public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-platforms] [PATCH 0/5] Add FIT support using FitGen
@ 2019-10-03 21:12 Agyeman, Prince
  2019-10-03 21:12 ` [edk2-platforms] [PATCH 1/5] BoardModulePkg: Add bios info HOB Agyeman, Prince
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Agyeman, Prince @ 2019-10-03 21:12 UTC (permalink / raw)
  To: devel

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

This series of patches
 1. Add the generation of the FitGen tool to build_bios.py
 2. Add Firmware Interface Table (FIT) to the final images of:
    a. KabylakeOpenBoardPkg/KabylakeRvp3
    b. KabylakeOpenBoardPkg/GalagoPro3
    c. WhiskeylakeOpenBoardPkg/WhiskeylakeURvp

What each patch does:
0001-BoardModulePkg-Add-bios-info-HOB: Adds the gBiosInfoGuid
and the Bios Info struct for the Bios info HOB

0002-KabylakeOpenBoardPkg-KabylakeRvp3-Add-BIOS-Info-PEIM,
0003-KabylakeOpenBoardPkg-GalagoPro3-Add-BiosInfo-PEIM,
0004-WhiskeylakeOpenBoardPkg-Add-BIOS-INFO-PEIM:
Patches 0002,0003,0004 add bios info PEIM to KabylakeRvp3,
GalagoPro3 and WhiskeylakeURvp boards respectively

0005-Platform-Intel-Add-FIT-generation-tool
Adds the FitGen tool binary and FIT generation to
the BIOS build process.

Prince Agyeman (5):
  BoardModulePkg: Add bios info HOB
  KabylakeOpenBoardPkg/KabylakeRvp3: Add BIOS Info PEIM
  KabylakeOpenBoardPkg/GalagoPro3: Add BiosInfo PEIM
  WhiskeylakeOpenBoardPkg: Add BIOS INFO PEIM
  Platform/Intel: Add FIT generation tool

 .../Intel/BoardModulePkg/BoardModulePkg.dec   |  3 +
 .../BoardModulePkg/Include/Library/BiosInfo.h | 62 +++++++++++++
 .../GalagoPro3/BiosInfo/BiosInfo.c            | 92 ++++++++++++++++++
 .../GalagoPro3/BiosInfo/BiosInfo.inf          | 48 ++++++++++
 .../GalagoPro3/OpenBoardPkg.dsc               |  2 +
 .../GalagoPro3/OpenBoardPkg.fdf               |  1 +
 .../GalagoPro3/build_config.cfg               |  1 +
 .../KabylakeRvp3/BiosInfo/BiosInfo.c          | 93 +++++++++++++++++++
 .../KabylakeRvp3/BiosInfo/BiosInfo.inf        | 48 ++++++++++
 .../KabylakeRvp3/OpenBoardPkg.dsc             |  2 +
 .../KabylakeRvp3/OpenBoardPkg.fdf             |  1 +
 .../KabylakeRvp3/build_config.cfg             |  1 +
 .../WhiskeylakeURvp/BiosInfo/BiosInfo.c       | 93 +++++++++++++++++++
 .../WhiskeylakeURvp/BiosInfo/BiosInfo.inf     | 48 ++++++++++
 .../WhiskeylakeURvp/OpenBoardPkg.dsc          |  2 +
 .../WhiskeylakeURvp/OpenBoardPkg.fdf          |  1 +
 .../WhiskeylakeURvp/build_config.cfg          |  1 +
 Platform/Intel/build.cfg                      |  1 +
 Platform/Intel/build_bios.py                  | 57 ++++++++++++
 19 files changed, 557 insertions(+)
 create mode 100644 Platform/Intel/BoardModulePkg/Include/Library/BiosInfo.h
 create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c
 create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.inf
 create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.c
 create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.inf
 create mode 100644 Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/BiosInfo.c
 create mode 100644 Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/BiosInfo.inf

-- 
2.19.1.windows.1


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

* [edk2-platforms] [PATCH 1/5] BoardModulePkg: Add bios info HOB
  2019-10-03 21:12 [edk2-platforms] [PATCH 0/5] Add FIT support using FitGen Agyeman, Prince
@ 2019-10-03 21:12 ` Agyeman, Prince
  2019-10-07 22:27   ` Nate DeSimone
  2019-10-08  0:34   ` Kubacki, Michael A
  2019-10-03 21:12 ` [edk2-platforms] [PATCH 2/5] KabylakeOpenBoardPkg/KabylakeRvp3: Add BIOS Info PEIM Agyeman, Prince
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 20+ messages in thread
From: Agyeman, Prince @ 2019-10-03 21:12 UTC (permalink / raw)
  To: devel; +Cc: Ankit Sinha, Nate DeSimone, Kubacki Michael A

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

Also added the Bios Info header
file BiosInfo.h

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/Library/BiosInfo.h | 62 +++++++++++++++++++
 2 files changed, 65 insertions(+)
 create mode 100644 Platform/Intel/BoardModulePkg/Include/Library/BiosInfo.h

diff --git a/Platform/Intel/BoardModulePkg/BoardModulePkg.dec b/Platform/Intel/BoardModulePkg/BoardModulePkg.dec
index 6f13945ca8..035427b2f5 100644
--- a/Platform/Intel/BoardModulePkg/BoardModulePkg.dec
+++ b/Platform/Intel/BoardModulePkg/BoardModulePkg.dec
@@ -36,3 +36,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/Library/BiosInfo.h b/Platform/Intel/BoardModulePkg/Include/Library/BiosInfo.h
new file mode 100644
index 0000000000..bba1c07bff
--- /dev/null
+++ b/Platform/Intel/BoardModulePkg/Include/Library/BiosInfo.h
@@ -0,0 +1,62 @@
+/** @file
+
+  Driver for BIOS Info support.
+
+  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] 20+ messages in thread

* [edk2-platforms] [PATCH 2/5] KabylakeOpenBoardPkg/KabylakeRvp3: Add BIOS Info PEIM
  2019-10-03 21:12 [edk2-platforms] [PATCH 0/5] Add FIT support using FitGen Agyeman, Prince
  2019-10-03 21:12 ` [edk2-platforms] [PATCH 1/5] BoardModulePkg: Add bios info HOB Agyeman, Prince
@ 2019-10-03 21:12 ` Agyeman, Prince
  2019-10-07 22:27   ` Nate DeSimone
                     ` (2 more replies)
  2019-10-03 21:12 ` [edk2-platforms] [PATCH 3/5] KabylakeOpenBoardPkg/GalagoPro3: Add BiosInfo PEIM Agyeman, Prince
                   ` (3 subsequent siblings)
  5 siblings, 3 replies; 20+ messages in thread
From: Agyeman, Prince @ 2019-10-03 21:12 UTC (permalink / raw)
  To: devel; +Cc: Ankit Sinha, Nate DeSimone, Kubacki Michael A

Added BIOS Info PEIM to KabylakeRvp3 to publish
the BIOS info HOB. This PEIM currently publishs
the board's microcode region info.

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>
---
 .../KabylakeRvp3/BiosInfo/BiosInfo.c          | 93 +++++++++++++++++++
 .../KabylakeRvp3/BiosInfo/BiosInfo.inf        | 48 ++++++++++
 .../KabylakeRvp3/OpenBoardPkg.dsc             |  2 +
 .../KabylakeRvp3/OpenBoardPkg.fdf             |  1 +
 4 files changed, 144 insertions(+)
 create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.c
 create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.inf

diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.c b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.c
new file mode 100644
index 0000000000..6a058a0fc2
--- /dev/null
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/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 <Library/BiosInfo.h>
+#include <Library/PeiServicesLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/HobLib.h>
+#include <Library/PcdLib.h>
+#include <IndustryStandard/FirmwareInterfaceTable.h>
+
+#define INDEXPORT_TO_ADDRESS(x)             (x)
+#define DATAPORT_TO_ADDRESS(x)              ((x) << 16)
+#define PORTWIDTH_TO_ADDRESS(x)             ((x) << 32)
+#define PORTBITNUMBER_TO_ADDRESS(x)         ((x) << 40)
+#define PORTINDEXNUMBER_TO_ADDRESS(x)       ((x) << 48)
+
+//
+// Internal
+//
+#pragma pack (1)
+
+typedef struct {
+  BIOS_INFO_HEADER  Header;
+  BIOS_INFO_STRUCT  Entry[1];
+} BIOS_INFO;
+#pragma pack ()
+
+GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO  mBiosInfo = {
+  {
+    BIOS_INFO_SIGNATURE,
+    1,
+    0,
+  },
+  {
+    {
+      FIT_TYPE_01_MICROCODE,
+      BIOS_INFO_STRUCT_ATTRIBUTE_MICROCODE_WHOLE_REGION,
+      0x0100,
+      FixedPcdGet32 (PcdFlashMicrocodeFvSize),
+      FixedPcdGet32 (PcdFlashMicrocodeFvBase)
+    }
+  }
+};
+
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR  mBiosInfoPpiList = {
+  EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
+  &gBiosInfoGuid,
+  &mBiosInfo
+};
+
+/**
+  Installs BiosInfo Ppi.
+
+  @param  FileHandle  Handle of the file being invoked.
+  @param  PeiServices Describes the list of possible PEI Services.
+
+  @retval EFI_SUCCESS   Install the BiosInfo Ppi successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+BiosInfoEntryPoint (
+  IN       EFI_PEI_FILE_HANDLE  FileHandle,
+  IN CONST EFI_PEI_SERVICES     **PeiServices
+  )
+{
+  EFI_STATUS  Status;
+  VOID        *HobData;
+
+  //
+  // Install PPI, so that other PEI module can add dependency.
+  //
+  Status = PeiServicesInstallPpi (&mBiosInfoPpiList);
+  ASSERT_EFI_ERROR (Status);
+
+  //
+  // Build hob, so that DXE module can also get the data.
+  //
+  HobData = BuildGuidHob (&gBiosInfoGuid, sizeof (mBiosInfo));
+  ASSERT (HobData != NULL);
+  if (HobData == NULL) {
+    return EFI_OUT_OF_RESOURCES;
+  }
+  CopyMem (HobData, &mBiosInfo, sizeof (mBiosInfo));
+
+  return EFI_SUCCESS;
+}
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.inf b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.inf
new file mode 100644
index 0000000000..94543408b1
--- /dev/null
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.inf
@@ -0,0 +1,48 @@
+### @file
+#  Module Information description file for BIOS Info Driver
+#
+#  Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+###
+
+[Defines]
+  INF_VERSION                    = 0x00010017
+  BASE_NAME                      = BiosInfo
+  FILE_GUID                      = 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
+
+[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/KabylakeRvp3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
index 7090852192..ef69a19aa4 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
@@ -324,6 +324,8 @@
   }
 !endif
 
+  $(PROJECT)/BiosInfo/BiosInfo.inf
+
 #
 # Security
 #
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
index 2b8eab36a1..81181710e6 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 $(PROJECT)/BiosInfo/BiosInfo.inf
 
 [FV.FvPostMemoryUncompact]
 BlockSize          = $(FLASH_BLOCK_SIZE)
-- 
2.19.1.windows.1


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

* [edk2-platforms] [PATCH 3/5] KabylakeOpenBoardPkg/GalagoPro3: Add BiosInfo PEIM
  2019-10-03 21:12 [edk2-platforms] [PATCH 0/5] Add FIT support using FitGen Agyeman, Prince
  2019-10-03 21:12 ` [edk2-platforms] [PATCH 1/5] BoardModulePkg: Add bios info HOB Agyeman, Prince
  2019-10-03 21:12 ` [edk2-platforms] [PATCH 2/5] KabylakeOpenBoardPkg/KabylakeRvp3: Add BIOS Info PEIM Agyeman, Prince
@ 2019-10-03 21:12 ` Agyeman, Prince
  2019-10-07 22:27   ` Nate DeSimone
  2019-10-03 21:12 ` [edk2-platforms] [PATCH 4/5] WhiskeylakeOpenBoardPkg: Add BIOS INFO PEIM Agyeman, Prince
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Agyeman, Prince @ 2019-10-03 21:12 UTC (permalink / raw)
  To: devel; +Cc: Ankit Sinha, Nate DeSimone, Kubacki Michael A

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

