| 198 | } |
| 199 | |
| 200 | UINT64* ScanXSDT2(UINT32 Signature, UINT64 TableId, UINTN MatchIndex) |
| 201 | { |
| 202 | if (!Xsdt || (0 == Signature && 0 == TableId)) { |
| 203 | return NULL; |
| 204 | } |
| 205 | |
| 206 | UINT32 Count = XsdtTableCount(); |
| 207 | UINTN MatchingCount = 0; |
| 208 | UINT64* Ptr = XsdtEntryPtrFromIndex(0); |
| 209 | UINT64* EndPtr = XsdtEntryPtrFromIndex(Count); |
| 210 | for (; Ptr < EndPtr; Ptr++) { |
| 211 | EFI_ACPI_DESCRIPTION_HEADER* Table = (EFI_ACPI_DESCRIPTION_HEADER*)(UINTN)ReadUnaligned64(Ptr); |
| 212 | if (!Table) { |
| 213 | // skip NULL entry |
| 214 | continue; |
| 215 | } |
| 216 | if (0 == Signature || Table->Signature == Signature) { |
| 217 | if ((0 == TableId || Table->OemTableId == TableId) && (IGNORE_INDEX == MatchIndex || MatchingCount == MatchIndex)) { |
| 218 | return Ptr; // pointer to the matching entry |
| 219 | } |
| 220 | ++MatchingCount; |
| 221 | } |
| 222 | } |
| 223 | return NULL; |
| 224 | } |
| 225 | |
| 226 | UINT64* ScanXSDT(UINT32 Signature, UINT64 TableId) |
| 227 | { |
no test coverage detected