From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web09.435.1635895518456887935 for ; Tue, 02 Nov 2021 16:25:18 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=zTjN1t7e; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: nathaniel.l.desimone@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10156"; a="255007166" X-IronPort-AV: E=Sophos;i="5.87,203,1631602800"; d="scan'208";a="255007166" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2021 16:25:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,203,1631602800"; d="scan'208";a="638382622" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga001.fm.intel.com with ESMTP; 02 Nov 2021 16:25:17 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 2 Nov 2021 16:25:17 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Tue, 2 Nov 2021 16:25:17 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.174) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Tue, 2 Nov 2021 16:25:16 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ksb3iEp72YptuUf6o0fd/Cdjoc+T5sc2ybPZpJ96k/xYKyPih8EBqMdLtBjTC4d12XQp3rEGEaTyFZfpbJCCfMyGcYTUaly7HJb9xXuE9a2Va+H5GyWhDzGDIPWgr2F8E53rt9vcZvB7EhNJ/QP4/azOnIB9V4MNUbFcYXUg4WimbnESWkr7u0kHnjhCegKPBwppbKqoceucH0P2tj4nwx3b+LbbFt1QGbIFaCaoftGQ6R0zqTMiXeMqFLTkC2zEnJMQSU0CuHPSyOiyeDj5Rl9V0UqU6WEuejO/cY5xrdDIfqRs30Lt/Hs4AuAh19trRWB05hwlBRKex9gO40MK6w== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vExboJj3wuAd4jsqBNp4fJ6vYCAsbYOaqY3JCM63Ss0=; b=niKVheCLpBWJqGDWbz2d36BUdk1mTObBqtx9Yd693mKeztcOYNJVJdJxb+E5RBAiazJhT6JQ1d+MHi+MFz0SYqmanFyvveBYfkC39g0Wk8UEFjOhketrGqUO5U1VAa19sl5AVoxMSYLmhnBfg/qFjOqmM/oRnQhy1GwrASBQaHokKIaCMXAxEs8SG8SHEwc6XOPoAZhUoszK9zc5QB1+dc4cGVCEIJbnSD44/3BTYrx0HCFQPGVmd9zNWJHz6aDe30Y198g5M4ET6Yne/CMLm7Lqj4lN+FxDahZdd+UNZNVHws75xMx0xhvdMfW/Sz6yp5wdvH3Z9DdxhnEIZ8ePyA== 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=vExboJj3wuAd4jsqBNp4fJ6vYCAsbYOaqY3JCM63Ss0=; b=zTjN1t7eqbBcpaK5d83U2st2OCAXRjq9y1t+795bG1DJdknOZD2aX2YpcPR8LaocXxI6TTtMegcgKeEz0jwiCzHxau6+LJ37iWmwquOMh/1G2o/dgkmxqFl3nStDaeJZyYmLNgnxubqI5N6hBxvzVB6DGIGXfcch0Bv7o0ey1lY= Received: from MW4PR11MB5821.namprd11.prod.outlook.com (2603:10b6:303:184::5) by MWHPR11MB1693.namprd11.prod.outlook.com (2603:10b6:300:2b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.17; Tue, 2 Nov 2021 23:25:14 +0000 Received: from MW4PR11MB5821.namprd11.prod.outlook.com ([fe80::6140:8298:9d5a:df46]) by MW4PR11MB5821.namprd11.prod.outlook.com ([fe80::6140:8298:9d5a:df46%9]) with mapi id 15.20.4649.019; Tue, 2 Nov 2021 23:25:14 +0000 From: "Nate DeSimone" To: "devel@edk2.groups.io" , "mikuback@linux.microsoft.com" CC: "Chiu, Chasel" , "Chaganty, Rangasai V" Subject: Re: [edk2-devel] [PATCH v6 44/52] KabylakeSiliconPkg: Identify flash regions by GUID Thread-Topic: [edk2-devel] [PATCH v6 44/52] KabylakeSiliconPkg: Identify flash regions by GUID Thread-Index: AQHXzEipfOIUsALUpESdAKSXMuEW56vw6TJg Date: Tue, 2 Nov 2021 23:25:14 +0000 Message-ID: References: <20211028220846.753-1-mikuback@linux.microsoft.com> <20211028220846.753-9-mikuback@linux.microsoft.com> In-Reply-To: <20211028220846.753-9-mikuback@linux.microsoft.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.200.16 dlp-product: dlpe-windows authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 97a429c6-0b4f-4312-8244-08d99e580649 x-ms-traffictypediagnostic: MWHPR11MB1693: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 9xf22vA77stIRcJ66X19pdFa/mav1tgzhKUV2+h/+ULjy+LRO6pPJBl2ltfSBw+9M5MXfFUb15bzx4B8cYSx24aNIz3cW3B4rbWss4YG6aegC11f51IY59nUoMB4dVn0Pcx3IsoDC08zhDhBjMT5DeoKVfW+SM0VxErA6NenYnKQAUY97Fca1Ee+IIcEfbpI8bj9R3J7Yy2UqGekX0FTYk0ddIEt8Tqu1P3Fduw4vfdQ/SBz/gbOhZ2HwUi3kaxyCl7hHXy5YJy4++QTM28plx8PNLeg/vOaGEWYbmpVWOmg1pQGJ9INsDeo+mWf6wWW2YrwQh4d2C/FO0wfSQfVhtfq17EsD5kKzBaepMrtumxxn/h1cGyjamvwreqDNQ20zx3ullSdZir9xVysznr9GFMFuM3fm7lIswo01Mi6ArYqcHlmCYqiZc7JiS5OXKG7F/TAZmYDA8jf9zXoQY5rYDd38f69i/ssrH08hFldWZ4NWFoAU2eKoIBJhLqRb1y9coAS6OJVIdV57pDyfpjD2fK7kHH4Lj1Ap7y+5nIEQeqFbRJubKEwbeTpmzmfzt+yTtXr9iDBCI1Z1deA4CwTWt96euazoP09ZnXjyE7wCRPR68Yk8RwIziGcyd4hulgw5Na3PEDF5h3B4uwqiM+b5Es4rnskEA7vRZLxss9cg0l7FGgcOBv6xdgO7kgyjC7kmFZE2+Ic8P1jxtmUPCoPyXZ+hZH0FlKi0JwVABujrlWeSyt07jyAD33c+gyFwdTUgAttnldm4AmOv832g2FS3zc2Wj9lKuZ4sD+F/7dtrO6lax3HV4b8toJznjLEexykS2aV8ug/homaV7M/Er0ZPw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR11MB5821.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(38100700002)(53546011)(122000001)(38070700005)(33656002)(82960400001)(107886003)(71200400001)(6506007)(8676002)(5660300002)(86362001)(8936002)(316002)(110136005)(7696005)(26005)(54906003)(76116006)(66946007)(45080400002)(66476007)(66556008)(4326008)(508600001)(2906002)(186003)(52536014)(83380400001)(64756008)(66446008)(966005)(55016002)(9686003)(30864003)(559001)(579004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?pYfNbPfS7OQ0DlmYzT9Aj3wN845KeA37HSMVuqHP2c+/jhCBWJ5sowedGKqV?= =?us-ascii?Q?v2V4gHd8t6RcWg+HqUngmNyjgZYK/1OpwnGr3zoZBM317UBsTh7CNHcKGG3F?= =?us-ascii?Q?P9R1tVZY5b9f65SYsptqqA3lcHhNBAKPWGMJqOfajFm7UC2koSRrYdcTPEKZ?= =?us-ascii?Q?78KD47+Ki4G1rpRvxQ/am884orEqkfd4yKRyT2Blw4Yq5ckhNcEL8DBiwVnn?= =?us-ascii?Q?BvxwXDkngPzXn+mHV4bd3Q8jJCeBORmbI796N56u3cqK/sOaZBj9s4r8LfmG?= =?us-ascii?Q?be9eEGEWcWNqsnl+lDyiiK7Ws9dlFwOGYEADVIfhvaIrKnaL5Mo6fuUtwRBQ?= =?us-ascii?Q?6TESBPjz/MEDOJSFKm0yYOCXf6KW3GOxFLTJmV1DW0SrqIpBPaHuKsss7WXx?= =?us-ascii?Q?n/Gi5nKCCYPtH5vUH7sD2zbwcmX4y8DupGThlk99ujg3C8ENimoU/G/bmN6y?= =?us-ascii?Q?cJ8F2NWEuIdjwb2QsVgrOJ5xTuX8mLIBTvKC+qLNiYXStA0JVeHMc80oRTQw?= =?us-ascii?Q?wfuhYcB1/LzuPGA9ruHOFf4zUSpRBs0Z43vp4s7jMLpedmzwl7v/8XYi2F6K?= =?us-ascii?Q?xknwNmGfHGN0xw3ysC29ShiIDb5KuNijX01dbH9VN7Rl9i5yDklxyHRzcEh/?= =?us-ascii?Q?z2FkKzlFoOfH1tXrJarnablyaBmvvFZ6b7OSTLdaPE2h8MDcYfspf05E6m8n?= =?us-ascii?Q?BzCvbV7aRTam1LF/L5lte1x4w2IA4h/rzzoo+9MLXzp98NM3YXS/dRSSl1e4?= =?us-ascii?Q?3aXncSLaOL1ca5ZF+YjvyB1gXtWTugR7z+ksg5TvQ+C9v1TBOLoVWYqt1GeG?= =?us-ascii?Q?OI/EOqwzS34rJT46RiVD8pZra6cab1XICdXoJ++TL1iicqEf6/8BDynHpULz?= =?us-ascii?Q?4NnTwMmd4gWOZKy+qRAK/HyVkJ05VU7JmQkku/Wp8uJJOKL9M+acQKy0hYpJ?= =?us-ascii?Q?zRFvvTWse8qMlb0yciV2Sp8tuNL6R5axRoMt2phEi+Y5v1Rqwbqn08+X1T1E?= =?us-ascii?Q?eQ1S/ojcLhV8MKyXbm//gakEkYZtZb3Ta580c+T2qzfUwjzR0IBy/sRKcerQ?= =?us-ascii?Q?oOCumNhu/uwwmUXP5yUa76h70RMQGYvzEEb8hXoRlCgmAXeioTxngltUGtzh?= =?us-ascii?Q?l6zUAEgfhjV5pi/w+HVRJQXE05TQqogChwRlRWkPe8TQxBKkzldxERDZXB/J?= =?us-ascii?Q?GlC7kSSzaPfZz4H9kJQ9m7uZ58WE6S1hh54xtGiZCEe2XONvqi7mHKj3z9v+?= =?us-ascii?Q?ASqtr5wTeffPP5fQ2QpH/7Qwmj6hE/oCzi+nIkmvSB2C26T0kjeJsDCRb9tO?= =?us-ascii?Q?OkpcUL3RNDC91tuow5Ph1mogUc8zHsT8r8CTnq6G7VoAAVrKkL4pJ78hkgPP?= =?us-ascii?Q?hRRqUcU6mRpLIKiELR0E6K1UJEeHCRCQq4dkzzsMe6nNlAGfccvADdpRcLHE?= =?us-ascii?Q?aZmQG4O0EvJoQcDzgfWmAQmMFueJ3Csdc80bpDFW0m+p5XYOAugD8NDl0KyP?= =?us-ascii?Q?RRPcqfmwL/lL7yiXCfGgsUeGBf0UK0xCc6qvXPUEpLVRVV4ehEdYxJm+aR/n?= =?us-ascii?Q?BwoQoeOFcjHTAL8AsCETb1WoUI/pM/0wQde2CJazL/nhhhQChX/3kd34M3Bt?= =?us-ascii?Q?4+IqJcYKYHIWS01m9XVyl4VzRORDYIKRF5tNJ1aTShp1ttJBMsBt/1vwZGb5?= =?us-ascii?Q?CnNsAQ=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5821.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97a429c6-0b4f-4312-8244-08d99e580649 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Nov 2021 23:25:14.7525 (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: zHo9VOb4uzGXjPJIaC4lk/ZTYCZ/RY2tyG/bQenrTxBnS+CVvsZv9kbt1r9G+Kj42ewyHVXAS9aFQRyNTu5I77B/cd6EuyH9TLF+io2tIUw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1693 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: devel@edk2.groups.io On Behalf Of Michael Kuba= cki Sent: Thursday, October 28, 2021 3:09 PM To: devel@edk2.groups.io Cc: Chiu, Chasel ; Chaganty, Rangasai V ; Desimone, Nathaniel L Subject: [edk2-devel] [PATCH v6 44/52] KabylakeSiliconPkg: Identify flash r= egions by GUID From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3307 Updates the code to identify flash regions by GUID and internally map the G= UID entries to values specific to KabylakeSiliconPkg. Cc: Chasel Chiu Cc: Rangasai V Chaganty Cc: Nate DeSimone Signed-off-by: Michael Kubacki Reviewed-by: Chasel Chiu --- Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/SecureMemoryMapConfiguration.c = | 108 ++++++++++- Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPrivate/BasePchSpiCommonLib/Sp= iCommon.c | 188 +++++++++++++++----- Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/HstiSiliconDxe.h = | 2 +- Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/HstiSiliconDxe.inf = | 9 + Silicon/Intel/KabylakeSiliconPkg/Pch/IncludePrivate/Library/PchSpiCommonLi= b.h | 68 +++---- Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPrivate/BasePchSpiCommonLib/Ba= sePchSpiCommonLib.inf | 11 ++ 6 files changed, 297 insertions(+), 89 deletions(-) diff --git a/Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/SecureMemoryMapConfi= guration.c b/Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/SecureMemoryMapConfi= guration.c index a3c9bbebeaa9..705004853122 100644 --- a/Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/SecureMemoryMapConfiguratio= n.c +++ b/Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/SecureMemoryMapConfigura +++ tion.c @@ -2,11 +2,14 @@ This file contains the tests for the SecureMemoryMapConfiguration bit =20 Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) Microsoft Corporation.
+ SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ =20 #include "HstiSiliconDxe.h" +#include =20 typedef struct { UINT64 Base; @@ -100,6 +103,90 @@ MEMORY_RANGE mNonLockableMemoryRange[NonLockableMemor= yRangeMax] =3D { // 14. SPI_BAR0 (BDF 0:31:5 + 0x10) }; =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 to = the flash region type value. + + @retval EFI_SUCCESS The flash region type was found fo= r the given flash region GUID. + @retval EFI_INVALID_PARAMETER A pointer argument passed to the f= unction is NULL. + @retval EFI_NOT_FOUND The flash region type was not foun= d 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; +} + /** Check for overlaps in single range array =20 @@ -224,7 +311,7 @@ AcquireSpiBar0 ( { UINT32 SpiBar0; UINTN PchSpiBase; - =20 + // // Init PCH spi reserved MMIO address. // @@ -269,8 +356,8 @@ ReleaseSpiBar0 ( /** Get the SPI region base and size, based on the enum type =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . - @param[in] FlashRegionType The Flash Region type for for the base a= ddress which is listed in the Descriptor. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. + @param[in] FlashRegionGuid The Flash Region GUID for the base addre= ss which corresponds to the type in the descriptor. @param[out] BaseAddress The Flash Linear Address for the Region = 'n' Base @param[out] RegionSize The size for the Region 'n' =20 @@ -281,13 +368,20 @@ ReleaseSpiBar0 ( EFI_STATUS EFIAPI GetRegionAddress ( - IN FLASH_REGION_TYPE FlashRegionType, + IN EFI_GUID *FlashRegionGuid, OUT UINT32 *BaseAddress, OUT UINT32 *RegionSize ) { - UINTN PchSpiBar0; - UINT32 ReadValue; + EFI_STATUS Status; + FLASH_REGION_TYPE FlashRegionType; + UINTN PchSpiBar0; + UINT32 ReadValue; + + Status =3D GetFlashRegionType (FlashRegionGuid, &FlashRegionType); if=20 + (EFI_ERROR (Status)) { + return EFI_INVALID_PARAMETER; + } =20 if (FlashRegionType >=3D FlashRegionMax) { return EFI_INVALID_PARAMETER; @@ -484,7 +578,7 @@ CheckSecureMemoryMapConfiguration ( // // Locate BIOS region size to update High bios base address // - GetRegionAddress (FlashRegionBios, &BaseAddress, &RegionSize); + GetRegionAddress (&gFlashRegionBiosGuid, &BaseAddress,=20 + &RegionSize); DEBUG ((DEBUG_INFO, "Bios Region Size %x:\n", RegionSize)); mLockableMemoryRange[LockableMemoryRangeHighBios].Base =3D SIZE_4GB -= RegionSize; mLockableMemoryRange[LockableMemoryRangeLowDram].End =3D (MmioRead32 = (MmPciBase (0,SA_MC_DEV,SA_MC_FUN) + R_SA_TOLUD) & B_SA_TOLUD_TOLUD_MASK) -= 1; diff --git a/Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPrivate/BasePc= hSpiCommonLib/SpiCommon.c b/Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPri= vate/BasePchSpiCommonLib/SpiCommon.c index 58757a8cba39..6fc8141b4681 100644 --- a/Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPrivate/BasePchSpiCommonL= ib/SpiCommon.c +++ b/Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPrivate/BasePchSpiComm +++ onLib/SpiCommon.c @@ -2,10 +2,13 @@ PCH SPI Common Driver implements the SPI Host Controller Compatibility I= nterface. =20 Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) Microsoft Corporation.
+ SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ #include +#include #include #include #include @@ -13,9 +16,93 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include <= PchAccess.h> #include #include -#include +#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 to = the flash region type value. + + @retval EFI_SUCCESS The flash region type was found fo= r the given flash region GUID. + @retval EFI_INVALID_PARAMETER A pointer argument passed to the f= unction is NULL. + @retval EFI_NOT_FOUND The flash region type was not foun= d 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 @@ -248,8 +335,8 @@ PchPmTimerStallRuntimeSafe ( /** Read data from the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . - @param[in] FlashRegionType The Flash Region type for flash cycle wh= ich is listed in the Descriptor. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle wh= ich corresponds to the type in the descriptor. @param[in] Address The Flash Linear Address must fall withi= n a region for which BIOS has access permissions. @param[in] ByteCount Number of bytes in the data portion of t= he SPI cycle. @param[out] Buffer The Pointer to caller-allocated buffer c= ontaining the dada received. @@ -262,8 +349,8 @@ PchPmTimerStallRuntimeSafe ( EFI_STATUS EFIAPI SpiPr= otocolFlashRead ( - IN PCH_SPI_PROTOCOL *This, - IN FLASH_REGION_TYPE FlashRegionType, + IN PCH_SPI2_PROTOCOL *This, + IN EFI_GUID *FlashRegionGuid, IN UINT32 Address, IN UINT32 ByteCount, OUT UINT8 *Buffer @@ -276,7 +363,7 @@ SpiProtocolFlashRead ( // Status =3D SendSpiCmd ( This, - FlashRegionType, + FlashRegionGuid, FlashCycleRead, Address, ByteCount, @@ -288,8 +375,8 @@ SpiProtocolFlashRead ( /** Write data to the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . - @param[in] FlashRegionType The Flash Region type for flash cycle wh= ich is listed in the Descriptor. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle wh= ich corresponds to the type in the descriptor. @param[in] Address The Flash Linear Address must fall withi= n a region for which BIOS has access permissions. @param[in] ByteCount Number of bytes in the data portion of t= he SPI cycle. @param[in] Buffer Pointer to caller-allocated buffer conta= ining the data sent during the SPI cycle. @@ -301,8 +388,8 @@ SpiProtocolFlashRead ( EFI_STATUS EFIAPI SpiProtocol= FlashWrite ( - IN PCH_SPI_PROTOCOL *This, - IN FLASH_REGION_TYPE FlashRegionType, + IN PCH_SPI2_PROTOCOL *This, + IN EFI_GUID *FlashRegionGuid, IN UINT32 Address, IN UINT32 ByteCount, IN UINT8 *Buffer @@ -315,7 +402,7 @@ SpiProtocolFlashWrite ( // Status =3D SendSpiCmd ( This, - FlashRegionType, + FlashRegionGuid, FlashCycleWrite, Address, ByteCount, @@ -327,8 +414,8 @@ SpiProtocolFlashWrite ( /** Erase some area on the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . - @param[in] FlashRegionType The Flash Region type for flash cycle wh= ich is listed in the Descriptor. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle wh= ich corresponds to the type in the descriptor. @param[in] Address The Flash Linear Address must fall withi= n a region for which BIOS has access permissions. @param[in] ByteCount Number of bytes in the data portion of t= he SPI cycle. =20 @@ -339,8 +426,8 @@ SpiProtocolFlashWrite ( EFI_STATUS EFIAPI SpiProtoco= lFlashErase ( - IN PCH_SPI_PROTOCOL *This, - IN FLASH_REGION_TYPE FlashRegionType, + IN PCH_SPI2_PROTOCOL *This, + IN EFI_GUID *FlashRegionGuid, IN UINT32 Address, IN UINT32 ByteCount ) @@ -352,7 +439,7 @@ SpiProtocolFlashErase ( // Status =3D SendSpiCmd ( This, - FlashRegionType, + FlashRegionGuid, FlashCycleErase, Address, ByteCount, @@ -364,7 +451,7 @@ SpiProtocolFlashErase ( /** Read SFDP data from the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. @param[in] ComponentNumber The Componen Number for chip select @param[in] Address The starting byte address for SFDP data = read. @param[in] ByteCount Number of bytes in SFDP data portion of = the SPI cycle @@ -378,7 +465,7 @@ SpiProtocolFlashErase ( EFI_STATUS EFIAPI SpiProtoco= lFlashReadSfdp ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT8 ComponentNumber, IN UINT32 Address, IN UINT32 ByteCount, @@ -407,7 +494,7 @@ SpiProtocolFlashReadSfdp ( // Status =3D SendSpiCmd ( This, - FlashRegionAll, + &gFlashRegionAllGuid, FlashCycleReadSfdp, FlashAddress, ByteCount, @@ -419,7 +506,7 @@ SpiProtocolFlashReadSfdp ( /** Read Jedec Id from the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. @param[in] ComponentNumber The Componen Number for chip select @param[in] ByteCount Number of bytes in JedecId data portion = of the SPI cycle, the data size is 3 typically @param[out] JedecId The Pointer to caller-allocated buffer c= ontaining JEDEC ID received @@ -432,7 +519,7 @@ SpiProtocolFlashReadSfdp ( EFI_STATUS EFIAPI SpiProt= ocolFlashReadJedecId ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT8 ComponentNumber, IN UINT32 ByteCount, OUT UINT8 *JedecId @@ -460,7 +547,7 @@ SpiProtocolFlashReadJedecId ( // Status =3D SendSpiCmd ( This, - FlashRegionAll, + &gFlashRegionAllGuid, FlashCycleReadJedecId, Address, ByteCount, @@ -472,7 +559,7 @@ SpiProtocolFlashReadJedecId ( /** Write the status register in the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. @param[in] ByteCount Number of bytes in Status data portion o= f the SPI cycle, the data size is 1 typically @param[in] StatusValue The Pointer to caller-allocated buffer c= ontaining the value of Status register writing =20 @@ -483,7 +570,7 @@ SpiProtocolFlashReadJedecId ( EFI_STATUS EFIAPI SpiP= rotocolFlashWriteStatus ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT32 ByteCount, IN UINT8 *StatusValue ) @@ -495,7 +582,7 @@ SpiProtocolFlashWriteStatus ( // Status =3D SendSpiCmd ( This, - FlashRegionAll, + &gFlashRegionAllGuid, FlashCycleWriteStatus, 0, ByteCount, @@ -507,7 +594,7 @@ SpiProtocolFlashWriteStatus ( /** Read status register in the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. @param[in] ByteCount Number of bytes in Status data portion o= f the SPI cycle, the data size is 1 typically @param[out] StatusValue The Pointer to caller-allocated buffer c= ontaining the value of Status register received. =20 @@ -518,7 +605,7 @@ SpiProtocolFlashWriteStatus ( EFI_STATUS EFIAPI SpiP= rotocolFlashReadStatus ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT32 ByteCount, OUT UINT8 *StatusValue ) @@ -530,7 +617,7 @@ SpiProtocolFlashReadStatus ( // Status =3D SendSpiCmd ( This, - FlashRegionAll, + &gFlashRegionAllGuid, FlashCycleReadStatus, 0, ByteCount, @@ -542,8 +629,8 @@ SpiProtocolFlashReadStatus ( /** Get the SPI region base and size, based on the enum type =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . - @param[in] FlashRegionType The Flash Region type for for the base a= ddress which is listed in the Descriptor. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. + @param[in] FlashRegionGuid The Flash Region GUID for the base addre= ss which corresponds to the type in the descriptor. @param[out] BaseAddress The Flash Linear Address for the Region = 'n' Base @param[out] RegionSize The size for the Region 'n' =20 @@ -554,18 +641,25 @@ SpiProtocolFlashReadStatus ( EFI_STATUS EFIAPI Spi= ProtocolGetRegionAddress ( - IN PCH_SPI_PROTOCOL *This, - IN FLASH_REGION_TYPE FlashRegionType, + IN PCH_SPI2_PROTOCOL *This, + 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=20 + (EFI_ERROR (Status)) { + return EFI_INVALID_PARAMETER; + } + if (FlashRegionType >=3D FlashRegionMax) { return EFI_INVALID_PARAMETER; } @@ -600,7 +694,7 @@ SpiProtocolGetRegionAddress ( /** Read PCH Soft Strap Values =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. @param[in] SoftStrapAddr PCH Soft Strap address offset from FPSBA= . @param[in] ByteCount Number of bytes in SoftStrap data portio= n of the SPI cycle @param[out] SoftStrapValue The Pointer to caller-allocated buffer c= ontaining PCH Soft Strap Value. @@ -614,7 +708,7 @@ SpiProtocolGetRegionAddress ( EFI_STATUS EFIAPI SpiP= rotocolReadPchSoftStrap ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT32 SoftStrapAddr, IN UINT32 ByteCount, OUT VOID *SoftStrapValue @@ -646,7 +740,7 @@ SpiProtocolReadPchSoftStrap ( // Status =3D SendSpiCmd ( This, - FlashRegionDescriptor, + &gFlashRegionDescriptorGuid, FlashCycleRead, StrapFlashAddr, ByteCount, @@ -658,7 +752,7 @@ SpiProtocolReadPchSoftStrap ( /** Read CPU Soft Strap Values =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. @param[in] SoftStrapAddr CPU Soft Strap address offset from FCPUS= BA. @param[in] ByteCount Number of bytes in SoftStrap data portio= n of the SPI cycle. @param[out] SoftStrapValue The Pointer to caller-allocated buffer c= ontaining CPU Soft Strap Value. @@ -672,7 +766,7 @@ SpiProtocolReadPchSoftStrap ( EFI_STATUS EFIAPI SpiP= rotocolReadCpuSoftStrap ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT32 SoftStrapAddr, IN UINT32 ByteCount, OUT VOID *SoftStrapValue @@ -704,7 +798,7 @@ SpiProtocolReadCpuSoftStrap ( // Status =3D SendSpiCmd ( This, - FlashRegionDescriptor, + &gFlashRegionDescriptorGuid, FlashCycleRead, StrapFlashAddr, ByteCount, @@ -716,8 +810,8 @@ SpiProtocolReadCpuSoftStrap ( /** This function sends the programmed SPI command to the slave device. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . - @param[in] SpiRegionType The SPI Region type for flash cycle whic= h is listed in the Descriptor + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle wh= ich corresponds to the type in the descriptor. @param[in] FlashCycleType The Flash SPI cycle type list in HSFC (H= ardware Sequencing Flash Control Register) register @param[in] Address The Flash Linear Address must fall withi= n a region for which BIOS has access permissions. @param[in] ByteCount Number of bytes in the data portion of t= he SPI cycle. @@ -730,8 +824,8 @@ SpiProtocolReadCpuSoftStrap ( **/ EFI_STATUS SendSpi= Cmd ( - IN PCH_SPI_PROTOCOL *This, - IN FLASH_REGION_TYPE FlashRegionType, + IN PCH_SPI2_PROTOCOL *This, + IN EFI_GUID *FlashRegionGuid, IN FLASH_CYCLE_TYPE FlashCycleType, IN UINT32 Address, IN UINT32 ByteCount, @@ -795,7 +889,7 @@ SendSpiCmd ( goto SendSpiCmdEnd; } =20 - Status =3D SpiProtocolGetRegionAddress (This, FlashRegionType, &Hardware= SpiAddr, &FlashRegionSize); + Status =3D SpiProtocolGetRegionAddress (This, FlashRegionGuid,=20 + &HardwareSpiAddr, &FlashRegionSize); if (EFI_ERROR (Status)) { goto SendSpiCmdEnd; } @@ -1016,7 +1110,7 @@ SendSpiCmd ( **/ BOOLEAN WaitForSpiCycleComplete ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINTN PchSpiBar0, IN BOOLEAN ErrorCheck ) diff --git a/Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/HstiSiliconDxe.h b/S= ilicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/HstiSiliconDxe.h index 08094dbbc145..f0a341b0214c 100644 --- a/Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/HstiSiliconDxe.h +++ b/Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/HstiSiliconDxe.h @@ -26,7 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include -#include +#include #include #include #in= clude diff --git a/Silicon/Intel/KabylakeSiliconPkg/H= sti/Dxe/HstiSiliconDxe.inf b/Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/Hsti= SiliconDxe.inf index bd12fa691d40..09826cdfdf39 100644 --- a/Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/HstiSiliconDxe.inf +++ b/Silicon/Intel/KabylakeSiliconPkg/Hsti/Dxe/HstiSiliconDxe.inf @@ -2,6 +2,7 @@ # Component description file for Hsti Silicon Driver # # Copyright (c) = 2017, Intel Corporation. All rights reserved.
+# Copyright (c) Microsoft Corporation.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -86,6 +87,14 @@ [Libr= aryClasses] [Guids] gEfiEndOfDxeEventGroupGuid gSiMemoryPlatformDataGuid ## CONSUMES + gFlashRegionDescriptorGuid + gFlashRegionBiosGuid + gFlashRegionMeGuid + gFlashRegionGbeGuid + gFlashRegionPlatformDataGuid + gFlashRegionDerGuid + gFlashRegionAllGuid + gFlashRegionMaxGuid =20 [Protocols] gEfiDxeSmmReadyToLockProtocolGuid ## CONSUMES diff --git a/Silicon/Inte= l/KabylakeSiliconPkg/Pch/IncludePrivate/Library/PchSpiCommonLib.h b/Silicon= /Intel/KabylakeSiliconPkg/Pch/IncludePrivate/Library/PchSpiCommonLib.h index d408289ea253..0341cc546465 100644 --- a/Silicon/Intel/KabylakeSiliconPkg/Pch/IncludePrivate/Library/PchSpiCom= monLib.h +++ b/Silicon/Intel/KabylakeSiliconPkg/Pch/IncludePrivate/Library/PchSpi +++ CommonLib.h @@ -47,7 +47,7 @@ typedef enum { typedef struct { UINT32 Signature; EFI_HANDLE Handle; - PCH_SPI_PROTOCOL SpiProtocol; + PCH_SPI2_PROTOCOL SpiProtocol; UINT16 PchAcpiBase; UINTN PchSpiBase; UINT8 ReadPermission; @@ -133,8 +133,8 @@ ReleaseSpiBar0 ( /** Read data from the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . - @param[in] FlashRegionType The Flash Region type for flash cycle wh= ich is listed in the Descriptor. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle wh= ich corresponds to the type in the descriptor. @param[in] Address The Flash Linear Address must fall withi= n a region for which BIOS has access permissions. @param[in] ByteCount Number of bytes in the data portion of t= he SPI cycle. @param[out] Buffer The Pointer to caller-allocated buffer c= ontaining the dada received. @@ -147,8 +147,8 @@ ReleaseSpiBar0 ( EFI_STATUS EFIAPI SpiProtocolFlashRead ( - IN PCH_SPI_PROTOCOL *This, - IN FLASH_REGION_TYPE FlashRegionType, + IN PCH_SPI2_PROTOCOL *This, + IN EFI_GUID *FlashRegionGuid, IN UINT32 Address, IN UINT32 ByteCount, OUT UINT8 *Buffer @@ -157,8 +157,8 @@ SpiProtocolFlashRead ( /** Write data to the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . - @param[in] FlashRegionType The Flash Region type for flash cycle wh= ich is listed in the Descriptor. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle wh= ich corresponds to the type in the descriptor. @param[in] Address The Flash Linear Address must fall withi= n a region for which BIOS has access permissions. @param[in] ByteCount Number of bytes in the data portion of t= he SPI cycle. @param[in] Buffer Pointer to caller-allocated buffer conta= ining the data sent during the SPI cycle. @@ -170,8 +170,8 @@ SpiProtocolFlashRead ( EFI_STATUS EFIAPI SpiProtocol= FlashWrite ( - IN PCH_SPI_PROTOCOL *This, - IN FLASH_REGION_TYPE FlashRegionType, + IN PCH_SPI2_PROTOCOL *This, + IN EFI_GUID *FlashRegionGuid, IN UINT32 Address, IN UINT32 ByteCount, IN UINT8 *Buffer @@ -180,8 +180,8 @@ SpiProtocolFlashWrite ( /** Erase some area on the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . - @param[in] FlashRegionType The Flash Region type for flash cycle wh= ich is listed in the Descriptor. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle wh= ich corresponds to the type in the descriptor. @param[in] Address The Flash Linear Address must fall withi= n a region for which BIOS has access permissions. @param[in] ByteCount Number of bytes in the data portion of t= he SPI cycle. =20 @@ -192,8 +192,8 @@ SpiProtocolFlashWrite ( EFI_STATUS EFIAPI SpiProtoco= lFlashErase ( - IN PCH_SPI_PROTOCOL *This, - IN FLASH_REGION_TYPE FlashRegionType, + IN PCH_SPI2_PROTOCOL *This, + IN EFI_GUID *FlashRegionGuid, IN UINT32 Address, IN UINT32 ByteCount ); @@ -201,7 +201,7 @@ SpiProtocolFlashErase ( /** Read SFDP data from the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. @param[in] ComponentNumber The Componen Number for chip select @param[in] Address The starting byte address for SFDP data = read. @param[in] ByteCount Number of bytes in SFDP data portion of = the SPI cycle @@ -215,7 +215,7 @@ SpiProtocolFlashErase ( EFI_STATUS EFIAPI SpiProtoco= lFlashReadSfdp ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT8 ComponentNumber, IN UINT32 Address, IN UINT32 ByteCount, @@ -225,7 +225,7 @@ SpiProtocolFlashReadSfdp ( /** Read Jedec Id from the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. @param[in] ComponentNumber The Componen Number for chip select @param[in] ByteCount Number of bytes in JedecId data portion = of the SPI cycle, the data size is 3 typically @param[out] JedecId The Pointer to caller-allocated buffer c= ontaining JEDEC ID received @@ -238,7 +238,7 @@ SpiProtocolFlashReadSfdp ( EFI_STATUS EFIAPI SpiProt= ocolFlashReadJedecId ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT8 ComponentNumber, IN UINT32 ByteCount, OUT UINT8 *JedecId @@ -247,7 +247,7 @@ SpiProtocolFlashReadJedecId ( /** Write the status register in the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. @param[in] ByteCount Number of bytes in Status data portion o= f the SPI cycle, the data size is 1 typically @param[in] StatusValue The Pointer to caller-allocated buffer c= ontaining the value of Status register writing =20 @@ -258,7 +258,7 @@ SpiProtocolFlashReadJedecId ( EFI_STATUS EFIAPI SpiP= rotocolFlashWriteStatus ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT32 ByteCount, IN UINT8 *StatusValue ); @@ -266,7 +266,7 @@ SpiProtocolFlashWriteStatus ( /** Read status register in the flash part. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. @param[in] ByteCount Number of bytes in Status data portion o= f the SPI cycle, the data size is 1 typically @param[out] StatusValue The Pointer to caller-allocated buffer c= ontaining the value of Status register received. =20 @@ -277,7 +277,7 @@ SpiProtocolFlashWriteStatus ( EFI_STATUS EFIAPI SpiP= rotocolFlashReadStatus ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT32 ByteCount, OUT UINT8 *StatusValue ); @@ -285,8 +285,8 @@ SpiProtocolFlashReadStatus ( /** Get the SPI region base and size, based on the enum type =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . - @param[in] FlashRegionType The Flash Region type for for the base a= ddress which is listed in the Descriptor. + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle wh= ich corresponds to the type in the descriptor. @param[out] BaseAddress The Flash Linear Address for the Region = 'n' Base @param[out] RegionSize The size for the Region 'n' =20 @@ -297,8 +297,8 @@ SpiProtocolFlashReadStatus ( EFI_STATUS EFIAPI SpiPr= otocolGetRegionAddress ( - IN PCH_SPI_PROTOCOL *This, - IN FLASH_REGION_TYPE FlashRegionType, + IN PCH_SPI2_PROTOCOL *This, + IN EFI_GUID *FlashRegionGuid, OUT UINT32 *BaseAddress, OUT UINT32 *RegionSize ); @@ -306,7 +306,7 @@ SpiProtocolGetRegionAddress ( /** Read PCH Soft Strap Values =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. @param[in] SoftStrapAddr PCH Soft Strap address offset from FPSBA= . @param[in] ByteCount Number of bytes in SoftStrap data portio= n of the SPI cycle @param[out] SoftStrapValue The Pointer to caller-allocated buffer c= ontaining PCH Soft Strap Value. @@ -320,7 +320,7 @@ SpiProtocolGetRegionAddress ( EFI_STATUS EFIAPI SpiP= rotocolReadPchSoftStrap ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT32 SoftStrapAddr, IN UINT32 ByteCount, OUT VOID *SoftStrapValue @@ -329,7 +329,7 @@ SpiProtocolReadPchSoftStrap ( /** Read CPU Soft Strap Values =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. @param[in] SoftStrapAddr CPU Soft Strap address offset from FCPUS= BA. @param[in] ByteCount Number of bytes in SoftStrap data portio= n of the SPI cycle. @param[out] SoftStrapValue The Pointer to caller-allocated buffer c= ontaining CPU Soft Strap Value. @@ -343,7 +343,7 @@ SpiProtocolReadPchSoftStrap ( EFI_STATUS EFIAPI SpiP= rotocolReadCpuSoftStrap ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINT32 SoftStrapAddr, IN UINT32 ByteCount, OUT VOID *SoftStrapValue @@ -352,8 +352,8 @@ SpiProtocolReadCpuSoftStrap ( /** This function sends the programmed SPI command to the slave device. =20 - @param[in] This Pointer to the PCH_SPI_PROTOCOL instance= . - @param[in] SpiRegionType The SPI Region type for flash cycle whic= h is listed in the Descriptor + @param[in] This Pointer to the PCH_SPI2_PROTOCOL instanc= e. + @param[in] FlashRegionGuid The Flash Region GUID for flash cycle wh= ich corresponds to the type in the descriptor. @param[in] FlashCycleType The Flash SPI cycle type list in HSFC (H= ardware Sequencing Flash Control Register) register @param[in] Address The Flash Linear Address must fall withi= n a region for which BIOS has access permissions. @param[in] ByteCount Number of bytes in the data portion of t= he SPI cycle. @@ -366,8 +366,8 @@ SpiProtocolReadCpuSoftStrap ( **/ EFI_STATUS SendSpi= Cmd ( - IN PCH_SPI_PROTOCOL *This, - IN FLASH_REGION_TYPE FlashRegionType, + IN PCH_SPI2_PROTOCOL *This, + IN EFI_GUID *FlashRegionGuid, IN FLASH_CYCLE_TYPE FlashCycleType, IN UINT32 Address, IN UINT32 ByteCount, @@ -387,7 +387,7 @@ SendSpiCmd ( **/ BOOLEAN WaitForSpiCycleComplete ( - IN PCH_SPI_PROTOCOL *This, + IN PCH_SPI2_PROTOCOL *This, IN UINTN PchSpiBar0, IN BOOLEAN ErrorCheck ); diff --git a/Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPrivate/BasePchSpi= CommonLib/BasePchSpiCommonLib.inf b/Silicon/Intel/KabylakeSiliconPkg/Pch/Li= braryPrivate/BasePchSpiCommonLib/BasePchSpiCommonLib.inf index 51e2d25a7f8b..67176c879de5 100644 --- a/Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPrivate/BasePchSpiCommonL= ib/BasePchSpiCommonLib.inf +++ b/Silicon/Intel/KabylakeSiliconPkg/Pch/LibraryPrivate/BasePchSpiComm +++ onLib/BasePchSpiCommonLib.inf @@ -2,6 +2,7 @@ # Component description file for the PchSpiCommonLib # # Copyright (c) = 2017 - 2020 Intel Corporation. All rights reserved.
+# Copyright (c) Microsoft Corporation.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -28,3 +29,13 @@ [Libr= aryClasses] IoLib DebugLib PchCycleDecodingLib + +[Guids] + gFlashRegionDescriptorGuid + gFlashRegionBiosGuid + gFlashRegionMeGuid + gFlashRegionGbeGuid + gFlashRegionPlatformDataGuid + gFlashRegionDerGuid + gFlashRegionAllGuid + gFlashRegionMaxGuid -- 2.28.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D Groups.io Links: You receive all messages sent to this group. View/Reply Online (#82864): https://edk2.groups.io/g/devel/message/82864 Mute This Topic: https://groups.io/mt/86664064/1767664 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [nathaniel.l.desimone@int= el.com] -=3D-=3D-=3D-=3D-=3D-=3D