Shubha Ramani
2015-07-23 20:59:37 UTC
Please see my code below.Â
If youâll notice, Iâm passing
In  EFI_SMBIOS_HANDLE InSmbiosHandle = 0xFFFE;EFI_SMBIOS_TYPE Type=160;
Which is as the header fileâSmbios.hâ and the protocol implementation âSmbiosDxe.câ
Instruct. According to myunderstanding, GetNext should return the address of the
First table whose Type=160. I used SmbiosView.efi and saw that indeed such a table
with Type=160 is present. I tried other valid Types too, though and the result is the same.
Â
What I expect to be returned isthe EFI_STATUS of âSuccessâ and the correct
Address for the SmbiosRecordwith type=160. Iâm getting neither. Iâm getting an EFI_STATUS
Code of 0xB58FBD02. At the veryleast, I would expect EFI_NOT_FOUND. According
To the protocol, this weird 0xB58FBD02should not be returned for EFI_STATUS.
I did search archives however,and it seems that others have had problems with Smbios GetNext,
With no resolution that I saw.
Â
The following two paths are the Smbios Protocolimplementation in the latest EDK2 repo:
Â
C:\edk2\MyWorkspace\MdeModulePkg\Universal\SmbiosDxe\SmbiosDxe.c
Â
C:\edk2\MyWorkspace\MdeModulePkg\Universal\SmbiosDxe\Smbios.h
Â
There is also a  shell toolC:\edk2\MyWorkspace\ShellPkg\Library\UefiShellDebug1CommandsLib\Sm
biosView which does not use the Smbios protocol at all. Itseems to use a backdoor approach of
internal data structures. I wonder why ? Is this because theSmbios protocol doesnât work ?
Â
We would like to use the Smbios Protocol because itâs simpleand provides what we need.
We would like to avoid the backdoor approach embraced bySmbiosview if possible.
Â
Can someone comment on my issue ? Am I using GetNextincorrectly ?
Â
EFI_STATUSEFIAPISmbiosMain ( IN EFI_HANDLE     ImageHandle, IN EFI_SYSTEM_TABLE  *SystemTable ){
 EFI_SMBIOS_PROTOCOL    Smb; EFI_STATUS Status = EFI_SUCCESS; EFI_SMBIOS_HANDLE InSmbiosHandle = 0xFFFE; EFI_SMBIOS_TYPE  Type=160; EFI_SMBIOS_TABLE_HEADER  *SmbiosRecord = NULL; KNL_GENERAL_INFORMATION knl; UINT16 size = 0;  Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **) &Smb);
 if (EFI_ERROR (Status)) {  return Status; }
  Print(L"Status after  gBS->LocateProtocol: %r\n", Status);
 SmbiosRecord = AllocateZeroPool (sizeof(EFI_SMBIOS_TABLE_HEADER));   Status = Smb.GetNext (&Smb, &InSmbiosHandle, &Type, &SmbiosRecord, NULL);
 Print(L"Status after SmbiosProtocol->GetNext: %r\n", Status); Â
   if (EFI_ERROR (Status)) {  return Status; }
 Print(L"Smbios In Handle: %d\n", InSmbiosHandle); Print(L"SmbiosRecord Address : 0X%llx\n", &SmbiosRecord); Print(L"SmbiosRecord->Type : %d\n", SmbiosRecord->Type); Print(L"SmbiosRecord->Length : %d\n\n", SmbiosRecord->Length);  Print(L"SmbiosRecord->Handle : %d\n\n", SmbiosRecord->Handle); Print(L"Sizeof SmbiosRecord : %d\n", sizeof(SmbiosRecord));
  FreePool (SmbiosRecord);   return EFI_SUCCESS; Shubha D. ***@gmail.com
***@yahoo.com
If youâll notice, Iâm passing
In  EFI_SMBIOS_HANDLE InSmbiosHandle = 0xFFFE;EFI_SMBIOS_TYPE Type=160;
Which is as the header fileâSmbios.hâ and the protocol implementation âSmbiosDxe.câ
Instruct. According to myunderstanding, GetNext should return the address of the
First table whose Type=160. I used SmbiosView.efi and saw that indeed such a table
with Type=160 is present. I tried other valid Types too, though and the result is the same.
Â
What I expect to be returned isthe EFI_STATUS of âSuccessâ and the correct
Address for the SmbiosRecordwith type=160. Iâm getting neither. Iâm getting an EFI_STATUS
Code of 0xB58FBD02. At the veryleast, I would expect EFI_NOT_FOUND. According
To the protocol, this weird 0xB58FBD02should not be returned for EFI_STATUS.
I did search archives however,and it seems that others have had problems with Smbios GetNext,
With no resolution that I saw.
Â
The following two paths are the Smbios Protocolimplementation in the latest EDK2 repo:
Â
C:\edk2\MyWorkspace\MdeModulePkg\Universal\SmbiosDxe\SmbiosDxe.c
Â
C:\edk2\MyWorkspace\MdeModulePkg\Universal\SmbiosDxe\Smbios.h
Â
There is also a  shell toolC:\edk2\MyWorkspace\ShellPkg\Library\UefiShellDebug1CommandsLib\Sm
biosView which does not use the Smbios protocol at all. Itseems to use a backdoor approach of
internal data structures. I wonder why ? Is this because theSmbios protocol doesnât work ?
Â
We would like to use the Smbios Protocol because itâs simpleand provides what we need.
We would like to avoid the backdoor approach embraced bySmbiosview if possible.
Â
Can someone comment on my issue ? Am I using GetNextincorrectly ?
Â
EFI_STATUSEFIAPISmbiosMain ( IN EFI_HANDLE     ImageHandle, IN EFI_SYSTEM_TABLE  *SystemTable ){
 EFI_SMBIOS_PROTOCOL    Smb; EFI_STATUS Status = EFI_SUCCESS; EFI_SMBIOS_HANDLE InSmbiosHandle = 0xFFFE; EFI_SMBIOS_TYPE  Type=160; EFI_SMBIOS_TABLE_HEADER  *SmbiosRecord = NULL; KNL_GENERAL_INFORMATION knl; UINT16 size = 0;  Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **) &Smb);
 if (EFI_ERROR (Status)) {  return Status; }
  Print(L"Status after  gBS->LocateProtocol: %r\n", Status);
 SmbiosRecord = AllocateZeroPool (sizeof(EFI_SMBIOS_TABLE_HEADER));   Status = Smb.GetNext (&Smb, &InSmbiosHandle, &Type, &SmbiosRecord, NULL);
 Print(L"Status after SmbiosProtocol->GetNext: %r\n", Status); Â
   if (EFI_ERROR (Status)) {  return Status; }
 Print(L"Smbios In Handle: %d\n", InSmbiosHandle); Print(L"SmbiosRecord Address : 0X%llx\n", &SmbiosRecord); Print(L"SmbiosRecord->Type : %d\n", SmbiosRecord->Type); Print(L"SmbiosRecord->Length : %d\n\n", SmbiosRecord->Length);  Print(L"SmbiosRecord->Handle : %d\n\n", SmbiosRecord->Handle); Print(L"Sizeof SmbiosRecord : %d\n", sizeof(SmbiosRecord));
  FreePool (SmbiosRecord);   return EFI_SUCCESS; Shubha D. ***@gmail.com
***@yahoo.com