From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 4B2D9AC0CAA for ; Mon, 29 Apr 2024 06:03:59 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=8YviWx/4zReXijx5+ZFky2XMqzEIURR8lrxmJuoYGpQ=; c=relaxed/simple; d=groups.io; h=Received-SPF:From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Received-SPF:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20240206; t=1714370638; v=1; b=oiZUckT/EQlIRqAcawXFUV8mbZsircEnb1u1qBsiHcnmjUd3/F5lLrTYCEzAMbF0lObddtng D3seqIIK0MXHgyNSzNyO7dGHMIKWf/j/bLNvYfCO7ikG+epYQ79435hY9CNEMJhdkcT7BPq3t1s 3ofX8UFPy2uzfgSDytolgKHTCUc1rVF8EDNLTt+IOCRDElSRLvaY2uBGBPyYmJTDVz+kbpiyHsd OcAgkVsrDRZtK8rkeJHrBb+PBAx3+Tzt+eqJj+FNhH6p7cMAFhlenyl4iXFyC8LQD7/HJI96o+s Nmsoq2EwHlOknwU0Jc0WiGpInk7cgYt/WoUt4wO3UspUg== X-Received: by 127.0.0.2 with SMTP id TiTzYY7687511xV7u3oWPSpJ; Sun, 28 Apr 2024 23:03:58 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.83]) by mx.groups.io with SMTP id smtpd.web11.13975.1714370637057050615 for ; Sun, 28 Apr 2024 23:03:57 -0700 X-Received: from MN2PR20CA0033.namprd20.prod.outlook.com (2603:10b6:208:e8::46) by CY8PR12MB7291.namprd12.prod.outlook.com (2603:10b6:930:54::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34; Mon, 29 Apr 2024 06:03:54 +0000 X-Received: from BL02EPF0001A107.namprd05.prod.outlook.com (2603:10b6:208:e8:cafe::4d) by MN2PR20CA0033.outlook.office365.com (2603:10b6:208:e8::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.32 via Frontend Transport; Mon, 29 Apr 2024 06:03:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C X-Received: from SATLEXMB03.amd.com (165.204.84.17) by BL02EPF0001A107.mail.protection.outlook.com (10.167.241.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Mon, 29 Apr 2024 06:03:54 +0000 X-Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 29 Apr 2024 01:03:54 -0500 X-Received: from BLR-LAB-SFW01.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 29 Apr 2024 01:03:52 -0500 From: "Abdul Lateef Attar via groups.io" To: CC: Abdul Lateef Attar , Sami Mujawar , Pierre Gondois Subject: [edk2-devel] [RESEND PATCH v4 4/5] DynamicTablesPkg: Adds ACPI SSDT HPET Table generator Date: Mon, 29 Apr 2024 11:33:34 +0530 Message-ID: In-Reply-To: References: MIME-Version: 1.0 Received-SPF: None (SATLEXMB03.amd.com: AbdulLateef.Attar@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0001A107:EE_|CY8PR12MB7291:EE_ X-MS-Office365-Filtering-Correlation-Id: bebf750f-255c-4fdb-464c-08dc681226ad X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?yUG73xFPQRZBz48C8iD4wP7jf+JEbVkCo6VywBBzGx8CrHYdp3/lsM5ROCGb?= =?us-ascii?Q?AQKkAjlrcaV1+Rz9jBotSjAb7e2PDQdtj0mnf/ruFlFaoO8xkuvhmetmUmiP?= =?us-ascii?Q?FgpWoAVhOXIwkiUQJHBHgSE8kHHAPPV0BUriwAnNbdS7EEjJ9zQc6WnfQ8Yj?= =?us-ascii?Q?cge6mTidSftR8L+RO2kQDd5f0vyQfyYPg5iZ0mZeuTjtYCrMsWfVyEBpvKyj?= =?us-ascii?Q?LWPvTCbQfkXT4xDweRnO1JEoh18DYW/CrIGdjEspbF+IUWI9Jv44HmbBcjMb?= =?us-ascii?Q?GxWxQIqtk5EuDry07j5/9X9u5qwjwcvHiC19xAuKo7xK3lHERUMSR/iulVB7?= =?us-ascii?Q?iaYEafoREhR6YmLzjelIZQKSnu+ccA8neGHQ6uebPBZf4AauRWyBvPRK7K+g?= =?us-ascii?Q?az9pzwqz9v0yyKgt/oC3KOJMf2/DS/GT2PTUTsJCluA9sWXawAFlEkjpY/Ja?= =?us-ascii?Q?NQoHYDSTXbXqKXkyWpaRYtu8EPQV659l8kYkNyCfoghRjS7iYZ+1lHsC5fI2?= =?us-ascii?Q?TfQurC4uMbjh4kQznV+bSjzXNYXEBLWmc42etr9De9gD61nLJp4RZPIyXrJL?= =?us-ascii?Q?pJoFJ5bmLJIa2vxIGrv26ElSntH+1wTXfazBvseMuKATSQjPcJowNZJYskFj?= =?us-ascii?Q?OTggJTf/DFShOpTlCFOOQHDXE7XwKUN4l3q578w5QOKbMh8427OcipyVayef?= =?us-ascii?Q?Lnn8r9OJrYpG+0r07hmNf/yfzN9Adxe0yS0nsxm0YESkDkjkRX+cSC/sX0Qb?= =?us-ascii?Q?mhIW/YcXokKQCgJ2qiwKO/vXYejHXpQ0AICiMxjy2frY98qZFORncpHxThpx?= =?us-ascii?Q?TsYZxBqCF4Bmeg4LOl7cBEGHVsffdwEQQ51u+Rs/GUOH2i5plPz+eTUsoG2e?= =?us-ascii?Q?uNhg6D+PkVZLCkm9q2MtawP8f1XpskwEtL3WJmfBznJ9rfaJhc9EHT8wlx93?= =?us-ascii?Q?RQlfwvkZ2qOS7FbAMOM8kFkvrJ9KQWX//zANLiWq60bSwmUxyMUZQIJQj0hC?= =?us-ascii?Q?d5egqPKCYv6P/fuy+uKY25rt+kF89IP+8W5FNSD4LmHfn18FqlwG9m3mAK9a?= =?us-ascii?Q?f+TaI4bXH+W5fzvqDLvmxcz/08FI6Ly+rCL8BpiYkI1BlXZfe+te3LLduMg4?= =?us-ascii?Q?BqKX/y5IT4uxs+u+jIXFCfdwUb2IsYP8Mg1aaGv/NDEH7dgtlJpjis5/+7ra?= =?us-ascii?Q?JbNRWP471GmN+XFnqnRwJU4+OZogJdZFw+CD1GunYlied/np68wuH6JqhInS?= =?us-ascii?Q?Rp0n26i6p4MCZMhQJkAFVjpGC3Dm/4BYf/3T8ekfUf4aeRVPD2aQ6A4DRJ7v?= =?us-ascii?Q?tk3cqUJa/s2v5encgtU9ScEWY6y1CiHYvMzfTWFzYjdn0+lPHaF+KO5vlhy5?= =?us-ascii?Q?EofvsnSb4v5Y29xlEmTdITUARqnt?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2024 06:03:54.6889 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bebf750f-255c-4fdb-464c-08dc681226ad X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0001A107.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7291 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Sun, 28 Apr 2024 23:03:57 -0700 Resent-From: AbdulLateef.Attar@amd.com Reply-To: devel@edk2.groups.io,AbdulLateef.Attar@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: LhEYloZNDA8e7i29HbSJXXbZx7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b="oiZUckT/"; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io Adds generic ACPI SSDT HPET table generator library. Register/Deregister HPET table. Adds ACPI namespace object for HPET device. Adds Address space for HPET device. Cc: Sami Mujawar Cc: Pierre Gondois Signed-off-by: Abdul Lateef Attar --- DynamicTablesPkg/DynamicTables.dsc.inc | 2 + DynamicTablesPkg/Include/AcpiTableGenerator.h | 2 + .../Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf | 32 ++ .../Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c | 295 ++++++++++++++++++ 4 files changed, 331 insertions(+) create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtH= petLib.inf create mode 100644 DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetG= enerator.c diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc b/DynamicTablesPkg/Dyna= micTables.dsc.inc index 477dc6b6a9..fc2ac5962e 100644 --- a/DynamicTablesPkg/DynamicTables.dsc.inc +++ b/DynamicTablesPkg/DynamicTables.dsc.inc @@ -36,6 +36,7 @@ DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf + DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf =20 [Components.IA32, Components.X64] # @@ -46,6 +47,7 @@ NULL|DynamicTablesPkg/Library/Acpi/AcpiFadtLib/AcpiFadtLib.inf NULL|DynamicTablesPkg/Library/Acpi/AcpiHpetLib/AcpiHpetLib.inf NULL|DynamicTablesPkg/Library/Acpi/AcpiWsmtLib/AcpiWsmtLib.inf + NULL|DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.i= nf } =20 [Components.ARM, Components.AARCH64] diff --git a/DynamicTablesPkg/Include/AcpiTableGenerator.h b/DynamicTablesP= kg/Include/AcpiTableGenerator.h index a32ef46ecb..ef651aa2aa 100644 --- a/DynamicTablesPkg/Include/AcpiTableGenerator.h +++ b/DynamicTablesPkg/Include/AcpiTableGenerator.h @@ -1,6 +1,7 @@ /** @file =20 Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.
+ Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -101,6 +102,7 @@ typedef enum StdAcpiTableId { EStdAcpiTableIdPcct, ///< PCCT Generator EStdAcpiTableIdHpet, ///< HPET Generator EStdAcpiTableIdWsmt, ///< WSMT Generator + EStdAcpiTableIdSsdtHpet, ///< SSDT HPET Generator EStdAcpiTableIdMax } ESTD_ACPI_TABLE_ID; =20 diff --git a/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.= inf b/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf new file mode 100644 index 0000000000..4dd0a60baf --- /dev/null +++ b/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/AcpiSsdtHpetLib.inf @@ -0,0 +1,32 @@ +## @file +# SSDT HPET Table Generator +# +# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION =3D 1.27 + BASE_NAME =3D AcpiSsdtHpetLib + FILE_GUID =3D 85262912-AD7F-4EE0-8BB1-EE177275A54E + VERSION_STRING =3D 1.0 + MODULE_TYPE =3D DXE_DRIVER + LIBRARY_CLASS =3D NULL|DXE_DRIVER + CONSTRUCTOR =3D AcpiSsdtHpetLibConstructor + DESTRUCTOR =3D AcpiSsdtHpetLibDestructor + +[Sources] + SsdtHpetGenerator.c + +[Packages] + DynamicTablesPkg/DynamicTablesPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + AcpiHelperLib + AmlLib + BaseLib + DebugLib + diff --git a/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerato= r.c b/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c new file mode 100644 index 0000000000..5e4f935af8 --- /dev/null +++ b/DynamicTablesPkg/Library/Acpi/AcpiSsdtHpetLib/SsdtHpetGenerator.c @@ -0,0 +1,295 @@ +/** @file + SSDT HPET Table Generator + + Copyright (c) 2017 - 2023, Arm Limited. All rights reserved. + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Reference(s): + - ACPI 6.5 Specification, Aug 29, 2022 + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** The Creator ID for the ACPI tables generated using + the standard ACPI table generators. +*/ +#define TABLE_GENERATOR_CREATOR_ID_GENERIC SIGNATURE_32('D', 'Y', 'N', 'T= ') + +#define SB_SCOPE "\\_SB_" + +/** This macro expands to a function that retrieves the + HPET base address from the Configuration Manager. +*/ +GET_OBJECT_LIST ( + EObjNameSpaceArch, + EArchObjHpetBaseAddress, + CM_ARCH_HPET_BASE_ADDRESS + ); + +/** Construct the SSDT HPET devices Table. + + This function invokes the Configuration Manager protocol interface + to get the required hardware information for generating the ACPI + table if required. + + 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. + @retval EFI_NOT_FOUND The required object was not found. + @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration + Manager is less than the Object size for t= he + requested object. +**/ +STATIC +EFI_STATUS +BuildSsdtHpetTable ( + 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 + ) +{ + EFI_STATUS Status; + AML_ROOT_NODE_HANDLE RootNode; + AML_OBJECT_NODE_HANDLE ScopeNode; + AML_OBJECT_NODE_HANDLE HpetNode; + AML_OBJECT_NODE_HANDLE CrsNode; + UINT32 EisaId; + CM_ARCH_HPET_BASE_ADDRESS *HpetBaseAddress; + + ASSERT (This !=3D NULL); + ASSERT (AcpiTableInfo !=3D NULL); + ASSERT (CfgMgrProtocol !=3D NULL); + ASSERT (Table !=3D NULL); + ASSERT (AcpiTableInfo->TableGeneratorId =3D=3D This->GeneratorID); + ASSERT (AcpiTableInfo->AcpiTableSignature =3D=3D This->AcpiTableSignatur= e); + + // Get the HPET Base Address from the Platform Configuration Manager + Status =3D GetEArchObjHpetBaseAddress ( + CfgMgrProtocol, + CM_NULL_TOKEN, + &HpetBaseAddress, + NULL + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: HPET: Failed to get HPET Base Address. Status =3D %r\n", + Status + )); + return Status; + } + + Status =3D AddSsdtAcpiHeader ( + CfgMgrProtocol, + This, + AcpiTableInfo, + &RootNode + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D AmlCodeGenScope (SB_SCOPE, RootNode, &ScopeNode); + if (EFI_ERROR (Status)) { + goto exit_handler; + } + + Status =3D AmlCodeGenDevice ("HPET", ScopeNode, &HpetNode); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto exit_handler; + } + + Status =3D AmlGetEisaIdFromString ("PNP0103", &EisaId); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto exit_handler; + } + + Status =3D AmlCodeGenNameInteger ("_HID", EisaId, HpetNode, NULL); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto exit_handler; + } + + Status =3D AmlCodeGenNameInteger ("_UID", 0x00, HpetNode, NULL); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto exit_handler; + } + + Status =3D AmlCodeGenNameResourceTemplate ("_CRS", HpetNode, &CrsNode); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto exit_handler; + } + + Status =3D AmlCodeGenRdMemory32Fixed (FALSE, (UINT32)HpetBaseAddress->Ba= seAddress, SIZE_1KB, CrsNode, NULL); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto exit_handler; + } + + Status =3D AmlSerializeDefinitionBlock ( + RootNode, + Table + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: SSDT-HPET: Failed to Serialize SSDT Table Data." + " Status =3D %r\n", + Status + )); + goto exit_handler; + } + +exit_handler: + // Delete the RootNode and its attached children. + return AmlDeleteTree (RootNode); +} + +/** Free any resources allocated for constructing the + SSDT HPET ACPI table. + + @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 [in, out] Table Pointer to the ACPI Table. + + @retval EFI_SUCCESS The resources were freed successfully. + @retval EFI_INVALID_PARAMETER The table pointer is NULL or invalid. +**/ +STATIC +EFI_STATUS +FreeSsdtHpetTableResources ( + IN CONST ACPI_TABLE_GENERATOR *CONST This, + IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInf= o, + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtoc= ol, + IN OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table + ) +{ + ASSERT (This !=3D NULL); + ASSERT (AcpiTableInfo !=3D NULL); + ASSERT (CfgMgrProtocol !=3D NULL); + ASSERT (AcpiTableInfo->TableGeneratorId =3D=3D This->GeneratorID); + ASSERT (AcpiTableInfo->AcpiTableSignature =3D=3D This->AcpiTableSignatur= e); + + if ((Table =3D=3D NULL) || (*Table =3D=3D NULL)) { + DEBUG ((DEBUG_ERROR, "ERROR: SSDT-HPET: Invalid Table Pointer\n")); + ASSERT ((Table !=3D NULL) && (*Table !=3D NULL)); + return EFI_INVALID_PARAMETER; + } + + FreePool (*Table); + *Table =3D NULL; + return EFI_SUCCESS; +} + +/** This macro defines the HPET Table Generator revision. +*/ +#define HPET_GENERATOR_REVISION CREATE_REVISION (1, 0) + +/** The interface for the SSDT HPET Table Generator. +*/ +STATIC +CONST +ACPI_TABLE_GENERATOR mSsdtPlatHpetGenerator =3D { + // Generator ID + CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdtHpet), + // Generator Description + L"ACPI.STD.SSDT.HPET.GENERATOR", + // ACPI Table Signature + EFI_ACPI_6_5_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, + // ACPI Table Revision - Unused + 0, + // Minimum ACPI Table Revision - Unused + 0, + // Creator ID + TABLE_GENERATOR_CREATOR_ID_GENERIC, + // Creator Revision + HPET_GENERATOR_REVISION, + // Build Table function + BuildSsdtHpetTable, + // Free Resource function + FreeSsdtHpetTableResources, + // 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 +AcpiSsdtHpetLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + Status =3D RegisterAcpiTableGenerator (&mSsdtPlatHpetGenerator); + DEBUG ((DEBUG_INFO, "SSDT-HPET: Register Generator. Status =3D %r\n", St= atus)); + 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 +AcpiSsdtHpetLibDestructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + Status =3D DeregisterAcpiTableGenerator (&mSsdtPlatHpetGenerator); + DEBUG ((DEBUG_INFO, "SSDT-HPET: Deregister Generator. Status =3D %r\n", = Status)); + ASSERT_EFI_ERROR (Status); + return Status; +} --=20 2.34.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 (#118373): https://edk2.groups.io/g/devel/message/118373 Mute This Topic: https://groups.io/mt/105796053/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-