[edk2-devel] [edk2-platforms Patch 21/28] Vlv2TbltDevicePkg: Re-enable BIOS ID feature

Michael D Kinney posted 28 patches 22 weeks ago

[edk2-devel] [edk2-platforms Patch 21/28] Vlv2TbltDevicePkg: Re-enable BIOS ID feature

Posted by Michael D Kinney 22 weeks ago
Add back BIOSID feature using GenBiosId.py script and
BiosIdLib from the BoardModulePkg.  Remove the VLV2
specific BiosIdLib implementation.

Cc: Zailiang Sun <zailiang.sun@intel.com>
Cc: Yi Qian <yi.qian@intel.com>
Cc: Gary Lin <glin@suse.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 .../Include/Library/BiosIdLib.h               | 86 ----------------
 .../Library/BiosIdLib/BiosIdLib.c             | 98 -------------------
 .../Library/BiosIdLib/BiosIdLib.inf           | 33 -------
 .../PlatformDxe/PlatformDxe.inf               |  5 +-
 .../Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf   |  7 ++
 .../Vlv2TbltDevicePkg/PlatformPkgGcc.fdf      |  7 ++
 .../Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc   |  2 +-
 .../Vlv2TbltDevicePkg/PlatformPkgIA32.dsc     |  2 +-
 .../Vlv2TbltDevicePkg/PlatformPkgX64.dsc      |  2 +-
 .../PlatformSetupDxe/PlatformSetupDxe.inf     |  3 +-
 .../SmBiosMiscDxe/MiscBiosVendorFunction.c    | 49 +---------
 .../SmBiosMiscDxe/SmBiosMiscDxe.inf           |  8 +-
 Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat  | 27 +++++
 Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh   | 46 +++++++++
 14 files changed, 100 insertions(+), 275 deletions(-)
 delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/Include/Library/BiosIdLib.h
 delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.c
 delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.inf

diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Include/Library/BiosIdLib.h b/Platform/Intel/Vlv2TbltDevicePkg/Include/Library/BiosIdLib.h
deleted file mode 100644
index bd08c9a80f..0000000000
--- a/Platform/Intel/Vlv2TbltDevicePkg/Include/Library/BiosIdLib.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*++
-
-  Copyright (c) 2004  - 2019, Intel Corporation. All rights reserved.<BR>
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-Module Name:
-
-  BiosIdLib.h
-
-Abstract:
-
-  BIOS ID library definitions.
-
-  This library provides functions to get BIOS ID, VERSION, DATE and TIME
-
---*/
-
-#ifndef _BIOS_ID_LIB_H_
-#define _BIOS_ID_LIB_H_
-
-//
-// BIOS ID string format:
-//
-// $(BOARD_ID)$(BOARD_REV).$(OEM_ID).$(VERSION_MAJOR).$(BUILD_TYPE)$(VERSION_MINOR).YYMMDDHHMM
-//
-// Example: "TRFTCRB1.86C.0008.D03.0506081529"
-//
-#pragma pack(1)
-
-typedef struct {
-  CHAR16  BoardId[7];               // "TRFTCRB"
-  CHAR16  BoardRev;                 // "1"
-  CHAR16  Dot1;                     // "."
-  CHAR16  OemId[3];                 // "86C"
-  CHAR16  Dot2;                     // "."
-  CHAR16  VersionMajor[4];          // "0008"
-  CHAR16  Dot3;                     // "."
-  CHAR16  BuildType;                // "D"
-  CHAR16  VersionMinor[2];          // "03"
-  CHAR16  Dot4;                     // "."
-  CHAR16  TimeStamp[10];            // "YYMMDDHHMM"
-  CHAR16  NullTerminator;           // 0x0000
-} BIOS_ID_STRING;
-
-#define MEM_IFWIVER_START           0x7E0000
-#define MEM_IFWIVER_LENGTH          0x1000
-
-typedef struct _MANIFEST_OEM_DATA{
-  UINT32         Signature;
-  unsigned char  FillNull[0x39];
-  UINT32         IFWIVersionLen;
-  unsigned char  IFWIVersion[32];
-}MANIFEST_OEM_DATA;
-
-//
-// A signature precedes the BIOS ID string in the FV to enable search by external tools.
-//
-typedef struct {
-  UINT8           Signature[8];     // "$IBIOSI$"
-  BIOS_ID_STRING  BiosIdString;     // "TRFTCRB1.86C.0008.D03.0506081529"
-} BIOS_ID_IMAGE;
-
-#pragma pack()
-
-/**
-  This function returns the Version & Release Date and Time by getting and converting
-  BIOS ID.
-
-  @param[in] BiosVersion         The Bios Version out of the conversion.
-  @param[in] BiosReleaseDate     The Bios Release Date out of the conversion.
-  @param[in] BiosReleaseTime     The Bios Release Time out of the conversion.
-
-  @retval EFI_SUCCESS            BIOS Version & Release Date and Time have been got successfully.
-  @retval EFI_NOT_FOUND          BiosId image is not found, and no parameter will be modified.
-  @retval EFI_INVALID_PARAMETER  All the parameters are NULL.
-
-**/
-EFI_STATUS
-GetBiosVersionDateTime (
-  OUT CHAR16    *BiosVersion, OPTIONAL
-  OUT CHAR16    *BiosReleaseDate, OPTIONAL
-  OUT CHAR16    *BiosReleaseTime OPTIONAL
-  );
-
-#endif
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.c b/Platform/Intel/Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.c
deleted file mode 100644
index f6ab37313c..0000000000
--- a/Platform/Intel/Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*++
-
-Copyright (c) 2011  - 2019, Intel Corporation. All rights reserved
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-Module Name:
-
-  BiosIdLib.c
-
-Abstract:
-
-  Boot service DXE BIOS ID library implementation.
-
-  These functions in this file can be called during DXE and cannot be called during runtime
-  or in SMM which should use a RT or SMM library.
-
---*/
-
-#include <PiDxe.h>
-#include <Library/BaseLib.h>
-
-#include <Library/BiosIdLib.h>
-
-/**
-  This function returns the Version & Release Date and Time by getting and converting
-  BIOS ID.
-
-  @param BiosVersion  The Bios Version out of the conversion.
-  @param BiosReleaseDate  The Bios Release Date out of the conversion.
-  @param BiosReleaseTime - The Bios Release Time out of the conversion.
-
-  @retval EFI_SUCCESS - BIOS Version & Release Date and Time have been got successfully.
-  @retval EFI_NOT_FOUND - BiosId image is not found, and no parameter will be modified.
-  @retval EFI_INVALID_PARAMETER - All the parameters are NULL.
-
-**/
-EFI_STATUS
-GetBiosVersionDateTime (
-  OUT CHAR16    *BiosVersion, OPTIONAL
-  OUT CHAR16    *BiosReleaseDate, OPTIONAL
-  OUT CHAR16    *BiosReleaseTime OPTIONAL
-  )
-{
-  if ((BiosVersion == NULL) && (BiosReleaseDate == NULL) && (BiosReleaseTime == NULL)) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  if (BiosVersion != NULL) {
-    //
-    // Fill the BiosVersion data from the BIOS ID.
-    //
-    StrCpy (BiosVersion, L"MNW2MAX1.X64.0084.D01");
-  }
-
-  if (BiosReleaseDate != NULL) {
-    //
-    // Fill the build timestamp date from the BIOS ID in the "MM/DD/YY" format.
-    //
-    BiosReleaseDate[0] = L'0';
-    BiosReleaseDate[1] = L'1';
-    BiosReleaseDate[2] = L'/';
-
-    BiosReleaseDate[3] = L'0';
-    BiosReleaseDate[4] = L'1';
-    BiosReleaseDate[5] = L'/';
-
-    //
-    // Add 20 for SMBIOS table
-    // Current Linux kernel will misjudge 09 as year 0, so using 2009 for SMBIOS table
-    //
-    BiosReleaseDate[6] = L'2';
-    BiosReleaseDate[7] = L'0';
-    BiosReleaseDate[8] = L'1';
-    BiosReleaseDate[9] = L'9';
-
-    BiosReleaseDate[10] = L'\0';
-  }
-
-  if (BiosReleaseTime != NULL) {
-
-    //
-    // Fill the build timestamp time from the BIOS ID in the "HH:MM" format.
-    //
-
-    BiosReleaseTime[0] = L'0';
-    BiosReleaseTime[1] = L'0';
-    BiosReleaseTime[2] = L':';
-
-    BiosReleaseTime[3] = L'0';
-    BiosReleaseTime[4] = L'0';
-
-    BiosReleaseTime[5] = L'\0';
-  }
-
-  return  EFI_SUCCESS;
-}
-
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.inf b/Platform/Intel/Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.inf
deleted file mode 100644
index 0d38d73ada..0000000000
--- a/Platform/Intel/Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.inf
+++ /dev/null
@@ -1,33 +0,0 @@
-#/*++
-#
-# Copyright (c)  2010  - 2019, Intel Corporation. All rights reserved
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-#  Module Name:
-#
-#   BiosIdLib.inf
-#
-#  Abstract:
-#
-#    Component description file for BIOS ID library
-#
-#--*/
-[Defines]
-  INF_VERSION                    = 0x00010005
-  BASE_NAME                      = BiosIdLib
-  FILE_GUID                      = 98546145-64F1-4d2e-814F-6BF963DB7930
-  MODULE_TYPE                    = BASE
-  VERSION_STRING                 = 1.0
-  LIBRARY_CLASS                  = BiosIdLib
-  PI_SPECIFICATION_VERSION       = 0x0001000A
-
-[Sources]
-  BiosIdLib.c
-
-[Packages]
-  MdePkg/MdePkg.dec
-  MdePkg/MdePkg.dec
-  MdeModulePkg/MdeModulePkg.dec
-  Vlv2DeviceRefCodePkg/Vlv2DeviceRefCodePkg.dec
-  Vlv2TbltDevicePkg/PlatformPkg.dec
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.inf b/Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.inf
index 9fee691365..88c9b36cb1 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.inf
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.inf
@@ -48,10 +48,11 @@ [sources.common]
 [Packages]
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
-  Vlv2TbltDevicePkg/PlatformPkg.dec
-  Vlv2DeviceRefCodePkg/Vlv2DeviceRefCodePkg.dec
   SecurityPkg/SecurityPkg.dec
   CryptoPkg/CryptoPkg.dec
