From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (EUR03-AM7-obe.outbound.protection.outlook.com [40.107.105.79]) by mx.groups.io with SMTP id smtpd.web12.11385.1663255004595235752 for ; Thu, 15 Sep 2022 08:16:45 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=zydx2eaL; spf=pass (domain: arm.com, ip: 40.107.105.79, mailfrom: sami.mujawar@arm.com) ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=k0NLYoG+Nk2lzURX/nfzPQk0B+y7FLE/l9JxEAM5uazMD47PsGEZnF0XJ8wZUvSTQgaPlvzgZGusbP0XLjjkH4eudTWB7YMKVmD0JNmht8DHI5WG2Y3YostrPXZVFN5yEADnn/VVNsFehrn5ftq4zaGQhl34a4i5r1kFK1XTmMljNPqVeysSRs7LyBazEUHYAiJNWCZkBrlgXDTooLU35Ss/Ii0EePaNNgnGV5K/QYfcKWg0zHoBStt6CwGItRgieQtDBGOk4izDsJ5vlz1+GLfijQzkzQqEDEPwECcRP2GbpuetOtCK7Ht4SG6MRBoBwSlnkxINbcxWrafixnhrNw== 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=WPA+Fa0nG2aocIeiCgn0JEfV2ILeQY3fwlli7cbSgGg=; b=INTKw+d3kNUzWEWuN4c/HtZ44NMk94LIK6aLMlK9a16HmOxVQPowcDr5VFYleOvFycJxuGxM0niz295wFHnD6crNoIGtWSFDIWS4tWOtwjb2GwmYeKdoOS1N7Vlgy+5rjua8tINYjvMjnIuG0BwIjYDOuJNXtrVH17c/2U4ACvAEcqkZYaMgL+yS9xu8c/qWJsL8iyeq6HbcqW6slWFo1lvNlBoXztmHhUXO8wrAqq7PmWbuHYlGDjzcio3Vdj1k1l5yKiNBAAhPhbQPcSODA/hk/VlISd2u4jf0KTpGWMbuweDoXOOn7CGkujpeRv4ARbZU4f9ch2RlEQEgJp6I2g== 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=WPA+Fa0nG2aocIeiCgn0JEfV2ILeQY3fwlli7cbSgGg=; b=zydx2eaLj60z3b9b1V5lNnU2X9QMYb5p7XmUcf4mC0N4HMLosRto0m9UNLipx65rRr8lL4fg8AscLOXs6H6+GGYmHcO55iRGHze39O7aBvnclGwWavZZCtidDlEZK/rfcKnMqiqS0IN9/H3/vMmI9R3NiJ6rDb6+LpoNeEAuvh0= Received: from FR3P281CA0139.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:95::13) by DB9PR08MB8740.eurprd08.prod.outlook.com (2603:10a6:10:3d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.19; Thu, 15 Sep 2022 15:16:40 +0000 Received: from VE1EUR03FT057.eop-EUR03.prod.protection.outlook.com (2603:10a6:d10:95:cafe::b1) by FR3P281CA0139.outlook.office365.com (2603:10a6:d10:95::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.6 via Frontend Transport; Thu, 15 Sep 2022 15:16:39 +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 VE1EUR03FT057.mail.protection.outlook.com (10.152.19.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.12 via Frontend Transport; Thu, 15 Sep 2022 15:16:39 +0000 Received: ("Tessian outbound fc2405f9ecaf:v124"); Thu, 15 Sep 2022 15:16:39 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4f792f573a4703a1 X-CR-MTA-TID: 64aa7808 Received: from d28924503849.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 6949DC12-35DA-4790-8FD1-A16D89EA09AA.1; Thu, 15 Sep 2022 15:16:27 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d28924503849.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 15 Sep 2022 15:16:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MsipGKGz2MesrXCIt7ak4Zos29ncxULtpVeKdGW+XM77l7n4Mt2ycYKQrSdrfDSumX6vRKXXPGRvkNnriYfj6UCMGX4Vt4lxL+mE6FEq2loUF5jpl/JWuG68iUw8vdsO89gdoEmGqko2bku+BZSIXYOjYPToL+7snZKO+6URmSeZEfH1PlShWjtwcf6EMYFaP1D6tmWYYqpmXbNrf59pFuU5zprp24aPfHI60uOTJbdGxpNgBj7GYLjP1ma4ghR4wvLiN5Ipf72E4U63o0WiY1lX4rJbPfO2evoPfKT9r8yTQUuadIT5+dB6u5hurJpxdMsM6gPAIjvtbvCjD+nR5Q== 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=WPA+Fa0nG2aocIeiCgn0JEfV2ILeQY3fwlli7cbSgGg=; b=XyS/EiUGiMunXem1mdzgIKgXRPd/JYgsQ+/x0DuFd5gS2G8Blmd8u3TMQF3SZc+SHsZZV+wrecqvIFL66rRMy0d4uL7B3tH3sa4x5qcuctxEh11EJS78ViMlT5T4Jym6GrKcST4PWAOgZYWwUs/4wiyuz10WHyzFfW+KJRosObQkeOxfNYtZCS4zQ3WQS0CNlszw/dWQrqko/FKz76IEAsXTNDPmn66EqJw9RaofyRy86+kHcAnJuR/yvMWYTSTdtEyHNUIeYf186tQahGIeQ9HuTscedqV9sZl7P6FRKVRTYsoWPNjm1JoI48noHrwhoFG1zkacLLgIERiq93SkJw== 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=WPA+Fa0nG2aocIeiCgn0JEfV2ILeQY3fwlli7cbSgGg=; b=zydx2eaLj60z3b9b1V5lNnU2X9QMYb5p7XmUcf4mC0N4HMLosRto0m9UNLipx65rRr8lL4fg8AscLOXs6H6+GGYmHcO55iRGHze39O7aBvnclGwWavZZCtidDlEZK/rfcKnMqiqS0IN9/H3/vMmI9R3NiJ6rDb6+LpoNeEAuvh0= 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 DB9PR08MB8204.eurprd08.prod.outlook.com (2603:10a6:10:39f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.14; Thu, 15 Sep 2022 15:16:24 +0000 Received: from AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::b480:677a:ac9b:8f24]) by AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::b480:677a:ac9b:8f24%7]) with mapi id 15.20.5612.022; Thu, 15 Sep 2022 15:16:24 +0000 Message-ID: Date: Thu, 15 Sep 2022 16:16:23 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH v3 2/3] DynamicTablesPkg: AML Code generation to add _CPC entries To: Jeff Brasen , devel@edk2.groups.io Cc: ardb+tianocore@kernel.org, Alexei.Fedorov@arm.com, pierre.gondois@arm.com, "nd@arm.com" References: <2bc2acdd897dae6fab193cc4a92595e41be586ca.1663247185.git.jbrasen@nvidia.com> From: "Sami Mujawar" In-Reply-To: <2bc2acdd897dae6fab193cc4a92595e41be586ca.1663247185.git.jbrasen@nvidia.com> X-ClientProxiedBy: LNXP265CA0017.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5e::29) To AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: AS8PR08MB6806:EE_|DB9PR08MB8204:EE_|VE1EUR03FT057:EE_|DB9PR08MB8740:EE_ X-MS-Office365-Filtering-Correlation-Id: 71e117a0-6876-4f51-266e-08da972d49eb X-LD-Processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr 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: Aj38iLTZFJnh2AMNZzfhcGutM6UZ1tkESvE9ZZmzqLvnLRX74+jzLj/9/3icsNq1MiYoyua4eoTIMTkPUn3roPm3SWIUbLpB1WRF5/xLVgnx+GSjNstMwcrf36iMIKElAykjKK8l659LBReM4G/2xbR8b2qBXbXHxQGTo+PTi5o4h1zTjijv3K8GEbuuefLyaUeTYnz9Zj473WZwyCoVGE4Dlc+4FNpH246FN2Mb8hFd2OK/EAj5yDK7Sbr4kbMk2AW0YDVCk3v4EQK7kNEflYKtYr4iCZdnuaxR7mpiy7WwPD/xoFSQQGmfW52ZBB/sB6hylYzaw7RzMOWvN5VvuVuI+HzwAePZRjvOVuIRxU3ZwOw/rQcy3qkQdxzva3C0jwGPT+CcxSwSvPW5sQWi/NvoatN/OoqAFQX0oOqCgfunGo1K82rvg7amrepaqEty+C0d38Woyn3eGLX03phQt1eGFfWKeAYUrnyiwm2sP2Ln74GAJM0BdvXfaESkTpbBCkee7BqeeBp4K14cuw17CFJ5HX/SKlE7RTbPyR0FcXUnzMKI58Hui0DL9cl9bvAxOseMJ16h+XigmLhqISM+C1Zg6V1FCsEqhivsVPcHU3fprpafR9o7NICDisxqWMYkH156TRok2JLIwmmse7ei2IvMhkLu8TWSm6KhEEsEJwDLmfxGAGWdiYoHYqOQmVa1VBrXlEK+sH0UHx9S0tIeRDFU4eS4bMu7rl6kyyWoQMJZl4KuFiuicGtbeoYuUgjhudH/ecjUUYnGC1QuSYZmT4QYi3G6pBQrRErFkj9wmAI= 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:(13230022)(4636009)(376002)(39860400002)(136003)(396003)(366004)(346002)(451199015)(31686004)(36756003)(33964004)(6486002)(316002)(186003)(38100700002)(53546011)(44832011)(41300700001)(478600001)(31696002)(8676002)(6512007)(2616005)(66476007)(6506007)(26005)(19627235002)(30864003)(4326008)(66946007)(2906002)(66556008)(8936002)(83380400001)(86362001)(5660300002)(45980500001)(43740500002)(559001)(579004);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB8204 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: VE1EUR03FT057.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 4491e21c-9b41-45ac-8618-08da972d40e4 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LNYnE6IGqjjNw5tICnAODDmtjPZVmd2G8tH0LbRejRT1WedLx7wQ51evpWPw69JBH1lTPQ2vFUEfHi6/COUpupm2ZLF2ElCoJGjhk+fWkibgIFzjolvGFqOz67oMJuBFZ0KcW62uIMTpC8UNIy/PoLEoLgvgyYpKC4QkfzOjA+QX8VGEbj3rG9LNDFz+mVdKKTrOod5Mm09leMHCEy0zBLdJ+K/Zmz9B5j3x46Xi7N2wccf3df4uiD5GPqYXI8G6UiPDDE+OWbGHAhxS6Pra0yHq5g1D6l/dazCeYLayYBphGyed04EOQoXSxY4cqTldJrRoE+SzUDgJDuNlWqHXBkaQ2uhA07CgEE5jXCyd1RqUMzQV5thg4ORYBU6F2QrgQXoyOfv06RSsNB4DhxyGi/qTVefywF6T06I0Duo9Gj6dhpznt5dmOaM80chrT1zOkMWxUiKNMnXz4gPCqEClA0FwGYrSUgIGBSQOJp3FeT7+BEueGHXF4Fu0uk/B/Tx80J9d06Ju4Igay4Bou3hDjpcY9T0ckaysGTxM5qyXgk9tZwSO0+RcEJ7xQ4pUU+yqy2Oh/hrrcYi1514UfbFAJyAKPaiua00ui/q9xrW7EEXWuLkyighT2vg0PNM88l7rjcvPF69JG1Sn1IX7jaZOFq5OzU/0OfOPdkBc1Lz2IyrcPeWB3f9nYEsdfywoSTMmB6aHFGQE7VfIZDdcFUey6wWVLO3mM8aTKuKtFp3pcK02+ffZZO7QvpTjlA05cK69LKLjMPraHf8MJBGI1zui4i9M0mtWXOg+k9/Kmw1vVZ1MQwma9CRwR+3pugcYikDl 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:(13230022)(4636009)(346002)(136003)(39860400002)(376002)(396003)(451199015)(40470700004)(36840700001)(46966006)(86362001)(8676002)(81166007)(53546011)(26005)(6486002)(44832011)(5660300002)(70206006)(31686004)(40460700003)(40480700001)(336012)(19627235002)(4326008)(2906002)(30864003)(82310400005)(6512007)(316002)(70586007)(186003)(6506007)(83380400001)(41300700001)(36860700001)(8936002)(356005)(47076005)(36756003)(33964004)(2616005)(31696002)(82740400003)(478600001)(43740500002)(559001)(579004);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2022 15:16:39.4410 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 71e117a0-6876-4f51-266e-08da972d49eb 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: VE1EUR03FT057.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB8740 Content-Type: multipart/alternative; boundary="------------opvjMl68ylkeiXALdOVJzd9M" --------------opvjMl68ylkeiXALdOVJzd9M Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Jeff, Please find my feedback inline marked [SAMI]. Most of my suggestions are with respect to reducing the number of parameters in the AmlCreateCpcNod(). Regards, Sami Mujawar On 15/09/2022 02:10 pm, Jeff Brasen wrote: > _CPC entries can describe CPU performance information. > > The object is described in ACPI 6.4 s8.4.7.1. > > "_CPC (Continuous Performance Control)". > > > > Add AmlCreateCpcNode() helper function to add _CPC entries to an > > existing CPU object. > > > > Signed-off-by: Jeff Brasen > > --- > > .../Include/Library/AmlLib/AmlLib.h | 156 +++++ > > .../Common/AmlLib/CodeGen/AmlCodeGen.c | 543 ++++++++++++++++++ > > 2 files changed, 699 insertions(+) > > > > diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h > > index 39968660f2..3fafa6b0e8 100644 > > --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h > > +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h [SAMI] Include to get the definition for AML_CPC_INFO. > > @@ -1336,6 +1336,162 @@ AmlAddNameIntegerPackage ( > > IN AML_OBJECT_NODE_HANDLE PackageNode > > ); > > > > +/** Create a _CPC node. > > + > > + Creates and optionally adds the following node > > + Name(_CPC, Package() > > + { > > + NumEntries, // Integer > > + Revision, // Integer > > + HighestPerformance, // Integer or Buffer (Resource Descriptor) > > + NominalPerformance, // Integer or Buffer (Resource Descriptor) > > + LowestNonlinearPerformance, // Integer or Buffer (Resource Descriptor) > > + LowestPerformance, // Integer or Buffer (Resource Descriptor) > > + GuaranteedPerformanceRegister, // Buffer (Resource Descriptor) > > + DesiredPerformanceRegister , // Buffer (Resource Descriptor) > > + MinimumPerformanceRegister , // Buffer (Resource Descriptor) > > + MaximumPerformanceRegister , // Buffer (Resource Descriptor) > > + PerformanceReductionToleranceRegister, // Buffer (Resource Descriptor) > > + TimeWindowRegister, // Buffer (Resource Descriptor) > > + CounterWraparoundTime, // Integer or Buffer (Resource Descriptor) > > + ReferencePerformanceCounterRegister, // Buffer (Resource Descriptor) > > + DeliveredPerformanceCounterRegister, // Buffer (Resource Descriptor) > > + PerformanceLimitedRegister, // Buffer (Resource Descriptor) > > + CPPCEnableRegister // Buffer (Resource Descriptor) > > + AutonomousSelectionEnable, // Integer or Buffer (Resource Descriptor) > > + AutonomousActivityWindowRegister, // Buffer (Resource Descriptor) > > + EnergyPerformancePreferenceRegister, // Buffer (Resource Descriptor) > > + ReferencePerformance // Integer or Buffer (Resource Descriptor) > > + LowestFrequency, // Integer or Buffer (Resource Descriptor) > > + NominalFrequency // Integer or Buffer (Resource Descriptor) > > + }) > > + > > + If resource buffer is NULL then integer will be used. > > + > > + Cf. ACPI 6.4, s8.4.7.1 _CPC (Continuous Performance Control) > > + > > + @ingroup CodeGenApis > > + > > + @param [in] HighestPerformanceBuffer If provided, buffer that indicates the highest level > > + of performance the processor. > > + @param [in] HighestPerformanceInteger Indicates the highest level of performance the processor, > > + used if buffer is NULL. > > + @param [in] NominalPerformanceBuffer If provided buffer that indicates the highest sustained > > + performance level of the processor. > > + @param [in] NominalPerformanceInteger Indicates the highest sustained performance level > > + of the processor, used if buffer is NULL. > > + @param [in] LowestNonlinearPerformanceBuffer If provided, buffer that indicates the lowest performance level > > + of the processor with non-linear power savings. > > + @param [in] LowestNonlinearPerformanceInteger Indicates the lowest performance level of the processor with > > + non-linear power savings, used if buffer is NULL. > > + @param [in] LowestPerformanceBuffer If provided, buffer that indicates the > > + lowest performance level of the processor. > > + @param [in] LowestPerformanceInteger Indicates the lowest performance level of the processor, > > + used if buffer is NULL. > > + @param [in] GuaranteedPerformanceRegister If provided, Guaranteed Performance Register Buffer. > > + @param [in] DesiredPerformanceRegister If provided, Desired Performance Register Buffer. > > + @param [in] MinimumPerformanceRegister If provided, Minimum Performance Register Buffer. > > + @param [in] MaximumPerformanceRegister If provided, Maximum Performance Register Buffer. > > + @param [in] PerformanceReductionToleranceRegister If provided, Performance Reduction Tolerance Register. > > + @param [in] TimeWindowRegister If provided, Time Window Register. > > + @param [in] CounterWraparoundTimeBuffer If provided, Counter Wraparound Time buffer. > > + @param [in] CounterWraparoundTimeInteger Counter Wraparound Time, used if buffer is NULL. > > + @param [in] ReferencePerformanceCounterRegister Reference Performance Counter Register. > > + @param [in] DeliveredPerformanceCounterRegister Delivered Performance Counter Register. > > + @param [in] PerformanceLimitedRegister Performance Limited Register. > > + @param [in] CPPCEnableRegister If provided, CPPC EnableRegister. > > + @param [in] AutonomousSelectionEnableBuffer If provided, Autonomous Selection Enable buffer. > > + @param [in] AutonomousSelectionEnableInteger Autonomous Selection Enable, used if buffer is NULL. > > + @param [in] AutonomousActivityWindowRegister If provided, AutonomousActivity-WindowRegister. > > + @param [in] EnergyPerformancePreferenceRegister If provided, EnergyPerformance-PreferenceRegister. > > + @param [in] ReferencePerformanceBuffer If provided, Reference Performance buffer. > > + @param [in] ReferencePerformanceInteger Reference Performance, used if buffer is NULL. > > + @param [in] LowestFrequencyBuffer If provided, Lowest Frequency buffer. > > + @param [in] LowestFrequencyInteger Lowest Frequency, used if buffer is NULL. > > + @param [in] NominalFrequencyBuffer If provided, NominalFrequencyBuffer buffer. > > + @param [in] NominalFrequencyInteger NominalFrequencyBuffer, used if buffer is NULL. > > + @param [in] ParentNode If provided, set ParentNode as the parent > > + of the node created. > > + @param [out] NewCpcNode If success and provided, contains the created node. > > + > > + @retval EFI_SUCCESS The function completed successfully. > > + @retval EFI_INVALID_PARAMETER Invalid parameter. > > + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. > > +**/ > > +EFI_STATUS > > +EFIAPI > > +AmlCreateCpcNode ( [SAMI] The number of parameters to this function can be reduced by passing a pointer to AML_CPC_INFO. So the new prototype for this function can be made as below: EFI_STATUS EFIAPI AmlCreateCpcNode (   IN AML_CPC_INFO             *CpcInfo,   IN  AML_NODE_HANDLE         ParentNode   OPTIONAL,   OUT AML_OBJECT_NODE_HANDLE  *NewCpcNode   OPTIONAL   ); [/SAMI] > > + /// The revision number of the _CPC package format. > > + IN UINT32 Revision, > > + /// Indicates the highest level of performance the processor > > + /// is theoretically capable of achieving. > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *HighestPerformanceBuffer OPTIONAL, > > + IN UINT32 HighestPerformanceInteger, > > + /// Indicates the highest sustained performance level of the processor. > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *NominalPerformanceBuffer OPTIONAL, > > + IN UINT32 NominalPerformanceInteger, > > + /// Indicates the lowest performance level of the processor with non-linear power savings. > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *LowestNonlinearPerformanceBuffer OPTIONAL, > > + IN UINT32 LowestNonlinearPerformanceInteger, > > + /// Indicates the lowest performance level of the processor.. > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *LowestPerformanceBuffer OPTIONAL, > > + IN UINT32 LowestPerformanceInteger, > > + /// Guaranteed Performance Register Buffer. > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *GuaranteedPerformanceRegister OPTIONAL, > > + /// Desired Performance Register Buffer. > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *DesiredPerformanceRegister, > > + /// Minimum Performance Register Buffer. > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *MinimumPerformanceRegister OPTIONAL, > > + /// Maximum Performance Register Buffer. > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *MaximumPerformanceRegister OPTIONAL, > > + /// Performance Reduction Tolerance Register. > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *PerformanceReductionToleranceRegister OPTIONAL, > > + /// Time Window Register. > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *TimeWindowRegister OPTIONAL, > > + /// Counter Wraparound Time > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *CounterWraparoundTimeBuffer OPTIONAL, > > + IN UINT32 CounterWraparoundTimeInteger, > > + /// Reference Performance Counter Register > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *ReferencePerformanceCounterRegister, > > + /// Delivered Performance Counter Register > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *DeliveredPerformanceCounterRegister, > > + /// Performance Limited Register > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *PerformanceLimitedRegister, > > + /// CPPC EnableRegister > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *CPPCEnableRegister OPTIONAL, > > + /// Autonomous Selection Enable > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *AutonomousSelectionEnableBuffer OPTIONAL, > > + IN UINT32 AutonomousSelectionEnableInteger, > > + /// AutonomousActivity-WindowRegister > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *AutonomousActivityWindowRegister OPTIONAL, > > + /// EnergyPerformance-PreferenceRegister > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *EnergyPerformancePreferenceRegister OPTIONAL, > > + /// Reference Performance > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *ReferencePerformanceBuffer OPTIONAL, > > + IN UINT32 ReferencePerformanceInteger, > > + /// Lowest Frequency > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *LowestFrequencyBuffer OPTIONAL, > > + IN UINT32 LowestFrequencyInteger, > > + /// Nominal Frequency > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *NominalFrequencyBuffer OPTIONAL, > > + IN UINT32 NominalFrequencyInteger, > > + IN AML_NODE_HANDLE ParentNode OPTIONAL, > > + OUT AML_OBJECT_NODE_HANDLE *NewCpcNode OPTIONAL > > + ); > > + > > // DEPRECATED APIS > > #ifndef DISABLE_NEW_DEPRECATED_INTERFACES > > > > diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c > > index 5fb39d077b..42f0d0002c 100644 > > --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c > > +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c [SAMI] Include  > > @@ -2850,3 +2850,546 @@ error_handler: > > > > return Status; > > } > > + > > +/** Adds a register to the package > > + > > + @ingroup CodeGenApis > > + > > + @param [in] Register If provided, register that will be added to package. > > + otherwise NULL register will be added > > + @param [in] PackageNode Package to add value to > > + > > + @retval EFI_SUCCESS The function completed successfully. > > + @retval EFI_INVALID_PARAMETER Invalid parameter. > > + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. > > +**/ > > +STATIC > > +EFI_STATUS > > +EFIAPI > > +AmlAddRegisterToPackage ( > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *Register OPTIONAL, > > + IN AML_OBJECT_NODE_HANDLE PackageNode > > + ) > > +{ > > + EFI_STATUS Status; > > + AML_DATA_NODE_HANDLE RdNode; > > + AML_OBJECT_NODE_HANDLE ResourceTemplateNode; > > + > > + RdNode = NULL; > > + > > + Status = AmlCodeGenResourceTemplate (&ResourceTemplateNode); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + return Status; > > + } > > + > > + if (Register != NULL) { > > + Status = AmlCodeGenRdRegister ( > > + Register->AddressSpaceId, > > + Register->RegisterBitWidth, > > + Register->RegisterBitOffset, > > + Register->Address, > > + Register->AccessSize, > > + NULL, > > + &RdNode > > + ); > > + } else { > > + Status = AmlCodeGenRdRegister ( > > + EFI_ACPI_6_4_SYSTEM_MEMORY, > > + 0, > > + 0, > > + 0, > > + 0, > > + NULL, > > + &RdNode > > + ); > > + } > > + > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAppendRdNode (ResourceTemplateNode, RdNode); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + RdNode = NULL; > > + > > + Status = AmlVarListAddTail ( > > + (AML_NODE_HANDLE)PackageNode, > > + (AML_NODE_HANDLE)ResourceTemplateNode > > + ); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + return Status; > > + > > +error_handler: > > + if (RdNode != NULL) { > > + AmlDeleteTree ((AML_NODE_HANDLE)RdNode); > > + } > > + > > + if (ResourceTemplateNode != NULL) { > > + AmlDeleteTree ((AML_NODE_HANDLE)ResourceTemplateNode); > > + } > > + > > + return Status; > > +} > > + [SAMI] Move IsNullGenericAddress() from patch 3/3 file DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.cover here. [/SAMI] > > +/** Adds an integer or register to the package > > + > > + @ingroup CodeGenApis > > + > > + @param [in] Register If provided, register that will be added to package > > + @param [in] Integer If Register is NULL, integer that will be added to the package > > + @param [in] PackageNode Package to add value to > > + > > + @retval EFI_SUCCESS The function completed successfully. > > + @retval EFI_INVALID_PARAMETER Invalid parameter. > > + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. > > +**/ > > +STATIC > > +EFI_STATUS > > +EFIAPI > > +AmlAddRegisterOrIntegerToPackage ( > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *Register OPTIONAL, > > + IN UINT32 Integer, > > + IN AML_OBJECT_NODE_HANDLE PackageNode > > + ) > > +{ > > + EFI_STATUS Status; > > + AML_OBJECT_NODE_HANDLE IntegerNode; > > + > > + IntegerNode = NULL; > > + > > + if (Register != NULL) { [SAMI] Modify the above check to if((Register != NULL) && !IsNullGenericAddress (Register)) { [/SAMI] > > + Status = AmlAddRegisterToPackage (Register, PackageNode); > > + } else { > > + Status = AmlCodeGenInteger (Integer, &IntegerNode); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + return Status; > > + } > > + > > + Status = AmlVarListAddTail ( > > + (AML_NODE_HANDLE)PackageNode, > > + (AML_NODE_HANDLE)IntegerNode > > + ); > > + } > > + > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + if (IntegerNode != NULL) { > > + AmlDeleteTree ((AML_NODE_HANDLE)IntegerNode); > > + } > > + } > > + > > + return Status; > > +} > > + > > +/** Create a _CPC node. > > + > > + Creates and optionally adds the following node > > + Name(_CPC, Package() > > + { > > + NumEntries, // Integer > > + Revision, // Integer > > + HighestPerformance, // Integer or Buffer (Resource Descriptor) > > + NominalPerformance, // Integer or Buffer (Resource Descriptor) > > + LowestNonlinearPerformance, // Integer or Buffer (Resource Descriptor) > > + LowestPerformance, // Integer or Buffer (Resource Descriptor) > > + GuaranteedPerformanceRegister, // Buffer (Resource Descriptor) > > + DesiredPerformanceRegister , // Buffer (Resource Descriptor) > > + MinimumPerformanceRegister , // Buffer (Resource Descriptor) > > + MaximumPerformanceRegister , // Buffer (Resource Descriptor) > > + PerformanceReductionToleranceRegister, // Buffer (Resource Descriptor) > > + TimeWindowRegister, // Buffer (Resource Descriptor) > > + CounterWraparoundTime, // Integer or Buffer (Resource Descriptor) > > + ReferencePerformanceCounterRegister, // Buffer (Resource Descriptor) > > + DeliveredPerformanceCounterRegister, // Buffer (Resource Descriptor) > > + PerformanceLimitedRegister, // Buffer (Resource Descriptor) > > + CPPCEnableRegister // Buffer (Resource Descriptor) > > + AutonomousSelectionEnable, // Integer or Buffer (Resource Descriptor) > > + AutonomousActivityWindowRegister, // Buffer (Resource Descriptor) > > + EnergyPerformancePreferenceRegister, // Buffer (Resource Descriptor) > > + ReferencePerformance // Integer or Buffer (Resource Descriptor) > > + LowestFrequency, // Integer or Buffer (Resource Descriptor) > > + NominalFrequency // Integer or Buffer (Resource Descriptor) > > + }) > > + > > + If resource buffer is NULL then integer will be used. > > + > > + Cf. ACPI 6.4, s8.4.7.1 _CPC (Continuous Performance Control) > > + > > + @ingroup CodeGenApis > > + > > + @param [in] HighestPerformanceBuffer If provided, buffer that indicates the highest level > > + of performance the processor. > > + @param [in] HighestPerformanceInteger Indicates the highest level of performance the processor, > > + used if buffer is NULL. > > + @param [in] NominalPerformanceBuffer If provided buffer that indicates the highest sustained > > + performance level of the processor. > > + @param [in] NominalPerformanceInteger Indicates the highest sustained performance level > > + of the processor, used if buffer is NULL. > > + @param [in] LowestNonlinearPerformanceBuffer If provided, buffer that indicates the lowest performance level > > + of the processor with non-linear power savings. > > + @param [in] LowestNonlinearPerformanceInteger Indicates the lowest performance level of the processor with > > + non-linear power savings, used if buffer is NULL. > > + @param [in] LowestPerformanceBuffer If provided, buffer that indicates the > > + lowest performance level of the processor. > > + @param [in] LowestPerformanceInteger Indicates the lowest performance level of the processor, > > + used if buffer is NULL. > > + @param [in] GuaranteedPerformanceRegister If provided, Guaranteed Performance Register Buffer. > > + @param [in] DesiredPerformanceRegister If provided, Desired Performance Register Buffer. > > + @param [in] MinimumPerformanceRegister If provided, Minimum Performance Register Buffer. > > + @param [in] MaximumPerformanceRegister If provided, Maximum Performance Register Buffer. > > + @param [in] PerformanceReductionToleranceRegister If provided, Performance Reduction Tolerance Register. > > + @param [in] TimeWindowRegister If provided, Time Window Register. > > + @param [in] CounterWraparoundTimeBuffer If provided, Counter Wraparound Time buffer. > > + @param [in] CounterWraparoundTimeInteger Counter Wraparound Time, used if buffer is NULL. > > + @param [in] ReferencePerformanceCounterRegister Reference Performance Counter Register. > > + @param [in] DeliveredPerformanceCounterRegister Delivered Performance Counter Register. > > + @param [in] PerformanceLimitedRegister Performance Limited Register. > > + @param [in] CPPCEnableRegister If provided, CPPC EnableRegister. > > + @param [in] AutonomousSelectionEnableBuffer If provided, Autonomous Selection Enable buffer. > > + @param [in] AutonomousSelectionEnableInteger Autonomous Selection Enable, used if buffer is NULL. > > + @param [in] AutonomousActivityWindowRegister If provided, AutonomousActivity-WindowRegister. > > + @param [in] EnergyPerformancePreferenceRegister If provided, EnergyPerformance-PreferenceRegister. > > + @param [in] ReferencePerformanceBuffer If provided, Reference Performance buffer. > > + @param [in] ReferencePerformanceInteger Reference Performance, used if buffer is NULL. > > + @param [in] LowestFrequencyBuffer If provided, Lowest Frequency buffer. > > + @param [in] LowestFrequencyInteger Lowest Frequency, used if buffer is NULL. > > + @param [in] NominalFrequencyBuffer If provided, NominalFrequencyBuffer buffer. > > + @param [in] NominalFrequencyInteger NominalFrequencyBuffer, used if buffer is NULL. > > + @param [in] ParentNode If provided, set ParentNode as the parent > > + of the node created. > > + @param [out] NewCpcNode If success and provided, contains the created node. > > + > > + @retval EFI_SUCCESS The function completed successfully. > > + @retval EFI_INVALID_PARAMETER Invalid parameter. > > + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. > > +**/ > > +EFI_STATUS > > +EFIAPI > > +AmlCreateCpcNode ( > > + /// The revision number of the _CPC package format. > > + IN UINT32 Revision, > > + /// Indicates the highest level of performance the processor > > + /// is theoretically capable of achieving. > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *HighestPerformanceBuffer OPTIONAL, > > + IN UINT32 HighestPerformanceInteger, > > + /// Indicates the highest sustained performance level of the processor. > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *NominalPerformanceBuffer OPTIONAL, > > + IN UINT32 NominalPerformanceInteger, > > + /// Indicates the lowest performance level of the processor with non-linear power savings. > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *LowestNonlinearPerformanceBuffer OPTIONAL, > > + IN UINT32 LowestNonlinearPerformanceInteger, > > + /// Indicates the lowest performance level of the processor.. > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *LowestPerformanceBuffer OPTIONAL, > > + IN UINT32 LowestPerformanceInteger, > > + /// Guaranteed Performance Register Buffer. > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *GuaranteedPerformanceRegister OPTIONAL, > > + /// Desired Performance Register Buffer. > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *DesiredPerformanceRegister, > > + /// Minimum Performance Register Buffer. > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *MinimumPerformanceRegister OPTIONAL, > > + /// Maximum Performance Register Buffer. > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *MaximumPerformanceRegister OPTIONAL, > > + /// Performance Reduction Tolerance Register. > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *PerformanceReductionToleranceRegister OPTIONAL, > > + /// Time Window Register. > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *TimeWindowRegister OPTIONAL, > > + /// Counter Wraparound Time > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *CounterWraparoundTimeBuffer OPTIONAL, > > + IN UINT32 CounterWraparoundTimeInteger, > > + /// Reference Performance Counter Register > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *ReferencePerformanceCounterRegister, > > + /// Delivered Performance Counter Register > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *DeliveredPerformanceCounterRegister, > > + /// Performance Limited Register > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *PerformanceLimitedRegister, > > + /// CPPC EnableRegister > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *CPPCEnableRegister OPTIONAL, > > + /// Autonomous Selection Enable > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *AutonomousSelectionEnableBuffer OPTIONAL, > > + IN UINT32 AutonomousSelectionEnableInteger, > > + /// AutonomousActivity-WindowRegister > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *AutonomousActivityWindowRegister OPTIONAL, > > + /// EnergyPerformance-PreferenceRegister > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *EnergyPerformancePreferenceRegister OPTIONAL, > > + /// Reference Performance > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *ReferencePerformanceBuffer OPTIONAL, > > + IN UINT32 ReferencePerformanceInteger, > > + /// Lowest Frequency > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *LowestFrequencyBuffer OPTIONAL, > > + IN UINT32 LowestFrequencyInteger, > > + /// Nominal Frequency > > + /// Optional > > + IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE *NominalFrequencyBuffer OPTIONAL, > > + IN UINT32 NominalFrequencyInteger, > > + IN AML_NODE_HANDLE ParentNode OPTIONAL, > > + OUT AML_OBJECT_NODE_HANDLE *NewCpcNode OPTIONAL > > + ) [SAMI] The number of parameters to this function can be reduced EFI_STATUS EFIAPI AmlCreateCpcNode (   IN AML_CPC_INFO             *CpcInfo,   IN  AML_NODE_HANDLE         ParentNode   OPTIONAL,   OUT AML_OBJECT_NODE_HANDLE  *NewCpcNode   OPTIONAL   ) { [/SAMI] > > +{ > > + EFI_STATUS Status; > > + AML_OBJECT_NODE_HANDLE CpcNode; > > + AML_OBJECT_NODE_HANDLE CpcPackage; > > + UINT32 NumberOfEntries; > > + > > + // Revision 3 per ACPI 6.4 specification > > + if (Revision == 3) { > > + // NumEntries 23 per ACPI 6.4 specification > > + NumberOfEntries = 23; > > + } else { > > + ASSERT (0); > > + return EFI_INVALID_PARAMETER; > > + } > > + > > + if (((HighestPerformanceBuffer == NULL) && (HighestPerformanceInteger == 0)) || > > + ((NominalPerformanceBuffer == NULL) && (NominalPerformanceInteger == 0)) || > > + ((LowestNonlinearPerformanceBuffer == NULL) && (LowestNonlinearPerformanceInteger == 0)) || > > + ((LowestPerformanceBuffer == NULL) && (LowestPerformanceInteger == 0)) || > > + (DesiredPerformanceRegister == NULL) || > > + (ReferencePerformanceCounterRegister == NULL) || > > + (DeliveredPerformanceCounterRegister == NULL) || > > + (PerformanceLimitedRegister == NULL) || [SAMI] Checks can be reduced to if((CpcInfo == NULL) ||       ((ParentNode == NULL) && (NewCpcNode == NULL))) [/SAMI] > > + ((ParentNode == NULL) && (NewCpcNode == NULL))) > > + { > > + ASSERT (0); > > + return EFI_INVALID_PARAMETER; > > + } > > + > > + CpcPackage = NULL; > > + > > + Status = AmlCodeGenNamePackage ("_CPC", NULL, &CpcNode); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + return Status; > > + } > > + > > + // Get the Package object node of the _CPC node, > > + // which is the 2nd fixed argument (i.e. index 1). > > + CpcPackage = (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument ( > > + CpcNode, > > + EAmlParseIndexTerm1 > > + ); > > + if ((CpcPackage == NULL) || > > + (AmlGetNodeType ((AML_NODE_HANDLE)CpcPackage) != EAmlNodeObject) || > > + (!AmlNodeHasOpCode (CpcPackage, AML_PACKAGE_OP, 0))) > > + { > > + ASSERT (0); > > + Status = EFI_INVALID_PARAMETER; > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterOrIntegerToPackage ( > > + NULL, > > + NumberOfEntries, > > + CpcPackage > > + ); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterOrIntegerToPackage ( > > + NULL, > > + Revision, > > + CpcPackage > > + ); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterOrIntegerToPackage ( > > + HighestPerformanceBuffer, > > + HighestPerformanceInteger, [SAMI] Parameters need updating as +&CpcInfo->HighestPerformanceBuffer, +CpcInfo->HighestPerformanceInteger, Similar changes at other places in this file. [/SAMI] > > + CpcPackage > > + ); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterOrIntegerToPackage ( > > + NominalPerformanceBuffer, > > + NominalPerformanceInteger, > > + CpcPackage > > + ); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterOrIntegerToPackage ( > > + LowestNonlinearPerformanceBuffer, > > + LowestNonlinearPerformanceInteger, > > + CpcPackage > > + ); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterOrIntegerToPackage ( > > + LowestPerformanceBuffer, > > + LowestPerformanceInteger, > > + CpcPackage > > + ); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterToPackage (GuaranteedPerformanceRegister, CpcPackage); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterToPackage (DesiredPerformanceRegister, CpcPackage); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterToPackage (MinimumPerformanceRegister, CpcPackage); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterToPackage (MaximumPerformanceRegister, CpcPackage); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterToPackage (PerformanceReductionToleranceRegister, CpcPackage); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterToPackage (TimeWindowRegister, CpcPackage); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterOrIntegerToPackage ( > > + CounterWraparoundTimeBuffer, > > + CounterWraparoundTimeInteger, > > + CpcPackage > > + ); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterToPackage (ReferencePerformanceCounterRegister, CpcPackage); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterToPackage (DeliveredPerformanceCounterRegister, CpcPackage); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterToPackage (PerformanceLimitedRegister, CpcPackage); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterToPackage (CPPCEnableRegister, CpcPackage); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterOrIntegerToPackage ( > > + AutonomousSelectionEnableBuffer, > > + AutonomousSelectionEnableInteger, > > + CpcPackage > > + ); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterToPackage (AutonomousActivityWindowRegister, CpcPackage); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterToPackage (EnergyPerformancePreferenceRegister, CpcPackage); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterOrIntegerToPackage ( > > + ReferencePerformanceBuffer, > > + ReferencePerformanceInteger, > > + CpcPackage > > + ); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterOrIntegerToPackage ( > > + LowestFrequencyBuffer, > > + LowestFrequencyInteger, > > + CpcPackage > > + ); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = AmlAddRegisterOrIntegerToPackage ( > > + NominalFrequencyBuffer, > > + NominalFrequencyInteger, > > + CpcPackage > > + ); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + Status = LinkNode (CpcNode, ParentNode, NewCpcNode); > > + if (EFI_ERROR (Status)) { > > + ASSERT_EFI_ERROR (Status); > > + goto error_handler; > > + } > > + > > + return Status; > > + > > +error_handler: > > + AmlDeleteTree ((AML_NODE_HANDLE)CpcNode); > > + return Status; > > +} > --------------opvjMl68ylkeiXALdOVJzd9M Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hi Jeff,

Please find my feedback inline marked [SAMI].

Most of my suggestions are with respect to reducing the number of parameters in the AmlCreateCpcNod().

Regards,

Sami Mujawar

On 15/09/2022 02:10 pm, Jeff Brasen wrote:
_CPC entries can describe CPU performance information.

The object is described in ACPI 6.4 s8.4.7.1.

"_CPC (Continuous Performance Control)".



Add AmlCreateCpcNode() helper function to add _CPC entries to an

existing CPU object.



Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>

---

 .../Include/Library/AmlLib/AmlLib.h           | 156 +++++

 .../Common/AmlLib/CodeGen/AmlCodeGen.c        | 543 ++++++++++++++++++

 2 files changed, 699 insertions(+)



diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h

index 39968660f2..3fafa6b0e8 100644

--- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h

+++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h

[SAMI] Include <Library/AmlCpcInfo.h> to get the definition for AML_CPC_INFO.


@@ -1336,6 +1336,162 @@ AmlAddNameIntegerPackage (

   IN AML_OBJECT_NODE_HANDLE  PackageNode

   );

 

+/** Create a _CPC node.

+

+  Creates and optionally adds the following node

+   Name(_CPC, Package()

+   {

+    NumEntries,                              // Integer

+    Revision,                                // Integer

+    HighestPerformance,                      // Integer or Buffer (Resource Descriptor)

+    NominalPerformance,                      // Integer or Buffer (Resource Descriptor)

+    LowestNonlinearPerformance,              // Integer or Buffer (Resource Descriptor)

+    LowestPerformance,                       // Integer or Buffer (Resource Descriptor)

+    GuaranteedPerformanceRegister,           // Buffer (Resource Descriptor)

+    DesiredPerformanceRegister ,             // Buffer (Resource Descriptor)

+    MinimumPerformanceRegister ,             // Buffer (Resource Descriptor)

+    MaximumPerformanceRegister ,             // Buffer (Resource Descriptor)

+    PerformanceReductionToleranceRegister,   // Buffer (Resource Descriptor)

+    TimeWindowRegister,                      // Buffer (Resource Descriptor)

+    CounterWraparoundTime,                   // Integer or Buffer (Resource Descriptor)

+    ReferencePerformanceCounterRegister,     // Buffer (Resource Descriptor)

+    DeliveredPerformanceCounterRegister,     // Buffer (Resource Descriptor)

+    PerformanceLimitedRegister,              // Buffer (Resource Descriptor)

+    CPPCEnableRegister                       // Buffer (Resource Descriptor)

+    AutonomousSelectionEnable,               // Integer or Buffer (Resource Descriptor)

+    AutonomousActivityWindowRegister,        // Buffer (Resource Descriptor)

+    EnergyPerformancePreferenceRegister,     // Buffer (Resource Descriptor)

+    ReferencePerformance                     // Integer or Buffer (Resource Descriptor)

+    LowestFrequency,                         // Integer or Buffer (Resource Descriptor)

+    NominalFrequency                         // Integer or Buffer (Resource Descriptor)

+  })

+

+  If resource buffer is NULL then integer will be used.

+

+  Cf. ACPI 6.4, s8.4.7.1 _CPC (Continuous Performance Control)

+

+  @ingroup CodeGenApis

+

+  @param [in]  HighestPerformanceBuffer               If provided, buffer that indicates the highest level

+                                                      of performance the processor.

+  @param [in]  HighestPerformanceInteger              Indicates the highest level of performance the processor,

+                                                      used if buffer is NULL.

+  @param [in]  NominalPerformanceBuffer               If provided buffer that indicates the highest sustained

+                                                      performance level of the processor.

+  @param [in]  NominalPerformanceInteger              Indicates the highest sustained performance level

+                                                      of the processor, used if buffer is NULL.

+  @param [in]  LowestNonlinearPerformanceBuffer       If provided, buffer that indicates the lowest performance level

+                                                      of the processor with non-linear power savings.

+  @param [in]  LowestNonlinearPerformanceInteger      Indicates the lowest performance level of the processor with

+                                                      non-linear power savings, used if buffer is NULL.

+  @param [in]  LowestPerformanceBuffer                If provided, buffer that indicates the

+                                                      lowest performance level of the processor.

+  @param [in]  LowestPerformanceInteger               Indicates the lowest performance level of the processor,

+                                                      used if buffer is NULL.

+  @param [in]  GuaranteedPerformanceRegister          If provided, Guaranteed Performance Register Buffer.

+  @param [in]  DesiredPerformanceRegister             If provided, Desired Performance Register Buffer.

+  @param [in]  MinimumPerformanceRegister             If provided, Minimum Performance Register Buffer.

+  @param [in]  MaximumPerformanceRegister             If provided, Maximum Performance Register Buffer.

+  @param [in]  PerformanceReductionToleranceRegister  If provided, Performance Reduction Tolerance Register.

+  @param [in]  TimeWindowRegister                     If provided, Time Window Register.

+  @param [in]  CounterWraparoundTimeBuffer            If provided, Counter Wraparound Time buffer.

+  @param [in]  CounterWraparoundTimeInteger           Counter Wraparound Time, used if buffer is NULL.

+  @param [in]  ReferencePerformanceCounterRegister    Reference Performance Counter Register.

+  @param [in]  DeliveredPerformanceCounterRegister    Delivered Performance Counter Register.

+  @param [in]  PerformanceLimitedRegister             Performance Limited Register.

+  @param [in]  CPPCEnableRegister                     If provided, CPPC EnableRegister.

+  @param [in]  AutonomousSelectionEnableBuffer        If provided, Autonomous Selection Enable buffer.

+  @param [in]  AutonomousSelectionEnableInteger       Autonomous Selection Enable, used if buffer is NULL.

+  @param [in]  AutonomousActivityWindowRegister       If provided, AutonomousActivity-WindowRegister.

+  @param [in]  EnergyPerformancePreferenceRegister    If provided, EnergyPerformance-PreferenceRegister.

+  @param [in]  ReferencePerformanceBuffer             If provided, Reference Performance buffer.

+  @param [in]  ReferencePerformanceInteger            Reference Performance, used if buffer is NULL.

+  @param [in]  LowestFrequencyBuffer                  If provided, Lowest Frequency buffer.

+  @param [in]  LowestFrequencyInteger                 Lowest Frequency, used if buffer is NULL.

+  @param [in]  NominalFrequencyBuffer                 If provided, NominalFrequencyBuffer buffer.

+  @param [in]  NominalFrequencyInteger                NominalFrequencyBuffer, used if buffer is NULL.

+  @param [in]  ParentNode                             If provided, set ParentNode as the parent

+                                                      of the node created.

+  @param [out] NewCpcNode                             If success and provided, contains the created node.

+

+  @retval EFI_SUCCESS             The function completed successfully.

+  @retval EFI_INVALID_PARAMETER   Invalid parameter.

+  @retval EFI_OUT_OF_RESOURCES    Failed to allocate memory.

+**/

+EFI_STATUS

+EFIAPI

+AmlCreateCpcNode (

[SAMI] The number of parameters to this function can be reduced by passing a pointer to AML_CPC_INFO.

So the new prototype for this function can be made as below:

EFI_STATUS
EFIAPI
AmlCreateCpcNode (
  IN AML_CPC_INFO             *CpcInfo,
  IN  AML_NODE_HANDLE         ParentNode   OPTIONAL,
  OUT AML_OBJECT_NODE_HANDLE  *NewCpcNode   OPTIONAL
  );
[/SAMI]


+  /// The revision number of the _CPC package format.

+  IN  UINT32  Revision,

+  /// Indicates the highest level of performance the processor

+  /// is theoretically capable of achieving.

+  IN  EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *HighestPerformanceBuffer OPTIONAL,

+  IN  UINT32                                  HighestPerformanceInteger,

+  /// Indicates the highest sustained performance level of the processor.

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE   *NominalPerformanceBuffer OPTIONAL,

+  IN UINT32                                   NominalPerformanceInteger,

+  /// Indicates the lowest performance level of the processor with non-linear power savings.

+  IN  EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *LowestNonlinearPerformanceBuffer OPTIONAL,

+  IN UINT32                                   LowestNonlinearPerformanceInteger,

+  /// Indicates the lowest performance level of the processor..

+  IN  EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *LowestPerformanceBuffer OPTIONAL,

+  IN  UINT32                                  LowestPerformanceInteger,

+  /// Guaranteed Performance Register Buffer.

+  /// Optional

+  IN  EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *GuaranteedPerformanceRegister OPTIONAL,

+  /// Desired Performance Register Buffer.

+  IN  EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *DesiredPerformanceRegister,

+  /// Minimum Performance Register Buffer.

+  /// Optional

+  IN  EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *MinimumPerformanceRegister OPTIONAL,

+  /// Maximum Performance Register Buffer.

+  /// Optional

+  IN  EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *MaximumPerformanceRegister OPTIONAL,

+  /// Performance Reduction Tolerance Register.

+  /// Optional

+  IN  EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *PerformanceReductionToleranceRegister OPTIONAL,

+  /// Time Window Register.

+  /// Optional

+  IN  EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *TimeWindowRegister OPTIONAL,

+  /// Counter Wraparound Time

+  /// Optional

+  IN  EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *CounterWraparoundTimeBuffer OPTIONAL,

+  IN  UINT32                                  CounterWraparoundTimeInteger,

+  /// Reference Performance Counter Register

+  IN  EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *ReferencePerformanceCounterRegister,

+  /// Delivered Performance Counter Register

+  IN  EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *DeliveredPerformanceCounterRegister,

+  /// Performance Limited Register

+  IN  EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *PerformanceLimitedRegister,

+  /// CPPC EnableRegister

+  /// Optional

+  IN  EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *CPPCEnableRegister OPTIONAL,

+  /// Autonomous Selection Enable

+  /// Optional

+  IN  EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *AutonomousSelectionEnableBuffer OPTIONAL,

+  IN  UINT32                                  AutonomousSelectionEnableInteger,

+  /// AutonomousActivity-WindowRegister

+  /// Optional

+  IN  EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *AutonomousActivityWindowRegister OPTIONAL,

+  /// EnergyPerformance-PreferenceRegister

+  /// Optional

+  IN  EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *EnergyPerformancePreferenceRegister OPTIONAL,

+  /// Reference Performance

+  /// Optional

+  IN  EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *ReferencePerformanceBuffer OPTIONAL,

+  IN  UINT32                                  ReferencePerformanceInteger,

+  /// Lowest Frequency

+  /// Optional

+  IN  EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *LowestFrequencyBuffer OPTIONAL,

+  IN  UINT32                                  LowestFrequencyInteger,

+  /// Nominal Frequency

+  /// Optional

+  IN  EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *NominalFrequencyBuffer OPTIONAL,

+  IN  UINT32                                  NominalFrequencyInteger,

+  IN  AML_NODE_HANDLE                         ParentNode   OPTIONAL,

+  OUT AML_OBJECT_NODE_HANDLE                  *NewCpcNode   OPTIONAL

+  );

+

 // DEPRECATED APIS

 #ifndef DISABLE_NEW_DEPRECATED_INTERFACES

 

diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c

index 5fb39d077b..42f0d0002c 100644

--- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c

+++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
[SAMI] Include  <Library/AmlCpcInfo.h>

@@ -2850,3 +2850,546 @@ error_handler:

 

   return Status;

 }

