From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: michael.a.kubacki@intel.com) Received: from mga02.intel.com (mga02.intel.com []) by groups.io with SMTP; Mon, 30 Sep 2019 18:16:00 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Sep 2019 18:16:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,569,1559545200"; d="scan'208";a="203080847" Received: from makuback-desk1.amr.corp.intel.com ([10.7.159.162]) by orsmga002.jf.intel.com with ESMTP; 30 Sep 2019 18:15:59 -0700 From: "Kubacki, Michael A" To: devel@edk2.groups.io Cc: Eric Dong , Liming Gao Subject: [edk2-platforms][PATCH V1 3/3] BoardModulePkg/FirmwareBootMediaInfoPei: Add module Date: Mon, 30 Sep 2019 18:15:47 -0700 Message-Id: <20191001011547.14588-4-michael.a.kubacki@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20191001011547.14588-1-michael.a.kubacki@intel.com> References: <20191001011547.14588-1-michael.a.kubacki@intel.com> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2229 Adds a new module that is responsible for publishing the boot media device information that will be used in the boot flow for system initialization decisions dependent upon firmware boot media. The module depends on a library class to implement the board- specific details to get the firmware boot media device. This allows the module to remain consistent in its responsibility across implementations and the details to be easily substituted. Cc: Eric Dong Cc: Liming Gao Signed-off-by: Michael Kubacki --- Platform/Intel/BoardModulePkg/BoardModulePkg.dsc | 2 + Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.inf | 46 ++++++++++++ Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.c | 76 ++++++++++++++++++++ 3 files changed, 124 insertions(+) diff --git a/Platform/Intel/BoardModulePkg/BoardModulePkg.dsc b/Platform/Intel/BoardModulePkg/BoardModulePkg.dsc index 78c09fbf82..50bc704056 100644 --- a/Platform/Intel/BoardModulePkg/BoardModulePkg.dsc +++ b/Platform/Intel/BoardModulePkg/BoardModulePkg.dsc @@ -31,6 +31,7 @@ DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf + PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf [LibraryClasses.common.PEIM] FirmwareBootMediaLib|IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBootMediaLib.inf @@ -74,6 +75,7 @@ ################################################################################################### [Components] + BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.inf BoardModulePkg/Library/CmosAccessLib/CmosAccessLib.inf BoardModulePkg/Library/PlatformCmosAccessLibNull/PlatformCmosAccessLibNull.inf diff --git a/Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.inf b/Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.inf new file mode 100644 index 0000000000..a81932f2a1 --- /dev/null +++ b/Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.inf @@ -0,0 +1,46 @@ +## @file +# Firmware Boot Media Info Module +# +# This module publishes firmware boot media device information used in the boot flow for system initialization +# decisions dependent upon the firmware boot media. +# +# This module depends upon a library instance to actually perform firmware boot media device detection since the +# detection mechanism will vary across systems. In many cases, the media type may simply be set to a single firmware +# boot media device with no run-time logic required. In any case, this module should dispatch as early as possible in +# the system boot flow so the firmware boot media information is available for other modules. If any dependencies are +# required to dynamically determine the firmware boot media device, those should be in the DEPEX section of the active +# FirmwareBootMediaInfoLib such that this module will dispatch once those dependencies are satisfied. +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = FirmwareBootMediaInfoPei + FILE_GUID = A8F14FA9-FC88-45F4-A622-F06E6C56E632 + VERSION_STRING = 1.0 + MODULE_TYPE = PEIM + ENTRY_POINT = FirmwareBootMediaInfoPeiEntry + +[LibraryClasses] + BaseLib + DebugLib + FirmwareBootMediaLib + FirmwareBootMediaInfoLib + HobLib + PeimEntryPoint + PeiServicesLib + +[Packages] + MdePkg/MdePkg.dec + IntelSiliconPkg/IntelSiliconPkg.dec + BoardModulePkg/BoardModulePkg.dec + +[Sources] + FirmwareBootMediaInfoPei.c + +[Depex] + TRUE diff --git a/Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.c b/Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.c new file mode 100644 index 0000000000..7a71071053 --- /dev/null +++ b/Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.c @@ -0,0 +1,76 @@ +/** @file + Firmware Boot Media Info Module + + This module publishes firmware boot media device information used in the boot flow for system initialization + decisions dependent upon the firmware boot media. + + This module depends upon a library instance to actually perform firmware boot media device detection since the + detection mechanism will vary across systems. In many cases, the media type may simply be set to a single firmware + boot media device with no run-time logic required. In any case, this module should dispatch as early as possible in + the system boot flow so the firmware boot media information is available for other modules. If any dependencies are + required to dynamically determine the firmware boot media device, those should be in the DEPEX section of the active + FirmwareBootMediaInfoLib such that this module will dispatch once those dependencies are satisfied. + +Copyright (c) 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include + +/** + Produces a gFirmwareBootMediaHobGuid HOB instance. + + @retval EFI_SUCCESS The firmware boot media HOB was produced successfully. + @retval EFI_NOT_FOUND The firmware boot media device information could not be found to produce the + the firmware boot media HOB. +**/ +EFI_STATUS +EFIAPI +ProduceFirmwareBootMediaHob ( + VOID + ) +{ + FW_BOOT_MEDIA_HOB_DATA FwBootMediaHobData; + + FwBootMediaHobData.BootMedia = IdentifyFirmwareBootMediaType (); + if (FwBootMediaHobData.BootMedia == FwBootMediaMax) { + return EFI_NOT_FOUND; + } + + BuildGuidDataHob ( + &gFirmwareBootMediaHobGuid, + &FwBootMediaHobData, + sizeof (FW_BOOT_MEDIA_HOB_DATA) + ); + + return EFI_SUCCESS; +} + +/** + Attempts to publish the firmware boot media HOB. + + @param FileHandle Handle of the file being invoked. + @param PeiServices Describes the list of possible PEI Services. + + @retval EFI_SUCCESS Produce the BootMedia Hob successfully. + +**/ +EFI_STATUS +EFIAPI +FirmwareBootMediaInfoPeiEntry ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + EFI_STATUS Status; + + Status = ProduceFirmwareBootMediaHob (); + ASSERT_EFI_ERROR (Status); + + return Status; +} -- 2.16.2.windows.1