public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-platforms] [PATCH v3 0/4] Add FIT support using FitGen
@ 2019-10-18  0:01 Agyeman, Prince
  2019-10-18  0:01 ` [edk2-platforms] [PATCH v3 1/4] BoardModulePkg: Add BIOS Info HOB Agyeman, Prince
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Agyeman, Prince @ 2019-10-18  0:01 UTC (permalink / raw)
  To: devel

Changes in v3:
- Added PcdLib to BiosInfo.inf's LibraryClasses section
- Cleaned up OpenBoardPkg.dscs for all three platforms
- Added bugzilla references

Changes in v2:
- Moved BIOS Info PEIM to KabylakeOpenBoardPkg
  shared by both KabylakeRvp3, GalagoPro3
- Moved BIOS Info PEIM to WhiskeylakeOpenBoardPkg
  used by WhiskeylakeURvp
- Moved BiosInfo.h to BoardModulePkg/Include/Guid
- Fixed typos, cleaned up commit messages and comments

Prince Agyeman (4):
  BoardModulePkg: Add BIOS Info HOB
  KabylakeOpenBoardPkg: Add BIOS Info PEIM
  WhiskeylakeOpenBoardPkg: Add BIOS Info PEIM
  Platform/Intel: Add FIT generation tool

 .../Intel/BoardModulePkg/BoardModulePkg.dec   |  3 +
 .../BoardModulePkg/Include/Guid/BiosInfo.h    | 61 ++++++++++++
 .../KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c  | 93 +++++++++++++++++++
 .../BiosInfo/BiosInfo.inf                     | 49 ++++++++++
 .../GalagoPro3/OpenBoardPkg.dsc               |  1 +
 .../GalagoPro3/OpenBoardPkg.fdf               |  1 +
 .../GalagoPro3/build_config.cfg               |  1 +
 .../KabylakeRvp3/OpenBoardPkg.dsc             |  1 +
 .../KabylakeRvp3/OpenBoardPkg.fdf             |  1 +
 .../KabylakeRvp3/build_config.cfg             |  1 +
 .../BiosInfo/BiosInfo.c                       | 93 +++++++++++++++++++
 .../BiosInfo/BiosInfo.inf                     | 49 ++++++++++
 .../WhiskeylakeURvp/OpenBoardPkg.dsc          |  2 +
 .../WhiskeylakeURvp/OpenBoardPkg.fdf          |  1 +
 .../WhiskeylakeURvp/build_config.cfg          |  1 +
 Platform/Intel/build.cfg                      |  1 +
 Platform/Intel/build_bios.py                  | 57 ++++++++++++
 17 files changed, 416 insertions(+)
 create mode 100644 Platform/Intel/BoardModulePkg/Include/Guid/BiosInfo.h
 create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c
 create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf
 create mode 100644 Platform/Intel/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.c
 create mode 100644 Platform/Intel/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.inf

-- 
2.19.1.windows.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [edk2-platforms] [PATCH v3 1/4] BoardModulePkg: Add BIOS Info HOB
  2019-10-18  0:01 [edk2-platforms] [PATCH v3 0/4] Add FIT support using FitGen Agyeman, Prince
@ 2019-10-18  0:01 ` 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
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 14+ messages in thread
From: Agyeman, Prince @ 2019-10-18  0:01 UTC (permalink / raw)
  To: devel; +Cc: Ankit Sinha, Nate DeSimone, Kubacki Michael A

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2210
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2211

Added gBiosInfoGuid to be used in
publishing the BIOS information HOB
which is needed in FIT generation

Also added the BIOS Info header
file BiosInfo.h that defines the
BIOS info struct and GUID

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>
---
 .../Intel/BoardModulePkg/BoardModulePkg.dec   |  3 +
 .../BoardModulePkg/Include/Guid/BiosInfo.h    | 61 +++++++++++++++++++
 2 files changed, 64 insertions(+)
 create mode 100644 Platform/Intel/BoardModulePkg/Include/Guid/BiosInfo.h

diff --git a/Platform/Intel/BoardModulePkg/BoardModulePkg.dec b/Platform/Intel/BoardModulePkg/BoardModulePkg.dec
index f96fb09aa1..f461cc7cab 100644
--- a/Platform/Intel/BoardModulePkg/BoardModulePkg.dec
+++ b/Platform/Intel/BoardModulePkg/BoardModulePkg.dec
@@ -39,3 +39,6 @@
 [Guids]
   ## Include Include/Guid/BiosId.h
   gBiosIdGuid = { 0xC3E36D09, 0x8294, 0x4b97, { 0xA8, 0x57, 0xD5, 0x28, 0x8F, 0xE3, 0x3E, 0x28 } }