+

+/** Adds a register to the package

+

+  @ingroup CodeGenApis

+

+  @param [in]  Register     If provided, register that will be added to package.

+                            otherwise NULL register will be added

+  @param [in]  PackageNode  Package to add value to

+

+  @retval EFI_SUCCESS             The function completed successfully.

+  @retval EFI_INVALID_PARAMETER   Invalid parameter.

+  @retval EFI_OUT_OF_RESOURCES    Failed to allocate memory.

+**/

+STATIC

+EFI_STATUS

+EFIAPI

+AmlAddRegisterToPackage (

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *Register OPTIONAL,

+  IN AML_OBJECT_NODE_HANDLE                  PackageNode

+  )

+{

+  EFI_STATUS              Status;

+  AML_DATA_NODE_HANDLE    RdNode;

+  AML_OBJECT_NODE_HANDLE  ResourceTemplateNode;

+

+  RdNode = NULL;

+

+  Status = AmlCodeGenResourceTemplate (&ResourceTemplateNode);

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    return Status;

+  }

+

+  if (Register != NULL) {

+    Status = AmlCodeGenRdRegister (

+               Register->AddressSpaceId,

+               Register->RegisterBitWidth,

+               Register->RegisterBitOffset,

+               Register->Address,

+               Register->AccessSize,

+               NULL,

+               &RdNode

+               );

+  } else {

+    Status = AmlCodeGenRdRegister (

+               EFI_ACPI_6_4_SYSTEM_MEMORY,

+               0,

+               0,

+               0,

+               0,

+               NULL,

+               &RdNode

+               );

+  }