+  BoardModulePkg/BoardModulePkg.dec
+  Vlv2TbltDevicePkg/PlatformPkg.dec
+  Vlv2DeviceRefCodePkg/Vlv2DeviceRefCodePkg.dec
 
 [LibraryClasses]
   BaseLib
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf
index c538fe4a06..dd4550dd88 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf
@@ -382,6 +382,13 @@ [FV.FVMAIN]
   INF  MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf
   }
 
+#
+# gBiosIdGuid
+#
+FILE FREEFORM = C3E36D09-8294-4b97-A857-D5288FE33E28 {
+    SECTION RAW = $(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_TAG)/BiosId.bin
+  }
+
   #
   # EDK II Related Platform codes
   #
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
index bd9d415939..b6e8e40582 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
@@ -331,6 +331,13 @@ [FV.FVMAIN]
   INF  MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf
   }
 
+#
+# gBiosIdGuid
+#
+FILE FREEFORM = C3E36D09-8294-4b97-A857-D5288FE33E28 {
+    SECTION RAW = $(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_TAG)/BiosId.bin
+  }
+
   #
   # EDK II Related Platform codes
   #
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
index 6317bc1342..26c1caad94 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
@@ -221,7 +221,7 @@ [LibraryClasses.common]
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
 !endif
 
- BiosIdLib|Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.inf
+ BiosIdLib|BoardModulePkg/Library/BiosIdLib/DxeBiosIdLib.inf
  CpuIA32Lib|Vlv2TbltDevicePkg/Library/CpuIA32Lib/CpuIA32Lib.inf
 
   StallSmmLib|Vlv2TbltDevicePkg/Library/StallSmmLib/StallSmmLib.inf
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
index 8f69bb47dd..dc6d8b1b26 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
@@ -219,7 +219,7 @@ [LibraryClasses.common]
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
 !endif
 
- BiosIdLib|Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.inf
+ BiosIdLib|BoardModulePkg/Library/BiosIdLib/DxeBiosIdLib.inf
  CpuIA32Lib|Vlv2TbltDevicePkg/Library/CpuIA32Lib/CpuIA32Lib.inf
 
   StallSmmLib|Vlv2TbltDevicePkg/Library/StallSmmLib/StallSmmLib.inf
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
index d146321750..cbc87aa9be 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
@@ -221,7 +221,7 @@ [LibraryClasses.common]
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
 !endif
 
