Re: [edk2-devel] [edk2-platforms] [PATCH v3 2/4] KabylakeOpenBoardPkg: Add BIOS Info PEIM
Reviewed-by: Chasel Chiu > -Original Message- > From: devel@edk2.groups.io On Behalf Of Agyeman, > Prince > Sent: Friday, October 18, 2019 8:02 AM > To: devel@edk2.groups.io > Cc: Sinha, Ankit ; Desimone, Nathaniel L > ; Kubacki, Michael A > > Subject: [edk2-devel] [edk2-platforms] [PATCH v3 2/4] > KabylakeOpenBoardPkg: Add BIOS Info PEIM > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2210 > > Added BIOS Info PEIM to KabylakeRvp3 and GalagoPro3 to publish the BIOS > info HOB. This PEIM currently publishes the board's microcode region > information. > > Cc: Ankit Sinha > Cc: Nate DeSimone > Cc: Kubacki Michael A > > Signed-off-by: Prince Agyeman > --- > .../KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c | 93 +++ > .../BiosInfo/BiosInfo.inf | 49 ++ > .../GalagoPro3/OpenBoardPkg.dsc | 1 + > .../GalagoPro3/OpenBoardPkg.fdf | 1 + > .../KabylakeRvp3/OpenBoardPkg.dsc | 1 + > .../KabylakeRvp3/OpenBoardPkg.fdf | 1 + > 6 files changed, 146 insertions(+) > create mode 100644 > Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c > create mode 100644 > Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf > > diff --git a/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c > b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c > new file mode 100644 > index 00..578e66149e > --- /dev/null > +++ b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c > @@ -0,0 +1,93 @@ > +/** @file > + Driver for BIOS Info support. > + > + Copyright (c) 2019, Intel Corporation. All rights reserved. > + SPDX-License-Identifier: BSD-2-Clause-Patent **/ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define INDEXPORT_TO_ADDRESS(x) (x) > +#define DATAPORT_TO_ADDRESS(x) ((x) << 16) > +#define PORTWIDTH_TO_ADDRESS(x) ((x) << 32) > +#define PORTBITNUMBER_TO_ADDRESS(x) ((x) << 40) > +#define PORTINDEXNUMBER_TO_ADDRESS(x) ((x) << 48) > + > +// > +// Internal > +// > +#pragma pack (1) > + > +typedef struct { > + BIOS_INFO_HEADER Header; > + BIOS_INFO_STRUCT Entry[1]; > +} BIOS_INFO; > +#pragma pack () > + > +GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO mBiosInfo = { > + { > +BIOS_INFO_SIGNATURE, > +1, > +0, > + }, > + { > +{ > + FIT_TYPE_01_MICROCODE, > + BIOS_INFO_STRUCT_ATTRIBUTE_MICROCODE_WHOLE_REGION, > + 0x0100, > + FixedPcdGet32 (PcdFlashMicrocodeFvSize), > + FixedPcdGet32 (PcdFlashMicrocodeFvBase) > +} > + } > +}; > + > +GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR > mBiosInfoPpiList > += { > + EFI_PEI_PPI_DESCRIPTOR_PPI | > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST, > + , > + > +}; > + > +/** > + Installs BiosInfo Ppi and builds BiosInfo HOB . > + > + @param FileHandle Handle of the file being invoked. > + @param PeiServices Describes the list of possible PEI Services. > + > + @retval EFI_SUCCESS Install the BiosInfo Ppi and HOB successfully. > + > +**/ > +EFI_STATUS > +EFIAPI > +BiosInfoEntryPoint ( > + IN EFI_PEI_FILE_HANDLE FileHandle, > + IN CONST EFI_PEI_SERVICES **PeiServices > + ) > +{ > + EFI_STATUS Status; > + VOID*HobData; > + > + // > + // Install PPI, so that other PEI module can add dependency. > + // > + Status = PeiServicesInstallPpi (); ASSERT_EFI_ERROR > + (Status); > + > + // > + // Build hob, so that DXE module can also get the data. > + // > + HobData = BuildGuidHob (, sizeof (mBiosInfo)); ASSERT > + (HobData != NULL); if (HobData == NULL) { > +return EFI_OUT_OF_RESOURCES; > + } > + CopyMem (HobData, , sizeof (mBiosInfo)); > + > + return EFI_SUCCESS; > +} > diff --git a/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf > b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf > new file mode 100644 > index 00..e5e40144a6 > --- /dev/null > +++ b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf > @@ -0,0 +1,49 @@ > +### @file > +# Module Information description file for BIOS Info Driver # # > +Copyright (c) 2019, Intel Corporation. All rights reserved. # > +SPDX-License-Identifier: BSD-2-Clause-Patent ### > + > +[Defines] > + INF_VERSION= 0x00010017 > + BASE_NAME = BiosInfo > + FILE_GUID = > C83BCE0E-6F16-4D3C-8D9F-4D6F5A032929 > + VERSION_STRING = 1.0 > + MODULE_TYPE= PEIM > + ENTRY_POINT= BiosInfoEntryPoint > +# > +# The following information is for reference only and not required by the > build tools. > +# > +# VALID_ARCHITECTURES IA32 X64 > +# > + > +[LibraryClasses] > + PeimEntryPoint > + PeiServicesLib > + HobLib > + BaseMemoryLib > + DebugLib > + PcdLib > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + IntelSiliconPkg/IntelSiliconPkg.dec >
Re: [edk2-devel] [edk2-platforms] [PATCH v3 2/4] KabylakeOpenBoardPkg: Add BIOS Info PEIM
Reviewed-by: Nate DeSimone -Original Message- From: devel@edk2.groups.io On Behalf Of Agyeman, Prince Sent: Thursday, October 17, 2019 5:02 PM To: devel@edk2.groups.io Cc: Sinha, Ankit ; Desimone, Nathaniel L ; Kubacki, Michael A Subject: [edk2-devel] [edk2-platforms] [PATCH v3 2/4] KabylakeOpenBoardPkg: Add BIOS Info PEIM REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2210 Added BIOS Info PEIM to KabylakeRvp3 and GalagoPro3 to publish the BIOS info HOB. This PEIM currently publishes the board's microcode region information. Cc: Ankit Sinha Cc: Nate DeSimone Cc: Kubacki Michael A Signed-off-by: Prince Agyeman --- .../KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c | 93 +++ .../BiosInfo/BiosInfo.inf | 49 ++ .../GalagoPro3/OpenBoardPkg.dsc | 1 + .../GalagoPro3/OpenBoardPkg.fdf | 1 + .../KabylakeRvp3/OpenBoardPkg.dsc | 1 + .../KabylakeRvp3/OpenBoardPkg.fdf | 1 + 6 files changed, 146 insertions(+) create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf diff --git a/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c new file mode 100644 index 00..578e66149e --- /dev/null +++ b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c @@ -0,0 +1,93 @@ +/** @file + Driver for BIOS Info support. + + Copyright (c) 2019, Intel Corporation. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent **/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define INDEXPORT_TO_ADDRESS(x) (x) +#define DATAPORT_TO_ADDRESS(x) ((x) << 16) +#define PORTWIDTH_TO_ADDRESS(x) ((x) << 32) +#define PORTBITNUMBER_TO_ADDRESS(x) ((x) << 40) +#define PORTINDEXNUMBER_TO_ADDRESS(x) ((x) << 48) + +// +// Internal +// +#pragma pack (1) + +typedef struct { + BIOS_INFO_HEADER Header; + BIOS_INFO_STRUCT Entry[1]; +} BIOS_INFO; +#pragma pack () + +GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO mBiosInfo = { + { +BIOS_INFO_SIGNATURE, +1, +0, + }, + { +{ + FIT_TYPE_01_MICROCODE, + BIOS_INFO_STRUCT_ATTRIBUTE_MICROCODE_WHOLE_REGION, + 0x0100, + FixedPcdGet32 (PcdFlashMicrocodeFvSize), + FixedPcdGet32 (PcdFlashMicrocodeFvBase) +} + } +}; + +GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR mBiosInfoPpiList += { + EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST, + , + +}; + +/** + Installs BiosInfo Ppi and builds BiosInfo HOB . + + @param FileHandle Handle of the file being invoked. + @param PeiServices Describes the list of possible PEI Services. + + @retval EFI_SUCCESS Install the BiosInfo Ppi and HOB successfully. + +**/ +EFI_STATUS +EFIAPI +BiosInfoEntryPoint ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + EFI_STATUS Status; + VOID*HobData; + + // + // Install PPI, so that other PEI module can add dependency. + // + Status = PeiServicesInstallPpi (); ASSERT_EFI_ERROR + (Status); + + // + // Build hob, so that DXE module can also get the data. + // + HobData = BuildGuidHob (, sizeof (mBiosInfo)); ASSERT + (HobData != NULL); if (HobData == NULL) { +return EFI_OUT_OF_RESOURCES; + } + CopyMem (HobData, , sizeof (mBiosInfo)); + + return EFI_SUCCESS; +} diff --git a/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf new file mode 100644 index 00..e5e40144a6 --- /dev/null +++ b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf @@ -0,0 +1,49 @@ +### @file +# Module Information description file for BIOS Info Driver # # +Copyright (c) 2019, Intel Corporation. All rights reserved. # +SPDX-License-Identifier: BSD-2-Clause-Patent ### + +[Defines] + INF_VERSION= 0x00010017 + BASE_NAME = BiosInfo + FILE_GUID = C83BCE0E-6F16-4D3C-8D9F-4D6F5A032929 + VERSION_STRING = 1.0 + MODULE_TYPE= PEIM + ENTRY_POINT= BiosInfoEntryPoint +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES IA32 X64 +# + +[LibraryClasses] + PeimEntryPoint + PeiServicesLib + HobLib + BaseMemoryLib + DebugLib + PcdLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + IntelSiliconPkg/IntelSiliconPkg.dec + KabylakeSiliconPkg/SiPkg.dec + KabylakeFspBinPkg/KabylakeFspBinPkg.dec + BoardModulePkg/BoardModulePkg.dec + MinPlatformPkg/MinPlatformPkg.dec + +[Pcd] + gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvBase## CONSUMES + gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize## CONSUMES + +[Sources] +
Re: [edk2-devel] [edk2-platforms] [PATCH v3 2/4] KabylakeOpenBoardPkg: Add BIOS Info PEIM
Reviewed-by: Michael Kubacki > -Original Message- > From: Agyeman, Prince > Sent: Thursday, October 17, 2019 5:02 PM > To: devel@edk2.groups.io > Cc: Sinha, Ankit ; Desimone, Nathaniel L > ; Kubacki, Michael A > > Subject: [edk2-platforms] [PATCH v3 2/4] KabylakeOpenBoardPkg: Add BIOS > Info PEIM > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2210 > > Added BIOS Info PEIM to KabylakeRvp3 and GalagoPro3 to publish the BIOS > info HOB. This PEIM currently publishes the board's microcode region > information. > > Cc: Ankit Sinha > Cc: Nate DeSimone > Cc: Kubacki Michael A > > Signed-off-by: Prince Agyeman > --- > .../KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c | 93 > +++ > .../BiosInfo/BiosInfo.inf | 49 ++ > .../GalagoPro3/OpenBoardPkg.dsc | 1 + > .../GalagoPro3/OpenBoardPkg.fdf | 1 + > .../KabylakeRvp3/OpenBoardPkg.dsc | 1 + > .../KabylakeRvp3/OpenBoardPkg.fdf | 1 + > 6 files changed, 146 insertions(+) > create mode 100644 > Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c > create mode 100644 > Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf > > diff --git a/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c > b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c > new file mode 100644 > index 00..578e66149e > --- /dev/null > +++ b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c > @@ -0,0 +1,93 @@ > +/** @file > + Driver for BIOS Info support. > + > + Copyright (c) 2019, Intel Corporation. All rights reserved. > + SPDX-License-Identifier: BSD-2-Clause-Patent **/ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define INDEXPORT_TO_ADDRESS(x) (x) > +#define DATAPORT_TO_ADDRESS(x) ((x) << 16) > +#define PORTWIDTH_TO_ADDRESS(x) ((x) << 32) > +#define PORTBITNUMBER_TO_ADDRESS(x) ((x) << 40) > +#define PORTINDEXNUMBER_TO_ADDRESS(x) ((x) << 48) > + > +// > +// Internal > +// > +#pragma pack (1) > + > +typedef struct { > + BIOS_INFO_HEADER Header; > + BIOS_INFO_STRUCT Entry[1]; > +} BIOS_INFO; > +#pragma pack () > + > +GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO mBiosInfo = { > + { > +BIOS_INFO_SIGNATURE, > +1, > +0, > + }, > + { > +{ > + FIT_TYPE_01_MICROCODE, > + BIOS_INFO_STRUCT_ATTRIBUTE_MICROCODE_WHOLE_REGION, > + 0x0100, > + FixedPcdGet32 (PcdFlashMicrocodeFvSize), > + FixedPcdGet32 (PcdFlashMicrocodeFvBase) > +} > + } > +}; > + > +GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR > mBiosInfoPpiList > += { > + EFI_PEI_PPI_DESCRIPTOR_PPI | > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST, > + , > + > +}; > + > +/** > + Installs BiosInfo Ppi and builds BiosInfo HOB . > + > + @param FileHandle Handle of the file being invoked. > + @param PeiServices Describes the list of possible PEI Services. > + > + @retval EFI_SUCCESS Install the BiosInfo Ppi and HOB successfully. > + > +**/ > +EFI_STATUS > +EFIAPI > +BiosInfoEntryPoint ( > + IN EFI_PEI_FILE_HANDLE FileHandle, > + IN CONST EFI_PEI_SERVICES **PeiServices > + ) > +{ > + EFI_STATUS Status; > + VOID*HobData; > + > + // > + // Install PPI, so that other PEI module can add dependency. > + // > + Status = PeiServicesInstallPpi (); ASSERT_EFI_ERROR > + (Status); > + > + // > + // Build hob, so that DXE module can also get the data. > + // > + HobData = BuildGuidHob (, sizeof (mBiosInfo)); ASSERT > + (HobData != NULL); if (HobData == NULL) { > +return EFI_OUT_OF_RESOURCES; > + } > + CopyMem (HobData, , sizeof (mBiosInfo)); > + > + return EFI_SUCCESS; > +} > diff --git a/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf > b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf > new file mode 100644 > index 00..e5e40144a6 > --- /dev/null > +++ b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf > @@ -0,0 +1,49 @@ > +### @file > +# Module Information description file for BIOS Info Driver # # > +Copyright (c) 2019, Intel Corporation. All rights reserved. # > +SPDX-License-Identifier: BSD-2-Clause-Patent ### > + > +[Defines] > + INF_VERSION= 0x00010017 > + BASE_NAME = BiosInfo > + FILE_GUID = C83BCE0E-6F16-4D3C-8D9F-4D6F5A032929 > + VERSION_STRING = 1.0 > + MODULE_TYPE= PEIM > + ENTRY_POINT= BiosInfoEntryPoint > +# > +# The following information is for reference only and not required by the > build tools. > +# > +# VALID_ARCHITECTURES IA32 X64 > +# > + > +[LibraryClasses] > + PeimEntryPoint > + PeiServicesLib > + HobLib > + BaseMemoryLib > + DebugLib > + PcdLib > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + IntelSiliconPkg/IntelSiliconPkg.dec > + KabylakeSiliconPkg/SiPkg.dec > +