+

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAppendRdNode (ResourceTemplateNode, RdNode);

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  RdNode = NULL;

+

+  Status = AmlVarListAddTail (

+             (AML_NODE_HANDLE)PackageNode,

+             (AML_NODE_HANDLE)ResourceTemplateNode

+             );

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  return Status;

+

+error_handler:

+  if (RdNode != NULL) {

+    AmlDeleteTree ((AML_NODE_HANDLE)RdNode);

+  }

+

+  if (ResourceTemplateNode != NULL) {

+    AmlDeleteTree ((AML_NODE_HANDLE)ResourceTemplateNode);

+  }

+

+  return Status;

+}

+
[SAMI] Move IsNullGenericAddress() from patch 3/3 file DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.cover here.

[/SAMI]

+/** Adds an integer or register to the package

+

+  @ingroup CodeGenApis

+

+  @param [in]  Register     If provided, register that will be added to package

+  @param [in]  Integer      If Register is NULL, integer that will be added to the package

+  @param [in]  PackageNode  Package to add value to

+

+  @retval EFI_SUCCESS             The function completed successfully.

+  @retval EFI_INVALID_PARAMETER   Invalid parameter.

+  @retval EFI_OUT_OF_RESOURCES    Failed to allocate memory.

+**/

+STATIC

