From patchwork Tue May 10 12:11:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 67445 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp2092134qge; Tue, 10 May 2016 05:15:01 -0700 (PDT) X-Received: by 10.140.217.208 with SMTP id n199mr32416301qhb.31.1462882501372; Tue, 10 May 2016 05:15:01 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f65si1210587qhe.24.2016.05.10.05.15.01; Tue, 10 May 2016 05:15:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 0A34861653; Tue, 10 May 2016 12:15:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id A0A18611FB; Tue, 10 May 2016 12:13:27 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 8F73C61676; Tue, 10 May 2016 12:13:17 +0000 (UTC) Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by lists.linaro.org (Postfix) with ESMTPS id 2C1D561657 for ; Tue, 10 May 2016 12:12:16 +0000 (UTC) Received: by mail-wm0-f46.google.com with SMTP id g17so23984386wme.1 for ; Tue, 10 May 2016 05:12:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2dVUKAAzMVnDh/ML6rX4ON/feroK4vRBegUPpW1QWL0=; b=RKznC/QCAY65w5OOzGJuj2Gzt79dJXdt9nxx5O6zvRSubqvedLIYdgUbI7x2guHW0S M0p9IWv4m8uJCDIOpJFPTIXNXSPDRPnwCiboHYpYTAlwQKd7VXrmSyIpxO6oo87EQtwC 9Hobf4Jv242CXW8T55QSy7wHXt4oD62975myRpx2LlbhtkipUl+dbLg8SY32KBdgZOOP S+VwTsfOQWJZAMdftBK88KgYNUplE20FwYXAh4eoFa80kdoE+5O/0rQ6ZG1M2jQj77D3 ivheNCx90gLSGY/bL7UFbTwsiSWhG6vUsgPFKV/2qzGi8SL116ZFSlEx0RXrDKDzQdbV AHUQ== X-Gm-Message-State: AOPr4FUb+Zw2JVEDEQ7v2nraw4NDNfFJnnA1yQkztWdSdp3m/LHpOynfCGg2geAyWYUOaqvMmdY= X-Received: by 10.28.2.67 with SMTP id 64mr16228317wmc.70.1462882335282; Tue, 10 May 2016 05:12:15 -0700 (PDT) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id m20sm2623084wma.23.2016.05.10.05.12.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 May 2016 05:12:14 -0700 (PDT) From: Ard Biesheuvel To: linaro-uefi@lists.linaro.org Date: Tue, 10 May 2016 14:11:48 +0200 Message-Id: <1462882313-7637-10-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1462882313-7637-1-git-send-email-ard.biesheuvel@linaro.org> References: <1462882313-7637-1-git-send-email-ard.biesheuvel@linaro.org> Cc: leo.duran@amd.com Subject: [Linaro-uefi] [PATCH 09/14] Platforms/AMD/Styx: move parking protocol handling to ACPI platform driver X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" Since ACPI is mandatory on ARM 64-bit servers while FDT support is optional, it makes sense to move shared functionality to the ACPI driver. So move the parking protocol code to AcpiPlatformDxe. This way, we can [conditionally] remove FdtDxe from the build without affecting ACPI parking protocol functionality. Note that this requires the dispatch of FdtDxe to be strictly order after the dispatch of ApciPlatformDxe, so update the FdtDxe Depex expression as well. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- Platforms/AMD/Styx/AmdStyx.dec | 3 +++ Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c | 7 +++++++ Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 15 ++++++++++++++- Platforms/AMD/Styx/{OverdriveBoard/FdtDxe/AArch64/BdsLinuxLoader.c => Drivers/AcpiPlatformDxe/AcpiPlatformParkingProtocol.c} | 13 +++++-------- Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformParkingProtocol.h | 19 +++++++++++++++++++ Platforms/AMD/Styx/{OverdriveBoard/FdtDxe/AArch64/BdsLinuxLoaderHelper.S => Drivers/AcpiPlatformDxe/AcpiPlatformParkingProtocolHelper.S} | 0 Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.c | 5 ----- Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.inf | 8 +------- 8 files changed, 49 insertions(+), 21 deletions(-) diff --git a/Platforms/AMD/Styx/AmdStyx.dec b/Platforms/AMD/Styx/AmdStyx.dec index ad65fc9eaf8b..3bdb4f83f858 100644 --- a/Platforms/AMD/Styx/AmdStyx.dec +++ b/Platforms/AMD/Styx/AmdStyx.dec @@ -42,6 +42,9 @@ gAmdStyxTokenSpaceGuid = { 0x220d9653, 0x4a0e, 0x40bc, { 0xb3, 0x65, 0x2f, 0xbb, 0xa2, 0xd9, 0x03, 0x45 } } gAmdStyxMpCoreInfoGuid = { 0x68efeabd, 0xcb77, 0x4aa5, { 0xbf, 0x0c, 0xa3, 0x31, 0xfc, 0xcf, 0x76, 0x66 } } + # used to manually order the dispatch of FdtDxe after AcpiPlatformDxe + gAmdStyxAcpiPlatformDxeFileGuid = { 0xf229c831, 0x6a35, 0x440b, { 0x9c, 0x84, 0xdd, 0x3b, 0xc7, 0x1e, 0x38, 0x65 } } + [PcdsDynamic] gAmdStyxTokenSpaceGuid.PcdSocCoreCount|1|UINT32|0x00000100 gAmdStyxTokenSpaceGuid.PcdSocCpuId|1|UINT32|0x00000101 diff --git a/Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c b/Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c index 36db0e2211f3..3b3d36eea007 100644 --- a/Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c +++ b/Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c @@ -26,6 +26,7 @@ #include #include +#include #define MAX_ACPI_TABLES 12 @@ -55,6 +56,12 @@ AcpiPlatformEntryPoint ( UINTN TableHandle; UINTN TableIndex; + // Move secondary cores to a Pen compliant with MP-Parking protocol + if (!FixedPcdGetBool (PcdPsciOsSupport) && + FixedPcdGetBool (PcdTrustedFWSupport)) { + AmdStyxParkSecondaryCores(); + } + ZeroMem(AcpiTableList, sizeof(AcpiTableList)); TableIndex = 0; diff --git a/Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf b/Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf index d78d7ef330d8..6a3d6ec0e949 100644 --- a/Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf +++ b/Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf @@ -28,10 +28,15 @@ [Sources] AcpiPlatform.c + AcpiPlatformParkingProtocol.c + +[Sources.AARCH64] + AcpiPlatformParkingProtocolHelper.S [Packages] MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec + AmdModulePkg/AmdModulePkg.dec OpenPlatformPkg/Platforms/AMD/Styx/AmdStyx.dec [LibraryClasses] @@ -44,10 +49,18 @@ UefiDriverEntryPoint AmdStyxHelperLib AmdStyxAcpiLib + ArmSmcLib + CacheMaintenanceLib + +[FixedPcd] + gAmdStyxTokenSpaceGuid.PcdParkingProtocolVersion + gAmdStyxTokenSpaceGuid.PcdParkingProtocolBase + gAmdStyxTokenSpaceGuid.PcdParkingProtocolSize + gAmdStyxTokenSpaceGuid.PcdPsciOsSupport + gAmdStyxTokenSpaceGuid.PcdTrustedFWSupport [Protocols] gEfiAcpiTableProtocolGuid # PROTOCOL ALWAYS_CONSUMED [Depex] gEfiAcpiTableProtocolGuid - diff --git a/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/AArch64/BdsLinuxLoader.c b/Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformParkingProtocol.c similarity index 91% rename from Platforms/AMD/Styx/OverdriveBoard/FdtDxe/AArch64/BdsLinuxLoader.c rename to Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformParkingProtocol.c index 6e0519edd9da..be85f3f442f0 100644 --- a/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/AArch64/BdsLinuxLoader.c +++ b/Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformParkingProtocol.c @@ -2,6 +2,7 @@ * * Copyright (c) 2011-2014, ARM Limited. All rights reserved.
* Copyright (c) 2014 - 2015, AMD Inc. All rights reserved.
+* Copyright (c) 2016, Linaro Ltd. All rights reserved.
* * This program and the accompanying materials * are licensed and made available under the terms and conditions of the BSD License @@ -18,11 +19,11 @@ **/ +#include +#include #include #include #include -#include -#include #include #include @@ -67,7 +68,7 @@ AmdStyxBringupSecondary ( VOID EFIAPI -AmdStyxParkSecondaryCores( +AmdStyxParkSecondaryCores ( VOID ) { @@ -104,11 +105,7 @@ AmdStyxParkSecondaryCores( // Reserve the memory as RuntimeServices Status = gBS->AllocatePages (AllocateAddress, EfiRuntimeServicesCode, EFI_SIZE_TO_PAGES (MpParkingSize ), &MpParkingBase ); - if (EFI_ERROR (Status)) { - Print (L"Warning: Failed to reserve memory for MP-Parking protocol at 0x%lX, Status = %r\n", - MpParkingBase, Status); - // Even if there is a risk of memory corruption we carry on - } + ASSERT_EFI_ERROR (Status); // Relocate the Pen code CopyMem ((VOID*)(PenBase), (VOID*)&SecondariesPenStart, PenSize); diff --git a/Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformParkingProtocol.h b/Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformParkingProtocol.h new file mode 100644 index 000000000000..fb79a803026d --- /dev/null +++ b/Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformParkingProtocol.h @@ -0,0 +1,19 @@ +/** @file +* +* Copyright (c) 2016, Linaro Ltd. All rights reserved.
+* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +VOID +EFIAPI +AmdStyxParkSecondaryCores ( + VOID + ); diff --git a/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/AArch64/BdsLinuxLoaderHelper.S b/Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformParkingProtocolHelper.S similarity index 100% rename from Platforms/AMD/Styx/OverdriveBoard/FdtDxe/AArch64/BdsLinuxLoaderHelper.S rename to Platforms/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformParkingProtocolHelper.S diff --git a/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.c b/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.c index 08430730f6ca..58599e8e1714 100644 --- a/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.c +++ b/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.c @@ -117,11 +117,6 @@ FdtReadyToBoot ( UINTN FdtBlobSize = 0; EFI_DEVICE_PATH *FdtDevicePath; - // Move secondary cores to a Pen complaint with MP-Parking protocol - if (!FixedPcdGetBool (PcdPsciOsSupport) && FixedPcdGetBool (PcdTrustedFWSupport)) { - AmdStyxParkSecondaryCores(); - } - // Search for FDT blob in EFI partition Status = FdtOverrideDevicePath(L"fdt.dtb", &FdtDevicePath); if (!EFI_ERROR (Status)) { diff --git a/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.inf b/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.inf index 5653cac39b71..813324f6d308 100644 --- a/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.inf +++ b/Platforms/AMD/Styx/OverdriveBoard/FdtDxe/FdtDxe.inf @@ -32,10 +32,6 @@ BdsLinuxFdt.c LinuxLoaderHelper.c -[Sources.AARCH64] - AArch64/BdsLinuxLoader.c - AArch64/BdsLinuxLoaderHelper.S | GCC - [Packages] ArmPkg/ArmPkg.dec EmbeddedPkg/EmbeddedPkg.dec @@ -78,8 +74,6 @@ gArmTokenSpaceGuid.PcdArmLinuxFdtAlignment gAmdStyxTokenSpaceGuid.PcdPsciOsSupport gAmdStyxTokenSpaceGuid.PcdTrustedFWSupport - gAmdStyxTokenSpaceGuid.PcdParkingProtocolBase - gAmdStyxTokenSpaceGuid.PcdParkingProtocolSize [Depex] - TRUE + AFTER gAmdStyxAcpiPlatformDxeFileGuid