Browse Source

KabylakeOpenBoardPkg: Add SecBoardInitLib

Adds a board-specific implementation of SecBoardInitLib.
This implementation will invoke the GPIO initialization
routine for the HDMI DDC Bus if the HDMI DDC Bus is being
used for debug log output. Adds PCDs for enable/disable
of using HDMI DDC I2C Bus as a Serial Port.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Benjamin Doron <benjamin.doron00@gmail.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Jeremy Soller <jeremy@system76.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
Reviewed-by: Isaac Oram <isaac.w.oram@intel.com>
Nate DeSimone 1 year ago
parent
commit
2af3a3eb64

+ 1 - 2
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiAspireVn7Dash572GInitPreMemLib.c

@@ -1,6 +1,6 @@
 /** @file
 
-Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2017 - 2022, Intel Corporation. All rights reserved.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -251,7 +251,6 @@ AspireVn7Dash572GBoardDebugInit (
   ///
   /// Do Early PCH init
   ///
-  EarlySiliconInit ();
   LpcInit ();
 
   // NB: MinPlatform specification defines platform initialisation flow.

+ 6 - 2
Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkg.dsc

@@ -210,8 +210,12 @@
   # Platform Package
   #######################################
   TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/SecTestPointCheckLib.inf
-  SecBoardInitLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/SecBoardInitLibNull/SecBoardInitLibNull.inf
-  SiliconPolicyUpdateLib|MinPlatformPkg/PlatformInit/Library/SiliconPolicyUpdateLibNull/SiliconPolicyUpdateLibNull.inf
+  SiliconPolicyUpdateLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/SiliconPolicyUpdateLibNull/SiliconPolicyUpdateLibNull.inf
+
+  #######################################
+  # Board-specific
+  #######################################
+  SecBoardInitLib|$(PLATFORM_BOARD_PACKAGE)/Library/SecBoardInitLib/SecBoardInitLib.inf
 
 [LibraryClasses.common.PEI_CORE]
   #######################################

+ 4 - 9
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Library/BoardInitLib/PeiGalagoPro3InitPreMemLib.c

@@ -1,7 +1,7 @@
 /** @file
   System 76 GalagoPro3 board pre-memory initialization.
 
-Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -167,9 +167,9 @@ SioInit (
 }
 
 /**
-  Configues the IC2 Controller on which GPIO Expander Communicates.
-  This Function is to enable the I2CGPIOExapanderLib to programm the Gpios
-  Complete intilization will be done in later Stage
+  Configures the IC2 Controller on which GPIO Expander Communicates.
+  This Function is to enable the I2CGPIOExapanderLib to program the Gpios
+  Complete initialization will be done in later Stage
 
 **/
 VOID
@@ -227,10 +227,6 @@ GalagoPro3BoardDebugInit (
   VOID
   )
 {
-  ///
-  /// Do Early PCH init
-  ///
-  EarlySiliconInit ();
   return EFI_SUCCESS;
 }
 