+EFI_STATUS

+EFIAPI

+AmlAddRegisterOrIntegerToPackage (

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *Register OPTIONAL,

+  IN UINT32                                  Integer,

+  IN AML_OBJECT_NODE_HANDLE                  PackageNode

+  )

+{

+  EFI_STATUS              Status;

+  AML_OBJECT_NODE_HANDLE  IntegerNode;

+

+  IntegerNode = NULL;

+

+  if (Register != NULL) {

[SAMI] Modify the above check to

if ((Register != NULL) && !IsNullGenericAddress (Register)) {
[/SAMI]


+    Status = AmlAddRegisterToPackage (Register, PackageNode);

+  } else {

+    Status = AmlCodeGenInteger (Integer, &IntegerNode);

+    if (EFI_ERROR (Status)) {

+      ASSERT_EFI_ERROR (Status);

+      return Status;

+    }

+

+    Status = AmlVarListAddTail (

+               (AML_NODE_HANDLE)PackageNode,

+               (AML_NODE_HANDLE)IntegerNode

+               );

+  }

+

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    if (IntegerNode != NULL) {

+      AmlDeleteTree ((AML_NODE_HANDLE)IntegerNode);

+    }

+  }

+

+  return Status;

+}

+

+/** Create a _CPC node.

+

+  Creates and optionally adds the following node

+   Name(_CPC, Package()

+   {

+    NumEntries,                              // Integer

+    Revision,                                // Integer

+    HighestPerformance,                      // Integer or Buffer (Resource Descriptor)

+    NominalPerformance,                      // Integer or Buffer (Resource Descriptor)

+    LowestNonlinearPerformance,              // Integer or Buffer (Resource Descriptor)

+    LowestPerformance,                       // Integer or Buffer (Resource Descriptor)

+    GuaranteedPerformanceRegister,           // Buffer (Resource Descriptor)

+    DesiredPerformanceRegister ,             // Buffer (Resource Descriptor)

+    MinimumPerformanceRegister ,             // Buffer (Resource Descriptor)

+    MaximumPerformanceRegister ,             // Buffer (Resource Descriptor)

+    PerformanceReductionToleranceRegister,   // Buffer (Resource Descriptor)

+    TimeWindowRegister,                      // Buffer (Resource Descriptor)

+    CounterWraparoundTime,                   // Integer or Buffer (Resource Descriptor)

+    ReferencePerformanceCounterRegister,     // Buffer (Resource Descriptor)

+    DeliveredPerformanceCounterRegister,     // Buffer (Resource Descriptor)

+    PerformanceLimitedRegister,              // Buffer (Resource Descriptor)

+    CPPCEnableRegister                       // Buffer (Resource Descriptor)

+    AutonomousSelectionEnable,               // Integer or Buffer (Resource Descriptor)

+    AutonomousActivityWindowRegister,        // Buffer (Resource Descriptor)

+    EnergyPerformancePreferenceRegister,     // Buffer (Resource Descriptor)

+    ReferencePerformance                     // Integer or Buffer (Resource Descriptor)

+    LowestFrequency,                         // Integer or Buffer (Resource Descriptor)

+    NominalFrequency                         // Integer or Buffer (Resource Descriptor)

+  })

+

+  If resource buffer is NULL then integer will be used.

+

+  Cf. ACPI 6.4, s8.4.7.1 _CPC (Continuous Performance Control)

+

+  @ingroup CodeGenApis

+

+  @param [in]  HighestPerformanceBuffer               If provided, buffer that indicates the highest level

+                                                      of performance the processor.

+  @param [in]  HighestPerformanceInteger              Indicates the highest level of performance the processor,

+                                                      used if buffer is NULL.

+  @param [in]  NominalPerformanceBuffer               If provided buffer that indicates the highest sustained

+                                                      performance level of the processor.

+  @param [in]  NominalPerformanceInteger              Indicates the highest sustained performance level

+                                                      of the processor, used if buffer is NULL.

+  @param [in]  LowestNonlinearPerformanceBuffer       If provided, buffer that indicates the lowest performance level

+                                                      of the processor with non-linear power savings.

+  @param [in]  LowestNonlinearPerformanceInteger      Indicates the lowest performance level of the processor with

+                                                      non-linear power savings, used if buffer is NULL.

+  @param [in]  LowestPerformanceBuffer                If provided, buffer that indicates the

+                                                      lowest performance level of the processor.

+  @param [in]  LowestPerformanceInteger               Indicates the lowest performance level of the processor,

+                                                      used if buffer is NULL.

+  @param [in]  GuaranteedPerformanceRegister          If provided, Guaranteed Performance Register Buffer.

+  @param [in]  DesiredPerformanceRegister             If provided, Desired Performance Register Buffer.

+  @param [in]  MinimumPerformanceRegister             If provided, Minimum Performance Register Buffer.

+  @param [in]  MaximumPerformanceRegister             If provided, Maximum Performance Register Buffer.

+  @param [in]  PerformanceReductionToleranceRegister  If provided, Performance Reduction Tolerance Register.

+  @param [in]  TimeWindowRegister                     If provided, Time Window Register.

+  @param [in]  CounterWraparoundTimeBuffer            If provided, Counter Wraparound Time buffer.

+  @param [in]  CounterWraparoundTimeInteger           Counter Wraparound Time, used if buffer is NULL.

+  @param [in]  ReferencePerformanceCounterRegister    Reference Performance Counter Register.

+  @param [in]  DeliveredPerformanceCounterRegister    Delivered Performance Counter Register.

+  @param [in]  PerformanceLimitedRegister             Performance Limited Register.

+  @param [in]  CPPCEnableRegister                     If provided, CPPC EnableRegister.

+  @param [in]  AutonomousSelectionEnableBuffer        If provided, Autonomous Selection Enable buffer.

+  @param [in]  AutonomousSelectionEnableInteger       Autonomous Selection Enable, used if buffer is NULL.

+  @param [in]  AutonomousActivityWindowRegister       If provided, AutonomousActivity-WindowRegister.

+  @param [in]  EnergyPerformancePreferenceRegister    If provided, EnergyPerformance-PreferenceRegister.

+  @param [in]  ReferencePerformanceBuffer             If provided, Reference Performance buffer.

+  @param [in]  ReferencePerformanceInteger            Reference Performance, used if buffer is NULL.

+  @param [in]  LowestFrequencyBuffer                  If provided, Lowest Frequency buffer.

+  @param [in]  LowestFrequencyInteger                 Lowest Frequency, used if buffer is NULL.

+  @param [in]  NominalFrequencyBuffer                 If provided, NominalFrequencyBuffer buffer.

+  @param [in]  NominalFrequencyInteger                NominalFrequencyBuffer, used if buffer is NULL.

+  @param [in]  ParentNode                             If provided, set ParentNode as the parent

+                                                      of the node created.

+  @param [out] NewCpcNode                             If success and provided, contains the created node.

+

+  @retval EFI_SUCCESS             The function completed successfully.

+  @retval EFI_INVALID_PARAMETER   Invalid parameter.

+  @retval EFI_OUT_OF_RESOURCES    Failed to allocate memory.

+**/

