[edk2-devel] [edk2-platforms] [PATCH 3/5] KabylakeOpenBoardPkg/GalagoPro3: Add BiosInfo PEIM

Nate DeSimone nathaniel.l.desimone at intel.com
Mon Oct 7 22:27:25 UTC 2019


Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.c and Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c are identical files. Can we move this up to the parent KabylakeOpenBoardPkg and use one PEIM for both platforms?

-----Original Message-----
From: Agyeman, Prince <prince.agyeman at intel.com> 
Sent: Thursday, October 3, 2019 2:13 PM
To: devel at edk2.groups.io
Cc: Sinha, Ankit <ankit.sinha at intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone at intel.com>; Kubacki, Michael A <michael.a.kubacki at intel.com>
Subject: [edk2-platforms] [PATCH 3/5] KabylakeOpenBoardPkg/GalagoPro3: Add BiosInfo PEIM

Added BiosInfo PEIM to publish the
Bios Info HOB. Currently this PEIM publishes one Bios Info entry which is the microcode region information.

Cc: Ankit Sinha <ankit.sinha at intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone at intel.com>
Cc: Kubacki Michael A <michael.a.kubacki at intel.com>

Signed-off-by: Prince Agyeman <prince.agyeman at intel.com>
---
 .../GalagoPro3/BiosInfo/BiosInfo.c            | 92 +++++++++++++++++++
 .../GalagoPro3/BiosInfo/BiosInfo.inf          | 48 ++++++++++
 .../GalagoPro3/OpenBoardPkg.dsc               |  2 +
 .../GalagoPro3/OpenBoardPkg.fdf               |  1 +
 4 files changed, 143 insertions(+)
 create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c
 create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.inf

diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c
new file mode 100644
index 0000000000..4db9d4685c
--- /dev/null
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c
@@ -0,0 +1,92 @@
+/** @file
+  Driver for BIOS Info support.
+
+Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include <PiPei.h> 
+#include <Library/BiosInfo.h> #include <Library/PeiServicesLib.h> 
+#include <Library/BaseMemoryLib.h> #include <Library/DebugLib.h> 
+#include <Library/HobLib.h> #include <Library/PcdLib.h> #include 
+<IndustryStandard/FirmwareInterfaceTable.h>
+
+#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,
+  &gBiosInfoGuid,
+  &mBiosInfo
+};
+
+/**
+  Installs BiosInfo Ppi.
+
+  @param  FileHandle  Handle of the file being invoked.
+  @param  PeiServices Describes the list of possible PEI Services.
+
+  @retval EFI_SUCCESS   Install the BiosInfo Ppi 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 (&mBiosInfoPpiList);  ASSERT_EFI_ERROR 
+ (Status);
+
+  //
+  // Build hob, so that DXE module can also get the data.
+  //
+  HobData = BuildGuidHob (&gBiosInfoGuid, sizeof (mBiosInfo));  ASSERT 
+ (HobData != NULL);  if (HobData == NULL) {
+    return EFI_OUT_OF_RESOURCES;
+  }
+  CopyMem (HobData, &mBiosInfo, sizeof (mBiosInfo));
+
+  return EFI_SUCCESS;
+}
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.inf b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.inf
new file mode 100644
index 0000000000..a0e18cff9c
--- /dev/null
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.i
+++ nf
@@ -0,0 +1,48 @@
+### @file
+#  Module Information description file for BIOS Info Driver # #  
+Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> #  
+SPDX-License-Identifier: BSD-2-Clause-Patent ###
+
+[Defines]
+  INF_VERSION                    = 0x00010017
+  BASE_NAME                      = BiosInfo
+  FILE_GUID                      = 3132E669-D16B-4AA7-B09B-BC0EB5F40E1F
+  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
+
+[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]
+  BiosInfo.c
+
+[Guids]
+  gBiosInfoGuid                                 ## PRODUCES
+
+[Depex]
+  TRUE
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
index d67e0cc000..64e25168c7 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
@@ -244,6 +244,8 @@
   }
   $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPostMem.inf
 
+  $(PROJECT)/BiosInfo/BiosInfo.inf
+
 #
 # Security
 #
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
index 56bb0edaad..a095c044a5 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
@@ -240,6 +240,7 @@ INF $(PLATFORM_PACKAGE)/PlatformInit/ReportFv/ReportFvPei.inf
 INF $(PROJECT)/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
 INF IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
 INF $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPreMem.inf
+INF $(PROJECT)/BiosInfo/BiosInfo.inf
 
 [FV.FvPostMemoryUncompact]
 BlockSize          = $(FLASH_BLOCK_SIZE)
--
2.19.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#48508): https://edk2.groups.io/g/devel/message/48508
Mute This Topic: https://groups.io/mt/34386699/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list