[edk2-devel] [Patch V5] IntelSiliconPkg/Include/Library:Add ConfigBlockLib.h

Ethan Tsao posted 1 patch 4 years, 3 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
Silicon/Intel/CoffeelakeSiliconPkg/CoffeelakeSiliconPkg.dsc                     |  2 +-
Silicon/Intel/IntelSiliconPkg/Include/ConfigBlock.h                             | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
Silicon/Intel/IntelSiliconPkg/Include/Library/ConfigBlockLib.h                  | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec                               |  4 ++++
Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc                               |  1 +
Silicon/Intel/IntelSiliconPkg/Library/BaseConfigBlockLib/BaseConfigBlockLib.inf |  2 +-
6 files changed, 124 insertions(+), 2 deletions(-)
[edk2-devel] [Patch V5] IntelSiliconPkg/Include/Library:Add ConfigBlockLib.h
Posted by Ethan Tsao 4 years, 3 months ago
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2318

Move ConfigBlockLib.h and ConfigBlock.h to InstelSiliconPkg and remove all other ConfigBlockLib.h and ConfigBlock.h

Signed-off-by: Ethan Tsao <ethan.tsao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
---
 Silicon/Intel/CoffeelakeSiliconPkg/CoffeelakeSiliconPkg.dsc                     |  2 +-
 Silicon/Intel/IntelSiliconPkg/Include/ConfigBlock.h                             | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 Silicon/Intel/IntelSiliconPkg/Include/Library/ConfigBlockLib.h                  | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec                               |  4 ++++
 Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc                               |  1 +
 Silicon/Intel/IntelSiliconPkg/Library/BaseConfigBlockLib/BaseConfigBlockLib.inf |  2 +-
 6 files changed, 124 insertions(+), 2 deletions(-)

diff --git a/Silicon/Intel/CoffeelakeSiliconPkg/CoffeelakeSiliconPkg.dsc b/Silicon/Intel/CoffeelakeSiliconPkg/CoffeelakeSiliconPkg.dsc
index 37c77d8f63..702a833cc4 100644
--- a/Silicon/Intel/CoffeelakeSiliconPkg/CoffeelakeSiliconPkg.dsc
+++ b/Silicon/Intel/CoffeelakeSiliconPkg/CoffeelakeSiliconPkg.dsc
@@ -147,7 +147,7 @@ gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate|0
 # Silicon Init Common Library
 #
 !include $(PLATFORM_SI_PACKAGE)/SiPkgCommonLib.dsc
-ConfigBlockLib|ClientSiliconPkg/Library/BaseConfigBlockLib/BaseConfigBlockLib.inf
+ConfigBlockLib|IntelSiliconPkg/Library/BaseConfigBlockLib/BaseConfigBlockLib.inf
 PchTraceHubInitLib|ClientSiliconPkg/Library/BasePchTraceHubInitLib/BasePchTraceHubInitLib.inf
 
 [LibraryClasses.IA32]
