From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web10.16407.1628730692131923391 for ; Wed, 11 Aug 2021 18:11:32 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=C/JGIJ1S; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: nathaniel.l.desimone@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10073"; a="213399788" X-IronPort-AV: E=Sophos;i="5.84,314,1620716400"; d="scan'208";a="213399788" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2021 18:11:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,314,1620716400"; d="scan'208";a="503692113" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga001.jf.intel.com with ESMTP; 11 Aug 2021 18:11:15 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Wed, 11 Aug 2021 18:11:14 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Wed, 11 Aug 2021 18:11:14 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) 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, 11 Aug 2021 18:11:14 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.103) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Wed, 11 Aug 2021 18:11:14 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d6fcVjfgAVglYVbpsyaop062ZBRXd9OZzz6pl75WmgMmZ7+G3zXIMzekPo3pWt67cz2kKavuMZ3kMPQxpdvFX/clvVd3QKpxzzKUJTWg87kNuzsKq2dpLrKB81RL+4nYmcVmTKAH3yOjs2y0wekuyJ6stYeiPbTCNybIhzeXokU2iyKwaLsCjLFqy2L9b+yMlMCruG00bjTo5InoS6+5KQ0HzaEnk0eQjvz8BZ+tNTAxQQKafqN8keqW6oq/QV6bMKpKXdbPO6mkhrj2rUrSBjlp8U8VWknvtizHmf9MCfjNnmX70Suh/pvUMQUYC//iSX8FO9hW5A2owcA0ttPo8A== 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=3C7YZT1iD2nKJPFa4ZyBf7iOvqpOAria64C9Cum6zH4=; b=oS61KM3CaOqMwX0bPGobazqraGP1KhmbozNSa/NGq0PBmSrfPLmVjrEV3xfbI5Ihn9NMLrIVTrNAzjofVf+r8IT5wZYVnaP/t4nRtlIVoqSc2xVj2x/EpK5m5l+AeDKkcmCVoKuXfkGemj1sZduWwrV2XIW+PGaEggm4ZHWHZ6HPsIQkmJX+hrz9nhu9UfYcXImBYVSguK3HC9IYg0hwTKra513Mz3VvlXTU0OjWbjBvhHn9QatpPPyx35XigCgZGPJPasJyzjjiwIuxTMJ/ZmHG2Mh1N0kMKvf6yKbKPZ3XCB1jktIy1LfhOrSoxgLvdB6Oh0iSjnrLezfMJPKz6A== 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=3C7YZT1iD2nKJPFa4ZyBf7iOvqpOAria64C9Cum6zH4=; b=C/JGIJ1SjsK6MATuRRc1vy37rgth3w1w4e6Qt95GZ4ClEYKV0qXBg+/IjhTlMg0iOtGBEG9Z8k5rE1VkRHXhho+4GzpDH0skKxYPsfd9YWdAqbFtueuX7CDDXMVQeQzp7wWQp1MmAIsV6FwtmQ5Eb2C5UyqwcFWCoIXDZtMXICo= 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.4415.13; Thu, 12 Aug 2021 01:11:12 +0000 Received: from MWHPR1101MB2160.namprd11.prod.outlook.com ([fe80::546c:f20e:35d2:65a7]) by MWHPR1101MB2160.namprd11.prod.outlook.com ([fe80::546c:f20e:35d2:65a7%5]) with mapi id 15.20.4415.016; Thu, 12 Aug 2021 01:11:12 +0000 From: "Nate DeSimone" To: "devel@edk2.groups.io" , "Desimone, Nathaniel L" CC: "Chiu, Chasel" , Michael Kubacki , Benjamin Doron Subject: Re: [edk2-devel] [edk2-platforms] [PATCH V2] KabylakeOpenBoardPkg: Add MMIO Base/Length to SA GNVS Thread-Topic: [edk2-devel] [edk2-platforms] [PATCH V2] KabylakeOpenBoardPkg: Add MMIO Base/Length to SA GNVS Thread-Index: AQHXjmNpQv+GOOSp0UKDTXKpTtXH4atvEQBA Date: Thu, 12 Aug 2021 01:11:12 +0000 Message-ID: References: <169A23C72E48BA3D.13770@groups.io> In-Reply-To: <169A23C72E48BA3D.13770@groups.io> 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: 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: 38129106-7839-482f-89a6-08d95d2e1389 x-ms-traffictypediagnostic: MWHPR11MB1917: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4502; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: c8CeXRKb7LnbXUR6oJyd2327IHIDuiwvinF26g2BtkUONrsD7rUIErTfuiJDp3q/6qZxs4uG8oxXRcSNl/CHo+li1jFvlTPJ+WkmHsW50zbl04hl1vKgHTj+r6TZzx8tTzQccFBkhrgikjNH86C/7HNhryUWuhcuHGqGJ4JEC6SbyL4aU/4PlpN4daAo9vRrJTIs93STgDnkXHMbYrcxCAQFVGwRdYn/pz9arbrgQZyFq5EJVspNBUu9PcdFghgaHI1F0H2CZl7aYVrHIpZo82lcywCBBQqmTR/xNa9N1q1XYLSfvFkDmo6KxGaXMCTk2NQ+DN0D7IYVT55PI+k7lSCxMTiY/v97X8GVb+B8E7FXtLqmv+HxIbtc84ZHnn3iGrbtRufguwVOSOHapGhKZ7uclATPTWt7pD6nkgwqqfkP5gBV6kwEvyZaV7v4jLax7EGd43cWpAF6mJJ0scZ8eHdDhX0dMYgeaWr3EcVOsv3kJJR81IrIQtEhUjHqAP4NWaewZYfSq2jFvPA+f3emToA4j0rwDlwmqw0oX8h2fQVD3vT3slNy9C5KgIhshSQi6g8DT1B/mnAkxjhD2htQVtO/MTv8qxFEjMNTBcGL44y9N5cAQXk4fQ4Uhz6FrDUki6cnHhR9QHkEdtJNgTvlEWayByXn22LW31u6/7Z2eItm+BQnUJzwDhZPJ7NjKdET2+pAjT+GLUkpIitXxM6a+TINo7LM8YDOMW5FvZb0rFmATNhpoJ/cDLpZyGL6CpH+zr8rjZvIzjrWF3UR3bGAH+9lS2ExsMnnze3Y41uRwW2ZHhHJivheu8uwbztm47qbpD7Xp511R1vGykS6q+GVeg== 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)(39860400002)(346002)(376002)(396003)(366004)(55016002)(38100700002)(186003)(8936002)(54906003)(38070700005)(66446008)(52536014)(478600001)(7696005)(2906002)(66946007)(66476007)(66556008)(33656002)(76116006)(64756008)(53546011)(110136005)(6506007)(9686003)(19627235002)(86362001)(316002)(122000001)(5660300002)(71200400001)(83380400001)(4326008)(8676002)(26005)(966005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?4GmMvk4jiQ9Tb9VUjoaD1ZC19DN3ZlZRlhEZkB3T/yy5ohnE0p/ZkNwIeHKy?= =?us-ascii?Q?fRLQRHbppaLRlMvSkVbCmaaV5fyPM0wg69ZdOvtTEJw4PhviAYtQENm3haJy?= =?us-ascii?Q?9XiTe7qEBgakXnRjHqeEjBRgpJKMdfsU6WkvRlS1/MloeQ8AJDff1D9WAmNB?= =?us-ascii?Q?8s/uvzQUYzig0ApvhBdFkKemzTgh9nuagVpHACuyZEErmyb/4NTU7zXQXjXc?= =?us-ascii?Q?3WqQWNDJC+WB1DhJgWAih8Pk6Sld9RiPiTLUhp2JBSAwGZrwfv3h/h+BX0q2?= =?us-ascii?Q?oTkg1MXTchQnmkif7xqlv8mm7LuheAdbx6UsWPjHXYQpdKD4gjak8t9Ity4K?= =?us-ascii?Q?W+OjTpJQlLOZOM2kyZMWbILDA1aY64VU5jwUnCctstNRKKUSzpAGB2s6hEEJ?= =?us-ascii?Q?ytWClRpMC64qdaZvoKgPtXJKaql3P96KphLP3pLSabz5hc93b2/Kwnoh4iPH?= =?us-ascii?Q?FJEnb2AIJrpsHQnhceZduAHbo+1f9lPwog+38GdB966t75rkEjSpfyqeMQHW?= =?us-ascii?Q?WGe8kitZGL2dJqCyN6w0ZkAnr1I6RZA4LhKypAFikiuhU8D0z6jwOa+AT7lj?= =?us-ascii?Q?XBDIC6Om8M1htPCX0/Qif0py0hDQ9svi3241kDZab2X6MNWupIgRThGgN4xt?= =?us-ascii?Q?Tj3nSv4UR4wKIjJdUwgXt/vxFKK5aJvJIwsAao/tgqt7IEkDUyUpaiMaVP0h?= =?us-ascii?Q?rlnDjoBDTpC2NrN3+MbxuTcCwYJBjli9WYeCNbhW7Kl1iKs22uzf2pX4llIp?= =?us-ascii?Q?MLoJ+/k9itoIzPqu8aUryCUD1PQFvG+PsurAJX5W6WSgCIfO7AOsbZmdmwAO?= =?us-ascii?Q?FpGHV+8z9dvUueZcvovwqeaLB/AJLjrYDf/lq0LQHIs7Uu4QNiiDzKn1uq87?= =?us-ascii?Q?8ZaCjji9zN+5h0npF2S0PcRXt8Amnz5zChbjjQw2gH6fO5DREcepBjN292zi?= =?us-ascii?Q?jizDVOsfV5ok6J6776337s6o/s5f4ZwnNSU6WmsDf8LBC87WFby4AF0W+7+1?= =?us-ascii?Q?+ZLhQe6DwM98W/roAd7P8hzWHFBtioInYWJs7ISLdM1sxMQK9qlRRed841rl?= =?us-ascii?Q?B8oF+1PGP0Xr7njsP+pf2ZJiTNen/QXiTfPszMK56mCnULgEGEMSKMnLAM6H?= =?us-ascii?Q?1mdSq+o8erdv6BXof4Oj1h/1TAqlzO9pWGtn/2fou8f18aGsJP3vOTbX1LMA?= =?us-ascii?Q?HCe4jW6mJXBf02o8HiH9P4eBzHwlnKEp9OS+U9M3tvN3kxlUD231fllwDB+R?= =?us-ascii?Q?tgLDbI3FDFFCGtQFvC+jQctrrH2wssBeV384LOjB3tsvBwGBSBHKSoT6nYki?= =?us-ascii?Q?F2OXjavLvUYvXPK2dmEg2dF+?= 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: 38129106-7839-482f-89a6-08d95d2e1389 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Aug 2021 01:11:12.6635 (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: wfpsnxbiW1CgKuW1lHQ7vMvwqtto2C60XlSQAtybHsrIsa1jgEtVBDA1+ozqZ/dJGayUcCgXkNsIEc1Vlc71DaxKGNN/p/YzoftGQpjazcM= 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 Pushed: https://github.com/tianocore/edk2-platforms/commit/37fff29 -----Original Message----- From: devel@edk2.groups.io On Behalf Of Nate DeSimon= e Sent: Tuesday, August 10, 2021 8:46 PM To: devel@edk2.groups.io Cc: Chiu, Chasel ; Michael Kubacki ; Benjamin Doron Subject: [edk2-devel] [edk2-platforms] [PATCH V2] KabylakeOpenBoardPkg: Add= MMIO Base/Length to SA GNVS The SA GNVS Area contains fields for the MMIO region base address and lengt= h. This implements code to populate those fields. The MMIO Base/Length are = used by ASL at runtime and must be populated for normal system operation. Cc: Chasel Chiu Cc: Michael Kubacki Cc: Benjamin Doron Signed-off-by: Nate DeSimone --- .../Acpi/BoardAcpiDxe/AcpiGnvsInit.c | 58 ++++++++++++++++++- .../Acpi/BoardAcpiDxe/BoardAcpiDxe.inf | 12 +++- 2 files changed, 64 insertions(+), 6 deletions(-) diff --git a/Platform/Intel/KabylakeOpenBoardPkg/Acpi/BoardAcpiDxe/AcpiGnvs= Init.c b/Platform/Intel/KabylakeOpenBoardPkg/Acpi/BoardAcpiDxe/AcpiGnvsInit= .c index 0d9d217e38..5c32a6e04c 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/Acpi/BoardAcpiDxe/AcpiGnvsInit.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/Acpi/BoardAcpiDxe/AcpiGnvsInit +++ .c @@ -1,7 +1,7 @@ /** @file Acpi Gnvs Init Library. =20 -Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -11,11 +11,52 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include = #include #include +#include #include =20 #include #include #include +#include + +/** + A protocol callback which updates MMIO Base and Length in SA GNVS=20 +area + + @param[in] Event - The triggered event. + @param[in] Context - Context for this event. + +**/ +VOID +EFIAPI +UpdateSaGnvsForMmioResourceBaseLength ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + SYSTEM_AGENT_GLOBAL_NVS_AREA_PROTOCOL *SaGlobalNvsAreaProtocol; + + Status =3D gBS->LocateProtocol (&gSaGlobalNvsAreaProtocolGuid, NULL,=20 + (VOID **) &SaGlobalNvsAreaProtocol); if (Status !=3D EFI_SUCCESS) { + return; + } + gBS->CloseEvent (Event); + + // + // Configure MMIO Base/Length. This logic is only valid for platforms th= at use PciHostBridgeLibSimple. + // + DEBUG ((DEBUG_INFO, "[BoardAcpiDxe] Update SA GNVS Area.\n")); + SaGlobalNvsAreaProtocol->Area->Mmio32Base =3D PcdGet32=20 +(PcdPciReservedMemBase); + if (PcdGet32 (PcdPciReservedMemLimit) !=3D 0) { + SaGlobalNvsAreaProtocol->Area->Mmio32Length =3D PcdGet32=20 +(PcdPciReservedMemLimit) - PcdGet32 (PcdPciReservedMemBase) + 1; + } else { + SaGlobalNvsAreaProtocol->Area->Mmio32Length =3D ((UINT32) PcdGet64=20 +(PcdPciExpressBaseAddress)) - PcdGet32 (PcdPciReservedMemBase); + } + if (PcdGet64 (PcdPciReservedMemAbove4GBLimit) > PcdGet64 (PcdPciReserved= MemAbove4GBBase)) { + SaGlobalNvsAreaProtocol->Area->Mmio64Base =3D PcdGet64 (PcdPciReserv= edMemAbove4GBBase); + SaGlobalNvsAreaProtocol->Area->Mmio64Length =3D PcdGet64=20 +(PcdPciReservedMemAbove4GBLimit) - PcdGet64=20 +(PcdPciReservedMemAbove4GBBase) + 1; + } +} =20 /** @brief @@ -39,6 +80,7 @@ AcpiGnvsInit ( EFI_MP_SERVICES_PROTOCOL *MpService; UINTN NumberOfCPUs; UINTN NumberOfEnabledCPUs; + VOID *SaGlobalNvsRegistration; =20 Pages =3D EFI_SIZE_TO_PAGES (sizeof (EFI_GLOBAL_NVS_AREA)); Address =3D 0xffffffff; // allocate address below 4G. @@ -53,7 +95,7 @@ AcpiGnvsInit ( if (EFI_ERROR(Status)) { return Status; } - =20 + // // Locate the MP services protocol // Find the MP Protocol. This is an MP platform, so MP protocol must be = there. @@ -90,6 +132,16 @@ AcpiGnvsInit ( GNVS->Area->PL1LimitCS =3D 0; GNVS->Area->PL1LimitCSValue =3D 4500; =20 + // + // Update SA GNVS with MMIO Base/Length // =20 + EfiCreateProtocolNotifyEvent ( + &gSaGlobalNvsAreaProtocolGuid, + TPL_CALLBACK, + UpdateSaGnvsForMmioResourceBaseLength, + NULL, + &SaGlobalNvsRegistration + ); + return EFI_SUCCESS; } - diff --git a/Platform/Intel/KabylakeOpenBoardPkg/Acpi/BoardAcpiDxe/BoardAcp= iDxe.inf b/Platform/Intel/KabylakeOpenBoardPkg/Acpi/BoardAcpiDxe/BoardAcpiD= xe.inf index 7d2e105e54..5d3d4c3a2b 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/Acpi/BoardAcpiDxe/BoardAcpiDxe.in= f +++ b/Platform/Intel/KabylakeOpenBoardPkg/Acpi/BoardAcpiDxe/BoardAcpiDxe +++ .inf @@ -1,7 +1,7 @@ ### @file # Component information file for AcpiPlatform module # -# Copyright (c) = 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2021, Intel Corporation. All rights=20 +reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -38,6 +38,7 @@ PcdLib UefiBootServicesTableLib UefiRuntimeServicesTableLib + UefiLib BaseMemoryLib HobLib AslUpdateLib @@ -48,8 +49,15 @@ gEfiFirmwareVolume2ProtocolGuid ## CONSUMES gEfiMpServiceProtocolGuid ## CONSUMES gEfiGlobalNvsAreaProtocolGuid + gSaGlobalNvsAreaProtocolGuid ## CONSUMES =20 [Pcd] + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress + gMinPlatformPkgTokenSpaceGuid.PcdPciReservedMemBase + gMinPlatformPkgTokenSpaceGuid.PcdPciReservedMemLimit + gMinPlatformPkgTokenSpaceGuid.PcdPciReservedMemAbove4GBBase + gMinPlatformPkgTokenSpaceGuid.PcdPciReservedMemAbove4GBLimit + gKabylakeOpenBoardPkgTokenSpaceGuid.PcdAcpiGnvsAddress =20 gKabylakeOpenBoardPkgTokenSpaceGuid.PcdAcpiSleepState @@ -65,5 +73,3 @@ gEfiPciRootBridgeIoProtocolGuid AND gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid - - -- 2.27.0.windows.1