From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: eric.dong@intel.com) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by groups.io with SMTP; Tue, 08 Oct 2019 00:02:29 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Oct 2019 00:02:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,269,1566889200"; d="scan'208";a="277016895" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga001.jf.intel.com with ESMTP; 08 Oct 2019 00:02:27 -0700 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 8 Oct 2019 00:02:27 -0700 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 8 Oct 2019 00:02:26 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.176]) by SHSMSX154.ccr.corp.intel.com ([10.239.6.54]) with mapi id 14.03.0439.000; Tue, 8 Oct 2019 15:02:24 +0800 From: "Dong, Eric" To: "Kubacki, Michael A" , "devel@edk2.groups.io" CC: "Gao, Liming" Subject: Re: [edk2-platforms][PATCH V2 3/3] BoardModulePkg/FirmwareBootMediaInfoPei: Add module Thread-Topic: [edk2-platforms][PATCH V2 3/3] BoardModulePkg/FirmwareBootMediaInfoPei: Add module Thread-Index: AQHVetlJUqQGZXV+Rk2znczi0inH26dQVung Date: Tue, 8 Oct 2019 07:02:23 +0000 Message-ID: References: <20191004172924.20240-1-michael.a.kubacki@intel.com> <20191004172924.20240-4-michael.a.kubacki@intel.com> In-Reply-To: <20191004172924.20240-4-michael.a.kubacki@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: eric.dong@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Eric Dong > -----Original Message----- > From: Kubacki, Michael A > Sent: Saturday, October 5, 2019 1:29 AM > To: devel@edk2.groups.io > Cc: Dong, Eric ; Gao, Liming > Subject: [edk2-platforms][PATCH V2 3/3] > BoardModulePkg/FirmwareBootMediaInfoPei: Add module >=20 > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2229 >=20 > 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. >=20 > 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. >=20 > Cc: Eric Dong > Cc: Liming Gao > Signed-off-by: Michael Kubacki > --- > Platform/Intel/BoardModulePkg/BoardModulePkg.dsc = | 3 + >=20 > Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMedi > aInfoPei.inf | 46 ++++++++++++ >=20 > Platform/Intel/BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMedi > aInfoPei.c | 76 ++++++++++++++++++++ > 3 files changed, 125 insertions(+) >=20 > 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 >=20 > [LibraryClasses.common.PEIM] >=20 > FirmwareBootMediaLib|IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFi > rmwareBootMediaLib.inf > + > FirmwareBootMediaInfoLib|BoardModulePkg/Library/PeiFirmwareBootMediaI > nfoLib/PeiFirmwareBootMediaInfoLib.inf > HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf >=20 > MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAll > ocationLib.inf >=20 > @@ -73,6 +75,7 @@ >=20 > ############################################################### > #################################### >=20 > [Components] > + BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.inf > BoardModulePkg/Library/CmosAccessLib/CmosAccessLib.inf >=20 > BoardModulePkg/Library/PlatformCmosAccessLibNull/PlatformCmosAccessLib > Null.inf >=20 > 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 t= he > boot flow for system initialization > +# decisions dependent upon the firmware boot media. > +# > +# This module depends upon a library instance to actually perform firmwa= re > 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 m= odule > should dispatch as early as possible in > +# the system boot flow so the firmware boot media information is availab= le > for other modules. If any dependencies are > +# required to dynamically determine the firmware boot media device, thos= e > should be in the DEPEX section of the active > +# FirmwareBootMediaInfoLib such that this module will dispatch once thos= e > dependencies are satisfied. > +# > +# Copyright (c) 2019, Intel Corporation. All rights reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010017 > + BASE_NAME =3D FirmwareBootMediaInfoPei > + FILE_GUID =3D A8F14FA9-FC88-45F4-A622-F06E6C56E632 > + VERSION_STRING =3D 1.0 > + MODULE_TYPE =3D PEIM > + ENTRY_POINT =3D 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 t= he > boot flow for system initialization > + decisions dependent upon the firmware boot media. > + > + This module depends upon a library instance to actually perform firmwa= re > 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 m= odule > should dispatch as early as possible in > + the system boot flow so the firmware boot media information is availab= le for > other modules. If any dependencies are > + required to dynamically determine the firmware boot media device, thos= e > should be in the DEPEX section of the active > + FirmwareBootMediaInfoLib such that this module will dispatch once thos= e > 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 =3D IdentifyFirmwareBootMediaType (); > + if (FwBootMediaHobData.BootMedia =3D=3D 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 =3D ProduceFirmwareBootMediaHob (); > + ASSERT_EFI_ERROR (Status); > + > + return Status; > +} > -- > 2.16.2.windows.1