From nobody Fri May 17 20:57:50 2024 Delivered-To: importer@patchew.org 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+91192+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1657313928367346.9852493780222; Fri, 8 Jul 2022 13:58:48 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id EG4dYY1788612xv8K6adt4e3; Fri, 08 Jul 2022 13:58:48 -0700 X-Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.51]) by mx.groups.io with SMTP id smtpd.web08.4196.1657313927181869771 for ; Fri, 08 Jul 2022 13:58:47 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eGsNc66fb763/E2S25qNvI5rn/AQktxq1erV+b1mAjR1QKplnIvfRulwA5evfKSNIywBP3ACGXxBOztwtIDiiBqTzILX7IJnEl6YpNqOrFPXUawWW9vnCAJ8f/ZPx3P4HrtWVejW53PjlguAso9JJIycjm5FWg/VjyoVbZnGmlY6n5AiKIPmh4Xk8sEjrcyRIMsSLmAK+Ksy0imVdq8Ote4AuGRyeUuQ96aRGSLaDpstNimX4+/3m9yjD3VaIM5yvkfpoDH4uGl8UyGWLJ1wvHNTnSVu6hcKzm08va/wiTwRuI2mK+pg9TJS5o38EOR+Q3ShpVmH3N9axwOx2DQfuA== 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=MjjxvJTNL0sXW+Bjdw2xGbkdZJgSg5iSJZiVnk5iJis=; b=cvw/UfVTxsn6vbEM08qFunSxLCoE+Xhx1APVj4j1VGu91WD0PEHoc51OcOZrtGsKK9cOabJX7GbIrDSXlclPg/Aa8RiHhfuvz8RHswKrUj9ZeCPeF54ARrdzZv7KjbtC/5sGxLVDuCstRmU6FxLzc3o8wvXdI3A30XXP0avkD/aukGXOhOHRMLR5cpPjPxEeOtuWfhZtYsGnS28puXVywV8Qo6g4uy7BerpCcxH1sbPbndn8+A2g4yKJxdltLspkQTcGfn98e0n5K4qEHCu6muaA/V/WprWdvqwlbjPy1UmOUKMRPbHhmvMSAgKkAb2rEx8UioRdPq+fbSKefTIy7w== 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 X-Received: from BN0PR04CA0064.namprd04.prod.outlook.com (2603:10b6:408:ea::9) by BY5PR12MB4950.namprd12.prod.outlook.com (2603:10b6:a03:1d9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.20; Fri, 8 Jul 2022 20:58:43 +0000 X-Received: from BN8NAM11FT054.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ea:cafe::72) by BN0PR04CA0064.outlook.office365.com (2603:10b6:408:ea::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.20 via Frontend Transport; Fri, 8 Jul 2022 20:58:43 +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 (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+91192+1787277+3901457@groups.io; helo=mail02.groups.io; 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 X-Received: from mail.nvidia.com (12.22.5.235) by BN8NAM11FT054.mail.protection.outlook.com (10.13.177.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5417.15 via Frontend Transport; Fri, 8 Jul 2022 20:58:43 +0000 X-Received: from rnnvmail203.nvidia.com (10.129.68.9) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Fri, 8 Jul 2022 20:58:42 +0000 X-Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Fri, 8 Jul 2022 13:58:41 -0700 X-Received: from perses.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.986.26 via Frontend Transport; Fri, 8 Jul 2022 13:58:41 -0700 From: "Jeff Brasen via groups.io" To: , CC: , , Jeff Brasen Subject: [edk2-devel] [PATCH v3 1/3] DynamicTablesPkg: AcpiSsdtPcieLibArm: Correct translation value Date: Fri, 8 Jul 2022 14:59:01 -0600 Message-ID: <9cbfc2c4fdca71cd042cda4dcec1a029e767141a.1657313523.git.jbrasen@nvidia.com> In-Reply-To: References: MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4dafba0d-f76d-45d6-a00e-08da6124a497 X-MS-TrafficTypeDiagnostic: BY5PR12MB4950:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: iABeb3/XIP1l/JvGFLMbXSGxKnlRNTUiDwrD4+DQrrhWBcYTKPjMgV4Hh9F3Up7JLXMX6oPAY1+d+JCXih4CUyTIZwI1AWmlOaY6w8652rz/lLAaHy8m/NT6IpIZy7L3PS3XTHetUTuC41oOFMSlT8AyeZXvFw1RrDxG73QIgpm7LjIU1uD5Tq8AMwfdOD0pREvtvxCM0K0FjwSYzAooEJg3jC3Hvsh6yKzEE0wfJKBxKZmMsjvspsSymSfbFeNSKE2VgDK7lCrZCDjG2FCZfy1Qez4T3CEO0okJF3u7Hs23T5oNF63jaAgz1VsgdXAvVTPCrr4MWtdNYwUzrJOA7uqjgC/D/wSDNhBn7yr7nkhwqdN204vBu46mR5vNkiPvULa4r2Ge4/oFa2YOsYAyv6Ok3d1mCJzcAM92GAEwiP2OpP4FuLF2wZI5MdZ+UdOVKsMgO1+mQGjdD6kyOGMdwFMj8i2IuWSjAp9LDQBRGYOSnvAHuLkuXBkdVlq1UaR6pn9B0H1Gh554uia25uZHzixEbvARif0rGuBVwLuTZkChGUbq71GAaps7CqcREP8VILHGj+I8OqYEUgSpdCBp8X/M3LEJlXjSeg8c8oyQDqIAoa4/0eIRsuZlJIndWKwnud/j+TBcVyyyStn1P7EySeUAPqdcJTqEZsKQbtxTD+MMqda4HbNXIJDDqiYCDb1X9JrkuDWvLbcaFQxv1vOMtREiX3aXpjd1rIc+zsFr8JfCevZ4zhm74Q7/4WtNN3BL9uTQ4wtnfD0j6xe5pGhbiMK1YMA/hlGKVs2Er4M068HT9qHyq0RLOAGicBn3wcs8W89FiCpM8wwCN8p8r0rCijdsyABvadlEIanv78sioqjyDPgGrrOANQYG2zopljsp X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2022 20:58:43.2745 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4dafba0d-f76d-45d6-a00e-08da6124a497 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: BN8NAM11FT054.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4950 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,jbrasen@nvidia.com X-Gm-Message-State: GWnTC9MztPdjlIRwCJWZQX1ix1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1657313928; bh=kCKcnFvy/fLsltGY/t4kPgVdEunJYuJSvgmAbL0dONU=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=O12MmC8aQRx/qNmNkjz4SHWLEs4C+mzJl4Shp+zElO61GEI270niKE4HGhdFwm+WjET grjLL54ZrdHBpyjC2lE28sm181gDNgELtqoTEXEB4kAituaprBbUlCO7z6vUisF3VdFjL KSTlwIwTPIkGWdhjjO17axK4RbYQqQolSsY= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1657313929770100001 Content-Type: text/plain; charset="utf-8" The translation value in ACPI should be the difference between the CPU and = PCIe address. Signed-off-by: Jeff Brasen Reviewed-by: Pierre Gondois Reviewed-by: Sami Mujawar --- .../Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieG= enerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieG= enerator.c index a34018151f..d4c5f47b07 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerato= r.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerato= r.c @@ -540,6 +540,7 @@ GeneratePciCrs ( UINT32 RefCount; CM_ARM_PCI_ADDRESS_MAP_INFO *AddrMapInfo; AML_OBJECT_NODE_HANDLE CrsNode; + BOOLEAN IsPosDecode; =20 ASSERT (Generator !=3D NULL); ASSERT (CfgMgrProtocol !=3D NULL); @@ -609,6 +610,11 @@ GeneratePciCrs ( } =20 Translation =3D (AddrMapInfo->CpuAddress !=3D AddrMapInfo->PciAddress); + if (AddrMapInfo->CpuAddress >=3D AddrMapInfo->PciAddress) { + IsPosDecode =3D TRUE; + } else { + IsPosDecode =3D FALSE; + } =20 switch (AddrMapInfo->SpaceCode) { case PCI_SS_IO: @@ -616,12 +622,12 @@ GeneratePciCrs ( FALSE, TRUE, TRUE, - TRUE, + IsPosDecode, 3, 0, AddrMapInfo->PciAddress, AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1, - Translation ? AddrMapInfo->CpuAddress : 0, + Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->Pc= iAddress : 0, AddrMapInfo->AddressSize, 0, NULL, @@ -635,7 +641,7 @@ GeneratePciCrs ( case PCI_SS_M32: Status =3D AmlCodeGenRdDWordMemory ( FALSE, - TRUE, + IsPosDecode, TRUE, TRUE, TRUE, @@ -643,7 +649,7 @@ GeneratePciCrs ( 0, AddrMapInfo->PciAddress, AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1, - Translation ? AddrMapInfo->CpuAddress : 0, + Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->Pc= iAddress : 0, AddrMapInfo->AddressSize, 0, NULL, @@ -657,7 +663,7 @@ GeneratePciCrs ( case PCI_SS_M64: Status =3D AmlCodeGenRdQWordMemory ( FALSE, - TRUE, + IsPosDecode, TRUE, TRUE, TRUE, @@ -665,7 +671,7 @@ GeneratePciCrs ( 0, AddrMapInfo->PciAddress, AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1, - Translation ? AddrMapInfo->CpuAddress : 0, + Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->Pc= iAddress : 0, AddrMapInfo->AddressSize, 0, NULL, --=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 (#91192): https://edk2.groups.io/g/devel/message/91192 Mute This Topic: https://groups.io/mt/92260870/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- From nobody Fri May 17 20:57:50 2024 Delivered-To: importer@patchew.org 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+91194+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1657313930030163.69519442640603; Fri, 8 Jul 2022 13:58:50 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Va9lYY1788612xG8TtaSmSAO; Fri, 08 Jul 2022 13:58:49 -0700 X-Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.41]) by mx.groups.io with SMTP id smtpd.web10.4163.1657313928137337921 for ; Fri, 08 Jul 2022 13:58:48 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jFj0h6AiMauSPG053bbk4+FXPgz99VdKkAT2gtpxNaQlk8SRwz2hkQVrKbu2w2lEGtuUWA94J89HhmmFsey/1orVdhh4pCz2S36ZvjPDzbvQskCx9UKmnffdpIwoHAhctvIdPBJ1nrzmn2LEqMDgzzpAIkSKRPo2/IrQ1avLxk0nO302bAV0aotIiOFc+VE9yFkQGSWVy/SoYjUCrhwKy+RJOBlPK3HM8CYzzL+bvE+fMBhfUENbipjEgkAP/OdkcqB8hRPiVh4mcQFmYHNA71Z0v4nt3O9bkS36dA8nKpWmN9rEpoDe5Q081vHV5VRTBBhevg8kUbO6Jbck/ZVpBQ== 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=hPMkkMPP0t4hXQf66emVmwAj8jZlf3DLpkBS2X27gik=; b=j5a8kFR74cCQeufSL+UCUTdjbrlG/parUJa80vWNhYG1ED6sYspLx2AyIL/Us5M3uayautge7YinhhIPF2/t89ApBMcWDxlo9yhAypbTKnQOw6wujwPDfrnKM1oXAYPHpgKS9/aANPfLDIE8fdOemHo/YU6zwR3dzhANPwaeQqV7fsF0pB4ObycFyETBSJq1+KeW++A4ffBQJez4n1xtNWfwar0V9JdGUahz3LxwTtxRsE2gyCyI6Jz/jzkUA6omkejQ4LSMHWmwqGQlqbZ1YNQ7OV4xmh3+UB20AlmWuQcX8S+XA1aMbZpD0ACT/u0okDJAPSYvsoGQWW3gTuj33w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) 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 X-Received: from BN9P220CA0004.NAMP220.PROD.OUTLOOK.COM (2603:10b6:408:13e::9) by BN8PR12MB3508.namprd12.prod.outlook.com (2603:10b6:408:6b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.16; Fri, 8 Jul 2022 20:58:44 +0000 X-Received: from BN8NAM11FT036.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13e:cafe::73) by BN9P220CA0004.outlook.office365.com (2603:10b6:408:13e::9) 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, 8 Jul 2022 20:58:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; 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+91194+1787277+3901457@groups.io; helo=mail02.groups.io; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; pr=C X-Received: from mail.nvidia.com (12.22.5.238) by BN8NAM11FT036.mail.protection.outlook.com (10.13.177.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5417.16 via Frontend Transport; Fri, 8 Jul 2022 20:58:44 +0000 X-Received: from rnnvmail204.nvidia.com (10.129.68.6) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Fri, 8 Jul 2022 20:58:43 +0000 X-Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Fri, 8 Jul 2022 13:58:42 -0700 X-Received: from perses.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.986.26 via Frontend Transport; Fri, 8 Jul 2022 13:58:42 -0700 From: "Jeff Brasen via groups.io" To: , CC: , , Jeff Brasen Subject: [edk2-devel] [PATCH v3 2/3] DynamicTablesPkg: AcpiSsdtPcieLibArm: Support UID > 0xF Date: Fri, 8 Jul 2022 14:59:02 -0600 Message-ID: <7a47623bd7e32de309df4113102858b78aacd9e4.1657313523.git.jbrasen@nvidia.com> In-Reply-To: References: MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ff058223-4f5f-46f8-8487-08da6124a50b X-MS-TrafficTypeDiagnostic: BN8PR12MB3508:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: qITfc7xGFgCYsEF8WsPUxEacA71xQFfCYtR2PBiWuVkVF2lQnyWwS+loEJfXBLuB2NYoPVZZV7Sl84XHPDHy0o6M+Ci0tuYjDj+kXySbiYCsh6N4gHMgQ/LJ99/m1/BzgYAW/YbzXs7Lq5uMILXNamrj4NjL5j0CkAH1fV4xkxSE5IJIpdgOjX8i3IK2abQdsg0YWipItt56CJghIiegUNdsVMjqElL3SchaGVttJItR3CwH6+32RXlz+JoXcybZrd7ACTfAFYjZOA/90UhL4N72qfCKauIE99ixpNfmghP8YnK2Pw2Dmhd/QLoEsJBz/Bn+Fs9RiBokHgBtGQAV6s3bXW1Tz09LfCSyWN6YgrycCCllVqfuPECAbqPpfNh6u6pWH4SAVvTv7tY+Sz8hECkyLaWqY6mcTSfExQ0GlvJMvVPJujAYpY76i6sjLZrHg2Uil0lcjfEPFpCuN6NcbojH6+DwqWXRb/0p/kPgqaEWrzPZCgcA3tBAyY6P6WPUxrKUHzGuHcdIpmFPdlOUD0e3qZSlEYSqtk93utKmZpm0epgvjSI6goiv3SlQHcr6kmGGWmwy06uDXxNgq85Zeo6MLsBZ5Ia2GieW1bomiGAK87OAUYXMBULVwHCu8z6vekcNoXaaZaZ+qleIZNUZVu3gHyn4ZtC1OvjDx5fdAb0iqEiDBVLp07i1jGUu1xMw8en4OYFFzOo/H5rI5vUj+Mwkqc6e+Ds8wcBBDkcztuFagzjzYEMbc+QiF7QK3Ikbg3D3TPllwAwb3Y+3zR3ibLB9xpiBuXurlmfZpgIdXRuvZDqNxHqIYCgAO+xlZC79RQXqXBhAo3NJgE/emigymqDrf/JxeN4HC4ECe9yqUYnq1q/HJ65Gfhl37rVrIB7y X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2022 20:58:44.0340 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ff058223-4f5f-46f8-8487-08da6124a50b 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.238];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT036.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3508 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,jbrasen@nvidia.com X-Gm-Message-State: jRZROdRRFGyLErvQh13UHDp4x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1657313929; bh=C+KEMNFLs4m7x7Q57YCwA1aEk3NlbV4/BjRKCeGJtEU=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=f5ILhpMnP5XcdbLA4Xt7tvh0Dmj3jZ+B/mqMYeewFCc58uV084Ivyy8ERwvFqPcVM/v LX86hzfhqoJWmDLmg/VLI1DtvNT2jd3EMeaPKQC7tBSkaJb+wTl3/JPH2O0OPgPWXYnq+ h/s9enRQPuIt7/3yQkJlfFCJDgmgulIFjO8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1657313931723100007 Content-Type: text/plain; charset="utf-8" Add support for PCIe devices with UID > 0xF. This is done by using the next value in the name so PCI5, PC26, etc Signed-off-by: Jeff Brasen Reviewed-by: Pierre Gondois Reviewed-by: Sami Mujawar --- .../Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c | 5 ++++- .../Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieG= enerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieG= enerator.c index d4c5f47b07..68ecae96be 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerato= r.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerato= r.c @@ -824,7 +824,10 @@ GeneratePciDevice ( =20 // Write the name of the PCI device. CopyMem (AslName, "PCIx", AML_NAME_SEG_SIZE + 1); - AslName[AML_NAME_SEG_SIZE - 1] =3D AsciiFromHex (Uid); + AslName[AML_NAME_SEG_SIZE - 1] =3D AsciiFromHex (Uid & 0xF); + if (Uid > 0xF) { + AslName[AML_NAME_SEG_SIZE - 2] =3D AsciiFromHex ((Uid >> 4) & 0xF); + } =20 // ASL: Device (PCIx) {} Status =3D AmlCodeGenDevice (AslName, ScopeNode, &PciNode); diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieG= enerator.h b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieG= enerator.h index 59a0d601a3..515a3e1785 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerato= r.h +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerato= r.h @@ -31,7 +31,7 @@ Corresponding changes would be needed to support the Name and UID fields describing the Pci root complexes. */ -#define MAX_PCI_ROOT_COMPLEXES_SUPPORTED 16 +#define MAX_PCI_ROOT_COMPLEXES_SUPPORTED 256 =20 // _SB scope of the AML namespace. #define SB_SCOPE "\\_SB_" --=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 (#91194): https://edk2.groups.io/g/devel/message/91194 Mute This Topic: https://groups.io/mt/92260872/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- From nobody Fri May 17 20:57:50 2024 Delivered-To: importer@patchew.org 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+91193+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1657313930262773.3598203364106; Fri, 8 Jul 2022 13:58:50 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id YAwEYY1788612xPKZVFV7WGM; Fri, 08 Jul 2022 13:58:49 -0700 X-Received: from NAM04-DM6-obe.outbound.protection.outlook.com (NAM04-DM6-obe.outbound.protection.outlook.com [40.107.102.69]) by mx.groups.io with SMTP id smtpd.web10.4162.1657313927947450464 for ; Fri, 08 Jul 2022 13:58:48 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E+YaJL18UiTONCZ7lGyK20EM98lb3KYVyTYSTUzpHFqsWYgCm1EpftFEjqu4+/h2lncWKQC5YDY9XI3K3NNEEFExnG/LFolenk/glAMBN8bmZpPqhg9qGccNorasDwz4/VM8NqXU5j3WMa7UoKLCDgfo7MIC5ieCN98tYLOvPj7x+g6eYjYwKtKIh2zPHCdmzHRoBnO9e80KwPoY/lvAP/lCLSCcSiAyl3rJbQ+0mkrWNq+4xIfxsNXJw15VNLAHZh1vOP+x8Whf501AKBvX1T2d/oYiQF97q1HJjEpKfftptIFDQ4AbZMTFNEQaIdiNqqp6BYozt81t40o7nGa+Hg== 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=pI3kGEcjbd9e+x0x8hflwP63cATA7N0ILfDOxAct7Nc=; b=FELf/W5qywYPMSE3Fq8LB+1yZZC+79xTiAZvrgmZXkmJAJoGnpOhf9Idpgft28sWAchBJzP7fKUcQjBrLEtHbWn3frnZsQTSYjida5nYbDh1CvMoGAaDGMyBntuaipOXogI+nXyHgd5vyUR0EzDejVb3cv2sNbt5aoUOeP6jAqNvMuiWz/MZ1tOMghwrIqb4lPxjJWMpsyEVN6+4cPaO4DMd2/b5o5P85S5dOvHSi2OvzUZ3WEG6VNqg4yDCJ9tJG4fHMIhXRgXjgUIHKuaHnE/kx2UedQ7l72JHCJh35v7LiE+Zca8eer//4ILRKc6Q7A6Aq4H+OlCt6WB7RWl2kQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) 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 X-Received: from BN9P220CA0005.NAMP220.PROD.OUTLOOK.COM (2603:10b6:408:13e::10) by BN8PR12MB3348.namprd12.prod.outlook.com (2603:10b6:408:47::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.16; Fri, 8 Jul 2022 20:58:45 +0000 X-Received: from BN8NAM11FT036.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13e:cafe::9a) by BN9P220CA0005.outlook.office365.com (2603:10b6:408:13e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.19 via Frontend Transport; Fri, 8 Jul 2022 20:58:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; 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+91193+1787277+3901457@groups.io; helo=mail02.groups.io; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; pr=C X-Received: from mail.nvidia.com (12.22.5.238) by BN8NAM11FT036.mail.protection.outlook.com (10.13.177.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5417.16 via Frontend Transport; Fri, 8 Jul 2022 20:58:44 +0000 X-Received: from rnnvmail203.nvidia.com (10.129.68.9) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Fri, 8 Jul 2022 20:58:44 +0000 X-Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Fri, 8 Jul 2022 13:58:43 -0700 X-Received: from perses.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.986.26 via Frontend Transport; Fri, 8 Jul 2022 13:58:42 -0700 From: "Jeff Brasen via groups.io" To: , CC: , , Jeff Brasen Subject: [edk2-devel] [PATCH v3 3/3] DynamicTablesPkg: AcpiSsdtPcieLibArm: Create support library Date: Fri, 8 Jul 2022 14:59:03 -0600 Message-ID: <92bf2e8419e091c86366322ad654e5efc809627e.1657313523.git.jbrasen@nvidia.com> In-Reply-To: References: MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5f3096e0-9c3d-481b-df5e-08da6124a589 X-MS-TrafficTypeDiagnostic: BN8PR12MB3348:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: DdckKAq4v+EfEFSSGQ7+mXBePJRFq6VCBitGqkK9c7ilvisJnPL1xvm4+HJI37N6nV2fzUwriSAWiZ6DZZev4edNI1mMsSIG9LvnPZFBkmmxpHQa1ouvlBE8zDJzl4c+t7gujhRjMZs5dus/pUThxT81NmlVlECe2mlaoxl8qTEhE+USC2lzGStOlRzVdnDxV7ZBUtkg3MX2zPuj0QWasXFj0Sl1ENDu11Zk5nqANTzI2/tlP8ic0+Eyb/bQ/Xi7x5YSOlrFrzlvGRuvjqJ6/MKxERO0SH4M0/g+7Dgt8g54lIl1xapuxZHXcRv3a6FFp8Uqg2RM124d0TdAZuITfR3DqlUUhCQhceMd7q5hNRUVCHoJff1DYnIlcoc4vlrafO01s2AQMdaZnV+MwtNTB61yoI8Q/jzebJGNd1QeuyXZn3Ve/9hAYBORlBo8iIedUg0VksjdneelExmoJEOkm+miunvMcbg6eRTw8NVdUUwFh3VAv9NR+P90/EwWknjQcaW+B3RZLG5LUNjumoiFd+mNCls3qieA2SIrtEuZw9kMbTgjv6EL/JfK53klk2u9sz6SNEYu27shQb4MRaAsZOKs0JdjotXSAplssk/TSfEGZCl5vctewPDJjXFoUKijXrIwpcIqcY8kOyoFf0pHTD9iGS1SHxoYeCBaAMI4Z57DQc50hlfzuHtum6S5PcG98JXs5flPcvs35e2GeSGSKruZA1jn5TBBOPTARCacUkdptCZ0tom46WMIRzErIqn0wXLJ0WmR3V4JvIEvaMvsfpTLthKEC2V60TovTRP6Gw7DnhhGq2OAUG2AeE7menLneeKDoigSea4rTwsga5U0HoDGFbnimcefPu61fuNBhEIHRYFXvSxy/uy65scI86OQ X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2022 20:58:44.7839 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5f3096e0-9c3d-481b-df5e-08da6124a589 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.238];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT036.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3348 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,jbrasen@nvidia.com X-Gm-Message-State: FdT9hPmwNvlum0RgltUyRQJ2x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1657313929; bh=UeFwozNVq9M536vWA0AuBDtfeYa8lmzbsJyueypF6T8=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=Ucaz+sotpYgVHdixeFunwOilhlg0noNWXNg3zCwz9YhBGOFQl8IOoL9sL4fcu3eJbvj 99xftVvANbP6PhqYK2hJog/25e7GKd2e/oGsW7KITB3xioBnK4byZ7GRejuQ919YgLYvM b5zh52PFrqc4sJszMYdh9gkTB5U157ed4bU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1657313931757100008 Content-Type: text/plain; charset="utf-8" Add support library to allow for customization of _OSC and slot info. The functions in the library are unchanged, with the exception of adding PciInfo pointer to the APIs. Signed-off-by: Jeff Brasen Reviewed-by: Pierre Gondois Reviewed-by: Sami Mujawar --- .../Include/Library/SsdtPcieSupportLib.h | 73 +++++++ .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.c | 168 +-------------- .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.h | 15 -- .../Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf | 2 +- .../SsdtPcieOscTemplate.asl | 0 .../SsdtPcieSupportLib/SsdtPcieSupportLib.c | 200 ++++++++++++++++++ .../SsdtPcieSupportLib/SsdtPcieSupportLib.inf | 30 +++ .../SsdtPcieSupportLibPrivate.h | 25 +++ 8 files changed, 332 insertions(+), 181 deletions(-) create mode 100644 DynamicTablesPkg/Include/Library/SsdtPcieSupportLib.h rename DynamicTablesPkg/Library/{Acpi/Arm/AcpiSsdtPcieLibArm =3D> Common/S= sdtPcieSupportLib}/SsdtPcieOscTemplate.asl (100%) create mode 100644 DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/Ssdt= PcieSupportLib.c create mode 100644 DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/Ssdt= PcieSupportLib.inf create mode 100644 DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/Ssdt= PcieSupportLibPrivate.h diff --git a/DynamicTablesPkg/Include/Library/SsdtPcieSupportLib.h b/Dynami= cTablesPkg/Include/Library/SsdtPcieSupportLib.h new file mode 100644 index 0000000000..f65431ef28 --- /dev/null +++ b/DynamicTablesPkg/Include/Library/SsdtPcieSupportLib.h @@ -0,0 +1,73 @@ +/** @file + Ssdt PCie Support Library + + Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef SSDT_PCIE_SUPPORT_LIB_H_ +#define SSDT_PCIE_SUPPORT_LIB_H_ + +#pragma pack(1) + +/** Structure used to map integer to an index. +*/ +typedef struct MappingTable { + /// Mapping table. + /// Contains the Index <-> integer mapping + UINT32 *Table; + + /// Last used index of the Table. + /// Bound by MaxIndex. + UINT32 LastIndex; + + /// Number of entries in the Table. + UINT32 MaxIndex; +} MAPPING_TABLE; + +#pragma pack() + +/** Add an _OSC template method to the PciNode. + + The _OSC method is provided as an AML blob. The blob is + parsed and attached at the end of the PciNode list of variable elements. + + @param [in] PciInfo Pci device information. + @param [in, out] PciNode Pci node to amend. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Could not allocate memory. +**/ +EFI_STATUS +EFIAPI +AddOscMethod ( + IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo, + IN OUT AML_OBJECT_NODE_HANDLE PciNode + ); + +/** Generate Pci slots devices. + + PCI Firmware Specification - Revision 3.3, + s4.8 "Generic ACPI PCI Slot Description" requests to describe the PCI sl= ot + used. It should be possible to enumerate them, but this is additional + information. + + @param [in] PciInfo Pci device information. + @param [in] MappingTable The mapping table structure. + @param [in, out] PciNode Pci node to amend. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +EFI_STATUS +EFIAPI +GeneratePciSlots ( + IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo, + IN CONST MAPPING_TABLE *MappingTable, + IN OUT AML_OBJECT_NODE_HANDLE PciNode + ); + +#endif // SSDT_PCIE_SUPPORT_LIB_H_ diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieG= enerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieG= enerator.c index 68ecae96be..62cec3753c 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerato= r.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerato= r.c @@ -29,6 +29,7 @@ #include #include #include +#include #include =20 #include "SsdtPcieGenerator.h" @@ -280,86 +281,6 @@ GeneratePciDeviceInfo ( return Status; } =20 -/** Generate Pci slots devices. - - PCI Firmware Specification - Revision 3.3, - s4.8 "Generic ACPI PCI Slot Description" requests to describe the PCI sl= ot - used. It should be possible to enumerate them, but this is additional - information. - - @param [in] MappingTable The mapping table structure. - @param [in, out] PciNode Pci node to amend. - - @retval EFI_SUCCESS Success. - @retval EFI_INVALID_PARAMETER Invalid parameter. - @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. -**/ -STATIC -EFI_STATUS -EFIAPI -GeneratePciSlots ( - IN CONST MAPPING_TABLE *MappingTable, - IN OUT AML_OBJECT_NODE_HANDLE PciNode - ) -{ - EFI_STATUS Status; - UINT32 Index; - UINT32 LastIndex; - UINT32 DeviceId; - CHAR8 AslName[AML_NAME_SEG_SIZE + 1]; - AML_OBJECT_NODE_HANDLE DeviceNode; - - ASSERT (MappingTable !=3D NULL); - ASSERT (PciNode !=3D NULL); - - // Generic device name is "Dxx". - CopyMem (AslName, "Dxx_", AML_NAME_SEG_SIZE + 1); - - LastIndex =3D MappingTable->LastIndex; - - // There are at most 32 devices on a Pci bus. - if (LastIndex >=3D 32) { - ASSERT (0); - return EFI_INVALID_PARAMETER; - } - - for (Index =3D 0; Index < LastIndex; Index++) { - DeviceId =3D MappingTable->Table[Index]; - AslName[AML_NAME_SEG_SIZE - 3] =3D AsciiFromHex (DeviceId & 0xF); - AslName[AML_NAME_SEG_SIZE - 2] =3D AsciiFromHex ((DeviceId >> 4) & 0xF= ); - - // ASL: - // Device (Dxx) { - // Name (_ADR,
) - // } - Status =3D AmlCodeGenDevice (AslName, PciNode, &DeviceNode); - if (EFI_ERROR (Status)) { - ASSERT (0); - return Status; - } - - /* ACPI 6.4 specification, Table 6.2: "ADR Object Address Encodings" - High word-Device #, Low word-Function #. (for example, device 3, - function 2 is 0x00030002). To refer to all the functions on a devic= e #, - use a function number of FFFF). - */ - Status =3D AmlCodeGenNameInteger ( - "_ADR", - (DeviceId << 16) | 0xFFFF, - DeviceNode, - NULL - ); - if (EFI_ERROR (Status)) { - ASSERT (0); - return Status; - } - - // _SUN object is not generated as we don't know which slot will be us= ed. - } - - return Status; -} - /** Generate a _PRT object (Pci Routing Table) for the Pci device. =20 Cf. ACPI 6.4 specification, s6.2.13 "_PRT (PCI Routing Table)" @@ -495,7 +416,7 @@ GeneratePrt ( PrtNode =3D NULL; =20 // Generate the Pci slots once all the device have been added. - Status =3D GeneratePciSlots (&Generator->DeviceTable, PciNode); + Status =3D GeneratePciSlots (PciInfo, &Generator->DeviceTable, PciNode); if (EFI_ERROR (Status)) { ASSERT (0); goto exit_handler; @@ -695,89 +616,6 @@ GeneratePciCrs ( return Status; } =20 -/** Add an _OSC template method to the PciNode. - - The _OSC method is provided as an AML blob. The blob is - parsed and attached at the end of the PciNode list of variable elements. - - @param [in, out] PciNode Pci node to amend. - - @retval EFI_SUCCESS The function completed successfully. - @retval EFI_INVALID_PARAMETER Invalid parameter. - @retval EFI_OUT_OF_RESOURCES Could not allocate memory. -**/ -STATIC -EFI_STATUS -EFIAPI -AddOscMethod ( - IN OUT AML_OBJECT_NODE_HANDLE PciNode - ) -{ - EFI_STATUS Status; - EFI_STATUS Status1; - EFI_ACPI_DESCRIPTION_HEADER *SsdtPcieOscTemplate; - AML_ROOT_NODE_HANDLE OscTemplateRoot; - AML_OBJECT_NODE_HANDLE OscNode; - - ASSERT (PciNode !=3D NULL); - - // Parse the Ssdt Pci Osc Template. - SsdtPcieOscTemplate =3D (EFI_ACPI_DESCRIPTION_HEADER *) - ssdtpcieosctemplate_aml_code; - - OscNode =3D NULL; - OscTemplateRoot =3D NULL; - Status =3D AmlParseDefinitionBlock ( - SsdtPcieOscTemplate, - &OscTemplateRoot - ); - if (EFI_ERROR (Status)) { - DEBUG (( - DEBUG_ERROR, - "ERROR: SSDT-PCI-OSC: Failed to parse SSDT PCI OSC Template." - " Status =3D %r\n", - Status - )); - return Status; - } - - Status =3D AmlFindNode (OscTemplateRoot, "\\_OSC", &OscNode); - if (EFI_ERROR (Status)) { - goto error_handler; - } - - Status =3D AmlDetachNode (OscNode); - if (EFI_ERROR (Status)) { - goto error_handler; - } - - Status =3D AmlAttachNode (PciNode, OscNode); - if (EFI_ERROR (Status)) { - // Free the detached node. - AmlDeleteTree (OscNode); - goto error_handler; - } - -error_handler: - // Cleanup - Status1 =3D AmlDeleteTree (OscTemplateRoot); - if (EFI_ERROR (Status1)) { - DEBUG (( - DEBUG_ERROR, - "ERROR: SSDT-PCI-OSC: Failed to cleanup AML tree." - " Status =3D %r\n", - Status1 - )); - // If Status was success but we failed to delete the AML Tree - // return Status1 else return the original error code, i.e. Status. - if (!EFI_ERROR (Status)) { - return Status1; - } - } - - return Status; -} - /** Generate a Pci device. =20 @param [in] Generator The SSDT Pci generator. @@ -865,7 +703,7 @@ GeneratePciDevice ( } =20 // Add the template _OSC method. - Status =3D AddOscMethod (PciNode); + Status =3D AddOscMethod (PciInfo, PciNode); ASSERT_EFI_ERROR (Status); return Status; } diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieG= enerator.h b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieG= enerator.h index 515a3e1785..b302e79786 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerato= r.h +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerato= r.h @@ -44,21 +44,6 @@ extern CHAR8 ssdtpcieosctemplate_aml_code[]; =20 #pragma pack(1) =20 -/** Structure used to map integer to an index. -*/ -typedef struct MappingTable { - /// Mapping table. - /// Contains the Index <-> integer mapping - UINT32 *Table; - - /// Last used index of the Table. - /// Bound by MaxIndex. - UINT32 LastIndex; - - /// Number of entries in the Table. - UINT32 MaxIndex; -} MAPPING_TABLE; - /** A structure holding the Pcie generator and additional private data. */ typedef struct AcpiPcieGenerator { diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieL= ibArm.inf b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLi= bArm.inf index 283b564801..b38a4e9d34 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.i= nf +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.i= nf @@ -19,7 +19,6 @@ [Sources] SsdtPcieGenerator.c SsdtPcieGenerator.h - SsdtPcieOscTemplate.asl =20 [Packages] DynamicTablesPkg/DynamicTablesPkg.dec @@ -30,3 +29,4 @@ AcpiHelperLib AmlLib BaseLib + SsdtPcieSupportLib diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieO= scTemplate.asl b/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPci= eOscTemplate.asl similarity index 100% rename from DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieOs= cTemplate.asl rename to DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieOscTem= plate.asl diff --git a/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSup= portLib.c b/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupp= ortLib.c new file mode 100644 index 0000000000..4066653d0b --- /dev/null +++ b/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLib= .c @@ -0,0 +1,200 @@ +/** @file + SSDT Pcie Table Generator. + + Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Reference(s): + - PCI Firmware Specification - Revision 3.0 + - ACPI 6.4 specification: + - s6.2.13 "_PRT (PCI Routing Table)" + - s6.1.1 "_ADR (Address)" + - linux kernel code + - Arm Base Boot Requirements v1.0 + - Arm Base System Architecture v1.0 +**/ + +#include +#include +#include +#include +#include +#include + +// Module specific include files. +#include +#include +#include +#include +#include +#include +#include +#include + +#include "SsdtPcieSupportLibPrivate.h" + +/** Generate Pci slots devices. + + PCI Firmware Specification - Revision 3.3, + s4.8 "Generic ACPI PCI Slot Description" requests to describe the PCI sl= ot + used. It should be possible to enumerate them, but this is additional + information. + + @param [in] PciInfo Pci device information. + @param [in] MappingTable The mapping table structure. + @param [in, out] PciNode Pci node to amend. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +EFI_STATUS +EFIAPI +GeneratePciSlots ( + IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo, + IN CONST MAPPING_TABLE *MappingTable, + IN OUT AML_OBJECT_NODE_HANDLE PciNode + ) +{ + EFI_STATUS Status; + UINT32 Index; + UINT32 LastIndex; + UINT32 DeviceId; + CHAR8 AslName[AML_NAME_SEG_SIZE + 1]; + AML_OBJECT_NODE_HANDLE DeviceNode; + + ASSERT (MappingTable !=3D NULL); + ASSERT (PciNode !=3D NULL); + + // Generic device name is "Dxx". + CopyMem (AslName, "Dxx_", AML_NAME_SEG_SIZE + 1); + + LastIndex =3D MappingTable->LastIndex; + + // There are at most 32 devices on a Pci bus. + if (LastIndex >=3D 32) { + ASSERT (0); + return EFI_INVALID_PARAMETER; + } + + for (Index =3D 0; Index < LastIndex; Index++) { + DeviceId =3D MappingTable->Table[Index]; + AslName[AML_NAME_SEG_SIZE - 3] =3D AsciiFromHex (DeviceId & 0xF); + AslName[AML_NAME_SEG_SIZE - 2] =3D AsciiFromHex ((DeviceId >> 4) & 0xF= ); + + // ASL: + // Device (Dxx) { + // Name (_ADR,
) + // } + Status =3D AmlCodeGenDevice (AslName, PciNode, &DeviceNode); + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + + /* ACPI 6.4 specification, Table 6.2: "ADR Object Address Encodings" + High word-Device #, Low word-Function #. (for example, device 3, + function 2 is 0x00030002). To refer to all the functions on a devic= e #, + use a function number of FFFF). + */ + Status =3D AmlCodeGenNameInteger ( + "_ADR", + (DeviceId << 16) | 0xFFFF, + DeviceNode, + NULL + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + + // _SUN object is not generated as we don't know which slot will be us= ed. + } + + return Status; +} + +/** Add an _OSC template method to the PciNode. + + The _OSC method is provided as an AML blob. The blob is + parsed and attached at the end of the PciNode list of variable elements. + + @param [in] PciInfo Pci device information. + @param [in, out] PciNode Pci node to amend. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Could not allocate memory. +**/ +EFI_STATUS +EFIAPI +AddOscMethod ( + IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo, + IN OUT AML_OBJECT_NODE_HANDLE PciNode + ) +{ + EFI_STATUS Status; + EFI_STATUS Status1; + EFI_ACPI_DESCRIPTION_HEADER *SsdtPcieOscTemplate; + AML_ROOT_NODE_HANDLE OscTemplateRoot; + AML_OBJECT_NODE_HANDLE OscNode; + + ASSERT (PciNode !=3D NULL); + + // Parse the Ssdt Pci Osc Template. + SsdtPcieOscTemplate =3D (EFI_ACPI_DESCRIPTION_HEADER *) + ssdtpcieosctemplate_aml_code; + + OscNode =3D NULL; + OscTemplateRoot =3D NULL; + Status =3D AmlParseDefinitionBlock ( + SsdtPcieOscTemplate, + &OscTemplateRoot + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: SSDT-PCI-OSC: Failed to parse SSDT PCI OSC Template." + " Status =3D %r\n", + Status + )); + return Status; + } + + Status =3D AmlFindNode (OscTemplateRoot, "\\_OSC", &OscNode); + if (EFI_ERROR (Status)) { + goto error_handler; + } + + Status =3D AmlDetachNode (OscNode); + if (EFI_ERROR (Status)) { + goto error_handler; + } + + Status =3D AmlAttachNode (PciNode, OscNode); + if (EFI_ERROR (Status)) { + // Free the detached node. + AmlDeleteTree (OscNode); + goto error_handler; + } + +error_handler: + // Cleanup + Status1 =3D AmlDeleteTree (OscTemplateRoot); + if (EFI_ERROR (Status1)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: SSDT-PCI-OSC: Failed to cleanup AML tree." + " Status =3D %r\n", + Status1 + )); + // If Status was success but we failed to delete the AML Tree + // return Status1 else return the original error code, i.e. Status. + if (!EFI_ERROR (Status)) { + return Status1; + } + } + + return Status; +} diff --git a/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSup= portLib.inf b/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSu= pportLib.inf new file mode 100644 index 0000000000..bbdb6ac6c8 --- /dev/null +++ b/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLib= .inf @@ -0,0 +1,30 @@ +## @file +# Ssdt Serial Port Table Support Library +# +# Copyright (c) 2021, Arm Limited. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D SsdtPcieSupportLib + FILE_GUID =3D 510451a0-60b2-446c-b6bf-59cbe4a41782 + VERSION_STRING =3D 1.0 + MODULE_TYPE =3D DXE_DRIVER + LIBRARY_CLASS =3D SsdtPcieSupportLib + +[Sources] + SsdtPcieSupportLib.c + SsdtPcieSupportLibPrivate.h + SsdtPcieOscTemplate.asl + +[Packages] + DynamicTablesPkg/DynamicTablesPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + AcpiHelperLib + AmlLib + BaseLib diff --git a/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSup= portLibPrivate.h b/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtP= cieSupportLibPrivate.h new file mode 100644 index 0000000000..a5dd1af660 --- /dev/null +++ b/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLib= Private.h @@ -0,0 +1,25 @@ +/** @file + SSDT Pcie Support Library private data. + + Copyright (c) 2021, Arm Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Reference(s): + - PCI Firmware Specification - Revision 3.0 + - ACPI 6.4 specification: + - s6.2.13 "_PRT (PCI Routing Table)" + - s6.1.1 "_ADR (Address)" + - linux kernel code + - Arm Base Boot Requirements v1.0 +**/ + +#ifndef SSDT_PCIE_SUPPORT_LIB_PRIVATE_H_ +#define SSDT_PCIE_SUPPORT_LIB_PRIVATE_H_ + +/** C array containing the compiled AML template. + This symbol is defined in the auto generated C file + containing the AML bytecode array. +*/ +extern CHAR8 ssdtpcieosctemplate_aml_code[]; + +#endif // SSDT_PCIE_SUPPORT_LIB_PRIVATE_H_ --=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 (#91193): https://edk2.groups.io/g/devel/message/91193 Mute This Topic: https://groups.io/mt/92260871/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-