@@ -242,4 +238,3 @@ GalagoPro3BoardBootModeDetect (
 {
   return BOOT_WITH_FULL_CONFIGURATION;
 }
-

+ 6 - 1
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc

@@ -153,8 +153,13 @@
   #######################################
   # Platform Package
   #######################################
-  SecBoardInitLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/SecBoardInitLibNull/SecBoardInitLibNull.inf
   TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/SecTestPointCheckLib.inf
+  SiliconPolicyUpdateLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/SiliconPolicyUpdateLibNull/SiliconPolicyUpdateLibNull.inf
+
+  #######################################
+  # Board-specific
+  #######################################
+  SecBoardInitLib|$(PLATFORM_BOARD_PACKAGE)/Library/SecBoardInitLib/SecBoardInitLib.inf
 
 [LibraryClasses.common.PEIM]
   #######################################

+ 4 - 9
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardInitLib/PeiKabylakeRvp3InitPreMemLib.c

@@ -1,6 +1,6 @@
 /** @file
 
-Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2017 - 2022, Intel Corporation. All rights reserved.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -257,9 +257,9 @@ SioInit (
 }
 
 /**
-  Configues the IC2 Controller on which GPIO Expander Communicates.
-  This Function is to enable the I2CGPIOExapanderLib to programm the Gpios
-  Complete intilization will be done in later Stage
+  Configures the IC2 Controller on which GPIO Expander Communicates.
+  This Function is to enable the I2CGPIOExapanderLib to program the Gpios
+  Complete initialization will be done in later Stage
 
 **/
 VOID
@@ -321,10 +321,6 @@ KabylakeRvp3BoardDebugInit (
   VOID
   )
 {
-  ///
-  /// Do Early PCH init
-  ///
-  EarlySiliconInit ();
   return EFI_SUCCESS;
 }
 
@@ -336,4 +332,3 @@ KabylakeRvp3BoardBootModeDetect (
 {
   return BOOT_WITH_FULL_CONFIGURATION;
 }
-

+ 6 - 2
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc

@@ -190,8 +190,12 @@
   # Platform Package
   #######################################
   TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/SecTestPointCheckLib.inf
-  SecBoardInitLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/SecBoardInitLibNull/SecBoardInitLibNull.inf
-  SiliconPolicyUpdateLib|MinPlatformPkg/PlatformInit/Library/SiliconPolicyUpdateLibNull/SiliconPolicyUpdateLibNull.inf
+  SiliconPolicyUpdateLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/SiliconPolicyUpdateLibNull/SiliconPolicyUpdateLibNull.inf
+
+  #######################################
+  # Board-specific
+  #######################################
+  SecBoardInitLib|$(PLATFORM_BOARD_PACKAGE)/Library/SecBoardInitLib/SecBoardInitLib.inf
 
 [LibraryClasses.common.PEIM]
   #######################################

+ 18 - 0
Platform/Intel/KabylakeOpenBoardPkg/Library/SecBoardInitLib/Ia32/SecBoardInit.nasm

@@ -0,0 +1,18 @@
+;; @file
+; Kaby Lake board SEC initialization.
+;
+; Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
+; SPDX-License-Identifier: BSD-2-Clause-Patent
+;
+;;
+
+SECTION .text
+
+global  ASM_PFX(BoardBeforeTempRamInit)
+ASM_PFX(BoardBeforeTempRamInit):
+        ;
+        ; This hook is called before FSP TempRamInit API call
+        ; ESI, EDI need to be preserved
+        ; ESP contains return address
+        ;
+        jmp     esp

+ 35 - 0
Platform/Intel/KabylakeOpenBoardPkg/Library/SecBoardInitLib/SecBoardInitLib.c

@@ -0,0 +1,35 @@
+/** @file
+  Kaby Lake board SEC initialization.
+
+Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiDxe.h>
+#include <Library/BoardInitLib.h>
+#include <Library/PcdLib.h>
+#include <Library/SiliconInitLib.h>
+#include <Library/HdmiDebugGpioInitLib.h>
+
+EFI_STATUS
+EFIAPI
+BoardAfterTempRamInit (
+  VOID
+  )
+{
+  ///
+  /// Do Early PCH init
+  ///
+  EarlySiliconInit ();
+
+  ///
+  /// Initialize HDMI DDC GPIOs if HDMI I2C Debug Port is Enabled
+  ///
+  if (PcdGetBool (PcdI2cHdmiDebugPortEnable) ||
+      PcdGetBool (PcdI2cHdmiDebugPortSerialTerminalEnable)) {
+    HdmiDebugGpioInit ();
+  }
+
+  return EFI_SUCCESS;
+}

+ 39 - 0
Platform/Intel/KabylakeOpenBoardPkg/Library/SecBoardInitLib/SecBoardInitLib.inf

@@ -0,0 +1,39 @@
+## @file
+# Component information file for Kaby Lake SEC Board Init Library
+#
+# Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = SecKabyLakeBoardInitLib
+  FILE_GUID                      = B9DC6910-67E0-4FCE-A1A4-675115E71455
+  MODULE_TYPE                    = SEC
+  VERSION_STRING                 = 1.0
+  LIBRARY_CLASS                  = SecBoardInitLib
+
+[Sources.IA32]
+  Ia32/SecBoardInit.nasm
+
+[Sources]
+  SecBoardInitLib.c
+
+[Packages]
+  MinPlatformPkg/MinPlatformPkg.dec
+  MdePkg/MdePkg.dec
+  KabylakeSiliconPkg/SiPkg.dec
+  KabylakeOpenBoardPkg/OpenBoardPkg.dec
+
+[LibraryClasses]
+  BaseLib
+  SiliconInitLib
+  HdmiDebugGpioInitLib
+
+[Guids]
+
+[Pcd]
+  gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortEnable               ## CONSUMES
+  gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortSerialTerminalEnable ## CONSUMES

+ 18 - 0
Platform/Intel/KabylakeOpenBoardPkg/OpenBoardPkg.dec

@@ -76,6 +76,24 @@ gKabylakeOpenBoardPkgTokenSpaceGuid.PcdFlashNvDebugMessageBase|0x00000000|UINT32
 gKabylakeOpenBoardPkgTokenSpaceGuid.PcdFlashNvDebugMessageSize|0x00000000|UINT32|0x90000031
 gKabylakeOpenBoardPkgTokenSpaceGuid.PcdFlashNvDebugMessageOffset|0x00000000|UINT32|0x90000032
 
+## Enable usage the HDMI DDC channel as a debug port - Causes the BIOS debug log
+#  to be written to the HDMI DDC channel.
+#  The value is defined as below.
+#  FALSE: Do NOT use the HDMI DDC channel as a debug port
+#  TRUE:  Use the HDMI DDC channel as a debug port
+# @Prompt Enable usage the HDMI DDC channel as a debug port
+gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortEnable|FALSE|BOOLEAN|0x90000033
+
+## Enable usage the HDMI DDC channel as a serial terminal - Enables usage of the
+#  HDMI DDC channel to display BIOS Setup, UEFI Shell, etc. using a terminal
+#  emulator. Useful for cases where video is not operating correctly.
+#
+#  The value is defined as below.
+#  FALSE: Do NOT use the HDMI DDC channel as a debug port
+#  TRUE:  Use the HDMI DDC channel as a debug port
+# @Prompt Enable usage the HDMI DDC channel as a debug port
+gKabylakeOpenBoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortSerialTerminalEnable|FALSE|BOOLEAN|0x90000034
+
 ## Specifies the DDC I2C channel to claim as the HDMI debug port
 #  The value is defined as below.
 #  2: DDC channel B