From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (NAM02-BN1-obe.outbound.protection.outlook.com [40.107.212.82]) by mx.groups.io with SMTP id smtpd.web11.40540.1656693154500182170 for ; Fri, 01 Jul 2022 09:32:34 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=cRWy1a7z; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: nvidia.com, ip: 40.107.212.82, mailfrom: jbrasen@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k35hZyMUc0GXTWLUJQ/MG78XXcTKgUu/zUlvHc+X9w3on42Mi0np/gZAUBv4hZrMyheuwSE9GYGYdnc9Hyl0Md8QuBeimC962BQSxCyX2lKO2a+ZqPeZji3EZOunZB6IUIcpLBJ1AlzfndZQeCLVoUyHvKhkuMxlOiHXmGGx30EQzpA+mL8xD9qv4lEhTtfnv+uDcyZcGuifFAc5ZU1s0qOhQZ/AeD05cR3TbGZm3+CZktk/zlE6jqVT9nYZwX3+TTYOSudOfCHfKpF/wg6E0X6U63IsONyRpQGnwH5LZuFg44ONCrfXNkZE+xevuUFFWQ6zyTWFuepTwbQ23wwEFg== 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=w9vnDwnGqBX0B3yN5/sswxZp7K1ZEKIJrI3XBoKzEsk=; b=WhmxKihsJ5oJsN506KY5CxTVVQRR/oHcT6R5oawsPh0kct/oYzDibudg+1eFeb4Mrck8IwMSKjJ65c3iQbO0lJaEdnvVwT7jWh2dTxriHV7DsjRsn1NjSmLn2Msd4tf9JSgnXGMOufGF9T7eK5+43/JbgbhmPs90yTKvELJnnYa9LDPtdR7OUcFgUPPPFKqJUQ8zYaaPMQpCkn6jChGmM9uzbfrscpb9iTe2/buZPPiLH/lZP1fP4pu10ylimtiK2tXnxLygcRbvrHrIMHjEKevioy8H568O1irmjfRVakNWQstzvZvh3q9+3yykgCJWeM5/G6XRmL+4mZUr6F37VQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=arm.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w9vnDwnGqBX0B3yN5/sswxZp7K1ZEKIJrI3XBoKzEsk=; b=cRWy1a7ztAKun0ul2NPNmJQa8QwfOGjfL92eyaQQZN6o/lw/hF1DqB1rEgxPkR3XvT+W+xSs+aCGEa2TffQJ6iTqodNq5zxi70loiNXQ4qDq4kNuigEkN2w2vxxpGi05A/QdXIjknzFMKQD9NvTQrb9hmHVIAzM6e+7JGYyrvDBGUa3WEFpmlug+3g832hEvU5bvKRn6GTLZL7OncxA764cCnK1coAfo2pQzyO1DEiOcw/ccK2E2SrLAKTipzTUN7JDWVt2/mlzVodGpy3Cb6WbQMFP95/wkUfkRlf5XTX+kTR4EPw2TLsIT2A3FDSC7AXihd9321cyBcORgG42S+g== Received: from MW4PR04CA0186.namprd04.prod.outlook.com (2603:10b6:303:86::11) by MWHPR12MB1582.namprd12.prod.outlook.com (2603:10b6:301:10::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15; Fri, 1 Jul 2022 16:32:31 +0000 Received: from CO1NAM11FT017.eop-nam11.prod.protection.outlook.com (2603:10b6:303:86:cafe::14) by MW4PR04CA0186.outlook.office365.com (2603:10b6:303:86::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15 via Frontend Transport; Fri, 1 Jul 2022 16:32:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.235) by CO1NAM11FT017.mail.protection.outlook.com (10.13.175.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5395.14 via Frontend Transport; Fri, 1 Jul 2022 16:32:30 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Fri, 1 Jul 2022 16:32:30 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Fri, 1 Jul 2022 09:32:29 -0700 Received: from perses.nvidia.com (10.127.8.13) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.26 via Frontend Transport; Fri, 1 Jul 2022 09:32:29 -0700 From: "Jeff Brasen" To: CC: , , , Jeff Brasen Subject: [PATCH v2 4/4] DynamicTablesPkg: AcpiSsdtPcieLibArm: Add support for override protocol Date: Fri, 1 Jul 2022 10:32:37 -0600 Message-ID: <4f14ba2221eeaeb00ca75f33016d9216a9aef635.1656693003.git.jbrasen@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-NVConfidentiality: public Return-Path: jbrasen@nvidia.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 304e5c5f-db26-4c6a-a00b-08da5b7f4b43 X-MS-TrafficTypeDiagnostic: MWHPR12MB1582:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sbDoPxVjM2POinDUzc/JOxn674pFQlO40HWZI76BykQuVTsscs9D94//rWWW8M38PsqgOg/cz+u3ouEPoFlLLTp8qkECdd6pRkZiQyQGaS0bvu/1IR5BRu9cNHxlwNPRYzdJ8mKq+fXxsw7tuEiDOtUjHGLUFpztINMn0AgvpJwgGm3Cu1q1an0uRcRD+PB386ODYXslh3P7sIkBrUao+q0TAe7mv/U8mXevSidgObwslhNjdEc2lvL214XXzKcZTOkycTWbocY5cdWGwuuwlctN6SmRIO1jiBgh12OeEne1abUfDCfYKjZAm1SDrs5mVDRQ2PVU4mhO/nUQcriVbG8zqfz2JstDjKubpKexDom/xbNsyqnWg1/8CzUWGLGKAZl+aDYX8SFDt1DasgBEFTwux9Ukz5FcNUXRPxTDxEjYZ1MBF8TP2JrG3SH8FaNO4mGaJfic6r45wPXfU8JTBCMNdgM5HUOyJWeVRxjgqe3PNlDnVH4dDU+f5jb4rwzCWk1iNLpadQLirwrEvNH+ryG6WBrZ+LN98Y2ekXtCvJfDXTYdTpCfRcSKCdIoRsGVM4I2aEDJon2fXlO6G2GQewMvn9ndF+UB5OoyAAUtbAU8grDsIvhFCoLs0hFZzzqIOZoyfbNTqPBfTRyGO8UABuuqM6RvAaWUghv66xMwGlgMOIu5TblSFlyA/WMOgyWslmXbVNzqgwcyLoHkeUy5fi0BYsNfIhkL0sHmpxK7hsfuYumgatvHWrR9Sh2jMs1bYvYWks6LMgoCTJeQI0eUslJ3UuIZQuppNSPR+YX9X2HfeZFpkAJP1W+gjv4hMMBvHMR6Y4gKkB5MDgw0dW1zYkU36uXAukkKzum+VM1Nlzj9FBbOUxSy5xrgLKQPiiof X-Forefront-Antispam-Report: CIP:12.22.5.235;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230016)(4636009)(136003)(39860400002)(346002)(376002)(396003)(46966006)(36840700001)(40470700004)(8936002)(5660300002)(2616005)(82740400003)(81166007)(316002)(54906003)(478600001)(41300700001)(6916009)(40460700003)(107886003)(26005)(7696005)(186003)(36860700001)(6666004)(4326008)(40480700001)(83380400001)(336012)(70206006)(8676002)(2906002)(426003)(47076005)(70586007)(356005)(82310400005)(36756003)(86362001)(213903007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2022 16:32:30.6950 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 304e5c5f-db26-4c6a-a00b-08da5b7f4b43 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.235];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT017.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1582 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain Some platfoms may want to modify the ACPI table created.=0D Add support for protocol that can provide an alternative implementation.=0D =0D Signed-off-by: Jeff Brasen =0D ---=0D DynamicTablesPkg/DynamicTablesPkg.dec | 3 +=0D .../Protocol/SsdtPcieOverrideProtocol.h | 63 +++++++++++++++++++=0D .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.c | 31 ++++++++-=0D .../Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf | 4 ++=0D 4 files changed, 98 insertions(+), 3 deletions(-)=0D create mode 100644 DynamicTablesPkg/Include/Protocol/SsdtPcieOverrideProto= col.h=0D =0D diff --git a/DynamicTablesPkg/DynamicTablesPkg.dec b/DynamicTablesPkg/Dynam= icTablesPkg.dec=0D index a890a048be..bb66bdaf14 100644=0D --- a/DynamicTablesPkg/DynamicTablesPkg.dec=0D +++ b/DynamicTablesPkg/DynamicTablesPkg.dec=0D @@ -43,6 +43,9 @@=0D # Dynamic Table Factory Protocol GUID=0D gEdkiiDynamicTableFactoryProtocolGuid =3D { 0x91d1e327, 0xfe5a, 0x49b8, = { 0xab, 0x65, 0xe, 0xce, 0x2d, 0xdb, 0x45, 0xec } }=0D =0D + # Protocol to override PCI SSDT table generation=0D + gEdkiiDynamicTableSsdtPcieOverrideProtocolGuid =3D { 0x962e8b44, 0x23b3,= 0x41da, { 0x9f, 0x36, 0xca, 0xde, 0x68, 0x49, 0xfb, 0xf6 } }=0D +=0D [PcdsFixedAtBuild]=0D =0D # Maximum number of Custom ACPI Generators=0D diff --git a/DynamicTablesPkg/Include/Protocol/SsdtPcieOverrideProtocol.h b= /DynamicTablesPkg/Include/Protocol/SsdtPcieOverrideProtocol.h=0D new file mode 100644=0D index 0000000000..29568a0159=0D --- /dev/null=0D +++ b/DynamicTablesPkg/Include/Protocol/SsdtPcieOverrideProtocol.h=0D @@ -0,0 +1,63 @@=0D +/** @file=0D +=0D + Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#ifndef SSDT_PCIE_OVERRIDE_PROTOCOL_H_=0D +#define SSDT_PCIE_OVERRIDE_PROTOCOL_H_=0D +=0D +#include =0D +#include =0D +=0D +/** This macro defines the SSDT PCI Override Protocol GUID.=0D +=0D + GUID: {D85A4835-5A82-4894-AC02-706F43D5978E}=0D +*/=0D +#define EDKII_SSDT_PCI_OVERRIDE_PROTOCOL_GUID \=0D + { 0x962e8b44, 0x23b3, 0x41da, \=0D + { 0x9f, 0x36, 0xca, 0xde, 0x68, 0x49, 0xfb, 0xf6 } \=0D + };=0D +=0D +/**=0D + Forward declarations:=0D +*/=0D +typedef struct SsdtOverridePciProtocol EDKII_SSDT_PCI_OVERRIDE_PROTOCOL;=0D +=0D +/** The UpdateTable function allows the override protocol to update the=0D + * PCIe SSDT table prior to being created.=0D +=0D + @param [in] This Pointer to the SSDT PCI Override Protocol.=0D + @param [in] PciInfo The PCIe configuration info for this node.=0D + @param [in] Uid UID that was selected for this PCIe node.=0D + @param [in, out] PciNode Pointer to the PCI node of this ACPI table.=0D +=0D + @retval EFI_SUCCESS Success.=0D + @retval EFI_INVALID_PARAMETER A parameter is invalid.=0D + @retval EFI_DEVICE_ERROR Failed to update the table.=0D +**/=0D +typedef=0D +EFI_STATUS=0D +(EFIAPI *EDKII_SSDT_PCI_OVERRIDE_PROTOCOL_UPDATE_TABLE)(=0D + IN CONST EDKII_SSDT_PCI_OVERRIDE_PROTOCOL *CONST This,=0D + IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo,=0D + IN UINT32 Uid,=0D + IN OUT AML_ROOT_NODE_HANDLE *PciNode=0D + );=0D +=0D +/** The EDKII_CONFIGURATION_MANAGER_PROTOCOL structure describes the=0D + Configuration Manager Protocol interface.=0D +*/=0D +typedef struct SsdtOverridePciProtocol {=0D + /** The interface used to update the ACPI table for PCI.=0D + */=0D + EDKII_SSDT_PCI_OVERRIDE_PROTOCOL_UPDATE_TABLE UpdateTable;=0D +} EDKII_SSDT_PCI_OVERRIDE_PROTOCOL;=0D +=0D +/** The SSDT PCI Override Protocol GUID.=0D +*/=0D +extern EFI_GUID gEdkiiDynamicTableSsdtPcieOverrideProtocolGuid;=0D +=0D +#endif // SSDT_PCIE_OVERRIDE_PROTOCOL_H_=0D diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieG= enerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieG= enerator.c=0D index 9f785ca5ac..46e0a98b98 100644=0D --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerato= r.c=0D +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerato= r.c=0D @@ -20,6 +20,7 @@=0D #include =0D #include =0D #include =0D +#include =0D #include =0D =0D // Module specific include files.=0D @@ -30,6 +31,7 @@=0D #include =0D #include =0D #include =0D +#include =0D =0D #include "SsdtPcieGenerator.h"=0D =0D @@ -804,9 +806,10 @@ GeneratePciDevice (=0D {=0D EFI_STATUS Status;=0D =0D - CHAR8 AslName[AML_NAME_SEG_SIZE + 1];=0D - AML_OBJECT_NODE_HANDLE ScopeNode;=0D - AML_OBJECT_NODE_HANDLE PciNode;=0D + CHAR8 AslName[AML_NAME_SEG_SIZE + 1];=0D + AML_OBJECT_NODE_HANDLE ScopeNode;=0D + AML_OBJECT_NODE_HANDLE PciNode;=0D + EDKII_SSDT_PCI_OVERRIDE_PROTOCOL *OverrideProtocol;=0D =0D ASSERT (Generator !=3D NULL);=0D ASSERT (CfgMgrProtocol !=3D NULL);=0D @@ -866,6 +869,28 @@ GeneratePciDevice (=0D =0D // Add the template _OSC method.=0D Status =3D AddOscMethod (PciNode);=0D + if (EFI_ERROR (Status)) {=0D + ASSERT (0);=0D + return Status;=0D + }=0D +=0D + Status =3D gBS->LocateProtocol (=0D + &gEdkiiDynamicTableSsdtPcieOverrideProtocolGuid,=0D + NULL,=0D + (VOID **)&OverrideProtocol=0D + );=0D + if (!EFI_ERROR (Status)) {=0D + Status =3D OverrideProtocol->UpdateTable (=0D + OverrideProtocol,=0D + PciInfo,=0D + Uid,=0D + PciNode=0D + );=0D + } else {=0D + // Not an error if override protocol is not found=0D + Status =3D EFI_SUCCESS;=0D + }=0D +=0D ASSERT_EFI_ERROR (Status);=0D return Status;=0D }=0D diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieL= ibArm.inf b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLi= bArm.inf=0D index 431e32a777..8e916f15e9 100644=0D --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.i= nf=0D +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.i= nf=0D @@ -30,6 +30,10 @@=0D AcpiHelperLib=0D AmlLib=0D BaseLib=0D + UefiBootServicesTableLib=0D =0D [Pcd]=0D gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdPciUseSegmentAsUid=0D +=0D +[Protocols]=0D + gEdkiiDynamicTableSsdtPcieOverrideProtocolGuid=0D -- =0D 2.25.1=0D =0D