From patchwork Tue May 10 00:37:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 67384 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1858379qge; Mon, 9 May 2016 17:37:43 -0700 (PDT) X-Received: by 10.66.65.133 with SMTP id x5mr54779210pas.108.1462840663820; Mon, 09 May 2016 17:37:43 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id k66si23354796pfb.102.2016.05.09.17.37.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 May 2016 17:37:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4CC251A1F08; Mon, 9 May 2016 17:37:43 -0700 (PDT) X-Original-To: edk2-devel@ml01.01.org Delivered-To: edk2-devel@ml01.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B61571A1F02 for ; Mon, 9 May 2016 17:37:41 -0700 (PDT) Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4FDF5C03BD5F; Tue, 10 May 2016 00:37:41 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-38.phx2.redhat.com [10.3.113.38]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4A0bc8G001870; Mon, 9 May 2016 20:37:40 -0400 From: Laszlo Ersek To: edk2-devel-01 Date: Tue, 10 May 2016 02:37:30 +0200 Message-Id: <1462840655-1802-2-git-send-email-lersek@redhat.com> In-Reply-To: <1462840655-1802-1-git-send-email-lersek@redhat.com> References: <1462840655-1802-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 10 May 2016 00:37:41 +0000 (UTC) Subject: [edk2] [PATCH 1/6] OvmfPkg: rename PcdAcpiPmBaseAddress to PcdPiix4AcpiPmBaseAddress X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" In the next patches, we'll differentiate the PMBA IO port address that we program on PIIX4 vs. Q35. Normally we'd just turn PcdAcpiPmBaseAddress into a dynamic PCD. However, because we need this PCD in BaseRomAcpiTimerLib too (which cannot access RAM and dynamic PCDs), it must remain a fixed PCD. We will introduce its Q35 counterpart PCD later. (We only need these PCDs to enable build-time configuration, and symbolic references in the code. Introducing macros under "OvmfPkg/Include/IndustryStandard/" is not a good choice, because the values that the firmware programs are not standardized.) As first step, rename the PCD so it says "Piix4" in the name, plus update all client code to fetch it explicitly with FixedPcdGet16(). Cc: Jordan Justen Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1333238 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- OvmfPkg/OvmfPkg.dec | 2 +- OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf | 4 ++-- OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.inf | 4 ++-- OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf | 4 ++-- OvmfPkg/PlatformPei/PlatformPei.inf | 2 +- OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c | 3 ++- OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c | 3 ++- OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c | 5 +++-- OvmfPkg/PlatformPei/Platform.c | 3 ++- 9 files changed, 17 insertions(+), 13 deletions(-) -- 1.8.3.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec index 97ffb8749be3..d30a40eb153c 100644 --- a/OvmfPkg/OvmfPkg.dec +++ b/OvmfPkg/OvmfPkg.dec @@ -75,11 +75,11 @@ [PcdsFixedAtBuild] ## This flag is used to control the destination port for PlatformDebugLibIoPort gUefiOvmfPkgTokenSpaceGuid.PcdDebugIoPort|0x402|UINT16|4 ## This flag determines the Power Management Base Address of choice, written # to PIIX4 function 3 offset 0x40-0x43 bits [15:6]. - gUefiOvmfPkgTokenSpaceGuid.PcdAcpiPmBaseAddress|0xB000|UINT16|5 + gUefiOvmfPkgTokenSpaceGuid.PcdPiix4AcpiPmBaseAddress|0xB000|UINT16|5 ## When VirtioScsiDxe is instantiated for a HBA, the numbers of targets and # LUNs are retrieved from the host during virtio-scsi setup. # MdeModulePkg/Bus/Scsi/ScsiBusDxe then scans all MaxTarget * MaxLun # possible devices. This can take extremely long, for example with diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf index 4c0e6159554d..d3f2180d61f3 100644 --- a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf +++ b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf @@ -29,12 +29,12 @@ [Sources] [Packages] MdePkg/MdePkg.dec OvmfPkg/OvmfPkg.dec -[Pcd] - gUefiOvmfPkgTokenSpaceGuid.PcdAcpiPmBaseAddress +[FixedPcd] + gUefiOvmfPkgTokenSpaceGuid.PcdPiix4AcpiPmBaseAddress [LibraryClasses] BaseLib PciLib IoLib diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.inf b/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.inf index d5e50aef618d..7a889155cb16 100644 --- a/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.inf +++ b/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.inf @@ -28,12 +28,12 @@ [Sources] [Packages] MdePkg/MdePkg.dec OvmfPkg/OvmfPkg.dec -[Pcd] - gUefiOvmfPkgTokenSpaceGuid.PcdAcpiPmBaseAddress +[FixedPcd] + gUefiOvmfPkgTokenSpaceGuid.PcdPiix4AcpiPmBaseAddress [LibraryClasses] BaseLib PciLib IoLib diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf index b6a3ffe77254..a09827899c14 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf @@ -36,7 +36,7 @@ [Packages] [LibraryClasses] DebugLib IoLib TimerLib -[Pcd] - gUefiOvmfPkgTokenSpaceGuid.PcdAcpiPmBaseAddress \ No newline at end of file +[FixedPcd] + gUefiOvmfPkgTokenSpaceGuid.PcdPiix4AcpiPmBaseAddress diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/PlatformPei.inf index ed31b1f724b5..981532d95bd3 100644 --- a/OvmfPkg/PlatformPei/PlatformPei.inf +++ b/OvmfPkg/PlatformPei/PlatformPei.inf @@ -63,11 +63,10 @@ [LibraryClasses] [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvSize gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize - gUefiOvmfPkgTokenSpaceGuid.PcdAcpiPmBaseAddress gUefiOvmfPkgTokenSpaceGuid.PcdS3AcpiReservedMemoryBase gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesSize @@ -97,10 +96,11 @@ [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress [FixedPcd] gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress + gUefiOvmfPkgTokenSpaceGuid.PcdPiix4AcpiPmBaseAddress [FeaturePcd] gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire [Ppis] diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c index c3c50c05d31e..f722731ca4f6 100644 --- a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c +++ b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c @@ -71,11 +71,12 @@ AcpiTimerLibConstructor ( if ((PciRead8 (AcpiCtlReg) & AcpiEnBit) == 0) { // // If the Power Management Base Address is not programmed, // then program the Power Management Base Address from a PCD. // - PciAndThenOr32 (Pmba, (UINT32) ~0xFFC0, PcdGet16 (PcdAcpiPmBaseAddress)); + PciAndThenOr32 (Pmba, (UINT32) ~0xFFC0, + FixedPcdGet16 (PcdPiix4AcpiPmBaseAddress)); // // Enable PMBA I/O port decodes // PciOr8 (AcpiCtlReg, AcpiEnBit); diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c b/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c index 5164769f6020..b0ab783843a8 100644 --- a/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c +++ b/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c @@ -67,11 +67,12 @@ AcpiTimerLibConstructor ( if ((PciRead8 (AcpiCtlReg) & AcpiEnBit) == 0) { // // If the Power Management Base Address is not programmed, // then program the Power Management Base Address from a PCD. // - PciAndThenOr32 (Pmba, (UINT32) ~0xFFC0, PcdGet16 (PcdAcpiPmBaseAddress)); + PciAndThenOr32 (Pmba, (UINT32) ~0xFFC0, + FixedPcdGet16 (PcdPiix4AcpiPmBaseAddress)); // // Enable PMBA I/O port decodes // PciOr8 (AcpiCtlReg, AcpiEnBit); diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c index 6d149e84c21e..a61060833e84 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c @@ -25,12 +25,13 @@ AcpiPmControl ( UINTN SuspendType ) { ASSERT (SuspendType < 6); - IoBitFieldWrite16 (PcdGet16 (PcdAcpiPmBaseAddress) + 4, 10, 13, (UINT16) SuspendType); - IoOr16 (PcdGet16 (PcdAcpiPmBaseAddress) + 4, BIT13); + IoBitFieldWrite16 (FixedPcdGet16 (PcdPiix4AcpiPmBaseAddress) + 4, 10, 13, + (UINT16) SuspendType); + IoOr16 (FixedPcdGet16 (PcdPiix4AcpiPmBaseAddress) + 4, BIT13); CpuDeadLoop (); } /** Calling this function causes a system-wide reset. This sets diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index 4be9922aeb1f..e4e21da5aa9b 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -410,11 +410,12 @@ MiscInitialization ( if ((PciRead8 (AcpiCtlReg) & AcpiEnBit) == 0) { // // The PEI phase should be exited with fully accessibe ACPI PM IO space: // 1. set PMBA // - PciAndThenOr32 (Pmba, (UINT32) ~0xFFC0, PcdGet16 (PcdAcpiPmBaseAddress)); + PciAndThenOr32 (Pmba, (UINT32) ~0xFFC0, + FixedPcdGet16 (PcdPiix4AcpiPmBaseAddress)); // // 2. set PCICMD/IOSE // PciOr8 (PmCmd, EFI_PCI_COMMAND_IO_SPACE);