Reviewed-by: Eric Dong <eric.d...@intel.com> > -----Original Message----- > From: Kubacki, Michael A > Sent: Saturday, October 5, 2019 1:29 AM > To: devel@edk2.groups.io > Cc: Dong, Eric <eric.d...@intel.com>; Gao, Liming <liming....@intel.com> > Subject: [edk2-platforms][PATCH V2 3/3] > BoardModulePkg/FirmwareBootMediaInfoPei: Add module > > 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 <eric.d...@intel.com> > Cc: Liming Gao <liming....@intel.com> > Signed-off-by: Michael Kubacki <michael.a.kuba...@intel.com> > --- > Platform/Intel/BoardModulePkg/BoardModulePkg.dsc > | 3 + > > Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMedi > aInfoPei.inf | 46 ++++++++++++ > > Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMedi > aInfoPei.c | 76 ++++++++++++++++++++ > 3 files changed, 125 insertions(+) > > diff --git a/Platform/Intel/BoardModulePkg/BoardModulePkg.dsc > b/Platform/Intel/BoardModulePkg/BoardModulePkg.dsc > index 3d605cf876..5ec68ceebf 100644 > --- a/Platform/Intel/BoardModulePkg/BoardModulePkg.dsc > +++ b/Platform/Intel/BoardModulePkg/BoardModulePkg.dsc > @@ -31,9 +31,11 @@ > 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/PeiFi > rmwareBootMediaLib.inf > + > FirmwareBootMediaInfoLib|BoardModulePkg/Library/PeiFirmwareBootMediaI > nfoLib/PeiFirmwareBootMediaInfoLib.inf > HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf > > MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAll > ocationLib.inf > > @@ -73,6 +75,7 @@ > > ############################################################### > #################################### > > [Components] > + BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.inf > BoardModulePkg/Library/CmosAccessLib/CmosAccessLib.inf > > BoardModulePkg/Library/PlatformCmosAccessLibNull/PlatformCmosAccessLib > Null.inf > > diff --git > a/Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe > diaInfoPei.inf > b/Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe > diaInfoPei.inf > new file mode 100644 > index 0000000000..a81932f2a1 > --- /dev/null > +++ > b/Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe > diaInfoPei.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.<BR> > +# > +# 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/FirmwareBootMe > diaInfoPei.c > b/Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe > diaInfoPei.c > new file mode 100644 > index 0000000000..7a71071053 > --- /dev/null > +++ > b/Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMe > diaInfoPei.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.<BR> > +SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include <Library/BaseLib.h> > +#include <Library/DebugLib.h> > +#include <Library/FirmwareBootMediaLib.h> > +#include <Library/FirmwareBootMediaInfoLib.h> > +#include <Library/HobLib.h> > + > +/** > + 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
-=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#48550): https://edk2.groups.io/g/devel/message/48550 Mute This Topic: https://groups.io/mt/34396663/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-