Cc: Ankit Sinha <ankit.sinha@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>
---
 .../GalagoPro3/BiosInfo/BiosInfo.c            | 92 +++++++++++++++++++
 .../GalagoPro3/BiosInfo/BiosInfo.inf          | 48 ++++++++++
 .../GalagoPro3/OpenBoardPkg.dsc               |  2 +
 .../GalagoPro3/OpenBoardPkg.fdf               |  1 +
 4 files changed, 143 insertions(+)
 create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c
 create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.inf

diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c
new file mode 100644
index 0000000000..4db9d4685c
--- /dev/null
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c
@@ -0,0 +1,92 @@
+/** @file
+  Driver for BIOS Info support.
+
+Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+#include <PiPei.h>
+#include <Library/BiosInfo.h>
+#include <Library/PeiServicesLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/HobLib.h>
+#include <Library/PcdLib.h>
+#include <IndustryStandard/FirmwareInterfaceTable.h>
+
+#define INDEXPORT_TO_ADDRESS(x)             (x)
+#define DATAPORT_TO_ADDRESS(x)              ((x) << 16)
+#define PORTWIDTH_TO_ADDRESS(x)             ((x) << 32)
+#define PORTBITNUMBER_TO_ADDRESS(x)         ((x) << 40)
+#define PORTINDEXNUMBER_TO_ADDRESS(x)       ((x) << 48)
+
+//
+// Internal
+//
+#pragma pack (1)
+
+typedef struct {
+  BIOS_INFO_HEADER  Header;
+  BIOS_INFO_STRUCT  Entry[1];
+} BIOS_INFO;
+#pragma pack ()
+
+GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO  mBiosInfo = {
+  {
+    BIOS_INFO_SIGNATURE,
+    1,
+    0,
+  },
+  {
+    {
+      FIT_TYPE_01_MICROCODE,
+      BIOS_INFO_STRUCT_ATTRIBUTE_MICROCODE_WHOLE_REGION,
+      0x0100,
+      FixedPcdGet32 (PcdFlashMicrocodeFvSize),
+      FixedPcdGet32 (PcdFlashMicrocodeFvBase)
+    }
+  }
+};
+
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR  mBiosInfoPpiList = {
+  EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
+  &gBiosInfoGuid,
+  &mBiosInfo
+};
+
+/**
+  Installs BiosInfo Ppi.
+
+  @param  FileHandle  Handle of the file being invoked.
+  @param  PeiServices Describes the list of possible PEI Services.
+
+  @retval EFI_SUCCESS   Install the BiosInfo Ppi successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+BiosInfoEntryPoint (
+  IN       EFI_PEI_FILE_HANDLE  FileHandle,
+  IN CONST EFI_PEI_SERVICES     **PeiServices
+  )
+{
+  EFI_STATUS  Status;
+  VOID        *HobData;
+
+  //
+  // Install PPI, so that other PEI module can add dependency.
+  //
+  Status = PeiServicesInstallPpi (&mBiosInfoPpiList);
+  ASSERT_EFI_ERROR (Status);
+
+  //
+  // Build hob, so that DXE module can also get the data.
+  //
+  HobData = BuildGuidHob (&gBiosInfoGuid, sizeof (mBiosInfo));
+  ASSERT (HobData != NULL);
+  if (HobData == NULL) {
+    return EFI_OUT_OF_RESOURCES;
+  }
+  CopyMem (HobData, &mBiosInfo, sizeof (mBiosInfo));
+
+  return EFI_SUCCESS;
+}
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.inf b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.inf
new file mode 100644
index 0000000000..a0e18cff9c
--- /dev/null
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.inf
@@ -0,0 +1,48 @@
+### @file
+#  Module Information description file for BIOS Info Driver
+#
+#  Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+###
+
+[Defines]
+  INF_VERSION                    = 0x00010017
+  BASE_NAME                      = BiosInfo
+  FILE_GUID                      = 3132E669-D16B-4AA7-B09B-BC0EB5F40E1F
+  VERSION_STRING                 = 1.0
+  MODULE_TYPE                    = PEIM
+  ENTRY_POINT                    = BiosInfoEntryPoint
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES IA32 X64
+#
+
+[LibraryClasses]
+  PeimEntryPoint
+  PeiServicesLib
+  HobLib
+  BaseMemoryLib
+  DebugLib
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  IntelSiliconPkg/IntelSiliconPkg.dec
+  KabylakeSiliconPkg/SiPkg.dec
+  KabylakeFspBinPkg/KabylakeFspBinPkg.dec
+  BoardModulePkg/BoardModulePkg.dec
+  MinPlatformPkg/MinPlatformPkg.dec
+
+[Pcd]
+  gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvBase                    ## CONSUMES
+  gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize                    ## CONSUMES
+
+[Sources]
+  BiosInfo.c
+
+[Guids]
+  gBiosInfoGuid                                 ## PRODUCES
+
+[Depex]
+  TRUE
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
index d67e0cc000..64e25168c7 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
@@ -244,6 +244,8 @@
   }
   $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPostMem.inf
 
+  $(PROJECT)/BiosInfo/BiosInfo.inf
+
 #
 # Security
 #
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
index 56bb0edaad..a095c044a5 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
@@ -240,6 +240,7 @@ INF $(PLATFORM_PACKAGE)/PlatformInit/ReportFv/ReportFvPei.inf
 INF $(PROJECT)/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
 INF IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
 INF $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPreMem.inf
+INF $(PROJECT)/BiosInfo/BiosInfo.inf
 
 [FV.FvPostMemoryUncompact]
 BlockSize          = $(FLASH_BLOCK_SIZE)
-- 
2.19.1.windows.1


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

* [edk2-platforms] [PATCH 4/5] WhiskeylakeOpenBoardPkg: Add BIOS INFO PEIM
  2019-10-03 21:12 [edk2-platforms] [PATCH 0/5] Add FIT support using FitGen Agyeman, Prince
                   ` (2 preceding siblings ...)
  2019-10-03 21:12 ` [edk2-platforms] [PATCH 3/5] KabylakeOpenBoardPkg/GalagoPro3: Add BiosInfo PEIM Agyeman, Prince
@ 2019-10-03 21:12 ` Agyeman, Prince
  2019-10-07 22:27   ` Nate DeSimone
  2019-10-08  1:32   ` Kubacki, Michael A
  2019-10-03 21:12 ` [edk2-platforms] [PATCH 5/5] Platform/Intel: Add FIT generation tool Agyeman, Prince
  2019-10-08  1:38 ` [edk2-devel] [edk2-platforms] [PATCH 0/5] Add FIT support using FitGen Kubacki, Michael A
  5 siblings, 2 replies; 20+ messages in thread
From: Agyeman, Prince @ 2019-10-03 21:12 UTC (permalink / raw)
  To: devel; +Cc: Ankit Sinha, Nate DeSimone, Kubacki Michael A

Added BIOS info PEIM to publish Bios Info
HOB. This PEIM currently publishes the microcode
FV info.

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>
---
 .../WhiskeylakeURvp/BiosInfo/BiosInfo.c       | 93 +++++++++++++++++++
 .../WhiskeylakeURvp/BiosInfo/BiosInfo.inf     | 48 ++++++++++
 .../WhiskeylakeURvp/OpenBoardPkg.dsc          |  2 +
 .../WhiskeylakeURvp/OpenBoardPkg.fdf          |  1 +
 4 files changed, 144 insertions(+)
 create mode 100644 Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/BiosInfo.c
 create mode 100644 Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/BiosInfo.inf

diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/BiosInfo.c b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/BiosInfo.c
new file mode 100644
index 0000000000..6a058a0fc2
--- /dev/null
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/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 <Library/BiosInfo.h>
+#include <Library/PeiServicesLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/HobLib.h>
+#include <Library/PcdLib.h>
+#include <IndustryStandard/FirmwareInterfaceTable.h>
+
+#define INDEXPORT_TO_ADDRESS(x)             (x)
+#define DATAPORT_TO_ADDRESS(x)              ((x) << 16)
+#define PORTWIDTH_TO_ADDRESS(x)             ((x) << 32)
+#define PORTBITNUMBER_TO_ADDRESS(x)         ((x) << 40)
+#define PORTINDEXNUMBER_TO_ADDRESS(x)       ((x) << 48)
+
+//
+// Internal
+//
+#pragma pack (1)
+
+typedef struct {
+  BIOS_INFO_HEADER  Header;
+  BIOS_INFO_STRUCT  Entry[1];
+} BIOS_INFO;
+#pragma pack ()
+
+GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO  mBiosInfo = {
+  {
+    BIOS_INFO_SIGNATURE,
+    1,
+    0,
+  },
+  {
+    {
+      FIT_TYPE_01_MICROCODE,
+      BIOS_INFO_STRUCT_ATTRIBUTE_MICROCODE_WHOLE_REGION,
+      0x0100,
+      FixedPcdGet32 (PcdFlashMicrocodeFvSize),
+      FixedPcdGet32 (PcdFlashMicrocodeFvBase)
+    }
+  }
+};
+
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR  mBiosInfoPpiList = {
+  EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
+  &gBiosInfoGuid,
+  &mBiosInfo
+};
+
+/**
+  Installs BiosInfo Ppi.
+
+  @param  FileHandle  Handle of the file being invoked.
+  @param  PeiServices Describes the list of possible PEI Services.
+
+  @retval EFI_SUCCESS   Install the BiosInfo Ppi successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+BiosInfoEntryPoint (
+  IN       EFI_PEI_FILE_HANDLE  FileHandle,
+  IN CONST EFI_PEI_SERVICES     **PeiServices
+  )
+{
+  EFI_STATUS  Status;
+  VOID        *HobData;
+
+  //
+  // Install PPI, so that other PEI module can add dependency.
+  //
+  Status = PeiServicesInstallPpi (&mBiosInfoPpiList);
+  ASSERT_EFI_ERROR (Status);
+
+  //
+  // Build hob, so that DXE module can also get the data.
+  //
+  HobData = BuildGuidHob (&gBiosInfoGuid, sizeof (mBiosInfo));
+  ASSERT (HobData != NULL);
+  if (HobData == NULL) {
+    return EFI_OUT_OF_RESOURCES;
+  }
+  CopyMem (HobData, &mBiosInfo, sizeof (mBiosInfo));
+
+  return EFI_SUCCESS;
+}
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/BiosInfo.inf b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/BiosInfo.inf
new file mode 100644
index 0000000000..f268de00f5
--- /dev/null
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/BiosInfo.inf
@@ -0,0 +1,48 @@
+### @file
+#  Module Information description file for BIOS Info Driver
+#
+#  Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+###
+
+[Defines]
+  INF_VERSION                    = 0x00010017
+  BASE_NAME                      = BiosInfo
+  FILE_GUID                      = 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
+
+[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 eea809140c..00a89f4507 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
@@ -246,6 +246,8 @@
       SiliconPolicyUpdateLib|MinPlatformPkg/PlatformInit/Library/SiliconPolicyUpdateLibNull/SiliconPolicyUpdateLibNull.inf
   }
 
+  $(PROJECT)/BiosInfo/BiosInfo.inf
+
   #
   # Security
   #
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
index 611078e4b4..867cee8a64 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
@@ -237,6 +237,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 $(PROJECT)/BiosInfo/BiosInfo.inf
 
 [FV.FvPostMemoryUncompact]
 BlockSize          = $(FLASH_BLOCK_SIZE)
-- 
2.19.1.windows.1


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

* [edk2-platforms] [PATCH 5/5] Platform/Intel: Add FIT generation tool
  2019-10-03 21:12 [edk2-platforms] [PATCH 0/5] Add FIT support using FitGen Agyeman, Prince
                   ` (3 preceding siblings ...)
  2019-10-03 21:12 ` [edk2-platforms] [PATCH 4/5] WhiskeylakeOpenBoardPkg: Add BIOS INFO PEIM Agyeman, Prince
@ 2019-10-03 21:12 ` Agyeman, Prince
  2019-10-07 22:27   ` Nate DeSimone
                     ` (2 more replies)
  2019-10-08  1:38 ` [edk2-devel] [edk2-platforms] [PATCH 0/5] Add FIT support using FitGen Kubacki, Michael A
  5 siblings, 3 replies; 20+ messages in thread
From: Agyeman, Prince @ 2019-10-03 21:12 UTC (permalink / raw)
  To: devel; +Cc: Ankit Sinha, Nate DeSimone, Michael Kubacki

Added fit generation tool to the build
process.

What was done:

Added BIOS_INFO_GUID to the build.cfg

Added BIOS_INFO_GUID to GalagoPro3,
KabylakeRvp3 and WhiskeylakeURvp build_config.cfg
This allows the boards to specify the GUID
associated with the its Bios Info PEIM

BIOS_INFO_GUID is passed as an argument to
FitGen in the FIT table generation process

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..3f64239a29 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 = 3132E669-D16B-4AA7-B09B-BC0EB5F40E1F
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] 20+ messages in thread

* Re: [edk2-platforms] [PATCH 1/5] BoardModulePkg: Add bios info HOB
  2019-10-03 21:12 ` [edk2-platforms] [PATCH 1/5] BoardModulePkg: Add bios info HOB Agyeman, Prince
@ 2019-10-07 22:27   ` Nate DeSimone
  2019-10-08  0:34   ` Kubacki, Michael A
  1 sibling, 0 replies; 20+ messages in thread
From: Nate DeSimone @ 2019-10-07 22:27 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 3, 2019 2:13 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 1/5] BoardModulePkg: Add bios info HOB

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

Also added the Bios Info header
file BiosInfo.h

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/Library/BiosInfo.h | 62 +++++++++++++++++++
 2 files changed, 65 insertions(+)
 create mode 100644 Platform/Intel/BoardModulePkg/Include/Library/BiosInfo.h

diff --git a/Platform/Intel/BoardModulePkg/BoardModulePkg.dec b/Platform/Intel/BoardModulePkg/BoardModulePkg.dec
index 6f13945ca8..035427b2f5 100644
--- a/Platform/Intel/BoardModulePkg/BoardModulePkg.dec
+++ b/Platform/Intel/BoardModulePkg/BoardModulePkg.dec
@@ -36,3 +36,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/Library/BiosInfo.h b/Platform/Intel/BoardModulePkg/Include/Library/BiosInfo.h
new file mode 100644
index 0000000000..bba1c07bff
--- /dev/null
+++ b/Platform/Intel/BoardModulePkg/Include/Library/BiosInfo.h
@@ -0,0 +1,62 @@
+/** @file
+
+  Driver for BIOS Info support.
+
+  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] 20+ messages in thread

* Re: [edk2-platforms] [PATCH 2/5] KabylakeOpenBoardPkg/KabylakeRvp3: Add BIOS Info PEIM
  2019-10-03 21:12 ` [edk2-platforms] [PATCH 2/5] KabylakeOpenBoardPkg/KabylakeRvp3: Add BIOS Info PEIM Agyeman, Prince
@ 2019-10-07 22:27   ` Nate DeSimone
  2019-10-08  1:09     ` Kubacki, Michael A
  2019-10-08  1:30   ` Kubacki, Michael A
       [not found]   ` <15CB87D9C8A2CD86.11065@groups.io>
  2 siblings, 1 reply; 20+ messages in thread
From: Nate DeSimone @ 2019-10-07 22:27 UTC (permalink / raw)
  To: Agyeman, Prince, devel@edk2.groups.io; +Cc: Sinha, Ankit, Kubacki, Michael A

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

-----Original Message-----
From: Agyeman, Prince <prince.agyeman@intel.com> 
Sent: Thursday, October 3, 2019 2:13 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 2/5] KabylakeOpenBoardPkg/KabylakeRvp3: Add BIOS Info PEIM

Added BIOS Info PEIM to KabylakeRvp3 to publish the BIOS info HOB. This PEIM currently publishs the board's microcode region info.

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>
---
 .../KabylakeRvp3/BiosInfo/BiosInfo.c          | 93 +++++++++++++++++++
 .../KabylakeRvp3/BiosInfo/BiosInfo.inf        | 48 ++++++++++
 .../KabylakeRvp3/OpenBoardPkg.dsc             |  2 +
 .../KabylakeRvp3/OpenBoardPkg.fdf             |  1 +
 4 files changed, 144 insertions(+)
 create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.c
 create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.inf

diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.c b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.c
new file mode 100644
index 0000000000..6a058a0fc2
--- /dev/null
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/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 <Library/BiosInfo.h>
+#include <Library/PeiServicesLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/HobLib.h>
+#include <Library/PcdLib.h>
+#include <IndustryStandard/FirmwareInterfaceTable.h>
+
+#define INDEXPORT_TO_ADDRESS(x)             (x)
+#define DATAPORT_TO_ADDRESS(x)              ((x) << 16)
+#define PORTWIDTH_TO_ADDRESS(x)             ((x) << 32)
+#define PORTBITNUMBER_TO_ADDRESS(x)         ((x) << 40)
+#define PORTINDEXNUMBER_TO_ADDRESS(x)       ((x) << 48)
+
+//
+// Internal
+//
+#pragma pack (1)
+
+typedef struct {
+  BIOS_INFO_HEADER  Header;
+  BIOS_INFO_STRUCT  Entry[1];
+} BIOS_INFO;
+#pragma pack ()
+
+GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO  mBiosInfo = {
+  {
+    BIOS_INFO_SIGNATURE,
+    1,
+    0,
+  },
+  {
+    {
+      FIT_TYPE_01_MICROCODE,
+      BIOS_INFO_STRUCT_ATTRIBUTE_MICROCODE_WHOLE_REGION,
+      0x0100,
+      FixedPcdGet32 (PcdFlashMicrocodeFvSize),
+      FixedPcdGet32 (PcdFlashMicrocodeFvBase)
+    }
+  }
+};
+
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR  mBiosInfoPpiList 
+= {
+  EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
+  &gBiosInfoGuid,
+  &mBiosInfo
+};
+
+/**
+  Installs BiosInfo Ppi.
+
+  @param  FileHandle  Handle of the file being invoked.
+  @param  PeiServices Describes the list of possible PEI Services.
+
+  @retval EFI_SUCCESS   Install the BiosInfo Ppi successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+BiosInfoEntryPoint (
+  IN       EFI_PEI_FILE_HANDLE  FileHandle,
+  IN CONST EFI_PEI_SERVICES     **PeiServices
+  )
+{
+  EFI_STATUS  Status;
+  VOID        *HobData;
+
+  //
+  // Install PPI, so that other PEI module can add dependency.
+  //
+  Status = PeiServicesInstallPpi (&mBiosInfoPpiList);  ASSERT_EFI_ERROR 
+ (Status);
+
+  //
+  // Build hob, so that DXE module can also get the data.
+  //
+  HobData = BuildGuidHob (&gBiosInfoGuid, sizeof (mBiosInfo));  ASSERT 
+ (HobData != NULL);  if (HobData == NULL) {
+    return EFI_OUT_OF_RESOURCES;
+  }
+  CopyMem (HobData, &mBiosInfo, sizeof (mBiosInfo));
+
+  return EFI_SUCCESS;
+}
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.inf b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.inf
new file mode 100644
index 0000000000..94543408b1
--- /dev/null
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo
+++ .inf
@@ -0,0 +1,48 @@
+### @file
+#  Module Information description file for BIOS Info Driver # #  
+Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> #  
+SPDX-License-Identifier: BSD-2-Clause-Patent ###
+
+[Defines]
+  INF_VERSION                    = 0x00010017
+  BASE_NAME                      = BiosInfo
+  FILE_GUID                      = 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
+
+[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/KabylakeRvp3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
index 7090852192..ef69a19aa4 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
@@ -324,6 +324,8 @@
   }
 !endif
 
+  $(PROJECT)/BiosInfo/BiosInfo.inf
+
 #
 # Security
 #
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
index 2b8eab36a1..81181710e6 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 $(PROJECT)/BiosInfo/BiosInfo.inf
 
 [FV.FvPostMemoryUncompact]
 BlockSize          = $(FLASH_BLOCK_SIZE)
--
2.19.1.windows.1


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

* Re: [edk2-platforms] [PATCH 3/5] KabylakeOpenBoardPkg/GalagoPro3: Add BiosInfo PEIM
  2019-10-03 21:12 ` [edk2-platforms] [PATCH 3/5] KabylakeOpenBoardPkg/GalagoPro3: Add BiosInfo PEIM Agyeman, Prince
@ 2019-10-07 22:27   ` Nate DeSimone
  2019-10-08  1:31     ` Kubacki, Michael A
  0 siblings, 1 reply; 20+ messages in thread
From: Nate DeSimone @ 2019-10-07 22:27 UTC (permalink / raw)
  To: Agyeman, Prince, devel@edk2.groups.io; +Cc: Sinha, Ankit, Kubacki, Michael A

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

-----Original Message-----
From: Agyeman, Prince <prince.agyeman@intel.com> 
Sent: Thursday, October 3, 2019 2:13 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 3/5] KabylakeOpenBoardPkg/GalagoPro3: Add BiosInfo PEIM

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

Cc: Ankit Sinha <ankit.sinha@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>
---
 .../GalagoPro3/BiosInfo/BiosInfo.c            | 92 +++++++++++++++++++
 .../GalagoPro3/BiosInfo/BiosInfo.inf          | 48 ++++++++++
 .../GalagoPro3/OpenBoardPkg.dsc               |  2 +
 .../GalagoPro3/OpenBoardPkg.fdf               |  1 +
 4 files changed, 143 insertions(+)
 create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c
 create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.inf

diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c
new file mode 100644
index 0000000000..4db9d4685c
--- /dev/null
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c
@@ -0,0 +1,92 @@
+/** @file
+  Driver for BIOS Info support.
+
+Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include <PiPei.h> 
+#include <Library/BiosInfo.h> #include <Library/PeiServicesLib.h> 
+#include <Library/BaseMemoryLib.h> #include <Library/DebugLib.h> 
+#include <Library/HobLib.h> #include <Library/PcdLib.h> #include 
+<IndustryStandard/FirmwareInterfaceTable.h>
+
+#define INDEXPORT_TO_ADDRESS(x)             (x)
+#define DATAPORT_TO_ADDRESS(x)              ((x) << 16)
+#define PORTWIDTH_TO_ADDRESS(x)             ((x) << 32)
+#define PORTBITNUMBER_TO_ADDRESS(x)         ((x) << 40)
+#define PORTINDEXNUMBER_TO_ADDRESS(x)       ((x) << 48)
+
+//
+// Internal
+//
+#pragma pack (1)
+
+typedef struct {
+  BIOS_INFO_HEADER  Header;
+  BIOS_INFO_STRUCT  Entry[1];
+} BIOS_INFO;
+#pragma pack ()
+
+GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO  mBiosInfo = {
+  {
+    BIOS_INFO_SIGNATURE,
+    1,
+    0,
+  },
+  {
+    {
+      FIT_TYPE_01_MICROCODE,
+      BIOS_INFO_STRUCT_ATTRIBUTE_MICROCODE_WHOLE_REGION,
+      0x0100,
+      FixedPcdGet32 (PcdFlashMicrocodeFvSize),
+      FixedPcdGet32 (PcdFlashMicrocodeFvBase)
+    }
+  }
+};
+
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR  mBiosInfoPpiList 
+= {
+  EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
+  &gBiosInfoGuid,
+  &mBiosInfo
+};
+
+/**
+  Installs BiosInfo Ppi.
+
+  @param  FileHandle  Handle of the file being invoked.
+  @param  PeiServices Describes the list of possible PEI Services.
+
+  @retval EFI_SUCCESS   Install the BiosInfo Ppi successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+BiosInfoEntryPoint (
+  IN       EFI_PEI_FILE_HANDLE  FileHandle,
+  IN CONST EFI_PEI_SERVICES     **PeiServices
+  )
+{
+  EFI_STATUS  Status;
+  VOID        *HobData;
+
+  //
+  // Install PPI, so that other PEI module can add dependency.
+  //
+  Status = PeiServicesInstallPpi (&mBiosInfoPpiList);  ASSERT_EFI_ERROR 
+ (Status);
+
+  //
+  // Build hob, so that DXE module can also get the data.
+  //
+  HobData = BuildGuidHob (&gBiosInfoGuid, sizeof (mBiosInfo));  ASSERT 
+ (HobData != NULL);  if (HobData == NULL) {
+    return EFI_OUT_OF_RESOURCES;
+  }
+  CopyMem (HobData, &mBiosInfo, sizeof (mBiosInfo));
+
+  return EFI_SUCCESS;
+}
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.inf b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.inf
new file mode 100644
index 0000000000..a0e18cff9c
--- /dev/null
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.i
+++ nf
@@ -0,0 +1,48 @@
+### @file
+#  Module Information description file for BIOS Info Driver # #  
+Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> #  
+SPDX-License-Identifier: BSD-2-Clause-Patent ###
+
+[Defines]
+  INF_VERSION                    = 0x00010017
+  BASE_NAME                      = BiosInfo
+  FILE_GUID                      = 3132E669-D16B-4AA7-B09B-BC0EB5F40E1F
+  VERSION_STRING                 = 1.0
+  MODULE_TYPE                    = PEIM
+  ENTRY_POINT                    = BiosInfoEntryPoint
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES IA32 X64
+#
+
+[LibraryClasses]
+  PeimEntryPoint
+  PeiServicesLib
+  HobLib
+  BaseMemoryLib
+  DebugLib
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  IntelSiliconPkg/IntelSiliconPkg.dec
+  KabylakeSiliconPkg/SiPkg.dec
+  KabylakeFspBinPkg/KabylakeFspBinPkg.dec
+  BoardModulePkg/BoardModulePkg.dec
+  MinPlatformPkg/MinPlatformPkg.dec
+
+[Pcd]
+  gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvBase                    ## CONSUMES
+  gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize                    ## CONSUMES
+
+[Sources]
+  BiosInfo.c
+
+[Guids]
+  gBiosInfoGuid                                 ## PRODUCES
+
+[Depex]
+  TRUE
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
index d67e0cc000..64e25168c7 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
@@ -244,6 +244,8 @@
   }
   $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPostMem.inf
 
+  $(PROJECT)/BiosInfo/BiosInfo.inf
+
 #
 # Security
 #
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
index 56bb0edaad..a095c044a5 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
@@ -240,6 +240,7 @@ INF $(PLATFORM_PACKAGE)/PlatformInit/ReportFv/ReportFvPei.inf
 INF $(PROJECT)/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
 INF IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
 INF $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPreMem.inf
+INF $(PROJECT)/BiosInfo/BiosInfo.inf
 
 [FV.FvPostMemoryUncompact]
 BlockSize          = $(FLASH_BLOCK_SIZE)
--
2.19.1.windows.1


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

* Re: [edk2-platforms] [PATCH 4/5] WhiskeylakeOpenBoardPkg: Add BIOS INFO PEIM
  2019-10-03 21:12 ` [edk2-platforms] [PATCH 4/5] WhiskeylakeOpenBoardPkg: Add BIOS INFO PEIM Agyeman, Prince
@ 2019-10-07 22:27   ` Nate DeSimone
  2019-10-08  1:32   ` Kubacki, Michael A
  1 sibling, 0 replies; 20+ messages in thread
From: Nate DeSimone @ 2019-10-07 22:27 UTC (permalink / raw)
  To: Agyeman, Prince, devel@edk2.groups.io; +Cc: Sinha, Ankit, Kubacki, Michael A

Same comment as PATCH 2 & 3, it seems like this PEIM could be used generically by any Whiskeylake board so I would prefer one copy of it in WhiskeylakeOpenBoardPkg.

-----Original Message-----
From: Agyeman, Prince <prince.agyeman@intel.com> 
Sent: Thursday, October 3, 2019 2:13 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 4/5] WhiskeylakeOpenBoardPkg: Add BIOS INFO PEIM

Added BIOS info PEIM to publish Bios Info HOB. This PEIM currently publishes the microcode FV info.

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>
---
 .../WhiskeylakeURvp/BiosInfo/BiosInfo.c       | 93 +++++++++++++++++++
 .../WhiskeylakeURvp/BiosInfo/BiosInfo.inf     | 48 ++++++++++
 .../WhiskeylakeURvp/OpenBoardPkg.dsc          |  2 +
 .../WhiskeylakeURvp/OpenBoardPkg.fdf          |  1 +
 4 files changed, 144 insertions(+)
 create mode 100644 Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/BiosInfo.c
 create mode 100644 Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/BiosInfo.inf

diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/BiosInfo.c b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/BiosInfo.c
new file mode 100644
index 0000000000..6a058a0fc2
--- /dev/null
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/Bi
+++ osInfo.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 <Library/BiosInfo.h>
+#include <Library/PeiServicesLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/HobLib.h>
+#include <Library/PcdLib.h>
+#include <IndustryStandard/FirmwareInterfaceTable.h>
+
+#define INDEXPORT_TO_ADDRESS(x)             (x)
+#define DATAPORT_TO_ADDRESS(x)              ((x) << 16)
+#define PORTWIDTH_TO_ADDRESS(x)             ((x) << 32)
+#define PORTBITNUMBER_TO_ADDRESS(x)         ((x) << 40)
+#define PORTINDEXNUMBER_TO_ADDRESS(x)       ((x) << 48)
+
+//
+// Internal
+//
+#pragma pack (1)
+
+typedef struct {
+  BIOS_INFO_HEADER  Header;
+  BIOS_INFO_STRUCT  Entry[1];
+} BIOS_INFO;
+#pragma pack ()
+
+GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO  mBiosInfo = {
+  {
+    BIOS_INFO_SIGNATURE,
+    1,
+    0,
+  },
+  {
+    {
+      FIT_TYPE_01_MICROCODE,
+      BIOS_INFO_STRUCT_ATTRIBUTE_MICROCODE_WHOLE_REGION,
+      0x0100,
+      FixedPcdGet32 (PcdFlashMicrocodeFvSize),
+      FixedPcdGet32 (PcdFlashMicrocodeFvBase)
+    }
+  }
+};
+
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR  mBiosInfoPpiList 
+= {
+  EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
+  &gBiosInfoGuid,
+  &mBiosInfo
+};
+
+/**
+  Installs BiosInfo Ppi.
+
+  @param  FileHandle  Handle of the file being invoked.
+  @param  PeiServices Describes the list of possible PEI Services.
+
+  @retval EFI_SUCCESS   Install the BiosInfo Ppi successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+BiosInfoEntryPoint (
+  IN       EFI_PEI_FILE_HANDLE  FileHandle,
+  IN CONST EFI_PEI_SERVICES     **PeiServices
+  )
+{
+  EFI_STATUS  Status;
+  VOID        *HobData;
+
+  //
+  // Install PPI, so that other PEI module can add dependency.
+  //
+  Status = PeiServicesInstallPpi (&mBiosInfoPpiList);  ASSERT_EFI_ERROR 
+ (Status);
+
+  //
+  // Build hob, so that DXE module can also get the data.
+  //
+  HobData = BuildGuidHob (&gBiosInfoGuid, sizeof (mBiosInfo));  ASSERT 
+ (HobData != NULL);  if (HobData == NULL) {
+    return EFI_OUT_OF_RESOURCES;
+  }
+  CopyMem (HobData, &mBiosInfo, sizeof (mBiosInfo));
+
+  return EFI_SUCCESS;
+}
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/BiosInfo.inf b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/BiosInfo.inf
new file mode 100644
index 0000000000..f268de00f5
--- /dev/null
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/Bi
+++ osInfo.inf
@@ -0,0 +1,48 @@
+### @file
+#  Module Information description file for BIOS Info Driver # #  
+Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> #  
+SPDX-License-Identifier: BSD-2-Clause-Patent ###
+
+[Defines]
+  INF_VERSION                    = 0x00010017
+  BASE_NAME                      = BiosInfo
+  FILE_GUID                      = 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
+
+[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 eea809140c..00a89f4507 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPk
+++ g.dsc
@@ -246,6 +246,8 @@
       SiliconPolicyUpdateLib|MinPlatformPkg/PlatformInit/Library/SiliconPolicyUpdateLibNull/SiliconPolicyUpdateLibNull.inf
   }
 
+  $(PROJECT)/BiosInfo/BiosInfo.inf
+
   #
   # Security
   #
diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
index 611078e4b4..867cee8a64 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.fdf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPk
+++ g.fdf
@@ -237,6 +237,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 $(PROJECT)/BiosInfo/BiosInfo.inf
 
 [FV.FvPostMemoryUncompact]
 BlockSize          = $(FLASH_BLOCK_SIZE)
--
2.19.1.windows.1


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

* Re: [edk2-platforms] [PATCH 5/5] Platform/Intel: Add FIT generation tool
  2019-10-03 21:12 ` [edk2-platforms] [PATCH 5/5] Platform/Intel: Add FIT generation tool Agyeman, Prince
@ 2019-10-07 22:27   ` Nate DeSimone
  2019-10-08  1:37   ` Kubacki, Michael A
       [not found]   ` <15CB88314AAB3150.15045@groups.io>
  2 siblings, 0 replies; 20+ messages in thread
From: Nate DeSimone @ 2019-10-07 22:27 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 3, 2019 2:13 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 5/5] Platform/Intel: Add FIT generation tool

Added fit generation tool to the build
process.

What was done:

Added BIOS_INFO_GUID to the build.cfg

Added BIOS_INFO_GUID to GalagoPro3,
KabylakeRvp3 and WhiskeylakeURvp build_config.cfg This allows the boards to specify the GUID associated with the its Bios Info PEIM

BIOS_INFO_GUID is passed as an argument to FitGen in the FIT table generation process

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..3f64239a29 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 = 3132E669-D16B-4AA7-B09B-BC0EB5F40E1F
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] 20+ messages in thread

* Re: [edk2-platforms] [PATCH 1/5] BoardModulePkg: Add bios info HOB
  2019-10-03 21:12 ` [edk2-platforms] [PATCH 1/5] BoardModulePkg: Add bios info HOB Agyeman, Prince
  2019-10-07 22:27   ` Nate DeSimone
@ 2019-10-08  0:34   ` Kubacki, Michael A
  1 sibling, 0 replies; 20+ messages in thread
From: Kubacki, Michael A @ 2019-10-08  0:34 UTC (permalink / raw)
  To: Agyeman, Prince, devel@edk2.groups.io; +Cc: Sinha, Ankit, Desimone, Nathaniel L

Library/BiosInfo.h:
 1. I think the file description can be more accurate and useful than "Driver for BIOS Info support."

     This header file is not a driver or restricted to any particular driver in this location. I would
     generalize the comment.

 2. This file is not related to a library. Why was it placed in the Include/Library directory?

> -----Original Message-----
> From: Agyeman, Prince <prince.agyeman@intel.com>
> Sent: Thursday, October 3, 2019 2:13 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 1/5] BoardModulePkg: Add bios info HOB
> 
> Added gBiosInfoGuid to be used to
> publish BIOS information HOB which
> is needed in FIT generation
> 
> Also added the Bios Info header
> file BiosInfo.h
> 
> 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/Library/BiosInfo.h | 62
> +++++++++++++++++++
>  2 files changed, 65 insertions(+)
>  create mode 100644
> Platform/Intel/BoardModulePkg/Include/Library/BiosInfo.h
> 
> diff --git a/Platform/Intel/BoardModulePkg/BoardModulePkg.dec
> b/Platform/Intel/BoardModulePkg/BoardModulePkg.dec
> index 6f13945ca8..035427b2f5 100644
> --- a/Platform/Intel/BoardModulePkg/BoardModulePkg.dec
> +++ b/Platform/Intel/BoardModulePkg/BoardModulePkg.dec
> @@ -36,3 +36,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/Library/BiosInfo.h
> b/Platform/Intel/BoardModulePkg/Include/Library/BiosInfo.h
> new file mode 100644
> index 0000000000..bba1c07bff
> --- /dev/null
> +++ b/Platform/Intel/BoardModulePkg/Include/Library/BiosInfo.h
> @@ -0,0 +1,62 @@
> +/** @file
> +
> +  Driver for BIOS Info support.
> +
> +  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] 20+ messages in thread

* Re: [edk2-platforms] [PATCH 2/5] KabylakeOpenBoardPkg/KabylakeRvp3: Add BIOS Info PEIM
  2019-10-07 22:27   ` Nate DeSimone
@ 2019-10-08  1:09     ` Kubacki, Michael A
  0 siblings, 0 replies; 20+ messages in thread
From: Kubacki, Michael A @ 2019-10-08  1:09 UTC (permalink / raw)
  To: Desimone, Nathaniel L, Agyeman, Prince, devel@edk2.groups.io; +Cc: Sinha, Ankit

For now, this is definitely possible.

It may also be viable long term. The table is closely tied to the FV layout which is
standardized under Minimum Platform. Firmware volumes that may come and go like those for
a particular advanced feature would end up as child FVs under a FvAdvanced parent that
would be covered in the BIOS Info table. It seems that the FVs that will eventually be described in
the table will remain fixed while their contents are customized by individual boards. 

Also due to the FV standardization, the FVs that compose the IBB segment definition in the table
for S-ACM verification/measurement can likely be consistent across the boards in addition to the
post-IBB FVs which leads to a standardized IBB/OBB definition. Some boards within a package may
have Boot Guard enabled while others don't but having the FVs identified as IBB, post-IBB, or
exclude from FIT in the table will not negatively impact the Boot Guard disabled case.

I agree we should start with KabylakeOpenBoardPkg having a single copy of the PEIM used for
all boards.

Thanks,
Michael

> -----Original Message-----
> From: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
> Sent: Monday, October 7, 2019 3:27 PM
> To: Agyeman, Prince <prince.agyeman@intel.com>; devel@edk2.groups.io
> Cc: Sinha, Ankit <ankit.sinha@intel.com>; Kubacki, Michael A
> <michael.a.kubacki@intel.com>
> Subject: RE: [edk2-platforms] [PATCH 2/5]
> KabylakeOpenBoardPkg/KabylakeRvp3: Add BIOS Info PEIM
> 
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.c
> and Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c
> are identical files. Can we move this up to the parent KabylakeOpenBoardPkg
> and use one PEIM for both platforms?
> 
> -----Original Message-----
> From: Agyeman, Prince <prince.agyeman@intel.com>
> Sent: Thursday, October 3, 2019 2:13 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 2/5]
> KabylakeOpenBoardPkg/KabylakeRvp3: Add BIOS Info PEIM
> 
> Added BIOS Info PEIM to KabylakeRvp3 to publish the BIOS info HOB. This
> PEIM currently publishs the board's microcode region info.
> 
> 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>
> ---
>  .../KabylakeRvp3/BiosInfo/BiosInfo.c          | 93 +++++++++++++++++++
>  .../KabylakeRvp3/BiosInfo/BiosInfo.inf        | 48 ++++++++++
>  .../KabylakeRvp3/OpenBoardPkg.dsc             |  2 +
>  .../KabylakeRvp3/OpenBoardPkg.fdf             |  1 +
>  4 files changed, 144 insertions(+)
>  create mode 100644
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.c
>  create mode 100644
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.inf
> 
> diff --git
> a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.c
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.c
> new file mode 100644
> index 0000000000..6a058a0fc2
> --- /dev/null
> +++
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/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 <Library/BiosInfo.h>
> +#include <Library/PeiServicesLib.h>
> +#include <Library/BaseMemoryLib.h>
> +#include <Library/DebugLib.h>
> +#include <Library/HobLib.h>
> +#include <Library/PcdLib.h>
> +#include <IndustryStandard/FirmwareInterfaceTable.h>
> +
> +#define INDEXPORT_TO_ADDRESS(x)             (x)
> +#define DATAPORT_TO_ADDRESS(x)              ((x) << 16)
> +#define PORTWIDTH_TO_ADDRESS(x)             ((x) << 32)
> +#define PORTBITNUMBER_TO_ADDRESS(x)         ((x) << 40)
> +#define PORTINDEXNUMBER_TO_ADDRESS(x)       ((x) << 48)
> +
> +//
> +// Internal
> +//
> +#pragma pack (1)
> +
> +typedef struct {
> +  BIOS_INFO_HEADER  Header;
> +  BIOS_INFO_STRUCT  Entry[1];
> +} BIOS_INFO;
> +#pragma pack ()
> +
> +GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO  mBiosInfo = {
> +  {
> +    BIOS_INFO_SIGNATURE,
> +    1,
> +    0,
> +  },
> +  {
> +    {
> +      FIT_TYPE_01_MICROCODE,
> +      BIOS_INFO_STRUCT_ATTRIBUTE_MICROCODE_WHOLE_REGION,
> +      0x0100,
> +      FixedPcdGet32 (PcdFlashMicrocodeFvSize),
> +      FixedPcdGet32 (PcdFlashMicrocodeFvBase)
> +    }
> +  }
> +};
> +
> +GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR
> mBiosInfoPpiList
> += {
> +  EFI_PEI_PPI_DESCRIPTOR_PPI |
> EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
> +  &gBiosInfoGuid,
> +  &mBiosInfo
> +};
> +
> +/**
> +  Installs BiosInfo Ppi.
> +
> +  @param  FileHandle  Handle of the file being invoked.
> +  @param  PeiServices Describes the list of possible PEI Services.
> +
> +  @retval EFI_SUCCESS   Install the BiosInfo Ppi successfully.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +BiosInfoEntryPoint (
> +  IN       EFI_PEI_FILE_HANDLE  FileHandle,
> +  IN CONST EFI_PEI_SERVICES     **PeiServices
> +  )
> +{
> +  EFI_STATUS  Status;
> +  VOID        *HobData;
> +
> +  //
> +  // Install PPI, so that other PEI module can add dependency.
> +  //
> +  Status = PeiServicesInstallPpi (&mBiosInfoPpiList);  ASSERT_EFI_ERROR
> + (Status);
> +
> +  //
> +  // Build hob, so that DXE module can also get the data.
> +  //
> +  HobData = BuildGuidHob (&gBiosInfoGuid, sizeof (mBiosInfo));  ASSERT
> + (HobData != NULL);  if (HobData == NULL) {
> +    return EFI_OUT_OF_RESOURCES;
> +  }
> +  CopyMem (HobData, &mBiosInfo, sizeof (mBiosInfo));
> +
> +  return EFI_SUCCESS;
> +}
> diff --git
> a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.i
> nf
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.i
> nf
> new file mode 100644
> index 0000000000..94543408b1
> --- /dev/null
> +++
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo
> +++ .inf
> @@ -0,0 +1,48 @@
> +### @file
> +#  Module Information description file for BIOS Info Driver # #
> +Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> #
> +SPDX-License-Identifier: BSD-2-Clause-Patent ###
> +
> +[Defines]
> +  INF_VERSION                    = 0x00010017
> +  BASE_NAME                      = BiosInfo
> +  FILE_GUID                      = 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
> +
> +[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/KabylakeRvp3/OpenBoardPkg.dsc
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
> index 7090852192..ef69a19aa4 100644
> ---
> a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
> +++
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
> @@ -324,6 +324,8 @@
>    }
>  !endif
> 
> +  $(PROJECT)/BiosInfo/BiosInfo.inf
> +
>  #
>  # Security
>  #
> diff --git
> a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
> index 2b8eab36a1..81181710e6 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 $(PROJECT)/BiosInfo/BiosInfo.inf
> 
>  [FV.FvPostMemoryUncompact]
>  BlockSize          = $(FLASH_BLOCK_SIZE)
> --
> 2.19.1.windows.1
> 


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

* Re: [edk2-platforms] [PATCH 2/5] KabylakeOpenBoardPkg/KabylakeRvp3: Add BIOS Info PEIM
  2019-10-03 21:12 ` [edk2-platforms] [PATCH 2/5] KabylakeOpenBoardPkg/KabylakeRvp3: Add BIOS Info PEIM Agyeman, Prince
  2019-10-07 22:27   ` Nate DeSimone
@ 2019-10-08  1:30   ` Kubacki, Michael A
       [not found]   ` <15CB87D9C8A2CD86.11065@groups.io>
  2 siblings, 0 replies; 20+ messages in thread
From: Kubacki, Michael A @ 2019-10-08  1:30 UTC (permalink / raw)
  To: Agyeman, Prince, devel@edk2.groups.io; +Cc: Sinha, Ankit, Desimone, Nathaniel L

BiosInfo.c:

BiosInfoEntryPoint () function description should be updated. The function installs the BiosInfo PPI
 but also produces the BiosInfo HOB.

It also looks like you can remove the following macros:
#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)

> -----Original Message-----
> From: Agyeman, Prince <prince.agyeman@intel.com>
> Sent: Thursday, October 3, 2019 2:13 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 2/5]
> KabylakeOpenBoardPkg/KabylakeRvp3: Add BIOS Info PEIM
> 
> Added BIOS Info PEIM to KabylakeRvp3 to publish the BIOS info HOB. This
> PEIM currently publishs the board's microcode region info.
> 
> 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>
> ---
>  .../KabylakeRvp3/BiosInfo/BiosInfo.c          | 93 +++++++++++++++++++
>  .../KabylakeRvp3/BiosInfo/BiosInfo.inf        | 48 ++++++++++
>  .../KabylakeRvp3/OpenBoardPkg.dsc             |  2 +
>  .../KabylakeRvp3/OpenBoardPkg.fdf             |  1 +
>  4 files changed, 144 insertions(+)
>  create mode 100644
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.c
>  create mode 100644
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.inf
> 
> diff --git
> a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.c
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.c
> new file mode 100644
> index 0000000000..6a058a0fc2
> --- /dev/null
> +++
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/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 <Library/BiosInfo.h>
> +#include <Library/PeiServicesLib.h>
> +#include <Library/BaseMemoryLib.h>
> +#include <Library/DebugLib.h>
> +#include <Library/HobLib.h>
> +#include <Library/PcdLib.h>
> +#include <IndustryStandard/FirmwareInterfaceTable.h>
> +
> +#define INDEXPORT_TO_ADDRESS(x)             (x)
> +#define DATAPORT_TO_ADDRESS(x)              ((x) << 16)
> +#define PORTWIDTH_TO_ADDRESS(x)             ((x) << 32)
> +#define PORTBITNUMBER_TO_ADDRESS(x)         ((x) << 40)
> +#define PORTINDEXNUMBER_TO_ADDRESS(x)       ((x) << 48)
> +
> +//
> +// Internal
> +//
> +#pragma pack (1)
> +
> +typedef struct {
> +  BIOS_INFO_HEADER  Header;
> +  BIOS_INFO_STRUCT  Entry[1];
> +} BIOS_INFO;
> +#pragma pack ()
> +
> +GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO  mBiosInfo = {
> +  {
> +    BIOS_INFO_SIGNATURE,
> +    1,
> +    0,
> +  },
> +  {
> +    {
> +      FIT_TYPE_01_MICROCODE,
> +      BIOS_INFO_STRUCT_ATTRIBUTE_MICROCODE_WHOLE_REGION,
> +      0x0100,
> +      FixedPcdGet32 (PcdFlashMicrocodeFvSize),
> +      FixedPcdGet32 (PcdFlashMicrocodeFvBase)
> +    }
> +  }
> +};
> +
> +GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR
> mBiosInfoPpiList
> += {
> +  EFI_PEI_PPI_DESCRIPTOR_PPI |
> EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
> +  &gBiosInfoGuid,
> +  &mBiosInfo
> +};
> +
> +/**
> +  Installs BiosInfo Ppi.
> +
> +  @param  FileHandle  Handle of the file being invoked.
> +  @param  PeiServices Describes the list of possible PEI Services.
> +
> +  @retval EFI_SUCCESS   Install the BiosInfo Ppi successfully.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +BiosInfoEntryPoint (
> +  IN       EFI_PEI_FILE_HANDLE  FileHandle,
> +  IN CONST EFI_PEI_SERVICES     **PeiServices
> +  )
> +{
> +  EFI_STATUS  Status;
> +  VOID        *HobData;
> +
> +  //
> +  // Install PPI, so that other PEI module can add dependency.
> +  //
> +  Status = PeiServicesInstallPpi (&mBiosInfoPpiList);  ASSERT_EFI_ERROR
> + (Status);
> +
> +  //
> +  // Build hob, so that DXE module can also get the data.
> +  //
> +  HobData = BuildGuidHob (&gBiosInfoGuid, sizeof (mBiosInfo));  ASSERT
> + (HobData != NULL);  if (HobData == NULL) {
> +    return EFI_OUT_OF_RESOURCES;
> +  }
> +  CopyMem (HobData, &mBiosInfo, sizeof (mBiosInfo));
> +
> +  return EFI_SUCCESS;
> +}
> diff --git
> a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.i
> nf
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.i
> nf
> new file mode 100644
> index 0000000000..94543408b1
> --- /dev/null
> +++
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo
> +++ .inf
> @@ -0,0 +1,48 @@
> +### @file
> +#  Module Information description file for BIOS Info Driver # #
> +Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> #
> +SPDX-License-Identifier: BSD-2-Clause-Patent ###
> +
> +[Defines]
> +  INF_VERSION                    = 0x00010017
> +  BASE_NAME                      = BiosInfo
> +  FILE_GUID                      = 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
> +
> +[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/KabylakeRvp3/OpenBoardPkg.dsc
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
> index 7090852192..ef69a19aa4 100644
> ---
> a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
> +++
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
> @@ -324,6 +324,8 @@
>    }
>  !endif
> 
> +  $(PROJECT)/BiosInfo/BiosInfo.inf
> +
>  #
>  # Security
>  #
> diff --git
> a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
> index 2b8eab36a1..81181710e6 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 $(PROJECT)/BiosInfo/BiosInfo.inf
> 
>  [FV.FvPostMemoryUncompact]
>  BlockSize          = $(FLASH_BLOCK_SIZE)
> --
> 2.19.1.windows.1


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

* Re: [edk2-platforms] [PATCH 3/5] KabylakeOpenBoardPkg/GalagoPro3: Add BiosInfo PEIM
  2019-10-07 22:27   ` Nate DeSimone
@ 2019-10-08  1:31     ` Kubacki, Michael A
  0 siblings, 0 replies; 20+ messages in thread
From: Kubacki, Michael A @ 2019-10-08  1:31 UTC (permalink / raw)
  To: Desimone, Nathaniel L, Agyeman, Prince, devel@edk2.groups.io; +Cc: Sinha, Ankit

As mentioned in patch #2, the same PEIM can be used for KabylakeRvp3 and GalagoPro3 for now.

> -----Original Message-----
> From: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>
> Sent: Monday, October 7, 2019 3:27 PM
> To: Agyeman, Prince <prince.agyeman@intel.com>; devel@edk2.groups.io
> Cc: Sinha, Ankit <ankit.sinha@intel.com>; Kubacki, Michael A
> <michael.a.kubacki@intel.com>
> Subject: RE: [edk2-platforms] [PATCH 3/5]
> KabylakeOpenBoardPkg/GalagoPro3: Add BiosInfo PEIM
> 
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.c
> and Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c
> are identical files. Can we move this up to the parent KabylakeOpenBoardPkg
> and use one PEIM for both platforms?
> 
> -----Original Message-----
> From: Agyeman, Prince <prince.agyeman@intel.com>
> Sent: Thursday, October 3, 2019 2:13 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 3/5] KabylakeOpenBoardPkg/GalagoPro3:
> Add BiosInfo PEIM
> 
> Added BiosInfo PEIM to publish the
> Bios Info HOB. Currently this PEIM publishes one Bios Info entry which is the
> microcode region information.
> 
> Cc: Ankit Sinha <ankit.sinha@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>
> ---
>  .../GalagoPro3/BiosInfo/BiosInfo.c            | 92 +++++++++++++++++++
>  .../GalagoPro3/BiosInfo/BiosInfo.inf          | 48 ++++++++++
>  .../GalagoPro3/OpenBoardPkg.dsc               |  2 +
>  .../GalagoPro3/OpenBoardPkg.fdf               |  1 +
>  4 files changed, 143 insertions(+)
>  create mode 100644
> Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c
>  create mode 100644
> Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.inf
> 
> diff --git
> a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c
> b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c
> new file mode 100644
> index 0000000000..4db9d4685c
> --- /dev/null
> +++
> b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c
> @@ -0,0 +1,92 @@
> +/** @file
> +  Driver for BIOS Info support.
> +
> +Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
> +SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include <PiPei.h>
> +#include <Library/BiosInfo.h> #include <Library/PeiServicesLib.h>
> +#include <Library/BaseMemoryLib.h> #include <Library/DebugLib.h>
> +#include <Library/HobLib.h> #include <Library/PcdLib.h> #include
> +<IndustryStandard/FirmwareInterfaceTable.h>
> +
> +#define INDEXPORT_TO_ADDRESS(x)             (x)
> +#define DATAPORT_TO_ADDRESS(x)              ((x) << 16)
> +#define PORTWIDTH_TO_ADDRESS(x)             ((x) << 32)
> +#define PORTBITNUMBER_TO_ADDRESS(x)         ((x) << 40)
> +#define PORTINDEXNUMBER_TO_ADDRESS(x)       ((x) << 48)
> +
> +//
> +// Internal
> +//
> +#pragma pack (1)
> +
> +typedef struct {
> +  BIOS_INFO_HEADER  Header;
> +  BIOS_INFO_STRUCT  Entry[1];
> +} BIOS_INFO;
> +#pragma pack ()
> +
> +GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO  mBiosInfo = {
> +  {
> +    BIOS_INFO_SIGNATURE,
> +    1,
> +    0,
> +  },
> +  {
> +    {
> +      FIT_TYPE_01_MICROCODE,
> +      BIOS_INFO_STRUCT_ATTRIBUTE_MICROCODE_WHOLE_REGION,
> +      0x0100,
> +      FixedPcdGet32 (PcdFlashMicrocodeFvSize),
> +      FixedPcdGet32 (PcdFlashMicrocodeFvBase)
> +    }
> +  }
> +};
> +
> +GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR
> mBiosInfoPpiList
> += {
> +  EFI_PEI_PPI_DESCRIPTOR_PPI |
> EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
> +  &gBiosInfoGuid,
> +  &mBiosInfo
> +};
> +
> +/**
> +  Installs BiosInfo Ppi.
> +
> +  @param  FileHandle  Handle of the file being invoked.
> +  @param  PeiServices Describes the list of possible PEI Services.
> +
> +  @retval EFI_SUCCESS   Install the BiosInfo Ppi successfully.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +BiosInfoEntryPoint (
> +  IN       EFI_PEI_FILE_HANDLE  FileHandle,
> +  IN CONST EFI_PEI_SERVICES     **PeiServices
> +  )
> +{
> +  EFI_STATUS  Status;
> +  VOID        *HobData;
> +
> +  //
> +  // Install PPI, so that other PEI module can add dependency.
> +  //
> +  Status = PeiServicesInstallPpi (&mBiosInfoPpiList);  ASSERT_EFI_ERROR
> + (Status);
> +
> +  //
> +  // Build hob, so that DXE module can also get the data.
> +  //
> +  HobData = BuildGuidHob (&gBiosInfoGuid, sizeof (mBiosInfo));  ASSERT
> + (HobData != NULL);  if (HobData == NULL) {
> +    return EFI_OUT_OF_RESOURCES;
> +  }
> +  CopyMem (HobData, &mBiosInfo, sizeof (mBiosInfo));
> +
> +  return EFI_SUCCESS;
> +}
> diff --git
> a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.inf
> b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.inf
> new file mode 100644
> index 0000000000..a0e18cff9c
> --- /dev/null
> +++
> b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.i
> +++ nf
> @@ -0,0 +1,48 @@
> +### @file
> +#  Module Information description file for BIOS Info Driver # #
> +Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> #
> +SPDX-License-Identifier: BSD-2-Clause-Patent ###
> +
> +[Defines]
> +  INF_VERSION                    = 0x00010017
> +  BASE_NAME                      = BiosInfo
> +  FILE_GUID                      = 3132E669-D16B-4AA7-B09B-BC0EB5F40E1F
> +  VERSION_STRING                 = 1.0
> +  MODULE_TYPE                    = PEIM
> +  ENTRY_POINT                    = BiosInfoEntryPoint
> +#
> +# The following information is for reference only and not required by the
> build tools.
> +#
> +# VALID_ARCHITECTURES IA32 X64
> +#
> +
> +[LibraryClasses]
> +  PeimEntryPoint
> +  PeiServicesLib
> +  HobLib
> +  BaseMemoryLib
> +  DebugLib
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  IntelSiliconPkg/IntelSiliconPkg.dec
> +  KabylakeSiliconPkg/SiPkg.dec
> +  KabylakeFspBinPkg/KabylakeFspBinPkg.dec
> +  BoardModulePkg/BoardModulePkg.dec
> +  MinPlatformPkg/MinPlatformPkg.dec
> +
> +[Pcd]
> +  gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvBase                    ##
> CONSUMES
> +  gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize                    ## CONSUMES
> +
> +[Sources]
> +  BiosInfo.c
> +
> +[Guids]
> +  gBiosInfoGuid                                 ## PRODUCES
> +
> +[Depex]
> +  TRUE
> diff --git
> a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
> b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
> index d67e0cc000..64e25168c7 100644
> --- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
> +++
> b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
> @@ -244,6 +244,8 @@
>    }
> 
> $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPostM
> em.inf
> 
> +  $(PROJECT)/BiosInfo/BiosInfo.inf
> +
>  #
>  # Security
>  #
> diff --git
> a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
> b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
> index 56bb0edaad..a095c044a5 100644
> --- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
> +++
> b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
> @@ -240,6 +240,7 @@ INF
> $(PLATFORM_PACKAGE)/PlatformInit/ReportFv/ReportFvPei.inf
>  INF
> $(PROJECT)/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformI
> nitPei/PlatformInitPreMem.inf
>  INF IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf
>  INF
> $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPreMe
> m.inf
> +INF $(PROJECT)/BiosInfo/BiosInfo.inf
> 
>  [FV.FvPostMemoryUncompact]
>  BlockSize          = $(FLASH_BLOCK_SIZE)
> --
> 2.19.1.windows.1
> 


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

* Re: [edk2-platforms] [PATCH 4/5] WhiskeylakeOpenBoardPkg: Add BIOS INFO PEIM
  2019-10-03 21:12 ` [edk2-platforms] [PATCH 4/5] WhiskeylakeOpenBoardPkg: Add BIOS INFO PEIM Agyeman, Prince
  2019-10-07 22:27   ` Nate DeSimone
@ 2019-10-08  1:32   ` Kubacki, Michael A
  1 sibling, 0 replies; 20+ messages in thread
From: Kubacki, Michael A @ 2019-10-08  1:32 UTC (permalink / raw)
  To: Agyeman, Prince, devel@edk2.groups.io; +Cc: Sinha, Ankit, Desimone, Nathaniel L

Same feedback as patch #2:

BiosInfo.c:

BiosInfoEntryPoint () function description should be updated. The function installs the BiosInfo PPI
 but also produces the BiosInfo HOB.

It also looks like you can remove the following macros for now:
#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)

> -----Original Message-----
> From: Agyeman, Prince <prince.agyeman@intel.com>
> Sent: Thursday, October 3, 2019 2:13 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 4/5] WhiskeylakeOpenBoardPkg: Add BIOS
> INFO PEIM
> 
> Added BIOS info PEIM to publish Bios Info HOB. This PEIM currently publishes
> the microcode FV info.
> 
> 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>
> ---
>  .../WhiskeylakeURvp/BiosInfo/BiosInfo.c       | 93 +++++++++++++++++++
>  .../WhiskeylakeURvp/BiosInfo/BiosInfo.inf     | 48 ++++++++++
>  .../WhiskeylakeURvp/OpenBoardPkg.dsc          |  2 +
>  .../WhiskeylakeURvp/OpenBoardPkg.fdf          |  1 +
>  4 files changed, 144 insertions(+)
>  create mode 100644
> Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/BiosI
> nfo.c
>  create mode 100644
> Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/BiosI
> nfo.inf
> 
> diff --git
> a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/Bi
> osInfo.c
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/Bi
> osInfo.c
> new file mode 100644
> index 0000000000..6a058a0fc2
> --- /dev/null
> +++
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/Bi
> +++ osInfo.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 <Library/BiosInfo.h>
> +#include <Library/PeiServicesLib.h>
> +#include <Library/BaseMemoryLib.h>
> +#include <Library/DebugLib.h>
> +#include <Library/HobLib.h>
> +#include <Library/PcdLib.h>
> +#include <IndustryStandard/FirmwareInterfaceTable.h>
> +
> +#define INDEXPORT_TO_ADDRESS(x)             (x)
> +#define DATAPORT_TO_ADDRESS(x)              ((x) << 16)
> +#define PORTWIDTH_TO_ADDRESS(x)             ((x) << 32)
> +#define PORTBITNUMBER_TO_ADDRESS(x)         ((x) << 40)
> +#define PORTINDEXNUMBER_TO_ADDRESS(x)       ((x) << 48)
> +
> +//
> +// Internal
> +//
> +#pragma pack (1)
> +
> +typedef struct {
> +  BIOS_INFO_HEADER  Header;
> +  BIOS_INFO_STRUCT  Entry[1];
> +} BIOS_INFO;
> +#pragma pack ()
> +
> +GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO  mBiosInfo = {
> +  {
> +    BIOS_INFO_SIGNATURE,
> +    1,
> +    0,
> +  },
> +  {
> +    {
> +      FIT_TYPE_01_MICROCODE,
> +      BIOS_INFO_STRUCT_ATTRIBUTE_MICROCODE_WHOLE_REGION,
> +      0x0100,
> +      FixedPcdGet32 (PcdFlashMicrocodeFvSize),
> +      FixedPcdGet32 (PcdFlashMicrocodeFvBase)
> +    }
> +  }
> +};
> +
> +GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR
> mBiosInfoPpiList
> += {
> +  EFI_PEI_PPI_DESCRIPTOR_PPI |
> EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
> +  &gBiosInfoGuid,
> +  &mBiosInfo
> +};
> +
> +/**
> +  Installs BiosInfo Ppi.
> +
> +  @param  FileHandle  Handle of the file being invoked.
> +  @param  PeiServices Describes the list of possible PEI Services.
> +
> +  @retval EFI_SUCCESS   Install the BiosInfo Ppi successfully.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +BiosInfoEntryPoint (
> +  IN       EFI_PEI_FILE_HANDLE  FileHandle,
> +  IN CONST EFI_PEI_SERVICES     **PeiServices
> +  )
> +{
> +  EFI_STATUS  Status;
> +  VOID        *HobData;
> +
> +  //
> +  // Install PPI, so that other PEI module can add dependency.
> +  //
> +  Status = PeiServicesInstallPpi (&mBiosInfoPpiList);  ASSERT_EFI_ERROR
> + (Status);
> +
> +  //
> +  // Build hob, so that DXE module can also get the data.
> +  //
> +  HobData = BuildGuidHob (&gBiosInfoGuid, sizeof (mBiosInfo));  ASSERT
> + (HobData != NULL);  if (HobData == NULL) {
> +    return EFI_OUT_OF_RESOURCES;
> +  }
> +  CopyMem (HobData, &mBiosInfo, sizeof (mBiosInfo));
> +
> +  return EFI_SUCCESS;
> +}
> diff --git
> a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/Bi
> osInfo.inf
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/Bi
> osInfo.inf
> new file mode 100644
> index 0000000000..f268de00f5
> --- /dev/null
> +++
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/Bi
> +++ osInfo.inf
> @@ -0,0 +1,48 @@
> +### @file
> +#  Module Information description file for BIOS Info Driver # #
> +Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> #
> +SPDX-License-Identifier: BSD-2-Clause-Patent ###
> +
> +[Defines]
> +  INF_VERSION                    = 0x00010017
> +  BASE_NAME                      = BiosInfo
> +  FILE_GUID                      = 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
> +
> +[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 eea809140c..00a89f4507 100644
> ---
> a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoard
> Pkg.dsc
> +++
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoard
> Pk
> +++ g.dsc
> @@ -246,6 +246,8 @@
> 
> SiliconPolicyUpdateLib|MinPlatformPkg/PlatformInit/Library/SiliconPolicyUp
> dateLibNull/SiliconPolicyUpdateLibNull.inf
>    }
> 
> +  $(PROJECT)/BiosInfo/BiosInfo.inf
> +
>    #
>    # Security
>    #
> diff --git
> a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoard
> Pkg.fdf
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoard
> Pkg.fdf
> index 611078e4b4..867cee8a64 100644
> ---
> a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoard
> Pkg.fdf
> +++
> b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoard
> Pk
> +++ g.fdf
> @@ -237,6 +237,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 $(PROJECT)/BiosInfo/BiosInfo.inf
> 
>  [FV.FvPostMemoryUncompact]
>  BlockSize          = $(FLASH_BLOCK_SIZE)
> --
> 2.19.1.windows.1


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

* Re: [edk2-platforms] [PATCH 5/5] Platform/Intel: Add FIT generation tool
  2019-10-03 21:12 ` [edk2-platforms] [PATCH 5/5] Platform/Intel: Add FIT generation tool Agyeman, Prince
  2019-10-07 22:27   ` Nate DeSimone
@ 2019-10-08  1:37   ` Kubacki, Michael A
       [not found]   ` <15CB88314AAB3150.15045@groups.io>
  2 siblings, 0 replies; 20+ messages in thread
From: Kubacki, Michael A @ 2019-10-08  1:37 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 3, 2019 2:13 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 5/5] Platform/Intel: Add FIT generation
> tool
> 
> Added fit generation tool to the build
> process.
> 
> What was done:
> 
> Added BIOS_INFO_GUID to the build.cfg
> 
> Added BIOS_INFO_GUID to GalagoPro3,
> KabylakeRvp3 and WhiskeylakeURvp build_config.cfg This allows the boards
> to specify the GUID associated with the its Bios Info PEIM
> 
> BIOS_INFO_GUID is passed as an argument to FitGen in the FIT table
> generation process
> 
> 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..3f64239a29 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 = 3132E669-D16B-4AA7-B09B-BC0EB5F40E1F
> 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] 20+ messages in thread

* Re: [edk2-devel] [edk2-platforms] [PATCH 0/5] Add FIT support using FitGen
  2019-10-03 21:12 [edk2-platforms] [PATCH 0/5] Add FIT support using FitGen Agyeman, Prince
                   ` (4 preceding siblings ...)
  2019-10-03 21:12 ` [edk2-platforms] [PATCH 5/5] Platform/Intel: Add FIT generation tool Agyeman, Prince
@ 2019-10-08  1:38 ` Kubacki, Michael A
  5 siblings, 0 replies; 20+ messages in thread
From: Kubacki, Michael A @ 2019-10-08  1:38 UTC (permalink / raw)
  To: devel@edk2.groups.io, Agyeman, Prince

* Please include the version number in the subject.

* Although minor, the commit description unnecessarily varies between commits.
   It would be better to keep it consistent.

   #2: "Add BIOS Info PEIM", #3: "Add BiosInfo PEIM", #4: "Add BIOS INFO PEIM"

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> Agyeman, Prince
> Sent: Thursday, October 3, 2019 2:13 PM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] [edk2-platforms] [PATCH 0/5] Add FIT support using
> FitGen
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2210
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2211
> 
> This series of patches
>  1. Add the generation of the FitGen tool to build_bios.py  2. Add Firmware
> Interface Table (FIT) to the final images of:
>     a. KabylakeOpenBoardPkg/KabylakeRvp3
>     b. KabylakeOpenBoardPkg/GalagoPro3
>     c. WhiskeylakeOpenBoardPkg/WhiskeylakeURvp
> 
> What each patch does:
> 0001-BoardModulePkg-Add-bios-info-HOB: Adds the gBiosInfoGuid and the
> Bios Info struct for the Bios info HOB
> 
> 0002-KabylakeOpenBoardPkg-KabylakeRvp3-Add-BIOS-Info-PEIM,
> 0003-KabylakeOpenBoardPkg-GalagoPro3-Add-BiosInfo-PEIM,
> 0004-WhiskeylakeOpenBoardPkg-Add-BIOS-INFO-PEIM:
> Patches 0002,0003,0004 add bios info PEIM to KabylakeRvp3,
> GalagoPro3 and WhiskeylakeURvp boards respectively
> 
> 0005-Platform-Intel-Add-FIT-generation-tool
> Adds the FitGen tool binary and FIT generation to the BIOS build process.
> 
> Prince Agyeman (5):
>   BoardModulePkg: Add bios info HOB
>   KabylakeOpenBoardPkg/KabylakeRvp3: Add BIOS Info PEIM
>   KabylakeOpenBoardPkg/GalagoPro3: Add BiosInfo PEIM
>   WhiskeylakeOpenBoardPkg: Add BIOS INFO PEIM
>   Platform/Intel: Add FIT generation tool
> 
>  .../Intel/BoardModulePkg/BoardModulePkg.dec   |  3 +
>  .../BoardModulePkg/Include/Library/BiosInfo.h | 62 +++++++++++++
>  .../GalagoPro3/BiosInfo/BiosInfo.c            | 92 ++++++++++++++++++
>  .../GalagoPro3/BiosInfo/BiosInfo.inf          | 48 ++++++++++
>  .../GalagoPro3/OpenBoardPkg.dsc               |  2 +
>  .../GalagoPro3/OpenBoardPkg.fdf               |  1 +
>  .../GalagoPro3/build_config.cfg               |  1 +
>  .../KabylakeRvp3/BiosInfo/BiosInfo.c          | 93 +++++++++++++++++++
>  .../KabylakeRvp3/BiosInfo/BiosInfo.inf        | 48 ++++++++++
>  .../KabylakeRvp3/OpenBoardPkg.dsc             |  2 +
>  .../KabylakeRvp3/OpenBoardPkg.fdf             |  1 +
>  .../KabylakeRvp3/build_config.cfg             |  1 +
>  .../WhiskeylakeURvp/BiosInfo/BiosInfo.c       | 93 +++++++++++++++++++
>  .../WhiskeylakeURvp/BiosInfo/BiosInfo.inf     | 48 ++++++++++
>  .../WhiskeylakeURvp/OpenBoardPkg.dsc          |  2 +
>  .../WhiskeylakeURvp/OpenBoardPkg.fdf          |  1 +
>  .../WhiskeylakeURvp/build_config.cfg          |  1 +
>  Platform/Intel/build.cfg                      |  1 +
>  Platform/Intel/build_bios.py                  | 57 ++++++++++++
>  19 files changed, 557 insertions(+)
>  create mode 100644
> Platform/Intel/BoardModulePkg/Include/Library/BiosInfo.h
>  create mode 100644
> Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.c
>  create mode 100644
> Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/BiosInfo/BiosInfo.inf
>  create mode 100644
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.c
>  create mode 100644
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.inf
>  create mode 100644
> Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/BiosI
> nfo.c
>  create mode 100644
> Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/BiosInfo/BiosI
> nfo.inf
> 
> --
> 2.19.1.windows.1
> 
> 
> 


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

* Re: [edk2-devel] [edk2-platforms] [PATCH 2/5] KabylakeOpenBoardPkg/KabylakeRvp3: Add BIOS Info PEIM
       [not found]   ` <15CB87D9C8A2CD86.11065@groups.io>
@ 2019-10-08  1:41     ` Kubacki, Michael A
  0 siblings, 0 replies; 20+ messages in thread
From: Kubacki, Michael A @ 2019-10-08  1:41 UTC (permalink / raw)
  To: devel@edk2.groups.io, Kubacki, Michael A, Agyeman, Prince
  Cc: Sinha, Ankit, Desimone, Nathaniel L

Please also fix the typo in the commit message "publishs".

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki,
> Michael A
> Sent: Monday, October 7, 2019 6:31 PM
> To: Agyeman, Prince <prince.agyeman@intel.com>; devel@edk2.groups.io
> Cc: Sinha, Ankit <ankit.sinha@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>
> Subject: Re: [edk2-devel] [edk2-platforms] [PATCH 2/5]
> KabylakeOpenBoardPkg/KabylakeRvp3: Add BIOS Info PEIM
> 
> BiosInfo.c:
> 
> BiosInfoEntryPoint () function description should be updated. The function
> installs the BiosInfo PPI  but also produces the BiosInfo HOB.
> 
> It also looks like you can remove the following macros:
> #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)
> 
> > -----Original Message-----
> > From: Agyeman, Prince <prince.agyeman@intel.com>
> > Sent: Thursday, October 3, 2019 2:13 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 2/5]
> > KabylakeOpenBoardPkg/KabylakeRvp3: Add BIOS Info PEIM
> >
> > Added BIOS Info PEIM to KabylakeRvp3 to publish the BIOS info HOB.
> > This PEIM currently publishs the board's microcode region info.
> >
> > 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>
> > ---
> >  .../KabylakeRvp3/BiosInfo/BiosInfo.c          | 93 +++++++++++++++++++
> >  .../KabylakeRvp3/BiosInfo/BiosInfo.inf        | 48 ++++++++++
> >  .../KabylakeRvp3/OpenBoardPkg.dsc             |  2 +
> >  .../KabylakeRvp3/OpenBoardPkg.fdf             |  1 +
> >  4 files changed, 144 insertions(+)
> >  create mode 100644
> > Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.c
> >  create mode 100644
> >
> Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.inf
> >
> > diff --git
> >
> a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.c
> >
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.c
> > new file mode 100644
> > index 0000000000..6a058a0fc2
> > --- /dev/null
> > +++
> > b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/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 <Library/BiosInfo.h>
> > +#include <Library/PeiServicesLib.h>
> > +#include <Library/BaseMemoryLib.h>
> > +#include <Library/DebugLib.h>
> > +#include <Library/HobLib.h>
> > +#include <Library/PcdLib.h>
> > +#include <IndustryStandard/FirmwareInterfaceTable.h>
> > +
> > +#define INDEXPORT_TO_ADDRESS(x)             (x)
> > +#define DATAPORT_TO_ADDRESS(x)              ((x) << 16)
> > +#define PORTWIDTH_TO_ADDRESS(x)             ((x) << 32)
> > +#define PORTBITNUMBER_TO_ADDRESS(x)         ((x) << 40)
> > +#define PORTINDEXNUMBER_TO_ADDRESS(x)       ((x) << 48)
> > +
> > +//
> > +// Internal
> > +//
> > +#pragma pack (1)
> > +
> > +typedef struct {
> > +  BIOS_INFO_HEADER  Header;
> > +  BIOS_INFO_STRUCT  Entry[1];
> > +} BIOS_INFO;
> > +#pragma pack ()
> > +
> > +GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO  mBiosInfo = {
> > +  {
> > +    BIOS_INFO_SIGNATURE,
> > +    1,
> > +    0,
> > +  },
> > +  {
> > +    {
> > +      FIT_TYPE_01_MICROCODE,
> > +      BIOS_INFO_STRUCT_ATTRIBUTE_MICROCODE_WHOLE_REGION,
> > +      0x0100,
> > +      FixedPcdGet32 (PcdFlashMicrocodeFvSize),
> > +      FixedPcdGet32 (PcdFlashMicrocodeFvBase)
> > +    }
> > +  }
> > +};
> > +
> > +GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR
> > mBiosInfoPpiList
> > += {
> > +  EFI_PEI_PPI_DESCRIPTOR_PPI |
> > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
> > +  &gBiosInfoGuid,
> > +  &mBiosInfo
> > +};
> > +
> > +/**
> > +  Installs BiosInfo Ppi.
> > +
> > +  @param  FileHandle  Handle of the file being invoked.
> > +  @param  PeiServices Describes the list of possible PEI Services.
> > +
> > +  @retval EFI_SUCCESS   Install the BiosInfo Ppi successfully.
> > +
> > +**/
> > +EFI_STATUS
> > +EFIAPI
> > +BiosInfoEntryPoint (
> > +  IN       EFI_PEI_FILE_HANDLE  FileHandle,
> > +  IN CONST EFI_PEI_SERVICES     **PeiServices
> > +  )
> > +{
> > +  EFI_STATUS  Status;
> > +  VOID        *HobData;
> > +
> > +  //
> > +  // Install PPI, so that other PEI module can add dependency.
> > +  //
> > +  Status = PeiServicesInstallPpi (&mBiosInfoPpiList);
> > + ASSERT_EFI_ERROR (Status);
> > +
> > +  //
> > +  // Build hob, so that DXE module can also get the data.
> > +  //
> > +  HobData = BuildGuidHob (&gBiosInfoGuid, sizeof (mBiosInfo));
> > + ASSERT (HobData != NULL);  if (HobData == NULL) {
> > +    return EFI_OUT_OF_RESOURCES;
> > +  }
> > +  CopyMem (HobData, &mBiosInfo, sizeof (mBiosInfo));
> > +
> > +  return EFI_SUCCESS;
> > +}
> > diff --git
> >
> a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.i
> > nf
> >
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo.i
> > nf
> > new file mode 100644
> > index 0000000000..94543408b1
> > --- /dev/null
> > +++
> > b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BiosInfo/BiosInfo
> > +++ .inf
> > @@ -0,0 +1,48 @@
> > +### @file
> > +#  Module Information description file for BIOS Info Driver # #
> > +Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> #
> > +SPDX-License-Identifier: BSD-2-Clause-Patent ###
> > +
> > +[Defines]
> > +  INF_VERSION                    = 0x00010017
> > +  BASE_NAME                      = BiosInfo
> > +  FILE_GUID                      = 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
> > +
> > +[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/KabylakeRvp3/OpenBoardPkg.dsc
> >
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
> > index 7090852192..ef69a19aa4 100644
> > ---
> >
> a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
> > +++
> >
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
> > @@ -324,6 +324,8 @@
> >    }
> >  !endif
> >
> > +  $(PROJECT)/BiosInfo/BiosInfo.inf
> > +
> >  #
> >  # Security
> >  #
> > diff --git
> >
> a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
> >
> b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf
> > index 2b8eab36a1..81181710e6 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/SiliconPolicyPeiPreM
> > e
> > m.inf
> > +INF $(PROJECT)/BiosInfo/BiosInfo.inf
> >
> >  [FV.FvPostMemoryUncompact]
> >  BlockSize          = $(FLASH_BLOCK_SIZE)
> > --
> > 2.19.1.windows.1
> 
> 
> 


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