- BiosIdLib|Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.inf
+ BiosIdLib|BoardModulePkg/Library/BiosIdLib/DxeBiosIdLib.inf
  CpuIA32Lib|Vlv2TbltDevicePkg/Library/CpuIA32Lib/CpuIA32Lib.inf
 
   StallSmmLib|Vlv2TbltDevicePkg/Library/StallSmmLib/StallSmmLib.inf
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/PlatformSetupDxe.inf b/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/PlatformSetupDxe.inf
index 85e8b1e8d6..8ff246041d 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/PlatformSetupDxe.inf
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/PlatformSetupDxe.inf
@@ -60,9 +60,10 @@ [Sources]
 [Packages]
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
+  SecurityPkg/SecurityPkg.dec
+  BoardModulePkg/BoardModulePkg.dec
   Vlv2TbltDevicePkg/PlatformPkg.dec
   Vlv2DeviceRefCodePkg/Vlv2DeviceRefCodePkg.dec    #for PchAccess.h
-  SecurityPkg/SecurityPkg.dec
 
 [LibraryClasses]
   BaseLib
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorFunction.c
index fb4fa820a5..0fbd5ac0bd 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorFunction.c
+++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorFunction.c
@@ -163,12 +163,6 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBiosVendor)
   SMBIOS_TABLE_TYPE0    *SmbiosRecord;
   EFI_SMBIOS_HANDLE     SmbiosHandle;
   EFI_MISC_BIOS_VENDOR *ForType0InputData;
-  UINT16                UVerStr[32];
-  UINTN                 LoopIndex;
-  UINTN                 CopyIndex;
-  MANIFEST_OEM_DATA     *IFWIVerStruct;
-  UINT8                 *Data8 = NULL;
-  UINT16                SpaceVer[2]={0x0020,0x0000};
   UINT16                BIOSVersionTemp[100];
 
   ForType0InputData        = (EFI_MISC_BIOS_VENDOR *)RecordData;
@@ -208,49 +202,8 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBiosVendor)
   TokenToGet = STRING_TOKEN (STR_MISC_BIOS_VERSION);
   Version = SmbiosMiscGetString (TokenToGet);
 
-  ZeroMem (UVerStr, 2*32);
-  ZeroMem (BIOSVersionTemp, 2*100);
+  ZeroMem (BIOSVersionTemp, sizeof (BIOSVersionTemp));
   StrCat (BIOSVersionTemp,Version);