+
+  ## GUID to publish BIOS information HOB
+  gBiosInfoGuid = { 0x09d0d15c, 0xe9f0, 0x4dfc, {0x9e, 0x0b, 0x39, 0x33, 0x1f, 0xca, 0x66, 0x85} }
diff --git a/Platform/Intel/BoardModulePkg/Include/Guid/BiosInfo.h b/Platform/Intel/BoardModulePkg/Include/Guid/BiosInfo.h
new file mode 100644
index 0000000000..d73409ea6f
--- /dev/null
+++ b/Platform/Intel/BoardModulePkg/Include/Guid/BiosInfo.h
@@ -0,0 +1,61 @@
+/** @file
+  Definitions and GUID for BIOS INFO.
+
+  Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef _BIOS_INFO_H_
+#define _BIOS_INFO_H_
+
+//
+// BIOS INFO data structure
+// This is self contained data structure for BIOS info for TXT
+//
+#pragma pack (1)
+#define BIOS_INFO_SIGNATURE  SIGNATURE_64 ('$', 'B', 'I', 'O', 'S', 'I', 'F', '$')
+typedef struct {
+  UINT64            Signature;
+  UINT32            EntryCount;
+  UINT32            Reserved;
+//BIOS_INFO_STRUCT  Struct[EntryCount];
+} BIOS_INFO_HEADER;
+
+//
+// BIOS_INFO_STRUCT attributes
+// bits[0:3] means general attributes
+// bits[4:7] means type specific attributes
+//
+#define BIOS_INFO_STRUCT_ATTRIBUTE_GENERAL_EXCLUDE_FROM_FIT  0x01
+#define BIOS_INFO_STRUCT_ATTRIBUTE_MICROCODE_WHOLE_REGION    0x10
+#define BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB             0x10
+#define BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_NON_IBB              0x20
+
+typedef struct {
+  //
+  // FitTable entry type
+  //
+  UINT8    Type;
+  //
+  // BIOS_INFO_STRUCT attributes
+  //
+  UINT8    Attributes;
+  //
+  // FitTable entry version
+  //
+  UINT16   Version;
+  //
+  // FitTable entry real size
+  //
+  UINT32   Size;
+  //
+  // FitTable entry address
+  //
+  UINT64   Address;
+} BIOS_INFO_STRUCT;
+
+extern EFI_GUID  gBiosInfoGuid;
+
+#pragma pack ()
+
+#endif
-- 
2.19.1.windows.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [edk2-platforms] [PATCH v3 2/4] KabylakeOpenBoardPkg: Add BIOS Info PEIM
  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  0:01 ` Agyeman, Prince
  2019-10-18  2:44   ` Kubacki, Michael A
                     ` (2 more replies)
  2019-10-18  0:01 ` [edk2-platforms] [PATCH v3 3/4] WhiskeylakeOpenBoardPkg: " Agyeman, Prince
  2019-10-18  0:01 ` [edk2-platforms] [PATCH v3 4/4] Platform/Intel: Add FIT generation tool Agyeman, Prince
  3 siblings, 3 replies; 14+ messages in thread
From: Agyeman, Prince @ 2019-10-18  0:01 UTC (permalink / raw)
  To: devel; +Cc: Ankit Sinha, Nate DeSimone, Kubacki Michael A

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


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [edk2-platforms] [PATCH v3 3/4] WhiskeylakeOpenBoardPkg: Add BIOS Info PEIM
  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  0:01 ` [edk2-platforms] [PATCH v3 2/4] KabylakeOpenBoardPkg: Add BIOS Info PEIM Agyeman, Prince
@ 2019-10-18  0:01 ` 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
  3 siblings, 2 replies; 14+ messages in thread
From: Agyeman, Prince @ 2019-10-18  0:01 UTC (permalink / raw)
  To: devel; +Cc: Ankit Sinha, Nate DeSimone, Kubacki Michael A

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2211

Added BIOS Info PEIM to publish Bios Info
HOB. This PEIM currently publishes the microcode
FV 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>
---
 .../BiosInfo/BiosInfo.c                       | 93 +++++++++++++++++++
 .../BiosInfo/BiosInfo.inf                     | 49 ++++++++++
 .../WhiskeylakeURvp/OpenBoardPkg.dsc          |  2 +
 .../WhiskeylakeURvp/OpenBoardPkg.fdf          |  1 +
 4 files changed, 145 insertions(+)
 create mode 100644 Platform/Intel/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.c
 create mode 100644 Platform/Intel/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.inf

diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.c b/Platform/Intel/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.c
new file mode 100644
index 0000000000..578e66149e
--- /dev/null
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/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/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.inf b/Platform/Intel/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.inf
new file mode 100644
index 0000000000..a9687d93de
--- /dev/null
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/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                      = A842B2D2-5C88-44E9-A9E2-4830F26662B7
+  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
+  CoffeelakeSiliconPkg/SiPkg.dec
+  CoffeeLakeFspBinPkg/CoffeeLakeFspBinPkg.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/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
index 423fa88c12..8e0ea2d5ce 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
@@ -314,6 +314,7 @@
   $(PLATFORM_PACKAGE)/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf
 !endif
 
+
   #######################################
   # Board Package
   #######################################
@@ -321,6 +322,7 @@
 !if gWhiskeylakeOpenBoardPkgTokenSpaceGuid.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/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
index 320e444aae..140e6260c9 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
@@ -240,6 +240,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


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [edk2-platforms] [PATCH v3 4/4] Platform/Intel: Add FIT generation tool
  2019-10-18  0:01 [edk2-platforms] [PATCH v3 0/4] Add FIT support using FitGen Agyeman, Prince
                   ` (2 preceding siblings ...)
  2019-10-18  0:01 ` [edk2-platforms] [PATCH v3 3/4] WhiskeylakeOpenBoardPkg: " Agyeman, Prince
@ 2019-10-18  0:01 ` Agyeman, Prince
  2019-10-18  2:45   ` Kubacki, Michael A
  2019-10-18  3:13   ` Nate DeSimone
  3 siblings, 2 replies; 14+ messages in thread
From: Agyeman, Prince @ 2019-10-18  0:01 UTC (permalink / raw)
  To: devel; +Cc: Ankit Sinha, Nate DeSimone, Michael Kubacki

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2210
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2211

Added FitGen tool build and FIT generation
to the BIOS build process.

What was done:

- Build the FIT generation tool
- Added default/empty BIOS_INFO_GUID to the build.cfg
- Added BIOS_INFO_GUID to GalagoPro3,KabylakeRvp3
and WhiskeylakeURvp's build_config.cfg
This allows a board to specify the GUID
associated with the BIOS Info PEIM to be used
in the board's FIT generation.

BIOS_INFO_GUID is passed as an argument to
FitGen tool which allow the tool to locate
the BIOS Info module to be used in FIT generation.

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

Signed-off-by: Prince Agyeman <prince.agyeman@intel.com>
---
 .../GalagoPro3/build_config.cfg               |  1 +
 .../KabylakeRvp3/build_config.cfg             |  1 +
 .../WhiskeylakeURvp/build_config.cfg          |  1 +
 Platform/Intel/build.cfg                      |  1 +
 Platform/Intel/build_bios.py                  | 57 +++++++++++++++++++
 5 files changed, 61 insertions(+)

diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/build_config.cfg b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/build_config.cfg
index 8c6c51abb4..458fe3d35d 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/build_config.cfg
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/build_config.cfg
@@ -31,3 +31,4 @@ FSP_PKG_NAME = KabylakeFspPkg
 FSP_BINARY_BUILD = FALSE
 FSP_TEST_RELEASE = FALSE
 SECURE_BOOT_ENABLE = FALSE
+BIOS_INFO_GUID = C83BCE0E-6F16-4D3C-8D9F-4D6F5A032929
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/build_config.cfg b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/build_config.cfg
index 78f808bfaf..f6ae4b342a 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/build_config.cfg
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/build_config.cfg
@@ -33,3 +33,4 @@ FSP_PKG_NAME = AmberLakeFspPkg
 FSP_BINARY_BUILD = FALSE
 FSP_TEST_RELEASE = FALSE
 SECURE_BOOT_ENABLE = FALSE
+BIOS_INFO_GUID = C83BCE0E-6F16-4D3C-8D9F-4D6F5A032929
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/build_config.cfg b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/build_config.cfg
index 1b0619bc1c..1dfe5ffd10 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/build_config.cfg
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/build_config.cfg
@@ -31,3 +31,4 @@ FSP_PKG_NAME = CoffeelakeSiliconPkg
 FSP_BINARY_BUILD = FALSE
 FSP_TEST_RELEASE = FALSE
 SECURE_BOOT_ENABLE = FALSE
+BIOS_INFO_GUID = A842B2D2-5C88-44E9-A9E2-4830F26662B7
diff --git a/Platform/Intel/build.cfg b/Platform/Intel/build.cfg
index 2040774d1b..6aee96694c 100644
--- a/Platform/Intel/build.cfg
+++ b/Platform/Intel/build.cfg
@@ -48,6 +48,7 @@ SECURE_BOOT_ENABLE = FALSE
 REBUILD_MODE =
 BUILD_ROM_ONLY =
 NUMBER_OF_PROCESSORS = 0
+BIOS_INFO_GUID =
 
 
 [PLATFORMS]
diff --git a/Platform/Intel/build_bios.py b/Platform/Intel/build_bios.py
index 46285df19a..ea098de705 100644
--- a/Platform/Intel/build_bios.py
+++ b/Platform/Intel/build_bios.py
@@ -196,6 +196,31 @@ def pre_build(build_config, build_type="DEBUG", silent=False, toolchain=None):
     if return_code != 0:
         build_failed(config)
 
+    #
+    # build platform silicon tools
+    #
+    # save the current workspace
+    saved_work_directory = config["WORKSPACE"]
+    # change the workspace to silicon tools directory
+    config["WORKSPACE"] = os.path.join(config["WORKSPACE_SILICON"], "Tools")
+
+    command = ["nmake"]
+    if os.name == "posix":  # linux
+        command = ["make"]
+        # add path to generated FitGen binary to
+        # environment path variable
+        config["PATH"] += os.pathsep + \
+                          os.path.join(config["BASE_TOOLS_PATH"],
+                                       "Source", "C", "bin")
+
+    # build the silicon tools
+    _, _, result, return_code = execute_script(command, config, shell=shell)
+    if return_code != 0:
+        build_failed(config)
+
+    # restore WORKSPACE environment variable
+    config["WORKSPACE"] = saved_work_directory
+
     config["SILENT_MODE"] = 'TRUE' if silent else 'FALSE'
 
     print("==============================================")
@@ -404,6 +429,35 @@ def post_build(config):
     :returns: nothing
     """
     print("Running post_build to complete the build process.")
+    board_fd = config["BOARD"].upper()
+    final_fd = os.path.join(config["BUILD_DIR_PATH"], "FV",
+                            "{}.fd".format(board_fd))
+
+    if config["BIOS_INFO_GUID"]:
+        # Generate the fit table
+        print("Generating FIT ...")
+        if os.path.isfile(final_fd):
+            temp_fd = os.path.join(config["BUILD_DIR_PATH"], "FV",
+                                   "{}_.fd".format(board_fd))
+            shell = True
+            command = ["FitGen", "-D",
+                       final_fd, temp_fd, "-NA",
+                       "-I", config["BIOS_INFO_GUID"]]
+
+            if os.name == "posix": # linux
+                shell = False
+
+            _, _, result, return_code = execute_script(command, config, shell=shell)
+            if return_code != 0:
+                print("Error while generating fit")
+            else:
+                # copy output to final binary
+                shutil.copyfile(temp_fd, final_fd)
+                # remove temp file
+                os.remove(temp_fd)
+        else:
+            print("{} does not exist".format(final_fd))
+            # remove temp file
 
     # Additional build scripts for this platform
     result = post_build_ex(config)
@@ -426,6 +480,9 @@ def post_build(config):
             except OSError:
                 pass
 
+    print("Done")
+    if os.path.isfile(final_fd):
+        print("Fd file can be found at {}".format(final_fd))
 
 def build_failed(config):
     """Displays results when build fails
-- 
2.19.1.windows.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [edk2-platforms] [PATCH v3 1/4] BoardModulePkg: Add BIOS Info HOB
  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
  1 sibling, 0 replies; 14+ messages in thread
From: Kubacki, Michael A @ 2019-10-18  2:44 UTC (permalink / raw)
  To: Agyeman, Prince, devel@edk2.groups.io; +Cc: Sinha, Ankit, Desimone, Nathaniel L

Reviewed-by: Michael Kubacki <michael.a.kubacki@intel.com>

> -----Original Message-----
> From: Agyeman, Prince <prince.agyeman@intel.com>
> 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-platforms] [PATCH v3 1/4] BoardModulePkg: Add BIOS Info
> HOB
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2210
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2211
> 
> Added gBiosInfoGuid to be used in
> publishing the BIOS information HOB
> which is needed in FIT generation
> 
> Also added the BIOS Info header
> file BiosInfo.h that defines the
> BIOS info struct and GUID
> 
> 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>
> ---
>  .../Intel/BoardModulePkg/BoardModulePkg.dec   |  3 +
>  .../BoardModulePkg/Include/Guid/BiosInfo.h    | 61
> +++++++++++++++++++
>  2 files changed, 64 insertions(+)
>  create mode 100644
> Platform/Intel/BoardModulePkg/Include/Guid/BiosInfo.h
> 
> diff --git a/Platform/Intel/BoardModulePkg/BoardModulePkg.dec
> b/Platform/Intel/BoardModulePkg/BoardModulePkg.dec
> index f96fb09aa1..f461cc7cab 100644
> --- a/Platform/Intel/BoardModulePkg/BoardModulePkg.dec
> +++ b/Platform/Intel/BoardModulePkg/BoardModulePkg.dec
> @@ -39,3 +39,6 @@
>  [Guids]
>    ## Include Include/Guid/BiosId.h
>    gBiosIdGuid = { 0xC3E36D09, 0x8294, 0x4b97, { 0xA8, 0x57, 0xD5, 0x28, 0x8F,
> 0xE3, 0x3E, 0x28 } }
> +
> +  ## GUID to publish BIOS information HOB  gBiosInfoGuid = {
> + 0x09d0d15c, 0xe9f0, 0x4dfc, {0x9e, 0x0b, 0x39, 0x33, 0x1f, 0xca, 0x66,
> + 0x85} }
> diff --git a/Platform/Intel/BoardModulePkg/Include/Guid/BiosInfo.h
> b/Platform/Intel/BoardModulePkg/Include/Guid/BiosInfo.h
> new file mode 100644
> index 0000000000..d73409ea6f
> --- /dev/null
> +++ b/Platform/Intel/BoardModulePkg/Include/Guid/BiosInfo.h
> @@ -0,0 +1,61 @@
> +/** @file
> +  Definitions and GUID for BIOS INFO.
> +
> +  Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
> +  SPDX-License-Identifier: BSD-2-Clause-Patent **/
> +
> +#ifndef _BIOS_INFO_H_
> +#define _BIOS_INFO_H_
> +
> +//
> +// BIOS INFO data structure
> +// This is self contained data structure for BIOS info for TXT //
> +#pragma pack (1) #define BIOS_INFO_SIGNATURE  SIGNATURE_64 ('$', 'B',
> +'I', 'O', 'S', 'I', 'F', '$') typedef struct {
> +  UINT64            Signature;
> +  UINT32            EntryCount;
> +  UINT32            Reserved;
> +//BIOS_INFO_STRUCT  Struct[EntryCount]; } BIOS_INFO_HEADER;
> +
> +//
> +// BIOS_INFO_STRUCT attributes
> +// bits[0:3] means general attributes
> +// bits[4:7] means type specific attributes // #define
> +BIOS_INFO_STRUCT_ATTRIBUTE_GENERAL_EXCLUDE_FROM_FIT  0x01
> +#define BIOS_INFO_STRUCT_ATTRIBUTE_MICROCODE_WHOLE_REGION
> 0x10
> +#define BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB             0x10
> +#define BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_NON_IBB              0x20
> +
> +typedef struct {
> +  //
> +  // FitTable entry type
> +  //
> +  UINT8    Type;
> +  //
> +  // BIOS_INFO_STRUCT attributes
> +  //
> +  UINT8    Attributes;
> +  //
> +  // FitTable entry version
> +  //
> +  UINT16   Version;
> +  //
> +  // FitTable entry real size
> +  //
> +  UINT32   Size;
> +  //
> +  // FitTable entry address
> +  //
> +  UINT64   Address;
> +} BIOS_INFO_STRUCT;
> +
> +extern EFI_GUID  gBiosInfoGuid;
> +
> +#pragma pack ()
> +
> +#endif
> --
> 2.19.1.windows.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [edk2-platforms] [PATCH v3 2/4] KabylakeOpenBoardPkg: Add BIOS Info PEIM
  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   ` [edk2-devel] " Nate DeSimone
  2019-10-21  1:12   ` Chiu, Chasel
  2 siblings, 0 replies; 14+ messages in thread
From: Kubacki, Michael A @ 2019-10-18  2:44 UTC (permalink / raw)
  To: Agyeman, Prince, devel@edk2.groups.io; +Cc: Sinha, Ankit, Desimone, Nathaniel L

Reviewed-by: Michael Kubacki <michael.a.kubacki@intel.com>

> -----Original Message-----
> From: Agyeman, Prince <prince.agyeman@intel.com>
> 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-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/PlatformI
> nitPei/PlatformInitPreMem.inf
>  INF IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
>  INF
> $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPreMe
> m.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.i
> nf
>  INF IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
>  INF
> $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPreMe
> m.inf
> +INF $(PLATFORM_BOARD_PACKAGE)/BiosInfo/BiosInfo.inf
> 
>  [FV.FvPostMemoryUncompact]
>  BlockSize          = $(FLASH_BLOCK_SIZE)
> --
> 2.19.1.windows.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [edk2-platforms] [PATCH v3 3/4] WhiskeylakeOpenBoardPkg: Add BIOS Info PEIM
  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
  1 sibling, 0 replies; 14+ messages in thread
From: Kubacki, Michael A @ 2019-10-18  2:44 UTC (permalink / raw)
  To: Agyeman, Prince, devel@edk2.groups.io; +Cc: Sinha, Ankit, Desimone, Nathaniel L

Reviewed-by: Michael Kubacki <michael.a.kubacki@intel.com>

> -----Original Message-----
> From: Agyeman, Prince <prince.agyeman@intel.com>
> 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-platforms] [PATCH v3 3/4] WhiskeylakeOpenBoardPkg: Add
> BIOS Info PEIM
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2211
> 
> Added BIOS Info PEIM to publish Bios Info HOB. This PEIM currently publishes
> the microcode FV 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>
> ---
>  .../BiosInfo/BiosInfo.c                       | 93 +++++++++++++++++++
>  .../BiosInfo/BiosInfo.inf                     | 49 ++++++++++
>  .../WhiskeylakeURvp/OpenBoardPkg.dsc          |  2 +
>  .../WhiskeylakeURvp/OpenBoardPkg.fdf          |  1 +
>  4 files changed, 145 insertions(+)
>  create mode 100644
> Platform/Intel/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.c
>  create mode 100644
> Platform/Intel/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.inf
> 
> diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.c
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.c
> new file mode 100644
> index 0000000000..578e66149e
> --- /dev/null
> +++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/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/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.inf
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.inf
> new file mode 100644
> index 0000000000..a9687d93de
> --- /dev/null
> +++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/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                      = A842B2D2-5C88-44E9-A9E2-4830F26662B7
> +  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
> +  CoffeelakeSiliconPkg/SiPkg.dec
> +  CoffeeLakeFspBinPkg/CoffeeLakeFspBinPkg.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/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoard
> Pkg.dsc
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoard
> Pkg.dsc
> index 423fa88c12..8e0ea2d5ce 100644
> ---
> a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoard
> Pkg.dsc
> +++
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoard
> Pk
> +++ g.dsc
> @@ -314,6 +314,7 @@
>    $(PLATFORM_PACKAGE)/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf
>  !endif
> 
> +
>    #######################################
>    # Board Package
>    #######################################
> @@ -321,6 +322,7 @@
>  !if gWhiskeylakeOpenBoardPkgTokenSpaceGuid.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/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoard
> Pkg.fdf
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoard
> Pkg.fdf
> index 320e444aae..140e6260c9 100644
> ---
> a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoard
> Pkg.fdf
> +++
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoard
> Pk
> +++ g.fdf
> @@ -240,6 +240,7 @@ INF
> $(PLATFORM_PACKAGE)/PlatformInit/ReportFv/ReportFvPei.inf
>  INF
> $(PLATFORM_PACKAGE)/PlatformInit/PlatformInitPei/PlatformInitPreMem.i
> nf
>  INF IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
>  INF
> $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPreMe
> m.inf
> +INF $(PLATFORM_BOARD_PACKAGE)/BiosInfo/BiosInfo.inf
> 
>  [FV.FvPostMemoryUncompact]
>  BlockSize          = $(FLASH_BLOCK_SIZE)
> --
> 2.19.1.windows.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [edk2-platforms] [PATCH v3 4/4] Platform/Intel: Add FIT generation tool
  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
  1 sibling, 0 replies; 14+ messages in thread