+EFI_STATUS

+EFIAPI

+AmlCreateCpcNode (

+  /// The revision number of the _CPC package format.

+  IN  UINT32  Revision,

+  /// Indicates the highest level of performance the processor

+  /// is theoretically capable of achieving.

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *HighestPerformanceBuffer OPTIONAL,

+  IN UINT32                                  HighestPerformanceInteger,

+  /// Indicates the highest sustained performance level of the processor.

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *NominalPerformanceBuffer OPTIONAL,

+  IN UINT32                                  NominalPerformanceInteger,

+  /// Indicates the lowest performance level of the processor with non-linear power savings.

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *LowestNonlinearPerformanceBuffer OPTIONAL,

+  IN UINT32                                  LowestNonlinearPerformanceInteger,

+  /// Indicates the lowest performance level of the processor..

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *LowestPerformanceBuffer OPTIONAL,

+  IN UINT32                                  LowestPerformanceInteger,

+  /// Guaranteed Performance Register Buffer.

+  /// Optional

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *GuaranteedPerformanceRegister OPTIONAL,

+  /// Desired Performance Register Buffer.

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *DesiredPerformanceRegister,

+  /// Minimum Performance Register Buffer.

+  /// Optional

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *MinimumPerformanceRegister OPTIONAL,

+  /// Maximum Performance Register Buffer.

+  /// Optional

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *MaximumPerformanceRegister OPTIONAL,

+  /// Performance Reduction Tolerance Register.

+  /// Optional

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *PerformanceReductionToleranceRegister OPTIONAL,

+  /// Time Window Register.

+  /// Optional

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *TimeWindowRegister OPTIONAL,

+  /// Counter Wraparound Time

+  /// Optional

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *CounterWraparoundTimeBuffer OPTIONAL,

+  IN UINT32                                  CounterWraparoundTimeInteger,

+  /// Reference Performance Counter Register

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *ReferencePerformanceCounterRegister,

+  /// Delivered Performance Counter Register

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *DeliveredPerformanceCounterRegister,

+  /// Performance Limited Register

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *PerformanceLimitedRegister,

+  /// CPPC EnableRegister

+  /// Optional

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *CPPCEnableRegister OPTIONAL,

+  /// Autonomous Selection Enable

+  /// Optional

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *AutonomousSelectionEnableBuffer OPTIONAL,

+  IN UINT32                                  AutonomousSelectionEnableInteger,

+  /// AutonomousActivity-WindowRegister

+  /// Optional

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *AutonomousActivityWindowRegister OPTIONAL,

+  /// EnergyPerformance-PreferenceRegister

+  /// Optional

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *EnergyPerformancePreferenceRegister OPTIONAL,

+  /// Reference Performance

+  /// Optional

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *ReferencePerformanceBuffer OPTIONAL,

+  IN UINT32                                  ReferencePerformanceInteger,

+  /// Lowest Frequency

+  /// Optional

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *LowestFrequencyBuffer OPTIONAL,

+  IN UINT32                                  LowestFrequencyInteger,

+  /// Nominal Frequency

+  /// Optional

+  IN EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE  *NominalFrequencyBuffer OPTIONAL,

+  IN UINT32                                  NominalFrequencyInteger,

+  IN AML_NODE_HANDLE                         ParentNode OPTIONAL,

+  OUT AML_OBJECT_NODE_HANDLE                 *NewCpcNode OPTIONAL

+  )

