Saves to disk (DirName != NULL) * or prints to debug log (DirName == NULL) * ACPI tables given by RsdPtr. * Takes tables from Xsdt if present or from Rsdt if Xsdt is not present. */
| 1235 | * Takes tables from Xsdt if present or from Rsdt if Xsdt is not present. |
| 1236 | */ |
| 1237 | VOID DumpTables(VOID *RsdPtrVoid, CONST CHAR16 *DirName) |
| 1238 | { |
| 1239 | EFI_STATUS Status; |
| 1240 | UINTN Length; |
| 1241 | INTN SsdtCount; |
| 1242 | CONST CHAR16 *FileNamePrefix; |
| 1243 | // |
| 1244 | // RSDP |
| 1245 | // Take it as Acpi 2.0, but take care that if RsdPtr->Revision == 0 |
| 1246 | // then it is actually Acpi 1.0 and fields after RsdtAddress (like XsdtAddress) |
| 1247 | // are not available |
| 1248 | // |
| 1249 | EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER* RsdPtr = (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER*)RsdPtrVoid; |
| 1250 | if (DirName != NULL) { |
| 1251 | DBG("Saving ACPI tables from RSDP %p to %ls ...\n", RsdPtr, DirName); |
| 1252 | } else { |
| 1253 | DBG("Printing ACPI tables from RSDP %p ...\n", RsdPtr); |
| 1254 | } |
| 1255 | |
| 1256 | if (RsdPtr->Signature != EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE) { |
| 1257 | DBG(" RsdPrt at %p has invaid signature 0x%llx - exiting.\n", RsdPtr, RsdPtr->Signature); |
| 1258 | return; |
| 1259 | } |
| 1260 | |
| 1261 | // Take Signature for printing |
| 1262 | CHAR8 Signature[9]; |
| 1263 | CopyMem(&Signature[0], &RsdPtr->Signature, 8); |
| 1264 | Signature[8] = 0; |
| 1265 | |
| 1266 | // Take Rsdt and Xsdt |
| 1267 | Rsdt = NULL; |
| 1268 | Xsdt = NULL; |
| 1269 | |
| 1270 | DBG(" %p: '%s', Rev: %d", RsdPtr, Signature, RsdPtr->Revision); |
| 1271 | if (RsdPtr->Revision == 0) { |
| 1272 | // Acpi 1.0 |
| 1273 | Length = sizeof(EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER); |
| 1274 | DBG(" (Acpi 1.0)"); |
| 1275 | } else { |
| 1276 | // Acpi 2.0 or newer |
| 1277 | Length = RsdPtr->Length; |
| 1278 | DBG(" (Acpi 2.0 or newer)"); |
| 1279 | } |
| 1280 | DBG(", Len: %llu", Length); |
| 1281 | |
| 1282 | // |
| 1283 | // Save RsdPtr |
| 1284 | // |
| 1285 | if (DirName != NULL && !IsTableSaved(RsdPtr)) { |
| 1286 | DBG(" -> RSDP.aml"); |
| 1287 | Status = SaveBufferToDisk(RsdPtr, Length, DirName, L"RSDP.aml"); |
| 1288 | MarkTableAsSaved(RsdPtr); |
| 1289 | if (EFI_ERROR(Status)) { |
| 1290 | DBG(" - %s\n", efiStrError(Status)); |
| 1291 | return; |
| 1292 | } |
| 1293 | } |
| 1294 | DBG("\n"); |
no test coverage detected