-  Data8 = AllocatePool (SECTOR_SIZE_4KB);
-  ZeroMem (Data8, SECTOR_SIZE_4KB);
-
-  Status = gBS->LocateProtocol (
-                  &gEfiSpiProtocolGuid,
-                  NULL,
-                 (VOID **)&mSpiProtocol
-                 );
-  if (!EFI_ERROR(Status)) {
-    //
-    // Get data form SPI ROM.
-    //
-    Status = FlashRead (
-               MEM_IFWIVER_START,
-               Data8,
-               SECTOR_SIZE_4KB,
-               EnumSpiRegionAll
-               );
-    if (!EFI_ERROR(Status)) {
-      for(LoopIndex = 0; LoopIndex <= SECTOR_SIZE_4KB; LoopIndex++) {
-        IFWIVerStruct = (MANIFEST_OEM_DATA *)(Data8 + LoopIndex);
-        if(IFWIVerStruct->Signature == SIGNATURE_32('$','F','U','D')) {
-          DEBUG ((EFI_D_ERROR, "the IFWI Length is:%d\n", IFWIVerStruct->IFWIVersionLen));
-          if(IFWIVerStruct->IFWIVersionLen < 32) {
-            for(CopyIndex = 0; CopyIndex < IFWIVerStruct->IFWIVersionLen; CopyIndex++) {
-              UVerStr[CopyIndex] = (UINT16)IFWIVerStruct->IFWIVersion[CopyIndex];
-            }
-            UVerStr[CopyIndex] = 0x0000;
-            DEBUG ((EFI_D_ERROR, "The IFWI Version is :%s,the IFWI Length is:%d\n", UVerStr,IFWIVerStruct->IFWIVersionLen));
-            StrCat(BIOSVersionTemp,SpaceVer);
-            StrCat(BIOSVersionTemp,UVerStr);
-            DEBUG ((EFI_D_ERROR, "The BIOS and IFWI Version is :%s\n", BIOSVersionTemp));
-          }
-          break;
-        }
-      }
-    }
-  }
-  FreePool(Data8);
-
   VerStrLen = StrLen(BIOSVersionTemp);
   if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) {
     return EFI_UNSUPPORTED;
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/SmBiosMiscDxe.inf b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/SmBiosMiscDxe.inf
index 92b51b1743..016fb53b18 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/SmBiosMiscDxe.inf
+++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/SmBiosMiscDxe.inf
@@ -81,12 +81,13 @@ [Sources]
   MiscMemoryDeviceFunction.c
 
 [Packages]
-  MdeModulePkg/MdeModulePkg.dec
-  Vlv2TbltDevicePkg/PlatformPkg.dec
   MdePkg/MdePkg.dec
-  Vlv2DeviceRefCodePkg/Vlv2DeviceRefCodePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
   NetworkPkg/NetworkPkg.dec
   UefiCpuPkg/UefiCpuPkg.dec
+  BoardModulePkg/BoardModulePkg.dec
+  Vlv2TbltDevicePkg/PlatformPkg.dec
+  Vlv2DeviceRefCodePkg/Vlv2DeviceRefCodePkg.dec
 
 [LibraryClasses]
   HiiLib
@@ -120,7 +121,6 @@ [Protocols]
   gMemInfoProtocolGuid
   gEfiTdtOperationProtocolGuid
   gDxePchPlatformPolicyProtocolGuid
-  gEfiSpiProtocolGuid
   gEfiSimpleNetworkProtocolGuid
 
 [Pcd]
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
index 5cae78bb6d..ffd6722582 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
+++ b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
@@ -207,11 +207,15 @@ if defined VS140COMNTOOLS (
 )
 
 echo Ensuring correct build directory is present
+if not exist %WORKSPACE%\Build mkdir %WORKSPACE%\Build
 if "%Arch%"=="IA32" (
+  if not exist %WORKSPACE%\Build\%PLATFORM_NAME%IA32 mkdir %WORKSPACE%\Build\%PLATFORM_NAME%IA32
   set BUILD_PATH=%WORKSPACE%\Build\%PLATFORM_NAME%IA32\%TARGET%_%TOOL_CHAIN_TAG%
 ) else (
+  if not exist %WORKSPACE%\Build\%PLATFORM_NAME% mkdir %WORKSPACE%\Build\%PLATFORM_NAME%
   set BUILD_PATH=%WORKSPACE%\Build\%PLATFORM_NAME%\%TARGET%_%TOOL_CHAIN_TAG%
 )
+if not exist %BUILD_PATH% mkdir %BUILD_PATH%
 
 echo Modifing Conf files for this build...
 :: Remove lines with these tags from target.txt
@@ -234,6 +238,29 @@ echo MAX_CONCURRENT_THREAD_NUMBER = %build_threads%                      >> %WOR
 
 move /Y %WORKSPACE%\Conf\target.txt.tmp %WORKSPACE%\Conf\target.txt >nul
 
+::**********************************************************************
+:: Generate BIOS ID
+::**********************************************************************
+
+echo BOARD_ID       = MNW2MAX >  %BUILD_PATH%/BiosId.env
+echo BOARD_REV      = 1       >> %BUILD_PATH%/BiosId.env
+if "%Arch%"=="IA32" (
+  echo BOARD_EXT      = I32   >> %BUILD_PATH%/BiosId.env
+)
+if "%Arch%"=="X64" (
+  echo BOARD_EXT      = X64   >> %BUILD_PATH%/BiosId.env
+)
+echo VERSION_MAJOR  = 0090    >> %BUILD_PATH%/BiosId.env
+if "%TARGET%"=="DEBUG" (
+  echo BUILD_TYPE     = D     >> %BUILD_PATH%/BiosId.env
+)
+if "%TARGET%"=="RELEASE" (
+  echo BUILD_TYPE     = R     >> %BUILD_PATH%/BiosId.env
+)
+echo VERSION_MINOR  = 01      >> %BUILD_PATH%/BiosId.env
+
+%WORKSPACE%\edk2-platforms\Platform\Intel\Tools\GenBiosId\GenBiosId.py -i %BUILD_PATH%/BiosId.env -o %BUILD_PATH%/BiosId.bin -ot %BUILD_PATH%/BiosId.txt
+
 ::**********************************************************************
 :: Build BIOS
 ::**********************************************************************
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
index aac8534677..03fa062310 100755
--- a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
+++ b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
@@ -66,6 +66,7 @@ cd $CORE_PATH
 make -C BaseTools
 
 ## Define platform specific environment variables.
+PLATFORM_NAME=Vlv2TbltDevicePkg
 PLATFORM_PACKAGE=Vlv2TbltDevicePkg
 PLATFORM_PKG_PATH=$PLATFORM_PATH/$PLATFORM_PACKAGE
 config_file=$PLATFORM_PKG_PATH/PlatformPkgConfig.dsc
@@ -186,6 +187,51 @@ else
   echo TARGET_ARCH   = IA32 X64                                   >> $WORKSPACE/Conf/target.txt
 fi
 
+
+## Set and Create $BUILD_PATH if necessary
+if [ ! -d ${WORKSPACE}/Build ]; then
+  mkdir ${WORKSPACE}/Build
+fi
+
+if [ $Arch == "IA32" ]; then
+  if [ ! -d ${WORKSPACE}/Build/${PLATFORM_NAME}IA32 ]; then
+    mkdir ${WORKSPACE}/Build/${PLATFORM_NAME}IA32
+  fi
+  BUILD_PATH=${WORKSPACE}/Build/${PLATFORM_NAME}IA32/${TARGET}_${TOOL_CHAIN_TAG}
+else
+  if [ ! -d ${WORKSPACE}/Build/${PLATFORM_NAME} ]; then
+    mkdir ${WORKSPACE}/Build/${PLATFORM_NAME}
+  fi
+  BUILD_PATH=${WORKSPACE}/Build/${PLATFORM_NAME}/${TARGET}_${TOOL_CHAIN_TAG}
+fi
+
+if [ ! -d $BUILD_PATH ]; then
+  mkdir $BUILD_PATH
+fi
+
+##**********************************************************************
+## Generate BIOS ID
+##**********************************************************************
+
+echo BOARD_ID       = MNW2MAX >  $BUILD_PATH/BiosId.env
+echo BOARD_REV      = 1       >> $BUILD_PATH/BiosId.env
+if [ $Arch == "IA32" ]; then
+  echo BOARD_EXT      = I32   >> $BUILD_PATH/BiosId.env
+fi
+if [ $Arch == "X64" ]; then
+  echo BOARD_EXT      = X64   >> $BUILD_PATH/BiosId.env
+fi
+echo VERSION_MAJOR  = 0090    >> $BUILD_PATH/BiosId.env
+if [ $TARGET == "DEBUG" ]; then
+  echo BUILD_TYPE     = D     >> $BUILD_PATH/BiosId.env
+fi
+if [ $TARGET == "RELEASE" ]; then
+  echo BUILD_TYPE     = R     >> $BUILD_PATH/BiosId.env
+fi
+echo VERSION_MINOR  = 01      >> $BUILD_PATH/BiosId.env
+
+python $WORKSPACE/edk2-platforms/Platform/Intel/Tools/GenBiosId/GenBiosId.py -i $BUILD_PATH/BiosId.env -o $BUILD_PATH/BiosId.bin -ot $BUILD_PATH/BiosId.txt
+
 ##**********************************************************************
 ## Build BIOS
 ##**********************************************************************
-- 
2.21.0.windows.1


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

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

Re: [edk2-devel] [edk2-platforms Patch 21/28] Vlv2TbltDevicePkg: Re-enable BIOS ID feature

Posted by Sun, Zailiang 22 weeks ago
Reviewed-By: Zailiang Sun <zailiang.sun@intel.com>

> -----Original Message-----
> From: Kinney, Michael D
> Sent: Thursday, July 11, 2019 3:05 AM
> To: devel@edk2.groups.io
> Cc: Sun, Zailiang <zailiang.sun@intel.com>; Qian, Yi <yi.qian@intel.com>;
> Gary Lin <glin@suse.com>
> Subject: [edk2-platforms Patch 21/28] Vlv2TbltDevicePkg: Re-enable BIOS ID
> feature
> 
> Add back BIOSID feature using GenBiosId.py script and BiosIdLib from the
> BoardModulePkg.  Remove the VLV2 specific BiosIdLib implementation.
> 
> Cc: Zailiang Sun <zailiang.sun@intel.com>
> Cc: Yi Qian <yi.qian@intel.com>
> Cc: Gary Lin <glin@suse.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  .../Include/Library/BiosIdLib.h               | 86 ----------------
>  .../Library/BiosIdLib/BiosIdLib.c             | 98 -------------------
>  .../Library/BiosIdLib/BiosIdLib.inf           | 33 -------
>  .../PlatformDxe/PlatformDxe.inf               |  5 +-
>  .../Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf   |  7 ++
>  .../Vlv2TbltDevicePkg/PlatformPkgGcc.fdf      |  7 ++
>  .../Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc   |  2 +-
>  .../Vlv2TbltDevicePkg/PlatformPkgIA32.dsc     |  2 +-
>  .../Vlv2TbltDevicePkg/PlatformPkgX64.dsc      |  2 +-
>  .../PlatformSetupDxe/PlatformSetupDxe.inf     |  3 +-
>  .../SmBiosMiscDxe/MiscBiosVendorFunction.c    | 49 +---------
>  .../SmBiosMiscDxe/SmBiosMiscDxe.inf           |  8 +-
>  Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat  | 27 +++++
>  Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh   | 46 +++++++++
>  14 files changed, 100 insertions(+), 275 deletions(-)  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/Include/Library/BiosIdLib.h
>  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.c
>  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.inf
> 
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Include/Library/BiosIdLib.h
> b/Platform/Intel/Vlv2TbltDevicePkg/Include/Library/BiosIdLib.h
> deleted file mode 100644
> index bd08c9a80f..0000000000
> --- a/Platform/Intel/Vlv2TbltDevicePkg/Include/Library/BiosIdLib.h
> +++ /dev/null
> @@ -1,86 +0,0 @@
> -/*++
> -
> -  Copyright (c) 2004  - 2019, Intel Corporation. All rights reserved.<BR>
> -
> -  SPDX-License-Identifier: BSD-2-Clause-Patent
> -
> -Module Name:
> -
> -  BiosIdLib.h
> -
> -Abstract:
> -
> -  BIOS ID library definitions.
> -
> -  This library provides functions to get BIOS ID, VERSION, DATE and TIME
> -
> ---*/
> -
> -#ifndef _BIOS_ID_LIB_H_
> -#define _BIOS_ID_LIB_H_
> -
> -//
> -// BIOS ID string format:
> -//
> -//
> $(BOARD_ID)$(BOARD_REV).$(OEM_ID).$(VERSION_MAJOR).$(BUILD_TYPE
> )$(VERSION_MINOR).YYMMDDHHMM
> -//
> -// Example: "TRFTCRB1.86C.0008.D03.0506081529"
> -//
> -#pragma pack(1)
> -
> -typedef struct {
> -  CHAR16  BoardId[7];               // "TRFTCRB"
> -  CHAR16  BoardRev;                 // "1"
> -  CHAR16  Dot1;                     // "."
> -  CHAR16  OemId[3];                 // "86C"
> -  CHAR16  Dot2;                     // "."
> -  CHAR16  VersionMajor[4];          // "0008"
> -  CHAR16  Dot3;                     // "."
> -  CHAR16  BuildType;                // "D"
> -  CHAR16  VersionMinor[2];          // "03"
> -  CHAR16  Dot4;                     // "."
> -  CHAR16  TimeStamp[10];            // "YYMMDDHHMM"
> -  CHAR16  NullTerminator;           // 0x0000
> -} BIOS_ID_STRING;
> -
> -#define MEM_IFWIVER_START           0x7E0000
> -#define MEM_IFWIVER_LENGTH          0x1000
> -
> -typedef struct _MANIFEST_OEM_DATA{
> -  UINT32         Signature;
> -  unsigned char  FillNull[0x39];
> -  UINT32         IFWIVersionLen;
> -  unsigned char  IFWIVersion[32];
> -}MANIFEST_OEM_DATA;
> -
> -//
> -// A signature precedes the BIOS ID string in the FV to enable search by
> external tools.
> -//
> -typedef struct {
> -  UINT8           Signature[8];     // "$IBIOSI$"
> -  BIOS_ID_STRING  BiosIdString;     // "TRFTCRB1.86C.0008.D03.0506081529"
> -} BIOS_ID_IMAGE;
> -
> -#pragma pack()
> -
> -/**
> -  This function returns the Version & Release Date and Time by getting and
> converting
> -  BIOS ID.
> -
> -  @param[in] BiosVersion         The Bios Version out of the conversion.
> -  @param[in] BiosReleaseDate     The Bios Release Date out of the
> conversion.
> -  @param[in] BiosReleaseTime     The Bios Release Time out of the
> conversion.
> -
> -  @retval EFI_SUCCESS            BIOS Version & Release Date and Time have
> been got successfully.
> -  @retval EFI_NOT_FOUND          BiosId image is not found, and no parameter
> will be modified.
> -  @retval EFI_INVALID_PARAMETER  All the parameters are NULL.
> -
> -**/
> -EFI_STATUS
> -GetBiosVersionDateTime (
> -  OUT CHAR16    *BiosVersion, OPTIONAL
> -  OUT CHAR16    *BiosReleaseDate, OPTIONAL
> -  OUT CHAR16    *BiosReleaseTime OPTIONAL
> -  );
> -
> -#endif
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.c
> b/Platform/Intel/Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.c
> deleted file mode 100644
> index f6ab37313c..0000000000
> --- a/Platform/Intel/Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.c
> +++ /dev/null
> @@ -1,98 +0,0 @@
> -/*++
> -
> -Copyright (c) 2011  - 2019, Intel Corporation. All rights reserved
> -
> -  SPDX-License-Identifier: BSD-2-Clause-Patent
> -
> -Module Name:
> -
> -  BiosIdLib.c
> -
> -Abstract:
> -
> -  Boot service DXE BIOS ID library implementation.
> -
> -  These functions in this file can be called during DXE and cannot be called
> during runtime
> -  or in SMM which should use a RT or SMM library.
> -
> ---*/
> -
> -#include <PiDxe.h>
> -#include <Library/BaseLib.h>
> -
> -#include <Library/BiosIdLib.h>
> -
> -/**
> -  This function returns the Version & Release Date and Time by getting and
> converting
> -  BIOS ID.
> -
> -  @param BiosVersion  The Bios Version out of the conversion.
> -  @param BiosReleaseDate  The Bios Release Date out of the conversion.
> -  @param BiosReleaseTime - The Bios Release Time out of the conversion.
> -
> -  @retval EFI_SUCCESS - BIOS Version & Release Date and Time have been
> got successfully.
> -  @retval EFI_NOT_FOUND - BiosId image is not found, and no parameter
> will be modified.
> -  @retval EFI_INVALID_PARAMETER - All the parameters are NULL.
> -
> -**/
> -EFI_STATUS
> -GetBiosVersionDateTime (
> -  OUT CHAR16    *BiosVersion, OPTIONAL
> -  OUT CHAR16    *BiosReleaseDate, OPTIONAL
> -  OUT CHAR16    *BiosReleaseTime OPTIONAL
> -  )
> -{
> -  if ((BiosVersion == NULL) && (BiosReleaseDate == NULL) &&
> (BiosReleaseTime == NULL)) {
> -    return EFI_INVALID_PARAMETER;
> -  }
> -
> -  if (BiosVersion != NULL) {
> -    //
> -    // Fill the BiosVersion data from the BIOS ID.
> -    //
> -    StrCpy (BiosVersion, L"MNW2MAX1.X64.0084.D01");
> -  }
> -
> -  if (BiosReleaseDate != NULL) {
> -    //
> -    // Fill the build timestamp date from the BIOS ID in the "MM/DD/YY"
> format.
> -    //
> -    BiosReleaseDate[0] = L'0';
> -    BiosReleaseDate[1] = L'1';
> -    BiosReleaseDate[2] = L'/';
> -
> -    BiosReleaseDate[3] = L'0';
> -    BiosReleaseDate[4] = L'1';
> -    BiosReleaseDate[5] = L'/';
> -
> -    //
> -    // Add 20 for SMBIOS table
> -    // Current Linux kernel will misjudge 09 as year 0, so using 2009 for
> SMBIOS table
> -    //
> -    BiosReleaseDate[6] = L'2';
> -    BiosReleaseDate[7] = L'0';
> -    BiosReleaseDate[8] = L'1';
> -    BiosReleaseDate[9] = L'9';
> -
> -    BiosReleaseDate[10] = L'\0';
> -  }
> -
> -  if (BiosReleaseTime != NULL) {
> -
> -    //
> -    // Fill the build timestamp time from the BIOS ID in the "HH:MM" format.
> -    //
> -
> -    BiosReleaseTime[0] = L'0';
> -    BiosReleaseTime[1] = L'0';
> -    BiosReleaseTime[2] = L':';
> -
> -    BiosReleaseTime[3] = L'0';
> -    BiosReleaseTime[4] = L'0';
> -
> -    BiosReleaseTime[5] = L'\0';
> -  }
> -
> -  return  EFI_SUCCESS;
> -}
> -
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.inf
> b/Platform/Intel/Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.inf
> deleted file mode 100644
> index 0d38d73ada..0000000000
> --- a/Platform/Intel/Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.inf
> +++ /dev/null
> @@ -1,33 +0,0 @@
> -#/*++
> -#
> -# Copyright (c)  2010  - 2019, Intel Corporation. All rights reserved -# -# SPDX-
> License-Identifier: BSD-2-Clause-Patent -# -#  Module Name:
> -#
> -#   BiosIdLib.inf
> -#
> -#  Abstract:
> -#
> -#    Component description file for BIOS ID library
> -#
> -#--*/
> -[Defines]
> -  INF_VERSION                    = 0x00010005
> -  BASE_NAME                      = BiosIdLib
> -  FILE_GUID                      = 98546145-64F1-4d2e-814F-6BF963DB7930
> -  MODULE_TYPE                    = BASE
> -  VERSION_STRING                 = 1.0
> -  LIBRARY_CLASS                  = BiosIdLib
> -  PI_SPECIFICATION_VERSION       = 0x0001000A
> -
> -[Sources]
> -  BiosIdLib.c
> -
> -[Packages]
> -  MdePkg/MdePkg.dec
> -  MdePkg/MdePkg.dec
> -  MdeModulePkg/MdeModulePkg.dec
> -  Vlv2DeviceRefCodePkg/Vlv2DeviceRefCodePkg.dec
> -  Vlv2TbltDevicePkg/PlatformPkg.dec
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.inf
> b/Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.inf
> index 9fee691365..88c9b36cb1 100644
> --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.inf
> +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.inf
> @@ -48,10 +48,11 @@ [sources.common]
>  [Packages]
>    MdePkg/MdePkg.dec
>    MdeModulePkg/MdeModulePkg.dec
> -  Vlv2TbltDevicePkg/PlatformPkg.dec
> -  Vlv2DeviceRefCodePkg/Vlv2DeviceRefCodePkg.dec
>    SecurityPkg/SecurityPkg.dec
>    CryptoPkg/CryptoPkg.dec
> +  BoardModulePkg/BoardModulePkg.dec
> +  Vlv2TbltDevicePkg/PlatformPkg.dec
> +  Vlv2DeviceRefCodePkg/Vlv2DeviceRefCodePkg.dec
> 
>  [LibraryClasses]
>    BaseLib
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf
> b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf
> index c538fe4a06..dd4550dd88 100644
> --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf
> +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf
> @@ -382,6 +382,13 @@ [FV.FVMAIN]
>    INF
> MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHan
> dlerRuntimeDxe.inf
>    }
> 
> +#
> +# gBiosIdGuid
> +#
> +FILE FREEFORM = C3E36D09-8294-4b97-A857-D5288FE33E28 {
> +    SECTION RAW =
> +$(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_TAG)/BiosId.bin
> +  }
> +
>    #
>    # EDK II Related Platform codes
>    #
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
> b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
> index bd9d415939..b6e8e40582 100644
> --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
> +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
> @@ -331,6 +331,13 @@ [FV.FVMAIN]
>    INF
> MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHan
> dlerRuntimeDxe.inf
>    }
> 
> +#
> +# gBiosIdGuid
> +#
> +FILE FREEFORM = C3E36D09-8294-4b97-A857-D5288FE33E28 {
> +    SECTION RAW =
> +$(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_TAG)/BiosId.bin
> +  }
> +
>    #
>    # EDK II Related Platform codes
>    #
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
> b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
> index 6317bc1342..26c1caad94 100644
> --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
> +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
> @@ -221,7 +221,7 @@ [LibraryClasses.common]
>    OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
>  !endif
> 
> - BiosIdLib|Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.inf
> + BiosIdLib|BoardModulePkg/Library/BiosIdLib/DxeBiosIdLib.inf
>   CpuIA32Lib|Vlv2TbltDevicePkg/Library/CpuIA32Lib/CpuIA32Lib.inf
> 
>    StallSmmLib|Vlv2TbltDevicePkg/Library/StallSmmLib/StallSmmLib.inf
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> index 8f69bb47dd..dc6d8b1b26 100644
> --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> @@ -219,7 +219,7 @@ [LibraryClasses.common]
>    OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
>  !endif
> 
> - BiosIdLib|Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.inf
> + BiosIdLib|BoardModulePkg/Library/BiosIdLib/DxeBiosIdLib.inf
>   CpuIA32Lib|Vlv2TbltDevicePkg/Library/CpuIA32Lib/CpuIA32Lib.inf
> 
>    StallSmmLib|Vlv2TbltDevicePkg/Library/StallSmmLib/StallSmmLib.inf
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> index d146321750..cbc87aa9be 100644
> --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> @@ -221,7 +221,7 @@ [LibraryClasses.common]
>    OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
>  !endif
> 
> - BiosIdLib|Vlv2TbltDevicePkg/Library/BiosIdLib/BiosIdLib.inf
> + BiosIdLib|BoardModulePkg/Library/BiosIdLib/DxeBiosIdLib.inf
>   CpuIA32Lib|Vlv2TbltDevicePkg/Library/CpuIA32Lib/CpuIA32Lib.inf
> 
>    StallSmmLib|Vlv2TbltDevicePkg/Library/StallSmmLib/StallSmmLib.inf
> diff --git
> a/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/PlatformSetupDxe.i
> nf
> b/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/PlatformSetupDxe.i
> nf
> index 85e8b1e8d6..8ff246041d 100644
> ---
> a/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/PlatformSetupDxe.i
> nf
> +++
> b/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/PlatformSetupDxe
> +++ .inf
> @@ -60,9 +60,10 @@ [Sources]
>  [Packages]
>    MdePkg/MdePkg.dec
>    MdeModulePkg/MdeModulePkg.dec
> +  SecurityPkg/SecurityPkg.dec
> +  BoardModulePkg/BoardModulePkg.dec
>    Vlv2TbltDevicePkg/PlatformPkg.dec
>    Vlv2DeviceRefCodePkg/Vlv2DeviceRefCodePkg.dec    #for PchAccess.h
> -  SecurityPkg/SecurityPkg.dec
> 
>  [LibraryClasses]
>    BaseLib
> diff --git
> a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorFunctio
> n.c
> b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorFuncti
> on.c
> index fb4fa820a5..0fbd5ac0bd 100644
> ---
> a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorFunctio
> n.c
> +++
> b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorFunct
> +++ ion.c
> @@ -163,12 +163,6 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBiosVendor)
>    SMBIOS_TABLE_TYPE0    *SmbiosRecord;
>    EFI_SMBIOS_HANDLE     SmbiosHandle;
>    EFI_MISC_BIOS_VENDOR *ForType0InputData;
> -  UINT16                UVerStr[32];
> -  UINTN                 LoopIndex;
> -  UINTN                 CopyIndex;
> -  MANIFEST_OEM_DATA     *IFWIVerStruct;
> -  UINT8                 *Data8 = NULL;
> -  UINT16                SpaceVer[2]={0x0020,0x0000};
>    UINT16                BIOSVersionTemp[100];
> 
>    ForType0InputData        = (EFI_MISC_BIOS_VENDOR *)RecordData;
> @@ -208,49 +202,8 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBiosVendor)
>    TokenToGet = STRING_TOKEN (STR_MISC_BIOS_VERSION);
>    Version = SmbiosMiscGetString (TokenToGet);
> 
> -  ZeroMem (UVerStr, 2*32);
> -  ZeroMem (BIOSVersionTemp, 2*100);
> +  ZeroMem (BIOSVersionTemp, sizeof (BIOSVersionTemp));
>    StrCat (BIOSVersionTemp,Version);
> -  Data8 = AllocatePool (SECTOR_SIZE_4KB);
> -  ZeroMem (Data8, SECTOR_SIZE_4KB);
> -
> -  Status = gBS->LocateProtocol (
> -                  &gEfiSpiProtocolGuid,
> -                  NULL,
> -                 (VOID **)&mSpiProtocol
> -                 );
> -  if (!EFI_ERROR(Status)) {
> -    //
> -    // Get data form SPI ROM.
> -    //
> -    Status = FlashRead (
> -               MEM_IFWIVER_START,
> -               Data8,
> -               SECTOR_SIZE_4KB,
> -               EnumSpiRegionAll
> -               );
> -    if (!EFI_ERROR(Status)) {
> -      for(LoopIndex = 0; LoopIndex <= SECTOR_SIZE_4KB; LoopIndex++) {
> -        IFWIVerStruct = (MANIFEST_OEM_DATA *)(Data8 + LoopIndex);
> -        if(IFWIVerStruct->Signature == SIGNATURE_32('$','F','U','D')) {
> -          DEBUG ((EFI_D_ERROR, "the IFWI Length is:%d\n", IFWIVerStruct-
> >IFWIVersionLen));
> -          if(IFWIVerStruct->IFWIVersionLen < 32) {
> -            for(CopyIndex = 0; CopyIndex < IFWIVerStruct->IFWIVersionLen;
> CopyIndex++) {
> -              UVerStr[CopyIndex] = (UINT16)IFWIVerStruct-
> >IFWIVersion[CopyIndex];
> -            }
> -            UVerStr[CopyIndex] = 0x0000;
> -            DEBUG ((EFI_D_ERROR, "The IFWI Version is :%s,the IFWI Length
> is:%d\n", UVerStr,IFWIVerStruct->IFWIVersionLen));
> -            StrCat(BIOSVersionTemp,SpaceVer);
> -            StrCat(BIOSVersionTemp,UVerStr);
> -            DEBUG ((EFI_D_ERROR, "The BIOS and IFWI Version is :%s\n",
> BIOSVersionTemp));
> -          }
> -          break;
> -        }
> -      }
> -    }
> -  }
> -  FreePool(Data8);
> -
>    VerStrLen = StrLen(BIOSVersionTemp);
>    if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) {
>      return EFI_UNSUPPORTED;
> diff --git
> a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/SmBiosMiscDxe.inf
> b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/SmBiosMiscDxe.inf
> index 92b51b1743..016fb53b18 100644
> --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/SmBiosMiscDxe.inf
> +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/SmBiosMiscDxe.inf
> @@ -81,12 +81,13 @@ [Sources]
>    MiscMemoryDeviceFunction.c
> 
>  [Packages]
> -  MdeModulePkg/MdeModulePkg.dec
> -  Vlv2TbltDevicePkg/PlatformPkg.dec
>    MdePkg/MdePkg.dec
> -  Vlv2DeviceRefCodePkg/Vlv2DeviceRefCodePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
>    NetworkPkg/NetworkPkg.dec
>    UefiCpuPkg/UefiCpuPkg.dec
> +  BoardModulePkg/BoardModulePkg.dec
> +  Vlv2TbltDevicePkg/PlatformPkg.dec
> +  Vlv2DeviceRefCodePkg/Vlv2DeviceRefCodePkg.dec
> 
>  [LibraryClasses]
>    HiiLib
> @@ -120,7 +121,6 @@ [Protocols]
>    gMemInfoProtocolGuid
>    gEfiTdtOperationProtocolGuid
>    gDxePchPlatformPolicyProtocolGuid
> -  gEfiSpiProtocolGuid
>    gEfiSimpleNetworkProtocolGuid
> 
>  [Pcd]
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
> b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
> index 5cae78bb6d..ffd6722582 100644
> --- a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
> +++ b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
> @@ -207,11 +207,15 @@ if defined VS140COMNTOOLS (
>  )
> 
>  echo Ensuring correct build directory is present
> +if not exist %WORKSPACE%\Build mkdir %WORKSPACE%\Build
>  if "%Arch%"=="IA32" (
> +  if not exist %WORKSPACE%\Build\%PLATFORM_NAME%IA32 mkdir
> + %WORKSPACE%\Build\%PLATFORM_NAME%IA32
>    set
> BUILD_PATH=%WORKSPACE%\Build\%PLATFORM_NAME%IA32\%TARGET%
> _%TOOL_CHAIN_TAG%
>  ) else (
> +  if not exist %WORKSPACE%\Build\%PLATFORM_NAME% mkdir
> + %WORKSPACE%\Build\%PLATFORM_NAME%
>    set
> BUILD_PATH=%WORKSPACE%\Build\%PLATFORM_NAME%\%TARGET%_%T
> OOL_CHAIN_TAG%
>  )
> +if not exist %BUILD_PATH% mkdir %BUILD_PATH%
> 
>  echo Modifing Conf files for this build...
>  :: Remove lines with these tags from target.txt
> @@ -234,6 +238,29 @@ echo MAX_CONCURRENT_THREAD_NUMBER
> = %build_threads%                      >> %WOR
> 
>  move
> /Y %WORKSPACE%\Conf\target.txt.tmp %WORKSPACE%\Conf\target.txt >n
> ul
> 
> +::********************************************************
> *************
> +*
> +:: Generate BIOS ID
> +::********************************************************
> *************
> +*
> +
> +echo BOARD_ID       = MNW2MAX >  %BUILD_PATH%/BiosId.env
> +echo BOARD_REV      = 1       >> %BUILD_PATH%/BiosId.env
> +if "%Arch%"=="IA32" (
> +  echo BOARD_EXT      = I32   >> %BUILD_PATH%/BiosId.env
> +)
> +if "%Arch%"=="X64" (
> +  echo BOARD_EXT      = X64   >> %BUILD_PATH%/BiosId.env
> +)
> +echo VERSION_MAJOR  = 0090    >> %BUILD_PATH%/BiosId.env
> +if "%TARGET%"=="DEBUG" (
> +  echo BUILD_TYPE     = D     >> %BUILD_PATH%/BiosId.env
> +)
> +if "%TARGET%"=="RELEASE" (
> +  echo BUILD_TYPE     = R     >> %BUILD_PATH%/BiosId.env
> +)
> +echo VERSION_MINOR  = 01      >> %BUILD_PATH%/BiosId.env
> +
> +%WORKSPACE%\edk2-
> platforms\Platform\Intel\Tools\GenBiosId\GenBiosId.py
> +-i %BUILD_PATH%/BiosId.env -o %BUILD_PATH%/BiosId.bin -ot
> +%BUILD_PATH%/BiosId.txt
> +
>  ::*********************************************************
> *************
>  :: Build BIOS
>  ::*********************************************************
> *************
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
> b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
> index aac8534677..03fa062310 100755
> --- a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
> +++ b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
> @@ -66,6 +66,7 @@ cd $CORE_PATH
>  make -C BaseTools
> 
>  ## Define platform specific environment variables.
> +PLATFORM_NAME=Vlv2TbltDevicePkg
>  PLATFORM_PACKAGE=Vlv2TbltDevicePkg
>  PLATFORM_PKG_PATH=$PLATFORM_PATH/$PLATFORM_PACKAGE
>  config_file=$PLATFORM_PKG_PATH/PlatformPkgConfig.dsc
> @@ -186,6 +187,51 @@ else
>    echo TARGET_ARCH   = IA32 X64                                   >>
> $WORKSPACE/Conf/target.txt
>  fi
> 
> +
> +## Set and Create $BUILD_PATH if necessary if [ ! -d ${WORKSPACE}/Build
> +]; then
> +  mkdir ${WORKSPACE}/Build
> +fi
> +
> +if [ $Arch == "IA32" ]; then
> +  if [ ! -d ${WORKSPACE}/Build/${PLATFORM_NAME}IA32 ]; then
> +    mkdir ${WORKSPACE}/Build/${PLATFORM_NAME}IA32
> +  fi
> +
> +BUILD_PATH=${WORKSPACE}/Build/${PLATFORM_NAME}IA32/${TARGET}_
> ${TOOL_CHA
> +IN_TAG}
> +else
> +  if [ ! -d ${WORKSPACE}/Build/${PLATFORM_NAME} ]; then
> +    mkdir ${WORKSPACE}/Build/${PLATFORM_NAME}
> +  fi
> +
> +BUILD_PATH=${WORKSPACE}/Build/${PLATFORM_NAME}/${TARGET}_${T
> OOL_CHAIN_T
> +AG}
> +fi
> +
> +if [ ! -d $BUILD_PATH ]; then
> +  mkdir $BUILD_PATH
> +fi
> +
> +##*******************************************************
> **************
> +*
> +## Generate BIOS ID
> +##*******************************************************
> **************
> +*
> +
> +echo BOARD_ID       = MNW2MAX >  $BUILD_PATH/BiosId.env
> +echo BOARD_REV      = 1       >> $BUILD_PATH/BiosId.env
> +if [ $Arch == "IA32" ]; then
> +  echo BOARD_EXT      = I32   >> $BUILD_PATH/BiosId.env
> +fi
> +if [ $Arch == "X64" ]; then
> +  echo BOARD_EXT      = X64   >> $BUILD_PATH/BiosId.env
> +fi
> +echo VERSION_MAJOR  = 0090    >> $BUILD_PATH/BiosId.env
> +if [ $TARGET == "DEBUG" ]; then
> +  echo BUILD_TYPE     = D     >> $BUILD_PATH/BiosId.env
> +fi
> +if [ $TARGET == "RELEASE" ]; then
> +  echo BUILD_TYPE     = R     >> $BUILD_PATH/BiosId.env
> +fi
> +echo VERSION_MINOR  = 01      >> $BUILD_PATH/BiosId.env
> +
> +python
> +$WORKSPACE/edk2-
> platforms/Platform/Intel/Tools/GenBiosId/GenBiosId.py
> +-i $BUILD_PATH/BiosId.env -o $BUILD_PATH/BiosId.bin -ot
> +$BUILD_PATH/BiosId.txt
> +
> 
> ##********************************************************
> **************
>  ## Build BIOS
> 
> ##********************************************************
> **************
> --
> 2.21.0.windows.1


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

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