From: Kubacki, Michael A @ 2019-10-18  2:45 UTC (permalink / raw)
  To: Agyeman, Prince, devel@edk2.groups.io; +Cc: Sinha, Ankit, Desimone, Nathaniel L

Reviewed-by: Michael Kubacki <michael.a.kubacki@intel.com>

> -----Original Message-----
> From: Agyeman, Prince <prince.agyeman@intel.com>
> 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-platforms] [PATCH v3 4/4] Platform/Intel: Add FIT generation
> tool
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2210
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2211
> 
> Added FitGen tool build and FIT generation to the BIOS build process.
> 
> What was done:
> 
> - Build the FIT generation tool
> - Added default/empty BIOS_INFO_GUID to the build.cfg
> - Added BIOS_INFO_GUID to GalagoPro3,KabylakeRvp3 and
> WhiskeylakeURvp's build_config.cfg This allows a board to specify the GUID
> associated with the BIOS Info PEIM to be used in the board's FIT generation.
> 
> BIOS_INFO_GUID is passed as an argument to FitGen tool which allow the
> tool to locate the BIOS Info module to be used in FIT generation.
> 
> Cc: Ankit Sinha <ankit.sinha@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Michael Kubacki <michael.a.kubacki@intel.com>
> 
> Signed-off-by: Prince Agyeman <prince.agyeman@intel.com>
> ---
>  .../GalagoPro3/build_config.cfg               |  1 +
>  .../KabylakeRvp3/build_config.cfg             |  1 +
>  .../WhiskeylakeURvp/build_config.cfg          |  1 +
>  Platform/Intel/build.cfg                      |  1 +
>  Platform/Intel/build_bios.py                  | 57 +++++++++++++++++++
>  5 files changed, 61 insertions(+)
> 
> diff --git
> a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/build_config.cfg
> b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/build_config.cfg
> index 8c6c51abb4..458fe3d35d 100644
> --- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/build_config.cfg
> +++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/build_config.cfg
> @@ -31,3 +31,4 @@ FSP_PKG_NAME = KabylakeFspPkg  FSP_BINARY_BUILD
> = FALSE  FSP_TEST_RELEASE = FALSE  SECURE_BOOT_ENABLE = FALSE
> +BIOS_INFO_GUID = C83BCE0E-6F16-4D3C-8D9F-4D6F5A032929
> diff --git
> a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/build_config.cfg
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/build_config.cfg
> index 78f808bfaf..f6ae4b342a 100644
> --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/build_config.cfg
> +++
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/build_config.cfg
> @@ -33,3 +33,4 @@ FSP_PKG_NAME = AmberLakeFspPkg
> FSP_BINARY_BUILD = FALSE  FSP_TEST_RELEASE = FALSE
> SECURE_BOOT_ENABLE = FALSE
> +BIOS_INFO_GUID = C83BCE0E-6F16-4D3C-8D9F-4D6F5A032929
> diff --git
> a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/build_confi
> g.cfg
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/build_confi
> g.cfg
> index 1b0619bc1c..1dfe5ffd10 100644
> ---
> a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/build_confi
> g.cfg
> +++
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/build_confi
> +++ g.cfg
> @@ -31,3 +31,4 @@ FSP_PKG_NAME = CoffeelakeSiliconPkg
> FSP_BINARY_BUILD = FALSE  FSP_TEST_RELEASE = FALSE
> SECURE_BOOT_ENABLE = FALSE
> +BIOS_INFO_GUID = A842B2D2-5C88-44E9-A9E2-4830F26662B7
> diff --git a/Platform/Intel/build.cfg b/Platform/Intel/build.cfg index
> 2040774d1b..6aee96694c 100644
> --- a/Platform/Intel/build.cfg
> +++ b/Platform/Intel/build.cfg
> @@ -48,6 +48,7 @@ SECURE_BOOT_ENABLE = FALSE  REBUILD_MODE =
> BUILD_ROM_ONLY =  NUMBER_OF_PROCESSORS = 0
> +BIOS_INFO_GUID =
> 
> 
>  [PLATFORMS]
> diff --git a/Platform/Intel/build_bios.py b/Platform/Intel/build_bios.py index
> 46285df19a..ea098de705 100644
> --- a/Platform/Intel/build_bios.py
> +++ b/Platform/Intel/build_bios.py
> @@ -196,6 +196,31 @@ def pre_build(build_config, build_type="DEBUG",
> silent=False, toolchain=None):
>      if return_code != 0:
>          build_failed(config)
> 
> +    #
> +    # build platform silicon tools
> +    #
> +    # save the current workspace
> +    saved_work_directory = config["WORKSPACE"]
> +    # change the workspace to silicon tools directory
> +    config["WORKSPACE"] = os.path.join(config["WORKSPACE_SILICON"],
> + "Tools")
> +
> +    command = ["nmake"]
> +    if os.name == "posix":  # linux
> +        command = ["make"]
> +        # add path to generated FitGen binary to
> +        # environment path variable
> +        config["PATH"] += os.pathsep + \
> +                          os.path.join(config["BASE_TOOLS_PATH"],
> +                                       "Source", "C", "bin")
> +
> +    # build the silicon tools
> +    _, _, result, return_code = execute_script(command, config, shell=shell)
> +    if return_code != 0:
> +        build_failed(config)
> +
> +    # restore WORKSPACE environment variable
> +    config["WORKSPACE"] = saved_work_directory
> +
>      config["SILENT_MODE"] = 'TRUE' if silent else 'FALSE'
> 
>      print("==============================================")
> @@ -404,6 +429,35 @@ def post_build(config):
>      :returns: nothing
>      """
>      print("Running post_build to complete the build process.")
> +    board_fd = config["BOARD"].upper()
> +    final_fd = os.path.join(config["BUILD_DIR_PATH"], "FV",
> +                            "{}.fd".format(board_fd))
> +
> +    if config["BIOS_INFO_GUID"]:
> +        # Generate the fit table
> +        print("Generating FIT ...")
> +        if os.path.isfile(final_fd):
> +            temp_fd = os.path.join(config["BUILD_DIR_PATH"], "FV",
> +                                   "{}_.fd".format(board_fd))
> +            shell = True
> +            command = ["FitGen", "-D",
> +                       final_fd, temp_fd, "-NA",
> +                       "-I", config["BIOS_INFO_GUID"]]
> +
> +            if os.name == "posix": # linux
> +                shell = False
> +
> +            _, _, result, return_code = execute_script(command, config,
> shell=shell)
> +            if return_code != 0:
> +                print("Error while generating fit")
> +            else:
> +                # copy output to final binary
> +                shutil.copyfile(temp_fd, final_fd)
> +                # remove temp file
> +                os.remove(temp_fd)
> +        else:
> +            print("{} does not exist".format(final_fd))
> +            # remove temp file
> 
>      # Additional build scripts for this platform
>      result = post_build_ex(config)
> @@ -426,6 +480,9 @@ def post_build(config):
>              except OSError:
>                  pass
> 
> +    print("Done")
> +    if os.path.isfile(final_fd):
> +        print("Fd file can be found at {}".format(final_fd))
> 
>  def build_failed(config):
>      """Displays results when build fails
> --
> 2.19.1.windows.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [edk2-devel] [edk2-platforms] [PATCH v3 1/4] BoardModulePkg: Add BIOS Info HOB
  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   ` Nate DeSimone
  1 sibling, 0 replies; 14+ messages in thread
From: Nate DeSimone @ 2019-10-18  3:13 UTC (permalink / raw)
  To: devel@edk2.groups.io, Agyeman, Prince; +Cc: Sinha, Ankit, Kubacki, Michael A

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 1/4] BoardModulePkg: Add BIOS Info HOB

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2210
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2211

Added gBiosInfoGuid to be used in
publishing the BIOS information HOB
which is needed in FIT generation

Also added the BIOS Info header
file BiosInfo.h that defines the
BIOS info struct and GUID

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>
---
 .../Intel/BoardModulePkg/BoardModulePkg.dec   |  3 +
 .../BoardModulePkg/Include/Guid/BiosInfo.h    | 61 +++++++++++++++++++
 2 files changed, 64 insertions(+)
 create mode 100644 Platform/Intel/BoardModulePkg/Include/Guid/BiosInfo.h

diff --git a/Platform/Intel/BoardModulePkg/BoardModulePkg.dec b/Platform/Intel/BoardModulePkg/BoardModulePkg.dec
index f96fb09aa1..f461cc7cab 100644
--- a/Platform/Intel/BoardModulePkg/BoardModulePkg.dec
+++ b/Platform/Intel/BoardModulePkg/BoardModulePkg.dec
@@ -39,3 +39,6 @@
 [Guids]
   ## Include Include/Guid/BiosId.h
   gBiosIdGuid = { 0xC3E36D09, 0x8294, 0x4b97, { 0xA8, 0x57, 0xD5, 0x28, 0x8F, 0xE3, 0x3E, 0x28 } }
+
+  ## GUID to publish BIOS information HOB  gBiosInfoGuid = { 
+ 0x09d0d15c, 0xe9f0, 0x4dfc, {0x9e, 0x0b, 0x39, 0x33, 0x1f, 0xca, 0x66, 
+ 0x85} }
diff --git a/Platform/Intel/BoardModulePkg/Include/Guid/BiosInfo.h b/Platform/Intel/BoardModulePkg/Include/Guid/BiosInfo.h
new file mode 100644
index 0000000000..d73409ea6f
--- /dev/null
+++ b/Platform/Intel/BoardModulePkg/Include/Guid/BiosInfo.h
@@ -0,0 +1,61 @@
+/** @file
+  Definitions and GUID for BIOS INFO.
+
+  Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+  SPDX-License-Identifier: BSD-2-Clause-Patent **/
+
+#ifndef _BIOS_INFO_H_
+#define _BIOS_INFO_H_
+
+//
+// BIOS INFO data structure
+// This is self contained data structure for BIOS info for TXT // 
+#pragma pack (1) #define BIOS_INFO_SIGNATURE  SIGNATURE_64 ('$', 'B', 
+'I', 'O', 'S', 'I', 'F', '$') typedef struct {
+  UINT64            Signature;
+  UINT32            EntryCount;
+  UINT32            Reserved;
+//BIOS_INFO_STRUCT  Struct[EntryCount]; } BIOS_INFO_HEADER;
+
+//
+// BIOS_INFO_STRUCT attributes
+// bits[0:3] means general attributes
+// bits[4:7] means type specific attributes // #define 
+BIOS_INFO_STRUCT_ATTRIBUTE_GENERAL_EXCLUDE_FROM_FIT  0x01
+#define BIOS_INFO_STRUCT_ATTRIBUTE_MICROCODE_WHOLE_REGION    0x10
+#define BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB             0x10
+#define BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_NON_IBB              0x20
+
+typedef struct {
+  //
+  // FitTable entry type
+  //
+  UINT8    Type;
+  //
+  // BIOS_INFO_STRUCT attributes
+  //
+  UINT8    Attributes;
+  //
+  // FitTable entry version
+  //
+  UINT16   Version;
+  //
+  // FitTable entry real size
+  //
+  UINT32   Size;
+  //
+  // FitTable entry address
+  //
+  UINT64   Address;
+} BIOS_INFO_STRUCT;
+
+extern EFI_GUID  gBiosInfoGuid;
+
+#pragma pack ()
+
+#endif
--
2.19.1.windows.1





^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [edk2-devel] [edk2-platforms] [PATCH v3 2/4] KabylakeOpenBoardPkg: Add BIOS Info PEIM
  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
  2019-10-21  1:12   ` Chiu, Chasel
  2 siblings, 0 replies; 14+ messages in thread
