From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web12.6731.1570638833873521404 for ; Wed, 09 Oct 2019 09:33:54 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=rFHsqTYW; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: michael.a.kubacki@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Oct 2019 09:33:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,276,1566889200"; d="scan'208";a="206912514" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga001.fm.intel.com with ESMTP; 09 Oct 2019 09:33:52 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 9 Oct 2019 09:33:52 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 9 Oct 2019 09:33:51 -0700 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (104.47.42.52) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 9 Oct 2019 09:33:51 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jOMD/b9G1FF+8imtzL3Ez0PzGxS2tnK1ezkJabKO+J6QpEz2tOoXHuhEtIMI0dZYNmHFG/sYgU3Q86FlwMQI4T2z81ZidnB41QZswr3K53i77QB7jn4S/Qjcfq8nj0qmHrgR1qvCI+Tqe1498Q8f7gLFoKEuXAtMKQF/wunw+x2qnjZbZBVVQux4ax/sf1OWP8Cx4Q2nO68uoDWxtd/AY2WA3jjEsl9AjcxVvLMSykBmG/IDcqDNdGt61lDA2rKZlR6SYwiU9xF3zPJAMqWUt/Je42p6CIc93KYY8y4UnJWszqw4HB59vbxrS9u6ZEq2moMi3SrBxNoxPl+muMK+fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UhDWztGwAzz6BiswLMzcozFM6rVnptb+SdIZyKVT4IM=; b=QeHOtxbfXxgDhcF+P+H3sJEsQP6fP9l4XIf96WzPPSfUtdz4KYea1IkSOmIT2t1fNN5/iLbDmcBhiONTg943YjtSpoim1V+q7Oimg+3IOyb4Yr52BwWjapPQger4+8W98rF/g4L/9i9Sq1sW7Chvm0Ncv6Q4C95VWbp4qQ3KoPsIjnQHaQLTmUisY2kGxLIpXdeqgHe9p7ucQnAC7DBBb+E2tBIn96C7b9TJoAxGA220tcfZVR9W+hKNtsiY1AC/5V8h9CT+no2v/YOXWJIbF7vsNnyoR6tWzksfSYBcCRtnIk2IC3T5OIotX1OqKWG3df6XHEh47uOjsk8M/g5K3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UhDWztGwAzz6BiswLMzcozFM6rVnptb+SdIZyKVT4IM=; b=rFHsqTYWIbQpbPrpvpY8yZCJNz4fVtx1N2bRTlzZ8TCU/dCt9K4C5NVdQSwkcsIJvg5xF4a+LdmNwJhwgoXn9Kl7kBvFEc9TVDgaTXFm8BZuCsrgmLQLeu9qnaNfpaZnMj2X2u9N3jKWEGbpzYUx61sbtzH8dWu9QZDjhT5L3Yg= Received: from BYAPR11MB3831.namprd11.prod.outlook.com (20.178.239.150) by BYAPR11MB2760.namprd11.prod.outlook.com (52.135.224.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16; Wed, 9 Oct 2019 16:33:45 +0000 Received: from BYAPR11MB3831.namprd11.prod.outlook.com ([fe80::1d85:7cb0:c014:938]) by BYAPR11MB3831.namprd11.prod.outlook.com ([fe80::1d85:7cb0:c014:938%5]) with mapi id 15.20.2347.016; Wed, 9 Oct 2019 16:33:45 +0000 From: "Kubacki, Michael A" To: "Ni, Ray" , "devel@edk2.groups.io" CC: "Chaganty, Rangasai V" Subject: Re: [edk2-platforms][PATCH V2 1/3] IntelSiliconPkg/FirmwareBootMediaLib: Add library Thread-Topic: [edk2-platforms][PATCH V2 1/3] IntelSiliconPkg/FirmwareBootMediaLib: Add library Thread-Index: AQHVfoTwE0CfYZT6AUCkaFY11+aOLqdSe8tg Date: Wed, 9 Oct 2019 16:33:44 +0000 Message-ID: References: <20191004172924.20240-1-michael.a.kubacki@intel.com> <20191004172924.20240-2-michael.a.kubacki@intel.com> <734D49CCEBEEF84792F5B80ED585239D5C317BD9@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5C317BD9@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYmU5YWUyYmYtOTZlNS00NWNiLTkzOTktNDI4MTY2YTFmZWU0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiM1ZtM3ZPejRuREdnZzl1bHVcL0ZiKzZuMVwvVGFIRU1tZE5xeHNveTNjY1wvNmhnNUpGT1hjRUdWd1VjTjJIYm9IMCJ9 dlp-reaction: no-action dlp-version: 11.2.0.6 authentication-results: spf=none (sender IP is ) smtp.mailfrom=michael.a.kubacki@intel.com; x-originating-ip: [134.134.136.217] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c06bd46a-0535-43bf-8445-08d74cd6742a x-ms-traffictypediagnostic: BYAPR11MB2760: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 018577E36E x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(376002)(396003)(136003)(39860400002)(366004)(13464003)(189003)(199004)(6246003)(25786009)(4326008)(107886003)(14454004)(33656002)(66066001)(76176011)(6506007)(53546011)(99286004)(7696005)(8676002)(81166006)(71190400001)(81156014)(256004)(76116006)(8936002)(66556008)(66476007)(71200400001)(14444005)(66446008)(478600001)(66946007)(64756008)(26005)(74316002)(6116002)(186003)(3846002)(2501003)(476003)(486006)(446003)(30864003)(2906002)(52536014)(5660300002)(102836004)(11346002)(86362001)(6436002)(110136005)(7736002)(305945005)(316002)(229853002)(6306002)(9686003)(55016002)(579004)(559001);DIR:OUT;SFP:1102;SCL:1;SRVR:BYAPR11MB2760;H:BYAPR11MB3831.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: qsUgmPNbILjWDo3MrU+4MuCFsMWsqCmNaz3bORLv7S2YxjFFke8z3x6WSPbbUQgKVggA/F5rXUSl8dhruU0LE24q5oSkNyvQ1Y6kPdB2Qw1zLdsSX7E2sYfelFeyAnaEIrgLMitCpwT8r17fTYKFBHO/ws5dbwP7AcQYx3NR+B0QB+NH5eRFQM4UYX7W8EsP4ff3IIgX5ObRao4aVbb10rFR/7BXs8jmfhKKHyINcBjdK3/xY4SieMV1zXw0TZKQNNuz2rqgIr/NoQB0dAH7pkwUT1jHRHwhUDw3UemZVwlT2Tqd900HaBm3YuS981SjiH9KYyWpMTRBa0Z7nIeq9UctozCAfuozZ3A/nQRlNoMZFKI49DEf0fbpaXk0DKFpsFk05t3lNPeLXWqk7eLAiWRWVgpWISD53P8KwdnVa4E= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: c06bd46a-0535-43bf-8445-08d74cd6742a X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Oct 2019 16:33:44.9801 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: YP34+bBxJFya8Np9eGOseaMMfccqPPao6laxnpjpRiWQEjsVGYQhbmrTl6DMKJOBNGZw6JJfNM2uP1bIBeJsanbe67TC5yr2vAtM69On3VQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2760 Return-Path: michael.a.kubacki@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 1. DxeSmmFirmwareBootMediaLib could get the HOB like PEI for every access. = I considered this but it seems unnecessary since we have the flexibility for phase-specific drivers that = can have trivial optimizations like this. Checking the HOB on every access would also constrain usage in D= XE_SMM_DRIVER and=20 DXE_RUNTIME_DRIVER modules. 2. They are certainly not required, but in practice we've found code usage = tends to read better and be more concise with these APIs for simple firmware boot media checks. The enum is = provided for relatively rarer scenarios where many possibilities need to be considered such as usage in a= switch statement. I can see a case made in either direction. Let me know if you and Sai feel strongly abo= ut this. Thanks, Michael > -----Original Message----- > From: Ni, Ray > Sent: Wednesday, October 9, 2019 2:36 AM > To: Kubacki, Michael A ; > devel@edk2.groups.io > Cc: Chaganty, Rangasai V > Subject: RE: [edk2-platforms][PATCH V2 1/3] > IntelSiliconPkg/FirmwareBootMediaLib: Add library >=20 > Michael, > Two comments: > 1. The difference between PEI and DXE instances is DXE instance has a glo= bal > variable caching the boot media type. Both get the type from HOB. So I am > thinking how about simplifying the library to have only one instance whic= h > equals to PEI instance. That can also be used in DXE phase. > 2. With the definition of enum type FW_BOOT_MEDIA_TYPE and GetType() > API, I feel the other several FirmwareBootMediaIsXXX() APIs are not very > necessary. >=20 > Thanks, > Ray >=20 > > -----Original Message----- > > From: Kubacki, Michael A > > Sent: Saturday, October 5, 2019 1:29 AM > > To: devel@edk2.groups.io > > Cc: Chaganty, Rangasai V ; Ni, Ray > > > > Subject: [edk2-platforms][PATCH V2 1/3] > > IntelSiliconPkg/FirmwareBootMediaLib: Add library > > > > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2229 > > > > Adds a new library that is used to make system initialization > > decisions in the boot flow dependent upon firmware boot media. > > Note that the firmware boot media is the storage media that the boot > > firmware is stored on. It is not the OS storage media which may be > > stored upon a different non-volatile storage device. > > > > Any Intel board, platform, or silicon code that must take action > > conditionally based on the firmware boot media must use this library > > API. > > > > Cc: Sai Chaganty > > Cc: Ray Ni > > Signed-off-by: Michael Kubacki > > --- > > Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec = | 8 +- > > Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc = | 4 +- > > > > > Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirm > > wareBootMediaLib.inf | 43 ++++++++ > > > > > Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareB > > ootMediaLib.inf | 38 +++++++ > > Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaLib.h > > | 106 +++++++++++++++++++ > > > > > Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirm > > wareBootMediaLib.c | 107 +++++++++++++++++++ > > > > > Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/FirmwareBoo > > tMediaLib.c | 109 ++++++++++++++++++++ > > > > > Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareB > > ootMediaLib.c | 82 +++++++++++++++ > > 8 files changed, 495 insertions(+), 2 deletions(-) > > > > diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec > > b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec > > index fe5bfa0dc6..f70e3b977d 100644 > > --- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec > > +++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec > > @@ -3,7 +3,7 @@ > > # > > # This package provides common open source Intel silicon modules. > > # > > -# Copyright (c) 2016 - 2018, Intel Corporation. All rights > > reserved.
> > +# Copyright (c) 2016 - 2019, Intel Corporation. All rights > > +reserved.
> > # SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -22,6 +22,10 > > @@ > > # > > MicrocodeFlashAccessLib|Include/Library/MicrocodeFlashAccessLib.h > > > > + ## @libraryclass Provides services to identify the firmware boot > > + media > > device. > > + # > > + FirmwareBootMediaLib|Include/Library/FirmwareBootMediaLib.h > > + > > [Guids] > > ## GUID for Package token space > > # {A9F8D54E-1107-4F0A-ADD0-4587E7A4A735} > > @@ -35,6 +39,8 @@ > > ## Include/Guid/MicrocodeFmp.h > > gMicrocodeFmpImageTypeIdGuid =3D { 0x96d4fdcd, 0x1502, 0x424d, = { > 0x9d, > > 0x4c, 0x9b, 0x12, 0xd2, 0xdc, 0xae, 0x5c } } > > > > + gFirmwareBootMediaHobGuid =3D { 0x8c7340ea, 0xde8b, 0x4e06, {0xa4, > > + 0x78, > > 0xec, 0x8b, 0x62, 0xd7, 0xa, 0x8b } } > > + > > [Ppis] > > gEdkiiVTdInfoPpiGuid =3D { 0x8a59fcb3, 0xf191, 0x400c, { 0x97, 0x67, > > 0x67, 0xaf, 0x2b, 0x25, 0x68, 0x4a } } > > > > diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc > > b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc > > index 58b5b656ef..3fb8a08b50 100644 > > --- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc > > +++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc > > @@ -1,7 +1,7 @@ > > ## @file > > # This package provides common open source Intel silicon modules. > > # > > -# Copyright (c) 2017, Intel Corporation. All rights reserved.
> > +# Copyright (c) 2017 - 2019, Intel Corporation. All rights > > +reserved.
> > # > > # SPDX-License-Identifier: BSD-2-Clause-Patent > > # > > @@ -80,6 +80,8 @@ > > > > > IntelSiliconPkg/Feature/VTd/PlatformVTdInfoSamplePei/PlatformVTdInfoSa > > mplePei.inf > > > > > IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDx > > e.inf > > > > IntelSiliconPkg/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/Mi > > cro > > codeFlashAccessLibNull.inf > > + > > > IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmwareBootMediaLib > > .inf > > + > > > IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFirmwareBootMe > > diaLib.inf > > > > [BuildOptions] > > *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES diff -- > git > > > a/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFi > > r > > mwareBootMediaLib.inf > > > b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFi > > r > > mwareBootMediaLib.inf > > new file mode 100644 > > index 0000000000..83ed5f04af > > --- /dev/null > > +++ > > > b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFi > > r > > mwareBootMediaLib.inf > > @@ -0,0 +1,43 @@ > > +## @file > > +# Firmware Boot Media Library > > +# > > +# The firmware boot media device is used to make system > > +initialization > > decisions in the boot flow dependent > > +# upon firmware boot media. Note that the firmware boot media is the > > storage media that the boot firmware is stored on. > > +# It is not the OS storage media which may be stored upon a different > > +non- > > volatile storage device. > > +# > > +# This library contains an implementation for the DXE and SMM boot > phases. > > +# > > +# Copyright (c) 2019, Intel Corporation. All rights reserved.
# # > > +SPDX-License-Identifier: BSD-2-Clause-Patent # ## > > + > > +[Defines] > > + INF_VERSION =3D 0x00010005 > > + BASE_NAME =3D DxeSmmFirmwareBootMediaLib > > + FILE_GUID =3D 72F07B0B-54F5-47FD-9EDB-D796BE2B8= 7E9 > > + MODULE_TYPE =3D DXE_DRIVER > > + VERSION_STRING =3D 1.0 > > + PI_SPECIFICATION_VERSION =3D 0x0001000A > > + LIBRARY_CLASS =3D FirmwareBootMediaLib|DXE_DRIVER > > DXE_SMM_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION > UEFI_DRIVER > > + CONSTRUCTOR =3D DxeSmmFirmwareBootMediaLibInit > > +# > > +# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC > > +# > > + > > +[Sources] > > + FirmwareBootMediaLib.c > > + DxeSmmFirmwareBootMediaLib.c > > + > > +[Packages] > > + MdePkg/MdePkg.dec > > + IntelSiliconPkg/IntelSiliconPkg.dec > > + > > +[LibraryClasses] > > + BaseLib > > + DebugLib > > + HobLib > > + > > +[Guids] > > + gFirmwareBootMediaHobGuid ## CONSUMES > > diff --git > > a/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmw > > ar > > eBootMediaLib.inf > > b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmw > > ar > > eBootMediaLib.inf > > new file mode 100644 > > index 0000000000..063c4027d3 > > --- /dev/null > > +++ > > b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmw > > ar > > eBootMediaLib.inf > > @@ -0,0 +1,38 @@ > > +## @file > > +# Firmware Boot Media Library > > +# > > +# The firmware boot media device is used to make system > > +initialization > > decisions in the boot flow dependent > > +# upon firmware boot media. Note that the firmware boot media is the > > storage media that the boot firmware is stored on. > > +# It is not the OS storage media which may be stored upon a different > > +non- > > volatile storage device. > > +# > > +# This library contains an implementation for the PEI boot phase. > > +# > > +# Copyright (c) 2019, Intel Corporation. All rights reserved.
# # > > +SPDX-License-Identifier: BSD-2-Clause-Patent # ## > > + > > +[Defines] > > + INF_VERSION =3D 0x00010005 > > + BASE_NAME =3D PeiFirmwareBootMediaLib > > + FILE_GUID =3D D3F7BD0B-3539-4F2D-AF98-EE32DBE7971F > > + MODULE_TYPE =3D PEIM > > + VERSION_STRING =3D 1.0 > > + LIBRARY_CLASS =3D FirmwareBootMediaLib > > + > > +[Sources] > > + FirmwareBootMediaLib.c > > + PeiFirmwareBootMediaLib.c > > + > > +[Packages] > > + MdePkg/MdePkg.dec > > + IntelSiliconPkg/IntelSiliconPkg.dec > > + > > +[LibraryClasses] > > + BaseLib > > + DebugLib > > + HobLib > > + > > +[Guids] > > + gFirmwareBootMediaHobGuid ## PRODUCES CONSUMES > > diff --git > > a/Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaLib.h > > b/Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaLib.h > > new file mode 100644 > > index 0000000000..aca9593a84 > > --- /dev/null > > +++ b/Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaL > > +++ ib.h > > @@ -0,0 +1,106 @@ > > +/** @file > > + This library identifies the firmware boot media device. > > + > > + The firmware boot media device is used to make system > > + initialization > > decisions in the boot flow dependent > > + upon firmware boot media. Note that the firmware boot media is the > > storage media that the boot firmware is stored on. > > + It is not the OS storage media which may be stored upon a different > > + non- > > volatile storage device. > > + > > +Copyright (c) 2019, Intel Corporation. All rights reserved.
> > +SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#ifndef _FIRMWARE_BOOT_MEDIA_LIB_H_ > > +#define _FIRMWARE_BOOT_MEDIA_LIB_H_ > > + > > +#include > > + > > +typedef enum { > > + FwBootMediaSpi, > > + FwBootMediaUfs, > > + FwBootMediaEmmc, > > + FwBootMediaNvme, > > + FwBootMediaMax > > +} FW_BOOT_MEDIA_TYPE; > > + > > +typedef struct { > > + FW_BOOT_MEDIA_TYPE BootMedia; > > +} FW_BOOT_MEDIA_HOB_DATA; > > + > > +/** > > + Determines the current platform firmware boot media device. > > + > > + @param[out] FwBootMediaType The current platform Boot Media type. > > + > > + @retval EFI_SUCCESS The operation completed successfully. > > + @retval EFI_NOT_FOUND The boot media type could not be found. > > +**/ > > +EFI_STATUS > > +EFIAPI > > +GetFirmwareBootMediaType ( > > + OUT FW_BOOT_MEDIA_TYPE *FwBootMediaType > > + ); > > + > > +/** > > + Indicates whether the boot media is presently known. > > + > > + Note: Very early in boot this data may not be available. > > + > > + @retval TRUE Boot media is known > > + @retval FALSE Boot media is not known > > +**/ > > +BOOLEAN > > +EFIAPI > > +FirmwareBootMediaIsKnown ( > > + VOID > > + ); > > + > > +/** > > + Determines if the platform firmware is booting from SPI. > > + > > + @retval TRUE Platform firmware is booting from SPI > > + @retval FALSE Platform firmware is booting from a non-SPI devi= ce or > > the boot media is unknown > > +**/ > > +BOOLEAN > > +EFIAPI > > +FirmwareBootMediaIsSpi ( > > + VOID > > + ); > > + > > +/** > > + Determines if the platform firmware is booting from UFS. > > + > > + @retval TRUE Platform firmware is booting from UFS > > + @retval FALSE Platform firmware is booting from a non-UFS devi= ce or > > the boot media is unknown > > +**/ > > +BOOLEAN > > +EFIAPI > > +FirmwareBootMediaIsUfs ( > > + VOID > > + ); > > + > > +/** > > + Determines if the platform firmware is booting from eMMC. > > + > > + @retval TRUE Platform firmware is booting from eMMC > > + @retval FALSE Platform firmware is booting from a non-eMMC dev= ice > > or the boot media is unknown > > +**/ > > +BOOLEAN > > +EFIAPI > > +FirmwareBootMediaIsEmmc ( > > + VOID > > + ); > > + > > +/** > > + Determines if the platform firmware is booting from NVMe. > > + > > + @retval TRUE Platform firmware is booting from NVMe. > > + @retval FALSE Platform firmware is booting from a non-NVMe dev= ice > or > > the boot media is unknown > > +**/ > > +BOOLEAN > > +EFIAPI > > +FirmwareBootMediaIsNvme ( > > + VOID > > + ); > > + > > +#endif > > diff --git > > > a/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFi > > r > > mwareBootMediaLib.c > > > b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFi > > r > > mwareBootMediaLib.c > > new file mode 100644 > > index 0000000000..1e3876afb3 > > --- /dev/null > > +++ > > > b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/DxeSmmFi > > r > > mwareBootMediaLib.c > > @@ -0,0 +1,107 @@ > > +/** @file > > + This library identifies the firmware boot media device. > > + > > + The firmware boot media device is used to make system > > + initialization > > decisions in the boot flow dependent > > + upon firmware boot media. Note that the firmware boot media is the > > storage media that the boot firmware is stored on. > > + It is not the OS storage media which may be stored upon a different > > + non- > > volatile storage device. > > + > > + This file contains implementation specific to the DXE and SMM boot > phases. > > + > > +Copyright (c) 2019, Intel Corporation. All rights reserved.
> > +SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#include > > +#include > > +#include #include > > + > > +STATIC FW_BOOT_MEDIA_TYPE mFwBootMedia =3D FwBootMediaMax; > > + > > +/** > > + Determines the current platform firmware boot media device. > > + > > + @param[out] FwBootMediaType The current platform Boot Media type. > > + > > + @retval EFI_SUCCESS The operation completed successfully. > > + @retval EFI_NOT_FOUND The boot media type could not be found. > > +**/ > > +EFI_STATUS > > +EFIAPI > > +GetFirmwareBootMediaType ( > > + OUT FW_BOOT_MEDIA_TYPE *FwBootMediaType > > + ) > > +{ > > + if (mFwBootMedia =3D=3D FwBootMediaMax) { > > + return EFI_NOT_FOUND; > > + } > > + > > + *FwBootMediaType =3D mFwBootMedia; > > + return EFI_SUCCESS; > > +} > > + > > +/** > > + Determines if the boot media is presently known. > > + > > + Note: Very early in boot this data may not be available. > > + > > + @retval TRUE Boot media is known > > + @retval FALSE Boot media is not known > > +**/ > > +BOOLEAN > > +EFIAPI > > +FirmwareBootMediaIsKnown ( > > + VOID > > + ) > > +{ > > + return mFwBootMedia !=3D FwBootMediaMax; } > > + > > +/** > > + The library constructor. > > + > > + This constructor depends upon gFirmwareBootMediaHobGuid. > > + It should be produced by the platform in the HOB producer phase. > > + > > + @param[in] ImageHandle The firmware allocated handle for = the > UEFI > > image. > > + @param[in] SystemTable A pointer to the EFI system table. > > + > > + @retval EFI_SUCCESS The constructor executed successfu= lly. > > + @retval EFI_NOT_FOUND The gFirmwareBootMediaHobGuid HOB > > could not be located > > + or the boot media type is invalid. > > +**/ > > +EFI_STATUS > > +EFIAPI > > +DxeSmmFirmwareBootMediaLibInit ( > > + IN EFI_HANDLE ImageHandle, > > + IN EFI_SYSTEM_TABLE *SystemTable > > + ) > > +{ > > + FW_BOOT_MEDIA_HOB_DATA *BootMediaHobData; > > + FW_BOOT_MEDIA_TYPE BootMediaType; > > + EFI_HOB_GUID_TYPE *GuidHobPtr; > > + > > + GuidHobPtr =3D GetFirstGuidHob (&gFirmwareBootMediaHobGuid); if > > + (GuidHobPtr =3D=3D NULL) { > > + DEBUG ((DEBUG_ERROR, "The firmware boot media HOB does not > > exist!\n")); > > + ASSERT (GuidHobPtr !=3D NULL); > > + return EFI_NOT_FOUND; > > + } > > + > > + BootMediaHobData =3D (FW_BOOT_MEDIA_HOB_DATA *) > > GET_GUID_HOB_DATA (GuidHobPtr); > > + if (BootMediaHobData =3D=3D NULL) { > > + return EFI_NOT_FOUND; > > + } > > + > > + BootMediaType =3D BootMediaHobData->BootMedia; > > + > > + if (BootMediaType >=3D FwBootMediaMax) { > > + DEBUG ((DEBUG_ERROR, "The firmware boot media HOB specifies an > > invalid media type.\n")); > > + return EFI_NOT_FOUND; > > + } > > + > > + mFwBootMedia =3D BootMediaType; > > + > > + return EFI_SUCCESS; > > +} > > diff --git > > a/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/Firmware > > B > > ootMediaLib.c > > b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/Firmware > > B > > ootMediaLib.c > > new file mode 100644 > > index 0000000000..11a14d172d > > --- /dev/null > > +++ > > b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/Firmware > > B > > ootMediaLib.c > > @@ -0,0 +1,109 @@ > > +/** @file > > + This library identifies the firmware boot media device. > > + > > + The firmware boot media device is used to make system > > + initialization > > decisions in the boot flow dependent > > + upon firmware boot media. Note that the firmware boot media is the > > storage media that the boot firmware is stored on. > > + It is not the OS storage media which may be stored upon a different > > + non- > > volatile storage device. > > + > > + This file contains library implementation common to all boot phases. > > + > > +Copyright (c) 2019, Intel Corporation. All rights reserved.
> > +SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#include > > +#include > > +#include > > + > > +/** > > + Determines if the platform firmware is booting from SPI. > > + > > + @retval TRUE Platform firmware is booting from SPI > > + @retval FALSE Platform firmware is booting from a non-SPI devi= ce or > > the boot media is unknown > > +**/ > > +BOOLEAN > > +EFIAPI > > +FirmwareBootMediaIsSpi ( > > + VOID > > + ) > > +{ > > + EFI_STATUS Status; > > + FW_BOOT_MEDIA_TYPE BootMedia; > > + > > + Status =3D GetFirmwareBootMediaType (&BootMedia); > > + if (EFI_ERROR (Status) || BootMedia !=3D FwBootMediaSpi) { > > + return FALSE; > > + } else { > > + return TRUE; > > + } > > +} > > + > > +/** > > + Determines if the platform firmware is booting from UFS. > > + > > + @retval TRUE Platform firmware is booting from UFS > > + @retval FALSE Platform firmware is booting from a non-UFS devi= ce or > > the boot media is unknown > > +**/ > > +BOOLEAN > > +EFIAPI > > +FirmwareBootMediaIsUfs ( > > + VOID > > + ) > > +{ > > + EFI_STATUS Status; > > + FW_BOOT_MEDIA_TYPE BootMedia; > > + > > + Status =3D GetFirmwareBootMediaType (&BootMedia); > > + if (EFI_ERROR (Status) || BootMedia !=3D FwBootMediaUfs) { > > + return FALSE; > > + } else { > > + return TRUE; > > + } > > +} > > + > > +/** > > + Determines if the platform firmware is booting from eMMC. > > + > > + @retval TRUE Platform firmware is booting from eMMC > > + @retval FALSE Platform firmware is booting from a non-eMMC dev= ice > > or the boot media is unknown > > +**/ > > +BOOLEAN > > +EFIAPI > > +FirmwareBootMediaIsEmmc ( > > + VOID > > + ) > > +{ > > + EFI_STATUS Status; > > + FW_BOOT_MEDIA_TYPE BootMedia; > > + > > + Status =3D GetFirmwareBootMediaType (&BootMedia); > > + if (EFI_ERROR (Status) || BootMedia !=3D FwBootMediaEmmc) { > > + return FALSE; > > + } else { > > + return TRUE; > > + } > > +} > > + > > +/** > > + Determines if the platform firmware is booting from NVMe. > > + > > + @retval TRUE Platform firmware is booting from NVMe. > > + @retval FALSE Platform firmware is booting from a non-NVMe dev= ice > or > > the boot media is unknown > > +**/ > > +BOOLEAN > > +EFIAPI > > +FirmwareBootMediaIsNvme ( > > + VOID > > + ) > > +{ > > + EFI_STATUS Status; > > + FW_BOOT_MEDIA_TYPE BootMedia; > > + > > + Status =3D GetFirmwareBootMediaType (&BootMedia); > > + if (EFI_ERROR (Status) || BootMedia !=3D FwBootMediaNvme) { > > + return FALSE; > > + } else { > > + return TRUE; > > + } > > +} > > diff --git > > a/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmw > > ar > > eBootMediaLib.c > > b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmw > > ar > > eBootMediaLib.c > > new file mode 100644 > > index 0000000000..14478e0dbe > > --- /dev/null > > +++ > > b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmw > > ar > > eBootMediaLib.c > > @@ -0,0 +1,82 @@ > > +/** @file > > + This library identifies the firmware boot media device. > > + > > + The firmware boot media device is used to make system > > + initialization > > decisions in the boot flow dependent > > + upon firmware boot media. Note that the firmware boot media is the > > storage media that the boot firmware is stored on. > > + It is not the OS storage media which may be stored upon a different > > + non- > > volatile storage device. > > + > > + This file contains implementation specific to the PEI boot phase. > > + > > +Copyright (c) 2019, Intel Corporation. All rights reserved.
> > +SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#include > > +#include > > +#include #include > > + > > +/** > > + Determines the current platform firmware boot media device. > > + > > + @param[out] FwBootMediaType The current platform Boot Media type. > > + > > + @retval EFI_SUCCESS The operation completed successfully. > > + @retval EFI_NOT_FOUND The boot media type could not be found. > > +**/ > > +EFI_STATUS > > +EFIAPI > > +GetFirmwareBootMediaType ( > > + OUT FW_BOOT_MEDIA_TYPE *FwBootMediaType > > + ) > > +{ > > + FW_BOOT_MEDIA_HOB_DATA *BootMediaHobData; > > + EFI_HOB_GUID_TYPE *GuidHobPtr; > > + > > + GuidHobPtr =3D GetFirstGuidHob (&gFirmwareBootMediaHobGuid); if > > + (GuidHobPtr =3D=3D NULL) { > > + DEBUG ((DEBUG_ERROR, "The firmware boot media HOB does not > > exist!\n")); > > + ASSERT (GuidHobPtr !=3D NULL); > > + return EFI_NOT_FOUND; > > + } > > + > > + BootMediaHobData =3D (FW_BOOT_MEDIA_HOB_DATA *) > > GET_GUID_HOB_DATA (GuidHobPtr); > > + if (BootMediaHobData =3D=3D NULL) { > > + return EFI_NOT_FOUND; > > + } > > + > > + if (BootMediaHobData->BootMedia >=3D FwBootMediaMax) { > > + DEBUG ((DEBUG_ERROR, "The firmware boot media HOB specifies an > > invalid media type.\n")); > > + return EFI_NOT_FOUND; > > + } > > + *FwBootMediaType =3D BootMediaHobData->BootMedia; > > + > > + return EFI_SUCCESS; > > +} > > + > > +/** > > + Determines if the boot media is presently known. > > + > > + Note: Very early in boot this data may not be available. > > + > > + @retval TRUE Boot media is known > > + @retval FALSE Boot media is not known > > +**/ > > +BOOLEAN > > +EFIAPI > > +FirmwareBootMediaIsKnown ( > > + VOID > > + ) > > +{ > > + EFI_STATUS Status; > > + FW_BOOT_MEDIA_TYPE BootMedia; > > + > > + BootMedia =3D FwBootMediaMax; > > + Status =3D GetFirmwareBootMediaType (&BootMedia); > > + if (EFI_ERROR (Status) || BootMedia =3D=3D FwBootMediaMax) { > > + return FALSE; > > + } else { > > + return TRUE; > > + } > > +} > > -- > > 2.16.2.windows.1 >=20