From nobody Sun Feb 8 20:52:28 2026 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+76766+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+76766+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1624030101; cv=none; d=zohomail.com; s=zohoarc; b=EVT12HJNzG698bpeceDXzQt9bYcY+JCGg1m31hBGGDSnPyXYBZ59Ga7+6FSRVIJjSp/qf4PObSH2T3Wm1950AqC29hCcRpmlV4l15kIkayCBp/THYuVVsk4yjElCsPWQbw/gTE0xiaEZXNKXVfYRDQg9HsCUuSPRSerz6f0miiE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624030101; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=cllACzxUtn1HvA8YH8jZPcAnVluqSIukq2eJmnali3M=; b=Llj+VM4212/sNBmHbbkdYbau3R2oDZLrMaQoayCa++vNoWtjPyM2NbamF9pEqo01JFrKbIhaL3+d1pyagqfjSGd7v6Nu7PHkOJOHxPU0FQGiDLnopnuoN9GX+h/l7fASBavmg+Dq1GZLE4QeMaSC4gak/MzRtLsqAzUvmgxFGTI= 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+76766+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1624030101557789.2733282339295; Fri, 18 Jun 2021 08:28:21 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id U3YmYY1788612xAyCmesdYoK; Fri, 18 Jun 2021 08:28:21 -0700 X-Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by mx.groups.io with SMTP id smtpd.web11.9403.1624030100665429376 for ; Fri, 18 Jun 2021 08:28:20 -0700 X-Received: by mail-pf1-f182.google.com with SMTP id k6so7909140pfk.12 for ; Fri, 18 Jun 2021 08:28:20 -0700 (PDT) X-Gm-Message-State: nBMdCjWjYXkGoHhOvSmNGCPbx1787277AA= X-Google-Smtp-Source: ABdhPJyUabdmVqdC2r3pFeWgOw0ed7IoOIBHIbMMNE9d6yzgPbOppKArfzsy6RQvYGXsteL7UzFwxw== X-Received: by 2002:a65:6a16:: with SMTP id m22mr10767617pgu.29.1624030099835; Fri, 18 Jun 2021 08:28:19 -0700 (PDT) X-Received: from embedded-PC.puresoft.int ([125.63.92.170]) by smtp.gmail.com with ESMTPSA id v15sm8326360pfm.216.2021.06.18.08.28.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jun 2021 08:28:19 -0700 (PDT) From: "Vikas Singh via groups.io" To: devel@edk2.groups.io Cc: sami.mujawar@arm.com, leif@nuviainc.com, meenakshi.aggarwal@nxp.com, samer.el-haj-mahmoud@arm.com, v.sethi@nxp.com, arokia.samy@puresoftware.com, kuldip.dwivedi@puresoftware.com, ard.biesheuvel@arm.com, vikas.singh@nxp.com, Sunny.Wang@arm.com Subject: [edk2-devel] [PATCH V2 4/4] Platform/NXP/LS1046aFrwyPkg: Add OEM specific DSDT generator Date: Fri, 18 Jun 2021 20:57:40 +0530 Message-Id: <20210618152740.14819-5-vikas.singh@puresoftware.com> In-Reply-To: <20210618152740.14819-1-vikas.singh@puresoftware.com> References: <20210618152740.14819-1-vikas.singh@puresoftware.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,vikas.singh@puresoftware.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1624030101; bh=HFhrARQpszcH0eyN2ThUMYc3v71XS26oMCpW9tpiXy0=; h=Cc:Date:From:Reply-To:Subject:To; b=axGNUXdHutTNMKWT+pFBrrQkLM6ipDEdWTrcMP3ND/iHrRa+Yo7kYFnVuoRnwVAuQrl MAKBTe2j5Ohx5a/pIcnDSPOmUw0k1DWgl6hxM/w0Id8f2uVVDLZ4357J9QWD3u15Jfhet 8eg00IrpfnmxlwgUh1OlOX/NZDD//nuBgz0= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" This patch adds platform specific DSDT generator and Clk dsdt properties for LS1046AFRWY platform. Reviewed-by: Leif Lindholm Signed-off-by: Vikas Singh --- Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/Dsdt/Clk.asl = | 60 +++++++++ Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/Dsdt/Dsdt.asl = | 15 +++ Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf = | 39 ++++++ Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/RawDsdtG= enerator.c | 138 ++++++++++++++++++++ Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiLib.h = | 23 ++++ Platform/NXP/LS1046aFrwyPkg/Include/Platform.h = | 6 +- Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dsc = | 1 + 7 files changed, 281 insertions(+), 1 deletion(-) diff --git a/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/Dsdt/Clk.asl b/P= latform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/Dsdt/Clk.asl new file mode 100644 index 0000000000..58541c3019 --- /dev/null +++ b/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/Dsdt/Clk.asl @@ -0,0 +1,60 @@ +/** @file +* DSDT : Dynamic Clock ACPI Information +* +* Copyright 2021 NXP +* Copyright 2021 Puresoftware Ltd. +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ + +Scope(_SB) +{ + Device(PCLK) { + Name(_HID, "NXP0017") + Name(CLK, 0) // Maximum Platform Clock (Hz) + Name(CCLK, 0) // Maximum CPU Core Clock (MHz) + Name(AVBL, 0) + OperationRegion(RCWS, SystemMemory, DCFG_BASE, DCFG_LEN) + Method(_REG,2) { + if (Arg0 =3D=3D "RCWS") { + Store(Arg1, AVBL) + } + } + Field (RCWS, ByteAcc, NoLock, Preserve) { + /* The below table provides the func of diff bits in 512 bits RCW da= ta: + SYS_PLL_CFG : 0-1 bits + SYS_PLL_RAT : 2-6 bits + SYSCLK_FREQ : 472-481 bits etc. + Refer LS1046ARM for more info. + For LS1046 RCWSRs are read as RCW[0:31] . + */ + offset(0x100), + RESV, 1, + PRAT, 5, + PCFG, 2, + offset(0x103), + CPRT, 6, // Cluster Group PLL Multiplier ratio + offset(0x13B), + HFRQ, 8, // Higher 8 bits of SYSCLK_FREQ + RESX, 6, + LFRQ, 2 // Lower bits of SYSCLK_FREQ + } + + Method(_INI, 0, NotSerialized) { + /* Calculating Platform Clock */ + Local0 =3D (HFRQ<<2 | LFRQ) // Concatinating LFRQ at end of HFRQ + Multiply(Local0, 500000, Local0) + Multiply(Local0, PRAT, Local0) + Divide(Local0, 3, , Local0) + Store(Local0, CLK) + + /* Calculating Maximum Core Clock */ + Local0 =3D (HFRQ<<2 | LFRQ) // Concatinating LFRQ at end of HFRQ + Multiply(Local0, 500000, Local0) + Divide(Local0, 3, , Local0) + Divide(Local0, 1000000, , Local0) //Just the MHz part of SYSCLK. + Multiply(Local0, CPRT, CCLK) // PLL_Ratio * SYSCLK, Max freq of clus= ter + } + } // end of device PCLK +} diff --git a/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/Dsdt/Dsdt.asl b/= Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/Dsdt/Dsdt.asl new file mode 100644 index 0000000000..19f3f1c0e8 --- /dev/null +++ b/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/Dsdt/Dsdt.asl @@ -0,0 +1,15 @@ +/** @file + Differentiated System Description Table Fields (DSDT) + + Copyright 2021 NXP + Copyright 2021 Puresoftware Ltd. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "Platform.h" + +DefinitionBlock("DsdtTable.aml", "DSDT", 2, "NXP ", "LS1046 ", EFI_ACPI_= ARM_OEM_REVISION) { + include ("Clk.asl") +} diff --git a/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiDsdt= Lib.inf b/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiDsdtLib= .inf new file mode 100644 index 0000000000..ed5f9dd442 --- /dev/null +++ b/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiDsdtLib.inf @@ -0,0 +1,39 @@ +## @file +# Raw Table Generator +# +# Copyright 2021 NXP +# Copyright 2021 Puresoftware Ltd +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION =3D 0x00010019 + BASE_NAME =3D PlatformAcpiDsdtLib + FILE_GUID =3D A97F70AC-3BB4-4596-B4D2-9F948EC12D17 + VERSION_STRING =3D 1.0 + MODULE_TYPE =3D DXE_DRIVER + LIBRARY_CLASS =3D NULL|DXE_DRIVER + CONSTRUCTOR =3D AcpiDsdtLibConstructor + DESTRUCTOR =3D AcpiDsdtLibDestructor + +[Sources] + PlatformAcpiDsdtLib/RawDsdtGenerator.c + Dsdt/Dsdt.asl + +[Packages] + DynamicTablesPkg/DynamicTablesPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dec + Platform/NXP/ConfigurationManagerPkg/ConfigurationManagerPkg.dec + +[LibraryClasses] + BaseLib + +[Pcd] + +[Protocols] + +[Guids] diff --git a/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiDsdt= Lib/RawDsdtGenerator.c b/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/Plat= formAcpiDsdtLib/RawDsdtGenerator.c new file mode 100644 index 0000000000..7d886396ca --- /dev/null +++ b/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiDsdtLib/Raw= DsdtGenerator.c @@ -0,0 +1,138 @@ +/** @file + Raw DSDT Table Generator + + Copyright 2021 NXP + Copyright 2021 Puresoftware Ltd. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include + +// Module specific include files. +#include +#include +#include +#include +#include + +#include "PlatformAcpiLib.h" + +/** Construct the ACPI table using the ACPI table data provided. + This function invokes the Configuration Manager protocol interface + to get the required hardware information for generating the ACPI + table. + If this function allocates any resources then they must be freed + in the FreeXXXXTableResources function. + @param [in] This Pointer to the table generator. + @param [in] AcpiTableInfo Pointer to the ACPI Table Info. + @param [in] CfgMgrProtocol Pointer to the Configuration Manager + Protocol Interface. + @param [out] Table Pointer to the constructed ACPI Table. + @retval EFI_SUCCESS Table generated successfully. + @retval EFI_INVALID_PARAMETER A parameter is invalid. +**/ +STATIC +EFI_STATUS +EFIAPI +BuildRawDsdtTable ( + IN CONST ACPI_TABLE_GENERATOR * CONST This, + IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * CONST AcpiTableInfo, + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, + OUT EFI_ACPI_DESCRIPTION_HEADER ** CONST Table + ) +{ + ASSERT (This !=3D NULL); + ASSERT (AcpiTableInfo !=3D NULL); + ASSERT (CfgMgrProtocol !=3D NULL); + ASSERT (Table !=3D NULL); + ASSERT (AcpiTableInfo->TableGeneratorId =3D=3D This->GeneratorID); + + if (AcpiTableInfo->AcpiTableData =3D=3D NULL) { + // Add the dsdt aml code here. + *Table =3D (EFI_ACPI_DESCRIPTION_HEADER *)&dsdt_aml_code; + } + + return EFI_SUCCESS; +} + +/** This macro defines the Raw Generator revision. +*/ +#define DSDT_GENERATOR_REVISION CREATE_REVISION (1, 0) + +/** The interface for the Raw Table Generator. +*/ +STATIC +CONST +ACPI_TABLE_GENERATOR RawDsdtGenerator =3D { + // Generator ID + CREATE_OEM_ACPI_TABLE_GEN_ID (PlatAcpiTableIdDsdt), + // Generator Description + L"ACPI.OEM.RAW.DSDT.GENERATOR", + // ACPI Table Signature - Unused + 0, + // ACPI Table Revision - Unused + 0, + // Minimum ACPI Table Revision - Unused + 0, + // Creator ID + TABLE_GENERATOR_CREATOR_ID_ARM, + // Creator Revision + DSDT_GENERATOR_REVISION, + // Build Table function + BuildRawDsdtTable, + // No additional resources are allocated by the generator. + // Hence the Free Resource function is not required. + NULL, + // Extended build function not needed + NULL, + // Extended build function not implemented by the generator. + // Hence extended free resource function is not required. + NULL +}; + +/** Register the Generator with the ACPI Table Factory. + @param [in] ImageHandle The handle to the image. + @param [in] SystemTable Pointer to the System Table. + @retval EFI_SUCCESS The Generator is registered. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_ALREADY_STARTED The Generator for the Table ID + is already registered. +**/ +EFI_STATUS +EFIAPI +AcpiDsdtLibConstructor ( + IN CONST EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE * CONST SystemTable + ) +{ + EFI_STATUS Status; + Status =3D RegisterAcpiTableGenerator (&RawDsdtGenerator); + DEBUG ((DEBUG_INFO, "OEM: Register DSDT Generator. Status =3D %r\n", Sta= tus)); + ASSERT_EFI_ERROR (Status); + return Status; +} + +/** Deregister the Generator from the ACPI Table Factory. + @param [in] ImageHandle The handle to the image. + @param [in] SystemTable Pointer to the System Table. + @retval EFI_SUCCESS The Generator is deregistered. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The Generator is not registered. +**/ +EFI_STATUS +EFIAPI +AcpiDsdtLibDestructor ( + IN CONST EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE * CONST SystemTable + ) +{ + EFI_STATUS Status; + Status =3D DeregisterAcpiTableGenerator (&RawDsdtGenerator); + DEBUG ((DEBUG_INFO, "OEM: Deregister DSDT Generator. Status =3D %r\n", S= tatus)); + ASSERT_EFI_ERROR (Status); + return Status; +} diff --git a/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiLib.= h b/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiLib.h new file mode 100644 index 0000000000..e5f907a7d4 --- /dev/null +++ b/Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiLib.h @@ -0,0 +1,23 @@ +/** @file + * Acpi lib headers + * + * Copyright 2021 NXP + * Copyright 2021 Puresoftware Ltd + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * +**/ + + +#ifndef LS1046AFRWY_PLATFORM_ACPI_LIB_H +#define LS1046AFRWY_PLATFORM_ACPI_LIB_H + +#include + +/** C array containing the compiled AML template. + These symbols are defined in the auto generated C file + containing the AML bytecode array. +*/ +extern CHAR8 dsdt_aml_code[]; + +#endif diff --git a/Platform/NXP/LS1046aFrwyPkg/Include/Platform.h b/Platform/NXP/= LS1046aFrwyPkg/Include/Platform.h index 3c68d65cd3..0483bf2dc8 100644 --- a/Platform/NXP/LS1046aFrwyPkg/Include/Platform.h +++ b/Platform/NXP/LS1046aFrwyPkg/Include/Platform.h @@ -17,6 +17,10 @@ // Soc defines #define PLAT_SOC_NAME "LS1046AFRWY" =20 +// PCLK : Dynamic Clock +#define DCFG_BASE 0x1EE0000 /* Device configuration da= ta Base Address */ +#define DCFG_LEN 0xFFF /* Device configuration da= ta length */ + // Gic #define GIC_VERSION 2 #define GICD_BASE 0x1410000 @@ -59,7 +63,7 @@ #define CFG_MGR_TABLE_ID SIGNATURE_64 ('L','S','1','0','4','6',' ',' ') =20 // Specify the OEM defined tables -#define OEM_ACPI_TABLES 0 +#define OEM_ACPI_TABLES 1 // Added DSDT =20 #define PLAT_PCI_SEG0 LS1046A_PCI_SEG0 #define PLAT_PCI_SEG1_CONFIG_BASE LS1046A_PCI_SEG1_CONFIG_BASE diff --git a/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dsc b/Platform/NXP/= LS1046aFrwyPkg/LS1046aFrwyPkg.dsc index 20111e6037..7041d15da5 100755 --- a/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dsc +++ b/Platform/NXP/LS1046aFrwyPkg/LS1046aFrwyPkg.dsc @@ -65,6 +65,7 @@ NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/AcpiMadtLibA= rm.inf NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/AcpiMcfgLibA= rm.inf NULL|DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/AcpiSpcrLibA= rm.inf + NULL|Platform/NXP/LS1046aFrwyPkg/AcpiTablesInclude/PlatformAcpiDsd= tLib.inf } !endif =20 --=20 2.25.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 (#76766): https://edk2.groups.io/g/devel/message/76766 Mute This Topic: https://groups.io/mt/83630885/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-