From: Nate DeSimone @ 2019-10-18  3:13 UTC (permalink / raw)
  To: devel@edk2.groups.io, Agyeman, Prince; +Cc: Sinha, Ankit, Kubacki, Michael A

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





^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [edk2-platforms] [PATCH v3 3/4] WhiskeylakeOpenBoardPkg: Add BIOS Info PEIM
  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
  1 sibling, 0 replies; 14+ messages in thread
From: Nate DeSimone @ 2019-10-18  3:13 UTC (permalink / raw)
  To: Agyeman, Prince, devel@edk2.groups.io; +Cc: Sinha, Ankit, Kubacki, Michael A

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

-----Original Message-----
From: Agyeman, Prince <prince.agyeman@intel.com> 
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-platforms] [PATCH v3 3/4] WhiskeylakeOpenBoardPkg: Add BIOS Info PEIM

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2211

Added BIOS Info PEIM to publish Bios Info HOB. This PEIM currently publishes the microcode FV 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>
---
 .../BiosInfo/BiosInfo.c                       | 93 +++++++++++++++++++
 .../BiosInfo/BiosInfo.inf                     | 49 ++++++++++
 .../WhiskeylakeURvp/OpenBoardPkg.dsc          |  2 +
 .../WhiskeylakeURvp/OpenBoardPkg.fdf          |  1 +
 4 files changed, 145 insertions(+)
 create mode 100644 Platform/Intel/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.c
 create mode 100644 Platform/Intel/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.inf

diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.c b/Platform/Intel/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.c
new file mode 100644
index 0000000000..578e66149e
--- /dev/null
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/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/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.inf b/Platform/Intel/WhiskeylakeOpenBoardPkg/BiosInfo/BiosInfo.inf
new file mode 100644
index 0000000000..a9687d93de
--- /dev/null
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/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                      = A842B2D2-5C88-44E9-A9E2-4830F26662B7
+  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
+  CoffeelakeSiliconPkg/SiPkg.dec
+  CoffeeLakeFspBinPkg/CoffeeLakeFspBinPkg.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/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
index 423fa88c12..8e0ea2d5ce 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPk
+++ g.dsc
@@ -314,6 +314,7 @@
   $(PLATFORM_PACKAGE)/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf
 !endif
 
+
   #######################################
   # Board Package
   #######################################
@@ -321,6 +322,7 @@
 !if gWhiskeylakeOpenBoardPkgTokenSpaceGuid.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/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
index 320e444aae..140e6260c9 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPk
+++ g.fdf
@@ -240,6 +240,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


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [edk2-platforms] [PATCH v3 4/4] Platform/Intel: Add FIT generation tool
  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
  1 sibling, 0 replies; 14+ messages in thread
From: Nate DeSimone @ 2019-10-18  3:13 UTC (permalink / raw)
  To: Agyeman, Prince, devel@edk2.groups.io; +Cc: Sinha, Ankit, Kubacki, Michael A

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

