From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web11.2269.1570682581270365539 for ; Wed, 09 Oct 2019 21:43:01 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=Dz0I+uC/; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: michael.a.kubacki@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Oct 2019 21:43:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,278,1566889200"; d="scan'208";a="198220037" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga006.jf.intel.com with ESMTP; 09 Oct 2019 21:42:59 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 9 Oct 2019 21:42:59 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 9 Oct 2019 21:42:58 -0700 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 9 Oct 2019 21:42:58 -0700 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.51) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 9 Oct 2019 21:42:58 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HTBdxeEUBn6nfH0BO3Cnn4L2YG7Ze8cAv5X9Sn2ENZ02MN8y5Rq826hoHfYkBvsIOOmwWp0D3ZlQvrodCjcBIBC9OmDuMDkJuHsdAEE3azY3/J4gBC2YOTlaVIz7HGBYvjwb+yK8j1PbUgtKdgFAyVh7nWoDGqD/GbGRMhLxIlzVYPUY2Ie5BRa060R83QoGoHcbic67RmsEMT1fvf+dXfJxdUhcMXXvcxjwlcCdkXLeFSEWKYJxfRX6uMD5RXnq6RNtuKvHxTopq2FiJ9T+it/loOf5S0iOXbEwArOsCMSniOBmvZ2yt4U1yfjlxitIIprnoCtr4LkQqZxM2xGI2w== 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=gxmEPxr8JSWzHLqp9c8IUXkgGHAGslp4STuZlU9mR2w=; b=iudtFPvnaiM1DyblbjUMXNCXQerOQx++q6Xibhycw/dsA0sBgyTmmLrIAjJRrFjAIZ0VM7i9utehU/VVLBOIumuB0+D6FiMSFkXyzTN12FuewYbq7OFNituUjdxr/cGSWlsl+qNSK22K+59u64F/6JEHhjIbhFRLmPh+O7Ly/8YpQkCKPbaYpEOQ73TPwbhUplmqKcFnlGr5ApLsZAx4ilMjsmoiIwNPoqwgzX7Efn8DOzSU+wIJ2wiWdLjijm8vVnW0gvGNjqYGyltrVkHHViQXvkLVtpYyrYaNvLSiQODVWG6EwUPHslzLCymyHyxaTi2MwmIdQE3E/3h1I0qAjw== 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=gxmEPxr8JSWzHLqp9c8IUXkgGHAGslp4STuZlU9mR2w=; b=Dz0I+uC/3FisXEPrKN+DLZEzP53Lb4xDc92+hYapzVMCL+olT+N2mB+BZz3bZpgkHlgbGDVjXRf4PRnd0hSrljQI+1gzlDBQJsNTi4wpF6cjPHztVeGuDUCxAAdj3TCjjk/rwm1jwKbcT9z5ddL9dMu8+vHHJzhJjH2o27jIK9w= Received: from BYAPR11MB3831.namprd11.prod.outlook.com (20.178.239.150) by BYAPR11MB3397.namprd11.prod.outlook.com (20.177.186.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16; Thu, 10 Oct 2019 04:42:40 +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; Thu, 10 Oct 2019 04:42:40 +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+aOLqdSe8tggACp54CAABzFsA== Date: Thu, 10 Oct 2019 04:42:40 +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> <734D49CCEBEEF84792F5B80ED585239D5C3194C9@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5C3194C9@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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZjA0YzM4ZDUtOWUxMy00NzU1LWE5MjctOTkxMjk2ZDBlZmU5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiTHZWVVBPZ3ZSMlcyaHNyV2c4NVMwWVlOMVN2U2xTeHVIc0E5OFZXUElES1BJczlpVEt2c0ZOR3BQZXpPQm1jXC8ifQ== 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: 5b89dc74-0c8b-4d0b-297d-08d74d3c4853 x-ms-traffictypediagnostic: BYAPR11MB3397: 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:5236; x-forefront-prvs: 018632C080 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(39850400004)(396003)(136003)(346002)(376002)(199004)(189003)(13464003)(81166006)(14454004)(7736002)(2501003)(99286004)(52536014)(55016002)(186003)(478600001)(76176011)(305945005)(229853002)(81156014)(8676002)(8936002)(74316002)(11346002)(66556008)(446003)(66446008)(66476007)(76116006)(30864003)(316002)(486006)(86362001)(64756008)(110136005)(66946007)(102836004)(26005)(476003)(6436002)(6506007)(7696005)(53546011)(2906002)(256004)(6246003)(9686003)(71200400001)(33656002)(66066001)(14444005)(107886003)(6306002)(5660300002)(4326008)(71190400001)(25786009)(3846002)(6116002)(569006);DIR:OUT;SFP:1102;SCL:1;SRVR:BYAPR11MB3397;H:BYAPR11MB3831.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: LFvvzneASdApNePnIJesRDGhgUmtwe6bnxXBZRd8iDeTJUZGMgyX3j4RwStFLbpSNsBIUXaRXqOXXQ+H71fUYD5130JWsc8ZRSjkNiF+ud70GnLD689EZCrqsQCG8pVesocoUOtUhRk1AHzzA3TbPYAREYKl9m7svbffr6LSWuSvSgQ2DCdFT9f4DHpLZ8WxeCWWy8kj2RB10wUQuaEpvN+GhXkEvhO/r13JQL2iz4aUbsPcUctSt9vna5KjW9eSN2Ib6JNQBQRTIMN4sfO1Tifk7N3ptmOYkJP58w35hsHOt3uATwi1pcr5DTdb6yAmW/+Ra+udR/vlT5q/XCK4thxEDbZNa8usfnexxLw/epnkL0yeqM5ZtDiBCGyudL/krcXpcExh8iyoxfogM1R1ycvnttO27bX/XT5Tpd16RAQ= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 5b89dc74-0c8b-4d0b-297d-08d74d3c4853 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Oct 2019 04:42:40.1421 (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: Bowru3JziDXRDyY4epWHbiK5tRzgY1bFsIIN6e4OJQRRuDx4T6/ql/y+X/Ay20p3biAB6vKSwxg8yBsa0P4vHYbPd5gD80w7UtUYRiuWibI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3397 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 Replies below. > -----Original Message----- > From: Ni, Ray > Sent: Wednesday, October 9, 2019 7:21 PM > 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 > Comments below. >=20 > > -----Original Message----- > > From: Kubacki, Michael A > > Sent: Thursday, October 10, 2019 12:34 AM > > To: Ni, Ray ; devel@edk2.groups.io > > Cc: Chaganty, Rangasai V > > Subject: RE: [edk2-platforms][PATCH V2 1/3] > > IntelSiliconPkg/FirmwareBootMediaLib: Add library > > > > 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 optimizat= ions like > this. > > Checking the HOB on every access would also constrain usage in > > DXE_SMM_DRIVER and DXE_RUNTIME_DRIVER modules. >=20 > Having single library instance can make platform DSC simpler. > Because SMM and Runtime drivers are dispatched in BS phase, they can > cache the boot media type if the usage lasts to post-EndOfDxe or OS > runtime. >=20 I don't see an issue with phase-specific instances that cleanly comply with phase restrictions. In general, PEI drivers cannot write to global variables. This change does cache the value in BS phase so it is available in OS runtime. * PEI: Do not write to a global variable. Use the heap to store the value = via the HOB list. Always get the value from the HOB. * DXE: Get the value from the HOB and store the value in a global variable during the library constructor in the BS phase so the value is available du= ring later phase transition. What exactly are you proposing to change? > > > > 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 about this. >=20 > I prefer to use enum and GetType() API. Because if there is more boot med= ia > type, there is no need to add a new library API like IsXXX(). > Not sure if it's over design, I prefer to use GUID against enum. No stron= g > preference of using GUID in this case. >=20 My preference is that the API is well-defined and stable. In this case, my = primary thought on the matter is not having two ways to do the same thing. And aga= in, I have no strong preference for either case but we do have Intel code that = favors the IsXXX () usage. I don't think adding new devices (extending the API) is= so much an issue as ensuring the existing ones are not modified. Which would be the ca= se for the enum members and the functions. In conclusion, I will send a patch to r= emove the IsXXX () functions. Before adding GUIDs, the problem statement needs to be clearly articulated that justifies introducing GUID management. > Thanks, > Ray >=20 > > > > 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 > > > > > > Michael, > > > Two comments: > > > 1. The difference between PEI and DXE instances is DXE instance has > > > a global 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 which 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. > > > > > > Thanks, > > > Ray > > > > > > > -----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/PeiFirmw > > > ar > > > eB > > > > 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/Firmware > > > Bo > > > o > > > > tMediaLib.c | 109 ++++++++++++++++++++ > > > > > > > > > > > Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiFirmw > > > ar > > > eB > > > > 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, 0x42= 4d, { > > > 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/MicrocodeFlashAccessLibNul > > > > l/ > > > > 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-D796B= E2B87E9 > > > > + MODULE_TYPE =3D DXE_DRIVER > > > > + VERSION_STRING =3D 1.0 > > > > + PI_SPECIFICATION_VERSION =3D 0x0001000A > > > > + LIBRARY_CLASS =3D FirmwareBootMediaLib|DXE_DRIV= ER > > > > DXE_SMM_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION > > > UEFI_DRIVER > > > > + CONSTRUCTOR =3D DxeSmmFirmwareBootMediaLibIni= t > > > > +# > > > > +# 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/PeiF > > > > ir > > > > mw > > > > ar > > > > eBootMediaLib.inf > > > > b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiF > > > > ir > > > > mw > > > > ar > > > > eBootMediaLib.inf > > > > new file mode 100644 > > > > index 0000000000..063c4027d3 > > > > --- /dev/null > > > > +++ > > > > b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiF > > > > ir > > > > mw > > > > 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/FirmwareBootMediaL > > > > ib > > > > .h > > > > b/Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMediaL > > > > ib > > > > .h > > > > new file mode 100644 > > > > index 0000000000..aca9593a84 > > > > --- /dev/null > > > > +++ b/Silicon/Intel/IntelSiliconPkg/Include/Library/FirmwareBootMe > > > > +++ di > > > > +++ aL > > > > +++ 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 = device > > 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 > device > > 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 > > device > > > > 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 > > device > > > 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 ta= ble. > > > > + > > > > + @retval EFI_SUCCESS The constructor executed succe= ssfully. > > > > + @retval EFI_NOT_FOUND The gFirmwareBootMediaHobGuid > > HOB > > > > could not be located > > > > + or the boot media type is inva= lid. > > > > +**/ > > > > +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); i= f > > > > + (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/Firm > > > > wa > > > > re > > > > B > > > > ootMediaLib.c > > > > b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/Firm > > > > wa > > > > re > > > > B > > > > ootMediaLib.c > > > > new file mode 100644 > > > > index 0000000000..11a14d172d > > > > --- /dev/null > > > > +++ > > > > b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/Firm > > > > wa > > > > re > > > > 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 pha= ses. > > > > + > > > > +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 = device > > 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 > device > > 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 > > device > > > > 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 > > device > > > 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/PeiF > > > > ir > > > > mw > > > > ar > > > > eBootMediaLib.c > > > > b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiF > > > > ir > > > > mw > > > > ar > > > > eBootMediaLib.c > > > > new file mode 100644 > > > > index 0000000000..14478e0dbe > > > > --- /dev/null > > > > +++ > > > > b/Silicon/Intel/IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/PeiF > > > > ir > > > > mw > > > > 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); i= f > > > > + (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