public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Nate DeSimone" <nathaniel.l.desimone@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Agyeman, Prince" <prince.agyeman@intel.com>
Cc: "Sinha, Ankit" <ankit.sinha@intel.com>,
	"Kubacki, Michael A" <michael.a.kubacki@intel.com>
Subject: Re: [edk2-devel] [edk2-platforms] [PATCH v3 2/4] KabylakeOpenBoardPkg: Add BIOS Info PEIM
Date: Fri, 18 Oct 2019 03:13:05 +0000	[thread overview]
Message-ID: <02A34F284D1DA44BB705E61F7180EF0AAEF75258@ORSMSX114.amr.corp.intel.com> (raw)
In-Reply-To: <20191018000145.3140-3-prince.agyeman@intel.com>

Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>

-----Original Message-----
From: devel@edk2.groups.io <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 <ankit.sinha@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Kubacki, Michael A <michael.a.kubacki@intel.com>
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 <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Kubacki Michael A <michael.a.kubacki@intel.com>

Signed-off-by: Prince Agyeman <prince.agyeman@intel.com>
---
 .../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 0000000000..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.<BR>
+  SPDX-License-Identifier: BSD-2-Clause-Patent **/
+
+#include <PiPei.h>
+#include <Guid/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 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 (&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/BiosInfo/BiosInfo.inf b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf
new file mode 100644
index 0000000000..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.<BR> #
+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]
+  BiosInfo.c
+
+[Guids]
+  gBiosInfoGuid                                 ## PRODUCES
+
+[Depex]
+  TRUE
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
index b6f9807e7e..f59248bba4 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
@@ -298,6 +298,7 @@
 !if gKabylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable == TRUE
   $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Pei/PeiTbtInit.inf
 !endif
+  $(PLATFORM_BOARD_PACKAGE)/BiosInfo/BiosInfo.inf
 
 [Components.X64]
   #######################################
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
index c46f7a71e5..80efab1aad 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 $(PLATFORM_BOARD_PACKAGE)/BiosInfo/BiosInfo.inf
 
 [FV.FvPostMemoryUncompact]
 BlockSize          = $(FLASH_BLOCK_SIZE)
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
index b412dc9eec..7e65eeda6f 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
@@ -370,6 +370,7 @@
 !if gKabylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable == TRUE
   $(PLATFORM_BOARD_PACKAGE)/Features/Tbt/TbtInit/Pei/PeiTbtInit.inf
 !endif
+  $(PLATFORM_BOARD_PACKAGE)/BiosInfo/BiosInfo.inf
 
 [Components.X64]
   #######################################
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
index c61b93db84..dbd6f2aa10 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
@@ -242,6 +242,7 @@ INF $(PLATFORM_PACKAGE)/PlatformInit/ReportFv/ReportFvPei.inf
 INF $(PLATFORM_PACKAGE)/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
 INF IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
 INF $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPreMem.inf
+INF $(PLATFORM_BOARD_PACKAGE)/BiosInfo/BiosInfo.inf
 
 [FV.FvPostMemoryUncompact]
 BlockSize          = $(FLASH_BLOCK_SIZE)
--
2.19.1.windows.1





  parent reply	other threads:[~2019-10-18  3:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18  0:01 [edk2-platforms] [PATCH v3 0/4] Add FIT support using FitGen Agyeman, Prince
2019-10-18  0:01 ` [edk2-platforms] [PATCH v3 1/4] BoardModulePkg: Add BIOS Info HOB Agyeman, Prince
2019-10-18  2:44   ` Kubacki, Michael A
2019-10-18  3:13   ` [edk2-devel] " Nate DeSimone
2019-10-18  0:01 ` [edk2-platforms] [PATCH v3 2/4] KabylakeOpenBoardPkg: Add BIOS Info PEIM Agyeman, Prince
2019-10-18  2:44   ` Kubacki, Michael A
2019-10-18  3:13   ` Nate DeSimone [this message]
2019-10-21  1:12   ` [edk2-devel] " Chiu, Chasel
2019-10-18  0:01 ` [edk2-platforms] [PATCH v3 3/4] WhiskeylakeOpenBoardPkg: " Agyeman, Prince
2019-10-18  2:44   ` Kubacki, Michael A
2019-10-18  3:13   ` Nate DeSimone
2019-10-18  0:01 ` [edk2-platforms] [PATCH v3 4/4] Platform/Intel: Add FIT generation tool Agyeman, Prince
2019-10-18  2:45   ` Kubacki, Michael A
2019-10-18  3:13   ` Nate DeSimone

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=02A34F284D1DA44BB705E61F7180EF0AAEF75258@ORSMSX114.amr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox