| 288 | |
| 289 | |
| 290 | void DropTableFromRSDT(UINT32 Signature, UINT64 TableId, UINT32 Length) |
| 291 | { |
| 292 | if (!Rsdt || (0 == Signature && 0 == TableId)) { |
| 293 | return; |
| 294 | } |
| 295 | |
| 296 | CHAR8 sign[5], OTID[9]; |
| 297 | sign[4] = 0; |
| 298 | OTID[8] = 0; |
| 299 | CopyMem(&sign[0], &Signature, 4); |
| 300 | CopyMem(&OTID[0], &TableId, 8); |
| 301 | DBG("Drop tables from RSDT, SIGN=%s TableID=%s Length=%d\n", sign, OTID, (INT32)Length); |
| 302 | |
| 303 | UINT32 Count = RsdtTableCount(); |
| 304 | //DBG(" Rsdt has tables count=%d\n", Count); |
| 305 | UINT32* Ptr = RsdtEntryPtrFromIndex(0); |
| 306 | UINT32* EndPtr = RsdtEntryPtrFromIndex(Count); |
| 307 | for (; Ptr < EndPtr; Ptr++) { |
| 308 | EFI_ACPI_DESCRIPTION_HEADER* Table = (EFI_ACPI_DESCRIPTION_HEADER*)(UINTN)*Ptr; |
| 309 | if (!Table) { |
| 310 | // skip NULL entry |
| 311 | continue; |
| 312 | } |
| 313 | CopyMem(&sign[0], &Table->Signature, 4); |
| 314 | CopyMem(&OTID[0], &Table->OemTableId, 8); |
| 315 | //DBG(" Found table: %s %s\n", sign, OTID); |
| 316 | if (!((Signature && Table->Signature == Signature) && |
| 317 | (!TableId || Table->OemTableId == TableId) && |
| 318 | (!Length || Table->Length == Length))) { |
| 319 | continue; |
| 320 | } |
| 321 | if (IsXsdtEntryMerged(IndexFromXsdtEntryPtr(Ptr))) { |
| 322 | DBG(" attempt to drop already merged table[%d]: %s %s %d ignored\n", IndexFromXsdtEntryPtr(Ptr), sign, OTID, (INT32)Table->Length); |
| 323 | continue; |
| 324 | } |
| 325 | // drop matching table by simply replacing entry with NULL |
| 326 | *Ptr = 0; |
| 327 | DBG(" Table[%d]: %s %s %d dropped\n", IndexFromXsdtEntryPtr(Ptr), sign, OTID, (INT32)Table->Length); |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | void DropTableFromXSDT(UINT32 Signature, UINT64 TableId, UINT32 Length) |
| 332 | { |
no test coverage detected