From patchwork Tue Mar 29 15:32:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Duran, Leo" X-Patchwork-Id: 64605 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2083432lbc; Tue, 29 Mar 2016 08:32:26 -0700 (PDT) X-Received: by 10.98.14.207 with SMTP id 76mr4435533pfo.1.1459265546610; Tue, 29 Mar 2016 08:32:26 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id 66si2044122pfl.7.2016.03.29.08.32.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Mar 2016 08:32:26 -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; dkim=neutral (body hash did not verify) header.i=@amdcloud.onmicrosoft.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 0D2EA1A1E89; Tue, 29 Mar 2016 08:32:55 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0640.outbound.protection.outlook.com [IPv6:2a01:111:f400:fc10::640]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 89BCB1A1E83 for ; Tue, 29 Mar 2016 08:32:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=WnxH6BYDr9tTESu6a6bmKFRjDwwdD3d/KHvYSXb6YJw=; b=2fULlo1If6VykhtQBewQY1bnIb7bVny0BpaswdGxv5drQno1jJy6abpXxzHdwM/ye4wSfTyeAOBuPXuMHaRsxZ6n5O70vovEnVaK1+cMdWS+qP1WGTrWy3BEahwtJ9QFgeOS5fv6IA1dRIMYII9NORJl73ib5GnFRG/bjaXJ7m0= Received: from BY1PR12MB0520.namprd12.prod.outlook.com (10.162.147.17) by BY1PR12MB0519.namprd12.prod.outlook.com (10.162.147.16) with Microsoft SMTP Server (TLS) id 15.1.443.12; Tue, 29 Mar 2016 15:32:22 +0000 Received: from BY1PR12MB0520.namprd12.prod.outlook.com ([10.162.147.17]) by BY1PR12MB0520.namprd12.prod.outlook.com ([10.162.147.17]) with mapi id 15.01.0443.016; Tue, 29 Mar 2016 15:32:22 +0000 From: "Duran, Leo" To: "edk2-devel@lists.01.org" Thread-Topic: [PATCH] MdeModulePkg: support for ACPI tables only above 4GB's Thread-Index: AQHRhgwllZE+1JjrZUaMn4/+VNUjQZ9wk1/w Date: Tue, 29 Mar 2016 15:32:22 +0000 Message-ID: References: <1458851413-26577-1-git-send-email-leo.duran@amd.com> <1458851413-26577-9-git-send-email-leo.duran@amd.com> In-Reply-To: <1458851413-26577-9-git-send-email-leo.duran@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: lists.01.org; dkim=none (message not signed) header.d=none; lists.01.org; dmarc=none action=none header.from=amd.com; x-originating-ip: [165.204.77.1] x-ms-office365-filtering-correlation-id: 7759039f-6717-4abd-3bb1-08d357e752b7 x-microsoft-exchange-diagnostics: 1; BY1PR12MB0519; 5:okartG0g7EL/w7zs13iyNJfep7ZsdAdX4UAhu0WmDz62qtAybhm9rbdPI7X8kZOlzYnTsTc9xB51t6cPfaA831E716zfHaiuMANinBRhcc2KMKNWorVMlcZyZfMiZIm+M5MOEQ1SX9f8z5t+pRohtw==; 24:dAG6FjrUvmxTtGOCvnsZ9M2o0Glbi5rChRdwn9Fa9iMz2VNEorQA9cZ1Ce5gCI7P50tsl/CGnHfjSuG4zTpe9CxG96xZYvhcOq3fec1YbHo=; 20:Xp+ukfcV6bm8fqn7tBw1q3twzhnYJHPMFOIO7mnrtEMSGIRIA2H/gh1oVDjqtFmvMCOoAmGC4vSk1RMhtmcSuSdzqv7Y0kxZpluhqyyIGCYo+VmR4ijqu/xAt5UDyg6zM6itOqPWMOhZTCF1k8nMJ/qe+iKlxozW0yOl0/1xQhKi9QnquyZ4CZgdUJA5ijMt6YU35Q2Pn8mb/gxcUY8JzHPVJwD00EF5nipBMOB0wABPcWza5BHl2mNsyE0fmmav x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR12MB0519; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:BY1PR12MB0519; BCL:0; PCL:0; RULEID:; SRVR:BY1PR12MB0519; x-forefront-prvs: 0896BFCE6C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(13464003)(164054003)(377454003)(99286002)(4326007)(77096005)(19580405001)(19580395003)(122556002)(1220700001)(2501003)(5008740100001)(1096002)(81166005)(5002640100001)(66066001)(2351001)(11100500001)(2906002)(10400500002)(76576001)(3280700002)(2950100001)(3660700001)(92566002)(2900100001)(106116001)(5003600100002)(3900700001)(54356999)(6116002)(50986999)(74316001)(76176999)(3846002)(586003)(102836003)(33656002)(5004730100002)(110136002)(86362001)(189998001)(87936001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR12MB0519; H:BY1PR12MB0520.namprd12.prod.outlook.com; FPR:; SPF:None; MLV:sfv; LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Mar 2016 15:32:22.4455 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR12MB0519 Subject: Re: [edk2] [PATCH] MdeModulePkg: support for ACPI tables only above 4GB's 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: Leendert van Doorn , "leif.lindholm@linaro.org" , "ard.biesheuvel@linaro.org" Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" All, Please ignore (do not review/apply) this patch, as it pertains to the proposed "PcdAcpiNo32BitAddressSupport". I will follow-up with single line change that I found to be required. Thanks, Leo. -----Original Message----- From: Duran, Leo Sent: Thursday, March 24, 2016 3:30 PM To: edk2-devel@lists.01.org Cc: ard.biesheuvel@linaro.org; leif.lindholm@linaro.org; Leendert van Doorn; Duran, Leo Subject: [PATCH] MdeModulePkg: support for ACPI tables only above 4GB's From: Leendert van Doorn Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Leo Duran --- MdeModulePkg/MdeModulePkg.dec | 6 ++++ .../Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf | 3 +- .../Acpi/AcpiTableDxe/AcpiTableProtocol.c | 41 ++++++++++++++-------- 3 files changed, 35 insertions(+), 15 deletions(-) // // Update pointers in FADT. If tables don't exist this will put NULL pointers there. // - AcpiTableInstance->Fadt1->FirmwareCtrl = (UINT32) (UINTN) AcpiTableInstance->Facs1; - AcpiTableInstance->Fadt1->Dsdt = (UINT32) (UINTN) AcpiTableInstance->Dsdt1; + if (!FeaturePcdGet (PcdAcpiNo32BitAddressSupport)) { + AcpiTableInstance->Fadt1->FirmwareCtrl = (UINT32) (UINTN) AcpiTableInstance->Facs1; + AcpiTableInstance->Fadt1->Dsdt = (UINT32) (UINTN) AcpiTableInstance->Dsdt1; + } // // RSDP OEM information is updated to match the FADT OEM information @@ -633,7 +637,8 @@ AddTableToList ( // Note: If the FIRMWARE_CTRL is non-zero, then X_FIRMWARE_CTRL must be zero, and // vice-versa. // - if ((UINT64)(UINTN)AcpiTableInstance->Facs3 < BASE_4GB) { + if (!FeaturePcdGet (PcdAcpiNo32BitAddressSupport) && + (UINT64)(UINTN)AcpiTableInstance->Facs3 < BASE_4GB) { AcpiTableInstance->Fadt3->FirmwareCtrl = (UINT32) (UINTN) AcpiTableInstance->Facs3; ZeroMem (&AcpiTableInstance->Fadt3->XFirmwareCtrl, sizeof (UINT64)); } else { @@ -645,7 +650,8 @@ AddTableToList ( ); AcpiTableInstance->Fadt3->FirmwareCtrl = 0; } - if ((UINT64)(UINTN)AcpiTableInstance->Dsdt3 < BASE_4GB) { + if (!FeaturePcdGet (PcdAcpiNo32BitAddressSupport) && + (UINT64)(UINTN)AcpiTableInstance->Dsdt3 < BASE_4GB) { AcpiTableInstance->Fadt3->Dsdt = (UINT32) (UINTN) AcpiTableInstance->Dsdt3; ZeroMem (&AcpiTableInstance->Fadt3->XDsdt, sizeof (UINT64)); } else { @@ -741,7 +747,8 @@ AddTableToList ( // If FADT already exists, update table pointers. // if (AcpiTableInstance->Fadt1 != NULL) { - AcpiTableInstance->Fadt1->FirmwareCtrl = (UINT32) (UINTN) AcpiTableInstance->Facs1; + if (!FeaturePcdGet (PcdAcpiNo32BitAddressSupport)) + AcpiTableInstance->Fadt1->FirmwareCtrl = (UINT32) (UINTN) + AcpiTableInstance->Facs1; // // Checksum FADT table @@ -769,7 +776,8 @@ AddTableToList ( // Note: If the FIRMWARE_CTRL is non-zero, then X_FIRMWARE_CTRL must be zero, and // vice-versa. // - if ((UINT64)(UINTN)AcpiTableInstance->Facs3 < BASE_4GB) { + if (!FeaturePcdGet (PcdAcpiNo32BitAddressSupport) && + (UINT64)(UINTN)AcpiTableInstance->Facs3 < BASE_4GB) { AcpiTableInstance->Fadt3->FirmwareCtrl = (UINT32) (UINTN) AcpiTableInstance->Facs3; ZeroMem (&AcpiTableInstance->Fadt3->XFirmwareCtrl, sizeof (UINT64)); } else { @@ -825,7 +833,8 @@ AddTableToList ( // If FADT already exists, update table pointers. // if (AcpiTableInstance->Fadt1 != NULL) { - AcpiTableInstance->Fadt1->Dsdt = (UINT32) (UINTN) AcpiTableInstance->Dsdt1; + if (!FeaturePcdGet (PcdAcpiNo32BitAddressSupport)) + AcpiTableInstance->Fadt1->Dsdt = (UINT32) (UINTN) + AcpiTableInstance->Dsdt1; // // Checksum FADT table @@ -849,7 +858,8 @@ AddTableToList ( // If FADT already exists, update table pointers. // if (AcpiTableInstance->Fadt3 != NULL) { - if ((UINT64)(UINTN)AcpiTableInstance->Dsdt3 < BASE_4GB) { + if (!FeaturePcdGet (PcdAcpiNo32BitAddressSupport) && + (UINT64)(UINTN)AcpiTableInstance->Dsdt3 < BASE_4GB) { AcpiTableInstance->Fadt3->Dsdt = (UINT32) (UINTN) AcpiTableInstance->Dsdt3; } Buffer64 = (UINT64) (UINTN) AcpiTableInstance->Dsdt3; @@ -1645,7 +1655,8 @@ AcpiTableAcpiTableConstructor ( // If ACPI v1.0b is among the ACPI versions we aim to support, we have to // ensure that all memory allocations are below 4 GB. // - if ((PcdGet32 (PcdAcpiExposedTableVersions) & EFI_ACPI_TABLE_VERSION_1_0B) != 0) { + if (!FeaturePcdGet (PcdAcpiNo32BitAddressSupport) && + (PcdGet32 (PcdAcpiExposedTableVersions) & + EFI_ACPI_TABLE_VERSION_1_0B) != 0) { mAcpiTableAllocType = AllocateMaxAddress; } else { mAcpiTableAllocType = AllocateAnyPages; @@ -1744,7 +1755,8 @@ AcpiTableAcpiTableConstructor ( CopyMem (&AcpiTableInstance->Rsdp1->Signature, &CurrentData, sizeof (UINT64)); CopyMem (AcpiTableInstance->Rsdp1->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (AcpiTableInstance->Rsdp1->OemId)); AcpiTableInstance->Rsdp1->Reserved = EFI_ACPI_RESERVED_BYTE; - AcpiTableInstance->Rsdp1->RsdtAddress = (UINT32) (UINTN) AcpiTableInstance->Rsdt1; + if (!FeaturePcdGet (PcdAcpiNo32BitAddressSupport)) + AcpiTableInstance->Rsdp1->RsdtAddress = (UINT32) (UINTN) + AcpiTableInstance->Rsdt1; } CurrentData = EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE; @@ -1752,7 +1764,8 @@ AcpiTableAcpiTableConstructor ( CopyMem (AcpiTableInstance->Rsdp3->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (AcpiTableInstance->Rsdp3->OemId)); AcpiTableInstance->Rsdp3->Revision = EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION; AcpiTableInstance->Rsdp3->Length = sizeof (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER); - if ((PcdGet32 (PcdAcpiExposedTableVersions) & EFI_ACPI_TABLE_VERSION_1_0B) != 0) { + if (!FeaturePcdGet (PcdAcpiNo32BitAddressSupport) && + (PcdGet32 (PcdAcpiExposedTableVersions) & + EFI_ACPI_TABLE_VERSION_1_0B) != 0) { AcpiTableInstance->Rsdp3->RsdtAddress = (UINT32) (UINTN) AcpiTableInstance->Rsdt3; } CurrentData = (UINT64) (UINTN) AcpiTableInstance->Xsdt; -- 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 1a20561..61db352 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -651,6 +651,12 @@ # @Prompt Enable PEI StatusCode replay in DXE phase gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeReplayIn|FALSE|BOOLEAN|0x0001002d + ## Indicates if ACPI will create an RSDT and XSDT table.

