Hi,
This worked well for me! Adding the line Maurice mentioned in the previous message I can
get BIOS information using the command “dmidecode -t bios -q”.
Thank you all for your help.
________________________________
De: Ma, Maurice <maurice.ma(a)intel.com>
Enviado: martes, 10 de marzo de 2020 16:37
Para: Gustavo Plaza Roma <gustavo_plaza_(a)hotmail.com>; Dong, Guo
<guo.dong(a)intel.com>; sbl-devel(a)lists.01.org <sbl-devel(a)lists.01.org>
Asunto: RE: Help. SBL versioning
Hi,
There is one more thing missing in your patch.
Since you are using OsLoader to boot Linux instead of UEFI payload, you will need to keep
a SMBIOS entry record at legacy F segment so that non-UEFI boot can find the SMBIOS table
accordingly.
You can try to add the following. I can try to submit a PR in the open source SBL to add
this part. 0xFFF60 is hardcoded here for SMBIOS. We do the similar for ACPI table at
address 0xFFF80.
diff --git a/BootloaderCorePkg/Library/SmbiosInitLib/SmbiosInitLib.c
b/BootloaderCorePkg/Library/SmbiosInitLib/SmbiosInitLib.c
index 4b667ed8bfca..7684b8cf75d0 100644
--- a/BootloaderCorePkg/Library/SmbiosInitLib/SmbiosInitLib.c
+++ b/BootloaderCorePkg/Library/SmbiosInitLib/SmbiosInitLib.c
@@ -151,6 +151,11 @@ FinalizeSmbios (
SmbiosEntry->IntermediateChecksum = CalculateCheckSum8 ((UINT8 *)SmbiosEntry
+ 0x10, sizeof (SMBIOS_TABLE_ENTRY_POINT) - 0x10);
SmbiosEntry->EntryPointStructureChecksum = CalculateCheckSum8 ((UINT8 *)SmbiosEntry
, sizeof (SMBIOS_TABLE_ENTRY_POINT) );
+ //
+ // Keep a copy in legacy F segment so that non-UEFI can locate it
+ //
+ CopyMem ((VOID *)0xFFF60, SmbiosEntry, sizeof (SMBIOS_TABLE_ENTRY_POINT));
+
return Status;
}
Thanks
Maurice
From: Gustavo Plaza Roma <gustavo_plaza_(a)hotmail.com>
Sent: Tuesday, March 10, 2020 8:23
To: Ma, Maurice <maurice.ma(a)intel.com>; Dong, Guo <guo.dong(a)intel.com>;
sbl-devel(a)lists.01.org
Subject: RE: Help. SBL versioning
Hi,
The platform I am using is Apollolake. I have added the function InitializeSmbiosInfo from
https://github.com/slimbootloader/slimbootloader/blob/master/Platform/Cof...
to
https://github.com/slimbootloader/slimbootloader/blob/master/Platform/Apo...
and I call this function from BoardInit.
I have modified the file
https://github.com/slimbootloader/slimbootloader/blob/master/Platform/Apo...
including the following lines:
gPlatformModuleTokenSpaceGuid.PcdSmbiosStringsPtr
gPlatformModuleTokenSpaceGuid.PcdSmbiosStringsCnt
gPlatformModuleTokenSpaceGuid.PcdSmbiosTablesBase
gPlatformModuleTokenSpaceGuid.PcdSmbiosEnabled
I have also added the line “self.ENABLE_SMBIOS = 1” in
https://github.com/slimbootloader/slimbootloader/blob/master/Platform/Apo...
After all of this, I boot the system but when I try run “dmidecode -t bios -q” the output
is empty. If I run “dmidecode” without parameters I get:
# dmidecode 3.1
Scanning /dev/mem for entry point.
# No SMBIOS nor DMI entry point found, sorry.
I attach part of the modified files (maybe the patch is not correct, I think some include
files are not necessary):
diff --git a/Platform/ApollolakeBoardPkg/BoardConfig.py
b/Platform/ApollolakeBoardPkg/BoardConfig.py
index fe2fdb9..f8e8d56 100755
--- a/Platform/ApollolakeBoardPkg/BoardConfig.py
+++ b/Platform/ApollolakeBoardPkg/BoardConfig.py
@@ -42,6 +42,8 @@ class Board(BaseBoard):
self.HAVE_MEASURED_BOOT = 1
self.HAVE_SEED_LIST = 0
self.HAVE_PSD_TABLE = 1
+ self.ENABLE_SMBIOS = 1
+
self.ENABLE_FSP_LOAD_IMAGE = 0
self.ENABLE_CRYPTO_SHA_NI = 1
diff --git a/Platform/ApollolakeBoardPkg/Library/Stage2BoardInitLib/Stage2BoardInitLib.c
b/Platform/ApollolakeBoardPkg/Library/Stage2BoardInitLib/Stage2BoardInitLib.c
index cb5af84..98b7eab 100644
--- a/Platform/ApollolakeBoardPkg/Library/Stage2BoardInitLib/Stage2BoardInitLib.c
+++ b/Platform/ApollolakeBoardPkg/Library/Stage2BoardInitLib/Stage2BoardInitLib.c
@@ -7,6 +7,56 @@
#include "Stage2BoardInitLib.h"
+
+
+#include <PiPei.h>
+#include <Library/BaseLib.h>
+#include <Library/PciLib.h>
+#include <Library/PcdLib.h>
+#include <Library/IoLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/BlMemoryAllocationLib.h>
+#include <Library/DebugLib.h>
+#include <Library/SpiFlashLib.h>
+#include <Library/SocInitLib.h>
+#include <Library/BoardInitLib.h>
+#include <Library/SerialPortLib.h>
+#include <Guid/GraphicsInfoHob.h>
+#include <Guid/SystemTableInfoGuid.h>
+#include <Guid/SerialPortInfoGuid.h>
+#include <FspsUpd.h>
+#include <Library/BootloaderCoreLib.h>
+#include <IndustryStandard/Acpi.h>
+#include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
+#include <BlCommon.h>
+#include <Guid/BootLoaderServiceGuid.h>
+#include <Library/SpiBlockIoLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Service/SpiFlashService.h>
+#include <Library/PrintLib.h>
+#include <ConfigDataDefs.h>
+#include <Library/ConfigDataLib.h>
+#include <Library/IgdOpRegionLib.h>
+#include <Library/VariableLib.h>
+#include <Guid/SmmInformationGuid.h>
+#include <Library/TpmLib.h>
+#include <PlatformBase.h>
+#include <Library/SiGpioLib.h>
+#include <RegAccess.h>
+#include <Library/HobLib.h>
+#include <Library/FirmwareUpdateLib.h>
+#include <Library/MpInitLib.h>
+#include <Guid/GraphicsInfoHob.h>
+#include <Library/PciCf8Lib.h>
+#include <Library/BoardSupportLib.h>
+#include <PlatformData.h>
+#include <PsdLib.h>
+#include <Library/SmbiosInitLib.h>
+#include <IndustryStandard/SmBios.h>
+#include <VerInfo.h>
+#include <Library/PchSpiLib.h>
+#include <Register/RegsSpi.h>
+
#define VBT_OFFSET 36
UINT32 mOtgDualRoleCfg0 = 0;
@@ -97,6 +147,150 @@ CreateNhltAcpiTable (
return PlatformService->AcpiTableUpdate ((UINT8 *)Table, Table->Header.Length);
}
+
+
+/**
+ Add a Smbios type string into a buffer
+
+**/
+STATIC
+EFI_STATUS
+AddSmbiosTypeString (
+ SMBIOS_TYPE_STRINGS *Dest,
+ UINT8 Type,
+ UINT8 Index,
+ CHAR8 *String
+ )
+{
+ UINTN Length;
+
+ Dest->Type = Type;
+ Dest->Idx = Index;
+ if (String != NULL) {
+ Length = AsciiStrLen (String);
+
+ Dest->String = (CHAR8 *)AllocateZeroPool (Length + 1);
+ if (Dest->String == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ CopyMem (Dest->String, String, Length);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Initialize necessary information for Smbios
+
+ @retval EFI_SUCCESS Initialized necessary information successfully
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory for Smbios info
+
+**/
+EFI_STATUS
+InitializeSmbiosInfo (
+ VOID
+ )
+{
+ CHAR8 TempStrBuf[SMBIOS_STRING_MAX_LENGTH];
+ UINT16 Index;
+ UINT16 PlatformId;
+ UINTN Length;
+ SMBIOS_TYPE_STRINGS *TempSmbiosStrTbl;
+ BOOT_LOADER_VERSION *VerInfoTbl;
+ VOID *SmbiosStringsPtr;
+
+ Index = 0;
+ PlatformId = GetPlatformId ();
+ TempSmbiosStrTbl = (SMBIOS_TYPE_STRINGS *) AllocateTemporaryMemory (0);
+ VerInfoTbl = GetLoaderGlobalDataPointer()->VerInfoPtr;
+
+ //
+ // SMBIOS_TYPE_BIOS_INFORMATION
+ //
+
+ AddSmbiosTypeString (&TempSmbiosStrTbl[Index++], SMBIOS_TYPE_BIOS_INFORMATION,
+ 1, "Intel Corporation");
+ if (VerInfoTbl != NULL) {
+ AsciiSPrint (TempStrBuf, sizeof (TempStrBuf),
+ "SB_CFL.%03d.%03d.%03d.%03d.%03d.%05d.%c-%016lX%a\0",
+ VerInfoTbl->ImageVersion.SecureVerNum,
+ VerInfoTbl->ImageVersion.CoreMajorVersion,
+ VerInfoTbl->ImageVersion.CoreMinorVersion,
+ VerInfoTbl->ImageVersion.ProjMajorVersion,
+ VerInfoTbl->ImageVersion.ProjMinorVersion,
+ VerInfoTbl->ImageVersion.BuildNumber,
+ VerInfoTbl->ImageVersion.BldDebug ? 'D' : 'R',
+ VerInfoTbl->SourceVersion,
+ VerInfoTbl->ImageVersion.Dirty ? "-dirty" : "");
+ } else {
+ AsciiSPrint (TempStrBuf, sizeof (TempStrBuf), "%a\0",
"Unknown");
+ }
+ AddSmbiosTypeString (&TempSmbiosStrTbl[Index++], SMBIOS_TYPE_BIOS_INFORMATION,
+ 2, TempStrBuf);
+ AddSmbiosTypeString (&TempSmbiosStrTbl[Index++], SMBIOS_TYPE_BIOS_INFORMATION,
+ 3, "Unknown date");
+
+ //
+ // SMBIOS_TYPE_SYSTEM_INFORMATION
+ //
+ AddSmbiosTypeString (&TempSmbiosStrTbl[Index++], SMBIOS_TYPE_SYSTEM_INFORMATION,
+ 1, "Intel Corporation");
+ if ((PlatformId == PLATFORM_ID_UC100)) {
+ AsciiSPrint (TempStrBuf, sizeof (TempStrBuf), "%a\0", "UC100 Client
Platform");
+ } else {
+ AsciiSPrint (TempStrBuf, sizeof (TempStrBuf), "%a\0",
"Unknown");
+ }
+ AddSmbiosTypeString (&TempSmbiosStrTbl[Index++], SMBIOS_TYPE_SYSTEM_INFORMATION,
+ 2, TempStrBuf);
+ AddSmbiosTypeString (&TempSmbiosStrTbl[Index++], SMBIOS_TYPE_SYSTEM_INFORMATION,
+ 3, "0.1");
+ AddSmbiosTypeString (&TempSmbiosStrTbl[Index++], SMBIOS_TYPE_SYSTEM_INFORMATION,
+ 4, "System Serial Number");
+ AddSmbiosTypeString (&TempSmbiosStrTbl[Index++], SMBIOS_TYPE_SYSTEM_INFORMATION,
+ 5, "System SKU Number");
+ AddSmbiosTypeString (&TempSmbiosStrTbl[Index++], SMBIOS_TYPE_SYSTEM_INFORMATION,
+ 6, "CannonLake Client System");
+
+ //
+ // SMBIOS_TYPE_BASEBOARD_INFORMATION
+ //
+ AddSmbiosTypeString (&TempSmbiosStrTbl[Index++],
SMBIOS_TYPE_BASEBOARD_INFORMATION,
+ 1, "Intel Corporation");
+ if (PlatformId == PLATFORM_ID_UC100) {
+ AsciiSPrint (TempStrBuf, sizeof (TempStrBuf), "%a\0", "UC100
Platform");
+ } else {
+ AsciiSPrint (TempStrBuf, sizeof (TempStrBuf), "%a\0",
"Unknown");
+ }
+ AddSmbiosTypeString (&TempSmbiosStrTbl[Index++],
SMBIOS_TYPE_BASEBOARD_INFORMATION,
+ 2, TempStrBuf);
+ AddSmbiosTypeString (&TempSmbiosStrTbl[Index++],
SMBIOS_TYPE_BASEBOARD_INFORMATION,
+ 3, "1");
+ AddSmbiosTypeString (&TempSmbiosStrTbl[Index++],
SMBIOS_TYPE_BASEBOARD_INFORMATION,
+ 4, "Board Serial Number");
+
+ //
+ // SMBIOS_TYPE_PROCESSOR_INFORMATION : TBD
+ //
+
+ //
+ // SMBIOS_TYPE_END_OF_TABLE
+ //
+ AddSmbiosTypeString (&TempSmbiosStrTbl[Index++], SMBIOS_TYPE_END_OF_TABLE,
+ 0, NULL);
+
+ Length = sizeof (SMBIOS_TYPE_STRINGS) * Index;
+ SmbiosStringsPtr = AllocatePool (Length);
+ if (SmbiosStringsPtr == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (SmbiosStringsPtr, TempSmbiosStrTbl, Length);
+ (VOID) PcdSet32S (PcdSmbiosStringsPtr, (UINT32)(UINTN)SmbiosStringsPtr);
+ (VOID) PcdSet16S (PcdSmbiosStringsCnt, Index);
+
+ return EFI_SUCCESS;
+}
+
/**
Print the output of the GPIO Config table that was read from CfgData.
@@ -724,6 +918,14 @@ BoardInit (
PciWrite8 (PCI_LIB_ADDRESS(SA_IGD_BUS, SA_IGD_DEV, SA_IGD_FUN_0,
PCI_COMMAND_OFFSET), \
EFI_PCI_COMMAND_MEMORY_SPACE | EFI_PCI_COMMAND_BUS_MASTER);
}
+
+ //
+ // Initialize Smbios Info for SmbiosInit
+ //
+ if (FeaturePcdGet (PcdSmbiosEnabled)) {
+ InitializeSmbiosInfo ();
+ }
+
BuildOsConfigDataHob ();
break;
case PostPciEnumeration:
@@ -1363,8 +1565,6 @@ UpdateLoaderPlatformInfo (
}
}
diff --git a/Platform/ApollolakeBoardPkg/Library/Stage2BoardInitLib/Stage2BoardInitLib.inf
b/Platform/ApollolakeBoardPkg/Library/Stage2BoardInitLib/Stage2BoardInitLib.inf
index a883d23..78acc0c 100644
--- a/Platform/ApollolakeBoardPkg/Library/Stage2BoardInitLib/Stage2BoardInitLib.inf
+++ b/Platform/ApollolakeBoardPkg/Library/Stage2BoardInitLib/Stage2BoardInitLib.inf
@@ -90,6 +90,10 @@
gPlatformCommonLibTokenSpaceGuid.PcdSeedListEnabled
gPlatformModuleTokenSpaceGuid.PcdPayloadReservedMemSize
gPlatformModuleTokenSpaceGuid.PcdPsdBiosEnabled
+ gPlatformModuleTokenSpaceGuid.PcdSmbiosStringsPtr
+ gPlatformModuleTokenSpaceGuid.PcdSmbiosStringsCnt
+ gPlatformModuleTokenSpaceGuid.PcdSmbiosTablesBase
+ gPlatformModuleTokenSpaceGuid.PcdSmbiosEnabled
gPlatformCommonLibTokenSpaceGuid.PcdVerifiedBootEnabled
gPlatformCommonLibTokenSpaceGuid.PcdMeasuredBootEnabled
gPlatformModuleTokenSpaceGuid.PcdSplashEnabled
--
Thanks.
________________________________
De: Ma, Maurice <maurice.ma@intel.com<mailto:maurice.ma@intel.com>>
Enviado: lunes, 9 de marzo de 2020 17:55
Para: Dong, Guo <guo.dong@intel.com<mailto:guo.dong@intel.com>>; Gustavo Plaza
Roma <gustavo_plaza_@hotmail.com<mailto:gustavo_plaza_@hotmail.com>>;
sbl-devel@lists.01.org<mailto:sbl-devel@lists.01.org>
<sbl-devel@lists.01.org<mailto:sbl-devel@lists.01.org>>
Asunto: RE: Help. SBL versioning
Yes, the standard way to retrieve BIOS version in user space is through SMBIOS table.
There are standard tools to do this. You might need admin/root access though.
In Windows, you can use
“wmic bios get smbiosbiosversion”
In Linux, you can use
“dmidecode -t bios -q”
In SBL, you will need to enable the SMBIOS for the project. Currently in the SBL repo,
only CFL enabled SMBIOS by default.
For other projects, it needs some porting to enable it as Guo mentioned.
Thanks
Maurice
From: Dong, Guo <guo.dong@intel.com<mailto:guo.dong@intel.com>>
Sent: Monday, March 9, 2020 7:43
To: Gustavo Plaza Roma
<gustavo_plaza_@hotmail.com<mailto:gustavo_plaza_@hotmail.com>>;
sbl-devel@lists.01.org<mailto:sbl-devel@lists.01.org>
Subject: [Sbl-devel] Re: Help. SBL versioning
Hi,
Please try if you could get the version information from SMBIOS table?
SBL should put these information into SMBIOS table.
Please refer InitializeSmbiosInfo () in
https://github.com/slimbootloader/slimbootloader/blob/master/Platform/Cof...
Thanks,
Guo
From: Gustavo Plaza Roma
<gustavo_plaza_@hotmail.com<mailto:gustavo_plaza_@hotmail.com>>
Sent: Sunday, March 8, 2020 6:41 PM
To: sbl-devel@lists.01.org<mailto:sbl-devel@lists.01.org>
Subject: [Sbl-devel] Help. SBL versioning
Hello,
First of all sorry if the question makes no sense but I am new using SBL.
At this moment I have a SBL in my board that boot the Os using the payload "Os
Loader".
The OS is Linux distro generated using Yocto. I don't know how to get the SBL version
from user space in Linux.
I have read the versioning documentation page
(
https://slimbootloader.github.io/developer-guides/versioning.html) but I don't know
how to access to the HOB data list with GUID gBootLoaderVersionGuid.
Could someone tell me how to access the version of SBL from Linux?
Best regards.