From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web09.6787.1624017225937454555 for ; Fri, 18 Jun 2021 04:53:48 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=b2QFXGsE; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: chasel.chiu@intel.com) IronPort-SDR: codAuFWwn5W+5URg+F+asx04jMr2kkiU4nqlxBjQFBf2qiACdQNNUVNA4rNSyil77T6K4BRQjK TaPi+sfvwa6g== X-IronPort-AV: E=McAfee;i="6200,9189,10018"; a="186233600" X-IronPort-AV: E=Sophos;i="5.83,283,1616482800"; d="scan'208";a="186233600" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jun 2021 04:53:43 -0700 IronPort-SDR: 0s//KrFKAwQp+DWRFcLk05mlZL1OodZgvuvzfl/pHhtiMqBl26fa74k3rGRPp/MNVKQTT+n/E1 f+TYxWlpQn4Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,283,1616482800"; d="scan'208";a="555553449" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga001.fm.intel.com with ESMTP; 18 Jun 2021 04:53:42 -0700 Received: from orsmsx604.amr.corp.intel.com (10.22.229.17) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Fri, 18 Jun 2021 04:53:42 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4 via Frontend Transport; Fri, 18 Jun 2021 04:53:42 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.108) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.4; Fri, 18 Jun 2021 04:53:41 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BSV5udx7I9PMnZUqiEQnahQkyxX07j6gGEZRIE4Pn5uHhwOVKpBKalW69hCKHpGqZWWScsvkuqrLKjXa1IwfsdBGDEAV18/F/ew9DGsFnI4q1Hp+qtD8LtCdfOOPJto0Rsb2quEYXCpfnptFPkKp+BGxmcwEC3+R/PL4Fb3ifRqLu8jqkqRHL8nWMjgInLy70a+jP6PGGnaC0W+xgykIHejN91R+Blx/KkUHqNOfibUqOyroNOrGV4C6m43wuCK5jhnrJvNnZoa2tANmofLqqGBmE2TYdJl/ygrMw7tMv3N4MmgLamjKY5jegu6P6pZ3t4q728emeLBLQo0XhQynkw== 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=/1U+kejbYURLFtEvW6x5dCNFQBSABteywRMuCszjaKw=; b=heKTeLab9x+zAzEMtXtpf2rO0Ucgvlz7LJL3Ql5H7zHshMQ1KssbRXz3FXRDM08DUsArwEnTEHLKFo304WJUT11837fDxl0yomseUGhXTjWO8lSBktbe/MimNyFG2n+FUcdaYklrbaueXoazgq6BMHob1DZ2ZdVvk2VjP+XCtLElJ3mHDucUtGgOdMQFKETli37aNfS9VdvS/7jzIfRfJ0fBxKhwOKoQIgVJypMrIspEfUcq1F0ZnG3rZuPDvEJKTnGM6QIUhQC5HpjlXSgqsdiLM9/xlghqPMiy4xUiugoGg3XyWR/gypukTdUc6W9Qi7fC7SgD57O8XYRtbTR/Cw== 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=/1U+kejbYURLFtEvW6x5dCNFQBSABteywRMuCszjaKw=; b=b2QFXGsECRPdJXmHG3JlIsFzdHAaSxq0Xt52jcNvMzmNuoGvoGgOasW0aS+Gv3Srr5xM53qyzzkO2o5nfTCkca76oORrhUvFlOkH0nisnxNJiNpk3g4xMj6rMcVGiCs8f+V8+j+EknSMPzdoaWkSe0tYxLYxxI2iRcZlcP2c3WI= Received: from BN9PR11MB5483.namprd11.prod.outlook.com (2603:10b6:408:104::10) by BN9PR11MB5369.namprd11.prod.outlook.com (2603:10b6:408:11a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.19; Fri, 18 Jun 2021 11:53:40 +0000 Received: from BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::2162:be61:a479:4168]) by BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::2162:be61:a479:4168%9]) with mapi id 15.20.4242.021; Fri, 18 Jun 2021 11:53:40 +0000 From: "Chiu, Chasel" To: "mikuback@linux.microsoft.com" , "devel@edk2.groups.io" CC: "Chaganty, Rangasai V" , "Desimone, Nathaniel L" Subject: Re: [edk2-platforms][PATCH v3 38/41] CoffeelakeSiliconPkg/BasePchSpiCommonLib: Identify flash regions by GUID Thread-Topic: [edk2-platforms][PATCH v3 38/41] CoffeelakeSiliconPkg/BasePchSpiCommonLib: Identify flash regions by GUID Thread-Index: AQHXY+cLIWDYepuszEWKCpF28Pu/kKsZqT5g Date: Fri, 18 Jun 2021 11:53:40 +0000 Message-ID: References: <20210618020726.5991-1-mikuback@linux.microsoft.com> <20210618020726.5991-39-mikuback@linux.microsoft.com> In-Reply-To: <20210618020726.5991-39-mikuback@linux.microsoft.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: linux.microsoft.com; dkim=none (message not signed) header.d=none;linux.microsoft.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [114.43.31.18] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7c2ff56d-95ac-49bb-0259-08d9324fb717 x-ms-traffictypediagnostic: BN9PR11MB5369: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1417; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: lU5lgE1UV46lT4NbYUoANCrvGkrariqOZaYy7y4JkcYbZcWsx9Xl+RU4Tyaz3Tc9JisD+xKlEa4aMGsBEJNJ/oW8WMgPckrKXOZ8Xt6CvrZM4wOvqx+Zm1s0xYbsW7JHa4+caoBrEBEtWkfkx4UbwwEd0JuhR/NcayGBg6DLSkQ90OHyJ0+qj1L114gRnigTQgGHpDIfs24UtfYQT+ibcaJmz7tbKdGCCwF4KNbwsuOyG1OJdqJ75eil5whAKw6fXBcFNKU2XWJYRLRtdExGW+ZEY1noRj0zuweQPZ0USocG7Zmt7PKXSdFAyVnfYOQI3UEZJ2kj0ODpxXKfKqvGI3n62ntoYnqxaU/v9cfy/vPgoYNql0q5AShFYS5ADiYmWjmeLmbR1Ta5lDFDoS3dVGd0uhsO/irXxLWdZyvqJSBxZf1tjXHIXQmU+7CkD0tEZBX7cER9pH60spSLL2aLO34O1Cry7T2u9DVZE9dhkVFCN5YIvWSH4q6iUAtxlGoJ7lFoWchyK14lczqBkS86GKbSbBY9SnSVIbx6e42BwIhnrFE6sWLpjvsfDiS79JQ+kdtVVcCimQOtkOmmFbh1CQxKdb0oTtBhMlTBGiIkTxKY26/9Mse5mm9OLX+Lh5KeepxWs8MjGwp18LGz8LZJ8WEeI1ILevnfL3So3/YhFtwv2H1SMzAiigdXdtO2kqnHhNBRQ9SigC3qrPEdpq9Y6847asB+31OEdbQH1j5oH55E/i7KqAQrDX/u1D1PWCooLTSzV9obVhfgC104L77yPC7RMfRjXuXlmg6j3AEit5Y= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR11MB5483.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39850400004)(136003)(376002)(366004)(346002)(8936002)(8676002)(33656002)(316002)(122000001)(71200400001)(45080400002)(52536014)(5660300002)(478600001)(107886003)(4326008)(83380400001)(66446008)(86362001)(55016002)(66946007)(66476007)(38100700002)(30864003)(9686003)(66556008)(64756008)(76116006)(54906003)(186003)(6506007)(26005)(53546011)(7696005)(2906002)(110136005)(11716005)(213903007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?cyaweWlvvN+mC/jgK8uQDsIaBZEm7S1FazbL9evwDNQ6pM62Bcbj6RUk1KVb?= =?us-ascii?Q?t3nOdcwNGHCxJSd+5zOMya9+TJ1w/4/B+DDj+CZifql2Nu7/qOLkUaoVp7Nz?= =?us-ascii?Q?RJ4k0S+J3nL7OHXsHTzxoyaS0n+tuiEZiPU/Qu/0OWOwCw2pIc63yaLWWg7p?= =?us-ascii?Q?fm0DHfWQxFjE1KQA1gxuOX0tvqZtz2Ypvu0JnC6zqTd8FS1DAbDPRBXMz2F7?= =?us-ascii?Q?fweNXRPONjJYY5/nX+cT0Ek9Xhs08qqLZ2fswcjuklz+xJ1JHzQLbpqs8yw6?= =?us-ascii?Q?LA5WdeiB7auRfwxEA+F9RjficitguhzBfFPdqUA7aZ3MPZyGWroPsa3SHtZS?= =?us-ascii?Q?+uw+tb7aOC3hmAupSemqx+DUlbW3FiazhTVglyq2l0yCuj0dCIFWSJCJHK6R?= =?us-ascii?Q?JoUoKHnG0cuKtMmiuiTK1z44kkBMR4a8NX5KZkaIdggqNe1lFKed69tClquS?= =?us-ascii?Q?prC1sUd8VqiVJSU2hmzR1jUDCYcXTKazem9AIFTEF6QoaZhao2K2wXfWpQ7N?= =?us-ascii?Q?45phZMaqPcxWzc4awGoZxhUFPOWwDwlc+ar/0l+//YgrYNlfuwTlojtnxSj1?= =?us-ascii?Q?PthZkQ5KnTblOgLZ6On3kr45opQubt7V9fO5n0VTZhnifjtdPE2bIuU6ysjS?= =?us-ascii?Q?0aAxWn0EqidRhHwAv/Ft5Z1G83JAJnntZ4BZzzmGcs/ie4yOmSQaglwJTfDm?= =?us-ascii?Q?MFDRsm2oRlpltZ13rLSzPhEu5nvIqhZ1FMaJe9OOh4elXms0GW1uIPjWP5/a?= =?us-ascii?Q?9pQ8WsFR2V9WZszpHx0VXtyYqpApSxaqPzZEa6ZfMkps7IgV5LQVWz964ay1?= =?us-ascii?Q?GBKvzNmF1Hc8sEDA6JiAZlnreHWdrblOCJq8XaK0ayRmfmn6WUAvX9rXgYXf?= =?us-ascii?Q?owCCB7q/NOt+1IinVKlJ0flIzxq9tKfce9Gf+0be4lVzOl2mNjAAF/HCKrw7?= =?us-ascii?Q?ZjeR6KqR2kubYuSQDEtvA8XUgS2wwO/5qqVI7cf7Cva1RWU1blj6+2Z8zPRO?= =?us-ascii?Q?IKWHG3CpPy9mnzyC6EJJ72+Dbb3HVZPc5KkEoQG0KcCop1Lj3H4dG/3qmHLU?= =?us-ascii?Q?QWDg2ExeuDj6zR+MSohDs0kEUPy9icnUQpitJUZs4ajQaPiJ4mhF0+ksrTCn?= =?us-ascii?Q?lkJcOvcNkw8ajtTVYfIeqjuyk8IQpX0LQnwuYrZhdMcRGT6Rj/mYHWEKe8w8?= =?us-ascii?Q?v2j0YwguYKa6HAwwiJps0DBXpr7ROI2J81BK2+Asv0+3MZrzCgDPCgix98BJ?= =?us-ascii?Q?kRoYL8iaRxKTBNtbctwt/sDH9kJ0wveF2tBkhDAshD6KJkYuaQ4MStlY+Otj?= =?us-ascii?Q?kno80KAvaW6qore5jSi36UNk?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5483.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c2ff56d-95ac-49bb-0259-08d9324fb717 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Jun 2021 11:53:40.4592 (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: QOQRGM8dhq9Wdjbeh6VzkntL7n51ZTPgnUDf+pCM12L+6kktGGQe5qsNfZQI+D1gKSP4Y7ho2kXE3mZ+Kc0EzA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR11MB5369 Return-Path: chasel.chiu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Chasel Chiu > -----Original Message----- > From: mikuback@linux.microsoft.com > Sent: Friday, June 18, 2021 10:07 AM > To: devel@edk2.groups.io > Cc: Chiu, Chasel ; Chaganty, Rangasai V > ; Desimone, Nathaniel L > > Subject: [edk2-platforms][PATCH v3 38/41] > CoffeelakeSiliconPkg/BasePchSpiCommonLib: Identify flash regions by GUID >=20 > From: Michael Kubacki >=20 > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3307 >=20 > Updates the library to identify flash regions by GUID and internally map = the > GUID entries to values specific to CoffeelakeSiliconPkg. >=20 > Cc: Chasel Chiu > Cc: Rangasai V Chaganty > Cc: Nate DeSimone > Signed-off-by: Michael Kubacki > --- >=20 > Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/Private/BasePchSpiCommonLi= b/S > piCommon.c | 144 ++++++++++++++++---- >=20 > Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/Private/Library/PchSpiComm= onLi > b.h | 16 +-- >=20 > Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/Private/BasePchSpiCommonLi= b/ > BasePchSpiCommonLib.inf | 12 ++ > 3 files changed, 141 insertions(+), 31 deletions(-) >=20 > diff --git > a/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/Private/BasePchSpiCommon= Lib > /SpiCommon.c > b/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/Private/BasePchSpiCommon= Lib > /SpiCommon.c > index bc84a4f27f1a..26a3d0e7db31 100644 > --- > a/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/Private/BasePchSpiCommon= Lib > /SpiCommon.c > +++ b/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/Private/BasePchSpiC > +++ ommonLib/SpiCommon.c > @@ -2,11 +2,13 @@ > PCH SPI Common Driver implements the SPI Host Controller Compatibility > Interface. >=20 > Copyright (c) 2019 Intel Corporation. All rights reserved.
> + Copyright (c) Microsoft Corporation.
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent **/ >=20 > #include > +#include > #include > #include > #include > @@ -20,6 +22,95 @@ > #include > #include >=20 > +typedef enum { > + FlashRegionDescriptor, > + FlashRegionBios, > + FlashRegionMe, > + FlashRegionGbe, > + FlashRegionPlatformData, > + FlashRegionDer, > + FlashRegionEc =3D 8, > + FlashRegionAll, > + FlashRegionMax > +} FLASH_REGION_TYPE; > + > +typedef struct { > + EFI_GUID *Guid; > + FLASH_REGION_TYPE Type; > +} FLASH_REGION_MAPPING; > + > +FLASH_REGION_MAPPING mFlashRegionTypes[] =3D { > + { > + &gFlashRegionDescriptorGuid, > + FlashRegionDescriptor > + }, > + { > + &gFlashRegionBiosGuid, > + FlashRegionBios > + }, > + { > + &gFlashRegionMeGuid, > + FlashRegionMe > + }, > + { > + &gFlashRegionGbeGuid, > + FlashRegionGbe > + }, > + { > + &gFlashRegionPlatformDataGuid, > + FlashRegionPlatformData > + }, > + { > + &gFlashRegionDerGuid, > + FlashRegionDer > + }, > + { > + &gFlashRegionEcGuid, > + FlashRegionEc > + }, > + { > + &gFlashRegionAllGuid, > + FlashRegionAll > + }, > + { > + &gFlashRegionMaxGuid, > + FlashRegionMax > + } > +}; > + > +/** > + Returns the type of a flash region given its GUID. > + > + @param[in] FlashRegionGuid Pointer to the flash region GUID. > + @param[out] FlashRegionType Pointer to a buffer that will be set t= o the > flash region type value. > + > + @retval EFI_SUCCESS The flash region type was found = for the given > flash region GUID. > + @retval EFI_INVALID_PARAMETER A pointer argument passed to the > function is NULL. > + @retval EFI_NOT_FOUND The flash region type was not fo= und for > the given flash region GUID. > + > +**/ > +EFI_STATUS > +GetFlashRegionType ( > + IN EFI_GUID *FlashRegionGuid, > + OUT FLASH_REGION_TYPE *FlashRegionType > + ) > +{ > + UINTN Index; > + > + if (FlashRegionGuid =3D=3D NULL || FlashRegionType =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + for (Index =3D 0; Index < ARRAY_SIZE (mFlashRegionTypes); Index++) { > + if (CompareGuid (mFlashRegionTypes[Index].Guid, FlashRegionGuid)) { > + *FlashRegionType =3D mFlashRegionTypes[Index].Type; > + return EFI_SUCCESS; > + } > + } > + > + return EFI_NOT_FOUND; > +} > + > /** > Initialize an SPI protocol instance. >=20 > @@ -303,7 +394,7 @@ WaitForSpiCycleComplete ( > This function sends the programmed SPI command to the slave device. >=20 > @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. > - @param[in] SpiRegionType The SPI Region type for flash cycle wh= ich is > listed in the Descriptor > + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle = which > corresponds to the type in the descriptor. > @param[in] FlashCycleType The Flash SPI cycle type list in HSFC = (Hardware > Sequencing Flash Control Register) register > @param[in] Address The Flash Linear Address must fall wit= hin a region > for which BIOS has access permissions. > @param[in] ByteCount Number of bytes in the data portion of= the SPI > cycle. > @@ -318,7 +409,7 @@ STATIC > EFI_STATUS > SendSpiCmd ( > IN PCH_SPI_PROTOCOL *This, > - IN FLASH_REGION_TYPE FlashRegionType, > + IN EFI_GUID *FlashRegionGuid, > IN FLASH_CYCLE_TYPE FlashCycleType, > IN UINT32 Address, > IN UINT32 ByteCount, > @@ -404,7 +495,7 @@ SendSpiCmd ( > } > } >=20 > - Status =3D SpiProtocolGetRegionAddress (This, FlashRegionType, > &HardwareSpiAddr, &FlashRegionSize); > + Status =3D SpiProtocolGetRegionAddress (This, FlashRegionGuid, > + &HardwareSpiAddr, &FlashRegionSize); > if (EFI_ERROR (Status)) { > goto SendSpiCmdEnd; > } > @@ -616,7 +707,7 @@ SendSpiCmd ( > Read data from the flash part. >=20 > @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. > - @param[in] FlashRegionType The Flash Region type for flash cycle = which is > listed in the Descriptor. > + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle = which > corresponds to the type in the descriptor. > @param[in] Address The Flash Linear Address must fall wit= hin a region > for which BIOS has access permissions. > @param[in] ByteCount Number of bytes in the data portion of= the SPI > cycle. > @param[out] Buffer The Pointer to caller-allocated buffer= containing > the dada received. > @@ -630,7 +721,7 @@ EFI_STATUS > EFIAPI > SpiProtocolFlashRead ( > IN PCH_SPI_PROTOCOL *This, > - IN FLASH_REGION_TYPE FlashRegionType, > + IN EFI_GUID *FlashRegionGuid, > IN UINT32 Address, > IN UINT32 ByteCount, > OUT UINT8 *Buffer > @@ -643,7 +734,7 @@ SpiProtocolFlashRead ( > // > Status =3D SendSpiCmd ( > This, > - FlashRegionType, > + FlashRegionGuid, > FlashCycleRead, > Address, > ByteCount, > @@ -656,7 +747,7 @@ SpiProtocolFlashRead ( > Write data to the flash part. >=20 > @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. > - @param[in] FlashRegionType The Flash Region type for flash cycle = which is > listed in the Descriptor. > + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle = which > corresponds to the type in the descriptor. > @param[in] Address The Flash Linear Address must fall wit= hin a region > for which BIOS has access permissions. > @param[in] ByteCount Number of bytes in the data portion of= the SPI > cycle. > @param[in] Buffer Pointer to caller-allocated buffer con= taining the > data sent during the SPI cycle. > @@ -669,7 +760,7 @@ EFI_STATUS > EFIAPI > SpiProtocolFlashWrite ( > IN PCH_SPI_PROTOCOL *This, > - IN FLASH_REGION_TYPE FlashRegionType, > + IN EFI_GUID *FlashRegionGuid, > IN UINT32 Address, > IN UINT32 ByteCount, > IN UINT8 *Buffer > @@ -682,7 +773,7 @@ SpiProtocolFlashWrite ( > // > Status =3D SendSpiCmd ( > This, > - FlashRegionType, > + FlashRegionGuid, > FlashCycleWrite, > Address, > ByteCount, > @@ -695,7 +786,7 @@ SpiProtocolFlashWrite ( > Erase some area on the flash part. >=20 > @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. > - @param[in] FlashRegionType The Flash Region type for flash cycle = which is > listed in the Descriptor. > + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle = which > corresponds to the type in the descriptor. > @param[in] Address The Flash Linear Address must fall wit= hin a region > for which BIOS has access permissions. > @param[in] ByteCount Number of bytes in the data portion of= the SPI > cycle. >=20 > @@ -707,7 +798,7 @@ EFI_STATUS > EFIAPI > SpiProtocolFlashErase ( > IN PCH_SPI_PROTOCOL *This, > - IN FLASH_REGION_TYPE FlashRegionType, > + IN EFI_GUID *FlashRegionGuid, > IN UINT32 Address, > IN UINT32 ByteCount > ) > @@ -719,7 +810,7 @@ SpiProtocolFlashErase ( > // > Status =3D SendSpiCmd ( > This, > - FlashRegionType, > + FlashRegionGuid, > FlashCycleErase, > Address, > ByteCount, > @@ -774,7 +865,7 @@ SpiProtocolFlashReadSfdp ( > // > Status =3D SendSpiCmd ( > This, > - FlashRegionAll, > + &gFlashRegionAllGuid, > FlashCycleReadSfdp, > FlashAddress, > ByteCount, > @@ -827,7 +918,7 @@ SpiProtocolFlashReadJedecId ( > // > Status =3D SendSpiCmd ( > This, > - FlashRegionAll, > + &gFlashRegionAllGuid, > FlashCycleReadJedecId, > Address, > ByteCount, > @@ -862,7 +953,7 @@ SpiProtocolFlashWriteStatus ( > // > Status =3D SendSpiCmd ( > This, > - FlashRegionAll, > + &gFlashRegionAllGuid, > FlashCycleWriteStatus, > 0, > ByteCount, > @@ -897,7 +988,7 @@ SpiProtocolFlashReadStatus ( > // > Status =3D SendSpiCmd ( > This, > - FlashRegionAll, > + &gFlashRegionAllGuid, > FlashCycleReadStatus, > 0, > ByteCount, > @@ -910,7 +1001,7 @@ SpiProtocolFlashReadStatus ( > Get the SPI region base and size, based on the enum type >=20 > @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. > - @param[in] FlashRegionType The Flash Region type for for the base > address which is listed in the Descriptor. > + @param[in] FlashRegionGuid The Flash Region GUID for the base add= ress > which corresponds to the type in the descriptor. > @param[out] BaseAddress The Flash Linear Address for the Regio= n 'n' > Base > @param[out] RegionSize The size for the Region 'n' >=20 > @@ -922,17 +1013,24 @@ EFI_STATUS > EFIAPI > SpiProtocolGetRegionAddress ( > IN PCH_SPI_PROTOCOL *This, > - IN FLASH_REGION_TYPE FlashRegionType, > + IN EFI_GUID *FlashRegionGuid, > OUT UINT32 *BaseAddress, > OUT UINT32 *RegionSize > ) > { > - SPI_INSTANCE *SpiInstance; > - UINTN PchSpiBar0; > - UINT32 ReadValue; > + EFI_STATUS Status; > + FLASH_REGION_TYPE FlashRegionType; > + SPI_INSTANCE *SpiInstance; > + UINTN PchSpiBar0; > + UINT32 ReadValue; >=20 > SpiInstance =3D SPI_INSTANCE_FROM_SPIPROTOCOL (This); >=20 > + Status =3D GetFlashRegionType (FlashRegionGuid, &FlashRegionType); if > + (EFI_ERROR (Status)) { > + return EFI_INVALID_PARAMETER; > + } > + > if (FlashRegionType >=3D FlashRegionMax) { > return EFI_INVALID_PARAMETER; > } > @@ -1013,7 +1111,7 @@ SpiProtocolReadPchSoftStrap ( > // > Status =3D SendSpiCmd ( > This, > - FlashRegionDescriptor, > + &gFlashRegionDescriptorGuid, > FlashCycleRead, > StrapFlashAddr, > ByteCount, > @@ -1071,7 +1169,7 @@ SpiProtocolReadCpuSoftStrap ( > // > Status =3D SendSpiCmd ( > This, > - FlashRegionDescriptor, > + &gFlashRegionDescriptorGuid, > FlashCycleRead, > StrapFlashAddr, > ByteCount, > diff --git > a/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/Private/Library/PchSpiCo= mmo > nLib.h > b/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/Private/Library/PchSpiCo= mmo > nLib.h > index 0a973a77a381..e69e2f1e456c 100644 > --- > a/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/Private/Library/PchSpiCo= mmo > nLib.h > +++ b/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Include/Private/Library/Pch > +++ SpiCommonLib.h > @@ -148,7 +148,7 @@ IsSpiFlashWriteGranted ( > Read data from the flash part. >=20 > @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. > - @param[in] FlashRegionType The Flash Region type for flash cycle = which is > listed in the Descriptor. > + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle = which > corresponds to the type in the descriptor. > @param[in] Address The Flash Linear Address must fall wit= hin a region > for which BIOS has access permissions. > @param[in] ByteCount Number of bytes in the data portion of= the SPI > cycle. > @param[out] Buffer The Pointer to caller-allocated buffer= containing > the dada received. > @@ -162,7 +162,7 @@ EFI_STATUS > EFIAPI > SpiProtocolFlashRead ( > IN PCH_SPI_PROTOCOL *This, > - IN FLASH_REGION_TYPE FlashRegionType, > + IN EFI_GUID *FlashRegionGuid, > IN UINT32 Address, > IN UINT32 ByteCount, > OUT UINT8 *Buffer > @@ -172,7 +172,7 @@ SpiProtocolFlashRead ( > Write data to the flash part. >=20 > @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. > - @param[in] FlashRegionType The Flash Region type for flash cycle = which is > listed in the Descriptor. > + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle = which > corresponds to the type in the descriptor. > @param[in] Address The Flash Linear Address must fall wit= hin a region > for which BIOS has access permissions. > @param[in] ByteCount Number of bytes in the data portion of= the SPI > cycle. > @param[in] Buffer Pointer to caller-allocated buffer con= taining the > data sent during the SPI cycle. > @@ -185,7 +185,7 @@ EFI_STATUS > EFIAPI > SpiProtocolFlashWrite ( > IN PCH_SPI_PROTOCOL *This, > - IN FLASH_REGION_TYPE FlashRegionType, > + IN EFI_GUID *FlashRegionGuid, > IN UINT32 Address, > IN UINT32 ByteCount, > IN UINT8 *Buffer > @@ -195,7 +195,7 @@ SpiProtocolFlashWrite ( > Erase some area on the flash part. >=20 > @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. > - @param[in] FlashRegionType The Flash Region type for flash cycle = which is > listed in the Descriptor. > + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle = which > corresponds to the type in the descriptor. > @param[in] Address The Flash Linear Address must fall wit= hin a region > for which BIOS has access permissions. > @param[in] ByteCount Number of bytes in the data portion of= the SPI > cycle. >=20 > @@ -207,7 +207,7 @@ EFI_STATUS > EFIAPI > SpiProtocolFlashErase ( > IN PCH_SPI_PROTOCOL *This, > - IN FLASH_REGION_TYPE FlashRegionType, > + IN EFI_GUID *FlashRegionGuid, > IN UINT32 Address, > IN UINT32 ByteCount > ); > @@ -300,7 +300,7 @@ SpiProtocolFlashReadStatus ( > Get the SPI region base and size, based on the enum type >=20 > @param[in] This Pointer to the PCH_SPI_PROTOCOL instan= ce. > - @param[in] FlashRegionType The Flash Region type for for the base > address which is listed in the Descriptor. > + @param[in] FlashRegionGuid The Flash Region GUID for the base add= ress > which corresponds to the type in the descriptor. > @param[out] BaseAddress The Flash Linear Address for the Regio= n 'n' > Base > @param[out] RegionSize The size for the Region 'n' >=20 > @@ -312,7 +312,7 @@ EFI_STATUS > EFIAPI > SpiProtocolGetRegionAddress ( > IN PCH_SPI_PROTOCOL *This, > - IN FLASH_REGION_TYPE FlashRegionType, > + IN EFI_GUID *FlashRegionGuid, > OUT UINT32 *BaseAddress, > OUT UINT32 *RegionSize > ); > diff --git > a/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/Private/BasePchSpiCommon= Lib > /BasePchSpiCommonLib.inf > b/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/Private/BasePchSpiCommon= Lib > /BasePchSpiCommonLib.inf > index f5dc4ee0bfef..b152d2278839 100644 > --- > a/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/Private/BasePchSpiCommon= Lib > /BasePchSpiCommonLib.inf > +++ b/Silicon/Intel/CoffeelakeSiliconPkg/Pch/Library/Private/BasePchSpiC > +++ ommonLib/BasePchSpiCommonLib.inf > @@ -2,6 +2,7 @@ > # Component description file for the PchSpiCommonLib # # Copyright (c= ) 2019 > Intel Corporation. All rights reserved.
> +# Copyright (c) Microsoft Corporation.
> # > # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -27,3 +28,14 @@ > [LibraryClasses] > IoLib > DebugLib > PmcLib > + > +[Guids] > + gFlashRegionDescriptorGuid > + gFlashRegionBiosGuid > + gFlashRegionMeGuid > + gFlashRegionGbeGuid > + gFlashRegionPlatformDataGuid > + gFlashRegionDerGuid > + gFlashRegionEcGuid > + gFlashRegionAllGuid > + gFlashRegionMaxGuid > -- > 2.28.0.windows.1