-----Original Message-----
From: Agyeman, Prince <prince.agyeman@intel.com> 
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-platforms] [PATCH v3 4/4] Platform/Intel: Add FIT generation tool

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2210
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2211

Added FitGen tool build and FIT generation to the BIOS build process.

What was done:

- Build the FIT generation tool
- Added default/empty BIOS_INFO_GUID to the build.cfg
- Added BIOS_INFO_GUID to GalagoPro3,KabylakeRvp3 and WhiskeylakeURvp's build_config.cfg This allows a board to specify the GUID associated with the BIOS Info PEIM to be used in the board's FIT generation.

BIOS_INFO_GUID is passed as an argument to FitGen tool which allow the tool to locate the BIOS Info module to be used in FIT generation.

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

Signed-off-by: Prince Agyeman <prince.agyeman@intel.com>
---
 .../GalagoPro3/build_config.cfg               |  1 +
 .../KabylakeRvp3/build_config.cfg             |  1 +
 .../WhiskeylakeURvp/build_config.cfg          |  1 +
 Platform/Intel/build.cfg                      |  1 +
 Platform/Intel/build_bios.py                  | 57 +++++++++++++++++++
 5 files changed, 61 insertions(+)

diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/build_config.cfg b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/build_config.cfg
index 8c6c51abb4..458fe3d35d 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/build_config.cfg
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/build_config.cfg
@@ -31,3 +31,4 @@ FSP_PKG_NAME = KabylakeFspPkg  FSP_BINARY_BUILD = FALSE  FSP_TEST_RELEASE = FALSE  SECURE_BOOT_ENABLE = FALSE
+BIOS_INFO_GUID = C83BCE0E-6F16-4D3C-8D9F-4D6F5A032929
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/build_config.cfg b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/build_config.cfg
index 78f808bfaf..f6ae4b342a 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/build_config.cfg
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/build_config.cfg
@@ -33,3 +33,4 @@ FSP_PKG_NAME = AmberLakeFspPkg  FSP_BINARY_BUILD = FALSE  FSP_TEST_RELEASE = FALSE  SECURE_BOOT_ENABLE = FALSE
+BIOS_INFO_GUID = C83BCE0E-6F16-4D3C-8D9F-4D6F5A032929
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/build_config.cfg b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/build_config.cfg
index 1b0619bc1c..1dfe5ffd10 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/build_config.cfg
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/build_confi
+++ g.cfg
@@ -31,3 +31,4 @@ FSP_PKG_NAME = CoffeelakeSiliconPkg  FSP_BINARY_BUILD = FALSE  FSP_TEST_RELEASE = FALSE  SECURE_BOOT_ENABLE = FALSE
+BIOS_INFO_GUID = A842B2D2-5C88-44E9-A9E2-4830F26662B7
diff --git a/Platform/Intel/build.cfg b/Platform/Intel/build.cfg index 2040774d1b..6aee96694c 100644
--- a/Platform/Intel/build.cfg
+++ b/Platform/Intel/build.cfg
@@ -48,6 +48,7 @@ SECURE_BOOT_ENABLE = FALSE  REBUILD_MODE =  BUILD_ROM_ONLY =  NUMBER_OF_PROCESSORS = 0
+BIOS_INFO_GUID =
 
 
 [PLATFORMS]
