MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / SaveOemTables

Function SaveOemTables

rEFIt_UEFI/Platform/AcpiPatcher.cpp:1438–1491  ·  view source on GitHub ↗

Saves OEM ACPI tables to disk. * Searches BIOS, then UEFI Sys.Tables for Acpi 2.0 or newer tables, then for Acpi 1.0 tables * CloverEFI: * - saves first one found, dump others to log * UEFI: * - saves first one found in UEFI Sys.Tables, dump others to log * * Dumping of other tables to log can be removed if it turns out that there is no value in doing it. */

Source from the content-addressed store, hash-verified

1436 * Dumping of other tables to log can be removed if it turns out that there is no value in doing it.
1437 */
1438VOID SaveOemTables()
1439{
1440// EFI_STATUS Status;
1441 VOID *RsdPtr;
1442 XStringW AcpiOriginPath = SWPrintf("%ls\\ACPI\\origin", OEMPath.wc_str());
1443 BOOLEAN Saved = FALSE;
1444 CHAR8 *MemLogStart;
1445 UINTN MemLogStartLen;
1446
1447 MemLogStartLen = GetMemLogLen();
1448 MemLogStart = GetMemLogBuffer() + MemLogStartLen;
1449 //
1450 // Search in BIOS
1451 // CloverEFI - Save
1452 // UEFI - just print to log
1453 //
1454 // RsdPtr = NULL;
1455 RsdPtr = FindAcpiRsdPtr();
1456 if (RsdPtr != NULL) {
1457 DBG("Found BIOS RSDP at %p\n", RsdPtr);
1458 if (gFirmwareClover) {
1459 // Save it
1460 DumpTables(RsdPtr, AcpiOriginPath.wc_str());
1461 Saved = TRUE;
1462 } else {
1463 // just print to log
1464 DumpTables(RsdPtr, NULL);
1465 }
1466 }
1467 //
1468 // Search Acpi 2.0 or newer in UEFI Sys.Tables
1469 //
1470 RsdPtr = NULL;
1471 /*Status = */EfiGetSystemConfigurationTable (&gEfiAcpi20TableGuid, &RsdPtr);
1472 if (RsdPtr != NULL) { //it may be EFI_SUCCESS but null pointer
1473 DBG("Found UEFI Acpi 2.0 RSDP at %p\n", RsdPtr);
1474 // if tables already saved, then just print to log
1475 DumpTables(RsdPtr, Saved ? NULL : AcpiOriginPath.wc_str());
1476 Saved = TRUE;
1477 }
1478 //
1479 // Then search Acpi 1.0 UEFI Sys.Tables
1480 //
1481 RsdPtr = NULL;
1482 /*Status = */EfiGetSystemConfigurationTable (&gEfiAcpi10TableGuid, &RsdPtr);
1483 if (RsdPtr != NULL) {
1484 DBG("Found UEFI Acpi 1.0 RSDP at %p\n", RsdPtr);
1485 // if tables already saved, then just print to log
1486 DumpTables(RsdPtr, Saved ? NULL : AcpiOriginPath.wc_str());
1487 // Saved = TRUE;
1488 }
1489 SaveBufferToDisk(MemLogStart, GetMemLogLen() - MemLogStartLen, AcpiOriginPath.wc_str(), L"DumpLog.txt");
1490 FreePool(mSavedTables);
1491}
1492
1493VOID SaveOemDsdt(BOOLEAN FullPatch)
1494{

Callers 1

RunGenericMenuMethod · 0.85

Calls 8

SWPrintfFunction · 0.85
GetMemLogLenFunction · 0.85
DumpTablesFunction · 0.85
SaveBufferToDiskFunction · 0.85
FindAcpiRsdPtrFunction · 0.70
FreePoolFunction · 0.50
wc_strMethod · 0.45

Tested by

no test coverage detected