diff options
Diffstat (limited to 'memtestEDK')
3 files changed, 51 insertions, 12 deletions
diff --git a/memtestEDK/Memtest/ConfigurationTable/ConfigurationTable.c b/memtestEDK/Memtest/ConfigurationTable/ConfigurationTable.c index 905a21e..4d056d1 100644 --- a/memtestEDK/Memtest/ConfigurationTable/ConfigurationTable.c +++ b/memtestEDK/Memtest/ConfigurationTable/ConfigurationTable.c @@ -3,6 +3,22 @@ #include <Library/UefiLib.h> #include <Library/UefiApplicationEntryPoint.h> +EFI_GUID EFI_ACPI_20_TABLE_GUID = {0x8868e871,0xe4f1,0x11d3, {0xbc,0x22,0x0,0x80,0xc7,0x3c,0x88,0x81}}; +EFI_GUID ACPI_TABLE_GUID = {0xeb9d2d30,0x2d88,0x11d3, {0x9a,0x16,0x0,0x90,0x27,0x3f,0xc1,0x4d}}; +EFI_GUID SAL_SYSTEM_TABLE_GUID = {0xeb9d2d32,0x2d88,0x11d3, {0x9a,0x16,0x0,0x90,0x27,0x3f,0xc1,0x4d}}; +EFI_GUID SMBIOS_TABLE_GUID = {0xeb9d2d31,0x2d88,0x11d3, {0x9a,0x16,0x0,0x90,0x27,0x3f,0xc1,0x4d}}; +EFI_GUID MPS_TABLE_GUID = {0xeb9d2d2f,0x2d88,0x11d3, {0x9a,0x16,0x0,0x90,0x27,0x3f,0xc1,0x4d}}; +EFI_GUID EFI_ACPI_TABLE_GUID = {0x8868e871,0xe4f1,0x11d3, {0xbc,0x22,0x0,0x80,0xc7,0x3c,0x88,0x81}}; +EFI_GUID ACPI_10_TABLE_GUID = {0xeb9d2d30,0x2d88,0x11d3, {0x9a,0x16,0x0,0x90,0x27,0x3f,0xc1,0x4d}}; + +BOOLEAN compareGUID(EFI_GUID guid1, EFI_GUID guid2) { + if (guid1.Data1 == guid2.Data1 && guid1.Data2 == guid2.Data2) { + return TRUE; + } else { + return FALSE; + } + +} EFI_STATUS EFIAPI @@ -11,21 +27,42 @@ UefiMain ( IN EFI_SYSTEM_TABLE *SystemTable ) { - Print(L"This is the Memtest Application\n"); + Print(L"Application to get ConfigurationTable\n"); EFI_SYSTEM_TABLE *st = SystemTable; EFI_CONFIGURATION_TABLE *ct = st->ConfigurationTable; - EFI_GUID guid = ct->VendorGuid; - UINT32 data1 = guid.Data1; - // UINT16 data2 = guid.Data2; - // UINT16 data3 ; - // UINT8 data4[8]; + UINTN NumberOfTableEntries = SystemTable->NumberOfTableEntries; + + Print(L"Number of Table entries: %d\n", NumberOfTableEntries); + + for (int i = 0; i < NumberOfTableEntries; i++) { + + EFI_GUID guid = ct->VendorGuid; + + Print(L"GUID: %x-%x-%x-%x-%x-%x-%x-%x-%x-%x-%x", + guid.Data1, guid.Data2, guid.Data3, + guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], + guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]); + if (compareGUID(guid, EFI_ACPI_20_TABLE_GUID)) { + Print(L" EFI_ACPI_20_TABLE_GUID"); + } else if (compareGUID(guid, ACPI_TABLE_GUID)) { + Print(L" ACPI_TABLE_GUID"); + } else if (compareGUID(guid, SAL_SYSTEM_TABLE_GUID)) { + Print(L" SAL_SYSTEM_TABLE_GUID"); + } else if (compareGUID(guid, SMBIOS_TABLE_GUID)) { + Print(L" SMBIOS_TABLE_GUID"); + } else if (compareGUID(guid, MPS_TABLE_GUID)) { + Print(L" MPS_TABLE_GUID"); + } else if (compareGUID(guid, EFI_ACPI_TABLE_GUID)) { + Print(L" EFI_ACPI_TABLE_GUID"); + } else if (compareGUID(guid, ACPI_10_TABLE_GUID)) { + Print(L" ACPI_10_TABLE_GUID"); + } - // - // Use UefiLib Print API to print string to UEFI console - // - Print(L"Data1: %d\n", data1); + Print(L"\n"); + ct++; + } return EFI_SUCCESS; } diff --git a/memtestEDK/Memtest/GetMemoryMap/GetMemoryMap.c b/memtestEDK/Memtest/GetMemoryMap/GetMemoryMap.c index 3300552..6751af5 100644 --- a/memtestEDK/Memtest/GetMemoryMap/GetMemoryMap.c +++ b/memtestEDK/Memtest/GetMemoryMap/GetMemoryMap.c @@ -53,6 +53,7 @@ UefiMain ( */ Status = bs->GetMemoryMap(&MemoryMapSize, memoryMap, &LocalMapKey, &DescriptorSize, &DescriptorVersion); do { + bs->FreePool(memoryMap); Status = bs->AllocatePool(EfiLoaderData, (UINTN) (MemoryMapSize + 1) , (void **)&memoryMap); Status = bs->GetMemoryMap(&MemoryMapSize, memoryMap, &LocalMapKey, &DescriptorSize, &DescriptorVersion); } while (Status == EFI_BUFFER_TOO_SMALL); @@ -90,8 +91,9 @@ UefiMain ( counter++; } + bs->FreePool(memoryMap); - uint64_t MemoryMapSize = totalPages * 4096; + MemoryMapSize = totalPages * 4096; Print(L"Memory detected: %d MB\n\n", MemoryMapSize / 1024 / 1024); return EFI_SUCCESS; diff --git a/memtestEDK/Memtest/GetRootSystemDescriptionPointer/GetRootSystemDescriptionPointer.c b/memtestEDK/Memtest/GetRootSystemDescriptionPointer/GetRootSystemDescriptionPointer.c index b9e3e48..aca9b9c 100644 --- a/memtestEDK/Memtest/GetRootSystemDescriptionPointer/GetRootSystemDescriptionPointer.c +++ b/memtestEDK/Memtest/GetRootSystemDescriptionPointer/GetRootSystemDescriptionPointer.c @@ -33,7 +33,7 @@ UefiMain ( UINT16 Data2 = guid.Data2; UINT16 Data3 = guid.Data3; UINT8 Data4[8]; - Data4[0] = guid.Data4[0]; + Data4[0] = guid.Data4[0]; // TODO if (Data1 == 0xEB9D2D30) { // ACPI 1.0 |