diff --git a/Silicon/Intel/IntelSiliconPkg/Include/ConfigBlock.h b/Silicon/Intel/IntelSiliconPkg/Include/ConfigBlock.h
new file mode 100644
index 0000000000..d0e3d94418
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Include/ConfigBlock.h
@@ -0,0 +1,53 @@
+/** @file
+  Header file for Config Block Lib implementation
+
+  Copyright (c) 2019 Intel Corporation. All rights reserved. <BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef _CONFIG_BLOCK_H_
+#define _CONFIG_BLOCK_H_
+
+#include <Uefi/UefiBaseType.h>
+#include <Uefi/UefiMultiPhase.h>
+#include <Pi/PiBootMode.h>
+#include <Pi/PiHob.h>
+
+#pragma pack (push,1)
+
+///
+/// Config Block Header
+///
+typedef struct _CONFIG_BLOCK_HEADER {
+  EFI_HOB_GUID_TYPE GuidHob;                      ///< Offset 0-23  GUID extension HOB header
+  UINT8             Revision;                     ///< Offset 24    Revision of this config block
+  UINT8             Attributes;                   ///< Offset 25    The main revision for config block
+  UINT8             Reserved[2];                  ///< Offset 26-27 Reserved for future use
+} CONFIG_BLOCK_HEADER;
+
+///
+/// Config Block
+///
+typedef struct _CONFIG_BLOCK {
+  CONFIG_BLOCK_HEADER            Header;          ///< Offset 0-27  Header of config block
+  //
+  // Config Block Data
+  //
+} CONFIG_BLOCK;
+
+///
+/// Config Block Table Header
+///
+typedef struct _CONFIG_BLOCK_TABLE_STRUCT {
+  CONFIG_BLOCK_HEADER            Header;          ///< Offset 0-27  GUID number for main entry of config block
+  UINT8                          Rsvd0[2];        ///< Offset 28-29 Reserved for future use
+  UINT16                         NumberOfBlocks;  ///< Offset 30-31 Number of config blocks (N)
+  UINT32                         AvailableSize;   ///< Offset 32-35 Current config block table size
+///
+/// Individual Config Block Structures are added here in memory as part of AddConfigBlock()
+///
+} CONFIG_BLOCK_TABLE_HEADER;
+#pragma pack (pop)
+
+#endif // _CONFIG_BLOCK_H_
diff --git a/Silicon/Intel/IntelSiliconPkg/Include/Library/ConfigBlockLib.h b/Silicon/Intel/IntelSiliconPkg/Include/Library/ConfigBlockLib.h
new file mode 100644
index 0000000000..9a3bf373a6
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Include/Library/ConfigBlockLib.h
@@ -0,0 +1,64 @@
+/** @file
+  Header file for Config Block Lib implementation
+
+  Copyright (c) 2019 Intel Corporation. All rights reserved. <BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef _CONFIG_BLOCK_LIB_H_
+#define _CONFIG_BLOCK_LIB_H_
+
+/**
+  Create config block table
+
+  @param[in]     TotalSize                    - Max size to be allocated for the Config Block Table
+  @param[out]    ConfigBlockTableAddress      - On return, points to a pointer to the beginning of Config Block Table Address
+
+  @retval EFI_INVALID_PARAMETER - Invalid Parameter
+  @retval EFI_OUT_OF_RESOURCES  - Out of resources
+  @retval EFI_SUCCESS           - Successfully created Config Block Table at ConfigBlockTableAddress
+**/
+EFI_STATUS
+EFIAPI
+CreateConfigBlockTable (
+  IN     UINT16    TotalSize,
+  OUT    VOID      **ConfigBlockTableAddress
+  );
+
+/**
+  Add config block into config block table structure
+
+  @param[in]     ConfigBlockTableAddress      - A pointer to the beginning of Config Block Table Address
+  @param[out]    ConfigBlockAddress           - On return, points to a pointer to the beginning of Config Block Address
+
+  @retval EFI_OUT_OF_RESOURCES - Config Block Table is full and cannot add new Config Block or
+                                 Config Block Offset Table is full and cannot add new Config Block.
+  @retval EFI_SUCCESS          - Successfully added Config Block
+**/
+EFI_STATUS
+EFIAPI
+AddConfigBlock (
+  IN     VOID      *ConfigBlockTableAddress,
+  OUT    VOID      **ConfigBlockAddress
+  );
+
+/**
+  Retrieve a specific Config Block data by GUID
+
+  @param[in]      ConfigBlockTableAddress      - A pointer to the beginning of Config Block Table Address
+  @param[in]      ConfigBlockGuid              - A pointer to the GUID uses to search specific Config Block
+  @param[out]     ConfigBlockAddress           - On return, points to a pointer to the beginning of Config Block Address
+
+  @retval EFI_NOT_FOUND         - Could not find the Config Block
+  @retval EFI_SUCCESS           - Config Block found and return
+**/
+EFI_STATUS
+EFIAPI
+GetConfigBlock (
+  IN     VOID      *ConfigBlockTableAddress,
+  IN     EFI_GUID  *ConfigBlockGuid,
+  OUT    VOID      **ConfigBlockAddress
+  );
+
+#endif // _CONFIG_BLOCK_LIB_H_
diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
index 22ebf19c4e..aad39f88ee 100644
--- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
+++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
@@ -30,6 +30,10 @@
   #
   PeiGetVtdPmrAlignmentLib|Include/Library/PeiGetVtdPmrAlignmentLib.h
 
+  ## @libraryclass Provides services to access ConfigBlock
+  #
+  ConfigBlockLib|Include/Library/ConfigBlockLib.h
+
 [Guids]
   ## GUID for Package token space
   # {A9F8D54E-1107-4F0A-ADD0-4587E7A4A735}
diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc
index 0a6509d8b3..d90202d0f3 100644
--- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc
+++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc
@@ -36,6 +36,7 @@
   MicrocodeFlashAccessLib|IntelSiliconPkg/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.inf
   PeiGetVtdPmrAlignmentLib|IntelSiliconPkg/Library/PeiGetVtdPmrAlignmentLib/PeiGetVtdPmrAlignmentLib.inf
   TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
+  ConfigBlockLib|IntelSiliconPkg/Library/BaseConfigBlockLib/BaseConfigBlockLib.inf
 
 [LibraryClasses.common.PEIM]
   PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
diff --git a/Silicon/Intel/IntelSiliconPkg/Library/BaseConfigBlockLib/BaseConfigBlockLib.inf b/Silicon/Intel/IntelSiliconPkg/Library/BaseConfigBlockLib/BaseConfigBlockLib.inf
index 37b4faaf65..87e7e315b7 100644
--- a/Silicon/Intel/IntelSiliconPkg/Library/BaseConfigBlockLib/BaseConfigBlockLib.inf
+++ b/Silicon/Intel/IntelSiliconPkg/Library/BaseConfigBlockLib/BaseConfigBlockLib.inf
@@ -18,7 +18,7 @@ LIBRARY_CLASS  = ConfigBlockLib
 
 [Packages]
 MdePkg/MdePkg.dec
-KabylakeSiliconPkg/SiPkg.dec
+IntelSiliconPkg/IntelSiliconPkg.dec
 
 [Sources]
 BaseConfigBlockLib.c
-- 
2.16.2.windows.1


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

View/Reply Online (#52575): https://edk2.groups.io/g/devel/message/52575
Mute This Topic: https://groups.io/mt/69268732/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-