* Re: [edk2-devel] [edk2-platforms] [PATCH 5/5] Platform/Intel: Add FIT generation tool
       [not found]   ` <15CB88314AAB3150.15045@groups.io>
@ 2019-10-08  1:44     ` Kubacki, Michael A
  0 siblings, 0 replies; 20+ messages in thread
From: Kubacki, Michael A @ 2019-10-08  1:44 UTC (permalink / raw)
  To: devel@edk2.groups.io, Kubacki, Michael A, Agyeman, Prince
  Cc: Sinha, Ankit, Desimone, Nathaniel L

Looking at the commit message in more detail, it should be cleaned up in V2.

Please try to clarify the following specifically:

"boards to specify the GUID associated with the its Bios Info PEIM"

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Kubacki,
> Michael A
> Sent: Monday, October 7, 2019 6:37 PM
> To: Agyeman, Prince <prince.agyeman@intel.com>; devel@edk2.groups.io
> Cc: Sinha, Ankit <ankit.sinha@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>
> Subject: Re: [edk2-devel] [edk2-platforms] [PATCH 5/5] Platform/Intel: Add
> FIT generation tool
> 
> Reviewed-by: Michael Kubacki <michael.a.kubacki@intel.com>
> 
> > -----Original Message-----
> > From: Agyeman, Prince <prince.agyeman@intel.com>
> > Sent: Thursday, October 3, 2019 2:13 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 5/5] Platform/Intel: Add FIT
> > generation tool
> >
> > Added fit generation tool to the build process.
> >
> > What was done:
> >
> > Added BIOS_INFO_GUID to the build.cfg
> >
> > Added BIOS_INFO_GUID to GalagoPro3,
> > KabylakeRvp3 and WhiskeylakeURvp build_config.cfg This allows the
> > boards to specify the GUID associated with the its Bios Info PEIM
> >
> > BIOS_INFO_GUID is passed as an argument to FitGen in the FIT table
> > generation process
> >
> > 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..3f64239a29 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 = 3132E669-D16B-4AA7-B09B-BC0EB5F40E1F
> > 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] 20+ messages in thread

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

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-03 21:12 [edk2-platforms] [PATCH 0/5] Add FIT support using FitGen Agyeman, Prince
2019-10-03 21:12 ` [edk2-platforms] [PATCH 1/5] BoardModulePkg: Add bios info HOB Agyeman, Prince
2019-10-07 22:27   ` Nate DeSimone
2019-10-08  0:34   ` Kubacki, Michael A
2019-10-03 21:12 ` [edk2-platforms] [PATCH 2/5] KabylakeOpenBoardPkg/KabylakeRvp3: Add BIOS Info PEIM Agyeman, Prince
2019-10-07 22:27   ` Nate DeSimone
2019-10-08  1:09     ` Kubacki, Michael A
2019-10-08  1:30   ` Kubacki, Michael A
     [not found]   ` <15CB87D9C8A2CD86.11065@groups.io>
2019-10-08  1:41     ` [edk2-devel] " Kubacki, Michael A
2019-10-03 21:12 ` [edk2-platforms] [PATCH 3/5] KabylakeOpenBoardPkg/GalagoPro3: Add BiosInfo PEIM Agyeman, Prince
2019-10-07 22:27   ` Nate DeSimone
2019-10-08  1:31     ` Kubacki, Michael A
2019-10-03 21:12 ` [edk2-platforms] [PATCH 4/5] WhiskeylakeOpenBoardPkg: Add BIOS INFO PEIM Agyeman, Prince
2019-10-07 22:27   ` Nate DeSimone
2019-10-08  1:32   ` Kubacki, Michael A
2019-10-03 21:12 ` [edk2-platforms] [PATCH 5/5] Platform/Intel: Add FIT generation tool Agyeman, Prince
2019-10-07 22:27   ` Nate DeSimone
2019-10-08  1:37   ` Kubacki, Michael A
     [not found]   ` <15CB88314AAB3150.15045@groups.io>
2019-10-08  1:44     ` [edk2-devel] " Kubacki, Michael A
2019-10-08  1:38 ` [edk2-devel] [edk2-platforms] [PATCH 0/5] Add FIT support using FitGen Kubacki, Michael A

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