From nobody Sat May 4 08:39:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+79079+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+79079+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1628653555; cv=none; d=zohomail.com; s=zohoarc; b=JBADYLpeHqq4EvApNM40TduhVJ3conwgnQnG8ufZlDWPSn2yWCwNEVTyXAB2RpZQPSfvJMQhFmVw1guKgkgf59ywfljjteNJ0cW8BVXCNfk4TAFLPQdhrvfyKEsxsEbpPiMETuGGYFZG6QtqgKuuwQSRGGvE+yluQyxAxxJZYro= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628653555; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=8H5K4Eh0xjOhSYkl/kyQfjDH7IwgT8G2EqtokJOKl/Q=; b=KCKTRNO/cV9yWnHg2HztRzMa4B7zAnm1EthnPoKXeK87ORq8HDI5CGFC5Rv8p2duVTo0UFjFxcRuBZPpvRO00KZmoGwBfhB5wjcf2MCsrGnugDwXjB0v+IdWHt98+h9P4HfjrNQaNudZ6xI5jHt5yOty+hIxPtmw+RarHxL5Twc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+79079+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1628653554836784.2354435784234; Tue, 10 Aug 2021 20:45:54 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id lVZkYY1788612xnidXCWVZnz; Tue, 10 Aug 2021 20:45:54 -0700 X-Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web08.3259.1628653553321629175 for ; Tue, 10 Aug 2021 20:45:53 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10072"; a="202214946" X-IronPort-AV: E=Sophos;i="5.84,311,1620716400"; d="scan'208";a="202214946" X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2021 20:45:52 -0700 X-IronPort-AV: E=Sophos;i="5.84,311,1620716400"; d="scan'208";a="526618362" X-Received: from nldesimo-desk1.amr.corp.intel.com ([10.209.11.68]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2021 20:45:52 -0700 From: "Nate DeSimone" To: devel@edk2.groups.io Cc: Chasel Chiu , Michael Kubacki , Benjamin Doron Subject: [edk2-devel] [edk2-platforms] [PATCH V2] KabylakeOpenBoardPkg: Add MMIO Base/Length to SA GNVS Date: Tue, 10 Aug 2021 20:45:48 -0700 Message-Id: <20210811034548.27675-1-nathaniel.l.desimone@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nathaniel.l.desimone@intel.com X-Gm-Message-State: qvtvIRlFCMwN1nzWDCfoHxwex1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1628653554; bh=YOojUbO+lXnjAymJOm2HGJBSANb5SbSsat5Z8AcYyBk=; h=Cc:Date:From:Reply-To:Subject:To; b=diSv769TfBAX6SQ7AwiuJdj8oInGG2A/78UHUKYgCD0b3/U/a45IJ4gm0i3c37BQebI dXcXjFhXSkooCKRZ9cHKh7mDscepYRSCYjurWuazno/HTaMgZI4CpA4wO+biPJ1Ni+8fo STYuVqi/MZ+pHDZbJEMelEOtm5J5tW6BZhE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1628653557059100002 Content-Type: text/plain; charset="utf-8" The SA GNVS Area contains fields for the MMIO region base address and length. 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 Acked-by: Michael Kubacki < michael.kubacki@microsoft.com > Reviewed-by: Chasel Chiu --- .../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 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, (VO= ID **) &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 (PcdPciReservedMe= mBase); + if (PcdGet32 (PcdPciReservedMemLimit) !=3D 0) { + SaGlobalNvsAreaProtocol->Area->Mmio32Length =3D PcdGet32 (PcdPciReserv= edMemLimit) - PcdGet32 (PcdPciReservedMemBase) + 1; + } else { + SaGlobalNvsAreaProtocol->Area->Mmio32Length =3D ((UINT32) PcdGet64 (Pc= dPciExpressBaseAddress)) - PcdGet32 (PcdPciReservedMemBase); + } + if (PcdGet64 (PcdPciReservedMemAbove4GBLimit) > PcdGet64 (PcdPciReserved= MemAbove4GBBase)) { + SaGlobalNvsAreaProtocol->Area->Mmio64Base =3D PcdGet64 (PcdPciReserv= edMemAbove4GBBase); + SaGlobalNvsAreaProtocol->Area->Mmio64Length =3D PcdGet64 (PcdPciReserv= edMemAbove4GBLimit) - PcdGet64 (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 + // + 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.inf +++ 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 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 - - --=20 2.27.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#79079): https://edk2.groups.io/g/devel/message/79079 Mute This Topic: https://groups.io/mt/84809603/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-