summaryrefslogtreecommitdiffstats
path: root/memtestEDK
diff options
context:
space:
mode:
authorRegina König2020-07-31 01:33:49 +0200
committerRegina König2020-07-31 01:33:49 +0200
commita3a58c125339d2d2a09d8a26fce5e97d87a0b80a (patch)
tree11fad31090b44248c2c899f8b0859bd096b87f5f /memtestEDK
parentHave some progress in search for file system protocol (diff)
downloadmemtest86-a3a58c125339d2d2a09d8a26fce5e97d87a0b80a.tar.gz
memtest86-a3a58c125339d2d2a09d8a26fce5e97d87a0b80a.tar.xz
memtest86-a3a58c125339d2d2a09d8a26fce5e97d87a0b80a.zip
seems that the desired protocol is there
Diffstat (limited to 'memtestEDK')
-rw-r--r--memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c131
1 files changed, 73 insertions, 58 deletions
diff --git a/memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c b/memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c
index c256dde..4a953c3 100644
--- a/memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c
+++ b/memtestEDK/Memtest/ProtocolInformation/ProtocolInformation.c
@@ -16,15 +16,20 @@ UefiMain (
EFI_STATUS efiStatus;
EFI_BOOT_SERVICES* bs = SystemTable->BootServices;
EFI_GUID sfspGuid = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID;
- EFI_HANDLE* handleBuffer = NULL;
+
+ EFI_HANDLE* handleBuffer = NULL;
+ EFI_HANDLE* handleBuffer2 = NULL;
UINTN handleCount = 0;
+ UINTN handleCount2 = 0;
UINTN handleIndex;
+
EFI_GUID **ProtocolGuidArray;
UINTN ArrayCount;
UINTN ProtocolIndex;
- //EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfo;
- //UINTN OpenInfoIndex;
- //UINTN OpenInfoCount;
+
+ EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfo;
+ UINTN OpenInfoIndex;
+ UINTN OpenInfoCount;
efiStatus = bs->LocateHandleBuffer (
AllHandles,
@@ -58,84 +63,94 @@ UefiMain (
EFI_GUID *guid = ProtocolGuidArray[ProtocolIndex];
UINT32 Data1;
- //UINT16 Data2;
- //UINT32 Data3;
- //UINT8 Data4[8];
+ UINT16 Data2;
+ UINT32 Data3;
+ UINT8 Data4[8];
Data1 = guid->Data1;
+ Data2 = guid->Data2;
+ Data3 = guid->Data3;
+ for (int i = 0; i < 8; i++) {
+ Data4[i] = guid->Data4[i];
+ }
+ // TODO compare the other values
if (Data1 == sfspData1) {
- Print(L"GUID: %x\n", Data1);
+ Print(L"GUID: %x-%x-%x-%x-%x-%x-%x-%x-%x-%x-%x\n", Data1, Data2, Data3, Data4[0], Data4[1],
+ Data4[2], Data4[3], Data4[4], Data4[5], Data4[6], Data4[7]);
Print(L"handleIndex: %d\n", handleIndex);
Print(L"ProtocolIndex: %d\n", ProtocolIndex);
+
+ //
+ // Retrieve the protocol instance for each protocol
+ //
+ efiStatus = bs->OpenProtocol (
+ handleBuffer[handleIndex],
+ ProtocolGuidArray[ProtocolIndex],
+ NULL,
+ ImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+
+ //
+ // Retrieve the list of agents that have opened each protocol
+ //
+ efiStatus = bs->OpenProtocolInformation (
+ handleBuffer[handleIndex],
+ ProtocolGuidArray[ProtocolIndex],
+ &OpenInfo,
+ &OpenInfoCount
+ );
}
- //
- // Retrieve the protocol instance for each protocol
- //
-
- /*efiStatus = bs->OpenProtocol (
- handleBuffer[handleIndex],
- ProtocolGuidArray[ProtocolIndex],
- NULL,
- ImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );*/
-
- //
- // Retrieve the list of agents that have opened each protocol
- //
- /*efiStatus = bs->OpenProtocolInformation (
- handleBuffer[handleIndex],
- ProtocolGuidArray[ProtocolIndex],
- &OpenInfo,
- &OpenInfoCount
- );
-*/ /* if (!EFI_ERROR (efiStatus)) {
-*/ /* for (OpenInfoIndex=0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) {*/
+ }
+ }
+
+ if (!EFI_ERROR (efiStatus)) {
+ for (OpenInfoIndex=0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) {
//
// 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) {
- bs->FreePool(OpenInfo);
- }*/
}
+ /*if (OpenInfo != NULL) { // TODO Why is it crashing when using FreePool?
+ bs->FreePool(OpenInfo);
+ Print(L"EFI_STATUS after FreePool(OpenInfo): %r\n", efiStatus);
+ }*/
}
- /* if (ProtocolGuidArray != NULL) {
+ /*if (ProtocolGuidArray != NULL) {
bs->FreePool(ProtocolGuidArray);
- }*/
-/* }*/
+ Print(L"EFI_STATUS after FreePool(ProtocolGuidArray): %r\n", efiStatus);
+ }*/
+ }
/*if (handleBuffer != NULL) {
- bs->FreePool (handleBuffer);
- }*/
- }
+ efiStatus = bs->FreePool(handleBuffer);
+ Print(L"EFI_STATUS after FreePool(handleBuffer): %r\n", efiStatus);
+ }*/
}
Print(L"sfps: %x\n", sfspData1);
- /* efiStatus = bs->LocateHandleBuffer(ByProtocol,
+ efiStatus = bs->LocateHandleBuffer(ByProtocol,
&sfspGuid,
NULL,
- &handleCount,
- &handles);
+ &handleCount2,
+ &handleBuffer2);
- Print(L"Handle count: %d\n", handleCount);
+ Print(L"Handle count: %d\n", handleCount2);
+
for (int index = 0; index < (int)handleCount; ++ index)
{
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL* fs = NULL;
+ //EFI_SIMPLE_FILE_SYSTEM_PROTOCOL* fs = NULL;
- Print(L"sfspGuid: %d\n", sfspGuid);
-
- efiStatus = bs->HandleProtocol( // TODO Should use OpenProtocol() in new implementations
+ /*efiStatus = bs->HandleProtocol( // TODO Should use OpenProtocol() in new implementations
handles[index],
&sfspGuid,
(void**)&fs
- );
- Print(L"Status after HandleProtocol: %r\n", efiStatus);
+ );*/
+ /*Print(L"Status after HandleProtocol: %r\n", efiStatus);
Print(L"Volume %d found\n", index);
Print(L"fs pointer: %p\n", fs);
EFI_FILE_PROTOCOL* root = NULL;
@@ -143,9 +158,9 @@ UefiMain (
Print(L"Status after open volume: %r\n", efiStatus);
EFI_GUID fsiGuid = EFI_FILE_SYSTEM_INFO_ID;
UINTN bufSize = 0;
- VOID* buffer = NULL;
+ VOID* buffer = NULL;*/
- efiStatus = root->GetInfo(
+ /*efiStatus = root->GetInfo(
root,
&fsiGuid,
&bufSize,
@@ -162,8 +177,8 @@ UefiMain (
root,
&fsiGuid,
&bufSize,
- &buffer);
-
+ &buffer);*/
+/*
Print(L"Status: %r\n", efiStatus);
EFI_FILE_SYSTEM_INFO* fhgf = buffer;
@@ -180,8 +195,8 @@ UefiMain (
Print(L"Number of handle found %d\n", (index + 1));
efiStatus = bs->FreePool((void **)&buffer);
- Print(L"efiStatus after FreePool: %r\n", efiStatus);
- }*/
+ Print(L"efiStatus after FreePool: %r\n", efiStatus);*/
+ }
/*
...