diff --git a/Platform/Intel/build_bios.py b/Platform/Intel/build_bios.py index 46285df19a..ea098de705 100644
--- a/Platform/Intel/build_bios.py
+++ b/Platform/Intel/build_bios.py
@@ -196,6 +196,31 @@ def pre_build(build_config, build_type="DEBUG", silent=False, toolchain=None):
     if return_code != 0:
         build_failed(config)
 
+    #
+    # build platform silicon tools
+    #
+    # save the current workspace
+    saved_work_directory = config["WORKSPACE"]
+    # change the workspace to silicon tools directory
+    config["WORKSPACE"] = os.path.join(config["WORKSPACE_SILICON"], 
+ "Tools")
+
+    command = ["nmake"]
+    if os.name == "posix":  # linux
+        command = ["make"]
+        # add path to generated FitGen binary to
+        # environment path variable
+        config["PATH"] += os.pathsep + \
+                          os.path.join(config["BASE_TOOLS_PATH"],
+                                       "Source", "C", "bin")
+
+    # build the silicon tools
+    _, _, result, return_code = execute_script(command, config, shell=shell)
+    if return_code != 0:
+        build_failed(config)
+
+    # restore WORKSPACE environment variable
+    config["WORKSPACE"] = saved_work_directory
+
     config["SILENT_MODE"] = 'TRUE' if silent else 'FALSE'
 
     print("==============================================")
