diff options
-rw-r--r-- | documentation/UEFI_from_spec/EFI_BOOT_SERVICES | 2 | ||||
-rw-r--r-- | efi_memtest/memtest86+/efi/logger.c | 40 | ||||
-rw-r--r-- | memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c | 73 | ||||
-rwxr-xr-x | memtestEDK/Memtest/run.sh | 2 |
4 files changed, 78 insertions, 39 deletions
diff --git a/documentation/UEFI_from_spec/EFI_BOOT_SERVICES b/documentation/UEFI_from_spec/EFI_BOOT_SERVICES index d50840d..44fe43f 100644 --- a/documentation/UEFI_from_spec/EFI_BOOT_SERVICES +++ b/documentation/UEFI_from_spec/EFI_BOOT_SERVICES @@ -32,7 +32,7 @@ typedef struct { EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface Installs a protocol interface on a device handle EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface Reinstalls a protocol interface on a device handle EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface Removes a protocol interface from a device handle - EFI_HANDLE_PROTOCOL HandleProtocol ProtocolQueries a handle to determine if it supports + EFI_HANDLE_PROTOCOL HandleProtocol Queries a handle to determine if it supports a specified protocol VOID* Reserved Reserved. Must be NULLs EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify Registers an event that is to be signaled whenever an interface is diff --git a/efi_memtest/memtest86+/efi/logger.c b/efi_memtest/memtest86+/efi/logger.c index 3895822..575ce58 100644 --- a/efi_memtest/memtest86+/efi/logger.c +++ b/efi_memtest/memtest86+/efi/logger.c @@ -1,7 +1,45 @@ #include "Uefi.h" #include "Library/UefiLib.h" -// TODO use ConOut +/*UINTN +InternalPrint ( + IN CONST CHAR16 *Format, + IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console, + IN VA_LIST Marker + ) +{ + EFI_STATUS Status; + UINTN Return; + CHAR16 *Buffer; + UINTN BufferSize; + + ASSERT (Format != NULL); + ASSERT (((UINTN) Format & BIT0) == 0); + ASSERT (Console != NULL); + + BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16); + + Buffer = (CHAR16 *) AllocatePool(BufferSize); + ASSERT (Buffer != NULL); + + Return = UnicodeVSPrint (Buffer, BufferSize, Format, Marker); + + if (Console != NULL && Return > 0) { + // + // To be extra safe make sure Console has been initialized + // + Status = Console->OutputString (Console, Buffer); + if (EFI_ERROR (Status)) { + Return = 0; + } + } + + FreePool (Buffer); + + return Return; +}*/ + +// TODO use ConOut gST->ConOut->OutputString() ; // TODO switch print to file or print to console void print_log(char *msg, const int length) { diff --git a/memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c b/memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c index 20ac4bc..c60fbbd 100644 --- a/memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c +++ b/memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c @@ -12,52 +12,53 @@ UefiMain ( IN EFI_SYSTEM_TABLE *SystemTable ) { -/* - EFI_STATUS efiStatus; + EFI_STATUS efiStatus; EFI_BOOT_SERVICES* bs = SystemTable->BootServices; - EFI_GUID sfspGuid = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID; + //EFI_GUID sfspGuid = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID; EFI_HANDLE* handleBuffer = NULL; UINTN handleCount = 0; - UINTN HandleIndex; + UINTN handleIndex; EFI_GUID **ProtocolGuidArray; UINTN ArrayCount; - UINTN ProtocolIndex; - EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfo; - UINTN OpenInfoIndex; - UINTN OpenInfoCount; + //UINTN ProtocolIndex; + //EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfo; + //UINTN OpenInfoIndex; + //UINTN OpenInfoCount; efiStatus = bs->LocateHandleBuffer ( AllHandles, NULL, NULL, - handleCount, + &handleCount, &handleBuffer ); - Print(L"Number of handles found: %d\n", handleCount); + Print(L"EFI_STATUS after LocateHandleBuffer: %r\n", efiStatus); + Print(L"Number of handles found: %d\n", handleCount); // Last time: 182 if (!EFI_ERROR (efiStatus)) { - for (HandleIndex = 0; HandleIndex < handleCount; HandleIndex++) { + for (handleIndex = 0; handleIndex < handleCount; handleIndex++) { // // Retrieve the list of all the protocols on each handle // - efiStatus = bs->ProtocolsPerHandle ( - handleBuffer[HandleIndex], - &ProtocolGuidArray, - &ArrayCount - ); + efiStatus = bs->ProtocolsPerHandle ( + handleBuffer[handleIndex], + &ProtocolGuidArray, + &ArrayCount + ); - Print(L"Number of Protocols per Handle: %d\n", ArrayCount); + Print(L"EFI_STATUS after ProtocolsPerHandle: %r\n", efiStatus); + Print(L"Number of Protocols per Handle: %d\n", ArrayCount); - if (!EFI_ERROR (efiStatus)) { - for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) { +/* if (!EFI_ERROR (efiStatus)) { +*/ /*for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) { // // Retrieve the protocol instance for each protocol // efiStatus = bs->OpenProtocol ( - handleBuffer[HandleIndex], + handleBuffer[handleIndex], ProtocolGuidArray[ProtocolIndex], NULL, ImageHandle, @@ -68,35 +69,35 @@ UefiMain ( // Retrieve the list of agents that have opened each protocol // efiStatus = bs->OpenProtocolInformation ( - handleBuffer[HandleIndex], + handleBuffer[handleIndex], ProtocolGuidArray[ProtocolIndex], &OpenInfo, &OpenInfoCount - ); - if (!EFI_ERROR (efiStatus)) { + );*/ + /* if (!EFI_ERROR (efiStatus)) { for (OpenInfoIndex=0;OpenInfoIndex<OpenInfoCount;OpenInfoIndex++) { // - // HandleBuffer[HandleIndex] is the handle + // HandleBuffer[handleIndex] is the handle // ProtocolGuidArray[ProtocolIndex] is the protocol GUID // Instance is the protocol instance for the protocol // OpenInfo[OpenInfoIndex] is an agent that has opened a protocol // - } - if (OpenInfo != NULL) { + }*/ + /*if (OpenInfo != NULL) { bs->FreePool(OpenInfo); - } - } - } - if (ProtocolGuidArray != NULL) { + }*/ + /* } + }*/ + /* if (ProtocolGuidArray != NULL) { bs->FreePool(ProtocolGuidArray); - } - } - if (handleBuffer != NULL) { + }*/ +/* }*/ + /*if (handleBuffer != NULL) { bs->FreePool (handleBuffer); - } - } + }*/ + } } -*/ + /* efiStatus = bs->LocateHandleBuffer(ByProtocol, &sfspGuid, NULL, diff --git a/memtestEDK/Memtest/run.sh b/memtestEDK/Memtest/run.sh index f9a3f01..6d98a65 100755 --- a/memtestEDK/Memtest/run.sh +++ b/memtestEDK/Memtest/run.sh @@ -3,7 +3,7 @@ (cd ..;. edksetup.sh BaseTools; build -a X64 -p MdeModulePkg/MdeModulePkg.dsc) if [ $? -ne 0 ]; then exit 1; fi -(cd ..; cp Build/MdeModule/DEBUG_GCC5/X64/GetRootSystemDescriptionPointer.efi ../../git/working_dir/memtest86/test_code/hda-contents/) +(cd ..; cp Build/MdeModule/DEBUG_GCC5/X64/ProtocolInformation.efi ../../git/working_dir/memtest86/test_code/hda-contents/) if [ $? -ne 0 ]; then exit 1; fi (cd ../../../git/working_dir/memtest86/test_code; sudo ./run.sh ) |