From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (EUR03-DBA-obe.outbound.protection.outlook.com [40.107.104.64]) by mx.groups.io with SMTP id smtpd.web11.25549.1659964968801376962 for ; Mon, 08 Aug 2022 06:22:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=mY+7stjf; spf=pass (domain: arm.com, ip: 40.107.104.64, mailfrom: sami.mujawar@arm.com) ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=IzLrfPL2DP1qhBTuSBlbthbKY8tpZtPiuC8wjG4rhxVJL39w9eWbCw3vDXNDTOqdmwMh4OENNBzKi1xlVvtYFkbTdBrTJjk7ioTY0zcGpC2lpGxtLtPDCWYR10nlnoWTce40SMGRcjiPCcvncTId5yggCLtK/kK44agxLfzpQV/rdNwcnBUcptzcpiiKXUkrcOSr1mxQYXe2yUIdYYLsTmN+6/Zcfmc3lgKvAj/J/9WlcVd9xDLdxa4Mm/WoMw/FQ5hPTVSuGHYD69laui0TPAx6VJXuYC+BS6KsZoWDmNbCWF29DPglGvOd1k+cyho//dqPeStNYYVTiMpCTzwZng== ARC-Message-Signature: i=2; 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=dWx/G1Y1wSUIf/Ql6eDGmouOuKIdVvTSqCDf5U7A7HU=; b=hoc9SwBkh4eImnZOnVQrBSTGWEQAygzrCEzUR6FfQ09bfXdMYqnzU/Rnud43TRHVP8KtyToBx4nBhwvNK6WC3+6hlhFaIX4krNOSQhRsxK/s8EdkS+Uvjd1OULuVpsjP9mPMPqKDcUFucOH08cjwwkMKjzw64LSBHBV/5X/sQEP2dzeBal/37EqY39L5xRO1oHon8XQykPyE0MPBAhcEbm6+43YuCl4kR6OaCYyvZk4qRXycEcURIqiTH3Y4EfY7m4IthKHZswEaRn8ILgE4YQXhLsZC8vGWkx9VUKH4+0ROawkh7e+nPzbJ8sE7Bz59JAE4904+ngRbw9yx+IvFrw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dWx/G1Y1wSUIf/Ql6eDGmouOuKIdVvTSqCDf5U7A7HU=; b=mY+7stjf2fBq8NBQ5yVdZotTrKa5mSCU+UPn64dw0CZGT0A94n5pGDuRu/rNHlwHOxMYMrRbVlqE+B/2lmCy0FSPrFdtGxTY3PX3VhUTwNt5MTJM+zsmHYw4bQnSkjtrfflaaEd0+H80NUbb3g5d8uz0UGsh+JdNguFA/GJt/4s= Received: from AS9PR06CA0693.eurprd06.prod.outlook.com (2603:10a6:20b:49f::9) by PAXPR08MB6704.eurprd08.prod.outlook.com (2603:10a6:102:130::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Mon, 8 Aug 2022 13:22:45 +0000 Received: from VE1EUR03FT041.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:49f:cafe::a2) by AS9PR06CA0693.outlook.office365.com (2603:10a6:20b:49f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.15 via Frontend Transport; Mon, 8 Aug 2022 13:22:45 +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 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT041.mail.protection.outlook.com (10.152.19.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14 via Frontend Transport; Mon, 8 Aug 2022 13:22:45 +0000 Received: ("Tessian outbound fccf984e7173:v123"); Mon, 08 Aug 2022 13:22:45 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: d211c07725dbccc9 X-CR-MTA-TID: 64aa7808 Received: from 4442f354d03a.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E7C58331-A306-4F11-A2DF-3BA416405392.1; Mon, 08 Aug 2022 13:22:34 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 4442f354d03a.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 08 Aug 2022 13:22:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DhWiMljqrM9o5kwNW85AjZRAzgSKv1d/1HDanB/1eNKm/E3+Gr2bGV4PlP7lY9FT6QZu8VIwz9yzBxlZHtcNJ7ufAmThgZHEINQjkkm7isxCNHP8RcxiqJtWjX9Ysvtv7uYv8BzcHHgYh0a9Sd0u+yA+HIlwbINV6p/3yXCEN+ozBndmjINO1z01d1V6L0CvzFPlRHZQy9QlwWWpEAoUKVZuL0pGSxAA7YNIS8fu4IuESVJNojYeyVx1w5RxKJyP4j+xdQDBcKc5yosJ6t2W1hWttepd5YR2xLpY/ScQ8NtwSx87Nk6Zt4wi/p1ig9QsKRHuKJahQ+8fcruiAWcE4Q== 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=dWx/G1Y1wSUIf/Ql6eDGmouOuKIdVvTSqCDf5U7A7HU=; b=fgoM9oFJJ8WYskNo8MsbkG5rbpObPPndOH9pZWKV0xb8OoZfELAbYt272XRxn3xOL707pQGp21tnOGJYCyZ0c/+ESgz5gMtqq6VcovueYaDViqQjWhgAHPwzIjKFca51jcU3ojcNfe6DGA/X69Bcrg91GCjQ0f7asDJSWDpJCW19bTYeAavOE9FhaM7jg3l84gldJAWg9YqGQWeqBAbedW3K0SmsoqQa+GLDnGoHv5cDaHoLWaadlzGQ1JbkLMXFPGDQG/x5dJnWomrA4nR9xCuSJoG8tQv3V+Bvtu3Nl60dq1q5ztLxt0w+nH3dXskXBZ+j9NBHDX8ZWklq7GoMTw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dWx/G1Y1wSUIf/Ql6eDGmouOuKIdVvTSqCDf5U7A7HU=; b=mY+7stjf2fBq8NBQ5yVdZotTrKa5mSCU+UPn64dw0CZGT0A94n5pGDuRu/rNHlwHOxMYMrRbVlqE+B/2lmCy0FSPrFdtGxTY3PX3VhUTwNt5MTJM+zsmHYw4bQnSkjtrfflaaEd0+H80NUbb3g5d8uz0UGsh+JdNguFA/GJt/4s= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) by DU0PR08MB7946.eurprd08.prod.outlook.com (2603:10a6:10:3ca::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.16; Mon, 8 Aug 2022 13:22:31 +0000 Received: from AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::d562:5a52:f638:7fe9]) by AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::d562:5a52:f638:7fe9%4]) with mapi id 15.20.5504.020; Mon, 8 Aug 2022 13:22:31 +0000 Message-ID: <7b2fb1d3-6acf-9cc8-025d-2ef598976df4@arm.com> Date: Mon, 8 Aug 2022 14:22:29 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [edk2-devel] [PATCH v3 5/6] DynamicTablesPkg: AcpiSsdtPcieLibArm: Added function to reserve ECAM space To: devel@edk2.groups.io, kuqin12@gmail.com Cc: Joe Lopez , Pierre Gondois , "nd@arm.com" References: <20220731053727.536-1-kuqin12@gmail.com> <20220731053727.536-6-kuqin12@gmail.com> From: "Sami Mujawar" In-Reply-To: <20220731053727.536-6-kuqin12@gmail.com> X-ClientProxiedBy: LO2P265CA0365.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a3::17) To AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 6c0fde03-a5e7-4ffe-6bc4-08da794114c8 X-MS-TrafficTypeDiagnostic: DU0PR08MB7946:EE_|VE1EUR03FT041:EE_|PAXPR08MB6704:EE_ 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: pIOiU21HR5EPK6DS7UrqDBLDGagUrgKO2WYKnthjLY66FPz/+4R7ctIxsRT1xserDyaOQ9kxK59oDy0mc5IzdKC1aoPFJQMeK5B6a082mZItcWWmn5dftuzN3RuCk0XdKWd30hwWpuuqIF7Ae/T61BCIbP70YjsaZ61P2tXLBbKmanA6JbQscIG352noJ2mQmEtx6fTvarGiOSUOOUP/OCH7A/DTBWfExtIqu14vBFYqqhPPO59wToON37YKxS8c4nrE81N2oBtpcmbi6hI+yzO3doftZW2O0LmtT0tdRxM1xa/u8FZvPCoG3ZzvB2AAucW2fqLmRxfrBwms1VGNHPtjZZYt/2Q94rgm/DxC1DV27Wl3mBAiJ6m1kApBQZD8UDiP4V+fSol3jyJoawvkHbHixGhz/ZrPaiLcWjQcsoSjMIHJku783rO26d31+JAKpXbYV7VSTWDU52wa3tO1tPe0PItvBNquU5kQghfD+CPa/fb0lNapUiSHGXBR94AyxDuG660LjHsPfg+r7KuDh+YrrXKvxSRmJv8OsNwURI8NL/3qXn6v2wByFZ58lAV4epcoV3yCfVN74BdQk1SU0cXdIenMOSvZhk8BXFDc7csGRwObtljCd2cFjSY57/CAKbpgena7MNaw2WTuS0qIpzd9RMc5UXy2NnWzXyVxsDeQeuQcSaOwxFcAPD2oUxanRKM3qyD2lYY1tkD17gkLQPBBPO5p5O76XsQkFeHGuvJhXIQqYveDo/39JTW31GAy855ktLcmIn2+Jb7gHhMuUDoWDtnm7Rn30xMKFKhqBO+oQDd2/PPIzwLiz7ZGgveWw7nuaB9PhHFxwNNrNOcWAGxryS6tj+/mTLS7MmAlSKWhbvsoDrC4UtKYf9mnDWRMrT/LZbVpQTBEeFlAjw46qg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR08MB6806.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(396003)(376002)(346002)(136003)(39860400002)(366004)(316002)(8676002)(4326008)(36756003)(44832011)(66476007)(66556008)(5660300002)(45080400002)(6486002)(966005)(66946007)(2906002)(54906003)(478600001)(86362001)(38100700002)(2616005)(6512007)(6506007)(53546011)(26005)(31696002)(41300700001)(31686004)(8936002)(186003)(83380400001)(213903007)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB7946 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT041.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: ee2f0c97-b4d8-4280-b5d5-08da79410c40 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +8CoQ2e1Dwg471GMQFMlNhSbHN7YZdkvFqxN42/O3AHM+bA3XW1UIYAV9bocxoi+bFMQ6wlTvrvyUr6kXNpaUY/OM4//9cyhrLQ8gboIIcVoh8dN3HFYn8i6N+1LnX4iI4+h4bDt2Kioil5XL5VZcKJdYizkzvTE7+4fNWLU/FdWDEH3tJ7L/Id34+KRU+FTbVyPzIGpFcLOBLqqiGmx6Q9krXOACQnbzaGHUcqAXow86031y7Ki+ZvgyjbygSnfWZ3Y7FDgHoOlOgfFaT7sfovfp4R/mJsu6HSoQ64g8WZ4fgEWeU8uIhVjs/S6omPt5h+MXwWFwxzEeZe5H2Rg4bQ0Du4hRNqc6qWNHXSGEnTC8Ac0nAd16DLBFO16bednVBXA4tEAj/H2n0XD1zywb6kcX8JrmoN6sQJVyQfMhvgU5t5UUEQ1pkDNn+Du0zUGraR9z1e2+g22rzIu75dhsB1WTVPIu/IsWRT++sv1b+PClzGBut94JPblY180uQEpu5AEZx5eMw7qNE4usvrrFEtx2aAHzURvPHCWUOWJBju7f3aKFdrUxYO7cchhjDwwsMexn/qoQcI41XtMzMA4kzKsdEqxHYKgKzsg7dXeSZeKdqaVuDJ4XMMfiHnloPUB7ye0g50bpSqXGJRJaM48xuZMXynFQtUclam1A8gTKrSjoFmeHatJ/37qo6GMBtRFqoIDqvbAN068AjhMMgM7DFQq87NrlZZTpVQmd49zPsAOK35wh1zYgBFU/IEMahZthzSXn/lvVUWqjAKD6a0wfUvJugoWhoJK53PWbrtO6Iw+Kr8p3X2zxssg0o4u4inOzN/tU6rRryaIB+UDX1+E8vcWXJOExa+p3BC5sMhht9lim8Vcq8wxwJaACbSu5rb5K4LtRJnfkWPo54AgWhbUXg== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230016)(4636009)(136003)(346002)(396003)(39860400002)(376002)(46966006)(36840700001)(40470700004)(356005)(45080400002)(82310400005)(81166007)(40480700001)(82740400003)(186003)(31686004)(36756003)(47076005)(316002)(54906003)(336012)(83380400001)(2616005)(6486002)(40460700003)(8676002)(26005)(966005)(8936002)(4326008)(44832011)(5660300002)(478600001)(2906002)(70206006)(31696002)(6506007)(86362001)(36860700001)(53546011)(70586007)(6512007)(41300700001)(213903007)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2022 13:22:45.3454 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6c0fde03-a5e7-4ffe-6bc4-08da794114c8 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: VE1EUR03FT041.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6704 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Kun, Thank you for this patch. These changes look good to me. Reviewed-by: Sami Mujawar Regards, Sami Mujawar On 31/07/2022 06:37 am, Kun Qin via groups.io wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3998 > > 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 > Reviewed-by: Pierre Gondois > --- > > Notes: > v2: > - Only create RES0 after config space checking [Pierre] > > v3: > - Updated function names and descriptions [Pierre] > - Moved translation calculation to CONFIG case [Pierre] > > DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c | 171 ++++++++++++++++++++ > 1 file changed, 171 insertions(+) > > diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c > index ceffe2838c03..658a089c8f1f 100644 > --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c > +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c > @@ -616,6 +616,169 @@ GeneratePciCrs ( > return Status; > > } > > > > +/** Generate a RES0 device node to reserve PNP motherboard resources > > + for a given PCI node. > > + > > + @param [in] PciNode Parent PCI node handle of the generated > > + resource object. > > + @param [out] CrsNode CRS node of the AML tree to populate. > > + > > + @retval EFI_SUCCESS The function completed successfully. > > + @retval EFI_INVALID_PARAMETER Invalid input parameter. > > + @retval EFI_OUT_OF_RESOURCES Could not allocate memory. > > +**/ > > +STATIC > > +EFI_STATUS > > +EFIAPI > > +GenerateMotherboardDevice ( > > + IN AML_OBJECT_NODE_HANDLE PciNode, > > + OUT AML_OBJECT_NODE_HANDLE *CrsNode > > + ) > > +{ > > + EFI_STATUS Status; > > + UINT32 EisaId; > > + AML_OBJECT_NODE_HANDLE ResNode; > > + > > + if (CrsNode == NULL) { > > + ASSERT (0); > > + return EFI_INVALID_PARAMETER; > > + } > > + > > + // ASL: Device (RES0) {} > > + Status = AmlCodeGenDevice ("RES0", PciNode, &ResNode); > > + if (EFI_ERROR (Status)) { > > + ASSERT (0); > > + return Status; > > + } > > + > > + // ASL: Name (_HID, EISAID ("PNP0C02")) > > + Status = AmlGetEisaIdFromString ("PNP0C02", &EisaId); /* PNP Motherboard Resources */ > > + if (EFI_ERROR (Status)) { > > + ASSERT (0); > > + return Status; > > + } > > + > > + Status = AmlCodeGenNameInteger ("_HID", EisaId, ResNode, NULL); > > + if (EFI_ERROR (Status)) { > > + ASSERT (0); > > + return Status; > > + } > > + > > + // ASL: Name (_CRS, ResourceTemplate () {}) > > + Status = AmlCodeGenNameResourceTemplate ("_CRS", ResNode, CrsNode); > > + if (EFI_ERROR (Status)) { > > + ASSERT (0); > > + return Status; > > + } > > + > > + return Status; > > +} > > + > > +/** Reserves ECAM space for PCI config space > > + > > + @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 > > +ReserveEcamSpace ( > > + IN ACPI_PCI_GENERATOR *Generator, > > + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, > > + IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo, > > + IN OUT AML_OBJECT_NODE_HANDLE PciNode > > + ) > > +{ > > + EFI_STATUS Status; > > + AML_OBJECT_NODE_HANDLE CrsNode; > > + BOOLEAN Translation; > > + UINT32 Index; > > + CM_ARM_OBJ_REF *RefInfo; > > + UINT32 RefCount; > > + CM_ARM_PCI_ADDRESS_MAP_INFO *AddrMapInfo; > > + BOOLEAN IsPosDecode; > > + > > + // Get the array of CM_ARM_OBJ_REF referencing the > > + // CM_ARM_PCI_ADDRESS_MAP_INFO objects. > > + Status = GetEArmObjCmRef ( > > + CfgMgrProtocol, > > + PciInfo->AddressMapToken, > > + &RefInfo, > > + &RefCount > > + ); > > + if (EFI_ERROR (Status)) { > > + ASSERT (0); > > + return Status; > > + } > > + > > + for (Index = 0; Index < RefCount; Index++) { > > + // Get CM_ARM_PCI_ADDRESS_MAP_INFO structures one by one. > > + Status = GetEArmObjPciAddressMapInfo ( > > + CfgMgrProtocol, > > + RefInfo[Index].ReferenceToken, > > + &AddrMapInfo, > > + NULL > > + ); > > + if (EFI_ERROR (Status)) { > > + ASSERT (0); > > + return Status; > > + } > > + > > + switch (AddrMapInfo->SpaceCode) { > > + case PCI_SS_CONFIG: > > + Translation = (AddrMapInfo->CpuAddress != AddrMapInfo->PciAddress); > > + if (AddrMapInfo->CpuAddress >= AddrMapInfo->PciAddress) { > > + IsPosDecode = TRUE; > > + } else { > > + IsPosDecode = FALSE; > > + } > > + > > + Status = GenerateMotherboardDevice (PciNode, &CrsNode); > > + if (EFI_ERROR (Status)) { > > + ASSERT (0); > > + break; > > + } > > + > > + Status = AmlCodeGenRdQWordMemory ( > > + FALSE, > > + IsPosDecode, > > + TRUE, > > + TRUE, > > + FALSE, // non-cacheable > > + TRUE, > > + 0, > > + AddrMapInfo->PciAddress, > > + AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1, > > + Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress : 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. > > > > @param [in] Generator The SSDT Pci generator. > > @@ -702,9 +865,17 @@ GeneratePciDevice ( > return Status; > > } > > > > + // Add the PNP Motherboard Resources Device to reserve ECAM space > > + Status = ReserveEcamSpace (Generator, CfgMgrProtocol, PciInfo, PciNode); > > + if (EFI_ERROR (Status)) { > > + ASSERT (0); > > + return Status; > > + } > > + > > // Add the template _OSC method. > > Status = AddOscMethod (PciInfo, PciNode); > > ASSERT_EFI_ERROR (Status); > > + > > return Status; > > } > > >