From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id AC048AC0BA8 for ; Tue, 25 Jul 2023 10:28:56 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=9j2I/ZX1qOqxKO2GL/CS7ZaDspiCiKromatjn7bhu6A=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-Received:X-Received:X-MS-Exchange-Authentication-Results:Received-SPF:X-Received:X-Received:X-CheckRecipientChecked:X-CR-MTA-CID:X-CR-MTA-TID:X-Received:X-Received:ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:X-Received:X-Received:X-MS-Exchange-Authentication-Results:Received-SPF:X-Received:X-Received:X-Received:X-Received:From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:X-EOPAttributedMessage:X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id:x-checkrecipientrouted:NoDisclaimer:X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam-Untrusted:X-Microsoft-Antispam-Message-Info-Original:X-Forefront-Antispam-Report-Untrusted:X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-MS-Exchange-Transport-CrossTenantHeadersStripped:X-MS-PublicTrafficType:X-MS-Office365-Filtering-Correlation-Id-Prvs:X-Microsoft-Antispam-Message-Info:X-OriginatorOrg:X-MS-Exchange-CrossTenant-OriginalArrivalTime:X- MS-Exchange-CrossTenant-Network-Message-Id:X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp:X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs:X-MS-Exchange-CrossTenant-FromEntityHeader:X-MS-Exchange-Transport-CrossTenantHeadersStamped:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:X-Gm-Message-State:Content-Type; s=20140610; t=1690280935; v=1; b=XpKM+EUVZB0P1ZT2DDfzea0SwS1BUH7O7zfGT5eqS/zDgUasGoC0+GeMXBUBm7UM4GtH89EP MU8m6I0mXOr9ws2MmYKRqEE0korOu8pfzmhbFd1G6vr1OdKgeoQRz+pTLPDaXGTXtNNRMarg69x 2IXCDzqyKmryrZZUQeTBoKUo= X-Received: by 127.0.0.2 with SMTP id t52GYY7687511xMycqbfj4xU; Tue, 25 Jul 2023 03:28:55 -0700 X-Received: from EUR02-AM0-obe.outbound.protection.outlook.com (EUR02-AM0-obe.outbound.protection.outlook.com [40.107.247.44]) by mx.groups.io with SMTP id smtpd.web10.17094.1690280934560578388 for ; Tue, 25 Jul 2023 03:28:55 -0700 X-Received: from AM6P191CA0036.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:8b::49) by PR3PR08MB5628.eurprd08.prod.outlook.com (2603:10a6:102:8e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.33; Tue, 25 Jul 2023 10:28:51 +0000 X-Received: from AM7EUR03FT011.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8b:cafe::77) by AM6P191CA0036.outlook.office365.com (2603:10a6:209:8b::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.33 via Frontend Transport; Tue, 25 Jul 2023 10:28:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT011.mail.protection.outlook.com (100.127.140.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.25 via Frontend Transport; Tue, 25 Jul 2023 10:28:50 +0000 X-Received: ("Tessian outbound ba2f3d95109c:v145"); Tue, 25 Jul 2023 10:28:50 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 3ea3add553c1e53f X-CR-MTA-TID: 64aa7808 X-Received: from f56a328a1840.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id C345E902-03C2-410E-A611-8C2D8D0C0B73.1; Tue, 25 Jul 2023 10:28:43 +0000 X-Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f56a328a1840.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 25 Jul 2023 10:28:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P1kd8oZxE7ZvdcKBRLE+0gyI5pm8tL+6ZtFnB68iSDFOYX8c+y3uySca1Ux3mfew0jY62TIV02tFRP8g4zJdN3mwxMddbEgysKWqcD/4ctUyGqM6s2Nq8eb524tfM0+GPZBbzBX/ojnQLBJCswE/xCPc+5qq2BlNprto0UFMYH4KxgSL9KPZ2IomrBGUVUw52jJpWJDtC4MLRerCa0l+vxDOxUTNuUqLtGAyPZmFvuGiAdkJF+zv/o9IPTP3xBK1lpA0zpDQ76QZLcQl1GpeWlOIi6ZeUVnOisBMOd3mhN8ZpmylPLI/PFtFqZurvaZiNZYkPTNReicWY8IcBktsUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gBpPXpVn+CEriXOEKytOM4Ggj9FsH8+swOLG05nc7Io=; b=JwUX4qrU+ngWto9NDv6YLjn0lnMGcFyBJWm2FIRiiUJZjDnbF6/b5o29uqE33fIVEv7ElhMFR3V5P78na2IbZbwZ2czB1nbX4SlRXVwOlS4Zq7Ujs2BDfyTnlYjbLsPZuF6Jk3raR2boLi56Kces+bpWOQTnhI7KkbgWPiYliXHb5rwQlSLpudO1aY71GSrfUpK760XkakWwdQLR7XJAzJEszCAq2bgtswpdgfPnmh1oDosQHTbxd6+AL18+ovU5poPO8C6NJzPbFhhY1Ialhdn+7sfvkyETrYDmGqRxnJXfDDgqrmFJyy7NFCcHAogpBSoV0fMFtUHuIHwrVeQLjQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from DU2PR04CA0284.eurprd04.prod.outlook.com (2603:10a6:10:28c::19) by AS4PR08MB7454.eurprd08.prod.outlook.com (2603:10a6:20b:4e5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.32; Tue, 25 Jul 2023 10:28:41 +0000 X-Received: from DBAEUR03FT060.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:28c:cafe::9a) by DU2PR04CA0284.outlook.office365.com (2603:10a6:10:28c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.33 via Frontend Transport; Tue, 25 Jul 2023 10:28:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C X-Received: from nebula.arm.com (40.67.248.234) by DBAEUR03FT060.mail.protection.outlook.com (100.127.142.238) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6631.25 via Frontend Transport; Tue, 25 Jul 2023 10:28:40 +0000 X-Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 25 Jul 2023 10:28:04 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 25 Jul 2023 10:28:04 +0000 X-Received: from E114225.Arm.com (10.1.196.36) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Tue, 25 Jul 2023 10:28:03 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , Subject: [edk2-devel] [PATCH v1 10/11] DynamicTablesPkg: Add ETE device to CPU node in AML Date: Tue, 25 Jul 2023 11:27:57 +0100 Message-ID: <20230725102758.28132-11-sami.mujawar@arm.com> In-Reply-To: <20230725102758.28132-1-sami.mujawar@arm.com> References: <20230725102758.28132-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DBAEUR03FT060:EE_|AS4PR08MB7454:EE_|AM7EUR03FT011:EE_|PR3PR08MB5628:EE_ X-MS-Office365-Filtering-Correlation-Id: e266c8a4-9812-492b-3eb1-08db8cf9f051 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: nXlbqE6NrxMSGsxPbwiO4Dkcq6H7Pw2Ri4aK5+jvhUAmvJOj3xjTo0kGApBziTJhS55jUxtilvsthAhyhSo0/HHRi41qV/RtrZiry0ZjIJj2ARB4Kv/avgP1FFodDAftKMnIynj8RfudTADQFINWJ4RyHE/pL1STViZvqzfHm3Sp5yTyn2nBALnTQcJ7cj1ZCSkXVVg1QAg9p4DsVXhIz9cjKfa6J0y5xIUbFErs4YgdEDlz+G/vkMuWph8QDdLk2IVyFf11vE56ZrdUeaKsaE+wyK3thwfYGgzYmYQsctjAZugp3fAeiS2itMLW8WzxTHUIj5n4LU8lur0la+CC1agwBf1v/HeA1khwnSR5XWm6B4hCZDtJuqjDYj1b/8uPHFPNypvDIyR5r+vMIulxk3uP/Ir+lkupJ32m+6nGjk1DmktOuf+Vx2JIP9u+HmNxAMj+MmCGeyNoRyTV2MSYUYgVmmcGnqSmfNEYugU0qug9IrOp0vyE7h8v1bLObhhuC+Yc6zxR0X1w1tT5OBGKWA3HuI+QvKOEVEGga1vQxqBANvNEW/tHaRxxTt0wPUMwxwkoxwnNkpL4I0EGsJ2LrNiiN+Y1KBhUOek9HE2vh+oU+hxOdOwjBDg1wlNALp7Qm9Eer3tmyQe1Zun4ftdYBv2O46G6mLY7we66FavkvXa6qKsD0/LiNEJdoJOy1Vcr+4O/xTzCisAazLSWEOrIxEezgVcqtBLKqPYc6vbbC4ClRP9UvmwB2txy7qpCaQsJqoDA8RcKC1iojSat21bj2Q== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(376002)(136003)(346002)(396003)(39860400002)(82310400008)(451199021)(46966006)(40470700004)(36840700001)(2906002)(426003)(2616005)(83380400001)(40460700003)(47076005)(40480700001)(478600001)(36860700001)(36756003)(8676002)(8936002)(6666004)(7696005)(54906003)(86362001)(316002)(41300700001)(6916009)(70586007)(356005)(4326008)(70206006)(26005)(82740400003)(81166007)(44832011)(186003)(336012)(1076003)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR08MB7454 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT011.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 8d90e53d-0a5c-4c6a-06ff-08db8cf9ea56 X-Microsoft-Antispam-Message-Info: puHVHxdgJea1ylDb8TSpUfe+jL33QuFG4rWx5wOOm1zGRCSBmtwsmxlwarpkbKUTElXWbgv45XX6JqjMEC0LU8Ziz1UQ32bVkSiqCVVMMpt1oPD+AuiH94Mz6JTksoKHjHy4rDPMnWW0VkuPHTvbnjt79GsCoiL3g4xlBIXZLyphNDcjngKSFmWTIB4YhCkzcP1S0DRsESR3QtQKO9OJPjRbnMhreycoZAAoz/uSfy3D6nD9AhlaZDRB1hQDPPzttDL0I3599BlVdkAi+m1wBOtBNL5XJC1G5FZXDYnYUvVz1PLHks8Fb9a9fpyol6EvHr3SpMjgFTz2mQdJxFg960SPMZZCL7xBj82rA+JlLeeEglUe919XvRSWtEjHm/28JuPxPjDH08xl5qJRZuD2pa7a8c03jbCBjSioHunUYtu0NSfmO4uTabJ8655Ut1RR/7UgQ81DlhDqcuzXWspLUm0HLuZBeUEC8jd/iGqNydFblErdlnUdWmmQvRWuCsXbTOLBR36IZyGq7ntaTJ9Q5YOv/abxxC1PiyjLTeQOJFGy/vman1oZ9g1lQ3Yfn2GE/OLLA64UaHNXat7rvIoqswa1WrSwhOM5MkrUo/O4BDWYrwgHWP/uPFSXPX6oR4Z98qVNXYzFIdz+64QJOJLirT2yZeLlwHglgXfX7z7IGpsZKAIu6FpZBia9wkCmPKKMARC9kgQ2RWmzFMPJKYU8GgGyWp9mX+0jcJFs3Hxvfcc= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2023 10:28:50.8877 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e266c8a4-9812-492b-3eb1-08db8cf9f051 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM7EUR03FT011.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5628 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 Reply-To: devel@edk2.groups.io,sami.mujawar@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: l3IzRbJfKvzgulLqTYirkrrYx7686176AA= Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=XpKM+EUV; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io The Coresight Embedded Trace Extension (ETE) feature can be detected by the platform firmware by examining the debug feature register ID_AA64DFR0_EL1.TraceVer field. The platform configuration manager can then describe the ETE by creating CM_ARM_ET_INFO object(s) and referencing these in CM_ARM_GICC_INFO.EtToken. The 'Table 3: Compatible IDs for architected CoreSight components' in the 'ACPI for CoreSight 1.2 Platform Design Document' specifies the HID value for Coresight ETE and CoreSight Embedded Trace Macrocell (ETM) v4.x as ARMH C500. Therefore, update the SsdtCpuTopologyGenerator to add an ETE device to the CPU node in the AML CPU hierarchy so that an OS can utilise this information. Note: Although ETE and ETM share the same HID, ETE has a system register interfaces, unlike ETM which requires memory mapped registers. Since this patch aims to support ETE, the AML description does not describe any memory mapped registers. However, support for ETM can be added in the future. Signed-off-by: Sami Mujawar --- DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c | 186 +++++++++++++++++++- DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.h | 11 +- 2 files changed, 195 insertions(+), 2 deletions(-) diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c index 6fb131b664820adca63c9efa6d8b0e17fc64284e..6fbba12a010bf987797f0901a032735e8e0be598 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.c @@ -1,11 +1,17 @@ /** @file SSDT Cpu Topology Table Generator. - Copyright (c) 2021, Arm Limited. All rights reserved.
+ Copyright (c) 2021 - 2023, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @par Reference(s): - ACPI 6.3 Specification - January 2019 - s8.4 Declaring Processors + - ACPI for CoreSight version 1.2 Platform Design Document + (https://developer.arm.com/documentation/den0067/a/?lang=en) + + @par Glossary: + - ETE - Embedded Trace Extension. + - ETM - Embedded Trace Macrocell. **/ #include @@ -35,6 +41,7 @@ Requirements: - EArmObjProcHierarchyInfo (OPTIONAL) along with - EArmObjCmRef (OPTIONAL) - EArmObjLpiInfo (OPTIONAL) + - GetEArmObjEtInfo (OPTIONAL) */ /** This macro expands to a function that retrieves the GIC @@ -86,6 +93,16 @@ GET_OBJECT_LIST ( CM_ARM_CPC_INFO ); +/** + This macro expands to a function that retrieves the ET device + information from the Configuration Manager. +*/ +GET_OBJECT_LIST ( + EObjNameSpaceArm, + EArmObjEtInfo, + CM_ARM_ET_INFO + ); + /** Initialize the TokenTable. One entry should be allocated for each CM_ARM_PROC_HIERARCHY_INFO @@ -326,6 +343,144 @@ CreateAmlCpcNode ( return Status; } +/** Create an embedded trace device and add it to the Cpu Node in the + AML namespace. + + This generates the following ASL code: + Device (E002) + { + Name (_UID, 2) + Name (_HID, "ARMHC500") + } + + Note: Currently we only support generating ETE nodes. Unlike ETM, + ETE has a system register interface and therefore does not need + the MMIO range to be described. + + @param [in] Generator The SSDT Cpu Topology generator. + @param [in] ParentNode Parent node to attach the Cpu node to. + @param [in] CpuName Value used to generate the node name. + @param [out] EtNodePtr If not NULL, return the created Cpu node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +STATIC +EFI_STATUS +EFIAPI +CreateAmlEtd ( + IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, + IN AML_NODE_HANDLE ParentNode, + IN UINT32 CpuName, + OUT AML_OBJECT_NODE_HANDLE *EtNodePtr OPTIONAL + ) +{ + EFI_STATUS Status; + AML_OBJECT_NODE_HANDLE EtNode; + CHAR8 AslName[AML_NAME_SEG_SIZE + 1]; + + ASSERT (Generator != NULL); + ASSERT (ParentNode != NULL); + + Status = WriteAslName ('E', CpuName, AslName); + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + + Status = AmlCodeGenDevice (AslName, ParentNode, &EtNode); + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + + Status = AmlCodeGenNameInteger ( + "_UID", + CpuName, + EtNode, + NULL + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + + Status = AmlCodeGenNameString ( + "_HID", + ACPI_HID_ET_DEVICE, + EtNode, + NULL + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + + // If requested, return the handle to the EtNode. + if (EtNodePtr != NULL) { + *EtNodePtr = EtNode; + } + + return Status; +} + +/** Create and add an Embedded trace device to the Cpu Node. + + @param [in] Generator The SSDT Cpu Topology generator. + @param [in] CfgMgrProtocol Pointer to the Configuration Manager + Protocol Interface. + @param [in] GicCInfo Pointer to the CM_ARM_GICC_INFO object + describing the Cpu. + @param [in] CpuName Value used to generate the CPU node name. + @param [in] Node CPU Node to which the ET device node is + attached. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_UNSUPPORTED Feature Unsupported. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +STATIC +EFI_STATUS +EFIAPI +CreateAmlEtNode ( + IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, + IN CM_ARM_GICC_INFO *GicCInfo, + IN UINT32 CpuName, + IN AML_OBJECT_NODE_HANDLE *Node + ) +{ + EFI_STATUS Status; + CM_ARM_ET_INFO *EtInfo; + + Status = GetEArmObjEtInfo ( + CfgMgrProtocol, + GicCInfo->EtToken, + &EtInfo, + NULL + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + + // Currently we only support creation of a ETE Node. + if (EtInfo->EtType != ArmEtTypeEte) { + return EFI_UNSUPPORTED; + } + + Status = CreateAmlEtd ( + Generator, + Node, + CpuName, + NULL + ); + ASSERT_EFI_ERROR (Status); + return Status; +} + /** Create and add an _LPI method to Cpu/Cluster Node. For instance, transform an AML node from: @@ -694,6 +849,21 @@ CreateAmlCpuFromProcHierarchy ( } } + // Add an Embedded Trace node if present. + if (GicCInfo->EtToken != CM_NULL_TOKEN) { + Status = CreateAmlEtNode ( + Generator, + CfgMgrProtocol, + GicCInfo, + CpuName, + CpuNode + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + } + return Status; } @@ -1135,6 +1305,20 @@ CreateTopologyFromGicC ( break; } } + + if (GicCInfo[Index].EtToken != CM_NULL_TOKEN) { + Status = CreateAmlEtNode ( + Generator, + CfgMgrProtocol, + &GicCInfo[Index], + Index, + CpuNode + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + } } // for return Status; diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.h b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.h index 48e4455490e9a211e8d4e0a18adcf079fd5d2d24..0c7a0b0601ab221bc416ecb4be436c0dafca1824 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.h +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.h @@ -1,11 +1,17 @@ /** @file SSDT Cpu Topology Table Generator. - Copyright (c) 2021, Arm Limited. All rights reserved.
+ Copyright (c) 2021 - 2023, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @par Reference(s): - ACPI 6.3 Specification - January 2019 - s8.4 Declaring Processors + - ACPI for CoreSight version 1.2 Platform Design Document + (https://developer.arm.com/documentation/den0067/a/?lang=en) + + @par Glossary: + - ETE - Embedded Trace Extension. + - ETM - Embedded Trace Macrocell. **/ #ifndef SSDT_CPU_TOPOLOGY_GENERATOR_H_ @@ -49,6 +55,9 @@ /// HID for a processor device. #define ACPI_HID_PROCESSOR_DEVICE "ACPI0007" +/// HID for a ETM/ETE device. +#define ACPI_HID_ET_DEVICE "ARMHC500" + /// HID for a processor container device. #define ACPI_HID_PROCESSOR_CONTAINER_DEVICE "ACPI0010" -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107234): https://edk2.groups.io/g/devel/message/107234 Mute This Topic: https://groups.io/mt/100347383/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-