From nobody Sat Feb 7 04:40:47 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+91502+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+91502+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1658190354; cv=none; d=zohomail.com; s=zohoarc; b=HituhgT1EBGlunayd19V4u2mn1Orygg4M0X8hfi8/9RiF/kVF/gO2AgMxZYYxIfE3mQVt4+Mgh0Og7v2s93yC128iHN84xGJsIwxB7ww6nx4d8OsfK17L6FKmkQ7f5A6jA7kiZklsKSpxhXfEyjxLQ1mHKjj8B/SPrLeHOLROb4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658190354; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=54vl/Pgu1cJWayOdY/UEr9lE88PTvUN8bo/Qg2gR9yw=; b=jSC8AzELr3U3N3n9TYWrOWhJ+3fj0vnRurA/rFNBa/nisFGWyH5NaSYR6ndVIZp8I6i9BFDo4yDmQ/x6zimpVLhIBtyqO2YCskyPWgvoZBVfoXcCz8oxwGYeRw9NiTbOIfW+26JMqXXVb8eVfs6UCG1ozTFsspug20R9BqwHr6s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+91502+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 165819035473797.30739707069131; Mon, 18 Jul 2022 17:25:54 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 974MYY1788612xnSDUT28a0j; Mon, 18 Jul 2022 17:25:54 -0700 X-Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by mx.groups.io with SMTP id smtpd.web09.34993.1658190348641829540 for ; Mon, 18 Jul 2022 17:25:48 -0700 X-Received: by mail-pg1-f169.google.com with SMTP id 72so12104256pge.0 for ; Mon, 18 Jul 2022 17:25:48 -0700 (PDT) X-Gm-Message-State: E74SgFxgvwYyR3bYSMvRusqQx1787277AA= X-Google-Smtp-Source: AGRyM1vUImT0vTy6RWrntpjTf9mvyYuuKyEBdHPM4Z9jlusrwYW5V32X/pV6+qqhdEiaEGViAI9KxQ== X-Received: by 2002:a63:210f:0:b0:40d:dd27:8361 with SMTP id h15-20020a63210f000000b0040ddd278361mr26863026pgh.306.1658190347964; Mon, 18 Jul 2022 17:25:47 -0700 (PDT) X-Received: from MININT-0U7P5GU.redmond.corp.microsoft.com ([2001:4898:80e8:9:6532:8264:ce7d:ced]) by smtp.gmail.com with ESMTPSA id n10-20020aa7984a000000b005251c6fbd0csm9941521pfq.29.2022.07.18.17.25.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 17:25:47 -0700 (PDT) From: "Kun Qin" To: devel@edk2.groups.io Cc: Joe Lopez Subject: [edk2-devel] [PATCH v1 5/6] DynamicTablesPkg: AcpiSsdtPcieLibArm: Added function to reserve ECAM space Date: Mon, 18 Jul 2022 17:22:53 -0700 Message-Id: <20220719002254.1891-6-kuqin12@gmail.com> In-Reply-To: <20220719002254.1891-1-kuqin12@gmail.com> References: <20220719002254.1891-1-kuqin12@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kuqin12@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1658190354; bh=VQ/MXaSlKTHseyJRtHsqJuSrexs+L6XKMMWuQGjzTsU=; h=Cc:Date:From:Reply-To:Subject:To; b=rfmOhBIRKYCimUJ79aozNJGjFT7d6C9qNUdGcX1wBHmzOJIsUadcS70Du4xuj4LVFsB jJ4HOoFrWaUpk4PlSFQecpm2ZKu2WIyIDSE8Vodysg9+YbdXXQAV71kLLJPLzfjP1ZzbR 3k2JYnUsLk1zyuSnwbGWb0NH9zKkJMrn8f4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1658190355422100001 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3998 Certain OSes will complain if the ECAM config space is not reserved in the ACPI namespace. This change adds a function to reserve PNP motherboard resources for a given PCI node. Co-authored-by: Joe Lopez Signed-off-by: Kun Qin --- DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c |= 130 ++++++++++++++++++++ 1 file changed, 130 insertions(+) diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieG= enerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieG= enerator.c index 626e53d70205..d9ed513a2ee3 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerato= r.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerato= r.c @@ -772,6 +772,128 @@ error_handler: return Status; } =20 +/** Generate a Pci Resource Template to hold Address Space Info + + @param [in] Generator The SSDT Pci generator. + @param [in] CfgMgrProtocol Pointer to the Configuration Manager + Protocol interface. + @param [in] PciInfo Pci device information. + @param [in, out] PciNode RootNode of the AML tree to populate. + + @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 +GeneratePciRes ( + IN ACPI_PCI_GENERATOR *Generator, + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtoc= ol, + IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo, + IN OUT AML_OBJECT_NODE_HANDLE PciNode + ) +{ + EFI_STATUS Status; + UINT32 EisaId; + AML_OBJECT_NODE_HANDLE ResNode; + AML_OBJECT_NODE_HANDLE CrsNode; + BOOLEAN Translation; + UINT32 Index; + CM_ARM_OBJ_REF *RefInfo; + UINT32 RefCount; + CM_ARM_PCI_ADDRESS_MAP_INFO *AddrMapInfo; + + // ASL: Device (PCIx) {} + Status =3D AmlCodeGenDevice ("RES0", PciNode, &ResNode); + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + + // ASL: Name (_HID, EISAID ("PNP0C02")) + Status =3D AmlGetEisaIdFromString ("PNP0C02", &EisaId); /* PNP Motherboa= rd Resources */ + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + + Status =3D AmlCodeGenNameInteger ("_HID", EisaId, ResNode, NULL); + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + + // ASL: Name (_CRS, ResourceTemplate () {}) + Status =3D AmlCodeGenNameResourceTemplate ("_CRS", ResNode, &CrsNode); + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + + // Get the array of CM_ARM_OBJ_REF referencing the + // CM_ARM_PCI_ADDRESS_MAP_INFO objects. + Status =3D GetEArmObjCmRef ( + CfgMgrProtocol, + PciInfo->AddressMapToken, + &RefInfo, + &RefCount + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + + for (Index =3D 0; Index < RefCount; Index++) { + // Get CM_ARM_PCI_ADDRESS_MAP_INFO structures one by one. + Status =3D GetEArmObjPciAddressMapInfo ( + CfgMgrProtocol, + RefInfo[Index].ReferenceToken, + &AddrMapInfo, + NULL + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + + Translation =3D (AddrMapInfo->CpuAddress !=3D AddrMapInfo->PciAddress); + + switch (AddrMapInfo->SpaceCode) { + case PCI_SS_CONFIG: + Status =3D AmlCodeGenRdQWordMemory ( + FALSE, + TRUE, + TRUE, + TRUE, + FALSE, // non-cacheable + TRUE, + 0, + AddrMapInfo->PciAddress, + AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1, + Translation ? AddrMapInfo->CpuAddress : 0, + AddrMapInfo->AddressSize, + 0, + NULL, + 0, + TRUE, + CrsNode, + NULL + ); + break; + default: + break; + } // switch + + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + } + + return Status; +} + /** Generate a Pci device. =20 @param [in] Generator The SSDT Pci generator. @@ -855,9 +977,17 @@ GeneratePciDevice ( return Status; } =20 + // Add the PNP Motherboard Resources Device to reserve ECAM space + Status =3D GeneratePciRes (Generator, CfgMgrProtocol, PciInfo, PciNode); + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + // Add the template _OSC method. Status =3D AddOscMethod (PciNode); ASSERT_EFI_ERROR (Status); + return Status; } =20 --=20 2.36.0.windows.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 (#91502): https://edk2.groups.io/g/devel/message/91502 Mute This Topic: https://groups.io/mt/92473116/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-