@@ -404,6 +429,35 @@ def post_build(config):
     :returns: nothing
     """
     print("Running post_build to complete the build process.")
+    board_fd = config["BOARD"].upper()
+    final_fd = os.path.join(config["BUILD_DIR_PATH"], "FV",
+                            "{}.fd".format(board_fd))
+
+    if config["BIOS_INFO_GUID"]:
+        # Generate the fit table
+        print("Generating FIT ...")
+        if os.path.isfile(final_fd):
+            temp_fd = os.path.join(config["BUILD_DIR_PATH"], "FV",
+                                   "{}_.fd".format(board_fd))
+            shell = True
+            command = ["FitGen", "-D",
+                       final_fd, temp_fd, "-NA",
+                       "-I", config["BIOS_INFO_GUID"]]
+
+            if os.name == "posix": # linux
+                shell = False
+
+            _, _, result, return_code = execute_script(command, config, shell=shell)
+            if return_code != 0:
+                print("Error while generating fit")
+            else:
+                # copy output to final binary
+                shutil.copyfile(temp_fd, final_fd)
+                # remove temp file
+                os.remove(temp_fd)
+        else:
+            print("{} does not exist".format(final_fd))
+            # remove temp file
 
     # Additional build scripts for this platform
     result = post_build_ex(config)
@@ -426,6 +480,9 @@ def post_build(config):
             except OSError:
                 pass
 
+    print("Done")
+    if os.path.isfile(final_fd):
+        print("Fd file can be found at {}".format(final_fd))
 
 def build_failed(config):
     """Displays results when build fails
--
2.19.1.windows.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [edk2-devel] [edk2-platforms] [PATCH v3 2/4] KabylakeOpenBoardPkg: Add BIOS Info PEIM
  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   ` [edk2-devel] " Nate DeSimone
@ 2019-10-21  1:12   ` Chiu, Chasel
  2 siblings, 0 replies; 14+ messages in thread
From: Chiu, Chasel @ 2019-10-21  1:12 UTC (permalink / raw)
  To: devel@edk2.groups.io, Agyeman, Prince
  Cc: Sinha, Ankit, Desimone, Nathaniel L, Kubacki, Michael A


Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <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 <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/PlatformIn
> itPei/PlatformInitPreMem.inf
>  INF IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
>  INF
> $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPreMe
> m.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/SiliconPolicyPeiPreMe
> m.inf
> +INF $(PLATFORM_BOARD_PACKAGE)/BiosInfo/BiosInfo.inf
> 
>  [FV.FvPostMemoryUncompact]
>  BlockSize          = $(FLASH_BLOCK_SIZE)
> --
> 2.19.1.windows.1
> 
> 
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-10-21  1:13 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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   ` [edk2-devel] " Nate DeSimone
2019-10-21  1:12   ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox