ReplaceName(dsdt, len, "AZAL", "HDEF");
| 1515 | |
| 1516 | //ReplaceName(dsdt, len, "AZAL", "HDEF"); |
| 1517 | INTN ReplaceName(UINT8 *dsdt, UINT32 len, CONST CHAR8 *OldName, CONST CHAR8 *NewName) |
| 1518 | { |
| 1519 | UINTN i; |
| 1520 | INTN j = 0; |
| 1521 | for (i = 0; len >= 4 && i < len - 4; i++) { |
| 1522 | if ((dsdt[i+0] == NewName[0]) && (dsdt[i+1] == NewName[1]) && |
| 1523 | (dsdt[i+2] == NewName[2]) && (dsdt[i+3] == NewName[3])) { |
| 1524 | if (OldName) { |
| 1525 | MsgLog("NewName %s already present, renaming impossible\n", NewName); |
| 1526 | } else { |
| 1527 | DBG("name %s present at %llX\n", NewName, i); |
| 1528 | } |
| 1529 | return -1; |
| 1530 | } |
| 1531 | } |
| 1532 | if (!OldName) { |
| 1533 | return 0; |
| 1534 | } |
| 1535 | |
| 1536 | for (i = 0; len >= 4 && i < len - 4; i++) { |
| 1537 | if ((dsdt[i+0] == OldName[0]) && (dsdt[i+1] == OldName[1]) && |
| 1538 | (dsdt[i+2] == OldName[2]) && (dsdt[i+3] == OldName[3])) { |
| 1539 | MsgLog("Name %s present at 0x%llX, renaming to %s\n", OldName, i, NewName); |
| 1540 | dsdt[i+0] = NewName[0]; |
| 1541 | dsdt[i+1] = NewName[1]; |
| 1542 | dsdt[i+2] = NewName[2]; |
| 1543 | dsdt[i+3] = NewName[3]; |
| 1544 | j++; |
| 1545 | } |
| 1546 | } |
| 1547 | return j; //number of replacement |
| 1548 | } |
| 1549 | |
| 1550 | //the procedure search nearest "Device" code before given address |
| 1551 | //should restrict the search by 6 bytes... OK, 10, .. until dsdt begin |
no outgoing calls
no test coverage detected