From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web08.3282.1627519683511618860 for ; Wed, 28 Jul 2021 17:48:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=qGIk7w6Z; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: nathaniel.l.desimone@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10059"; a="298361845" X-IronPort-AV: E=Sophos;i="5.84,276,1620716400"; d="scan'208";a="298361845" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2021 17:48:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,276,1620716400"; d="scan'208";a="435315654" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by orsmga002.jf.intel.com with ESMTP; 28 Jul 2021 17:48:01 -0700 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Wed, 28 Jul 2021 17:48:00 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Wed, 28 Jul 2021 17:48:00 -0700 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.175) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Wed, 28 Jul 2021 17:47:56 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gZk+5Kjyv7vggcwTZC7yX1LIKw21osInWTebML3oav6ntE0FyztIdSzegtizXZRZzH982D4xauoDwBWNxT3tz+I6HPSEJt77erhaFlo1QOpUk0GKFY4nahNN6CcSip5q6F95cUg/v9PiPzAqpbwADbviKYnqtkmvnyhRqA6Z141oXbOkhs5WcACbqc2no9oH+XQalWZHq5nTszSFMZaItaxYaNRek1fwp9lU1+hTMlATAjV95QaO5insgMlIHgFj9MWoWcfujkCx7EdRZSXrCuFtXCvcm8mt1DJ4ljHxo5LZyDRtBCX67U1vyR2AN8y2N0+yfjd861KiL7gqH4bfnA== 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=acnrqy0PtteGDW8ue8PN/qRzniHlJzmHygb+ZRkgvlA=; b=H3cU8/WJrHkiPvJO7Tbv55iqQE70Z/Cx42OzP8sePPKQdeEzRPJApM75P7pMNIbfrkrzgingk0Q4Zf9vfeKbRpIneGKetN2+lJ2cHdaG+qsZbKtwLeoyi8d8lhJNMWhjvCUhX7WMbLNtKjdw2HQ6BMAUwBf6Z7HcmTBMm1TgWdI8BewAvWvUoFUWgSAUuXZBUGSpjMQb5P4EqkLvkqJkYKBjwkLqSLPIG4uWb73NIi7bo6UAzMWe7NMI4nnyt6/4bH87PmXH/rKzAhfvVpRlTrjng8flE8Cn7BBAlwi/MAaciC9cG6LnQLUYfFEUaODi73aHnTCsYtIqGscBvNWI9Q== 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=acnrqy0PtteGDW8ue8PN/qRzniHlJzmHygb+ZRkgvlA=; b=qGIk7w6ZknO5nVN5XfduIcxSdXOAxAzMsapbi18tg9DcqYv4+1ay7KzsFP3K051yWD1xrF8NcqQUFy33NfSVCt+t4B/e+KW12u8GjJZMBHHOhql2/nUNH54Dpsc4zG63sqKEygkhbxvKm39jDfFNEAxp+WRx8M5KYyKTIXqnRyc= Received: from MWHPR1101MB2160.namprd11.prod.outlook.com (2603:10b6:301:5b::12) by MWHPR11MB1917.namprd11.prod.outlook.com (2603:10b6:300:112::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.18; Thu, 29 Jul 2021 00:47:50 +0000 Received: from MWHPR1101MB2160.namprd11.prod.outlook.com ([fe80::64ce:a6b0:9ae8:e644]) by MWHPR1101MB2160.namprd11.prod.outlook.com ([fe80::64ce:a6b0:9ae8:e644%12]) with mapi id 15.20.4352.032; Thu, 29 Jul 2021 00:47:50 +0000 From: "Nate DeSimone" To: "mikuback@linux.microsoft.com" , "devel@edk2.groups.io" CC: "Agyeman, Prince" Subject: Re: [edk2-platforms][PATCH v4 40/41] SimicsIch10Pkg/BasePchSpiCommonLib: Identify flash regions by GUID Thread-Topic: [edk2-platforms][PATCH v4 40/41] SimicsIch10Pkg/BasePchSpiCommonLib: Identify flash regions by GUID Thread-Index: AQHXaghVtSagttXRdUuRyy//doJEMatZUo/g Date: Thu, 29 Jul 2021 00:47:50 +0000 Message-ID: References: <20210625212120.235-1-mikuback@linux.microsoft.com> <20210625212120.235-41-mikuback@linux.microsoft.com> In-Reply-To: <20210625212120.235-41-mikuback@linux.microsoft.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.5.1.3 dlp-product: dlpe-windows 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-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e91ed6fb-2f92-4e3a-3a87-08d9522a7dd9 x-ms-traffictypediagnostic: MWHPR11MB1917: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4125; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Mmtt/qavtgdMcafN7OJVvdR+r1OmMyGRya62KmXZgqI66E3X1mbY7lItPIwv0aVydTxbCQNdrfh5wzjQ/MELXrwIoa9pmL6RzK8B0tTKMInMuMzD7F8irMyjyl/hWV7JaHpCMQwrxsMAyAhYCg68r5vBzRfeQl99HuCe8VQhM9NBpdhFR8GhdLTjB8j378c011bk+b0dGyORa5KZs2kBRTQwd6sTr5YAxoLCtn/8LnWww1QsXpklK6AeHZrl6hPG+usEBOI5aVUUlIc4BSILtHLWns80kFaOugGCQxpBj7d8x2yVgx28ud97sM9jkoCw/mA9IE/IhrWCaHp6Wo5Otruejx5hyGf7SbmsMxmdEiVVbmsE2RBIbkt1zGdUrPrdXVWJUX5GztyF4AUmh+8FeUHPEP5uzCZJdP/x6ZgyxJkUwNOpWebyqzSUQJNbmnIuSoFRpoCvVBLPGCjhtFY0JLL9ad2Mh5HWh7dNG6XqAjPsksmbNaxixGJKkzJqLEzZVHBl2tBALgcYN35Yp3HkxlBN2TaaGIJOYU46NQMkbTz0aHamya4QeAgemUc3mxEF1cdu7+iIomSjm4df7aEQAL3gQzK1YS1L7Pq5X5KDpuTsx8MMJ5eE89r0hP3jllThdk0dlSKzl5g0iWmCF/Jf+Uplb9yw3DbimlUHOxeURwsy3WkhSHRo6s019t8LmkOw9mxb+td+Q4gC5YdUATku+i+r4hKdvKx9PwztROqWGIoS1oxWFMJrlmXs4wCmQE2IDvObvkPmQjSk9YukYIiXDmb4NnTZu03ji2ZMbNKOOAPryeFxZd29zh6y7kcJLNVS x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1101MB2160.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(136003)(366004)(376002)(39860400002)(346002)(396003)(2906002)(55016002)(5660300002)(38100700002)(122000001)(8936002)(7696005)(66476007)(53546011)(66556008)(66446008)(64756008)(52536014)(30864003)(26005)(38070700005)(6506007)(8676002)(316002)(9686003)(186003)(76116006)(66946007)(83380400001)(107886003)(4326008)(478600001)(45080400002)(110136005)(71200400001)(86362001)(33656002)(213903007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?4mHohkKp4bR4jJo8SBDLjw+naXBZLAWMctalB/50hY4pGpiP1IVoAboye7wO?= =?us-ascii?Q?DyRNyM1lsusRUE9pspZ6K7U0imkKvLRZt6gd3T4o1WqQVly8jj9bWVVW0PVA?= =?us-ascii?Q?pg2fJfDIkdeJm6dyv6KQj4i50u8qwyDHab0tiVprGwXeaUeCx9eknEZMgt7u?= =?us-ascii?Q?6NEKSMODMSAHHzVXPuw+PJuwzGzk63xpbVNRi7unj8lh/JgjARTVjKHnd810?= =?us-ascii?Q?zUcTafpyFxk5OpWbRRiGAofooqr5jBda1WFEnMmaQn3ASDsJlB6s14cTs/K2?= =?us-ascii?Q?AsBnB4tWI61z1jAxczpaVixdX8h2PsiGQ97nl3eyf9x6MzMU8oPOYuP0/h49?= =?us-ascii?Q?KOydqk65MHNyK9r+xdMnqyOxULQ6sStpENmiIcZ7pfTKfP3+bwLuGEkgzA7h?= =?us-ascii?Q?2FT+YT+ulA02hJaeVM/Cv3tTYtINUbKCxJV84xvlk5baAQ+5bLkyV7cespC/?= =?us-ascii?Q?DFv+EzUjeAjJobVEeRCVoOAJmNR20HVYiAZ4UcJu9BhCHQFAebK+ogmjKBm6?= =?us-ascii?Q?4X2TixqhJjxBvtO83uwM0D/ixQPVtaPnXlVkT7CUdKjOGEsZ+FkLbxYXwL8F?= =?us-ascii?Q?psZh5m07rQHN5MBmnWvdJL+HkqVCShsTMk5HpR5OpNA5W9pMvArxi7ixZqMX?= =?us-ascii?Q?pLahE0aahhPsqs+V6dJhWpya7q1yTlrP2tKVd+o4CMb6593S1gQD2qsi+r9o?= =?us-ascii?Q?UZ9tTDPM1oKgG1Mix9N0JAcZztsqmeBF0yDpHkt86Rfs8PSPLvDlzzi3BQ7M?= =?us-ascii?Q?oueYcvg1NtPGKii/Fjs/2lic8MDezVoqRuresHegzSyl+AE8WrHEOz8Pg7ad?= =?us-ascii?Q?/cyE1yhjHDnJaT0xVIAXPLrfl8rOEBLMWP5ozdTLa449dXBJRhwZDg508El7?= =?us-ascii?Q?kEPvnoHAu6iY8OXABWQsb30+vmHjlh3Gylevu/J40odJqJRgX7V1tmmVz4P8?= =?us-ascii?Q?fDC8Qp+kGZzMdrGYe2WgEoAyOr0qwb32txHwH+PfLRoS++9+xTpOtRfY7xSM?= =?us-ascii?Q?95+SAW7ttfTtvAKZ3zbDXrrLw5YfSvRDSi0BzvLYHnr/f1fWTkZqHwohuNI8?= =?us-ascii?Q?ubKjwTxwgFYcufM5PbGtZjb8GQIjJZLlVXskx4vWeEc9dpztQQy9Zluknpx3?= =?us-ascii?Q?wvVOWvK6BD5iIw0TUFmkANECSSA0iwGYS9gbwJi9r/igLsjHUZlWARMQfxwZ?= =?us-ascii?Q?uiYCGe6zeTNm/dzAl5bVtu/w68bg7Hib6ZQe5K1c14efmBIUXQ6qvPILSuhE?= =?us-ascii?Q?D0g/CGuy45c58WGTfa4Srk6BeL/b42sLyjlmQUkpbMZsv42Q+AQrdwnfTTy0?= =?us-ascii?Q?DqZ4wc0KIDNPW5T29bH/v7aN?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR1101MB2160.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e91ed6fb-2f92-4e3a-3a87-08d9522a7dd9 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jul 2021 00:47:50.1858 (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: mHnWdLT3vJDIjRrEpr08UIIHdmj1txWTh8SPXyx9d55GDPMfYshta8DgBLjw7DvhEvWCT0j8M511wVkKKGqsZg2sTKa+IDkI5HjgKz7YXBU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1917 Return-Path: nathaniel.l.desimone@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Nate DeSimone > -----Original Message----- > From: mikuback@linux.microsoft.com > Sent: Friday, June 25, 2021 2:21 PM > To: devel@edk2.groups.io > Cc: Agyeman, Prince ; Desimone, Nathaniel L > > Subject: [edk2-platforms][PATCH v4 40/41] > SimicsIch10Pkg/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 SimicsIch10Pkg. >=20 > Cc: Agyeman Prince > Cc: Nate DeSimone > Signed-off-by: Michael Kubacki > --- >=20 > Silicon/Intel/SimicsIch10Pkg/LibraryPrivate/BasePchSpiCommonLib/SpiCom > mon.c | 139 ++++++++++++++++---- > Silicon/Intel/SimicsIch10Pkg/IncludePrivate/Library/PchSpiCommonLib.h > | 20 +-- >=20 > Silicon/Intel/SimicsIch10Pkg/LibraryPrivate/BasePchSpiCommonLib/BasePch > SpiCommonLib.inf | 11 ++ > 3 files changed, 137 insertions(+), 33 deletions(-) >=20 > diff --git > a/Silicon/Intel/SimicsIch10Pkg/LibraryPrivate/BasePchSpiCommonLib/SpiCo > mmon.c > b/Silicon/Intel/SimicsIch10Pkg/LibraryPrivate/BasePchSpiCommonLib/SpiCo > mmon.c > index fc2a8be76b6a..04dbd921c091 100644 > --- > a/Silicon/Intel/SimicsIch10Pkg/LibraryPrivate/BasePchSpiCommonLib/SpiCo > mmon.c > +++ b/Silicon/Intel/SimicsIch10Pkg/LibraryPrivate/BasePchSpiCommonLib/Sp > +++ iCommon.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 > @@ -16,6 +18,90 @@ > #include > #include >=20 > +typedef enum { > + FlashRegionDescriptor, > + FlashRegionBios, > + FlashRegionMe, > + FlashRegionGbe, > + FlashRegionPlatformData, > + FlashRegionDer, > + 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 > + }, > + { > + &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 > @@ -145,7 +231,7 @@ PchPmTimerStallRuntimeSafe ( > 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. > @@ -159,7 +245,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 +258,7 @@ SpiProtocolFlashRead ( > // > Status =3D SendSpiCmd ( > This, > - FlashRegionType, > + FlashRegionGuid, > FlashCycleRead, > Address, > ByteCount, > @@ -185,7 +271,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. > @@ -198,7 +284,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 > @@ -211,7 +297,7 @@ SpiProtocolFlashWrite ( > // > Status =3D SendSpiCmd ( > This, > - FlashRegionType, > + FlashRegionGuid, > FlashCycleWrite, > Address, > ByteCount, > @@ -224,7 +310,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 > @@ -236,7 +322,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 > ) > @@ -248,7 +334,7 @@ SpiProtocolFlashErase ( > // > Status =3D SendSpiCmd ( > This, > - FlashRegionType, > + FlashRegionGuid, > FlashCycleErase, > Address, > ByteCount, > @@ -303,7 +389,7 @@ SpiProtocolFlashReadSfdp ( > // > Status =3D SendSpiCmd ( > This, > - FlashRegionAll, > + &gFlashRegionAllGuid, > FlashCycleReadSfdp, > FlashAddress, > ByteCount, > @@ -356,7 +442,7 @@ SpiProtocolFlashReadJedecId ( > // > Status =3D SendSpiCmd ( > This, > - FlashRegionAll, > + &gFlashRegionAllGuid, > FlashCycleReadJedecId, > Address, > ByteCount, > @@ -391,7 +477,7 @@ SpiProtocolFlashWriteStatus ( > // > Status =3D SendSpiCmd ( > This, > - FlashRegionAll, > + &gFlashRegionAllGuid, > FlashCycleWriteStatus, > 0, > ByteCount, > @@ -426,7 +512,7 @@ SpiProtocolFlashReadStatus ( > // > Status =3D SendSpiCmd ( > This, > - FlashRegionAll, > + &gFlashRegionAllGuid, > FlashCycleReadStatus, > 0, > ByteCount, > @@ -439,7 +525,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 > address 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 > @@ -451,17 +537,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; > } > @@ -542,7 +635,7 @@ SpiProtocolReadPchSoftStrap ( > // > Status =3D SendSpiCmd ( > This, > - FlashRegionDescriptor, > + &gFlashRegionDescriptorGuid, > FlashCycleRead, > StrapFlashAddr, > ByteCount, > @@ -600,7 +693,7 @@ SpiProtocolReadCpuSoftStrap ( > // > Status =3D SendSpiCmd ( > This, > - FlashRegionDescriptor, > + &gFlashRegionDescriptorGuid, > FlashCycleRead, > StrapFlashAddr, > ByteCount, > @@ -613,7 +706,7 @@ SpiProtocolReadCpuSoftStrap ( > 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. > @@ -627,7 +720,7 @@ SpiProtocolReadCpuSoftStrap ( 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, > @@ -682,7 +775,7 @@ SendSpiCmd ( > goto SendSpiCmdEnd; > } >=20 > - Status =3D SpiProtocolGetRegionAddress (This, FlashRegionType, > &HardwareSpiAddr, &FlashRegionSize); > + Status =3D SpiProtocolGetRegionAddress (This, FlashRegionGuid, > + &HardwareSpiAddr, &FlashRegionSize); > if (EFI_ERROR (Status)) { > goto SendSpiCmdEnd; > } > diff --git > a/Silicon/Intel/SimicsIch10Pkg/IncludePrivate/Library/PchSpiCommonLib.h > b/Silicon/Intel/SimicsIch10Pkg/IncludePrivate/Library/PchSpiCommonLib.h > index 2c8162ac8170..603e141e2058 100644 > --- > a/Silicon/Intel/SimicsIch10Pkg/IncludePrivate/Library/PchSpiCommonLib.h > +++ b/Silicon/Intel/SimicsIch10Pkg/IncludePrivate/Library/PchSpiCommonLi > +++ b.h > @@ -135,7 +135,7 @@ ReleaseSpiBar0 ( > 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. > @@ -149,7 +149,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 > @@ -159,7 +159,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. > @@ -172,7 +172,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 > @@ -182,7 +182,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 > @@ -194,7 +194,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 > ); > @@ -287,7 +287,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 > address 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 > @@ -299,7 +299,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 > ); > @@ -354,7 +354,7 @@ SpiProtocolReadCpuSoftStrap ( > 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. > @@ -368,7 +368,7 @@ SpiProtocolReadCpuSoftStrap ( 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, > diff --git > a/Silicon/Intel/SimicsIch10Pkg/LibraryPrivate/BasePchSpiCommonLib/BasePc > hSpiCommonLib.inf > b/Silicon/Intel/SimicsIch10Pkg/LibraryPrivate/BasePchSpiCommonLib/BasePc > hSpiCommonLib.inf > index b5aa13c1c56d..3a64005b5690 100644 > --- > a/Silicon/Intel/SimicsIch10Pkg/LibraryPrivate/BasePchSpiCommonLib/BasePc > hSpiCommonLib.inf > +++ b/Silicon/Intel/SimicsIch10Pkg/LibraryPrivate/BasePchSpiCommonLib/Ba > +++ sePchSpiCommonLib.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 # @@ -30,3 +31,13 @@ > [LibraryClasses] [Pcd] > gIntelSiliconPkgTokenSpaceGuid.PcdBiosAreaBaseAddress ## CONSUMES > gIntelSiliconPkgTokenSpaceGuid.PcdBiosSize ## CONSUMES > + > +[Guids] > + gFlashRegionDescriptorGuid > + gFlashRegionBiosGuid > + gFlashRegionMeGuid > + gFlashRegionGbeGuid > + gFlashRegionPlatformDataGuid > + gFlashRegionDerGuid > + gFlashRegionAllGuid > + gFlashRegionMaxGuid > -- > 2.28.0.windows.1