From patchwork Thu Dec 6 12:12:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 153009 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp10447535ljp; Thu, 6 Dec 2018 04:12:15 -0800 (PST) X-Google-Smtp-Source: AFSGD/XQzWCtwOlDS26n0OJsKGka7IWszv+kUAhEZ0p8JwFTfvYzli4OfYstbe7GNJdYG2RzcJ+y X-Received: by 2002:a63:d157:: with SMTP id c23mr23662560pgj.170.1544098335572; Thu, 06 Dec 2018 04:12:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544098335; cv=none; d=google.com; s=arc-20160816; b=05ECYO0C1N8zqxXKETyBqykv/tiJckSR0rhHLaD7DddranJMgZZpOJ44y5/WzE3bTu ogGDUesn22uXfTGVSrhTHbklwqeCmtCCE5oSIZ59ShwLKwRxAgUHhkpXkyTkgpqXbtgE 7eGJz2sRFxbttXB0Hg4JhWjCqdNJgs2jF429+zbrniR1Fn9V8HAewgmUMIhVU/xzd7vF eXyGIlWoNBxdxw33JcHpE92c8QUW77oOmyYLZhbhrmjMB+qTXRqgVPuGctCdBzTqEypw RDUb4GfdxWSlwWc60fpJ3dzmvhN2WT7HY8ShA8/I+eFC0wLaGGO5fyiACpBoJMY17lHf g0WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=KIJiwUGNqK39kzKjvZA4zVQsX2dD46ZMbt5F24uOqTE=; b=VKg9Z1adRERKrgw1pTk3dELHLKXADnvjdk8byYIFSc5Nvy2InGZRgQsELiyLBxEwEZ QuQw7a/8ruOv786Ku0cKM3LURrtGjr8E/2itN5xaFikJdYf/ywKmc5PoN34BU8FJ7kDe w4UMWScYliMRjjmDaVPi/4gFwfMuBwwsVJN6SgaT+ylVrjHbKZJndNDJoWwqan6iij0e Bpi8chY9LcZ76XgLnSgJooJO29HbFe1ClEyqZh/x991di3ts0xQoKCpkPiS1RmO57fsF RMnzFwNBhcchSHcrac1TWXA/28oQdjJhztXcVfr/dLjvm+zbQCJ8Q+BUauX5F8HiFuK+ jHAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=LHcQ7N1Q; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id v9si177528pgo.23.2018.12.06.04.12.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Dec 2018 04:12:15 -0800 (PST) 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=@linaro.org header.s=google header.b=LHcQ7N1Q; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1F69B21199269; Thu, 6 Dec 2018 04:12:15 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::341; helo=mail-wm1-x341.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 526ED211963F9 for ; Thu, 6 Dec 2018 04:12:13 -0800 (PST) Received: by mail-wm1-x341.google.com with SMTP id n190so778112wmd.0 for ; Thu, 06 Dec 2018 04:12:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GIdtzvhP58JDmTag0O2YtH9BNQ0SjFF5rx90rrMpc84=; b=LHcQ7N1Qu9xpuUxoF00est7i5X9TEIxMbZCsVHNsob/AjVQZTf9an/LkwwGx5nyphm yy1WFS9DFepOy0Qwv092abCFk0Y7/M6GVrRJF0JrYEior+T6SCUBoamdU9xM+N47ghp4 YuGUGK5RHhietkN6pzgjfu/KNXyS/Hk4NTM7I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GIdtzvhP58JDmTag0O2YtH9BNQ0SjFF5rx90rrMpc84=; b=quG9JHglWDmNNxkvLHXUlSI6NSDWS7xPvMpeT5DBQLSiLPavJ1OdyT6DdK5C+uP2ED 2Qp4JhF2BUHWrao1ijJMq9mC8yNwwzEpq5KE+tAa5A2Js+XkonHAFwjZ47dYAu/s5ot5 92F9WOpJfQSQVawBDBKhsLbeh4u5ZPFD/VWDhs0oPmk1tm8virc7Kt/zvQznKiwwoxmz gjzzZvzefDQK7QOmDlM+efXxztWwnUuaeNzksO8+3MXViJ9w3s5myCNANt4BCKp4wdhd eXZija2ZqJ0wlzlgAW7fC/CJIzVErkvioGTKx/nRO7Pxc7iotYy3jiHO4TFMhuQaZkw2 dkyA== X-Gm-Message-State: AA+aEWackLyRhUv5WSy1ixWddBKh7BFRNWDRrXBdCBQeypm4ElLL8DSs QSxHc/nLhRvr9o+0kBY4r7FevONuQ5JbwQ== X-Received: by 2002:a1c:400b:: with SMTP id n11mr19763652wma.85.1544098330992; Thu, 06 Dec 2018 04:12:10 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:992c:f260:a375:8d9e]) by smtp.gmail.com with ESMTPSA id d5sm405558wrx.22.2018.12.06.04.12.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Dec 2018 04:12:10 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 6 Dec 2018 13:12:03 +0100 Message-Id: <20181206121204.4057-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181206121204.4057-1-ard.biesheuvel@linaro.org> References: <20181206121204.4057-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [PATCH edk2-platforms 1/2] Silicon/AMD/Styx: merge ACPI table drivers X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alan@softiron.co.uk Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" ACPI table support on Seattle is split into two parts for no good reason: AcpiPlatformDxe and AmdStyxAcpiLib. Let's merge them together, and clean up the code that iterates over the tables and installs them. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Platform/AMD/OverdriveBoard/OverdriveBoard.dsc | 1 - Platform/LeMaker/CelloBoard/CelloBoard.dsc | 1 - Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc | 1 - Platform/AMD/OverdriveBoard/OverdriveBoard.fdf | 1 + Platform/LeMaker/CelloBoard/CelloBoard.fdf | 1 + Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.fdf | 1 + Silicon/AMD/Styx/AcpiTables/AcpiTables.inf | 85 -------------- Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 31 +++++- Silicon/AMD/Styx/{Common/AmdStyxAcpiLib.h => Drivers/AcpiPlatformDxe/AcpiPlatform.h} | 9 -- Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c | 117 +++++++++----------- Silicon/AMD/Styx/{AcpiTables => Drivers/AcpiPlatformDxe}/Madt.c | 3 +- Silicon/AMD/Styx/{AcpiTables/Csrt.c => Drivers/AcpiPlatformDxe/Csrt.aslc} | 13 +-- Silicon/AMD/Styx/{AcpiTables/Dbg2.c => Drivers/AcpiPlatformDxe/Dbg2.aslc} | 12 +- Silicon/AMD/Styx/{AcpiTables/Fadt.c => Drivers/AcpiPlatformDxe/Fadt.aslc} | 11 +- Silicon/AMD/Styx/{AcpiTables/Gtdt.c => Drivers/AcpiPlatformDxe/Gtdt.aslc} | 20 +--- Silicon/AMD/Styx/{AcpiTables/Iort.c => Drivers/AcpiPlatformDxe/Iort.aslc} | 19 +--- Silicon/AMD/Styx/{AcpiTables/Mcfg.c => Drivers/AcpiPlatformDxe/Mcfg.aslc} | 13 +-- Silicon/AMD/Styx/{AcpiTables/Pptt.c => Drivers/AcpiPlatformDxe/Pptt.aslc} | 10 +- Silicon/AMD/Styx/{AcpiTables/Spcr.c => Drivers/AcpiPlatformDxe/Spcr.aslc} | 12 +- 19 files changed, 108 insertions(+), 253 deletions(-) -- 2.19.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc index 2843e51f93f7..87731357e2eb 100644 --- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc +++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc @@ -121,7 +121,6 @@ DEFINE DO_CAPSULE = FALSE # Styx specific libraries # AmdSataInit|Silicon/AMD/Styx/AmdModulePkg/Library/AmdSataInitLib/AmdSataInitLib.inf - AmdStyxAcpiLib|Silicon/AMD/Styx/AcpiTables/AcpiTables.inf ResetSystemLib|ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf RealTimeClockLib|Silicon/AMD/Styx/Library/RealTimeClockLib/RealTimeClockLib.inf diff --git a/Platform/LeMaker/CelloBoard/CelloBoard.dsc b/Platform/LeMaker/CelloBoard/CelloBoard.dsc index 057bf0eb67de..29e740695366 100644 --- a/Platform/LeMaker/CelloBoard/CelloBoard.dsc +++ b/Platform/LeMaker/CelloBoard/CelloBoard.dsc @@ -118,7 +118,6 @@ DEFINE DO_FLASHER = FALSE # Styx specific libraries # AmdSataInit|Silicon/AMD/Styx/AmdModulePkg/Library/AmdSataInitLib/AmdSataInitLib.inf - AmdStyxAcpiLib|Silicon/AMD/Styx/AcpiTables/AcpiTables.inf ResetSystemLib|ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf RealTimeClockLib|Silicon/AMD/Styx/Library/RealTimeClockLib/RealTimeClockLib.inf diff --git a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc index 985ba2253a90..f342cf82d251 100644 --- a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc +++ b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc @@ -117,7 +117,6 @@ DEFINE DO_FLASHER = FALSE # Styx specific libraries # AmdSataInit|Silicon/AMD/Styx/AmdModulePkg/Library/AmdSataInitLib/AmdSataInitLib.inf - AmdStyxAcpiLib|Silicon/AMD/Styx/AcpiTables/AcpiTables.inf ResetSystemLib|ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf RealTimeClockLib|Silicon/AMD/Styx/Library/RealTimeClockLib/RealTimeClockLib.inf diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.fdf b/Platform/AMD/OverdriveBoard/OverdriveBoard.fdf index 96df83e0da5a..c7e27e20ad4a 100644 --- a/Platform/AMD/OverdriveBoard/OverdriveBoard.fdf +++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.fdf @@ -454,6 +454,7 @@ CAPSULE_HEADER_INIT_VERSION = 0x1 PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi UI STRING="$(MODULE_NAME)" Optional RAW ASL Optional |.aml + RAW ACPI Optional |.acpi } [Rule.Common.DXE_RUNTIME_DRIVER] diff --git a/Platform/LeMaker/CelloBoard/CelloBoard.fdf b/Platform/LeMaker/CelloBoard/CelloBoard.fdf index fc977f14b5a1..6362257deb8c 100644 --- a/Platform/LeMaker/CelloBoard/CelloBoard.fdf +++ b/Platform/LeMaker/CelloBoard/CelloBoard.fdf @@ -365,6 +365,7 @@ READ_LOCK_STATUS = TRUE PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi UI STRING="$(MODULE_NAME)" Optional RAW ASL Optional |.aml + RAW ACPI Optional |.acpi } [Rule.Common.DXE_RUNTIME_DRIVER] diff --git a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.fdf b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.fdf index 8fc9a979aebc..9ba98dd83767 100644 --- a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.fdf +++ b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.fdf @@ -367,6 +367,7 @@ READ_LOCK_STATUS = TRUE PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi UI STRING="$(MODULE_NAME)" Optional RAW ASL Optional |.aml + RAW ACPI Optional |.acpi } [Rule.Common.DXE_RUNTIME_DRIVER] diff --git a/Silicon/AMD/Styx/AcpiTables/AcpiTables.inf b/Silicon/AMD/Styx/AcpiTables/AcpiTables.inf deleted file mode 100644 index 0bc5b1e98964..000000000000 --- a/Silicon/AMD/Styx/AcpiTables/AcpiTables.inf +++ /dev/null @@ -1,85 +0,0 @@ -#/** @file -# Sample ACPI Platform Driver -# -# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
-# Copyright (c) 2014 - 2016, AMD Inc. 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. -# -#**/ -#/** -# -# Derived from: -# MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf -# -#**/ - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = AmdStyxAcpiLib - FILE_GUID = 74850e9e-371c-43af-b1fe-794d61505ad0 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = AmdStyxAcpiLib - -[Sources] - Gtdt.c - Fadt.c - Dbg2.c - Spcr.c - Madt.c - Mcfg.c - Csrt.c - Iort.c - Pptt.c - -[Packages] - ArmPkg/ArmPkg.dec - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - Silicon/AMD/Styx/AmdModulePkg/AmdModulePkg.dec - Silicon/AMD/Styx/AmdStyx.dec - -[LibraryClasses] - PcdLib - DebugLib - UefiBootServicesTableLib - -[Protocols] - gAmdMpCoreInfoProtocolGuid ## CONSUMED - -[Pcd] - gAmdStyxTokenSpaceGuid.PcdSocCoreCount - gAmdStyxTokenSpaceGuid.PcdSocCpuId - -[FixedPcd] - gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase - gArmTokenSpaceGuid.PcdGicDistributorBase - gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase - gAmdStyxTokenSpaceGuid.PcdSerialDbgRegisterBase - gAmdStyxTokenSpaceGuid.PcdGicVersion - gAmdStyxTokenSpaceGuid.PcdGicHypervisorInterruptInterfaceBase - gAmdStyxTokenSpaceGuid.PcdGicVirtualInterruptInterfaceBase - gAmdStyxTokenSpaceGuid.PcdGicVirtualMaintenanceInterrupt - gAmdStyxTokenSpaceGuid.PcdGicVirtualRegisterInterfaceBase - gAmdStyxTokenSpaceGuid.PcdGicMSIFrameBase - gAmdStyxTokenSpaceGuid.PcdCntControlBase - gAmdStyxTokenSpaceGuid.PcdCntReadBase - gAmdStyxTokenSpaceGuid.PcdCntCTLBase - gAmdStyxTokenSpaceGuid.PcdCntBase0 - gAmdStyxTokenSpaceGuid.PcdCntEL0Base0 - gAmdStyxTokenSpaceGuid.PcdSbsaWatchDogRefreshBase - gAmdStyxTokenSpaceGuid.PcdSbsaWatchDogControlBase - gAmdStyxTokenSpaceGuid.PcdSbsaWakeUpGSIV - gAmdStyxTokenSpaceGuid.PcdSbsaWatchDogGSIV - gAmdStyxTokenSpaceGuid.PcdSocCoresPerCluster - gAmdStyxTokenSpaceGuid.PcdSata1PortCount - -[Depex] - gAmdMpCoreInfoProtocolGuid diff --git a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf index 92f185fa4bee..95745db00ff3 100644 --- a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf +++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf @@ -28,7 +28,16 @@ [Sources] AcpiPlatform.c + Csrt.aslc + Dbg2.aslc Dsdt.asl + Fadt.aslc + Gtdt.aslc + Iort.aslc + Madt.c + Mcfg.aslc + Pptt.aslc + Spcr.aslc SsdtB1.asl SsdtXgbe.asl @@ -40,7 +49,6 @@ Silicon/AMD/Styx/AmdStyx.dec [LibraryClasses] - AmdStyxAcpiLib BaseLib BaseMemoryLib DebugLib @@ -54,12 +62,33 @@ gAmdStyxTokenSpaceGuid.PcdEthMacA gAmdStyxTokenSpaceGuid.PcdEthMacB gAmdStyxTokenSpaceGuid.PcdEnableSmmus + gAmdStyxTokenSpaceGuid.PcdSocCoreCount gAmdStyxTokenSpaceGuid.PcdSocCpuId [FixedPcd] + gAmdStyxTokenSpaceGuid.PcdCntControlBase + gAmdStyxTokenSpaceGuid.PcdCntReadBase + gAmdStyxTokenSpaceGuid.PcdCntCTLBase + gAmdStyxTokenSpaceGuid.PcdCntBase0 + gAmdStyxTokenSpaceGuid.PcdCntEL0Base0 + gAmdStyxTokenSpaceGuid.PcdGicVersion + gAmdStyxTokenSpaceGuid.PcdGicHypervisorInterruptInterfaceBase + gAmdStyxTokenSpaceGuid.PcdGicVirtualInterruptInterfaceBase + gAmdStyxTokenSpaceGuid.PcdGicVirtualMaintenanceInterrupt + gAmdStyxTokenSpaceGuid.PcdGicVirtualRegisterInterfaceBase + gAmdStyxTokenSpaceGuid.PcdGicMSIFrameBase gAmdStyxTokenSpaceGuid.PcdSata1PortCount + gAmdStyxTokenSpaceGuid.PcdSbsaWatchDogRefreshBase + gAmdStyxTokenSpaceGuid.PcdSbsaWatchDogControlBase + gAmdStyxTokenSpaceGuid.PcdSbsaWakeUpGSIV + gAmdStyxTokenSpaceGuid.PcdSbsaWatchDogGSIV + gAmdStyxTokenSpaceGuid.PcdSerialDbgRegisterBase + gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase + gArmTokenSpaceGuid.PcdGicDistributorBase + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase [Protocols] + gAmdMpCoreInfoProtocolGuid ## CONSUMED gEfiAcpiTableProtocolGuid ## ALWAYS_CONSUMED [Depex] diff --git a/Silicon/AMD/Styx/Common/AmdStyxAcpiLib.h b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.h similarity index 83% rename from Silicon/AMD/Styx/Common/AmdStyxAcpiLib.h rename to Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.h index 0dfd7635e897..b1864131795a 100644 --- a/Silicon/AMD/Styx/Common/AmdStyxAcpiLib.h +++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.h @@ -18,16 +18,7 @@ #include -EFI_ACPI_DESCRIPTION_HEADER *FadtTable (void); -EFI_ACPI_DESCRIPTION_HEADER *FacsTable (void); EFI_ACPI_DESCRIPTION_HEADER *MadtHeader (void); -EFI_ACPI_DESCRIPTION_HEADER *GtdtHeader (void); -EFI_ACPI_DESCRIPTION_HEADER *McfgHeader (void); -EFI_ACPI_DESCRIPTION_HEADER *Dbg2Header (void); -EFI_ACPI_DESCRIPTION_HEADER *SpcrHeader (void); -EFI_ACPI_DESCRIPTION_HEADER *CsrtHeader (void); -EFI_ACPI_DESCRIPTION_HEADER *IortHeader (void); -EFI_ACPI_DESCRIPTION_HEADER *PpttHeader (void); #define EFI_ACPI_AMD_OEM_ID_ARRAY {'A','M','D','I','N','C'} #define EFI_ACPI_AMD_OEM_TABLE_ID SIGNATURE_64('S','E','A','T','T','L','E',' ') diff --git a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c index a00bd3bd2215..ff1326982329 100644 --- a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c +++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c @@ -19,7 +19,6 @@ MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatform.c **/ -#include #include #include @@ -31,12 +30,11 @@ #include #include +#include #include -#define MAX_ACPI_TABLES 16 - -EFI_ACPI_DESCRIPTION_HEADER *AcpiTableList[MAX_ACPI_TABLES]; +#include "AcpiPlatform.h" STATIC EFI_ACPI_TABLE_PROTOCOL *mAcpiTableProtocol; @@ -97,16 +95,20 @@ InstallSystemDescriptionTables ( VOID ) { - EFI_ACPI_DESCRIPTION_HEADER *Table; - EFI_STATUS Status; - UINT32 CpuId; - UINTN Index; - UINTN TableSize; - UINTN TableHandle; + EFI_ACPI_DESCRIPTION_HEADER *Table; + EFI_STATUS Status; + UINT32 CpuId; + UINTN Index; + UINTN TableSize; + UINTN TableHandle; + EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE *Gtdt; + EFI_ACPI_6_0_IO_REMAPPING_TABLE *Iort; #if DO_XGBE UINT8 MacPackage[sizeof(mDefaultMacPackageA)]; #endif + CpuId = PcdGet32 (PcdSocCpuId); + Status = EFI_SUCCESS; for (Index = 0; !EFI_ERROR (Status); Index++) { Status = GetSectionFromFv (&gEfiCallerIdGuid, EFI_SECTION_RAW, Index, @@ -117,7 +119,6 @@ InstallSystemDescriptionTables ( switch (Table->OemTableId) { case SIGNATURE_64 ('S', 't', 'y', 'x', 'B', '1', ' ', ' '): - CpuId = PcdGet32 (PcdSocCpuId); if ((CpuId & STYX_SOC_VERSION_MASK) < STYX_SOC_VERSION_B1) { continue; } @@ -141,11 +142,39 @@ InstallSystemDescriptionTables ( break; #endif continue; + + default: + switch (Table->Signature) { + case EFI_ACPI_6_0_IO_REMAPPING_TABLE_SIGNATURE: + if (!PcdGetBool (PcdEnableSmmus)) { + continue; + } + if ((CpuId & STYX_SOC_VERSION_MASK) < STYX_SOC_VERSION_B1) { + Iort = (EFI_ACPI_6_0_IO_REMAPPING_TABLE *)Table; + Iort->NumNodes -= 2; + } + break; + + case EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE: + if ((CpuId & STYX_SOC_VERSION_MASK) < STYX_SOC_VERSION_B1) { + Gtdt = (EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE *)Table; + Gtdt->Header.Length = sizeof (*Gtdt); + Gtdt->PlatformTimerCount = 0; + Gtdt->PlatformTimerOffset = 0; + } + break; + } } Status = mAcpiTableProtocol->InstallAcpiTable (mAcpiTableProtocol, Table, - TableSize, &TableHandle); - ASSERT_EFI_ERROR (Status); + Table->Length, &TableHandle); + + DEBUG ((DEBUG_WARN, + "Installing %c%c%c%c Table (Revision %d, Length %d) ... %r\n", + ((UINT8 *)&Table->Signature)[0], ((UINT8 *)&Table->Signature)[1], + ((UINT8 *)&Table->Signature)[2], ((UINT8 *)&Table->Signature)[3], + Table->Revision, Table->Length, Status)); + FreePool (Table); } } @@ -168,67 +197,23 @@ AcpiPlatformEntryPoint ( IN EFI_SYSTEM_TABLE *SystemTable ) { - EFI_STATUS Status; - UINTN TableHandle; - UINTN TableIndex; - - ZeroMem(AcpiTableList, sizeof(AcpiTableList)); - - TableIndex = 0; - AcpiTableList[TableIndex++] = FadtTable(); - AcpiTableList[TableIndex++] = MadtHeader(); - AcpiTableList[TableIndex++] = GtdtHeader(); - AcpiTableList[TableIndex++] = Dbg2Header(); - AcpiTableList[TableIndex++] = SpcrHeader(); - AcpiTableList[TableIndex++] = McfgHeader(); - AcpiTableList[TableIndex++] = CsrtHeader(); - if (PcdGetBool (PcdEnableSmmus)) { - AcpiTableList[TableIndex++] = IortHeader(); - } - AcpiTableList[TableIndex++] = PpttHeader(); - AcpiTableList[TableIndex++] = NULL; - - DEBUG((DEBUG_INFO, "%a(): ACPI Table installer\n", __FUNCTION__)); + EFI_STATUS Status; + UINTN TableHandle; + EFI_ACPI_DESCRIPTION_HEADER *Header; // // Find the AcpiTable protocol // Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID**)&mAcpiTableProtocol); - if (EFI_ERROR (Status)) { - DEBUG((EFI_D_ERROR, "Failed to locate AcpiTable protocol. Status = %r\n", Status)); - ASSERT_EFI_ERROR(Status); - } + ASSERT_EFI_ERROR (Status); - TableIndex = 0; - while (AcpiTableList[TableIndex] != NULL) { - // - // Install ACPI table - // - DEBUG ((EFI_D_ERROR, "Installing %c%c%c%c Table (Revision %d, Length %d) ...\n", - *((UINT8*)&AcpiTableList[TableIndex]->Signature), - *((UINT8*)&AcpiTableList[TableIndex]->Signature + 1), - *((UINT8*)&AcpiTableList[TableIndex]->Signature + 2), - *((UINT8*)&AcpiTableList[TableIndex]->Signature + 3), - AcpiTableList[TableIndex]->Revision, - AcpiTableList[TableIndex]->Length)); - - Status = mAcpiTableProtocol->InstallAcpiTable ( - mAcpiTableProtocol, - AcpiTableList[TableIndex], - (AcpiTableList[TableIndex])->Length, - &TableHandle - ); - if (EFI_ERROR (Status)) { - DEBUG((DEBUG_ERROR,"Error adding ACPI Table. Status = %r\n", Status)); - ASSERT_EFI_ERROR(Status); - } - TableIndex++; - ASSERT( TableIndex < MAX_ACPI_TABLES ); - } + Header = MadtHeader (); + Status = mAcpiTableProtocol->InstallAcpiTable (mAcpiTableProtocol, Header, + Header->Length, &TableHandle); + ASSERT_EFI_ERROR (Status); InstallSystemDescriptionTables (); - return EFI_SUCCESS; + return EFI_REQUEST_UNLOAD_IMAGE; } - diff --git a/Silicon/AMD/Styx/AcpiTables/Madt.c b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Madt.c similarity index 97% rename from Silicon/AMD/Styx/AcpiTables/Madt.c rename to Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Madt.c index 43d415c8bc32..b10ae7e1ab74 100644 --- a/Silicon/AMD/Styx/AcpiTables/Madt.c +++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Madt.c @@ -27,9 +27,10 @@ #include #include -#include #include +#include "AcpiPlatform.h" + AMD_MP_CORE_INFO_PROTOCOL *mAmdMpCoreInfoProtocol = NULL; diff --git a/Silicon/AMD/Styx/AcpiTables/Csrt.c b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Csrt.aslc similarity index 93% rename from Silicon/AMD/Styx/AcpiTables/Csrt.c rename to Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Csrt.aslc index f25f90da5314..4aca9320250b 100644 --- a/Silicon/AMD/Styx/AcpiTables/Csrt.c +++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Csrt.aslc @@ -16,7 +16,7 @@ **/ -#include +#include "AcpiPlatform.h" // // CSRT for ARM_CCN504 (L3 CACHE) @@ -69,7 +69,7 @@ typedef struct { } AMD_ACPI_ARM_CCN504_CORE_SYSTEM_RESOURCE_TABLE; -AMD_ACPI_ARM_CCN504_CORE_SYSTEM_RESOURCE_TABLE AcpiCsrt = { +STATIC AMD_ACPI_ARM_CCN504_CORE_SYSTEM_RESOURCE_TABLE AcpiCsrt = { AMD_ACPI_HEADER (EFI_ACPI_5_1_CORE_SYSTEM_RESOURCE_TABLE_SIGNATURE, AMD_ACPI_ARM_CCN504_CORE_SYSTEM_RESOURCE_TABLE, AMD_ACPI_ARM_CCN504_CSRT_REVISION), @@ -97,11 +97,4 @@ AMD_ACPI_ARM_CCN504_CORE_SYSTEM_RESOURCE_TABLE AcpiCsrt = { #pragma pack(pop) - -EFI_ACPI_DESCRIPTION_HEADER * -CsrtHeader ( - VOID - ) -{ - return &AcpiCsrt.Header; -} +VOID* CONST ReferenceAcpiTable = &AcpiCsrt; diff --git a/Silicon/AMD/Styx/AcpiTables/Dbg2.c b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Dbg2.aslc similarity index 95% rename from Silicon/AMD/Styx/AcpiTables/Dbg2.c rename to Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Dbg2.aslc index 5d6cf82dba5b..07635aa9dd8e 100644 --- a/Silicon/AMD/Styx/AcpiTables/Dbg2.c +++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Dbg2.aslc @@ -16,9 +16,10 @@ **/ -#include #include +#include "AcpiPlatform.h" + #pragma pack(push, 1) #define EFI_ACPI_DBG2_REVISION 0 @@ -104,11 +105,4 @@ STATIC DBG2_TABLE AcpiDbg2 = { #pragma pack(pop) -EFI_ACPI_DESCRIPTION_HEADER * -Dbg2Header ( - VOID - ) -{ - return &AcpiDbg2.Description.Header; -} - +VOID* CONST ReferenceAcpiTable = &AcpiDbg2; diff --git a/Silicon/AMD/Styx/AcpiTables/Fadt.c b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Fadt.aslc similarity index 96% rename from Silicon/AMD/Styx/AcpiTables/Fadt.c rename to Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Fadt.aslc index bdf88a9c8e32..35d190bdf685 100644 --- a/Silicon/AMD/Styx/AcpiTables/Fadt.c +++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Fadt.aslc @@ -21,7 +21,7 @@ **/ -#include +#include "AcpiPlatform.h" #define FADT_FLAGS ( EFI_ACPI_5_1_HW_REDUCED_ACPI | \ EFI_ACPI_5_1_LOW_POWER_S0_IDLE_CAPABLE | \ @@ -91,11 +91,4 @@ STATIC EFI_ACPI_5_1_FIXED_ACPI_DESCRIPTION_TABLE AcpiFadt = { #pragma pack(pop) -EFI_ACPI_DESCRIPTION_HEADER * -FadtTable ( - VOID - ) -{ - return (EFI_ACPI_DESCRIPTION_HEADER *) &AcpiFadt; -} - +VOID* CONST ReferenceAcpiTable = &AcpiFadt; diff --git a/Silicon/AMD/Styx/AcpiTables/Gtdt.c b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Gtdt.aslc similarity index 92% rename from Silicon/AMD/Styx/AcpiTables/Gtdt.c rename to Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Gtdt.aslc index 139c9ae0baad..34f92f2e4061 100644 --- a/Silicon/AMD/Styx/AcpiTables/Gtdt.c +++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Gtdt.aslc @@ -21,7 +21,7 @@ **/ -#include +#include "AcpiPlatform.h" #pragma pack(push, 1) @@ -170,20 +170,4 @@ STATIC AMD_ACPI_5_1_ARM_GTDT_STRUCTURE AcpiGtdt = { #pragma pack(pop) - -EFI_ACPI_DESCRIPTION_HEADER * -GtdtHeader ( - VOID - ) -{ - UINT32 CpuId = PcdGet32 (PcdSocCpuId); - - // Check BaseModel and Stepping: Styx-B0 or prior? - if (((CpuId & 0xFF0) == 0) || ((CpuId & 0x00F) == 0)) { - AcpiGtdt.Gtdt.Header.Length = sizeof (EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE); - AcpiGtdt.Gtdt.PlatformTimerCount = 0; - AcpiGtdt.Gtdt.PlatformTimerOffset = 0; - } - - return (EFI_ACPI_DESCRIPTION_HEADER *) &AcpiGtdt.Gtdt.Header; -} +VOID* CONST ReferenceAcpiTable = &AcpiGtdt; diff --git a/Silicon/AMD/Styx/AcpiTables/Iort.c b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Iort.aslc similarity index 95% rename from Silicon/AMD/Styx/AcpiTables/Iort.c rename to Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Iort.aslc index 9c232379eff5..7723a4ddade3 100644 --- a/Silicon/AMD/Styx/AcpiTables/Iort.c +++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Iort.aslc @@ -12,9 +12,9 @@ **/ -#include #include -#include + +#include "AcpiPlatform.h" #define FIELD_OFFSET(type, name) __builtin_offsetof(type, name) @@ -355,17 +355,4 @@ STATIC STYX_IO_REMAPPING_STRUCTURE AcpiIort = { #pragma pack() -EFI_ACPI_DESCRIPTION_HEADER * -IortHeader ( - VOID - ) -{ - if ((PcdGet32 (PcdSocCpuId) & STYX_SOC_VERSION_MASK) < STYX_SOC_VERSION_B1) { - // - // Silicon revisions prior to B1 have only one SATA port, - // so omit the nodes of the second port in this case. - // - AcpiIort.Iort.NumNodes -= 2; - } - return (EFI_ACPI_DESCRIPTION_HEADER *)&AcpiIort.Iort.Header; -} +VOID* CONST ReferenceAcpiTable = &AcpiIort; diff --git a/Silicon/AMD/Styx/AcpiTables/Mcfg.c b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Mcfg.aslc similarity index 86% rename from Silicon/AMD/Styx/AcpiTables/Mcfg.c rename to Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Mcfg.aslc index 4fc18e8efcfc..67fb0429d840 100644 --- a/Silicon/AMD/Styx/AcpiTables/Mcfg.c +++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Mcfg.aslc @@ -16,9 +16,10 @@ **/ -#include #include +#include "AcpiPlatform.h" + #if STYX_A0 #define END_PCI_BUS_NUMBER 15 #else @@ -32,7 +33,7 @@ typedef struct { EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE Structure; } EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_DESCRIPTION_TABLE; -EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_DESCRIPTION_TABLE AcpiMcfg = { +STATIC EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_DESCRIPTION_TABLE AcpiMcfg = { { AMD_ACPI_HEADER (EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE, EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_DESCRIPTION_TABLE, EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION), @@ -42,10 +43,4 @@ EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_DESCRIPTION_TABLE AcpiMcfg = { #pragma pack(pop) -EFI_ACPI_DESCRIPTION_HEADER * -McfgHeader ( - VOID - ) -{ - return &AcpiMcfg.Header.Header; -} +VOID* CONST ReferenceAcpiTable = &AcpiMcfg; diff --git a/Silicon/AMD/Styx/AcpiTables/Pptt.c b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Pptt.aslc similarity index 97% rename from Silicon/AMD/Styx/AcpiTables/Pptt.c rename to Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Pptt.aslc index 1746bbe8b596..64a6cda7fd87 100644 --- a/Silicon/AMD/Styx/AcpiTables/Pptt.c +++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Pptt.aslc @@ -14,7 +14,7 @@ #include -#include +#include "AcpiPlatform.h" #define FIELD_OFFSET(type, name) __builtin_offsetof(type, name) @@ -216,10 +216,4 @@ STATIC STYX_PPTT_TABLE mStyxPpttTable = { } }; -EFI_ACPI_DESCRIPTION_HEADER * -PpttHeader ( - VOID - ) -{ - return (EFI_ACPI_DESCRIPTION_HEADER *)&mStyxPpttTable.Pptt.Header; -} +VOID* CONST ReferenceAcpiTable = &mStyxPpttTable; diff --git a/Silicon/AMD/Styx/AcpiTables/Spcr.c b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Spcr.aslc similarity index 90% rename from Silicon/AMD/Styx/AcpiTables/Spcr.c rename to Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Spcr.aslc index 719c276cfb31..bd84a19cce46 100644 --- a/Silicon/AMD/Styx/AcpiTables/Spcr.c +++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Spcr.aslc @@ -16,9 +16,10 @@ **/ -#include #include +#include "AcpiPlatform.h" + #pragma pack(push, 1) #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_PL011 3 @@ -114,11 +115,4 @@ STATIC EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE AcpiSpcr = { #pragma pack(pop) -EFI_ACPI_DESCRIPTION_HEADER * -SpcrHeader ( - VOID - ) -{ - return &AcpiSpcr.Header; -} - +VOID* CONST ReferenceAcpiTable = &AcpiSpcr;