## + The RSDT contains 32-bit points and hence has to lie in 0-4GB + memory.
## Setting this to TRUE will only generate an XSDT with + 64-bit pointers.
# @Prompt Enable ACPI 64-bit pointers. + + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiNo32BitAddressSupport|FALSE|BOOL + EAN|0x0001002e + ## Indicates if ACPI SDT protocol will be installed.

# TRUE - Installs ACPI SDT protocol.
# FALSE - Does not install ACPI SDT protocol.
diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf index 3ec39c0..aff7599 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf @@ -60,7 +60,8 @@ gEfiAcpiTableGuid ## PRODUCES ## SystemTable [FeaturePcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiNo32BitAddressSupport ## CONSUMES [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId ## CONSUMES diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c index 7f95b9d..7872c2b 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c @@ -167,7 +167,8 @@ PublishTables ( // Add the RSD_PTR to the system table and store that we have installed the // tables. // - if ((Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) { + if (!FeaturePcdGet (PcdAcpiNo32BitAddressSupport) && + (Version & EFI_ACPI_TABLE_VERSION_1_0B) != 0) { Status = gBS->InstallConfigurationTable (&gEfiAcpi10TableGuid, AcpiTableInstance->Rsdp1); if (EFI_ERROR (Status)) { return EFI_ABORTED; @@ -393,7 +394,8 @@ ReallocateAcpiTableBuffer ( // // Update RSDP to point to the new Rsdt and Xsdt address. // - if ((PcdGet32 (PcdAcpiExposedTableVersions) & EFI_ACPI_TABLE_VERSION_1_0B) != 0) { + if (!FeaturePcdGet (PcdAcpiNo32BitAddressSupport) && + (PcdGet32 (PcdAcpiExposedTableVersions) & + EFI_ACPI_TABLE_VERSION_1_0B) != 0) { AcpiTableInstance->Rsdp1->RsdtAddress = (UINT32) (UINTN) AcpiTableInstance->Rsdt1; AcpiTableInstance->Rsdp3->RsdtAddress = (UINT32) (UINTN) AcpiTableInstance->Rsdt3; } @@ -518,7 +520,7 @@ AddTableToList ( // ASSERT ((EFI_PAGE_SIZE % 64) == 0); Status = gBS->AllocatePages ( - AllocateMaxAddress, + mAcpiTableAllocType, EfiACPIMemoryNVS, CurrentTableList->NumberOfPages, &CurrentTableList->PageAddress @@ -593,8 +595,10 @@ AddTableToList (