[SAMI] The number of parameters to this function can be reduced

EFI_STATUS
EFIAPI
AmlCreateCpcNode (
  IN AML_CPC_INFO             *CpcInfo,
  IN  AML_NODE_HANDLE         ParentNode   OPTIONAL,
  OUT AML_OBJECT_NODE_HANDLE  *NewCpcNode   OPTIONAL
  )
{
[/SAMI]


+{

+  EFI_STATUS              Status;

+  AML_OBJECT_NODE_HANDLE  CpcNode;

+  AML_OBJECT_NODE_HANDLE  CpcPackage;

+  UINT32                  NumberOfEntries;

+

+  // Revision 3 per ACPI 6.4 specification

+  if (Revision == 3) {

+    // NumEntries 23 per ACPI 6.4 specification

+    NumberOfEntries = 23;

+  } else {

+    ASSERT (0);

+    return EFI_INVALID_PARAMETER;

+  }

+

+  if (((HighestPerformanceBuffer == NULL) && (HighestPerformanceInteger == 0)) ||

+      ((NominalPerformanceBuffer == NULL) && (NominalPerformanceInteger == 0)) ||

+      ((LowestNonlinearPerformanceBuffer == NULL) && (LowestNonlinearPerformanceInteger == 0)) ||

+      ((LowestPerformanceBuffer == NULL) && (LowestPerformanceInteger == 0)) ||

+      (DesiredPerformanceRegister == NULL)    ||

+      (ReferencePerformanceCounterRegister == NULL)    ||

+      (DeliveredPerformanceCounterRegister == NULL)    ||

+      (PerformanceLimitedRegister == NULL)             ||

[SAMI] Checks can be reduced to

 if ((CpcInfo == NULL) ||
      ((ParentNode == NULL) && (NewCpcNode == NULL)))

[/SAMI]

+      ((ParentNode == NULL) && (NewCpcNode == NULL)))

+  {

+    ASSERT (0);

+    return EFI_INVALID_PARAMETER;

+  }

+

+  CpcPackage = NULL;

+

+  Status = AmlCodeGenNamePackage ("_CPC", NULL, &CpcNode);

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    return Status;

+  }

+

+  // Get the Package object node of the _CPC node,

+  // which is the 2nd fixed argument (i.e. index 1).

+  CpcPackage = (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument (

+                                         CpcNode,

+                                         EAmlParseIndexTerm1

+                                         );

+  if ((CpcPackage == NULL)                                              ||

+      (AmlGetNodeType ((AML_NODE_HANDLE)CpcPackage) != EAmlNodeObject)  ||

+      (!AmlNodeHasOpCode (CpcPackage, AML_PACKAGE_OP, 0)))

+  {

+    ASSERT (0);

+    Status = EFI_INVALID_PARAMETER;

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterOrIntegerToPackage (

+             NULL,

+             NumberOfEntries,

+             CpcPackage

+             );

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterOrIntegerToPackage (

+             NULL,

+             Revision,

+             CpcPackage

+             );

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterOrIntegerToPackage (

+             HighestPerformanceBuffer,

+             HighestPerformanceInteger,
[SAMI] Parameters need updating as
+             &CpcInfo->HighestPerformanceBuffer,
+             CpcInfo->HighestPerformanceInteger,
Similar changes at other places in this file.
[/SAMI]

+             CpcPackage

+             );

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterOrIntegerToPackage (

+             NominalPerformanceBuffer,

+             NominalPerformanceInteger,

+             CpcPackage

+             );

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterOrIntegerToPackage (

+             LowestNonlinearPerformanceBuffer,

+             LowestNonlinearPerformanceInteger,

+             CpcPackage

+             );

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterOrIntegerToPackage (

+             LowestPerformanceBuffer,

+             LowestPerformanceInteger,

+             CpcPackage

+             );

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterToPackage (GuaranteedPerformanceRegister, CpcPackage);

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterToPackage (DesiredPerformanceRegister, CpcPackage);

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterToPackage (MinimumPerformanceRegister, CpcPackage);

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterToPackage (MaximumPerformanceRegister, CpcPackage);

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterToPackage (PerformanceReductionToleranceRegister, CpcPackage);

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterToPackage (TimeWindowRegister, CpcPackage);

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterOrIntegerToPackage (

+             CounterWraparoundTimeBuffer,

+             CounterWraparoundTimeInteger,

+             CpcPackage

+             );

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterToPackage (ReferencePerformanceCounterRegister, CpcPackage);

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterToPackage (DeliveredPerformanceCounterRegister, CpcPackage);

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterToPackage (PerformanceLimitedRegister, CpcPackage);

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterToPackage (CPPCEnableRegister, CpcPackage);

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterOrIntegerToPackage (

+             AutonomousSelectionEnableBuffer,

+             AutonomousSelectionEnableInteger,

+             CpcPackage

+             );

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterToPackage (AutonomousActivityWindowRegister, CpcPackage);

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterToPackage (EnergyPerformancePreferenceRegister, CpcPackage);

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterOrIntegerToPackage (

+             ReferencePerformanceBuffer,

+             ReferencePerformanceInteger,

+             CpcPackage

+             );

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterOrIntegerToPackage (

+             LowestFrequencyBuffer,

+             LowestFrequencyInteger,

+             CpcPackage

+             );

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = AmlAddRegisterOrIntegerToPackage (

+             NominalFrequencyBuffer,

+             NominalFrequencyInteger,

+             CpcPackage

+             );

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  Status = LinkNode (CpcNode, ParentNode, NewCpcNode);

+  if (EFI_ERROR (Status)) {

+    ASSERT_EFI_ERROR (Status);

+    goto error_handler;

+  }

+

+  return Status;

+

+error_handler:

+  AmlDeleteTree ((AML_NODE_HANDLE)CpcNode);

+  return Status;

+}

--------------opvjMl68ylkeiXALdOVJzd9M--