From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (EUR02-HE1-obe.outbound.protection.outlook.com [40.107.1.62]) by mx.groups.io with SMTP id smtpd.web09.13585.1633533276340193727 for ; Wed, 06 Oct 2021 08:14:37 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=kaMYiTvW; spf=pass (domain: arm.com, ip: 40.107.1.62, mailfrom: sami.mujawar@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=+uasDAKtitkH5Q7jRMzA72GFvFUQpkup2LXCO5Qm+jY=; b=kaMYiTvWDHTZ0y2xnucpp43FP7LwtOOAPaazr3hGMq4Zfqj6eZ8icC/IanGQC2iLL0WFay0czL+u2ffMJr1JpQS2RcCvld4WwXJP3iXeYfaDrD89854t2gy+5UlbYDMC+FsCbihTtcIA68ZqUMUaUEIHQbPoTPj/SoIBTe8pPB0= Received: from AM0PR10CA0093.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::46) by AS8PR08MB5880.eurprd08.prod.outlook.com (2603:10a6:20b:29f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.22; Wed, 6 Oct 2021 15:14:32 +0000 Received: from VE1EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:208:15:cafe::35) by AM0PR10CA0093.outlook.office365.com (2603:10a6:208:15::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.21 via Frontend Transport; Wed, 6 Oct 2021 15:14:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; 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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT059.mail.protection.outlook.com (10.152.19.60) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18 via Frontend Transport; Wed, 6 Oct 2021 15:14:31 +0000 Received: ("Tessian outbound e27daf245730:v103"); Wed, 06 Oct 2021 15:14:31 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 3d6c38b33f2522e7 X-CR-MTA-TID: 64aa7808 Received: from bd4db0b30c85.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0650D798-2965-48B0-8E94-B2DC3C3CBA64.1; Wed, 06 Oct 2021 15:14:20 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id bd4db0b30c85.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 06 Oct 2021 15:14:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MOxfNUSHY7Jz8HEDYBJPc0jmCh8nfVmT1QxlWjopk0JatnVaIODQJMLSkKl/KB5zbq+Ig7IvSMMh/BCbHJ+POi1YHfurJ9JCyU8TdToF07lyY+YQ6Q+/bf4mDw5azkakT+/LMW+IVIXE8vjznOrzxWTpXuCkNzFkugUXeV0wTxw86b5/55PDUjqZYInl9DMdtzYx4dUvcvq6bhDtXcZ0eMWOwDOJOtqeQAdmWmRBZPkfrg/GxS2NdOrjas632F8Cj15/fmVE7Mp78K4Kz/B3R/00/TwerHcUSpS3/y38zsA6Ln5GJt2Vnk4j+rlaqEUbEXq84+xZoI2Y2ZBpPXQknA== 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=+uasDAKtitkH5Q7jRMzA72GFvFUQpkup2LXCO5Qm+jY=; b=Kb47EK9hW5IOfZ3DWTgN1PnvAO590aFEco9GJny5Uc0Q5vLURUFnTRUWIDVh8fhMwfsDKaS4VQK21CdnLyC099QBp+wy347bL7h1Nm8uSI7vnsFKyZlArVaKjbRhzapi0f9pBfnY8YeMERdbe8LJJjfwo9TlJf5MrkCZrP01Eha7RxOFUzuMEAC6Gbp9KUN3rI5qBTdmZ5bK0XCjZRcVqmxkFQX3MPSZ/TtAUmDor0MIP68sIC5w18+TA1+KDeGqSADGtSXNI4A49RTHPo8sw7NC5hcEawEjZx/vPBLN5UVLR6GIVTiyb0t5zfYfZGmNEMlQSOHRhPD03d9l50mKfA== 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=+uasDAKtitkH5Q7jRMzA72GFvFUQpkup2LXCO5Qm+jY=; b=kaMYiTvWDHTZ0y2xnucpp43FP7LwtOOAPaazr3hGMq4Zfqj6eZ8icC/IanGQC2iLL0WFay0czL+u2ffMJr1JpQS2RcCvld4WwXJP3iXeYfaDrD89854t2gy+5UlbYDMC+FsCbihTtcIA68ZqUMUaUEIHQbPoTPj/SoIBTe8pPB0= Authentication-Results-Original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; Received: from AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) by AM6PR08MB5079.eurprd08.prod.outlook.com (2603:10a6:20b:e8::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.22; Wed, 6 Oct 2021 15:14:17 +0000 Received: from AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::54b5:239d:9896:ee65]) by AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::54b5:239d:9896:ee65%4]) with mapi id 15.20.4566.022; Wed, 6 Oct 2021 15:14:17 +0000 Subject: Re: [PATCH v1 1/7] DynamicTablesPkg: AML Code generation for memory ranges To: Pierre.Gondois@arm.com, devel@edk2.groups.io, Alexei Fedorov Cc: Akanksha Jain , Alexandru Elisei , nd References: <20210623115834.907-1-Pierre.Gondois@arm.com> <20210623115834.907-2-Pierre.Gondois@arm.com> From: "Sami Mujawar" Message-ID: <64fb105e-4c1a-2a60-3097-e976ce8dfd26@arm.com> Date: Wed, 6 Oct 2021 16:14:20 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 In-Reply-To: <20210623115834.907-2-Pierre.Gondois@arm.com> X-ClientProxiedBy: LO4P123CA0235.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a7::6) To AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) MIME-Version: 1.0 Received: from [10.1.196.43] (217.140.106.52) by LO4P123CA0235.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.15 via Frontend Transport; Wed, 6 Oct 2021 15:14:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: afd6ae1d-f48f-42fd-91de-08d988dbffbe X-MS-TrafficTypeDiagnostic: AM6PR08MB5079:|AS8PR08MB5880: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7219;OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: ORgHatUX+iO3mvjG5fDxRdArbkv1jV8fAGtdNTcgykXqwcP7LDBVC3wY3kWZftZBDMVOFkFmJC9qFsocCj00hE6+ztnV3zel9UySRbC2wFc98H9yRIkZPdW/Ox/+zZyhwgSVSefQodqoe4M/kCckhDInQJCo7jb1xLyRbZ632PIRc03yG5urnpfHnqEjEmS+DcbodmEfi/63h66i1ZLiBrl/B3bsUVsp6pqTWsiWQs1ciy0J2UgraZJrGOPBFK2QUsJwgawJ3VgeiEVtRJaU69VU34FDBPHgHx0EcrLkIuFGcVuuzqOLrxtnlYR8ajGXtELYlCTCOEaahWp9cKAR4y+vwWft8g11tH5TWnrxdgVs7VMgLQLJgYMDueItgmbPMln71m4Z1/l1ZE49w9Fiul3Y4YvecqONUB7AjK0zMt5THIOBgVFcb14Zx0j5eb3q6rvS9OAo1lbTOgAvnaJCCPgiWDyPDg5KmSA7oP97mXjECA4/9PY8sY8pPlxkotphQ+R/jLjDIvLT6MtviNXCGjzfWnJ2kH4mIUyIoXpYozikTHUtYd2BfUQqfa15nLKQ0+oMPws0Yq6S8Xr3pDMxz5X+goS263wpfr+lXBkeiOAnGqQL/GUh3nTi1bkSUndJYc/TL2EIuIHsmZBeXIl4DYd3AXeCx80S30WcIcKXorDC/N/HUh9OhDkpr2sKGRhvOL07Q6q0BkbaDTJ5yUv+46lZWgLN7UKtKpHWNNgwyfgFjPrc96pSVB/RYklL1J+wcLk0q8dcRWsqkmRRMsNU2w== 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:(4636009)(366004)(6486002)(38350700002)(2616005)(38100700002)(86362001)(36756003)(316002)(16576012)(956004)(26005)(6636002)(31696002)(186003)(8676002)(44832011)(37006003)(508600001)(66476007)(66556008)(53546011)(66946007)(6666004)(30864003)(52116002)(4326008)(5660300002)(31686004)(19627235002)(2906002)(6862004)(54906003)(83380400001)(8936002)(43740500002)(45980500001)(559001)(579004);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5079 Original-Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: f0aa9094-6d02-44b1-3058-08d988dbf689 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9Hexg8oLsn9MfRsInZfxS/IifsUNYRC1WDcrrW/A8No9jI6kkJDh59kX3Q5qCfv/qESG5efrnKea3QAYlcUr3KmeirXWQxSwms3BcSw0hv8pGU2yPYskEUvF3LP+zHYa/SxyCvSYe1SDwWBS1v74FsXjYRq9rmsDY1TCg+iu8PO3gLgp3qJBnNXpjbzvXe7CUI2i9e9pKkMpY0OyF3yUbADEjT8kxcvrIGhSTUlPaUipxJbzoi4Va7BWgyAAzrXGE+SDJE/qk0+Y4efboAKOZgh+tCTzFoAEUf+yRedWy0Ao/4TL6cPMM+4cSt9R9Qq2VWG3uguItwiZW/QdFeX9at+wsDe9FKXrO6bxfT9+FNfZYeN3b24rKixhnOAjakZGhttJS4vUApnRaJV0u3+BiLLThdZNgmXm+Xpk3kzDP9v6OGGC+xsgjy597AjfsviP3w9qrgWhW267LeKH2OZDSzJnLRSS27nVZW8tyfSmTL16wfy4WLtOeqSaXREhcCxOgEIDWFdIfD4fsXHgGFaIdfVyjBKesqr/6sOD1aVCDNXg2V2ui2plir22S5RAJ31JtmR0PK+slPqQJVXWf0Fv0nh2QmUaNWQKYPMpVejwLzptjL5ujEEkf64nqqGXwgzUj8Q+94IKYb4yvMhkfiAqPsV/im5DAinb0IuiBVuDGqLbsHMBXTkE3dMq4rFahCqEVAxNKmE62TpIulwc9IiR+6fiPvcvif0wy1toklax9nc= 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:(4636009)(36840700001)(46966006)(82310400003)(26005)(36756003)(70206006)(16576012)(83380400001)(37006003)(6666004)(2906002)(54906003)(30864003)(81166007)(8936002)(6636002)(5660300002)(4326008)(44832011)(316002)(70586007)(6862004)(31696002)(956004)(508600001)(53546011)(47076005)(36860700001)(336012)(31686004)(6486002)(86362001)(186003)(8676002)(19627235002)(2616005)(356005)(43740500002)(579004)(559001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2021 15:14:31.8081 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: afd6ae1d-f48f-42fd-91de-08d988dbffbe 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: VE1EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB5880 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Hi Pierre, Please find my feedback marked inline as [SAMI]. Regards, Sami Mujawar On 23/06/2021 12:58 PM, Pierre.Gondois@arm.com wrote: > From: Pierre Gondois > > Add helper functions to generate AML Resource Data describing memory > ranges. Memory ranges can be one, double or four words long. They > can be of 'normal', IO or bus number memory type. The following > APIs are exposed: > - AmlCodeGenRdDWordIo () > - AmlCodeGenRdDWordMemory () > - AmlCodeGenRdWordBusNumber () > - AmlCodeGenRdQWordMemory () > > Signed-off-by: Pierre Gondois > --- > .../Include/Library/AmlLib/AmlLib.h | 289 ++++++ > .../AmlLib/CodeGen/AmlResourceDataCodeGen.c | 945 ++++++++++++++++++ > 2 files changed, 1234 insertions(+) > > diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h > index 4932f6fd9c8b..cbbbb7a478f7 100644 > --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h > +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h > @@ -418,6 +418,295 @@ AmlUpdateRdQWord ( > IN UINT64 BaseAddressLength > ); > > +/** Code generation for the "DWordIO ()" ASL function. > + > + The Resource Data effectively created is an Extended Interrupt Resource [SAMI] I think the text above needs updating. Same comment for other functions in this patch. > + Data. Cf ACPI 6.4: > + - s6.4.3.5.2 "DWord Address Space Descriptor". > + - s19.6.34 "DWordIO". > + > + The created resource data node can be: > + - appended to the list of resource data elements of the NameOpNode. > + In such case NameOpNode must be defined by a the "Name ()" ASL statement > + and initially contain a "ResourceTemplate ()". > + - returned through the NewRdNode parameter. > + > + @ingroup CodeGenApis > + > + @param [in] IsResourceConsumer ResourceUsage parameter, > + See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] IsMinFixed See ACPI 6.4 spec, s19.6.34 for more. [SAMI] Add brief description about the parameter in addition to the specification reference. > + @param [in] IsMaxFixed See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] IsPosDecode Decode parameter, > + See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] IsaRanges Available values are: > + 0-Reserved > + 1-NonISAOnly > + 2-ISAOnly > + 3-EntireRange > + See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] AddressGranularity See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] AddressMinimum See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] AddressMaximum See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] AddressTranslation See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] RangeLength See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] ResourceSourceIndex See ACPI 6.4 spec, s19.6.34 for more. > + Not supported. [SAMI] I think it would be good to mention that this parameter is unused and is provided here for compatibility with the ACPI DWordIo() resource descriptor macro. > + @param [in] ResourceSource See ACPI 6.4 spec, s19.6.34 for more. > + Not supported. > + @param [in] IsDenseTranslation TranslationDensity parameter, > + See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] IsTypeStatic TranslationType parameter, > + See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] NameOpNode NameOp object node defining a named object. > + If provided, append the new resource data > + node to the list of resource data elements > + of this node. > + @param [out] NewRdNode If provided and success, > + contain the created node. > + > + @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 > +AmlCodeGenRdDWordIo ( > + IN BOOLEAN IsResourceConsumer, > + IN BOOLEAN IsMinFixed, > + IN BOOLEAN IsMaxFixed, > + IN BOOLEAN IsPosDecode, > + IN UINT8 IsaRanges, > + IN UINT32 AddressGranularity, > + IN UINT32 AddressMinimum, > + IN UINT32 AddressMaximum, > + IN UINT32 AddressTranslation, > + IN UINT32 RangeLength, > + IN UINT8 ResourceSourceIndex, > + IN CONST CHAR8 *ResourceSource, > + IN BOOLEAN IsDenseTranslation, > + IN BOOLEAN IsTypeStatic, > + IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL > + OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL > + ); > + > +/** Code generation for the "DWordMemory ()" ASL function. > + > + The Resource Data effectively created is an Extended Interrupt Resource > + Data. Cf ACPI 6.4: > + - s6.4.3.5.2 "DWord Address Space Descriptor". > + - s19.6.35 "DWordMemory". > + > + The created resource data node can be: > + - appended to the list of resource data elements of the NameOpNode. > + In such case NameOpNode must be defined by a the "Name ()" ASL statement > + and initially contain a "ResourceTemplate ()". > + - returned through the NewRdNode parameter. > + > + @ingroup CodeGenApis > + > + @param [in] IsResourceConsumer ResourceUsage parameter, > + See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] IsPosDecode Decode parameter, > + See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] IsMinFixed See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] IsMaxFixed See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] Cacheable Available values are: > + 0-The memory is non-cacheable > + 1-The memory is cacheable > + 2-The memory is cacheable and supports > + write combining > + 3-The memory is cacheable and prefetchable > + @param [in] IsReadWrite ReadAndWrite parameter, > + See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] AddressGranularity See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] AddressMinimum See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] AddressMaximum See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] AddressTranslation See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] RangeLength See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] ResourceSourceIndex See ACPI 6.4 spec, s19.6.35 for more. > + Not supported. > + @param [in] ResourceSource See ACPI 6.4 spec, s19.6.35 for more. > + Not supported. > + @param [in] MemoryRangeType Available values are: > + 0-AddressRangeMemory > + 1-AddressRangeReserved > + 2-AddressRangeACPI > + 3-AddressRangeNVS > + See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] IsTypeStatic TranslationType parameter, > + See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] NameOpNode NameOp object node defining a named object. > + If provided, append the new resource data > + node to the list of resource data elements > + of this node. > + @param [out] NewRdNode If provided and success, > + contain the created node. > + > + @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 > +AmlCodeGenRdDWordMemory ( > + IN BOOLEAN IsResourceConsumer, > + IN BOOLEAN IsPosDecode, > + IN BOOLEAN IsMinFixed, > + IN BOOLEAN IsMaxFixed, > + IN UINT8 Cacheable, > + IN BOOLEAN IsReadWrite, > + IN UINT32 AddressGranularity, > + IN UINT32 AddressMinimum, > + IN UINT32 AddressMaximum, > + IN UINT32 AddressTranslation, > + IN UINT32 RangeLength, > + IN UINT8 ResourceSourceIndex, > + IN CONST CHAR8 *ResourceSource, > + IN UINT8 MemoryRangeType, > + IN BOOLEAN IsTypeStatic, > + IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL > + OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL > + ); > + > +/** Code generation for the "WordBusNumber ()" ASL function. > + > + The Resource Data effectively created is an Extended Interrupt Resource > + Data. Cf ACPI 6.4: > + - s6.4.3.5.3 "Word Address Space Descriptor". > + - s19.6.149 "WordBusNumber". > + > + The created resource data node can be: > + - appended to the list of resource data elements of the NameOpNode. > + In such case NameOpNode must be defined by a the "Name ()" ASL statement > + and initially contain a "ResourceTemplate ()". > + - returned through the NewRdNode parameter. > + > + @ingroup CodeGenApis > + > + @param [in] IsResourceConsumer ResourceUsage parameter, > + See ACPI 6.4 spec, s19.6.149 for more. > + @param [in] IsMinFixed See ACPI 6.4 spec, s19.6.149 for more. > + @param [in] IsMaxFixed See ACPI 6.4 spec, s19.6.149 for more. > + @param [in] IsPosDecode Decode parameter, > + See ACPI 6.4 spec, s19.6.149 for more. > + @param [in] AddressGranularity See ACPI 6.4 spec, s19.6.149 for more. > + @param [in] AddressMinimum See ACPI 6.4 spec, s19.6.149 for more. > + @param [in] AddressMaximum See ACPI 6.4 spec, s19.6.149 for more. > + @param [in] AddressTranslation See ACPI 6.4 spec, s19.6.149 for more. > + @param [in] RangeLength See ACPI 6.4 spec, s19.6.149 for more. > + @param [in] ResourceSourceIndex See ACPI 6.4 spec, s19.6.149 for more. > + Not supported. > + @param [in] ResourceSource See ACPI 6.4 spec, s19.6.149 for more. > + Not supported. > + @param [in] NameOpNode NameOp object node defining a named object. > + If provided, append the new resource data > + node to the list of resource data elements > + of this node. > + @param [out] NewRdNode If provided and success, > + contain the created node. > + > + @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 > +AmlCodeGenRdWordBusNumber ( > + IN BOOLEAN IsResourceConsumer, > + IN BOOLEAN IsMinFixed, > + IN BOOLEAN IsMaxFixed, > + IN BOOLEAN IsPosDecode, > + IN UINT32 AddressGranularity, > + IN UINT32 AddressMinimum, > + IN UINT32 AddressMaximum, > + IN UINT32 AddressTranslation, > + IN UINT32 RangeLength, > + IN UINT8 ResourceSourceIndex, > + IN CONST CHAR8 *ResourceSource, > + IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL > + OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL > + ); > + > +/** Code generation for the "QWordMemory ()" ASL function. > + > + The Resource Data effectively created is an Extended Interrupt Resource > + Data. Cf ACPI 6.4: > + - s6.4.3.5.1 "QWord Address Space Descriptor". > + - s19.6.110 "QWordMemory". > + > + The created resource data node can be: > + - appended to the list of resource data elements of the NameOpNode. > + In such case NameOpNode must be defined by a the "Name ()" ASL statement > + and initially contain a "ResourceTemplate ()". > + - returned through the NewRdNode parameter. > + > + @ingroup CodeGenApis > + > + @param [in] IsResourceConsumer ResourceUsage parameter, > + See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] IsPosDecode Decode parameter, > + See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] IsMinFixed See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] IsMaxFixed See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] Cacheable Available values are: > + 0-The memory is non-cacheable > + 1-The memory is cacheable > + 2-The memory is cacheable and supports > + write combining > + 3-The memory is cacheable and prefetchable > + @param [in] IsReadWrite ReadAndWrite parameter, > + See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] AddressGranularity See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] AddressMinimum See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] AddressMaximum See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] AddressTranslation See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] RangeLength See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] ResourceSourceIndex See ACPI 6.4 spec, s19.6.110 for more. > + Not supported. > + @param [in] ResourceSource See ACPI 6.4 spec, s19.6.110 for more. > + Not supported. > + @param [in] MemoryRangeType Available values are: > + 0-AddressRangeMemory > + 1-AddressRangeReserved > + 2-AddressRangeACPI > + 3-AddressRangeNVS > + See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] IsTypeStatic TranslationType parameter, > + See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] NameOpNode NameOp object node defining a named object. > + If provided, append the new resource data > + node to the list of resource data elements > + of this node. > + @param [out] NewRdNode If provided and success, > + contain the created node. > + > + @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 > +AmlCodeGenRdQWordMemory ( > + IN BOOLEAN IsResourceConsumer, > + IN BOOLEAN IsPosDecode, > + IN BOOLEAN IsMinFixed, > + IN BOOLEAN IsMaxFixed, > + IN UINT8 Cacheable, > + IN BOOLEAN IsReadWrite, > + IN UINT64 AddressGranularity, > + IN UINT64 AddressMinimum, > + IN UINT64 AddressMaximum, > + IN UINT64 AddressTranslation, > + IN UINT64 RangeLength, > + IN UINT8 ResourceSourceIndex, > + IN CONST CHAR8 *ResourceSource, > + IN UINT8 MemoryRangeType, > + IN BOOLEAN IsTypeStatic, > + IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL > + OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL > + ); > + > /** Code generation for the "Interrupt ()" ASL function. > > The Resource Data effectively created is an Extended Interrupt Resource > diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c > index 78910cc5d4b4..3ab78d4fce22 100644 > --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c > +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c > @@ -94,6 +94,951 @@ error_handler: > return Status; > } > > +/** Populate the TypeSpecificFlags field for IO ranges. > + > + @param [in] IsaRanges Available values are: > + 0-Reserved > + 1-NonISAOnly > + 2-ISAOnly > + 3-EntireRange > + See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] IsDenseTranslation TranslationDensity parameter, > + See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] IsTypeStatic TranslationType parameter, > + See ACPI 6.4 spec, s19.6.34 for more. > + > + @return A TypeSpecificFlagsvalue. > + MAX_UINT8 if error. > +**/ > +STATIC > +UINT8 > +EFIAPI > +RdIoRangeSpecificFlags ( > + IN UINT8 IsaRanges, > + IN BOOLEAN IsDenseTranslation, > + IN BOOLEAN IsTypeStatic > + ) > +{ > + // Only check type specific parameters. > + if (IsaRanges > 3) { > + ASSERT (0); > + return MAX_UINT8; > + } > + > + // Populate TypeSpecificFlags and call the generic function. > + // Cf ACPI 6.4 specification, Table 6.50: > + // "Table 6.50: I/O Resource Flag (Resource Type = 1) Definitions" > + return IsaRanges | > + (IsTypeStatic ? 0 : BIT4) | > + (IsDenseTranslation ? 0 : BIT5); > +} > + > +/** Populate the TypeSpecificFlags field for Memory ranges. [SAMI] Construct type specific flags for Memory ranges? Same for other functions in this patch. > + > + @param [in] Cacheable Available values are: [SAMI] Maybe the description should say Possible values are. > + 0-The memory is non-cacheable > + 1-The memory is cacheable > + 2-The memory is cacheable and supports > + write combining > + 3-The memory is cacheable and prefetchable > + @param [in] IsReadWrite ReadAndWrite parameter, > + See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] MemoryRangeType Available values are: > + 0-AddressRangeMemory > + 1-AddressRangeReserved > + 2-AddressRangeACPI > + 3-AddressRangeNVS > + See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] IsTypeStatic TranslationType parameter, > + See ACPI 6.4 spec, s19.6.35 for more. > + > + @return A TypeSpecificFlagsvalue. [SAMI] I think this should be changed to 'Returns a type specific flag value'. > + MAX_UINT8 if error. > +**/ > +STATIC > +UINT8 > +EFIAPI > +MemoryRangeSpecificFlags ( > + IN UINT8 Cacheable, > + IN BOOLEAN IsReadWrite, > + IN UINT8 MemoryRangeType, > + IN BOOLEAN IsTypeStatic > + ) > +{ > + // Only check type specific parameters. > + if ((Cacheable > 3) || > + (MemoryRangeType > 3)) { > + ASSERT (0); > + return MAX_UINT8; > + } > + > + // Populate TypeSpecificFlags and call the generic function. > + // Cf ACPI 6.4 specification, Table 6.49: > + // "Memory Resource Flag (Resource Type = 0) Definitions" > + return (IsReadWrite ? BIT0 : 0) | > + (Cacheable << 1) | > + (MemoryRangeType << 3) | > + (IsTypeStatic ? 0 : BIT5); > +} > + > +/** Populate the GeneralFlags field of any Address Space Resource Descriptors. > + > + E.g.: > + ACPI 6.4 specification, s6.4.3.5.1 "QWord Address Space Descriptor" > + for QWord > + > + @param [in] IsPosDecode Decode parameter, > + See ACPI 6.4 spec, s19.6.36 for more. > + @param [in] IsMinFixed See ACPI 6.4 spec, s19.6.36 for more. > + @param [in] IsMaxFixed See ACPI 6.4 spec, s19.6.36 for more. > + > + @return A TypeSpecificFlagsvalue. > +**/ > +STATIC > +UINT8 > +EFIAPI > +AddressSpaceGeneralFlags ( > + IN BOOLEAN IsPosDecode, > + IN BOOLEAN IsMinFixed, > + IN BOOLEAN IsMaxFixed > + ) > +{ > + return (IsPosDecode ? 0 : BIT1) | > + (IsMinFixed ? BIT2 : 0) | > + (IsMaxFixed ? BIT3 : 0); > +} > + > +/** Check Address Space Descriptor Fields. > + > + Cf. ACPI 6.4 Table 6.44: > + "Valid Combination of Address Space Descriptor Fields" > + > + @param [in] IsMinFixed See ACPI 6.4 spec, s19.6.36 for more. > + @param [in] IsMaxFixed See ACPI 6.4 spec, s19.6.36 for more. > + @param [in] AddressGranularity See ACPI 6.4 spec, s19.6.36 for more. > + @param [in] AddressMinimum See ACPI 6.4 spec, s19.6.36 for more. > + @param [in] AddressMaximum See ACPI 6.4 spec, s19.6.36 for more. > + @param [in] AddressTranslation See ACPI 6.4 spec, s19.6.36 for more. > + @param [in] RangeLength See ACPI 6.4 spec, s19.6.36 for more. > + > + @retval EFI_SUCCESS The function completed successfully. > + @retval EFI_INVALID_PARAMETER Invalid parameter. > +**/ > +STATIC > +EFI_STATUS > +EFIAPI > +CheckAddressSpaceFields ( > + IN BOOLEAN IsMinFixed, > + IN BOOLEAN IsMaxFixed, > + IN UINT64 AddressGranularity, > + IN UINT64 AddressMinimum, > + IN UINT64 AddressMaximum, > + IN UINT64 AddressTranslation, > + IN UINT64 RangeLength > + ) > +{ > + if ((AddressMinimum > AddressMaximum) || > + (RangeLength > (AddressMaximum - AddressMinimum + 1)) || > + ((AddressGranularity != 0) && > + ((AddressGranularity + 1) & AddressGranularity) != 0)) { > + ASSERT (0); > + return EFI_INVALID_PARAMETER; > + } > + > + if (RangeLength != 0) { > + if (IsMinFixed ^ IsMaxFixed) { > + ASSERT (0); > + return EFI_INVALID_PARAMETER; > + } else if (IsMinFixed && > + IsMaxFixed && > + (AddressGranularity != 0) && > + ((AddressMaximum - AddressMinimum + 1) != RangeLength)) { > + ASSERT (0); > + return EFI_INVALID_PARAMETER; > + } > + } else { > + if (IsMinFixed && IsMaxFixed) { > + ASSERT (0); > + return EFI_INVALID_PARAMETER; > + } else if (IsMinFixed && > + ((AddressMinimum & AddressGranularity) != 0)) { > + ASSERT (0); > + return EFI_INVALID_PARAMETER; > + } else if (IsMaxFixed && > + (((AddressMaximum + 1) & AddressGranularity) != 0)) { > + ASSERT (0); > + return EFI_INVALID_PARAMETER; > + } > + } > + > + return EFI_SUCCESS; > +} > + > +/** Code generation for the "DWordSpace ()" ASL function. > + > + The Resource Data effectively created is an Extended Interrupt Resource > + Data. Cf ACPI 6.4: > + - s6.4.3.5.2 "DWord Address Space Descriptor". > + - s19.6.36 "DWordSpace". > + > + The created resource data node can be: > + - appended to the list of resource data elements of the NameOpNode. > + In such case NameOpNode must be defined by a the "Name ()" ASL statement > + and initially contain a "ResourceTemplate ()". > + - returned through the NewRdNode parameter. > + > + @param [in] ResourceType See ACPI 6.4 spec, s6.4.3.5.2 for more. > + Available values are: > + 0: Memory range > + 1: I/O range > + 2: Bus number range > + 3-191: Reserved > + 192-255: Hardware Vendor Defined > + @param [in] IsResourceConsumer ResourceUsage parameter, > + See ACPI 6.4 spec, s19.6.36 for more. > + @param [in] IsPosDecode Decode parameter, > + See ACPI 6.4 spec, s19.6.36 for more. > + @param [in] IsMinFixed See ACPI 6.4 spec, s19.6.36 for more. > + @param [in] IsMaxFixed See ACPI 6.4 spec, s19.6.36 for more. > + @param [in] TypeSpecificFlags See ACPI 6.4 spec, s6.4.3.5.5 > + "Resource Type Specific Flags". > + @param [in] AddressGranularity See ACPI 6.4 spec, s19.6.36 for more. > + @param [in] AddressMinimum See ACPI 6.4 spec, s19.6.36 for more. > + @param [in] AddressMaximum See ACPI 6.4 spec, s19.6.36 for more. > + @param [in] AddressTranslation See ACPI 6.4 spec, s19.6.36 for more. > + @param [in] RangeLength See ACPI 6.4 spec, s19.6.36 for more. > + @param [in] ResourceSourceIndex See ACPI 6.4 spec, s19.6.36 for more. > + Not supported. [SAMI] I think you should mentions 'Not supported, must be 0.' > + @param [in] ResourceSource See ACPI 6.4 spec, s19.6.36 for more. > + Not supported. [SAMI] I think you should mentions 'Not supported, must be NULL.' > + @param [in] NameOpNode NameOp object node defining a named object. > + If provided, append the new resource data > + node to the list of resource data elements > + of this node. > + @param [out] NewRdNode If provided and success, > + contain the created node. > + > + @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 > +AmlCodeGenRdDWordSpace ( > + IN UINT8 ResourceType, > + IN BOOLEAN IsResourceConsumer, > + IN BOOLEAN IsPosDecode, > + IN BOOLEAN IsMinFixed, > + IN BOOLEAN IsMaxFixed, > + IN UINT8 TypeSpecificFlags, > + IN UINT32 AddressGranularity, > + IN UINT32 AddressMinimum, > + IN UINT32 AddressMaximum, > + IN UINT32 AddressTranslation, > + IN UINT32 RangeLength, > + IN UINT8 ResourceSourceIndex, > + IN CONST CHAR8 *ResourceSource, > + IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL > + OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL > + ) > +{ > + EFI_STATUS Status; > + AML_DATA_NODE * RdNode; > + EFI_ACPI_DWORD_ADDRESS_SPACE_DESCRIPTOR RdDWord; > + > + // ResourceSource and ResourceSourceIndex are not supported. > + if ((TypeSpecificFlags == MAX_UINT8) || > + (ResourceSourceIndex != 0) || > + (ResourceSource != NULL) || > + ((NameOpNode == NULL) && (NewRdNode == NULL))) { > + ASSERT (0); > + return EFI_INVALID_PARAMETER; > + } > + > + Status = CheckAddressSpaceFields ( > + IsMinFixed, > + IsMaxFixed, > + AddressGranularity, > + AddressMinimum, > + AddressMaximum, > + AddressTranslation, > + RangeLength > + ); > + if (EFI_ERROR (Status)) { > + ASSERT (0); > + return Status; > + } > + > + // Header > + RdDWord.Header.Header.Bits.Name = > + ACPI_LARGE_DWORD_ADDRESS_SPACE_DESCRIPTOR_NAME; > + RdDWord.Header.Header.Bits.Type = ACPI_LARGE_ITEM_FLAG; > + RdDWord.Header.Length = sizeof (EFI_ACPI_DWORD_ADDRESS_SPACE_DESCRIPTOR) - > + sizeof (ACPI_LARGE_RESOURCE_HEADER); > + > + // Body > + RdDWord.ResType = ResourceType; > + RdDWord.GenFlag = AddressSpaceGeneralFlags ( > + IsPosDecode, > + IsMinFixed, > + IsMaxFixed > + ); > + RdDWord.SpecificFlag = TypeSpecificFlags; > + RdDWord.AddrSpaceGranularity = AddressGranularity; > + RdDWord.AddrRangeMin = AddressMinimum; > + RdDWord.AddrRangeMax = AddressMaximum; > + RdDWord.AddrTranslationOffset = AddressTranslation; > + RdDWord.AddrLen = RangeLength; > + > + Status = AmlCreateDataNode ( > + EAmlNodeDataTypeResourceData, > + (UINT8*)&RdDWord, > + sizeof (EFI_ACPI_DWORD_ADDRESS_SPACE_DESCRIPTOR), > + &RdNode > + ); > + if (EFI_ERROR (Status)) { > + ASSERT (0); > + return Status; > + } > + > + return LinkRdNode (RdNode, NameOpNode, NewRdNode); > +} > + > +/** Code generation for the "DWordIO ()" ASL function. > + > + The Resource Data effectively created is an Extended Interrupt Resource > + Data. Cf ACPI 6.4: > + - s6.4.3.5.2 "DWord Address Space Descriptor". > + - s19.6.34 "DWordIO". > + > + The created resource data node can be: > + - appended to the list of resource data elements of the NameOpNode. > + In such case NameOpNode must be defined by a the "Name ()" ASL statement > + and initially contain a "ResourceTemplate ()". > + - returned through the NewRdNode parameter. > + > + @param [in] IsResourceConsumer ResourceUsage parameter, > + See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] IsMinFixed See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] IsMaxFixed See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] IsPosDecode Decode parameter, > + See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] IsaRanges Available values are: > + 0-Reserved > + 1-NonISAOnly > + 2-ISAOnly > + 3-EntireRange > + See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] AddressGranularity See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] AddressMinimum See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] AddressMaximum See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] AddressTranslation See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] RangeLength See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] ResourceSourceIndex See ACPI 6.4 spec, s19.6.34 for more. > + Not supported. > + @param [in] ResourceSource See ACPI 6.4 spec, s19.6.34 for more. > + Not supported. > + @param [in] IsDenseTranslation TranslationDensity parameter, > + See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] IsTypeStatic TranslationType parameter, > + See ACPI 6.4 spec, s19.6.34 for more. > + @param [in] NameOpNode NameOp object node defining a named object. > + If provided, append the new resource data > + node to the list of resource data elements > + of this node. > + @param [out] NewRdNode If provided and success, > + contain the created node. > + > + @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 > +AmlCodeGenRdDWordIo ( > + IN BOOLEAN IsResourceConsumer, > + IN BOOLEAN IsMinFixed, > + IN BOOLEAN IsMaxFixed, > + IN BOOLEAN IsPosDecode, > + IN UINT8 IsaRanges, > + IN UINT32 AddressGranularity, > + IN UINT32 AddressMinimum, > + IN UINT32 AddressMaximum, > + IN UINT32 AddressTranslation, > + IN UINT32 RangeLength, > + IN UINT8 ResourceSourceIndex, > + IN CONST CHAR8 *ResourceSource, > + IN BOOLEAN IsDenseTranslation, > + IN BOOLEAN IsTypeStatic, > + IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL > + OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL > + ) > +{ > + return AmlCodeGenRdDWordSpace ( > + ACPI_ADDRESS_SPACE_TYPE_IO, > + IsResourceConsumer, > + IsPosDecode, > + IsMinFixed, > + IsMaxFixed, > + RdIoRangeSpecificFlags ( > + IsaRanges, > + IsDenseTranslation, > + IsTypeStatic > + ), > + AddressGranularity, > + AddressMinimum, > + AddressMaximum, > + AddressTranslation, > + RangeLength, > + ResourceSourceIndex, > + ResourceSource, > + NameOpNode, > + NewRdNode > + ); > +} > + > +/** Code generation for the "DWordMemory ()" ASL function. > + > + The Resource Data effectively created is an Extended Interrupt Resource > + Data. Cf ACPI 6.4: > + - s6.4.3.5.2 "DWord Address Space Descriptor". > + - s19.6.35 "DWordMemory". > + > + The created resource data node can be: > + - appended to the list of resource data elements of the NameOpNode. > + In such case NameOpNode must be defined by a the "Name ()" ASL statement > + and initially contain a "ResourceTemplate ()". > + - returned through the NewRdNode parameter. > + > + @param [in] IsResourceConsumer ResourceUsage parameter, > + See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] IsPosDecode Decode parameter, > + See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] IsMinFixed See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] IsMaxFixed See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] Cacheable Available values are: > + 0-The memory is non-cacheable > + 1-The memory is cacheable > + 2-The memory is cacheable and supports > + write combining > + 3-The memory is cacheable and prefetchable > + @param [in] IsReadWrite ReadAndWrite parameter, > + See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] AddressGranularity See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] AddressMinimum See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] AddressMaximum See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] AddressTranslation See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] RangeLength See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] ResourceSourceIndex See ACPI 6.4 spec, s19.6.35 for more. > + Not supported. > + @param [in] ResourceSource See ACPI 6.4 spec, s19.6.35 for more. > + Not supported. > + @param [in] MemoryRangeType Available values are: > + 0-AddressRangeMemory > + 1-AddressRangeReserved > + 2-AddressRangeACPI > + 3-AddressRangeNVS > + See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] IsTypeStatic TranslationType parameter, > + See ACPI 6.4 spec, s19.6.35 for more. > + @param [in] NameOpNode NameOp object node defining a named object. > + If provided, append the new resource data > + node to the list of resource data elements > + of this node. > + @param [out] NewRdNode If provided and success, > + contain the created node. > + > + @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 > +AmlCodeGenRdDWordMemory ( > + IN BOOLEAN IsResourceConsumer, > + IN BOOLEAN IsPosDecode, > + IN BOOLEAN IsMinFixed, > + IN BOOLEAN IsMaxFixed, > + IN UINT8 Cacheable, > + IN BOOLEAN IsReadWrite, > + IN UINT32 AddressGranularity, > + IN UINT32 AddressMinimum, > + IN UINT32 AddressMaximum, > + IN UINT32 AddressTranslation, > + IN UINT32 RangeLength, > + IN UINT8 ResourceSourceIndex, > + IN CONST CHAR8 *ResourceSource, > + IN UINT8 MemoryRangeType, > + IN BOOLEAN IsTypeStatic, > + IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL > + OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL > + ) > +{ > + return AmlCodeGenRdDWordSpace ( > + ACPI_ADDRESS_SPACE_TYPE_MEM, > + IsResourceConsumer, > + IsPosDecode, > + IsMinFixed, > + IsMaxFixed, > + MemoryRangeSpecificFlags ( > + Cacheable, > + IsReadWrite, > + MemoryRangeType, > + IsTypeStatic > + ), > + AddressGranularity, > + AddressMinimum, > + AddressMaximum, > + AddressTranslation, > + RangeLength, > + ResourceSourceIndex, > + ResourceSource, > + NameOpNode, > + NewRdNode > + ); > +} > + > +/** Code generation for the "WordSpace ()" ASL function. > + > + The Resource Data effectively created is an Extended Interrupt Resource > + Data. Cf ACPI 6.4: > + - s6.4.3.5.3 "Word Address Space Descriptor". > + - s19.6.151 "WordSpace". > + > + The created resource data node can be: > + - appended to the list of resource data elements of the NameOpNode. > + In such case NameOpNode must be defined by a the "Name ()" ASL statement > + and initially contain a "ResourceTemplate ()". > + - returned through the NewRdNode parameter. > + > + @param [in] ResourceType See ACPI 6.4 spec, s6.4.3.5.3 for more. > + Available values are: > + 0: Memory range > + 1: I/O range > + 2: Bus number range > + 3-191: Reserved > + 192-255: Hardware Vendor Defined > + @param [in] IsResourceConsumer ResourceUsage parameter, > + See ACPI 6.4 spec, s19.6.151 for more. > + @param [in] IsPosDecode Decode parameter, > + See ACPI 6.4 spec, s19.6.151 for more. > + @param [in] IsMinFixed See ACPI 6.4 spec, s19.6.151 for more. > + @param [in] IsMaxFixed See ACPI 6.4 spec, s19.6.151 for more. > + @param [in] TypeSpecificFlags See ACPI 6.4 spec, s6.4.3.5.5 > + "Resource Type Specific Flags". > + @param [in] AddressGranularity See ACPI 6.4 spec, s19.6.151 for more. > + @param [in] AddressMinimum See ACPI 6.4 spec, s19.6.151 for more. > + @param [in] AddressMaximum See ACPI 6.4 spec, s19.6.151 for more. > + @param [in] AddressTranslation See ACPI 6.4 spec, s19.6.151 for more. > + @param [in] RangeLength See ACPI 6.4 spec, s19.6.151 for more. > + @param [in] ResourceSourceIndex See ACPI 6.4 spec, s19.6.151 for more. > + Not supported. > + @param [in] ResourceSource See ACPI 6.4 spec, s19.6.151 for more. > + Not supported. > + @param [in] NameOpNode NameOp object node defining a named object. > + If provided, append the new resource data > + node to the list of resource data elements > + of this node. > + @param [out] NewRdNode If provided and success, > + contain the created node. > + > + @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 > +AmlCodeGenRdWordSpace ( > + IN UINT8 ResourceType, > + IN BOOLEAN IsResourceConsumer, > + IN BOOLEAN IsPosDecode, > + IN BOOLEAN IsMinFixed, > + IN BOOLEAN IsMaxFixed, > + IN UINT8 TypeSpecificFlags, > + IN UINT16 AddressGranularity, > + IN UINT16 AddressMinimum, > + IN UINT16 AddressMaximum, > + IN UINT16 AddressTranslation, > + IN UINT16 RangeLength, > + IN UINT8 ResourceSourceIndex, > + IN CONST CHAR8 *ResourceSource, > + IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL > + OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL > + ) > +{ > + EFI_STATUS Status; > + AML_DATA_NODE * RdNode; > + EFI_ACPI_WORD_ADDRESS_SPACE_DESCRIPTOR Rdword; > + > + // ResourceSource and ResourceSourceIndex are not supported. > + if ((TypeSpecificFlags == MAX_UINT8) || > + (ResourceSourceIndex != 0) || > + (ResourceSource != NULL) || > + ((NameOpNode == NULL) && (NewRdNode == NULL))) { > + ASSERT (0); > + return EFI_INVALID_PARAMETER; > + } > + > + Status = CheckAddressSpaceFields ( > + IsMinFixed, > + IsMaxFixed, > + AddressGranularity, > + AddressMinimum, > + AddressMaximum, > + AddressTranslation, > + RangeLength > + ); > + if (EFI_ERROR (Status)) { > + ASSERT (0); > + return Status; > + } > + > + // Header > + Rdword.Header.Header.Bits.Name = > + ACPI_LARGE_WORD_ADDRESS_SPACE_DESCRIPTOR_NAME; > + Rdword.Header.Header.Bits.Type = ACPI_LARGE_ITEM_FLAG; > + Rdword.Header.Length = sizeof (EFI_ACPI_WORD_ADDRESS_SPACE_DESCRIPTOR) - > + sizeof (ACPI_LARGE_RESOURCE_HEADER); > + > + // Body > + Rdword.ResType = ResourceType; > + Rdword.GenFlag = AddressSpaceGeneralFlags ( > + IsPosDecode, > + IsMinFixed, > + IsMaxFixed > + ); > + Rdword.SpecificFlag = TypeSpecificFlags; > + Rdword.AddrSpaceGranularity = AddressGranularity; > + Rdword.AddrRangeMin = AddressMinimum; > + Rdword.AddrRangeMax = AddressMaximum; > + Rdword.AddrTranslationOffset = AddressTranslation; > + Rdword.AddrLen = RangeLength; > + > + Status = AmlCreateDataNode ( > + EAmlNodeDataTypeResourceData, > + (UINT8*)&Rdword, > + sizeof (EFI_ACPI_WORD_ADDRESS_SPACE_DESCRIPTOR), > + &RdNode > + ); > + if (EFI_ERROR (Status)) { > + ASSERT (0); > + return Status; > + } > + > + return LinkRdNode (RdNode, NameOpNode, NewRdNode); > +} > + > +/** Code generation for the "WordBusNumber ()" ASL function. > + > + The Resource Data effectively created is an Extended Interrupt Resource > + Data. Cf ACPI 6.4: > + - s6.4.3.5.3 "Word Address Space Descriptor". > + - s19.6.149 "WordBusNumber". > + > + The created resource data node can be: > + - appended to the list of resource data elements of the NameOpNode. > + In such case NameOpNode must be defined by a the "Name ()" ASL statement > + and initially contain a "ResourceTemplate ()". > + - returned through the NewRdNode parameter. > + > + @param [in] IsResourceConsumer ResourceUsage parameter, > + See ACPI 6.4 spec, s19.6.149 for more. > + @param [in] IsMinFixed See ACPI 6.4 spec, s19.6.149 for more. > + @param [in] IsMaxFixed See ACPI 6.4 spec, s19.6.149 for more. > + @param [in] IsPosDecode Decode parameter, > + See ACPI 6.4 spec, s19.6.149 for more. > + @param [in] AddressGranularity See ACPI 6.4 spec, s19.6.149 for more. > + @param [in] AddressMinimum See ACPI 6.4 spec, s19.6.149 for more. > + @param [in] AddressMaximum See ACPI 6.4 spec, s19.6.149 for more. > + @param [in] AddressTranslation See ACPI 6.4 spec, s19.6.149 for more. > + @param [in] RangeLength See ACPI 6.4 spec, s19.6.149 for more. > + @param [in] ResourceSourceIndex See ACPI 6.4 spec, s19.6.149 for more. > + Not supported. > + @param [in] ResourceSource See ACPI 6.4 spec, s19.6.149 for more. > + Not supported. > + @param [in] NameOpNode NameOp object node defining a named object. > + If provided, append the new resource data > + node to the list of resource data elements > + of this node. > + @param [out] NewRdNode If provided and success, > + contain the created node. > + > + @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 > +AmlCodeGenRdWordBusNumber ( > + IN BOOLEAN IsResourceConsumer, > + IN BOOLEAN IsMinFixed, > + IN BOOLEAN IsMaxFixed, > + IN BOOLEAN IsPosDecode, > + IN UINT32 AddressGranularity, > + IN UINT32 AddressMinimum, > + IN UINT32 AddressMaximum, > + IN UINT32 AddressTranslation, > + IN UINT32 RangeLength, > + IN UINT8 ResourceSourceIndex, > + IN CONST CHAR8 *ResourceSource, > + IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL > + OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL > + ) > +{ > + // There is no Type Specific Flags for buses. > + return AmlCodeGenRdWordSpace ( > + ACPI_ADDRESS_SPACE_TYPE_BUS, > + IsResourceConsumer, > + IsPosDecode, > + IsMinFixed, > + IsMaxFixed, > + 0, > + AddressGranularity, > + AddressMinimum, > + AddressMaximum, > + AddressTranslation, > + RangeLength, > + ResourceSourceIndex, > + ResourceSource, > + NameOpNode, > + NewRdNode > + ); > +} > + > +/** Code generation for the "QWordSpace ()" ASL function. > + > + The Resource Data effectively created is an Extended Interrupt Resource > + Data. Cf ACPI 6.4: > + - s6.4.3.5.1 "QWord Address Space Descriptor". > + - s19.6.111 "QWordSpace". > + > + The created resource data node can be: > + - appended to the list of resource data elements of the NameOpNode. > + In such case NameOpNode must be defined by a the "Name ()" ASL statement > + and initially contain a "ResourceTemplate ()". > + - returned through the NewRdNode parameter. > + > + @param [in] ResourceType See ACPI 6.4 spec, s6.4.3.5.1 for more. > + Available values are: > + 0: Memory range > + 1: I/O range > + 2: Bus number range > + 3-191: Reserved > + 192-255: Hardware Vendor Defined > + @param [in] IsResourceConsumer ResourceUsage parameter, > + See ACPI 6.4 spec, s19.6.111 for more. > + @param [in] IsPosDecode Decode parameter, > + See ACPI 6.4 spec, s19.6.111 for more. > + @param [in] IsMinFixed See ACPI 6.4 spec, s19.6.111 for more. > + @param [in] IsMaxFixed See ACPI 6.4 spec, s19.6.111 for more. > + @param [in] TypeSpecificFlags See ACPI 6.4 spec, s6.4.3.5.5 > + "Resource Type Specific Flags". > + @param [in] AddressGranularity See ACPI 6.4 spec, s19.6.111 for more. > + @param [in] AddressMinimum See ACPI 6.4 spec, s19.6.111 for more. > + @param [in] AddressMaximum See ACPI 6.4 spec, s19.6.111 for more. > + @param [in] AddressTranslation See ACPI 6.4 spec, s19.6.111 for more. > + @param [in] RangeLength See ACPI 6.4 spec, s19.6.111 for more. > + @param [in] ResourceSourceIndex See ACPI 6.4 spec, s19.6.111 for more. > + Not supported. > + @param [in] ResourceSource See ACPI 6.4 spec, s19.6.111 for more. > + Not supported. > + @param [in] NameOpNode NameOp object node defining a named object. > + If provided, append the new resource data > + node to the list of resource data elements > + of this node. > + @param [out] NewRdNode If provided and success, > + contain the created node. > + > + @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 > +AmlCodeGenRdQWordSpace ( > + IN UINT8 ResourceType, > + IN BOOLEAN IsResourceConsumer, > + IN BOOLEAN IsPosDecode, > + IN BOOLEAN IsMinFixed, > + IN BOOLEAN IsMaxFixed, > + IN UINT8 TypeSpecificFlags, > + IN UINT64 AddressGranularity, > + IN UINT64 AddressMinimum, > + IN UINT64 AddressMaximum, > + IN UINT64 AddressTranslation, > + IN UINT64 RangeLength, > + IN UINT8 ResourceSourceIndex, > + IN CONST CHAR8 *ResourceSource, > + IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL > + OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL > + ) > +{ > + EFI_STATUS Status; > + AML_DATA_NODE * RdNode; > + EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR RdQword; > + > + // ResourceSource and ResourceSourceIndex are not supported. > + if ((TypeSpecificFlags == MAX_UINT8) || > + (ResourceSourceIndex != 0) || > + (ResourceSource != NULL) || > + ((NameOpNode == NULL) && (NewRdNode == NULL))) { > + ASSERT (0); > + return EFI_INVALID_PARAMETER; > + } > + > + Status = CheckAddressSpaceFields ( > + IsMinFixed, > + IsMaxFixed, > + AddressGranularity, > + AddressMinimum, > + AddressMaximum, > + AddressTranslation, > + RangeLength > + ); > + if (EFI_ERROR (Status)) { > + ASSERT (0); > + return Status; > + } > + > + // Header > + RdQword.Header.Header.Bits.Name = > + ACPI_LARGE_QWORD_ADDRESS_SPACE_DESCRIPTOR_NAME; > + RdQword.Header.Header.Bits.Type = ACPI_LARGE_ITEM_FLAG; > + RdQword.Header.Length = sizeof (EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR) - > + sizeof (ACPI_LARGE_RESOURCE_HEADER); > + > + // Body > + RdQword.ResType = ResourceType; > + RdQword.GenFlag = AddressSpaceGeneralFlags ( > + IsPosDecode, > + IsMinFixed, > + IsMaxFixed > + ); > + RdQword.SpecificFlag = TypeSpecificFlags; > + RdQword.AddrSpaceGranularity = AddressGranularity; > + RdQword.AddrRangeMin = AddressMinimum; > + RdQword.AddrRangeMax = AddressMaximum; > + RdQword.AddrTranslationOffset = AddressTranslation; > + RdQword.AddrLen = RangeLength; > + > + Status = AmlCreateDataNode ( > + EAmlNodeDataTypeResourceData, > + (UINT8*)&RdQword, > + sizeof (EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR), > + &RdNode > + ); > + if (EFI_ERROR (Status)) { > + ASSERT (0); > + return Status; > + } > + > + return LinkRdNode (RdNode, NameOpNode, NewRdNode); > +} > + > +/** Code generation for the "QWordMemory ()" ASL function. > + > + The Resource Data effectively created is an Extended Interrupt Resource > + Data. Cf ACPI 6.4: > + - s6.4.3.5.1 "QWord Address Space Descriptor". > + - s19.6.110 "QWordMemory". > + > + The created resource data node can be: > + - appended to the list of resource data elements of the NameOpNode. > + In such case NameOpNode must be defined by a the "Name ()" ASL statement > + and initially contain a "ResourceTemplate ()". > + - returned through the NewRdNode parameter. > + > + @param [in] IsResourceConsumer ResourceUsage parameter, > + See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] IsPosDecode Decode parameter, > + See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] IsMinFixed See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] IsMaxFixed See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] Cacheable Available values are: > + 0-The memory is non-cacheable > + 1-The memory is cacheable > + 2-The memory is cacheable and supports > + write combining > + 3-The memory is cacheable and prefetchable > + @param [in] IsReadWrite ReadAndWrite parameter, > + See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] AddressGranularity See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] AddressMinimum See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] AddressMaximum See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] AddressTranslation See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] RangeLength See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] ResourceSourceIndex See ACPI 6.4 spec, s19.6.110 for more. > + Not supported. > + @param [in] ResourceSource See ACPI 6.4 spec, s19.6.110 for more. > + Not supported. > + @param [in] MemoryRangeType Available values are: > + 0-AddressRangeMemory > + 1-AddressRangeReserved > + 2-AddressRangeACPI > + 3-AddressRangeNVS > + See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] IsTypeStatic TranslationType parameter, > + See ACPI 6.4 spec, s19.6.110 for more. > + @param [in] NameOpNode NameOp object node defining a named object. > + If provided, append the new resource data > + node to the list of resource data elements > + of this node. > + @param [out] NewRdNode If provided and success, > + contain the created node. > + > + @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 > +AmlCodeGenRdQWordMemory ( > + IN BOOLEAN IsResourceConsumer, > + IN BOOLEAN IsPosDecode, > + IN BOOLEAN IsMinFixed, > + IN BOOLEAN IsMaxFixed, > + IN UINT8 Cacheable, > + IN BOOLEAN IsReadWrite, > + IN UINT64 AddressGranularity, > + IN UINT64 AddressMinimum, > + IN UINT64 AddressMaximum, > + IN UINT64 AddressTranslation, > + IN UINT64 RangeLength, > + IN UINT8 ResourceSourceIndex, > + IN CONST CHAR8 *ResourceSource, > + IN UINT8 MemoryRangeType, > + IN BOOLEAN IsTypeStatic, > + IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL > + OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL > + ) > +{ > + return AmlCodeGenRdQWordSpace ( > + ACPI_ADDRESS_SPACE_TYPE_MEM, > + IsResourceConsumer, > + IsPosDecode, > + IsMinFixed, > + IsMaxFixed, > + MemoryRangeSpecificFlags ( > + Cacheable, > + IsReadWrite, > + MemoryRangeType, > + IsTypeStatic > + ), > + AddressGranularity, > + AddressMinimum, > + AddressMaximum, > + AddressTranslation, > + RangeLength, > + ResourceSourceIndex, > + ResourceSource, > + NameOpNode, > + NewRdNode > + ); > +} > + > /** Code generation for the "Interrupt ()" ASL function. > > The Resource Data effectively created is an Extended Interrupt Resource