From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83816+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83816+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167788058873.5709909646654; Wed, 17 Nov 2021 08:49:48 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id n8uqYY1788612xrIwof8WFV0; Wed, 17 Nov 2021 08:49:47 -0800 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.116]) by mx.groups.io with SMTP id smtpd.web08.9761.1637167786615272414 for ; Wed, 17 Nov 2021 08:49:46 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QsAxw1Z+8L1q+StcVMkvfxytGqKYNLW1yc2fmg2VYdNu+H2R3uNaOF0xOdKJEkq9Z4uf2yfY+a+VVuCE5vrLg51p2g1F05KoYICRuc1aLX/iubMI/BEDPYB522sQQZC8c451A+3PQ091+UAOI3AABK05mmgAUxJbADkSLsmPIjijFsxkkMWdfRaYnELtKhVkrUhLOnYHUea1/dtXL8Y5F3rgPUpC1b+OrBIL8JWSn37VRqss7QMPUSZjBPyURwc1iMLi+SimE2rQiytjgB47FKYFQ1OkqPdN29DCukd7VvtwKFmGEmyxVL1BST8HhXiIu5KDj37Y1TBbe+0uNRlaUw== 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=EWREa2Dht5adP11DpNjnxqgn76dolQTxBIZca3lCmz8=; b=c5GrZiVppIM18wVel3klj0ZdXL9nI6EB2TEKS8gn8ywNe5Wl0hJHQ8IazbkUbhh8TwJQnC7wus0Qrk/qn61nDOdst2uFFVaTjwhhvYpMvxsQ5tjENhQi2pIqHhgmN5O82jJjIcj/t7UazKZd0CFf3E0JFd7YsbagqJdKpYu1hn2xfiGqaaJaxSb/7uIoKmQdvxXXtzGzywCb6H0ZGBPFMgrOEYpTUnJ4QZ5ihjT/mqNi8Mimb3PQf+odpf5XoA/Y+nigadhNO1xDOike8dO0ALbSl8TT1GOd853kMB6O/law61yh6elM1oviHFiqcKFKlryoWw8Fp1jBP1jW0NzwOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB6454.prod.exchangelabs.com (2603:10b6:510:1b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.20; Wed, 17 Nov 2021 16:49:37 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:49:37 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 01/30] Ampere: Initial support for Ampere Altra processor and Mt. Jade platform Date: Wed, 17 Nov 2021 23:46:58 +0700 Message-ID: <20211117164727.10922-2-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:49:33 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 60c36788-c55f-4276-21c4-08d9a9ea3d4c X-MS-TrafficTypeDiagnostic: PH0PR01MB6454: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: P+YrrCqp36yfuVks83VP4SMnx/VgLYUtgtTbc3bsfMteoDbWrEtIMMFkNX9YilrdFcTWqFheHvM8aRr52ecskZrSqZ18VH8uXAfBxxJt939haLCExL8JP7AO9Qw03dSt6Iz2ot8ZiBmjcHkclW9L3u9xPxUMm98XTvYg5voBNvSe1FSsY1YnN8wDi0dcCMjyRL+uPn4/9m8DF2OxvRaAlddLvWnFuOdbJoiHHjL9b2qxo+nNlkBxoo+3EPZQtPU2O54PDmW57DfLPaROmfZxGH0gr01/9MWCQ72o8EXR6bbLIOHMC3dJeWqfnb/PxnKGM+SMoWYWwJr0oTyYD+YcXnSipFnj8+b1QedjPeKz8QFMQDwg9jQ/o/u4LafDIN1c8BAvvb17Q9dlelP3JVFUBdlPaHXvkh7dBsGuKfa7YF0FheqAMWaoYn65EEr5TLHx/NLc5TccG4+VFx1WIZsliqhpZgR+YyP0eXVyQA4qJtQDx/nc0d3qihbxG9X8TRfVSfbgHi8C73/3G0YbUVboFktb22WTB2WCMjVrRY6ZN3qM+2WE+aieZ7ISaBGsDUxdnR2Ek6/yweR2v5sfigSi3DVCncdMOh4k8eFzXBjfqArVTcgmLd4TXBuvWYsFb0vB8m7qIwEjJV0Z2kGcCeIh78apUXuX4zZBJqu0s/osNlqsKWKN26l112UigbQ9QUSa8lseRV/u+LGpkaZsK+2vHg== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?tbqHbsh6xQw3MsGnMVPPDQtd4xxGd/vZGddeX89oRMPT+RuAKy1UI0rWtehM?= =?us-ascii?Q?xPUQCqY+XUB2Eyy4zpq5H4awhWOzJTCW47tnl4GHCz3+2nBm8hCx1tKWxIdg?= =?us-ascii?Q?EtKUO/bdHRsPrQr2r5+eOsTCBuQmCz0oxmi3KAkF4Et8iSma6vABJkKqdoEC?= =?us-ascii?Q?dpda+18pJcsKxPEuaeMrjbMKXjnARWHZp8AyB+u1nA7TtUTkKq2B8wLSUwZs?= =?us-ascii?Q?GA8WYk9maXHFhpakl44xR609NLouf9N/qss/pddCwR2bLQxQQF780U1vNks0?= =?us-ascii?Q?cowrVcaue9+492fpNzHb23pqYJbj0wFt+TIimx9dpMQc9XIYmt4PQuMl7jzR?= =?us-ascii?Q?KJE63CyYqz1xxlTUA7cxGCtb7lDWK2rHEI4c3vcpZfJhljEbCtIPKT8P2EG4?= =?us-ascii?Q?jhmvQ8UbRoLXjAOSDLwmvGxZFL+Ju40atOBGZB16lBuUxfN1kXl9vxWOrAMk?= =?us-ascii?Q?XlWfxsoUgjk72qhiA/DDgJFEa/6wehnOb71YogDrxt+dWx7aeUmICSm7n5Cd?= =?us-ascii?Q?bNyv6/ZQ2GXY7+aOo0+eaP0kuF56CLPyW2c0mgc4iOwFHFSa3EBImi88NnTD?= =?us-ascii?Q?4cN7UoLzd6VqgWriBuZzUQmw4Duf+yldzKDamIIcZUTmyPo7s1VwS1UUT12C?= =?us-ascii?Q?Ej1SgQYCaLxNjT29cHc5NBJqH6jId0nJ4BCYFjabbi+1CvrpPYr8R+E9X6p9?= =?us-ascii?Q?O6QLJdV+6zJ8uGDe7B1lbVx5MO5i3Qb6E6RPmsrWIRDM0l++P3Mv19aPT/8O?= =?us-ascii?Q?XiahsMZxrGJHAgsUUV7ZYgl5mv/5aBTOXzYG/Dioue9Nua8uGZB9dDH/88Be?= =?us-ascii?Q?Ds4VP/qc+iVAPanWD8+7s9eIEpdk+syiMVyG4QSb/zQbf5ryOBfAlTHu3X99?= =?us-ascii?Q?qkNugoxTFpRf3YrXJULjS+5K/ZwOF+aSGzsLNuATlYAAB9oORKT5X++nfcjq?= =?us-ascii?Q?7iSBwjphCg3QhKYUyGb10Nc6F+TQyy+tztbzNxT+VwpRlUwUPQ64rND+oIUE?= =?us-ascii?Q?cQWEmgUc14VmCA2qG40o09oLBJazj2t/dsiKEh1RN33M6pwMsTgty3An6dMA?= =?us-ascii?Q?ZJHpvs3amsQDpA5yDHihm/4P6CHPvAd3p8Mt11NC34F5nJY9zGLgUEaLBnoY?= =?us-ascii?Q?+3r6i2Yu56Xh4QMn2Mj8BmAz3GF1IJiVNXr3zVcB7IuPmoXtGTGl18fmoR8e?= =?us-ascii?Q?xXUAfNfgfkukpYkIfKibAE4OsM9yBbVYWXdInH2UyoXs4aL/qwLoRBydHiiC?= =?us-ascii?Q?OJYNEywgopXbz/KzNpWdZ5xheNEI+yDIriHcHpDUcqN7KW2E8NhbYjLVbVoY?= =?us-ascii?Q?DyNiPhpLLcMjwx1g99fG1TKA3HbLW4P/9vXdWlpiaraK3TpF0jYTUIJIciO1?= =?us-ascii?Q?Puj5EkV6/9a2pWjsKqun3XnmJ3LTLS6XmZmtgYFG5SSkCsuXumIkSZaN4iRz?= =?us-ascii?Q?c1MkLgMjfc1tPpsBDgaBzFIBQNoYHqtsq4VGcnKBtpJiKPKRLJD3gqlLaXXu?= =?us-ascii?Q?B3/FUBlS+8lcrNZBDqFYb4IEn0CQYHsgf7W0/f9hjE5lKXHFEOqvVQk5fz7C?= =?us-ascii?Q?Az2Qsnq9Xxz5y3tuvuHPZeIYMrjLRAaEFHRl/BLaSew9kuUk7lpcbUUiqIUd?= =?us-ascii?Q?vK508Laro0yYLCa+HnOXijiofcu8w8DjlE1razy7BfzRTiQMMPi2O00r+W3v?= =?us-ascii?Q?Ec7I7Q=3D=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 60c36788-c55f-4276-21c4-08d9a9ea3d4c X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:49:37.1888 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ads1xStxkhudbB0tIFpDmW0z/ucXAtozHfPL+HE7G6Jl0u8vfJWUnP1oUkMR4KMeQjed1YSWZaRCZkHmtZlVduUJPJasxHFwvgDuGRpHcVo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6454 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: FjJmnPGZsGa8zfkyw081aOPCx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167787; bh=sCSdReG45QeNhfXZGu53/hf2+9sWwypETSdLZI3lwZk=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=iD4oo1/iSlVdFnWZ2sZNYWopkP+YnqEjCDfzNkhYbCYg4nd1DyX8v7/w4Ol2bf/ZqFt bhL81DGiWh1stW+uDbRfa/tzzTECTXowXF8ktIo0u0BlpOg+y/KCio9pGaJjdV6BmurDd HuQaYqN1VYsPJEYu2hl8NcGLuBHnYDDKXs8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167788931100005 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen This commit adds the support for Ampere=E2=80=99s Altra processor-based Mt.= Jade platform that provides up to 160 processor cores in a dual socket configuration. The essential modules are wired up enough to boot system to EDK2 UiApp. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec = | 45 ++ Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec = | 46 ++ Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc = | 677 ++++++++++++++++++++ Platform/Ampere/JadePkg/Jade.dsc = | 101 +++ Platform/Ampere/JadePkg/Jade.fdf = | 228 +++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf = | 41 ++ Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.inf = | 45 ++ Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAmpereCpuLib.inf= | 50 ++ Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.inf = | 57 ++ Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfaceLib/MailboxInterface= Lib.inf | 37 ++ Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.in= f | 59 ++ Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLib/MmCommunicationLi= b.inf | 35 + Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.inf = | 33 + Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/RuntimeNVParamLib.inf = | 35 + Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.inf = | 29 + Silicon/Ampere/AmpereAltraPkg/Library/SystemFirmwareInterfaceLib/SystemFir= mwareInterfaceLib.inf | 30 + Silicon/Ampere/AmpereAltraPkg/Library/TrngLib/TrngLib.inf = | 29 + Silicon/Ampere/AmpereAltraPkg/Include/Guid/PlatformInfoHob.h = | 188 ++++++ Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h = | 276 ++++++++ Silicon/Ampere/AmpereAltraPkg/Include/Library/MailboxInterfaceLib.h = | 172 +++++ Silicon/Ampere/AmpereAltraPkg/Include/Library/MmCommunicationLib.h = | 44 ++ Silicon/Ampere/AmpereAltraPkg/Include/Library/NVParamLib.h = | 134 ++++ Silicon/Ampere/AmpereAltraPkg/Include/Library/SystemFirmwareInterfaceLib.h= | 282 ++++++++ Silicon/Ampere/AmpereAltraPkg/Include/Library/TrngLib.h = | 31 + Silicon/Ampere/AmpereAltraPkg/Include/NVParamDef.h = | 534 +++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h = | 62 ++ Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/PlatformMemoryMap.h = | 135 ++++ Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLibCommon.h = | 70 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.c = | 51 ++ Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.c = | 42 ++ Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLibCommon.c = | 637 ++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAmpereCpuLib.c = | 137 ++++ Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.c = | 168 +++++ Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLibMemory.= c | 256 ++++++++ Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfaceLib/MailboxInterface= Lib.c | 281 ++++++++ Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.c = | 93 +++ Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLib/MmCommunicationLi= b.c | 184 ++++++ Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.c = | 64 ++ Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLibCommon.c = | 235 +++++++ Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/RuntimeNVParamLib.c = | 130 ++++ Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.c = | 141 ++++ Silicon/Ampere/AmpereAltraPkg/Library/SystemFirmwareInterfaceLib/SystemFir= mwareInterfaceLib.c | 328 ++++++++++ Silicon/Ampere/AmpereAltraPkg/Library/TrngLib/TrngLib.c = | 63 ++ Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformHelper.S = | 45 ++ Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.uni = | 13 + Silicon/Ampere/AmpereSiliconPkg/FvRules.fdf.inc = | 176 +++++ 46 files changed, 6549 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Amp= ere/AmpereAltraPkg/AmpereAltraPkg.dec new file mode 100644 index 000000000000..0813fc9b4b69 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -0,0 +1,45 @@ +## @file +# +# Copyright (c) 2020-2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + DEC_SPECIFICATION =3D 0x0001001B + PACKAGE_NAME =3D AmpereAltraPkg + PACKAGE_GUID =3D 481F7D0D-7525-4B76-AF12-58E7B82C46C2 + PACKAGE_VERSION =3D 0.1 + +[Includes] + Include + +[LibraryClasses] + ## @libraryclass Defines a set of methods to retrieve CPU info. + AmpereCpuLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h + + ## @libraryclass Defines a set of methods to get/set NVParam. + NVParamLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/NVParamLib.h + + ## @libraryclass Defines a set of methods to access Mailbox interface. + MailboxInterfaceLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/Mailbo= xInterfaceLib.h + + ## @libraryclass Defines a set of methods to communicate with SCP. + SystemFirmwareInterfaceLib|Silicon/Ampere/AmpereAltraPkg/Include/Library= /SystemFirmwareInterfaceLib.h + + ## @libraryclass Defines a set of methods to communicate with secure p= arition over MM interface. + MmCommunicationLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/MmCommu= nicationLib.h + + ## @libraryclass Defines a set of methods to generate random numbers b= y using Hardware RNG. + TrngLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/TrngLib.h + +[Guids] + ## NVParam MM GUID + gNVParamMmGuid =3D { 0xE4AC5024, 0x29BE, 0x4ADC, { 0x93, 0= x36, 0x87, 0xB5, 0xA0, 0x76, 0x23, 0x2D } } + + ## SPI NOR Proxy MM GUID + gSpiNorMmGuid =3D { 0xC8D76438, 0x4D3C, 0x4BEA, { 0xBF, 0= x86, 0x92, 0x6B, 0x83, 0x07, 0xA2, 0x39 } } + + ## Include/Guid/PlatformInfoHob.h + gPlatformInfoHobGuid =3D { 0x7f73e372, 0x7183, 0x4022, { 0xb3, 0= x76, 0x78, 0x30, 0x32, 0x6d, 0x79, 0xb4 } } diff --git a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec b/Silicon= /Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec new file mode 100644 index 000000000000..6ebdf7db0a57 --- /dev/null +++ b/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec @@ -0,0 +1,46 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + DEC_SPECIFICATION =3D 0x0001001B + PACKAGE_NAME =3D AmpereSiliconPkg + PACKAGE_GUID =3D F9EB69A8-7569-4C0E-87D1-3CC9EB7CBF09 + PACKAGE_VERSION =3D 0.1 + +##########################################################################= ###### +# +# Include Section - list of Include Paths that are provided by this packag= e. +# Comments are used for Keywords and Module Types. +# +# Supported Module Types: +# BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_D= RIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION +# +##########################################################################= ###### +[Includes.common] + +[LibraryClasses] + +[Guids] + gAmpereTokenSpaceGuid =3D { 0xdbd4436e, 0x89cb, 0x44dc, { 0xb5, 0xc0, 0x= 49, 0xc3, 0x91, 0x35, 0xbf, 0xdf } } + +[Ppis] + +[PcdsFixedAtBuild] + # + # SMpro PMpro Pcds + # + gAmpereTokenSpaceGuid.PcdSmproDbBaseReg|0x100000540000|UINT64|0x00000001 + gAmpereTokenSpaceGuid.PcdSmproEfuseShadow0|0x10000054a000|UINT64|0x00000= 002 + gAmpereTokenSpaceGuid.PcdSmproNsMailboxIndex|0x1|UINT32|0x00000003 + gAmpereTokenSpaceGuid.PcdPmproDbBaseReg|0x100001540000|UINT64|0x00000004 + +[PcdsFixedAtBuild, PcdsDynamic, PcdsDynamicEx] + # + # Firmware Volume Pcds + # + gAmpereTokenSpaceGuid.PcdFvBlockSize|0|UINT32|0xB0000001 diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc new file mode 100644 index 000000000000..15f649d97f30 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -0,0 +1,677 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,B= uildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICA= TION] + GCC:*_*_AARCH64_DLINK_FLAGS =3D -z common-page-size=3D0x1000 + +[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER] + GCC:*_*_AARCH64_DLINK_FLAGS =3D -z common-page-size=3D0x10000 + +[BuildOptions] + GCC:RELEASE_*_*_CC_FLAGS =3D -DMDEPKG_NDEBUG + +[LibraryClasses.common] +!if $(TARGET) =3D=3D RELEASE + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf +!else + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf +!endif + DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseD= ebugPrintErrorLevelLib.inf + + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf + SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf + SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchroniza= tionLib.inf + PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibN= ull.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeC= offGetEntryPointLib.inf + PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf + UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompres= sLib.inf + CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf + + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/U= efiRuntimeServicesTableLib.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBoo= tServicesTableLib.inf + DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableL= ib.inf + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry= Point.inf + UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiA= pplicationEntryPoint.inf + HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf + UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServic= esLib.inf + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf + + # + # Allow dynamic PCDs + # + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + + # + # Random Generator Library + # + TrngLib|Silicon/Ampere/AmpereAltraPkg/Library/TrngLib/TrngLib.inf + RngLib|Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.inf + + # + # ARM Architectural Libraries + # + ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf + ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf + CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMainte= nanceLib.inf + DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/Def= aultExceptionHandlerLib.inf + CpuExceptionHandlerLib|ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf + ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.= inf + ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf + ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf + ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatfo= rmStackLib.inf + ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf + ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/Ar= mGenericTimerPhyCounterLib.inf + ResetSystemLib|ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSy= stemLib.inf + + # + # Ampere Altra specific Libraries + # + ArmPlatformLib|Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmP= latformLib.inf + NVParamLib|Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.i= nf + MailboxInterfaceLib|Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfa= ceLib/MailboxInterfaceLib.inf + SystemFirmwareInterfaceLib|Silicon/Ampere/AmpereAltraPkg/Library/SystemF= irmwareInterfaceLib/SystemFirmwareInterfaceLib.inf + AmpereCpuLib|Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCp= uLib.inf + TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf + MmCommunicationLib|Silicon/Ampere/AmpereAltraPkg/Library/MmCommunication= Lib/MmCommunicationLib.inf + + # + # ARM PL011 UART Driver + # + PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf + SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortL= ib.inf + PL011UartClockLib|ArmPlatformPkg/Library/PL011UartClockLib/PL011UartCloc= kLib.inf + + # + # Timer Library + # + TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf + + # + # Uncomment (and comment out the next line) For RealView Debugger. The S= tandard IO window + # in the debugger will show load and unload commands for symbols. You ca= n cut and paste this + # into the command window to load symbols. We should be able to use a sc= ript to do this, but + # the version of RVD I have does not support scripts accessing system me= mory. + # + #PeCoffExtraActionLib|ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffEx= traActionLib.inf + PeCoffExtraActionLib|ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCof= fExtraActionLib.inf + #PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePe= CoffExtraActionLibNull.inf + + DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.i= nf + DebugAgentTimerLib|EmbeddedPkg/Library/DebugAgentTimerLibNull/DebugAgent= TimerLibNull.inf + + SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf + + # + # BDS Libraries + # + UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManag= erLib.inf + PlatformBootManagerLib|ArmPkg/Library/PlatformBootManagerLib/PlatformBoo= tManagerLib.inf + BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf + + # + # UEFI Shell libraries + # + ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf + FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf + SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf + FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf + OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib= /BaseOrderedCollectionRedBlackTreeLib.inf + + # + # Secure Boot dependencies + # +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf + OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf + TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasure= mentLib.inf + AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf + SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/SecureBo= otVariableLib.inf + SecureBootVariableProvisionLib|SecurityPkg/Library/SecureBootVariablePro= visionLib/SecureBootVariableProvisionLib.inf + + # + # re-use the UserPhysicalPresent() dummy implementation from the ovmf tr= ee + # + PlatformSecureLib|OvmfPkg/Library/PlatformSecureLib/PlatformSecureLib.inf +!else + TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurem= entLibNull.inf + AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLib= Null.inf +!endif + VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyL= ib.inf + VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Var= iablePolicyHelperLib.inf + + # + # Networking Requirements + # +!if $(NETWORK_TLS_ENABLE) =3D=3D TRUE + TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf +!endif + + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf + CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/Customize= dDisplayLib.inf + + ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf + +[LibraryClasses.common.SEC] + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsB= aseLib.inf + PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf + ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib= /PrePiExtractGuidedSectionLib.inf + LzmaDecompressLib|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCusto= mDecompressLib.inf + MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMe= moryAllocationLib.inf + HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf + PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/Pre= PiHobListPointerLib.inf + PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.= inf + ArmGicArchLib|ArmPkg/Library/ArmGicArchSecLib/ArmGicArchSecLib.inf + +[LibraryClasses.common.PEI_CORE] + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf + PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf + PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.= inf + ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiRepor= tStatusCodeLib.inf + OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf + ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExt= ractGuidedSectionLib.inf + PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf + + PeiServicesTablePointerLib|ArmPkg/Library/PeiServicesTablePointerLib/Pei= ServicesTablePointerLib.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + +[LibraryClasses.common.PEIM] + PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf + PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf + PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.= inf + ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiRepor= tStatusCodeLib.inf + OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf + PeiResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiRe= sourcePublicationLib.inf + ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExt= ractGuidedSectionLib.inf + PeiServicesTablePointerLib|ArmPkg/Library/PeiServicesTablePointerLib/Pei= ServicesTablePointerLib.inf + +[LibraryClasses.common.SEC, LibraryClasses.common.PEIM] + MemoryInitPeiLib|Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/= MemoryInitPeiLib.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf + +[LibraryClasses.common.DXE_CORE] + HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf + MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeC= oreMemoryAllocationLib.inf + DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf + ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExt= ractGuidedSectionLib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerform= anceLib.inf + +[LibraryClasses.common.DXE_DRIVER] + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeS= ecurityManagementLib.inf + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.= inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf + +[LibraryClasses.common.UEFI_APPLICATION] + UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiTianoCust= omDecompressLib.inf + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.= inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + +[LibraryClasses.common.UEFI_DRIVER] + ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExt= ractGuidedSectionLib.inf + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.= inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf + UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf + UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf + +[LibraryClasses.common.DXE_RUNTIME_DRIVER] + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf + ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/R= untimeDxeReportStatusCodeLib.inf +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf +!endif +!if $(TARGET) !=3D RELEASE + DebugLib|MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibS= erialPort.inf +!endif + VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyL= ibRuntimeDxe.inf + + EfiResetSystemLib|ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSyste= mLib.inf + ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf + NVParamLib|Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/RuntimeNVPar= amLib.inf + AmpereCpuLib|Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeA= mpereCpuLib.inf + +[LibraryClasses.ARM,LibraryClasses.AARCH64] + # + # It is not possible to prevent the ARM compiler for generic intrinsic f= unctions. + # This library provides the instrinsic functions generate by a given com= piler. + # [LibraryClasses.ARM] and NULL mean link this library into all ARM imag= es. + # + NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf + + # + # Add support for GCC stack protector + # + NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf + +##########################################################################= ###### +# +# Pcd Section - list of all EDK II PCD Entries defined by this Platform +# +##########################################################################= ###### + +[PcdsFeatureFlag.common] + gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|FALSE + gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable|TRUE + gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable|FALSE + gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable|TRUE + + # + # Use the Vector Table location in CpuDxe. We will not copy the Vector T= able at PcdCpuVectorBaseAddress + # + gArmTokenSpaceGuid.PcdRelocateVectorTable|FALSE + + gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|TRUE + + gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE + + # + # If TRUE, Graphics Output Protocol will be installed on virtual handle + # created by ConsplitterDxe. It could be set FALSE to save size. + # + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE + +[PcdsFixedAtBuild.common] +!ifdef $(FIRMWARE_VER) + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"$(FIRMWARE_VER= )" +!endif + + gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000 + gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF + gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1 + gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0 + gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320 + + # DEBUG_ASSERT_ENABLED 0x01 + # DEBUG_PRINT_ENABLED 0x02 + # DEBUG_CODE_ENABLED 0x04 + # CLEAR_MEMORY_ENABLED 0x08 + # ASSERT_BREAKPOINT_ENABLED 0x10 + # ASSERT_DEADLOOP_ENABLED 0x20 +!if $(TARGET) =3D=3D RELEASE + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x21 +!else + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2F +!endif + + # + # SBSA Watchdog Count + # +!ifndef DISABLE_SBSA_WATCHDOG + gArmPlatformTokenSpaceGuid.PcdWatchdogCount|1 +!endif + + # DEBUG_INIT 0x00000001 // Initialization + # DEBUG_WARN 0x00000002 // Warnings + # DEBUG_LOAD 0x00000004 // Load events + # DEBUG_FS 0x00000008 // EFI File system + # DEBUG_POOL 0x00000010 // Alloc & Free (pool) + # DEBUG_PAGE 0x00000020 // Alloc & Free (page) + # DEBUG_INFO 0x00000040 // Informational debug messages + # DEBUG_DISPATCH 0x00000080 // PEI/DXE/SMM Dispatchers + # DEBUG_VARIABLE 0x00000100 // Variable + # DEBUG_BM 0x00000400 // Boot Manager + # DEBUG_BLKIO 0x00001000 // BlkIo Driver + # DEBUG_NET 0x00004000 // SNP Driver + # DEBUG_UNDI 0x00010000 // UNDI Driver + # DEBUG_LOADFILE 0x00020000 // LoadFile + # DEBUG_EVENT 0x00080000 // Event messages + # DEBUG_GCD 0x00100000 // Global Coherency Database changes + # DEBUG_CACHE 0x00200000 // Memory range cachability changes + # DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may + # // significantly impact boot performance + # DEBUG_ERROR 0x80000000 // Error + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|$(DEBUG_PRINT_ERROR_LEV= EL) + + gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07 + + # + # Optional feature to help prevent EFI memory map fragments + # Turned on and off via: PcdPrePiProduceMemoryTypeInformationHob + # Values are in EFI Pages (4K). DXE Core will make sure that + # at least this much of each type of memory can be allocated + # from a single memory range. This way you only end up with + # maximum of two fragements for each type in the memory map + # (the memory used, and the free memory that was prereserved + # but not used). + # + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|80 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|65 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|400 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|20000 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0 + + gArmTokenSpaceGuid.PcdVFPEnabled|1 + + gArmTokenSpaceGuid.PcdArmPrimaryCore|0x0 + + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000 + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800 + + # + # Stacks for MPCores in Normal World + # + gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x91100000 + gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x20000 + gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize|0x1000 + + # + # Maximum memory region that fits into the 32bit address space + # of 1-Processor and 2-Processor systems. + # + gArmTokenSpaceGuid.PcdSystemMemoryBase|0x90000000 + gArmTokenSpaceGuid.PcdSystemMemorySize|0x30000000 + + # + # UEFI region size + # + gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x08000000 + + # + # Ampere Altra Core-Cluster profile + # + gArmPlatformTokenSpaceGuid.PcdCoreCount|80 + gArmPlatformTokenSpaceGuid.PcdClusterCount|40 + + # + # PL011 - Serial Terminal + # Ampere Altra UART0 + # + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x100002600000 + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200 + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultReceiveFifoDepth|32 + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits|8 + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity|1 + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits|1 + + gArmPlatformTokenSpaceGuid.PL011UartClkInHz|1843200 + gArmPlatformTokenSpaceGuid.PL011UartInterrupt|0x62 + + # + # PL011 - Serial Debug UART + # Ampere Altra UART2 + # + gArmPlatformTokenSpaceGuid.PcdSerialDbgRegisterBase|0x100002620000 + gArmPlatformTokenSpaceGuid.PcdSerialDbgUartBaudRate|115200 + + # + # We want to use the Shell Libraries but don't want it to initialise + # automatically. We initialise the libraries when the command is called = by the + # Shell. + # + gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE + + gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FAL= SE + + # + # ARM SBSA Watchdog + # + gArmTokenSpaceGuid.PcdGenericWatchdogControlBase|0x1000027c0000 + gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase|0x1000027d0000 + gArmTokenSpaceGuid.PcdGenericWatchdogEl2IntrNum|92 + + # + # ARM Generic Interrupt Controller + # + gArmTokenSpaceGuid.PcdGicDistributorBase|0x100100000000 + gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x100100140000 + + # + # ARM Architectural Timer Frequency + # + # Set it to 0 so that the code will read frequence from register + gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|0 + gEmbeddedTokenSpaceGuid.PcdMetronomeTickPeriod|1000 + + # + # use the TTY terminal type + # + gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4 + + # + # GUID of the UI app + # + gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c= , 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0= x31 } + + # + # Enable strict image permissions for all images. (This applies + # only to images that were built with >=3D 4 KB section alignment.) + # + gEfiMdeModulePkgTokenSpaceGuid.PcdImageProtectionPolicy|0x3 + + # + # Enable NX memory protection for all non-code regions, including OEM an= d OS + # reserved ones, with the exception of LoaderData regions, of which OS l= oaders + # (i.e., GRUB) may assume that its contents are executable. + # + gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy|0xC0000000= 00007FD1 + + # + # Enable the non-executable DXE stack. (This gets set up by DxeIpl) + # + gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE + + # + # MmCommunication + # + gArmTokenSpaceGuid.PcdMmBufferBase|0x88300000 + gArmTokenSpaceGuid.PcdMmBufferSize|0x100000 + + # + # Number of address lines in the I/O space for the CPU + # + gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|32 + +[PcdsDynamicHii.common.DEFAULT] + gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVar= iableGuid|0x0|10 + +[PcdsDynamicDefault.common] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0x0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0x0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|0x0 + +##########################################################################= ###### +# +# Component Section - list of all EDK II Component Entries defined by this= Platform +# +##########################################################################= ###### + +[Components.common] + # + # PEI Phase modules + # + ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf + MdeModulePkg/Core/Pei/PeiMain.inf + MdeModulePkg/Universal/PCD/Pei/Pcd.inf { + + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + ArmPlatformPkg/PlatformPei/PlatformPeim.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf + ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf + ArmPkg/Drivers/CpuPei/CpuPei.inf + UefiCpuPkg/CpuIoPei/CpuIoPei.inf + MdeModulePkg/Universal/Variable/Pei/VariablePei.inf + MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf { + + NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompre= ssLib.inf + } + MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouter= Pei.inf + MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf + + # + # DXE Phase modules + # + MdeModulePkg/Core/Dxe/DxeMain.inf { + + NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32Gu= idedSectionExtractLib.inf + } + MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCod= eRouterRuntimeDxe.inf + MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRun= timeDxe.inf + + # + # PCD + # + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf { + + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + + # + # Architectural Protocols + # + ArmPkg/Drivers/CpuDxe/CpuDxe.inf + MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf + MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf { + +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificatio= nLib.inf +!endif + } + +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDx= e.inf +!endif + MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf + MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntim= eDxe.inf + EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf + EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf + + # + # Environment Variables Protocol + # + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { + + gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE + + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeas= urementLibNull.inf + VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf + NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf + } + + # + # Timer + # + ArmPkg/Drivers/TimerDxe/TimerDxe.inf + ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf + + # + # ARM GIC Dxe + # + ArmPkg/Drivers/ArmGic/ArmGicDxe.inf + + # + # Uefi Cpu + # + UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf + + # + # Console + # + MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf + MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf + MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf + MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf + MdeModulePkg/Universal/SerialDxe/SerialDxe.inf + + # + # Simple TextIn/TextOut for UEFI Terminal + # + EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf + + # + # Hii Database + # + MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + + # + # Semi-hosting filesystem + # + ArmPkg/Filesystem/SemihostFs/SemihostFs.inf + + # + # FAT filesystem + GPT/MBR partitioning + # + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + FatPkg/EnhancedFatDxe/Fat.inf + + # + # Bds + # + MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf + MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf + MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf + MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf + MdeModulePkg/Universal/BdsDxe/BdsDxe.inf + MdeModulePkg/Application/UiApp/UiApp.inf { + + NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf + NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf + NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc= eManagerUiLib.inf + } + + # + # Networking stack + # +!include NetworkPkg/Network.dsc.inc + + # + # UEFI application (Shell Embedded Boot Loader) + # + ShellPkg/Application/Shell/Shell.inf { + + ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellComman= dLib.inf + NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2Comm= andsLib.inf + NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1Comm= andsLib.inf + NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3Comm= andsLib.inf + NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1Co= mmandsLib.inf + NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comm= andsLib.inf + NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1= CommandsLib.inf + NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1= CommandsLib.inf + NULL|ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2= CommandsLib.inf + NULL|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewC= ommandLib.inf + HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandlePar= singLib.inf + BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcf= gCommandLib.inf + + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xFF + gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE + gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|8000 + } +!ifdef $(INCLUDE_TFTP_COMMAND) + ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf +!endif #$(INCLUDE_TFTP_COMMAND) diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc new file mode 100644 index 000000000000..a10591933cf7 --- /dev/null +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -0,0 +1,101 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +##########################################################################= ###### +# +# Defines Section - statements that will be processed to create a Makefile. +# +##########################################################################= ###### +[Defines] + PLATFORM_NAME =3D Jade + PLATFORM_GUID =3D 7BDD00C0-68F3-4CC1-8775-F0F00572019F + PLATFORM_VERSION =3D 0.1 + DSC_SPECIFICATION =3D 0x0001001B + OUTPUT_DIRECTORY =3D Build/Jade + SUPPORTED_ARCHITECTURES =3D AARCH64 + BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT + SKUID_IDENTIFIER =3D DEFAULT + FLASH_DEFINITION =3D Platform/Ampere/JadePkg/Jade.fdf + + # + # Defines for default states. These can be changed on the command line. + # -D FLAG=3DVALUE + # + + # DEBUG_INIT 0x00000001 // Initialization + # DEBUG_WARN 0x00000002 // Warnings + # DEBUG_LOAD 0x00000004 // Load events + # DEBUG_FS 0x00000008 // EFI File system + # DEBUG_POOL 0x00000010 // Alloc & Free (pool) + # DEBUG_PAGE 0x00000020 // Alloc & Free (page) + # DEBUG_INFO 0x00000040 // Informational debug messages + # DEBUG_DISPATCH 0x00000080 // PEI/DXE/SMM Dispatchers + # DEBUG_VARIABLE 0x00000100 // Variable + # DEBUG_BM 0x00000400 // Boot Manager + # DEBUG_BLKIO 0x00001000 // BlkIo Driver + # DEBUG_NET 0x00004000 // SNP Driver + # DEBUG_UNDI 0x00010000 // UNDI Driver + # DEBUG_LOADFILE 0x00020000 // LoadFile + # DEBUG_EVENT 0x00080000 // Event messages + # DEBUG_GCD 0x00100000 // Global Coherency Database changes + # DEBUG_CACHE 0x00200000 // Memory range cachability changes + # DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may + # // significantly impact boot performance + # DEBUG_ERROR 0x80000000 // Error + DEFINE DEBUG_PRINT_ERROR_LEVEL =3D 0x8000000F + DEFINE FIRMWARE_VER =3D 0.01.001 + DEFINE SECURE_BOOT_ENABLE =3D FALSE + DEFINE INCLUDE_TFTP_COMMAND =3D TRUE + + # + # Network definition + # + DEFINE NETWORK_IP6_ENABLE =3D FALSE + DEFINE NETWORK_HTTP_BOOT_ENABLE =3D TRUE + DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS =3D TRUE + DEFINE NETWORK_TLS_ENABLE =3D FALSE + +!include MdePkg/MdeLibs.dsc.inc + +# Include default Ampere Platform DSC file +!include Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc + +##########################################################################= ###### +# +# Specific Platform Library +# +##########################################################################= ###### +[LibraryClasses] + # + # RTC Library: Common RTC + # + RealTimeClockLib|EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualReal= TimeClockLib.inf + +##########################################################################= ###### +# +# Specific Platform Pcds +# +##########################################################################= ###### +[PcdsFeatureFlag.common] +[PcdsFixedAtBuild.common] + +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + # Override the default values from SecurityPkg to ensure images + # from all sources are verified in secure boot + gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04 + gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x04 + gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0= x04 +!endif + + +##########################################################################= ###### +# +# Specific Platform Component +# +##########################################################################= ###### +[Components.common] diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf new file mode 100644 index 000000000000..f20a8645c415 --- /dev/null +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -0,0 +1,228 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +##########################################################################= ###### +# +# FD Section +# The [FD] Section is made up of the definition statements and a +# description of what goes into the Flash Device Image. Each FD section +# defines one flash "device" image. A flash device image may be one of +# the following: Removable media bootable image (like a boot floppy +# image,) an Option ROM image (that would be "flashed" into an add-in +# card,) a System "Flash" image (that would be burned into a system's +# flash) or an Update ("Capsule") image that will be used to update and +# existing system flash. +# +##########################################################################= ###### + +[FD.BL33_JADE_UEFI] +BaseAddress =3D 0x92000000|gArmTokenSpaceGuid.PcdFdBaseAddress # The ba= se address of the Firmware in NOR Flash. +Size =3D 0x007C0000|gArmTokenSpaceGuid.PcdFdSize # The si= ze in bytes of the FLASH Device +ErasePolarity =3D 1 + +# This one is tricky, it must be: BlockSize * NumBlocks =3D Size +BlockSize =3D 0x10000 +NumBlocks =3D 0x7C + +##########################################################################= ###### +# +# Following are lists of FD Region layout which correspond to the location= s of different +# images within the flash device. +# +# Regions must be defined in ascending order and may not overlap. +# +# A Layout Region start with a eight digit hex offset (leading "0x" requir= ed) followed by +# the pipe "|" character, followed by the size of the region, also in hex = with the leading +# "0x" characters. Like: +# Offset|Size +# PcdOffsetCName|PcdSizeCName +# RegionType +# +##########################################################################= ###### + +# +# FV MAIN +# Offset: 0x00000000 +# Size: 0x00740000 +# +0x00000000|0x00740000 +gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize +FV =3D FVMAIN_COMPACT + +# +# NV Variables +# Placeholder +# + +##########################################################################= ###### +# +# FV Section +# +# [FV] section is used to define what components or modules are placed wit= hin a flash +# device file. This section also defines order the components and modules= are positioned +# within the image. The [FV] section consists of define statements, set s= tatements and +# module statements. +# +##########################################################################= ###### + +[FV.FVMAIN_COMPACT] +FvAlignment =3D 16 +ERASE_POLARITY =3D 1 +MEMORY_MAPPED =3D TRUE +STICKY_WRITE =3D TRUE +LOCK_CAP =3D TRUE +LOCK_STATUS =3D TRUE +WRITE_DISABLED_CAP =3D TRUE +WRITE_ENABLED_CAP =3D TRUE +WRITE_STATUS =3D TRUE +WRITE_LOCK_CAP =3D TRUE +WRITE_LOCK_STATUS =3D TRUE +READ_DISABLED_CAP =3D TRUE +READ_ENABLED_CAP =3D TRUE +READ_STATUS =3D TRUE +READ_LOCK_CAP =3D TRUE +READ_LOCK_STATUS =3D TRUE +FvNameGuid =3D 61C0F511-A691-4F54-974F-B9A42172CE53 + +APRIORI PEI { + INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf + INF MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRo= uterPei.inf + INF MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf +} + + INF ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf + INF MdeModulePkg/Core/Pei/PeiMain.inf + INF UefiCpuPkg/CpuIoPei/CpuIoPei.inf + INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf + INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf + INF ArmPkg/Drivers/CpuPei/CpuPei.inf + INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf + INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf + INF MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRo= uterPei.inf + INF MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf + + # + # Print platform information before passing control into the Driver Exec= ution Environment (DXE) phase + # + INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf + + FILE FV_IMAGE =3D 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { + SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRE= D =3D TRUE { + SECTION FV_IMAGE =3D FVMAIN + } + } + +[FV.FvMain] +FvAlignment =3D 16 +ERASE_POLARITY =3D 1 +MEMORY_MAPPED =3D TRUE +STICKY_WRITE =3D TRUE +LOCK_CAP =3D TRUE +LOCK_STATUS =3D TRUE +WRITE_DISABLED_CAP =3D TRUE +WRITE_ENABLED_CAP =3D TRUE +WRITE_STATUS =3D TRUE +WRITE_LOCK_CAP =3D TRUE +WRITE_LOCK_STATUS =3D TRUE +READ_DISABLED_CAP =3D TRUE +READ_ENABLED_CAP =3D TRUE +READ_STATUS =3D TRUE +READ_LOCK_CAP =3D TRUE +READ_LOCK_STATUS =3D TRUE +FvNameGuid =3D 5C60F367-A505-419A-859E-2A4FF6CA6FE5 + +APRIORI DXE { + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatu= sCodeRouterRuntimeDxe.inf + INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandle= rRuntimeDxe.inf + INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf + INF ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf +} + + INF MdeModulePkg/Core/Dxe/DxeMain.inf + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatu= sCodeRouterRuntimeDxe.inf + INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandle= rRuntimeDxe.inf + + # + # PI DXE Drivers producing Architectural Protocols (EFI Services) + # + INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf + INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf + INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConf= igDxe.inf +!endif + INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRu= ntimeDxe.inf + INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf + INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + INF ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf + + # + # Environment Variables Protocol + # + INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf + + # + # Multiple Console IO support + # + INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf + INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf + INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe= .inf + INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf + INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf + + # + # Timer + # + INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf + INF ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf + + # + # ARM GIC Dxe + # + INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf + + INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf + + # + # FAT filesystem + GPT/MBR partitioning + # + INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + INF FatPkg/EnhancedFatDxe/Fat.inf + INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.i= nf + + # + # UEFI application (Shell Embedded Boot Loader) + # + INF ShellPkg/Application/Shell/Shell.inf +!if $(INCLUDE_TFTP_COMMAND) =3D=3D TRUE + INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf +!endif + + # + # Bds + # + INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf + INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf + INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf + INF MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe= .inf + INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf + INF MdeModulePkg/Application/UiApp/UiApp.inf + + # + # Networking stack + # +!include NetworkPkg/Network.fdf.inc + +!include Silicon/Ampere/AmpereSiliconPkg/FvRules.fdf.inc diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf= b/Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf new file mode 100644 index 000000000000..9f2864c53618 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf @@ -0,0 +1,41 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D ATFHobPeim + FILE_GUID =3D B1975734-77C2-4827-9617-914883F3B578 + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D InitializeATFHobPeim + +[Sources] + ATFHobPeim.c + +[FixedPcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + +[Packages] + ArmPkg/ArmPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + HobLib + PcdLib + PeiServicesLib + PeimEntryPoint + +[Guids] + gPlatformInfoHobGuid + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLi= b.inf b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.inf new file mode 100644 index 000000000000..924d92bfb2bc --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.inf @@ -0,0 +1,45 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D AmpereCpuLib + FILE_GUID =3D 4ACE898C-4DDC-4EF7-BB6C-91549BDF5B9C + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D AmpereCpuLib + +[Sources] + AmpereCpuLibCommon.c + AmpereCpuLib.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + ArmLib + BaseLib + HobLib + IoLib + NVParamLib + +[FixedPcd] + gArmPlatformTokenSpaceGuid.PcdCoreCount + gArmPlatformTokenSpaceGuid.PcdClusterCount + + gAmpereTokenSpaceGuid.PcdSmproEfuseShadow0 + + gArmTokenSpaceGuid.PcdSystemMemoryBase + +[Guids] + gPlatformInfoHobGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAmpe= reCpuLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAm= pereCpuLib.inf new file mode 100644 index 000000000000..c6672f5def96 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAmpereCpuLi= b.inf @@ -0,0 +1,50 @@ +## @file +# +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D RuntimeAmpereCpuLib + FILE_GUID =3D 5BE8FCAD-5D7E-4696-948A-E90970CA442E + MODULE_TYPE =3D DXE_RUNTIME_DRIVER + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D AmpereCpuLib + CONSTRUCTOR =3D RuntimeAmpereCpuLibConstructor + DESTRUCTOR =3D RuntimeAmpereCpuLibDestructor + +[Sources] + AmpereCpuLibCommon.c + RuntimeAmpereCpuLib.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + ArmLib + BaseLib + HobLib + IoLib + MemoryAllocationLib + NVParamLib + UefiRuntimeLib + +[FixedPcd] + gArmPlatformTokenSpaceGuid.PcdCoreCount + gArmPlatformTokenSpaceGuid.PcdClusterCount + + gAmpereTokenSpaceGuid.PcdSmproEfuseShadow0 + + gArmTokenSpaceGuid.PcdSystemMemoryBase + +[Guids] + gEfiEventVirtualAddressChangeGuid + gPlatformInfoHobGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatfo= rmLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatfor= mLib.inf new file mode 100644 index 000000000000..a4d29379198d --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.i= nf @@ -0,0 +1,57 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D ArmPlatformLib + FILE_GUID =3D 7F829BB1-5092-4D8E-8FB7-2B2C2A80D783 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D ArmPlatformLib + +[Sources] + ArmPlatformHelper.S + ArmPlatformLib.c + ArmPlatformLibMemory.c + +[LibraryClasses] + AmpereCpuLib + ArmLib + ArmSmcLib + HobLib + IoLib + MemoryAllocationLib + PL011UartLib + PcdLib + SerialPortLib + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[Pcd] + gArmTokenSpaceGuid.PcdMmBufferBase + gArmTokenSpaceGuid.PcdMmBufferSize + +[FixedPcd] + gArmPlatformTokenSpaceGuid.PcdClusterCount + gArmPlatformTokenSpaceGuid.PcdCoreCount + gArmPlatformTokenSpaceGuid.PL011UartClkInHz + + gArmTokenSpaceGuid.PcdArmPrimaryCore + + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultReceiveFifoDepth + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfaceLib/Mail= boxInterfaceLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfac= eLib/MailboxInterfaceLib.inf new file mode 100644 index 000000000000..de07a573b62b --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfaceLib/MailboxInte= rfaceLib.inf @@ -0,0 +1,37 @@ +## @file +# The library implements the hardware Mailbox (Doorbell) interface for co= mmunication +# between the Application Processor (ARMv8) and the System Control Proces= sors (SMpro/PMpro). +# +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D MailboxInterface + FILE_GUID =3D EE482BD0-A91A-45BE-83B1-2157A0FB94C3 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D MailboxInterfaceLib + +[Sources] + MailboxInterfaceLib.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + AmpereCpuLib + BaseLib + BaseMemoryLib + DebugLib + IoLib + TimerLib + +[FixedPcd] + gAmpereTokenSpaceGuid.PcdSmproDbBaseReg + gAmpereTokenSpaceGuid.PcdPmproDbBaseReg diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/MemoryI= nitPeiLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/Memo= ryInitPeiLib.inf new file mode 100644 index 000000000000..d36f4938638c --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/MemoryInitPeiL= ib.inf @@ -0,0 +1,59 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D ArmMemoryInitPeiLib + FILE_GUID =3D 55DDB6E0-70B5-11E0-B33E-0002A5D5C51B + MODULE_TYPE =3D SEC + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D MemoryInitPeiLib + +[Sources] + MemoryInitPeiLib.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + ArmLib + ArmMmuLib + ArmPlatformLib + DebugLib + HobLib + +[Guids] + gEfiMemoryTypeInformationGuid + +[FeaturePcd] + gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob + +[FixedPcd] + gArmTokenSpaceGuid.PcdFdBaseAddress + gArmTokenSpaceGuid.PcdFdSize + + gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize + + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLib/MmCom= municationLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLi= b/MmCommunicationLib.inf new file mode 100644 index 000000000000..1693fa7e8050 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLib/MmCommunicat= ionLib.inf @@ -0,0 +1,35 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D MmCommunicationLib + FILE_GUID =3D 106099B8-0051-4B35-9578-EFB1045D2FA8 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D MmCommunicationLib + CONSTRUCTOR =3D MmCommunicationLibConstructor + +[Sources] + MmCommunicationLib.c + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + ArmLib + ArmSmcLib + BaseMemoryLib + DebugLib + PcdLib + +[Pcd] + gArmTokenSpaceGuid.PcdMmBufferBase + gArmTokenSpaceGuid.PcdMmBufferSize diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.in= f b/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.inf new file mode 100644 index 000000000000..5f12d88eab50 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.inf @@ -0,0 +1,33 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D NVParamLib + FILE_GUID =3D 8512FF56-11DF-4A16-A0CF-81B27DBD23FB + MODULE_TYPE =3D BASE + VERSION_STRING =3D 0.1 + LIBRARY_CLASS =3D NVParamLib + +[Sources.common] + NVParamLib.c + NVParamLibCommon.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseMemoryLib + DebugLib + MmCommunicationLib + +[Guids] + gNVParamMmGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/RuntimeNVPara= mLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/RuntimeNVParamL= ib.inf new file mode 100644 index 000000000000..61bb8dde2b3b --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/RuntimeNVParamLib.inf @@ -0,0 +1,35 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D RuntimeNVParamLib + FILE_GUID =3D D17AD70D-7C0F-4F36-9ED5-7EA43A700C45 + MODULE_TYPE =3D DXE_RUNTIME_DRIVER + VERSION_STRING =3D 0.1 + LIBRARY_CLASS =3D NVParamLib + +[Sources.common] + NVParamLibCommon.c + RuntimeNVParamLib.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseMemoryLib + DebugLib + +[Guids] + gNVParamMmGuid + +[Protocols] + gEfiMmCommunication2ProtocolGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.inf b/Sili= con/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.inf new file mode 100644 index 000000000000..5b25a64d5451 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.inf @@ -0,0 +1,29 @@ +## @file +# Instance of RNG (Random Number Generator) Library. +# +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D RngLib + MODULE_UNI_FILE =3D RngLib.uni + FILE_GUID =3D 9CC35499-5CC8-49A2-8C27-AE7B3B83D149 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D RngLib + +[Sources] + RngLib.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + TrngLib diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/SystemFirmwareInterfaceL= ib/SystemFirmwareInterfaceLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/S= ystemFirmwareInterfaceLib/SystemFirmwareInterfaceLib.inf new file mode 100644 index 000000000000..f11291003dde --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/SystemFirmwareInterfaceLib/Syst= emFirmwareInterfaceLib.inf @@ -0,0 +1,30 @@ +## @file +# Provides functions for communication with System Firmware (SMpro/PMpro) +# via interfaces like Mailbox. +# +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D SystemFirmwareInterface + FILE_GUID =3D 8574F1CC-BF8C-46FD-9276-5B202E2A425C + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D SystemFirmwareInterfaceLib + +[Sources] + SystemFirmwareInterfaceLib.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + MailboxInterfaceLib diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/TrngLib/TrngLib.inf b/Si= licon/Ampere/AmpereAltraPkg/Library/TrngLib/TrngLib.inf new file mode 100644 index 000000000000..aac835ed46ed --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/TrngLib/TrngLib.inf @@ -0,0 +1,29 @@ +## @file +# Instance of RNG (Random Number Generator) Library. +# +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D Trng + FILE_GUID =3D 30200949-29CF-4BDB-8300-EFFC44D03603 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D TrngLib + +[Sources] + TrngLib.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + SystemFirmwareInterfaceLib diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Guid/PlatformInfoHob.h b= /Silicon/Ampere/AmpereAltraPkg/Include/Guid/PlatformInfoHob.h new file mode 100644 index 000000000000..4467babb479a --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/PlatformInfoHob.h @@ -0,0 +1,188 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef PLATFORM_INFO_HOB_H_ +#define PLATFORM_INFO_HOB_H_ + +#include +#include + +#define PLATFORM_INFO_HOB_GUID \ + { 0x7f73e372, 0x7183, 0x4022, { 0xb3, 0x76, 0x78, 0x30, 0x32, 0x6d, 0x79= , 0xb4 } } + +extern EFI_GUID gPlatformInfoHobGuid; + +// +// DIMM type +// +#define UDIMM 0x00 +#define RDIMM 0x01 +#define SODIMM 0x02 +#define RSODIMM 0x03 +#define LRDIMM 0x04 +#define NVRDIMM 0x05 + +// +// DIMM status +// +#define DIMM_NOT_INSTALLED 0x00 +#define DIMM_INSTALLED_OPERATIONAL 0x01 // installed and operational +#define DIMM_INSTALLED_NONOPERATIONAL 0x02 // installed and non-operat= ional +#define DIMM_INSTALLED_FAILED 0x03 // installed and failed + +typedef struct { + UINT32 NumRegion; + UINT64 TotalSize; + UINT64 Base[PLATFORM_DRAM_INFO_MAX_REGION]; + UINT64 Size[PLATFORM_DRAM_INFO_MAX_REGION]; + UINT64 Node[PLATFORM_DRAM_INFO_MAX_REGION]; + UINT64 Socket[PLATFORM_DRAM_INFO_MAX_REGION]; + UINT32 MaxSpeed; + UINT32 McuMask[PLATFORM_CPU_MAX_SOCKET]; + UINT32 NvdRegion[PLATFORM_DRAM_INFO_MAX_REGION]; + UINT32 NvdimmMode[PLATFORM_CPU_MAX_SOCKET]; +} PLATFORM_DRAM_INFO; + +typedef struct { + CHAR8 PartNumber[32]; + UINT64 DimmSize; + UINT16 DimmMfcId; + UINT16 Reserved; + UINT8 DimmNrRank; + UINT8 DimmType; + UINT8 DimmStatus; + UINT8 DimmDevType; +} PLATFORM_DIMM_INFO; + +typedef struct { + UINT8 Data[512]; +} PLATFORM_DIMM_SPD_DATA; + +typedef struct { + PLATFORM_DIMM_INFO Info; + PLATFORM_DIMM_SPD_DATA SpdData; + UINT32 NodeId; +} PLATFORM_DIMM; + +typedef struct { + UINT32 BoardDimmSlots; + PLATFORM_DIMM Dimm[PLATFORM_DIMM_INFO_MAX_SLOT]; +} PLATFORM_DIMM_LIST; + +typedef struct { + UINT32 EnableMask[4]; +} PLATFORM_CLUSTER_EN; + +// +// Algorithm ID defined in pre-UEFI firmware +// +typedef enum { + PlatformAlgorithmSha1 =3D 1, + PlatformAlgorithmSha256, + PlatformAlgorithmMax, +} PLATFORM_ALGORITHM_ID; + +// +// Platform digest data definition +// +typedef union { + unsigned char Sha1[SHA1_DIGEST_SIZE]; + unsigned char Sha256[SHA256_DIGEST_SIZE]; +} PLATFORM_TPM_DIGEST; + +#define MAX_VIRTUAL_PCR_INDEX 0x0002 + +#pragma pack(1) +typedef struct { + PLATFORM_ALGORITHM_ID AlgorithmId; + struct { + PLATFORM_TPM_DIGEST Hash; + } VPcr[MAX_VIRTUAL_PCR_INDEX]; // vPCR 0 or 1 +} PLATFORM_VPCR_HASH_INFO; + +typedef struct { + UINT8 InterfaceType; // If I/F is CRB then CRB parameters = are expected + UINT64 InterfaceParametersAddress; // Physical address of interface, by = Value */ + UINT64 InterfaceParametersLength; + UINT32 SupportedAlgorithmsBitMask; + UINT64 EventLogAddress; + UINT64 EventLogLength; + UINT8 Reserved[3]; +} PLATFORM_TPM2_CONFIG_DATA; + +typedef struct { + UINT32 CurrentRequest; + UINT32 LastRequest; + UINT32 LastRequestStatus; +} PLATFORM_TPM2_PPI_REQUEST; + +typedef struct { + UINT64 AddressOfControlArea; + UINT64 ControlAreaLength; + UINT8 InterruptMode; + UINT8 Reserved[3]; + UINT32 InterruptNumber; // Should have a va= lue of zero polling + UINT32 SmcFunctionId; // SMC Function ID + UINT64 PpiRequestNotifyAddress; // Doorbell/Interru= pt Address + PLATFORM_TPM2_PPI_REQUEST *PpiRequest; // PPI Request +} PLATFORM_TPM2_CRB_INTERFACE_PARAMETERS; + +typedef struct { + PLATFORM_TPM2_CONFIG_DATA Tpm2ConfigData; + PLATFORM_TPM2_CRB_INTERFACE_PARAMETERS Tpm2CrbInterfaceParams; + PLATFORM_VPCR_HASH_INFO Tpm2VPcrHashInfo; +} PLATFORM_TPM2_INFO; +#pragma pack() + +typedef struct { + UINT8 MajorNumber; + UINT8 MinorNumber; + UINT64 PcpClk; + UINT64 CpuClk; + UINT64 SocClk; + UINT64 AhbClk; + UINT64 SysClk; + UINT8 CpuInfo[128]; + UINT8 CpuVer[32]; + UINT8 SmPmProVer[32]; + UINT8 SmPmProBuild[32]; + PLATFORM_DRAM_INFO DramInfo; + PLATFORM_DIMM_LIST DimmList; + PLATFORM_CLUSTER_EN ClusterEn[2]; + UINT32 FailSafeStatus; + UINT32 RcDisableMask[2]; + UINT8 ResetStatus; + UINT16 CoreVoltage[2]; + UINT16 SocVoltage[2]; + UINT16 Dimm1Voltage[2]; + UINT16 Dimm2Voltage[2]; + + /* Chip information */ + UINT32 ScuProductId[2]; + UINT8 MaxNumOfCore[2]; + UINT8 Warranty[2]; + UINT8 SubNumaMode[2]; + UINT8 AvsEnable[2]; + UINT32 AvsVoltageMV[2]; + UINT8 TurboCapability[2]; + UINT32 TurboFrequency[2]; + + UINT8 SkuMaxTurbo[2]; + UINT8 SkuMaxCore[2]; + UINT32 AHBCId[2]; + + /* TPM2 Info */ + PLATFORM_TPM2_INFO Tpm2Info; + + /* 2P link info for RCA0/RCA1 */ + UINT8 Link2PSpeed[2]; + UINT8 Link2PWidth[2]; + +} PLATFORM_INFO_HOB; + +#endif /* PLATFORM_INFO_HOB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h b= /Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h new file mode 100644 index 000000000000..9355e6cc7c62 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h @@ -0,0 +1,276 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef AMPERE_CPU_LIB_H_ +#define AMPERE_CPU_LIB_H_ + +#define SUBNUMA_MODE_MONOLITHIC 0 +#define SUBNUMA_MODE_HEMISPHERE 1 +#define SUBNUMA_MODE_QUADRANT 2 + +#define MONOLITIC_NUM_OF_REGION 1 +#define HEMISPHERE_NUM_OF_REGION 2 +#define QUADRANT_NUM_OF_REGION 4 +#define SUBNUMA_CPM_REGION_SIZE 4 +#define NUM_OF_CPM_PER_MESH_ROW 8 + +#define CPM_PER_ROW_OFFSET(CpmId) ((CpmId) % NUM_OF_CPM_PER_MESH_ROW) +#define CPM_ROW_NUMBER(CpmId) ((CpmId) / NUM_OF_CPM_PER_MESH_ROW) + +#define SOCKET_ID(CpuId) ((CpuId) / (PLATFORM_CPU_MAX_CPM * = PLATFORM_CPU_NUM_CORES_PER_CPM)) +#define CLUSTER_ID(CpuId) (((CpuId) / PLATFORM_CPU_NUM_CORES_= PER_CPM) % PLATFORM_CPU_MAX_CPM) + + +/** + Get current CPU frequency. + + @param Socket Socket index. + @return UINTN Current CPU frequency. + +**/ +UINTN +EFIAPI +CpuGetCurrentFreq ( + UINT8 Socket + ); + +/** + Get maximum CPU frequency. + + @param Socket Socket index. + @return UINTN Maximum CPU frequency. + +**/ +UINTN +EFIAPI +CpuGetMaxFreq ( + UINT8 Socket + ); + +/** + Get CPU voltage. + + @param Socket Socket index. + @return UINT8 CPU voltage. + +**/ +UINT8 +EFIAPI +CpuGetVoltage ( + UINT8 Socket + ); + +/** + Get the SubNUMA mode. + + @return UINT8 The SubNUMA mode. + +**/ +UINT8 +EFIAPI +CpuGetSubNumaMode ( + VOID + ); + +/** + Get the number of SubNUMA region. + + @return UINT8 The number of SubNUMA region. + +**/ +UINT8 +EFIAPI +CpuGetNumberOfSubNumaRegion ( + VOID + ); + +/** + Get the SubNUMA node of a CPM. + + @param SocketId Socket index. + @param Cpm CPM index. + @return UINT8 The SubNUMA node of a CPM. + +**/ +UINT8 +EFIAPI +CpuGetSubNumNode ( + UINT8 Socket, + UINT16 Cpm + ); + +/** + Get the number of supported socket. + + @return UINT8 Number of supported socket. + +**/ +UINT8 +EFIAPI +GetNumberOfSupportedSockets ( + VOID + ); + +/** + Get the number of active socket. + + @return UINT8 Number of active socket. + +**/ +UINT8 +EFIAPI +GetNumberOfActiveSockets ( + VOID + ); + +/** + Get the number of active CPM per socket. + + @param SocketId Socket index. + @return UINT16 Number of CPM. + +**/ +UINT16 +EFIAPI +GetNumberOfActiveCPMsPerSocket ( + UINT8 SocketId + ); + +/** + Get the number of configured CPM per socket. + + @param SocketId Socket index. + @return UINT16 Number of configured CPM. + +**/ +UINT16 +EFIAPI +GetNumberOfConfiguredCPMs ( + UINT8 SocketId + ); + +/** + Set the number of configured CPM per socket. + + @param SocketId Socket index. + @param NumberOfCPMs Number of CPM to be configured. + @return EFI_SUCCESS Operation succeeded. + @return Others An error has occurred. + +**/ +EFI_STATUS +EFIAPI +SetNumberOfConfiguredCPMs ( + UINT8 SocketId, + UINT16 NumberOfCPMs + ); + +/** + Get the maximum number of core per socket. This number + should be the same for all sockets. + + @return UINT16 Maximum number of core. + +**/ +UINT16 +EFIAPI +GetMaximumNumberOfCores ( + VOID + ); + +/** + Get the maximum number of CPM per socket. This number + should be the same for all sockets. + + @return UINT32 Maximum number of CPM. + +**/ +UINT16 +EFIAPI +GetMaximumNumberOfCPMs ( + VOID + ); + +/** + Get the number of active cores of a sockets. + + @return UINT16 Number of active core. + +**/ +UINT16 +EFIAPI +GetNumberOfActiveCoresPerSocket ( + UINT8 SocketId + ); + +/** + Get the number of active cores of all socket. + + @return UINT16 Number of active core. + +**/ +UINT16 +EFIAPI +GetNumberOfActiveCores ( + VOID + ); + +/** + Check if the logical CPU is enabled or not. + + @param CpuId The logical Cpu ID. Started from 0. + @return BOOLEAN TRUE if the Cpu enabled + FALSE if the Cpu disabled. + +**/ +BOOLEAN +EFIAPI +IsCpuEnabled ( + UINT16 CpuId + ); + + +/** + Check if the slave socket is present + + @return BOOLEAN TRUE if the Slave Cpu is present + FALSE if the Slave Cpu is not present + +**/ +BOOLEAN +EFIAPI +IsSlaveSocketAvailable ( + VOID + ); + +/** + Check if the slave socket is active + + @return BOOLEAN TRUE if the Slave CPU Socket is active. + FALSE if the Slave CPU Socket is not active. + +**/ +BOOLEAN +EFIAPI +IsSlaveSocketActive ( + VOID + ); + +/** + Check if the CPU product ID is Ac01 + @return BOOLEAN TRUE if the Product ID is Ac01 + FALSE otherwise. + +**/ +BOOLEAN +EFIAPI +IsAc01Processor ( + VOID + ); + +#endif /* AMPERE_CPU_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/MailboxInterface= Lib.h b/Silicon/Ampere/AmpereAltraPkg/Include/Library/MailboxInterfaceLib.h new file mode 100644 index 000000000000..2750487f3e96 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/MailboxInterfaceLib.h @@ -0,0 +1,172 @@ +/** @file + The library implements the hardware Mailbox (Doorbell) interface for com= munication + between the Application Processor (ARMv8) and the System Control Process= ors (SMpro/PMpro). + + A transfer to SMpro/PMpro is performed on a doorbell channel which is im= plemented through + hardware doorbell registers. Each transfer can be up to 12 bytes long, i= ncluding 4 bytes + for the message and two 4 bytes for additional data. + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef MAILBOX_INTERFACE_LIB_H_ +#define MAILBOX_INTERFACE_LIB_H_ + +#define SMPRO_DB_MAX 8 +#define PMPRO_DB_MAX 8 +#define NUMBER_OF_DOORBELLS_PER_SOCKET (SMPRO_DB_MAX + PMPRO_DB_MAX) + +// +// General address offset of Doorbell registers +// +#define DB_IN_REG_OFST 0x00000000 // Doorbell In +#define DB_DIN0_REG_OFST 0x00000004 // Doorbell In Data +#define DB_DIN1_REG_OFST 0x00000008 // Doorbell In Data +#define DB_OUT_REG_OFST 0x00000010 // Doorbell Out +#define DB_DOUT0_REG_OFST 0x00000014 // Doorbell Out Data +#define DB_DOUT1_REG_OFST 0x00000018 // Doorbell Out Data +#define DB_STATUS_REG_OFST 0x00000020 // Doorbell Interrupt Status +#define DB_STATUS_MASK_REG_OFST 0x00000024 // Doorbell Interrupt Status = Mask + +// +// List of supported doorbells +// +typedef enum { + // + // PMpro Doorbells + // + PMproDoorbellChannel0 =3D 0, + PMproDoorbellChannel1, + PMproDoorbellChannel2, + PMproDoorbellChannel3, + PMproDoorbellChannel4, + PMproDoorbellChannel5, + PMproDoorbellChannel6, + PMproDoorbellChannel7, + // + // SMpro Doorbells + // + SMproDoorbellChannel0 =3D PMPRO_DB_MAX, + SMproDoorbellChannel1, + SMproDoorbellChannel2, + SMproDoorbellChannel3, + SMproDoorbellChannel4, + SMproDoorbellChannel5, + SMproDoorbellChannel6, + SMproDoorbellChannel7 +} DOORBELL_CHANNELS; + +#pragma pack(1) +// +// Mailbox Message Data +// +// A mailbox transaction supports up to 12 bytes long, +// including 4 bytes for message and two 4 bytes for extended data. +// +typedef struct { + UINT32 Data; + UINT32 ExtendedData[2]; +} MAILBOX_MESSAGE_DATA; + +#pragma pack() + +// +// Timeout configuration when waiting for an doorbell interrupt status +// +#define MAILBOX_POLL_TIMEOUT_US 10000000 +#define MAILBOX_POLL_INTERVAL_US 1000 +#define MAILBOX_POLL_COUNT (MAILBOX_POLL_TIMEOUT_US / MAILBOX_POLL_I= NTERVAL_US) + +/** + Get the base address of a doorbell. + + @param[in] Socket Active socket index. + @param[in] Doorbell Doorbell channel for communication with th= e SMpro/PMpro. + + @retval UINT32 The base address of the doorbell. + The returned value is 0 indicate that the = input parameters are invalid. + +**/ +UINTN +EFIAPI +MailboxGetDoorbellAddress ( + IN UINT8 Socket, + IN DOORBELL_CHANNELS Doorbell + ); + +/** + Get the interrupt number of a doorbell. + + @param[in] Socket Active socket index. + @param[in] Doorbell Doorbell channel for communication with th= e SMpro/PMpro. + + @retval UINT32 The interrupt number. + The returned value is 0 indicate that the = input parameters are invalid. + +**/ +UINT32 +EFIAPI +MailboxGetDoorbellInterruptNumber ( + IN UINT8 Socket, + IN DOORBELL_CHANNELS Doorbell + ); + +/** + Read a message via the hardware Doorbell interface. + + @param[in] Socket Active socket index. + @param[in] Doorbell Doorbell channel for communication with th= e SMpro/PMpro. + @param[out] Message Pointer to the Mailbox message. + + @retval EFI_SUCCESS Read the message successfully. + @retval EFI_TIMEOUT Timeout occurred when waiting for availabl= e message in the mailbox. + @retval EFI_INVALID_PARAMETER A parameter is invalid. +**/ +EFI_STATUS +EFIAPI +MailboxRead ( + IN UINT8 Socket, + IN DOORBELL_CHANNELS Doorbell, + OUT MAILBOX_MESSAGE_DATA *Message + ); + +/** + Write a message via the hardware Doorbell interface. + + @param[in] Socket Active socket index. + @param[in] Doorbell Doorbel channel for communication with the= SMpro/PMpro. + @param[in] Message Pointer to the Mailbox message. + + @retval EFI_SUCCESS Write the message successfully. + @retval EFI_TIMEOUT Timeout occurred when waiting for acknowle= dge signal from the mailbox. + @retval EFI_INVALID_PARAMETER A parameter is invalid. +**/ +EFI_STATUS +EFIAPI +MailboxWrite ( + IN UINT8 Socket, + IN DOORBELL_CHANNELS Doorbell, + IN MAILBOX_MESSAGE_DATA *Message + ); + +/** + Unmask the Doorbell interrupt status. + + @param Socket Active socket index. + @param Doorbell Doorbel channel for communication with the SMpro/PMpro. + + @retval EFI_SUCCESS Unmask the Doorbell interrupt successfull= y. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + +**/ +EFI_STATUS +EFIAPI +MailboxUnmaskInterrupt ( + IN UINT8 Socket, + IN UINT16 Doorbell + ); + +#endif /* MAILBOX_INTERFACE_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/MmCommunicationL= ib.h b/Silicon/Ampere/AmpereAltraPkg/Include/Library/MmCommunicationLib.h new file mode 100644 index 000000000000..fbbf66e5187d --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/MmCommunicationLib.h @@ -0,0 +1,44 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef MM_COMMUNICATION_LIB_H_ +#define MM_COMMUNICATION_LIB_H_ + +/** + Communicates with a registered handler. + + This function provides an interface to send and receive messages to the + Standalone MM environment in UEFI PEI phase. + + @param[in, out] CommBuffer A pointer to the buffer to convey + into MMRAM. + @param[in, out] CommSize The size of the data buffer being + passed in. This is optional. + + @retval EFI_SUCCESS The message was successfully posted. + @retval EFI_INVALID_PARAMETER The CommBuffer was NULL. + @retval EFI_BAD_BUFFER_SIZE The buffer size is incorrect for the= MM + implementation. If this error is + returned, the MessageLength field in + the CommBuffer header or the integer + pointed by CommSize are updated to r= eflect + the maximum payload size the + implementation can accommodate. + @retval EFI_ACCESS_DENIED The CommunicateBuffer parameter + or CommSize parameter, if not omitte= d, + are in address range that cannot be + accessed by the MM environment +**/ +EFI_STATUS +EFIAPI +MmCommunicationCommunicate ( + IN OUT VOID *CommBuffer, + IN OUT UINTN *CommSize OPTIONAL + ); + +#endif /* MM_COMMUNICATION_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/NVParamLib.h b/S= ilicon/Ampere/AmpereAltraPkg/Include/Library/NVParamLib.h new file mode 100644 index 000000000000..e8521ce336a3 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/NVParamLib.h @@ -0,0 +1,134 @@ +/** @file + + The non-volatile parameter layout in SPI-NOR is shown below. There is + two copies. The master copy is changeable by the user. The Last Known + copy is handled by the fail safe future. It is a last know bootable copy. + + --------------------------- + | Master Copy | 16KB + | Pre-boot parameters | + --------------------------- + | Master Copy | 16KB + | Pre-boot parameters | + | w/o failsafe support | + --------------------------- + | Master Copy | + | Manufactory & | 32KB + | Users parameters | + --------------------------- + | Last Known Copy | 16KB + | Pre-boot parameters | + --------------------------- + | | 16KB + --------------------------- + | Last Known Copy | + | Manufactory & | 32KB + | Users parameters | + --------------------------- + + As each non-volatile parameter requires 8 bytes, there is a total of 8K + parameters. + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef NV_PARAM_LIB_H_ +#define NV_PARAM_LIB_H_ + +#define NV_PARAM_MAX_SIZE (64 * 1024) +#define NV_PARAM_ENTRYSIZE 8 + +#define NV_PERM_ALL 0xFFFF /* Allowed for all */ +#define NV_PERM_ATF 0x0001 /* Allowed for EL3 code */ +#define NV_PERM_OPTEE 0x0004 /* Allowed for secure El1 */ +#define NV_PERM_BIOS 0x0008 /* Allowed for EL2 non-secure */ +#define NV_PERM_MANU 0x0010 /* Allowed for manufactory interface */ +#define NV_PERM_BMC 0x0020 /* Allowed for BMC interface */ + +#define NVPARAM_SIZE 0x8 + +/** + Retrieve a non-volatile parameter. + + NOTE: If you need a signed value, cast it. It is expected that the + caller will carry the correct permission over various call sequences. + + @param[in] Param Parameter ID to retrieve + @param[in] ACLRd Permission for read operation. + @param[out] Val Pointer to an UINT32 to the return value. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_ACCESS_DENIED Permission not allowed. + @retval EFI_DEVICE_ERROR Service is unavailable. + @retval EFI_INVALID_PARAMETER Val is NULL or return status is invalid. + @retval EFI_NOT_FOUND NVParam entry is not set. +**/ +EFI_STATUS +NVParamGet ( + IN UINT32 Param, + IN UINT16 ACLRd, + OUT UINT32 *Val + ); + +/** + Set a non-volatile parameter. + + NOTE: If you have a signed value, cast to unsigned. If the parameter has + not being created before, the provied permission is used to create the + parameter. Otherwise, it is checked for access. It is expected that the + caller will carry the correct permission over various call sequences. + + @param[in] Param Parameter ID to set + @param[in] ACLRd Permission for read operation. + @param[in] ACLWr Permission for write operation. + @param[in] Val Unsigned int value to set. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_ACCESS_DENIED Permission not allowed. + @retval EFI_DEVICE_ERROR Service is unavailable. + @retval EFI_INVALID_PARAMETER Return status is invalid. +**/ +EFI_STATUS +NVParamSet ( + IN UINT32 Param, + IN UINT16 ACLRd, + IN UINT16 ACLWr, + IN UINT32 Val + ); + +/** + Clear a non-volatile parameter. + + NOTE: It is expected that the caller will carry the correct permission + over various call sequences. + + @param[in] Param Parameter ID to set + @param[in] ACLWr Permission for write operation. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_ACCESS_DENIED Permission not allowed. + @retval EFI_DEVICE_ERROR Service is unavailable. + @retval EFI_INVALID_PARAMETER Return status is invalid. +**/ +EFI_STATUS +NVParamClr ( + IN UINT32 Param, + IN UINT16 ACLWr + ); + +/** + Clear all non-volatile parameters + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_DEVICE_ERROR Service is unavailable. + @retval EFI_INVALID_PARAMETER Return status is invalid. +**/ +EFI_STATUS +NVParamClrAll ( + VOID + ); + +#endif /* NV_PARAM_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/SystemFirmwareIn= terfaceLib.h b/Silicon/Ampere/AmpereAltraPkg/Include/Library/SystemFirmware= InterfaceLib.h new file mode 100644 index 000000000000..ce96c2a6b4b6 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/SystemFirmwareInterface= Lib.h @@ -0,0 +1,282 @@ +/** @file + Provides functions for communication with System Firmware (SMpro/PMpro) + via interfaces like Mailbox. + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef SYSTEM_FIRMWARE_INTERFACE_LIB_H_ +#define SYSTEM_FIRMWARE_INTERFACE_LIB_H_ + +// +// Common mailbox message format +// Bit 31:28 - Message type +// Bit 27:24 - Message subtype +// Bit 23:16 - Message control byte +// Bit 15:0 - Message data specific +// +#define MAILBOX_MESSAGE_TYPE_SHIFT 28 +#define MAILBOX_MESSAGE_SUBTYPE_SHIFT 24 +#define MAILBOX_MESSAGE_CONTROL_BYTE_SHIFT 16 + +#define COMMON_MESSAGE_ENCODE(Type,Subtype,Control) \ + ( \ + ((Type) << MAILBOX_MESSAGE_TYPE_SHIFT) | \ + ((Subtype) << MAILBOX_MESSAGE_SUBTYPE_SHIFT) | \ + ((Control) << MAILBOX_MESSAGE_CONTROL_BYTE_SHIFT) \ + ) + +#define MAILBOX_MESSAGE_CONTROL_URGENT BIT7 +#define MAILBOX_MESSAGE_CONTROL_TYPICAL 0 + +// +// Mailbox Message Types +// +#define MAILBOX_MESSAGE_TYPE_DEBUG 0x00 +#define MAILBOX_MESSAGE_TYPE_ADDRESS 0x05 +#define MAILBOX_MESSAGE_TYPE_USER 0x06 + +// +// Mailbox Message Type 0x00 - Debug message +// +#define MAILBOX_DEBUG_MESSAGE_SUBTYPE_REGISTER_READ 0x01 +#define MAILBOX_DEBUG_MESSAGE_SUBTYPE_REGISTER_WRITE 0x02 + +// +// Debug message data format +// Bit 31:16 - Refer to definition of COMMON_MESSAGE_ENCODE +// Bit 15:0 - Store lower 16-bit of the upper 64-bit address +// +#define MAILBOX_DEBUG_MESSAGE_ENCODE(Subtype,Address) \ + ( \ + (COMMON_MESSAGE_ENCODE ( \ + MAILBOX_MESSAGE_TYPE_DEBUG, \ + (Subtype), \ + MAILBOX_MESSAGE_CONTROL_TYPICAL)) | \ + ((Address) & 0xFFFF) \ + ) + +// +// Mailbox Message Type 0x05 - Address message +// +#define MAILBOX_ADDRESS_MESSAGE_SUBTYPE_PCC 0x03 + +// +// Address message data format +// Bit 31:16 - Refer to definition of COMMON_MESSAGE_ENCODE +// Bit 15:8 - Message Parameter +// Bit 7:4 - Address message control bit +// 0x4: 256 alignment +// 0x0: No alignment +// Bit 3:0 - Unused +// +#define MAILBOX_ADDRESS_MESSAGE_ENCODE(Subtype,Param,Align) \ + ( \ + (COMMON_MESSAGE_ENCODE ( \ + MAILBOX_MESSAGE_TYPE_ADDRESS, \ + (Subtype), \ + MAILBOX_MESSAGE_CONTROL_TYPICAL)) | \ + ((Param) << 8) | \ + ((Align) << 4) \ + ) + +#define MAILBOX_ADDRESS_URGENT_MESSAGE_ENCODE(Subtype,Param,Align) \ + ( \ + (COMMON_MESSAGE_ENCODE ( \ + MAILBOX_MESSAGE_TYPE_ADDRESS, \ + (Subtype), \ + MAILBOX_MESSAGE_CONTROL_URGENT)) | \ + ((Param) << 8) | \ + ((Align) << 4) \ + ) + +#define MAILBOX_ADDRESS_256_ALIGNMENT 0x4 +#define MAILBOX_ADDRESS_NO_ALIGNMENT 0x0 + +#define MAILBOX_ADDRESS_MESSAGE_PARAM_CPPC 0x01 + +#define MAILBOX_URGENT_CPPC_MESSAGE \ + ( \ + MAILBOX_ADDRESS_URGENT_MESSAGE_ENCODE ( \ + MAILBOX_ADDRESS_MESSAGE_SUBTYPE_PCC, \ + MAILBOX_ADDRESS_MESSAGE_PARAM_CPPC, \ + MAILBOX_ADDRESS_256_ALIGNMENT) \ + ) + +#define MAILBOX_TYPICAL_PCC_MESSAGE \ + ( \ + MAILBOX_ADDRESS_MESSAGE_ENCODE ( \ + MAILBOX_ADDRESS_MESSAGE_SUBTYPE_PCC, \ + 0, \ + MAILBOX_ADDRESS_256_ALIGNMENT) \ + ) + +// +// Mailbox Message Type 0x06 - User message +// +#define MAILBOX_USER_MESSAGE_SUBTYPE_SET_CONFIGURATION 0x02 +#define MAILBOX_USER_MESSAGE_SUBTYPE_BOOT_PROGRESS 0x06 +#define MAILBOX_USER_MESSAGE_SUBTYPE_TRNG_PROXY 0x07 + +// +// User message data format +// Bit 31:16 - Refer to definition of COMMON_MESSAGE_ENCODE +// Bit 15:8 - Message Parameter 0 +// Bit 7:0 - Message Parameter 1 +// +#define MAILBOX_USER_MESSAGE_ENCODE(Subtype,Param0,Param1) \ + ( \ + (COMMON_MESSAGE_ENCODE ( \ + MAILBOX_MESSAGE_TYPE_USER, \ + (Subtype), \ + MAILBOX_MESSAGE_CONTROL_TYPICAL)) | \ + ((Param0) << 8) | \ + (Param1) \ + ) + +// +// Parameters for True RNG Proxy Message +// Param0: 1 - Get a random number +// Param1: Unused +// +#define MAILBOX_TRNG_PROXY_GET_RANDOM_NUMBER 1 + +// +// Parameters for Boot Progress +// Param0: 1 - Set boot state +// Param1: Boot stage value +// 0x08: BL33/UEFI Stage +// +#define MAILBOX_BOOT_PROGRESS_COMMAND_SET 1 +#define MAILBOX_BOOT_PROGRESS_STAGE_UEFI 8 + +// +// Parameters for Set Configuration +// Param0: Configuration type +// 20: Turbo configuration +// Param1: Unused +// +#define MAILBOX_SET_CONFIGURATION_TURBO 20 + +/** + Read a register which is not accessible from the non-secure world + by sending a mailbox message to the SMpro processor. + + Note that not all addresses are allowed. + + @param[in] Socket Active socket index. + @param[in] Address A 64-bit register address to be read. + @param[out] Value A pointer to the read value. + + @retval EFI_SUCCESS Read the register successfully. + @retval EFI_UNSUPPORTED The register is not allowed. + @retval Otherwise Errors returned from MailboxWrite/MailboxR= ead() functions. +**/ +EFI_STATUS +EFIAPI +MailboxMsgRegisterRead ( + IN UINT8 Socket, + IN UINTN Address, + OUT UINT32 *Value + ); + +/** + Write a value to a register which is not accessible from the non-secure = world + by sending a mailbox message to the SMpro processor. + + Note that not all addresses are allowed. + + @param[in] Socket Active socket index. + @param[in] Address A 64-bit register address to be written. + @param[in] Value The value to be written to the register. + + @retval EFI_SUCCESS Write the register successfully. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval Otherwise Errors returned from the MailboxWrite() functio= n. +**/ +EFI_STATUS +EFIAPI +MailboxMsgRegisterWrite ( + IN UINT8 Socket, + IN UINTN Address, + IN UINT32 Value + ); + +/** + Set the PCC shared Memory Address to service handlers in the System Cont= rol Processors, + using for communication between the System Firmware and OSPM. + + @param[in] Socket Active socket index. + @param[in] Doorbell Doorbell index which is numbered like DOORB= ELL_CHANNELS. + @param[in] AddressAlign256 Enable/Disable 256 alignment. + @param[in] Address The shared memory address. + + @retval EFI_SUCCESS Set the shared memory address successfully. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval Otherwise Errors returned from the MailboxWrite() fu= nctions. +**/ +EFI_STATUS +EFIAPI +MailboxMsgSetPccSharedMem ( + IN UINT8 Socket, + IN UINT8 Doorbell, + IN BOOLEAN AddressAlign256, + IN UINTN Address + ); + +/** + The True RNG is provided by the SMpro processor. This function is to sen= d a mailbox + message to the SMpro to request a 64-bit random number. + + @param[out] Buffer A pointer to the read 64-bit random number. + + @retval EFI_SUCCESS The operation succeeds. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval Otherwise Errors returned from the MailboxWrite/Mail= boxRead() functions. +**/ +EFI_STATUS +EFIAPI +MailboxMsgGetRandomNumber64 ( + OUT UINT8 *Buffer + ); + +/** + Report the UEFI boot progress to the SMpro. + + @param[in] Socket Active socket index. + @param[in] BootStatus The status of the UEFI boot. + @param[in] Checkpoint The UEFI Checkpoint value. + + @retval EFI_SUCCESS Set the boot progress successfully. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval Otherwise Errors returned from the MailboxWrite() fu= nctions. +**/ +EFI_STATUS +EFIAPI +MailboxMsgSetBootProgress ( + IN UINT8 Socket, + IN UINT8 BootStatus, + IN UINT32 Checkpoint + ); + +/** + Configure the Turbo (Max Performance) mode. + + @param[in] Socket Active socket index. + @param[in] Enable Enable/Disable the Turbo (Max performance) = mode. + + @retval EFI_SUCCESS Configure the Turbo successfully. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval Otherwise Errors returned from the MailboxWrite() fu= nctions. +**/ +EFI_STATUS +EFIAPI +MailboxMsgTurboConfig ( + IN UINT8 Socket, + IN BOOLEAN Enable + ); + +#endif /* SYSTEM_FIRMWARE_INTERFACE_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/TrngLib.h b/Sili= con/Ampere/AmpereAltraPkg/Include/Library/TrngLib.h new file mode 100644 index 000000000000..b478986cb032 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/TrngLib.h @@ -0,0 +1,31 @@ +/** @file + RNG (Random Number Generator) Library that uses Hardware RNG in SMpro. + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef TRNG_LIB_H_ +#define TRNG_LIB_H_ + +/** + Generates a random number by using Hardware RNG in SMpro. + + @param[out] Buffer Buffer to receive the random number. + @param[in] BufferSize Number of bytes in Buffer. + + @retval EFI_SUCCESS The random value was returned successfully. + @retval EFI_DEVICE_ERROR A random value could not be retrieved + due to a hardware or firmware error. + @retval EFI_INVALID_PARAMETER Buffer is NULL or BufferSize is zero. +**/ +EFI_STATUS +EFIAPI +GenerateRandomNumbers ( + OUT UINT8 *Buffer, + IN UINTN BufferSize + ); + +#endif /* TRNG_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/NVParamDef.h b/Silicon/A= mpere/AmpereAltraPkg/Include/NVParamDef.h new file mode 100644 index 000000000000..3259fa1ea45c --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/NVParamDef.h @@ -0,0 +1,534 @@ +/** @file + + The non-volatile parameter layout in SPI-NOR is shown below. There is + two copies. The master copy is changeable by the user. The Last Known + copy is handled by the fail safe future. It is a last know bootable copy. + + --------------------------- + | Master Copy | 16KB + | Pre-boot parameters | + --------------------------- + | Master Copy | 16KB + | Pre-boot parameters | + | w/o failsafe support | + --------------------------- + | Master Copy | + | Manufactory & | 32KB + | Users parameters | + --------------------------- + | Last Known Copy | 16KB + | Pre-boot parameters | + --------------------------- + | | 16KB + --------------------------- + | Last Known Copy | + | Manufactory & | 32KB + | Users parameters | + --------------------------- + + As each non-volatile parameter requires 8 bytes, there is a total of 8K + parameters. + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef NVPARAMDEF_H_ +#define NVPARAMDEF_H_ + +// +// SoC validation pre-boot non-volatile setting +// +// These parameters will reset to default value on failsafe. +// They are not used in production life cycle. +// +#define NV_PREBOOT_PARAM_START (0x000000) +#define NV_SI_PCP_VDMC ((1 * 8) + NV_PREBOOT_PA= RAM_START) +#define NV_SI_FAILSAFE_RETRY ((2 * 8) + NV_PREBOOT_PA= RAM_START) +#define NV_SI_DDR_PPR_EN ((3 * 8) + NV_PREBOOT_PA= RAM_START) +#define NV_SI_DDR_RESERVED0 ((4 * 8) + NV_PREBOOT_PA= RAM_START) +#define NV_SI_DDR_RESERVED1 ((5 * 8) + NV_PREBOOT_PA= RAM_START) +#define NV_SI_DDR_LOG_LEVEL ((6 * 8) + NV_PREBOOT_PA= RAM_START) +#define NV_SI_DDR_RESERVED2 ((7 * 8) + NV_PREBOOT_PA= RAM_START) +#define NV_SI_DDR_RD_DBI_EN ((8 * 8) + NV_PREBOOT_PA= RAM_START) +#define NV_SI_DDR_WR_DBI_EN ((9 * 8) + NV_PREBOOT_PA= RAM_START) +#define NV_SI_DDR_RETRY_EN ((10 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_BANK_HASH_EN ((11 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_RESERVED3 ((12 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_RCD_PARITY_EN ((13 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_WRPATH_CLK_GATE_EN ((14 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_IOCAL_MARGIN ((15 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_RTR_S_MARGIN ((16 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_RTR_L_MARGIN ((17 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_RTR_CS_MARGIN ((18 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_WTW_S_MARGIN ((19 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_WTW_L_MARGIN ((20 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_WTW_CS_MARGIN ((21 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_RTW_S_MARGIN ((22 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_RTW_L_MARGIN ((23 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_RTW_CS_MARGIN ((24 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_WTR_S_MARGIN ((25 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_WTR_L_MARGIN ((26 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_WTR_CS_MARGIN ((27 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_PARITY_EN ((28 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_SLC_DISABLE ((29 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_SLC_SIZE ((30 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_SLC_SCRUB ((31 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_CCIX_DISABLE ((32 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_ESM_RESERVED ((33 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_PHY_CAL_MODE ((34 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_RAS_TEST_EN ((35 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_EYE_SCREEN_TEST_EN ((36 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_EYE_MASK_RD_MARGIN ((37 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_EYE_MASK_WR_MARGIN ((38 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_RDODT_ON_MARGIN ((39 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_RDODT_OFF_MARGIN ((40 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_WRODT_ON_MARGIN ((41 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_WRODT_OFF_MARGIN ((42 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_SLC_OCM_EN ((43 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_ESM_WIDTH ((44 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_TM2_DISABLE ((45 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_CPUPLL_FREQ_MHZ ((46 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_ERR_INJECT_MASK_SK0 ((47 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_ERR_INJECT_MASK_SK1 ((48 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_CXG_DISABLE_EARLY_COMPACK ((49 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_CXG_ENABLE_SAME_ADDR_COMP_ORDER ((50 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_TURNAROUND_CONTROL ((51 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_HIT_TURNAROUND_CONTROL ((52 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_QOS_CLASS_CONTROL ((53 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_ESCALATION_CONTROL ((54 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_QV_CONTROL_31_00 ((55 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_QV_CONTROL_63_32 ((56 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_CREDIT_CONTROL ((57 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_WRITE_PRIORITY_CONTROL_31_00 ((58 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_WRITE_PRIORITY_CONTROL_63_32 ((59 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_QUEUE_THRESHOLD_CONTROL_31_00 ((60 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_QUEUE_THRESHOLD_CONTROL_63_32 ((61 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_ATF_FAILURE_FAILSAFE ((62 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_UEFI_FAILURE_FAILSAFE ((63 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_STRIPE_DECODE ((64 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_DEBUG_CTRL ((65 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_CXG_RA_DEVNR_ORD_WFC_DIS ((66 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_PHY_DLL_TRACK_UPD_THRESHOLD ((67 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_PHY_DLL_TRACK_UPD_THRESHOLD_AC ((68 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_PHY_INIT_UPDATE_CONFIG ((69 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_PHY_UPDATE_CONTROL ((70 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_PROFILE_EN ((71 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_PCIE_PHY_SETTING ((72 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_PHY_CAL_THRESHOLD ((73 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_PHY_CAL_INTERVAL_CNT ((74 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_RESERVED ((75 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_S0_RHS_RCA_EN ((76 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_S1_RHS_RCA_EN ((77 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_2P_DPLL ((78 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_2P_ALI_CFG ((79 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_2P_ALI_CFG_LINK_RETRAIN ((80 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_2P_ALI_CFG_CRC ((81 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_RT_CONTROL_31_00 ((82 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_RT_CONTROL_63_32 ((83 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_DDR_TIMEOUT_CONTROL ((84 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_CPU_LPI_FREQ_DISABLE ((85 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_SI_CPU_LPI_FREQ_ENERGY_THRSHLD ((86 * 8) + NV_PREBOOT_P= ARAM_START) +#define NV_PMPRO_REGION1_LOAD_START (NV_SI_SLC_DISABLE) +#define NV_PMPRO_REGION1_LOAD_END (NV_SI_CPU_LPI_FREQ_ENER= GY_THRSHLD) +// +// NOTE: Add before NV_PREBOOT_PARAM_MAX and increase its value +// +#define NV_PREBOOT_PARAM_MAX ((86 * 8) + NV_PREBOOT_P= ARAM_START) + +// +// Manufactory non-volatile memory +// +// These parameters will reset to default value on failsafe. +// +#define NV_MANU_PARAM_START (0x004000) +#define NV_SI_DDR_VMARGIN ((0 * 8) + NV_MANU_PARAM= _START) +#define NV_PMPRO_REGION2_LOAD_START (NV_SI_DDR_VMARGIN) +#define NV_SI_SOC_VMARGIN ((1 * 8) + NV_MANU_PARAM= _START) +#define NV_SI_AVS_VMARGIN ((2 * 8) + NV_MANU_PARAM= _START) +#define NV_SI_TPC_TM1_MARGIN ((3 * 8) + NV_MANU_PARAM= _START) +#define NV_SI_TPC_TM2_MARGIN ((4 * 8) + NV_MANU_PARAM= _START) +#define NV_SI_TPC_FREQ_THROTTLE ((5 * 8) + NV_MANU_PARAM= _START) +#define NV_SI_T_LTLM_EN ((6 * 8) + NV_MANU_PARAM= _START) +#define NV_SI_T_LTLM_THRSHLD ((7 * 8) + NV_MANU_PARAM= _START) +#define NV_SI_T_GTLM_THRSHLD ((8 * 8) + NV_MANU_PARAM= _START) +#define NV_SI_P_LM_EN ((9 * 8) + NV_MANU_PARAM= _START) +#define NV_SI_P_LM_THRSHLD ((10 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_TPC_OVERTEMP_ISR_DISABLE ((11 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_VPP_VMARGIN ((12 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PMPRO_FAILURE_FAILSAFE ((13 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_FAILSAFE_DISABLE ((14 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLIMIT_APM_DS_PERCENTAGE ((15 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLIMIT_APM_EP_MS ((16 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLIMIT_APM_PM1_PERCENTAGE_TDP ((17 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_CPU_LPI_RESERVED0 ((18 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_CPU_LPI_RESERVED1 ((19 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_CCIX_OPT_CONFIG ((20 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_MESH_FREQ_MARGIN ((21 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_MESH_TURBO_EN ((22 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PWR_HEADROOM_WATT ((23 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_EXTRA_PCP_VOLT_MV ((24 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_CPU_LPI_HYST_CNT ((25 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_DVFS_VOLT_INC_STEP_MV ((26 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_DVFS_VOLT_DEC_STEP_MV ((27 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLIMIT_APM_TEMP_THLD ((28 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLIMIT_APM_EN ((29 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_VDM_EN ((30 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_VDM_VMARGIN_MV ((31 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLT_EN ((32 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLT_SOCKET ((33 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLT_MCU_MASK ((34 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLT_RANK_MASK ((35 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLT_SLICE_MASK ((36 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLT_BIT_MASK ((37 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLT_X_PARAM ((38 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLT_Y_PARAM ((39 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLT_X_LEFT ((40 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLT_X_RIGHT ((41 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLT_X_STEP ((42 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLT_Y_BOTTOM ((43 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLT_Y_TOP ((44 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLT_Y_STEP ((45 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLT_START_ADDR_LO ((46 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLT_START_ADDR_UP ((47 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLT_SIZE ((48 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLT_THREAD_CNT ((49 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLT_SCREEN ((50 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_PLT_RSVD ((51 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_DVFS_VOLT_CHANGE_BY_STEP_EN ((52 * 8) + NV_MANU_PARA= M_START) +#define NS_SI_DVFS_TCAL_F_LIMIT ((53 * 8) + NV_MANU_PARA= M_START) +#define NS_SI_DVFS_TCAL_T_LIMIT ((54 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_CCIX_DIAG_CTRL1 ((55 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_CCIX_DIAG_CTRL2 ((56 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_DDR_TCAL_EN ((57 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_DDR_TCAL_DIMM_LOW_TEMP_THRESHOLD ((58 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_DDR_TCAL_DIMM_HIGH_TEMP_THRESHOLD ((59 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_DDR_TCAL_MCU_LOW_TEMP_THRESHOLD ((60 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_DDR_TCAL_MCU_HIGH_TEMP_THRESHOLD ((61 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_DDR_TCAL_LOW_TEMP_VOLT_OFF_MV ((62 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_DDR_TCAL_PERIOD_SEC ((63 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_DDR_TCAL_SOC_VOLT_CAP_MV ((64 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_ALTRAMAX_ICCMAX_EN ((65 * 8) + NV_MANU_PARA= M_START) +#define NV_SI_MESH_TURBO_ACTIVITY_THRESHOLD ((66 * 8) + NV_MANU_PARA= M_START) +#define NV_PMPRO_REGION2_LOAD_END (NV_SI_MESH_TURBO_ACTIVI= TY_THRESHOLD) +// +// NOTE: Add before NV_MANU_PARAM_MAX and increase its value +// +#define NV_MANU_PARAM_MAX ((66 * 8) + NV_MANU_PARA= M_START) + +// +// User non-volatile memory +// +// These parameters will reset to default value on failsafe. +// +#define NV_USER_PARAM_START (0x008000) +#define NV_SI_S0_PCP_ACTIVECPM_0_31 ((0 * 8) + NV_USER_PARAM= _START) +#define NV_SI_S0_PCP_ACTIVECPM_32_63 ((1 * 8) + NV_USER_PARAM= _START) +#define NV_SI_S1_PCP_ACTIVECPM_0_31 ((2 * 8) + NV_USER_PARAM= _START) +#define NV_SI_S1_PCP_ACTIVECPM_32_63 ((3 * 8) + NV_USER_PARAM= _START) +#define NV_SI_WDT_BIOS_EXP_MINS ((4 * 8) + NV_USER_PARAM= _START) +#define NV_SI_DDR_CE_RAS_THRESHOLD ((5 * 8) + NV_USER_PARAM= _START) +#define NV_SI_DDR_CE_RAS_INTERVAL ((6 * 8) + NV_USER_PARAM= _START) +#define NV_SI_DDR_SPEED ((7 * 8) + NV_USER_PARAM= _START) +#define NV_SI_DDR_SCRUB_EN ((8 * 8) + NV_USER_PARAM= _START) +#define NV_SI_DDR_ECC_MODE ((9 * 8) + NV_USER_PARAM= _START) +#define NV_SI_S0_RCA_PCI_DEVMAP ((10 * 8) + NV_USER_PARA= M_START) +#define NV_SI_S0_RCB_PCI_DEVMAP ((11 * 8) + NV_USER_PARA= M_START) +#define NV_SI_S1_RCA_PCI_DEVMAP ((12 * 8) + NV_USER_PARA= M_START) +#define NV_SI_S1_RCB_PCI_DEVMAP ((13 * 8) + NV_USER_PARA= M_START) +#define NV_SI_DDR_ERRCTRL ((14 * 8) + NV_USER_PARA= M_START) +#define NV_SI_DDR_REFRESH_GRANULARITY ((15 * 8) + NV_USER_PARA= M_START) +#define NV_SI_SUBNUMA_MODE ((16 * 8) + NV_USER_PARA= M_START) +#define NV_SI_ERRATUM_1542419_WA ((17 * 8) + NV_USER_PARA= M_START) +#define NV_SI_NEAR_ATOMIC_DISABLE ((18 * 8) + NV_USER_PARA= M_START) +#define NV_SI_DDR_SLAVE_32BIT_MEM_EN ((19 * 8) + NV_USER_PARA= M_START) +#define NV_SI_CPUECTLR_EL1_0_31 ((20 * 8) + NV_USER_PARA= M_START) +#define NV_SI_CPUECTLR_EL1_32_63 ((21 * 8) + NV_USER_PARA= M_START) +#define NV_SI_HARDWARE_EINJ ((22 * 8) + NV_USER_PARA= M_START) +#define NV_SI_2P_CE_RAS_THRESHOLD ((23 * 8) + NV_USER_PARA= M_START) +#define NV_SI_2P_CE_RAS_INTERVAL ((24 * 8) + NV_USER_PARA= M_START) +#define NV_SI_RAS_BERT_ENABLED ((25 * 8) + NV_USER_PARA= M_START) +#define NV_SI_HNF_AUX_CTL_0_31 ((26 * 8) + NV_USER_PARA= M_START) +#define NV_SI_HNF_AUX_CTL_32_63 ((27 * 8) + NV_USER_PARA= M_START) +#define NV_SI_CPM_CE_RAS_THRESHOLD ((28 * 8) + NV_USER_PARA= M_START) +#define NV_SI_CPM_CE_RAS_INTERVAL ((29 * 8) + NV_USER_PARA= M_START) +#define NV_SI_HNF_AUX_CTL_0_31_WR_EN_MASK ((30 * 8) + NV_USER_PARA= M_START) +#define NV_SI_HNF_AUX_CTL_32_63_WR_EN_MASK ((31 * 8) + NV_USER_PARA= M_START) +#define NV_SI_DDR_WR_BACK_EN ((32 * 8) + NV_USER_PARA= M_START) +#define NV_SI_CPUECTLR_EL1_0_31_WR_EN_MASK ((33 * 8) + NV_USER_PARA= M_START) +#define NV_SI_CPUECTLR_EL1_32_63_WR_EN_MASK ((34 * 8) + NV_USER_PARA= M_START) +#define NV_SI_LINK_ERR_THRESHOLD ((35 * 8) + NV_USER_PARA= M_START) +#define NV_SI_SEC_WDT_BIOS_EXP_MINS ((36 * 8) + NV_USER_PARA= M_START) +#define NV_SI_NVDIMM_MODE ((37 * 8) + NV_USER_PARA= M_START) +#define NV_SI_RAS_SDEI_ENABLED ((38 * 8) + NV_USER_PARA= M_START) +#define NV_SI_NVDIMM_PROV_MASK_S0 ((39 * 8) + NV_USER_PARA= M_START) +#define NV_SI_NVDIMM_PROV_MASK_S1 ((40 * 8) + NV_USER_PARA= M_START) +#define NV_SI_DDR_ZQCS_EN ((41 * 8) + NV_USER_PARA= M_START) +#define NV_SI_DDR_CRC_MODE ((42 * 8) + NV_USER_PARA= M_START) +#define NV_SI_CXG_RA_AUX_CTL_0_31 ((43 * 8) + NV_USER_PARA= M_START) +#define NV_SI_CXG_RA_AUX_CTL_32_63 ((44 * 8) + NV_USER_PARA= M_START) +#define NV_SI_CXG_RA_AUX_CTL_0_31_WR_EN_MASK ((45 * 8) + NV_USER_PARA= M_START) +#define NV_SI_CXG_RA_AUX_CTL_32_63_WR_EN_MASK ((46 * 8) + NV_USER_PARA= M_START) +#define NV_SI_CXLA_AUX_CTL_0_31 ((47 * 8) + NV_USER_PARA= M_START) +#define NV_SI_CXLA_AUX_CTL_32_63 ((48 * 8) + NV_USER_PARA= M_START) +#define NV_SI_CXLA_AUX_CTL_0_31_WR_EN_MASK ((49 * 8) + NV_USER_PARA= M_START) +#define NV_SI_CXLA_AUX_CTL_32_63_WR_EN_MASK ((50 * 8) + NV_USER_PARA= M_START) +#define NV_SI_DDR_LOW_POWER_CFG ((51 * 8) + NV_USER_PARA= M_START) +#define NV_SI_ALERT_DIMM_SHUTDOWN_EN ((52 * 8) + NV_USER_PARA= M_START) +#define NV_SI_DFS_EN ((53 * 8) + NV_USER_PARA= M_START) +#define NV_SI_RAS_PCIE_AER_FW_FIRST ((54 * 8) + NV_USER_PARA= M_START) +#define NV_SI_RAS_DRAM_EINJ_NOTRIGGER ((55 * 8) + NV_USER_PARA= M_START) +#define NV_SI_RAS_AEST_PROC_EN ((56 * 8) + NV_USER_PARA= M_START) +#define NV_SI_MESH_S0_CXG_RC_STRONG_ORDERING_EN ((57 * 8) + NV_USER_PARA= M_START) +#define NV_SI_MESH_S1_CXG_RC_STRONG_ORDERING_EN ((58 * 8) + NV_USER_PARA= M_START) +#define NV_SI_2P_RESERVED0 ((59 * 8) + NV_USER_PARA= M_START) +#define NV_SI_2P_RESERVED1 ((60 * 8) + NV_USER_PARA= M_START) +#define NV_SI_2P_RESERVED2 ((61 * 8) + NV_USER_PARA= M_START) +#define NV_SI_HCR_EL2_CTL_LOW ((62 * 8) + NV_USER_PARA= M_START) +#define NV_SI_HCR_EL2_CTL_HIGH ((63 * 8) + NV_USER_PARA= M_START) +#define NV_SI_ESM_SPEED ((64 * 8) + NV_USER_PARA= M_START) +// +// NOTE: Add before NV_USER_PARAM_MAX and increase its value +// +#define NV_USER_PARAM_MAX ((64 * 8) + NV_USER_PARA= M_START) +#define NV_PMPRO_REGION3_LOAD_START (NV_USER_PARAM_START) +#define NV_PMPRO_REGION3_LOAD_END (NV_USER_PARAM_MAX) + +// +// Non-volatile board read-only setting +// +// These parameters do not support failsafe and will always read +// from its location. Please note that the physical base address +// location for board setting is not the same as above region. This +// allows packaging these board setting along with the firmware +// image itself. See SPI-NOR flash layout design for more info. +// +// Please note that script will parse these and generate +// board setting. The keyword "Default: " is used to provide +// the default value. +// +#define NV_BOARD_PARAM_START (0x00C000) +#define NV_SI_RO_BOARD_VENDOR ((0 * 8) + NV_BOARD_PARA= M_START) /* Default: 0x0000CD3A - Follow BMC FRU format */ +#define NV_PMPRO_REGION4_LOAD_START (NV_SI_RO_BOARD_VENDOR) +#define NV_SI_RO_BOARD_TYPE ((1 * 8) + NV_BOARD_PARA= M_START) /* Default: 0x00000000 - Follow BMC FRU format */ +#define NV_SI_RO_BOARD_REV ((2 * 8) + NV_BOARD_PARA= M_START) /* Default: 0x00000000 Follow BMC FRU format */ +#define NV_SI_RO_BOARD_CFG ((3 * 8) + NV_BOARD_PARA= M_START) /* Default: 0x00000000 Follow BMC FRU format */ +#define NV_SI_RO_BOARD_S0_DIMM_AVAIL ((4 * 8) + NV_BOARD_PARA= M_START) /* Default: 0x0000FFFF */ +#define NV_SI_RO_BOARD_S1_DIMM_AVAIL ((5 * 8) + NV_BOARD_PARA= M_START) /* Default: 0x0000FFFF */ +#define NV_SI_RO_BOARD_SPI0CS0_FREQ_KHZ ((6 * 8) + NV_BOARD_PARA= M_START) /* Default: 33000 */ +#define NV_SI_RO_BOARD_SPI0CS1_FREQ_KHZ ((7 * 8) + NV_BOARD_PARA= M_START) /* Default: 33000 */ +#define NV_SI_RO_BOARD_SPI1CS0_FREQ_KHZ ((8 * 8) + NV_BOARD_PARA= M_START) /* Default: 10000 */ +#define NV_SI_RO_BOARD_SPI1CS1_FREQ_KHZ ((9 * 8) + NV_BOARD_PARA= M_START) /* Default: 10000 */ +#define NV_SI_RO_BOARD_TPM_LOC ((10 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00000000 */ +#define NV_SI_RO_BOARD_I2C0_FREQ_KHZ ((11 * 8) + NV_BOARD_PAR= AM_START) /* Default: 400 */ +#define NV_SI_RO_BOARD_I2C1_FREQ_KHZ ((12 * 8) + NV_BOARD_PAR= AM_START) /* Default: 400 */ +#define NV_SI_RO_BOARD_I2C2_10_FREQ_KHZ ((13 * 8) + NV_BOARD_PAR= AM_START) /* Default: 400 */ +#define NV_SI_RO_BOARD_I2C3_FREQ_KHZ ((14 * 8) + NV_BOARD_PAR= AM_START) /* Default: 400 */ +#define NV_SI_RO_BOARD_I2C9_FREQ_KHZ ((15 * 8) + NV_BOARD_PAR= AM_START) /* Default: 400 */ +#define NV_SI_RO_BOARD_2P_CFG ((16 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0xFFFFFF01 */ +#define NV_SI_RO_BOARD_S0_RCA0_CFG ((17 * 8) + NV_BOARD_PAR= AM_START) +#define NV_SI_RO_BOARD_S0_RCA1_CFG ((18 * 8) + NV_BOARD_PAR= AM_START) +#define NV_SI_RO_BOARD_S0_RCA2_CFG ((19 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00000004 */ +#define NV_SI_RO_BOARD_S0_RCA3_CFG ((20 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00000004 */ +#define NV_SI_RO_BOARD_S0_RCB0_LO_CFG ((21 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00020002 */ +#define NV_SI_RO_BOARD_S0_RCB0_HI_CFG ((22 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00020002 */ +#define NV_SI_RO_BOARD_S0_RCB1_LO_CFG ((23 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00020002 */ +#define NV_SI_RO_BOARD_S0_RCB1_HI_CFG ((24 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00020002 */ +#define NV_SI_RO_BOARD_S0_RCB2_LO_CFG ((25 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00020002 */ +#define NV_SI_RO_BOARD_S0_RCB2_HI_CFG ((26 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00000003 */ +#define NV_SI_RO_BOARD_S0_RCB3_LO_CFG ((27 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00000003 */ +#define NV_SI_RO_BOARD_S0_RCB3_HI_CFG ((28 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00020002 */ +#define NV_SI_RO_BOARD_S1_RCA0_CFG ((29 * 8) + NV_BOARD_PAR= AM_START) +#define NV_SI_RO_BOARD_S1_RCA1_CFG ((30 * 8) + NV_BOARD_PAR= AM_START) +#define NV_SI_RO_BOARD_S1_RCA2_CFG ((31 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x02020202 */ +#define NV_SI_RO_BOARD_S1_RCA3_CFG ((32 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00030003 */ +#define NV_SI_RO_BOARD_S1_RCB0_LO_CFG ((33 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00000003 */ +#define NV_SI_RO_BOARD_S1_RCB0_HI_CFG ((34 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00020002 */ +#define NV_SI_RO_BOARD_S1_RCB1_LO_CFG ((35 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00020002 */ +#define NV_SI_RO_BOARD_S1_RCB1_HI_CFG ((36 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00000003 */ +#define NV_SI_RO_BOARD_S1_RCB2_LO_CFG ((37 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00020002 */ +#define NV_SI_RO_BOARD_S1_RCB2_HI_CFG ((38 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00020002 */ +#define NV_SI_RO_BOARD_S1_RCB3_LO_CFG ((39 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00020002 */ +#define NV_SI_RO_BOARD_S1_RCB3_HI_CFG ((40 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00020002 */ +#define NV_SI_RO_BOARD_T_LTLM_DELTA_P0 ((41 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00000001 */ +#define NV_SI_RO_BOARD_T_LTLM_DELTA_P1 ((42 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00000002 */ +#define NV_SI_RO_BOARD_T_LTLM_DELTA_P2 ((43 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00000003 */ +#define NV_SI_RO_BOARD_T_LTLM_DELTA_P3 ((44 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0x00000004 */ +#define NV_SI_RO_BOARD_T_LTLM_DELTA_M1 ((45 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0xFFFFFFFF */ +#define NV_SI_RO_BOARD_T_LTLM_DELTA_M2 ((46 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0xFFFFFFFE */ +#define NV_SI_RO_BOARD_T_LTLM_DELTA_M3 ((47 * 8) + NV_BOARD_PAR= AM_START) /* Default: 0xFFFFFFFD */ +#define NV_SI_RO_BOARD_P_LM_PID_P ((48 * 8) + NV_BOARD_PAR= AM_START) +#define NV_SI_RO_BOARD_P_LM_PID_I ((49 * 8) + NV_BOARD_PAR= AM_START) +#define NV_SI_RO_BOARD_P_LM_PID_I_L_THOLD ((50 * 8) + NV_BOARD_PAR= AM_START) +#define NV_SI_RO_BOARD_P_LM_PID_I_H_THOLD ((51 * 8) + NV_BOARD_PAR= AM_START) +#define NV_SI_RO_BOARD_P_LM_PID_D ((52 * 8) + NV_BOARD_PAR= AM_START) +#define NV_SI_RO_BOARD_P_LM_EXP_SMOOTH_CONST ((53 * 8) + NV_BOARD_PAR= AM_START) +// +// NV_SI_RO_BOARD_TPM_ALG_ID: 0=3DDefault to SHA256, 1=3DSHA1, 2=3DSHA256 +// Any other value will lead to default digest. +// +#define NV_SI_RO_BOARD_TPM_ALG_ID ((54 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x00000002 */ +#define NV_SI_RO_BOARD_DDR_SPEED_GRADE ((55 * 8) + NV_B= OARD_PARAM_START) /* Default: 3200 */ +#define NV_SI_RO_BOARD_DDR_S0_RTT_WR ((56 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x20020000 */ +#define NV_SI_RO_BOARD_DDR_S1_RTT_WR ((57 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x20020000 */ +#define NV_SI_RO_BOARD_DDR_S0_RTT_NOM ((58 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x31060177 */ +#define NV_SI_RO_BOARD_DDR_S1_RTT_NOM ((59 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x31060177 */ +#define NV_SI_RO_BOARD_DDR_S0_RTT_PARK ((60 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x30060070 */ +#define NV_SI_RO_BOARD_DDR_S1_RTT_PARK ((61 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x30060070 */ +#define NV_SI_RO_BOARD_DDR_CS0_RDODT_MASK_1DPC ((62 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x000000 */ +#define NV_SI_RO_BOARD_DDR_CS1_RDODT_MASK_1DPC ((63 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x000000 */ +#define NV_SI_RO_BOARD_DDR_CS2_RDODT_MASK_1DPC ((64 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x000000 */ +#define NV_SI_RO_BOARD_DDR_CS3_RDODT_MASK_1DPC ((65 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x000000 */ +#define NV_SI_RO_BOARD_DDR_CS0_RDODT_MASK_2DPC ((66 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x044C0CCC */ +#define NV_SI_RO_BOARD_DDR_CS1_RDODT_MASK_2DPC ((67 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x084C0CCC */ +#define NV_SI_RO_BOARD_DDR_CS2_RDODT_MASK_2DPC ((68 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x04130333 */ +#define NV_SI_RO_BOARD_DDR_CS3_RDODT_MASK_2DPC ((69 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x08130333 */ +#define NV_SI_RO_BOARD_DDR_CS0_WRODT_MASK_1DPC ((70 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x01130333 */ +#define NV_SI_RO_BOARD_DDR_CS1_WRODT_MASK_1DPC ((71 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x02230333 */ +#define NV_SI_RO_BOARD_DDR_CS2_WRODT_MASK_1DPC ((72 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x01430333 */ +#define NV_SI_RO_BOARD_DDR_CS3_WRODT_MASK_1DPC ((73 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x02830333 */ +#define NV_SI_RO_BOARD_DDR_CS0_WRODT_MASK_2DPC ((74 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x055EDEED */ +#define NV_SI_RO_BOARD_DDR_CS1_WRODT_MASK_2DPC ((75 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x0A5DEDDE */ +#define NV_SI_RO_BOARD_DDR_CS2_WRODT_MASK_2DPC ((76 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x055B7BB7 */ +#define NV_SI_RO_BOARD_DDR_CS3_WRODT_MASK_2DPC ((77 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x0A57B77B */ +#define NV_SI_RO_BOARD_DDR_PHY_TERM_DQ_CTRL_1DPC ((78 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x5 */ +#define NV_SI_RO_BOARD_DDR_PHY_TERM_DQ_VAL_1DPC ((79 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x90DD90 */ +#define NV_SI_RO_BOARD_DDR_PHY_TERM_DQS_CTRL_1DPC ((80 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x5 */ +#define NV_SI_RO_BOARD_DDR_PHY_TERM_DQS_VAL_1DPC ((81 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x90DD90 */ +#define NV_SI_RO_BOARD_DDR_PHY_TERM_DQ_CTRL_2DPC ((82 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x5 */ +#define NV_SI_RO_BOARD_DDR_PHY_TERM_DQ_VAL_2DPC ((83 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x90DD90 */ +#define NV_SI_RO_BOARD_DDR_PHY_TERM_DQS_CTRL_2DPC ((84 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x5 */ +#define NV_SI_RO_BOARD_DDR_PHY_TERM_DQS_VAL_2DPC ((85 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x90DD90 */ +#define NV_SI_RO_BOARD_DDR_PHY_VREFDQ_RANGE_VAL_1DPC ((86 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x24 */ +#define NV_SI_RO_BOARD_DDR_DRAM_VREFDQ_RANGE_VAL_1DPC ((87 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x001A001A */ +#define NV_SI_RO_BOARD_DDR_PHY_VREFDQ_RANGE_VAL_2DPC ((88 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x50 */ +#define NV_SI_RO_BOARD_DDR_DRAM_VREFDQ_RANGE_VAL_2DPC ((89 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x00240020 */ +#define NV_SI_RO_BOARD_DDR_CLK_WRDQ_DLY_DEFAULT ((90 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x02800280 */ +#define NV_SI_RO_BOARD_DDR_RDDQS_DQ_DLY_DEFAULT ((91 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x90909090 */ +#define NV_SI_RO_BOARD_DDR_WRDQS_SHIFT_DEFAULT ((92 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x00000000 */ +#define NV_SI_RO_BOARD_DDR_ADCMD_DLY_DEFAULT ((93 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x00C000C0 */ +#define NV_SI_RO_BOARD_DDR_CLK_WRDQ_DLY_ADJ ((94 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x00000000 */ +#define NV_SI_RO_BOARD_DDR_RDDQS_DQ_DLY_ADJ ((95 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x00000000 */ +#define NV_SI_RO_BOARD_DDR_PHY_VREF_ADJ ((96 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x00000000 */ +#define NV_SI_RO_BOARD_DDR_DRAM_VREF_ADJ ((97 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x00000000 */ +#define NV_SI_RO_BOARD_DDR_WR_PREAMBLE_CYCLE ((98 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x02010201 */ +#define NV_SI_RO_BOARD_DDR_ADCMD_2T_MODE ((99 * 8) + NV_B= OARD_PARAM_START) /* Default: 0x00000000 */ +#define NV_SI_RO_BOARD_I2C_VRD_CONFIG_INFO ((100 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_DDR_PHY_FEATURE_CTRL ((101 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x00000000 */ +#define NV_SI_RO_BOARD_BMC_HANDSHAKE_SPI_ACCESS ((102 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x01050106 */ +#define NV_SI_RO_BOARD_DIMM_TEMP_THRESHOLD ((103 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x5F4 */ +#define NV_SI_RO_BOARD_DIMM_SPD_COMPARE_DISABLE ((104 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x0 */ +#define NV_SI_RO_BOARD_S0_PCIE_CLK_CFG ((105 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S0_RCA4_CFG ((106 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x02020202 */ +#define NV_SI_RO_BOARD_S0_RCA5_CFG ((107 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x02020202 */ +#define NV_SI_RO_BOARD_S0_RCA6_CFG ((108 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x02020202 */ +#define NV_SI_RO_BOARD_S0_RCA7_CFG ((109 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x02020003 */ +#define NV_SI_RO_BOARD_S0_RCA0_TXRX_G3PRESET ((110 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S0_RCA1_TXRX_G3PRESET ((111 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S0_RCA2_TXRX_G3PRESET ((112 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S0_RCA3_TXRX_G3PRESET ((113 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S0_RCB0A_TXRX_G3PRESET ((114 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S0_RCB0B_TXRX_G3PRESET ((115 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S0_RCB1A_TXRX_G3PRESET ((116 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S0_RCB1B_TXRX_G3PRESET ((117 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S0_RCB2A_TXRX_G3PRESET ((118 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S0_RCB2B_TXRX_G3PRESET ((119 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S0_RCB3A_TXRX_G3PRESET ((120 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S0_RCB3B_TXRX_G3PRESET ((121 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S0_RCA4_TXRX_G3PRESET ((122 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S0_RCA5_TXRX_G3PRESET ((123 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S0_RCA6_TXRX_G3PRESET ((124 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S0_RCA7_TXRX_G3PRESET ((125 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S0_RCA0_TXRX_G4PRESET ((126 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S0_RCA1_TXRX_G4PRESET ((127 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S0_RCA2_TXRX_G4PRESET ((128 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S0_RCA3_TXRX_G4PRESET ((129 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S0_RCB0A_TXRX_G4PRESET ((130 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S0_RCB0B_TXRX_G4PRESET ((131 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S0_RCB1A_TXRX_G4PRESET ((132 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S0_RCB1B_TXRX_G4PRESET ((133 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S0_RCB2A_TXRX_G4PRESET ((134 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S0_RCB2B_TXRX_G4PRESET ((135 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S0_RCB3A_TXRX_G4PRESET ((136 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S0_RCB3B_TXRX_G4PRESET ((137 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S0_RCA4_TXRX_G4PRESET ((138 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S0_RCA5_TXRX_G4PRESET ((139 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S0_RCA6_TXRX_G4PRESET ((140 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S0_RCA7_TXRX_G4PRESET ((141 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S1_PCIE_CLK_CFG ((142 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S1_RCA4_CFG ((143 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x02020202 */ +#define NV_SI_RO_BOARD_S1_RCA5_CFG ((144 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x02020202 */ +#define NV_SI_RO_BOARD_S1_RCA6_CFG ((145 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x02020202 */ +#define NV_SI_RO_BOARD_S1_RCA7_CFG ((146 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x02020003 */ +#define NV_SI_RO_BOARD_S1_RCA2_TXRX_G3PRESET ((147 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S1_RCA3_TXRX_G3PRESET ((148 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S1_RCB0A_TXRX_G3PRESET ((149 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S1_RCB0B_TXRX_G3PRESET ((150 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S1_RCB1A_TXRX_G3PRESET ((151 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S1_RCB1B_TXRX_G3PRESET ((152 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S1_RCB2A_TXRX_G3PRESET ((153 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S1_RCB2B_TXRX_G3PRESET ((154 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S1_RCB3A_TXRX_G3PRESET ((155 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S1_RCB3B_TXRX_G3PRESET ((156 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S1_RCA4_TXRX_G3PRESET ((157 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S1_RCA5_TXRX_G3PRESET ((158 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S1_RCA6_TXRX_G3PRESET ((159 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S1_RCA7_TXRX_G3PRESET ((160 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_S1_RCA2_TXRX_G4PRESET ((161 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S1_RCA3_TXRX_G4PRESET ((162 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S1_RCB0A_TXRX_G4PRESET ((163 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S1_RCB0B_TXRX_G4PRESET ((164 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S1_RCB1A_TXRX_G4PRESET ((165 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S1_RCB1B_TXRX_G4PRESET ((166 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S1_RCB2A_TXRX_G4PRESET ((167 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S1_RCB2B_TXRX_G4PRESET ((168 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S1_RCB3A_TXRX_G4PRESET ((169 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S1_RCB3B_TXRX_G4PRESET ((170 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S1_RCA4_TXRX_G4PRESET ((171 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S1_RCA5_TXRX_G4PRESET ((172 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S1_RCA6_TXRX_G4PRESET ((173 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_S1_RCA7_TXRX_G4PRESET ((174 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x57575757 */ +#define NV_SI_RO_BOARD_2P_CE_MASK_THRESHOLD ((175 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x00000003 */ +#define NV_SI_RO_BOARD_2P_CE_MASK_INTERVAL ((176 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x000001A4 */ +#define NV_SI_RO_BOARD_SX_PHY_CFG_SETTING ((177 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_DDR_PHY_DC_CLK ((178 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x00018000 */ +#define NV_SI_RO_BOARD_DDR_PHY_DC_DATA ((179 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x80018000 */ +#define NV_SI_RO_BOARD_SX_RCA0_TXRX_20GPRESET ((180 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_SX_RCA1_TXRX_20GPRESET ((181 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_SX_RCA2_TXRX_20GPRESET ((182 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_SX_RCA3_TXRX_20GPRESET ((183 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_SX_RCA0_TXRX_25GPRESET ((184 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_SX_RCA1_TXRX_25GPRESET ((185 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_SX_RCA2_TXRX_25GPRESET ((186 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_SX_RCA3_TXRX_25GPRESET ((187 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_DDR_2X_REFRESH_TEMP_THRESHOLD ((188 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x00550055 */ +#define NV_SI_RO_BOARD_PCP_VRD_VOUT_WAIT_US ((189 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x00000064 */ +#define NV_SI_RO_BOARD_PCP_VRD_VOUT_RESOLUTION_MV ((190 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x00000005 */ +#define NV_SI_RO_BOARD_DVFS_VOLT_READ_BACK_EN ((191 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x00000001 */ +#define NV_SI_RO_BOARD_DVFS_VOLT_READ_BACK_TIME ((192 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x00000002 */ +#define NV_SI_RO_BOARD_DVFS_VOUT_20MV_RAMP_TIME_US ((193 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x00000005 */ +#define NV_SI_RO_BOARD_PCIE_AER_FW_FIRST ((194 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x00000000 */ +#define NV_SI_RO_BOARD_RTC_GPI_LOCK_BYPASS ((195 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x00000000 */ +#define NV_SI_RO_BOARD_TPM_DISABLE ((196 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_MESH_S0_CXG_RC_STRONG_ORDERING_EN ((197 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x00000000 */ +#define NV_SI_RO_BOARD_MESH_S1_CXG_RC_STRONG_ORDERING_EN ((198 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x00000000 */ +#define NV_SI_RO_BOARD_GPIO_SW_WATCHDOG_EN ((199 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x00000000 */ +#define NV_SI_RO_BOARD_PCIE_HP_DISABLE ((200 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x00000000 */ +#define NV_SI_RO_BOARD_I2C_VRD_VOUT_FORMAT ((201 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x00000000 */ +#define NV_SI_RO_BOARD_I2C_VRD_SMBUS_CMD_FLAGS ((202 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x00000000 */ +#define NV_SI_RO_BOARD_CUST_SPM_LOCATION ((203 * 8) + NV_= BOARD_PARAM_START) +#define NV_SI_RO_BOARD_RAS_DDR_CE_WINDOW ((204 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x00000000 */ +#define NV_SI_RO_BOARD_RAS_DDR_CE_TH1 ((205 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x000001F4 */ +#define NV_SI_RO_BOARD_RAS_DDR_CE_TH2 ((206 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x00001388 */ +#define NV_SI_RO_BOARD_RAS_DDR_CE_THC ((207 * 8) + NV_= BOARD_PARAM_START) /* Default: 0x00000000 */ +#define NV_PMPRO_REGION4_LOAD_END (NV_SI_RO_BOARD_= RAS_DDR_CE_THC) +// +// NOTE: Add before NV_BOARD_PARAM_MAX and increase its value +// +#define NV_BOARD_PARAM_MAX ((207 * 8) + NV_= BOARD_PARAM_START) + +typedef UINT32 NVPARAM; + +#endif /* NVPARAMDEF_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h b/Silico= n/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h new file mode 100644 index 000000000000..c5774dca7a0a --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h @@ -0,0 +1,62 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef PLATFORM_AC01_H_ +#define PLATFORM_AC01_H_ + +// +// Number of supported sockets in the platform +// +#define PLATFORM_CPU_MAX_SOCKET 2 + +// +// Maximum number of CPMs in the chip. +// +#define PLATFORM_CPU_MAX_CPM (FixedPcdGet32 (PcdClusterCount)) + +// +// Number of cores per CPM. +// +#define PLATFORM_CPU_NUM_CORES_PER_CPM (FixedPcdGet32 (PcdCoreCount) / = PLATFORM_CPU_MAX_CPM) + +// +// Maximum number of cores supported. +// +#define PLATFORM_CPU_MAX_NUM_CORES (PLATFORM_CPU_MAX_SOCKET * PLATF= ORM_CPU_MAX_CPM * PLATFORM_CPU_NUM_CORES_PER_CPM) + +// +// Maximum number of memory region +// +#define PLATFORM_DRAM_INFO_MAX_REGION 16 + +// +// Maximum number of DDR slots supported +// +#define PLATFORM_DIMM_INFO_MAX_SLOT 32 + +// +// CSR Address base for slave socket +// +#define SLAVE_SOCKET_BASE_ADDRESS_OFFSET 0x400000000000 + +// +// SMpro EFUSE Shadow register +// +#define SMPRO_EFUSE_SHADOW0 (FixedPcdGet64 (PcdSmproEfuseSha= dow0)) + +// +// 2P Configuration Register +// +#define CFG2P_OFFSET 0x200 + +// +// Slave socket present +// +#define SLAVE_PRESENT_N BIT1 + +#endif /* PLATFORM_AC01_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/PlatformM= emoryMap.h b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/PlatformM= emoryMap.h new file mode 100644 index 000000000000..23b52653f30b --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/PlatformMemoryMa= p.h @@ -0,0 +1,135 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef PLATFORM_MEMORY_MAP_H_ +#define PLATFORM_MEMORY_MAP_H_ + +//******************************************************************* +// Platform Memory Map +//******************************************************************* +// +// Device Memory (Socket 0) +// +#define AC01_DEVICE_MEMORY_S0_BASE 0x100000000000ULL +#define AC01_DEVICE_MEMORY_S0_SIZE 0x102000000ULL + +// +// Device Memory (Socket 1) +// +#define AC01_DEVICE_MEMORY_S1_BASE 0x500000000000ULL +#define AC01_DEVICE_MEMORY_S1_SIZE 0x101000000ULL + +// +// BERT memory +// +#define AC01_BERT_MEMORY_BASE 0x88230000ULL +#define AC01_BERT_MEMORY_SIZE 0x50000ULL + +//******************************************************************* +// Socket 0 PCIe Device Memory +//******************************************************************* +// +// PCIe RCA0 Device memory +// +#define AC01_RCA0_DEVICE_MEMORY_S0_BASE 0x33FFE0000000ULL +#define AC01_RCA0_DEVICE_MEMORY_S0_SIZE 0x000020000000ULL + +// +// PCIe RCA1 Device memory +// +#define AC01_RCA1_DEVICE_MEMORY_S0_BASE 0x37FFE0000000ULL +#define AC01_RCA1_DEVICE_MEMORY_S0_SIZE 0x000020000000ULL + +// +// PCIe RCA2 Device memory +// +#define AC01_RCA2_DEVICE_MEMORY_S0_BASE 0x3BFFE0000000ULL +#define AC01_RCA2_DEVICE_MEMORY_S0_SIZE 0x000020000000ULL + +// +// PCIe RCA3 Device memory +// +#define AC01_RCA3_DEVICE_MEMORY_S0_BASE 0x3FFFE0000000ULL +#define AC01_RCA3_DEVICE_MEMORY_S0_SIZE 0x000020000000ULL + +// +// PCIe RCB0 Device memory +// +#define AC01_RCB0_DEVICE_MEMORY_S0_BASE 0x23FFE0000000ULL +#define AC01_RCB0_DEVICE_MEMORY_S0_SIZE 0x000020000000ULL + +// +// PCIe RCB1 Device memory +// +#define AC01_RCB1_DEVICE_MEMORY_S0_BASE 0x27FFE0000000ULL +#define AC01_RCB1_DEVICE_MEMORY_S0_SIZE 0x000020000000ULL + +// +// PCIe RCB2 Device memory +// +#define AC01_RCB2_DEVICE_MEMORY_S0_BASE 0x2BFFE0000000ULL +#define AC01_RCB2_DEVICE_MEMORY_S0_SIZE 0x000020000000ULL + +// +// PCIe RCB3 Device memory +// +#define AC01_RCB3_DEVICE_MEMORY_S0_BASE 0x2FFFE0000000ULL +#define AC01_RCB3_DEVICE_MEMORY_S0_SIZE 0x000020000000ULL + +//******************************************************************* +// Socket 1 PCIe Device Memory +//******************************************************************* +// +// PCIe RCA0 Device memory +// +#define AC01_RCA0_DEVICE_MEMORY_S1_BASE 0x73FFE0000000ULL +#define AC01_RCA0_DEVICE_MEMORY_S1_SIZE 0x000020000000ULL + +// +// PCIe RCA1 Device memory +// +#define AC01_RCA1_DEVICE_MEMORY_S1_BASE 0x77FFE0000000ULL +#define AC01_RCA1_DEVICE_MEMORY_S1_SIZE 0x000020000000ULL + +// +// PCIe RCA2 Device memory +// +#define AC01_RCA2_DEVICE_MEMORY_S1_BASE 0x7BFFE0000000ULL +#define AC01_RCA2_DEVICE_MEMORY_S1_SIZE 0x000020000000ULL + +// +// PCIe RCA3 Device memory +// +#define AC01_RCA3_DEVICE_MEMORY_S1_BASE 0x7FFFE0000000ULL +#define AC01_RCA3_DEVICE_MEMORY_S1_SIZE 0x000020000000ULL + +// +// PCIe RCB0 Device memory +// +#define AC01_RCB0_DEVICE_MEMORY_S1_BASE 0x63FFE0000000ULL +#define AC01_RCB0_DEVICE_MEMORY_S1_SIZE 0x000020000000ULL + +// +// PCIe RCB1 Device memory +// +#define AC01_RCB1_DEVICE_MEMORY_S1_BASE 0x67FFE0000000ULL +#define AC01_RCB1_DEVICE_MEMORY_S1_SIZE 0x000020000000ULL + +// +// PCIe RCB2 Device memory +// +#define AC01_RCB2_DEVICE_MEMORY_S1_BASE 0x6BFFE0000000ULL +#define AC01_RCB2_DEVICE_MEMORY_S1_SIZE 0x000020000000ULL + +// +// PCIe RCB3 Device memory +// +#define AC01_RCB3_DEVICE_MEMORY_S1_BASE 0x6FFFE0000000ULL +#define AC01_RCB3_DEVICE_MEMORY_S1_SIZE 0x000020000000ULL + +#endif /* PLATFORM_MEMORY_MAP_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLibCom= mon.h b/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLibCommon.h new file mode 100644 index 000000000000..57b6cccda758 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLibCommon.h @@ -0,0 +1,70 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef NV_PARAM_LIB_COMMON_H_ +#define NV_PARAM_LIB_COMMON_H_ + +#define EFI_MM_MAX_PAYLOAD_SIZE 0x50 + +#define MM_NVPARAM_FUNC_READ 0x01 +#define MM_NVPARAM_FUNC_WRITE 0x02 +#define MM_NVPARAM_FUNC_CLEAR 0x03 +#define MM_NVPARAM_FUNC_CLEAR_ALL 0x04 + +#define MM_NVPARAM_RES_SUCCESS 0xAABBCC00 +#define MM_NVPARAM_RES_NOT_SET 0xAABBCC01 +#define MM_NVPARAM_RES_NO_PERM 0xAABBCC02 +#define MM_NVPARAM_RES_FAIL 0xAABBCCFF + +#pragma pack (1) + +typedef struct { + // + // Allows for disambiguation of the message format. + // + EFI_GUID HeaderGuid; + + // + // Describes the size of Data (in bytes) and does not include the size o= f the header. + // + UINTN MessageLength; + + // + // Designates an array of bytes that is MessageLength in size. + // + UINT8 Data[EFI_MM_MAX_PAYLOAD_SIZE]; +} EFI_MM_COMMUNICATE_REQUEST; + +typedef struct { + UINT64 Status; + UINT64 Value; +} EFI_MM_COMMUNICATE_NVPARAM_RESPONSE; + +#pragma pack () + +/** + Provides an interface to access the NVParam services via MM interface. + + @param[in] Request Pointer to the request buffer + @param[in] RequestDataSize Size of the request buffer. + @param[out] Response Pointer to the response buffer + @param[in] ResponseDataSize Size of the response buffer. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER An invalid data parameter or an invalid + combination of data parameters. + @retval Others An error has occurred. +**/ +EFI_STATUS +NVParamMmCommunicate ( + IN VOID *Request, + IN UINT32 RequestDataSize, + OUT VOID *Response, + IN UINT32 ResponseDataSize + ); +#endif /* NV_PARAM_LIB_COMMON_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.c b= /Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.c new file mode 100644 index 000000000000..c8ea60dc7a8b --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.c @@ -0,0 +1,51 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +VOID +BuildPlatformInformationHob ( + VOID + ) +{ + VOID *Hob; + + /* The ATF HOB handoff base is at PcdSystemMemoryBase */ + Hob =3D GetNextGuidHob ( + &gPlatformInfoHobGuid, + (CONST VOID *)FixedPcdGet64 (PcdSystemMemoryBase) + ); + if (Hob !=3D NULL) { + BuildGuidDataHob ( + &gPlatformInfoHobGuid, + GET_GUID_HOB_DATA (Hob), + GET_GUID_HOB_DATA_SIZE (Hob) + ); + } +} + +EFI_STATUS +EFIAPI +InitializeATFHobPeim ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + BuildPlatformInformationHob (); + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLi= b.c b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.c new file mode 100644 index 000000000000..ecb03b1ee333 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.c @@ -0,0 +1,42 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include + +#include +#include +#include +#include + +VOID *mPlatformInfoHob =3D NULL; + +/** + Get the platform HOB data. + + @return PLATFORM_INFO_HOB The pointer to the platform HOB data. + +**/ +PLATFORM_INFO_HOB * +GetPlatformHob ( + VOID + ) +{ + if (mPlatformInfoHob =3D=3D NULL) { + mPlatformInfoHob =3D GetNextGuidHob ( + &gPlatformInfoHobGuid, + (CONST VOID *)FixedPcdGet64 (PcdSystemMemoryBase) + ); + if (mPlatformInfoHob =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "%a: Failed to get gPlatformInfoHobGuid!\n", __= FUNCTION__)); + return NULL; + } + } + + return ((PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (mPlatformInfoHob)); +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLi= bCommon.c b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib= Common.c new file mode 100644 index 000000000000..9eebea3de1b5 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLibCommon= .c @@ -0,0 +1,637 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +PLATFORM_INFO_HOB * +GetPlatformHob ( + VOID + ); + +/** + Get current CPU frequency. + + @param Socket Socket index. + @return UINTN Current CPU frequency. + +**/ +UINTN +EFIAPI +CpuGetCurrentFreq ( + UINT8 Socket + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + + PlatformHob =3D GetPlatformHob (); + ASSERT (PlatformHob !=3D NULL); + + return PlatformHob->CpuClk; +} + +/** + Get maximum CPU frequency. + + @param Socket Socket index. + @return UINTN Maximum CPU frequency. + +**/ +UINTN +EFIAPI +CpuGetMaxFreq ( + UINT8 Socket + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + + PlatformHob =3D GetPlatformHob (); + ASSERT (PlatformHob !=3D NULL); + + if (PlatformHob->TurboCapability[Socket]) { + return PlatformHob->TurboFrequency[Socket]; + } + + return PlatformHob->CpuClk; +} + +/** + Get CPU voltage. + + @param Socket Socket index. + @return UINT8 CPU voltage. + +**/ +UINT8 +EFIAPI +CpuGetVoltage ( + UINT8 Socket + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + UINT8 Voltage; + + PlatformHob =3D GetPlatformHob (); + ASSERT (PlatformHob !=3D NULL); + + Voltage =3D 0x80 | (PlatformHob->CoreVoltage[Socket] / 100); + + return Voltage; +} + +/** + Get the SubNUMA mode. + + @return UINT8 The SubNUMA mode. + +**/ +UINT8 +EFIAPI +CpuGetSubNumaMode ( + VOID + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + + PlatformHob =3D GetPlatformHob (); + if (PlatformHob =3D=3D NULL) { + return SUBNUMA_MODE_MONOLITHIC; + } + + return PlatformHob->SubNumaMode[0]; +} + +/** + Get the number of SubNUMA region. + + @return UINT8 The number of SubNUMA region. + +**/ +UINT8 +EFIAPI +CpuGetNumberOfSubNumaRegion ( + VOID + ) +{ + UINT8 SubNumaMode; + UINT8 NumberOfSubNumaRegion; + + SubNumaMode =3D CpuGetSubNumaMode (); + ASSERT (SubNumaMode <=3D SUBNUMA_MODE_QUADRANT); + + switch (SubNumaMode) { + case SUBNUMA_MODE_MONOLITHIC: + NumberOfSubNumaRegion =3D MONOLITIC_NUM_OF_REGION; + break; + + case SUBNUMA_MODE_HEMISPHERE: + NumberOfSubNumaRegion =3D HEMISPHERE_NUM_OF_REGION; + break; + + case SUBNUMA_MODE_QUADRANT: + NumberOfSubNumaRegion =3D QUADRANT_NUM_OF_REGION; + break; + + default: + // Should never reach there. + NumberOfSubNumaRegion =3D 0; + ASSERT (FALSE); + break; + } + + return NumberOfSubNumaRegion; +} + +/** + Get the SubNUMA node of a CPM. + + @param SocketId Socket index. + @param Cpm CPM index. + @return UINT8 The SubNUMA node of a CPM. + +**/ +UINT8 +EFIAPI +CpuGetSubNumNode ( + UINT8 SocketId, + UINT16 Cpm + ) +{ + BOOLEAN IsAsymMesh; + UINT8 SubNumaNode; + UINT16 MaxNumberOfCPM; + UINT8 MiddleRow; + UINT8 QuadrantHigherRowNodeNumber[NUM_OF_CPM_PER_MESH_ROW] =3D {1, 1, = 1, 1, 3, 3, 3, 3}; + UINT8 QuadrantLowerRowNodeNumber[NUM_OF_CPM_PER_MESH_ROW] =3D {0, 0, = 0, 0, 2, 2, 2, 2}; + UINT8 QuadrantMiddleRowNodeNumber[NUM_OF_CPM_PER_MESH_ROW] =3D {0, 0, = 1, 1, 3, 3, 2, 2}; + UINT8 SubNumaMode; + + MaxNumberOfCPM =3D GetMaximumNumberOfCPMs (); + SubNumaMode =3D CpuGetSubNumaMode (); + ASSERT (SubNumaMode <=3D SUBNUMA_MODE_QUADRANT); + + switch (SubNumaMode) { + case SUBNUMA_MODE_MONOLITHIC: + SubNumaNode =3D (SocketId =3D=3D 0) ? 0 : 1; + break; + + case SUBNUMA_MODE_HEMISPHERE: + if (CPM_PER_ROW_OFFSET (Cpm) >=3D SUBNUMA_CPM_REGION_SIZE) { + SubNumaNode =3D 1; + } else { + SubNumaNode =3D 0; + } + + if (SocketId =3D=3D 1) { + SubNumaNode +=3D HEMISPHERE_NUM_OF_REGION; + } + break; + + case SUBNUMA_MODE_QUADRANT: + // + // CPM Mesh Rows + // + // |---------------------------------------| + // | 00 ----------- 03 | 04 ----------- 07 | Row 0 + // |-------------------|-------------------| + // | 08 ----------- 11 | 12 ----------- 15 | Row 1 + // |-------------------|-------------------| + // | 16 - 17 | 18 - 19 | 20 - 21 | 22 - 23 | Middle Row + // |-------------------|-------------------| + // | 24 ----------- 27 | 28 ----------- 31 | Row 3 + // |-------------------|-------------------| + // | 32 ----------- 35 | 36 ----------- 39 | Row 4 + // |---------------------------------------| + // + + IsAsymMesh =3D (BOOLEAN)(CPM_ROW_NUMBER (MaxNumberOfCPM) % 2 !=3D 0); + MiddleRow =3D CPM_ROW_NUMBER (MaxNumberOfCPM) / 2; + if (IsAsymMesh + && CPM_ROW_NUMBER (Cpm) =3D=3D MiddleRow) + { + SubNumaNode =3D QuadrantMiddleRowNodeNumber[CPM_PER_ROW_OFFSET (Cpm)= ]; + + } else if (CPM_ROW_NUMBER (Cpm) >=3D MiddleRow) { + SubNumaNode =3D QuadrantHigherRowNodeNumber[CPM_PER_ROW_OFFSET (Cpm)= ]; + + } else { + SubNumaNode =3D QuadrantLowerRowNodeNumber[CPM_PER_ROW_OFFSET (Cpm)]; + } + + if (SocketId =3D=3D 1) { + SubNumaNode +=3D QUADRANT_NUM_OF_REGION; + } + break; + + default: + // Should never reach there. + SubNumaNode =3D 0; + ASSERT (FALSE); + break; + } + + return SubNumaNode; +} + +/** + Get the number of supported socket. + + @return UINT8 Number of supported socket. + +**/ +UINT8 +EFIAPI +GetNumberOfSupportedSockets ( + VOID + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + + PlatformHob =3D GetPlatformHob (); + if (PlatformHob =3D=3D NULL) { + // + // By default, the number of supported sockets is 1. + // + return 1; + } + + return (sizeof (PlatformHob->ClusterEn) / sizeof (PLATFORM_CLUSTER_EN)); +} + +/** + Get the number of active socket. + + @return UINT8 Number of active socket. + +**/ +UINT8 +EFIAPI +GetNumberOfActiveSockets ( + VOID + ) +{ + UINT8 NumberOfActiveSockets, Count, Index, Index1; + PLATFORM_CLUSTER_EN *Socket; + PLATFORM_INFO_HOB *PlatformHob; + + PlatformHob =3D GetPlatformHob (); + if (PlatformHob =3D=3D NULL) { + // + // By default, the number of active sockets is 1. + // + return 1; + } + + NumberOfActiveSockets =3D 0; + + for (Index =3D 0; Index < GetNumberOfSupportedSockets (); Index++) { + Socket =3D &PlatformHob->ClusterEn[Index]; + Count =3D ARRAY_SIZE (Socket->EnableMask); + for (Index1 =3D 0; Index1 < Count; Index1++) { + if (Socket->EnableMask[Index1] !=3D 0) { + NumberOfActiveSockets++; + break; + } + } + } + + return NumberOfActiveSockets; +} + +/** + Get the number of active CPM per socket. + + @param SocketId Socket index. + @return UINT16 Number of CPM. + +**/ +UINT16 +EFIAPI +GetNumberOfActiveCPMsPerSocket ( + UINT8 SocketId + ) +{ + UINT16 NumberOfCPMs, Count, Index; + UINT32 Val32; + PLATFORM_CLUSTER_EN *Socket; + PLATFORM_INFO_HOB *PlatformHob; + + PlatformHob =3D GetPlatformHob (); + if (PlatformHob =3D=3D NULL) { + return 0; + } + + if (SocketId >=3D GetNumberOfActiveSockets ()) { + return 0; + } + + NumberOfCPMs =3D 0; + Socket =3D &PlatformHob->ClusterEn[SocketId]; + Count =3D ARRAY_SIZE (Socket->EnableMask); + for (Index =3D 0; Index < Count; Index++) { + Val32 =3D Socket->EnableMask[Index]; + while (Val32 > 0) { + if ((Val32 & 0x1) !=3D 0) { + NumberOfCPMs++; + } + Val32 >>=3D 1; + } + } + + return NumberOfCPMs; +} + +/** + Get the number of configured CPM per socket. This number + should be the same for all sockets. + + @param SocketId Socket index. + @return UINT8 Number of configured CPM. + +**/ +UINT16 +EFIAPI +GetNumberOfConfiguredCPMs ( + UINT8 SocketId + ) +{ + EFI_STATUS Status; + UINT32 Value; + UINT32 Param, ParamStart, ParamEnd; + UINT16 Count; + + Count =3D 0; + ParamStart =3D NV_SI_S0_PCP_ACTIVECPM_0_31 + SocketId * NV_PARAM_ENTRYSI= ZE * (PLATFORM_CPU_MAX_CPM / 32); + ParamEnd =3D ParamStart + NV_PARAM_ENTRYSIZE * (PLATFORM_CPU_MAX_CPM / 3= 2); + for (Param =3D ParamStart; Param < ParamEnd; Param +=3D NV_PARAM_ENTRYSI= ZE) { + Status =3D NVParamGet ( + Param, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + break; + } + while (Value !=3D 0) { + if ((Value & 0x01) !=3D 0) { + Count++; + } + Value >>=3D 1; + } + } + + return Count; +} + +/** + Set the number of configured CPM per socket. + + @param SocketId Socket index. + @param NumberOfCPMs Number of CPM to be configured. + @return EFI_SUCCESS Operation succeeded. + @return Others An error has occurred. + +**/ +EFI_STATUS +EFIAPI +SetNumberOfConfiguredCPMs ( + UINT8 SocketId, + UINT16 NumberOfCPMs + ) +{ + EFI_STATUS Status; + UINT32 Value; + UINT32 Param, ParamStart, ParamEnd; + BOOLEAN IsClear; + + IsClear =3D FALSE; + if (NumberOfCPMs =3D=3D 0) { + IsClear =3D TRUE; + } + + Status =3D EFI_SUCCESS; + + ParamStart =3D NV_SI_S0_PCP_ACTIVECPM_0_31 + SocketId * NV_PARAM_ENTRYSI= ZE * (PLATFORM_CPU_MAX_CPM / 32); + ParamEnd =3D ParamStart + NV_PARAM_ENTRYSIZE * (PLATFORM_CPU_MAX_CPM / 3= 2); + for (Param =3D ParamStart; Param < ParamEnd; Param +=3D NV_PARAM_ENTRYSI= ZE) { + if (NumberOfCPMs >=3D 32) { + Value =3D 0xffffffff; + NumberOfCPMs -=3D 32; + } else { + Value =3D 0; + while (NumberOfCPMs > 0) { + Value |=3D (1 << (--NumberOfCPMs)); + } + } + if (IsClear) { + /* Clear this param */ + Status =3D NVParamClr ( + Param, + NV_PERM_BIOS | NV_PERM_MANU + ); + } else { + Status =3D NVParamSet ( + Param, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Value + ); + } + } + + return Status; +} + +/** + Get the maximum number of core per socket. + + @return UINT16 Maximum number of core. + +**/ +UINT16 +EFIAPI +GetMaximumNumberOfCores ( + VOID + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + + PlatformHob =3D GetPlatformHob (); + if (PlatformHob =3D=3D NULL) { + return 0; + } + + return PlatformHob->MaxNumOfCore[0]; +} + +/** + Get the maximum number of CPM per socket. This number + should be the same for all sockets. + + @return UINT16 Maximum number of CPM. + +**/ +UINT16 +EFIAPI +GetMaximumNumberOfCPMs ( + VOID + ) +{ + return GetMaximumNumberOfCores () / PLATFORM_CPU_NUM_CORES_PER_CPM; +} + +/** + Get the number of active cores of a sockets. + + @param SocketId Socket Index. + @return UINT16 Number of active core. + +**/ +UINT16 +EFIAPI +GetNumberOfActiveCoresPerSocket ( + UINT8 SocketId + ) +{ + return GetNumberOfActiveCPMsPerSocket (SocketId) * PLATFORM_CPU_NUM_CORE= S_PER_CPM; +} + +/** + Get the number of active cores of all sockets. + + @return UINT16 Number of active core. + +**/ +UINT16 +EFIAPI +GetNumberOfActiveCores ( + VOID + ) +{ + UINT16 NumberOfActiveCores; + UINT8 Index; + + NumberOfActiveCores =3D 0; + + for (Index =3D 0; Index < GetNumberOfActiveSockets (); Index++) { + NumberOfActiveCores +=3D GetNumberOfActiveCoresPerSocket (Index); + } + + return NumberOfActiveCores; +} + +/** + Check if the logical CPU is enabled or not. + + @param CpuId The logical Cpu ID. Started from 0. + @return BOOLEAN TRUE if the Cpu enabled + FALSE if the Cpu disabled. + +**/ +BOOLEAN +EFIAPI +IsCpuEnabled ( + UINT16 CpuId + ) +{ + PLATFORM_CLUSTER_EN *Socket; + PLATFORM_INFO_HOB *PlatformHob; + UINT8 SocketId; + UINT16 ClusterId; + + SocketId =3D SOCKET_ID (CpuId); + ClusterId =3D CLUSTER_ID (CpuId); + + PlatformHob =3D GetPlatformHob (); + if (PlatformHob =3D=3D NULL) { + return FALSE; + } + + if (SocketId >=3D GetNumberOfActiveSockets ()) { + return FALSE; + } + + Socket =3D &PlatformHob->ClusterEn[SocketId]; + if ((Socket->EnableMask[ClusterId / 32] & (1 << (ClusterId % 32))) !=3D = 0) { + return TRUE; + } + + return FALSE; +} + +/** + Check if the slave socket is present + + @return BOOLEAN TRUE if the Slave Cpu is present + FALSE if the Slave Cpu is not present + +**/ +BOOLEAN +EFIAPI +IsSlaveSocketAvailable ( + VOID + ) +{ + UINT32 Value; + + Value =3D MmioRead32 (SMPRO_EFUSE_SHADOW0 + CFG2P_OFFSET); + + return ((Value & SLAVE_PRESENT_N) !=3D 0) ? FALSE : TRUE; +} + +/** + Check if the slave socket is active + + @return BOOLEAN TRUE if the Slave CPU Socket is active. + FALSE if the Slave CPU Socket is not active. + +**/ +BOOLEAN +EFIAPI +IsSlaveSocketActive ( + VOID + ) +{ + return (GetNumberOfActiveSockets () > 1) ? TRUE : FALSE; +} + +/** + Check if the CPU product ID is Ac01 + @return BOOLEAN TRUE if the Product ID is Ac01 + FALSE otherwise. + +**/ +BOOLEAN +EFIAPI +IsAc01Processor ( + VOID + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + + PlatformHob =3D GetPlatformHob (); + ASSERT (PlatformHob !=3D NULL); + + if (PlatformHob !=3D NULL) { + if ((PlatformHob->ScuProductId[0] & 0xFF) =3D=3D 0x01) { + return TRUE; + } + } + + return FALSE; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAmpe= reCpuLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAmpe= reCpuLib.c new file mode 100644 index 000000000000..5e8354422912 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAmpereCpuLi= b.c @@ -0,0 +1,137 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +EFI_EVENT mRuntimeAmpereCpuLibVirtualNotifyEvent =3D NULL; +VOID *mPlatformInfoHob =3D NULL; + +/** + Get the platform HOB data. + + @return PLATFORM_INFO_HOB The pointer to the platform HOB data. + +**/ +PLATFORM_INFO_HOB * +GetPlatformHob ( + VOID + ) +{ + ASSERT (mPlatformInfoHob !=3D NULL); + return (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (mPlatformInfoHob); +} + +/** + Notification function of EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE. + + @param Event Event whose notification function is being invoked. + @param Context Pointer to the notification function's context + +**/ +VOID +EFIAPI +RuntimeAmpereCpuLibVirtualNotify ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + + // + // Convert the platform HOB address to a virtual address. + // + Status =3D EfiConvertPointer (0, (VOID **)&mPlatformInfoHob); + + ASSERT_EFI_ERROR (Status); +} + +/** + Constructor of Runtime Ampere CPU Library Instance. + + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The constructor completed successfully. + @retval Others The constructor did not complete successfully. + +**/ +EFI_STATUS +EFIAPI +RuntimeAmpereCpuLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + VOID *Hob; + + Hob =3D GetNextGuidHob ( + &gPlatformInfoHobGuid, + (CONST VOID *)FixedPcdGet64 (PcdSystemMemoryBase) + ); + if (Hob =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "%a: Failed to get gPlatformInfoHobGuid!\n", __FU= NCTION__)); + return EFI_DEVICE_ERROR; + } + + mPlatformInfoHob =3D AllocateRuntimeCopyPool (sizeof (PLATFORM_INFO_HOB)= , Hob); + ASSERT (mPlatformInfoHob !=3D NULL); + + // + // Register notify function for EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE + // + Status =3D gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + RuntimeAmpereCpuLibVirtualNotify, + NULL, + &gEfiEventVirtualAddressChangeGuid, + &mRuntimeAmpereCpuLibVirtualNotifyEvent + ); + ASSERT_EFI_ERROR (Status); + + return Status; +} + +/** + Destructor of Runtime Ampere CPU Library Instance. + + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The destructor completed successfully. + @retval Others The destructor did not complete successfully. + +**/ +EFI_STATUS +EFIAPI +RuntimeAmpereCpuLibDestructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + // + // Close the Set Virtual Address Map event + // + Status =3D gBS->CloseEvent (mRuntimeAmpereCpuLibVirtualNotifyEvent); + ASSERT_EFI_ERROR (Status); + + return Status; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatfo= rmLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformL= ib.c new file mode 100644 index 000000000000..5b4be0e55516 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.c @@ -0,0 +1,168 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +ARM_CORE_INFO mArmPlatformMpCoreInfoTable[PLATFORM_CPU_MAX_NUM_CORES]; + +/** + Return the current Boot Mode + + This function returns the boot reason on the platform + + @return Return the current Boot Mode of the platform + +**/ +EFI_BOOT_MODE +ArmPlatformGetBootMode ( + VOID + ) +{ + return BOOT_WITH_FULL_CONFIGURATION; +} + +/** + Initialize controllers that must setup in the normal world + + This function is called by the ArmPlatformPkg/PrePi or ArmPlatformPkg/Pl= atformPei + in the PEI phase. + +**/ +EFI_STATUS +ArmPlatformInitialize ( + IN UINTN MpId + ) +{ + RETURN_STATUS Status; + UINT64 BaudRate; + UINT32 ReceiveFifoDepth; + EFI_PARITY_TYPE Parity; + UINT8 DataBits; + EFI_STOP_BITS_TYPE StopBits; + + Status =3D EFI_SUCCESS; + + if (FixedPcdGet64 (PcdSerialRegisterBase) !=3D 0) { + /* Debug port should use the same parameters with console */ + BaudRate =3D FixedPcdGet64 (PcdUartDefaultBaudRate); + ReceiveFifoDepth =3D FixedPcdGet32 (PcdUartDefaultReceiveFifoDepth); + Parity =3D (EFI_PARITY_TYPE)FixedPcdGet8 (PcdUartDefaultParity); + DataBits =3D FixedPcdGet8 (PcdUartDefaultDataBits); + StopBits =3D (EFI_STOP_BITS_TYPE)FixedPcdGet8 (PcdUartDefaultStopBits); + + /* Initialize uart debug port */ + Status =3D PL011UartInitializePort ( + (UINTN)FixedPcdGet64 (PcdSerialRegisterBase), + FixedPcdGet32 (PL011UartClkInHz), + &BaudRate, + &ReceiveFifoDepth, + &Parity, + &DataBits, + &StopBits + ); + } + + return Status; +} + +EFI_STATUS +PrePeiCoreGetMpCoreInfo ( + OUT UINTN *CoreCount, + OUT ARM_CORE_INFO **ArmCoreTable + ) +{ + UINTN mArmPlatformCoreCount; + UINTN ClusterId; + UINTN SocketId; + UINTN Index; + + ASSERT (CoreCount !=3D NULL); + ASSERT (ArmCoreTable !=3D NULL); + ASSERT (*ArmCoreTable !=3D NULL); + + mArmPlatformCoreCount =3D 0; + for (Index =3D 0; Index < PLATFORM_CPU_MAX_NUM_CORES; Index++) { + if (!IsCpuEnabled (Index)) { + continue; + } + SocketId =3D SOCKET_ID (Index); + ClusterId =3D CLUSTER_ID (Index); + mArmPlatformMpCoreInfoTable[mArmPlatformCoreCount].ClusterId =3D Socke= tId; + mArmPlatformMpCoreInfoTable[mArmPlatformCoreCount].CoreId =3D + (ClusterId << 8) | (Index % PLATFORM_CPU_NUM_CORES_PER_CPM); + mArmPlatformMpCoreInfoTable[mArmPlatformCoreCount].MailboxClearAddress= =3D 0; + mArmPlatformMpCoreInfoTable[mArmPlatformCoreCount].MailboxClearValue = =3D 0; + mArmPlatformMpCoreInfoTable[mArmPlatformCoreCount].MailboxGetAddress = =3D 0; + mArmPlatformMpCoreInfoTable[mArmPlatformCoreCount].MailboxSetAddress = =3D 0; + mArmPlatformCoreCount++; + } + + *CoreCount =3D mArmPlatformCoreCount; + + *ArmCoreTable =3D mArmPlatformMpCoreInfoTable; + ASSERT (*ArmCoreTable !=3D NULL); + + return EFI_SUCCESS; +} + +// Needs to be declared in the file. Otherwise gArmMpCoreInfoPpiGuid is un= defined in the contect of PrePeiCore +EFI_GUID mArmMpCoreInfoPpiGuid =3D ARM_MP_CORE_INFO_PPI_GUID; +ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi =3D { PrePeiCoreGetMpCoreInfo }; + +EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] =3D { + { + EFI_PEI_PPI_DESCRIPTOR_PPI, + &mArmMpCoreInfoPpiGuid, + &mMpCoreInfoPpi + }, +}; + +/** + Return the Platform specific PPIs + + This function exposes the Platform Specific PPIs. They can be used by an= y PrePi modules or passed + to the PeiCore by PrePeiCore. + + @param[out] PpiListSize Size in Bytes of the Platform PPI List + @param[out] PpiList Platform PPI List + +**/ +VOID +ArmPlatformGetPlatformPpiList ( + OUT UINTN *PpiListSize, + OUT EFI_PEI_PPI_DESCRIPTOR **PpiList + ) +{ + ASSERT (PpiListSize !=3D NULL); + ASSERT (PpiList !=3D NULL); + ASSERT (*PpiList !=3D NULL); + + if (ArmIsMpCore ()) { + *PpiListSize =3D sizeof (gPlatformPpiTable); + *PpiList =3D gPlatformPpiTable; + } else { + *PpiListSize =3D 0; + *PpiList =3D NULL; + } +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatfo= rmLibMemory.c b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPla= tformLibMemory.c new file mode 100644 index 000000000000..20c592750231 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLibMe= mory.c @@ -0,0 +1,256 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "PlatformMemoryMap.h" + +/* Number of Virtual Memory Map Descriptors */ +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 50 + +/* DDR attributes */ +#define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_= BACK +#define DDR_ATTRIBUTES_UNCACHED ARM_MEMORY_REGION_ATTRIBUTE_UNCACH= ED_UNBUFFERED + +/** + Return the Virtual Memory Map of your platform + + This Virtual Memory Map is used by MemoryInitPei Module to initialize th= e MMU on your platform. + + @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR = describing a Physical-to- + Virtual Memory mapping. This array mus= t be ended by a zero-filled + entry + +**/ +VOID +ArmPlatformGetVirtualMemoryMap ( + OUT ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap + ) +{ + UINTN Index =3D 0; + ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; + UINT32 NumRegion; + UINTN Count; + VOID *Hob; + PLATFORM_INFO_HOB *PlatformHob; + + Hob =3D GetFirstGuidHob (&gPlatformInfoHobGuid); + ASSERT (Hob !=3D NULL); + if (Hob =3D=3D NULL) { + return; + } + + PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + + ASSERT (VirtualMemoryMap !=3D NULL); + + VirtualMemoryTable =3D (ARM_MEMORY_REGION_DESCRIPTOR *)AllocatePages (EF= I_SIZE_TO_PAGES (sizeof (ARM_MEMORY_REGION_DESCRIPTOR) * MAX_VIRTUAL_MEMORY= _MAP_DESCRIPTORS)); + if (VirtualMemoryTable =3D=3D NULL) { + return; + } + + /* For Address space 0x1000_0000_0000 to 0x1001_00FF_FFFF + * - Device memory + */ + VirtualMemoryTable[Index].PhysicalBase =3D AC01_DEVICE_MEMORY_S0_BASE; + VirtualMemoryTable[Index].VirtualBase =3D AC01_DEVICE_MEMORY_S0_BASE; + VirtualMemoryTable[Index].Length =3D AC01_DEVICE_MEMORY_S0_SIZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_D= EVICE; + + /* For Address space 0x5000_0000_0000 to 0x5001_00FF_FFFF + * - Device memory + */ + if (IsSlaveSocketActive ()) + { + VirtualMemoryTable[++Index].PhysicalBase =3D AC01_DEVICE_MEMORY_S1_BAS= E; + VirtualMemoryTable[Index].VirtualBase =3D AC01_DEVICE_MEMORY_S1_BASE; + VirtualMemoryTable[Index].Length =3D AC01_DEVICE_MEMORY_S1_SIZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE= _DEVICE; + } + + /* + * - PCIe RCA0 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase =3D AC01_RCA0_DEVICE_MEMORY_S0_= BASE; + VirtualMemoryTable[Index].VirtualBase =3D AC01_RCA0_DEVICE_MEMORY_S0_BA= SE; + VirtualMemoryTable[Index].Length =3D AC01_RCA0_DEVICE_MEMORY_S0_SI= ZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_D= EVICE; + + /* + * - PCIe RCA1 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase =3D AC01_RCA1_DEVICE_MEMORY_S0_= BASE; + VirtualMemoryTable[Index].VirtualBase =3D AC01_RCA1_DEVICE_MEMORY_S0_BA= SE; + VirtualMemoryTable[Index].Length =3D AC01_RCA1_DEVICE_MEMORY_S0_SI= ZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_D= EVICE; + + /* + * - PCIe RCA2 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase =3D AC01_RCA2_DEVICE_MEMORY_S0_= BASE; + VirtualMemoryTable[Index].VirtualBase =3D AC01_RCA2_DEVICE_MEMORY_S0_BA= SE; + VirtualMemoryTable[Index].Length =3D AC01_RCA2_DEVICE_MEMORY_S0_SI= ZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_D= EVICE; + + /* + * - PCIe RCA3 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase =3D AC01_RCA3_DEVICE_MEMORY_S0_= BASE; + VirtualMemoryTable[Index].VirtualBase =3D AC01_RCA3_DEVICE_MEMORY_S0_BA= SE; + VirtualMemoryTable[Index].Length =3D AC01_RCA3_DEVICE_MEMORY_S0_SI= ZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_D= EVICE; + + /* + * - PCIe RCB0 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase =3D AC01_RCB0_DEVICE_MEMORY_S0_= BASE; + VirtualMemoryTable[Index].VirtualBase =3D AC01_RCB0_DEVICE_MEMORY_S0_BA= SE; + VirtualMemoryTable[Index].Length =3D AC01_RCB0_DEVICE_MEMORY_S0_SI= ZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_D= EVICE; + + /* + * - PCIe RCB1 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase =3D AC01_RCB1_DEVICE_MEMORY_S0_= BASE; + VirtualMemoryTable[Index].VirtualBase =3D AC01_RCB1_DEVICE_MEMORY_S0_BA= SE; + VirtualMemoryTable[Index].Length =3D AC01_RCB1_DEVICE_MEMORY_S0_SI= ZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_D= EVICE; + + /* + * - PCIe RCB2 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase =3D AC01_RCB2_DEVICE_MEMORY_S0_= BASE; + VirtualMemoryTable[Index].VirtualBase =3D AC01_RCB2_DEVICE_MEMORY_S0_BA= SE; + VirtualMemoryTable[Index].Length =3D AC01_RCB2_DEVICE_MEMORY_S0_SI= ZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_D= EVICE; + + /* + * - PCIe RCB3 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase =3D AC01_RCB3_DEVICE_MEMORY_S0_= BASE; + VirtualMemoryTable[Index].VirtualBase =3D AC01_RCB3_DEVICE_MEMORY_S0_BA= SE; + VirtualMemoryTable[Index].Length =3D AC01_RCB3_DEVICE_MEMORY_S0_SI= ZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_D= EVICE; + + if (IsSlaveSocketActive ()) { + // Slave socket exist + /* + * - PCIe RCA0 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase =3D AC01_RCA0_DEVICE_MEMORY_S= 1_BASE; + VirtualMemoryTable[Index].VirtualBase =3D AC01_RCA0_DEVICE_MEMORY_S1_= BASE; + VirtualMemoryTable[Index].Length =3D AC01_RCA0_DEVICE_MEMORY_S1_= SIZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE= _DEVICE; + + /* + * - PCIe RCA1 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase =3D AC01_RCA1_DEVICE_MEMORY_S= 1_BASE; + VirtualMemoryTable[Index].VirtualBase =3D AC01_RCA1_DEVICE_MEMORY_S1_= BASE; + VirtualMemoryTable[Index].Length =3D AC01_RCA1_DEVICE_MEMORY_S1_= SIZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE= _DEVICE; + + /* + * - PCIe RCA2 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase =3D AC01_RCA2_DEVICE_MEMORY_S= 1_BASE; + VirtualMemoryTable[Index].VirtualBase =3D AC01_RCA2_DEVICE_MEMORY_S1_= BASE; + VirtualMemoryTable[Index].Length =3D AC01_RCA2_DEVICE_MEMORY_S1_= SIZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE= _DEVICE; + + /* + * - PCIe RCA3 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase =3D AC01_RCA3_DEVICE_MEMORY_S= 1_BASE; + VirtualMemoryTable[Index].VirtualBase =3D AC01_RCA3_DEVICE_MEMORY_S1_= BASE; + VirtualMemoryTable[Index].Length =3D AC01_RCA3_DEVICE_MEMORY_S1_= SIZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE= _DEVICE; + + /* + * - PCIe RCB0 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase =3D AC01_RCB0_DEVICE_MEMORY_S= 1_BASE; + VirtualMemoryTable[Index].VirtualBase =3D AC01_RCB0_DEVICE_MEMORY_S1_= BASE; + VirtualMemoryTable[Index].Length =3D AC01_RCB0_DEVICE_MEMORY_S1_= SIZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE= _DEVICE; + + /* + * - PCIe RCB1 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase =3D AC01_RCB1_DEVICE_MEMORY_S= 1_BASE; + VirtualMemoryTable[Index].VirtualBase =3D AC01_RCB1_DEVICE_MEMORY_S1_= BASE; + VirtualMemoryTable[Index].Length =3D AC01_RCB1_DEVICE_MEMORY_S1_= SIZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE= _DEVICE; + + /* + * - PCIe RCB2 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase =3D AC01_RCB2_DEVICE_MEMORY_S= 1_BASE; + VirtualMemoryTable[Index].VirtualBase =3D AC01_RCB2_DEVICE_MEMORY_S1_= BASE; + VirtualMemoryTable[Index].Length =3D AC01_RCB2_DEVICE_MEMORY_S1_= SIZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE= _DEVICE; + + /* + * - PCIe RCB3 Device memory + */ + VirtualMemoryTable[++Index].PhysicalBase =3D AC01_RCB3_DEVICE_MEMORY_S= 1_BASE; + VirtualMemoryTable[Index].VirtualBase =3D AC01_RCB3_DEVICE_MEMORY_S1_= BASE; + VirtualMemoryTable[Index].Length =3D AC01_RCB3_DEVICE_MEMORY_S1_= SIZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE= _DEVICE; + } + + /* + * - BERT memory region + */ + VirtualMemoryTable[++Index].PhysicalBase =3D AC01_BERT_MEMORY_BASE; + VirtualMemoryTable[Index].VirtualBase =3D AC01_BERT_MEMORY_BASE; + VirtualMemoryTable[Index].Length =3D AC01_BERT_MEMORY_SIZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_D= EVICE; + + /* + * - DDR memory region + */ + NumRegion =3D PlatformHob->DramInfo.NumRegion; + Count =3D 0; + while (NumRegion-- > 0) { + if (PlatformHob->DramInfo.NvdRegion[Count]) { /* Skip NVDIMM Region */ + Count++; + continue; + } + + VirtualMemoryTable[++Index].PhysicalBase =3D PlatformHob->DramInfo.Bas= e[Count]; + VirtualMemoryTable[Index].VirtualBase =3D PlatformHob->DramInfo.Base[= Count]; + VirtualMemoryTable[Index].Length =3D PlatformHob->DramInfo.Size[= Count]; + VirtualMemoryTable[Index].Attributes =3D DDR_ATTRIBUTES_CACHED; + if (PlatformHob->DramInfo.Base[Count] =3D=3D PcdGet64 (PcdMmBufferBase= )) { + // + // Set uncached attribute for MM region + // + VirtualMemoryTable[Index].Attributes =3D DDR_ATTRIBUTES_UNCACHED; + } + Count++; + } + + /* End of Table */ + VirtualMemoryTable[++Index].PhysicalBase =3D 0; + VirtualMemoryTable[Index].VirtualBase =3D 0; + VirtualMemoryTable[Index].Length =3D 0; + VirtualMemoryTable[Index].Attributes =3D (ARM_MEMORY_REGION_ATTRIBUTES= )0; + + ASSERT ((Index + 1) <=3D MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS); + + *VirtualMemoryMap =3D VirtualMemoryTable; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfaceLib/Mail= boxInterfaceLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfaceL= ib/MailboxInterfaceLib.c new file mode 100644 index 000000000000..b2117d77a0aa --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfaceLib/MailboxInte= rfaceLib.c @@ -0,0 +1,281 @@ +/** @file + The library implements the hardware Mailbox (Doorbell) interface for com= munication + between the Application Processor (ARMv8) and the System Control Process= ors (SMpro/PMpro). + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +// +// Hardware Doorbells +// +#define SMPRO_DB0_IRQ_OFST 40 +#define SMPRO_DB0_BASE_ADDRESS (FixedPcdGet64 (PcdSmproDbBaseReg= )) + +#define PMPRO_DB0_IRQ_OFST 56 +#define PMPRO_DB0_BASE_ADDRESS (FixedPcdGet64 (PcdPmproDbBaseReg= )) + +// +// The base SPI interrupt number of the Slave socket +// +#define SLAVE_SOCKET_SPI_INTERRUPT 352 + +#define SLAVE_SOCKET_DOORBELL_INTERRUPT_BASE(Socket) ((Socket) * SLAVE_SOC= KET_SPI_INTERRUPT - 32) + +// +// Doorbell base register stride size +// +#define DB_BASE_REG_STRIDE 0x00001000 + +#define SMPRO_DBx_ADDRESS(socket, db) \ + ((socket) * SLAVE_SOCKET_BASE_ADDRESS_OFFSET + SMPRO_DB0_BASE_ADDR= ESS + DB_BASE_REG_STRIDE * (db)) + +#define PMPRO_DBx_ADDRESS(socket, db) \ + ((socket) * SLAVE_SOCKET_BASE_ADDRESS_OFFSET + PMPRO_DB0_BASE_ADDR= ESS + DB_BASE_REG_STRIDE * (db)) + +// +// Doorbell Status Bits +// +#define DB_STATUS_AVAIL_BIT BIT16 +#define DB_STATUS_ACK_BIT BIT0 + +/** + Get the base address of a doorbell. + + @param[in] Socket Active socket index. + @param[in] Doorbell Doorbell channel for communication with th= e SMpro/PMpro. + + @retval UINT32 The base address of the doorbell. + The returned value is 0 indicate that the = input parameters are invalid. + +**/ +UINTN +EFIAPI +MailboxGetDoorbellAddress ( + IN UINT8 Socket, + IN DOORBELL_CHANNELS Doorbell + ) +{ + UINTN DoorbellAddress; + + if (Socket >=3D GetNumberOfActiveSockets () + || Doorbell >=3D NUMBER_OF_DOORBELLS_PER_SOCKET) + { + return 0; + } + + if (Doorbell >=3D SMproDoorbellChannel0) { + DoorbellAddress =3D SMPRO_DBx_ADDRESS (Socket, (UINT8)(Doorbell - SMpr= oDoorbellChannel0)); + } else { + DoorbellAddress =3D PMPRO_DBx_ADDRESS (Socket, (UINT8)Doorbell); + } + + return DoorbellAddress; +} + +/** + Get the interrupt number of a doorbell. + + @param[in] Socket Active socket index. + @param[in] Doorbell Doorbell channel for communication with th= e SMpro/PMpro. + + @retval UINT32 The interrupt number. + The returned value is 0 indicate that the = input parameters are invalid. + +**/ +UINT32 +EFIAPI +MailboxGetDoorbellInterruptNumber ( + IN UINT8 Socket, + IN DOORBELL_CHANNELS Doorbell + ) +{ + UINT32 DoorbellInterruptNumber; + + if (Socket >=3D GetNumberOfActiveSockets () + || Doorbell >=3D NUMBER_OF_DOORBELLS_PER_SOCKET) + { + return 0; + } + + DoorbellInterruptNumber =3D 0; + + if (Socket > 0) { + DoorbellInterruptNumber =3D SLAVE_SOCKET_DOORBELL_INTERRUPT_BASE (Sock= et); + } + + if (Doorbell >=3D SMproDoorbellChannel0) { + DoorbellInterruptNumber +=3D SMPRO_DB0_IRQ_OFST + (UINT8)(Doorbell - S= MproDoorbellChannel0); + } else { + DoorbellInterruptNumber +=3D PMPRO_DB0_IRQ_OFST + (UINT8)Doorbell; + } + + return DoorbellInterruptNumber; +} + +/** + Read a message via the hardware Doorbell interface. + + @param[in] Socket Active socket index. + @param[in] Doorbell Doorbell channel for communication with th= e SMpro/PMpro. + @param[out] Message Pointer to the Mailbox message. + + @retval EFI_SUCCESS Read the message successfully. + @retval EFI_TIMEOUT Timeout occurred when waiting for availabl= e message in the mailbox. + @retval EFI_INVALID_PARAMETER A parameter is invalid. +**/ +EFI_STATUS +EFIAPI +MailboxRead ( + IN UINT8 Socket, + IN DOORBELL_CHANNELS Doorbell, + OUT MAILBOX_MESSAGE_DATA *Message + ) +{ + UINTN TimeoutCount; + UINTN DoorbellAddress; + + if (Socket >=3D GetNumberOfActiveSockets () + || Doorbell >=3D NUMBER_OF_DOORBELLS_PER_SOCKET + || Message =3D=3D NULL) + { + return EFI_INVALID_PARAMETER; + } + + TimeoutCount =3D MAILBOX_POLL_COUNT; + + DoorbellAddress =3D MailboxGetDoorbellAddress (Socket, Doorbell); + ASSERT (DoorbellAddress !=3D 0); + + // + // Polling Doorbell status + // + while ((MmioRead32 ((DoorbellAddress + DB_STATUS_REG_OFST)) & DB_STATUS_= AVAIL_BIT) =3D=3D 0) { + MicroSecondDelay (MAILBOX_POLL_INTERVAL_US); + if (--TimeoutCount =3D=3D 0) { + return EFI_TIMEOUT; + } + } + + Message->ExtendedData[0] =3D MmioRead32 (DoorbellAddress + DB_DIN0_REG_O= FST); + Message->ExtendedData[1] =3D MmioRead32 (DoorbellAddress + DB_DIN1_REG_O= FST); + Message->Data =3D MmioRead32 (DoorbellAddress + DB_IN_REG_OFST); + + // + // Write 1 to clear the AVAIL status + // + MmioWrite32 (DoorbellAddress + DB_STATUS_REG_OFST, DB_STATUS_AVAIL_BIT); + + return EFI_SUCCESS; +} + +/** + Write a message via the hardware Doorbell interface. + + @param[in] Socket Active socket index. + @param[in] Doorbell Doorbel channel for communication with the= SMpro/PMpro. + @param[in] Message Pointer to the Mailbox message. + + @retval EFI_SUCCESS Write the message successfully. + @retval EFI_TIMEOUT Timeout occurred when waiting for acknowle= dge signal from the mailbox. + @retval EFI_INVALID_PARAMETER A parameter is invalid. +**/ +EFI_STATUS +EFIAPI +MailboxWrite ( + IN UINT8 Socket, + IN DOORBELL_CHANNELS Doorbell, + IN MAILBOX_MESSAGE_DATA *Message + ) +{ + UINTN TimeoutCount; + UINTN DoorbellAddress; + + if (Socket >=3D GetNumberOfActiveSockets () + || Doorbell >=3D NUMBER_OF_DOORBELLS_PER_SOCKET + || Message =3D=3D NULL) + { + return EFI_INVALID_PARAMETER; + } + + TimeoutCount =3D MAILBOX_POLL_COUNT; + + DoorbellAddress =3D MailboxGetDoorbellAddress (Socket, Doorbell); + ASSERT (DoorbellAddress !=3D 0); + + // + // Clear previous pending ack if any + // + if ((MmioRead32 (DoorbellAddress + DB_STATUS_REG_OFST) & DB_STATUS_ACK_B= IT) !=3D 0) { + MmioWrite32 (DoorbellAddress + DB_STATUS_REG_OFST, DB_STATUS_ACK_BIT); + } + + // + // Send message + // + MmioWrite32 (DoorbellAddress + DB_DOUT0_REG_OFST, Message->ExtendedData[= 0]); + MmioWrite32 (DoorbellAddress + DB_DOUT1_REG_OFST, Message->ExtendedData[= 1]); + MmioWrite32 (DoorbellAddress + DB_OUT_REG_OFST, Message->Data); + + // + // Wait for ACK + // + while ((MmioRead32 (DoorbellAddress + DB_STATUS_REG_OFST) & DB_STATUS_AC= K_BIT) =3D=3D 0) { + MicroSecondDelay (MAILBOX_POLL_INTERVAL_US); + if (--TimeoutCount =3D=3D 0) { + return EFI_TIMEOUT; + } + } + + // + // Write 1 to clear the ACK status + // + MmioWrite32 (DoorbellAddress + DB_STATUS_REG_OFST, DB_STATUS_ACK_BIT); + + return EFI_SUCCESS; +} + +/** + Unmask the Doorbell interrupt status. + + @param Socket Active socket index. + @param Doorbell Doorbel channel for communication with the SMpro/PMpro. + + @retval EFI_SUCCESS Unmask the Doorbell interrupt successfull= y. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + +**/ +EFI_STATUS +EFIAPI +MailboxUnmaskInterrupt ( + IN UINT8 Socket, + IN UINT16 Doorbell + ) +{ + UINTN DoorbellAddress; + + if (Socket >=3D GetNumberOfActiveSockets () + || Doorbell >=3D NUMBER_OF_DOORBELLS_PER_SOCKET) + { + return EFI_INVALID_PARAMETER; + } + + DoorbellAddress =3D MailboxGetDoorbellAddress (Socket, Doorbell); + ASSERT (DoorbellAddress !=3D 0); + + MmioWrite32 (DoorbellAddress + DB_STATUS_MASK_REG_OFST, ~DB_STATUS_AVAIL= _BIT); + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/MemoryI= nitPeiLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/Memory= InitPeiLib.c new file mode 100644 index 000000000000..98aa1e77b3b4 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/MemoryInitPeiL= ib.c @@ -0,0 +1,93 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include + +STATIC +VOID +InitMmu ( + IN ARM_MEMORY_REGION_DESCRIPTOR *MemoryTable + ) +{ + VOID *TranslationTableBase; + UINTN TranslationTableSize; + RETURN_STATUS Status; + + // Note: Because we called PeiServicesInstallPeiMemory() before to call = InitMmu() + // the MMU Page Table resides in DRAM (even at the top of DRAM as it is = the first + // permanent memory allocation) + // + Status =3D ArmConfigureMmu (MemoryTable, &TranslationTableBase, &Transla= tionTableSize); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Error: Failed to enable MMU\n")); + } + + BuildMemoryAllocationHob ( + (EFI_PHYSICAL_ADDRESS)(UINTN)TranslationTableBase, + EFI_SIZE_TO_PAGES (TranslationTableSize) * EFI_PAGE_SIZE, + EfiBootServicesData + ); +} + +EFI_STATUS +EFIAPI +MemoryPeim ( + IN EFI_PHYSICAL_ADDRESS UefiMemoryBase, + IN UINT64 UefiMemorySize + ) +{ + ARM_MEMORY_REGION_DESCRIPTOR *MemoryTable; + UINTN Index; + + /* Get Virtual Memory Map from the Platform Library */ + ArmPlatformGetVirtualMemoryMap (&MemoryTable); + + Index =3D 0; + while (MemoryTable[Index].Length !=3D 0) { + if (MemoryTable[Index].Attributes =3D=3D ARM_MEMORY_REGION_ATTRIBUTE_W= RITE_BACK) { + BuildResourceDescriptorHob ( + EFI_RESOURCE_SYSTEM_MEMORY, + EFI_RESOURCE_ATTRIBUTE_PRESENT | + EFI_RESOURCE_ATTRIBUTE_INITIALIZED | + EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE | + EFI_RESOURCE_ATTRIBUTE_TESTED, + MemoryTable[Index].PhysicalBase, + MemoryTable[Index].Length + ); + } else if (MemoryTable[Index].Attributes =3D=3D ARM_MEMORY_REGION_ATTR= IBUTE_DEVICE) { + BuildResourceDescriptorHob ( + EFI_RESOURCE_MEMORY_MAPPED_IO, + EFI_RESOURCE_ATTRIBUTE_PRESENT | + EFI_RESOURCE_ATTRIBUTE_INITIALIZED | + EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE, + MemoryTable[Index].PhysicalBase, + MemoryTable[Index].Length + ); + } + Index++; + } + + BuildMemoryAllocationHob ( + PcdGet64 (PcdFdBaseAddress), + PcdGet32 (PcdFdSize), + EfiRuntimeServicesData + ); + + InitMmu (MemoryTable); + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLib/MmCom= municationLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLib/= MmCommunicationLib.c new file mode 100644 index 000000000000..453bee414f13 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLib/MmCommunicat= ionLib.c @@ -0,0 +1,184 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include + +// +// Address, Length of the pre-allocated buffer for communication with the = secure +// world. +// +STATIC ARM_MEMORY_REGION_DESCRIPTOR mNsCommBuffMemRegion; + +EFI_STATUS +EFIAPI +MmCommunicationLibConstructor ( + VOID + ) +{ + mNsCommBuffMemRegion.PhysicalBase =3D PcdGet64 (PcdMmBufferBase); + // During UEFI boot, virtual and physical address are the same + mNsCommBuffMemRegion.VirtualBase =3D mNsCommBuffMemRegion.PhysicalBase; + mNsCommBuffMemRegion.Length =3D PcdGet64 (PcdMmBufferSize); + + return EFI_SUCCESS; +} + +/** + Communicates with a registered handler. + + This function provides an interface to send and receive messages to the + Standalone MM environment in UEFI PEI phase. + + @param[in, out] CommBuffer A pointer to the buffer to convey + into MMRAM. + @param[in, out] CommSize The size of the data buffer being + passed in. This is optional. + + @retval EFI_SUCCESS The message was successfully posted. + @retval EFI_INVALID_PARAMETER The CommBuffer was NULL. + @retval EFI_BAD_BUFFER_SIZE The buffer size is incorrect for the= MM + implementation. If this error is + returned, the MessageLength field in + the CommBuffer header or the integer + pointed by CommSize are updated to r= eflect + the maximum payload size the + implementation can accommodate. + @retval EFI_ACCESS_DENIED The CommunicateBuffer parameter + or CommSize parameter, if not omitte= d, + are in address range that cannot be + accessed by the MM environment +**/ +EFI_STATUS +EFIAPI +MmCommunicationCommunicate ( + IN OUT VOID *CommBuffer, + IN OUT UINTN *CommSize OPTIONAL + ) +{ + EFI_MM_COMMUNICATE_HEADER *CommunicateHeader; + ARM_SMC_ARGS CommunicateSmcArgs; + EFI_STATUS Status; + UINTN BufferSize; + + Status =3D EFI_ACCESS_DENIED; + BufferSize =3D 0; + + ZeroMem (&CommunicateSmcArgs, sizeof (ARM_SMC_ARGS)); + + // + // Check parameters + // + if (CommBuffer =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + CommunicateHeader =3D CommBuffer; + // CommBuffer is a mandatory parameter. Hence, Rely on + // MessageLength + Header to ascertain the + // total size of the communication payload rather than + // rely on optional CommSize parameter + BufferSize =3D CommunicateHeader->MessageLength + + sizeof (CommunicateHeader->HeaderGuid) + + sizeof (CommunicateHeader->MessageLength); + + // If the length of the CommBuffer is 0 then return the expected length. + if (CommSize !=3D NULL) { + // This case can be used by the consumer of this driver to find out the + // max size that can be used for allocating CommBuffer. + if ((*CommSize =3D=3D 0) || + (*CommSize > mNsCommBuffMemRegion.Length)) + { + *CommSize =3D mNsCommBuffMemRegion.Length; + return EFI_BAD_BUFFER_SIZE; + } + // + // CommSize must match MessageLength + sizeof (EFI_MM_COMMUNICATE_HEAD= ER); + // + if (*CommSize !=3D BufferSize) { + return EFI_INVALID_PARAMETER; + } + } + + // + // If the buffer size is 0 or greater than what can be tolerated by the = MM + // environment then return the expected size. + // + if ((BufferSize =3D=3D 0) || + (BufferSize > mNsCommBuffMemRegion.Length)) + { + CommunicateHeader->MessageLength =3D mNsCommBuffMemRegion.Length - + sizeof (CommunicateHeader->HeaderGu= id) - + sizeof (CommunicateHeader->MessageL= ength); + return EFI_BAD_BUFFER_SIZE; + } + + // SMC Function ID + CommunicateSmcArgs.Arg0 =3D ARM_SMC_ID_MM_COMMUNICATE_AARCH64; + + // Cookie + CommunicateSmcArgs.Arg1 =3D 0; + + // Copy Communication Payload + CopyMem ((VOID *)mNsCommBuffMemRegion.VirtualBase, CommBuffer, BufferSiz= e); + + // comm_buffer_address (64-bit physical address) + CommunicateSmcArgs.Arg2 =3D (UINTN)mNsCommBuffMemRegion.PhysicalBase; + + // comm_size_address (not used, indicated by setting to zero) + CommunicateSmcArgs.Arg3 =3D 0; + + // Call the Standalone MM environment. + ArmCallSmc (&CommunicateSmcArgs); + + switch (CommunicateSmcArgs.Arg0) { + case ARM_SMC_MM_RET_SUCCESS: + ZeroMem (CommBuffer, BufferSize); + // On successful return, the size of data being returned is inferred f= rom + // MessageLength + Header. + CommunicateHeader =3D (EFI_MM_COMMUNICATE_HEADER *)mNsCommBuffMemRegio= n.VirtualBase; + BufferSize =3D CommunicateHeader->MessageLength + + sizeof (CommunicateHeader->HeaderGuid) + + sizeof (CommunicateHeader->MessageLength); + + CopyMem ( + CommBuffer, + (VOID *)mNsCommBuffMemRegion.VirtualBase, + BufferSize + ); + Status =3D EFI_SUCCESS; + break; + + case ARM_SMC_MM_RET_INVALID_PARAMS: + Status =3D EFI_INVALID_PARAMETER; + break; + + case ARM_SMC_MM_RET_DENIED: + Status =3D EFI_ACCESS_DENIED; + break; + + case ARM_SMC_MM_RET_NO_MEMORY: + // Unexpected error since the CommSize was checked for zero length + // prior to issuing the SMC + Status =3D EFI_OUT_OF_RESOURCES; + ASSERT (0); + break; + + default: + Status =3D EFI_ACCESS_DENIED; + ASSERT (0); + } + + return Status; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.c = b/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.c new file mode 100644 index 000000000000..d0bc719361f1 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.c @@ -0,0 +1,64 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include + +#include "NVParamLibCommon.h" + +/** + Provides an interface to access the NVParam services via MM interface. + + @param[in] Request Pointer to the request buffer + @param[in] RequestDataSize Size of the request buffer. + @param[out] Response Pointer to the response buffer + @param[in] ResponseDataSize Size of the response buffer. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER An invalid data parameter or an invalid + combination of data parameters. + @retval Others An error has occurred. +**/ +EFI_STATUS +NVParamMmCommunicate ( + IN VOID *Request, + IN UINT32 RequestDataSize, + OUT VOID *Response, + IN UINT32 ResponseDataSize + ) +{ + EFI_MM_COMMUNICATE_REQUEST CommBuffer; + EFI_STATUS Status; + + if (Request =3D=3D NULL || RequestDataSize =3D=3D 0 + || RequestDataSize > EFI_MM_MAX_PAYLOAD_SIZE + || (ResponseDataSize =3D=3D 0 && Response =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + CopyGuid (&CommBuffer.HeaderGuid, &gNVParamMmGuid); + CommBuffer.MessageLength =3D RequestDataSize; + CopyMem (CommBuffer.Data, Request, RequestDataSize); + + Status =3D MmCommunicationCommunicate ( + &CommBuffer, + NULL + ); + if (EFI_ERROR (Status)) { + return Status; + } + + if (ResponseDataSize > 0) { + CopyMem (Response, CommBuffer.Data, ResponseDataSize); + } + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLibCom= mon.c b/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLibCommon.c new file mode 100644 index 000000000000..496d5234552b --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLibCommon.c @@ -0,0 +1,235 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include + +#include "NVParamLibCommon.h" + +/** + Retrieve a non-volatile parameter. + + NOTE: If you need a signed value, cast it. It is expected that the + caller will carry the correct permission over various call sequences. + + @param[in] Param Parameter ID to retrieve + @param[in] ACLRd Permission for read operation. + @param[out] Val Pointer to an UINT32 to the return value. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_ACCESS_DENIED Permission not allowed. + @retval EFI_DEVICE_ERROR Service is unavailable. + @retval EFI_INVALID_PARAMETER Val is NULL or return status is invalid. + @retval EFI_NOT_FOUND NVParam entry is not set. +**/ +EFI_STATUS +NVParamGet ( + IN UINT32 Param, + IN UINT16 ACLRd, + OUT UINT32 *Val + ) +{ + EFI_MM_COMMUNICATE_NVPARAM_RESPONSE MmNVParamRes; + EFI_STATUS Status; + UINT64 MmData[5]; + + if (Val =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + MmData[0] =3D MM_NVPARAM_FUNC_READ; + MmData[1] =3D Param; + MmData[2] =3D (UINT64)ACLRd; + + Status =3D NVParamMmCommunicate ( + MmData, + sizeof (MmData), + &MmNVParamRes, + sizeof (MmNVParamRes) + ); + if (EFI_ERROR (Status)) { + return Status; + } + + switch (MmNVParamRes.Status) { + case MM_NVPARAM_RES_SUCCESS: + *Val =3D (UINT32)MmNVParamRes.Value; + return EFI_SUCCESS; + + case MM_NVPARAM_RES_NOT_SET: + return EFI_NOT_FOUND; + + case MM_NVPARAM_RES_NO_PERM: + return EFI_ACCESS_DENIED; + + case MM_NVPARAM_RES_FAIL: + return EFI_DEVICE_ERROR; + + default: + return EFI_INVALID_PARAMETER; + } +} + +/** + Set a non-volatile parameter. + + NOTE: If you have a signed value, cast to unsigned. If the parameter has + not being created before, the provied permission is used to create the + parameter. Otherwise, it is checked for access. It is expected that the + caller will carry the correct permission over various call sequences. + + @param[in] Param Parameter ID to set + @param[in] ACLRd Permission for read operation. + @param[in] ACLWr Permission for write operation. + @param[in] Val Unsigned int value to set. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_ACCESS_DENIED Permission not allowed. + @retval EFI_DEVICE_ERROR Service is unavailable. + @retval EFI_INVALID_PARAMETER Return status is invalid. +**/ +EFI_STATUS +NVParamSet ( + IN UINT32 Param, + IN UINT16 ACLRd, + IN UINT16 ACLWr, + IN UINT32 Val + ) +{ + EFI_MM_COMMUNICATE_NVPARAM_RESPONSE MmNVParamRes; + EFI_STATUS Status; + UINT64 MmData[5]; + + MmData[0] =3D MM_NVPARAM_FUNC_WRITE; + MmData[1] =3D Param; + MmData[2] =3D (UINT64)ACLRd; + MmData[3] =3D (UINT64)ACLWr; + MmData[4] =3D (UINT64)Val; + + Status =3D NVParamMmCommunicate ( + MmData, + sizeof (MmData), + &MmNVParamRes, + sizeof (MmNVParamRes) + ); + if (EFI_ERROR (Status)) { + return Status; + } + + switch (MmNVParamRes.Status) { + case MM_NVPARAM_RES_SUCCESS: + return EFI_SUCCESS; + + case MM_NVPARAM_RES_NO_PERM: + return EFI_ACCESS_DENIED; + + case MM_NVPARAM_RES_FAIL: + return EFI_DEVICE_ERROR; + + default: + return EFI_INVALID_PARAMETER; + } +} + +/** + Clear a non-volatile parameter. + + NOTE: It is expected that the caller will carry the correct permission + over various call sequences. + + @param[in] Param Parameter ID to set + @param[in] ACLWr Permission for write operation. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_ACCESS_DENIED Permission not allowed. + @retval EFI_DEVICE_ERROR Service is unavailable. + @retval EFI_INVALID_PARAMETER Return status is invalid. +**/ +EFI_STATUS +NVParamClr ( + IN UINT32 Param, + IN UINT16 ACLWr + ) +{ + EFI_MM_COMMUNICATE_NVPARAM_RESPONSE MmNVParamRes; + EFI_STATUS Status; + UINT64 MmData[5]; + + MmData[0] =3D MM_NVPARAM_FUNC_CLEAR; + MmData[1] =3D Param; + MmData[2] =3D 0; + MmData[3] =3D (UINT64)ACLWr; + + Status =3D NVParamMmCommunicate ( + MmData, + sizeof (MmData), + &MmNVParamRes, + sizeof (MmNVParamRes) + ); + if (EFI_ERROR (Status)) { + return Status; + } + + switch (MmNVParamRes.Status) { + case MM_NVPARAM_RES_SUCCESS: + return EFI_SUCCESS; + + case MM_NVPARAM_RES_NO_PERM: + return EFI_ACCESS_DENIED; + + case MM_NVPARAM_RES_FAIL: + return EFI_DEVICE_ERROR; + + default: + return EFI_INVALID_PARAMETER; + } +} + +/** + Clear all non-volatile parameters + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_DEVICE_ERROR Service is unavailable. + @retval EFI_INVALID_PARAMETER Return status is invalid. +**/ +EFI_STATUS +NVParamClrAll ( + VOID + ) +{ + EFI_MM_COMMUNICATE_NVPARAM_RESPONSE MmNVParamRes; + EFI_STATUS Status; + UINT64 MmData[5]; + + MmData[0] =3D MM_NVPARAM_FUNC_CLEAR_ALL; + + Status =3D NVParamMmCommunicate ( + MmData, + sizeof (MmData), + &MmNVParamRes, + sizeof (MmNVParamRes) + ); + if (EFI_ERROR (Status)) { + return Status; + } + + switch (MmNVParamRes.Status) { + case MM_NVPARAM_RES_SUCCESS: + return EFI_SUCCESS; + + case MM_NVPARAM_RES_FAIL: + return EFI_DEVICE_ERROR; + + default: + return EFI_INVALID_PARAMETER; + } +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/RuntimeNVPara= mLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/RuntimeNVParamLib= .c new file mode 100644 index 000000000000..f34e5c5c4269 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/RuntimeNVParamLib.c @@ -0,0 +1,130 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include + +#include "NVParamLibCommon.h" + +STATIC EFI_MM_COMMUNICATION2_PROTOCOL *mMmCommunicationProtocol =3D NULL; + +/** + This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRESS= _CHANGE + event. It converts a pointer to a new virtual address. + + @param Event Event whose notification function is being invoked. + @param Context Pointer to the notification function's context +**/ +VOID +EFIAPI +NVParamLibAddressChangeEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + gRT->ConvertPointer (0x0, (VOID **)&mMmCommunicationProtocol); +} + +/** + Constructor function of the RuntimeNVParamLib. + + @param ImageHandle The image handle. + @param SystemTable The system table. + + @retval EFI_SUCCESS Operation succeeded. + @retval Others An error has occurred +**/ +EFI_STATUS +EFIAPI +NVParamLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_EVENT VirtualAddressChangeEvent =3D NULL; + EFI_STATUS Status; + + Status =3D gBS->LocateProtocol ( + &gEfiMmCommunication2ProtocolGuid, + NULL, + (VOID **)&mMmCommunicationProtocol + ); + ASSERT_EFI_ERROR (Status); + + Status =3D gBS->CreateEvent ( + EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE, + TPL_CALLBACK, + NVParamLibAddressChangeEvent, + NULL, + &VirtualAddressChangeEvent + ); + ASSERT_EFI_ERROR (Status); + + return Status; +} + +/** + Provides an interface to access the NVParam services via MM interface. + + @param[in] Request Pointer to the request buffer + @param[in] RequestDataSize Size of the request buffer. + @param[out] Response Pointer to the response buffer + @param[in] ResponseDataSize Size of the response buffer. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER An invalid data parameter or an invalid + combination of data parameters. + @retval Others An error has occurred. +**/ +EFI_STATUS +NVParamMmCommunicate ( + IN VOID *Request, + IN UINT32 RequestDataSize, + OUT VOID *Response, + IN UINT32 ResponseDataSize + ) +{ + EFI_MM_COMMUNICATE_REQUEST CommBuffer; + EFI_STATUS Status; + + if (Request =3D=3D NULL || RequestDataSize =3D=3D 0 + || RequestDataSize > EFI_MM_MAX_PAYLOAD_SIZE + || (ResponseDataSize =3D=3D 0 && Response =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + CopyGuid (&CommBuffer.HeaderGuid, &gNVParamMmGuid); + CommBuffer.MessageLength =3D RequestDataSize; + CopyMem (CommBuffer.Data, Request, RequestDataSize); + + if (mMmCommunicationProtocol =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + Status =3D mMmCommunicationProtocol->Communicate ( + mMmCommunicationProtocol, + &CommBuffer, + &CommBuffer, + NULL + ); + if (EFI_ERROR (Status)) { + return Status; + } + + if (ResponseDataSize > 0) { + CopyMem (Response, CommBuffer.Data, ResponseDataSize); + } + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.c b/Silico= n/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.c new file mode 100644 index 000000000000..f7e6fb6092a6 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.c @@ -0,0 +1,141 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include + +/** + Generates a 16-bit random number. + + if Rand is NULL, then ASSERT(). + + @param[out] Rand Buffer pointer to store the 16-bit random value. + + @retval TRUE Random number generated successfully. + @retval FALSE Failed to generate the random number. + +**/ +BOOLEAN +EFIAPI +GetRandomNumber16 ( + OUT UINT16 *Rand + ) +{ + EFI_STATUS Status; + + ASSERT (Rand !=3D NULL); + if (Rand =3D=3D NULL) { + return FALSE; + } + + Status =3D GenerateRandomNumbers ((UINT8 *)Rand, sizeof (UINT16)); + if (EFI_ERROR (Status)) { + return FALSE; + } + + return TRUE; +} + +/** + Generates a 32-bit random number. + + if Rand is NULL, then ASSERT(). + + @param[out] Rand Buffer pointer to store the 32-bit random value. + + @retval TRUE Random number generated successfully. + @retval FALSE Failed to generate the random number. + +**/ +BOOLEAN +EFIAPI +GetRandomNumber32 ( + OUT UINT32 *Rand + ) +{ + EFI_STATUS Status; + + ASSERT (Rand !=3D NULL); + if (Rand =3D=3D NULL) { + return FALSE; + } + + Status =3D GenerateRandomNumbers ((UINT8 *)Rand, sizeof (UINT32)); + if (EFI_ERROR (Status)) { + return FALSE; + } + + return TRUE; +} + +/** + Generates a 64-bit random number. + + if Rand is NULL, then ASSERT(). + + @param[out] Rand Buffer pointer to store the 64-bit random value. + + @retval TRUE Random number generated successfully. + @retval FALSE Failed to generate the random number. + +**/ +BOOLEAN +EFIAPI +GetRandomNumber64 ( + OUT UINT64 *Rand + ) +{ + EFI_STATUS Status; + + ASSERT (Rand !=3D NULL); + if (Rand =3D=3D NULL) { + return FALSE; + } + + Status =3D GenerateRandomNumbers ((UINT8 *)Rand, sizeof (UINT64)); + if (EFI_ERROR (Status)) { + return FALSE; + } + + return TRUE; +} + +/** + Generates a 128-bit random number. + + if Rand is NULL, then ASSERT(). + + @param[out] Rand Buffer pointer to store the 128-bit random value. + + @retval TRUE Random number generated successfully. + @retval FALSE Failed to generate the random number. + +**/ +BOOLEAN +EFIAPI +GetRandomNumber128 ( + OUT UINT64 *Rand + ) +{ + EFI_STATUS Status; + + ASSERT (Rand !=3D NULL); + if (Rand =3D=3D NULL) { + return FALSE; + } + + Status =3D GenerateRandomNumbers ((UINT8 *)Rand, 2 * sizeof (UINT64)); + if (EFI_ERROR (Status)) { + return FALSE; + } + + return TRUE; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/SystemFirmwareInterfaceL= ib/SystemFirmwareInterfaceLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/Sys= temFirmwareInterfaceLib/SystemFirmwareInterfaceLib.c new file mode 100644 index 000000000000..9cab653418fb --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/SystemFirmwareInterfaceLib/Syst= emFirmwareInterfaceLib.c @@ -0,0 +1,328 @@ +/** @file + Provides functions for communication with System Firmware (SMpro/PMpro a= nd ATF). + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include + +/** + Read a register which is not accessible from the non-secure world + by sending a mailbox message to the SMpro processor. + + Note that not all addresses are allowed. + + @param[in] Socket Active socket index. + @param[in] Address A 64-bit register address to be read. + @param[out] Value A pointer to the read value. + + @retval EFI_SUCCESS Read the register successfully. + @retval EFI_UNSUPPORTED The register is not allowed. + @retval Otherwise Errors returned from MailboxWrite/MailboxR= ead() functions. +**/ +EFI_STATUS +EFIAPI +MailboxMsgRegisterRead ( + IN UINT8 Socket, + IN UINTN Address, + OUT UINT32 *Value + ) +{ + EFI_STATUS Status; + MAILBOX_MESSAGE_DATA Message; + UINT32 AddressLower32Bit; + UINT32 AddressUpper32Bit; + + if (Socket >=3D GetNumberOfActiveSockets ()) { + return EFI_INVALID_PARAMETER; + } + + AddressLower32Bit =3D (UINT32)(Address & 0xFFFFFFFF); + AddressUpper32Bit =3D (UINT32)RShiftU64 ((UINT64)Address, 32); + + Message.Data =3D MAILBOX_DEBUG_MESSAGE_ENCODE ( + MAILBOX_DEBUG_MESSAGE_SUBTYPE_REGISTER_READ, + (UINT16)(AddressUpper32Bit & 0xFFFF) + ); + + Message.ExtendedData[0] =3D AddressLower32Bit; + Message.ExtendedData[1] =3D 0; + + Status =3D MailboxWrite (Socket, SMproDoorbellChannel0, &Message); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D MailboxRead (Socket, SMproDoorbellChannel0, &Message); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + return Status; + } + + if ((Message.Data & 0xFF00) =3D=3D 0) { + return EFI_UNSUPPORTED; + } + + if (Value !=3D NULL) { + *Value =3D Message.ExtendedData[0]; + } + + return EFI_SUCCESS; +} + +/** + Write a value to a register which is not accessible from the non-secure = world + by sending a mailbox message to the SMpro processor. + + Note that not all addresses are allowed. + + @param[in] Socket Active socket index. + @param[in] Address A 64-bit register address to be written. + @param[in] Value The value to be written to the register. + + @retval EFI_SUCCESS Write the register successfully. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval Otherwise Errors returned from the MailboxWrite() functio= n. +**/ +EFI_STATUS +EFIAPI +MailboxMsgRegisterWrite ( + IN UINT8 Socket, + IN UINTN Address, + IN UINT32 Value + ) +{ + EFI_STATUS Status; + MAILBOX_MESSAGE_DATA Message; + UINT32 AddressLower32Bit; + UINT32 AddressUpper32Bit; + + if (Socket >=3D GetNumberOfActiveSockets ()) { + return EFI_INVALID_PARAMETER; + } + + AddressLower32Bit =3D (UINT32)(Address & 0xFFFFFFFF); + AddressUpper32Bit =3D (UINT32)RShiftU64 ((UINT64)Address, 32); + + Message.Data =3D MAILBOX_DEBUG_MESSAGE_ENCODE ( + MAILBOX_DEBUG_MESSAGE_SUBTYPE_REGISTER_WRITE, + (UINT16)(AddressUpper32Bit & 0xFFFF) + ); + + Message.ExtendedData[0] =3D AddressLower32Bit; + Message.ExtendedData[1] =3D Value; + + Status =3D MailboxWrite (Socket, SMproDoorbellChannel0, &Message); + ASSERT_EFI_ERROR (Status); + + return Status; +} + +/** + Set the PCC shared Memory Address to service handlers in the System Cont= rol Processors, + using for communication between the System Firmware and OSPM. + + @param[in] Socket Active socket index. + @param[in] Doorbell Doorbell index which is numbered like DOORB= ELL_CHANNELS. + @param[in] AddressAlign256 Enable/Disable 256 alignment. + @param[in] Address The shared memory address. + + @retval EFI_SUCCESS Set the shared memory address successfully. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval Otherwise Errors returned from the MailboxWrite() fu= nctions. +**/ +EFI_STATUS +EFIAPI +MailboxMsgSetPccSharedMem ( + IN UINT8 Socket, + IN UINT8 Doorbell, + IN BOOLEAN AddressAlign256, + IN UINTN Address + ) +{ + EFI_STATUS Status; + MAILBOX_MESSAGE_DATA Message; + UINT8 AlignBit; + UINT8 AlignControl; + + if (Socket >=3D GetNumberOfActiveSockets () || Doorbell >=3D NUMBER_OF_D= OORBELLS_PER_SOCKET) { + return EFI_INVALID_PARAMETER; + } + + if (AddressAlign256) { + AlignBit =3D 8; + AlignControl =3D MAILBOX_ADDRESS_256_ALIGNMENT; + } else { + AlignBit =3D 0; + AlignControl =3D MAILBOX_ADDRESS_NO_ALIGNMENT; + } + + Message.Data =3D MAILBOX_ADDRESS_MESSAGE_ENCODE ( + MAILBOX_ADDRESS_MESSAGE_SUBTYPE_PCC, + 0, + AlignControl + ); + + Message.ExtendedData[0] =3D (UINT32)(RShiftU64 ((UINT64)Address, AlignBi= t) & 0xFFFFFFFF); + Message.ExtendedData[1] =3D (UINT32)(RShiftU64 ((UINT64)Address, 32 + Al= ignBit)); + + Status =3D MailboxWrite (Socket, Doorbell, &Message); + ASSERT_EFI_ERROR (Status); + + return Status; +} + +/** + The True RNG is provided by the SMpro processor. This function is to sen= d a mailbox + message to the SMpro to request a 64-bit random number. + + @param[out] Buffer A pointer to the read 64-bit random number. + + @retval EFI_SUCCESS The operation succeeds. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval Otherwise Errors returned from the MailboxWrite/Mail= boxRead() functions. +**/ +EFI_STATUS +EFIAPI +MailboxMsgGetRandomNumber64 ( + OUT UINT8 *Buffer + ) +{ + EFI_STATUS Status; + MAILBOX_MESSAGE_DATA Message; + + if (Buffer =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + Message.Data =3D MAILBOX_USER_MESSAGE_ENCODE ( + MAILBOX_USER_MESSAGE_SUBTYPE_TRNG_PROXY, + MAILBOX_TRNG_PROXY_GET_RANDOM_NUMBER, + 0 + ); + Message.ExtendedData[0] =3D 0; + Message.ExtendedData[1] =3D 0; + + Status =3D MailboxWrite (0, SMproDoorbellChannel6, &Message); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D MailboxRead (0, SMproDoorbellChannel6, &Message); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + return Status; + } + + CopyMem (Buffer, &Message.ExtendedData[0], sizeof (UINT32)); + CopyMem (Buffer + sizeof (UINT32), &Message.ExtendedData[1], sizeof (UIN= T32)); + + return EFI_SUCCESS; +} + +/** + Report the UEFI boot progress to the SMpro. + + @param[in] Socket Active socket index. + @param[in] BootStatus The status of the UEFI boot. + @param[in] Checkpoint The UEFI Checkpoint value. + + @retval EFI_SUCCESS Set the boot progress successfully. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval Otherwise Errors returned from the MailboxWrite() fu= nctions. +**/ +EFI_STATUS +EFIAPI +MailboxMsgSetBootProgress ( + IN UINT8 Socket, + IN UINT8 BootStatus, + IN UINT32 Checkpoint + ) +{ + EFI_STATUS Status; + MAILBOX_MESSAGE_DATA Message; + + if (Socket >=3D GetNumberOfActiveSockets ()) { + return EFI_INVALID_PARAMETER; + } + + Message.Data =3D MAILBOX_USER_MESSAGE_ENCODE ( + MAILBOX_USER_MESSAGE_SUBTYPE_BOOT_PROGRESS, + MAILBOX_BOOT_PROGRESS_COMMAND_SET, + MAILBOX_BOOT_PROGRESS_STAGE_UEFI + ); + + // + // Extended Data Format for Boot Progress Set + // + // Data 0: + // Bit 31:16 - Boot Status + // Bit 15:0 - UEFI Checkpoint lower 16-bit + // + // Data 1: + // Bit 31:16 - Unused + // Bit 15:0 - UEFI Checkpoint upper 16-bit + // + Message.ExtendedData[0] =3D ((UINT32)BootStatus & 0xFFFF) | (((UINT32)Ch= eckpoint << 16) & 0xFFFF0000); + Message.ExtendedData[1] =3D (Checkpoint >> 16) & 0xFFFF; + + Status =3D MailboxWrite (Socket, SMproDoorbellChannel1, &Message); + ASSERT_EFI_ERROR (Status); + + return Status; +} + +/** + Configure the Turbo (Max Performance) mode. + + @param[in] Socket Active socket index. + @param[in] Enable Enable/Disable the Turbo (Max performance) = mode. + + @retval EFI_SUCCESS Configure the Turbo successfully. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval Otherwise Errors returned from the MailboxWrite() fu= nctions. +**/ +EFI_STATUS +EFIAPI +MailboxMsgTurboConfig ( + IN UINT8 Socket, + IN BOOLEAN Enable + ) +{ + EFI_STATUS Status; + MAILBOX_MESSAGE_DATA Message; + + if (Socket >=3D GetNumberOfSupportedSockets ()) { + return EFI_INVALID_PARAMETER; + } + + Message.Data =3D MAILBOX_USER_MESSAGE_ENCODE ( + MAILBOX_USER_MESSAGE_SUBTYPE_SET_CONFIGURATION, + MAILBOX_SET_CONFIGURATION_TURBO, + 0 + ); + + // + // The Turbo configuration is written into the extended data 0. + // The extended data 1 is unused. + // + Message.ExtendedData[0] =3D Enable ? 1 : 0; + Message.ExtendedData[1] =3D 0; + + Status =3D MailboxWrite (Socket, PMproDoorbellChannel1, &Message); + ASSERT_EFI_ERROR (Status); + + return Status; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/TrngLib/TrngLib.c b/Sili= con/Ampere/AmpereAltraPkg/Library/TrngLib/TrngLib.c new file mode 100644 index 000000000000..55250ddcb86d --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/TrngLib/TrngLib.c @@ -0,0 +1,63 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include + +/** + Generates a random number by using Hardware RNG in SMpro. + + @param[out] Buffer Buffer to receive the random number. + @param[in] BufferSize Number of bytes in Buffer. + + @retval EFI_SUCCESS The random value was returned successfully. + @retval EFI_DEVICE_ERROR A random value could not be retrieved + due to a hardware or firmware error. + @retval EFI_INVALID_PARAMETER Buffer is NULL or BufferSize is zero. +**/ +EFI_STATUS +EFIAPI +GenerateRandomNumbers ( + OUT UINT8 *Buffer, + IN UINTN BufferSize + ) +{ + UINTN Count; + UINTN RandSize; + UINT64 Value; + EFI_STATUS Status; + + if ((BufferSize =3D=3D 0) || (Buffer =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + // + // SMpro only supports generating a 64-bits random number once. + // + RandSize =3D sizeof (UINT64); + for (Count =3D 0; Count < (BufferSize / sizeof (UINT64)) + 1; Count++) { + if (Count =3D=3D (BufferSize / sizeof (UINT64))) { + RandSize =3D BufferSize % sizeof (UINT64); + } + + if (RandSize !=3D 0) { + Status =3D MailboxMsgGetRandomNumber64 ((UINT8 *)&Value); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to get random number!\n", __FUNCT= ION__)); + return EFI_DEVICE_ERROR; + } + CopyMem (Buffer + Count * sizeof (UINT64), &Value, RandSize); + } + } + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatfo= rmHelper.S b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatfo= rmHelper.S new file mode 100644 index 000000000000..770aa9424eed --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformHelpe= r.S @@ -0,0 +1,45 @@ +/** @file + + Copyright (c) 2020, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +/** + * Derived from edk2/ArmPlatformPkg/Library/ArmPlatformLibNull/AArch64/Arm= PlatformHelper.S + **/ + +#include +#include + +ASM_FUNC(ArmPlatformPeiBootAction) + ret + +//UINTN +//ArmPlatformGetPrimaryCoreMpId ( +// VOID +// ); +ASM_FUNC(ArmPlatformGetPrimaryCoreMpId) + MOV32 (w0, FixedPcdGet32 (PcdArmPrimaryCore)) + ret + +//UINTN +//ArmPlatformIsPrimaryCore ( +// IN UINTN MpId +// ); +ASM_FUNC(ArmPlatformIsPrimaryCore) + ldr x0, =3D0x1 + ret + +//UINTN +//ArmPlatformGetCorePosition ( +// IN UINTN MpId +// ); +ASM_FUNC(ArmPlatformGetCorePosition) + and x1, x0, #ARM_CORE_MASK + and x0, x0, #ARM_CLUSTER_MASK + add x0, x1, x0, LSR #7 + ret + +ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.uni b/Sili= con/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.uni new file mode 100644 index 000000000000..dac06405dd58 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.uni @@ -0,0 +1,13 @@ +// /** @file +// Instance of RNG (Random Number Generator) Library. +// +// Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "Instance of RNG L= ibrary" + +#string STR_MODULE_DESCRIPTION #language en-US "RngLib that uses = Hardware RNG module from SMpro to generate random numbers." diff --git a/Silicon/Ampere/AmpereSiliconPkg/FvRules.fdf.inc b/Silicon/Ampe= re/AmpereSiliconPkg/FvRules.fdf.inc new file mode 100644 index 000000000000..027b3cf6dee4 --- /dev/null +++ b/Silicon/Ampere/AmpereSiliconPkg/FvRules.fdf.inc @@ -0,0 +1,176 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +##########################################################################= ###### +# +# Rules are used with the [FV] section's module INF type to define +# how an FFS file is created for a given INF file. The following Rule are = the default +# rules for the different module type. User can add the customized rules t= o define the +# content of the FFS file. +# +##########################################################################= ###### + +##########################################################################= ## +# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section = # +##########################################################################= ## +# +#[Rule.Common.DXE_DRIVER] +# FILE DRIVER =3D $(NAMED_GUID) { +# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_= NAME).depex +# COMPRESS PI_STD { +# GUIDED { +# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi +# UI STRING=3D"$(MODULE_NAME)" Optional +# VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_N= UMBER) +# } +# } +# } +# +##########################################################################= ## + + +[Rule.Common.SEC] + FILE SEC =3D $(NAMED_GUID) RELOCS_STRIPPED FIXED { + TE TE Align =3D Auto $(INF_OUTPUT)/$(MODULE_NAME).efi + } + +[Rule.Common.PEI_CORE] + FILE PEI_CORE =3D $(NAMED_GUID) FIXED { + TE TE Align =3D Auto $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING =3D"$(MODULE_NAME)" Optional + } + +[Rule.Common.PEIM] + FILE PEIM =3D $(NAMED_GUID) FIXED { + PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + TE TE Align =3D Auto $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + } + +[Rule.Common.PEIM.Binary] + FILE PEIM =3D $(NAMED_GUID) { + PEI_DEPEX PEI_DEPEX Optional |.depex + TE TE Align =3D Auto |.efi + UI STRING=3D"$(MODULE_NAME)" Optional + } + +[Rule.Common.PEIM.TIANOCOMPRESSED] + FILE PEIM =3D $(NAMED_GUID) DEBUG_MYTOOLS_IA32 { + PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED =3D TR= UE { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + } + } + +[Rule.Common.DXE_CORE] + FILE DXE_CORE =3D $(NAMED_GUID) { + COMPRESS PI_STD { + GUIDED { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).e= fi + UI STRING=3D"$(MODULE_NAME)" Optional + } + } + } + +[Rule.Common.UEFI_DRIVER] + FILE DRIVER =3D $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NA= ME).depex + COMPRESS PI_STD { + GUIDED { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).e= fi + UI STRING=3D"$(MODULE_NAME)" Optional + } + } + } + +[Rule.Common.DXE_DRIVER] + FILE DRIVER =3D $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NA= ME).depex + COMPRESS PI_STD { + GUIDED { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).e= fi + UI STRING=3D"$(MODULE_NAME)" Optional + RAW ACPI Optional |.acpi + RAW ASL Optional |.aml + } + } + } + +[Rule.Common.DXE_RUNTIME_DRIVER] + FILE DRIVER =3D $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NA= ME).depex + COMPRESS PI_STD { + GUIDED { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).e= fi + UI STRING=3D"$(MODULE_NAME)" Optional + } + } + } + +[Rule.Common.DXE_RUNTIME_DRIVER.Binary] + FILE DRIVER =3D $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional |.depex + COMPRESS PI_STD { + GUIDED { + PE32 PE32 |.efi + UI STRING=3D"$(MODULE_NAME)" Optional + } + } + } + +[Rule.Common.UEFI_APPLICATION] + FILE APPLICATION =3D $(NAMED_GUID) { + COMPRESS PI_STD { + GUIDED { + UI STRING =3D"$(MODULE_NAME)" Optional + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).e= fi + } + } + } + +[Rule.Common.UEFI_DRIVER.BINARY] + FILE DRIVER =3D $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional |.depex + COMPRESS PI_STD { + GUIDED { + PE32 PE32 |.efi + UI STRING=3D"$(MODULE_NAME)" Optional + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_N= UMBER) + } + } + } + +[Rule.Common.UEFI_DRIVER.Binary] + FILE DRIVER =3D $(NAMED_GUID) { + PE32 PE32 |.efi + UI STRING=3D"$(MODULE_NAME)" Optional + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NU= MBER) + } + +[Rule.Common.UEFI_APPLICATION.BINARY] + FILE APPLICATION =3D $(NAMED_GUID) { + PE32 PE32 |.efi + UI STRING=3D"$(MODULE_NAME)" Optional + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBE= R) + } + +[Rule.Common.USER_DEFINED.ACPITABLE] + FILE FREEFORM =3D $(NAMED_GUID) { + RAW ACPI Optional |.acpi + RAW ASL Optional |.aml + } + +[Rule.Common.PEIM.FMP_IMAGE_DESC] + FILE PEIM =3D $(NAMED_GUID) { + RAW BIN |.acpi + PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + PE32 PE32 Align=3D4K $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBE= R) + } --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83816): https://edk2.groups.io/g/devel/message/83816 Mute This Topic: https://groups.io/mt/87123857/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83814+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83814+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167785264600.491068866405; Wed, 17 Nov 2021 08:49:45 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id ah5VYY1788612xrN3EacLjaw; Wed, 17 Nov 2021 08:49:44 -0800 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.109]) by mx.groups.io with SMTP id smtpd.web10.9738.1637167783792045599 for ; Wed, 17 Nov 2021 08:49:44 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kk2f7W4BSt5a7cu8zzJyQmtlNy0MrPSseWcweE2XUMb1t4GaMsRSevy4GoFUBO4aLnxbWrqG4L1QFHm65RVSpr5YFfwiPhZ6XKAhc8BfaqmaNkNZ6s9szhTQB92T/eHJwTnNU3TGiQbyLbeaJyZN5B1FaXH0DAUXb7pIqNeFm0O+Ls5NlBcC/1YJmJWISIa4//FMNWix8nnhYxsgPYuoWZ1IEjIxBBLUOE7Mchmc+z+ORtxTbJm72qKesMV30PFfWsugdy3gdVEtw1pHKueCYpyIuHrVmKwcQuO3Mx01m4uobwLvZ06ATpux7XxeosOkLnMPLKvBIKz+/7jvMxphJA== 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=0UaUYjz3nOB+QTEDAtgxFEhCDvUkwrOgsPZ11fmnptQ=; b=c/9ms6LCHERBiyYwnTQc3Og46Ws2zbJFbqwAZawSP9q6L/tC602vmKh0hHbfAFVdxrujDsUCgNWhBJ2zB562FY99gTGC1bWaB20mCLOVTS19YQ8acSZ/NlsyLkVt82BXRoGKjUAz+B9pHQWc9N/w/UPNufF5DfqI86ecnOIAKmZCUdVUFswkgwOuHbmBRwX5cOPkFdIwL8jdRjTlLZ3iyMrhwLZYl1fKfrRKu2PGKlBocOJvAwrvKacv7Ju7+z15hWBnLLUm2GnNPZXhO6yY0zIvdztxkPdO+tapXndfvoO3QU50iQbGUKTmsFgOU50XSXEFAQV5pb557m00KId1zA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB6454.prod.exchangelabs.com (2603:10b6:510:1b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.20; Wed, 17 Nov 2021 16:49:41 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:49:40 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 02/30] AmpereAltraPkg: Add FlashLib library instance Date: Wed, 17 Nov 2021 23:46:59 +0700 Message-ID: <20211117164727.10922-3-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:49:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ab8b7cc9-8613-4dac-d370-08d9a9ea3f6d X-MS-TrafficTypeDiagnostic: PH0PR01MB6454: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: Veu2aNSkQOjWu+qGs1ngU2Bnrj8/GIQO3LEoAqXRb6ohDmgWzl7MqfnA2DYaddDvQjYwwXFQd8O2GSzaQYWf9JIyAzH3bVEiC6wG3X0hX3oXbdDgoFs9x/rYKZ0ykQ+/jZbfGXgQSJBPUVUCtDoG2CWtrZKuk5S2SIAg5Dtt/TQEsaDqDj+Jz203vMDzq5C6PhPbETFQpr0kxHDN71kV6BWpymvmEY0Tz/fmNSXNSAfGBO20dmDts/F3bTsPjUweizu0VrJgMRsQkWScsvItMsSGsgaUkjQyuZC/Dc3ThP3lVcKnXlRn5TEH50/9dYHzb1zBeQvT1pEjVw4zO/IIFTjkID+bHD+Rf3RUo0bCBhwIEZRKDt0poGxDsI/23krIl+VyoMXnUPc0mWe23e3LhSz4rg6SWnXEgVMB/RgP+pOtAQDjPODZFW9He9X4qitkvqaUCOAhIs/IPyQDShPPJOFi4frcJHNS+QcUtilBSQCGaKjwRAbnU4zIxoz0cdEQpWB95vpSAaKIlszJA7W9dMUTXPLskPy/QL9Bqnb6AZT4eqYBWkDAtHhgsSVhOVH2G3EAQwOpF0qpBkKHRI3Xp8AsADuH+T5c9LX41g4G5mLeqZAQAEN1TH5yaXx/DCfc+XSnnfMaI7LxlFbYgAU2eKIg/GLdjPVdHC/IfXapfmsJwkp9wO9ygSe0FHZvDMTj8iW+0Vfk1YelSS0akp90BA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?S5J9VJU8/gN20UM0pDX1kIviMYhHHRWfWwASSkPfninoGFYuK6ZHhbGCxfxs?= =?us-ascii?Q?r+i5Xyb1/LLiT1wK2nfLVWs8PAAnlRPHkeMHRdTl51WMQYttN6dbSQ8ICaA/?= =?us-ascii?Q?1+OQ5C4S44jkUqtfMiZjx/Y2a99prEjFtTY/JvwjfB+emCUxacmuXO+9+Dng?= =?us-ascii?Q?9iLuG1eL25/KKnyN8+j4rs5OmO6vUilGcR3SzP1Zu8r6hmhJuxTJqQZwc4Nd?= =?us-ascii?Q?MNPYj3RChoFELIH0XN9Ui8pYG7dlUTuU/if1CgmmJtgwavbbm6of3MWy0wcj?= =?us-ascii?Q?6934K20NnILn6KoRGrHQkBwUesaZ1CkzTENvKLT6nB28dwTuNxDBuPUSrYj3?= =?us-ascii?Q?QOnOoZhXs2FE//M9ypj+FdJ8bZleJ24HUITcjy3Gi1hl+JdwEh65nrvDqlW9?= =?us-ascii?Q?tIx9zhVojmdydR+PzicOTA8orRkpAqVGgl5KHeqboltYI9vAOInMmznAoO4V?= =?us-ascii?Q?Qe5aUk2CBpqt639g+FyLD7Ey4Gp6HhIsFdP3JU4NXviRBchFu1hNhnzwgP/T?= =?us-ascii?Q?tXyfKm/aexsvl0XBzL4Ci53CHekq681amN8gBT2x3qLad5O+hV0FmXhj1yzQ?= =?us-ascii?Q?5AkswwxM8kWOsfym8vwNbWiccKNgiebpR46qgcnkUVG1eAa9TNYGg0InHao5?= =?us-ascii?Q?JjJM0azsu63+eRvqAXC96vGJQf6ax/TWcuM32SAURDbE9HejxtwTmvjGJbVn?= =?us-ascii?Q?uBVDl8aCvhzrtvUI/1uwgu8X9aVIR8RXSM7Oa7hscFXl7KeRd+k/O7zuIrRd?= =?us-ascii?Q?KMm9WWmF4CXmw5FR4dFX2JwXLnPeDBE0TmnV75MB97LxQZ1y8K3QJz9iYgcJ?= =?us-ascii?Q?D6Mo/uLJW7stuOTaNpxzsADAeosdhwPgAu1pO4Rq/l3CHqsi0U36GSOT/32z?= =?us-ascii?Q?qigbP2HEjOL3NRZn5VIakv8iJ+0AwwmN27LD3DU2JIJIsHuarPxPhQnAch/H?= =?us-ascii?Q?Niwwc2ng9a7cbVW5S6sLl1FlpLFGBUO0qZWj4yA6lODd4Mx77qalOU6rru0g?= =?us-ascii?Q?4uhX1NPvuHEiH733N+rrLdpOvITZHXT+LjvazZ2WQBiM46OK9wHM68Np9I7j?= =?us-ascii?Q?4IixICM4EXuJOtnEYVsQu2+LQnvxASUbd1icocBfOqr6k7Yo+hgWjP/RGpdQ?= =?us-ascii?Q?jmUxXa6CKfdBjWjjvI8vtdin6BhT8/lW/hjXvLebipeMjBrk9ZniFjDgIEZt?= =?us-ascii?Q?KdDH3NUmEt2RLE7J6n7Ygua+6ww82HN3ozf35dVLRvwNxvREx+vGkNiEi4hz?= =?us-ascii?Q?nrscWNaeXbMPrqcUHtm0R9F7ZYe2k6mIv0B3S9JhE3Jr8K0IX1A+sUzZ9I/r?= =?us-ascii?Q?Shq0i0Ekp+WMFRL7VOcM4Sow1MkgdVGZ71DYXQa54xercrZb2OQ1/DqomKK7?= =?us-ascii?Q?OcNJvAeNBTMsvP6lRJTPfE9YmBk04bfOZ043Eb3vDvBDXjZ6DrsM6I2NsQHj?= =?us-ascii?Q?DjVc49UIUTraT+sPgc7rV6R3PdL0VUxqdLZnh+eQD1vf7/DxPZfu6l2SmWES?= =?us-ascii?Q?fOY2y4bMu66YeS7dAx3z5rPr24sC8e6L645YJzSKvGOi3vE7q8XinhFjSLJ/?= =?us-ascii?Q?FTcZGEsiauqW6cYgXHaJcje0q1UCAmVmjjzKe5OxY9Fu/9ywKrTYWdA3bxRG?= =?us-ascii?Q?wlEWqsCrYCBN95RhcvnP/wEndyEbKWMaJ1kerGN4kXfjRiSDLhRv3Woeh+k6?= =?us-ascii?Q?75UuXA=3D=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab8b7cc9-8613-4dac-d370-08d9a9ea3f6d X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:49:40.3837 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: A+J0ynRutJraMHzPGJILPje1j0qNlcGimLx28TiJbA63uq44YdSyqxU1E46vXGg/80AZKS0TaC53J6S/1uQ5/8FhieILe8IUWZ8/Lf3d/Xc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6454 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: IF7bCjiQzjLnU6oujxy7FjaUx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167784; bh=dsPtFOqfWXJ9Mr02hFhCceujBtxcSOXgbXtz4cnd8bM=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=vHcXc15QiuxQSMVy2eyzAEhzFugglq2vIpdL5LIYfTkXKimMv7/EBIy6eJiIBhwbFL9 l0aVvVG8I8KBa9tfYCGjId1sQB4AbgCnTU8k5muUA3y/EJCUwiIid4yjYD5abI9ZusW9m S/8yYVGVTsmj6CnpOe8L1Tx/G9Ldm0bhscU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167786262100001 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen Provides functions to access the NVRAM, NVRAM2 and FailSafe region on the Flash over MM communication. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec | 3 + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc | 2 + Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.inf | 35 ++ Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/RuntimeFlashLib.inf | 37 ++ Silicon/Ampere/AmpereAltraPkg/Include/Library/FlashLib.h | 118 += ++++++ Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLibCommon.h | 92 += ++++ Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.c | 83 += ++++ Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLibCommon.c | 372 += +++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/RuntimeFlashLib.c | 137 += ++++++ 9 files changed, 879 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Amp= ere/AmpereAltraPkg/AmpereAltraPkg.dec index 0813fc9b4b69..ac778674266d 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -34,6 +34,9 @@ [LibraryClasses] ## @libraryclass Defines a set of methods to generate random numbers b= y using Hardware RNG. TrngLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/TrngLib.h =20 + ## @libraryclass Defines a set of methods to access flash memory. + FlashLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/FlashLib.h + [Guids] ## NVParam MM GUID gNVParamMmGuid =3D { 0xE4AC5024, 0x29BE, 0x4ADC, { 0x93, 0= x36, 0x87, 0xB5, 0xA0, 0x76, 0x23, 0x2D } } diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index 15f649d97f30..cf1be4df8f27 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -84,6 +84,7 @@ [LibraryClasses.common] AmpereCpuLib|Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCp= uLib.inf TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf MmCommunicationLib|Silicon/Ampere/AmpereAltraPkg/Library/MmCommunication= Lib/MmCommunicationLib.inf + FlashLib|Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.inf =20 # # ARM PL011 UART Driver @@ -252,6 +253,7 @@ [LibraryClasses.common.DXE_RUNTIME_DRIVER] ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf NVParamLib|Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/RuntimeNVPar= amLib.inf AmpereCpuLib|Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeA= mpereCpuLib.inf + FlashLib|Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/RuntimeFlashLib.= inf =20 [LibraryClasses.ARM,LibraryClasses.AARCH64] # diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.inf b/= Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.inf new file mode 100644 index 000000000000..896d8fd965c8 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.inf @@ -0,0 +1,35 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D FlashLib + FILE_GUID =3D 9E9D093D-6484-45AE-BA49-0745AA0BB481 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 0.1 + LIBRARY_CLASS =3D FlashLib + CONSTRUCTOR =3D FlashLibConstructor + +[Sources.common] + FlashLib.c + FlashLibCommon.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseMemoryLib + DebugLib + MemoryAllocationLib + MmCommunicationLib + +[Guids] + gSpiNorMmGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/RuntimeFlashLib= .inf b/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/RuntimeFlashLib.inf new file mode 100644 index 000000000000..e729e29cf450 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/RuntimeFlashLib.inf @@ -0,0 +1,37 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D RuntimeFlashLib + FILE_GUID =3D 0FDF1187-A2DA-4876-8B1F-6D1E928AA319 + MODULE_TYPE =3D DXE_RUNTIME_DRIVER + VERSION_STRING =3D 0.1 + LIBRARY_CLASS =3D FlashLib + CONSTRUCTOR =3D FlashLibConstructor + +[Sources.common] + FlashLibCommon.c + RuntimeFlashLib.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseMemoryLib + DebugLib + MemoryAllocationLib + +[Guids] + gSpiNorMmGuid + +[Protocols] + gEfiMmCommunication2ProtocolGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/FlashLib.h b/Sil= icon/Ampere/AmpereAltraPkg/Include/Library/FlashLib.h new file mode 100644 index 000000000000..ce50602f9934 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/FlashLib.h @@ -0,0 +1,118 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef FLASH_LIB_H_ +#define FLASH_LIB_H_ + +/** + Get the information about the Flash region to store the FailSafe status. + + @param[out] FailSafeBase Base address of the FailSafe space. + @param[out] FailSafeSize Total size of the FailSafe space. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER FailSafeBase or FailSafeSize is NULL. + @retval Others An error has occurred. +**/ +EFI_STATUS +EFIAPI +FlashGetFailSafeInfo ( + OUT UINTN *FailSafeBase, + OUT UINT32 *FailSafeSize + ); + +/** + Get the information about the Flash region to store the NVRAM variables. + + @param[out] NvRamBase Base address of the NVRAM space. + @param[out] NvRamSize Total size of the NVRAM space. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER NvRamBase or NvRamSize is NULL. + @retval Others An error has occurred. +**/ +EFI_STATUS +EFIAPI +FlashGetNvRamInfo ( + OUT UINTN *NvRamBase, + OUT UINT32 *NvRamSize + ); + +/** + Get the information about the second Flash region to store the NVRAM var= iables. + + @param[out] NvRam2Base Base address of the NVRAM space. + @param[out] NvRam2Size Total size of the NVRAM space. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER NvRam2Base or NvRam2Size is NULL. + @retval Others An error has occurred. +**/ +EFI_STATUS +EFIAPI +FlashGetNvRam2Info ( + OUT UINTN *NvRam2Base, + OUT UINT32 *NvRam2Size + ); + +/** + Erase a region of the Flash. + + @param[in] ByteAddress Start address of the region. + @param[in] Length Number of bytes to erase. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER Length is Zero. + @retval Others An error has occurred. +**/ +EFI_STATUS +EFIAPI +FlashEraseCommand ( + IN UINTN ByteAddress, + IN UINT32 Length + ); + +/** + Write data buffer to the Flash. + + @param[in] ByteAddress Start address of the region. + @param[in] Buffer Pointer to the data buffer. + @param[in] Length Number of bytes to write. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER Buffer is NULL or Length is Zero. + @retval Others An error has occurred. +**/ +EFI_STATUS +EFIAPI +FlashWriteCommand ( + IN UINTN ByteAddress, + IN VOID *Buffer, + IN UINT32 Length + ); + +/** + Read data from the Flash into Buffer. + + @param[in] ByteAddress Start address of the region. + @param[out] Buffer Pointer to the data buffer. + @param[in] Length Number of bytes to read. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER Buffer is NULL or Length is Zero. + @retval Others An error has occurred. +**/ +EFI_STATUS +EFIAPI +FlashReadCommand ( + IN UINTN ByteAddress, + OUT VOID *Buffer, + IN UINT32 Length + ); + +#endif /* FLASH_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLibCommon.= h b/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLibCommon.h new file mode 100644 index 000000000000..327429a8f998 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLibCommon.h @@ -0,0 +1,92 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef FLASH_LIB_COMMON_H_ +#define FLASH_LIB_COMMON_H_ + +#define EFI_MM_MAX_TMP_BUF_SIZE 0x1000 +#define EFI_MM_MAX_PAYLOAD_SIZE 0x50 + +#define MM_SPINOR_FUNC_GET_INFO 0x00 +#define MM_SPINOR_FUNC_READ 0x01 +#define MM_SPINOR_FUNC_WRITE 0x02 +#define MM_SPINOR_FUNC_ERASE 0x03 +#define MM_SPINOR_FUNC_GET_NVRAM_INFO 0x04 +#define MM_SPINOR_FUNC_GET_NVRAM2_INFO 0x05 +#define MM_SPINOR_FUNC_GET_FAILSAFE_INFO 0x06 + +#define MM_SPINOR_RES_SUCCESS 0xAABBCC00 +#define MM_SPINOR_RES_FAIL 0xAABBCCFF + +#pragma pack(1) + +typedef struct { + // + // Allows for disambiguation of the message format. + // + EFI_GUID HeaderGuid; + + // + // Describes the size of Data (in bytes) and does not include the size o= f the header. + // + UINTN MessageLength; + + // + // Designates an array of bytes that is MessageLength in size. + // + UINT8 Data[EFI_MM_MAX_PAYLOAD_SIZE]; +} EFI_MM_COMMUNICATE_REQUEST; + +typedef struct { + UINT64 Status; + UINT64 DeviceBase; + UINT64 PageSize; + UINT64 SectorSize; + UINT64 DeviceSize; +} EFI_MM_COMMUNICATE_SPINOR_RESPONSE; + +typedef struct { + UINT64 Status; + UINT64 FailSafeBase; + UINT64 FailSafeSize; +} EFI_MM_COMMUNICATE_FAILSAFE_INFO_RESPONSE; + +typedef struct { + UINT64 Status; + UINT64 NvRamBase; + UINT64 NvRamSize; +} EFI_MM_COMMUNICATE_NVRAM_INFO_RESPONSE; + +#pragma pack() + +extern BOOLEAN gFlashLibRuntime; +extern UINT8 *gFlashLibPhysicalBuffer; +extern UINT8 *gFlashLibVirtualBuffer; + +/** + Provides an interface to access the Flash services via MM interface. + + @param[in] Request Pointer to the request buffer + @param[in] RequestDataSize Size of the request buffer. + @param[out] Response Pointer to the response buffer + @param[in] ResponseDataSize Size of the response buffer. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER An invalid data parameter or an invalid + combination of data parameters. + @retval Others An error has occurred. +**/ +EFI_STATUS +FlashMmCommunicate ( + IN VOID *Request, + IN UINT32 RequestDataSize, + OUT VOID *Response, + IN UINT32 ResponseDataSize + ); + +#endif /* FLASH_LIB_COMMON_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.c b/Si= licon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.c new file mode 100644 index 000000000000..6c8a79699cd4 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.c @@ -0,0 +1,83 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include + +#include "FlashLibCommon.h" + +/** + Constructor function of the FlashLib + + @retval EFI_SUCCESS The constructor executes successfully. +**/ +EFI_STATUS +EFIAPI +FlashLibConstructor ( + VOID + ) +{ + gFlashLibPhysicalBuffer =3D AllocateZeroPool (EFI_MM_MAX_TMP_BUF_SIZE); + gFlashLibVirtualBuffer =3D gFlashLibPhysicalBuffer; + ASSERT (gFlashLibPhysicalBuffer !=3D NULL); + + return EFI_SUCCESS; +} + +/** + Provides an interface to access the Flash services via MM interface. + + @param[in] Request Pointer to the request buffer + @param[in] RequestDataSize Size of the request buffer. + @param[out] Response Pointer to the response buffer + @param[in] ResponseDataSize Size of the response buffer. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER An invalid data parameter or an invalid + combination of data parameters. + @retval Others An error has occurred. +**/ +EFI_STATUS +FlashMmCommunicate ( + IN VOID *Request, + IN UINT32 RequestDataSize, + OUT VOID *Response, + IN UINT32 ResponseDataSize + ) +{ + EFI_MM_COMMUNICATE_REQUEST CommBuffer; + EFI_STATUS Status; + + if (Request =3D=3D NULL || RequestDataSize =3D=3D 0 + || RequestDataSize > EFI_MM_MAX_PAYLOAD_SIZE + || (ResponseDataSize =3D=3D 0 && Response =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + CopyGuid (&CommBuffer.HeaderGuid, &gSpiNorMmGuid); + CommBuffer.MessageLength =3D RequestDataSize; + CopyMem (CommBuffer.Data, Request, RequestDataSize); + + Status =3D MmCommunicationCommunicate ( + &CommBuffer, + NULL + ); + if (EFI_ERROR (Status)) { + return Status; + } + + if (ResponseDataSize > 0) { + CopyMem (Response, CommBuffer.Data, ResponseDataSize); + } + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLibCommon.= c b/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLibCommon.c new file mode 100644 index 000000000000..83695c857a11 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLibCommon.c @@ -0,0 +1,372 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include + +#include "FlashLibCommon.h" + +BOOLEAN gFlashLibRuntime =3D FALSE; +UINT8 *gFlashLibPhysicalBuffer; +UINT8 *gFlashLibVirtualBuffer; + +/** + Convert Virtual Address to Physical Address at Runtime. + + @param[in] VirtualPtr Virtual Address Pointer. + @param[in] Size Total bytes of the buffer. + + @retval Pointer to the physical address of the converted buffer. +**/ +STATIC +UINT8 * +ConvertToPhysicalBuffer ( + IN UINT8 *VirtualPtr, + IN UINT32 Size + ) +{ + if (gFlashLibRuntime) { + ASSERT (VirtualPtr !=3D NULL); + CopyMem (gFlashLibVirtualBuffer, VirtualPtr, Size); + return gFlashLibPhysicalBuffer; + } + + return VirtualPtr; +} + +/** + Get the information about the Flash region to store the FailSafe status. + + @param[out] FailSafeBase Base address of the FailSafe space. + @param[out] FailSafeSize Total size of the FailSafe space. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER FailSafeBase or FailSafeSize is NULL. + @retval Others An error has occurred. +**/ +EFI_STATUS +EFIAPI +FlashGetFailSafeInfo ( + OUT UINTN *FailSafeBase, + OUT UINT32 *FailSafeSize + ) +{ + EFI_MM_COMMUNICATE_FAILSAFE_INFO_RESPONSE FailSafeInfo; + EFI_STATUS Status; + UINT64 MmData[5]; + + if (FailSafeBase =3D=3D NULL || FailSafeSize =3D=3D NULL ) { + return EFI_INVALID_PARAMETER; + } + + MmData[0] =3D MM_SPINOR_FUNC_GET_FAILSAFE_INFO; + + Status =3D FlashMmCommunicate ( + MmData, + sizeof (MmData), + &FailSafeInfo, + sizeof (FailSafeInfo) + ); + if (EFI_ERROR (Status)) { + return Status; + } + + if (FailSafeInfo.Status =3D=3D MM_SPINOR_RES_SUCCESS) { + *FailSafeBase =3D FailSafeInfo.FailSafeBase; + *FailSafeSize =3D FailSafeInfo.FailSafeSize; + + DEBUG (( + DEBUG_INFO, + "%a: FailSafe Base 0x%llx, Size 0x%lx\n", + __FUNCTION__, + *FailSafeBase, + *FailSafeSize + )); + } + + return EFI_SUCCESS; +} + +/** + Get the information about the Flash region to store the NVRAM variables. + + @param[out] NvRamBase Base address of the NVRAM space. + @param[out] NvRamSize Total size of the NVRAM space. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER NvRamBase or NvRamSize is NULL. + @retval Others An error has occurred. +**/ +EFI_STATUS +EFIAPI +FlashGetNvRamInfo ( + OUT UINTN *NvRamBase, + OUT UINT32 *NvRamSize + ) +{ + EFI_MM_COMMUNICATE_NVRAM_INFO_RESPONSE NvRamInfo; + EFI_STATUS Status; + UINT64 MmData[5]; + + if (NvRamBase =3D=3D NULL || NvRamSize =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + MmData[0] =3D MM_SPINOR_FUNC_GET_NVRAM_INFO; + + Status =3D FlashMmCommunicate ( + MmData, + sizeof (MmData), + &NvRamInfo, + sizeof (NvRamInfo) + ); + if (EFI_ERROR (Status)) { + return Status; + } + + if (NvRamInfo.Status =3D=3D MM_SPINOR_RES_SUCCESS) { + *NvRamBase =3D NvRamInfo.NvRamBase; + *NvRamSize =3D NvRamInfo.NvRamSize; + DEBUG (( + DEBUG_INFO, + "%a: NVRAM Base 0x%llx, Size 0x%lx\n", + __FUNCTION__, + *NvRamBase, + *NvRamSize + )); + } + + return EFI_SUCCESS; +} + +/** + Get the information about the second Flash region to store the NVRAM var= iables. + + @param[out] NvRam2Base Base address of the NVRAM space. + @param[out] NvRam2Size Total size of the NVRAM space. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER NvRam2Base or NvRam2Size is NULL. + @retval Others An error has occurred. +**/ +EFI_STATUS +EFIAPI +FlashGetNvRam2Info ( + OUT UINTN *NvRam2Base, + OUT UINT32 *NvRam2Size + ) +{ + EFI_MM_COMMUNICATE_NVRAM_INFO_RESPONSE NvRam2Info; + EFI_STATUS Status; + UINT64 MmData[5]; + + if (NvRam2Base =3D=3D NULL || NvRam2Size =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + MmData[0] =3D MM_SPINOR_FUNC_GET_NVRAM2_INFO; + + Status =3D FlashMmCommunicate ( + MmData, + sizeof (MmData), + &NvRam2Info, + sizeof (NvRam2Info) + ); + if (EFI_ERROR (Status)) { + return Status; + } + + if (NvRam2Info.Status =3D=3D MM_SPINOR_RES_SUCCESS) { + *NvRam2Base =3D NvRam2Info.NvRamBase; + *NvRam2Size =3D NvRam2Info.NvRamSize; + DEBUG (( + DEBUG_INFO, + "%a: NVRAM2 Base 0x%llx, Size 0x%lx\n", + __FUNCTION__, + *NvRam2Base, + *NvRam2Size + )); + } + + return EFI_SUCCESS; +} + +/** + Erase a region of the Flash. + + @param[in] ByteAddress Start address of the region. + @param[in] Length Number of bytes to erase. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER Length is Zero. + @retval Others An error has occurred. +**/ +EFI_STATUS +EFIAPI +FlashEraseCommand ( + IN UINTN ByteAddress, + IN UINT32 Length + ) +{ + EFI_MM_COMMUNICATE_SPINOR_RESPONSE MmSpiNorRes; + EFI_STATUS Status; + UINT64 MmData[5]; + + if (Length =3D=3D 0) { + return EFI_INVALID_PARAMETER; + } + + MmData[0] =3D MM_SPINOR_FUNC_ERASE; + MmData[1] =3D ByteAddress; + MmData[2] =3D Length; + + Status =3D FlashMmCommunicate ( + MmData, + sizeof (MmData), + &MmSpiNorRes, + sizeof (MmSpiNorRes) + ); + if (EFI_ERROR (Status)) { + return Status; + } + + if (MmSpiNorRes.Status !=3D MM_SPINOR_RES_SUCCESS) { + DEBUG ((DEBUG_ERROR, "%a: Device error %llx\n", __FUNCTION__, MmSpiNor= Res.Status)); + return EFI_DEVICE_ERROR; + } + + return EFI_SUCCESS; +} + +/** + Write data buffer to the Flash. + + @param[in] ByteAddress Start address of the region. + @param[in] Buffer Pointer to the data buffer. + @param[in] Length Number of bytes to write. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER Buffer is NULL or Length is Zero. + @retval Others An error has occurred. +**/ +EFI_STATUS +EFIAPI +FlashWriteCommand ( + IN UINTN ByteAddress, + IN VOID *Buffer, + IN UINT32 Length + ) +{ + EFI_MM_COMMUNICATE_SPINOR_RESPONSE MmSpiNorRes; + EFI_STATUS Status; + UINT64 MmData[5]; + UINTN Remain, NumWrite; + UINTN Count =3D 0; + + if (Buffer =3D=3D NULL || Length =3D=3D 0) { + return EFI_INVALID_PARAMETER; + } + + Remain =3D Length; + while (Remain > 0) { + NumWrite =3D (Remain > EFI_MM_MAX_TMP_BUF_SIZE) ? EFI_MM_MAX_TMP_BUF_S= IZE : Remain; + + MmData[0] =3D MM_SPINOR_FUNC_WRITE; + MmData[1] =3D ByteAddress + Count; + MmData[2] =3D NumWrite; + MmData[3] =3D (UINT64)ConvertToPhysicalBuffer (Buffer + Count, NumWrit= e); + + Status =3D FlashMmCommunicate ( + MmData, + sizeof (MmData), + &MmSpiNorRes, + sizeof (MmSpiNorRes) + ); + if (EFI_ERROR (Status)) { + return Status; + } + + if (MmSpiNorRes.Status !=3D MM_SPINOR_RES_SUCCESS) { + DEBUG ((DEBUG_ERROR, "%a: Device error 0x%llx\n", __FUNCTION__, MmSp= iNorRes.Status)); + return EFI_DEVICE_ERROR; + } + + Remain -=3D NumWrite; + Count +=3D NumWrite; + } + + return EFI_SUCCESS; +} + +/** + Read data from the Flash into Buffer. + + @param[in] ByteAddress Start address of the region. + @param[out] Buffer Pointer to the data buffer. + @param[in] Length Number of bytes to read. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER Buffer is NULL or Length is Zero. + @retval Others An error has occurred. +**/ +EFI_STATUS +EFIAPI +FlashReadCommand ( + IN UINTN ByteAddress, + OUT VOID *Buffer, + IN UINT32 Length + ) +{ + EFI_MM_COMMUNICATE_SPINOR_RESPONSE MmSpiNorRes; + EFI_STATUS Status; + UINT64 MmData[5]; + UINTN Remain, NumRead; + UINTN Count =3D 0; + + if (Buffer =3D=3D NULL || Length =3D=3D 0) { + return EFI_INVALID_PARAMETER; + } + + Remain =3D Length; + while (Remain > 0) { + NumRead =3D (Remain > EFI_MM_MAX_TMP_BUF_SIZE) ? EFI_MM_MAX_TMP_BUF_SI= ZE : Remain; + + MmData[0] =3D MM_SPINOR_FUNC_READ; + MmData[1] =3D ByteAddress + Count; + MmData[2] =3D NumRead; + MmData[3] =3D (UINT64)gFlashLibPhysicalBuffer; // Read data into the = temp buffer with specified virtual address + + Status =3D FlashMmCommunicate ( + MmData, + sizeof (MmData), + &MmSpiNorRes, + sizeof (MmSpiNorRes) + ); + if (EFI_ERROR (Status)) { + return Status; + } + + if (MmSpiNorRes.Status !=3D MM_SPINOR_RES_SUCCESS) { + DEBUG ((DEBUG_ERROR, "%a: Device error %llx\n", __FUNCTION__, MmSpiN= orRes.Status)); + return EFI_DEVICE_ERROR; + } + + // + // Get data from the virtual address of the temp buffer. + // + CopyMem ((VOID *)(Buffer + Count), (VOID *)gFlashLibVirtualBuffer, Num= Read); + Remain -=3D NumRead; + Count +=3D NumRead; + } + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/RuntimeFlashLib= .c b/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/RuntimeFlashLib.c new file mode 100644 index 000000000000..2dcd13e08146 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/RuntimeFlashLib.c @@ -0,0 +1,137 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include + +#include "FlashLibCommon.h" + +STATIC EFI_MM_COMMUNICATION2_PROTOCOL *mMmCommunicationProtocol =3D NULL; + +/** + This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRESS= _CHANGE + event. It converts a pointer to a new virtual address. + + @param[in] Event Event whose notification function is being invok= ed. + @param[in] Context Pointer to the notification function's context +**/ +VOID +EFIAPI +FlashLibAddressChangeEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + gRT->ConvertPointer (0x0, (VOID **)&gFlashLibVirtualBuffer); + gRT->ConvertPointer (0x0, (VOID **)&mMmCommunicationProtocol); + + gFlashLibRuntime =3D TRUE; +} + +/** + Constructor function of the RuntimeFlashLib. + + @param[in] ImageHandle The image handle. + @param[in] SystemTable The system table. + + @retval EFI_SUCCESS Operation succeeded. + @retval Others An error has occurred. +**/ +EFI_STATUS +EFIAPI +FlashLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_EVENT VirtualAddressChangeEvent =3D NULL; + EFI_STATUS Status; + + gFlashLibPhysicalBuffer =3D AllocateRuntimeZeroPool (EFI_MM_MAX_TMP_BUF_= SIZE); + gFlashLibVirtualBuffer =3D gFlashLibPhysicalBuffer; + ASSERT (gFlashLibPhysicalBuffer !=3D NULL); + + Status =3D gBS->LocateProtocol ( + &gEfiMmCommunication2ProtocolGuid, + NULL, + (VOID **)&mMmCommunicationProtocol + ); + ASSERT_EFI_ERROR (Status); + + Status =3D gBS->CreateEvent ( + EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE, + TPL_CALLBACK, + FlashLibAddressChangeEvent, + NULL, + &VirtualAddressChangeEvent + ); + ASSERT_EFI_ERROR (Status); + + return Status; +} + +/** + Provides an interface to access the Flash services via MM interface. + + @param[in] Request Pointer to the request buffer + @param[in] RequestDataSize Size of the request buffer. + @param[out] Response Pointer to the response buffer + @param[in] ResponseDataSize Size of the response buffer. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER An invalid data parameter or an invalid + combination of data parameters. + @retval Others An error has occurred. +**/ +EFI_STATUS +FlashMmCommunicate ( + IN VOID *Request, + IN UINT32 RequestDataSize, + OUT VOID *Response, + IN UINT32 ResponseDataSize + ) +{ + EFI_MM_COMMUNICATE_REQUEST CommBuffer; + EFI_STATUS Status; + + if (Request =3D=3D NULL || RequestDataSize =3D=3D 0 + || RequestDataSize > EFI_MM_MAX_PAYLOAD_SIZE + || (ResponseDataSize =3D=3D 0 && Response =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + CopyGuid (&CommBuffer.HeaderGuid, &gSpiNorMmGuid); + CommBuffer.MessageLength =3D RequestDataSize; + CopyMem (CommBuffer.Data, Request, RequestDataSize); + + if (mMmCommunicationProtocol =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + Status =3D mMmCommunicationProtocol->Communicate ( + mMmCommunicationProtocol, + &CommBuffer, + &CommBuffer, + NULL + ); + if (EFI_ERROR (Status)) { + return Status; + } + + if (ResponseDataSize > 0) { + CopyMem (Response, CommBuffer.Data, ResponseDataSize); + } + + return EFI_SUCCESS; +} --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83814): https://edk2.groups.io/g/devel/message/83814 Mute This Topic: https://groups.io/mt/87123853/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83815+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83815+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167786776707.0167245210491; Wed, 17 Nov 2021 08:49:46 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id mljUYY1788612xSapy3byrGE; Wed, 17 Nov 2021 08:49:46 -0800 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.134]) by mx.groups.io with SMTP id smtpd.web10.9739.1637167785254487283 for ; Wed, 17 Nov 2021 08:49:45 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JaNGQcMrDuY409gCp5ph97DzgJvTi43hS94fDX1gpqnbmBPD9IpQ7wxEuv5/wfvykLX9efRnp2N1cD3sFavC7vS2KGip3s4/0s+a48ug9Op23TZ5ToFrQfm0yrBxMG0EeHX+hD+0n4mN8xIPRSMmyaDS9MvkJ6wx0xM7J/8IkzaifYlsLWmj5kyUkxm/2urwYFihA26JwgA592srNqNBcwpAw91Zs4++w52MQ+hn2m2AblHsKxGNp9enTtbQmx9bNdFGisImtJkI0g3Setqb8kCFfal9U/VO7zMgGQvRs7BUD8hfXtsUn4wM9GkPIETtYoe7Zd0pRIcNjGG7cDJMUw== 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=PA3RTErQOtQ0ARiiaS6tUC4U8UgkqnVOoRxc1eF3PEY=; b=KFPWzIqB2do9+G6d3k6/6hOKTZmFQgNvlCmu8JzBHMecuOi1CRxApQ3eQuk2tIzF3cE18USOKVx/CkpI3sEqBZ9sQVbG+Zape8s+t86ukQJQud0BxZXmtIP7QoiWs1sZmQyMbo8WvFh+Jvv64JzBHY6+rGXy2I42scAq1y0OFPMu0F5G/OG/xXsZTtl3P8MR5Ihpb4lwiP1JElm+ARh2daY79wGOiOi2FnGVfrVjgX9VncxQTJ2yY1XuAldP2DbzagnhFGwVsGnnuKY/9GL37d32nv3FlNX76Zoi+Ejz2vWqeodNxdtOe5GHkcScmYoys3u21zcCLpHRLdJpD671Nw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB6454.prod.exchangelabs.com (2603:10b6:510:1b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.20; Wed, 17 Nov 2021 16:49:43 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:49:43 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 03/30] AmpereAltraPkg: Add DwI2cLib library instance Date: Wed, 17 Nov 2021 23:47:00 +0700 Message-ID: <20211117164727.10922-4-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:49:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d6589372-15c9-455d-6293-08d9a9ea4151 X-MS-TrafficTypeDiagnostic: PH0PR01MB6454: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: lzpI47C71PZHk1+xdH9S5txeZuHs7KiYUcIC6lZnluR6+YPtMOPn8YCILgRk9y8gPftKsY5vTv4a4QmXWyU6MU7cGnPEIrfDt6LPVlvm0XXcFsdD88A7XCdbaHQKEx5Dm8o8hPHAg3hevP3qAAs954NYJVCVUWEb5wgNZe4fXisHAOnRgHp0PCCP8R+RRHJdZGdNvU8WRRRdPzqp2ux7s0xwkrByrLPO53RwAAiKXhkhEn71c370cTU5gI+neJn9X4lipmMSXx64HFritKHCTRlC77J0TG9KP2YXbh5+RbJyrK9s84HQq5As1hVFEounRlZbLKJRIb3PfgV/91ppRR0EIskO2Y24fKUQn6OT7gxglQ9J8CSbR/WI18UhxivthoQEjspumbMQF/n/IAiVIig/7jBM3u0/fpqe4aQ+K0rLg+xMMlBMW2tByDF/s/dPQ5nkRup1nci8edJ5TbnmzVU1XzrB3h2G/bvw31oLu5fkoVVHvGC5CwApN6VDmBzRifwJq9O5UDEAQ+3ZZ/EbifDtR98ZTeEBS3755e+zDxyrax38jzImlUXzHguxe0wti35D98xxMNZU4CsXyo/MZHVmJYOaZY6vIYEc00/Du5pzDyQVjIsbDJEE6jXoBN+32TmOvqEIU2kxiKn5zSEz+qTGP5z7ZlwN8g5WjZjIHDA3Eaox0z+yD6pruDIICZPGOuvHacmBOggnV1y8Rrf3pA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Yu+cvcARAYE/zi9l26R+I0hhB4VckO3kPdDurVTkk8Q4XDOHw/3j+cQOBqbg?= =?us-ascii?Q?ToWU38l7gksPJdg+iffgOIuoLIFUWr7HE66X1GF20CRfV8S2nODP9UEMuZXg?= =?us-ascii?Q?ra4Encz0CJ0zkArM9rtVZRFL4WXNpAfp6vDP+JWtCtrtcKn1/bsH7yNWFDu4?= =?us-ascii?Q?EES96cKtRogpNZxLPDhs69RkGDx/lPSG80TdYls4X/XUdo36c0wavMdBOFPN?= =?us-ascii?Q?mXKtYETlzJ0PMhSQHwCG34pHQQDejPRfjX6/DSSmDVo9IEiwiGyvVm7Z3AWt?= =?us-ascii?Q?LDvg3PdlSyVMjt28V5ofuxi5wMaHRcx3jlt499EfmQYmls1EXtDOI3Ue8wuv?= =?us-ascii?Q?7OCXYUzLaBe2j1K0Ws6CbpDJJ2g1mdVRIxQdAR+0WqWN/DoQwX2anhEMpykX?= =?us-ascii?Q?MKlXYHm+PVeFZ+uWxBbM9ixqVgvqSiuWzXiLwMFXM4gwifaB5QaSnW9RmA4t?= =?us-ascii?Q?SsQRU05W4BA8nzRiFkQzCdSPH4NcSXM3hV7FaDjRuQw7ZSfB79AJCOYKF10n?= =?us-ascii?Q?H66jLv2GR/gXC4fuzLhRd6rZ8MoWd3INL5At/XyzMpnZitRm3mQfuVmS5GW+?= =?us-ascii?Q?SuCOQUVjSFewK9P4QqNjKIwBWi/Za7+X1FS+m4sbD6BBHyWvuCsGyfD4eK8E?= =?us-ascii?Q?FOU8mjpCUWsVH7YUNoY00mkgO9ue7HObs4+zZjZH2cMhIIR17i7f2Z1PXGPF?= =?us-ascii?Q?RF8T3Ye+9yAEmv3ZneDF8QgKMrDwmwfG8/KMO5uYReVZ56ViButWPjZD+RnT?= =?us-ascii?Q?AkJURlkolKJJrpurPQmHDuYr03WeCwwbqRNA5ntHeqnXQf01oOOU7/n2S/cy?= =?us-ascii?Q?dkfpfBqJoKieYT2/T1Q5k22uneVyb/ddLFZBBz7b1sNNKU7K9GQ1vMzzJjBj?= =?us-ascii?Q?LgFs9CMyhC+XjyMrkiMYMcSv/gr9ZX82kcUDnkVLpOr+vKo9xX6XkV2OBdoy?= =?us-ascii?Q?cfhg6Q2Jf6SSwcbIS0Whgh8pbYbkJE/8Ctr7ktim+wYsgMSJkrHMZVIdVhNc?= =?us-ascii?Q?xdwwpkBeiZRdDbBQCPxzGXOqQFQ4NW6YhHN+zHpPgz7v9OZpZAUHkdZh1YD6?= =?us-ascii?Q?lcYeRMxAQoGKRH0Ird26GYlzFTqxT742sTHwSnnyrhYSkp3o8zsTaH5dEQCV?= =?us-ascii?Q?kqhi5Yaqej95v2LgYhEAjJ2+7j2KbWwwDwIxEXoLsSEbv0MhnyRC7b1KtMQW?= =?us-ascii?Q?suSHMovrm8cobOx1Czz7F51CzEH3bm10Kv+M5NuZvnKbdejiOe+MOPsILi1a?= =?us-ascii?Q?+jv6B/5Ga773haxoeM02LQeo+EPtEhDg4tP0RhUjRnWHYZfV8mfucbRwumGW?= =?us-ascii?Q?OVNSe73V96k0gFpjtQdRR9CL7ySgVW6BuQ1O84kxauwf7q/7t5piq3iDB6Tp?= =?us-ascii?Q?OgAa30wpAx/+gDtlvKMbfZvD31WWmIC+CC5iz3i7CW+LRIyo8OmFWffjk81t?= =?us-ascii?Q?eg80WTTphdn8/rc5f7eCgJujbmZ+3s4Jr71azKQ7WKF/f+O3OI8ErC+2jqeP?= =?us-ascii?Q?v+UZwwZ7HFoUeO0jxXryybZYr5FHcj84xEzZt7d3CNtW0NVd8HoAWPXZxUcM?= =?us-ascii?Q?PlcvYUGxBpbRSdhtmXZaXgLXDRjwrS82+kKCBOKvh3s35ZvcxqqxqR8CnAbP?= =?us-ascii?Q?OgyRak00ZJniKPy6yZXsoo1ITk6zqh1OgAqrKvz0h2aYBsWemoqmUM3MidDI?= =?us-ascii?Q?0WtR2g=3D=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: d6589372-15c9-455d-6293-08d9a9ea4151 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:49:43.5478 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cBBbjdQFRhSLL1kabe8FsNzjZlKS2OSuWDysNl6zCJUZ2afvfsTZ80tpmFOG74XXR6EWKPLtqtgeKhp/uFKAcM8G8J2sywFZOXaos8GBS9g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6454 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: tnJYeePl3yFxM7ZEVxK8JUf7x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167786; bh=G/YdsauyLO45rldH30iAW47G9orMoQ1pFlc4mKWFeZY=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=Ul0uVgHTTyNZf5q6nbGJktocDb75+UkxYhK4Zd15suDqBOTGZMud9PFWCzI22HbOvgr MdeTTi56KsAbYAdorlqIyNN+blB5pyK2j5dosuNP0+WGs9ucH4sbsp9tAPpjz5I5HgqYp jIoiN3mpa7gRc6HC/GGjx7eWh9rcWQCwva8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167788528100002 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen The DwI2cLib library provides basic functions to control the I2C controller on Ampere Altra processor. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec | 3 + Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.inf | 38 + Silicon/Ampere/AmpereAltraPkg/Include/Library/I2cLib.h | 100 +++ Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h | 10 + Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.c | 882 ++++++++= ++++++++++++ 5 files changed, 1033 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Amp= ere/AmpereAltraPkg/AmpereAltraPkg.dec index ac778674266d..57ee7aafe545 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -28,6 +28,9 @@ [LibraryClasses] ## @libraryclass Defines a set of methods to communicate with SCP. SystemFirmwareInterfaceLib|Silicon/Ampere/AmpereAltraPkg/Include/Library= /SystemFirmwareInterfaceLib.h =20 + ## @libraryclass Defines a set of methods to read/write to I2C devices. + I2cLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/I2cLib.h + ## @libraryclass Defines a set of methods to communicate with secure p= arition over MM interface. MmCommunicationLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/MmCommu= nicationLib.h =20 diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.inf b/= Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.inf new file mode 100644 index 000000000000..7e697558cfb1 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.inf @@ -0,0 +1,38 @@ +## @file +# Component description for DwI2cLib library for the Designware I2C contro= ller. +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D DwI2cLib + FILE_GUID =3D 222609E2-C181-11E6-A4A6-CEC0C932CE01 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D I2cLib + CONSTRUCTOR =3D I2cLibConstructor + +[Sources] + DwI2cLib.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + HobLib + IoLib + TimerLib + +[Guids] + gEfiEventVirtualAddressChangeGuid + gPlatformInfoHobGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/I2cLib.h b/Silic= on/Ampere/AmpereAltraPkg/Include/Library/I2cLib.h new file mode 100644 index 000000000000..f13794171029 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/I2cLib.h @@ -0,0 +1,100 @@ +/** @file + Library implementation for the Designware I2C controller. + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef I2C_LIB_H_ +#define I2C_LIB_H_ + +#include + +/** + Write to I2C bus. + + @param[in] Bus I2C bus Id. + @param[in] SlaveAddr The address of slave device on the bus. + @param[in,out] Buf Buffer that holds data to write. + @param[in,out] WriteLength Pointer to length of buffer. + + @return EFI_SUCCESS Write successfully. + @return EFI_INVALID_PARAMETER A parameter is invalid. + @return EFI_UNSUPPORTED The bus is not supported. + @return EFI_NOT_READY The device/bus is not ready. + @return EFI_TIMEOUT Timeout why transferring data. + +**/ +EFI_STATUS +EFIAPI +I2cWrite ( + IN UINT32 Bus, + IN UINT32 SlaveAddr, + IN OUT UINT8 *Buf, + IN OUT UINT32 *WriteLength + ); + +/** + Read data from I2C bus. + + @param[in] Bus I2C bus Id. + @param[in] SlaveAddr The address of slave device on the bus. + @param[in] BufCmd Buffer where to send the command. + @param[in] CmdLength Pointer to length of BufCmd. + @param[in,out] Buf Buffer where to put the read data to. + @param[in,out] ReadLength Pointer to length of buffer. + + @return EFI_SUCCESS Read successfully. + @return EFI_INVALID_PARAMETER A parameter is invalid. + @return EFI_UNSUPPORTED The bus is not supported. + @return EFI_NOT_READY The device/bus is not ready. + @return EFI_TIMEOUT Timeout why transferring data. + @return EFI_CRC_ERROR There are errors on receiving data. + +**/ +EFI_STATUS +EFIAPI +I2cRead ( + IN UINT32 Bus, + IN UINT32 SlaveAddr, + IN UINT8 *BufCmd, + IN UINT32 CmdLength, + IN OUT UINT8 *Buf, + IN OUT UINT32 *ReadLength + ); + +/** + Setup new transaction with I2C slave device. + + @param[in] Bus I2C bus Id. + @param[in] BusSpeed I2C bus speed in Hz. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + +**/ +EFI_STATUS +EFIAPI +I2cProbe ( + IN UINT32 Bus, + IN UINTN BusSpeed + ); + +/** + Setup a bus that to be used in runtime service. + + @param[in] Bus I2C bus Id. + + @retval EFI_SUCCESS Success. + @retval Otherwise Error code. + +**/ +EFI_STATUS +EFIAPI +I2cSetupRuntime ( + IN UINT32 Bus + ); + +#endif /* I2C_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h b/Silico= n/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h index c5774dca7a0a..453d966d6058 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h @@ -59,4 +59,14 @@ // #define SLAVE_PRESENT_N BIT1 =20 +// +// The maximum number of I2C bus +// +#define AC01_I2C_MAX_BUS_NUM 2 + +// +// The base address of DW I2C +// +#define AC01_I2C_BASE_ADDRESS_LIST 0x1000026B0000ULL, 0x10000275000= 0ULL + #endif /* PLATFORM_AC01_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.c b/Si= licon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.c new file mode 100644 index 000000000000..669ba2ea98a4 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.c @@ -0,0 +1,882 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define I2cSync() { asm volatile ("dmb ish" : : : "memory"); } + +// +// Runtime needs to be 64K alignment +// +#define RUNTIME_ADDRESS_MASK (~(SIZE_64KB - 1)) +#define RUNTIME_ADDRESS_LENGTH SIZE_64KB + +// +// Private I2C bus data +// +typedef struct { + UINTN Base; + UINT32 BusSpeed; + UINT32 RxFifo; + UINT32 TxFifo; + UINT32 PollingTime; + UINT32 Enabled; +} DW_I2C_CONTEXT_T; + +// +// I2C SCL counter macros +// +typedef enum { + I2cSpeedModeStandard =3D 0, + I2cSpeedModeFast, +} I2C_SPEED_MODE; + +#define DW_I2C_MAXIMUM_SPEED_HZ 400000 + +typedef enum { + I2cSclSpkLen =3D 0, + I2cSclHcnt, + I2cSclLcnt, +} I2C_SCL_PARAM; + +STATIC UINT32 I2cSclParam[][3] =3D { + /* SPK_LEN, HCNT, LCNT */ + [I2cSpeedModeStandard] =3D { 10, 0x3E2, 0x47D }, // SS (Standard Speed) + [I2cSpeedModeFast] =3D { 10, 0xA4, 0x13F }, // FS (Fast Speed) +}; + +STATIC BOOLEAN mI2cRuntimeEnableArray[AC01_I2C_MAX_BUS_NUM] =3D {= FALSE}; +STATIC UINTN mI2cBaseArray[AC01_I2C_MAX_BUS_NUM] =3D {AC01_I2C_= BASE_ADDRESS_LIST}; +STATIC DW_I2C_CONTEXT_T mI2cBusList[AC01_I2C_MAX_BUS_NUM]; +STATIC UINTN mI2cClock =3D 0; +STATIC EFI_EVENT mVirtualAddressChangeEvent =3D NULL; + +// +// Registers +// +#define DW_IC_CON 0x0 +#define DW_IC_CON_MASTER BIT0 +#define DW_IC_CON_SPEED_STD BIT1 +#define DW_IC_CON_SPEED_FAST BIT2 +#define DW_IC_CON_10BITADDR_MASTER BIT4 +#define DW_IC_CON_RESTART_EN BIT5 +#define DW_IC_CON_SLAVE_DISABLE BIT6 +#define DW_IC_TAR 0x4 +#define DW_IC_TAR_10BITS BIT12 +#define DW_IC_SAR 0x8 +#define DW_IC_DATA_CMD 0x10 +#define DW_IC_DATA_CMD_RESTART BIT10 +#define DW_IC_DATA_CMD_STOP BIT9 +#define DW_IC_DATA_CMD_CMD BIT8 +#define DW_IC_DATA_CMD_DAT_MASK 0xFF +#define DW_IC_SS_SCL_HCNT 0x14 +#define DW_IC_SS_SCL_LCNT 0x18 +#define DW_IC_FS_SCL_HCNT 0x1c +#define DW_IC_FS_SCL_LCNT 0x20 +#define DW_IC_HS_SCL_HCNT 0x24 +#define DW_IC_HS_SCL_LCNT 0x28 +#define DW_IC_INTR_STAT 0x2c +#define DW_IC_INTR_MASK 0x30 +#define DW_IC_INTR_RX_UNDER BIT0 +#define DW_IC_INTR_RX_OVER BIT1 +#define DW_IC_INTR_RX_FULL BIT2 +#define DW_IC_INTR_TX_EMPTY BIT4 +#define DW_IC_INTR_TX_ABRT BIT6 +#define DW_IC_INTR_ACTIVITY BIT8 +#define DW_IC_INTR_STOP_DET BIT9 +#define DW_IC_INTR_START_DET BIT10 +#define DW_IC_ERR_CONDITION \ + (DW_IC_INTR_RX_UNDER | DW_IC_INTR_RX_OVER | DW_IC_INTR_TX_= ABRT) +#define DW_IC_RAW_INTR_STAT 0x34 +#define DW_IC_CLR_INTR 0x40 +#define DW_IC_CLR_RX_UNDER 0x44 +#define DW_IC_CLR_RX_OVER 0x48 +#define DW_IC_CLR_TX_ABRT 0x54 +#define DW_IC_CLR_ACTIVITY 0x5c +#define DW_IC_CLR_STOP_DET 0x60 +#define DW_IC_CLR_START_DET 0x64 +#define DW_IC_ENABLE 0x6c +#define DW_IC_STATUS 0x70 +#define DW_IC_STATUS_ACTIVITY BIT0 +#define DW_IC_STATUS_TFE BIT2 +#define DW_IC_STATUS_RFNE BIT3 +#define DW_IC_STATUS_MST_ACTIVITY BIT5 +#define DW_IC_TXFLR 0x74 +#define DW_IC_RXFLR 0x78 +#define DW_IC_SDA_HOLD 0x7c +#define DW_IC_TX_ABRT_SOURCE 0x80 +#define DW_IC_ENABLE_STATUS 0x9c +#define DW_IC_COMP_PARAM_1 0xf4 +#define DW_IC_COMP_PARAM_1_RX_BUFFER_DEPTH(x) \ + ((((x) >> 8) & 0xFF) + 1) +#define DW_IC_COMP_PARAM_1_TX_BUFFER_DEPTH(x) \ + ((((x) >> 16) & 0xFF) + 1) +#define DW_IC_COMP_TYPE 0xfc +#define SB_DW_IC_CON 0xa8 +#define SB_DW_IC_SCL_TMO_CNT 0xac +#define SB_DW_IC_RX_PEC 0xb0 +#define SB_DW_IC_ACK 0xb4 +#define SB_DW_IC_FLG 0xb8 +#define SB_DW_IC_FLG_CLR 0xbc +#define SB_DW_IC_INTR_STAT 0xc0 +#define SB_DW_IC_INTR_STAT_MASK 0xc4 +#define SB_DW_IC_DEBUG_SEL 0xec +#define SB_DW_IC_ACK_DEBUG 0xf0 +#define DW_IC_FS_SPKLEN 0xa0 +#define DW_IC_HS_SPKLEN 0xa4 + +// +// Timeout interval +// +// The interval is equal to the 10 times the signaling period +// for the highest I2C transfer speed used in the system. +// +#define DW_POLL_INTERVAL_US(x) (10 * (1000000 / (x))) + +// +// Maximum timeout count +// +#define DW_MAX_TRANSFER_POLL_COUNT 100000 // Maximum timeout: 10s +#define DW_MAX_STATUS_POLL_COUNT 100 + +#define DW_POLL_MST_ACTIVITY_INTERVAL_US 1000 // 1ms +#define DW_MAX_MST_ACTIVITY_POLL_COUNT 20 + +/** + Initialize I2C Bus + **/ +VOID +I2cHWInit ( + UINT32 Bus + ) +{ + UINT32 Param; + + mI2cBusList[Bus].Base =3D mI2cBaseArray[Bus]; + + Param =3D MmioRead32 (mI2cBusList[Bus].Base + DW_IC_COMP_PARAM_1); + + mI2cBusList[Bus].PollingTime =3D DW_POLL_INTERVAL_US (mI2cBusList[Bus].B= usSpeed); + mI2cBusList[Bus].RxFifo =3D DW_IC_COMP_PARAM_1_RX_BUFFER_DEPTH (Param); + mI2cBusList[Bus].TxFifo =3D DW_IC_COMP_PARAM_1_TX_BUFFER_DEPTH (Param); + mI2cBusList[Bus].Enabled =3D 0; + + DEBUG ((DEBUG_VERBOSE, "%a: Bus %d, Rx_Buffer %d, Tx_Buffer %d\n", + __FUNCTION__, + Bus, + mI2cBusList[Bus].RxFifo, + mI2cBusList[Bus].TxFifo + )); +} + +/** + Enable or disable I2C Bus + */ +VOID +I2cEnable ( + UINT32 Bus, + UINT32 Enable + ) +{ + UINT32 I2cStatusCnt; + UINTN Base; + + Base =3D mI2cBusList[Bus].Base; + I2cStatusCnt =3D DW_MAX_STATUS_POLL_COUNT; + mI2cBusList[Bus].Enabled =3D Enable; + + MmioWrite32 (Base + DW_IC_ENABLE, Enable); + + do { + if ((MmioRead32 (Base + DW_IC_ENABLE_STATUS) & 0x01) =3D=3D Enable) { + break; + } + MicroSecondDelay (mI2cBusList[Bus].PollingTime); + } while (I2cStatusCnt-- !=3D 0); + + if (I2cStatusCnt =3D=3D 0) { + DEBUG ((DEBUG_ERROR, "%a: Enable/disable timeout\n", __FUNCTION__)); + } + + if ((Enable =3D=3D 0) || (I2cStatusCnt =3D=3D 0)) { + /* Unset the target adddress */ + MmioWrite32 (Base + DW_IC_TAR, 0); + mI2cBusList[Bus].Enabled =3D 0; + } +} + +/** + Setup Slave address + **/ +VOID +I2cSetSlaveAddr ( + UINT32 Bus, + UINT32 SlaveAddr + ) +{ + UINTN Base; + UINT32 OldEnableStatus; + + Base =3D mI2cBusList[Bus].Base; + OldEnableStatus =3D mI2cBusList[Bus].Enabled; + + I2cEnable (Bus, 0); + MmioWrite32 (Base + DW_IC_TAR, SlaveAddr); + if (OldEnableStatus !=3D 0) { + I2cEnable (Bus, 1); + } +} + +/** + Check for errors on I2C Bus + **/ +UINT32 +I2cCheckErrors ( + UINT32 Bus + ) +{ + UINTN Base; + UINT32 ErrorStatus; + + Base =3D mI2cBusList[Bus].Base; + + ErrorStatus =3D MmioRead32 (Base + DW_IC_RAW_INTR_STAT) & DW_IC_ERR_COND= ITION; + + if ((ErrorStatus & DW_IC_INTR_RX_UNDER) !=3D 0) { + DEBUG ((DEBUG_ERROR, "%a: RX_UNDER error on i2c bus %d error status %0= 8x\n", + __FUNCTION__, + Bus, + ErrorStatus + )); + MmioRead32 (Base + DW_IC_CLR_RX_UNDER); + } + + if ((ErrorStatus & DW_IC_INTR_RX_OVER) !=3D 0) { + DEBUG ((DEBUG_ERROR, "%a: RX_OVER error on i2c bus %d error status %08= x\n", + __FUNCTION__, + Bus, + ErrorStatus + )); + MmioRead32 (Base + DW_IC_CLR_RX_OVER); + } + + if ((ErrorStatus & DW_IC_INTR_TX_ABRT) !=3D 0) { + DEBUG ((DEBUG_VERBOSE, "%a: TX_ABORT at source %08x\n", + __FUNCTION__, + MmioRead32 (Base + DW_IC_TX_ABRT_SOURCE) + )); + MmioRead32 (Base + DW_IC_CLR_TX_ABRT); + } + + return ErrorStatus; +} + +/** + Waiting for bus to not be busy + **/ +BOOLEAN +I2cWaitBusNotBusy ( + UINT32 Bus + ) +{ + UINTN Base; + UINTN PollCount; + + Base =3D mI2cBusList[Bus].Base; + PollCount =3D DW_MAX_MST_ACTIVITY_POLL_COUNT; + + while ((MmioRead32 (Base + DW_IC_STATUS) & DW_IC_STATUS_MST_ACTIVITY) != =3D 0) { + if (PollCount =3D=3D 0) { + DEBUG ((DEBUG_VERBOSE, "%a: Timeout while waiting for bus ready\n", = __FUNCTION__)); + return FALSE; + } + PollCount--; + /* + * A delay isn't absolutely necessary. + * But to ensure that we don't hammer the bus constantly, + * delay for DW_POLL_MST_ACTIVITY_INTERVAL_US as with other implementa= tion. + */ + MicroSecondDelay (DW_POLL_MST_ACTIVITY_INTERVAL_US); + } + + return TRUE; +} + +/** + Waiting for TX FIFO buffer available + **/ +EFI_STATUS +I2cWaitTxData ( + UINT32 Bus + ) +{ + UINTN Base; + UINTN PollCount; + + Base =3D mI2cBusList[Bus].Base; + PollCount =3D 0; + + while (MmioRead32 (Base + DW_IC_TXFLR) =3D=3D mI2cBusList[Bus].TxFifo) { + if (PollCount++ >=3D DW_MAX_TRANSFER_POLL_COUNT) { + DEBUG ((DEBUG_ERROR, "%a: Timeout waiting for TX buffer available\n"= , __FUNCTION__)); + return EFI_TIMEOUT; + } + MicroSecondDelay (mI2cBusList[Bus].PollingTime); + } + + return EFI_SUCCESS; +} + +/** + Waiting for RX FIFO buffer available + **/ +EFI_STATUS +I2cWaitRxData ( + UINT32 Bus + ) +{ + UINTN Base; + UINTN PollCount; + + Base =3D mI2cBusList[Bus].Base; + PollCount =3D 0; + + while ((MmioRead32 (Base + DW_IC_STATUS) & DW_IC_STATUS_RFNE) =3D=3D 0) { + if (PollCount++ >=3D DW_MAX_TRANSFER_POLL_COUNT) { + DEBUG ((DEBUG_ERROR, "%a: Timeout waiting for RX buffer available\n"= , __FUNCTION__)); + return EFI_TIMEOUT; + } + + if ((I2cCheckErrors (Bus) & DW_IC_INTR_TX_ABRT) !=3D 0) { + return EFI_ABORTED; + } + + MicroSecondDelay (mI2cBusList[Bus].PollingTime); + } + + return EFI_SUCCESS; +} + +/** + Initialize the Designware I2C SCL Counts + + This functions configures SCL clock Count for Standard Speed (SS) and Fas= t Speed (FS) mode. + **/ +VOID +I2cSclInit ( + UINT32 Bus, + UINT32 I2cClkFreq, + UINT32 I2cSpeed + ) +{ + UINT16 IcCon; + UINTN Base; + UINT32 I2cSpeedKhz; + + Base =3D mI2cBusList[Bus].Base; + I2cSpeedKhz =3D I2cSpeed / 1000; + + DEBUG ((DEBUG_VERBOSE, "%a: Bus %d I2cClkFreq %d I2cSpeed %d\n", + __FUNCTION__, + Bus, + I2cClkFreq, + I2cSpeed + )); + + IcCon =3D DW_IC_CON_MASTER | DW_IC_CON_SLAVE_DISABLE | DW_IC_CON_RESTART= _EN; + + if (I2cSpeedKhz <=3D 100) { + IcCon |=3D DW_IC_CON_SPEED_STD; + // Standard speed mode + MmioWrite32 (Base + DW_IC_FS_SPKLEN, I2cSclParam[I2cSpeedModeStandard]= [I2cSclSpkLen]); + MmioWrite32 (Base + DW_IC_SS_SCL_HCNT, I2cSclParam[I2cSpeedModeStandar= d][I2cSclHcnt]); + MmioWrite32 (Base + DW_IC_SS_SCL_LCNT, I2cSclParam[I2cSpeedModeStandar= d][I2cSclLcnt]); + } else if (I2cSpeedKhz > 100 && I2cSpeedKhz <=3D 400) { + IcCon |=3D DW_IC_CON_SPEED_FAST; + // Fast speed mode + MmioWrite32 (Base + DW_IC_FS_SPKLEN, I2cSclParam[I2cSpeedModeFast][I2c= SclSpkLen]); + MmioWrite32 (Base + DW_IC_FS_SCL_HCNT, I2cSclParam[I2cSpeedModeFast][I= 2cSclHcnt]); + MmioWrite32 (Base + DW_IC_FS_SCL_LCNT, I2cSclParam[I2cSpeedModeFast][I= 2cSclLcnt]); + } + MmioWrite32 (Base + DW_IC_CON, IcCon); +} + +/** + Initialize the designware i2c master hardware + **/ +EFI_STATUS +I2cInit ( + UINT32 Bus, + UINTN BusSpeed + ) +{ + UINTN Base; + + ASSERT (mI2cClock !=3D 0); + + mI2cBusList[Bus].BusSpeed =3D BusSpeed; + I2cHWInit (Bus); + + Base =3D mI2cBusList[Bus].Base; + + /* Disable the adapter and interrupt */ + I2cEnable (Bus, 0); + MmioWrite32 (Base + DW_IC_INTR_MASK, 0); + + /* Set standard and fast speed divider for high/low periods */ + I2cSclInit (Bus, mI2cClock, BusSpeed); + MmioWrite32 (Base + DW_IC_SDA_HOLD, 0x4b); + + return EFI_SUCCESS; +} + +/** + Wait the transaction finished + **/ +EFI_STATUS +I2cFinish ( + UINT32 Bus + ) +{ + UINTN Base; + UINTN PollCount; + + Base =3D mI2cBusList[Bus].Base; + PollCount =3D 0; + + /* Wait for TX FIFO empty */ + do { + if ((MmioRead32 (Base + DW_IC_STATUS) & DW_IC_STATUS_TFE) !=3D 0) { + break; + } + MicroSecondDelay (mI2cBusList[Bus].PollingTime); + } while (PollCount++ < DW_MAX_TRANSFER_POLL_COUNT); + + if (PollCount >=3D DW_MAX_TRANSFER_POLL_COUNT) { + DEBUG ((DEBUG_ERROR, "%a: Timeout waiting for TX FIFO empty\n", __FUNC= TION__)); + return EFI_TIMEOUT; + } + + /* Wait for STOP signal detected on the bus */ + PollCount =3D 0; + do { + if ((MmioRead32 (Base + DW_IC_RAW_INTR_STAT) & DW_IC_INTR_STOP_DET) != =3D 0) { + MmioRead32 (Base + DW_IC_CLR_STOP_DET); + return EFI_SUCCESS; + } + MicroSecondDelay (mI2cBusList[Bus].PollingTime); + } while (PollCount++ < DW_MAX_TRANSFER_POLL_COUNT); + + DEBUG ((DEBUG_ERROR, "%a: Timeout waiting for transaction finished\n", _= _FUNCTION__)); + return EFI_TIMEOUT; +} + +EFI_STATUS +InternalI2cWrite ( + UINT32 Bus, + UINT8 *Buf, + UINT32 *Length + ) +{ + EFI_STATUS Status; + UINTN WriteCount; + UINTN Base; + + Status =3D EFI_SUCCESS; + Base =3D mI2cBusList[Bus].Base; + + DEBUG ((DEBUG_VERBOSE, "%a: Write Bus %d Buf %p Length %d\n", + __FUNCTION__, + Bus, + Buf, + *Length + )); + I2cEnable (Bus, 1); + + WriteCount =3D 0; + while ((*Length - WriteCount) !=3D 0) { + Status =3D I2cWaitTxData (Bus); + if (EFI_ERROR (Status)) { + MmioWrite32 (Base + DW_IC_DATA_CMD, DW_IC_DATA_CMD_STOP); + I2cSync (); + goto Exit; + } + + if (WriteCount =3D=3D *Length - 1) { + MmioWrite32 ( + Base + DW_IC_DATA_CMD, + (Buf[WriteCount] & DW_IC_DATA_CMD_DAT_MASK) | DW_IC_DATA_CMD_STOP + ); + } else { + MmioWrite32 ( + Base + DW_IC_DATA_CMD, + Buf[WriteCount] & DW_IC_DATA_CMD_DAT_MASK + ); + } + I2cSync (); + WriteCount++; + } + +Exit: + *Length =3D WriteCount; + I2cFinish (Bus); + I2cWaitBusNotBusy (Bus); + I2cEnable (Bus, 0); + + return Status; +} + +EFI_STATUS +InternalI2cRead ( + UINT32 Bus, + UINT8 *BufCmd, + UINT32 CmdLength, + UINT8 *Buf, + UINT32 *Length + ) +{ + EFI_STATUS Status; + UINTN Base; + UINT32 CmdSend; + UINT32 TxLimit, RxLimit; + UINTN Idx; + UINTN Count; + UINTN ReadCount; + UINTN WriteCount; + + Status =3D EFI_SUCCESS; + Base =3D mI2cBusList[Bus].Base; + Count =3D 0; + ReadCount =3D 0; + + DEBUG ((DEBUG_VERBOSE, "%a: Read Bus %d Buf %p Length:%d\n", + __FUNCTION__, + Bus, + Buf, + *Length + )); + + I2cEnable (Bus, 1); + + /* Write command data */ + WriteCount =3D 0; + while (CmdLength !=3D 0) { + TxLimit =3D mI2cBusList[Bus].TxFifo - MmioRead32 (Base + DW_IC_TXFLR); + Count =3D CmdLength > TxLimit ? TxLimit : CmdLength; + + for (Idx =3D 0; Idx < Count; Idx++ ) { + CmdSend =3D BufCmd[WriteCount++] & DW_IC_DATA_CMD_DAT_MASK; + MmioWrite32 (Base + DW_IC_DATA_CMD, CmdSend); + I2cSync (); + + if (I2cCheckErrors (Bus) !=3D 0) { + Status =3D EFI_CRC_ERROR; + goto Exit; + } + CmdLength--; + } + + Status =3D I2cWaitTxData (Bus); + if (EFI_ERROR (Status)) { + MmioWrite32 (Base + DW_IC_DATA_CMD, DW_IC_DATA_CMD_STOP); + I2cSync (); + goto Exit; + } + } + + WriteCount =3D 0; + while ((*Length - ReadCount) !=3D 0) { + TxLimit =3D mI2cBusList[Bus].TxFifo - MmioRead32 (Base + DW_IC_TXFLR); + RxLimit =3D mI2cBusList[Bus].RxFifo - MmioRead32 (Base + DW_IC_RXFLR); + Count =3D *Length - ReadCount; + Count =3D Count > RxLimit ? RxLimit : Count; + Count =3D Count > TxLimit ? TxLimit : Count; + + for (Idx =3D 0; Idx < Count; Idx++ ) { + CmdSend =3D DW_IC_DATA_CMD_CMD; + if (WriteCount =3D=3D *Length - 1) { + CmdSend |=3D DW_IC_DATA_CMD_STOP; + } + MmioWrite32 (Base + DW_IC_DATA_CMD, CmdSend); + I2cSync (); + WriteCount++; + + if (I2cCheckErrors (Bus) !=3D 0) { + DEBUG ((DEBUG_VERBOSE, + "%a: Sending reading command remaining length %d CRC error\n", + __FUNCTION__, + *Length + )); + Status =3D EFI_CRC_ERROR; + goto Exit; + } + } + + for (Idx =3D 0; Idx < Count; Idx++ ) { + Status =3D I2cWaitRxData (Bus); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_VERBOSE, + "%a: Reading remaining length %d failed to wait data\n", + __FUNCTION__, + *Length + )); + + if (Status !=3D EFI_ABORTED) { + MmioWrite32 (Base + DW_IC_DATA_CMD, DW_IC_DATA_CMD_STOP); + I2cSync (); + } + + goto Exit; + } + + Buf[ReadCount++] =3D MmioRead32 (Base + DW_IC_DATA_CMD) & DW_IC_DATA= _CMD_DAT_MASK; + I2cSync (); + + if (I2cCheckErrors (Bus) !=3D 0) { + DEBUG ((DEBUG_VERBOSE, "%a: Reading remaining length %d CRC error\= n", + __FUNCTION__, + *Length + )); + Status =3D EFI_CRC_ERROR; + goto Exit; + } + } + } + +Exit: + *Length =3D ReadCount; + I2cFinish (Bus); + I2cWaitBusNotBusy (Bus); + I2cEnable (Bus, 0); + + return Status; +} + +/** + Write to I2C bus. + + @param[in] Bus I2C bus Id. + @param[in] SlaveAddr The address of slave device on the bus. + @param[in,out] Buf Buffer that holds data to write. + @param[in,out] WriteLength Pointer to length of buffer. + + @return EFI_SUCCESS Write successfully. + @return EFI_INVALID_PARAMETER A parameter is invalid. + @return EFI_UNSUPPORTED The bus is not supported. + @return EFI_NOT_READY The device/bus is not ready. + @return EFI_TIMEOUT Timeout why transferring data. + +**/ +EFI_STATUS +EFIAPI +I2cWrite ( + IN UINT32 Bus, + IN UINT32 SlaveAddr, + IN OUT UINT8 *Buf, + IN OUT UINT32 *WriteLength + ) +{ + if (Bus >=3D AC01_I2C_MAX_BUS_NUM + || Buf =3D=3D NULL + || WriteLength =3D=3D NULL) + { + return EFI_INVALID_PARAMETER; + } + + I2cSetSlaveAddr (Bus, SlaveAddr); + + return InternalI2cWrite (Bus, Buf, WriteLength); +} + +/** + Read data from I2C bus. + + @param[in] Bus I2C bus Id. + @param[in] SlaveAddr The address of slave device on the bus. + @param[in] BufCmd Buffer where to send the command. + @param[in] CmdLength Pointer to length of BufCmd. + @param[in,out] Buf Buffer where to put the read data to. + @param[in,out] ReadLength Pointer to length of buffer. + + @return EFI_SUCCESS Read successfully. + @return EFI_INVALID_PARAMETER A parameter is invalid. + @return EFI_UNSUPPORTED The bus is not supported. + @return EFI_NOT_READY The device/bus is not ready. + @return EFI_TIMEOUT Timeout why transferring data. + @return EFI_CRC_ERROR There are errors on receiving data. + +**/ +EFI_STATUS +EFIAPI +I2cRead ( + IN UINT32 Bus, + IN UINT32 SlaveAddr, + IN UINT8 *BufCmd, + IN UINT32 CmdLength, + IN OUT UINT8 *Buf, + IN OUT UINT32 *ReadLength + ) +{ + if (Bus >=3D AC01_I2C_MAX_BUS_NUM + || Buf =3D=3D NULL + || ReadLength =3D=3D NULL) + { + return EFI_INVALID_PARAMETER; + } + + I2cSetSlaveAddr (Bus, SlaveAddr); + + return InternalI2cRead (Bus, BufCmd, CmdLength, Buf, ReadLength); +} + +/** + Setup new transaction with I2C slave device. + + @param[in] Bus I2C bus Id. + @param[in] BusSpeed I2C bus speed in Hz. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + +**/ +EFI_STATUS +EFIAPI +I2cProbe ( + IN UINT32 Bus, + IN UINTN BusSpeed + ) +{ + if (Bus >=3D AC01_I2C_MAX_BUS_NUM + || BusSpeed > DW_I2C_MAXIMUM_SPEED_HZ) + { + return EFI_INVALID_PARAMETER; + } + + return I2cInit (Bus, BusSpeed); +} + +/** + * Notification function of EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE. + * + * This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRES= S_CHANGE event. + * It convers pointer to new virtual address. + * + * @param Event Event whose notification function is being invoked. + * @param Context Pointer to the notification function's context. + */ +VOID +EFIAPI +I2cVirtualAddressChangeEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + UINTN Count; + + EfiConvertPointer (0x0, (VOID **)&mI2cBusList); + EfiConvertPointer (0x0, (VOID **)&mI2cBaseArray); + EfiConvertPointer (0x0, (VOID **)&mI2cClock); + for (Count =3D 0; Count < AC01_I2C_MAX_BUS_NUM; Count++) { + if (!mI2cRuntimeEnableArray[Count]) { + continue; + } + EfiConvertPointer (0x0, (VOID **)&mI2cBaseArray[Count]); + EfiConvertPointer (0x0, (VOID **)&mI2cBusList[Count].Base); + } +} + +/** + Setup a bus that to be used in runtime service. + + @param[in] Bus I2C bus Id. + + @retval EFI_SUCCESS Success. + @retval Otherwise Error code. + +**/ +EFI_STATUS +EFIAPI +I2cSetupRuntime ( + IN UINT32 Bus + ) +{ + EFI_STATUS Status; + EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor; + + if (Bus >=3D AC01_I2C_MAX_BUS_NUM) { + return EFI_INVALID_PARAMETER; + } + + if (mVirtualAddressChangeEvent =3D=3D NULL) { + /* + * Register for the virtual address change event + */ + Status =3D gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + I2cVirtualAddressChangeEvent, + NULL, + &gEfiEventVirtualAddressChangeGuid, + &mVirtualAddressChangeEvent + ); + ASSERT_EFI_ERROR (Status); + } + + Status =3D gDS->GetMemorySpaceDescriptor ( + mI2cBaseArray[Bus] & RUNTIME_ADDRESS_MASK, + &Descriptor + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D gDS->SetMemorySpaceAttributes ( + mI2cBaseArray[Bus] & RUNTIME_ADDRESS_MASK, + RUNTIME_ADDRESS_LENGTH, + Descriptor.Attributes | EFI_MEMORY_RUNTIME + ); + if (EFI_ERROR (Status)) { + return Status; + } + + mI2cRuntimeEnableArray[Bus] =3D TRUE; + + return Status; +} + +EFI_STATUS +EFIAPI +I2cLibConstructor ( + VOID + ) +{ + VOID *Hob; + PLATFORM_INFO_HOB *PlatformHob; + + /* Get I2C Clock from the Platform HOB */ + Hob =3D GetFirstGuidHob (&gPlatformInfoHobGuid); + if (Hob =3D=3D NULL) { + return EFI_NOT_FOUND; + } + PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + mI2cClock =3D PlatformHob->AhbClk; + ASSERT (mI2cClock !=3D 0); + + return EFI_SUCCESS; +} --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83815): https://edk2.groups.io/g/devel/message/83815 Mute This Topic: https://groups.io/mt/87123856/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83817+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83817+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167789521733.7095996844877; Wed, 17 Nov 2021 08:49:49 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id R4VQYY1788612xLcgQeQsOAA; Wed, 17 Nov 2021 08:49:49 -0800 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.102]) by mx.groups.io with SMTP id smtpd.web11.9773.1637167788275480888 for ; Wed, 17 Nov 2021 08:49:48 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TEe+zdYSUHz6GpSs6dFgoDKAEPDOdblVB1ifpSlrnhYXtRnZbIB+wf74tCNvCeEp3iKHN8yOZq/3VLx7MvztcNAE8yPx3eC3BCtPUIuK4jlyhInMYR2DeoXzrjWzbpKhcT/rLYiZkNtDBR4QVqhoU0WQSNlSt6WDIqSmuua66iNqihmQuBBRivpavIsy02kX6ZFNtGmJp2q6P0pScrUKFtAyzBUiHOqlOkypdZ4cGGuV3Yf4dGpoB4XC8cz7IzndRlqE3eTlhFOpl4yRBFfQ82ekPr3XqAZzKtknk3xlGgyC40VdnYAx22g1Oyp14guXXI5m4V3en9nL3MHLPZ1ALA== 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=jatn/isIPIq+LO1k5eogzMNrEVN4mh5ZrmewEPJ8Ok8=; b=IltRqOGFZ4gWtQJr+ai1zVyQSvMPRZVrtNnHpe6u3mUzMhN+2+ZFwK0672YOCW736Dw1oDHw3Pn/3t/EYdNxY77Xo0Nk9awYspwaG7zhi02t0jlVZqbbAZ0rjqWzSbpc/pSjJ5V++j+jPBtOk+XQlvybFtDlnVZHm9LRbFi/jVti9pkoDwjSw9E27cA/gFVYnMz9gW1vN8NI4hgTX7dR3JC4rszQCk3UuEIJ4LOki573RtyPBaqyvlGMeg3IZrsnmFbWORQ96VPeYLXFHHS9YzQL1k1l284VMylu68ImD8RCdu6WpD5JaE+CWFAy7jBqPN6A8Mg7Y5Y0mXpgD0Enxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB6454.prod.exchangelabs.com (2603:10b6:510:1b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.20; Wed, 17 Nov 2021 16:49:47 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:49:47 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 04/30] AmpereAltraPkg: Add DwGpioLib library instance Date: Wed, 17 Nov 2021 23:47:01 +0700 Message-ID: <20211117164727.10922-5-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:49:43 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a9710e59-4d4b-4708-bed1-08d9a9ea4350 X-MS-TrafficTypeDiagnostic: PH0PR01MB6454: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: G43mCXZgZ1A9cKZhZvPHqOxYBg9TYy5kAErohfsB+/G0HPBbYA9+RkkfML4KY7VvnEK6HFHyWovMMGiEgQEksYsJ4xRBV3ZoheT9OmJ3ymq86p0nj7x/SMo+Dt46U6DRdsD9UEI2QMKdBBoShvTeKd/jKsB1Sr7ds+n11pmKVyfjWmYxoe7fJHLv8sqUR52doJVKu1Pl3vpyTGjGdotokn60Bley7eY+iw17LqW4c/zp8PT6lIOTbIWMJlKQKqC5DrIj+plT9YSw/YWM4tbPxrlKCUcjKR25DP0d28KfgtptAB0W0TVg4yGtxyd+GtTtyrYSIndn97XXioCB2aRdbCC8Yx9YdTsxT3+Z3PMddRVoCdijJIOxSPSoG766mkj6eqKH3uETicZwn4lS7g66CkHkDRJ1YPUpl/a9q/CBWaQ0V4kC0bN2YQErLhO3iqsEScg9NiBet2Lds/NIJ77nNLqV45ujhz2yGSvte4qA0gJklSGjeUyj7RCEvDYbgAmH6AyThkNql88xtvViv1KVzrNqzt/Yx2reuVQIWl61ZEU056M4dF4NADgHUKpA1XxoEed+4m2ypFjt0JmSAVV9gygjnxTT/2x1N4v5yQP8r/RXux09sCyiRjlKW8p19trDUQb/8GM2K8hbHjzi+Z0SUfL4QpiIL3A10nSu+bDpuHd32DMYlUVl2rwSn2EhJX5eMWpr3aM3cKfpzgZ9Mwvcnw== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?mh8njxZ/K0autEMDG0SFONj4qHfT5xt89swhTiE3F0kp0TIbcmeB5YDehYJ8?= =?us-ascii?Q?JouFi00ZCAWB97ltR8B4jXpwpHwMBTr8iFhRA9EMIVHMNRh8WkA1d+VtuIzB?= =?us-ascii?Q?FlzD+FTONqel4Jbt7nFY+YmFBDQrpDh5RakkXHPanEPOQA9isMn617XlOCb1?= =?us-ascii?Q?w77rKJKz+HEkclQVXNpgS8c0UUE995GPycWuBtgPykLWL02T114/YiCq76lk?= =?us-ascii?Q?F3sbnc169eA2L8g5RtcZ9O/XWEklaVE4zJPTBluuJqqgPDbwu2GddnFq3xRp?= =?us-ascii?Q?hamnHT+2iWewOpz1R/ElQhEZzm9jQfjCt6i9mDqMkN0IxHsuZzzk3ZKZqrHD?= =?us-ascii?Q?n9u2tqJAT0jcRb3YTb3ds5HsXFlnbC2mmf/Yb/fbChyOufI30U9AqCA5xg86?= =?us-ascii?Q?KgheHOfBnWi1IpwL5ERbNb4syrQNpVC9p8nmGveDiQkfhzbjhztxwFJipTLv?= =?us-ascii?Q?f/9kjqJfBtv7Ur3zP6KK7CC+fdc8o/2iJxZ0i9UXxhHKPkIkQzNxZ6FnuUn7?= =?us-ascii?Q?WCCg6SieNZBXsSHXR8gLps5gWc1joPeDEt54DW1NkhZRd9Htw11/del1iNeG?= =?us-ascii?Q?M4s+ph2PouqfikcysiM3DsgV6VOA1R6CrOYIxJjgQrYh+e4JussAAq6AV3zI?= =?us-ascii?Q?MjyeTgaeM8G+GvloAD7zJ1EJyfwJx4ohK7GJ1AmM6DFva96Q64I6JOs8P572?= =?us-ascii?Q?ks5Tjuuaw6jMGQ5bOjBxq+tkymMIQmnXdjts7vehVYG1BMDxL/hMrp+4+Qzq?= =?us-ascii?Q?/mWo/o0A8lx4Syhnx7PRJ5G5wnVDret4rYfYvUa1hDNH3qOO45iL0NBChUYT?= =?us-ascii?Q?wmhO8a1W9Qj1sv32wlHdHbaVTXdXiPs2d19AvS7lHWBo6FvLDHegjaF33Qki?= =?us-ascii?Q?Ql/R+wsugq4kgU4/MckUDHNcx+xX4itE8Wm35icPE33oqJz8VTvtpm79mAx3?= =?us-ascii?Q?WBpH6C04nhXuvpwQ6E4W558BX4+uF1eHCXgxMNaX4ctOlmZp1PrEgg7lYUI3?= =?us-ascii?Q?F4yA0fR6n2t1sMNjB1bKZDJqaqCoQdz7OAhWPBPSg9UkfdTyCdhRheYWtNGS?= =?us-ascii?Q?VXllGabKhZ8aK6kHsrKR6P7HKBe/6f6khlqZ37KQ2aPTPDnfsOrO1LbwHfOO?= =?us-ascii?Q?YWXhOuIAjEJByKNoc/Pc8/wg8f4t1uer4D9sYc/VEEO7ngejcALVkIU2bIFA?= =?us-ascii?Q?3/Rp+Qc6iC61Yt0xY83xFQCCnjpozleyH8CmbIYFjaL37a/QVF2jjat3/2bX?= =?us-ascii?Q?eGYfd0WohZi0EctapA0iKtKzsO0RCgUWbM56Xhejg+x5QsP0pEid/KIWchRY?= =?us-ascii?Q?opxswusT0uqjSoC/eZUqOEO17QzqBhrz3IVFhtSkqaY8bkhmZHKXsAT16O+B?= =?us-ascii?Q?4MMXGlulBR/EqcksTR/VuSA18TvzoLeHmh1uiqH+iv7t9T8nhYOHVWSYpOlw?= =?us-ascii?Q?QTW8cwqc1K9S56d+mvG0KPlOEjB9qCjovuZFsaPwyKN3SnXkELoJeP6C+odd?= =?us-ascii?Q?AtcR9njSLDd75W/xOHW8+EvoXewvcANcHtv0Nd16b3yHsUzlA6u8IuG+ZV3Y?= =?us-ascii?Q?+Epj6mqPTyOpS6Z0IU5R2Zn+ipA0nnx+yipzMHqB4VDBWUtLvLoqUjp4URNk?= =?us-ascii?Q?pUWj0gKH/CeoWp6VoTikwTYcfledbIHmxWMw7JyIETKOr/KvzaDFeZT5sQYW?= =?us-ascii?Q?SA3zJw=3D=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: a9710e59-4d4b-4708-bed1-08d9a9ea4350 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:49:46.9369 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: coFP4JK+A8H8WoQVYW+cHt0Vb3wHb47NyNRPRPXreFkhLKj0Ewp0/xTxfD1HNggnriRRAnaDxBeUFwmjU+yxz7c5k5w2yfD16EcdX6WqVcw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6454 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: 2TqaXp1Pqv5tcys0CA2whLAqx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167789; bh=Phr+GcJB9LF8cSPCfTpFerBT7eEtnl0uWNdFQbWSkPo=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=XVSV61qvhu8jngv+3NJ4PlywyxCqP8caBk4DHLjjIWXLQvFP4oo3fvvNKtPG7C94XBy qg+4+3OyvlQDnIsFIXfKBEwNFjqyYidHgfBKcys/waQJxttiVtq5Do85cmTXd6b6cRqPT cYKL1F+n+WpDBrZVyRzu6BCHDhaNtpAE/28= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167790901100009 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen The DwGpioLib library provides basic functions to control the GPIO controller on Ampere Altra processor. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec | 3 + Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.inf | 33 ++ Silicon/Ampere/AmpereAltraPkg/Include/Library/GpioLib.h | 76 +++++ Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h | 20 ++ Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.c | 314 ++++++= ++++++++++++++ 5 files changed, 446 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Amp= ere/AmpereAltraPkg/AmpereAltraPkg.dec index 57ee7aafe545..c1226c296dad 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -31,6 +31,9 @@ [LibraryClasses] ## @libraryclass Defines a set of methods to read/write to I2C devices. I2cLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/I2cLib.h =20 + ## @libraryclass Defines a set of methods to get/set GPIO. + GpioLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/GpioLib.h + ## @libraryclass Defines a set of methods to communicate with secure p= arition over MM interface. MmCommunicationLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/MmCommu= nicationLib.h =20 diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.inf = b/Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.inf new file mode 100644 index 000000000000..36ce0c3be2c8 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.inf @@ -0,0 +1,33 @@ +## @file +# Component description for DwGpioLib library for the Designware GPIO cont= roller. +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D DwGpioLib + FILE_GUID =3D E7D9CAE1-6930-46E3-BDF9-0027446E7DF2 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D GpioLib + +[Sources.common] + DwGpioLib.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + IoLib + +[Guids] + gEfiEventVirtualAddressChangeGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/GpioLib.h b/Sili= con/Ampere/AmpereAltraPkg/Include/Library/GpioLib.h new file mode 100644 index 000000000000..3c72ce3d48d7 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/GpioLib.h @@ -0,0 +1,76 @@ +/** @file + Library implementation for the Designware GPIO controller. + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef GPIO_LIB_H_ +#define GPIO_LIB_H_ + +typedef enum { + GpioConfigOutLow =3D 0, + GpioConfigOutHigh, + GpioConfigOutLowToHigh, + GpioConfigOutHightToLow, + GpioConfigIn, + MaxGpioConfigMode +} GPIO_CONFIG_MODE; + +/* + * GpioWriteBit: Use to Set/Clear GPIOs + * Input: + * Pin : Pin Identification + * Val : 1 to Set, 0 to Clear + */ +VOID +EFIAPI +GpioWriteBit ( + IN UINT32 Pin, + IN UINT32 Val + ); + +/* + * GpioReadBit: + * Input: + * Pin : Pin Identification + * Return: + * 1 : On/High + * 0 : Off/Low + */ +UINTN +EFIAPI +GpioReadBit ( + IN UINT32 Pin + ); + +/* + * GpioModeConfig: Use to configure GPIOs as Input/Output + * Input: + * Pin : Pin Identification + * InOut : GPIO_OUT/1 as Output + * GPIO_IN/0 as Input + */ +EFI_STATUS +EFIAPI +GpioModeConfig ( + UINT8 Pin, + GPIO_CONFIG_MODE Mode + ); + +/* + * Setup a controller that to be used in runtime service. + * Input: + * Pin: Pin belongs to the controller. + * return: 0 for success. + * Otherwise, error code. + */ +EFI_STATUS +EFIAPI +GpioSetupRuntime ( + IN UINT32 Pin + ); + +#endif /* GPIO_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h b/Silico= n/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h index 453d966d6058..1ba1da17117e 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h @@ -69,4 +69,24 @@ // #define AC01_I2C_BASE_ADDRESS_LIST 0x1000026B0000ULL, 0x10000275000= 0ULL =20 +// +// The Array of Soc Gpio Base Address +// +#define AC01_GPIO_BASE_ADDRESS_LIST 0x1000026f0000, 0x1000026e0000, = 0x1000027b0000, 0x1000026d0000, 0x5000026f0000, 0x5000026e0000, 0x5000027b0= 000, 0x5000026d0000 + +// +// The Array of Soc Gpi Base Address +// +#define AC01_GPI_BASE_ADDRESS_LIST 0x1000026d0000, 0x5000026d0000 + +// +// Number of Pins Per Each Contoller +// +#define AC01_GPIO_PINS_PER_CONTROLLER 8 + +// +// Number of Pins Each Socket +// +#define AC01_GPIO_PINS_PER_SOCKET 32 + #endif /* PLATFORM_AC01_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.c b/= Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.c new file mode 100644 index 000000000000..319ce43ba71d --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.c @@ -0,0 +1,314 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +/* Runtime needs to be 64K alignment */ +#define RUNTIME_ADDRESS_MASK (~(SIZE_64KB - 1)) +#define RUNTIME_ADDRESS_LENGTH SIZE_64KB + +#define GPIO_MUX_VAL(Gpio) (0x00000001 << (Gpio)) +#define GPIO_IN 0 +#define GPIO_OUT 1 + +/* Address GPIO_REG Registers */ +#define GPIO_SWPORTA_DR_ADDR 0x00000000 +#define GPIO_SWPORTA_DDR_ADDR 0x00000004 +#define GPIO_EXT_PORTA_ADDR 0x00000050 + +STATIC UINT64 GpioBaseAddr[] =3D { AC01_GPIO_BASE_ADDRESS_LIST }; +STATIC UINT64 GpiBaseAddr[] =3D { AC01_GPI_BASE_ADDRESS_LIST }; +STATIC BOOLEAN GpioRuntimeEnableArray[sizeof (GpioBaseAddr) / sizeof (Gp= ioBaseAddr[0])] =3D { FALSE }; +STATIC EFI_EVENT mVirtualAddressChangeEvent =3D NULL; + +UINT64 +GetBaseAddr ( + IN UINT32 Pin + ) +{ + UINT32 NumberOfControllers =3D sizeof (GpioBaseAddr) / sizeof (GpioBaseA= ddr[0]); + UINT32 TotalPins =3D AC01_GPIO_PINS_PER_CONTROLLER * NumberOfControllers; + + if (NumberOfControllers =3D=3D 0 || Pin >=3D TotalPins) { + return 0; + } + + return GpioBaseAddr[Pin / AC01_GPIO_PINS_PER_CONTROLLER]; +} + +VOID +GpioWrite ( + IN UINT64 Base, + IN UINT32 Val + ) +{ + MmioWrite32 ((UINTN)Base, Val); +} + +VOID +GpioRead ( + IN UINT64 Base, + OUT UINT32 *Val + ) +{ + ASSERT (Val !=3D NULL); + *Val =3D MmioRead32 (Base); +} + +VOID +EFIAPI +GpioWriteBit ( + IN UINT32 Pin, + IN UINT32 Val + ) +{ + UINT64 Reg; + UINT32 GpioPin; + UINT32 ReadVal; + + Reg =3D GetBaseAddr (Pin); + if (Reg =3D=3D 0) { + return; + } + + GpioPin =3D Pin % AC01_GPIO_PINS_PER_CONTROLLER; + + Reg +=3D GPIO_SWPORTA_DR_ADDR; + GpioRead (Reg, &ReadVal); + + if (Val !=3D 0) { + GpioWrite (Reg, ReadVal | GPIO_MUX_VAL (GpioPin)); + } else { + GpioWrite (Reg, ReadVal & ~GPIO_MUX_VAL (GpioPin)); + } +} + +UINTN +EFIAPI +GpioReadBit ( + IN UINT32 Pin + ) +{ + UINT64 Reg; + UINT32 Val; + UINT32 GpioPin; + UINT8 Index; + UINT32 MaxIndex; + + Reg =3D GetBaseAddr (Pin); + if (Reg =3D=3D 0) { + return 0; + } + + GpioPin =3D Pin % AC01_GPIO_PINS_PER_CONTROLLER; + + /* Check if a base address is GPI */ + MaxIndex =3D sizeof (GpiBaseAddr) / sizeof (GpiBaseAddr[0]); + for (Index =3D 0; Index < MaxIndex; Index++) { + if (Reg =3D=3D GpiBaseAddr[Index]) { + break; + } + } + if (Index =3D=3D MaxIndex) { + /* Only GPIO has GPIO_EXT_PORTA register, not for GPI */ + Reg +=3D GPIO_EXT_PORTA_ADDR; + } + + GpioRead (Reg, &Val); + + return Val & GPIO_MUX_VAL (GpioPin) ? 1 : 0; +} + +EFI_STATUS +GpioConfig ( + IN UINT32 Pin, + IN UINT32 InOut + ) +{ + INTN GpioPin; + UINT32 Val; + UINT64 Reg; + + /* + * Caculate GPIO Pin Number for Direction Register + * GPIO_SWPORTA_DDR for GPIO[31...0] + * GPIO_SWPORTB_DDR for GPIO[51...32] + */ + + Reg =3D GetBaseAddr (Pin); + if (Reg =3D=3D 0) { + return EFI_UNSUPPORTED; + } + + Reg +=3D GPIO_SWPORTA_DDR_ADDR; + GpioPin =3D Pin % AC01_GPIO_PINS_PER_CONTROLLER; + GpioRead (Reg, &Val); + + if (InOut =3D=3D GPIO_OUT) { + Val |=3D GPIO_MUX_VAL (GpioPin); + } else { + Val &=3D ~GPIO_MUX_VAL (GpioPin); + } + GpioWrite (Reg, Val); + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +GpioModeConfig ( + UINT8 Pin, + GPIO_CONFIG_MODE Mode + ) +{ + UINT32 NumberOfControllers =3D sizeof (GpioBaseAddr) / sizeof (UINT64); + UINT32 NumersOfPins =3D NumberOfControllers * AC01_GPIO_PINS_PER_CONTROL= LER; + UINT32 Delay =3D 10; + + if (Mode < GpioConfigOutLow + || Mode >=3D MaxGpioConfigMode + || Pin > NumersOfPins - 1 + || Pin < 0) + { + return EFI_INVALID_PARAMETER; + } + + switch (Mode) { + case GpioConfigOutLow: + GpioConfig (Pin, GPIO_OUT); + GpioWriteBit (Pin, 0); + DEBUG ((DEBUG_INFO, "GPIO pin %d configured as output low\n", Pin)); + break; + + case GpioConfigOutHigh: + GpioConfig (Pin, GPIO_OUT); + GpioWriteBit (Pin, 1); + DEBUG ((DEBUG_INFO, "GPIO pin %d configured as output high\n", Pin)); + break; + + case GpioConfigOutLowToHigh: + GpioConfig (Pin, GPIO_OUT); + GpioWriteBit (Pin, 0); + MicroSecondDelay (1000 * Delay); + GpioWriteBit (Pin, 1); + DEBUG ((DEBUG_INFO, "GPIO pin %d configured as output low->high\n", Pi= n)); + break; + + case GpioConfigOutHightToLow: + GpioConfig (Pin, GPIO_OUT); + GpioWriteBit (Pin, 1); + MicroSecondDelay (1000 * Delay); + GpioWriteBit (Pin, 0); + DEBUG ((DEBUG_INFO, "GPIO pin %d configured as output high->low\n", Pi= n)); + break; + + case GpioConfigIn: + GpioConfig (Pin, GPIO_IN); + DEBUG ((DEBUG_INFO, "GPIO pin %d configured as input\n", Pin)); + break; + + default: + break; + } + + return EFI_SUCCESS; +} + +/** + * Notification function of EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE. + * + * This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRES= S_CHANGE event. + * It convers pointer to new virtual address. + * + * @param Event Event whose notification function is being invoked. + * @param Context Pointer to the notification function's context. + */ +VOID +EFIAPI +GpioVirtualAddressChangeEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + UINTN Count; + + EfiConvertPointer (0x0, (VOID **)&GpioBaseAddr); + for (Count =3D 0; Count < sizeof (GpioBaseAddr) / sizeof (GpioBaseAddr[0= ]); Count++) { + if (!GpioRuntimeEnableArray[Count]) { + continue; + } + EfiConvertPointer (0x0, (VOID **)&GpioBaseAddr[Count]); + } +} + +/** + Setup a controller that to be used in runtime service. + + @Bus: Bus ID. + @return: 0 for success. + Otherwise, error code. + **/ +EFI_STATUS +EFIAPI +GpioSetupRuntime ( + IN UINT32 Pin + ) +{ + EFI_STATUS Status; + EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor; + + if (GetBaseAddr (Pin) =3D=3D 0) { + return EFI_INVALID_PARAMETER; + } + + if (mVirtualAddressChangeEvent =3D=3D NULL) { + /* + * Register for the virtual address change event + */ + Status =3D gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + GpioVirtualAddressChangeEvent, + NULL, + &gEfiEventVirtualAddressChangeGuid, + &mVirtualAddressChangeEvent + ); + ASSERT_EFI_ERROR (Status); + } + + Status =3D gDS->GetMemorySpaceDescriptor ( + GetBaseAddr (Pin) & RUNTIME_ADDRESS_MASK, + &Descriptor + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D gDS->SetMemorySpaceAttributes ( + GetBaseAddr (Pin) & RUNTIME_ADDRESS_MASK, + RUNTIME_ADDRESS_LENGTH, + Descriptor.Attributes | EFI_MEMORY_RUNTIME + ); + if (EFI_ERROR (Status)) { + return Status; + } + + GpioRuntimeEnableArray[Pin / AC01_GPIO_PINS_PER_CONTROLLER] =3D TRUE; + + return Status; +} --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83817): https://edk2.groups.io/g/devel/message/83817 Mute This Topic: https://groups.io/mt/87123858/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83818+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83818+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167792977924.7068977941333; Wed, 17 Nov 2021 08:49:52 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 7DXTYY1788612xHe0H5BAMWZ; Wed, 17 Nov 2021 08:49:52 -0800 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.131]) by mx.groups.io with SMTP id smtpd.web09.9814.1637167791799452754 for ; Wed, 17 Nov 2021 08:49:52 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OZSN1zquIzu9JYLtuVEKruYr2S6VgLc2hXhx+jqgl/zWH7DguQAUQw5cDcSX0ZvKs8gLazC0mcMpX2etoiZX7Ru15/xz9DWLxabFykWS341qFea7xFT2XmdFl5n6tewmU/Y84V31sT3zVwNJcmr0g5Wji7zzJOlmpoiMCIq/0ngi8JHYTqzY46/rFWDV34LIYPucxkTVPJo6Appe6Up/8yh1B05KuMFyGQ+IMFAkysPt4tjt6JcojRU7HrMlkEqIWCGYrijIMNTpJldPB8J7Lxh7ECDW+wj0Ubs0Ri9ZD5V3B/LRmkw2zWGRr+w4rSxcZzkyjjqe1+eJr6HDlKpXGQ== 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=V/xYWFdL5NDSeyBiKD0zFOdNH/umbz4g6JXvKlcQWfQ=; b=AJlCGpLxfd6j7qDT3sNu4Uw09g3bHVzU56auKV5pahKTEDISVNBAPebxFhsE9BytKDg+SvsmcwI59fyaleKCup5spCHVSKQ86yg8rbVY8kn6525OpweDIjzcHIjVBEA87iyFYk37z9nlIplXWIQyqDEvXNaHaa3Q1n3B5+o4XmNmkknkd3jNARsxU1uQfyI9IcTNYAIgij39p6hfTGQQq5EYazZ5yuWA4fd62IJJJdAT2cM6QD41CFaNre3Aca/SjZU3xIZbMZyLSDbvx/NjiKh1l8i/GaPfTYCrUoHkSRzZYPPAUtKlal6HPDAuQDCtSbIFxRAHMmiO7o8TGoOiVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB6454.prod.exchangelabs.com (2603:10b6:510:1b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.20; Wed, 17 Nov 2021 16:49:50 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:49:50 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 05/30] JadePkg: Implement RealTimeClockLib for PCF85063 Date: Wed, 17 Nov 2021 23:47:02 +0700 Message-ID: <20211117164727.10922-6-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:49:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2955fc48-1375-4d34-e020-08d9a9ea453d X-MS-TrafficTypeDiagnostic: PH0PR01MB6454: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:901; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: uqbmT99RCENpNEdfAC94O2vPK1d/1OWa3Rl3hW166IiAY+Lz9oQQwC4/Nw/KDwk4rugMC1RcP2Wmr+e3aaS56ICZj6hlQlQ1XDg82fDc40AAicSiK8hCSZNLqh35/E7w5Ch1BOh8Oo8loH7VaFWWo6qFynUJZkWJrgCvEkfLYunKyyzxC5c8f3SP3ArBvbEMa6DCvIoRReytHSLH0xPWHQijBw5T/sqCgUxEOUBeH7bhkR+5sxAW7xVxYdj0Xipq4ArbEzxVVzK8I0s/AiBReNdrTrOYw1kOtBlpzlv/h/D3W485bgoADZJ2Uwmp+4Y7SG5nOgn9OigPBOip2jOlE24oUkMSQASgeYPg7cfPNvfiZmBdnyW8DQS1UOau+Lh7d5XtzlLEXWgrAYEbLpTybQyYSsnm8bSFC5kgIe4/ijfDTiuprFl+J1PXa+fFRm0Ap5mI4bvJG2HsBkLe6CN654Lkuc2Ds4Q8TuwquWsTfCIvOyu8MGjyxBXvC3OdK03juUqHDTcPLjAXl4NIgIoCoQ6vBxvTX78bc092BJGbzE+NUANsaFRfLvGVQMgWKKxde4ITpiu/igA1pjctxguzpY0TAViKjnDKdwkap78rKMip/xKsEdvbBjmiJ5PKb1e0k9MupN4nK94NJK//R/2Ag21SihmFW+Vl7JLEzTQf3VtumbaIGdQI8kwa5M5Srs/jqVRD5WA3HPgDoA+BxNQu5A== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?e5njw5MoxztSZwIOZWLyMr7UXOm4r9PpL9AcozWfdsFy+xX25WzX+D8zOY58?= =?us-ascii?Q?RiljuIDpgh6jQP+bgfoUKZ3KWE4FLjYjv8eRAoxC1XrOakp9LOG6RCEab6lq?= =?us-ascii?Q?nCvs0vV0+mnL6wp6yVZrLxLw7OvxVTFYmXTdYoI1q2HSN5Ks/RbpZTJa5k+J?= =?us-ascii?Q?I4kCJoC5FQJVzx1y+i6R+3Zynnn5VFQn3Hn7B1B8N1prj4tzSgwmq+4T54/P?= =?us-ascii?Q?zUuzLkyPk81RlJk+9iKONqTAuUt3AEGz7nTqVjg12CVnY/BumCBi+ob8aqZU?= =?us-ascii?Q?FyMHmkzm98DPJwKrK3K6iPAWtaT9Aie9sW0+QAQJk3QK1uesR+eE+mGSF+os?= =?us-ascii?Q?Ag/M3YnLWHzhIUg6miam2u7vkRCt+Vdu7BTV1vr77VQJ9PveL0JEokeIN7SL?= =?us-ascii?Q?CXAVTETgqFeEcsOWBOV+hiQr4uTXf3FyF+sv3jJDizXwhqtjx/0/snNnptOw?= =?us-ascii?Q?6D7jzIDV8TIB3vdFQNJySur1nkV37dvPKtQJHQWyhIYc5ZA+FdnyO1ofLm/m?= =?us-ascii?Q?48NDNyRLqnAaqcZN8ZJtYj08S4khx7Tlz2MDXmZs031Eh0qpg/RnqSNzq1mi?= =?us-ascii?Q?zbzfJerb9Ts6LBTmg0sUImT3O0JAC40xbBY9i4dYjSy37rUxAs9U+xyMnV8f?= =?us-ascii?Q?inU11auPstNLvExEJeve2nCvmX69ruprHcyrt1gFTTdOHVvxn6qOJPVe8RrV?= =?us-ascii?Q?QOnWOUSgrvmNusgWseZtG+Asry+u2n94AaHExTtYMWA3wuDpXrOYdUbfusTH?= =?us-ascii?Q?pdRvjhOd1a3UWKb3cuF1TRidIa8EgOSoe3TMiJqVhscKMmA9K0wU5MfO3vKV?= =?us-ascii?Q?6styGTY94yvPnbonwi+KV+zCY9bH1ajLRv1wN3oTVmc9QTHPbwgYWrvQby8t?= =?us-ascii?Q?YXGODWrEHs06dgp6/0srbf7770QdWDOqC1YclChxvHkGdNv2e0kuW5t+Jue0?= =?us-ascii?Q?lbJGFdvCPWPYsGYxwQFfhIgKPUIaFAwyZX7Jl461yHu9fctTuYB/VnlBtYgv?= =?us-ascii?Q?PEZYXk6up86zJp8c52rogHBrzWv9Q3L/dSUVD9x7F3lqpgFTV32NnSQCao9o?= =?us-ascii?Q?tmqcgHfCmrvOzXlWys0f9ioo/J7b+JGU2aBJg9zhSeW34s4s2nQ2uEtmBEiz?= =?us-ascii?Q?B8ZsrhLbX5KfnbtXn8/6SSuYqZP0yUm4qcldbv1RvvXPRWTzD2MAjkcymm1+?= =?us-ascii?Q?7wEctI5hIZRYLY6jpKFaxtNXHtMzb9ThZ5KXkquA8dot5P1XYIXt+YzWIeil?= =?us-ascii?Q?d5tjgQnp7kzubCWP+hjPT+bwTxqGrzkV9Ij7t8i3wQP6hEG5HWl1eYz7u7GO?= =?us-ascii?Q?GjhTpC4O0cTc/RFGspBPTYb2oGRrLmEjRWTrVX2OjEpZHMRjqPTaPiQakVP3?= =?us-ascii?Q?rMJINBemIiGXQkzTaf0HRS2ZsHcbjhl3uQFHpcA309HYgxlgNcnu7hkn+A53?= =?us-ascii?Q?yZRI9RC3+Lq/ljz3jhczMly1YT/kZh/Nd8TELTTX5bYamVnuRZDB1O8LEA73?= =?us-ascii?Q?8aoX+FvwrzQLD61NAlFJ3Cmg10P22ANKNZEmimZ1GUaqxEuqMsFSI3gcj8cG?= =?us-ascii?Q?aVRC0C51D92BQFmOSDZVEHLGKgcehz3+n/ux6cbeVxHjM/FLfRMDPb1EAtuo?= =?us-ascii?Q?ypLklGxQZK1+sEKJVJ2Auv0HCOt/1QlBbujJPflnk4J3W7h1IoZPdwR5dUp+?= =?us-ascii?Q?fb4Anw=3D=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2955fc48-1375-4d34-e020-08d9a9ea453d X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:49:50.2822 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: g93e/CU6bKkvLBRPdDj6XFxynzkPRbyUh59aepelzInLsNEUBBD1+JRK/lG3zaVPsYDFUdqTpBS3d6tpzi9SoZRZ0v8Mwt5tk6yZBY5CEx4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6454 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: a3ncadTDcE24hiiheUK6bE2vx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167792; bh=S2qXJ0Uzp5EoKW3Y4ZycZ7CbCZDDzEiLcN2RCQWR+ns=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=na07U2vZn/a1kC5KU8eKmWCg7m6v5fRfjwPQDttvR3dEg8Zl94XPajDBA6XJz8iY6FI w/pjvc/1rCMGG5/wA0bCFwDp9/EEbra0hw7WmOD8mkjw/jq8OtejivGPA4BZPRYRvbSh8 fUcSqlteeDYmeqMlwa6cvvBL5zQsM4Miqy0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167795124100002 Content-Type: text/plain; charset="utf-8" This library adds the support for retrieving and updating system datetime over real RTC PCF85063 device on Mt. Jade platform instead of using virtual RTC. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc = | 2 + Platform/Ampere/JadePkg/Jade.dsc = | 2 +- Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063RealTimeC= lockLib.inf | 44 +++ Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063.h = | 91 ++++++ Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063.c = | 317 ++++++++++++++++++++ Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063RealTimeC= lockLib.c | 257 ++++++++++++++++ 6 files changed, 712 insertions(+), 1 deletion(-) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index cf1be4df8f27..326bdfb5ced5 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -83,6 +83,8 @@ [LibraryClasses.common] SystemFirmwareInterfaceLib|Silicon/Ampere/AmpereAltraPkg/Library/SystemF= irmwareInterfaceLib/SystemFirmwareInterfaceLib.inf AmpereCpuLib|Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCp= uLib.inf TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf + I2cLib|Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.inf + GpioLib|Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.inf MmCommunicationLib|Silicon/Ampere/AmpereAltraPkg/Library/MmCommunication= Lib/MmCommunicationLib.inf FlashLib|Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.inf =20 diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index a10591933cf7..7b70c5d6b5fb 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -74,7 +74,7 @@ [LibraryClasses] # # RTC Library: Common RTC # - RealTimeClockLib|EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualReal= TimeClockLib.inf + RealTimeClockLib|Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLi= b/PCF85063RealTimeClockLib.inf =20 ##########################################################################= ###### # diff --git a/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85= 063RealTimeClockLib.inf b/Platform/Ampere/JadePkg/Library/PCF85063RealTimeC= lockLib/PCF85063RealTimeClockLib.inf new file mode 100644 index 000000000000..1fe561cc0ec9 --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063Real= TimeClockLib.inf @@ -0,0 +1,44 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + MODULE_TYPE =3D BASE + BASE_NAME =3D PCF85063RealTimeClockLib + FILE_GUID =3D 271569F6-5522-4006-9FF5-F07A59473AAC + LIBRARY_CLASS =3D RealTimeClockLib + VERSION_STRING =3D 1.0 + +[Sources.common] + PCF85063.c + PCF85063.h + PCF85063RealTimeClockLib.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + ArmGenericTimerCounterLib + ArmLib + BaseLib + DebugLib + GpioLib + DxeServicesTableLib + I2cLib + TimeBaseLib + TimerLib + UefiLib + UefiRuntimeLib + +[Guids] + gEfiEventVirtualAddressChangeGuid diff --git a/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85= 063.h b/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063.h new file mode 100644 index 000000000000..03ce4d29a03f --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063.h @@ -0,0 +1,91 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef PCF85063_H_ +#define PCF85063_H_ + +#include + +#include +#include + +// +// I2C bus address that RTC connected to +// +#define I2C_RTC_BUS_ADDRESS 1 + +// +// I2C RTC bus speed +// +#define I2C_RTC_BUS_SPEED 100000 + +// +// I2C chip address that RTC connected to +// +#define I2C_RTC_CHIP_ADDRESS 0x51 + +// +// The GPI PIN that tell if RTC can be access +// +#define I2C_RTC_ACCESS_GPIO_PIN 28 + +/** + * Returns the current time and date information of the hardware platform. + * + * @param Time A pointer to storage to receive a snapsho= t of the current time. + * + * + * @retval EFI_SUCCESS The operation completed successfully. + * @retval EFI_INVALID_PARAMETER Time is NULL. + * @retval EFI_DEVICE_ERROR The time could not be retrieved due to ha= rdware error. + */ +EFI_STATUS +EFIAPI +PlatformGetTime ( + OUT EFI_TIME *Time + ); + +/** + * Set the time and date information to the hardware platform. + * + * @param Time A pointer to storage to set the current t= ime to hardware platform. + * + * + * @retval EFI_SUCCESS The operation completed successfully. + * @retval EFI_INVALID_PARAMETER Time is NULL. + * @retval EFI_DEVICE_ERROR The time could not be set due due to hard= ware error. + **/ +EFI_STATUS +EFIAPI +PlatformSetTime ( + IN EFI_TIME *Time + ); + +/** + * Callback function for hardware platform to convert data pointers to vir= tual address + */ +VOID +EFIAPI +PlatformVirtualAddressChangeEvent ( + VOID + ); + +/** + * Callback function for hardware platform to initialize private data + * + * + * @retval EFI_SUCCESS The operation completed successfully. + * @retval Others The error status indicates the error + */ +EFI_STATUS +EFIAPI +PlatformInitialize ( + VOID + ); + +#endif /* PCF85063_H_ */ diff --git a/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85= 063.c b/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063.c new file mode 100644 index 000000000000..bc886b530f3c --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063.c @@ -0,0 +1,317 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "PCF85063.h" + +#define RTC_TIMEOUT_WAIT_ACCESS 100000 /* 100 miliseconds */ +#define RTC_DEFAULT_MIN_YEAR 2000 +#define RTC_DEFAULT_MAX_YEAR 2099 + +#define RTC_ADDR 0x4 +#define RTC_DATA_BUF_LEN 8 + +/** + * PCF85063 register offsets + */ +#define PCF85063_OFFSET_SEC 0x0 +#define PCF85063_OFFSET_MIN 0x1 +#define PCF85063_OFFSET_HR 0x2 +#define PCF85063_OFFSET_DAY 0x3 +#define PCF85063_OFFSET_WKD 0x4 +#define PCF85063_OFFSET_MON 0x5 +#define PCF85063_OFFSET_YEA 0x6 + +/** + * PCF85063 encoding macros + */ +#define PCF85063_SEC_ENC(s) (((((s) / 10) & 0x7) << 4) | (((s) % 10) & 0xf= )) +#define PCF85063_MIN_ENC(m) (((((m) / 10) & 0x7) << 4) | (((m) % 10) & 0xf= )) +#define PCF85063_HR_ENC(h) (((((h) / 10) & 0x3) << 4) | (((h) % 10) & 0xf= )) +#define PCF85063_DAY_ENC(d) (((((d) / 10) & 0x3) << 4) | (((d) % 10) & 0xf= )) +#define PCF85063_WKD_ENC(w) ((w) & 0x7) +#define PCF85063_MON_ENC(m) (((((m) / 10) & 0x1) << 4) | (((m) % 10) & 0xf= )) +#define PCF85063_YEA_ENC(y) (((((y) / 10) & 0xf) << 4) | (((y) % 10) & 0xf= )) + +/** + * PCF85063 decoding macros + */ +#define PCF85063_SEC_DEC(s) (((((s) & 0x70) >> 4) * 10) + ((s) & 0xf)) +#define PCF85063_MIN_DEC(m) (((((m) & 0x70) >> 4) * 10) + ((m) & 0xf)) +#define PCF85063_HR_DEC(h) (((((h) & 0x30) >> 4) * 10) + ((h) & 0xf)) +#define PCF85063_DAY_DEC(d) (((((d) & 0x30) >> 4) * 10) + ((d) & 0xf)) +#define PCF85063_WKD_DEC(w) ((w) & 0x7) +#define PCF85063_MON_DEC(m) (((((m) & 0x10) >> 4) * 10) + ((m) & 0xf)) +#define PCF85063_YEA_DEC(y) (((((y) & 0xf0) >> 4) * 10) + ((y) & 0xf)) + +/* Buffer pointers to convert Vir2Phys and Phy2Vir */ +STATIC volatile UINT64 RtcBufVir; +STATIC volatile UINT64 RtcBufPhy; + +STATIC +EFI_STATUS +RtcI2cWaitAccess ( + VOID + ) +{ + INTN Timeout; + + Timeout =3D RTC_TIMEOUT_WAIT_ACCESS; + while ((GpioReadBit (I2C_RTC_ACCESS_GPIO_PIN) !=3D 0) && (Timeout > 0)) { + MicroSecondDelay (100); + Timeout -=3D 100; + } + + if (Timeout <=3D 0) { + DEBUG ((DEBUG_ERROR, "%a: Timeout while waiting access RTC\n", __FUNCT= ION__)); + return EFI_TIMEOUT; + } + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS +RtcI2cRead ( + IN UINT8 Addr, + IN OUT UINT64 Data, + IN UINT32 DataLen + ) +{ + EFI_STATUS Status; + UINT32 TmpLen; + + if (EFI_ERROR (RtcI2cWaitAccess ())) { + return EFI_DEVICE_ERROR; + } + + Status =3D I2cProbe (I2C_RTC_BUS_ADDRESS, I2C_RTC_BUS_SPEED); + if (EFI_ERROR (Status)) { + return EFI_DEVICE_ERROR; + } + + // + // Send the slave address for read + // + TmpLen =3D 1; + Status =3D I2cWrite (I2C_RTC_BUS_ADDRESS, I2C_RTC_CHIP_ADDRESS, (UINT8 *= )&Addr, &TmpLen); + if (EFI_ERROR (Status)) { + return EFI_DEVICE_ERROR; + } + + // + // Read back the time + // + Status =3D I2cRead (I2C_RTC_BUS_ADDRESS, I2C_RTC_CHIP_ADDRESS, NULL, 0, = (UINT8 *)Data, &DataLen); + if (EFI_ERROR (Status)) { + return EFI_DEVICE_ERROR; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +RtcI2cWrite ( + IN UINT8 Addr, + IN UINT64 Data, + IN UINT32 DataLen + ) +{ + EFI_STATUS Status; + UINT8 TmpBuf[RTC_DATA_BUF_LEN + 1]; + UINT32 TmpLen; + + if (EFI_ERROR (RtcI2cWaitAccess ())) { + return EFI_DEVICE_ERROR; + } + + if (DataLen > sizeof (TmpBuf) - 1) { + return EFI_INVALID_PARAMETER; + } + + Status =3D I2cProbe (I2C_RTC_BUS_ADDRESS, I2C_RTC_BUS_SPEED); + if (EFI_ERROR (Status)) { + return EFI_DEVICE_ERROR; + } + + // + // The first byte is the address + // + TmpBuf[0] =3D Addr; + TmpLen =3D DataLen + 1; + CopyMem ((VOID *)(TmpBuf + 1), (VOID *)Data, DataLen); + + Status =3D I2cWrite (I2C_RTC_BUS_ADDRESS, I2C_RTC_CHIP_ADDRESS, TmpBuf, = &TmpLen); + if (EFI_ERROR (Status)) { + return EFI_DEVICE_ERROR; + } + + return EFI_SUCCESS; +} + +/** + * Returns the current time and date information of the hardware platform. + * + * @param Time A pointer to storage to receive a snapsho= t of the current time. + * + * + * @retval EFI_SUCCESS The operation completed successfully. + * @retval EFI_INVALID_PARAMETER Time is NULL. + * @retval EFI_DEVICE_ERROR The time could not be retrieved due to ha= rdware error. + */ +EFI_STATUS +EFIAPI +PlatformGetTime ( + OUT EFI_TIME *Time + ) +{ + EFI_STATUS Status; + UINT8 *Data; + + if (Time =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + Status =3D RtcI2cRead (RTC_ADDR, RtcBufVir, RTC_DATA_BUF_LEN); + + Data =3D (UINT8 *)RtcBufVir; + if (Status =3D=3D EFI_SUCCESS) { + Time->Second =3D PCF85063_SEC_DEC (Data[PCF85063_OFFSET_SEC]); + Time->Minute =3D PCF85063_MIN_DEC (Data[PCF85063_OFFSET_MIN]); + Time->Hour =3D PCF85063_HR_DEC (Data[PCF85063_OFFSET_HR]); + Time->Day =3D PCF85063_DAY_DEC (Data[PCF85063_OFFSET_DAY]); + Time->Month =3D PCF85063_MON_DEC (Data[PCF85063_OFFSET_MON]); + Time->Year =3D PCF85063_YEA_DEC (Data[PCF85063_OFFSET_YEA]); + Time->Year +=3D RTC_DEFAULT_MIN_YEAR; + if (Time->Year > RTC_DEFAULT_MAX_YEAR) { + Time->Year =3D RTC_DEFAULT_MAX_YEAR; + } + if (Time->Year < RTC_DEFAULT_MIN_YEAR) { + Time->Year =3D RTC_DEFAULT_MIN_YEAR; + } + } + + return Status; +} + +/** + * Set the time and date information to the hardware platform. + * + * @param Time A pointer to storage to set the current t= ime to hardware platform. + * + * + * @retval EFI_SUCCESS The operation completed successfully. + * @retval EFI_INVALID_PARAMETER Time is NULL. + * @retval EFI_DEVICE_ERROR The time could not be set due due to hard= ware error. + **/ +EFI_STATUS +EFIAPI +PlatformSetTime ( + IN EFI_TIME *Time + ) +{ + UINT8 *Data; + + if (Time =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + if (Time->Year < RTC_DEFAULT_MIN_YEAR || + Time->Year > RTC_DEFAULT_MAX_YEAR) + { + return EFI_INVALID_PARAMETER; + } + + Data =3D (UINT8 *)RtcBufVir; + Data[PCF85063_OFFSET_SEC] =3D PCF85063_SEC_ENC (Time->Second); + Data[PCF85063_OFFSET_MIN] =3D PCF85063_MIN_ENC (Time->Minute); + Data[PCF85063_OFFSET_HR] =3D PCF85063_HR_ENC (Time->Hour); + Data[PCF85063_OFFSET_DAY] =3D PCF85063_DAY_ENC (Time->Day); + Data[PCF85063_OFFSET_MON] =3D PCF85063_MON_ENC (Time->Month); + Data[PCF85063_OFFSET_YEA] =3D PCF85063_YEA_ENC (Time->Year - RTC_DEFAULT= _MIN_YEAR); + + return RtcI2cWrite (RTC_ADDR, RtcBufVir, RTC_DATA_BUF_LEN); +} + +/** + * Callback function for hardware platform to convert data pointers to vir= tual address + */ +VOID +EFIAPI +PlatformVirtualAddressChangeEvent ( + VOID + ) +{ + EfiConvertPointer (0x0, (VOID **)&RtcBufVir); +} + +/** + * Callback function for hardware platform to initialize private data + * + * + * @retval EFI_SUCCESS The operation completed successfully. + * @retval Others The error status indicates the error + */ +EFI_STATUS +EFIAPI +PlatformInitialize ( + VOID + ) +{ + EFI_STATUS Status; + + /* + * Allocate the buffer for RTC data + * The buffer can be accessible after ExitBootServices + */ + RtcBufVir =3D (UINT64)AllocateRuntimeZeroPool (RTC_DATA_BUF_LEN); + ASSERT_EFI_ERROR (RtcBufVir); + RtcBufPhy =3D (UINT64)RtcBufVir; + + Status =3D I2cSetupRuntime (I2C_RTC_BUS_ADDRESS); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a:%d I2cSetupRuntime() failed - %r \n", + __FUNCTION__, + __LINE__, + Status + )); + return Status; + } + + Status =3D GpioSetupRuntime (I2C_RTC_ACCESS_GPIO_PIN); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a:%d GpioSetupRuntime() failed - %r \n", + __FUNCTION__, + __LINE__, + Status + )); + return Status; + } + + return EFI_SUCCESS; +} diff --git a/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85= 063RealTimeClockLib.c b/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClo= ckLib/PCF85063RealTimeClockLib.c new file mode 100644 index 000000000000..ef8c71e92c18 --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLib/PCF85063Real= TimeClockLib.c @@ -0,0 +1,257 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "PCF85063.h" + +#define TICKS_PER_SEC (ArmGenericTimerGetTimerFreq ()) + +STATIC EFI_EVENT mVirtualAddressChangeEvent =3D NULL; + +STATIC UINT64 mLastSavedSystemCount =3D 0; +STATIC UINT64 mLastSavedTimeEpoch =3D 0; + +/** + * Returns the current time and date information, and the time-keeping cap= abilities + * of the hardware platform. + * + * @param Time A pointer to storage to receive a snapsho= t of the current time. + * @param Capabilities An optional pointer to a buffer to receiv= e the real time clock + * device's capabilities. + * + * + * @retval EFI_SUCCESS The operation completed successfully. + * @retval EFI_INVALID_PARAMETER Time is NULL. + * @retval EFI_DEVICE_ERROR The time could not be retrieved due to ha= rdware error. + */ +EFI_STATUS +EFIAPI +LibGetTime ( + OUT EFI_TIME *Time, + OUT EFI_TIME_CAPABILITIES *Capabilities + ) +{ + EFI_STATUS Status; + UINT64 CurrentSystemCount; + UINT64 TimeElapsed; + UINTN EpochSeconds; + + if ((mLastSavedTimeEpoch =3D=3D 0) || EfiAtRuntime ()) { + Status =3D PlatformGetTime (Time); + if (EFI_ERROR (Status)) { + // Failed to read platform RTC so create fake time + Time->Second =3D 0; + Time->Minute =3D 0; + Time->Hour =3D 10; + Time->Day =3D 1; + Time->Month =3D 1; + Time->Year =3D 2017; + } + + EpochSeconds =3D EfiTimeToEpoch (Time); + if (!EfiAtRuntime ()) { + mLastSavedTimeEpoch =3D EpochSeconds; + mLastSavedSystemCount =3D ArmGenericTimerGetSystemCount (); + } + } else { + CurrentSystemCount =3D ArmGenericTimerGetSystemCount (); + if (CurrentSystemCount >=3D mLastSavedSystemCount) { + TimeElapsed =3D (CurrentSystemCount - mLastSavedSystemCount) / MultU= 64x32 (1, TICKS_PER_SEC); + EpochSeconds =3D mLastSavedTimeEpoch + TimeElapsed; + } else { + // System counter overflow 64 bits + // Call GetTime again to read the date from RTC HW, not using generi= c timer system counter + mLastSavedTimeEpoch =3D 0; + return LibGetTime (Time, Capabilities); + } + } + + // Adjust for the correct timezone + if (Time->TimeZone !=3D EFI_UNSPECIFIED_TIMEZONE) { + EpochSeconds +=3D Time->TimeZone * SEC_PER_MIN; + } + + // Adjust for the correct period + if ((Time->Daylight & EFI_TIME_IN_DAYLIGHT) =3D=3D EFI_TIME_IN_DAYLIGHT)= { + // Convert to adjusted time, i.e. spring forwards one hour + EpochSeconds +=3D SEC_PER_HOUR; + } + + EpochToEfiTime (EpochSeconds, Time); + + return EFI_SUCCESS; +} + +/** + * Sets the current local time and date information. + * + * @param Time A pointer to the current time. + * + * @retval EFI_SUCCESS The operation completed successfully. + * @retval EFI_INVALID_PARAMETER A time field is out of range. + * @retval EFI_DEVICE_ERROR The time could not be set due due to hard= ware error. + */ +EFI_STATUS +EFIAPI +LibSetTime ( + IN EFI_TIME *Time + ) +{ + EFI_STATUS Status; + UINTN EpochSeconds; + + EpochSeconds =3D EfiTimeToEpoch (Time); + + // Adjust for the correct time zone, i.e. convert to UTC time zone + if (Time->TimeZone !=3D EFI_UNSPECIFIED_TIMEZONE) { + EpochSeconds -=3D Time->TimeZone * SEC_PER_MIN; + } + + // Adjust for the correct period, i.e. fall back one hour + if ((Time->Daylight & EFI_TIME_IN_DAYLIGHT) =3D=3D EFI_TIME_IN_DAYLIGHT)= { + EpochSeconds -=3D SEC_PER_HOUR; + } + + EpochToEfiTime (EpochSeconds, Time); + + Status =3D PlatformSetTime (Time); + if (EFI_ERROR (Status)) { + return Status; + } + + if (!EfiAtRuntime ()) { + mLastSavedTimeEpoch =3D EpochSeconds; + mLastSavedSystemCount =3D ArmGenericTimerGetSystemCount (); + } + + return EFI_SUCCESS; +} + +/** + * Returns the current wakeup alarm clock setting. + * + * @param Enabled Indicates if the alarm is currently enabl= ed or disabled. + * @param Pending Indicates if the alarm signal is pending = and requires acknowledgement. + * @param Time The current alarm setting. + * + * @retval EFI_SUCCESS The alarm settings were returned. + * @retval EFI_INVALID_PARAMETER Any parameter is NULL. + * @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved du= e to a hardware error. + */ +EFI_STATUS +EFIAPI +LibGetWakeupTime ( + OUT BOOLEAN *Enabled, + OUT BOOLEAN *Pending, + OUT EFI_TIME *Time + ) +{ + return EFI_UNSUPPORTED; +} + +/** + * Sets the system wakeup alarm clock time. + * + * @param Enabled Enable or disable the wakeup alarm. + * @param Time If Enable is TRUE, the time to set the wa= keup alarm for. + * + * @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm = was enabled. If + * Enable is FALSE, then the wakeup alarm wa= s disabled. + * @retval EFI_INVALID_PARAMETER A time field is out of range. + * @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a= hardware error. + * @retval EFI_UNSUPPORTED A wakeup timer is not supported on this p= latform. + */ +EFI_STATUS +EFIAPI +LibSetWakeupTime ( + IN BOOLEAN Enabled, + OUT EFI_TIME *Time + ) +{ + return EFI_UNSUPPORTED; +} + +/** + Fixup internal data so that EFI can be call in virtual mode. + Call the passed in Child Notify event and convert any pointers in + lib to virtual mode. + + @param[in] Event The Event that is being processed + @param[in] Context Event Context +**/ +VOID +EFIAPI +LibRtcVirtualNotifyEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + // + // Only needed if you are going to support the OS calling RTC functions = in virtual mode. + // You will need to call EfiConvertPointer (). To convert any stored phy= sical addresses + // to virtual address. After the OS transitions to calling in virtual mo= de, all future + // runtime calls will be made in virtual mode. + // + PlatformVirtualAddressChangeEvent (); +} + +/** + * This is the declaration of an EFI image entry point. This can be the en= try point to an application + * written to this specification, an EFI boot service driver, or an EFI ru= ntime driver. + * + * @param ImageHandle Handle that identifies the loaded image. + * @param SystemTable System Table for this image. + * + * @retval EFI_SUCCESS The operation completed successfully. + */ +EFI_STATUS +EFIAPI +LibRtcInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + Status =3D PlatformInitialize (); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Register for the virtual address change event + // + Status =3D gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + LibRtcVirtualNotifyEvent, + NULL, + &gEfiEventVirtualAddressChangeGuid, + &mVirtualAddressChangeEvent + ); + ASSERT_EFI_ERROR (Status); + + return EFI_SUCCESS; +} --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83818): https://edk2.groups.io/g/devel/message/83818 Mute This Topic: https://groups.io/mt/87123860/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83819+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83819+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167796496966.7701909698626; Wed, 17 Nov 2021 08:49:56 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 8Io5YY1788612xEDrSkipA67; Wed, 17 Nov 2021 08:49:56 -0800 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.130]) by mx.groups.io with SMTP id smtpd.web10.9741.1637167795443633947 for ; Wed, 17 Nov 2021 08:49:55 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oCi4GeLUesc3Jvdkxmw/w6ZuqBs60CKKtVG3ZPJL81VoPHZH0zTPHTTtF0tkxk7HT56iZyB+xjwLXCUD8hGmW8NwqahOge4IRthHiBSpKnLlDUhnkJHN7cRtDUoegZcm4N36u4t7MUobmdQuYFWBGeEY6aydhJpTa4kg70pEe3QMOcSSsLG3weTYljp4GPeqEdKoL96+foSEoM4hf6rm+VglfScvSbjwmPccSY183PJcXcdn5Z8w5c0Vi7lP1dWVpjzHtkt8e8pFdJ+fL5tN38lWDITVwiawnOohuXIG8q/WhBehAl6mWnTnqpNxqK6sRZZe5i80dwAds6QU5yHGAQ== 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=bon7pA7rlHsARlLLT+rNWIdgpmZMwIMvU0j5zodyMHk=; b=BSnoPgXUiikHVGudw7rxISpA4foK6DGPUf9GuLMsyGJ3R5lRZUpLqpQA0GfRQv8kVHy8HWHJm4GMknIayZsWmkujKX3ebCze2C1aRk4W+J3noG4utsFVyRWRNDR+0EGlWvBn+3ihbzL4xWoht00cDTKDQDq1HCJMSa+lkiDTZ7qint47Hzn2fsDZRJNlr8ntO92xK/2P0HPeXYHWsrj4GmEnASDGdZU2vdFYH6YXJH7lf0/Lnk3pZ4TAcyS+YxO47nG//qdSYHJOQjTE0J9YWQFgnb0xEEmGPu6ilyeFDUR2yDJ4WDt7OV9wroZxJSxNkz4YsTIOa7fvbQvd0EfAWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB6454.prod.exchangelabs.com (2603:10b6:510:1b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.20; Wed, 17 Nov 2021 16:49:53 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:49:53 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Quan Nguyen , Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 06/30] AmpereAltraPkg: Add BootProgress support Date: Wed, 17 Nov 2021 23:47:03 +0700 Message-ID: <20211117164727.10922-7-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:49:50 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7b55f846-1886-442c-5d9e-08d9a9ea4757 X-MS-TrafficTypeDiagnostic: PH0PR01MB6454: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: /+Pn0LNX09Og2Ep2zU9ZhZRiX1GNVdHoaWshQwwABz2wxnPbAk7B6ldjGqebffIhPqUEFc529zjYiQnCPxSkzwbwvolVnJMgZrakf8hiMzHBojOsJURZbmRerzSyGeM36Origw0Rbxhzd5p1AgNyMxIotJmttwIKRPwxvQGkn/0IN9TDS1cCoeLSKliM+dm4N4gqugvVzwZI7HnLtipPZq5BFuPRwydwE9HL9f5+wyhjtK0uet7vcDApQJ/yQ9YmlseIvrpR5BbA5lbyT83a3RD1tIx4YRphIRzXGIlL/1+6q0RpbF0D6uWFpN5Q8zjYJN407F0ApuVbQeu+o/RHHm9nPziZS5osNvVoR69MhPVJqBS2spAnN/2w8leXAl4Y+yjgOTBEW3Q4lxCdsL2Vrwg/MvwrbKJ0Y1C9tSdzmDPbEX+IkT8UtyGV/+Vb88+A8wEOCcdKH+A/DB4gUkBiJ5YenN60eOb+TYOeLrDjrVxxwz9JpLy4ECUKk/4HVzsbf6du3kZP30mck1dkJbFQF0EKKwwl7kKEuiHWnj/0gKh+fomPO2mFjpt8yv2WaE+A0ZY8G6Xxa3UJvTClFndwsDbIx3B6qJcHQMoPh2Wd3q8PwWwZJdp+99pqHAo72k0es5rJhPrfuVA3szr9a1VxuWjlXEiO7lYzx6WiGOessV7UuPpmNJ3Cbnw75B1dqheXsbyictKM8aumrejIY34iYg== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?USdDsvuFnlwi9voQt69tiwdmPkQzlZ1fG6b45Ptk/lbOkpcFy0VMZ6tOVtD3?= =?us-ascii?Q?fIi4goA3eN8fao/I+0E5Dr5NCX6RvYefGjkrkrUhf7VVFxpmMlNOkv09WDlK?= =?us-ascii?Q?mUWdCd6wkehlKXk7FcqwzMjo2+McsN1aWCyuVwxpArbK3+5Hs6ZP6MAL4nSR?= =?us-ascii?Q?EvEaHwEX4PZ0HFT/UacTD6TDDs/PCLnOcCbMAAAQbomzu297+ik7tbLk2NXZ?= =?us-ascii?Q?uzeocS3m7e/1BlUx/I4MF3QebgGjd2n+2oGN7Ezxuv1gwZo7WsCbliTWFiRM?= =?us-ascii?Q?vIwa81GjSFB3CfV5TFi87hSq15kYde458CYGTz8NX7E2vzDjJVWzP7MwbaSQ?= =?us-ascii?Q?Ai6cYqXNcU2j2T7x0/ZOs0nBQFo/VJMfOrWOLDMzIQVuAD8SJZ5O72bUl6mg?= =?us-ascii?Q?MwFbG9PB8GS6X6GS9+4neNiinhrp9c8LhJ49WPEF2JBYeUpHrspjz9YJUHjd?= =?us-ascii?Q?nxn7ewCZgzF0jb08P0a4om5CjNpM4MhuFbovkYw1Tb5cuatG4V+nwaWkVP/R?= =?us-ascii?Q?LsisDV+ATbyJYrQKwlKQV8T/i6xNuv6VF0U4WiJ52fveW9Alp0ULB0GtYJF6?= =?us-ascii?Q?+xesFsBxSnWSVG1rUIF4IqtBuPJ8Y03xKldKjmgdhlA9xi2hPXl7VXN7LTGh?= =?us-ascii?Q?fsqfK/vWwCB7PbmD9pR+tBYpdTFRciQlRaLPmyLIxmXFEZspLG/q16RT1P1x?= =?us-ascii?Q?6Od6q/eUX7DQnhlfC+ohDLQp/dX6CBMbliQ9B/uzaUgR/GOGtfE52qtZdUxP?= =?us-ascii?Q?+VuvVCCTo7rpA9KgGm055hBgN9ydOGzRdW9yyQh6xb8cfU9FEpAGGIkombsE?= =?us-ascii?Q?unKTBDOmFS+7q9YUPd65MMQwSSdi5Dcv7tDltd7XERoy2NPGc2RxPAgqY4yj?= =?us-ascii?Q?/NPi7DcJpzD/GD2HwL61Q4TmiMkAy1pyR1TmkEfnAJRhEpNOqqvoxtsn+rjQ?= =?us-ascii?Q?nV1x4Z34bwDp7qQ8m+o4P4hm9HKtkXmVEEXDCi6x3U5NvPBZ5eQ2L6BugS1s?= =?us-ascii?Q?UaI62NqSwHMf7Q77nRihxP4/2JUftM8kbKAqm40Z1/uiI2BkydY7qMOzFkUl?= =?us-ascii?Q?vxZzGO7gHyeOdLMK2+2dDPa0NznCcKe07MuDP53mYpjYQHQ/NJ9YjE5gpnt2?= =?us-ascii?Q?ArSG0SkCTiaMz0N/cDHKoj0C94ZquglhLUFrqX+lmcwRKa0aODPa9Yn0jD2G?= =?us-ascii?Q?BgyzULVShRql+hPjS36uaKuyt7qAUAe5SyGCg46ydH6SD9xBGO+N3fNFKeYv?= =?us-ascii?Q?wZIH4fyJX5c5wcPj0pUusLrgFGmb/DfKEP5FNOQdUu+D3Hjmrx3mU3UgHN5Z?= =?us-ascii?Q?V4lCFr9uBWqsoCmpJaDprlVr4lXyVqX5UGxrZgDlZTVkbMNdvTklEhmdtww0?= =?us-ascii?Q?3+Fuodemuefr8W8fXgPGdFoRGcPir+6V6CikwytS62uHLucVWrBF8ofQuH9u?= =?us-ascii?Q?MC/kWpmNJ9HYbdQJDFJLw9W2VTxNGxWYf80tGzbdq4OSP8wnJjnsdqLJqX1b?= =?us-ascii?Q?AE0v/gT5Oi+QzfBCoipWv/yjwimwhaKfEP6Z5Gv8LJ4tVm5Mwr4Mk5avKjm6?= =?us-ascii?Q?r67zfHbg/ZMBS4v1umQoNBCGFg6AudcZvPWXLVBW/AAwUlIxbiLpyoxPzvnb?= =?us-ascii?Q?/zpTq2RCV/dGaTiNUqY/8epCl9N6dxwbcEHLiGpTPtDy21apwO/HcM6555n4?= =?us-ascii?Q?SsYRdw=3D=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b55f846-1886-442c-5d9e-08d9a9ea4757 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:49:53.6922 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /+kATRiwglF1Es1EXI3rOVIPB3UtUDkmG84JDQAQTrKNkMrMeXshp79ficQuIYZwKtD078H9T+n9fQYMNF5sP54bUN5Ga/+1uh2lLqOuHSo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6454 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: 9ZUR3JHKjjxg6utWS3kF9yaox1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167796; bh=g5LnOsEMnhRXrFcI/4dEk8Xzb2HRmQAkbS0QRhQWbzI=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=agmfn/4Spyfp0biuogzIkNR0xXJE2R78Z7IurXK4Vb7hzIBriVxDv2vF90gBIlJNbK5 HWfui9z/5Hg8z4+ZJGtZL3DPx4yQXQAiVNBi1We6ppKp4xXYez32L9C6Dvmiz9UeDRipN +y3aGWwggdx5jIVdsmX6BYkC4jtMxHrYaCg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167797521100007 Content-Type: text/plain; charset="utf-8" From: Quan Nguyen BootProgress will send 32-bit UEFI Status Code via doorbell to report its progress status. Currently support reporting Progress Status Code and Error Status Code only. Other types of Status Code are ignored. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc = | 2 + Platform/Ampere/JadePkg/Jade.fdf = | 2 + Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressDxe/BootPro= gressDxe.inf | 51 +++++ Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressPeim/BootPr= ogressPeim.inf | 49 +++++ Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressDxe/BootPro= gressDxe.c | 212 ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressPeim/BootPr= ogressPeim.c | 211 +++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressDxe/BootPro= gressDxe.uni | 16 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressPeim/BootPr= ogressPeim.uni | 18 ++ 8 files changed, 561 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index 326bdfb5ced5..3ffad43d1696 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -532,6 +532,7 @@ [Components.common] } MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouter= Pei.inf MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressPeim/Boot= ProgressPeim.inf =20 # # DXE Phase modules @@ -542,6 +543,7 @@ [Components.common] } MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCod= eRouterRuntimeDxe.inf MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRun= timeDxe.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressDxe/BootP= rogressDxe.inf =20 # # PCD diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index f20a8645c415..459a1475ada1 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -101,6 +101,7 @@ [FV.FVMAIN_COMPACT] INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf INF Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressPeim/= BootProgressPeim.inf INF ArmPkg/Drivers/CpuPei/CpuPei.inf INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf @@ -149,6 +150,7 @@ [FV.FvMain] INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatu= sCodeRouterRuntimeDxe.inf INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandle= rRuntimeDxe.inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressDxe/B= ootProgressDxe.inf =20 # # PI DXE Drivers producing Architectural Protocols (EFI Services) diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgres= sDxe/BootProgressDxe.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgre= ss/BootProgressDxe/BootProgressDxe.inf new file mode 100644 index 000000000000..2211a213a6df --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressDxe/Bo= otProgressDxe.inf @@ -0,0 +1,51 @@ +## @file +# This module installs Boot Progress Dxe. +# +# This module registers report status code listener to report boot progre= ss +# to SMpro. +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D BootProgressDxe + MODULE_UNI_FILE =3D BootProgressDxe.uni + FILE_GUID =3D 6E12F248-F0C1-11EA-B37C-9798918A2163 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D BootProgressDxeEntryPoint + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D AARCH64 +# + +[Sources] + BootProgressDxe.c + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + AmpereCpuLib + BaseLib + DebugLib + DxeServicesLib + SystemFirmwareInterfaceLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + UefiRuntimeServicesTableLib + +[Protocols] + gEfiRscHandlerProtocolGuid ## CONSUMES + +[Depex] + gEfiRscHandlerProtocolGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgres= sPeim/BootProgressPeim.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/BootProg= ress/BootProgressPeim/BootProgressPeim.inf new file mode 100644 index 000000000000..1dd0ec31ac37 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressPeim/B= ootProgressPeim.inf @@ -0,0 +1,49 @@ +## @file +# Boot Progress Pei Module. +# +# Updates to SCP with Boot Progress information during boot. +# +# This module register report status code listener to collect boot progre= ss +# information and keep SCP posted. +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D BootProgressPeim + MODULE_UNI_FILE =3D BootProgressPeim.uni + FILE_GUID =3D 2E8A3B3E-F26C-11EA-BDE5-6726AD8F88BD + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D BootProgressPeiEntryPoint + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D AARCH64 +# + +[Sources] + BootProgressPeim.c + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + PeiServicesLib + PeimEntryPoint + SystemFirmwareInterfaceLib + +[Ppis] + gEfiPeiRscHandlerPpiGuid ## CONSUMES + +[Depex] + gEfiPeiRscHandlerPpiGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgres= sDxe/BootProgressDxe.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress= /BootProgressDxe/BootProgressDxe.c new file mode 100644 index 000000000000..307efc4529e6 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressDxe/Bo= otProgressDxe.c @@ -0,0 +1,212 @@ +/** @file + + This module installs Boot Progress Dxe that report boot progress to SMpr= o. + + This module registers report status code listener to report boot progress + to SMpro. + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +typedef struct { + UINT8 Byte; + EFI_STATUS_CODE_VALUE Value; +} STATUS_CODE_TO_CHECKPOINT; + +typedef enum { + BootNotStart =3D 0, + BootStart, + BootComplete, + BootFailed, + BootProgressStateMax +} BOOT_PROGRESS_STATE; + +UINT32 DxeProgressCode[] =3D { + (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_ENTRY_POINT), = // DXE Core is started + (EFI_COMPUTING_UNIT_CHIPSET | EFI_CHIPSET_PC_DXE_HB_INIT), = // PCI host bridge initialization + (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT), = // Boot Device Selection (BDS) phase is started=C2=A0 + (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_BEGIN_CONNECTING_DRIVERS)= , // Driver connecting is started + (EFI_IO_BUS_PCI | EFI_IOB_PC_INIT), = // PCI Bus initialization is started + (EFI_IO_BUS_PCI | EFI_IOB_PCI_HPC_INIT), = // PCI Bus Hot Plug Controller Initialization + (EFI_IO_BUS_PCI | EFI_IOB_PCI_BUS_ENUM), = // PCI Bus Enumeration + (EFI_IO_BUS_PCI | EFI_IOB_PCI_RES_ALLOC), = // PCI Bus Request Resources + (EFI_IO_BUS_PCI | EFI_IOB_PC_ENABLE), = // PCI Bus Assign Resources + (EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_PC_INIT), = // Console Output devices connect + (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_INIT), = // Console input devices connect + (EFI_IO_BUS_LPC | EFI_IOB_PC_INIT), = // Super IO Initialization + (EFI_IO_BUS_USB | EFI_IOB_PC_INIT), = // USB initialization is started + (EFI_IO_BUS_USB | EFI_IOB_PC_RESET), = // USB Reset + (EFI_IO_BUS_USB | EFI_IOB_PC_DETECT), = // USB Detect + (EFI_IO_BUS_USB | EFI_IOB_PC_ENABLE), = // USB Enable + (EFI_IO_BUS_SCSI | EFI_IOB_PC_INIT), = // SCSI initialization is started + (EFI_IO_BUS_SCSI | EFI_IOB_PC_RESET), = // SCSI Reset + (EFI_IO_BUS_SCSI | EFI_IOB_PC_DETECT), = // SCSI Detect + (EFI_IO_BUS_SCSI | EFI_IOB_PC_ENABLE), = // SCSI Enable + (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_VERIFYING_PASSWORD), = // Setup Verifying Password + (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_USER_SETUP), = // Start of Setup + (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_INPUT_WAIT), = // Setup Input Wait + (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT), = // Ready To Boot event + (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES), = // Exit Boot Services event + (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_RS_PC_SET_VIRTUAL_ADDRESS_MAP= ), // Runtime Set Virtual Address MAP Begin + (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_VIRTUAL_ADDRESS_CHANGE_EV= ENT), // Runtime Set Virtual Address MAP End + (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_RS_PC_RESET_SYSTEM), = // System Reset + (EFI_IO_BUS_USB | EFI_IOB_PC_HOTPLUG), = // USB hot plug + (EFI_IO_BUS_PCI | EFI_IOB_PC_HOTPLUG), = // PCI bus hot plug + 0 = // Must ended by 0 +}; + +UINT32 DxeErrorCode[] =3D { + (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_EC_NO_ARCH), = // Some of the Architectural Protocols are not available + (EFI_IO_BUS_PCI | EFI_IOB_EC_RESOURCE_CONFLICT), = // PCI resource allocation error. Out of Resources + (EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_NOT_DETECTED), = // No Console Output Devices are found + (EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED), = // No Console Input Devices are found + (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_EC_INVALID_PASSWORD), = // Invalid password + (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR), = // Error loading Boot Option (LoadImage returned error) + (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED), = // Boot Option is failed (StartImage returned error) + (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_UPDATE_FAIL), = // Flash update is failed + (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_PS_EC_RESET_NOT_AVAILABLE), = // Reset protocol is not available + 0 = // Must end by 0 +}; + +EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol =3D NULL; + +STATIC UINT8 mBootstate =3D BootStart; + +STATIC +BOOLEAN +StatusCodeFilter ( + UINT32 *Map, + EFI_STATUS_CODE_VALUE Value + ) +{ + UINTN Index =3D 0; + + while (Map[Index] !=3D 0) { + if (Map[Index] =3D=3D Value) { + return TRUE; + } + Index++; + } + return FALSE; +} + +/** + Report status code listener of Boot Progress Dxe. + + @param[in] CodeType Indicates the type of status code being = reported. + @param[in] Value Describes the current status of a hardwa= re or software entity. + This included information about the clas= s and subclass that is used to + classify the entity as well as an operat= ion. + @param[in] Instance The enumeration of a hardware or softwar= e entity within + the system. Valid instance numbers start= with 1. + @param[in] CallerId This optional parameter may be used to i= dentify the caller. + This parameter allows the status code dr= iver to apply different rules to + different callers. + @param[in] Data This optional parameter may be used to p= ass additional data. + + @retval EFI_SUCCESS Status code is what we expected. + @retval EFI_UNSUPPORTED Status code not supported. + +**/ +EFI_STATUS +EFIAPI +BootProgressListenerDxe ( + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value, + IN UINT32 Instance, + IN EFI_GUID *CallerId, + IN EFI_STATUS_CODE_DATA *Data + ) +{ + BOOLEAN IsProgress =3D FALSE; + BOOLEAN IsError =3D FALSE; + + if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) =3D=3D EFI_PROGRESS_CODE) { + IsProgress =3D StatusCodeFilter (DxeProgressCode, Value); + } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) =3D=3D EFI_ERROR_CODE)= { + IsError =3D StatusCodeFilter (DxeErrorCode, Value); + } else { + return EFI_SUCCESS; + } + + if (!IsProgress && !IsError) { + return EFI_SUCCESS; + } + + DEBUG (( + DEBUG_INFO, + "BootProgressDxe: CodeType=3D0x%X Value=3D0x%X Instance=3D0x%X CallerI= dGuid=3D%g Data=3D%p\n", + CodeType, + Value, + Instance, + CallerId, + Data + )); + + if (IsError) { + mBootstate =3D BootFailed; + } else if (Value =3D=3D (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_R= EADY_TO_BOOT_EVENT)) { + /* Set boot complete when reach to ReadyToBoot event */ + mBootstate =3D BootComplete; + } + + MailboxMsgSetBootProgress (0, mBootstate, Value); + + if (Value =3D=3D (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT= _SERVICES) && + mRscHandlerProtocol !=3D NULL) + { + mRscHandlerProtocol->Unregister (BootProgressListenerDxe); + } + + return EFI_SUCCESS; +} + + +/** + The module Entry Point of the Firmware Performance Data Table DXE driver. + + @param[in] ImageHandle The firmware allocated handle for the EFI ima= ge. + @param[in] SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The entry point is executed successfully. + @retval Other Some error occurs when executing this entry point. + +**/ +EFI_STATUS +EFIAPI +BootProgressDxeEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + // + // Get Report Status Code Handler Protocol. + // + Status =3D gBS->LocateProtocol (&gEfiRscHandlerProtocolGuid, NULL, (VOID= **)&mRscHandlerProtocol); + ASSERT_EFI_ERROR (Status); + + // + // Register report status code listener for OS Loader load and start. + // + if (!EFI_ERROR (Status)) { + Status =3D mRscHandlerProtocol->Register (BootProgressListenerDxe, TPL= _HIGH_LEVEL); + } + ASSERT_EFI_ERROR (Status); + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgres= sPeim/BootProgressPeim.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgre= ss/BootProgressPeim/BootProgressPeim.c new file mode 100644 index 000000000000..9b166ed1efbf --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressPeim/B= ootProgressPeim.c @@ -0,0 +1,211 @@ +/** @file + + This module installs Boot Progress Pei to report boot progress to SMpro. + + This module registers report status code listener to report boot progress + to SMpro. + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include + +typedef enum { + BootNotStart =3D 0, + BootStart, + BootComplete, + BootFailed, + BootProgressStateMax +} BOOT_PROGRESS_STATE; + +UINT32 PeiProgressStatusCode[] =3D { + // Regular boot + (EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_CORE_PC_ENTRY_POINT), // PEI= Core is started + (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_POWER_ON_INIT), // Pre= -memory CPU initialization is started + (EFI_SOFTWARE_PEI_SERVICE | EFI_SW_PS_PC_INSTALL_PEI_MEMORY), // Mem= ory Installed + (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_PC_INIT_BEGIN), // CPU= post-memory initialization is started + (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_CACHE_INIT), // CPU= post-memory initialization. Cache initialization + (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_AP_INIT), // CPU= post-memory initialization. Application Processor(s) (AP) initialization + (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_BSP_SELECT), // CPU= post-memory initialization. Boot Strap Processor (BSP) selection + (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_SMM_INIT), // CPU= post-memory initialization. System Management Mode (SMM) initialization + // DXE IPL is started + (EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_CORE_PC_HANDOFF_TO_NEXT), // DXE IPL= is started + // DXE Core is started + (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_ENTRY_POINT), // DXE Cor= e is started + // Recovery + (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_RECOVERY_AUTO), // Recovery co= ndition triggered by firmware (Auto recovery) + (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_RECOVERY_USER), // Recovery co= ndition triggered by user (Forced recovery) + (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_RECOVERY_BEGIN), // Recovery pr= ocess started + (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_CAPSULE_LOAD), // Recovery fi= rmware image is found + (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_CAPSULE_START), // Recovery fi= rmware image is loaded + // S3 + (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_S3_BOOT_SCRIPT), // S3 Boot Scr= ipt execution + (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_OS_WAKE), // OS S3 wake = vector call + 0 // Must end wi= th 0 +}; + +UINT32 PeiErrorStatusCode[] =3D { + // Regular boot + (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_TYPE), // Me= mory initialization error. Invalid memory type + (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_SPEED), // Me= mory initialization error. Incompatible memory speed + (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_SPD_FAIL), // Me= mory initialization error. SPD reading has failed + (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_SIZE), // Me= mory initialization error. Invalid memory size + (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_MISMATCH), // Me= mory initialization error. Memory modules do not match + (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_NONE_DETECTED), // Me= mory initialization error. No usable memory detected + (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_NONE_USEFUL), // Me= mory initialization error. No usable memory detected + (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_EC_NON_SPECIFIC), // Un= specified memory initialization error. + (EFI_SOFTWARE_PEI_CORE | EFI_SW_PEI_CORE_EC_MEMORY_NOT_INSTALLED), // Me= mory not installed + (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_INVALID_TYPE), // In= valid CPU type + (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_INVALID_SPEED), // In= valid CPU Speed + (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_MISMATCH), // CP= U mismatch + (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST), // CP= U self test failed + (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_CACHE), // po= ssible CPU cache error + (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_INTERNAL), // In= ternal CPU error + (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_EC_NON_SPECIFIC), // In= ternal CPU error + (EFI_SOFTWARE_PEI_SERVICE | EFI_SW_PS_EC_RESET_NOT_AVAILABLE), // re= set PPI is not available + // Recovery + (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_RECOVERY_PPI_NOT_FOUND), //= Recovery PPI is not available + (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_NO_RECOVERY_CAPSULE), //= Recovery capsule is not found + (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_INVALID_CAPSULE_DESCRIPTOR), //= Invalid recovery capsule + // S3 Resume + (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_S3_RESUME_FAIL), // S3= Resume Failed + (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_RESUME_PPI_NOT_FOUND), // S3= Resume PPI not found + (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_BOOT_SCRIPT_ERROR), // S3= Resume Boot Script Error + (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_OS_WAKE_ERROR), // S3= OS Wake Error + 0 +}; + +// Should always be BootStart when start +STATIC UINT8 mBootstate =3D BootStart; + +STATIC +BOOLEAN +StatusCodeFilter ( + UINT32 *Map, + EFI_STATUS_CODE_VALUE Value + ) +{ + UINTN Index =3D 0; + + while (Map[Index] !=3D 0) { + if (Map[Index] =3D=3D Value) { + return TRUE; + } + Index++; + } + + return FALSE; +} + +/** + Report status code listener for PEI. This is used to record the boot pro= gress info + and report it to SMpro. + + @param[in] PeiServices An indirect pointer to the EFI_PEI_SERVI= CES table published by the PEI Foundation. + @param[in] CodeType Indicates the type of status code being = reported. + @param[in] Value Describes the current status of a hardwa= re or software entity. + This included information about the clas= s and subclass that is used to + classify the entity as well as an operat= ion. + @param[in] Instance The enumeration of a hardware or softwar= e entity within + the system. Valid instance numbers start= with 1. + @param[in] CallerId This optional parameter may be used to i= dentify the caller. + This parameter allows the status code dr= iver to apply different rules to + different callers. + @param[in] Data This optional parameter may be used to p= ass additional data. + + @retval EFI_SUCCESS Status code is what we expected. + @retval EFI_UNSUPPORTED Status code not supported. + +**/ +EFI_STATUS +EFIAPI +BootProgressListenerPei ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value, + IN UINT32 Instance, + IN CONST EFI_GUID *CallerId, + IN CONST EFI_STATUS_CODE_DATA *Data + ) +{ + BOOLEAN IsProgress =3D FALSE; + BOOLEAN IsError =3D FALSE; + + if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) =3D=3D EFI_PROGRESS_CODE) { + IsProgress =3D StatusCodeFilter (PeiProgressStatusCode, Value); + } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) =3D=3D EFI_ERROR_CODE)= { + IsError =3D StatusCodeFilter (PeiErrorStatusCode, Value); + } else { + return EFI_SUCCESS; + } + + // No interested status found + if (!IsProgress && !IsError) { + return EFI_SUCCESS; + } + + DEBUG (( + DEBUG_INFO, + "BootProgressPeim: CodeType=3D0x%X Value=3D0x%X Instance=3D0x%X Caller= IdGuid=3D%g Data=3D%p\n", + CodeType, + Value, + Instance, + CallerId, + Data + )); + + if (IsError) { + mBootstate =3D BootFailed; + } + + MailboxMsgSetBootProgress (0, mBootstate, Value); + + return EFI_SUCCESS; +} + +/** + Main entry for Boot Progress PEIM. + + This routine is to register report status code listener for Boot Progres= s PEIM. + + @param[in] FileHandle Handle of the file being invoked. + @param[in] PeiServices Pointer to PEI Services table. + + @retval EFI_SUCCESS Report status code listener is registered successful= ly. + +**/ +EFI_STATUS +EFIAPI +BootProgressPeiEntryPoint ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + EFI_STATUS Status; + EFI_PEI_RSC_HANDLER_PPI *RscHandler; + + Status =3D PeiServicesLocatePpi ( + &gEfiPeiRscHandlerPpiGuid, + 0, + NULL, + (VOID **)&RscHandler + ); + ASSERT_EFI_ERROR (Status); + + if (!EFI_ERROR (Status)) { + Status =3D RscHandler->Register (BootProgressListenerPei); + } + ASSERT_EFI_ERROR (Status); + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgres= sDxe/BootProgressDxe.uni b/Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgre= ss/BootProgressDxe/BootProgressDxe.uni new file mode 100644 index 000000000000..492e85404631 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressDxe/Bo= otProgressDxe.uni @@ -0,0 +1,16 @@ +// +// This module installs Boot Progress Dxe that report boot progress to SMp= ro. +// +// This module registers report status code listener to report boot progre= ss +// for SMpro. +// +// Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// + + +#string STR_MODULE_ABSTRACT #language en-US "Installs Boot Pro= gress Driver" + +#string STR_MODULE_DESCRIPTION #language en-US "This module regis= ters report status code listener to collect and report boot progress to SMp= ro." diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgres= sPeim/BootProgressPeim.uni b/Silicon/Ampere/AmpereAltraPkg/Drivers/BootProg= ress/BootProgressPeim/BootProgressPeim.uni new file mode 100644 index 000000000000..0371fc4f9a80 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressPeim/B= ootProgressPeim.uni @@ -0,0 +1,18 @@ +// +// Boot Progress Pei Module. +// +// Updates to SCP with Boot Progress information during boot +// +// This module register report status code listener to collect boot progre= ss +// information and keep SCP posted. +// +// Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// + + +#string STR_MODULE_ABSTRACT #language en-US "Boot Progress Pei= Module." + +#string STR_MODULE_DESCRIPTION #language en-US "Updates SCP with = boot progress information during boot. This module register report status c= ode listener to collect boot progress information and post to SCP." --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83819): https://edk2.groups.io/g/devel/message/83819 Mute This Topic: https://groups.io/mt/87123863/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83820+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83820+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167799746693.3312305164782; Wed, 17 Nov 2021 08:49:59 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id RAhnYY1788612xIg2zfn4FgO; Wed, 17 Nov 2021 08:49:59 -0800 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.131]) by mx.groups.io with SMTP id smtpd.web08.9763.1637167798630383019 for ; Wed, 17 Nov 2021 08:49:58 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l20s1RcsTfiPe4quHAHrJEsmz/awSlv8yoAspyh1Eewk82labED7fELcVpDg1Hr2qQdyQ+ZYv3/ep+iZ/dLkfYIOy81y1DZ6cL8JJa243CFxoU9vTaQCetLfV1v/XWJ005+uL8eaT8/ashKGCLx6Z81euwK8VNGxvGrLDK64Ha8VdjCL/og+b5YzCkcoKmfvnVHI296D3Zmw8RwwNmvv2ScyF2Ig28ji4qZTxzjMFQS0M5VN9K7NqAu9m6TsDF9z6oYPsBpfyqfRTPecp4n7x2wSo5rLLxfFfLK1UPopXcPxXjbRNbzJtElbd0PqB7fRY8pGe6/qbk/YE2kV5epUVg== 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=LpzvWe/aGpLfl0PiWZZADuaBPC2Bum6I9pjWKkqyIMs=; b=SpcbMPqLBovoC0cLi+7tFHrcb//2uLnueji7fVll9xHFnZszeLXM4aDo0dF8O+jxDYf3+hUnSiPgOgsflfS4XqJd0NPt1oLSIEIaw6W6M0les4q5wUQulxzFkR+g2HgmC2XXJRd9GI8kWnrNzPGGT2LyeLXxcn6WvontMPSFyL9dpID0uJKIaxsCqOp0TAFrKjAPPuQLL/3OioV6mOO1YjBb/HHoM8JPq/M6mMgubjMIPSpcJzC0XR7hp/RsXZsnMr+/h4f2GtUW/RGQcXY7pYRbuuN103r+ptn7eOhtxsYK0Gf1r/NaWk26EfgTYLS6HEAPLQLJIebMJehF9+ORxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB6454.prod.exchangelabs.com (2603:10b6:510:1b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.20; Wed, 17 Nov 2021 16:49:57 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:49:56 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 07/30] AmpereAltraPkg: Support UEFI non-volatile variable Date: Wed, 17 Nov 2021 23:47:04 +0700 Message-ID: <20211117164727.10922-8-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:49:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 076c067a-08fd-4e8e-b2a3-08d9a9ea4940 X-MS-TrafficTypeDiagnostic: PH0PR01MB6454: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: nu2XEBR9fSB/CRSCUFlxf0oDKOt2zfRDk4nr5FLN/ObiVKT/IGVIqdyOJ73zA9RcZwVff8pTU3bWUCatkeU6pxMWMm0EwIaP+6vi++4QeFE2HDqrG0/B6PAPEsTJbZSCXq2TckPpe0LNhn7JvOXcaPmDh0WcgSm1rencga2SEXVMwsHmk5WucijhPVYHkUEFb7KWqzLZPC9JHuWKSpNZPsWChBr3TwVLb/ZXZYKMrOoZ7cjKeaHnX6tZV2I11dcSoD6xuHHDh5gOslZnz+lmuuu5LTCQ1PswI1WMyN1KH/YlhhlKLBzUC/Fc+7d5HeDzxTQ1QbYN1G8rDSarAK5FI4pBerkbY6Jr76MLrUsLaSuJeQaALx4fbVJrGulB2wBnHjuLeWQLdClE4Y7pWs018uk8ZL0n5xbfwPBChG8tsuv7NJ5o2nz5w/wnJIYUfmylyT7IDitc8QVcrSAI6lJd5cXJncX66z156yJ2T+ZxoDPnqh2K0sPPPpPcjxMjXFMITA6hk+GSzk4L10rRgoKTABOcLrjoRYC3AwniIW2OnZvxmXYXnzY+y3fCjaf3ZFDflUQEl/oVuNeQKce+NHjZ7ZQzB6C81jOLxL78J27hqgR6cYBhkoSOnjVtHL5f7yPPphNZPJu/BnMHi04fFrs50q1KrZ3elxc1U1HfQ5tATdapHVZ9dil45U6OEYowS2qQGP6ile+7YP2Xtkgpxzn8mzZH0+RcoeioQGmoJL8m1q4= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?9pWQyyElWrksTwzSqBHyk8zGMqMOXEfhA1Mm7n10pheYJigFCvMplPztPXR7?= =?us-ascii?Q?o2M1iUBHwp2zCJ326aIiYN4BN6t/I8KcxB+/e8dBG4OVtRril0MzmiIgEmC6?= =?us-ascii?Q?557VDN8A3aPlzyLVMz2afFEV5QBlBqPKARGXIwsPH/S972TIdbLkh1/yjJqq?= =?us-ascii?Q?caduaLvkoC9iX7BwqnkBG12gKaSwUeq68QqXV2GsIreuCTTxcrWwn6fj2eR1?= =?us-ascii?Q?txY7DZaiX9B5bH1zLa1t+OQsHZc+I/0HCYhXWRDJvw353A7406icZfAAWbpX?= =?us-ascii?Q?FZN0RC/jzEP77J2yQIU2xa0/PvyhMSVFoycI/C/VzCUdWuqNpvYIJl0UH6vQ?= =?us-ascii?Q?oLL+FOJd8TGEWROLbzdwBSDd2QuYU1wdAyXkXV9Nmb+/bze9hfxtDbO0jlVC?= =?us-ascii?Q?F/hju+HgZxDT7x35KAMn3tf7rFGhdmTDh7Qe6JlHTiSCiGl1zg4RuPyIcllh?= =?us-ascii?Q?5YyeUIZZ3auTOyDOy10XTjERGq8+HrIj+tUwTqOMJiuZGgIEekzkITnPemU2?= =?us-ascii?Q?6+DHyzubkhtU52YNYBup8Ct7JMY4yfWRSedgZg2dCjNCk0NYrR2yncuWiCMB?= =?us-ascii?Q?wcPLdnGzd6YMX6+vOlry3XrMdUVACiukg9wkGJyKgnCFvM247E+aaYV1vKuE?= =?us-ascii?Q?QEWHFpU+dMi+Y7iVO85tujkPRZrT7dhiYeMdYDMeC1zafvFiJmY+tAC0loAW?= =?us-ascii?Q?WOko5CvXrCagdYtVV6OOWECcSUaNZzFUDo44jxxBxxc9ihKHmYl7ncifua0I?= =?us-ascii?Q?Zw4CdlXjRjjSHdcMuq0UTrha2Cqs2LigYFTc/36B7C/hiV6NFeLJtb+wiR6Z?= =?us-ascii?Q?OpOJ3HVeG6mQ5Oom82NRBDpqbZfjaIbRhSrVvy8jdpt3OZRH67+tm4sQgBPU?= =?us-ascii?Q?EWtkVnaPyHiqpLiw/qqOQv6LGHmV9qUMtvegz/RPp3P7ZaxUeOuv2Qb0kzyR?= =?us-ascii?Q?XLjiUnWFj/3uLIUxODiostNHVgdahlesBrj8l1To7ZCuIwjZgE88X0r22H83?= =?us-ascii?Q?1uomkIt533FqijEjhr+QDUn53CzZUDDtdyFzFobvRc3OvrxhR+kdLplcEbIQ?= =?us-ascii?Q?HOoC/aag8b34pmprBjgNc895QLsoTBUUpXhvRCHq0r/8an1YwRVBEgQ6C166?= =?us-ascii?Q?Ie5B0RWQwbw3YZxnP7nVlkx2Q7DD86ZpRgqaHSbfNkl27Tv6/mTqdC9FSfkG?= =?us-ascii?Q?lMOTm6MFATJkYZkzlnL7bk8By8GeoVq4k3CKPyZ2iK5PDAkrNm5t9cSukqzn?= =?us-ascii?Q?RvLxJrPNp6qLCva1kfrJxBU9XFqkQLpcJMDjMun67gQWN4BK6C8JlzBur0/X?= =?us-ascii?Q?gnCyxhLl7x9mSHOWWA5LiL8SZ6daKFrPWLgCAmVaWTbfqkt9SOVhLy0Ow7LF?= =?us-ascii?Q?DMy9pPkRHGteYWVOoferimleczZpHGNfD/ll9uPZdoYoDusubfugVl3k4Xf8?= =?us-ascii?Q?S0DwEvdfECM6Qk7fxXaSr7q47htvkFYhv9FQcgha3jTNeVWhq3nsJpTDtqlb?= =?us-ascii?Q?EZHZhUMdGBn0hQiPJbo4HzXO97EtJNlsrSKHrNm4VF4cWLyNNinEYyqTAB6K?= =?us-ascii?Q?Lo+1vstlhJvjtSEqgChtshuBJ/xYUAeyc0S3r0jKYEcKqhSSlVmknPOfxqk2?= =?us-ascii?Q?cq+De/HHMBvQZbc7m9X0AQtnNWxPa5OH2UuE8dgNuM+L92jzW8W55/wSdb4r?= =?us-ascii?Q?jMpOSw=3D=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 076c067a-08fd-4e8e-b2a3-08d9a9ea4940 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:49:56.9001 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +qFyAMtO5lgPewOE/mgHc/LxTVaWRlwSZSPWv2OhsY0a/krZRSPvWqKR3SyPs59pt8bf8BcRzxST/g92PEAxdEipN4gQDadlBftqIr+MBRs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6454 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: qq31wloKzo5rSv3Otof8YbgAx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167799; bh=aem/a/eNLLj8uNa0d0l/ciYoagK5PAfQcgAbWmKBQFk=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=r7J+eGzQ1TYxz2/07ePh6/L/GH4XjmdNtIcg0OlElvP3okzqYw+Wh8o/z73vAlNdDWA F9XYIWMABQql4E0cTe3xCw0YOvU/vE9f37jwjNtDzkFLiW6fL3TwNvz9qknw3LholxSux cLfYLghJSRWDk0THKCZHXm7lQKutRdPhzxQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167801701100001 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen This change supports storing the UEFI non-volatile varibles on the Flash through below modules: * FlashPei driver helps to restore the saved variables from flash on each boot. * FlashFvbDxe driver provides the implementation for the gEfiFirmwareVolumeBlock protocol Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec | 5 + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc | 6 +- Platform/Ampere/JadePkg/Jade.dsc | 5 + Platform/Ampere/JadePkg/Jade.fdf | 62 ++- Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf | 54 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/FlashPei/FlashPei.inf | 49 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c | 525 ++= ++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/FlashPei/FlashPei.c | 125 ++= +++ 8 files changed, 827 insertions(+), 4 deletions(-) diff --git a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec b/Silicon= /Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec index 6ebdf7db0a57..c6827d0cad7e 100644 --- a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec +++ b/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec @@ -31,6 +31,11 @@ [Guids] [Ppis] =20 [PcdsFixedAtBuild] + # + # NVRAM + # + gAmpereTokenSpaceGuid.PcdPlatformConfigUuid|"C416535D-970B-41B9-859A-3CA= F0FAF198C"|VOID*|0x00000010 + # # SMpro PMpro Pcds # diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index 3ffad43d1696..d6adcb8d77cf 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -523,8 +523,10 @@ [Components.common] ArmPlatformPkg/PlatformPei/PlatformPeim.inf Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/FlashPei/FlashPei.inf ArmPkg/Drivers/CpuPei/CpuPei.inf UefiCpuPkg/CpuIoPei/CpuIoPei.inf + MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf MdeModulePkg/Universal/Variable/Pei/VariablePei.inf MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf { @@ -578,9 +580,9 @@ [Components.common] # # Environment Variables Protocol # + Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf + MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { - - gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeas= urementLibNull.inf diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index 7b70c5d6b5fb..0dd30dc14841 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -51,6 +51,7 @@ [Defines] DEFINE FIRMWARE_VER =3D 0.01.001 DEFINE SECURE_BOOT_ENABLE =3D FALSE DEFINE INCLUDE_TFTP_COMMAND =3D TRUE + DEFINE PLATFORM_CONFIG_UUID =3D 84BC921F-9D4A-4D1D-A1A1-1AE13EDD07E5 =20 # # Network definition @@ -83,6 +84,10 @@ [LibraryClasses] ##########################################################################= ###### [PcdsFeatureFlag.common] [PcdsFixedAtBuild.common] + # + # Platform config UUID + # + gAmpereTokenSpaceGuid.PcdPlatformConfigUuid|"$(PLATFORM_CONFIG_UUID)" =20 !if $(SECURE_BOOT_ENABLE) =3D=3D TRUE # Override the default values from SecurityPkg to ensure images diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index 459a1475ada1..de37415cd5c0 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -26,7 +26,7 @@ [FD.BL33_JADE_UEFI] ErasePolarity =3D 1 =20 # This one is tricky, it must be: BlockSize * NumBlocks =3D Size -BlockSize =3D 0x10000 +BlockSize =3D 0x10000|gAmpereTokenSpaceGuid.PcdFvBlockSize NumBlocks =3D 0x7C =20 ##########################################################################= ###### @@ -56,8 +56,61 @@ [FD.BL33_JADE_UEFI] =20 # # NV Variables -# Placeholder +# Offset: 0x00740000 +# Size: 0x00080000 # +0x00740000|0x00030000 +gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|gEfiMdeModu= lePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize +DATA =3D { + ## This is the EFI_FIRMWARE_VOLUME_HEADER + # ZeroVector [] + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + # FileSystemGuid: gEfiSystemNvDataFvGuid =3D + # { 0xFFF12B8D, 0x7696, 0x4C8B, + # { 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50 }} + 0x8D, 0x2B, 0xF1, 0xFF, 0x96, 0x76, 0x8B, 0x4C, + 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50, + # FvLength: 0x80000 + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, + # Signature "_FVH" # Attributes + 0x5f, 0x46, 0x56, 0x48, 0xff, 0xfe, 0x04, 0x00, + # HeaderLength # CheckSum # ExtHeaderOffset #Reserved #Revision + 0x48, 0x00, 0x2D, 0x09, 0x00, 0x00, 0x00, 0x02, + # Blockmap[0]: 0x2 Blocks * 0x40000 Bytes / Block + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, + # Blockmap[1]: End + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + ## This is the VARIABLE_STORE_HEADER + # It is compatible with SECURE_BOOT_ENABLE =3D=3D FALSE as well. + # Signature: gEfiAuthenticatedVariableGuid =3D + # { 0xaaf32c78, 0x947b, 0x439a, + # { 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92 }} + 0x78, 0x2c, 0xf3, 0xaa, 0x7b, 0x94, 0x9a, 0x43, + 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92, + # Size: 0x30000 (gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariabl= eSize) - + # 0x48 (size of EFI_FIRMWARE_VOLUME_HEADER) =3D 0x2FFB8 + # This can speed up the Variable Dispatch a bit. + 0xB8, 0xFF, 0x02, 0x00, + # FORMATTED: 0x5A #HEALTHY: 0xFE #Reserved: UINT16 #Reserved1: UINT32 + 0x5A, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +} + +0x00770000|0x00010000 +gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|gEfiMdeMo= dulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize +DATA =3D { + # EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER->Signature =3D gEdkiiWorkingBl= ockSignatureGuid =3D + # { 0x9e58292b, 0x7c68, 0x497d, { 0xa0, 0xce, 0x65, 0x0, 0xfd, 0x9f, 0= x1b, 0x95 }} + 0x2b, 0x29, 0x58, 0x9e, 0x68, 0x7c, 0x7d, 0x49, + 0xa0, 0xce, 0x65, 0x0, 0xfd, 0x9f, 0x1b, 0x95, + # Crc:UINT32 #WorkingBlockValid:1, WorkingBlockInvalid:1, Res= erved + 0x2c, 0xaf, 0x2c, 0x64, 0xFE, 0xFF, 0xFF, 0xFF, + # WriteQueueSize: UINT64 Size: 0x10000 - 0x20 (FTW_WORKING_HEADER) =3D 0= xFFE0 + 0xE0, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +} + +0x00780000|0x00040000 +gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|gEfiMdeModu= lePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize =20 ##########################################################################= ###### # @@ -101,9 +154,11 @@ [FV.FVMAIN_COMPACT] INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf INF Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/FlashPei/FlashPei.inf INF Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressPeim/= BootProgressPeim.inf INF ArmPkg/Drivers/CpuPei/CpuPei.inf INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf + INF MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.i= nf INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf INF MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRo= uterPei.inf INF MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf @@ -144,6 +199,7 @@ [FV.FvMain] INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandle= rRuntimeDxe.inf INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf INF ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf } =20 INF MdeModulePkg/Core/Dxe/DxeMain.inf @@ -173,6 +229,8 @@ [FV.FvMain] # Environment Variables Protocol # INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf + INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.i= nf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf =20 # # Multiple Console IO support diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.= inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf new file mode 100644 index 000000000000..008fd2315ffe --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf @@ -0,0 +1,54 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D FlashFvbDxe + FILE_GUID =3D 9E6EA240-DF80-11EA-8B6E-0800200C9A66 + MODULE_TYPE =3D DXE_RUNTIME_DRIVER + VERSION_STRING =3D 0.1 + ENTRY_POINT =3D FlashFvbDxeInitialize + +[Sources] + FlashFvbDxe.c + +[Packages] + ArmPkg/ArmPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + DebugLib + FlashLib + PcdLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiRuntimeLib + +[FixedPcd] + gAmpereTokenSpaceGuid.PcdFvBlockSize + + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 + +[Guids] + gEfiEventVirtualAddressChangeGuid + gSpiNorMmGuid + +[Protocols] + gEfiFirmwareVolumeBlockProtocolGuid ## PRODUCES + gEfiMmCommunication2ProtocolGuid ## CONSUMES + +[Depex] + gEfiMmCommunication2ProtocolGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashPei/FlashPei.inf b/= Silicon/Ampere/AmpereAltraPkg/Drivers/FlashPei/FlashPei.inf new file mode 100644 index 000000000000..2b329c5d0987 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashPei/FlashPei.inf @@ -0,0 +1,49 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D FlashPei + FILE_GUID =3D 967CFBD0-DF81-11EA-8B6E-0800200C9A66 + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D FlashPeiEntryPoint + +[Sources] + FlashPei.c + +[Packages] + ArmPkg/ArmPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + ArmSmcLib + BaseMemoryLib + DebugLib + FlashLib + MmCommunicationLib + PcdLib + PeimEntryPoint + +[FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 + + gAmpereTokenSpaceGuid.PcdPlatformConfigUuid + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.= c b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c new file mode 100644 index 000000000000..009694703ddd --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c @@ -0,0 +1,525 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include + +// +// These temporary buffers are used to calculate and convert linear virtual +// to physical address +// +STATIC UINT64 mNvFlashBase; +STATIC UINT32 mNvFlashSize; +STATIC UINT32 mFlashBlockSize; +STATIC UINT64 mNvStorageBase; +STATIC UINT64 mNvStorageSize; + +/** + Fixup internal data so that EFI can be call in virtual mode. + Call the passed in Child Notify event and convert any pointers in + lib to virtual mode. + + @param[in] Event The Event that is being processed + @param[in] Context Event Context +**/ +VOID +EFIAPI +FlashFvbAddressChangeEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EfiConvertPointer (0x0, (VOID **)&mNvStorageBase); +} + +/** + The GetAttributes() function retrieves the attributes and + current settings of the block. + + @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL inst= ance. + + @param Attributes Pointer to EFI_FVB_ATTRIBUTES_2 in which the + attributes and current settings are + returned. Type EFI_FVB_ATTRIBUTES_2 is defined + in EFI_FIRMWARE_VOLUME_HEADER. + + @retval EFI_SUCCESS The firmware volume attributes were + returned. + +**/ +EFI_STATUS +EFIAPI +FlashFvbDxeGetAttributes ( + IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This, + OUT EFI_FVB_ATTRIBUTES_2 *Attributes + ) +{ + ASSERT (Attributes !=3D NULL); + + *Attributes =3D EFI_FVB2_READ_ENABLED_CAP | // Reads may be enabled + EFI_FVB2_READ_STATUS | // Reads are currently enabl= ed + EFI_FVB2_WRITE_STATUS | // Writes are currently enab= led + EFI_FVB2_WRITE_ENABLED_CAP | // Writes may be enabled + EFI_FVB2_STICKY_WRITE | // A block erase is required= to flip bits into EFI_FVB2_ERASE_POLARITY + EFI_FVB2_MEMORY_MAPPED | // It is memory mapped + EFI_FVB2_ALIGNMENT | + EFI_FVB2_ERASE_POLARITY; // After erasure all bits ta= ke this value (i.e. '1') + + return EFI_SUCCESS; +} + +/** + The SetAttributes() function sets configurable firmware volume + attributes and returns the new settings of the firmware volume. + + @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL in= stance. + + @param Attributes On input, Attributes is a pointer to + EFI_FVB_ATTRIBUTES_2 that contains the + desired firmware volume settings. On + successful return, it contains the new + settings of the firmware volume. Type + EFI_FVB_ATTRIBUTES_2 is defined in + EFI_FIRMWARE_VOLUME_HEADER. + + @retval EFI_SUCCESS The firmware volume attributes were return= ed. + + @retval EFI_INVALID_PARAMETER The attributes requested are in + conflict with the capabilities + as declared in the firmware + volume header. + +**/ +EFI_STATUS +EFIAPI +FlashFvbDxeSetAttributes ( + IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This, + IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes + ) +{ + return EFI_SUCCESS; // ignore for now +} + +/** + The GetPhysicalAddress() function retrieves the base address of + a memory-mapped firmware volume. This function should be called + only for memory-mapped firmware volumes. + + @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instan= ce. + + @param Address Pointer to a caller-allocated + EFI_PHYSICAL_ADDRESS that, on successful + return from GetPhysicalAddress(), contains the + base address of the firmware volume. + + @retval EFI_SUCCESS The firmware volume base address was returned. + + @retval EFI_UNSUPPORTED The firmware volume is not memory mapped. + +**/ +EFI_STATUS +EFIAPI +FlashFvbDxeGetPhysicalAddress ( + IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This, + OUT EFI_PHYSICAL_ADDRESS *Address + ) +{ + ASSERT (Address !=3D NULL); + + *Address =3D (EFI_PHYSICAL_ADDRESS)mNvStorageBase; + + return EFI_SUCCESS; +} + +/** + The GetBlockSize() function retrieves the size of the requested + block. It also returns the number of additional blocks with + the identical size. The GetBlockSize() function is used to + retrieve the block map (see EFI_FIRMWARE_VOLUME_HEADER). + + + @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL = instance. + + @param Lba Indicates the block for which to return the size. + + @param BlockSize Pointer to a caller-allocated UINTN in which + the size of the block is returned. + + @param NumberOfBlocks Pointer to a caller-allocated UINTN in + which the number of consecutive blocks, + starting with Lba, is returned. All + blocks in this range have a size of + BlockSize. + + + @retval EFI_SUCCESS The firmware volume base address was ret= urned. + + @retval EFI_INVALID_PARAMETER The requested LBA is out of range. + +**/ +EFI_STATUS +EFIAPI +FlashFvbDxeGetBlockSize ( + IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This, + IN EFI_LBA Lba, + OUT UINTN *BlockSize, + OUT UINTN *NumberOfBlocks + ) +{ + UINTN TotalNvStorageBlocks; + + ASSERT (BlockSize !=3D NULL); + ASSERT (NumberOfBlocks !=3D NULL); + + TotalNvStorageBlocks =3D mNvStorageSize / mFlashBlockSize; + + if (TotalNvStorageBlocks <=3D (UINTN)Lba) { + DEBUG ((DEBUG_ERROR, "The requested LBA is out of range\n")); + return EFI_INVALID_PARAMETER; + } + + *NumberOfBlocks =3D TotalNvStorageBlocks - (UINTN)Lba; + *BlockSize =3D mFlashBlockSize; + + return EFI_SUCCESS; +} + +/** + Reads the specified number of bytes into a buffer from the specified blo= ck. + + The Read() function reads the requested number of bytes from the + requested block and stores them in the provided buffer. + Implementations should be mindful that the firmware volume + might be in the ReadDisabled state. If it is in this state, + the Read() function must return the status code + EFI_ACCESS_DENIED without modifying the contents of the + buffer. The Read() function must also prevent spanning block + boundaries. If a read is requested that would span a block + boundary, the read must read up to the boundary but not + beyond. The output parameter NumBytes must be set to correctly + indicate the number of bytes actually read. The caller must be + aware that a read may be partially completed. + + @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instan= ce. + + @param Lba The starting logical block index + from which to read. + + @param Offset Offset into the block at which to begin reading. + + @param NumBytes Pointer to a UINTN. At entry, *NumBytes + contains the total size of the buffer. At + exit, *NumBytes contains the total number of + bytes read. + + @param Buffer Pointer to a caller-allocated buffer that will + be used to hold the data that is read. + + @retval EFI_SUCCESS The firmware volume was read successfully, + and contents are in Buffer. + + @retval EFI_BAD_BUFFER_SIZE Read attempted across an LBA + boundary. On output, NumBytes + contains the total number of bytes + returned in Buffer. + + @retval EFI_ACCESS_DENIED The firmware volume is in the + ReadDisabled state. + + @retval EFI_DEVICE_ERROR The block device is not + functioning correctly and could + not be read. + +**/ +EFI_STATUS +EFIAPI +FlashFvbDxeRead ( + IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This, + IN EFI_LBA Lba, + IN UINTN Offset, + IN OUT UINTN *NumBytes, + IN OUT UINT8 *Buffer + ) +{ + EFI_STATUS Status; + + ASSERT (NumBytes !=3D NULL); + ASSERT (Buffer !=3D NULL); + + if (Offset + *NumBytes > mFlashBlockSize) { + return EFI_BAD_BUFFER_SIZE; + } + + Status =3D FlashReadCommand ( + mNvFlashBase + Lba * mFlashBlockSize + Offset, + Buffer, + *NumBytes + ); + + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Failed to do flash read\n")); + return EFI_DEVICE_ERROR; + } + + return EFI_SUCCESS; +} + +/** + Writes the specified number of bytes from the input buffer to the block. + + The Write() function writes the specified number of bytes from + the provided buffer to the specified block and offset. If the + firmware volume is sticky write, the caller must ensure that + all the bits of the specified range to write are in the + EFI_FVB_ERASE_POLARITY state before calling the Write() + function, or else the result will be unpredictable. This + unpredictability arises because, for a sticky-write firmware + volume, a write may negate a bit in the EFI_FVB_ERASE_POLARITY + state but cannot flip it back again. Before calling the + Write() function, it is recommended for the caller to first call + the EraseBlocks() function to erase the specified block to + write. A block erase cycle will transition bits from the + (NOT)EFI_FVB_ERASE_POLARITY state back to the + EFI_FVB_ERASE_POLARITY state. Implementations should be + mindful that the firmware volume might be in the WriteDisabled + state. If it is in this state, the Write() function must + return the status code EFI_ACCESS_DENIED without modifying the + contents of the firmware volume. The Write() function must + also prevent spanning block boundaries. If a write is + requested that spans a block boundary, the write must store up + to the boundary but not beyond. The output parameter NumBytes + must be set to correctly indicate the number of bytes actually + written. The caller must be aware that a write may be + partially completed. All writes, partial or otherwise, must be + fully flushed to the hardware before the Write() service + returns. + + @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instan= ce. + + @param Lba The starting logical block index to write to. + + @param Offset Offset into the block at which to begin writing. + + @param NumBytes The pointer to a UINTN. At entry, *NumBytes + contains the total size of the buffer. At + exit, *NumBytes contains the total number of + bytes actually written. + + @param Buffer The pointer to a caller-allocated buffer that + contains the source for the write. + + @retval EFI_SUCCESS The firmware volume was written successfully. + + @retval EFI_BAD_BUFFER_SIZE The write was attempted across an + LBA boundary. On output, NumBytes + contains the total number of bytes + actually written. + + @retval EFI_ACCESS_DENIED The firmware volume is in the + WriteDisabled state. + + @retval EFI_DEVICE_ERROR The block device is malfunctioning + and could not be written. + +**/ +EFI_STATUS +EFIAPI +FlashFvbDxeWrite ( + IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This, + IN EFI_LBA Lba, + IN UINTN Offset, + IN OUT UINTN *NumBytes, + IN UINT8 *Buffer + ) +{ + EFI_STATUS Status; + + ASSERT (NumBytes !=3D NULL); + ASSERT (Buffer !=3D NULL); + + if (Offset + *NumBytes > mFlashBlockSize) { + return EFI_BAD_BUFFER_SIZE; + } + + Status =3D FlashWriteCommand ( + mNvFlashBase + Lba * mFlashBlockSize + Offset, + Buffer, + *NumBytes + ); + + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Failed to do flash write\n")); + return EFI_DEVICE_ERROR; + } + + return Status; +} + +/** + Erases and initializes a firmware volume block. + + The EraseBlocks() function erases one or more blocks as denoted + by the variable argument list. The entire parameter list of + blocks must be verified before erasing any blocks. If a block is + requested that does not exist within the associated firmware + volume (it has a larger index than the last block of the + firmware volume), the EraseBlocks() function must return the + status code EFI_INVALID_PARAMETER without modifying the contents + of the firmware volume. Implementations should be mindful that + the firmware volume might be in the WriteDisabled state. If it + is in this state, the EraseBlocks() function must return the + status code EFI_ACCESS_DENIED without modifying the contents of + the firmware volume. All calls to EraseBlocks() must be fully + flushed to the hardware before the EraseBlocks() service + returns. + + @param This Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL + instance. + + @param ... The variable argument list is a list of tuples. + Each tuple describes a range of LBAs to erase + and consists of the following: + - An EFI_LBA that indicates the starting LBA + - A UINTN that indicates the number of blocks to + erase. + + The list is terminated with an + EFI_LBA_LIST_TERMINATOR. For example, the + following indicates that two ranges of blocks + (5-7 and 10-11) are to be erased: EraseBlocks + (This, 5, 3, 10, 2, EFI_LBA_LIST_TERMINATOR); + + @retval EFI_SUCCESS The erase request successfully + completed. + + @retval EFI_ACCESS_DENIED The firmware volume is in the + WriteDisabled state. + @retval EFI_DEVICE_ERROR The block device is not functioning + correctly and could not be written. + The firmware device may have been + partially erased. + @retval EFI_INVALID_PARAMETER One or more of the LBAs listed + in the variable argument list do + not exist in the firmware volume. + +**/ +EFI_STATUS +EFIAPI +FlashFvbDxeErase ( + IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This, + ... + ) +{ + VA_LIST Args; + EFI_LBA Start; + UINTN Length; + EFI_STATUS Status; + + Status =3D EFI_SUCCESS; + + VA_START (Args, This); + + for (Start =3D VA_ARG (Args, EFI_LBA); + Start !=3D EFI_LBA_LIST_TERMINATOR; + Start =3D VA_ARG (Args, EFI_LBA)) + { + Length =3D VA_ARG (Args, UINTN); + Status =3D FlashEraseCommand ( + mNvFlashBase + Start * mFlashBlockSize, + Length * mFlashBlockSize + ); + } + + VA_END (Args); + + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Failed to do flash erase\n")); + return EFI_DEVICE_ERROR; + } + + return EFI_SUCCESS; +} + +EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL mFlashFvbProtocol =3D { + FlashFvbDxeGetAttributes, + FlashFvbDxeSetAttributes, + FlashFvbDxeGetPhysicalAddress, + FlashFvbDxeGetBlockSize, + FlashFvbDxeRead, + FlashFvbDxeWrite, + FlashFvbDxeErase +}; + +EFI_STATUS +EFIAPI +FlashFvbDxeInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_HANDLE FvbHandle =3D NULL; + EFI_EVENT VirtualAddressChangeEvent; + + // Get NV store FV info + mFlashBlockSize =3D FixedPcdGet32 (PcdFvBlockSize); + mNvStorageBase =3D PcdGet64 (PcdFlashNvStorageVariableBase64); + mNvStorageSize =3D FixedPcdGet32 (PcdFlashNvStorageVariableSize) + + FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) + + FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize); + + DEBUG (( + DEBUG_INFO, + "%a: Using NV store FV in-memory copy at 0x%lx with size 0x%x\n", + __FUNCTION__, + mNvStorageBase, + mNvStorageSize + )); + + // Get NV Flash information + Status =3D FlashGetNvRamInfo (&mNvFlashBase, &mNvFlashSize); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to get Flash info\n", __FUNCTION__)); + return EFI_DEVICE_ERROR; + } + + if (mNvFlashSize >=3D (mNvStorageSize * 2)) { + DEBUG ((DEBUG_INFO, "%a: NV store on Flash is valid\n", __FUNCTION__)); + } else { + DEBUG ((DEBUG_ERROR, "%a: NV store on Flash is invalid\n", __FUNCTION_= _)); + return EFI_DEVICE_ERROR; + } + + Status =3D gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + FlashFvbAddressChangeEvent, + NULL, + &gEfiEventVirtualAddressChangeGuid, + &VirtualAddressChangeEvent + ); + ASSERT_EFI_ERROR (Status); + + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &FvbHandle, + &gEfiFirmwareVolumeBlockProtocolGuid, + &mFlashFvbProtocol, + NULL + ); + + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Failed to install Firmware Volume Block protocol= \n")); + return Status; + } + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashPei/FlashPei.c b/Si= licon/Ampere/AmpereAltraPkg/Drivers/FlashPei/FlashPei.c new file mode 100644 index 000000000000..3da7df3907dc --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashPei/FlashPei.c @@ -0,0 +1,125 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include + +#include +#include +#include +#include +#include +#include + +/** + Entry point function for the PEIM + + @param FileHandle Handle of the file being invoked. + @param PeiServices Describes the list of possible PEI Services. + + @return EFI_SUCCESS If we installed our PPI + +**/ +EFI_STATUS +EFIAPI +FlashPeiEntryPoint ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + CHAR8 BuildUuid[PcdGetSize (PcdPlatformConfigUuid)]; + CHAR8 StoredUuid[PcdGetSize (PcdPlatformConfigUuid)]; + EFI_STATUS Status; + UINTN FWNvRamStartOffset; + UINT32 FWNvRamSize; + UINTN NvRamAddress; + UINT32 NvRamSize; + + CopyMem ((VOID *)BuildUuid, PcdGetPtr (PcdPlatformConfigUuid), sizeof (B= uildUuid)); + + NvRamAddress =3D PcdGet64 (PcdFlashNvStorageVariableBase64); + NvRamSize =3D FixedPcdGet32 (PcdFlashNvStorageVariableSize) + + FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) + + FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize); + + DEBUG (( + DEBUG_INFO, + "%a: Using NV store FV in-memory copy at 0x%lx with size 0x%x\n", + __FUNCTION__, + NvRamAddress, + NvRamSize + )); + + Status =3D FlashGetNvRamInfo (&FWNvRamStartOffset, &FWNvRamSize); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to get Flash NVRAM info %r\n", __FUNC= TION__, Status)); + return Status; + } + + if (FWNvRamSize < (NvRamSize * 2 + sizeof (BuildUuid))) { + // + // NVRAM size provided by FW is not enough + // + return EFI_INVALID_PARAMETER; + } + + // + // We stored BUILD UUID build at the offset NVRAM_SIZE * 2 + // + Status =3D FlashReadCommand ( + FWNvRamStartOffset + NvRamSize * 2, + (UINT8 *)StoredUuid, + sizeof (StoredUuid) + ); + if (EFI_ERROR (Status)) { + return Status; + } + + if (CompareMem ((VOID *)StoredUuid, (VOID *)BuildUuid, sizeof (BuildUuid= )) !=3D 0) { + DEBUG ((DEBUG_INFO, "BUILD UUID Changed, Update Storage with NVRAM FV\= n")); + + Status =3D FlashEraseCommand (FWNvRamStartOffset, NvRamSize * 2 + size= of (BuildUuid)); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D FlashWriteCommand ( + FWNvRamStartOffset, + (UINT8 *)NvRamAddress, + NvRamSize + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Write new BUILD UUID to the Flash + // + Status =3D FlashWriteCommand ( + FWNvRamStartOffset + NvRamSize * 2, + (UINT8 *)BuildUuid, + sizeof (BuildUuid) + ); + if (EFI_ERROR (Status)) { + return Status; + } + } else { + DEBUG ((DEBUG_INFO, "Identical UUID, copy stored NVRAM to RAM\n")); + + Status =3D FlashReadCommand ( + FWNvRamStartOffset, + (UINT8 *)NvRamAddress, + NvRamSize + ); + if (EFI_ERROR (Status)) { + return Status; + } + } + + return EFI_SUCCESS; +} --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83820): https://edk2.groups.io/g/devel/message/83820 Mute This Topic: https://groups.io/mt/87123865/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83821+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83821+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167803535874.2760562654836; Wed, 17 Nov 2021 08:50:03 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id bEA2YY1788612xV7hfW44csS; Wed, 17 Nov 2021 08:50:03 -0800 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.122]) by mx.groups.io with SMTP id smtpd.web11.9779.1637167801905294624 for ; Wed, 17 Nov 2021 08:50:02 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UcGFqHPUS2FGG3YeXSuhcpOOBKAR7OjPtPQr/swG/IF6s5V4nl32LDuxCgaVtESk9pLq9yZk35geohV6l8mn2xyuDMuuPjyGJG5KKaJMrgdxDRmRua6Z13zCS9ycE+B1473ZI4lNQK2ImhSgUao7j6QAi9sst4LW8YXXraHtb4DJ5vKU+RNkKxyYLy3vlkfVDfS8Wp8i+vIZyw7QJa49mu73IULGyvLWs9i5VeO5kq79A5B8NLUw1Eietxu71c/Jv+KuQXaTUeC21+YbYHb09EKm8unOnYw6880XgWlpP6g4255Qtk0A80VckKw8mTEnGTCQhLytMZrV72fSbdbhFQ== 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=PnJwvQ2lzqEasQ3ZR96qPF4OwnncmVlrbMEnlB3R+Tc=; b=VNZJH6Iytpo5MZ9PT14fAqbHYsATjsmwZgYr4J9g/GuUpYDuOyiJb9clIPo347/HhUO38V2Ll49Lb/BeV0MmYoA0ho6bLJMoLoRgbydwPrd5kLPyViZmMdwnGFppgWs8PRez5pj9UosCRd5Me90DviuSpy11nlL9bvUgJgv4gWtCGLEPkKaCrbGcmjsPCW3wKXwEln2IxJ4ppEBChd5aoMTeqZi0V+FNwessJLVyWk9046o7INHclwuiktViPiyvyAc30BKWY+U26+0FrZjNjLlEropAreX4SNCtzS6ashCFW64cXJwvD1hV18TpsoWZXu8Oe2tEzQ9aXUNWV3W9lQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB6454.prod.exchangelabs.com (2603:10b6:510:1b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.20; Wed, 17 Nov 2021 16:50:00 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:00 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 08/30] AmpereSiliconPkg: Add PlatformManagerUiLib library instance Date: Wed, 17 Nov 2021 23:47:05 +0700 Message-ID: <20211117164727.10922-9-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:49:57 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c0380cc7-2a44-4238-e790-08d9a9ea4b33 X-MS-TrafficTypeDiagnostic: PH0PR01MB6454: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:67; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: TPu4lBfdcrOuRo30lGZHaQbjaq11TfroJbBlJHEiQv5ds69iRBRnYFtILUjQlRq6yx9ymSSGyLuH9cVq83xtYhJSDAQJLf7a5pyMuX+y742dWy+PN2f5JkWwUMMpTVjxOcp5gaOiLyHSTz7+yV78hpeoB4oUsZbeCw/6DIjKZHg+/XT4DOQvJlxgo86W2jCky+4sXsuqCzSSZVKCZ7DH4Ps+wQrAoydvqd7yRCy18Qt9lEBLwaK+PPt1Ynu8DMsb+YXyeQ3Q5m5CutCp/FpGmhCI7QXepig/ew+c/M5vgW1BRve2aP4CMCWVGFreleXIzYfw3cTUxbuwKBktcC6jBwUdDg1o1DvNMzdHpg7CqqfHs8DdYWe2sxTyrJ0M6JKeusPdfmSQLQvMYidHHjjJB1HwFXxWhJQRcZb7ZnceUgPeB5jVMxaTXCS4JGbukSEwTgXkh2LoV6CXF92fUfPe4v1y+mmW4rm+DRb52Pk1ktT+2C9q0vQtko+K6PfHZGFHM4YcbTGYIgJStD5mDFIMqDitwMfRh+vdFV0nN31tcUpqunWsFLURVDAnEYrGNINR4H9JYJYPN+IjKMh5LURUenKi+D5tuE6WJIhqdepxx6BoeiTnb8TtAVlMDb7hs3G1TQW10T35bZhgbG9PyRV+wYkbcAPIwCZtEhjn2vx17E/IfruPrO3HvoNBrMe7cTSR9o3UblJ7TcbohI7PWh+A3qS8JpJM4d+NzfmEJdgYM1Uvlsj5+NY2I1Fd1NpoC8Bj X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?FE5qOJzMTQ+0R0PohTZC+dryOPwxgPqX/GnSjALsBKRGHbgOk7qWqbxiGgl3?= =?us-ascii?Q?9Y0lTRc24Y4r3vFbtoLAVwpmWuLSsx0GX8p1dhUjsWq9APb5MwsboDUzQ84w?= =?us-ascii?Q?O5/BLDCn/LUS6oPfEQEET8N/QhRCYTvtOkoLiBtKt+t0nj7cFDCUlovV6udZ?= =?us-ascii?Q?5irMouqOvVTYuVq5WMFJ/Hzie9qdfLg2oG6rquwS87HBy3/00efNkqI5tYw9?= =?us-ascii?Q?gumcKQrjSxXJJwMpwejjNtQsLopEgV36P5zbkz9ZJ9fJeHiPrpr0qP/Ztaxb?= =?us-ascii?Q?G1bIaC4FUV73A3bH0XQpvd86RWEgqnOnJ0Ro8JohkYVbG7QOM5YcTQBFgMEw?= =?us-ascii?Q?JNpeNCHpEpP5d48sRyW2PW5KXXfStnqG6BF50AnWPFAqhx/3Hg7ueOAMdTmZ?= =?us-ascii?Q?wW8RYquKPrZIIngAojnury8WfDEeuzKZqiFzZJYJRHsxBiU/hRIXpST881rJ?= =?us-ascii?Q?U8v3ZrCTc+FCcP0OAcKMZc0fin3PYRAP6WuI4myJPp6ZNgNj/78WdsErlC8h?= =?us-ascii?Q?px6yUfXNaF1xDU1nQmBCcuEwSbkweUG9Wb9VHwEi7EviFqnmdNMudGJBku4W?= =?us-ascii?Q?PktNhDkrMse7hJzXc+TFs1PBN/weLsAcDOzDtOFq4/O8Usmu2QO/BmIXPIQ7?= =?us-ascii?Q?9YeHkeJvvHRegMJ5sPL/io9TqjQ67/UQjcJThoB1BHWKAFmXzNjn7sZ9IgYl?= =?us-ascii?Q?pcMXlQBIvYes/f4QeHq9zZk1pLYQTBqMXYSfzsSDDR5chrUdqnDf9FCOKidB?= =?us-ascii?Q?upDhFwBdhx+2e+2PgBPZQZJFhXrxpfkBTfvvS/ttdRrWTOxOs6bP8SmBVoSy?= =?us-ascii?Q?T5lRnTyBV0dPFsA9QzaHAoJKXs2xubmk3TcPR22v/KfT+bmxgT0KXL0NaWZU?= =?us-ascii?Q?jZ/jtW/wOPtDKKCzAon26KMSEOiQea75aF0+Yc2X+ainkGV+Sd20uaejdXHy?= =?us-ascii?Q?IYEquzsDHWgzEo3zEaAzN3FiyzAbkcCEGdPdo3mCXoUNZKteaeoJULJzQtfJ?= =?us-ascii?Q?3VHDfZestm0iZRu6suiaP8FhggINjeWdG+5lW7jWzlIp1bYOkOBmzMXHQ1Nq?= =?us-ascii?Q?Vp4FylBo70DB93Wtn2UrrF+r+ecygPz+KPyrJci8VABZ1bUfpHAIgW9Caflm?= =?us-ascii?Q?XtFwl6482jW6pVA4MbtiDSgQUL2Inb9QuN3drYp/R5TfddYIH6SGuoVt857H?= =?us-ascii?Q?r+OXqWebIFLUUpI4x3iYolBWqqYDKVLiBOOrTBOQJNKXcc65bgi1Z+dC2t1c?= =?us-ascii?Q?S2068PVrftw41KLV+miCRbMq6jtgdk3Giz8kHkypcwCABgajl6O9v5F50VNR?= =?us-ascii?Q?7SbJU/XUVsIgIcKIqdyG6MSxzNbxnCNj49rLuYtOCBmxnQyeYN803ZrFJNlk?= =?us-ascii?Q?A6heKvCjhMfTAE7VL+Dpv6lS4n/KJyimdP/G+Br594P4ZKaMAb2HhAw5wTWT?= =?us-ascii?Q?aiOBJZ08kEYBYYj5qtUAQzo6ptCmBVoRcFSr45phd03VWJJHM12lWUdEPPaU?= =?us-ascii?Q?+VNZkVD6+N5Nr4a+eKKCJhnvU4fapGYNJN3pE5QYaCm3kQVkoyX9D6ZiQcie?= =?us-ascii?Q?pBAAJRWRYNYqd6lfkeZONLIjqYrP3wNYVyCSOmoet04vG4Nm1d8nQZwAkSF3?= =?us-ascii?Q?Bug74/vAQffzVd3jj5iGst9ITM5wmVpjC0oq6Mea5fL8yitwIYT1scF1wS8O?= =?us-ascii?Q?yAgdSGgjRUjyd4UZbHvQiz86mY0=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0380cc7-2a44-4238-e790-08d9a9ea4b33 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:00.2204 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bmGtK4bQwzJQQxcqTIaHuhPnlhagGPgHFirFFD5EoDaUpeD/n+dYnMBd9AUO2hs4kJ2BsI53dzqwBkuj4dSMMGnNeDs7z/AwLMZkESM65G4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6454 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: FsAmBfqEiXGMJHRLF5gBJNXcx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167803; bh=2QrETuAhmoohvp1wOSqA+hHJF2YMMJ23BWSN+DGoKiE=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=Wnup9WKFkp6PA1H0qZmefQAbZSgifrjm2j7LU5/n78PcvL80j9gZzbKYL/H1NGIzcOL UmBDN8kGtTgOb8BaFpvG0BmTGYWfhhDS88Etk6RBXlEXIWlB/xeHvfNYZ4gPrNojNyCQ9 0EVSbP208r2CIyyzJ5Gy28jP+cOkG5D6dZ8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167804137100001 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen The idea came from DeviceManagerUiLib that all related menu settings can be placed under a common entry. This change intends to provide a central point for all platform menus by creating a Platform Manager entry located under Device Manager entry of UiApp. New classuuid called gPlatformManagerFormsetGuid was introduced for platform menus which want to be reached through this Platform Manager. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec = | 19 ++ Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc = | 1 + Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerUiLib= .inf | 47 +++ Silicon/Ampere/AmpereSiliconPkg/Include/Guid/PlatformManagerHii.h = | 31 ++ Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManager.h = | 51 +++ Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerVfr.h= | 28 ++ Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManager.c = | 354 ++++++++++++++++++++ Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerStrin= gs.uni | 21 ++ Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerUiLib= .uni | 13 + Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManagerVfr.V= fr | 29 ++ 10 files changed, 594 insertions(+) diff --git a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec b/Silicon= /Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec index c6827d0cad7e..f8b06ef81de5 100644 --- a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec +++ b/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec @@ -22,12 +22,31 @@ [Defines] # ##########################################################################= ###### [Includes.common] + Include # Root include for the package =20 [LibraryClasses] =20 [Guids] gAmpereTokenSpaceGuid =3D { 0xdbd4436e, 0x89cb, 0x44dc, { 0xb5, 0xc0, 0x= 49, 0xc3, 0x91, 0x35, 0xbf, 0xdf } } =20 + # + # Platform Manager formset UUID + # + ## Include/Guid/PlatformManagerHii.h + gPlatformManagerFormsetGuid =3D { 0x83ABD546, 0x7AD9, 0x4DE7, { 0xBD, 0= x52, 0x12, 0x23, 0xF6, 0xE8, 0xFD, 0x4B } } + + # + # Platform Manager entry UUID + # + ## Include/Guid/PlatformManagerHii.h + gPlatformManagerEntryEventGuid =3D { 0x28A4731E, 0x14A9, 0x488A, { 0xA8,= 0x19, 0xFF, 0x27, 0x80, 0x6E, 0xDB, 0x0E } } + + # + # Platform Manager exit UUID + # + ## Include/Guid/PlatformManagerHii.h + gPlatformManagerExitEventGuid =3D { 0xE8887242, 0x4EFF, 0x4323, { 0x81,= 0xF4, 0xC9, 0x5F, 0xD5, 0x8D, 0x80, 0xD5 } } + [Ppis] =20 [PcdsFixedAtBuild] diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index d6adcb8d77cf..99e00f82aac8 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -648,6 +648,7 @@ [Components.common] MdeModulePkg/Universal/BdsDxe/BdsDxe.inf MdeModulePkg/Application/UiApp/UiApp.inf { + NULL|Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformM= anagerUiLib.inf NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc= eManagerUiLib.inf diff --git a/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/Platform= ManagerUiLib.inf b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/Pl= atformManagerUiLib.inf new file mode 100644 index 000000000000..1cc5788bcebb --- /dev/null +++ b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManager= UiLib.inf @@ -0,0 +1,47 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D PlatformManagerUiLib + MODULE_UNI_FILE =3D PlatformManagerUiLib.uni + FILE_GUID =3D 9264993E-2E15-478A-8928-14573E34C606 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D NULL|DXE_DRIVER UEFI_APPLICATION + CONSTRUCTOR =3D PlatformManagerUiLibConstructor + DESTRUCTOR =3D PlatformManagerUiLibDestructor + +[Sources] + PlatformManager.h + PlatformManagerVfr.Vfr + PlatformManagerStrings.uni + PlatformManager.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + DevicePathLib + BaseLib + MemoryAllocationLib + UefiBootServicesTableLib + BaseMemoryLib + DebugLib + HiiLib + UefiLib + UefiHiiServicesLib + +[Guids] + gPlatformManagerFormsetGuid ## CONSUMES ## GUID (Indic= ate the formset class guid to be displayed) + gEfiIfrTianoGuid ## CONSUMES ## GUID (Exten= ded IFR Guid Opcode) + gEfiIfrFrontPageGuid ## CONSUMES ## GUID (Indic= ate the formset in this library need to display in which page) + gPlatformManagerEntryEventGuid ## CONSUMES ## GUID (Indic= ate enter PlatformManager) + gPlatformManagerExitEventGuid ## CONSUMES ## GUID (Indic= ate exit PlatformManager) diff --git a/Silicon/Ampere/AmpereSiliconPkg/Include/Guid/PlatformManagerHi= i.h b/Silicon/Ampere/AmpereSiliconPkg/Include/Guid/PlatformManagerHii.h new file mode 100644 index 000000000000..ee3ca13ddeb1 --- /dev/null +++ b/Silicon/Ampere/AmpereSiliconPkg/Include/Guid/PlatformManagerHii.h @@ -0,0 +1,31 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef PLATFORM_MANAGER_HII_GUID_H_ +#define PLATFORM_MANAGER_HII_GUID_H_ + +#define PLATFORM_MANAGER_FORMSET_GUID \ + { \ + 0x83ABD546, 0x7AD9, 0x4DE7, { 0xBD, 0x52, 0x12, 0x23, 0xF6, 0xE8, 0xFD, = 0x4B } \ + } + +#define PLATFORM_MANAGER_ENTRY_EVENT_GUID \ + { \ + 0x28A4731E, 0x14A9, 0x488A, { 0xA8, 0x19, 0xFF, 0x27, 0x80, 0x6E, 0xDB, = 0x0E } \ + } + +#define PLATFORM_MANAGER_EXIT_EVENT_GUID \ + { \ + 0xE8887242, 0x4EFF, 0x4323, { 0x81, 0xF4, 0xC9, 0x5F, 0xD5, 0x8D, 0x80, = 0xD5 } \ + } + +extern EFI_GUID gPlatformManagerFormsetGuid; +extern EFI_GUID gPlatformManagerEntryEventGuid; +extern EFI_GUID gPlatformManagerExitEventGuid; + +#endif diff --git a/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/Platform= Manager.h b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformM= anager.h new file mode 100644 index 000000000000..49157e0cea47 --- /dev/null +++ b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManager= .h @@ -0,0 +1,51 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef PLATFORM_MANAGER_H_ +#define PLATFORM_MANAGER_H_ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "PlatformManagerVfr.h" + +// +// These are the VFR compiler generated data representing our VFR data. +// +extern UINT8 PlatformManagerVfrBin[]; +extern UINT8 PlatformManagerUiLibStrings[]; + +/// +/// HII specific Vendor Device Path definition. +/// +typedef struct { + VENDOR_DEVICE_PATH VendorDevicePath; + EFI_DEVICE_PATH_PROTOCOL End; +} HII_VENDOR_DEVICE_PATH; + +typedef struct { + /// + /// Platform Manager HII relative handles + /// + EFI_HII_HANDLE HiiHandle; + EFI_HANDLE DriverHandle; + +} PLATFORM_MANAGER_CALLBACK_DATA; + +#endif diff --git a/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/Platform= ManagerVfr.h b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/Platfo= rmManagerVfr.h new file mode 100644 index 000000000000..205907d3777a --- /dev/null +++ b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManager= Vfr.h @@ -0,0 +1,28 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef PLATFORM_MANAGER_VFR_H_ +#define PLATFORM_MANAGER_VFR_H_ + +#define FORMSET_GUID \ + { \ + 0x6E7233C5, 0x2B79, 0x4383, { 0x81, 0x46, 0xD8, 0x6A, 0x9F, 0x0A, 0x0B, = 0x99 } \ + } + +// +// These are defined as the same with vfr file +// +#define LABEL_FORM_ID_OFFSET 0x0100 +#define ENTRY_KEY_OFFSET 0x4000 + +#define PLATFORM_MANAGER_FORM_ID 0x1000 + +#define LABEL_ENTRY_LIST 0x1100 +#define LABEL_END 0xffff + +#endif /* PLATFORM_MANAGER_VFR_H_ */ diff --git a/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/Platform= Manager.c b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformM= anager.c new file mode 100644 index 000000000000..1872aa80ed18 --- /dev/null +++ b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManager= .c @@ -0,0 +1,354 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "PlatformManager.h" + +PLATFORM_MANAGER_CALLBACK_DATA gPlatformManagerPrivate =3D { + NULL, + NULL +}; + +EFI_GUID mPlatformManagerGuid =3D FORMSET_GUID; + +HII_VENDOR_DEVICE_PATH mPlatformManagerHiiVendorDevicePath =3D { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8)(sizeof (VENDOR_DEVICE_PATH)), + (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + // + // {FC587265-0750-44D1-B68D-D1DDD3F29B0B} + // + { 0xFC587265, 0x0750, 0x44D1, {0xB6, 0x8D, 0xD1, 0xDD, 0xD3, 0xF2, 0x9= B, 0x0B} } + }, + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { + (UINT8)(END_DEVICE_PATH_LENGTH), + (UINT8)((END_DEVICE_PATH_LENGTH) >> 8) + } + } +}; + +/** + Extract device path for given HII handle and class guid. + + @param Handle The HII handle. + + @retval NULL Fail to get the device path string. + @return PathString Get the device path string. + +**/ +CHAR16 * +PmExtractDevicePathFromHiiHandle ( + IN EFI_HII_HANDLE Handle + ) +{ + EFI_STATUS Status; + EFI_HANDLE DriverHandle; + + ASSERT (Handle !=3D NULL); + + if (Handle =3D=3D NULL) { + return NULL; + } + + Status =3D gHiiDatabase->GetPackageListHandle (gHiiDatabase, Handle, &Dr= iverHandle); + if (EFI_ERROR (Status)) { + return NULL; + } + // + // Get device path string. + // + return ConvertDevicePathToText (DevicePathFromHandle (DriverHandle), FAL= SE, FALSE); +} + +/** + Dynamic create Hii information for Platform Manager. + + @param NextShowFormId The FormId which need to be show. + +**/ +VOID +CreatePlatformManagerForm ( + IN EFI_FORM_ID NextShowFormId + ) +{ + UINTN Index; + EFI_STRING String; + EFI_STRING_ID Token; + EFI_STRING_ID TokenHelp; + EFI_HII_HANDLE *HiiHandles; + EFI_HII_HANDLE HiiHandle; + EFI_GUID FormSetGuid; + VOID *StartOpCodeHandle; + VOID *EndOpCodeHandle; + EFI_IFR_GUID_LABEL *StartLabel; + EFI_IFR_GUID_LABEL *EndLabel; + CHAR16 *DevicePathStr; + EFI_STRING_ID DevicePathId; + EFI_IFR_FORM_SET *Buffer; + UINTN BufferSize; + UINT8 ClassGuidNum; + EFI_GUID *ClassGuid; + UINTN TempSize; + UINT8 *Ptr; + EFI_STATUS Status; + + TempSize =3D 0; + BufferSize =3D 0; + Buffer =3D NULL; + + HiiHandle =3D gPlatformManagerPrivate.HiiHandle; + + // + // Allocate space for creation of UpdateData Buffer + // + StartOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (StartOpCodeHandle !=3D NULL); + + EndOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (EndOpCodeHandle !=3D NULL); + + // + // Create Hii Extend Label OpCode as the start opcode + // + StartLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode ( + StartOpCodeHandle, + &gEfiIfrTianoGuid, + NULL, + sizeof (EFI_IFR_GUID_LABEL) + ); + ASSERT (StartLabel !=3D NULL); + StartLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + // + // According to the next show Form id(mNextShowFormId) to decide which f= orm need to update. + // + StartLabel->Number =3D (UINT16)(LABEL_FORM_ID_OFFSET + NextShowFor= mId); + + // + // Create Hii Extend Label OpCode as the end opcode + // + EndLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode ( + EndOpCodeHandle, + &gEfiIfrTianoGuid, + NULL, + sizeof (EFI_IFR_GUID_LABEL) + ); + ASSERT (EndLabel !=3D NULL); + EndLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + EndLabel->Number =3D LABEL_END; + + // + // Get all the Hii handles + // + HiiHandles =3D HiiGetHiiHandles (NULL); + ASSERT (HiiHandles !=3D NULL); + + // + // Search for formset of each class type + // + for (Index =3D 0; HiiHandles[Index] !=3D NULL; Index++) { + Status =3D HiiGetFormSetFromHiiHandle (HiiHandles[Index], &Buffer,&Buf= ferSize); + if (EFI_ERROR (Status)) { + continue; + } + + Ptr =3D (UINT8 *)Buffer; + + while(TempSize < BufferSize) { + TempSize +=3D ((EFI_IFR_OP_HEADER *)Ptr)->Length; + if (((EFI_IFR_OP_HEADER *)Ptr)->Length <=3D OFFSET_OF (EFI_IFR_FORM_= SET, Flags)) { + Ptr +=3D ((EFI_IFR_OP_HEADER *)Ptr)->Length; + continue; + } + + ClassGuidNum =3D (UINT8)(((EFI_IFR_FORM_SET *)Ptr)->Flags & 0x3); + ClassGuid =3D (EFI_GUID *)(VOID *)(Ptr + sizeof (EFI_IFR_FORM_SET)); + while (ClassGuidNum-- > 0) { + if (CompareGuid (&gPlatformManagerFormsetGuid, ClassGuid)=3D=3D 0)= { + ClassGuid++; + continue; + } + + String =3D HiiGetString (HiiHandles[Index], ((EFI_IFR_FORM_SET *)P= tr)->FormSetTitle, NULL); + if (String =3D=3D NULL) { + String =3D HiiGetString (HiiHandle, STRING_TOKEN (STR_MISSING_ST= RING), NULL); + ASSERT (String !=3D NULL); + } + Token =3D HiiSetString (HiiHandle, 0, String, NULL); + FreePool (String); + + String =3D HiiGetString (HiiHandles[Index], ((EFI_IFR_FORM_SET *)P= tr)->Help, NULL); + if (String =3D=3D NULL) { + String =3D HiiGetString (HiiHandle, STRING_TOKEN (STR_MISSING_ST= RING), NULL); + ASSERT (String !=3D NULL); + } + TokenHelp =3D HiiSetString (HiiHandle, 0, String, NULL); + FreePool (String); + + CopyMem (&FormSetGuid, &((EFI_IFR_FORM_SET *)Ptr)->Guid, sizeof (E= FI_GUID)); + + if (NextShowFormId =3D=3D PLATFORM_MANAGER_FORM_ID) { + DevicePathStr =3D PmExtractDevicePathFromHiiHandle (HiiHandles[I= ndex]); + DevicePathId =3D 0; + if (DevicePathStr !=3D NULL) { + DevicePathId =3D HiiSetString (HiiHandle, 0, DevicePathStr, N= ULL); + FreePool (DevicePathStr); + } + + HiiCreateGotoExOpCode ( + StartOpCodeHandle, + 0, + Token, + TokenHelp, + 0, + (EFI_QUESTION_ID)(Index + ENTRY_KEY_OFFSET), + 0, + &FormSetGuid, + DevicePathId + ); + } + break; + } + + Ptr +=3D ((EFI_IFR_OP_HEADER *)Ptr)->Length; + } + + FreePool (Buffer); + Buffer =3D NULL; + TempSize =3D 0; + BufferSize =3D 0; + } + + HiiUpdateForm ( + HiiHandle, + &mPlatformManagerGuid, + NextShowFormId, + StartOpCodeHandle, + EndOpCodeHandle + ); + + HiiFreeOpCodeHandle (StartOpCodeHandle); + HiiFreeOpCodeHandle (EndOpCodeHandle); + FreePool (HiiHandles); +} + +/** + Install Boot Manager Menu driver. + + @param ImageHandle The image handle. + @param SystemTable The system table. + + @retval EFI_SUCEESS Install Boot manager menu success. + @retval Other Return error status. + +**/ +EFI_STATUS +EFIAPI +PlatformManagerUiLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_EVENT PlatformUiEntryEvent; + + gPlatformManagerPrivate.DriverHandle =3D NULL; + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &gPlatformManagerPrivate.DriverHandle, + &gEfiDevicePathProtocolGuid, + &mPlatformManagerHiiVendorDevicePath, + NULL + ); + ASSERT_EFI_ERROR (Status); + + // + // Publish our HII data. + // + gPlatformManagerPrivate.HiiHandle =3D HiiAddPackages ( + &mPlatformManagerGuid, + gPlatformManagerPrivate.DriverHand= le, + PlatformManagerVfrBin, + PlatformManagerUiLibStrings, + NULL + ); + if (gPlatformManagerPrivate.HiiHandle !=3D NULL) { + // + // Update platform manager page + // + CreatePlatformManagerForm (PLATFORM_MANAGER_FORM_ID); + } else { + DEBUG ((DEBUG_ERROR, "%a: Failed to add Hii package\n", __FUNCTION__)); + return EFI_INVALID_PARAMETER; + } + + // Signal Entry event + Status =3D gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_CALLBACK, + EfiEventEmptyFunction, + NULL, + &gPlatformManagerEntryEventGuid, + &PlatformUiEntryEvent + ); + ASSERT_EFI_ERROR (Status); + gBS->SignalEvent (PlatformUiEntryEvent); + gBS->CloseEvent (PlatformUiEntryEvent); + + return EFI_SUCCESS; +} + +/** + Unloads the application and its installed protocol. + + @param ImageHandle Handle that identifies the image to be unloaded. + @param SystemTable The system table. + + @retval EFI_SUCCESS The image has been unloaded. +**/ +EFI_STATUS +EFIAPI +PlatformManagerUiLibDestructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_EVENT PlatformUiExitEvent; + + Status =3D gBS->UninstallMultipleProtocolInterfaces ( + gPlatformManagerPrivate.DriverHandle, + &gEfiDevicePathProtocolGuid, + &mPlatformManagerHiiVendorDevicePath, + NULL + ); + ASSERT_EFI_ERROR (Status); + + HiiRemovePackages (gPlatformManagerPrivate.HiiHandle); + + // Signal Exit event + Status =3D gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_CALLBACK, + EfiEventEmptyFunction, + NULL, + &gPlatformManagerExitEventGuid, + &PlatformUiExitEvent + ); + ASSERT_EFI_ERROR (Status); + gBS->SignalEvent (PlatformUiExitEvent); + gBS->CloseEvent (PlatformUiExitEvent); + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/Platform= ManagerStrings.uni b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/= PlatformManagerStrings.uni new file mode 100644 index 000000000000..3bb39413bc4b --- /dev/null +++ b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManager= Strings.uni @@ -0,0 +1,21 @@ +// +// Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// + +/=3D# + +#langdef en-US "English" + +#string STR_EDKII_MENU_TITLE #language en-US "Platform Manager" +#string STR_EDKII_MENU_HELP #language en-US "This selection wi= ll take you to the Platform Manager" +#string STR_PLATFORM_LIST #language en-US "Platform Configur= ation" +#string STR_MISSING_STRING #language en-US "Missing String" +#string STR_EMPTY_STRING #language en-US "" +#string STR_EXIT_STRING #language en-US "Press ESC to exit= ." +// +// Ensure that this is the last string. We are using it programmatically +// to do string token re-usage settings for the Device Manager since we are +// constantly recreating this page based on HII population. +//// diff --git a/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/Platform= ManagerUiLib.uni b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/Pl= atformManagerUiLib.uni new file mode 100644 index 000000000000..217a7e999dab --- /dev/null +++ b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManager= UiLib.uni @@ -0,0 +1,13 @@ +// +// Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// + +#string STR_MODULE_ABSTRACT +#language en-US +"Platform Manager Library used by UiApp" + +#string STR_MODULE_DESCRIPTION +#language en-US +"Platform Manager Library used by UiApp" diff --git a/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/Platform= ManagerVfr.Vfr b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/Plat= formManagerVfr.Vfr new file mode 100644 index 000000000000..bfda75319416 --- /dev/null +++ b/Silicon/Ampere/AmpereSiliconPkg/Library/PlatformUiLib/PlatformManager= Vfr.Vfr @@ -0,0 +1,29 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include "PlatformManagerVfr.h" + +formset + guid =3D FORMSET_GUID, + title =3D STRING_TOKEN(STR_EDKII_MENU_TITLE), + help =3D STRING_TOKEN(STR_EDKII_MENU_HELP), + classguid =3D EFI_HII_PLATFORM_SETUP_FORMSET_GUID, + + form formid =3D PLATFORM_MANAGER_FORM_ID, + title =3D STRING_TOKEN(STR_EDKII_MENU_TITLE); + subtitle text =3D STRING_TOKEN(STR_PLATFORM_LIST); + + label LABEL_ENTRY_LIST; + label LABEL_END; + + subtitle text =3D STRING_TOKEN(STR_EMPTY_STRING); + subtitle text =3D STRING_TOKEN(STR_EMPTY_STRING); + subtitle text =3D STRING_TOKEN(STR_EXIT_STRING); + endform; +endformset; --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83821): https://edk2.groups.io/g/devel/message/83821 Mute This Topic: https://groups.io/mt/87123869/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83827+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83827+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167826310765.038638010539; Wed, 17 Nov 2021 08:50:26 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id yivlYY1788612xej9GUcRtdT; Wed, 17 Nov 2021 08:50:25 -0800 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.127]) by mx.groups.io with SMTP id smtpd.web12.9709.1637167823159301630 for ; Wed, 17 Nov 2021 08:50:23 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mvkJosaHR0AanNu0XYPFIlcmKtJJl41BRxPkyXxBkcBy1DZF0Juyvl9+1Ifo4LtWjghWdJ842gaReVW0I31Cr2y6IxAwlFeqVjdAy9zerBPFAcRCxCTbq++rCogiUAB71CAL7BHRcZma/P+M0s6w6NNAEbqazLumn1o1ZnUSp/DfDD9QjKvGM/xvz5G1QD9Pk/+d9twwjoATdVGG/bXlFVEIaa68IV6I0ua7qtFW1IAB4pYRmVcj2+rrJG0lyLntJHzleR/A2B6Mk6UQ00J5IfgXFaQNkvcM1/AMFIzWITXY8AAE7PM6ddTG+cxl1TxvP4nSZuClevovVJTGe2BM5w== 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=qAYXyihq9TZN7rsaiuZbA8iJMhgOJxbl679gSXi1SJA=; b=L6zzC+6gRnvHmHR9hwD2tqWLyfleXQ5ifhVF8PtFKF4U4vVAChof7mWnafg5E/WDRH/DKvgzfroe4V/zQp7ZYq93aRX525+RfnK2nQMHJ60jxraBiDUUDJ9GQSPcMDUTf5X18KOWsd+ZB5zOu/hlmlD4QOeAyeZrQ95JOFLDj6QdERFX7HgBsbdVZvGLeYY0KDpnnUAZhNlxFiwD/W8XDSNBQG4X3z1Al6lRaQ4Pcd/FY2XksfuGTbwdRw5c+6NmTlFrTdWzHajDtM6/ABRRfUBqJgesZQ4E6yuFi/VKFa7x3q6rt3GwicCSdCxEJ0i2sXLdlLJ0jlcXs7Mv0jLQ1A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB6454.prod.exchangelabs.com (2603:10b6:510:1b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.20; Wed, 17 Nov 2021 16:50:04 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:04 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 09/30] AmpereAltraPkg, JadePkg: Add ACPI support Date: Wed, 17 Nov 2021 23:47:06 +0700 Message-ID: <20211117164727.10922-10-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:50:00 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c3d53965-37ac-40be-e55c-08d9a9ea4d25 X-MS-TrafficTypeDiagnostic: PH0PR01MB6454: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: NI9bfyDVBuGiBiZ688hHJ7samsG/pplfApaerksWH8S/1iCrh4Gtp7+gITIO85XXBmlDeJZP8YUJW85C2DKWPE+UyrieM75XDVEot24EBT1tydbljWytiLkP8f1T3E2ysF66AJ1tNJBiK70t6gZVKmkQDrYfGvbRQKHUITOixSNvjziDvTrzwkBwVNOydd8Sw7mKK6HPzZIcHJ9x4150itJ6k2MO4gUSxuz9+o/Zkv7tEcaAHNl0PMhkMaGfDT5FLHbRiHp33f1frWC3Z7pwj1HVUR9a+htrcYGwSpHUCKNssjpwY7ise5WP9JOV+Djpx/sOW21INoiHHgriivv3uUXqTwtsLUnh4f8s8zANR8cn9wGDc+Yp4/4gECcQrljcX4rsoNYQpvcyvy8Sc/exySPm+R/GVICdO3FAEaFPivVTr9O8VSgKWaliqtgy0lKooD4zVYi2evM9+RiclTb3T9ADx66sTpzC1RdZYOKsH234r9vFU3pJwyPiiduQJD3bcUl+YagdbrF5DLfm2qnNZW5OQGuUuD6nKjqd5O8rJqKPyJKxuIAOWeTjaVTEhGiWht6H6/qdQaT7JdrSkF2nbZ8DnpCNuSJObmWJI6hYYWCtfN9nRzrNXVGnV3Fra63NMTf3oaiujx5ibeT18rBsoU307mRkGBo4rFPuNsn1Fd+61mCM9oP+umus5rho17wHhcyx0478nuTYO/2X0zN8uq8AccvSTnfc8FNMrDh/o+zg9ZYNr1+GN4xPx48TKfsxMgUjv8m1gwUZJvp4lJP4dy/j64HDCJYBbEfG5OyYvIRFEMsSh6x2W9jXa7GQI4LO X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?zsJzSYNZ+4SGR2eIMVJQ/S1KiAFA6sP5QFXzUX9Q1X/GvAuJeS2wPpLxQLoK?= =?us-ascii?Q?2U9rM6qEVHDsgLD1lIVVs8YgvfRdRQ/CyB8BiaKG5B+C+SNA9MGev2Hq9DVJ?= =?us-ascii?Q?hRo2ZPmE1g6vqRX3nA1afNSMj2NeJb3SpSScplSF9DilWQ1mvg42SgWkIFYV?= =?us-ascii?Q?y7kMzKTLlj/CuYjQyz2sx8xnqZtP++zj0p62DnPavGFQmB1kpWW8dEes84x5?= =?us-ascii?Q?z+9ZM/3LZsb9b30DMuLsk0tc/+76Vidl13VoO9k1bcxJcynAlv/VhL1FdDd6?= =?us-ascii?Q?i0B9y84b2ABkyfuqurGWDJRYSQ7tfdi+VDFdgVsEBjTTz2YBEw8vVeG1Qw05?= =?us-ascii?Q?mrc2k9Xh/Mq3EqfSK9IvxOtChySxfxnqywpXaJ8+oO9ujyEKSgz6k4MudTm9?= =?us-ascii?Q?gnb2QDR1+3LYSQu0gH91cZa3Bws7VNUh3QS08XxYAy+kA0n7qT5vQRazjqsJ?= =?us-ascii?Q?VrbhUggz3idIyZJmV8/ICNtgxrKSYjLSQdilA4aSazlzOoWt3Q5kZ4tZn7Xb?= =?us-ascii?Q?n9rG3xQiP8KZZYEEGZp/jbt/v8jXzlRkUuF9ifz2ddUGsMOZyy4E/RBSJ7hU?= =?us-ascii?Q?f5Cvqtfr/DkTpdL71T8eR1GbhwAI+TQ8QLAfH5qNQvtB9SjrDcqW2BcBr6l3?= =?us-ascii?Q?QJKB73mRxjHbOfyCcxyfHmn47evJGJlK21oscC4C3wORn4FS0H66ZataFwzB?= =?us-ascii?Q?kLRbxpE4B5JF3UftNo1PNmepum5xAuxkQ9pzOQVtsUyNZptDbvmiyr4MiHtT?= =?us-ascii?Q?5LwyROVp9oEgAE087ubIxiDnsHJvSu1hk4w5aLIq6puVa/FiCFZxkZGBpCxy?= =?us-ascii?Q?L3yE7r2rT8v60Htp+GBrUQCUC1n/p07tw0VmupBGxoN1P8zULNLRKhSiOyBE?= =?us-ascii?Q?7KthJ8L4wMYIkeyLr2DU4+/Xect216nHKY6L6ectxFegNHmghCo9no1Z2WVI?= =?us-ascii?Q?YmJHAvoPowh+cJ7y1pgXjTvmwc4bUEKFgykMA0TdkUNj3+3/UFi6PFkCrdWX?= =?us-ascii?Q?sVvtA5FIDGXfHya6Zmpr+reCYnKsAd2C565aqTkVEyvygwl9pFe3rfjW+c/F?= =?us-ascii?Q?/KF3c9yVulGszehSGzdcJrqqyGeOjYE1LHTguZsJE6sjcaiAzTbyaILnH9lP?= =?us-ascii?Q?g/v+L8tWxeU764d+t19IZXc0ZHrWSe02KxmpwrkXxjvRmjk8/EY0zMkKmr14?= =?us-ascii?Q?hnjXjTtE8UMoPjagH3l3mTqyypzFWNyelkuOfxjR8QWMvvKjQDteWH6MveD4?= =?us-ascii?Q?vTopeueGBvMY0S9snfyYbGNhQVsOV8AVNnOOnHdu3On4UFPEuY0Pf08e8DuW?= =?us-ascii?Q?1Q2jdA0FHhWGCBngbgFSiav/u2P/x+a+dIuPcruG2/QJ0EetAAruNuZQe8Td?= =?us-ascii?Q?Xdtmab3gSBv6fdIexhZxk9aiuhyhw5s6Z1YZwxEZp8TpcgXPq25YqNspfWQu?= =?us-ascii?Q?v7iQnaYijVT/kASUiBmO+hfIjJgXjU7V6wUchMQkgFVKMTw9jpOjxz9RjXTW?= =?us-ascii?Q?latRWbjH85Wk/5OhAqUJ9YU/JMTPFuqKufdPRjiLH9Jf/jvBy4AYtdQL7BjY?= =?us-ascii?Q?SIkicwBMaUFwF+IxdEL6ExaZ+7QHsnrRD0S9YE6KHxExsgTnQQYYUosjfo/J?= =?us-ascii?Q?Iig2kNeTvonMOCL7+O06IUZKPeWwiIagu5lHcLeTafHHOwkDL+LIuyXP8xcv?= =?us-ascii?Q?rLmiwiuKpkQyuWi31niPMs/K0sE=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3d53965-37ac-40be-e55c-08d9a9ea4d25 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:04.0805 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: p7SvRtyf4X5lDcf+ykceo23TQl03dOE1mIvm1SI3XKVUR/GcPFy+3HeC9wG7IeOFlYNds8sDEx/3J3cLdvTDS/5+0jmAaxCANh8nrsLro8A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6454 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: kXnueVAnwsJ11sqgS9umOXZHx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167825; bh=6c/oZzAAeHdTnXKFVPBZblD+C88doY8gpx4T3DUc4vo=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=szzCF0eR6Pt28bmqIgS7WMDsFWCKOQfyXc8/iMXcCnXBpxJxp0bG4HvbkWltYtMkwl0 1RoniUfHyTWzc/JdZVjOvfYXhSMcw8AFP0/QrBO/0DiEHpIcmuJFIUF52qYnW2yp3HBKd OUjU6oHKz8NSqe4/Jh6k2qJSNVW8DtxmzT4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167829397100002 Content-Type: text/plain; charset="utf-8" Add various ACPI tables for the Mt. Jade platform including: DSDT, SPCR, DBG2, GTDT, FACP, SSDT, MADT, PPTT, PCCT, SLIT, SRAT, and NFIT. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Acked-by: Leif Lindholm --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc | 8= + Platform/Ampere/JadePkg/Jade.dsc | 20= + Platform/Ampere/JadePkg/Jade.fdf | 8= + Platform/Ampere/JadePkg/AcpiTables/AcpiTables.inf | 20= + Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 76= + Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/AcpiCommonTables.inf | 44= + Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.h | 131= + Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiNfit.h | 50= + Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform.h | 74= + Silicon/Ampere/AmpereAltraPkg/Include/AcpiHeader.h | 37= + Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h | 140= + Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c | 435= ++ Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiDsdt.c | 601= +++ Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiMadt.c | 348= ++ Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiNfit.c | 596= +++ Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPcct.c | 413= ++ Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.c | 178= + Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPptt.c | 333= ++ Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSlit.c | 187= + Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSrat.c | 271= + Platform/Ampere/JadePkg/AcpiTables/CPU-S0.asi | 5639= ++++++++++++++++++++ Platform/Ampere/JadePkg/AcpiTables/CPU-S1.asi | 5639= ++++++++++++++++++++ Platform/Ampere/JadePkg/AcpiTables/CPU.asi | 127= + Platform/Ampere/JadePkg/AcpiTables/Dsdt.asl | 531= ++ Platform/Ampere/JadePkg/AcpiTables/PCI-PDRC.asi | 217= + Platform/Ampere/JadePkg/AcpiTables/PCI-S0.Rca01.asi | 681= +++ Platform/Ampere/JadePkg/AcpiTables/PCI-S0.asi | 2078= ++++++++ Platform/Ampere/JadePkg/AcpiTables/PCI-S1.asi | 2087= ++++++++ Platform/Ampere/JadePkg/AcpiTables/PMU-S0.asi | 1303= +++++ Platform/Ampere/JadePkg/AcpiTables/PMU-S1.asi | 1303= +++++ Platform/Ampere/JadePkg/AcpiTables/PMU.asi | 10= + Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Bert.aslc | 33= + Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Dbg2.aslc | 87= + Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Einj.asl | 165= + Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Fadt.aslc | 87= + Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Gtdt.aslc | 180= + Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Hest.asl | 330= ++ Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Sdei.asl | 17= + Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Spcr.aslc | 81= + Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Ssdt.asl | 15= + 40 files changed, 24580 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index 99e00f82aac8..fa9b120b2c2b 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -467,6 +467,14 @@ [PcdsFixedAtBuild.common] # gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c= , 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0= x31 } =20 + # + # ACPI table + # + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId|"Ampere" + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId|0x2020206172746C= 41 # Altra + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId|0x2E504D41 # AMP. + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision|0x01000013 + # # Enable strict image permissions for all images. (This applies # only to images that were built with >=3D 4 KB section alignment.) diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index 0dd30dc14841..e4b29e36fc8d 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -77,12 +77,22 @@ [LibraryClasses] # RealTimeClockLib|Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLi= b/PCF85063RealTimeClockLib.inf =20 + # + # ACPI Libraries + # + AcpiLib|EmbeddedPkg/Library/AcpiLib/AcpiLib.inf + ##########################################################################= ###### # # Specific Platform Pcds # ##########################################################################= ###### [PcdsFeatureFlag.common] + # + # Activate AcpiSdtProtocol + # + gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE + [PcdsFixedAtBuild.common] # # Platform config UUID @@ -104,3 +114,13 @@ [PcdsFixedAtBuild.common] # ##########################################################################= ###### [Components.common] + # + # ACPI + # + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf { + + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2B + } + Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf + Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/AcpiCommonTables.inf + Platform/Ampere/JadePkg/AcpiTables/AcpiTables.inf diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index de37415cd5c0..078b63c867d6 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -285,4 +285,12 @@ [FV.FvMain] # !include NetworkPkg/Network.fdf.inc =20 + # + # ACPI + # + INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + INF Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf + INF RuleOverride=3DACPITABLE Silicon/Ampere/AmpereAltraPkg/AcpiCommonTab= les/AcpiCommonTables.inf + INF RuleOverride=3DACPITABLE Platform/Ampere/JadePkg/AcpiTables/AcpiTabl= es.inf + !include Silicon/Ampere/AmpereSiliconPkg/FvRules.fdf.inc diff --git a/Platform/Ampere/JadePkg/AcpiTables/AcpiTables.inf b/Platform/A= mpere/JadePkg/AcpiTables/AcpiTables.inf new file mode 100644 index 000000000000..1cf632f8a406 --- /dev/null +++ b/Platform/Ampere/JadePkg/AcpiTables/AcpiTables.inf @@ -0,0 +1,20 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D JadeAcpiTables + FILE_GUID =3D 5ADDBC13-8634-480C-9B94-671B7855CDB8 + MODULE_TYPE =3D USER_DEFINED + VERSION_STRING =3D 1.0 + +[Sources] + Dsdt.asl + +[Packages] + MdePkg/MdePkg.dec diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDx= e.inf b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf new file mode 100644 index 000000000000..72e78fb4e31e --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf @@ -0,0 +1,76 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D AcpiPlatformDxe + FILE_GUID =3D CDA4ED56-6960-4092-885D-FEF37D29093E + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D AcpiPlatformDxeInitialize + +[Sources.common] + AcpiApei.c + AcpiApei.h + AcpiDsdt.c + AcpiMadt.c + AcpiNfit.c + AcpiPcct.c + AcpiPlatform.h + AcpiPlatformDxe.c + AcpiPptt.c + AcpiSlit.c + AcpiSrat.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + AcpiLib + AmpereCpuLib + ArmLib + BaseLib + DebugLib + FlashLib + MailboxInterfaceLib + SystemFirmwareInterfaceLib + TimerLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + +[Pcd] + gArmPlatformTokenSpaceGuid.PcdCoreCount + gArmPlatformTokenSpaceGuid.PcdClusterCount + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision + gAmpereTokenSpaceGuid.PcdPmproDbBaseReg + gAmpereTokenSpaceGuid.PcdSmproDbBaseReg + +[Guids] + gArmMpCoreInfoGuid + gEfiAcpiTableGuid + gEfiEventReadyToBootGuid + gPlatformInfoHobGuid + +[Protocols] + gEfiAcpiTableProtocolGuid ## ALWAYS_CONSUMED + gEfiAcpiSdtProtocolGuid + gEfiPciRootBridgeIoProtocolGuid + +[Depex] + gEfiAcpiTableProtocolGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/AcpiCommonTable= s.inf b/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/AcpiCommonTables.inf new file mode 100644 index 000000000000..acc4092c650d --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/AcpiCommonTables.inf @@ -0,0 +1,44 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D AcpiCommonTables + FILE_GUID =3D CEFA2AEB-357E-4F48-8066-EA950853056E + MODULE_TYPE =3D USER_DEFINED + VERSION_STRING =3D 1.0 + +[Sources] + Bert.aslc + Dbg2.aslc + Einj.asl + Fadt.aslc + Gtdt.aslc + Hest.asl + Sdei.asl + Spcr.aslc + Ssdt.asl + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase ## CONSU= MES + gArmPlatformTokenSpaceGuid.PL011UartInterrupt ## CONSU= MES + gArmPlatformTokenSpaceGuid.PcdWatchdogCount ## CONSU= MES + + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision ## CONSU= MES + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision ## CONSU= MES + + gArmPlatformTokenSpaceGuid.PcdSerialDbgRegisterBase ## CONSU= MES + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate ## CONSU= MES diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.h b/P= latform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.h new file mode 100644 index 000000000000..61648f107efe --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.h @@ -0,0 +1,131 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef ACPI_APEI_H_ +#define ACPI_APEI_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#pragma pack(1) +#define BERT_MSG_SIZE 0x2C +#define BERT_UEFI_FAILURE 5 +#define BERT_DEFAULT_ERROR_SEVERITY 0x1 +#define GENERIC_ERROR_DATA_REVISION 0x300 + +#define RAS_TYPE_2P 0x03 +#define RAS_TYPE_BERT 0x3F +#define RAS_TYPE_ERROR_MASK 0x3F +#define RAS_TYPE_PAYLOAD_MASK 0xC0 +#define RAS_TYPE_PAYLOAD0 0x00 +#define RAS_TYPE_PAYLOAD1 0x40 +#define RAS_TYPE_PAYLOAD2 0x80 +#define RAS_TYPE_PAYLOAD3 0xC0 +#define RAS_TYPE_BERT_PAYLOAD3 (RAS_TYPE_BERT | RAS_TYPE_PAYLOAD3) + +#define PLAT_CRASH_ITERATOR_SIZE 0x398 +#define SMPRO_CRASH_SIZE 0x800 +#define PMPRO_CRASH_SIZE 0x800 +#define RASIP_CRASH_SIZE 0x1000 +#define HEST_NUM_ENTRIES_PER_SOC 3 + +#define CURRENT_BERT_VERSION 0x11 +#define BERT_FLASH_OFFSET 0x91B30000ULL +#define BERT_DDR_OFFSET 0x88230000ULL +#define BERT_DDR_LENGTH 0x50000 + +typedef struct { + UINT8 Type; + UINT8 SubType; + UINT16 Instance; + CHAR8 Msg[BERT_MSG_SIZE]; +} APEI_BERT_ERROR_DATA; + +typedef struct { + APEI_BERT_ERROR_DATA Vendor; + UINT8 BertRev; + UINT8 S0PmproRegisters[PMPRO_CRASH_SIZE]; + UINT8 S0SmproRegisters[SMPRO_CRASH_SIZE]; + UINT8 S0RasIpRegisters[RASIP_CRASH_SIZE]; + UINT8 S1PmproRegisters[PMPRO_CRASH_SIZE]; + UINT8 S1SmproRegisters[SMPRO_CRASH_SIZE]; + UINT8 S1RasIpRegisters[RASIP_CRASH_SIZE]; + UINT8 AtfDump[PLATFORM_CPU_MAX_NUM_CORES * PLAT_CRASH_ITE= RATOR_SIZE]; +} APEI_CRASH_DUMP_DATA; + +typedef struct { + EFI_ACPI_6_3_GENERIC_ERROR_STATUS_STRUCTURE Ges; + EFI_ACPI_6_3_GENERIC_ERROR_DATA_ENTRY_STRUCTURE Ged; + APEI_CRASH_DUMP_DATA Bed; +} APEI_CRASH_DUMP_BERT_ERROR; +#pragma pack() + +VOID +EFIAPI +CreateDefaultBertData ( + APEI_BERT_ERROR_DATA *Data + ); + +VOID +EFIAPI +WrapBertErrorData ( + APEI_CRASH_DUMP_BERT_ERROR *WrappedError + ); + +VOID +EFIAPI +PullBertSpinorData ( + APEI_CRASH_DUMP_DATA *BertErrorData + ); + +VOID +EFIAPI +AdjustBERTRegionLen ( + UINT32 Len + ); + +BOOLEAN +EFIAPI +IsBertEnabled ( + VOID + ); + +VOID +EFIAPI +WriteDDRBertTable ( + APEI_CRASH_DUMP_BERT_ERROR *Data + ); + +VOID +WriteSpinorDefaultBertTable ( + APEI_CRASH_DUMP_DATA *SpiRefrenceData + ); + +EFI_STATUS +EFIAPI +AcpiApeiUpdate ( + VOID + ); + +EFI_STATUS +EFIAPI +AcpiPopulateBert ( + VOID + ); + +#endif /* ACPI_APEI_H_ */ diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiNfit.h b/P= latform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiNfit.h new file mode 100644 index 000000000000..db47e422d48d --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiNfit.h @@ -0,0 +1,50 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef ACPI_NFIT_H_ +#define ACPI_NFIT_H_ + +#include + +#define NVDIMM_SK0 0 +#define NVDIMM_SK1 1 +#define NVDIMM_NUM_PER_SK (AC01_NVDIMM_MAX_MCU_PER_SOCKET * AC01_NVDIMM_= MAX_DIMM_PER_MCU) +#define ONE_GB (1024 * 1024 * 1024) + +typedef enum { + NvdimmDisabled =3D 0, + NvdimmNonHashed, + NvdimmHashed, + NvdimmModeMax +} NVDIMM_MODE; + +typedef struct { + BOOLEAN Enabled; + UINT64 NvdSize; + UINT32 DeviceHandle; + UINT16 PhysId; + UINT8 InterleaveWays; + UINT64 RegionOffset; + UINT16 VendorId; + UINT16 DeviceId; + UINT16 RevisionId; + UINT16 SubVendorId; + UINT16 SubDeviceId; + UINT16 SubRevisionId; + UINT32 SerialNumber; +} NVDIMM_INFO; + +typedef struct { + UINT8 NvdRegionNum; + UINT8 NvdRegionId[AC01_NVDIMM_MAX_REGION_PER_SOCKET]; + UINT8 NvdMode; + UINT8 NvdNum; + NVDIMM_INFO NvdInfo[NVDIMM_NUM_PER_SK]; +} NVDIMM_DATA; + +#endif diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform.h= b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform.h new file mode 100644 index 000000000000..b5035067a47b --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform.h @@ -0,0 +1,74 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef ACPI_PLATFORM_H_ +#define ACPI_PLATFORM_H_ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +EFI_STATUS +AcpiPatchDsdtTable ( + VOID + ); + +EFI_STATUS +AcpiInstallMadtTable ( + VOID + ); + +EFI_STATUS +AcpiInstallNfitTable ( + VOID + ); + +EFI_STATUS +AcpiPcctInitializeSharedMemory ( + VOID + ); + +EFI_STATUS +AcpiInstallPcctTable ( + VOID + ); + +EFI_STATUS +AcpiInstallPpttTable ( + VOID + ); + +EFI_STATUS +AcpiInstallSlitTable ( + VOID + ); + +EFI_STATUS +AcpiInstallSratTable ( + VOID + ); + +#endif /* ACPI_PLATFORM_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/AcpiHeader.h b/Silicon/A= mpere/AmpereAltraPkg/Include/AcpiHeader.h new file mode 100644 index 000000000000..d604b712d8c8 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/AcpiHeader.h @@ -0,0 +1,37 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef ACPI_HEADER_H_ +#define ACPI_HEADER_H_ + +#include + +// +// ACPI table information used to initialize tables. +// +#define EFI_ACPI_OEM_ID {'A','m','p','e','r','e'} +#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64('A','l','t','r','a',' ',' '= ,' ') +#define EFI_ACPI_OEM_REVISION FixedPcdGet32 (PcdAcpiDefaultOemRevision) +#define EFI_ACPI_CREATOR_ID SIGNATURE_32('A','M','P','.') +#define EFI_ACPI_CREATOR_REVISION FixedPcdGet32 (PcdAcpiDefaultCreatorRevi= sion) + +// A macro to initialise the common header part of EFI ACPI tables as defi= ned by +// EFI_ACPI_DESCRIPTION_HEADER structure. +#define __ACPI_HEADER(Signature, Type, Revision) { \ + Signature, /* UINT32 Signature */ \ + sizeof (Type), /* UINT32 Length */ \ + Revision, /* UINT8 Revision */ \ + 0, /* UINT8 Checksum */ \ + EFI_ACPI_OEM_ID, /* UINT8 OemId[6] */ \ + EFI_ACPI_OEM_TABLE_ID, /* UINT64 OemTableId */ \ + EFI_ACPI_OEM_REVISION, /* UINT32 OemRevision */ \ + EFI_ACPI_CREATOR_ID, /* UINT32 CreatorId */ \ + EFI_ACPI_CREATOR_REVISION /* UINT32 CreatorRevision */ \ + } + +#endif /* ACPI_HEADER_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h b/Silico= n/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h index 1ba1da17117e..2310e4e1ce98 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h @@ -89,4 +89,144 @@ // #define AC01_GPIO_PINS_PER_SOCKET 32 =20 +// +// Maximum number of memory controller supports NVDIMM-N per socket +// +#define AC01_NVDIMM_MAX_MCU_PER_SOCKET 2 + +// +// Maximum number of NVDIMM-N per memory controller +// +#define AC01_NVDIMM_MAX_DIMM_PER_MCU 1 + +// +// Maximum number of NVDIMM region per socket +// +#define AC01_NVDIMM_MAX_REGION_PER_SOCKET 2 + +// +// Socket 0 base address of NVDIMM non-hashed region 0 +// +#define AC01_NVDIMM_SK0_NHASHED_REGION0_BASE 0x0B0000000000ULL + +// +// Socket 0 base address of NVDIMM non-hashed region 1 +// +#define AC01_NVDIMM_SK0_NHASHED_REGION1_BASE 0x0F0000000000ULL + +// +// Socket 1 base address of NVDIMM non-hashed region 0 +// +#define AC01_NVDIMM_SK1_NHASHED_REGION0_BASE 0x430000000000ULL + +// +// Socket 1 base address of NVDIMM non-hashed region 1 +// +#define AC01_NVDIMM_SK1_NHASHED_REGION1_BASE 0x470000000000ULL + +// +// DIMM ID of NVDIMM-N device 1 +// +#define AC01_NVDIMM_NVD1_DIMM_ID 6 + +// +// DIMM ID of NVDIMM-N device 2 +// +#define AC01_NVDIMM_NVD2_DIMM_ID 14 + +// +// DIMM ID of NVDIMM-N device 3 +// +#define AC01_NVDIMM_NVD3_DIMM_ID 22 + +// +// DIMM ID of NVDIMM-N device 4 +// +#define AC01_NVDIMM_NVD4_DIMM_ID 30 + +// +// NFIT device handle of NVDIMM-N device 1 +// +#define AC01_NVDIMM_NVD1_DEVICE_HANDLE 0x0330 + +// +// NFIT device handle of NVDIMM-N device 2 +// +#define AC01_NVDIMM_NVD2_DEVICE_HANDLE 0x0770 + +// +// NFIT device handle of NVDIMM-N device 3 +// +#define AC01_NVDIMM_NVD3_DEVICE_HANDLE 0x1330 + +// +// NFIT device handle of NVDIMM-N device 4 +// +#define AC01_NVDIMM_NVD4_DEVICE_HANDLE 0x1770 + +// +// Interleave ways of non-hashed NVDIMM-N +// +#define AC01_NVDIMM_NHASHED_INTERLEAVE_WAYS 1 + +// +// Interleave ways of hashed NVDIMM-N +// +#define AC01_NVDIMM_HASHED_INTERLEAVE_WAYS 2 + +// +// Region offset of hashed NVDIMM-N +// +#define AC01_NVDIMM_HASHED_REGION_OFFSET 512 + +// +// The base address of GIC distributor registers +// +#define AC01_GICD_MASTER_BASE_ADDRESS 0x100100000000 + +// +// The base address of master socket GIC redistributor registers +// +#define AC01_GICR_MASTER_BASE_ADDRESS 0x100100140000 + +// +// The base address of slave socket GIC distributor registers +// +#define AC01_GICD_SLAVE_BASE_ADDRESS 0x500100000000 + +// +// The base address of slave socket GIC redistributor registers +// +#define AC01_GICR_SLAVE_BASE_ADDRESS 0x500100140000 + +// +// Socket 0 first RC +// +#define SOCKET0_FIRST_RC 2 + +// +// Socket 0 last RC +// +#define SOCKET0_LAST_RC 7 + +// +// Socket 1 first RC +// +#define SOCKET1_FIRST_RC 10 + +// +// Socket 1 last RC +// +#define SOCKET1_LAST_RC 15 + +// +// Socket bit offset of core UID. +// +#define PLATFORM_SOCKET_UID_BIT_OFFSET 16 + +// +// CPM bit offset of core UID. +// +#define PLATFORM_CPM_UID_BIT_OFFSET 8 + #endif /* PLATFORM_AC01_H_ */ diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c b/P= latform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c new file mode 100644 index 000000000000..58c511db99a7 --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c @@ -0,0 +1,435 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include + +#include "AcpiApei.h" + +UINT8 AMPERE_GUID[16] =3D {0x8d, 0x89, 0xed, 0xe8, 0x16, 0xdf, 0xcc, 0x43,= 0x8e, 0xcc, 0x54, 0xf0, 0x60, 0xef, 0x15, 0x7f}; +CHAR8 DEFAULT_BERT_REBOOT_MSG[BERT_MSG_SIZE] =3D "Unknown reboot reason"; + +STATIC VOID +AcpiApeiUninstallTable ( + UINT32 Signature + ) +{ + EFI_STATUS Status; + EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; + EFI_ACPI_SDT_PROTOCOL *AcpiTableSdtProtocol; + EFI_ACPI_SDT_HEADER *Table; + UINTN TableKey; + UINTN TableIndex; + + /* + * Get access to ACPI tables + */ + Status =3D gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID = **)&AcpiTableProtocol); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a:%d: Unable to locate ACPI table protocol\n", = __FUNCTION__, __LINE__)); + return; + } + + Status =3D gBS->LocateProtocol (&gEfiAcpiSdtProtocolGuid, NULL, (VOID **= )&AcpiTableSdtProtocol); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a:%d: Unable to locate ACPI table support proto= col\n", __FUNCTION__, __LINE__)); + return; + } + + /* + * Search for ACPI Table Signature + */ + TableIndex =3D 0; + Status =3D AcpiLocateTableBySignature ( + AcpiTableSdtProtocol, + Signature, + &TableIndex, + (EFI_ACPI_DESCRIPTION_HEADER **)&Table, + &TableKey + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a:%d Unable to get ACPI table\n", __FUNCTION__,= __LINE__)); + return; + } + + /* + * Uninstall ACPI Table + */ + Status =3D AcpiTableProtocol->UninstallAcpiTable (AcpiTableProtocol, Tab= leKey); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a:%d: Unable to uninstall table\n", __FUNCTION_= _, __LINE__)); + } +} + +VOID +AdjustBERTRegionLen ( + UINT32 Len + ) +{ + EFI_STATUS Status; + EFI_ACPI_SDT_PROTOCOL *AcpiTableSdtProtocol; + UINTN TableKey; + UINTN TableIndex; + EFI_ACPI_6_3_BOOT_ERROR_RECORD_TABLE_HEADER *Table; + + Status =3D gBS->LocateProtocol ( + &gEfiAcpiSdtProtocolGuid, + NULL, + (VOID **)&AcpiTableSdtProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "APEI: Unable to locate ACPI table support protoc= ol\n")); + return; + } + + /* + * Search for ACPI Table Signature + */ + TableIndex =3D 0; + Status =3D AcpiLocateTableBySignature ( + AcpiTableSdtProtocol, + EFI_ACPI_6_3_BOOT_ERROR_RECORD_TABLE_SIGNATURE, + &TableIndex, + (EFI_ACPI_DESCRIPTION_HEADER **)&Table, + &TableKey + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a:%d Unable to get ACPI BERT table\n", __FUNCTI= ON__, __LINE__)); + return; + } + + /* + * Adjust Boot Error Region Length + */ + Table->BootErrorRegionLength =3D Len; + + AcpiUpdateChecksum ((UINT8 *)Table, Table->Header.Length); +} + +/* + * Retrieve Bert data from SPI NOR + */ +VOID +PullBertSpinorData ( + APEI_CRASH_DUMP_DATA *BertErrorData + ) +{ + UINTN Length; + + Length =3D sizeof (*BertErrorData); + + FlashReadCommand ( + BERT_FLASH_OFFSET, + BertErrorData, + Length + ); +} + +/* + * wrap raw bert error data + * + * @param IN BertErrorData Bert Error record to be wrapped + * @param OUT WrappedError Generic error data for OS to consume. + */ +VOID +WrapBertErrorData ( + APEI_CRASH_DUMP_BERT_ERROR *WrappedError + ) +{ + UINT32 CrashSize; + UINT8 CrashType; + UINT8 CrashSubType; + + CrashSize =3D PLAT_CRASH_ITERATOR_SIZE * + GetNumberOfSupportedSockets () * + GetMaximumNumberOfCores (); + CrashSize +=3D 2 * (SMPRO_CRASH_SIZE + PMPRO_CRASH_SIZE + RASIP_CRASH_SI= ZE); + CrashSize +=3D sizeof (WrappedError->Bed.Vendor) + sizeof (WrappedError-= >Bed.BertRev); + + CrashType =3D WrappedError->Bed.Vendor.Type & RAS_TYPE_ERROR_MASK; + CrashSubType =3D WrappedError->Bed.Vendor.SubType; + + WrappedError->Ges.BlockStatus.ErrorDataEntryCount =3D 1; + WrappedError->Ges.BlockStatus.UncorrectableErrorValid =3D 1; + WrappedError->Ged.ErrorSeverity =3D BERT_DEFAULT_ERROR_SEVERITY; + WrappedError->Ged.Revision =3D GENERIC_ERROR_DATA_REVISION; + + if ((CrashType =3D=3D RAS_TYPE_BERT && (CrashSubType =3D=3D 0 || CrashSu= bType =3D=3D BERT_UEFI_FAILURE)) + || (CrashType =3D=3D RAS_TYPE_2P)) { + WrappedError->Ged.ErrorDataLength =3D sizeof (WrappedError->Bed.Vendor= ) + + sizeof (WrappedError->Bed.BertRev); + WrappedError->Ges.DataLength =3D sizeof (WrappedError->Bed.Vendor) + + sizeof (WrappedError->Bed.BertRev) + + sizeof (WrappedError->Ged); + AdjustBERTRegionLen ( + sizeof (WrappedError->Bed.Vendor) + + sizeof (WrappedError->Bed.BertRev) + + sizeof (WrappedError->Ged) + + sizeof (WrappedError->Ges) + ); + } else { + WrappedError->Ged.ErrorDataLength =3D CrashSize; + WrappedError->Ges.DataLength =3D CrashSize + sizeof (WrappedError->Ged= ); + AdjustBERTRegionLen ( + CrashSize + + sizeof (WrappedError->Ged) + + sizeof (WrappedError->Ges) + ); + } + CopyMem ( + WrappedError->Ged.SectionType, + AMPERE_GUID, + sizeof (AMPERE_GUID) + ); +} + + +/* + * create default bert error + * Msg: Unknown reboot reason + */ +VOID +CreateDefaultBertData ( + APEI_BERT_ERROR_DATA *Data + ) +{ + Data->Type =3D RAS_TYPE_BERT_PAYLOAD3; + AsciiStrCpyS ( + Data->Msg, + BERT_MSG_SIZE, + DEFAULT_BERT_REBOOT_MSG + ); +} + +/* + * Ensures BertErrorData In SPINOR matches + * the record produced by CreateDefaultBertData. + * @param Bed Crash dump Data + */ +VOID +WriteSpinorDefaultBertTable ( + APEI_CRASH_DUMP_DATA *Bed + ) +{ + UINT8 BertRev; + UINTN Length; + UINT64 Offset; + UINT32 MsgDiff; + APEI_BERT_ERROR_DATA DefaultData =3D {0}; + + CreateDefaultBertData (&DefaultData); + if ((Bed->Vendor.Type !=3D DefaultData.Type)) { + Offset =3D BERT_FLASH_OFFSET + + OFFSET_OF (APEI_CRASH_DUMP_DATA, Vendor) + + OFFSET_OF (APEI_BERT_ERROR_DATA, Type); + Length =3D sizeof (DefaultData.Type); + FlashEraseCommand (Offset, Length); + FlashWriteCommand (Offset, &(DefaultData.Type), Length); + } + + if ((Bed->Vendor.SubType !=3D DefaultData.SubType)) { + Offset =3D BERT_FLASH_OFFSET + + OFFSET_OF (APEI_CRASH_DUMP_DATA, Vendor) + + OFFSET_OF (APEI_BERT_ERROR_DATA, SubType); + Length =3D sizeof (DefaultData.SubType); + FlashEraseCommand (Offset, Length); + FlashWriteCommand (Offset, &(DefaultData.SubType), Length); + } + + if ((Bed->Vendor.Instance !=3D DefaultData.Instance)) { + Offset =3D BERT_FLASH_OFFSET + + OFFSET_OF (APEI_CRASH_DUMP_DATA, Vendor) + + OFFSET_OF (APEI_BERT_ERROR_DATA, Instance); + Length =3D sizeof (DefaultData.Instance); + FlashEraseCommand (Offset, Length); + FlashWriteCommand (Offset, &(DefaultData.Instance), Length); + } + + MsgDiff =3D AsciiStrnCmp (Bed->Vendor.Msg, DefaultData.Msg, BERT_MSG_SIZ= E); + if (MsgDiff !=3D 0) { + Offset =3D BERT_FLASH_OFFSET + + OFFSET_OF (APEI_CRASH_DUMP_DATA, Vendor) + + OFFSET_OF (APEI_BERT_ERROR_DATA, Msg); + Length =3D sizeof (DefaultData.Msg); + FlashEraseCommand (Offset, Length); + FlashWriteCommand (Offset, &(DefaultData.Msg), Length); + } + + if (Bed->BertRev !=3D CURRENT_BERT_VERSION) { + Offset =3D BERT_FLASH_OFFSET + OFFSET_OF (APEI_CRASH_DUMP_DATA, BertRe= v); + Length =3D sizeof (Bed->BertRev); + BertRev =3D CURRENT_BERT_VERSION; + FlashEraseCommand (Offset, Length); + FlashWriteCommand (Offset, &BertRev, Length); + } + +} + +/* + * Checks Status of NV_SI_RAS_BERT_ENABLED + * Returns TRUE if enabled and FALSE if disabled + */ +BOOLEAN +IsBertEnabled ( + VOID + ) +{ + EFI_STATUS Status; + UINT32 Value; + + Status =3D NVParamGet ( + NV_SI_RAS_BERT_ENABLED, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + // BERT is enabled by default + return TRUE; + } + + return (Value !=3D 0) ? TRUE : FALSE; +} + +/* + * Write bert table to DDR + */ +VOID +WriteDDRBertTable ( + APEI_CRASH_DUMP_BERT_ERROR *Data + ) +{ + VOID *Blk =3D (VOID *)BERT_DDR_OFFSET; + + /* + * writing sizeof data to ddr produces alignment error + * this is a temporary workaround + */ + CopyMem (Blk, Data, BERT_DDR_LENGTH); +} + +/* + * Update Bert Table + */ +EFI_STATUS +AcpiPopulateBert ( + VOID + ) +{ + APEI_CRASH_DUMP_BERT_ERROR *DDRError; + + DDRError =3D + (APEI_CRASH_DUMP_BERT_ERROR *) + AllocateZeroPool (sizeof (APEI_CRASH_DUMP_BERT_ERROR)); + + if (DDRError =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + if (IsBertEnabled ()) { + PullBertSpinorData (&(DDRError->Bed)); + if ((DDRError->Bed.BertRev =3D=3D CURRENT_BERT_VERSION)) { + WrapBertErrorData (DDRError); + WriteDDRBertTable (DDRError); + } + WriteSpinorDefaultBertTable (&(DDRError->Bed)); + } + + FreePool (DDRError); + return EFI_SUCCESS; +} + +/* + * Checks Status of NV_SI_RAS_SDEI_ENABLED + * Returns TRUE if enabled and FALSE if disabled or error occurred + */ +BOOLEAN +IsSdeiEnabled ( + VOID + ) +{ + EFI_STATUS Status; + UINT32 Value; + + Status =3D NVParamGet ( + NV_SI_RAS_SDEI_ENABLED, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + // SDEI is disabled by default + return FALSE; + } + + return (Value !=3D 0) ? TRUE : FALSE; +} + +STATIC +VOID +AcpiApeiHestUpdateTable1P ( + VOID + ) +{ + EFI_STATUS Status; + EFI_ACPI_SDT_PROTOCOL *AcpiTableSdtProtocol; + EFI_ACPI_6_3_HARDWARE_ERROR_SOURCE_TABLE_HEADER *HestTablePointer; + UINTN TableKey; + UINTN TableIndex; + + Status =3D gBS->LocateProtocol (&gEfiAcpiSdtProtocolGuid, NULL, (VOID **= )&AcpiTableSdtProtocol); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "APEI: Unable to locate ACPI table support protoc= ol\n")); + return; + } + + /* + * Search for ACPI Table Signature + */ + TableIndex =3D 0; + Status =3D AcpiLocateTableBySignature ( + AcpiTableSdtProtocol, + EFI_ACPI_6_3_HARDWARE_ERROR_SOURCE_TABLE_SIGNATURE, + &TableIndex, + (EFI_ACPI_DESCRIPTION_HEADER **)&HestTablePointer, + &TableKey + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a:%d Unable to get ACPI HEST table\n", __FUNCTI= ON__, __LINE__)); + return; + } + + HestTablePointer->ErrorSourceCount -=3D HEST_NUM_ENTRIES_PER_SOC; + HestTablePointer->Header.Length -=3D + (HEST_NUM_ENTRIES_PER_SOC * + sizeof (EFI_ACPI_6_3_GENERIC_HARDWARE_ERROR_SOURCE_VERSION_2_STRUCTUR= E)); + + AcpiUpdateChecksum ((UINT8 *)HestTablePointer, HestTablePointer->Header.= Length); +} + +/* + * Update APEI + * + */ +EFI_STATUS +EFIAPI +AcpiApeiUpdate ( + VOID + ) +{ + if (!IsSlaveSocketActive ()) { + AcpiApeiHestUpdateTable1P (); + } + + if (!IsSdeiEnabled ()) { + AcpiApeiUninstallTable (EFI_ACPI_6_3_SOFTWARE_DELEGATED_EXCEPTIONS_INT= ERFACE_TABLE_SIGNATURE); + } + + return EFI_SUCCESS; +} diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiDsdt.c b/P= latform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiDsdt.c new file mode 100644 index 000000000000..82bfbb90f07f --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiDsdt.c @@ -0,0 +1,601 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include + +#include "AcpiNfit.h" +#include "AcpiPlatform.h" + +#define PCIE_DEVICE_CONTROL_OFFSET 0x078 +#define PCIE_DEVICE_CONTROL_UNSUPPORT_REQ_REP_EN 0x08 +#define PCIE_DEVICE_CONTROL_FATAL_ERR_REPORT_EN 0x04 +#define PCIE_DEVICE_CONTROL_NON_FATAL_ERR_REPORT_EN 0x02 +#define PCIE_DEVICE_CONTROL_CORR_ERR_REPORT_EN 0x01 + +#define PCIE_ROOT_ERR_CMD_OFFSET 0x12C +#define PCIE_ROOT_ERR_CMD_FATAL_ERR_REPORTING_EN 0x4 +#define PCIE_ROOT_ERR_CMD_NON_FATAL_ERR_REPORTING_EN 0x2 +#define PCIE_ROOT_ERR_CMD_CORR_ERR_REPORTING_EN 0x1 + +#define PCIE_MAX_DEVICE_PER_ROOT_PORT 8 + +#pragma pack(1) +typedef struct { + UINT8 DWordPrefix; + UINT32 DWordData; +} OP_REGION_DWORD_DATA; + +typedef struct { + UINT8 ExtOpPrefix; + UINT8 ExtOpCode; + UINT8 NameString[4]; + UINT8 RegionSpace; + OP_REGION_DWORD_DATA RegionBase; + OP_REGION_DWORD_DATA RegionLen; +} AML_OP_REGION; +#pragma pack() + +EFI_STATUS +UpdateStatusMethodObject ( + EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol, + EFI_ACPI_HANDLE TableHandle, + CHAR8 *AsciiObjectPath, + CHAR8 ReturnValue + ) +{ + EFI_STATUS Status; + EFI_ACPI_HANDLE ObjectHandle; + EFI_ACPI_DATA_TYPE DataType; + CHAR8 *Buffer; + UINTN DataSize; + + Status =3D AcpiSdtProtocol->FindPath (TableHandle, AsciiObjectPath, &Obj= ectHandle); + if (EFI_ERROR (Status) || ObjectHandle =3D=3D NULL) { + return EFI_SUCCESS; + } + ASSERT (ObjectHandle !=3D NULL); + + Status =3D AcpiSdtProtocol->GetOption (ObjectHandle, 2, &DataType, (VOID= *)&Buffer, &DataSize); + if (!EFI_ERROR (Status) && Buffer[2] =3D=3D AML_BYTE_PREFIX) { + // + // Only patch when the initial value is byte object. + // + Buffer[3] =3D ReturnValue; + } + + AcpiSdtProtocol->Close (ObjectHandle); + return Status; +} + +EFI_STATUS +GetOpRegionBase ( + EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol, + EFI_ACPI_HANDLE TableHandle, + CHAR8 *AsciiObjectPath, + UINT32 *Value + ) +{ + EFI_STATUS Status; + EFI_ACPI_HANDLE ObjectHandle; + EFI_ACPI_DATA_TYPE DataType; + CHAR8 *Buffer; + UINTN DataSize; + AML_OP_REGION *OpRegion; + + Status =3D AcpiSdtProtocol->FindPath (TableHandle, AsciiObjectPath, &Obj= ectHandle); + if (EFI_ERROR (Status)) { + Status =3D EFI_NOT_FOUND; + goto Exit; + } + + Status =3D AcpiSdtProtocol->GetOption (ObjectHandle, 0, &DataType, (VOID= *)&Buffer, &DataSize); + if (!EFI_ERROR (Status) && Buffer !=3D NULL) { + OpRegion =3D (AML_OP_REGION *)Buffer; + + if (OpRegion->ExtOpCode !=3D AML_EXT_REGION_OP + || OpRegion->RegionBase.DWordPrefix !=3D AML_DWORD_PREFIX) + { + AcpiSdtProtocol->Close (TableHandle); + Status =3D EFI_NOT_FOUND; + goto Exit; + } + + *Value =3D OpRegion->RegionBase.DWordData; + } + +Exit: + AcpiSdtProtocol->Close (ObjectHandle); + return Status; +} + +EFI_STATUS +SetOpRegionBase ( + EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol, + EFI_ACPI_HANDLE TableHandle, + CHAR8 *AsciiObjectPath, + UINT32 Value + ) +{ + EFI_STATUS Status; + EFI_ACPI_HANDLE ObjectHandle; + EFI_ACPI_DATA_TYPE DataType; + CHAR8 *Buffer; + UINTN DataSize; + AML_OP_REGION *OpRegion; + + Status =3D AcpiSdtProtocol->FindPath (TableHandle, AsciiObjectPath, &Obj= ectHandle); + if (EFI_ERROR (Status)) { + Status =3D EFI_NOT_FOUND; + goto Exit; + } + + Status =3D AcpiSdtProtocol->GetOption (ObjectHandle, 0, &DataType, (VOID= *)&Buffer, &DataSize); + if (!EFI_ERROR (Status) && Buffer !=3D NULL) { + OpRegion =3D (AML_OP_REGION *)Buffer; + + if (OpRegion->ExtOpCode !=3D AML_EXT_REGION_OP + || OpRegion->RegionBase.DWordPrefix !=3D AML_DWORD_PREFIX) + { + AcpiSdtProtocol->Close (TableHandle); + Status =3D EFI_NOT_FOUND; + goto Exit; + } + + OpRegion->RegionBase.DWordData =3D Value; + } + +Exit: + AcpiSdtProtocol->Close (ObjectHandle); + return Status; +} + +STATIC VOID +AcpiPatchCmn600 ( + EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol, + EFI_ACPI_HANDLE TableHandle + ) +{ + CHAR8 NodePath[256]; + UINTN Index; + + for (Index =3D 0; Index < GetNumberOfSupportedSockets (); Index++) { + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.CMN%1X._STA", Index); + if (GetNumberOfActiveCPMsPerSocket (Index) > 0) { + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePath, 0x= F); + } else { + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePath, 0x= 0); + } + } +} + +STATIC VOID +AcpiPatchDmc620 ( + EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol, + EFI_ACPI_HANDLE TableHandle + ) +{ + CHAR8 NodePath[256]; + UINTN Index, Index1; + PLATFORM_INFO_HOB *PlatformHob; + UINT32 McuMask; + VOID *Hob; + + Hob =3D GetFirstGuidHob (&gPlatformInfoHobGuid); + if (Hob =3D=3D NULL) { + return; + } + + PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + + for (Index =3D 0; Index < GetNumberOfSupportedSockets (); Index++) { + McuMask =3D PlatformHob->DramInfo.McuMask[Index]; + for (Index1 =3D 0; Index1 < sizeof (McuMask) * 8; Index1++) { + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.MC%1X%1X._STA", Ind= ex, Index1); + if (McuMask & (0x1 << Index1)) { + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePath, = 0xF); + } else { + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePath, = 0x0); + } + } + } +} + +STATIC VOID +AcpiPatchNvdimm ( + EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol, + EFI_ACPI_HANDLE TableHandle + ) +{ + CHAR8 NodePath[256]; + UINTN NvdRegionNumSK0, NvdRegionNumSK1, NvdRegionNum, Count; + PLATFORM_INFO_HOB *PlatformHob; + VOID *Hob; + UINT32 OpRegionBase;; + EFI_STATUS Status; + + Hob =3D GetFirstGuidHob (&gPlatformInfoHobGuid); + if (Hob =3D=3D NULL) { + return; + } + PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + + NvdRegionNumSK0 =3D 0; + NvdRegionNumSK1 =3D 0; + for (Count =3D 0; Count < PlatformHob->DramInfo.NumRegion; Count++) { + if (PlatformHob->DramInfo.NvdRegion[Count] > 0) { + if (PlatformHob->DramInfo.Socket[Count] =3D=3D 0) { + NvdRegionNumSK0++; + } else { + NvdRegionNumSK1++; + } + } + } + NvdRegionNum =3D NvdRegionNumSK0 + NvdRegionNumSK1; + + /* Disable NVDIMM Root Device */ + if (NvdRegionNum =3D=3D 0) { + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.NVDR._STA"); + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePath, 0x0); + } + /* Update NVDIMM Device _STA for SK0 */ + if (NvdRegionNumSK0 =3D=3D 0) { + /* Disable NVD1/2 */ + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.NVDR.NVD1._STA"); + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePath, 0x0); + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.NVDR.NVD2._STA"); + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePath, 0x0); + } else if (NvdRegionNumSK0 =3D=3D 1) { + if (PlatformHob->DramInfo.NvdimmMode[NVDIMM_SK0] =3D=3D NvdimmNonHashe= d) { + for (Count =3D 0; Count < PlatformHob->DramInfo.NumRegion; Count++) { + if (PlatformHob->DramInfo.NvdRegion[Count] > 0 && + PlatformHob->DramInfo.Socket[Count] =3D=3D 0) + { + if (PlatformHob->DramInfo.Base[Count] =3D=3D + AC01_NVDIMM_SK0_NHASHED_REGION0_BASE) + { + /* Disable NVD2 */ + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.NVDR.NVD2._ST= A"); + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePa= th, 0x0); + } else if (PlatformHob->DramInfo.Base[Count] =3D=3D + AC01_NVDIMM_SK0_NHASHED_REGION1_BASE) + { + /* Disable NVD1 */ + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.NVDR.NVD1._ST= A"); + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePa= th, 0x0); + } + } + } + } + } + /* Update NVDIMM Device _STA and OpRegions for SK1 */ + if (NvdRegionNumSK1 =3D=3D 0) { + /* Use NVD1 OpRegion base for NVD3 */ + OpRegionBase =3D 0; + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.NVDR.NVD1.BUF1"); + Status =3D GetOpRegionBase (AcpiSdtProtocol, TableHandle, NodePath, &O= pRegionBase); + ASSERT ((!EFI_ERROR (Status)) && (OpRegionBase !=3D 0)); + + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.NVDR.NVD3.BUF1"); + Status =3D SetOpRegionBase (AcpiSdtProtocol, TableHandle, NodePath, Op= RegionBase); + + /* Use NVD2 OpRegion base for NVD4 */ + OpRegionBase =3D 0; + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.NVDR.NVD2.BUF1"); + Status =3D GetOpRegionBase (AcpiSdtProtocol, TableHandle, NodePath, &O= pRegionBase); + ASSERT ((!EFI_ERROR (Status)) && (OpRegionBase !=3D 0)); + + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.NVDR.NVD4.BUF1"); + Status =3D SetOpRegionBase (AcpiSdtProtocol, TableHandle, NodePath, Op= RegionBase); + + /* Disable NVD3/4 */ + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.NVDR.NVD3._STA"); + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePath, 0x0); + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.NVDR.NVD4._STA"); + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePath, 0x0); + } else if (NvdRegionNumSK1 =3D=3D 1) { + if (PlatformHob->DramInfo.NvdimmMode[NVDIMM_SK1] =3D=3D NvdimmNonHashe= d) { + for (Count =3D 0; Count < PlatformHob->DramInfo.NumRegion; Count++) { + if (PlatformHob->DramInfo.NvdRegion[Count] > 0 && + PlatformHob->DramInfo.Socket[Count] =3D=3D 1) + { + if (PlatformHob->DramInfo.Base[Count] =3D=3D + AC01_NVDIMM_SK1_NHASHED_REGION0_BASE) + { + /* Disable NVD4 */ + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.NVDR.NVD4._ST= A"); + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePa= th, 0x0); + } else if (PlatformHob->DramInfo.Base[Count] =3D=3D + AC01_NVDIMM_SK1_NHASHED_REGION1_BASE) + { + /* Disable NVD3 */ + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.NVDR.NVD3._ST= A"); + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePa= th, 0x0); + } + } + } + } + } +} + +STATIC VOID +AcpiPatchHwmon ( + EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol, + EFI_ACPI_HANDLE TableHandle + ) +{ + CHAR8 NodePath[256]; + UINT8 Index; + + // PCC Hardware Monitor Devices + for (Index =3D 0; Index < GetNumberOfSupportedSockets (); Index++) { + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.HM0%1X._STA", Index); + if (GetNumberOfActiveCPMsPerSocket (Index) > 0) { + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePath, 0x= F); + } else { + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePath, 0x= 0); + } + } + + // Ampere Altra SoC Hardware Monitor Devices + for (Index =3D 0; Index < GetNumberOfSupportedSockets (); Index++) { + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.HM0%1X._STA", Index += 2); + if (GetNumberOfActiveCPMsPerSocket (Index) > 0) { + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePath, 0x= F); + } else { + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePath, 0x= 0); + } + } +} + +STATIC VOID +AcpiPatchDsu ( + EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol, + EFI_ACPI_HANDLE TableHandle + ) +{ + CHAR8 NodePath[256]; + UINTN Index; + + for (Index =3D 0; Index < PLATFORM_CPU_MAX_NUM_CORES; Index +=3D PLATFOR= M_CPU_NUM_CORES_PER_CPM) { + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.DU%2X._STA", Index / = PLATFORM_CPU_NUM_CORES_PER_CPM); + if (IsCpuEnabled (Index)) { + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePath, 0x= F); + } else { + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePath, 0x= 0); + } + } +} + +VOID +AcpiPatchPcieNuma ( + EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol, + EFI_ACPI_HANDLE TableHandle + ) +{ + CHAR8 NodePath[256]; + UINTN Index; + UINTN NumaIdx; + UINTN NumPciePort; + UINTN NumaAssignment[3][16] =3D { + { 0, 0, 0, 0, 0, 0, 0, 0, // Monolithic Node 0 (S0) + 1, 1, 1, 1, 1, 1, 1, 1 }, // Monolithic Node 1 (S1) + { 0, 1, 0, 1, 0, 0, 1, 1, // Hemisphere Node 0, 1 (S0) + 2, 3, 2, 3, 2, 2, 3, 3 }, // Hemisphere Node 2, 3 (S1) + { 0, 2, 1, 3, 1, 1, 3, 3, // Quadrant Node 0, 1, 2, 3 (S0) + 4, 6, 5, 7, 5, 5, 7, 7 }, // Quadrant Node 4, 5, 6, 7 (S1) + }; + + switch (CpuGetSubNumaMode ()) { + case SUBNUMA_MODE_MONOLITHIC: + NumaIdx =3D 0; + break; + + case SUBNUMA_MODE_HEMISPHERE: + NumaIdx =3D 1; + break; + + case SUBNUMA_MODE_QUADRANT: + NumaIdx =3D 2; + break; + + default: + NumaIdx =3D 0; + break; + } + + if (IsSlaveSocketActive ()) { + NumPciePort =3D 16; // 16 ports total (8 per socket) + } else { + NumPciePort =3D 8; // 8 ports total + } + + for (Index =3D 0; Index < NumPciePort; Index++) { + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.PCI%X._PXM", Index); + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePath, Numa= Assignment[NumaIdx][Index]); + } +} + +EFI_STATUS +AcpiPatchPcieAerFwFirst ( + EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol, + EFI_ACPI_HANDLE TableHandle + ) +{ + EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS Address; + EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo; + EFI_HANDLE *HandleBuffer; + UINTN HandleCount; + CHAR8 ObjectPath[8]; + EFI_STATUS Status; + UINT32 AerFwFirstConfigValue; + UINT32 RegData; + UINT16 Device; + UINT32 Index; + + // + // Check if PCIe AER Firmware First should be enabled + // + Status =3D NVParamGet ( + NV_SI_RAS_PCIE_AER_FW_FIRST, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &AerFwFirstConfigValue + ); + if (EFI_ERROR (Status)) { + Status =3D NVParamGet ( + NV_SI_RO_BOARD_PCIE_AER_FW_FIRST, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &AerFwFirstConfigValue + ); + if (EFI_ERROR (Status)) { + AerFwFirstConfigValue =3D 0; + } + } + + if (AerFwFirstConfigValue =3D=3D 0) { + // + // By default, the PCIe AER FW-First (ACPI Object "AERF") is set to 0 + // in the DSDT table. + // + return EFI_SUCCESS; + } + + // + // Update Name Object "AERF" (PCIe AER Firmware-First) to enable PCIe AE= R Firmware-First + // + AsciiSPrint (ObjectPath, sizeof (ObjectPath), "\\AERF"); + Status =3D AcpiAmlObjectUpdateInteger (AcpiSdtProtocol, TableHandle, Obj= ectPath, 1); + + // + // For PCIe AER Firmware First, PCIe capability registers need + // to be updated to allow Firmware to detect AER errors. + // + + HandleCount =3D 0; + HandleBuffer =3D NULL; + PciRootBridgeIo =3D NULL; + + Status =3D gBS->LocateHandleBuffer ( + ByProtocol, + &gEfiPciRootBridgeIoProtocolGuid, + NULL, + &HandleCount, + &HandleBuffer + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Loop through each root complex + // + for (Index =3D 0; Index < HandleCount; Index++) { + Status =3D gBS->HandleProtocol ( + HandleBuffer[Index], + &gEfiPciRootBridgeIoProtocolGuid, + (VOID **)&PciRootBridgeIo + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Loop through each root port + // + for (Device =3D 1; Device <=3D PCIE_MAX_DEVICE_PER_ROOT_PORT; Device++= ) { + Address.Bus =3D 0; + Address.Device =3D Device; + Address.Function =3D 0; + Address.Register =3D 0; + + Address.ExtendedRegister =3D PCIE_DEVICE_CONTROL_OFFSET; + PciRootBridgeIo->Pci.Read (PciRootBridgeIo, EfiPciWidthUint32, *((UI= NT64 *)&Address), 1, &RegData); + + if (RegData =3D=3D 0xFFFFFFFF) { + continue; + } + + RegData |=3D PCIE_DEVICE_CONTROL_UNSUPPORT_REQ_REP_EN + | PCIE_DEVICE_CONTROL_FATAL_ERR_REPORT_EN + | PCIE_DEVICE_CONTROL_NON_FATAL_ERR_REPORT_EN + | PCIE_DEVICE_CONTROL_CORR_ERR_REPORT_EN; + + PciRootBridgeIo->Pci.Write (PciRootBridgeIo, EfiPciWidthUint32, *((U= INT64 *)&Address), 1, &RegData); + + RegData =3D 0; + Address.ExtendedRegister =3D PCIE_ROOT_ERR_CMD_OFFSET; + PciRootBridgeIo->Pci.Read (PciRootBridgeIo, EfiPciWidthUint32, *((UI= NT64 *)&Address), 1, &RegData); + + RegData |=3D PCIE_ROOT_ERR_CMD_FATAL_ERR_REPORTING_EN + | PCIE_ROOT_ERR_CMD_NON_FATAL_ERR_REPORTING_EN + | PCIE_ROOT_ERR_CMD_CORR_ERR_REPORTING_EN; + + PciRootBridgeIo->Pci.Write (PciRootBridgeIo, EfiPciWidthUint32, *((U= INT64 *)&Address), 1, &RegData); + } + } + + return Status; +} + +EFI_STATUS +AcpiPatchDsdtTable ( + VOID + ) +{ + EFI_STATUS Status; + EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol; + EFI_ACPI_DESCRIPTION_HEADER *Table; + UINTN TableKey; + UINTN TableIndex; + EFI_ACPI_HANDLE TableHandle; + + Status =3D gBS->LocateProtocol ( + &gEfiAcpiSdtProtocolGuid, + NULL, + (VOID **)&AcpiSdtProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Unable to locate ACPI table protocol\n")); + return Status; + } + + TableIndex =3D 0; + Status =3D AcpiLocateTableBySignature ( + AcpiSdtProtocol, + EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATUR= E, + &TableIndex, + &Table, + &TableKey + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "ACPI DSDT table not found!\n")); + ASSERT_EFI_ERROR (Status); + return Status; + } + + Status =3D AcpiSdtProtocol->OpenSdt (TableKey, &TableHandle); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + AcpiSdtProtocol->Close (TableHandle); + return Status; + } + + AcpiPatchCmn600 (AcpiSdtProtocol, TableHandle); + AcpiPatchDmc620 (AcpiSdtProtocol, TableHandle); + AcpiPatchDsu (AcpiSdtProtocol, TableHandle); + AcpiPatchHwmon (AcpiSdtProtocol, TableHandle); + AcpiPatchNvdimm (AcpiSdtProtocol, TableHandle); + AcpiPatchPcieNuma (AcpiSdtProtocol, TableHandle); + AcpiPatchPcieAerFwFirst (AcpiSdtProtocol, TableHandle); + + AcpiSdtProtocol->Close (TableHandle); + AcpiUpdateChecksum ((UINT8 *)Table, Table->Length); + + return EFI_SUCCESS; +} diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiMadt.c b/P= latform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiMadt.c new file mode 100644 index 000000000000..419ce578e452 --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiMadt.c @@ -0,0 +1,348 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "AcpiPlatform.h" + +EFI_ACPI_6_3_GIC_ITS_STRUCTURE GicItsTemplate =3D { + EFI_ACPI_6_3_GIC_ITS, + sizeof (EFI_ACPI_6_3_GIC_ITS_STRUCTURE), + EFI_ACPI_RESERVED_WORD, + 0, /* GicItsId */ + 0, /* PhysicalBaseAddress */ + 0, /* Reserved2 */ +}; + +EFI_ACPI_6_3_GICR_STRUCTURE GicRTemplate =3D { + EFI_ACPI_6_3_GICR, + sizeof (EFI_ACPI_6_3_GICR_STRUCTURE), + EFI_ACPI_RESERVED_WORD, + AC01_GICR_MASTER_BASE_ADDRESS, /* DiscoveryRangeBaseAddress */ + 0x1000000, /* DiscoveryRangeLength */ +}; + +EFI_ACPI_6_3_GIC_DISTRIBUTOR_STRUCTURE GicDTemplate =3D { + EFI_ACPI_6_3_GICD, + sizeof (EFI_ACPI_6_3_GIC_DISTRIBUTOR_STRUCTURE), + EFI_ACPI_RESERVED_WORD, + 0, /* GicDistHwId */ + AC01_GICD_MASTER_BASE_ADDRESS, /* GicDistBase */ + 0, /* GicDistVector */ + 0x3, /* GicVersion */ + {EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE} +}; + +EFI_ACPI_6_3_GIC_STRUCTURE GiccTemplate =3D { + EFI_ACPI_6_3_GIC, + sizeof (EFI_ACPI_6_3_GIC_STRUCTURE), + EFI_ACPI_RESERVED_WORD, + 0, /* GicId */ + 0, /* AcpiCpuUid */ + 0, /* Flags */ + 0, + 23, /* PmuIrq */ + 0, + 0, + 0, + 0, + 25, /* GsivId */ + 0, /* GicRBase */ + 0, /* Mpidr */ + 0, /* ProcessorPowerEfficiencyClass */ + 0, /* Reserved2 */ + 21, /* SPE irq */ +}; + +EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER MADTTableHeaderTemplat= e =3D { + __ACPI_HEADER ( + EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, + 0, /* need fill in */ + EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION + ), +}; + +UINT32 Ac01CoreOrderMonolithic[PLATFORM_CPU_MAX_CPM * PLATFORM_CPU_NUM_COR= ES_PER_CPM] =3D { + 36, 52, 40, 56, 32, 48, 44, 60, + 20, 68, 24, 72, 16, 64, 28, 76, + 4, 8, 0, 12, 38, 54, 42, 58, + 34, 50, 46, 62, 22, 70, 26, 74, + 18, 66, 30, 78, 6, 10, 2, 14, + 37, 53, 41, 57, 33, 49, 45, 61, + 21, 69, 25, 73, 17, 65, 29, 77, + 5, 9, 1, 13, 39, 55, 43, 59, + 35, 51, 47, 63, 23, 71, 27, 75, + 19, 67, 31, 79, 7, 11, 3, 15, +}; + +UINT32 Ac01CoreOrderHemisphere[PLATFORM_CPU_MAX_CPM * PLATFORM_CPU_NUM_COR= ES_PER_CPM] =3D { + 32, 48, 16, 64, 36, 52, 0, 20, + 68, 4, 34, 50, 18, 66, 38, 54, + 2, 22, 70, 6, 33, 49, 17, 65, + 37, 53, 1, 21, 69, 5, 35, 51, + 19, 67, 39, 55, 3, 23, 71, 7, + 44, 60, 28, 76, 40, 56, 12, 24, + 72, 8, 46, 62, 30, 78, 42, 58, + 14, 26, 74, 10, 45, 61, 29, 77, + 41, 57, 13, 25, 73, 9, 47, 63, + 31, 79, 43, 59, 15, 27, 75, 11, +}; + +UINT32 Ac01CoreOrderQuadrant[PLATFORM_CPU_MAX_CPM * PLATFORM_CPU_NUM_CORES= _PER_CPM] =3D { + 16, 32, 0, 20, 4, 18, 34, 2, + 22, 6, 17, 33, 1, 21, 5, 19, + 35, 3, 23, 7, 48, 64, 52, 68, + 36, 50, 66, 54, 70, 38, 49, 65, + 53, 69, 37, 51, 67, 55, 71, 39, + 28, 44, 12, 24, 8, 30, 46, 14, + 26, 10, 29, 45, 13, 25, 9, 31, + 47, 15, 27, 11, 60, 76, 56, 72, + 40, 62, 78, 58, 74, 42, 61, 77, + 57, 73, 41, 63, 79, 59, 75, 43, +}; + +EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *MadtTablePointer; + +UINT32 * +CpuGetCoreOrder ( + VOID + ) +{ + UINT8 SubNumaMode; + + SubNumaMode =3D CpuGetSubNumaMode (); + switch (SubNumaMode) { + case SUBNUMA_MODE_MONOLITHIC: + return (UINT32 *)&Ac01CoreOrderMonolithic; + + case SUBNUMA_MODE_HEMISPHERE: + return (UINT32 *)&Ac01CoreOrderHemisphere; + + case SUBNUMA_MODE_QUADRANT: + return (UINT32 *)&Ac01CoreOrderQuadrant; + + default: + // Should never reach here + ASSERT (FALSE); + return NULL; + } + + return NULL; +} + +UINT32 +AcpiInstallMadtProcessorNode ( + VOID *EntryPointer, + UINT32 CpuId + ) +{ + EFI_ACPI_6_3_GIC_STRUCTURE *MadtProcessorEntryPointer =3D EntryPointer; + UINT32 SocketId; + UINT32 ClusterId; + UINTN Size; + + Size =3D sizeof (GiccTemplate); + CopyMem (MadtProcessorEntryPointer, &GiccTemplate, Size); + + SocketId =3D SOCKET_ID (CpuId); + ClusterId =3D CLUSTER_ID (CpuId); + + // + // GICv2 compatibility mode is not supported. + // Hence, set GIC's CPU Interface Number to 0. + // + MadtProcessorEntryPointer->CPUInterfaceNumber =3D 0; + MadtProcessorEntryPointer->AcpiProcessorUid =3D + (SocketId << PLATFORM_SOCKET_UID_BIT_OFFSET) + + (ClusterId << 8) + (CpuId % PLATFORM_CPU_NUM_CORES_PER_CPM); + MadtProcessorEntryPointer->Flags =3D 1; + MadtProcessorEntryPointer->MPIDR =3D + (((ClusterId << 8) + (CpuId % PLATFORM_CPU_NUM_CORES_PER_CPM)) << 8); + MadtProcessorEntryPointer->MPIDR +=3D (((UINT64)SocketId) << 32); + + return Size; +} + +UINT32 +AcpiInstallMadtGicD ( + VOID *EntryPointer + ) +{ + EFI_ACPI_6_3_GIC_DISTRIBUTOR_STRUCTURE *GicDEntryPointer =3D EntryPointe= r; + UINTN Size; + + Size =3D sizeof (GicDTemplate); + CopyMem (GicDEntryPointer, &GicDTemplate, Size); + + return Size; +} + +UINT32 +AcpiInstallMadtGicR ( + VOID *EntryPointer, + UINT32 SocketId + ) +{ + EFI_ACPI_6_3_GICR_STRUCTURE *GicREntryPointer =3D EntryPointer; + UINTN Size; + + /* + * If the Slave socket is not present, discard the Slave socket + * GIC redistributor region + */ + if (SocketId =3D=3D 1 && !IsSlaveSocketActive ()) { + return 0; + } + + Size =3D sizeof (GicRTemplate); + CopyMem (GicREntryPointer, &GicRTemplate, Size); + + if (SocketId =3D=3D 1) { + GicREntryPointer->DiscoveryRangeBaseAddress =3D AC01_GICR_SLAVE_BASE_A= DDRESS; + } + + return Size; +} + +UINT32 +AcpiInstallMadtGicIts ( + VOID *EntryPointer, + UINT32 Index + ) +{ + EFI_ACPI_6_3_GIC_ITS_STRUCTURE *GicItsEntryPointer =3D EntryPointer; + UINTN Size, Offset; + UINT64 GicBase =3D AC01_GICD_MASTER_BASE_ADDRESS; + UINT32 ItsId =3D Index; + + if (Index > SOCKET0_LAST_RC) { /* Socket 1, Index: 8-15 */ + GicBase =3D AC01_GICD_SLAVE_BASE_ADDRESS; + Index -=3D (SOCKET0_LAST_RC + 1); /* Socket 1, Index:8 -> RCA0 */ + } + Size =3D sizeof (GicItsTemplate); + CopyMem (GicItsEntryPointer, &GicItsTemplate, Size); + Offset =3D 0x40000 + Index * 0x20000; + GicItsEntryPointer->GicItsId =3D ItsId; + GicItsEntryPointer->PhysicalBaseAddress =3D Offset + GicBase; + + return Size; +} + +/* + * Install MADT table. + */ +EFI_STATUS +AcpiInstallMadtTable ( + VOID + ) +{ + EFI_ACPI_6_3_GIC_STRUCTURE *GiccEntryPointer =3D NULL; + EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; + UINTN MadtTableKey =3D 0; + INTN Index; + EFI_STATUS Status; + UINTN Size; + UINT32 *CoreOrder; + UINT32 SktMaxCoreNum; + + Status =3D gBS->LocateProtocol ( + &gEfiAcpiTableProtocolGuid, + NULL, + (VOID **)&AcpiTableProtocol + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Size =3D sizeof (MADTTableHeaderTemplate) + + (PLATFORM_CPU_MAX_NUM_CORES * sizeof (GiccTemplate)) + + sizeof (GicDTemplate) + + (PLATFORM_CPU_MAX_SOCKET * sizeof (GicRTemplate)) + + ((SOCKET0_LAST_RC - SOCKET0_FIRST_RC + 1) * sizeof (GicItsTempl= ate)); + if (IsSlaveSocketActive ()) { + Size +=3D ((SOCKET1_LAST_RC - SOCKET1_FIRST_RC + 1) * sizeof (GicItsT= emplate)); + } else if (!IsSlaveSocketAvailable ()) { + Size +=3D 2 * sizeof (GicItsTemplate); /* RCA0/1 */ + } + + MadtTablePointer =3D + (EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *)AllocateZeroPoo= l (Size); + if (MadtTablePointer =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + GiccEntryPointer =3D + (EFI_ACPI_6_3_GIC_STRUCTURE *)((UINT64)MadtTablePointer + + sizeof (MADTTableHeaderTemplate)); + + /* Install Gic interface for each processor */ + Size =3D 0; + CoreOrder =3D CpuGetCoreOrder (); + ASSERT (CoreOrder !=3D NULL); + SktMaxCoreNum =3D PLATFORM_CPU_MAX_CPM * PLATFORM_CPU_NUM_CORES_PER_CPM; + for (Index =3D 0; Index < SktMaxCoreNum; Index++) { + if (IsCpuEnabled (CoreOrder[Index])) { + Size +=3D AcpiInstallMadtProcessorNode ((VOID *)((UINT64)GiccEntryPo= inter + Size), CoreOrder[Index]); + } + } + + for (Index =3D 0; Index < SktMaxCoreNum; Index++) { + if (IsCpuEnabled (CoreOrder[Index] + SktMaxCoreNum)) { + Size +=3D AcpiInstallMadtProcessorNode ((VOID *)((UINT64)GiccEntryPo= inter + Size), CoreOrder[Index] + SktMaxCoreNum); + } + } + + /* Install Gic Distributor */ + Size +=3D AcpiInstallMadtGicD ((VOID *)((UINT64)GiccEntryPointer + Size)= ); + + /* Install Gic Redistributor */ + for (Index =3D 0; Index < PLATFORM_CPU_MAX_SOCKET; Index++) { + Size +=3D AcpiInstallMadtGicR ((VOID *)((UINT64)GiccEntryPointer + Siz= e), Index); + } + + /* Install Gic ITS */ + if (!IsSlaveSocketAvailable ()) { + for (Index =3D 0; Index <=3D 1; Index++) { /* RCA0/1 */ + Size +=3D AcpiInstallMadtGicIts ((VOID *)((UINT64)GiccEntryPointer += Size), Index); + } + } + for (Index =3D SOCKET0_FIRST_RC; Index <=3D SOCKET0_LAST_RC; Index++) { + Size +=3D AcpiInstallMadtGicIts ((VOID *)((UINT64)GiccEntryPointer + S= ize), Index); + } + if (IsSlaveSocketActive ()) { + for (Index =3D SOCKET1_FIRST_RC; Index <=3D SOCKET1_LAST_RC; Index++) { + Size +=3D AcpiInstallMadtGicIts ((VOID *)((UINT64)GiccEntryPointer += Size), Index); + } + } + CopyMem ( + MadtTablePointer, + &MADTTableHeaderTemplate, + sizeof (MADTTableHeaderTemplate) + ); + + Size +=3D sizeof (MADTTableHeaderTemplate); + MadtTablePointer->Header.Length =3D Size; + CopyMem ( + MadtTablePointer->Header.OemId, + PcdGetPtr (PcdAcpiDefaultOemId), + sizeof (MadtTablePointer->Header.OemId) + ); + + AcpiUpdateChecksum ((UINT8 *)MadtTablePointer, MadtTablePointer->Header.= Length); + + Status =3D AcpiTableProtocol->InstallAcpiTable ( + AcpiTableProtocol, + (VOID *)MadtTablePointer, + MadtTablePointer->Header.Length, + &MadtTableKey + ); + FreePool ((VOID *)MadtTablePointer); + if (EFI_ERROR (Status)) { + return Status; + } + + return EFI_SUCCESS; +} diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiNfit.c b/P= latform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiNfit.c new file mode 100644 index 000000000000..dd6843dc8164 --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiNfit.c @@ -0,0 +1,596 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "AcpiNfit.h" +#include "AcpiPlatform.h" + +EFI_ACPI_6_3_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE NfitSPATemplate = =3D { + EFI_ACPI_6_3_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE_TYPE, + sizeof (EFI_ACPI_6_3_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE), + 0, // The= uniue index - need to be filled. + 0, // The= flags - need to be filled. + 0, // Res= erved. + 0, // Pro= ximity domain - need to be filled. + EFI_ACPI_6_3_NFIT_GUID_BYTE_ADDRESSABLE_PERSISTENT_MEMORY_REGION, // PM = range type. + 0, // Sta= rt address - need to be filled. + 0, // Siz= e - need to be filled. + EFI_MEMORY_UC | EFI_MEMORY_WC | EFI_MEMORY_WT | EFI_MEMORY_WB | + EFI_MEMORY_WP | EFI_MEMORY_UCE, // attribute - need to be filled. +}; + +EFI_ACPI_6_3_NFIT_NVDIMM_CONTROL_REGION_STRUCTURE NvdimmControlRegionTempl= ate =3D { + EFI_ACPI_6_3_NFIT_NVDIMM_CONTROL_REGION_STRUCTURE_TYPE, + sizeof (EFI_ACPI_6_3_NFIT_NVDIMM_CONTROL_REGION_STRUCTURE), + 0, // The unique index - need to be filled. + 0, // The vendor id - need to be filled. + 0, // The device id - need to be filled. + 0, // The revision - need to be filled. + 0, // The subsystem nvdimm id - need to be filled. + 0, // The subsystem nvdimm device id - need to be filled. + 0, // The subsystem revision - need to be filled. + 0, // The valid field. + 0, // The manufacturing location - not valid. + 0, // The manufacturing date - not valid. + {0}, // Reserved. + 0, // The serial number - need to be filled. + 0, // The region format interface code - dummy value. + 0, // The number of block control windows. + 0, // The size of block control windows. + 0, // The Command Register Offset in Block Control Window. + 0, // The Size of Command Register in Block Control Windows. + 0, // The Status Register Offset in Block Control Window. + 0, // Size of Status Register in Block Control Windows. + 0, // The NVDIMM Control Region Flag. + {0}, // Reserved. +}; + +EFI_ACPI_6_3_NFIT_NVDIMM_REGION_MAPPING_STRUCTURE NvdimmRegionMappingTempl= ate =3D { + EFI_ACPI_6_3_NFIT_NVDIMM_REGION_MAPPING_STRUCTURE_TYPE, + sizeof (EFI_ACPI_6_3_NFIT_NVDIMM_REGION_MAPPING_STRUCTURE), + {0}, // _ADR of the NVDIMM device - need to be filled. + 0, // Dimm smbios handle index - need to be filled. + 0, // The unique region index - need to be filled. + 0, // The SPA range index - need to be filled. + 0, // The control region index - need to be filled. + 0, // The region size - need to be filled. + 0, // The region offset - need to be filled. + 0, // The region base - need to be filled. + 0, // The interleave structure index - need to be filled. + 0, // The interleave ways - need to be filled. + 0, // NVDIMM flags - need to be filled. + 0, // Reserved. +}; + +EFI_ACPI_6_3_NVDIMM_FIRMWARE_INTERFACE_TABLE NFITTableHeaderTemplate =3D { + __ACPI_HEADER ( + EFI_ACPI_6_3_NVDIMM_FIRMWARE_INTERFACE_TABLE_STRUCTURE_SIGNATURE, + 0, /* need fill in */ + EFI_ACPI_6_3_NVDIMM_FIRMWARE_INTERFACE_TABLE_REVISION + ), + 0x00000000, // Reserved +}; + +NVDIMM_DATA NvdData[PLATFORM_CPU_MAX_SOCKET] =3D { { 0 } }; + +EFI_STATUS +AcpiNvdInfoInit ( + IN OUT NVDIMM_INFO *NvdInfoPtr, + IN UINTN NvdId + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + VOID *Hob; + + /* Get the Platform HOB */ + Hob =3D GetFirstGuidHob (&gPlatformInfoHobGuid); + if (Hob =3D=3D NULL || NvdInfoPtr =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + + NvdInfoPtr->Enabled =3D TRUE; + NvdInfoPtr->PhysId =3D NvdId; + NvdInfoPtr->NvdSize =3D PlatformHob->DimmList.Dimm[NvdId].Info.DimmSize = * ONE_GB; + NvdInfoPtr->VendorId =3D + *((UINT16 *)&PlatformHob->DimmList.Dimm[NvdId].SpdData.Data[320]); + NvdInfoPtr->DeviceId =3D + *((UINT16 *)&PlatformHob->DimmList.Dimm[NvdId].SpdData.Data[192]); + NvdInfoPtr->RevisionId =3D + (UINT16)PlatformHob->DimmList.Dimm[NvdId].SpdData.Data[349]; + NvdInfoPtr->SubVendorId =3D + *((UINT16 *)&PlatformHob->DimmList.Dimm[NvdId].SpdData.Data[194]); + NvdInfoPtr->SubDeviceId =3D + *((UINT16 *)&PlatformHob->DimmList.Dimm[NvdId].SpdData.Data[196]); + NvdInfoPtr->SubRevisionId =3D + (UINT16)PlatformHob->DimmList.Dimm[NvdId].SpdData.Data[198]; + NvdInfoPtr->SerialNumber =3D + *((UINT32 *)&PlatformHob->DimmList.Dimm[NvdId].SpdData.Data[325]); + + return EFI_SUCCESS; +} + +EFI_STATUS +AcpiNvdDataInit ( + IN UINTN Socket + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + NVDIMM_INFO *NvdInfo; + UINTN Count; + VOID *Hob; + UINTN NvdRegionNum, RegionId; + + /* Get the Platform HOB */ + Hob =3D GetFirstGuidHob (&gPlatformInfoHobGuid); + if (Hob =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + + NvdRegionNum =3D 0; + for (Count =3D 0; Count < PlatformHob->DramInfo.NumRegion; Count++) { + if (PlatformHob->DramInfo.NvdRegion[Count] !=3D 0 + && (PlatformHob->DramInfo.Socket[Count] =3D=3D Socket)) + { + NvdData[Socket].NvdRegionId[NvdRegionNum] =3D Count; + NvdRegionNum++; + } + } + if (NvdRegionNum =3D=3D 0) { + return EFI_SUCCESS; + } + + NvdData[Socket].NvdRegionNum =3D NvdRegionNum; + NvdData[Socket].NvdMode =3D PlatformHob->DramInfo.NvdimmMode[Socket]; + if (NvdData[Socket].NvdMode =3D=3D NvdimmHashed) { + NvdInfo =3D &NvdData[Socket].NvdInfo[NVDIMM_SK0]; + NvdInfo->DeviceHandle =3D + (Socket =3D=3D 0) ? AC01_NVDIMM_NVD1_DEVICE_HANDLE : + AC01_NVDIMM_NVD3_DEVICE_HANDLE; + NvdInfo->InterleaveWays =3D AC01_NVDIMM_HASHED_INTERLEAVE_WAYS; + NvdInfo->RegionOffset =3D 0; + AcpiNvdInfoInit ( + NvdInfo, + (Socket =3D=3D 0) ? AC01_NVDIMM_NVD1_DIMM_ID : + AC01_NVDIMM_NVD3_DIMM_ID + ); + + NvdInfo =3D &NvdData[Socket].NvdInfo[1]; + NvdInfo->DeviceHandle =3D + (Socket =3D=3D 0) ? AC01_NVDIMM_NVD2_DEVICE_HANDLE : + AC01_NVDIMM_NVD4_DEVICE_HANDLE; + NvdInfo->InterleaveWays =3D AC01_NVDIMM_HASHED_INTERLEAVE_WAYS; + NvdInfo->RegionOffset =3D AC01_NVDIMM_HASHED_REGION_OFFSET; + AcpiNvdInfoInit ( + NvdInfo, + (Socket =3D=3D 0) ? AC01_NVDIMM_NVD2_DIMM_ID : + AC01_NVDIMM_NVD4_DIMM_ID + ); + + /* Update NvdNum */ + NvdData[Socket].NvdNum =3D 0; + for (Count =3D 0; Count < NVDIMM_NUM_PER_SK; Count++) { + if (NvdData[Socket].NvdInfo[Count].Enabled) { + NvdData[Socket].NvdNum++; + } + } + return EFI_SUCCESS; + } + /* NvdimmNonHashed */ + NvdData[Socket].NvdNum =3D 0; + for (Count =3D 0; Count < NvdData[Socket].NvdRegionNum; Count++) { + RegionId =3D NvdData[Socket].NvdRegionId[Count]; + if (PlatformHob->DramInfo.Base[RegionId] =3D=3D + AC01_NVDIMM_SK0_NHASHED_REGION0_BASE || + PlatformHob->DramInfo.Base[RegionId] =3D=3D + AC01_NVDIMM_SK1_NHASHED_REGION0_BASE) + { + NvdInfo =3D &NvdData[Socket].NvdInfo[0]; + NvdInfo->DeviceHandle =3D + (Socket =3D=3D 0) ? AC01_NVDIMM_NVD1_DEVICE_HANDLE : + AC01_NVDIMM_NVD3_DEVICE_HANDLE; + NvdInfo->InterleaveWays =3D AC01_NVDIMM_NHASHED_INTERLEAVE_WAYS; + NvdInfo->RegionOffset =3D 0; + AcpiNvdInfoInit ( + NvdInfo, + (Socket =3D=3D 0) ? AC01_NVDIMM_NVD1_DIMM_ID : + AC01_NVDIMM_NVD3_DIMM_ID + ); + + } else if (PlatformHob->DramInfo.Base[RegionId] =3D=3D + AC01_NVDIMM_SK0_NHASHED_REGION1_BASE || + PlatformHob->DramInfo.Base[RegionId] =3D=3D + AC01_NVDIMM_SK1_NHASHED_REGION1_BASE) + { + NvdInfo =3D &NvdData[Socket].NvdInfo[1]; + NvdInfo->DeviceHandle =3D + (Socket =3D=3D 0) ? AC01_NVDIMM_NVD2_DEVICE_HANDLE : + AC01_NVDIMM_NVD4_DEVICE_HANDLE; + NvdInfo->InterleaveWays =3D AC01_NVDIMM_NHASHED_INTERLEAVE_WAYS; + NvdInfo->RegionOffset =3D 0; + AcpiNvdInfoInit ( + NvdInfo, + (Socket =3D=3D 0) ? AC01_NVDIMM_NVD2_DIMM_ID : + AC01_NVDIMM_NVD4_DIMM_ID + ); + } + } + /* Update NvdNum */ + NvdData[Socket].NvdNum =3D 0; + for (Count =3D 0; Count < NVDIMM_NUM_PER_SK; Count++) { + if (NvdData[Socket].NvdInfo[Count].Enabled) { + NvdData[Socket].NvdNum++; + } + } + return EFI_SUCCESS; +} + +/* + * Fill in SPA structure + */ +VOID +AcpiNfitFillSPA ( + IN OUT EFI_ACPI_6_3_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE *NfitSp= aPointer, + IN UINTN NvdRegi= onIndex, + IN UINT64 NvdRegi= onBase, + IN UINT64 NvdRegi= onSize + ) +{ + ASSERT (NfitSpaPointer !=3D NULL); + + NfitSpaPointer->Flags =3D 0; + NfitSpaPointer->SPARangeStructureIndex =3D NvdRegionIndex; + NfitSpaPointer->SystemPhysicalAddressRangeBase =3D NvdRegionBase; + NfitSpaPointer->SystemPhysicalAddressRangeLength =3D NvdRegionSize; +} + +VOID +NfitFillControlRegion ( + IN OUT EFI_ACPI_6_3_NFIT_NVDIMM_CONTROL_REGION_STRUCTURE *NfitControlReg= ionPointer, + IN NVDIMM_INFO *NvdInfo, + IN UINTN NvdControlRegio= nIndex + ) +{ + ASSERT ( + NfitControlRegionPointer !=3D NULL + && NvdInfo !=3D NULL + ); + + NfitControlRegionPointer->NVDIMMControlRegionStructureIndex =3D + NvdControlRegionIndex; + NfitControlRegionPointer->VendorID =3D NvdInfo->VendorId; + NfitControlRegionPointer->DeviceID =3D NvdInfo->DeviceId; + NfitControlRegionPointer->RevisionID =3D NvdInfo->RevisionId; + NfitControlRegionPointer->SubsystemVendorID =3D NvdInfo->SubVendorId; + NfitControlRegionPointer->SubsystemDeviceID =3D NvdInfo->SubDeviceId; + NfitControlRegionPointer->SubsystemRevisionID =3D NvdInfo->SubRevisionId; + NfitControlRegionPointer->SerialNumber =3D NvdInfo->SerialNumber; +} + +VOID +NfitFillRegionMapping ( + IN OUT EFI_ACPI_6_3_NFIT_NVDIMM_REGION_MAPPING_STRUCTURE *NfitRe= gionMappingPointer, + IN EFI_ACPI_6_3_NFIT_NVDIMM_CONTROL_REGION_STRUCTURE *NfitCo= ntrolRegionPointer, + IN EFI_ACPI_6_3_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE *NfitSp= aPointer, + IN NVDIMM_INFO *NvdInf= o, + IN UINTN NvdRegi= onID + ) +{ + ASSERT ( + NfitRegionMappingPointer !=3D NULL + && NfitRegionMappingPointer !=3D NULL + && NfitRegionMappingPointer !=3D NULL + && NfitRegionMappingPointer !=3D NULL + && NvdInfo !=3D NULL + ); + + NfitRegionMappingPointer->NVDIMMRegionID =3D NvdRegionID; + NfitRegionMappingPointer->NVDIMMPhysicalID =3D NvdInfo->PhysId; + NfitRegionMappingPointer->InterleaveWays =3D NvdInfo->InterleaveWays; + NfitRegionMappingPointer->RegionOffset =3D NvdInfo->RegionOffset; + NfitRegionMappingPointer->NVDIMMRegionSize =3D NvdInfo->NvdSize; + NfitRegionMappingPointer->NFITDeviceHandle.DIMMNumber =3D + NvdInfo->DeviceHandle & 0x0F; + NfitRegionMappingPointer->NFITDeviceHandle.MemoryChannelNumber =3D + (NvdInfo->DeviceHandle >> 4) & 0x0F; + NfitRegionMappingPointer->NFITDeviceHandle.MemoryControllerID =3D + (NvdInfo->DeviceHandle >> 8) & 0x0F; + NfitRegionMappingPointer->NFITDeviceHandle.SocketID =3D + (NvdInfo->DeviceHandle >> 12) & 0x0F; + NfitRegionMappingPointer->SPARangeStructureIndex =3D + NfitSpaPointer->SPARangeStructureIndex; + NfitRegionMappingPointer->NVDIMMPhysicalAddressRegionBase =3D + NfitSpaPointer->SystemPhysicalAddressRangeBase; + NfitRegionMappingPointer->NVDIMMControlRegionStructureIndex =3D + NfitControlRegionPointer->NVDIMMControlRegionStructureIndex; +} + +EFI_STATUS +AcpiNfitFillTableBySK ( + IN EFI_ACPI_6_3_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE *NfitSp= aPointerStart, + IN OUT EFI_ACPI_6_3_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE **NfitS= paPointerNext, + IN UINTN Socket + ) +{ + EFI_ACPI_6_3_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE *NfitSpaPointe= r; + EFI_ACPI_6_3_NFIT_NVDIMM_CONTROL_REGION_STRUCTURE *NfitControlRe= gionPointer; + EFI_ACPI_6_3_NFIT_NVDIMM_REGION_MAPPING_STRUCTURE *NfitRegionMap= pingPointer; + PLATFORM_INFO_HOB *PlatformHob; + VOID *Hob; + UINT64 NvdRegionBase, + NvdRegionSize; + UINTN NvdCount, MaxNvdCount, RegionCount; + UINTN RegionId, NvdRegionIndex, NvdIndex; + + /* Get the Platform HOB */ + Hob =3D GetFirstGuidHob (&gPlatformInfoHobGuid); + if (Hob =3D=3D NULL + || NfitSpaPointerStart =3D=3D NULL + || NfitSpaPointerNext =3D=3D NULL) + { + return EFI_INVALID_PARAMETER; + } + + PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + NvdRegionIndex =3D (Socket =3D=3D 0) ? 0 : NvdData[NVDIMM_SK0].NvdRegion= Num; + NvdIndex =3D (Socket =3D=3D 0) ? 0 : NvdData[NVDIMM_SK0].NvdNum; + if (NvdData[Socket].NvdMode =3D=3D NvdimmHashed) { + /* Table Type 0: SPA Range Structure */ + NfitSpaPointer =3D NfitSpaPointerStart; + CopyMem ( + (VOID *)NfitSpaPointer, + (VOID *)&NfitSPATemplate, + sizeof (NfitSPATemplate) + ); + RegionId =3D NvdData[Socket].NvdRegionId[0]; + NvdRegionBase =3D PlatformHob->DramInfo.Base[RegionId]; + NvdRegionSize =3D PlatformHob->DramInfo.Size[RegionId]; + NvdRegionIndex++; + AcpiNfitFillSPA ( + NfitSpaPointer, + NvdRegionIndex, + NvdRegionBase, + NvdRegionSize + ); + + NfitControlRegionPointer =3D + (EFI_ACPI_6_3_NFIT_NVDIMM_CONTROL_REGION_STRUCTURE *) + (NfitSpaPointer + 1); + for (NvdCount =3D 0; NvdCount < NVDIMM_NUM_PER_SK; NvdCount++) { + if (!NvdData[Socket].NvdInfo[NvdCount].Enabled) { + continue; + } + NvdIndex++; + /* Table Type 4: NVDIMM Control Region Structure Mark */ + CopyMem ( + (VOID *)NfitControlRegionPointer, + (VOID *)&NvdimmControlRegionTemplate, + sizeof (NvdimmControlRegionTemplate) + ); + NfitFillControlRegion ( + NfitControlRegionPointer, + &NvdData[Socket].NvdInfo[NvdCount], + NvdIndex + ); + + NfitRegionMappingPointer =3D + (EFI_ACPI_6_3_NFIT_NVDIMM_REGION_MAPPING_STRUCTURE *) + (NfitControlRegionPointer + 1); + + /* Table Type 1: NVDIMM Region Mapping Structure */ + CopyMem ( + (VOID *)NfitRegionMappingPointer, + (VOID *)&NvdimmRegionMappingTemplate, + sizeof (NvdimmRegionMappingTemplate) + ); + NfitFillRegionMapping ( + NfitRegionMappingPointer, + NfitControlRegionPointer, + NfitSpaPointer, + &NvdData[Socket].NvdInfo[NvdCount], + NvdIndex - 1 + ); + + NfitControlRegionPointer =3D + (EFI_ACPI_6_3_NFIT_NVDIMM_CONTROL_REGION_STRUCTURE *) + (NfitRegionMappingPointer + 1); + } + NfitSpaPointer =3D + (EFI_ACPI_6_3_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE *) + NfitControlRegionPointer; + } else { /* NvdimmNonHashed */ + NfitSpaPointer =3D NfitSpaPointerStart; + for (RegionCount =3D 0; RegionCount < NvdData[Socket].NvdRegionNum; + RegionCount++) + { + /* Table Type 0: SPA Range Structure */ + CopyMem ( + (VOID *)NfitSpaPointer, + (VOID *)&NfitSPATemplate, + sizeof (NfitSPATemplate) + ); + RegionId =3D NvdData[Socket].NvdRegionId[RegionCount]; + NvdRegionBase =3D PlatformHob->DramInfo.Base[RegionId]; + NvdRegionSize =3D PlatformHob->DramInfo.Size[RegionId]; + NvdRegionIndex++; + AcpiNfitFillSPA ( + NfitSpaPointer, + NvdRegionIndex, + NvdRegionBase, + NvdRegionSize + ); + + NfitControlRegionPointer =3D + (EFI_ACPI_6_3_NFIT_NVDIMM_CONTROL_REGION_STRUCTURE *) + (NfitSpaPointer + 1); + NvdCount =3D ((NvdRegionBase =3D=3D AC01_NVDIMM_SK0_NHASHED_REGION0_= BASE) || + (NvdRegionBase =3D=3D AC01_NVDIMM_SK1_NHASHED_REGION0_BA= SE)) ? + 0 : AC01_NVDIMM_MAX_DIMM_PER_MCU; + MaxNvdCount =3D NvdCount + AC01_NVDIMM_MAX_DIMM_PER_MCU; + for (; NvdCount < MaxNvdCount; NvdCount++) { + if (!NvdData[Socket].NvdInfo[NvdCount].Enabled) { + continue; + } + NvdIndex++; + + /* Table Type 4: NVDIMM Control Region Structure Mark */ + CopyMem ( + (VOID *)NfitControlRegionPointer, + (VOID *)&NvdimmControlRegionTemplate, + sizeof (NvdimmControlRegionTemplate) + ); + NfitFillControlRegion ( + NfitControlRegionPointer, + &NvdData[Socket].NvdInfo[NvdCount], + NvdIndex + ); + + NfitRegionMappingPointer =3D + (EFI_ACPI_6_3_NFIT_NVDIMM_REGION_MAPPING_STRUCTURE *) + (NfitControlRegionPointer + 1); + + /* Table Type 1: NVDIMM Region Mapping Structure */ + CopyMem ( + (VOID *)NfitRegionMappingPointer, + (VOID *)&NvdimmRegionMappingTemplate, + sizeof (NvdimmRegionMappingTemplate) + ); + NfitFillRegionMapping ( + NfitRegionMappingPointer, + NfitControlRegionPointer, + NfitSpaPointer, + &NvdData[Socket].NvdInfo[NvdCount], + NvdIndex - 1 + ); + + NfitControlRegionPointer =3D + (EFI_ACPI_6_3_NFIT_NVDIMM_CONTROL_REGION_STRUCTURE *) + (NfitRegionMappingPointer + 1); + } + NfitSpaPointer =3D + (EFI_ACPI_6_3_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE *) + NfitControlRegionPointer; + } + } + /* Update NfitSpaPointerNext */ + *NfitSpaPointerNext =3D NfitSpaPointer; + + return EFI_SUCCESS; +} + +EFI_STATUS +AcpiNfitFillTable ( + IN EFI_ACPI_6_3_NVDIMM_FIRMWARE_INTERFACE_TABLE *NfitTablePointer + ) +{ + EFI_ACPI_6_3_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE *NfitSpaPointe= rNext; + + if (NfitTablePointer =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + NfitSpaPointerNext =3D (EFI_ACPI_6_3_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_= STRUCTURE *) + (NfitTablePointer + 1); + + if (NvdData[NVDIMM_SK0].NvdRegionNum !=3D 0) { + AcpiNfitFillTableBySK (NfitSpaPointerNext, &NfitSpaPointerNext, NVDIMM= _SK0); + } + + if (NvdData[NVDIMM_SK1].NvdRegionNum !=3D 0) { + AcpiNfitFillTableBySK (NfitSpaPointerNext, &NfitSpaPointerNext, NVDIMM= _SK1); + } + + return EFI_SUCCESS; +} + +/* + * Install NFIT table. + */ +EFI_STATUS +AcpiInstallNfitTable ( + VOID + ) +{ + EFI_ACPI_6_3_NVDIMM_FIRMWARE_INTERFACE_TABLE *NfitTablePointer; + EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; + UINTN NfitTableKey =3D 0; + EFI_STATUS Status; + UINTN Size; + UINTN NvdRegionNum; + + Status =3D gBS->LocateProtocol ( + &gEfiAcpiTableProtocolGuid, + NULL, + (VOID **)&AcpiTableProtocol + ); + if (EFI_ERROR (Status)) { + return Status; + } + Status =3D AcpiNvdDataInit (NVDIMM_SK0); + if (EFI_ERROR (Status)) { + return Status; + } + Status =3D AcpiNvdDataInit (NVDIMM_SK1); + if (EFI_ERROR (Status)) { + return Status; + } + NvdRegionNum =3D NvdData[NVDIMM_SK0].NvdRegionNum + + NvdData[NVDIMM_SK1].NvdRegionNum; + if (NvdRegionNum =3D=3D 0) { + return EFI_INVALID_PARAMETER; /* No NVDIMM Region */ + } + Size =3D sizeof (EFI_ACPI_6_3_NVDIMM_FIRMWARE_INTERFACE_TABLE); + if (NvdData[NVDIMM_SK0].NvdRegionNum !=3D 0) { + Size +=3D + (sizeof (EFI_ACPI_6_3_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE) * + NvdData[NVDIMM_SK0].NvdRegionNum) + + (sizeof (EFI_ACPI_6_3_NFIT_NVDIMM_CONTROL_REGION_STRUCTURE) * + NvdData[NVDIMM_SK0].NvdNum) + + (sizeof (EFI_ACPI_6_3_NFIT_NVDIMM_REGION_MAPPING_STRUCTURE) * + NvdData[NVDIMM_SK0].NvdNum); + } + if (NvdData[NVDIMM_SK1].NvdRegionNum !=3D 0) { + Size +=3D + (sizeof (EFI_ACPI_6_3_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE) * + NvdData[NVDIMM_SK1].NvdRegionNum) + + (sizeof (EFI_ACPI_6_3_NFIT_NVDIMM_CONTROL_REGION_STRUCTURE) * + NvdData[NVDIMM_SK1].NvdNum) + + (sizeof (EFI_ACPI_6_3_NFIT_NVDIMM_REGION_MAPPING_STRUCTURE) * + NvdData[NVDIMM_SK1].NvdNum); + } + NfitTablePointer =3D + (EFI_ACPI_6_3_NVDIMM_FIRMWARE_INTERFACE_TABLE *)AllocateZeroPool (Size= ); + if (NfitTablePointer =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + CopyMem ( + (VOID *)NfitTablePointer, + (VOID *)&NFITTableHeaderTemplate, + sizeof (NFITTableHeaderTemplate) + ); + + NfitTablePointer->Header.Length =3D Size; + + Status =3D AcpiNfitFillTable (NfitTablePointer); + if (EFI_ERROR (Status)) { + FreePool ((VOID *)NfitTablePointer); + return Status; + } + AcpiUpdateChecksum ((UINT8 *)NfitTablePointer, NfitTablePointer->Header.= Length); + Status =3D AcpiTableProtocol->InstallAcpiTable ( + AcpiTableProtocol, + (VOID *)NfitTablePointer, + NfitTablePointer->Header.Length, + &NfitTableKey + ); + if (EFI_ERROR (Status)) { + FreePool ((VOID *)NfitTablePointer); + } + return Status; +} diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPcct.c b/P= latform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPcct.c new file mode 100644 index 000000000000..6f4b252ab366 --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPcct.c @@ -0,0 +1,413 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "AcpiPlatform.h" + +#include +#include +#include + +// +// The communication data for advertising the shared memory address to the= SMpro/PMpro. +// +#define PCC_PAYLOAD_ADVERTISE_ADDRESS 0x0F000000 +#define PCC_PAYLOAD_SIZE 12 // Bytes + +// +// ACPI Platform Communication Channel (PCC) +// +#define PCC_SUBSPACE_SHARED_MEM_SIGNATURE 0x50434300 // "PCC" +#define PCC_SUBSPACE_SHARED_MEM_SIZE 0x4000 // Number of Bytes + +// +// Mask for available doorbells. This is used to reserve +// doorbells which are for other communications with OS. +// +// Each bit in the mask represents each doorbell channel +// from PMpro Doorbell 0 to PMpro Doorbell 7 and SMpro +// Doorbell channel 0 to SMpro Doorbell channel 7. +// +#define PCC_AVAILABLE_DOORBELL_MASK 0xEFFFEFFF + +#define PCC_MAX_VALID_DOORBELL_COUNT (NUMBER_OF_DOORBELLS_P= ER_SOCKET * PLATFORM_CPU_MAX_SOCKET) + +#define PCC_NOMINAL_LATENCY_US 1000 // us +#define PCC_MAX_PERIODIC_ACCESS_RATE 0 // no limitation +#define PCC_MIN_REQ_TURNAROUND_TIME_US 0 + +// Polling interval for PCC Command Complete +#define PCC_COMMAND_POLL_INTERVAL_US 10 + +#define PCC_COMMAND_POLL_COUNT (PCC_NOMINAL_LATENCY_US / PCC_COMMAND_POLL= _INTERVAL_US) + +// +// Doorbell Channel for CPPC +// +#define PCC_CPPC_DOORBELL_ID (PMproDoorbellChannel2) + +#define PCC_CPPC_NOMINAL_LATENCY_US 100 +#define PCC_CPPC_MIN_REQ_TURNAROUND_TIME_US 110 + +// +// Shared memory regions allocated for PCC subspaces +// +STATIC EFI_PHYSICAL_ADDRESS mPccSharedMemoryAddress; +STATIC UINTN mPccSharedMemorySize; + + +EFI_ACPI_6_3_PCCT_SUBSPACE_2_HW_REDUCED_COMMUNICATIONS PcctSubspaceTemplat= e =3D { + EFI_ACPI_6_3_PCCT_SUBSPACE_TYPE_2_HW_REDUCED_COMMUNICATIONS, + sizeof (EFI_ACPI_6_3_PCCT_SUBSPACE_2_HW_REDUCED_COMMUNICATIONS), + 0, // PlatformInterrupt + 0, // PlatformInterruptFlags + 0, // Reserved + 0, // BaseAddress + 0x100, // AddressLength + { 0, 0x20, 0, 0x3, 0x0 }, // DoorbellRegister + 0, // DoorbellPreserve + 0x53000040, // DoorbellWrite + 1, // NominalLatency + 1, // MaximumPeriodicAccessRate + 1, // MinimumRequestTurnaroundTime + { 0, 0x20, 0, 0x3, 0x0 }, // PlatformInterruptAckRegister + 0, // PlatformInterruptAckPreserve + 0x10001, // PlatformInterruptAckWrite +}; + +EFI_ACPI_6_3_PLATFORM_COMMUNICATION_CHANNEL_TABLE_HEADER PcctTableHeaderTe= mplate =3D { + __ACPI_HEADER ( + EFI_ACPI_6_3_PLATFORM_COMMUNICATIONS_CHANNEL_TABLE_SIGNATURE, + EFI_ACPI_6_3_PLATFORM_COMMUNICATION_CHANNEL_TABLE_HEADER, + EFI_ACPI_6_3_PLATFORM_COMMUNICATION_CHANNEL_TABLE_REVISION + ), + EFI_ACPI_6_3_PCCT_FLAGS_PLATFORM_INTERRUPT, +}; + + +/** + Check whether the Doorbell is reserved or not. + +**/ +BOOLEAN +PcctIsDoorbellReserved ( + IN UINT16 Doorbell + ) +{ + ASSERT (Doorbell <=3D PCC_MAX_VALID_DOORBELL_COUNT); + + if (((1 << Doorbell) & PCC_AVAILABLE_DOORBELL_MASK) =3D=3D 0) { + return TRUE; + } + + return FALSE; +} + +/** + Get number of available doorbells for the usage of PCC communication. + +**/ +UINT16 +PcctGetNumberOfAvailableDoorbells ( + VOID + ) +{ + UINT16 Doorbell; + UINT16 AvailableDoorbellCount; + + AvailableDoorbellCount =3D 0; + for (Doorbell =3D 0; Doorbell < NUMBER_OF_DOORBELLS_PER_SOCKET; Doorbell= ++ ) { + if (((1 << Doorbell) & PCC_AVAILABLE_DOORBELL_MASK) !=3D 0) { + AvailableDoorbellCount++; + } + } + ASSERT (AvailableDoorbellCount <=3D PCC_MAX_VALID_DOORBELL_COUNT); + + return AvailableDoorbellCount; +} + +/** + Allocate memory pages for the PCC shared memory region. + +**/ +EFI_STATUS +PcctAllocateSharedMemory ( + IN UINT16 SubspaceCount, + OUT EFI_PHYSICAL_ADDRESS *PccSharedMemoryPtr + ) +{ + EFI_STATUS Status; + + mPccSharedMemorySize =3D PCC_SUBSPACE_SHARED_MEM_SIZE * SubspaceCount; + + Status =3D gBS->AllocatePages ( + AllocateAnyPages, + EfiRuntimeServicesData, + EFI_SIZE_TO_PAGES (mPccSharedMemorySize), + &mPccSharedMemoryAddress + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Failed to allocate PCC shared memory\n")); + mPccSharedMemorySize =3D 0; + return Status; + } + + *PccSharedMemoryPtr =3D mPccSharedMemoryAddress; + + return EFI_SUCCESS; +} + +EFI_PHYSICAL_ADDRESS +PcctGetSharedMemoryAddress ( + IN UINT8 Socket, + IN UINT16 Subspace + ) +{ + ASSERT (Socket < PLATFORM_CPU_MAX_SOCKET); + + return (mPccSharedMemoryAddress + PCC_SUBSPACE_SHARED_MEM_SIZE * Subspac= e); +} + +/** + Free the whole shared memory region that is allocated by + the PcctAllocateSharedMemory() function. + +**/ +VOID +PcctFreeSharedMemory ( + VOID + ) +{ + if (mPccSharedMemoryAddress !=3D 0 && mPccSharedMemorySize !=3D 0) { + gBS->FreePages ( + mPccSharedMemoryAddress, + EFI_SIZE_TO_PAGES (mPccSharedMemorySize) + ); + + mPccSharedMemoryAddress =3D 0; + } +} + +/** + This function is to advertise the shared memory region address + to the platform (SMpro/PMpro). + +**/ +EFI_STATUS +PcctAdvertiseSharedMemoryAddress ( + IN UINT8 Socket, + IN UINT16 Doorbell, + IN UINT16 Subspace + ) +{ + EFI_STATUS Status; + EFI_ACPI_6_3_PCCT_GENERIC_SHARED_MEMORY_REGION_HEADER *PccSharedMemoryRe= gion; + UINT32 CommunicationData; + UINTN Timeout; + + if (Socket >=3D PLATFORM_CPU_MAX_SOCKET + || Doorbell >=3D NUMBER_OF_DOORBELLS_PER_SOCKET) { + return EFI_INVALID_PARAMETER; + } + + PccSharedMemoryRegion =3D (EFI_ACPI_6_3_PCCT_GENERIC_SHARED_MEMORY_REGIO= N_HEADER *) + PcctGetSharedMemoryAddress (Socket, Subspace); + ASSERT (PccSharedMemoryRegion !=3D NULL); + + // + // Zero shared memory region for each PCC subspace + // + SetMem ( + (VOID *)PccSharedMemoryRegion, + sizeof (EFI_ACPI_6_3_PCCT_GENERIC_SHARED_MEMORY_REGION_HEADER) + PCC_P= AYLOAD_SIZE, + 0 + ); + + // Advertise shared memory address to Platform (SMpro/PMpro) + // by ringing the doorbell with dummy PCC message + // + CommunicationData =3D PCC_PAYLOAD_ADVERTISE_ADDRESS; + + // + // Write Data into Communication Space Region + // + CopyMem ((VOID *)(PccSharedMemoryRegion + 1), &CommunicationData, sizeof= (CommunicationData)); + + PccSharedMemoryRegion->Status.CommandComplete =3D 0; + PccSharedMemoryRegion->Signature =3D PCC_SUBSPACE_SHARED_MEM_SIGNATURE |= Subspace; + + Status =3D MailboxMsgSetPccSharedMem (Socket, Doorbell, TRUE, (UINT64)Pc= cSharedMemoryRegion); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to send mailbox message!\n", __FUNCTI= ON__)); + ASSERT_EFI_ERROR (Status); + return Status; + } + + // + // Polling CMD_COMPLETE bit + // + Timeout =3D PCC_COMMAND_POLL_COUNT; + while (PccSharedMemoryRegion->Status.CommandComplete !=3D 1) { + if (--Timeout <=3D 0) { + DEBUG ((DEBUG_ERROR, "%a - Timeout occurred when polling the PCC Sta= tus Complete\n", __FUNCTION__)); + return EFI_TIMEOUT; + } + MicroSecondDelay (PCC_COMMAND_POLL_INTERVAL_US); + } + + return EFI_SUCCESS; +} + +EFI_STATUS +AcpiPcctInitializeSharedMemory ( + VOID + ) +{ + UINT8 SocketCount; + UINT8 Socket; + UINT16 Doorbell; + UINT16 Subspace; + + SocketCount =3D GetNumberOfActiveSockets (); + Subspace =3D 0; + + for (Socket =3D 0; Socket < SocketCount; Socket++) { + for (Doorbell =3D 0; Doorbell < NUMBER_OF_DOORBELLS_PER_SOCKET; Doorbe= ll++ ) { + if (PcctIsDoorbellReserved (Doorbell + NUMBER_OF_DOORBELLS_PER_SOCKE= T * Socket)) { + continue; + } + PcctAdvertiseSharedMemoryAddress (Socket, Doorbell, Subspace); + MailboxUnmaskInterrupt (Socket, Doorbell); + + Subspace++; + } + } + + return EFI_SUCCESS; +} + +/** + Install PCCT table. + + PCC channels are associated with hardware doorbell instances to provide + bi-directional communication between the OS and platform entities. + +**/ +EFI_STATUS +AcpiInstallPcctTable ( + VOID + ) +{ + EFI_STATUS Status; + EFI_ACPI_6_3_PLATFORM_COMMUNICATION_CHANNEL_TABLE_HEADER *PcctTableHeade= r; + EFI_ACPI_6_3_PCCT_SUBSPACE_2_HW_REDUCED_COMMUNICATIONS *PccSubspacePtr; + EFI_PHYSICAL_ADDRESS PccSharedMemory= Ptr; + EFI_ACPI_TABLE_PROTOCOL *AcpiTableProto= col; + UINTN PcctTableKey; + UINT8 SocketCount; + UINT8 Socket; + UINT16 Doorbell; + UINT16 Subspace; + UINT16 SubspaceCount; + UINTN Size; + UINTN DoorbellAddress; + UINTN DoorbellCount; + + Subspace =3D 0; + SocketCount =3D GetNumberOfActiveSockets (); + DoorbellCount =3D PcctGetNumberOfAvailableDoorbells (); + + Status =3D gBS->LocateProtocol ( + &gEfiAcpiTableProtocolGuid, + NULL, + (VOID **)&AcpiTableProtocol + ); + if (EFI_ERROR (Status)) { + return Status; + } + + SubspaceCount =3D DoorbellCount * SocketCount; + + PcctAllocateSharedMemory (SubspaceCount, &PccSharedMemoryPtr); + if (PccSharedMemoryPtr =3D=3D (EFI_PHYSICAL_ADDRESS)(UINTN)NULL) { + return EFI_OUT_OF_RESOURCES; + } + + Size =3D sizeof (EFI_ACPI_6_3_PLATFORM_COMMUNICATION_CHANNEL_TABLE_HEADE= R) + + SubspaceCount * sizeof (EFI_ACPI_6_3_PCCT_SUBSPACE_2_HW_REDUCED_= COMMUNICATIONS); + + PcctTableHeader =3D (EFI_ACPI_6_3_PLATFORM_COMMUNICATION_CHANNEL_TABLE_H= EADER *)AllocateZeroPool (Size); + if (PcctTableHeader =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + PccSubspacePtr =3D (EFI_ACPI_6_3_PCCT_SUBSPACE_2_HW_REDUCED_COMMUNICATIO= NS *)(PcctTableHeader + 1); + + for (Socket =3D 0; Socket < SocketCount; Socket++) { + for (Doorbell =3D 0; Doorbell < NUMBER_OF_DOORBELLS_PER_SOCKET; Doorbe= ll++ ) { + if (PcctIsDoorbellReserved (Doorbell + NUMBER_OF_DOORBELLS_PER_SOCKE= T * Socket)) { + continue; + } + + CopyMem ( + PccSubspacePtr, + &PcctSubspaceTemplate, + sizeof (EFI_ACPI_6_3_PCCT_SUBSPACE_2_HW_REDUCED_COMMUNICATIONS) + ); + + PccSubspacePtr->BaseAddress =3D (UINT64)PccSharedMemoryPtr + PCC_SUB= SPACE_SHARED_MEM_SIZE * Subspace; + PccSubspacePtr->AddressLength =3D PCC_SUBSPACE_SHARED_MEM_SIZE; + + DoorbellAddress =3D MailboxGetDoorbellAddress (Socket, Doorbell); + + PccSubspacePtr->DoorbellRegister.Address =3D DoorbellAddress + DB_OU= T_REG_OFST; + PccSubspacePtr->PlatformInterrupt =3D MailboxGetDoorbellInterruptNum= ber (Socket, Doorbell); + PccSubspacePtr->PlatformInterruptAckRegister.Address =3D DoorbellAdd= ress + DB_STATUS_REG_OFST; + + if (Doorbell =3D=3D PCC_CPPC_DOORBELL_ID) { + PccSubspacePtr->DoorbellWrite =3D MAILBOX_URGENT_CPPC_MESSAGE; + PccSubspacePtr->NominalLatency =3D PCC_CPPC_NOMINAL_LATENCY_US; + PccSubspacePtr->MinimumRequestTurnaroundTime =3D PCC_CPPC_MIN_REQ_= TURNAROUND_TIME_US; + } else { + PccSubspacePtr->DoorbellWrite =3D MAILBOX_TYPICAL_PCC_MESSAGE; + PccSubspacePtr->NominalLatency =3D PCC_NOMINAL_LATENCY_US; + PccSubspacePtr->MinimumRequestTurnaroundTime =3D PCC_MIN_REQ_TURNA= ROUND_TIME_US; + } + PccSubspacePtr->MaximumPeriodicAccessRate =3D PCC_MAX_PERIODIC_ACCES= S_RATE; + + PccSubspacePtr++; + Subspace++; + } + } + + CopyMem ( + PcctTableHeader, + &PcctTableHeaderTemplate, + sizeof (EFI_ACPI_6_3_PLATFORM_COMMUNICATION_CHANNEL_TABLE_HEADER) + ); + + PcctTableHeader->Header.Length =3D Size; + + AcpiUpdateChecksum ( + (UINT8 *)PcctTableHeader, + PcctTableHeader->Header.Length + ); + + Status =3D AcpiTableProtocol->InstallAcpiTable ( + AcpiTableProtocol, + (VOID *)PcctTableHeader, + PcctTableHeader->Header.Length, + &PcctTableKey + ); + if (EFI_ERROR (Status)) { + PcctFreeSharedMemory (); + FreePool ((VOID *)PcctTableHeader); + return Status; + } + + return EFI_SUCCESS; +} diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDx= e.c b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.c new file mode 100644 index 000000000000..c4022eb056e0 --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.c @@ -0,0 +1,178 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "AcpiApei.h" +#include "AcpiPlatform.h" + +STATIC EFI_EVENT mAcpiRegistration =3D NULL; + +/* + * This GUID must match the FILE_GUID in AcpiTables.inf of each boards + */ +STATIC CONST EFI_GUID mAcpiCommonTableFile =3D { 0xCEFA2AEB, 0x357E, 0x4F4= 8, { 0x80, 0x66, 0xEA, 0x95, 0x08, 0x53, 0x05, 0x6E } } ; +STATIC CONST EFI_GUID mJadeAcpiTableFile =3D { 0x5addbc13, 0x8634, 0x480c,= { 0x9b, 0x94, 0x67, 0x1b, 0x78, 0x55, 0xcd, 0xb8 } }; +/** + * Callback called when ACPI Protocol is installed + */ +STATIC VOID +AcpiNotificationEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp; + + Status =3D LocateAndInstallAcpiFromFv (&mAcpiCommonTableFile); + ASSERT_EFI_ERROR (Status); + + Status =3D LocateAndInstallAcpiFromFv (&mJadeAcpiTableFile); + ASSERT_EFI_ERROR (Status); + + // + // Find ACPI table RSD_PTR from the system table. + // + Status =3D EfiGetSystemConfigurationTable (&gEfiAcpiTableGuid, (VOID **)= &Rsdp); + if (EFI_ERROR (Status)) { + Status =3D EfiGetSystemConfigurationTable (&gEfiAcpi10TableGuid, (VOID= **)&Rsdp); + } + + if (!EFI_ERROR (Status) && + Rsdp !=3D NULL && + Rsdp->Revision >=3D EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REV= ISION && + Rsdp->RsdtAddress !=3D 0) + { + // ARM Platforms must set the RSDT address to NULL + Rsdp->RsdtAddress =3D 0; + } + + DEBUG ((DEBUG_INFO, "[%a:%d]-\n", __FUNCTION__, __LINE__)); +} + +VOID +EFIAPI +InstallAcpiOnReadyToBoot ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + + Status =3D AcpiInstallMadtTable (); + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "Installed MADT table\n")); + } + + Status =3D AcpiInstallPpttTable (); + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "Installed PPTT table\n")); + } + + Status =3D AcpiInstallSlitTable (); + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "Installed SLIT table\n")); + } + + Status =3D AcpiInstallSratTable (); + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "Installed SRAT table\n")); + } + + Status =3D AcpiInstallPcctTable (); + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "Installed PCCT table\n")); + } + + Status =3D AcpiInstallNfitTable (); + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "Installed NFIT table\n")); + } + + Status =3D AcpiPopulateBert (); + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "Populate BERT record\n")); + } + + // + // Close the event, so it will not be signalled again. + // + gBS->CloseEvent (Event); +} + +VOID +EFIAPI +UpdateAcpiOnExitBootServices ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + + Status =3D AcpiPatchDsdtTable (); + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "DSDT Table updated!\n")); + } + + // Configure ACPI Platform Error Interfaces + Status =3D AcpiApeiUpdate (); + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "APEI Table updated!\n")); + } + + // Advertise shared memory regions to SMpro/PMpro and unmask interrupt + Status =3D AcpiPcctInitializeSharedMemory (); + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "PCCT Table updated!\n")); + } + + // + // Close the event, so it will not be signalled again. + // + gBS->CloseEvent (Event); +} + +EFI_STATUS +EFIAPI +AcpiPlatformDxeInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_EVENT ReadyToBootEvent; + EFI_EVENT ExitBootServicesEvent; + EFI_STATUS Status; + + EfiCreateProtocolNotifyEvent ( + &gEfiAcpiTableProtocolGuid, + TPL_CALLBACK, + AcpiNotificationEvent, + NULL, + &mAcpiRegistration + ); + + Status =3D gBS->CreateEvent ( + EVT_SIGNAL_EXIT_BOOT_SERVICES, + TPL_CALLBACK, + UpdateAcpiOnExitBootServices, + NULL, + &ExitBootServicesEvent + ); + ASSERT_EFI_ERROR (Status); + + Status =3D gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_CALLBACK, + InstallAcpiOnReadyToBoot, + NULL, + &gEfiEventReadyToBootGuid, + &ReadyToBootEvent + ); + ASSERT_EFI_ERROR (Status); + + return EFI_SUCCESS; +} diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPptt.c b/P= latform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPptt.c new file mode 100644 index 000000000000..0e09a17cc52d --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPptt.c @@ -0,0 +1,333 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include "AcpiPlatform.h" + +EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR PPTTProcessorTemplate =3D { + EFI_ACPI_6_3_PPTT_TYPE_PROCESSOR, + sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR), + { EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE }, + {0}, /* Flags */ + 0, /* Parent */ + 0, /* AcpiProcessorId */ + 0 /* NumberOfPrivateResources */ +}; + +EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE PPTTCacheTemplate =3D { + EFI_ACPI_6_3_PPTT_TYPE_CACHE, + sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE), + { EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE }, + {0}, /* Flags */ + 0, /* NextLevelOfCache */ + 0, /* Size */ + 0, /* NumberOfSets */ + 0, /* Associativity */ + {0}, /* Attributes */ + 0 +}; + +EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER PPTTTableHeaderTem= plate =3D { + __ACPI_HEADER ( + EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE, + 0, /* need fill in */ + EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_REVISION + ), +}; + +STATIC EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER *PpttTableP= ointer; +STATIC UINT32 PpttCluster= Offset[PLATFORM_CPU_MAX_CPM * PLATFORM_CPU_MAX_SOCKET]; +STATIC UINT32 PpttSocketO= ffset[PLATFORM_CPU_MAX_SOCKET]; +STATIC UINT32 PpttRootOff= set; +STATIC UINT32 PpttL1DataC= acheOffset[PLATFORM_CPU_MAX_NUM_CORES]; +STATIC UINT32 PpttL1Instr= uctionCacheOffset[PLATFORM_CPU_MAX_NUM_CORES]; +STATIC UINT32 PpttL2Cache= Offset[PLATFORM_CPU_MAX_NUM_CORES]; + +UINT32 +AcpiPpttProcessorCoreNode ( + VOID *EntryPointer, + UINT32 CpuId + ) +{ + EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR *PpttProcessorEntryPointer =3D Ent= ryPointer; + UINT32 *ResPointer; + UINTN ClusterIdPerSocket, CoreIdPerCpm, = SocketId; + + CopyMem ( + PpttProcessorEntryPointer, + &PPTTProcessorTemplate, + sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR) + ); + + ClusterIdPerSocket =3D (CpuId / PLATFORM_CPU_NUM_CORES_PER_CPM) % PLATFO= RM_CPU_MAX_CPM; + SocketId =3D (CpuId / PLATFORM_CPU_NUM_CORES_PER_CPM) / PLATFORM_CPU_MAX= _CPM; + CoreIdPerCpm =3D CpuId % PLATFORM_CPU_NUM_CORES_PER_CPM; + PpttProcessorEntryPointer->Flags.AcpiProcessorIdValid =3D 1; + PpttProcessorEntryPointer->Flags.NodeIsALeaf =3D 1; + PpttProcessorEntryPointer->Flags.IdenticalImplementation =3D 1; + PpttProcessorEntryPointer->AcpiProcessorId =3D (SocketId << PLATFORM_SOC= KET_UID_BIT_OFFSET) | (ClusterIdPerSocket << 8) | CoreIdPerCpm; + PpttProcessorEntryPointer->Parent =3D (UINT32)PpttClusterOffset[CpuId / = PLATFORM_CPU_NUM_CORES_PER_CPM]; + PpttProcessorEntryPointer->NumberOfPrivateResources =3D 2; /* L1I + L1D = */ + + ResPointer =3D (UINT32 *)((UINT64)EntryPointer + + sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR)); + ResPointer[0] =3D PpttL1InstructionCacheOffset[CpuId]; + ResPointer[1] =3D PpttL1DataCacheOffset[CpuId]; + + PpttProcessorEntryPointer->Length =3D sizeof (EFI_ACPI_6_3_PPTT_STRUCTUR= E_PROCESSOR) + 2 * sizeof (UINT32); + + return PpttProcessorEntryPointer->Length; +} + +STATIC UINT32 +AcpiPpttClusterNode ( + VOID *EntryPointer, + UINT32 ClusterId + ) +{ + EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR *PpttProcessorEntryPointer =3D Ent= ryPointer; + + PpttClusterOffset[ClusterId] =3D (UINT64)EntryPointer - (UINT64)PpttTabl= ePointer; + + CopyMem ( + PpttProcessorEntryPointer, + &PPTTProcessorTemplate, + sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR) + ); + + PpttProcessorEntryPointer->Parent =3D (UINT32)PpttSocketOffset[ClusterId= / PLATFORM_CPU_MAX_CPM]; + PpttProcessorEntryPointer->Flags.IdenticalImplementation =3D 1; + + return PpttProcessorEntryPointer->Length; +} + +STATIC UINT32 +AcpiPpttSocketNode ( + VOID *EntryPointer, + UINT32 SocketId + ) +{ + EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR *PpttProcessorEntryPointer =3D Ent= ryPointer; + + PpttSocketOffset[SocketId] =3D (UINT64)EntryPointer - (UINT64)PpttTableP= ointer; + + CopyMem ( + PpttProcessorEntryPointer, + &PPTTProcessorTemplate, + sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR) + ); + + PpttProcessorEntryPointer->Flags.PhysicalPackage =3D 1; + PpttProcessorEntryPointer->Flags.IdenticalImplementation =3D 1; + PpttProcessorEntryPointer->Parent =3D (UINT32)PpttRootOffset; + + return PpttProcessorEntryPointer->Length; +} + +STATIC UINT32 +AcpiPpttRootNode ( + VOID *EntryPointer + ) +{ + EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR *PpttProcessorEntryPointer =3D Ent= ryPointer; + + PpttRootOffset =3D (UINT64)EntryPointer - (UINT64)PpttTablePointer; + + CopyMem ( + PpttProcessorEntryPointer, + &PPTTProcessorTemplate, + sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR) + ); + + PpttProcessorEntryPointer->Flags.IdenticalImplementation =3D 1; + + return PpttProcessorEntryPointer->Length; +} + +STATIC VOID +AcpiPpttFillCacheSizeInfo ( + EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE *Node, + UINT32 Level, + BOOLEAN DataCache, + BOOLEAN UnifiedCache + ) +{ + CSSELR_DATA CsselrData; + CCSIDR_DATA CcsidrData; + + CsselrData.Data =3D 0; + CsselrData.Bits.Level =3D Level - 1; + CsselrData.Bits.InD =3D (!DataCache && !UnifiedCache); + + CcsidrData.Data =3D ReadCCSIDR (CsselrData.Data); + + Node->Flags.LineSizeValid =3D 1; + Node->Flags.NumberOfSetsValid =3D 1; + Node->Flags.AssociativityValid =3D 1; + Node->Flags.SizePropertyValid =3D 1; + Node->Flags.CacheTypeValid =3D 1; + Node->NumberOfSets =3D (UINT16)CcsidrData.BitsNonCcidx.NumSets + 1; + Node->Associativity =3D (UINT16)CcsidrData.BitsNonCcidx.Associativity + = 1; + Node->LineSize =3D (UINT16)(1 << (CcsidrData.BitsNonCcidx.LineSize + 4))= ;; + Node->Size =3D Node->NumberOfSets * + Node->Associativity * + Node->LineSize; +} + +STATIC UINT32 +AcpiPpttL1DataCacheNode ( + VOID *EntryPointer, + UINT32 CpuId + ) +{ + EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE *PpttCacheEntryPointer =3D EntryPointe= r; + + PpttL1DataCacheOffset[CpuId] =3D (UINT64)EntryPointer - (UINT64)PpttTabl= ePointer; + CopyMem ( + PpttCacheEntryPointer, + &PPTTCacheTemplate, + sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE) + ); + + AcpiPpttFillCacheSizeInfo (PpttCacheEntryPointer, 1, TRUE, FALSE); + PpttCacheEntryPointer->Attributes.CacheType =3D 0x0; /* Data Cache */ + PpttCacheEntryPointer->NextLevelOfCache =3D PpttL2CacheOffset[CpuId]; + + return PpttCacheEntryPointer->Length; +} + +STATIC UINT32 +AcpiPpttL1InstructionCacheNode ( + VOID *EntryPointer, + UINT32 CpuId + ) +{ + EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE *PpttCacheEntryPointer =3D EntryPointe= r; + + PpttL1InstructionCacheOffset[CpuId] =3D (UINT64)EntryPointer - (UINT64)P= pttTablePointer; + CopyMem ( + PpttCacheEntryPointer, + &PPTTCacheTemplate, + sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE) + ); + + AcpiPpttFillCacheSizeInfo (PpttCacheEntryPointer, 1, FALSE, FALSE); + PpttCacheEntryPointer->Attributes.CacheType =3D 0x1; /* Instruction Cach= e */ + PpttCacheEntryPointer->NextLevelOfCache =3D PpttL2CacheOffset[CpuId]; + + return PpttCacheEntryPointer->Length; +} + +STATIC UINT32 +AcpiPpttL2CacheNode ( + VOID *EntryPointer, + UINT32 CpuId + ) +{ + EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE *PpttCacheEntryPointer =3D EntryPointe= r; + + PpttL2CacheOffset[CpuId] =3D (UINT64)EntryPointer - (UINT64)PpttTablePoi= nter; + CopyMem ( + PpttCacheEntryPointer, + &PPTTCacheTemplate, + sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE) + ); + + AcpiPpttFillCacheSizeInfo (PpttCacheEntryPointer, 2, FALSE, TRUE); + PpttCacheEntryPointer->Attributes.CacheType =3D 0x3; /* Unified Cache */ + PpttCacheEntryPointer->NextLevelOfCache =3D 0; + + return PpttCacheEntryPointer->Length; +} + +/* + * Install PPTT table. + */ +EFI_STATUS +AcpiInstallPpttTable ( + VOID + ) +{ + EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR *PpttProcessorEntryPointer =3D NUL= L; + EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; + UINTN PpttTableKey =3D 0; + INTN Count; + EFI_STATUS Status; + UINTN Size; + + Status =3D gBS->LocateProtocol ( + &gEfiAcpiTableProtocolGuid, + NULL, + (VOID **)&AcpiTableProtocol + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Size =3D sizeof (EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER= ) + + sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR) + = /* Root node */ + (PLATFORM_CPU_MAX_SOCKET * sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_P= ROCESSOR)) + /* Socket node */ + (PLATFORM_CPU_MAX_CPM * PLATFORM_CPU_MAX_SOCKET * sizeof (EFI_AC= PI_6_3_PPTT_STRUCTURE_PROCESSOR)) + /* Cluster node */ + (PLATFORM_CPU_MAX_NUM_CORES * (sizeof (EFI_ACPI_6_3_PPTT_STRUCTU= RE_PROCESSOR) + 2 * sizeof (UINT32))) + /* Core node */ + (PLATFORM_CPU_MAX_NUM_CORES * sizeof (EFI_ACPI_6_3_PPTT_STRUCTUR= E_CACHE)) + /* L1I node */ + (PLATFORM_CPU_MAX_NUM_CORES * sizeof (EFI_ACPI_6_3_PPTT_STRUCTUR= E_CACHE)) + /* L1D node */ + (PLATFORM_CPU_MAX_NUM_CORES * sizeof (EFI_ACPI_6_3_PPTT_STRUCTUR= E_CACHE)); /* L2 node */ + + PpttTablePointer =3D + (EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER *)AllocateZer= oPool (Size); + if (PpttTablePointer =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + PpttProcessorEntryPointer =3D + (EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR *)((UINT64)PpttTablePointer + + sizeof (EFI_ACPI_6_3_PROCESS= OR_PROPERTIES_TOPOLOGY_TABLE_HEADER)); + + Size =3D 0; + Size +=3D AcpiPpttRootNode ((VOID *)((UINT64)PpttProcessorEntryPointer += Size)); + + for (Count =3D 0; Count < PLATFORM_CPU_MAX_SOCKET; Count++) { + Size +=3D AcpiPpttSocketNode ((VOID *)((UINT64)PpttProcessorEntryPoint= er + Size), Count); + } + + for (Count =3D 0; Count < PLATFORM_CPU_MAX_CPM * PLATFORM_CPU_MAX_SOCKET= ; Count++) { + Size +=3D AcpiPpttClusterNode ((VOID *)((UINT64)PpttProcessorEntryPoin= ter + Size), Count); + } + + for (Count =3D 0; Count < PLATFORM_CPU_MAX_NUM_CORES; Count++) { + Size +=3D AcpiPpttL2CacheNode ((VOID *)((UINT64)PpttProcessorEntryPoin= ter + Size), Count); + Size +=3D AcpiPpttL1InstructionCacheNode ((VOID *)((UINT64)PpttProcess= orEntryPointer + Size), Count); + Size +=3D AcpiPpttL1DataCacheNode ((VOID *)((UINT64)PpttProcessorEntry= Pointer + Size), Count); + Size +=3D AcpiPpttProcessorCoreNode ((VOID *)((UINT64)PpttProcessorEnt= ryPointer + Size), Count); + } + + CopyMem ( + PpttTablePointer, + &PPTTTableHeaderTemplate, + sizeof (EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER) + ); + + Size +=3D sizeof (EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADE= R); + PpttTablePointer->Header.Length =3D Size; + + AcpiUpdateChecksum ((UINT8 *)PpttTablePointer, PpttTablePointer->Header.= Length); + + Status =3D AcpiTableProtocol->InstallAcpiTable ( + AcpiTableProtocol, + (VOID *)PpttTablePointer, + PpttTablePointer->Header.Length, + &PpttTableKey + ); + FreePool ((VOID *)PpttTablePointer); + if (EFI_ERROR (Status)) { + return Status; + } + + return EFI_SUCCESS; +} diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSlit.c b/P= latform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSlit.c new file mode 100644 index 000000000000..0b534e739b4e --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSlit.c @@ -0,0 +1,187 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "AcpiPlatform.h" + +#define MAX_NODES_PER_SOCKET 4 +#define SELF_DISTANCE 10 +#define REMOTE_DISTANCE 20 + +EFI_ACPI_6_3_SYSTEM_LOCALITY_DISTANCE_INFORMATION_TABLE_HEADER SLITTableHe= aderTemplate =3D { + __ACPI_HEADER ( + EFI_ACPI_6_3_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE, + 0, /* need fill in */ + EFI_ACPI_6_3_SYSTEM_LOCALITY_DISTANCE_INFORMATION_TABLE_REVISION + ), + 0, +}; + +VOID +ComputeCoordinatesForNode ( + UINTN Node, + UINTN *X, + UINTN *Y + ) +{ + switch (Node) { + case 0: + *X =3D 0; + *Y =3D 0; + break; + case 1: + *X =3D 1; + *Y =3D 0; + break; + case 2: + *X =3D 0; + *Y =3D 1; + break; + case 3: + *X =3D 1; + *Y =3D 1; + break; + default: + *X =3D 0; + *Y =3D 0; + break; + } +} + +/** + Compute the distance between between two nodes on socket. +**/ +UINT8 +ComputeSlitDistanceOnSocket ( + UINTN Node1, + UINTN Node2 + ) +{ + UINTN X1, Y1, X2, Y2; + UINTN XDistance, YDistance; + + ComputeCoordinatesForNode (Node1, &X1, &Y1); + ComputeCoordinatesForNode (Node2, &X2, &Y2); + + XDistance =3D ABS ((INTN)(X1 - X2)); + YDistance =3D ABS ((INTN)(Y1 - Y2)); + + return (UINT8)(XDistance + YDistance + SELF_DISTANCE); +} + +/** + Compute the distance between between two nodes on + different sockets. + Node1 - local socket node number + Node2 - remote socket node number +**/ +UINT8 +ComputeSlitDistanceOnRemoteSocket ( + UINTN LocalNode, + UINTN RemoteNode + ) +{ + UINTN LocalDistance, RemoteDistance; + + // + // Mesh forwards traffic between sockets over both CCIX links when going= from + // one quadrant to another. For example, memory access from Node 0 to No= de 4 + // results in traffic being split between RCA0 and 1. Hence distance is + // different only between upper half and lower half of sockets and not + // between quadrants. Hemisphere configuration is not impacted as there + // is no upper-half. + // + LocalDistance =3D 0; + RemoteDistance =3D 0; + if (LocalNode >=3D (MAX_NODES_PER_SOCKET / 2)) { + LocalDistance =3D 1; + } + if (RemoteNode >=3D (MAX_NODES_PER_SOCKET / 2)) { + RemoteDistance =3D 1; + } + + return (UINT8)(LocalDistance + RemoteDistance + REMOTE_DISTANCE); +} + +UINT8 +ComputeSlitDistance ( + UINTN Node1, + UINTN Node2, + UINTN DomainsPerSocket + ) +{ + UINT8 Distance; + + Distance =3D 0; + if ((Node1 / DomainsPerSocket) =3D=3D (Node2 / DomainsPerSocket)) { + Distance =3D ComputeSlitDistanceOnSocket ( + Node1 % DomainsPerSocket, + Node2 % DomainsPerSocket + ); + } else { + Distance =3D ComputeSlitDistanceOnRemoteSocket ( + Node1 % DomainsPerSocket, + Node2 % DomainsPerSocket + ); + } + + return Distance; +} + +EFI_STATUS +AcpiInstallSlitTable ( + VOID + ) +{ + EFI_ACPI_TABLE_PROTOCOL *AcpiTabl= eProtocol; + EFI_STATUS Status; + UINTN NumDomain= , Count, Count1; + EFI_ACPI_6_3_SYSTEM_LOCALITY_DISTANCE_INFORMATION_TABLE_HEADER *SlitTabl= ePointer; + UINT8 *TmpPtr; + UINTN SlitTable= Key; + UINTN NumDomain= PerSocket; + + Status =3D gBS->LocateProtocol ( + &gEfiAcpiTableProtocolGuid, + NULL, + (VOID **)&AcpiTableProtocol + ); + if (EFI_ERROR (Status)) { + return Status; + } + + NumDomainPerSocket =3D CpuGetNumberOfSubNumaRegion (); + NumDomain =3D NumDomainPerSocket * GetNumberOfActiveSockets (); + + SlitTablePointer =3D (EFI_ACPI_6_3_SYSTEM_LOCALITY_DISTANCE_INFORMATION_= TABLE_HEADER *) + AllocateZeroPool (sizeof (SLITTableHeaderTemplate) + = NumDomain * NumDomain); + if (SlitTablePointer =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + CopyMem ((VOID *)SlitTablePointer, (VOID *)&SLITTableHeaderTemplate, siz= eof (SLITTableHeaderTemplate)); + SlitTablePointer->NumberOfSystemLocalities =3D NumDomain; + TmpPtr =3D (UINT8 *)SlitTablePointer + sizeof (SLITTableHeaderTemplate); + for (Count =3D 0; Count < NumDomain; Count++) { + for (Count1 =3D 0; Count1 < NumDomain; Count1++, TmpPtr++) { + *TmpPtr =3D ComputeSlitDistance (Count, Count1, NumDomainPerSocket); + } + } + + SlitTablePointer->Header.Length =3D sizeof (SLITTableHeaderTemplate) + N= umDomain * NumDomain; + + AcpiUpdateChecksum ((UINT8 *)SlitTablePointer, SlitTablePointer->Header.= Length); + + Status =3D AcpiTableProtocol->InstallAcpiTable ( + AcpiTableProtocol, + (VOID *)SlitTablePointer, + SlitTablePointer->Header.Length, + &SlitTableKey + ); + FreePool ((VOID *)SlitTablePointer); + + return Status; +} diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSrat.c b/P= latform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSrat.c new file mode 100644 index 000000000000..906b771a250c --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSrat.c @@ -0,0 +1,271 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include "AcpiPlatform.h" + +EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER SRATTableHeaderTemplate= =3D { + __ACPI_HEADER ( + EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_SIGNATURE, + 0, /* need fill in */ + EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_REVISION + ), + 0x00000001, + 0x0000000000000000, +}; + +EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE GicItsAffinityTemplate =3D { + .Type =3D EFI_ACPI_6_3_GIC_ITS_AFFINITY, + sizeof (EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE), + .ProximityDomain =3D 0, /* ProximityDomain */ + { EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE }, + .ItsId =3D 0, +}; + +STATIC +UINTN +SratCalculateNumMemoryRegion ( + VOID + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + UINTN Count; + UINT64 TmpVal; + VOID *Hob; + UINTN Result; + + /* Get the Platform HOB */ + Hob =3D GetFirstGuidHob (&gPlatformInfoHobGuid); + if (Hob =3D=3D NULL) { + return 0; + } + PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + + Result =3D 0; + for (Count =3D 0; Count < PlatformHob->DramInfo.NumRegion; Count++) { + TmpVal =3D PlatformHob->DramInfo.Size[Count]; + if (TmpVal > 0) { + Result++; + } + } + + return Result; +} + +STATIC +EFI_STATUS +SratAddMemAffinity ( + EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE *SratMemAffinity + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + UINTN Count, NumRegion; + UINT64 RegionSize, RegionBase; + VOID *Hob; + UINTN ProximityDomain; + + /* Get the Platform HOB */ + Hob =3D GetFirstGuidHob (&gPlatformInfoHobGuid); + if (Hob =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + + NumRegion =3D 0; + + for (Count =3D 0; Count < PlatformHob->DramInfo.NumRegion; Count++) { + RegionSize =3D PlatformHob->DramInfo.Size[Count]; + RegionBase =3D PlatformHob->DramInfo.Base[Count]; + ProximityDomain =3D PlatformHob->DramInfo.Node[Count]; + if (RegionSize > 0) { + ZeroMem ((VOID *)&SratMemAffinity[NumRegion], sizeof (SratMemAffinit= y[NumRegion])); + SratMemAffinity[NumRegion].Flags =3D EFI_ACPI_6_3_MEMORY_ENABLED; + if (PlatformHob->DramInfo.NvdRegion[Count] !=3D 0) { + /* Mark NVDIMM-N region as HOT_PLUGGABLE and NON-VOLATILE */ + SratMemAffinity[NumRegion].Flags |=3D EFI_ACPI_6_3_MEMORY_HOT_PLUG= GABLE | + EFI_ACPI_6_3_MEMORY_NONVOLATIL= E; + } + SratMemAffinity[NumRegion].LengthLow =3D + (UINT32)(RegionSize & 0xFFFFFFFF); + SratMemAffinity[NumRegion].LengthHigh =3D + (UINT32)((RegionSize & 0xFFFFFFFF00000000ULL) >> 32); + SratMemAffinity[NumRegion].AddressBaseLow =3D + (UINT32)(RegionBase & 0xFFFFFFFF); + SratMemAffinity[NumRegion].AddressBaseHigh =3D + (UINT32)((RegionBase & 0xFFFFFFFF00000000ULL) >> 32); + SratMemAffinity[NumRegion].ProximityDomain =3D (UINT32)(ProximityDom= ain); + SratMemAffinity[NumRegion].Type =3D EFI_ACPI_6_3_MEMORY_AFFINITY; + SratMemAffinity[NumRegion].Length =3D sizeof (EFI_ACPI_6_3_MEMORY_AF= FINITY_STRUCTURE); + NumRegion++; + } + } + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS +SratAddGiccAffinity ( + EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE *SratGiccAffinity + ) +{ + ARM_PROCESSOR_TABLE *ArmProcessorTable; + ARM_CORE_INFO *ArmCoreInfoTable; + UINTN Count, NumNode, Idx; + UINT32 AcpiProcessorUid; + UINT8 Socket; + UINT8 Cpm; + + for (Idx =3D 0; Idx < gST->NumberOfTableEntries; Idx++) { + if (CompareGuid (&gArmMpCoreInfoGuid, &(gST->ConfigurationTable[Idx].V= endorGuid))) { + ArmProcessorTable =3D (ARM_PROCESSOR_TABLE *)gST->ConfigurationTable= [Idx].VendorTable; + ArmCoreInfoTable =3D ArmProcessorTable->ArmCpus; + break; + } + } + + if (Idx =3D=3D gST->NumberOfTableEntries) { + return EFI_INVALID_PARAMETER; + } + + Count =3D 0; + NumNode =3D 0; + while (Count !=3D ArmProcessorTable->NumberOfEntries) { + for (Idx =3D 0; Idx < ArmProcessorTable->NumberOfEntries; Idx++ ) { + Socket =3D ArmCoreInfoTable[Idx].ClusterId; + Cpm =3D (ArmCoreInfoTable[Idx].CoreId >> PLATFORM_CPM_UID_BIT_OFFSET= ); + if (CpuGetSubNumNode (Socket, Cpm) !=3D NumNode) { + /* We add nodes based on ProximityDomain order */ + continue; + } + AcpiProcessorUid =3D (ArmCoreInfoTable[Idx].ClusterId << PLATFORM_SO= CKET_UID_BIT_OFFSET) + + ArmCoreInfoTable[Idx].CoreId; + ZeroMem ((VOID *)&SratGiccAffinity[Count], sizeof (SratGiccAffinity[= Count])); + SratGiccAffinity[Count].AcpiProcessorUid =3D AcpiProcessorUid; + SratGiccAffinity[Count].Flags =3D 1; + SratGiccAffinity[Count].Length =3D sizeof (EFI_ACPI_6_3_GICC_AFFINIT= Y_STRUCTURE); + SratGiccAffinity[Count].Type =3D EFI_ACPI_6_3_GICC_AFFINITY; + SratGiccAffinity[Count].ProximityDomain =3D CpuGetSubNumNode (Socket= , Cpm); + Count++; + } + NumNode++; + } + + return EFI_SUCCESS; +} + +STATIC UINT32 +InstallGicItsAffinity ( + VOID *EntryPointer, + UINT32 Index + ) +{ + EFI_ACPI_6_3_GIC_ITS_AFFINITY_STRUCTURE *ItsAffinityEntryPointer =3D Ent= ryPointer; + UINTN Size; + + Size =3D sizeof (GicItsAffinityTemplate); + CopyMem (ItsAffinityEntryPointer, &GicItsAffinityTemplate, Size); + return Size; +} + +STATIC +EFI_STATUS +SratAddGicItsAffinity ( + VOID *TmpPtr + ) +{ + UINTN Size =3D 0; + UINTN Index; + + /* Install Gic ITSAffinity */ + if (!IsSlaveSocketAvailable ()) { + for (Index =3D 0; Index <=3D 1; Index++) { /* RCA0/1 */ + GicItsAffinityTemplate.ItsId =3D Index; + GicItsAffinityTemplate.ProximityDomain =3D 0; + Size +=3D InstallGicItsAffinity ((VOID *)((UINT64)TmpPtr + Size), In= dex); + } + } + + for (Index =3D SOCKET0_FIRST_RC; Index <=3D SOCKET0_LAST_RC; Index++) { + GicItsAffinityTemplate.ItsId =3D Index; + GicItsAffinityTemplate.ProximityDomain =3D 0; + Size +=3D InstallGicItsAffinity ((VOID *)((UINT64)TmpPtr + Size), Inde= x); + } + + if (IsSlaveSocketActive ()) { + for (Index =3D SOCKET1_FIRST_RC; Index <=3D SOCKET1_LAST_RC; Index++) { + GicItsAffinityTemplate.ItsId =3D Index; + GicItsAffinityTemplate.ProximityDomain =3D 1; + Size +=3D InstallGicItsAffinity ((VOID *)((UINT64)TmpPtr + Size), In= dex); + } + } + + return EFI_SUCCESS; +} + +EFI_STATUS +AcpiInstallSratTable ( + VOID + ) +{ + EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; + EFI_STATUS Status; + EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER *SratTablePointer; + UINT8 *TmpPtr; + UINTN SratTableKey; + UINTN Size; + + Status =3D gBS->LocateProtocol ( + &gEfiAcpiTableProtocolGuid, + NULL, + (VOID **)&AcpiTableProtocol + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Size =3D sizeof (SRATTableHeaderTemplate) + + SratCalculateNumMemoryRegion () * sizeof (EFI_ACPI_6_3_MEMORY_AFF= INITY_STRUCTURE) + + GetNumberOfActiveCores () * sizeof (EFI_ACPI_6_3_GICC_AFFINITY_ST= RUCTURE) + + ((SOCKET0_LAST_RC - SOCKET0_FIRST_RC + 1) * sizeof (GicItsAffini= tyTemplate)); + if (IsSlaveSocketActive ()) { + Size +=3D (SOCKET1_LAST_RC - SOCKET1_FIRST_RC + 1) * sizeof (GicItsAf= finityTemplate); + } else if (!IsSlaveSocketAvailable ()) { + Size +=3D 2 * sizeof (GicItsAffinityTemplate); /* RCA0/1 */ + } + + SratTablePointer =3D (EFI_ACPI_6_3_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER= *)AllocateZeroPool (Size); + if (SratTablePointer =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + CopyMem ((VOID *)SratTablePointer, (VOID *)&SRATTableHeaderTemplate, siz= eof (SRATTableHeaderTemplate)); + + TmpPtr =3D (UINT8 *)SratTablePointer + sizeof (SRATTableHeaderTemplate); + Status =3D SratAddMemAffinity ((EFI_ACPI_6_3_MEMORY_AFFINITY_STRUCTURE *= )TmpPtr); + ASSERT_EFI_ERROR (Status); + + TmpPtr +=3D SratCalculateNumMemoryRegion () * sizeof (EFI_ACPI_6_3_MEMOR= Y_AFFINITY_STRUCTURE); + Status =3D SratAddGiccAffinity ((EFI_ACPI_6_3_GICC_AFFINITY_STRUCTURE *)= TmpPtr); + ASSERT_EFI_ERROR (Status); + + TmpPtr +=3D GetNumberOfActiveCores () * sizeof (EFI_ACPI_6_3_GICC_AFFINI= TY_STRUCTURE); + SratAddGicItsAffinity ((VOID *)(UINT64)TmpPtr); + SratTablePointer->Header.Length =3D Size; + + AcpiUpdateChecksum ((UINT8 *)SratTablePointer, SratTablePointer->Header.= Length); + + Status =3D AcpiTableProtocol->InstallAcpiTable ( + AcpiTableProtocol, + (VOID *)SratTablePointer, + SratTablePointer->Header.Length, + &SratTableKey + ); + FreePool ((VOID *)SratTablePointer); + + return Status; +} diff --git a/Platform/Ampere/JadePkg/AcpiTables/CPU-S0.asi b/Platform/Amper= e/JadePkg/AcpiTables/CPU-S0.asi new file mode 100644 index 000000000000..969cece130ad --- /dev/null +++ b/Platform/Ampere/JadePkg/AcpiTables/CPU-S0.asi @@ -0,0 +1,5639 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +Device(C000) { + Name(_HID, "ACPI0007") + Name(_UID, 0x0) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x000, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x004, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x008, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x00c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x010, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x014, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x050, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x054, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x058, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 0, 0xFD, 2} + }) // Domain 0 +} + +Device(C001) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x080, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x084, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x088, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x08c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x090, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x094, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xbc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x0d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x0d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x0d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 1, 0xFD, 2} + }) // Domain 1 +} + +Device(C002) { + Name(_HID, "ACPI0007") + Name(_UID, 0x100) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x100, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x104, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x108, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x10c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x110, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x114, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x12c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x134, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x13c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x150, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x154, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x158, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 2, 0xFD, 2} + }) // Domain 2 +} + +Device(C003) { + Name(_HID, "ACPI0007") + Name(_UID, 0x101) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x180, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x184, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x188, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x18c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x190, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x194, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 3, 0xFD, 2} + }) // Domain 3 +} + +Device(C004) { + Name(_HID, "ACPI0007") + Name(_UID, 0x200) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x200, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x204, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x208, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x20c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x210, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x214, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x22c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x234, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x23c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x250, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x254, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x258, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 4, 0xFD, 2} + }) // Domain 4 +} + +Device(C005) { + Name(_HID, "ACPI0007") + Name(_UID, 0x201) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x280, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x284, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x288, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x28c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x290, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x294, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 5, 0xFD, 2} + }) // Domain 5 +} + +Device(C006) { + Name(_HID, "ACPI0007") + Name(_UID, 0x300) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x300, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x304, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x308, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x30c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x310, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x314, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x32c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x334, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x33c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x350, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x354, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x358, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 6, 0xFD, 2} + }) // Domain 6 +} + +Device(C007) { + Name(_HID, "ACPI0007") + Name(_UID, 0x301) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x380, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x384, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x388, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x38c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x390, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x394, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 7, 0xFD, 2} + }) // Domain 7 +} + +Device(C008) { + Name(_HID, "ACPI0007") + Name(_UID, 0x400) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x400, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x404, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x408, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x40c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x410, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x414, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x42c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x434, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x43c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x450, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x454, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x458, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 8, 0xFD, 2} + }) // Domain 8 +} + +Device(C009) { + Name(_HID, "ACPI0007") + Name(_UID, 0x401) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x480, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x484, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x488, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x48c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x490, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x494, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x4ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x4b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x4bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x4d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x4d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x4d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 9, 0xFD, 2} + }) // Domain 9 +} + +Device(C010) { + Name(_HID, "ACPI0007") + Name(_UID, 0x500) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x500, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x504, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x508, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x50c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x510, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x514, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x52c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x534, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x53c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x550, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x554, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x558, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 10, 0xFD, 2} + }) // Domain 10 +} + +Device(C011) { + Name(_HID, "ACPI0007") + Name(_UID, 0x501) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x580, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x584, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x588, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x58c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x590, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x594, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x5ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x5b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x5bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x5d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x5d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x5d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 11, 0xFD, 2} + }) // Domain 11 +} + +Device(C012) { + Name(_HID, "ACPI0007") + Name(_UID, 0x600) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x600, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x604, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x608, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x60c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x610, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x614, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x62c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x634, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x63c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x650, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x654, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x658, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 12, 0xFD, 2} + }) // Domain 12 +} + +Device(C013) { + Name(_HID, "ACPI0007") + Name(_UID, 0x601) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x680, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x684, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x688, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x68c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x690, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x694, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x6ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x6b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x6bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x6d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x6d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x6d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 13, 0xFD, 2} + }) // Domain 13 +} + +Device(C014) { + Name(_HID, "ACPI0007") + Name(_UID, 0x700) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x700, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x704, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x708, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x70c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x710, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x714, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x72c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x734, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x73c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x750, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x754, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x758, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 14, 0xFD, 2} + }) // Domain 14 +} + +Device(C015) { + Name(_HID, "ACPI0007") + Name(_UID, 0x701) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x780, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x784, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x788, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x78c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x790, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x794, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x7ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x7b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x7bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x7d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x7d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x7d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 15, 0xFD, 2} + }) // Domain 15 +} + +Device(C016) { + Name(_HID, "ACPI0007") + Name(_UID, 0x800) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x800, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x804, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x808, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x80c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x810, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x814, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x82c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x834, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x83c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x850, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x854, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x858, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 16, 0xFD, 2} + }) // Domain 16 +} + +Device(C017) { + Name(_HID, "ACPI0007") + Name(_UID, 0x801) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x880, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x884, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x888, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x88c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x890, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x894, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x8ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x8b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x8bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x8d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x8d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x8d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 17, 0xFD, 2} + }) // Domain 17 +} + +Device(C018) { + Name(_HID, "ACPI0007") + Name(_UID, 0x900) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x900, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x904, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x908, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x90c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x910, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x914, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x92c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x934, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x93c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x950, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x954, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x958, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 18, 0xFD, 2} + }) // Domain 18 +} + +Device(C019) { + Name(_HID, "ACPI0007") + Name(_UID, 0x901) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x980, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x984, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x988, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x98c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x990, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x994, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x9ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x9b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x9bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x9d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x9d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x9d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 19, 0xFD, 2} + }) // Domain 19 +} + +Device(C020) { + Name(_HID, "ACPI0007") + Name(_UID, 0xa00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xa00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xa04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xa08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xa0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xa10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xa14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xa2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xa34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xa3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xa50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xa54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xa58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 20, 0xFD, 2} + }) // Domain 20 +} + +Device(C021) { + Name(_HID, "ACPI0007") + Name(_UID, 0xa01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xa80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xa84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xa88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xa8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xa90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xa94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xaac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xab4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xabc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xad0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xad4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xad8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 21, 0xFD, 2} + }) // Domain 21 +} + +Device(C022) { + Name(_HID, "ACPI0007") + Name(_UID, 0xb00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xb00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xb04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xb08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xb0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xb10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xb14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xb2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xb34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xb3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xb50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xb54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xb58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 22, 0xFD, 2} + }) // Domain 22 +} + +Device(C023) { + Name(_HID, "ACPI0007") + Name(_UID, 0xb01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xb80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xb84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xb88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xb8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xb90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xb94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xbac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xbb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xbbc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xbd0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xbd4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xbd8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 23, 0xFD, 2} + }) // Domain 23 +} + +Device(C024) { + Name(_HID, "ACPI0007") + Name(_UID, 0xc00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xc00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xc04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xc08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xc0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xc10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xc14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xc2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xc34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xc3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xc50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xc54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xc58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 24, 0xFD, 2} + }) // Domain 24 +} + +Device(C025) { + Name(_HID, "ACPI0007") + Name(_UID, 0xc01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xc80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xc84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xc88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xc8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xc90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xc94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xcac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xcb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xcbc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xcd0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xcd4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xcd8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 25, 0xFD, 2} + }) // Domain 25 +} + +Device(C026) { + Name(_HID, "ACPI0007") + Name(_UID, 0xd00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xd00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xd04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xd08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xd0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xd10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xd14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xd2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xd34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xd3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xd50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xd54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xd58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 26, 0xFD, 2} + }) // Domain 26 +} + +Device(C027) { + Name(_HID, "ACPI0007") + Name(_UID, 0xd01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xd80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xd84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xd88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xd8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xd90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xd94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xdac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xdb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xdbc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xdd0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xdd4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xdd8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 27, 0xFD, 2} + }) // Domain 27 +} + +Device(C028) { + Name(_HID, "ACPI0007") + Name(_UID, 0xe00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xe00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xe04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xe08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xe0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xe10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xe14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xe2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xe34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xe3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xe50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xe54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xe58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 28, 0xFD, 2} + }) // Domain 28 +} + +Device(C029) { + Name(_HID, "ACPI0007") + Name(_UID, 0xe01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xe80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xe84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xe88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xe8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xe90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xe94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xeac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xeb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xebc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xed0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xed4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xed8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 29, 0xFD, 2} + }) // Domain 29 +} + +Device(C030) { + Name(_HID, "ACPI0007") + Name(_UID, 0xf00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xf00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xf04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xf08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xf0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xf10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xf14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xf2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xf34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xf3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xf50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xf54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xf58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 30, 0xFD, 2} + }) // Domain 30 +} + +Device(C031) { + Name(_HID, "ACPI0007") + Name(_UID, 0xf01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xf80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xf84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xf88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xf8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xf90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xf94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xfac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xfb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xfbc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xfd0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xfd4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xfd8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 31, 0xFD, 2} + }) // Domain 31 +} + +Device(C032) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1000) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1000, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1004, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1008, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x100c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1010, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1014, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x102c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1034, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x103c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1050, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1054, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1058, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 32, 0xFD, 2} + }) // Domain 32 +} + +Device(C033) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1001) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1080, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1084, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1088, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x108c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1090, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1094, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x10ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x10b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x10bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x10d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x10d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x10d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 33, 0xFD, 2} + }) // Domain 33 +} + +Device(C034) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1100) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1100, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1104, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1108, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x110c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1110, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1114, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x112c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1134, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x113c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1150, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1154, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1158, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 34, 0xFD, 2} + }) // Domain 34 +} + +Device(C035) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1101) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1180, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1184, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1188, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x118c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1190, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1194, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x11ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x11b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x11bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x11d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x11d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x11d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 35, 0xFD, 2} + }) // Domain 35 +} + +Device(C036) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1200) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1200, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1204, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1208, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x120c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1210, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1214, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x122c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1234, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x123c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1250, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1254, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1258, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 36, 0xFD, 2} + }) // Domain 36 +} + +Device(C037) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1201) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1280, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1284, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1288, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x128c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1290, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1294, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x12ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x12b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x12bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x12d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x12d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x12d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 37, 0xFD, 2} + }) // Domain 37 +} + +Device(C038) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1300) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1300, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1304, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1308, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x130c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1310, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1314, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x132c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1334, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x133c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1350, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1354, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1358, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 38, 0xFD, 2} + }) // Domain 38 +} + +Device(C039) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1301) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1380, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1384, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1388, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x138c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1390, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1394, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x13ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x13b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x13bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x13d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x13d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x13d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 39, 0xFD, 2} + }) // Domain 39 +} + +Device(C040) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1400) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1400, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1404, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1408, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x140c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1410, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1414, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x142c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1434, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x143c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1450, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1454, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1458, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 40, 0xFD, 2} + }) // Domain 40 +} + +Device(C041) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1401) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1480, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1484, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1488, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x148c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1490, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1494, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x14ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x14b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x14bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x14d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x14d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x14d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 41, 0xFD, 2} + }) // Domain 41 +} + +Device(C042) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1500) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1500, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1504, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1508, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x150c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1510, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1514, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x152c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1534, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x153c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1550, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1554, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1558, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 42, 0xFD, 2} + }) // Domain 42 +} + +Device(C043) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1501) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1580, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1584, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1588, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x158c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1590, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1594, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x15ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x15b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x15bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x15d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x15d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x15d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 43, 0xFD, 2} + }) // Domain 43 +} + +Device(C044) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1600) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1600, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1604, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1608, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x160c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1610, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1614, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x162c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1634, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x163c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1650, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1654, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1658, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 44, 0xFD, 2} + }) // Domain 44 +} + +Device(C045) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1601) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1680, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1684, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1688, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x168c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1690, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1694, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x16ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x16b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x16bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x16d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x16d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x16d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 45, 0xFD, 2} + }) // Domain 45 +} + +Device(C046) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1700) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1700, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1704, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1708, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x170c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1710, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1714, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x172c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1734, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x173c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1750, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1754, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1758, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 46, 0xFD, 2} + }) // Domain 46 +} + +Device(C047) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1701) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1780, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1784, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1788, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x178c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1790, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1794, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x17ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x17b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x17bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x17d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x17d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x17d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 47, 0xFD, 2} + }) // Domain 47 +} + +Device(C048) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1800) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1800, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1804, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1808, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x180c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1810, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1814, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x182c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1834, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x183c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1850, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1854, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1858, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 48, 0xFD, 2} + }) // Domain 48 +} + +Device(C049) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1801) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1880, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1884, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1888, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x188c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1890, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1894, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x18ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x18b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x18bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x18d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x18d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x18d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 49, 0xFD, 2} + }) // Domain 49 +} + +Device(C050) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1900) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1900, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1904, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1908, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x190c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1910, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1914, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x192c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1934, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x193c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1950, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1954, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1958, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 50, 0xFD, 2} + }) // Domain 50 +} + +Device(C051) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1901) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1980, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1984, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1988, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x198c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1990, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1994, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x19ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x19b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x19bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x19d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x19d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x19d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 51, 0xFD, 2} + }) // Domain 51 +} + +Device(C052) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1a00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1a00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1a04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1a08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1a0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1a10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1a14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1a2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1a34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1a3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1a50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1a54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1a58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 52, 0xFD, 2} + }) // Domain 52 +} + +Device(C053) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1a01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1a80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1a84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1a88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1a8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1a90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1a94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1aac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1ab4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1abc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1ad0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1ad4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1ad8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 53, 0xFD, 2} + }) // Domain 53 +} + +Device(C054) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1b00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1b00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1b04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1b08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1b0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1b10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1b14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1b2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1b34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1b3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1b50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1b54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1b58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 54, 0xFD, 2} + }) // Domain 54 +} + +Device(C055) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1b01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1b80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1b84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1b88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1b8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1b90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1b94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1bac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1bb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1bbc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1bd0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1bd4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1bd8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 55, 0xFD, 2} + }) // Domain 5 +} + +Device(C056) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1c00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1c00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1c04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1c08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1c0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1c10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1c14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1c2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1c34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1c3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1c50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1c54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1c58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 56, 0xFD, 2} + }) // Domain 56 +} + +Device(C057) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1c01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1c80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1c84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1c88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1c8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1c90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1c94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1cac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1cb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1cbc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1cd0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1cd4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1cd8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 57, 0xFD, 2} + }) // Domain 57 +} + +Device(C058) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1d00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1d00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1d04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1d08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1d0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1d10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1d14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1d2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1d34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1d3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1d50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1d54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1d58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 58, 0xFD, 2} + }) // Domain 58 +} + +Device(C059) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1d01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1d80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1d84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1d88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1d8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1d90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1d94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1dac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1db4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1dbc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1dd0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1dd4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1dd8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 59, 0xFD, 2} + }) // Domain 59 +} + +Device(C060) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1e00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1e00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1e04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1e08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1e0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1e10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1e14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1e2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1e34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1e3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1e50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1e54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1e58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 60, 0xFD, 2} + }) // Domain 60 +} + +Device(C061) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1e01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1e80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1e84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1e88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1e8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1e90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1e94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1eac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1eb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1ebc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1ed0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1ed4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1ed8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 61, 0xFD, 2} + }) // Domain 61 +} + +Device(C062) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1f00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1f00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1f04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1f08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1f0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1f10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1f14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1f2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1f34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1f3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1f50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1f54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1f58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 62, 0xFD, 2} + }) // Domain 62 +} + +Device(C063) { + Name(_HID, "ACPI0007") + Name(_UID, 0x1f01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1f80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1f84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1f88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1f8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1f90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1f94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1fac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1fb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1fbc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1fd0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1fd4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1fd8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 63, 0xFD, 2} + }) // Domain 63 +} + +Device(C064) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2000) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2000, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2004, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2008, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x200c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2010, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2014, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x202c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2034, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x203c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2050, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2054, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2058, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 64, 0xFD, 2} + }) // Domain 64 +} + +Device(C065) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2001) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2080, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2084, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2088, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x208c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2090, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2094, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x20ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x20b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x20bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x20d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x20d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x20d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 65, 0xFD, 2} + }) // Domain 65 +} + +Device(C066) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2100) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2100, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2104, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2108, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x210c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2110, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2114, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x212c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2134, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x213c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2150, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2154, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2158, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 66, 0xFD, 2} + }) // Domain 66 +} + +Device(C067) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2101) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2180, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2184, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2188, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x218c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2190, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2194, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x21ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x21b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x21bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x21d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x21d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x21d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 67, 0xFD, 2} + }) // Domain 67 +} + +Device(C068) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2200) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2200, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2204, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2208, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x220c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2210, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2214, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x222c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2234, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x223c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2250, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2254, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2258, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 68, 0xFD, 2} + }) // Domain 68 +} + +Device(C069) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2201) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2280, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2284, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2288, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x228c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2290, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2294, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x22ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x22b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x22bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x22d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x22d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x22d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 69, 0xFD, 2} + }) // Domain 69 +} + +Device(C070) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2300) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2300, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2304, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2308, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x230c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2310, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2314, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x232c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2334, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x233c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2350, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2354, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2358, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 70, 0xFD, 2} + }) // Domain 70 +} + +Device(C071) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2301) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2380, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2384, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2388, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x238c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2390, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2394, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x23ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x23b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x23bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x23d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x23d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x23d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 71, 0xFD, 2} + }) // Domain 71 +} + +Device(C072) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2400) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2400, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2404, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2408, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x240c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2410, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2414, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x242c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2434, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x243c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2450, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2454, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2458, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 72, 0xFD, 2} + }) // Domain 72 +} + +Device(C073) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2401) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2480, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2484, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2488, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x248c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2490, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2494, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x24ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x24b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x24bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x24d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x24d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x24d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 73, 0xFD, 2} + }) // Domain 73 +} + +Device(C074) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2500) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2500, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2504, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2508, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x250c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2510, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2514, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x252c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2534, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x253c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2550, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2554, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2558, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 74, 0xFD, 2} + }) // Domain 74 +} + +Device(C075) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2501) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2580, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2584, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2588, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x258c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2590, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2594, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x25ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x25b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x25bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x25d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x25d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x25d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 75, 0xFD, 2} + }) // Domain 75 +} + +Device(C076) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2600) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2600, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2604, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2608, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x260c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2610, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2614, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x262c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2634, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x263c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2650, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2654, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2658, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 76, 0xFD, 2} + }) // Domain 76 +} + +Device(C077) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2601) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2680, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2684, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2688, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x268c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2690, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2694, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x26ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x26b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x26bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x26d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x26d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x26d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 77, 0xFD, 2} + }) // Domain 77 +} + +Device(C078) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2700) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2700, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2704, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2708, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x270c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2710, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2714, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x272c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2734, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x273c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2750, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2754, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2758, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 78, 0xFD, 2} + }) // Domain 78 +} + +Device(C079) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2701) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2780, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2784, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2788, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x278c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2790, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2794, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x27ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x27b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x27bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x27d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x27d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x27d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 79, 0xFD, 2} + }) // Domain 79 +} + +Device(C080) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2800) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2800, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2804, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2808, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x280c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2810, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2814, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x282c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2834, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x283c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2850, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2854, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2858, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 80, 0xFD, 2} + }) // Domain 80 +} + +Device(C081) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2801) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2880, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2884, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2888, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x288c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2890, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2894, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x28ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x28b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x28bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x28d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x28d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x28d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 81, 0xFD, 2} + }) // Domain 81 +} + +Device(C082) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2900) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2900, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2904, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2908, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x290c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2910, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2914, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x292c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2934, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x293c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2950, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2954, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2958, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 82, 0xFD, 2} + }) // Domain 82 +} + +Device(C083) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2901) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2980, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2984, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2988, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x298c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2990, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2994, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x29ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x29b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x29bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x29d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x29d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x29d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 83, 0xFD, 2} + }) // Domain 83 +} + +Device(C084) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2a00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2a00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2a04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2a08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2a0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2a10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2a14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2a2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2a34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2a3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2a50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2a54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2a58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 84, 0xFD, 2} + }) // Domain 84 +} + +Device(C085) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2a01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2a80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2a84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2a88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2a8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2a90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2a94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2aac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2ab4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2abc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2ad0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2ad4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2ad8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 85, 0xFD, 2} + }) // Domain 85 +} + +Device(C086) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2b00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2b00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2b04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2b08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2b0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2b10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2b14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2b2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2b34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2b3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2b50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2b54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2b58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 86, 0xFD, 2} + }) // Domain 86 +} + +Device(C087) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2b01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2b80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2b84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2b88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2b8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2b90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2b94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2bac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2bb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2bbc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2bd0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2bd4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2bd8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 87, 0xFD, 2} + }) // Domain 87 +} + +Device(C088) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2c00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2c00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2c04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2c08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2c0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2c10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2c14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2c2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2c34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2c3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2c50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2c54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2c58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 88, 0xFD, 2} + }) // Domain 88 +} + +Device(C089) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2c01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2c80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2c84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2c88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2c8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2c90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2c94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2cac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2cb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2cbc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2cd0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2cd4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2cd8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 89, 0xFD, 2} + }) // Domain 89 +} + +Device(C090) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2d00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2d00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2d04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2d08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2d0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2d10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2d14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2d2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2d34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2d3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2d50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2d54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2d58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 90, 0xFD, 2} + }) // Domain 90 +} + +Device(C091) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2d01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2d80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2d84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2d88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2d8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2d90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2d94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2dac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2db4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2dbc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2dd0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2dd4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2dd8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 91, 0xFD, 2} + }) // Domain 91 +} + +Device(C092) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2e00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2e00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2e04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2e08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2e0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2e10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2e14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2e2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2e34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2e3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2e50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2e54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2e58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 92, 0xFD, 2} + }) // Domain 92 +} + +Device(C093) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2e01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2e80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2e84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2e88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2e8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2e90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2e94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2eac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2eb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2ebc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2ed0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2ed4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2ed8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 93, 0xFD, 2} + }) // Domain 93 +} + +Device(C094) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2f00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2f00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2f04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2f08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2f0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2f10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2f14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2f2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2f34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2f3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2f50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2f54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2f58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 94, 0xFD, 2} + }) // Domain 94 +} + +Device(C095) { + Name(_HID, "ACPI0007") + Name(_UID, 0x2f01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2f80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2f84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2f88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2f8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2f90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2f94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2fac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2fb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2fbc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2fd0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2fd4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2fd8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 95, 0xFD, 2} + }) // Domain 95 +} + +Device(C096) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3000) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3000, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3004, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3008, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x300c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3010, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3014, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x302c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3034, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x303c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3050, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3054, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3058, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 96, 0xFD, 2} + }) // Domain 96 +} + +Device(C097) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3001) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3080, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3084, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3088, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x308c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3090, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3094, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x30ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x30b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x30bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x30d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x30d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x30d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 97, 0xFD, 2} + }) // Domain 97 +} + +Device(C098) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3100) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3100, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3104, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3108, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x310c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3110, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3114, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x312c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3134, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x313c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3150, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3154, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3158, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 98, 0xFD, 2} + }) // Domain 98 +} + +Device(C099) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3101) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3180, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3184, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3188, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x318c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3190, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3194, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x31ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x31b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x31bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x31d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x31d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x31d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 99, 0xFD, 2} + }) // Domain 99 +} + +Device(C100) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3200) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3200, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3204, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3208, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x320c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3210, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3214, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x322c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3234, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x323c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3250, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3254, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3258, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 100, 0xFD, 2} + }) // Domain 100 +} + +Device(C101) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3201) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3280, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3284, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3288, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x328c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3290, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3294, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x32ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x32b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x32bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x32d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x32d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x32d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 101, 0xFD, 2} + }) // Domain 101 +} + +Device(C102) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3300) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3300, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3304, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3308, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x330c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3310, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3314, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x332c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3334, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x333c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3350, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3354, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3358, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 102, 0xFD, 2} + }) // Domain 102 +} + +Device(C103) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3301) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3380, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3384, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3388, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x338c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3390, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3394, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x33ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x33b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x33bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x33d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x33d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x33d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 103, 0xFD, 2} + }) // Domain 103 +} + +Device(C104) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3400) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3400, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3404, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3408, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x340c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3410, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3414, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x342c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3434, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x343c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3450, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3454, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3458, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 104, 0xFD, 2} + }) // Domain 104 +} + +Device(C105) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3401) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3480, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3484, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3488, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x348c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3490, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3494, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x34ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x34b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x34bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x34d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x34d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x34d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 105, 0xFD, 2} + }) // Domain 105 +} + +Device(C106) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3500) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3500, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3504, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3508, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x350c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3510, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3514, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x352c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3534, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x353c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3550, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3554, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3558, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 106, 0xFD, 2} + }) // Domain 106 +} + +Device(C107) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3501) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3580, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3584, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3588, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x358c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3590, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3594, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x35ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x35b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x35bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x35d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x35d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x35d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 107, 0xFD, 2} + }) // Domain 107 +} + +Device(C108) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3600) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3600, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3604, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3608, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x360c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3610, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3614, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x362c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3634, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x363c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3650, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3654, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3658, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 108, 0xFD, 2} + }) // Domain 108 +} + +Device(C109) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3601) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3680, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3684, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3688, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x368c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3690, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3694, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x36ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x36b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x36bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x36d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x36d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x36d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 109, 0xFD, 2} + }) // Domain 109 +} + +Device(C110) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3700) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3700, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3704, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3708, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x370c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3710, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3714, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x372c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3734, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x373c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3750, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3754, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3758, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 110, 0xFD, 2} + }) // Domain 110 +} + +Device(C111) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3701) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3780, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3784, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3788, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x378c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3790, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3794, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x37ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x37b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x37bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x37d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x37d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x37d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 111, 0xFD, 2} + }) // Domain 111 +} + +Device(C112) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3800) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3800, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3804, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3808, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x380c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3810, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3814, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x382c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3834, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x383c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3850, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3854, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3858, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 112, 0xFD, 2} + }) // Domain 112 +} + +Device(C113) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3801) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3880, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3884, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3888, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x388c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3890, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3894, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x38ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x38b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x38bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x38d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x38d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x38d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 113, 0xFD, 2} + }) // Domain 113 +} + +Device(C114) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3900) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3900, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3904, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3908, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x390c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3910, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3914, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x392c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3934, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x393c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3950, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3954, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3958, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 114, 0xFD, 2} + }) // Domain 114 +} + +Device(C115) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3901) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3980, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3984, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3988, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x398c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3990, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3994, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x39ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x39b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x39bc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x39d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x39d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x39d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 115, 0xFD, 2} + }) // Domain 115 +} + +Device(C116) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3a00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3a00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3a04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3a08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3a0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3a10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3a14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3a2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3a34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3a3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3a50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3a54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3a58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 116, 0xFD, 2} + }) // Domain 116 +} + +Device(C117) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3a01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3a80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3a84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3a88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3a8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3a90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3a94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3aac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3ab4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3abc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3ad0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3ad4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3ad8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 117, 0xFD, 2} + }) // Domain 117 +} + +Device(C118) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3b00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3b00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3b04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3b08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3b0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3b10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3b14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3b2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3b34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3b3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3b50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3b54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3b58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 118, 0xFD, 2} + }) // Domain 118 +} + +Device(C119) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3b01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3b80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3b84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3b88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3b8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3b90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3b94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3bac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3bb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3bbc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3bd0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3bd4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3bd8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 119, 0xFD, 2} + }) // Domain 119 +} + +Device(C120) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3c00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3c00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3c04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3c08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3c0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3c10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3c14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3c2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3c34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3c3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3c50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3c54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3c58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 120, 0xFD, 2} + }) // Domain 120 +} + +Device(C121) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3c01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3c80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3c84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3c88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3c8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3c90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3c94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3cac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3cb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3cbc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3cd0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3cd4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3cd8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 121, 0xFD, 2} + }) // Domain 121 +} + +Device(C122) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3d00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3d00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3d04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3d08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3d0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3d10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3d14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3d2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3d34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3d3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3d50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3d54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3d58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 122, 0xFD, 2} + }) // Domain 122 +} + +Device(C123) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3d01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3d80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3d84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3d88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3d8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3d90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3d94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3dac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3db4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3dbc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3dd0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3dd4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3dd8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 123, 0xFD, 2} + }) // Domain 123 +} + +Device(C124) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3e00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3e00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3e04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3e08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3e0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3e10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3e14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3e2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3e34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3e3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3e50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3e54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3e58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 124, 0xFD, 2} + }) // Domain 124 +} + +Device(C125) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3e01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3e80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3e84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3e88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3e8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3e90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3e94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3eac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3eb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3ebc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3ed0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3ed4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3ed8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 125, 0xFD, 2} + }) // Domain 125 +} + +Device(C126) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3f00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3f00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3f04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3f08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3f0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3f10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3f14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3f2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3f34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3f3c, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3f50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3f54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3f58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 126, 0xFD, 2} + }) // Domain 126 +} + +Device(C127) { + Name(_HID, "ACPI0007") + Name(_UID, 0x3f01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3f80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3f84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3f88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3f8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3f90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3f94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3fac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3fb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3fbc, 2)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3fd0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3fd4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3fd8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 127, 0xFD, 2} + }) // Domain 127 +} diff --git a/Platform/Ampere/JadePkg/AcpiTables/CPU-S1.asi b/Platform/Amper= e/JadePkg/AcpiTables/CPU-S1.asi new file mode 100644 index 000000000000..e0def4064fd7 --- /dev/null +++ b/Platform/Ampere/JadePkg/AcpiTables/CPU-S1.asi @@ -0,0 +1,5639 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +Device(C128) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10000) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x000, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x004, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x008, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x00c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x010, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x014, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x34, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x050, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x054, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x058, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 128, 0xFD, 2} + }) // Domain 128 +} + +Device(C129) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10001) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x080, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x084, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x088, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x08c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x090, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x094, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xb4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xbc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x0d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x0d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x0d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 1219, 0xFD, 2} + }) // Domain 129 +} + +Device(C130) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10100) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x100, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x104, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x108, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x10c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x110, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x114, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x12c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x134, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x13c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x150, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x154, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x158, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 130, 0xFD, 2} + }) // Domain 130 +} + +Device(C131) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10101) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x180, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x184, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x188, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x18c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x190, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x194, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 131, 0xFD, 2} + }) // Domain 131 +} + +Device(C132) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10200) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x200, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x204, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x208, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x20c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x210, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x214, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x22c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x234, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x23c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x250, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x254, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x258, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 132, 0xFD, 2} + }) // Domain 132 +} + +Device(C133) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10201) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x280, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x284, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x288, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x28c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x290, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x294, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 133, 0xFD, 2} + }) // Domain 133 +} + +Device(C134) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10300) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x300, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x304, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x308, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x30c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x310, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x314, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x32c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x334, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x33c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x350, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x354, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x358, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 134, 0xFD, 2} + }) // Domain 134 +} + +Device(C135) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10301) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x380, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x384, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x388, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x38c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x390, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x394, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 135, 0xFD, 2} + }) // Domain 135 +} + +Device(C136) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10400) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x400, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x404, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x408, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x40c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x410, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x414, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x42c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x434, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x43c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x450, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x454, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x458, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 136, 0xFD, 2} + }) // Domain 136 +} + +Device(C137) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10401) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x480, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x484, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x488, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x48c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x490, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x494, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x4ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x4b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x4bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x4d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x4d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x4d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 137, 0xFD, 2} + }) // Domain 137 +} + +Device(C138) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10500) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x500, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x504, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x508, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x50c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x510, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x514, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x52c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x534, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x53c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x550, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x554, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x558, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 138, 0xFD, 2} + }) // Domain 138 +} + +Device(C139) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10501) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x580, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x584, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x588, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x58c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x590, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x594, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x5ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x5b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x5bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x5d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x5d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x5d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 139, 0xFD, 2} + }) // Domain 139 +} + +Device(C140) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10600) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x600, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x604, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x608, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x60c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x610, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x614, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x62c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x634, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x63c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x650, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x654, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x658, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 140, 0xFD, 2} + }) // Domain 140 +} + +Device(C141) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10601) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x680, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x684, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x688, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x68c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x690, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x694, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x6ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x6b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x6bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x6d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x6d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x6d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 141, 0xFD, 2} + }) // Domain 141 +} + +Device(C142) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10700) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x700, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x704, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x708, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x70c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x710, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x714, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x72c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x734, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x73c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x750, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x754, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x758, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 142, 0xFD, 2} + }) // Domain 142 +} + +Device(C143) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10701) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x780, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x784, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x788, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x78c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x790, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x794, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x7ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x7b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x7bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x7d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x7d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x7d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 143, 0xFD, 2} + }) // Domain 143 +} + +Device(C144) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10800) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x800, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x804, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x808, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x80c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x810, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x814, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x82c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x834, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x83c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x850, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x854, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x858, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 144, 0xFD, 2} + }) // Domain 144 +} + +Device(C145) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10801) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x880, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x884, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x888, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x88c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x890, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x894, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x8ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x8b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x8bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x8d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x8d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x8d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 145, 0xFD, 2} + }) // Domain 145 +} + +Device(C146) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10900) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x900, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x904, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x908, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x90c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x910, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x914, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x92c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x934, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x93c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x950, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x954, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x958, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 146, 0xFD, 2} + }) // Domain 146 +} + +Device(C147) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10901) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x980, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x984, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x988, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x98c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x990, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x994, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x9ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x9b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x9bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x9d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x9d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x9d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 147, 0xFD, 2} + }) // Domain 147 +} + +Device(C148) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10a00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xa00, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xa04, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xa08, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xa0c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xa10, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xa14, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xa2c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xa34, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xa3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xa50, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xa54, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xa58, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 148, 0xFD, 2} + }) // Domain 148 +} + +Device(C149) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10a01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xa80, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xa84, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xa88, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xa8c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xa90, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xa94, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xaac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xab4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xabc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xad0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xad4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xad8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 149, 0xFD, 2} + }) // Domain 149 +} + +Device(C150) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10b00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xb00, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xb04, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xb08, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xb0c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xb10, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xb14, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xb2c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xb34, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xb3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xb50, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xb54, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xb58, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 150, 0xFD, 2} + }) // Domain 150 +} + +Device(C151) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10b01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xb80, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xb84, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xb88, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xb8c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xb90, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xb94, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xbac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xbb4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xbbc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xbd0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xbd4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xbd8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 151, 0xFD, 2} + }) // Domain 151 +} + +Device(C152) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10c00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xc00, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xc04, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xc08, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xc0c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xc10, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xc14, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xc2c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xc34, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xc3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xc50, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xc54, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xc58, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 152, 0xFD, 2} + }) // Domain 152 +} + +Device(C153) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10c01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xc80, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xc84, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xc88, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xc8c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xc90, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xc94, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xcac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xcb4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xcbc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xcd0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xcd4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xcd8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 153, 0xFD, 2} + }) // Domain 153 +} + +Device(C154) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10d00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xd00, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xd04, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xd08, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xd0c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xd10, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xd14, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xd2c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xd34, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xd3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xd50, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xd54, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xd58, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 154, 0xFD, 2} + }) // Domain 154 +} + +Device(C155) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10d01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xd80, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xd84, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xd88, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xd8c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xd90, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xd94, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xdac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xdb4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xdbc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xdd0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xdd4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xdd8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 155, 0xFD, 2} + }) // Domain 155 +} + +Device(C156) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10e00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xe00, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xe04, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xe08, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xe0c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xe10, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xe14, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xe2c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xe34, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xe3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xe50, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xe54, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xe58, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 156, 0xFD, 2} + }) // Domain 156 +} + +Device(C157) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10e01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xe80, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xe84, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xe88, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xe8c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xe90, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xe94, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xeac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xeb4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xebc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xed0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xed4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xed8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 157, 0xFD, 2} + }) // Domain 157 +} + +Device(C158) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10f00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xf00, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xf04, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xf08, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xf0c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xf10, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xf14, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xf2c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xf34, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xf3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xf50, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xf54, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xf58, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 158, 0xFD, 2} + }) // Domain 158 +} + +Device(C159) { + Name(_HID, "ACPI0007") + Name(_UID, 0x10f01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0xf80, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xf84, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xf88, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xf8c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0xf90, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xf94, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0xfac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0xfb4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0xfbc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0xfd0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0xfd4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0xfd8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 159, 0xFD, 2} + }) // Domain 159 +} + +Device(C160) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11000) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1000, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1004, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1008, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x100c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1010, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1014, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x102c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1034, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x103c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1050, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1054, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1058, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 160, 0xFD, 2} + }) // Domain 160 +} + +Device(C161) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11001) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1080, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1084, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1088, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x108c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1090, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1094, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x10ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x10b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x10bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x10d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x10d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x10d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 161, 0xFD, 2} + }) // Domain 161 +} + +Device(C162) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11100) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1100, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1104, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1108, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x110c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1110, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1114, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x112c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1134, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x113c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1150, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1154, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1158, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 162, 0xFD, 2} + }) // Domain 162 +} + +Device(C163) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11101) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1180, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1184, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1188, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x118c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1190, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1194, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x11ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x11b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x11bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x11d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x11d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x11d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 163, 0xFD, 2} + }) // Domain 163 +} + +Device(C164) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11200) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1200, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1204, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1208, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x120c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1210, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1214, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x122c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1234, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x123c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1250, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1254, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1258, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 164, 0xFD, 2} + }) // Domain 164 +} + +Device(C165) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11201) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1280, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1284, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1288, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x128c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1290, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1294, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x12ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x12b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x12bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x12d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x12d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x12d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 165, 0xFD, 2} + }) // Domain 165 +} + +Device(C166) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11300) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1300, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1304, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1308, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x130c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1310, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1314, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x132c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1334, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x133c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1350, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1354, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1358, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 166, 0xFD, 2} + }) // Domain 166 +} + +Device(C167) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11301) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1380, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1384, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1388, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x138c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1390, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1394, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x13ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x13b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x13bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x13d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x13d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x13d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 167, 0xFD, 2} + }) // Domain 167 +} + +Device(C168) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11400) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1400, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1404, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1408, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x140c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1410, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1414, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x142c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1434, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x143c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1450, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1454, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1458, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 168, 0xFD, 2} + }) // Domain 168 +} + +Device(C169) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11401) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1480, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1484, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1488, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x148c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1490, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1494, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x14ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x14b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x14bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x14d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x14d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x14d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 169, 0xFD, 2} + }) // Domain 169 +} + +Device(C170) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11500) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1500, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1504, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1508, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x150c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1510, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1514, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x152c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1534, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x153c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1550, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1554, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1558, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 170, 0xFD, 2} + }) // Domain 170 +} + +Device(C171) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11501) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1580, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1584, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1588, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x158c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1590, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1594, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x15ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x15b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x15bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x15d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x15d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x15d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 171, 0xFD, 2} + }) // Domain 171 +} + +Device(C172) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11600) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1600, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1604, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1608, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x160c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1610, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1614, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x162c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1634, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x163c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1650, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1654, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1658, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 172, 0xFD, 2} + }) // Domain 172 +} + +Device(C173) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11601) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1680, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1684, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1688, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x168c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1690, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1694, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x16ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x16b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x16bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x16d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x16d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x16d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 173, 0xFD, 2} + }) // Domain 173 +} + +Device(C174) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11700) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1700, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1704, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1708, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x170c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1710, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1714, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x172c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1734, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x173c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1750, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1754, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1758, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 174, 0xFD, 2} + }) // Domain 174 +} + +Device(C175) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11701) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1780, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1784, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1788, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x178c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1790, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1794, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x17ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x17b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x17bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x17d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x17d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x17d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 175, 0xFD, 2} + }) // Domain 175 +} + +Device(C176) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11800) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1800, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1804, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1808, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x180c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1810, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1814, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x182c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1834, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x183c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1850, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1854, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1858, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 176, 0xFD, 2} + }) // Domain 176 +} + +Device(C177) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11801) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1880, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1884, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1888, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x188c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1890, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1894, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x18ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x18b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x18bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x18d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x18d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x18d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 177, 0xFD, 2} + }) // Domain 177 +} + +Device(C178) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11900) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1900, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1904, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1908, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x190c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1910, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1914, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x192c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1934, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x193c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1950, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1954, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1958, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 178, 0xFD, 2} + }) // Domain 178 +} + +Device(C179) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11901) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1980, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1984, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1988, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x198c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1990, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1994, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x19ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x19b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x19bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x19d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x19d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x19d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 179, 0xFD, 2} + }) // Domain 179 +} + +Device(C180) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11a00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1a00, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1a04, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1a08, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1a0c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1a10, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1a14, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1a2c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1a34, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1a3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1a50, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1a54, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1a58, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 180, 0xFD, 2} + }) // Domain 180 +} + +Device(C181) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11a01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1a80, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1a84, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1a88, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1a8c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1a90, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1a94, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1aac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1ab4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1abc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1ad0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1ad4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1ad8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 181, 0xFD, 2} + }) // Domain 181 +} + +Device(C182) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11b00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1b00, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1b04, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1b08, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1b0c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1b10, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1b14, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1b2c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1b34, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1b3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1b50, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1b54, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1b58, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 182, 0xFD, 2} + }) // Domain 182 +} + +Device(C183) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11b01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1b80, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1b84, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1b88, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1b8c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1b90, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1b94, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1bac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1bb4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1bbc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1bd0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1bd4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1bd8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 183, 0xFD, 2} + }) // Domain 183 +} + +Device(C184) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11c00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1c00, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1c04, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1c08, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1c0c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1c10, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1c14, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1c2c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1c34, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1c3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1c50, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1c54, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1c58, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 184, 0xFD, 2} + }) // Domain 184 +} + +Device(C185) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11c01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1c80, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1c84, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1c88, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1c8c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1c90, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1c94, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1cac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1cb4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1cbc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1cd0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1cd4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1cd8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 185, 0xFD, 2} + }) // Domain 185 +} + +Device(C186) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11d00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1d00, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1d04, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1d08, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1d0c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1d10, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1d14, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1d2c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1d34, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1d3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1d50, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1d54, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1d58, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 186, 0xFD, 2} + }) // Domain 186 +} + +Device(C187) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11d01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1d80, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1d84, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1d88, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1d8c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1d90, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1d94, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1dac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1db4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1dbc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1dd0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1dd4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1dd8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 187, 0xFD, 2} + }) // Domain 187 +} + +Device(C188) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11e00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1e00, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1e04, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1e08, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1e0c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1e10, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1e14, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1e2c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1e34, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1e3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1e50, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1e54, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1e58, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 188, 0xFD, 2} + }) // Domain 188 +} + +Device(C189) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11e01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1e80, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1e84, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1e88, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1e8c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1e90, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1e94, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1eac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1eb4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1ebc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1ed0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1ed4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1ed8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 189, 0xFD, 2} + }) // Domain 189 +} + +Device(C190) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11f00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1f00, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1f04, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1f08, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1f0c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1f10, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1f14, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1f2c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1f34, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1f3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1f50, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1f54, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1f58, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 190, 0xFD, 2} + }) // Domain 190 +} + +Device(C191) { + Name(_HID, "ACPI0007") + Name(_UID, 0x11f01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x1f80, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1f84, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1f88, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1f8c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x1f90, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1f94, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x1fac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x1fb4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1fbc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1fd0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1fd4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x1fd8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 191, 0xFD, 2} + }) // Domain 191 +} + +Device(C192) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12000) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2000, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2004, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2008, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x200c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2010, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2014, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x202c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2034, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x203c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2050, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2054, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2058, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 192, 0xFD, 2} + }) // Domain 192 +} + +Device(C193) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12001) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2080, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2084, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2088, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x208c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2090, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2094, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x20ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x20b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x20bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x20d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x20d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x20d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 193, 0xFD, 2} + }) // Domain 193 +} + +Device(C194) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12100) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2100, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2104, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2108, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x210c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2110, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2114, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x212c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2134, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x213c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2150, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2154, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2158, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 194, 0xFD, 2} + }) // Domain 194 +} + +Device(C195) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12101) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2180, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2184, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2188, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x218c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2190, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2194, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x21ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x21b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x21bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x21d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x21d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x21d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 195, 0xFD, 2} + }) // Domain 195 +} + +Device(C196) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12200) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2200, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2204, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2208, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x220c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2210, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2214, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x222c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2234, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x223c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2250, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2254, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2258, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 196, 0xFD, 2} + }) // Domain 196 +} + +Device(C197) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12201) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2280, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2284, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2288, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x228c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2290, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2294, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x22ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x22b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x22bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x22d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x22d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x22d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 197, 0xFD, 2} + }) // Domain 197 +} + +Device(C198) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12300) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2300, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2304, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2308, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x230c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2310, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2314, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x232c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2334, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x233c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2350, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2354, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2358, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 198, 0xFD, 2} + }) // Domain 198 +} + +Device(C199) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12301) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2380, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2384, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2388, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x238c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2390, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2394, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x23ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x23b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x23bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x23d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x23d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x23d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 199, 0xFD, 2} + }) // Domain 199 +} + +Device(C200) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12400) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2400, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2404, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2408, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x240c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2410, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2414, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x242c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2434, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x243c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2450, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2454, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2458, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 200, 0xFD, 2} + }) // Domain 200 +} + +Device(C201) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12401) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2480, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2484, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2488, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x248c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2490, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2494, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x24ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x24b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x24bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x24d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x24d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x24d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 201, 0xFD, 2} + }) // Domain 201 +} + +Device(C202) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12500) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2500, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2504, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2508, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x250c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2510, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2514, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x252c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2534, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x253c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2550, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2554, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2558, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 202, 0xFD, 2} + }) // Domain 202 +} + +Device(C203) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12501) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2580, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2584, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2588, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x258c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2590, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2594, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x25ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x25b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x25bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x25d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x25d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x25d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 203, 0xFD, 2} + }) // Domain 203 +} + +Device(C204) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12600) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2600, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2604, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2608, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x260c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2610, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2614, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x262c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2634, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x263c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2650, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2654, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2658, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 204, 0xFD, 2} + }) // Domain 204 +} + +Device(C205) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12601) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2680, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2684, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2688, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x268c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2690, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2694, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x26ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x26b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x26bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x26d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x26d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x26d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 205, 0xFD, 2} + }) // Domain 205 +} + +Device(C206) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12700) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2700, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2704, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2708, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x270c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2710, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2714, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x272c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2734, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x273c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2750, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2754, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2758, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 206, 0xFD, 2} + }) // Domain 206 +} + +Device(C207) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12701) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2780, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2784, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2788, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x278c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2790, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2794, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x27ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x27b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x27bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x27d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x27d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x27d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 207, 0xFD, 2} + }) // Domain 207 +} + +Device(C208) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12800) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2800, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2804, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2808, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x280c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2810, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2814, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x282c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2834, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x283c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2850, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2854, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2858, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 208, 0xFD, 2} + }) // Domain 208 +} + +Device(C209) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12801) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2880, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2884, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2888, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x288c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2890, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2894, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x28ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x28b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x28bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x28d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x28d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x28d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 209, 0xFD, 2} + }) // Domain 209 +} + +Device(C210) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12900) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2900, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2904, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2908, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x290c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2910, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2914, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x292c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2934, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x293c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2950, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2954, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2958, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 210, 0xFD, 2} + }) // Domain 210 +} + +Device(C211) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12901) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2980, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2984, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2988, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x298c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2990, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2994, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x29ac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x29b4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x29bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x29d0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x29d4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x29d8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 211, 0xFD, 2} + }) // Domain 211 +} + +Device(C212) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12a00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2a00, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2a04, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2a08, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2a0c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2a10, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2a14, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2a2c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2a34, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2a3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2a50, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2a54, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2a58, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 212, 0xFD, 2} + }) // Domain 212 +} + +Device(C213) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12a01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2a80, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2a84, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2a88, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2a8c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2a90, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2a94, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2aac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2ab4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2abc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2ad0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2ad4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2ad8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 213, 0xFD, 2} + }) // Domain 213 +} + +Device(C214) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12b00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2b00, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2b04, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2b08, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2b0c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2b10, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2b14, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2b2c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2b34, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2b3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2b50, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2b54, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2b58, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 214, 0xFD, 2} + }) // Domain 214 +} + +Device(C215) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12b01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2b80, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2b84, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2b88, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2b8c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2b90, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2b94, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2bac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2bb4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2bbc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2bd0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2bd4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2bd8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 215, 0xFD, 2} + }) // Domain 215 +} + +Device(C216) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12c00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2c00, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2c04, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2c08, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2c0c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2c10, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2c14, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2c2c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2c34, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2c3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2c50, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2c54, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2c58, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 216, 0xFD, 2} + }) // Domain 216 +} + +Device(C217) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12c01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2c80, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2c84, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2c88, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2c8c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2c90, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2c94, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2cac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2cb4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2cbc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2cd0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2cd4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2cd8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 217, 0xFD, 2} + }) // Domain 217 +} + +Device(C218) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12d00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2d00, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2d04, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2d08, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2d0c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2d10, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2d14, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2d2c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2d34, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2d3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2d50, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2d54, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2d58, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 218, 0xFD, 2} + }) // Domain 218 +} + +Device(C219) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12d01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2d80, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2d84, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2d88, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2d8c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2d90, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2d94, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2dac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2db4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2dbc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2dd0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2dd4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2dd8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 219, 0xFD, 2} + }) // Domain 219 +} + +Device(C220) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12e00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2e00, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2e04, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2e08, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2e0c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2e10, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2e14, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2e2c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2e34, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2e3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2e50, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2e54, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2e58, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 220, 0xFD, 2} + }) // Domain 220 +} + +Device(C221) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12e01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2e80, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2e84, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2e88, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2e8c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2e90, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2e94, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2eac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2eb4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2ebc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2ed0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2ed4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2ed8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 221, 0xFD, 2} + }) // Domain 221 +} + +Device(C222) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12f00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2f00, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2f04, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2f08, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2f0c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2f10, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2f14, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2f2c, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2f34, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2f3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2f50, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2f54, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2f58, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 222, 0xFD, 2} + }) // Domain 222 +} + +Device(C223) { + Name(_HID, "ACPI0007") + Name(_UID, 0x12f01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x2f80, 17)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2f84, 17)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2f88, 17)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2f8c, 17)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x2f90, 17)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2f94, 17)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x2fac, 17)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x2fb4, 17)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2fbc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2fd0, 17)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2fd4, 17)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x2fd8, 17)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 223, 0xFD, 2} + }) // Domain 223 +} + +Device(C224) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13000) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3000, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3004, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3008, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x300c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3010, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3014, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x302c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3034, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x303c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3050, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3054, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3058, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 224, 0xFD, 2} + }) // Domain 224 +} + +Device(C225) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13001) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3080, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3084, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3088, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x308c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3090, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3094, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x30ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x30b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x30bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x30d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x30d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x30d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 225, 0xFD, 2} + }) // Domain 225 +} + +Device(C226) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13100) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3100, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3104, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3108, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x310c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3110, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3114, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x312c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3134, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x313c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3150, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3154, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3158, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 226, 0xFD, 2} + }) // Domain 226 +} + +Device(C227) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13101) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3180, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3184, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3188, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x318c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3190, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3194, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x31ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x31b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x31bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x31d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x31d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x31d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 227, 0xFD, 2} + }) // Domain 227 +} + +Device(C228) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13200) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3200, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3204, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3208, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x320c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3210, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3214, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x322c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3234, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x323c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3250, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3254, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3258, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 228, 0xFD, 2} + }) // Domain 228 +} + +Device(C229) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13201) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3280, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3284, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3288, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x328c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3290, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3294, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x32ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x32b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x32bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x32d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x32d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x32d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 229, 0xFD, 2} + }) // Domain 229 +} + +Device(C230) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13300) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3300, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3304, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3308, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x330c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3310, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3314, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x332c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3334, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x333c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3350, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3354, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3358, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 230, 0xFD, 2} + }) // Domain 230 +} + +Device(C231) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13301) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3380, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3384, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3388, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x338c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3390, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3394, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x33ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x33b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x33bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x33d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x33d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x33d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 231, 0xFD, 2} + }) // Domain 231 +} + +Device(C232) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13400) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3400, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3404, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3408, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x340c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3410, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3414, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x342c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3434, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x343c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3450, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3454, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3458, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 232, 0xFD, 2} + }) // Domain 232 +} + +Device(C233) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13401) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3480, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3484, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3488, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x348c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3490, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3494, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x34ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x34b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x34bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x34d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x34d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x34d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 233, 0xFD, 2} + }) // Domain 233 +} + +Device(C234) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13500) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3500, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3504, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3508, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x350c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3510, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3514, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x352c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3534, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x353c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3550, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3554, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3558, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 234, 0xFD, 2} + }) // Domain 234 +} + +Device(C235) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13501) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3580, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3584, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3588, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x358c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3590, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3594, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x35ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x35b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x35bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x35d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x35d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x35d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 235, 0xFD, 2} + }) // Domain 235 +} + +Device(C236) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13600) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3600, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3604, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3608, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x360c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3610, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3614, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x362c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3634, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x363c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3650, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3654, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3658, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 236, 0xFD, 2} + }) // Domain 236 +} + +Device(C237) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13601) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3680, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3684, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3688, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x368c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3690, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3694, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x36ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x36b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x36bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x36d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x36d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x36d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 237, 0xFD, 2} + }) // Domain 237 +} + +Device(C238) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13700) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3700, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3704, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3708, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x370c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3710, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3714, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x372c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3734, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x373c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3750, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3754, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3758, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 238, 0xFD, 2} + }) // Domain 238 +} + +Device(C239) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13701) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3780, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3784, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3788, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x378c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3790, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3794, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x37ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x37b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x37bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x37d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x37d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x37d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 239, 0xFD, 2} + }) // Domain 239 +} + +Device(C240) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13800) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3800, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3804, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3808, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x380c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3810, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3814, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x382c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3834, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x383c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3850, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3854, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3858, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 240, 0xFD, 2} + }) // Domain 240 +} + +Device(C241) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13801) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3880, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3884, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3888, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x388c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3890, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3894, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x38ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x38b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x38bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x38d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x38d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x38d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 241, 0xFD, 2} + }) // Domain 241 +} + +Device(C242) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13900) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3900, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3904, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3908, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x390c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3910, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3914, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x392c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3934, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x393c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3950, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3954, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3958, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 242, 0xFD, 2} + }) // Domain 242 +} + +Device(C243) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13901) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3980, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3984, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3988, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x398c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3990, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3994, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x39ac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x39b4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x39bc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x39d0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x39d4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x39d8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 243, 0xFD, 2} + }) // Domain 243 +} + +Device(C244) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13a00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3a00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3a04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3a08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3a0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3a10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3a14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3a2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3a34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3a3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3a50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3a54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3a58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 244, 0xFD, 2} + }) // Domain 244 +} + +Device(C245) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13a01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3a80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3a84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3a88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3a8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3a90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3a94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3aac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3ab4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3abc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3ad0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3ad4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3ad8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 245, 0xFD, 2} + }) // Domain 245 +} + +Device(C246) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13b00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3b00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3b04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3b08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3b0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3b10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3b14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3b2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3b34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3b3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3b50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3b54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3b58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 246, 0xFD, 2} + }) // Domain 246 +} + +Device(C247) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13b01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3b80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3b84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3b88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3b8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3b90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3b94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3bac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3bb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3bbc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3bd0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3bd4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3bd8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 247, 0xFD, 2} + }) // Domain 247 +} + +Device(C248) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13c00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3c00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3c04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3c08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3c0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3c10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3c14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3c2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3c34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3c3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3c50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3c54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3c58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 248, 0xFD, 2} + }) // Domain 248 +} + +Device(C249) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13c01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3c80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3c84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3c88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3c8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3c90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3c94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3cac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3cb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3cbc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3cd0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3cd4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3cd8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 249, 0xFD, 2} + }) // Domain 249 +} + +Device(C250) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13d00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3d00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3d04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3d08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3d0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3d10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3d14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3d2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3d34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3d3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3d50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3d54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3d58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 250, 0xFD, 2} + }) // Domain 250 +} + +Device(C251) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13d01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3d80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3d84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3d88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3d8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3d90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3d94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3dac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3db4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3dbc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3dd0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3dd4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3dd8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 251, 0xFD, 2} + }) // Domain 251 +} + +Device(C252) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13e00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3e00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3e04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3e08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3e0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3e10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3e14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3e2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3e34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3e3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3e50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3e54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3e58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 252, 0xFD, 2} + }) // Domain 252 +} + +Device(C253) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13e01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3e80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3e84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3e88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3e8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3e90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3e94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3eac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3eb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3ebc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3ed0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3ed4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3ed8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 253, 0xFD, 2} + }) // Domain 253 +} + +Device(C254) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13f00) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3f00, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3f04, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3f08, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3f0c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3f10, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3f14, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3f2c, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3f34, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3f3c, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3f50, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3f54, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3f58, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package() { + Package() {5, 0, 254, 0xFD, 2} + }) // Domain 254 +} + +Device(C255) { + Name(_HID, "ACPI0007") + Name(_UID, 0x13f01) + + Method (_LPI, 0, NotSerialized) { + return(PLPI) + } + + Name(PCPC, Package() { + 23, // NumEntr= ies + 3, // Revision + ResourceTemplate(){Register(PCC, 32, 0, 0x3f80, 2)}, // Highest= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3f84, 2)}, // Nominal= Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3f88, 2)}, // Lowest = Nonlinear Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3f8c, 2)}, // Lowest = Performance + ResourceTemplate(){Register(PCC, 32, 0, 0x3f90, 2)}, // Guarant= eed Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3f94, 2)}, // Desired= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Minimum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Maximum= Performance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Perform= ance Reduction Tolerance Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Time Wi= ndow Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Counter= Wraparound Time + ResourceTemplate(){Register(PCC, 64, 0, 0x3fac, 2)}, // Referen= ce Counter Register + ResourceTemplate(){Register(PCC, 64, 0, 0x3fb4, 2)}, // Deliver= ed Counter Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3fbc, 17)}, // Perform= ance Limited Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Enable = Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Selection Enable + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Autonom= ous Activity Window Register + ResourceTemplate(){Register(SystemMemory, 0, 0, 0, 0)}, // Energy = Performance Preference Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3fd0, 2)}, // Referen= ce Performance Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3fd4, 2)}, // Lowest = Frequency Register + ResourceTemplate(){Register(PCC, 32, 0, 0x3fd8, 2)}, // Nominal= Frequency Register + }) + If (LEqual(CPCE, 0x1)) { + Method (_CPC, 0, NotSerialized) { + return(PCPC) + } + } + //Performance State dependency + Name(_PSD, Package(){ + Package() {5, 0, 255, 0xFD, 2} + }) // Domain 255 +} diff --git a/Platform/Ampere/JadePkg/AcpiTables/CPU.asi b/Platform/Ampere/J= adePkg/AcpiTables/CPU.asi new file mode 100644 index 000000000000..00c09340b957 --- /dev/null +++ b/Platform/Ampere/JadePkg/AcpiTables/CPU.asi @@ -0,0 +1,127 @@ +/** @file + + Copyright (c) 2020, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +Name (CPCE, 1) // CPPC Enable +Name (LPIE, 0) // LPI Enable + +Method (_OSC, 4, Serialized) { // _OSC: Operating System Capabilit= ies + CreateDWordField (Arg3, 0x00, STS0) + CreateDWordField (Arg3, 0x04, CAP0) + If (LEqual(Arg0, ToUUID ("0811b06e-4a27-44f9-8d60-3cbbc22e7b48")) /* Pla= tform-wide Capabilities */) { + If (LNotEqual(Arg1, One)) { + And(STS0, 0xFFFFFFE0, STS0) + Or(STS0, 0x0A, STS0) // Unrecognized Revision, OSC failure + } Else { + If (LEqual(And(CAP0, 0x100), 0x100)) { + And(CAP0, 0xFFFFFEFF, CAP0) // No support for OS Initiated LPI + And(STS0, 0xFFFFFFE0, STS0) + Or(STS0, 0x12, STS0) + } + If (LEqual(LPIE, 0x1)) { + Or(CAP0, 0x80, CAP0) // Support for LPI + } Else { + And(CAP0, 0xFFFFFF7F, CAP0) // No support for LPI + } + If (LEqual(CPCE, 0x1)) { + Or(CAP0, 0x40, CAP0) // Support for CPPCv2 + } Else { + And(CAP0, 0xFFFFFFBF, CAP0) // No support for CPPCv2 + } + } + } Else { + And(STS0, 0xFFFFFFE0, STS0) + Or(STS0, 0x06, STS0) // Unrecognized Revision, Unrecognized= UUID + } + Return (Arg3) +} + +Name(PLPI, Package() { + 0, // Version + 1, // Level Index + 2, // Count + // WFI for CPU (NS-WFI) + Package() { + 1, // Min residency (uS) + 1, // Wake latency (uS) + 1, // Flags + 0, // Arch Context Flags + 100, // Residency Counter Frequency + 0, // No parent state + ResourceTemplate () { + // Register Entry method + Register (FFixedHW, + 0x20, // Bit Width + 0x00, // Bit Offset + 0xFFFFFFFF, // Address + 0x03, // Access Size + ) + }, + ResourceTemplate() { // Null Residency Counter + Register (SystemMemory, 0, 0, 0, 0) + }, + ResourceTemplate() { // Null Usage Counter + Register (SystemMemory, 0, 0, 0, 0) + }, + "Standby", + }, + // Retention state for CPU (S-WFI) + Package() { + 2, // Min residency (uS) + 2, // Wake latency (uS) + 1, // Flags + 0, // Arch Context Flags + 100, // Residency Counter Frequency + 1, // Parent node can be in Standby states + ResourceTemplate () { + // Register Entry method + Register (FFixedHW, + 0x20, // Bit Width + 0x00, // Bit Offset + 0x00000001, // Address + 0x03, // Access Size + ) + }, + ResourceTemplate() { // Null Residency Counter + Register (SystemMemory, 0, 0, 0, 0) + }, + ResourceTemplate() { // Null Usage Counter + Register (SystemMemory, 0, 0, 0, 0) + }, + "Standby_ATF" + }, +}) + +Device (SYST) { // System state + Name(_HID, "ACPI0010") + Name(_UID, 1) + Name (_LPI, Package() { + 0, // Version + 0, // Level Index + 1, // Count + // Retention state for Cluster + Package() { + 100, // Min residency (uS) + 100, // Wake latency (uS) + 1, // Flags + 0, // Arch Context Flags + 100, // Residency Counter Frequency + 0, // No Parent State + 0x02000100, // Integer Entry method + ResourceTemplate() { // Null Residency Counter + Register (SystemMemory, 0, 0, 0, 0) + }, + ResourceTemplate() { // Null Usage Counter + Register (SystemMemory, 0, 0, 0, 0) + }, + "Standby" + }, + }) + + Include ("CPU-S0.asi") + Include ("CPU-S1.asi") +} diff --git a/Platform/Ampere/JadePkg/AcpiTables/Dsdt.asl b/Platform/Ampere/= JadePkg/AcpiTables/Dsdt.asl new file mode 100644 index 000000000000..9c0ee4c44f94 --- /dev/null +++ b/Platform/Ampere/JadePkg/AcpiTables/Dsdt.asl @@ -0,0 +1,531 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +DefinitionBlock("Dsdt.aml", "DSDT", 0x02, "Ampere", "Jade", 1) { + // + // Board Model + Name(\BDMD, "Jade Board") + Name(AERF, 0) // PCIe AER Firmware-First + Scope(\_SB) { + + Include ("CPU.asi") + Include ("PMU.asi") + + // + // Hardware Monitor + Device(HM00) { + Name(_HID, "APMC0D29") + Name(_UID, "HWM0") + Name(_DDN, "HWM0") + Name(_CCA, ONE) + Name(_STR, Unicode("Hardware Monitor Device")) + Method(_STA, 0, NotSerialized) { + return (0xF) + } + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package() { + Package() {"pcc-channel", 14} + } + }) + } + + // + // Hardware Monitor + Device(HM01) { + Name(_HID, "APMC0D29") + Name(_UID, "HWM1") + Name(_DDN, "HWM1") + Name(_CCA, ONE) + Name(_STR, Unicode("Hardware Monitor Device")) + Method(_STA, 0, NotSerialized) { + return (0xF) + } + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package() { + Package() {"pcc-channel", 29} + } + }) + } + + // + // Hardware Monitor + Device(HM02) { + Name(_HID, "AMPC0005") + Name(_UID, "HWM2") + Name(_DDN, "HWM2") + Name(_CCA, ONE) + Name(_STR, Unicode("AC01 SoC Hardware Monitor Device")) + Method(_STA, 0, NotSerialized) { + return (0xF) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + Cacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000000088900000, // AddressMinimum - MIN + 0x000000008891FFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000020000 // RangeLength - LEN + ) + }) + } + + // + // Hardware Monitor + Device(HM03) { + Name(_HID, "AMPC0005") + Name(_UID, "HWM3") + Name(_DDN, "HWM3") + Name(_CCA, ONE) + Name(_STR, Unicode("AC01 SoC Hardware Monitor Device")) + Method(_STA, 0, NotSerialized) { + return (0xF) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + Cacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000000088920000, // AddressMinimum - MIN + 0x000000008893FFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000020000 // RangeLength - LEN + ) + }) + } + + // + // DesignWare I2C on AHBC bus + Device(I2C4) { + Name(_HID, "APMC0D0F") + Name(_UID, 4) + Name(_STR, Unicode("Altra I2C Device")) + Method(_STA, 0, NotSerialized) { + return (0x0f) + } + Name(_CCA, ONE) + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x00001000026B0000, // AddressMinimum - MIN + 0x00001000026BFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000010000 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 105 } + }) + Device (IPI) { + Name(_HID, "AMPC0004") + Name(_CID, "IPI0001") + Name(_STR, Unicode("IPMI_SSIF")) + Name(_UID, 0) + Name(_CCA, ONE) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Method(_IFT) { + Return(0x04) // IPMI SSIF + } + Method(_SRV) { + Return(0x0200) // IPMI Specification Revision + } + Name(_CRS, ResourceTemplate () + { + I2cSerialBusV2 (0x0010, ControllerInitiated, 0x00061A80, + AddressingMode7Bit, "\\_SB.I2C4", + 0x00, ResourceConsumer,, Exclusive, + // Vendor specific data: + // "BMC0", + // Flags (2 bytes): SMBUS variable length (Bit 0), Read Checks= um (Bit 1), Verify Checksum (Bit 2) + RawDataBuffer () { 0x42, 0x4D, 0x43, 0x30, 0x7, 0x0 } + ) + }) + } + Name(SSCN, Package() { 0x3E2, 0x47D, 0 }) + Name(FMCN, Package() { 0xA4, 0x13F, 0 }) + } + + // + // Report APEI Errors to GHES via SCI notification. + // SCI notification requires one GED and one HED Device + // GED =3D Generic Event Device (ACPI0013) + // HED =3D Hardware Error Device (PNP0C33) + // + Device(GED0) { + Name(_HID, "ACPI0013") + Name(_UID, Zero) + Method(_STA) { + Return (0xF) + } + Name(_CRS, ResourceTemplate () { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 84 }= // GHES + }) + Method(_EVT, 1, Serialized) { + Switch (ToInteger(Arg0)) { + Case (84) { // GHES interrupt + Notify (HED0, 0x80) + } + } + } + } + + // Shutdown button using GED. + Device(GED1) { + Name(_HID, "ACPI0013") + Name(_CID, "ACPI0013") + Name(_UID, One) + Method(_STA) { + Return (0xF) + } + Name(_CRS, ResourceTemplate () { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 327 } + }) + OperationRegion(PDDR, SystemMemory, 0x1000027B0004, 4) + Field(PDDR, DWordAcc, NoLock, Preserve) { + STDI, 8 + } + + OperationRegion(INTE, SystemMemory, 0x1000027B0030, 4) + Field(INTE, DWordAcc, NoLock, Preserve) { + STDE, 8 + } + + OperationRegion(INTT, SystemMemory, 0x1000027B0034, 4) + Field(INTT, DWordAcc, NoLock, Preserve) { + TYPE, 8 + } + + OperationRegion(INTP, SystemMemory, 0x1000027B0038, 4) + Field(INTP, DWordAcc, NoLock, Preserve) { + POLA, 8 + } + + OperationRegion(INTS, SystemMemory, 0x1000027B003c, 4) + Field(INTS, DWordAcc, NoLock, Preserve) { + STDS, 8 + } + + OperationRegion(INTC, SystemMemory, 0x1000027B0040, 4) + Field(INTC, DWordAcc, NoLock, Preserve) { + SINT, 8 + } + + OperationRegion(INTM, SystemMemory, 0x1000027B0044, 4) + Field(INTM, DWordAcc, NoLock, Preserve) { + MASK, 8 + } + + Method(_INI, 0, NotSerialized) { + // Set level type, low active (shutdown) + Store (0x00, TYPE) + Store (0x00, POLA) + // Set Input type (shutdown) + Store (0x00, STDI) + // Enable interrupt (shutdown) + Store (0x80, STDE) + // Unmask the interrupt. + Store (0x00, MASK) + } + Method(_EVT, 1, Serialized) { + Switch (ToInteger(Arg0)) { + Case (327) { + if (And (STDS, 0x80)) { + //Clear the interrupt. + Store (0x80, SINT) + // Notify OSPM the power button is pressed + Notify (\_SB.PWRB, 0x80) + } + } + } + } + } + + // Power button device description + Device(PWRB) { + Name(_HID, EISAID("PNP0C0C")) + Name(_UID, 0) + Name(_CCA, ONE) + Method(_STA, 0, Notserialized) { + Return (0x0b) + } + } + + // + // UART0 PL011 + Device(URT0) { + Name(_HID, "ARMH0011") + Name(_UID, 0) + Name(_CCA, ONE) + Method(_STA, 0, NotSerialized) { + return (0x0f) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000100002600000, // AddressMinimum - MIN + 0x0000100002600FFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000001000 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 98 } + }) + } // UART0 + + // + // UART2 PL011 + Device(URT2) { + Name(_HID, "ARMH0011") + Name(_UID, 1) + Name(_CCA, ONE) + Method(_STA, 0, NotSerialized) { + return (0x0f) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000100002620000, // AddressMinimum - MIN + 0x0000100002620FFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000001000 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 100 } + }) + } // UART1 + + Device(HED0) + { + Name(_HID, EISAID("PNP0C33")) + Name(_UID, Zero) + } + + Device(NVDR) { + Name(_HID, "ACPI0012") + Method(_STA, 0, NotSerialized) { + return (0xf) + } + Method (_DSM, 0x4, Serialized) { + // Not support any functions for now + Return (Buffer() {0}) + } + Device (NVD1) { + Name(_ADR, 0x0330) + Name(SMRT, Buffer(13) {0}) + CreateDWordField(SMRT, 0, BSTA) + CreateWordField(SMRT, 4, BHTH) + CreateWordField(SMRT, 6, BTMP) + CreateByteField(SMRT, 8, BETH) + CreateByteField(SMRT, 9, BWTH) + CreateByteField(SMRT, 10, BNLF) + OperationRegion(BUF1, SystemMemory, 0x88980000, 16) + Field (BUF1, DWordAcc, NoLock, Preserve) { + STAT, 32, //Status + HLTH, 16, //Module Health + CTMP, 16, //Module Current Status + ETHS, 8, //Error Threshold Status + WTHS, 8, //Warning Threshold Status + NVLF, 8, //NVM Lifetime + , 40 //Reserve + } + Method (_DSM, 0x4, Serialized) { + //Accept only MSF Family type NVDIMM DSM functions + If(LEqual(Arg0, ToUUID ("1ee68b36-d4bd-4a1a-9a16-4f8e53d46e05"))= ) { + //Handle Func 0 query implemented commands + If(LEqual(Arg2, 0)) { + //Check revision and returned proper implemented commands + //Support only health check for now + Return (Buffer() {0x01, 0x08}) //Byte 0: 0x1 + } + //Handle MSF DSM Func 11 Get Smart and Health Info + If(LEqual(Arg2, 11)) { + Store(\_SB.NVDR.NVD1.STAT, BSTA) + Store(\_SB.NVDR.NVD1.HLTH, BHTH) + Store(\_SB.NVDR.NVD1.CTMP, BTMP) + Store(\_SB.NVDR.NVD1.ETHS, BETH) + Store(\_SB.NVDR.NVD1.WTHS, BWTH) + Store(\_SB.NVDR.NVD1.NVLF, BNLF) + Return (SMRT) + } + } + Return (Buffer() {0}) + } + Method(_STA, 0, NotSerialized) { + return (0xf) + } + } + Device (NVD2) { + Name(_ADR, 0x0770) + Name(SMRT, Buffer(13) {0}) + CreateDWordField(SMRT, 0, BSTA) + CreateWordField(SMRT, 4, BHTH) + CreateWordField(SMRT, 6, BTMP) + CreateByteField(SMRT, 8, BETH) + CreateByteField(SMRT, 9, BWTH) + CreateByteField(SMRT, 10, BNLF) + OperationRegion(BUF1, SystemMemory, 0x88988000, 16) + Field (BUF1, DWordAcc, NoLock, Preserve) { + STAT, 32, //Status + HLTH, 16, //Module Health + CTMP, 16, //Module Current Status + ETHS, 8, //Error Threshold Status + WTHS, 8, //Warning Threshold Status + NVLF, 8, //NVM Lifetime + , 40 //Reserve + } + Method (_DSM, 0x4, Serialized) { + //Accept only MSF Family type NVDIMM DSM functions + If(LEqual(Arg0, ToUUID ("1ee68b36-d4bd-4a1a-9a16-4f8e53d46e05"))= ) { + //Handle Func 0 query implemented commands + If(LEqual(Arg2, 0)) { + //Check revision and returned proper implemented commands + //Support only health check for now + Return (Buffer() {0x01, 0x08}) //Byte 0: 0x1 + } + //Handle MSF DSM Func 11 Get Smart and Health Info + If(LEqual(Arg2, 11)) { + Store(\_SB.NVDR.NVD2.STAT, BSTA) + Store(\_SB.NVDR.NVD2.HLTH, BHTH) + Store(\_SB.NVDR.NVD2.CTMP, BTMP) + Store(\_SB.NVDR.NVD2.ETHS, BETH) + Store(\_SB.NVDR.NVD2.WTHS, BWTH) + Store(\_SB.NVDR.NVD2.NVLF, BNLF) + Return (SMRT) + } + } + Return (Buffer() {0}) + } + Method(_STA, 0, NotSerialized) { + return (0xf) + } + } + Device (NVD3) { + Name(_ADR, 0x1330) + Name(SMRT, Buffer(13) {0}) + CreateDWordField(SMRT, 0, BSTA) + CreateWordField(SMRT, 4, BHTH) + CreateWordField(SMRT, 6, BTMP) + CreateByteField(SMRT, 8, BETH) + CreateByteField(SMRT, 9, BWTH) + CreateByteField(SMRT, 10, BNLF) + OperationRegion(BUF1, SystemMemory, 0xC0080000, 16) + Field (BUF1, DWordAcc, NoLock, Preserve) { + STAT, 32, //Status + HLTH, 16, //Module Health + CTMP, 16, //Module Current Status + ETHS, 8, //Error Threshold Status + WTHS, 8, //Warning Threshold Status + NVLF, 8, //NVM Lifetime + , 40 //Reserve + } + Method (_DSM, 0x4, Serialized) { + //Accept only MSF Family type NVDIMM DSM functions + If(LEqual(Arg0, ToUUID ("1ee68b36-d4bd-4a1a-9a16-4f8e53d46e05"))= ) { + //Handle Func 0 query implemented commands + If(LEqual(Arg2, 0)) { + //Check revision and returned proper implemented commands + //Support only health check for now + Return (Buffer() {0x01, 0x08}) //Byte 0: 0x1 + } + //Handle MSF DSM Func 11 Get Smart and Health Info + If(LEqual(Arg2, 11)) { + Store(\_SB.NVDR.NVD3.STAT, BSTA) + Store(\_SB.NVDR.NVD3.HLTH, BHTH) + Store(\_SB.NVDR.NVD3.CTMP, BTMP) + Store(\_SB.NVDR.NVD3.ETHS, BETH) + Store(\_SB.NVDR.NVD3.WTHS, BWTH) + Store(\_SB.NVDR.NVD3.NVLF, BNLF) + Return (SMRT) + } + } + Return (Buffer() {0}) + } + Method(_STA, 0, NotSerialized) { + return (0xf) + } + } + Device (NVD4) { + Name(_ADR, 0x1770) + Name(SMRT, Buffer(13) {0}) + CreateDWordField(SMRT, 0, BSTA) + CreateWordField(SMRT, 4, BHTH) + CreateWordField(SMRT, 6, BTMP) + CreateByteField(SMRT, 8, BETH) + CreateByteField(SMRT, 9, BWTH) + CreateByteField(SMRT, 10, BNLF) + OperationRegion(BUF1, SystemMemory, 0xC0088000, 16) + Field (BUF1, DWordAcc, NoLock, Preserve) { + STAT, 32, //Status + HLTH, 16, //Module Health + CTMP, 16, //Module Current Status + ETHS, 8, //Error Threshold Status + WTHS, 8, //Warning Threshold Status + NVLF, 8, //NVM Lifetime + , 40 //Reserve + } + Method (_DSM, 0x4, Serialized) { + //Accept only MSF Family type NVDIMM DSM functions + If(LEqual(Arg0, ToUUID ("1ee68b36-d4bd-4a1a-9a16-4f8e53d46e05"))= ) { + //Handle Func 0 query implemented commands + If(LEqual(Arg2, 0)) { + //Check revision and returned proper implemented commands + //Support only health check for now + Return (Buffer() {0x01, 0x08}) //Byte 0: 0x1 + } + //Handle MSF DSM Func 11 Get Smart and Health Info + If(LEqual(Arg2, 11)) { + Store(\_SB.NVDR.NVD4.STAT, BSTA) + Store(\_SB.NVDR.NVD4.HLTH, BHTH) + Store(\_SB.NVDR.NVD4.CTMP, BTMP) + Store(\_SB.NVDR.NVD4.ETHS, BETH) + Store(\_SB.NVDR.NVD4.WTHS, BWTH) + Store(\_SB.NVDR.NVD4.NVLF, BNLF) + Return (SMRT) + } + } + Return (Buffer() {0}) + } + Method(_STA, 0, NotSerialized) { + return (0xf) + } + } + } + + Include ("PCI-S0.Rca01.asi") + Include ("PCI-S0.asi") + Include ("PCI-S1.asi") + Include ("PCI-PDRC.asi") + } +} // DSDT diff --git a/Platform/Ampere/JadePkg/AcpiTables/PCI-PDRC.asi b/Platform/Amp= ere/JadePkg/AcpiTables/PCI-PDRC.asi new file mode 100644 index 000000000000..16c00c35e3fe --- /dev/null +++ b/Platform/Ampere/JadePkg/AcpiTables/PCI-PDRC.asi @@ -0,0 +1,217 @@ +/** @file + + Copyright (c) 2020, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + + // Motherboard resource consumption for PCIE resource reservation + // as upstream discussion "ACPI namespace details for ARM64" + Device (PDRC) { + Name (_HID, EISAID("PNP0C02")) + Name (_UID, 1) + // S0 Start here + Name (PDRS, ResourceTemplate() { + QWordMemory ( // PCIE0 256M CFG region for ECAM + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + Cacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x00003BFFF0000000, // AddressMinimum - MIN + 0x00003BFFFFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000010000000 // RangeLength - LEN + ) + + QWordMemory ( // PCIE1 256M CFG region for ECAM + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + Cacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x00003FFFF0000000, // AddressMinimum - MIN + 0x00003FFFFFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000010000000 // RangeLength - LEN + ) + + QWordMemory ( // PCIE2 256M CFG region for ECAM + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + Cacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000023FFF0000000, // AddressMinimum - MIN + 0x000023FFFFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000010000000 // RangeLength - LEN + ) + + QWordMemory ( // PCIE3 256M CFG region for ECAM + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + Cacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000027FFF0000000, // AddressMinimum - MIN + 0x000027FFFFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000010000000 // RangeLength - LEN + ) + + QWordMemory ( // PCIE4 256M CFG region for ECAM + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + Cacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x00002BFFF0000000, // AddressMinimum - MIN + 0x00002BFFFFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000010000000 // RangeLength - LEN + ) + + QWordMemory ( // PCIE5 256M CFG region for ECAM + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + Cacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x00002FFFF0000000, // AddressMinimum - MIN + 0x00002FFFFFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000010000000 // RangeLength - LEN + ) + + // S1 Start here + QWordMemory ( // PCIE6 256M CFG region for ECAM + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + Cacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x00007BFFF0000000, // AddressMinimum - MIN + 0x00007BFFFFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000010000000 // RangeLength - LEN + ) + + QWordMemory ( // PCIE7 256M CFG region for ECAM + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + Cacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x00007FFFF0000000, // AddressMinimum - MIN + 0x00007FFFFFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000010000000 // RangeLength - LEN + ) + + QWordMemory ( // PCIE8 256M CFG region for ECAM + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + Cacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000063FFF0000000, // AddressMinimum - MIN + 0x000063FFFFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000010000000 // RangeLength - LEN + ) + + QWordMemory ( // PCIE9 256M CFG region for ECAM + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + Cacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000067FFF0000000, // AddressMinimum - MIN + 0x000067FFFFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000010000000 // RangeLength - LEN + ) + QWordMemory ( // PCIEA 256M CFG region for ECAM + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + Cacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x00006BFFF0000000, // AddressMinimum - MIN + 0x00006BFFFFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000010000000 // RangeLength - LEN + ) + + QWordMemory ( // PCIEB 256M CFG region for ECAM + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + Cacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x00006FFFF0000000, // AddressMinimum - MIN + 0x00006FFFFFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000010000000 // RangeLength - LEN + ) + + QWordMemory ( // PCIEC 256M CFG region for ECAM + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + Cacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000033FFF0000000, // AddressMinimum - MIN + 0x000033FFFFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000010000000 // RangeLength - LEN + ) + + QWordMemory ( // PCIED 256M CFG region for ECAM + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + Cacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000037FFF0000000, // AddressMinimum - MIN + 0x000037FFFFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000010000000 // RangeLength - LEN + ) + }) + + // Current Resource Settings + Method (_CRS, 0, Serialized) { + Return (PDRS) + } + } diff --git a/Platform/Ampere/JadePkg/AcpiTables/PCI-S0.Rca01.asi b/Platform= /Ampere/JadePkg/AcpiTables/PCI-S0.Rca01.asi new file mode 100644 index 000000000000..67e1518ebf88 --- /dev/null +++ b/Platform/Ampere/JadePkg/AcpiTables/PCI-S0.Rca01.asi @@ -0,0 +1,681 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + + // PCI0 RCA0 + Device (PCI0) { + // + // Hardware ID must be PNP0A08, which maps to a PCIe root complex. + // Section 6.1.5 + // + + Name (_HID, "PNP0A08") + Name (_CCA, ONE) + + Method (_STA, 0, NotSerialized) { + Return (0xF) // The default value is 0x0. Unfor= tunately, it breaks + // run-time patching as the repres= entation of 0 is special + // encoding and cannot be patched = to expand with extra bytes + // easily. As such, we default to = 0xF and patch this based + // on whether the port was enabled= or not by the BIOS. + } + + // + // Optionally, include a compatible ID of PNP0A03, which maps to a PCI + // root complex for use with pre-PCIe operating systems. + // Section 6.1.2 + // + + Name (_CID, "PNP0A03") + + // + // Declare the segment number of this root complex. Most systems only + // have one segment, which is numbered 0. + // Section 6.5.6 + // + + Name (_SEG, 12) + + // + // Declare the base bus number, which is the bus number of the root + // bus in this root complex. This is usually 0, but need not be. + // For root complexes supporting multiple root busses, this should + // be the lowest numbered root bus. + // Section 6.5.5 + // + + Name (_BBN, 0) + + // + // The _UID value provides a way of uniquely identifying a device + // in the case where more than one instance of a specific device + // is implemented with the same _HID/_CID. For systems with a + // single root complex, this is usually just 0. For systems with + // multiple root complexes, this should be different for each + // root complex. + // Section 6.1.12 + // + + Name (_UID, "PCI0") + Name (_STR, Unicode("PCIe 0 Device")) + + // + // Declare the PCI Routing Table. + // This defines SPI mappings of the four line-based interrupts + // associated with the root complex and hierarchy below it. + // Section 6.2.12 + // + + Name (_PRT, Package() { + + // + // Routing for device 0, all functions. + // Note: ARM doesn't support LNK nodes, so the third param + // is 0 and the fourth param is the SPI number of the interrupt + // line. In this example, the A/B/C/D interrupts are wired to + // SPI lines 128/129/130/131 respectively. PCI0 RCA0 + // + Package() {0x0001FFFF, 0, 0, 128}, + Package() {0x0001FFFF, 1, 0, 129}, + Package() {0x0001FFFF, 2, 0, 130}, + Package() {0x0001FFFF, 3, 0, 131}, + Package() {0x0002FFFF, 0, 0, 128}, + Package() {0x0002FFFF, 1, 0, 129}, + Package() {0x0002FFFF, 2, 0, 130}, + Package() {0x0002FFFF, 3, 0, 131}, + Package() {0x0003FFFF, 0, 0, 128}, + Package() {0x0003FFFF, 1, 0, 129}, + Package() {0x0003FFFF, 2, 0, 130}, + Package() {0x0003FFFF, 3, 0, 131}, + Package() {0x0004FFFF, 0, 0, 128}, + Package() {0x0004FFFF, 1, 0, 129}, + Package() {0x0004FFFF, 2, 0, 130}, + Package() {0x0004FFFF, 3, 0, 131}, + }) + + // + // Declare the resources assigned to this root complex. + // Section 6.2.2 + // + Method (_CBA, 0, Serialized) { + Return (0x33FFF0000000) + } + + // + // Declare a ResourceTemplate buffer to return the resource + // requirements from _CRS. + // Section 19.5.109 + // + + Name (RBUF, ResourceTemplate () { + + // + // Declare the range of bus numbers assigned to this root + // complex. In this example, the minimum bus number will be + // 0, the maximum bus number will be 0xFF, supporting + // 256 busses total. + // Section 19.5.141 + // + + WordBusNumber ( + ResourceProducer, + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + PosDecode, // Decode + 0, // AddressGranularity + 0, // AddressMinimum - Minimum Bus Number + 255, // AddressMaximum - Maximum Bus Number + 0, // AddressTranslation - Set to 0 + 256) // RangeLength - Number of Busses + + // + // Declare the memory range to be used for BAR memory + // windows. This declares a 4GB region starting at + // 0x4000000000. + // Section 19.5.80 + // + // Memory32Fixed (ReadWrite, 0x1FE40000, 0x10000, ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + Cacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000000040000000, // AddressMinimum - MIN + 0x000000004FFFFFFF, // AddressMinimum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000010000000 // RangeLength - LEN + ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + Cacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000300000000000, // AddressMinimum - MIN + 0x000033FFDFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x000003FFE0000000 // RangeLength - LEN + ) + }) + + Method (_CRS, 0, Serialized) { + Return (RBUF) + } + + // + // Declare an _OSC (OS Control Handoff) method which takes 4 arguments. + // + // Argments: + // Arg0 A Buffer containing a UUID + // Arg1 An Integer containing a Revision ID of the buffer format + // Arg2 An Integer containing a count of entries in Arg3 + // Arg3 A Buffer containing a list of DWORD capabilities + // Return Value: + // A Buffer containing a list of capabilities + // See the APCI spec, Section 6.2.10, + // and the PCI FW spec, Section 4.5. + // + // The following is an example, and may need modification for + // specific implementations. + // + + Name (SUPP,0) // PCI _OSC Support Field value + Name (CTRL,0) // PCI _OSC Control Field value + + Method (_OSC, 4) { + + // + // Look for the PCI Host Bridge Interface UUID. + // Section 6.2.10.3 + // + + // + // Create DWord-adressable fields from the Capabilities Buffer + // Create CDW1 outside the test as it's used in the else clause. + // + + CreateDWordField (Arg3, 0, CDW1) + If (LEqual (Arg0, ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) { + + CreateDWordField (Arg3, 4, CDW2) + CreateDWordField (Arg3, 8, CDW3) + + // + // Save Capabilities DWord 2 & 3 + // + + Store (CDW2, SUPP) + Store (CDW3, CTRL) + + // + // Only allow native hot plug control if OS supports: + // ASPM + // Clock PM + // MSI/MSI-X + // + + If (LNotEqual (And (SUPP, 0x16), 0x16)) { + + // + // Mask bit 0 (and undefined bits) + // + + And (CTRL, 0x1E, CTRL) + } + + // + // Never allow native Hot plug, PME. + // Never allow SHPC (no SHPC controller in this system). + // Only allow PCIe AER control if PCIe AER Firmware-First is disab= led + // Allows PCI Express Capability Structure control + // + + If (AERF) { + And (CTRL, 0x10, CTRL) + } Else { + And (CTRL, 0x18, CTRL) + } + + // + // Check for unknown revision. + // + + If (LNotEqual (Arg1, One)) { + Or (CDW1, 0x08, CDW1) + } + + // + // Check if capabilities bits were masked. + // + + If (LNotEqual (CDW3, CTRL)) { + Or (CDW1, 0x10, CDW1) + } + + // + // Update DWORD3 in the buffer. + // + + Store (CTRL, CDW3) + Return (Arg3) + + } Else { + + // + // Unrecognized UUID + // + + Or (CDW1, 4, CDW1) + Return (Arg3) + } + } // End _OSC + + // + // Declare a _DSM method for various functions called by the OS. + // See the APCI spec, Section 9.14.1, + // and the PCI FW spec, Section 4.6. + // See also: + // http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fd= e-d599bac8184a/PCI-rsc.doc + // + + Method (_DSM, 0x4, Serialized) { + + // + // Match against the _DSM PCI GUID. + // + + If (LEqual (Arg0, ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D"))) { + + Switch (ToInteger(Arg2)) { + // + // Function 0: Return supported functions as a bitfield + // with one bit for each supported function. + // Bit 0 must always be set, as that represents + // function 0 (which is what is being called here). + // Support for different functions may depend on + // the revision ID of the interface, passed as Arg1. + // + + Case (0) { + + // + // Functions 0-7 are supported. + // + + Return (Buffer() {0x01}) + } + } + } + + // + // If not one of the function identifiers we recognize, then return = a buffer + // with bit 0 set to 0 indicating no functions supported. + // + + Return (Buffer() {0}) + } + + // + // Root Port 0 Device within the Root Complex. + // + Device (RP0) { + // + // Device 0, Function 0. + // + + Name (_ADR, 0x00000000) + } + + Method (_PXM, 0, NotSerialized) { + // Patch by code + Return(0xFF) + } + } // PCI0 RCA0 + + // PCI1 RCA1 + Device (PCI1) { + // + // Hardware ID must be PNP0A08, which maps to a PCIe root complex. + // Section 6.1.5 + // + + Name (_HID, "PNP0A08") + Name (_CCA, ONE) + + Method (_STA, 0, NotSerialized) { + Return (0xF) // The default value is 0x0. Unfor= tunately, it breaks + // run-time patching as the repres= entation of 0 is special + // encoding and cannot be patched = to expand with extra bytes + // easily. As such, we default to = 0xF and patch this based + // on whether the port was enabled= or not by the BIOS. + } + + // + // Optionally, include a compatible ID of PNP0A03, which maps to a PCI + // root complex for use with pre-PCIe operating systems. + // Section 6.1.2 + // + + Name (_CID, "PNP0A03") + + // + // Declare the segment number of this root complex. Most systems only + // have one segment, which is numbered 0. + // Section 6.5.6 + // + + Name (_SEG, 13) + + // + // Declare the base bus number, which is the bus number of the root + // bus in this root complex. This is usually 0, but need not be. + // For root complexes supporting multiple root busses, this should + // be the lowest numbered root bus. + // Section 6.5.5 + // + + Name (_BBN, 0) + + // + // The _UID value provides a way of uniquely identifying a device + // in the case where more than one instance of a specific device + // is implemented with the same _HID/_CID. For systems with a + // single root complex, this is usually just 0. For systems with + // multiple root complexes, this should be different for each + // root complex. + // Section 6.1.12 + // + + Name (_UID, "PCI1") + Name (_STR, Unicode("PCIe 1 Device")) + + // + // Declare the PCI Routing Table. + // This defines SPI mappings of the four line-based interrupts + // associated with the root complex and hierarchy below it. + // Section 6.2.12 + // + + Name (_PRT, Package() { + + // + // Routing for device 0, all functions. + // Note: ARM doesn't support LNK nodes, so the third param + // is 0 and the fourth param is the SPI number of the interrupt + // line. In this example, the A/B/C/D interrupts are wired to + // SPI lines 132/133/134/135 respectively. PCI1 RCA1 + // + Package() {0x0001FFFF, 0, 0, 132}, + Package() {0x0001FFFF, 1, 0, 133}, + Package() {0x0001FFFF, 2, 0, 134}, + Package() {0x0001FFFF, 3, 0, 135}, + Package() {0x0002FFFF, 0, 0, 132}, + Package() {0x0002FFFF, 1, 0, 133}, + Package() {0x0002FFFF, 2, 0, 134}, + Package() {0x0002FFFF, 3, 0, 135}, + Package() {0x0003FFFF, 0, 0, 132}, + Package() {0x0003FFFF, 1, 0, 133}, + Package() {0x0003FFFF, 2, 0, 134}, + Package() {0x0003FFFF, 3, 0, 135}, + Package() {0x0004FFFF, 0, 0, 132}, + Package() {0x0004FFFF, 1, 0, 133}, + Package() {0x0004FFFF, 2, 0, 134}, + Package() {0x0004FFFF, 3, 0, 135}, + }) + + // + // Declare the resources assigned to this root complex. + // Section 6.2.2 + // + Method (_CBA, 0, Serialized) { + Return (0x37FFF0000000) + } + + // + // Declare a ResourceTemplate buffer to return the resource + // requirements from _CRS. + // Section 19.5.109 + // + + Name (RBUF, ResourceTemplate () { + + // + // Declare the range of bus numbers assigned to this root + // complex. In this example, the minimum bus number will be + // 0, the maximum bus number will be 0xFF, supporting + // 256 busses total. + // Section 19.5.141 + // + + WordBusNumber ( + ResourceProducer, + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + PosDecode, // Decode + 0, // AddressGranularity + 0, // AddressMinimum - Minimum Bus Number + 255, // AddressMaximum - Maximum Bus Number + 0, // AddressTranslation - Set to 0 + 256) // RangeLength - Number of Busses + + // + // Declare the memory range to be used for BAR memory + // windows. This declares a 4GB region starting at + // 0x4000000000. + // Section 19.5.80 + // + // Memory32Fixed (ReadWrite, 0x1FE40000, 0x10000, ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + Cacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000000050000000, // AddressMinimum - MIN + 0x000000005FFFFFFF, // AddressMinimum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000010000000 // RangeLength - LEN + ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + Cacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000340000000000, // AddressMinimum - MIN + 0x000037FFDFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x000003FFE0000000 // RangeLength - LEN + ) + }) + + Method (_CRS, 0, Serialized) { + Return (RBUF) + } + + // + // Declare an _OSC (OS Control Handoff) method which takes 4 arguments. + // + // Argments: + // Arg0 A Buffer containing a UUID + // Arg1 An Integer containing a Revision ID of the buffer format + // Arg2 An Integer containing a count of entries in Arg3 + // Arg3 A Buffer containing a list of DWORD capabilities + // Return Value: + // A Buffer containing a list of capabilities + // See the APCI spec, Section 6.2.10, + // and the PCI FW spec, Section 4.5. + // + // The following is an example, and may need modification for + // specific implementations. + // + + Name (SUPP,0) // PCI _OSC Support Field value + Name (CTRL,0) // PCI _OSC Control Field value + + Method (_OSC, 4) { + + // + // Look for the PCI Host Bridge Interface UUID. + // Section 6.2.10.3 + // + + // + // Create DWord-adressable fields from the Capabilities Buffer + // Create CDW1 outside the test as it's used in the else clause. + // + + CreateDWordField (Arg3, 0, CDW1) + If (LEqual (Arg0, ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) { + + CreateDWordField (Arg3, 4, CDW2) + CreateDWordField (Arg3, 8, CDW3) + + // + // Save Capabilities DWord 2 & 3 + // + + Store (CDW2, SUPP) + Store (CDW3, CTRL) + + // + // Only allow native hot plug control if OS supports: + // ASPM + // Clock PM + // MSI/MSI-X + // + + If (LNotEqual (And (SUPP, 0x16), 0x16)) { + + // + // Mask bit 0 (and undefined bits) + // + + And (CTRL, 0x1E, CTRL) + } + + // + // Never allow native Hot plug, PME. + // Never allow SHPC (no SHPC controller in this system). + // Only allow PCIe AER control if PCIe AER Firmware-First is disab= led + // Allows PCI Express Capability Structure control + // + + If (AERF) { + And (CTRL, 0x10, CTRL) + } Else { + And (CTRL, 0x18, CTRL) + } + + // + // Check for unknown revision. + // + + If (LNotEqual (Arg1, One)) { + Or (CDW1, 0x08, CDW1) + } + + // + // Check if capabilities bits were masked. + // + + If (LNotEqual (CDW3, CTRL)) { + Or (CDW1, 0x10, CDW1) + } + + // + // Update DWORD3 in the buffer. + // + + Store (CTRL, CDW3) + Return (Arg3) + + } Else { + + // + // Unrecognized UUID + // + + Or (CDW1, 4, CDW1) + Return (Arg3) + } + } // End _OSC + + // + // Declare a _DSM method for various functions called by the OS. + // See the APCI spec, Section 9.14.1, + // and the PCI FW spec, Section 4.6. + // See also: + // http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fd= e-d599bac8184a/PCI-rsc.doc + // + + Method (_DSM, 0x4, Serialized) { + + // + // Match against the _DSM PCI GUID. + // + + If (LEqual (Arg0, ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D"))) { + + Switch (ToInteger(Arg2)) { + // + // Function 0: Return supported functions as a bitfield + // with one bit for each supported function. + // Bit 0 must always be set, as that represents + // function 0 (which is what is being called here). + // Support for different functions may depend on + // the revision ID of the interface, passed as Arg1. + // + + Case (0) { + + // + // Functions 0-7 are supported. + // + + Return (Buffer() {0x01}) + } + } + } + + // + // If not one of the function identifiers we recognize, then return = a buffer + // with bit 0 set to 0 indicating no functions supported. + // + + Return (Buffer() {0}) + } + + // + // Root Port 0 Device within the Root Complex. + // + Device (RP0) { + // + // Device 0, Function 0. + // + + Name (_ADR, 0x00000000) + } + + Method (_PXM, 0, NotSerialized) { + // Patch by code + Return(0xFF) + } + } // PCI1 RCA1 diff --git a/Platform/Ampere/JadePkg/AcpiTables/PCI-S0.asi b/Platform/Amper= e/JadePkg/AcpiTables/PCI-S0.asi new file mode 100644 index 000000000000..f6d788cd99b0 --- /dev/null +++ b/Platform/Ampere/JadePkg/AcpiTables/PCI-S0.asi @@ -0,0 +1,2078 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + + // PCI2 RCA2 + Device (PCI2) { + // + // Hardware ID must be PNP0A08, which maps to a PCIe root complex. + // Section 6.1.5 + // + + Name (_HID, "PNP0A08") + Name (_CCA, ONE) + + Method (_STA, 0, NotSerialized) { + Return (0xF) + } + + // + // Optionally, include a compatible ID of PNP0A03, which maps to a PCI + // root complex for use with pre-PCIe operating systems. + // Section 6.1.2 + // + + Name (_CID, "PNP0A03") + + // + // Declare the segment number of this root complex. Most systems only + // have one segment, which is numbered 0. + // Section 6.5.6 + // + + Name (_SEG, 1) + + // + // Declare the base bus number, which is the bus number of the root + // bus in this root complex. This is usually 0, but need not be. + // For root complexes supporting multiple root busses, this should + // be the lowest numbered root bus. + // Section 6.5.5 + // + + Name (_BBN, 0) + + // + // The _UID value provides a way of uniquely identifying a device + // in the case where more than one instance of a specific device + // is implemented with the same _HID/_CID. For systems with a + // single root complex, this is usually just 0. For systems with + // multiple root complexes, this should be different for each + // root complex. + // Section 6.1.12 + // + + Name (_UID, "PCI2") + Name (_STR, Unicode("PCIe 2 Device")) + + // + // Declare the PCI Routing Table. + // This defines SPI mappings of the four line-based interrupts + // associated with the root complex and hierarchy below it. + // Section 6.2.12 + // + + Name (_PRT, Package() { + // + // Routing for device 0, all functions. + // Note: ARM doesn't support LNK nodes, so the third param + // is 0 and the fourth param is the SPI number of the interrupt + // line. In this example, the A/B/C/D interrupts are wired to + // SPI lines 136/137/138/139 respectively. PCI2 RCA2 + // + Package() {0x0001FFFF, 0, 0, 136}, + Package() {0x0001FFFF, 1, 0, 137}, + Package() {0x0001FFFF, 2, 0, 138}, + Package() {0x0001FFFF, 3, 0, 139}, + Package() {0x0002FFFF, 0, 0, 136}, + Package() {0x0002FFFF, 1, 0, 137}, + Package() {0x0002FFFF, 2, 0, 138}, + Package() {0x0002FFFF, 3, 0, 139}, + Package() {0x0003FFFF, 0, 0, 136}, + Package() {0x0003FFFF, 1, 0, 137}, + Package() {0x0003FFFF, 2, 0, 138}, + Package() {0x0003FFFF, 3, 0, 139}, + Package() {0x0004FFFF, 0, 0, 136}, + Package() {0x0004FFFF, 1, 0, 137}, + Package() {0x0004FFFF, 2, 0, 138}, + Package() {0x0004FFFF, 3, 0, 139}, + }) + + // + // Declare the resources assigned to this root complex. + // Section 6.2.2 + // + Method (_CBA, 0, Serialized) { + Return (0x3BFFF0000000) + } + + // + // Declare a ResourceTemplate buffer to return the resource + // requirements from _CRS. + // Section 19.5.109 + // + + Name (RBUF, ResourceTemplate () { + + // + // Declare the range of bus numbers assigned to this root + // complex. In this example, the minimum bus number will be + // 0, the maximum bus number will be 0xFF, supporting + // 256 busses total. + // Section 19.5.141 + // + + WordBusNumber ( + ResourceProducer, + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + PosDecode, // Decode + 0, // AddressGranularity + 0, // AddressMinimum - Minimum Bus Number + 255, // AddressMaximum - Maximum Bus Number + 0, // AddressTranslation - Set to 0 + 256) // RangeLength - Number of Busses + + // + // Declare the memory range to be used for BAR memory + // windows. This declares a 4GB region starting at + // 0x4000000000. + // Section 19.5.80 + // + // Memory32Fixed (ReadWrite, 0x1FE80000, 0x10000, ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000000030000000, // AddressMinimum - MIN + 0x0000000037FFFFFF, // AddressMinimum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000008000000 // RangeLength - LEN + ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000380000000000, // AddressMinimum - MIN + 0x00003BFFDFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x000003FFE0000000 // RangeLength - LEN + ) + }) + + Method (_CRS, 0, Serialized) { + Return (RBUF) + } + + // + // Declare an _OSC (OS Control Handoff) method which takes 4 arguments. + // + // Argments: + // Arg0 A Buffer containing a UUID + // Arg1 An Integer containing a Revision ID of the buffer format + // Arg2 An Integer containing a count of entries in Arg3 + // Arg3 A Buffer containing a list of DWORD capabilities + // Return Value: + // A Buffer containing a list of capabilities + // See the APCI spec, Section 6.2.10, + // and the PCI FW spec, Section 4.5. + // + // The following is an example, and may need modification for + // specific implementations. + // + + Name (SUPP, 0) // PCI _OSC Support Field value + Name (CTRL, 0) // PCI _OSC Control Field value + + Method (_OSC, 4) { + + // + // Look for the PCI Host Bridge Interface UUID. + // Section 6.2.10.3 + // + + // + // Create DWord-adressable fields from the Capabilities Buffer + // Create CDW1 outside the test as it's used in the else clause. + // + + CreateDWordField (Arg3,0,CDW1) + If (LEqual (Arg0, ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) { + + CreateDWordField (Arg3, 4, CDW2) + CreateDWordField (Arg3, 8, CDW3) + + // + // Save Capabilities DWord 2 & 3 + // + + Store (CDW2, SUPP) + Store (CDW3, CTRL) + + // + // Only allow native hot plug control if OS supports: + // ASPM + // Clock PM + // MSI/MSI-X + // + + If (LNotEqual (And (SUPP, 0x16), 0x16)) { + + // + // Mask bit 0 (and undefined bits) + // + + And (CTRL, 0x1E, CTRL) + } + + // + // Never allow native Hot plug, PME. + // Never allow SHPC (no SHPC controller in this system). + // Only allow PCIe AER control if PCIe AER Firmware-First is disab= led + // Allows PCI Express Capability Structure control + // + + If (AERF) { + And (CTRL, 0x10, CTRL) + } Else { + And (CTRL, 0x18, CTRL) + } + + // + // Check for unknown revision. + // + + If (LNotEqual (Arg1, One)) { + Or (CDW1, 0x08, CDW1) + } + + // + // Check if capabilities bits were masked. + // + + If (LNotEqual (CDW3, CTRL)) { + Or (CDW1, 0x10, CDW1) + } + + // + // Update DWORD3 in the buffer. + // + + Store (CTRL, CDW3) + Return (Arg3) + } Else { + + // + // Unrecognized UUID + // + + Or (CDW1, 4, CDW1) + Return (Arg3) + } + } // End _OSC + + // + // Declare a _DSM method for various functions called by the OS. + // See the APCI spec, Section 9.14.1, + // and the PCI FW spec, Section 4.6. + // See also: + // http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fd= e-d599bac8184a/PCI-rsc.doc + // + + Method (_DSM, 0x4, Serialized) { + + // + // Match against the _DSM PCI GUID. + // + + If (LEqual (Arg0, ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D"))) { + + Switch (ToInteger(Arg2)) { + // + // Function 0: Return supported functions as a bitfield + // with one bit for each supported function. + // Bit 0 must always be set, as that represents + // function 0 (which is what is being called here). + // Support for different functions may depend on + // the revision ID of the interface, passed as Arg1. + // + + Case (0) { + + // + // Functions 0-7 are supported. + // + + Return (Buffer() {0x01}) + } + } + } + + // + // If not one of the function identifiers we recognize, then return = a buffer + // with bit 0 set to 0 indicating no functions supported. + // + + Return (Buffer() {0}) + } + + // + // Root Port 0 Device within the Root Complex. + // + Device (RP0) { + // + // Device 0, Function 0. + // + + Name (_ADR, 0x00000000) + } + + Method (_PXM, 0, NotSerialized) { + // Patch by code + Return(0xFF) + } + } // PCI2 RCA2 + + // PCI3 RCA3 + Device (PCI3) { + // + // Hardware ID must be PNP0A08, which maps to a PCIe root complex. + // Section 6.1.5 + // + + Name (_HID, "PNP0A08") + Name (_CCA, ONE) + + Method (_STA, 0, NotSerialized) { + Return (0xF) + } + + // + // Optionally, include a compatible ID of PNP0A03, which maps to a PCI + // root complex for use with pre-PCIe operating systems. + // Section 6.1.2 + // + + Name (_CID, "PNP0A03") + + // + // Declare the segment number of this root complex. Most systems only + // have one segment, which is numbered 0. + // Section 6.5.6 + // + + Name (_SEG, 0) + + // + // Declare the base bus number, which is the bus number of the root + // bus in this root complex. This is usually 0, but need not be. + // For root complexes supporting multiple root busses, this should + // be the lowest numbered root bus. + // Section 6.5.5 + // + + Name (_BBN, 0) + + // + // The _UID value provides a way of uniquely identifying a device + // in the case where more than one instance of a specific device + // is implemented with the same _HID/_CID. For systems with a + // single root complex, this is usually just 0. For systems with + // multiple root complexes, this should be different for each + // root complex. + // Section 6.1.12 + // + + Name (_UID, "PCI3") + Name (_STR, Unicode("PCIe 3 Device")) + + // + // Declare the PCI Routing Table. + // This defines SPI mappings of the four line-based interrupts + // associated with the root complex and hierarchy below it. + // Section 6.2.12 + // + + Name (_PRT, Package() { + // + // Routing for device 0, all functions. + // Note: ARM doesn't support LNK nodes, so the third param + // is 0 and the fourth param is the SPI number of the interrupt + // line. In this example, the A/B/C/D interrupts are wired to + // SPI lines 140/141/142/143 respectively. PCI3 RCA3 + // + Package() {0x0001FFFF, 0, 0, 140}, + Package() {0x0001FFFF, 1, 0, 141}, + Package() {0x0001FFFF, 2, 0, 142}, + Package() {0x0001FFFF, 3, 0, 143}, + Package() {0x0002FFFF, 0, 0, 140}, + Package() {0x0002FFFF, 1, 0, 141}, + Package() {0x0002FFFF, 2, 0, 142}, + Package() {0x0002FFFF, 3, 0, 143}, + Package() {0x0003FFFF, 0, 0, 140}, + Package() {0x0003FFFF, 1, 0, 141}, + Package() {0x0003FFFF, 2, 0, 142}, + Package() {0x0003FFFF, 3, 0, 143}, + Package() {0x0004FFFF, 0, 0, 140}, + Package() {0x0004FFFF, 1, 0, 141}, + Package() {0x0004FFFF, 2, 0, 142}, + Package() {0x0004FFFF, 3, 0, 143}, + }) + + // + // Declare the resources assigned to this root complex. + // Section 6.2.2 + // + Method (_CBA, 0, Serialized) { + Return (0x3FFFF0000000) + } + + // + // Declare a ResourceTemplate buffer to Return the resource + // requirements from _CRS. + // Section 19.5.109 + // + + Name (RBUF, ResourceTemplate () { + + // + // Declare the range of bus numbers assigned to this root + // complex. In this example, the minimum bus number will be + // 0, the maximum bus number will be 0xFF, supporting + // 256 busses total. + // Section 19.5.141 + // + + WordBusNumber ( + ResourceProducer, + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + PosDecode, // Decode + 0, // AddressGranularity + 0, // AddressMinimum - Minimum Bus Number + 255, // AddressMaximum - Maximum Bus Number + 0, // AddressTranslation - Set to 0 + 256) // RangeLength - Number of Busses + + // + // Declare the memory range to be used for BAR memory + // windows. This declares a 4GB region starting at + // 0x4000000000. + // Section 19.5.80 + // + // Memory32Fixed (ReadWrite, 0x1FE00000, 0x10000, ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000000038000000, // AddressMinimum - MIN + 0x000000003FFFFFFF, // AddressMinimum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000008000000 // RangeLength - LEN + ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x00003C0000000000, // AddressMinimum - MIN + 0x00003FFFDFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x000003FFE0000000 // RangeLength - LEN + ) + }) + + Method (_CRS, 0, Serialized) { + Return (RBUF) + } + + // + // Declare an _OSC (OS Control Handoff) method which takes 4 arguments. + // + // Argments: + // Arg0 A Buffer containing a UUID + // Arg1 An Integer containing a Revision ID of the buffer format + // Arg2 An Integer containing a count of entries in Arg3 + // Arg3 A Buffer containing a list of DWORD capabilities + // Return Value: + // A Buffer containing a list of capabilities + // See the APCI spec, Section 6.2.10, + // and the PCI FW spec, Section 4.5. + // + // The following is an example, and may need modification for + // specific implementations. + // + + Name (SUPP, 0) // PCI _OSC Support Field value + Name (CTRL, 0) // PCI _OSC Control Field value + + Method (_OSC, 4) { + + // + // Look for the PCI Host Bridge Interface UUID. + // Section 6.2.10.3 + // + + // + // Create DWord-adressable fields from the Capabilities Buffer + // Create CDW1 outside the test as it's used in the else clause. + // + + CreateDWordField (Arg3, 0, CDW1) + If (LEqual (Arg0, ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) { + + CreateDWordField (Arg3, 4, CDW2) + CreateDWordField (Arg3, 8, CDW3) + + // + // Save Capabilities DWord 2 & 3 + // + + Store (CDW2, SUPP) + Store (CDW3, CTRL) + + // + // Only allow native hot plug control if OS supports: + // ASPM + // Clock PM + // MSI/MSI-X + // + + If (LNotEqual (And (SUPP, 0x16), 0x16)) { + + // + // Mask bit 0 (and undefined bits) + // + + And (CTRL, 0x1E, CTRL) + } + + // + // Never allow native Hot plug, PME. + // Never allow SHPC (no SHPC controller in this system). + // Only allow PCIe AER control if PCIe AER Firmware-First is disab= led + // Allows PCI Express Capability Structure control + // + + If (AERF) { + And (CTRL, 0x10, CTRL) + } Else { + And (CTRL, 0x18, CTRL) + } + + // + // Check for unknown revision. + // + + If (LNotEqual (Arg1, One)) { + Or (CDW1, 0x08, CDW1) + } + + // + // Check if capabilities bits were masked. + // + + If (LNotEqual (CDW3, CTRL)) { + Or (CDW1, 0x10, CDW1) + } + + // + // Update DWORD3 in the buffer. + // + + Store (CTRL, CDW3) + Return (Arg3) + } Else { + + // + // Unrecognized UUID + // + + Or (CDW1, 4, CDW1) + Return (Arg3) + } + } // End _OSC + + // + // Declare a _DSM method for various functions called by the OS. + // See the APCI spec, Section 9.14.1, + // and the PCI FW spec, Section 4.6. + // See also: + // http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fd= e-d599bac8184a/PCI-rsc.doc + // + + Method (_DSM, 0x4, Serialized) { + + // + // Match against the _DSM PCI GUID. + // + + If (LEqual (Arg0, ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D"))) { + + Switch (ToInteger(Arg2)) { + // + // Function 0: Return supported functions as a bitfield + // with one bit for each supported function. + // Bit 0 must always be set, as that represents + // function 0 (which is what is being called here). + // Support for different functions may depend on + // the revision ID of the interface, passed as Arg1. + // + + Case (0) { + + // + // Functions 0-7 are supported. + // + + Return (Buffer() {0x01}) + } + } + } + + // + // If not one of the function identifiers we recognize, then return = a buffer + // with bit 0 set to 0 indicating no functions supported. + // + + Return (Buffer() {0}) + } + + // + // Root Port 0 Device within the Root Complex. + // + Device (RP0) { + // + // Device 0, Function 0. + // + + Name (_ADR, 0x00000000) + } + + Method (_PXM, 0, NotSerialized) { + // Patch by code + Return(0xFF) + } + } // PCI3 RCA3 + + // PCI4 RCB0 + Device (PCI4) { + // + // Hardware ID must be PNP0A08, which maps to a PCIe root complex. + // Section 6.1.5 + // + + Name (_HID, "PNP0A08") + Name (_CCA, ONE) + + Method (_STA, 0, NotSerialized) { + Return (0xF) // The default value is 0x0. Unfor= tunately, it breaks + // run-time patching as the repres= entation of 0 is special + // encoding and cannot be patched = to expand with extra bytes + // easily. As such, we default to = 0xF and patch this based + // on whether the port was enabled= or not by the BIOS. + } + + // + // Optionally, include a compatible ID of PNP0A03, which maps to a PCI + // root complex for use with pre-PCIe operating systems. + // Section 6.1.2 + // + + Name (_CID, "PNP0A03") + + // + // Declare the segment number of this root complex. Most systems only + // have one segment, which is numbered 0. + // Section 6.5.6 + // + + Name (_SEG, 2) + + // + // Declare the base bus number, which is the bus number of the root + // bus in this root complex. This is usually 0, but need not be. + // For root complexes supporting multiple root busses, this should + // be the lowest numbered root bus. + // Section 6.5.5 + // + + Name (_BBN, 0) + + // + // The _UID value provides a way of uniquely identifying a device + // in the case where more than one instance of a specific device + // is implemented with the same _HID/_CID. For systems with a + // single root complex, this is usually just 0. For systems with + // multiple root complexes, this should be different for each + // root complex. + // Section 6.1.12 + // + + Name (_UID, "PCI4") + Name (_STR, Unicode("PCIe 4 Device")) + + // + // Declare the PCI Routing Table. + // This defines SPI mappings of the four line-based interrupts + // associated with the root complex and hierarchy below it. + // Section 6.2.12 + // + + Name (_PRT, Package() { + + // + // Routing for device 0, all functions. + // Note: ARM doesn't support LNK nodes, so the third param + // is 0 and the fourth param is the SPI number of the interrupt + // line. In this example, the A/B/C/D interrupts are wired to + // SPI lines 144/145/146/147 respectively. PCI4 RCB0 + // + Package() {0x0001FFFF, 0, 0, 144}, + Package() {0x0001FFFF, 1, 0, 145}, + Package() {0x0001FFFF, 2, 0, 146}, + Package() {0x0001FFFF, 3, 0, 147}, + Package() {0x0002FFFF, 0, 0, 144}, + Package() {0x0002FFFF, 1, 0, 145}, + Package() {0x0002FFFF, 2, 0, 146}, + Package() {0x0002FFFF, 3, 0, 147}, + Package() {0x0003FFFF, 0, 0, 144}, + Package() {0x0003FFFF, 1, 0, 145}, + Package() {0x0003FFFF, 2, 0, 146}, + Package() {0x0003FFFF, 3, 0, 147}, + Package() {0x0004FFFF, 0, 0, 144}, + Package() {0x0004FFFF, 1, 0, 145}, + Package() {0x0004FFFF, 2, 0, 146}, + Package() {0x0004FFFF, 3, 0, 147}, + Package() {0x0005FFFF, 0, 0, 144}, + Package() {0x0005FFFF, 1, 0, 145}, + Package() {0x0005FFFF, 2, 0, 146}, + Package() {0x0005FFFF, 3, 0, 147}, + Package() {0x0006FFFF, 0, 0, 144}, + Package() {0x0006FFFF, 1, 0, 145}, + Package() {0x0006FFFF, 2, 0, 146}, + Package() {0x0006FFFF, 3, 0, 147}, + Package() {0x0007FFFF, 0, 0, 144}, + Package() {0x0007FFFF, 1, 0, 145}, + Package() {0x0007FFFF, 2, 0, 146}, + Package() {0x0007FFFF, 3, 0, 147}, + Package() {0x0008FFFF, 0, 0, 144}, + Package() {0x0008FFFF, 1, 0, 145}, + Package() {0x0008FFFF, 2, 0, 146}, + Package() {0x0008FFFF, 3, 0, 147}, + }) + + // + // Declare the resources assigned to this root complex. + // Section 6.2.2 + // + Method (_CBA, 0, Serialized) { + Return (0x23FFF0000000) + } + + + // + // Declare a ResourceTemplate buffer to return the resource + // requirements from _CRS. + // Section 19.5.109 + // + + Name (RBUF, ResourceTemplate () { + + // + // Declare the range of bus numbers assigned to this root + // complex. In this example, the minimum bus number will be + // 0, the maximum bus number will be 0xFF, supporting + // 256 busses total. + // Section 19.5.141 + // + + WordBusNumber ( + ResourceProducer, + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + PosDecode, // Decode + 0, // AddressGranularity + 0, // AddressMinimum - Minimum Bus Number + 255, // AddressMaximum - Maximum Bus Number + 0, // AddressTranslation - Set to 0 + 256) // RangeLength - Number of Busses + + // + // Declare the memory range to be used for BAR memory + // windows. This declares a 4GB region starting at + // 0x4000000000. + // Section 19.5.80 + // + // Memory32Fixed (ReadWrite, 0x1FEC0000, 0x10000, ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000000004000000, // AddressMinimum - MIN + 0x0000000007FFFFFF, // AddressMinimum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000004000000 // RangeLength - LEN + ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000200000000000, // AddressMinimum - MIN + 0x000023FFDFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x000003FFE0000000 // RangeLength - LEN + ) + }) + + Method (_CRS, 0, Serialized) { + Return (RBUF) + } + + // + // Declare an _OSC (OS Control Handoff) method which takes 4 arguments. + // + // Argments: + // Arg0 A Buffer containing a UUID + // Arg1 An Integer containing a Revision ID of the buffer format + // Arg2 An Integer containing a count of entries in Arg3 + // Arg3 A Buffer containing a list of DWORD capabilities + // Return Value: + // A Buffer containing a list of capabilities + // See the APCI spec, Section 6.2.10, + // and the PCI FW spec, Section 4.5. + // + // The following is an example, and may need modification for + // specific implementations. + // + + Name (SUPP,0) // PCI _OSC Support Field value + Name (CTRL,0) // PCI _OSC Control Field value + + Method (_OSC, 4) { + + // + // Look for the PCI Host Bridge Interface UUID. + // Section 6.2.10.3 + // + + // + // Create DWord-adressable fields from the Capabilities Buffer + // Create CDW1 outside the test as it's used in the else clause. + // + + CreateDWordField (Arg3, 0, CDW1) + If (LEqual (Arg0,ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) { + + CreateDWordField (Arg3, 4, CDW2) + CreateDWordField (Arg3, 8, CDW3) + + // + // Save Capabilities DWord 2 & 3 + // + + Store (CDW2, SUPP) + Store (CDW3, CTRL) + + // + // Only allow native hot plug control if OS supports: + // ASPM + // Clock PM + // MSI/MSI-X + // + + If (LNotEqual (And (SUPP, 0x16), 0x16)) { + + // + // Mask bit 0 (and undefined bits) + // + + And (CTRL, 0x1E, CTRL) + } + + // + // Never allow native Hot plug, PME. + // Never allow SHPC (no SHPC controller in this system). + // Only allow PCIe AER control if PCIe AER Firmware-First is disab= led + // Allows PCI Express Capability Structure control + // + + If (AERF) { + And (CTRL, 0x10, CTRL) + } Else { + And (CTRL, 0x18, CTRL) + } + + // + // Check for unknown revision. + // + + If (LNotEqual (Arg1, One)) { + Or (CDW1, 0x08, CDW1) + } + + // + // Check if capabilities bits were masked. + // + + If (LNotEqual (CDW3, CTRL)) { + Or (CDW1, 0x10, CDW1) + } + + // + // Update DWORD3 in the buffer. + // + + Store (CTRL, CDW3) + Return (Arg3) + } Else { + + // + // Unrecognized UUID + // + + Or (CDW1, 4, CDW1) + Return (Arg3) + } + } // End _OSC + + // + // Declare a _DSM method for various functions called by the OS. + // See the APCI spec, Section 9.14.1, + // and the PCI FW spec, Section 4.6. + // See also: + // http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fd= e-d599bac8184a/PCI-rsc.doc + // + + Method (_DSM, 0x4, Serialized) { + + // + // Match against the _DSM PCI GUID. + // + + If (LEqual (Arg0, ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D"))) { + + Switch (ToInteger(Arg2)) + { + // + // Function 0: Return supported functions as a bitfield + // with one bit for each supported function. + // Bit 0 must always be set, as that represents + // function 0 (which is what is being called here). + // Support for different functions may depend on + // the revision ID of the interface, passed as Arg1. + // + + Case (0) { + + // + // Functions 0-7 are supported. + // + + Return (Buffer() {0x01}) + } + } + } + + // + // If not one of the function identifiers we recognize, then return = a buffer + // with bit 0 set to 0 indicating no functions supported. + // + + Return (Buffer() {0}) + } + + // + // Root Port 0 Device within the Root Complex. + // + Device (RP0) { + // + // Device 0, Function 0. + // + + Name (_ADR, 0x00000000) + } + + Method (_PXM, 0, NotSerialized) { + // Patch by code + Return(0xFF) + } + } // PCI4 RCB0 + + // PCI5 RCB1 + Device (PCI5) { + // + // Hardware ID must be PNP0A08, which maps to a PCIe root complex. + // Section 6.1.5 + // + + Name (_HID, "PNP0A08") + Name (_CCA, ONE) + + Method (_STA, 0, NotSerialized) { + Return (0xF) + } + + // + // Optionally, include a compatible ID of PNP0A03, which maps to a PCI + // root complex for use with pre-PCIe operating systems. + // Section 6.1.2 + // + + Name (_CID,"PNP0A03") + + // + // Declare the segment number of this root complex. Most systems only + // have one segment, which is numbered 0. + // Section 6.5.6 + // + + Name (_SEG, 3) + + // + // Declare the base bus number, which is the bus number of the root + // bus in this root complex. This is usually 0, but need not be. + // For root complexes supporting multiple root busses, this should + // be the lowest numbered root bus. + // Section 6.5.5 + // + + Name (_BBN, 0) + + // + // The _UID value provides a way of uniquely identifying a device + // in the case where more than one instance of a specific device + // is implemented with the same _HID/_CID. For systems with a + // single root complex, this is usually just 0. For systems with + // multiple root complexes, this should be different for each + // root complex. + // Section 6.1.12 + // + + Name (_UID, "PCI5") + Name (_STR, Unicode("PCIe 5 Device")) + + // + // Declare the PCI Routing Table. + // This defines SPI mappings of the four line-based interrupts + // associated with the root complex and hierarchy below it. + // Section 6.2.12 + // + + Name (_PRT, Package() { + + // + // Routing for device 0, all functions. + // Note: ARM doesn't support LNK nodes, so the third param + // is 0 and the fourth param is the SPI number of the interrupt + // line. In this example, the A/B/C/D interrupts are wired to + // SPI lines 148/149/150/151 respectively. PCI5 RCB1 + // + Package() {0x0001FFFF, 0, 0, 148}, + Package() {0x0001FFFF, 1, 0, 149}, + Package() {0x0001FFFF, 2, 0, 150}, + Package() {0x0001FFFF, 3, 0, 151}, + Package() {0x0002FFFF, 0, 0, 148}, + Package() {0x0002FFFF, 1, 0, 149}, + Package() {0x0002FFFF, 2, 0, 150}, + Package() {0x0002FFFF, 3, 0, 151}, + Package() {0x0003FFFF, 0, 0, 148}, + Package() {0x0003FFFF, 1, 0, 149}, + Package() {0x0003FFFF, 2, 0, 150}, + Package() {0x0003FFFF, 3, 0, 151}, + Package() {0x0004FFFF, 0, 0, 148}, + Package() {0x0004FFFF, 1, 0, 149}, + Package() {0x0004FFFF, 2, 0, 150}, + Package() {0x0004FFFF, 3, 0, 151}, + Package() {0x0005FFFF, 0, 0, 148}, + Package() {0x0005FFFF, 1, 0, 149}, + Package() {0x0005FFFF, 2, 0, 150}, + Package() {0x0005FFFF, 3, 0, 151}, + Package() {0x0006FFFF, 0, 0, 148}, + Package() {0x0006FFFF, 1, 0, 149}, + Package() {0x0006FFFF, 2, 0, 150}, + Package() {0x0006FFFF, 3, 0, 151}, + Package() {0x0007FFFF, 0, 0, 148}, + Package() {0x0007FFFF, 1, 0, 149}, + Package() {0x0007FFFF, 2, 0, 150}, + Package() {0x0007FFFF, 3, 0, 151}, + Package() {0x0008FFFF, 0, 0, 148}, + Package() {0x0008FFFF, 1, 0, 149}, + Package() {0x0008FFFF, 2, 0, 150}, + Package() {0x0008FFFF, 3, 0, 151}, + }) + + // + // Declare the resources assigned to this root complex. + // Section 6.2.2 + // + Method (_CBA, 0, Serialized) { + Return (0x27FFF0000000) + } + + // + // Declare a ResourceTemplate buffer to return the resource + // requirements from _CRS. + // Section 19.5.109 + // + + Name (RBUF, ResourceTemplate () { + + // + // Declare the range of bus numbers assigned to this root + // complex. In this example, the minimum bus number will be + // 0, the maximum bus number will be 0xFF, supporting + // 256 busses total. + // Section 19.5.141 + // + + WordBusNumber ( + ResourceProducer, + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + PosDecode, // Decode + 0, // AddressGranularity + 0, // AddressMinimum - Minimum Bus Number + 255, // AddressMaximum - Maximum Bus Number + 0, // AddressTranslation - Set to 0 + 256) // RangeLength - Number of Busses + + // + // Declare the memory range to be used for BAR memory + // windows. This declares a 4GB region starting at + // 0x4000000000. + // Section 19.5.80 + // + // Memory32Fixed (ReadWrite, 0x1FF00000, 0x10000, ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000000008000000, // AddressMinimum - MIN + 0x000000000FFFFFFF, // AddressMinimum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000008000000 // RangeLength - LEN + ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000240000000000, // AddressMinimum - MIN + 0x000027FFDFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x000003FFE0000000 // RangeLength - LEN + ) + }) + + Method (_CRS, 0, Serialized) { + Return (RBUF) + } + + // + // Declare an _OSC (OS Control Handoff) method which takes 4 arguments. + // + // Argments: + // Arg0 A Buffer containing a UUID + // Arg1 An Integer containing a Revision ID of the buffer format + // Arg2 An Integer containing a count of entries in Arg3 + // Arg3 A Buffer containing a list of DWORD capabilities + // Return Value: + // A Buffer containing a list of capabilities + // See the APCI spec, Section 6.2.10, + // and the PCI FW spec, Section 4.5. + // + // The following is an example, and may need modification for + // specific implementations. + // + + Name (SUPP, 0) // PCI _OSC Support Field value + Name (CTRL, 0) // PCI _OSC Control Field value + + Method (_OSC, 4) { + + // + // Look for the PCI Host Bridge Interface UUID. + // Section 6.2.10.3 + // + + // + // Create DWord-adressable fields from the Capabilities Buffer + // Create CDW1 outside the test as it's used in the else clause. + // + + CreateDWordField (Arg3, 0, CDW1) + If (LEqual (Arg0,ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) { + + CreateDWordField (Arg3, 4, CDW2) + CreateDWordField (Arg3, 8, CDW3) + + // + // Save Capabilities DWord 2 & 3 + // + + Store (CDW2, SUPP) + Store (CDW3, CTRL) + + // + // Only allow native hot plug control if OS supports: + // ASPM + // Clock PM + // MSI/MSI-X + // + + If (LNotEqual (And (SUPP, 0x16), 0x16)) { + + // + // Mask bit 0 (and undefined bits) + // + + And (CTRL, 0x1E, CTRL) + } + + // + // Never allow native Hot plug, PME. + // Never allow SHPC (no SHPC controller in this system). + // Only allow PCIe AER control if PCIe AER Firmware-First is disab= led + // Allows PCI Express Capability Structure control + // + + If (AERF) { + And (CTRL, 0x10, CTRL) + } Else { + And (CTRL, 0x18, CTRL) + } + + // + // Check for unknown revision. + // + + If (LNotEqual (Arg1, One)) { + Or (CDW1, 0x08, CDW1) + } + + // + // Check if capabilities bits were masked. + // + + If (LNotEqual (CDW3, CTRL)) { + Or (CDW1, 0x10, CDW1) + } + + // + // Update DWORD3 in the buffer. + // + + Store (CTRL, CDW3) + Return (Arg3) + + } Else { + + // + // Unrecognized UUID + // + + Or (CDW1, 4, CDW1) + Return (Arg3) + } + } // End _OSC + + // + // Declare a _DSM method for various functions called by the OS. + // See the APCI spec, Section 9.14.1, + // and the PCI FW spec, Section 4.6. + // See also: + // http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fd= e-d599bac8184a/PCI-rsc.doc + // + + Method (_DSM, 0x4, Serialized) { + + // + // Match against the _DSM PCI GUID. + // + + If (LEqual (Arg0, ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D"))) { + + Switch (ToInteger(Arg2)) + { + // + // Function 0: Return supported functions as a bitfield + // with one bit for each supported function. + // Bit 0 must always be set, as that represents + // function 0 (which is what is being called here). + // Support for different functions may depend on + // the revision ID of the interface, passed as Arg1. + // + + Case (0) { + + // + // Functions 0-7 are supported. + // + + Return (Buffer() {0x01}) + } + } + } + + // + // If not one of the function identifiers we recognize, then return = a buffer + // with bit 0 set to 0 indicating no functions supported. + // + + Return (Buffer() {0}) + } + + // + // Root Port 0 Device within the Root Complex. + // + Device (RP0) { + // + // Device 0, Function 0. + // + + Name (_ADR, 0x00000000) + } + + Method (_PXM, 0, NotSerialized) { + // Patch by code + Return(0xFF) + } + } // PCI5 RCB1 + + + // PCI6 RCB2 + Device (PCI6) { + // + // Hardware ID must be PNP0A08, which maps to a PCIe root complex. + // Section 6.1.5 + // + + Name (_HID,"PNP0A08") + Name (_CCA, ONE) + + Method (_STA, 0, NotSerialized) { + Return (0xF) // The default value is 0x0. Unfor= tunately, it breaks + // run-time patching as the repres= entation of 0 is special + // encoding and cannot be patched = to expand with extra bytes + // easily. As such, we default to = 0xF and patch this based + // on whether the port was enabled= or not by the BIOS. + } + + // + // Optionally, include a compatible ID of PNP0A03, which maps to a PCI + // root complex for use with pre-PCIe operating systems. + // Section 6.1.2 + // + + Name (_CID,"PNP0A03") + + // + // Declare the segment number of this root complex. Most systems only + // have one segment, which is numbered 0. + // Section 6.5.6 + // + + Name (_SEG, 4) + + // + // Declare the base bus number, which is the bus number of the root + // bus in this root complex. This is usually 0, but need not be. + // For root complexes supporting multiple root busses, this should + // be the lowest numbered root bus. + // Section 6.5.5 + // + + Name (_BBN, 0) + + // + // The _UID value provides a way of uniquely identifying a device + // in the case where more than one instance of a specific device + // is implemented with the same _HID/_CID. For systems with a + // single root complex, this is usually just 0. For systems with + // multiple root complexes, this should be different for each + // root complex. + // Section 6.1.12 + // + + Name (_UID, "PCI6") + Name (_STR, Unicode("PCIe 6 Device")) + + // + // Declare the PCI Routing Table. + // This defines SPI mappings of the four line-based interrupts + // associated with the root complex and hierarchy below it. + // Section 6.2.12 + // + + Name (_PRT, Package() { + + // + // Routing for device 0, all functions. + // Note: ARM doesn't support LNK nodes, so the third param + // is 0 and the fourth param is the SPI number of the interrupt + // line. In this example, the A/B/C/D interrupts are wired to + // SPI lines 152/153/154/155 respectively. PCI6 RCB2 + // + Package() {0x0001FFFF, 0, 0, 152}, + Package() {0x0001FFFF, 1, 0, 153}, + Package() {0x0001FFFF, 2, 0, 154}, + Package() {0x0001FFFF, 3, 0, 155}, + Package() {0x0002FFFF, 0, 0, 152}, + Package() {0x0002FFFF, 1, 0, 153}, + Package() {0x0002FFFF, 2, 0, 154}, + Package() {0x0002FFFF, 3, 0, 155}, + Package() {0x0003FFFF, 0, 0, 152}, + Package() {0x0003FFFF, 1, 0, 153}, + Package() {0x0003FFFF, 2, 0, 154}, + Package() {0x0003FFFF, 3, 0, 155}, + Package() {0x0004FFFF, 0, 0, 152}, + Package() {0x0004FFFF, 1, 0, 153}, + Package() {0x0004FFFF, 2, 0, 154}, + Package() {0x0004FFFF, 3, 0, 155}, + Package() {0x0005FFFF, 0, 0, 152}, + Package() {0x0005FFFF, 1, 0, 153}, + Package() {0x0005FFFF, 2, 0, 154}, + Package() {0x0005FFFF, 3, 0, 155}, + Package() {0x0006FFFF, 0, 0, 152}, + Package() {0x0006FFFF, 1, 0, 153}, + Package() {0x0006FFFF, 2, 0, 154}, + Package() {0x0006FFFF, 3, 0, 155}, + Package() {0x0007FFFF, 0, 0, 152}, + Package() {0x0007FFFF, 1, 0, 153}, + Package() {0x0007FFFF, 2, 0, 154}, + Package() {0x0007FFFF, 3, 0, 155}, + Package() {0x0008FFFF, 0, 0, 152}, + Package() {0x0008FFFF, 1, 0, 153}, + Package() {0x0008FFFF, 2, 0, 154}, + Package() {0x0008FFFF, 3, 0, 155}, + }) + + // + // Declare the resources assigned to this root complex. + // Section 6.2.2 + // + Method (_CBA, 0, Serialized) { + Return (0x2BFFF0000000) + } + + // + // Declare a ResourceTemplate buffer to return the resource + // requirements from _CRS. + // Section 19.5.109 + // + + Name (RBUF, ResourceTemplate () { + + // + // Declare the range of bus numbers assigned to this root + // complex. In this example, the minimum bus number will be + // 0, the maximum bus number will be 0xFF, supporting + // 256 busses total. + // Section 19.5.141 + // + + WordBusNumber ( + ResourceProducer, + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + PosDecode, // Decode + 0, // AddressGranularity + 0, // AddressMinimum - Minimum Bus Number + 255, // AddressMaximum - Maximum Bus Number + 0, // AddressTranslation - Set to 0 + 256) // RangeLength - Number of Busses + + // + // Declare the memory range to be used for BAR memory + // windows. This declares a 4GB region starting at + // 0x4000000000. + // Section 19.5.80 + // + // Memory32Fixed (ReadWrite, 0x1FF40000, 0x10000, ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000000010000000, // AddressMinimum - MIN + 0x0000000017FFFFFF, // AddressMinimum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000008000000 // RangeLength - LEN + ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000280000000000, // AddressMinimum - MIN + 0x00002BFFDFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x000003FFE0000000 // RangeLength - LEN + ) + }) + + Method (_CRS, 0, Serialized) { + Return (RBUF) + } + + // + // Declare an _OSC (OS Control Handoff) method which takes 4 arguments. + // + // Argments: + // Arg0 A Buffer containing a UUID + // Arg1 An Integer containing a Revision ID of the buffer format + // Arg2 An Integer containing a count of entries in Arg3 + // Arg3 A Buffer containing a list of DWORD capabilities + // Return Value: + // A Buffer containing a list of capabilities + // See the APCI spec, Section 6.2.10, + // and the PCI FW spec, Section 4.5. + // + // The following is an example, and may need modification for + // specific implementations. + // + + Name (SUPP,0) // PCI _OSC Support Field value + Name (CTRL,0) // PCI _OSC Control Field value + + Method (_OSC, 4) { + + // + // Look for the PCI Host Bridge Interface UUID. + // Section 6.2.10.3 + // + + // + // Create DWord-adressable fields from the Capabilities Buffer + // Create CDW1 outside the test as it's used in the else clause. + // + + CreateDWordField (Arg3,0,CDW1) + If (LEqual (Arg0,ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) { + + CreateDWordField (Arg3,4,CDW2) + CreateDWordField (Arg3,8,CDW3) + + // + // Save Capabilities DWord 2 & 3 + // + + Store (CDW2,SUPP) + Store (CDW3,CTRL) + + // + // Only allow native hot plug control if OS supports: + // ASPM + // Clock PM + // MSI/MSI-X + // + + If (LNotEqual (And (SUPP, 0x16), 0x16)) { + + // + // Mask bit 0 (and undefined bits) + // + + And (CTRL,0x1E,CTRL) + } + + // + // Never allow native Hot plug, PME. + // Never allow SHPC (no SHPC controller in this system). + // Only allow PCIe AER control if PCIe AER Firmware-First is disab= led + // Allows PCI Express Capability Structure control + // + + If (AERF) { + And (CTRL, 0x10, CTRL) + } Else { + And (CTRL, 0x18, CTRL) + } + + // + // Check for unknown revision. + // + + If (LNotEqual (Arg1,One)) { + Or (CDW1,0x08,CDW1) + } + + // + // Check if capabilities bits were masked. + // + + If (LNotEqual (CDW3,CTRL)) { + Or (CDW1,0x10,CDW1) + } + + // + // Update DWORD3 in the buffer. + // + + Store (CTRL,CDW3) + Return (Arg3) + } Else { + + // + // Unrecognized UUID + // + + Or (CDW1,4,CDW1) + Return (Arg3) + } + } // End _OSC + + // + // Declare a _DSM method for various functions called by the OS. + // See the APCI spec, Section 9.14.1, + // and the PCI FW spec, Section 4.6. + // See also: + // http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fd= e-d599bac8184a/PCI-rsc.doc + // + + Method (_DSM, 0x4, Serialized) { + + // + // Match against the _DSM PCI GUID. + // + + If (LEqual (Arg0,ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D"))) { + + Switch (ToInteger(Arg2)) { + // + // Function 0: Return supported functions as a bitfield + // with one bit for each supported function. + // Bit 0 must always be set, as that represents + // function 0 (which is what is being called here). + // Support for different functions may depend on + // the revision ID of the interface, passed as Arg1. + // + + Case (0) { + + // + // Functions 0-7 are supported. + // + + Return (Buffer() {0x01}) + } + } + } + + // + // If not one of the function identifiers we recognize, then return = a buffer + // with bit 0 set to 0 indicating no functions supported. + // + + Return (Buffer() {0}) + } + + // + // Root Port 0 Device within the Root Complex. + // + Device (RP0) { + // + // Device 0, Function 0. + // + + Name (_ADR, 0x00000000) + } + + Method (_PXM, 0, NotSerialized) { + // Patch by code + Return(0xFF) + } + } // PCI6 RCB2 + + // PCI7 RCB3 + Device (PCI7) { + // + // Hardware ID must be PNP0A08, which maps to a PCIe root complex. + // Section 6.1.5 + // + + Name (_HID,"PNP0A08") + Name (_CCA, ONE) + + Method (_STA, 0, NotSerialized) { + Return (0xF) // The default value is 0x0. Unfor= tunately, it breaks + // run-time patching as the repres= entation of 0 is special + // encoding and cannot be patched = to expand with extra bytes + // easily. As such, we default to = 0xF and patch this based + // on whether the port was enabled= or not by the BIOS. + } + + // + // Optionally, include a compatible ID of PNP0A03, which maps to a PCI + // root complex for use with pre-PCIe operating systems. + // Section 6.1.2 + // + + Name (_CID,"PNP0A03") + + // + // Declare the segment number of this root complex. Most systems only + // have one segment, which is numbered 0. + // Section 6.5.6 + // + + Name (_SEG, 5) + + // + // Declare the base bus number, which is the bus number of the root + // bus in this root complex. This is usually 0, but need not be. + // For root complexes supporting multiple root busses, this should + // be the lowest numbered root bus. + // Section 6.5.5 + // + + Name (_BBN, 0) + + // + // The _UID value provides a way of uniquely identifying a device + // in the case where more than one instance of a specific device + // is implemented with the same _HID/_CID. For systems with a + // single root complex, this is usually just 0. For systems with + // multiple root complexes, this should be different for each + // root complex. + // Section 6.1.12 + // + + Name (_UID, "PCI7") + Name (_STR, Unicode("PCIe 7 Device")) + + // + // Declare the PCI Routing Table. + // This defines SPI mappings of the four line-based interrupts + // associated with the root complex and hierarchy below it. + // Section 6.2.12 + // + + Name (_PRT, Package() { + + // + // Routing for device 0, all functions. + // Note: ARM doesn't support LNK nodes, so the third param + // is 0 and the fourth param is the SPI number of the interrupt + // line. In this example, the A/B/C/D interrupts are wired to + // SPI lines 156/157/158/159 respectively. PCI7 RCB3 + // + Package() {0x0001FFFF, 0, 0, 156}, + Package() {0x0001FFFF, 1, 0, 157}, + Package() {0x0001FFFF, 2, 0, 158}, + Package() {0x0001FFFF, 3, 0, 159}, + Package() {0x0002FFFF, 0, 0, 156}, + Package() {0x0002FFFF, 1, 0, 157}, + Package() {0x0002FFFF, 2, 0, 158}, + Package() {0x0002FFFF, 3, 0, 159}, + Package() {0x0003FFFF, 0, 0, 156}, + Package() {0x0003FFFF, 1, 0, 157}, + Package() {0x0003FFFF, 2, 0, 158}, + Package() {0x0003FFFF, 3, 0, 159}, + Package() {0x0004FFFF, 0, 0, 156}, + Package() {0x0004FFFF, 1, 0, 157}, + Package() {0x0004FFFF, 2, 0, 158}, + Package() {0x0004FFFF, 3, 0, 159}, + Package() {0x0005FFFF, 0, 0, 156}, + Package() {0x0005FFFF, 1, 0, 157}, + Package() {0x0005FFFF, 2, 0, 158}, + Package() {0x0005FFFF, 3, 0, 159}, + Package() {0x0006FFFF, 0, 0, 156}, + Package() {0x0006FFFF, 1, 0, 157}, + Package() {0x0006FFFF, 2, 0, 158}, + Package() {0x0006FFFF, 3, 0, 159}, + Package() {0x0007FFFF, 0, 0, 156}, + Package() {0x0007FFFF, 1, 0, 157}, + Package() {0x0007FFFF, 2, 0, 158}, + Package() {0x0007FFFF, 3, 0, 159}, + Package() {0x0008FFFF, 0, 0, 156}, + Package() {0x0008FFFF, 1, 0, 157}, + Package() {0x0008FFFF, 2, 0, 158}, + Package() {0x0008FFFF, 3, 0, 159}, + }) + + // + // Declare the resources assigned to this root complex. + // Section 6.2.2 + // + Method (_CBA, 0, Serialized) { + Return (0x2FFFF0000000) + } + + // + // Declare a ResourceTemplate buffer to return the resource + // requirements from _CRS. + // Section 19.5.109 + // + + Name (RBUF, ResourceTemplate () { + + // + // Declare the range of bus numbers assigned to this root + // complex. In this example, the minimum bus number will be + // 0, the maximum bus number will be 0xFF, supporting + // 256 busses total. + // Section 19.5.141 + // + + WordBusNumber ( + ResourceProducer, + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + PosDecode, // Decode + 0, // AddressGranularity + 0, // AddressMinimum - Minimum Bus Number + 255, // AddressMaximum - Maximum Bus Number + 0, // AddressTranslation - Set to 0 + 256) // RangeLength - Number of Busses + + // + // Declare the memory range to be used for BAR memory + // windows. This declares a 4GB region starting at + // 0x4000000000. + // Section 19.5.80 + // + // Memory32Fixed (ReadWrite, 0x1FF40000, 0x10000, ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000000018000000, // AddressMinimum - MIN + 0x000000001FFFFFFF, // AddressMinimum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000008000000 // RangeLength - LEN + ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x00002C0000000000, // AddressMinimum - MIN + 0x00002FFFDFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x000003FFE0000000 // RangeLength - LEN + ) + }) + + Method (_CRS, 0, Serialized) { + Return (RBUF) + } + + // + // Declare an _OSC (OS Control Handoff) method which takes 4 arguments. + // + // Argments: + // Arg0 A Buffer containing a UUID + // Arg1 An Integer containing a Revision ID of the buffer format + // Arg2 An Integer containing a count of entries in Arg3 + // Arg3 A Buffer containing a list of DWORD capabilities + // Return Value: + // A Buffer containing a list of capabilities + // See the APCI spec, Section 6.2.10, + // and the PCI FW spec, Section 4.5. + // + // The following is an example, and may need modification for + // specific implementations. + // + + Name (SUPP,0) // PCI _OSC Support Field value + Name (CTRL,0) // PCI _OSC Control Field value + + Method (_OSC, 4) { + + // + // Look for the PCI Host Bridge Interface UUID. + // Section 6.2.10.3 + // + + // + // Create DWord-adressable fields from the Capabilities Buffer + // Create CDW1 outside the test as it's used in the else clause. + // + + CreateDWordField (Arg3,0,CDW1) + If (LEqual (Arg0,ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) { + + CreateDWordField (Arg3,4,CDW2) + CreateDWordField (Arg3,8,CDW3) + + // + // Save Capabilities DWord 2 & 3 + // + + Store (CDW2,SUPP) + Store (CDW3,CTRL) + + // + // Only allow native hot plug control if OS supports: + // ASPM + // Clock PM + // MSI/MSI-X + // + + If (LNotEqual (And (SUPP, 0x16), 0x16)) { + + // + // Mask bit 0 (and undefined bits) + // + + And (CTRL,0x1E,CTRL) + } + + // + // Never allow native Hot plug, PME. + // Never allow SHPC (no SHPC controller in this system). + // Only allow PCIe AER control if PCIe AER Firmware-First is disab= led + // Allows PCI Express Capability Structure control + // + + If (AERF) { + And (CTRL, 0x10, CTRL) + } Else { + And (CTRL, 0x18, CTRL) + } + + // + // Check for unknown revision. + // + + If (LNotEqual (Arg1,One)) { + Or (CDW1,0x08,CDW1) + } + + // + // Check if capabilities bits were masked. + // + + If (LNotEqual (CDW3,CTRL)) { + Or (CDW1,0x10,CDW1) + } + + // + // Update DWORD3 in the buffer. + // + + Store (CTRL,CDW3) + Return (Arg3) + } Else { + + // + // Unrecognized UUID + // + + Or (CDW1,4,CDW1) + Return (Arg3) + } + } // End _OSC + + // + // Declare a _DSM method for various functions called by the OS. + // See the APCI spec, Section 9.14.1, + // and the PCI FW spec, Section 4.6. + // See also: + // http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fd= e-d599bac8184a/PCI-rsc.doc + // + + Method (_DSM, 0x4, Serialized) { + + // + // Match against the _DSM PCI GUID. + // + + If (LEqual (Arg0,ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D"))) { + + Switch (ToInteger(Arg2)) { + // + // Function 0: Return supported functions as a bitfield + // with one bit for each supported function. + // Bit 0 must always be set, as that represents + // function 0 (which is what is being called here). + // Support for different functions may depend on + // the revision ID of the interface, passed as Arg1. + // + + Case (0) { + + // + // Functions 0-7 are supported. + // + + Return (Buffer() {0x01}) + } + } + } + + // + // If not one of the function identifiers we recognize, then return = a buffer + // with bit 0 set to 0 indicating no functions supported. + // + + Return (Buffer() {0}) + } + + // + // Root Port 0 Device within the Root Complex. + // + Device (RP0) { + // + // Device 0, Function 0. + // + + Name (_ADR, 0x00000000) + } + + Method (_PXM, 0, NotSerialized) { + // Patch by code + Return(0xFF) + } + } // PCI7 RCB3 diff --git a/Platform/Ampere/JadePkg/AcpiTables/PCI-S1.asi b/Platform/Amper= e/JadePkg/AcpiTables/PCI-S1.asi new file mode 100644 index 000000000000..2757f3124b83 --- /dev/null +++ b/Platform/Ampere/JadePkg/AcpiTables/PCI-S1.asi @@ -0,0 +1,2087 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + + // + // S1 Start here + // + + // PCIE6 S1 RCA2 + Device (PCIA) { + // + // Hardware ID must be PNP0A08, which maps to a PCIe root complex. + // Section 6.1.5 + // + + Name (_HID,"PNP0A08") + Name (_CCA, ONE) + + Method (_STA, 0, NotSerialized) { + Return (0xF) + } + + // + // Optionally, include a compatible ID of PNP0A03, which maps to a PCI + // root complex for use with pre-PCIe operating systems. + // Section 6.1.2 + // + + Name (_CID,"PNP0A03") + + // + // Declare the segment number of this root complex. Most systems only + // have one segment, which is numbered 0. + // Section 6.5.6 + // + + Name (_SEG, 6) + + // + // Declare the base bus number, which is the bus number of the root + // bus in this root complex. This is usually 0, but need not be. + // For root complexes supporting multiple root busses, this should + // be the lowest numbered root bus. + // Section 6.5.5 + // + + Name (_BBN, 0) + + // + // The _UID value provides a way of uniquely identifying a device + // in the case where more than one instance of a specific device + // is implemented with the same _HID/_CID. For systems with a + // single root complex, this is usually just 0. For systems with + // multiple root complexes, this should be different for each + // root complex. + // Section 6.1.12 + // + + Name (_UID, "PCIA") + Name (_STR, Unicode("PCIe 10 Device")) + + // + // Declare the PCI Routing Table. + // This defines SPI mappings of the four line-based interrupts + // associated with the root complex and hierarchy below it. + // Section 6.2.12 + // + + Name (_PRT, Package() { + + // + // Routing for device 0, all functions. + // Note: ARM doesn't support LNK nodes, so the third param + // is 0 and the fourth param is the SPI number of the interrupt + // line. In this example, the A/B/C/D interrupts are wired to + // SPI lines 136/137/138/139 + 320 respectively. PCIA RCA2 + // + Package() {0x0001FFFF, 0, 0, 456}, + Package() {0x0001FFFF, 1, 0, 457}, + Package() {0x0001FFFF, 2, 0, 458}, + Package() {0x0001FFFF, 3, 0, 459}, + Package() {0x0002FFFF, 0, 0, 456}, + Package() {0x0002FFFF, 1, 0, 457}, + Package() {0x0002FFFF, 2, 0, 458}, + Package() {0x0002FFFF, 3, 0, 459}, + Package() {0x0003FFFF, 0, 0, 456}, + Package() {0x0003FFFF, 1, 0, 457}, + Package() {0x0003FFFF, 2, 0, 458}, + Package() {0x0003FFFF, 3, 0, 459}, + Package() {0x0004FFFF, 0, 0, 456}, + Package() {0x0004FFFF, 1, 0, 457}, + Package() {0x0004FFFF, 2, 0, 458}, + Package() {0x0004FFFF, 3, 0, 459}, + }) + + // + // Declare the resources assigned to this root complex. + // Section 6.2.2 + // + Method (_CBA, 0, Serialized) { + Return (0x7BFFF0000000) + } + + // + // Declare a ResourceTemplate buffer to return the resource + // requirements from _CRS. + // Section 19.5.109 + // + + Name (RBUF, ResourceTemplate () { + + // + // Declare the range of bus numbers assigned to this root + // complex. In this example, the minimum bus number will be + // 0, the maximum bus number will be 0xFF, supporting + // 256 busses total. + // Section 19.5.141 + // + + WordBusNumber ( + ResourceProducer, + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + PosDecode, // Decode + 0, // AddressGranularity + 0, // AddressMinimum - Minimum Bus Number + 255, // AddressMaximum - Maximum Bus Number + 0, // AddressTranslation - Set to 0 + 256) // RangeLength - Number of Busses + + // + // Declare the memory range to be used for BAR memory + // windows. This declares a 4GB region starting at + // 0x4000000000. + // Section 19.5.80 + // + // Memory32Fixed (ReadWrite, 0x1FF80000, 0x10000, ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000000070000000, // AddressMinimum - MIN + 0x0000000077FFFFFF, // AddressMinimum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000008000000 // RangeLength - LEN + ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000780000000000, // AddressMinimum - MIN + 0x00007BFFDFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x000003FFE0000000 // RangeLength - LEN + ) + }) + + Method (_CRS, 0, Serialized) { + Return (RBUF) + } + + // + // Declare an _OSC (OS Control Handoff) method which takes 4 arguments. + // + // Argments: + // Arg0 A Buffer containing a UUID + // Arg1 An Integer containing a Revision ID of the buffer format + // Arg2 An Integer containing a count of entries in Arg3 + // Arg3 A Buffer containing a list of DWORD capabilities + // Return Value: + // A Buffer containing a list of capabilities + // See the APCI spec, Section 6.2.10, + // and the PCI FW spec, Section 4.5. + // + // The following is an example, and may need modification for + // specific implementations. + // + + Name (SUPP,0) // PCI _OSC Support Field value + Name (CTRL,0) // PCI _OSC Control Field value + + Method (_OSC, 4) { + + // + // Look for the PCI Host Bridge Interface UUID. + // Section 6.2.10.3 + // + + // + // Create DWord-adressable fields from the Capabilities Buffer + // Create CDW1 outside the test as it's used in the else clause. + // + + CreateDWordField (Arg3,0,CDW1) + If (LEqual (Arg0,ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) { + + CreateDWordField (Arg3,4,CDW2) + CreateDWordField (Arg3,8,CDW3) + + // + // Save Capabilities DWord 2 & 3 + // + + Store (CDW2,SUPP) + Store (CDW3,CTRL) + + // + // Only allow native hot plug control if OS supports: + // ASPM + // Clock PM + // MSI/MSI-X + // + + If (LNotEqual (And (SUPP, 0x16), 0x16)) { + + // + // Mask bit 0 (and undefined bits) + // + + And (CTRL,0x1E,CTRL) + } + + // + // Never allow native Hot plug, PME. + // Never allow SHPC (no SHPC controller in this system). + // Only allow PCIe AER control if PCIe AER Firmware-First is disab= led + // Allows PCI Express Capability Structure control + // + + If (AERF) { + And (CTRL, 0x10, CTRL) + } Else { + And (CTRL, 0x18, CTRL) + } + + // + // Check for unknown revision. + // + + If (LNotEqual (Arg1,One)) { + Or (CDW1,0x08,CDW1) + } + + // + // Check if capabilities bits were masked. + // + + If (LNotEqual (CDW3,CTRL)) { + Or (CDW1,0x10,CDW1) + } + + // + // Update DWORD3 in the buffer. + // + + Store (CTRL,CDW3) + Return (Arg3) + } Else { + + // + // Unrecognized UUID + // + + Or (CDW1,4,CDW1) + Return (Arg3) + } + } // End _OSC + + // + // Declare a _DSM method for various functions called by the OS. + // See the APCI spec, Section 9.14.1, + // and the PCI FW spec, Section 4.6. + // See also: + // http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fd= e-d599bac8184a/PCI-rsc.doc + // + + Method (_DSM, 0x4, Serialized) { + + // + // Match against the _DSM PCI GUID. + // + + If (LEqual (Arg0,ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D"))) { + + Switch (ToInteger(Arg2)) { + // + // Function 0: Return supported functions as a bitfield + // with one bit for each supported function. + // Bit 0 must always be set, as that represents + // function 0 (which is what is being called here). + // Support for different functions may depend on + // the revision ID of the interface, passed as Arg1. + // + + Case (0) { + + // + // Functions 0-7 are supported. + // + + Return (Buffer() {0x01}) + } + } + } + + // + // If not one of the function identifiers we recognize, then return = a buffer + // with bit 0 set to 0 indicating no functions supported. + // + + Return (Buffer() {0}) + } + + // + // Root Port 0 Device within the Root Complex. + // + Device (RP0) { + // + // Device 0, Function 0. + // + + Name (_ADR, 0x00000000) + } + + Method (_PXM, 0, NotSerialized) { + // Patch by code + Return(0xFF) + } + } // PCIA RCA2 + + // PCIEB RCA3 + Device (PCIB) { + // + // Hardware ID must be PNP0A08, which maps to a PCIe root complex. + // Section 6.1.5 + // + + Name (_HID,"PNP0A08") + Name (_CCA, ONE) + + Method (_STA, 0, NotSerialized) { + Return (0xF) + } + + // + // Optionally, include a compatible ID of PNP0A03, which maps to a PCI + // root complex for use with pre-PCIe operating systems. + // Section 6.1.2 + // + + Name (_CID,"PNP0A03") + + // + // Declare the segment number of this root complex. Most systems only + // have one segment, which is numbered 0. + // Section 6.5.6 + // + + Name (_SEG, 7) + + // + // Declare the base bus number, which is the bus number of the root + // bus in this root complex. This is usually 0, but need not be. + // For root complexes supporting multiple root busses, this should + // be the lowest numbered root bus. + // Section 6.5.5 + // + + Name (_BBN, 0) + + // + // The _UID value provides a way of uniquely identifying a device + // in the case where more than one instance of a specific device + // is implemented with the same _HID/_CID. For systems with a + // single root complex, this is usually just 0. For systems with + // multiple root complexes, this should be different for each + // root complex. + // Section 6.1.12 + // + + Name (_UID, "PCIB") + Name (_STR, Unicode("PCIe 11 Device")) + + // + // Declare the PCI Routing Table. + // This defines SPI mappings of the four line-based interrupts + // associated with the root complex and hierarchy below it. + // Section 6.2.12 + // + + Name (_PRT, Package() { + + // + // Routing for device 0, all functions. + // Note: ARM doesn't support LNK nodes, so the third param + // is 0 and the fourth param is the SPI number of the interrupt + // line. In this example, the A/B/C/D interrupts are wired to + // SPI lines 140/141/142/143 + 320 respectively. PCIB RCA3 + // + Package() {0x0001FFFF, 0, 0, 460}, + Package() {0x0001FFFF, 1, 0, 461}, + Package() {0x0001FFFF, 2, 0, 462}, + Package() {0x0001FFFF, 3, 0, 463}, + Package() {0x0002FFFF, 0, 0, 460}, + Package() {0x0002FFFF, 1, 0, 461}, + Package() {0x0002FFFF, 2, 0, 462}, + Package() {0x0002FFFF, 3, 0, 463}, + Package() {0x0003FFFF, 0, 0, 460}, + Package() {0x0003FFFF, 1, 0, 461}, + Package() {0x0003FFFF, 2, 0, 462}, + Package() {0x0003FFFF, 3, 0, 463}, + Package() {0x0004FFFF, 0, 0, 460}, + Package() {0x0004FFFF, 1, 0, 461}, + Package() {0x0004FFFF, 2, 0, 462}, + Package() {0x0004FFFF, 3, 0, 463}, + }) + + // + // Declare the resources assigned to this root complex. + // Section 6.2.2 + // + Method (_CBA, 0, Serialized) { + Return (0x7FFFF0000000) + } + + // + // Declare a ResourceTemplate buffer to return the resource + // requirements from _CRS. + // Section 19.5.109 + // + + Name (RBUF, ResourceTemplate () { + + // + // Declare the range of bus numbers assigned to this root + // complex. In this example, the minimum bus number will be + // 0, the maximum bus number will be 0xFF, supporting + // 256 busses total. + // Section 19.5.141 + // + + WordBusNumber ( + ResourceProducer, + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + PosDecode, // Decode + 0, // AddressGranularity + 0, // AddressMinimum - Minimum Bus Number + 255, // AddressMaximum - Maximum Bus Number + 0, // AddressTranslation - Set to 0 + 256) // RangeLength - Number of Busses + + // + // Declare the memory range to be used for BAR memory + // windows. This declares a 4GB region starting at + // 0x4000000000. + // Section 19.5.80 + // + // Memory32Fixed (ReadWrite, 0x1FFC0000, 0x10000, ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000000078000000, // AddressMinimum - MIN + 0x000000007FFFFFFF, // AddressMinimum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000008000000 // RangeLength - LEN + ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x00007C0000000000, // AddressMinimum - MIN + 0x00007FFFDFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x000003FFE0000000 // RangeLength - LEN + ) + }) + + Method (_CRS, 0, Serialized) { + Return (RBUF) + } + + // + // Declare an _OSC (OS Control Handoff) method which takes 4 arguments. + // + // Argments: + // Arg0 A Buffer containing a UUID + // Arg1 An Integer containing a Revision ID of the buffer format + // Arg2 An Integer containing a count of entries in Arg3 + // Arg3 A Buffer containing a list of DWORD capabilities + // Return Value: + // A Buffer containing a list of capabilities + // See the APCI spec, Section 6.2.10, + // and the PCI FW spec, Section 4.5. + // + // The following is an example, and may need modification for + // specific implementations. + // + + Name (SUPP,0) // PCI _OSC Support Field value + Name (CTRL,0) // PCI _OSC Control Field value + + Method (_OSC, 4) { + + // + // Look for the PCI Host Bridge Interface UUID. + // Section 6.2.10.3 + // + + // + // Create DWord-adressable fields from the Capabilities Buffer + // Create CDW1 outside the test as it's used in the else clause. + // + + CreateDWordField (Arg3,0,CDW1) + If (LEqual (Arg0,ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) { + + CreateDWordField (Arg3,4,CDW2) + CreateDWordField (Arg3,8,CDW3) + + // + // Save Capabilities DWord 2 & 3 + // + + Store (CDW2,SUPP) + Store (CDW3,CTRL) + + // + // Only allow native hot plug control if OS supports: + // ASPM + // Clock PM + // MSI/MSI-X + // + + If (LNotEqual (And (SUPP, 0x16), 0x16)) { + + // + // Mask bit 0 (and undefined bits) + // + + And (CTRL,0x1E,CTRL) + } + + // + // Never allow native Hot plug, PME. + // Never allow SHPC (no SHPC controller in this system). + // Only allow PCIe AER control if PCIe AER Firmware-First is disab= led + // Allows PCI Express Capability Structure control + // + + If (AERF) { + And (CTRL, 0x10, CTRL) + } Else { + And (CTRL, 0x18, CTRL) + } + + // + // Check for unknown revision. + // + + If (LNotEqual (Arg1,One)) { + Or (CDW1,0x08,CDW1) + } + + // + // Check if capabilities bits were masked. + // + + If (LNotEqual (CDW3,CTRL)) { + Or (CDW1,0x10,CDW1) + } + + // + // Update DWORD3 in the buffer. + // + + Store (CTRL,CDW3) + Return (Arg3) + } Else { + + // + // Unrecognized UUID + // + + Or (CDW1,4,CDW1) + Return (Arg3) + } + } // End _OSC + + // + // Declare a _DSM method for various functions called by the OS. + // See the APCI spec, Section 9.14.1, + // and the PCI FW spec, Section 4.6. + // See also: + // http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fd= e-d599bac8184a/PCI-rsc.doc + // + + Method (_DSM, 0x4, Serialized) { + + // + // Match against the _DSM PCI GUID. + // + + If (LEqual (Arg0,ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D"))) { + + Switch (ToInteger(Arg2)) { + // + // Function 0: Return supported functions as a bitfield + // with one bit for each supported function. + // Bit 0 must always be set, as that represents + // function 0 (which is what is being called here). + // Support for different functions may depend on + // the revision ID of the interface, passed as Arg1. + // + + Case (0) { + + // + // Functions 0-7 are supported. + // + + Return (Buffer() {0x01}) + } + } + } + + // + // If not one of the function identifiers we recognize, then return = a buffer + // with bit 0 set to 0 indicating no functions supported. + // + + Return (Buffer() {0}) + } + + // + // Root Port 0 Device within the Root Complex. + // + Device (RP0) { + // + // Device 0, Function 0. + // + + Name (_ADR, 0x00000000) + } + + Method (_PXM, 0, NotSerialized) { + // Patch by code + Return(0xFF) + } + } // PCIB RCA3 + + // PCIC RCB0 + Device (PCIC) { + // + // Hardware ID must be PNP0A08, which maps to a PCIe root complex. + // Section 6.1.5 + // + + Name (_HID, "PNP0A08") + Name (_CCA, ONE) + + Method (_STA, 0, NotSerialized) { + Return (0xF) // The default value is 0x0. Unfor= tunately, it breaks + // run-time patching as the repres= entation of 0 is special + // encoding and cannot be patched = to expand with extra bytes + // easily. As such, we default to = 0xF and patch this based + // on whether the port was enabled= or not by the BIOS. + } + + // + // Optionally, include a compatible ID of PNP0A03, which maps to a PCI + // root complex for use with pre-PCIe operating systems. + // Section 6.1.2 + // + + Name (_CID, "PNP0A03") + + // + // Declare the segment number of this root complex. Most systems only + // have one segment, which is numbered 0. + // Section 6.5.6 + // + + Name (_SEG, 8) + + // + // Declare the base bus number, which is the bus number of the root + // bus in this root complex. This is usually 0, but need not be. + // For root complexes supporting multiple root busses, this should + // be the lowest numbered root bus. + // Section 6.5.5 + // + + Name (_BBN, 0) + + // + // The _UID value provides a way of uniquely identifying a device + // in the case where more than one instance of a specific device + // is implemented with the same _HID/_CID. For systems with a + // single root complex, this is usually just 0. For systems with + // multiple root complexes, this should be different for each + // root complex. + // Section 6.1.12 + // + + Name (_UID, "PCIC") + Name (_STR, Unicode("PCIe 12 Device")) + + // + // Declare the PCI Routing Table. + // This defines SPI mappings of the four line-based interrupts + // associated with the root complex and hierarchy below it. + // Section 6.2.12 + // + + Name (_PRT, Package() { + + // + // Routing for device 0, all functions. + // Note: ARM doesn't support LNK nodes, so the third param + // is 0 and the fourth param is the SPI number of the interrupt + // line. In this example, the A/B/C/D interrupts are wired to + // SPI lines 144/145/146/147 + 320 respectively. PCIC RCB0 + // + Package() {0x0001FFFF, 0, 0, 464}, + Package() {0x0001FFFF, 1, 0, 465}, + Package() {0x0001FFFF, 2, 0, 466}, + Package() {0x0001FFFF, 3, 0, 467}, + Package() {0x0002FFFF, 0, 0, 464}, + Package() {0x0002FFFF, 1, 0, 465}, + Package() {0x0002FFFF, 2, 0, 466}, + Package() {0x0002FFFF, 3, 0, 467}, + Package() {0x0003FFFF, 0, 0, 464}, + Package() {0x0003FFFF, 1, 0, 465}, + Package() {0x0003FFFF, 2, 0, 466}, + Package() {0x0003FFFF, 3, 0, 467}, + Package() {0x0004FFFF, 0, 0, 464}, + Package() {0x0004FFFF, 1, 0, 465}, + Package() {0x0004FFFF, 2, 0, 466}, + Package() {0x0004FFFF, 3, 0, 467}, + Package() {0x0005FFFF, 0, 0, 464}, + Package() {0x0005FFFF, 1, 0, 465}, + Package() {0x0005FFFF, 2, 0, 466}, + Package() {0x0005FFFF, 3, 0, 467}, + Package() {0x0006FFFF, 0, 0, 464}, + Package() {0x0006FFFF, 1, 0, 465}, + Package() {0x0006FFFF, 2, 0, 466}, + Package() {0x0006FFFF, 3, 0, 467}, + Package() {0x0007FFFF, 0, 0, 464}, + Package() {0x0007FFFF, 1, 0, 465}, + Package() {0x0007FFFF, 2, 0, 466}, + Package() {0x0007FFFF, 3, 0, 467}, + Package() {0x0008FFFF, 0, 0, 464}, + Package() {0x0008FFFF, 1, 0, 465}, + Package() {0x0008FFFF, 2, 0, 466}, + Package() {0x0008FFFF, 3, 0, 467}, + }) + + // + // Declare the resources assigned to this root complex. + // Section 6.2.2 + // + Method (_CBA, 0, Serialized) { + Return (0x63FFF0000000) + } + + // + // Declare a ResourceTemplate buffer to return the resource + // requirements from _CRS. + // Section 19.5.109 + // + + Name (RBUF, ResourceTemplate () { + + // + // Declare the range of bus numbers assigned to this root + // complex. In this example, the minimum bus number will be + // 0, the maximum bus number will be 0xFF, supporting + // 256 busses total. + // Section 19.5.141 + // + + WordBusNumber ( + ResourceProducer, + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + PosDecode, // Decode + 0, // AddressGranularity + 0, // AddressMinimum - Minimum Bus Number + 255, // AddressMaximum - Maximum Bus Number + 0, // AddressTranslation - Set to 0 + 256) // RangeLength - Number of Busses + + // + // Declare the memory range to be used for BAR memory + // windows. This declares a 4GB region starting at + // 0x4000000000. + // Section 19.5.80 + // + // Memory32Fixed (ReadWrite, 0x1FE40000, 0x10000, ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000000040000000, // AddressMinimum - MIN + 0x0000000047FFFFFF, // AddressMinimum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000008000000 // RangeLength - LEN + ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000600000000000, // AddressMinimum - MIN + 0x000063FFDFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x000003FFE0000000 // RangeLength - LEN + ) + }) + + Method (_CRS, 0, Serialized) { + Return (RBUF) + } + + // + // Declare an _OSC (OS Control Handoff) method which takes 4 arguments. + // + // Argments: + // Arg0 A Buffer containing a UUID + // Arg1 An Integer containing a Revision ID of the buffer format + // Arg2 An Integer containing a count of entries in Arg3 + // Arg3 A Buffer containing a list of DWORD capabilities + // Return Value: + // A Buffer containing a list of capabilities + // See the APCI spec, Section 6.2.10, + // and the PCI FW spec, Section 4.5. + // + // The following is an example, and may need modification for + // specific implementations. + // + + Name (SUPP,0) // PCI _OSC Support Field value + Name (CTRL,0) // PCI _OSC Control Field value + + Method (_OSC, 4) { + + // + // Look for the PCI Host Bridge Interface UUID. + // Section 6.2.10.3 + // + + // + // Create DWord-adressable fields from the Capabilities Buffer + // Create CDW1 outside the test as it's used in the else clause. + // + + CreateDWordField (Arg3, 0, CDW1) + If (LEqual (Arg0, ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) { + + CreateDWordField (Arg3, 4, CDW2) + CreateDWordField (Arg3, 8, CDW3) + + // + // Save Capabilities DWord 2 & 3 + // + + Store (CDW2, SUPP) + Store (CDW3, CTRL) + + // + // Only allow native hot plug control if OS supports: + // ASPM + // Clock PM + // MSI/MSI-X + // + + If (LNotEqual (And (SUPP, 0x16), 0x16)) { + + // + // Mask bit 0 (and undefined bits) + // + + And (CTRL, 0x1E, CTRL) + } + + // + // Never allow native Hot plug, PME. + // Never allow SHPC (no SHPC controller in this system). + // Only allow PCIe AER control if PCIe AER Firmware-First is disab= led + // Allows PCI Express Capability Structure control + // + + If (AERF) { + And (CTRL, 0x10, CTRL) + } Else { + And (CTRL, 0x18, CTRL) + } + + // + // Check for unknown revision. + // + + If (LNotEqual (Arg1, One)) { + Or (CDW1, 0x08, CDW1) + } + + // + // Check if capabilities bits were masked. + // + + If (LNotEqual (CDW3, CTRL)) { + Or (CDW1, 0x10, CDW1) + } + + // + // Update DWORD3 in the buffer. + // + + Store (CTRL, CDW3) + Return (Arg3) + + } Else { + + // + // Unrecognized UUID + // + + Or (CDW1, 4, CDW1) + Return (Arg3) + } + } // End _OSC + + // + // Declare a _DSM method for various functions called by the OS. + // See the APCI spec, Section 9.14.1, + // and the PCI FW spec, Section 4.6. + // See also: + // http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fd= e-d599bac8184a/PCI-rsc.doc + // + + Method (_DSM, 0x4, Serialized) { + + // + // Match against the _DSM PCI GUID. + // + + If (LEqual (Arg0, ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D"))) { + + Switch (ToInteger(Arg2)) { + // + // Function 0: Return supported functions as a bitfield + // with one bit for each supported function. + // Bit 0 must always be set, as that represents + // function 0 (which is what is being called here). + // Support for different functions may depend on + // the revision ID of the interface, passed as Arg1. + // + + Case (0) { + + // + // Functions 0-7 are supported. + // + + Return (Buffer() {0x01}) + } + } + } + + // + // If not one of the function identifiers we recognize, then return = a buffer + // with bit 0 set to 0 indicating no functions supported. + // + + Return (Buffer() {0}) + } + + // + // Root Port 0 Device within the Root Complex. + // + Device (RP0) { + // + // Device 0, Function 0. + // + + Name (_ADR, 0x00000000) + } + + Method (_PXM, 0, NotSerialized) { + // Patch by code + Return(0xFF) + } + } // PCIC RCB0 + + // PCID RCB1 + Device (PCID) { + // + // Hardware ID must be PNP0A08, which maps to a PCIe root complex. + // Section 6.1.5 + // + + Name (_HID, "PNP0A08") + Name (_CCA, ONE) + + Method (_STA, 0, NotSerialized) { + Return (0xF) // The default value is 0x0. Unfor= tunately, it breaks + // run-time patching as the repres= entation of 0 is special + // encoding and cannot be patched = to expand with extra bytes + // easily. As such, we default to = 0xF and patch this based + // on whether the port was enabled= or not by the BIOS. + } + + // + // Optionally, include a compatible ID of PNP0A03, which maps to a PCI + // root complex for use with pre-PCIe operating systems. + // Section 6.1.2 + // + + Name (_CID, "PNP0A03") + + // + // Declare the segment number of this root complex. Most systems only + // have one segment, which is numbered 0. + // Section 6.5.6 + // + + Name (_SEG, 9) + + // + // Declare the base bus number, which is the bus number of the root + // bus in this root complex. This is usually 0, but need not be. + // For root complexes supporting multiple root busses, this should + // be the lowest numbered root bus. + // Section 6.5.5 + // + + Name (_BBN, 0) + + // + // The _UID value provides a way of uniquely identifying a device + // in the case where more than one instance of a specific device + // is implemented with the same _HID/_CID. For systems with a + // single root complex, this is usually just 0. For systems with + // multiple root complexes, this should be different for each + // root complex. + // Section 6.1.12 + // + + Name (_UID, "PCID") + Name (_STR, Unicode("PCIe 13 Device")) + + // + // Declare the PCI Routing Table. + // This defines SPI mappings of the four line-based interrupts + // associated with the root complex and hierarchy below it. + // Section 6.2.12 + // + + Name (_PRT, Package() { + + // + // Routing for device 0, all functions. + // Note: ARM doesn't support LNK nodes, so the third param + // is 0 and the fourth param is the SPI number of the interrupt + // line. In this example, the A/B/C/D interrupts are wired to + // SPI lines 148/149/150/151 + 320 respectively. PCID RCB1 + // + Package() {0x0001FFFF, 0, 0, 468}, + Package() {0x0001FFFF, 1, 0, 469}, + Package() {0x0001FFFF, 2, 0, 470}, + Package() {0x0001FFFF, 3, 0, 471}, + Package() {0x0002FFFF, 0, 0, 468}, + Package() {0x0002FFFF, 1, 0, 469}, + Package() {0x0002FFFF, 2, 0, 470}, + Package() {0x0002FFFF, 3, 0, 471}, + Package() {0x0003FFFF, 0, 0, 468}, + Package() {0x0003FFFF, 1, 0, 469}, + Package() {0x0003FFFF, 2, 0, 470}, + Package() {0x0003FFFF, 3, 0, 471}, + Package() {0x0004FFFF, 0, 0, 468}, + Package() {0x0004FFFF, 1, 0, 469}, + Package() {0x0004FFFF, 2, 0, 470}, + Package() {0x0004FFFF, 3, 0, 471}, + Package() {0x0005FFFF, 0, 0, 468}, + Package() {0x0005FFFF, 1, 0, 469}, + Package() {0x0005FFFF, 2, 0, 470}, + Package() {0x0005FFFF, 3, 0, 471}, + Package() {0x0006FFFF, 0, 0, 468}, + Package() {0x0006FFFF, 1, 0, 469}, + Package() {0x0006FFFF, 2, 0, 470}, + Package() {0x0006FFFF, 3, 0, 471}, + Package() {0x0007FFFF, 0, 0, 468}, + Package() {0x0007FFFF, 1, 0, 469}, + Package() {0x0007FFFF, 2, 0, 470}, + Package() {0x0007FFFF, 3, 0, 471}, + Package() {0x0008FFFF, 0, 0, 468}, + Package() {0x0008FFFF, 1, 0, 469}, + Package() {0x0008FFFF, 2, 0, 470}, + Package() {0x0008FFFF, 3, 0, 471}, + }) + + // + // Declare the resources assigned to this root complex. + // Section 6.2.2 + // + Method (_CBA, 0, Serialized) { + Return (0x67FFF0000000) + } + + // + // Declare a ResourceTemplate buffer to return the resource + // requirements from _CRS. + // Section 19.5.109 + // + + Name (RBUF, ResourceTemplate () { + + // + // Declare the range of bus numbers assigned to this root + // complex. In this example, the minimum bus number will be + // 0, the maximum bus number will be 0xFF, supporting + // 256 busses total. + // Section 19.5.141 + // + + WordBusNumber ( + ResourceProducer, + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + PosDecode, // Decode + 0, // AddressGranularity + 0, // AddressMinimum - Minimum Bus Number + 255, // AddressMaximum - Maximum Bus Number + 0, // AddressTranslation - Set to 0 + 256) // RangeLength - Number of Busses + + // + // Declare the memory range to be used for BAR memory + // windows. This declares a 4GB region starting at + // 0x4000000000. + // Section 19.5.80 + // + // Memory32Fixed (ReadWrite, 0x1FE40000, 0x10000, ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000000048000000, // AddressMinimum - MIN + 0x000000004FFFFFFF, // AddressMinimum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000008000000 // RangeLength - LEN + ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000640000000000, // AddressMinimum - MIN + 0x000067FFDFFFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x000003FFE0000000 // RangeLength - LEN + ) + }) + + Method (_CRS, 0, Serialized) { + Return (RBUF) + } + + // + // Declare an _OSC (OS Control Handoff) method which takes 4 arguments. + // + // Argments: + // Arg0 A Buffer containing a UUID + // Arg1 An Integer containing a Revision ID of the buffer format + // Arg2 An Integer containing a count of entries in Arg3 + // Arg3 A Buffer containing a list of DWORD capabilities + // Return Value: + // A Buffer containing a list of capabilities + // See the APCI spec, Section 6.2.10, + // and the PCI FW spec, Section 4.5. + // + // The following is an example, and may need modification for + // specific implementations. + // + + Name (SUPP,0) // PCI _OSC Support Field value + Name (CTRL,0) // PCI _OSC Control Field value + + Method (_OSC, 4) { + + // + // Look for the PCI Host Bridge Interface UUID. + // Section 6.2.10.3 + // + + // + // Create DWord-adressable fields from the Capabilities Buffer + // Create CDW1 outside the test as it's used in the else clause. + // + + CreateDWordField (Arg3, 0, CDW1) + If (LEqual (Arg0, ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) { + + CreateDWordField (Arg3, 4, CDW2) + CreateDWordField (Arg3, 8, CDW3) + + // + // Save Capabilities DWord 2 & 3 + // + + Store (CDW2, SUPP) + Store (CDW3, CTRL) + + // + // Only allow native hot plug control if OS supports: + // ASPM + // Clock PM + // MSI/MSI-X + // + + If (LNotEqual (And (SUPP, 0x16), 0x16)) { + + // + // Mask bit 0 (and undefined bits) + // + + And (CTRL, 0x1E, CTRL) + } + + // + // Never allow native Hot plug, PME. + // Never allow SHPC (no SHPC controller in this system). + // Only allow PCIe AER control if PCIe AER Firmware-First is disab= led + // Allows PCI Express Capability Structure control + // + + If (AERF) { + And (CTRL, 0x10, CTRL) + } Else { + And (CTRL, 0x18, CTRL) + } + + // + // Check for unknown revision. + // + + If (LNotEqual (Arg1, One)) { + Or (CDW1, 0x08, CDW1) + } + + // + // Check if capabilities bits were masked. + // + + If (LNotEqual (CDW3, CTRL)) { + Or (CDW1, 0x10, CDW1) + } + + // + // Update DWORD3 in the buffer. + // + + Store (CTRL, CDW3) + Return (Arg3) + + } Else { + + // + // Unrecognized UUID + // + + Or (CDW1, 4, CDW1) + Return (Arg3) + } + } // End _OSC + + // + // Declare a _DSM method for various functions called by the OS. + // See the APCI spec, Section 9.14.1, + // and the PCI FW spec, Section 4.6. + // See also: + // http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fd= e-d599bac8184a/PCI-rsc.doc + // + + Method (_DSM, 0x4, Serialized) { + + // + // Match against the _DSM PCI GUID. + // + + If (LEqual (Arg0, ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D"))) { + + Switch (ToInteger(Arg2)) { + // + // Function 0: Return supported functions as a bitfield + // with one bit for each supported function. + // Bit 0 must always be set, as that represents + // function 0 (which is what is being called here). + // Support for different functions may depend on + // the revision ID of the interface, passed as Arg1. + // + + Case (0) { + + // + // Functions 0-7 are supported. + // + + Return (Buffer() {0x01}) + } + } + } + + // + // If not one of the function identifiers we recognize, then return = a buffer + // with bit 0 set to 0 indicating no functions supported. + // + + Return (Buffer() {0}) + } + + // + // Root Port 0 Device within the Root Complex. + // + Device (RP0) { + // + // Device 0, Function 0. + // + + Name (_ADR, 0x00000000) + } + + Method (_PXM, 0, NotSerialized) { + // Patch by code + Return(0xFF) + } + } // PCID RCB1 + + // PCIE RCB2 + Device (PCIE) { + // + // Hardware ID must be PNP0A08, which maps to a PCIe root complex. + // Section 6.1.5 + // + + Name (_HID, "PNP0A08") + Name (_CCA, ONE) + + Method (_STA, 0, NotSerialized) { + Return (0xF) // The default value is 0x0. Unfor= tunately, it breaks + // run-time patching as the repres= entation of 0 is special + // encoding and cannot be patched = to expand with extra bytes + // easily. As such, we default to = 0xF and patch this based + // on whether the port was enabled= or not by the BIOS. + } + + // + // Optionally, include a compatible ID of PNP0A03, which maps to a PCI + // root complex for use with pre-PCIe operating systems. + // Section 6.1.2 + // + + Name (_CID, "PNP0A03") + + // + // Declare the segment number of this root complex. Most systems only + // have one segment, which is numbered 0. + // Section 6.5.6 + // + + Name (_SEG, 10) + + // + // Declare the base bus number, which is the bus number of the root + // bus in this root complex. This is usually 0, but need not be. + // For root complexes supporting multiple root busses, this should + // be the lowest numbered root bus. + // Section 6.5.5 + // + + Name (_BBN, 0) + + // + // The _UID value provides a way of uniquely identifying a device + // in the case where more than one instance of a specific device + // is implemented with the same _HID/_CID. For systems with a + // single root complex, this is usually just 0. For systems with + // multiple root complexes, this should be different for each + // root complex. + // Section 6.1.12 + // + + Name (_UID, "PCIE") + Name (_STR, Unicode("PCIe 14 Device")) + + // + // Declare the PCI Routing Table. + // This defines SPI mappings of the four line-based interrupts + // associated with the root complex and hierarchy below it. + // Section 6.2.12 + // + + Name (_PRT, Package() { + + // + // Routing for device 0, all functions. + // Note: ARM doesn't support LNK nodes, so the third param + // is 0 and the fourth param is the SPI number of the interrupt + // line. In this example, the A/B/C/D interrupts are wired to + // SPI lines 152/153/154/155 + 320 respectively. PCIE RCB2 + // + Package() {0x0001FFFF, 0, 0, 472}, + Package() {0x0001FFFF, 1, 0, 473}, + Package() {0x0001FFFF, 2, 0, 474}, + Package() {0x0001FFFF, 3, 0, 475}, + Package() {0x0002FFFF, 0, 0, 472}, + Package() {0x0002FFFF, 1, 0, 473}, + Package() {0x0002FFFF, 2, 0, 474}, + Package() {0x0002FFFF, 3, 0, 475}, + Package() {0x0003FFFF, 0, 0, 472}, + Package() {0x0003FFFF, 1, 0, 473}, + Package() {0x0003FFFF, 2, 0, 474}, + Package() {0x0003FFFF, 3, 0, 475}, + Package() {0x0004FFFF, 0, 0, 472}, + Package() {0x0004FFFF, 1, 0, 473}, + Package() {0x0004FFFF, 2, 0, 474}, + Package() {0x0004FFFF, 3, 0, 475}, + Package() {0x0005FFFF, 0, 0, 472}, + Package() {0x0005FFFF, 1, 0, 473}, + Package() {0x0005FFFF, 2, 0, 474}, + Package() {0x0005FFFF, 3, 0, 475}, + Package() {0x0006FFFF, 0, 0, 472}, + Package() {0x0006FFFF, 1, 0, 473}, + Package() {0x0006FFFF, 2, 0, 474}, + Package() {0x0006FFFF, 3, 0, 475}, + Package() {0x0007FFFF, 0, 0, 472}, + Package() {0x0007FFFF, 1, 0, 473}, + Package() {0x0007FFFF, 2, 0, 474}, + Package() {0x0007FFFF, 3, 0, 475}, + Package() {0x0008FFFF, 0, 0, 472}, + Package() {0x0008FFFF, 1, 0, 473}, + Package() {0x0008FFFF, 2, 0, 474}, + Package() {0x0008FFFF, 3, 0, 475}, + }) + + // + // Declare the resources assigned to this root complex. + // Section 6.2.2 + // + Method (_CBA, 0, Serialized) { + Return (0x6BFFF0000000) + } + + // + // Declare a ResourceTemplate buffer to return the resource + // requirements from _CRS. + // Section 19.5.109 + // + + Name (RBUF, ResourceTemplate () { + + // + // Declare the range of bus numbers assigned to this root + // complex. In this example, the minimum bus number will be + // 0, the maximum bus number will be 0xFF, supporting + // 256 busses total. + // Section 19.5.141 + // + + WordBusNumber ( + ResourceProducer, + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + PosDecode, // Decode + 0, // AddressGranularity + 0, // AddressMinimum - Minimum Bus Number + 255, // AddressMaximum - Maximum Bus Number + 0, // AddressTranslation - Set to 0 + 256) // RangeLength - Number of Busses + + // + // Declare the memory range to be used for BAR memory + // windows. This declares a 4GB region starting at + // 0x4000000000. + // Section 19.5.80 + // + // Memory32Fixed (ReadWrite, 0x1FE40000, 0x10000, ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000000050000000, // AddressMinimum - MIN + 0x0000000057FFFFFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000008000000 // RangeLength - LEN + ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000680000000000, // AddressMinimum - MIN + 0x00006BFFDFFFFFFF, // AddressMinimum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x000003FFE0000000 // RangeLength - LEN + ) + }) + + Method (_CRS, 0, Serialized) { + Return (RBUF) + } + + // + // Declare an _OSC (OS Control Handoff) method which takes 4 arguments. + // + // Argments: + // Arg0 A Buffer containing a UUID + // Arg1 An Integer containing a Revision ID of the buffer format + // Arg2 An Integer containing a count of entries in Arg3 + // Arg3 A Buffer containing a list of DWORD capabilities + // Return Value: + // A Buffer containing a list of capabilities + // See the APCI spec, Section 6.2.10, + // and the PCI FW spec, Section 4.5. + // + // The following is an example, and may need modification for + // specific implementations. + // + + Name (SUPP,0) // PCI _OSC Support Field value + Name (CTRL,0) // PCI _OSC Control Field value + + Method (_OSC, 4) { + + // + // Look for the PCI Host Bridge Interface UUID. + // Section 6.2.10.3 + // + + // + // Create DWord-adressable fields from the Capabilities Buffer + // Create CDW1 outside the test as it's used in the else clause. + // + + CreateDWordField (Arg3, 0, CDW1) + If (LEqual (Arg0, ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) { + + CreateDWordField (Arg3, 4, CDW2) + CreateDWordField (Arg3, 8, CDW3) + + // + // Save Capabilities DWord 2 & 3 + // + + Store (CDW2, SUPP) + Store (CDW3, CTRL) + + // + // Only allow native hot plug control if OS supports: + // ASPM + // Clock PM + // MSI/MSI-X + // + + If (LNotEqual (And (SUPP, 0x16), 0x16)) { + + // + // Mask bit 0 (and undefined bits) + // + + And (CTRL, 0x1E, CTRL) + } + + // + // Never allow native Hot plug, PME. + // Never allow SHPC (no SHPC controller in this system). + // Only allow PCIe AER control if PCIe AER Firmware-First is disab= led + // Allows PCI Express Capability Structure control + // + + If (AERF) { + And (CTRL, 0x10, CTRL) + } Else { + And (CTRL, 0x18, CTRL) + } + + // + // Check for unknown revision. + // + + If (LNotEqual (Arg1, One)) { + Or (CDW1, 0x08, CDW1) + } + + // + // Check if capabilities bits were masked. + // + + If (LNotEqual (CDW3, CTRL)) { + Or (CDW1, 0x10, CDW1) + } + + // + // Update DWORD3 in the buffer. + // + + Store (CTRL, CDW3) + Return (Arg3) + + } Else { + + // + // Unrecognized UUID + // + + Or (CDW1, 4, CDW1) + Return (Arg3) + } + } // End _OSC + + // + // Declare a _DSM method for various functions called by the OS. + // See the APCI spec, Section 9.14.1, + // and the PCI FW spec, Section 4.6. + // See also: + // http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fd= e-d599bac8184a/PCI-rsc.doc + // + + Method (_DSM, 0x4, Serialized) { + + // + // Match against the _DSM PCI GUID. + // + + If (LEqual (Arg0, ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D"))) { + + Switch (ToInteger(Arg2)) { + // + // Function 0: Return supported functions as a bitfield + // with one bit for each supported function. + // Bit 0 must always be set, as that represents + // function 0 (which is what is being called here). + // Support for different functions may depend on + // the revision ID of the interface, passed as Arg1. + // + + Case (0) { + + // + // Functions 0-7 are supported. + // + + Return (Buffer() {0x01}) + } + } + } + + // + // If not one of the function identifiers we recognize, then return = a buffer + // with bit 0 set to 0 indicating no functions supported. + // + + Return (Buffer() {0}) + } + + // + // Root Port 0 Device within the Root Complex. + // + Device (RP0) { + // + // Device 0, Function 0. + // + + Name (_ADR, 0x00000000) + } + + Method (_PXM, 0, NotSerialized) { + // Patch by code + Return(0xFF) + } + } // PCIE RCB2 + + // PCIF RCB3 + Device (PCIF) { + // + // Hardware ID must be PNP0A08, which maps to a PCIe root complex. + // Section 6.1.5 + // + + Name (_HID, "PNP0A08") + Name (_CCA, ONE) + + Method (_STA, 0, NotSerialized) { + Return (0xF) // The default value is 0x0. Unfor= tunately, it breaks + // run-time patching as the repres= entation of 0 is special + // encoding and cannot be patched = to expand with extra bytes + // easily. As such, we default to = 0xF and patch this based + // on whether the port was enabled= or not by the BIOS. + } + + // + // Optionally, include a compatible ID of PNP0A03, which maps to a PCI + // root complex for use with pre-PCIe operating systems. + // Section 6.1.2 + // + + Name (_CID, "PNP0A03") + + // + // Declare the segment number of this root complex. Most systems only + // have one segment, which is numbered 0. + // Section 6.5.6 + // + + Name (_SEG, 11) + + // + // Declare the base bus number, which is the bus number of the root + // bus in this root complex. This is usually 0, but need not be. + // For root complexes supporting multiple root busses, this should + // be the lowest numbered root bus. + // Section 6.5.5 + // + + Name (_BBN, 0) + + // + // The _UID value provides a way of uniquely identifying a device + // in the case where more than one instance of a specific device + // is implemented with the same _HID/_CID. For systems with a + // single root complex, this is usually just 0. For systems with + // multiple root complexes, this should be different for each + // root complex. + // Section 6.1.12 + // + + Name (_UID, "PCIF") + Name (_STR, Unicode("PCIe 15 Device")) + + // + // Declare the PCI Routing Table. + // This defines SPI mappings of the four line-based interrupts + // associated with the root complex and hierarchy below it. + // Section 6.2.12 + // + + Name (_PRT, Package() { + + // + // Routing for device 0, all functions. + // Note: ARM doesn't support LNK nodes, so the third param + // is 0 and the fourth param is the SPI number of the interrupt + // line. In this example, the A/B/C/D interrupts are wired to + // SPI lines 156/157/158/159 + 320 respectively. PCIF RCB3 + // + Package() {0x0001FFFF, 0, 0, 476}, + Package() {0x0001FFFF, 1, 0, 477}, + Package() {0x0001FFFF, 2, 0, 478}, + Package() {0x0001FFFF, 3, 0, 479}, + Package() {0x0002FFFF, 0, 0, 476}, + Package() {0x0002FFFF, 1, 0, 477}, + Package() {0x0002FFFF, 2, 0, 478}, + Package() {0x0002FFFF, 3, 0, 479}, + Package() {0x0003FFFF, 0, 0, 476}, + Package() {0x0003FFFF, 1, 0, 477}, + Package() {0x0003FFFF, 2, 0, 478}, + Package() {0x0003FFFF, 3, 0, 479}, + Package() {0x0004FFFF, 0, 0, 476}, + Package() {0x0004FFFF, 1, 0, 477}, + Package() {0x0004FFFF, 2, 0, 478}, + Package() {0x0004FFFF, 3, 0, 479}, + Package() {0x0005FFFF, 0, 0, 476}, + Package() {0x0005FFFF, 1, 0, 477}, + Package() {0x0005FFFF, 2, 0, 478}, + Package() {0x0005FFFF, 3, 0, 479}, + Package() {0x0006FFFF, 0, 0, 476}, + Package() {0x0006FFFF, 1, 0, 477}, + Package() {0x0006FFFF, 2, 0, 478}, + Package() {0x0006FFFF, 3, 0, 479}, + Package() {0x0007FFFF, 0, 0, 476}, + Package() {0x0007FFFF, 1, 0, 477}, + Package() {0x0007FFFF, 2, 0, 478}, + Package() {0x0007FFFF, 3, 0, 479}, + Package() {0x0008FFFF, 0, 0, 476}, + Package() {0x0008FFFF, 1, 0, 477}, + Package() {0x0008FFFF, 2, 0, 478}, + Package() {0x0008FFFF, 3, 0, 479}, + }) + + // + // Declare the resources assigned to this root complex. + // Section 6.2.2 + // + Method (_CBA, 0, Serialized) { + Return (0x6FFFF0000000) + } + + // + // Declare a ResourceTemplate buffer to return the resource + // requirements from _CRS. + // Section 19.5.109 + // + + Name (RBUF, ResourceTemplate () { + + // + // Declare the range of bus numbers assigned to this root + // complex. In this example, the minimum bus number will be + // 0, the maximum bus number will be 0xFF, supporting + // 256 busses total. + // Section 19.5.141 + // + + WordBusNumber ( + ResourceProducer, + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + PosDecode, // Decode + 0, // AddressGranularity + 0, // AddressMinimum - Minimum Bus Number + 255, // AddressMaximum - Maximum Bus Number + 0, // AddressTranslation - Set to 0 + 256) // RangeLength - Number of Busses + + // + // Declare the memory range to be used for BAR memory + // windows. This declares a 4GB region starting at + // 0x4000000000. + // Section 19.5.80 + // + // Memory32Fixed (ReadWrite, 0x1FE40000, 0x10000, ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000000058000000, // AddressMinimum - MIN + 0x000000005FFFFFFF, // AddressMinimum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000008000000 // RangeLength - LEN + ) + + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // NonCacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x00006C0000000000, // AddressMinimum - MIN + 0x00006FFFDFFFFFFF, // AddressMinimum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x000003FFE0000000 // RangeLength - LEN + ) + }) + + Method (_CRS, 0, Serialized) { + Return (RBUF) + } + + // + // Declare an _OSC (OS Control Handoff) method which takes 4 arguments. + // + // Argments: + // Arg0 A Buffer containing a UUID + // Arg1 An Integer containing a Revision ID of the buffer format + // Arg2 An Integer containing a count of entries in Arg3 + // Arg3 A Buffer containing a list of DWORD capabilities + // Return Value: + // A Buffer containing a list of capabilities + // See the APCI spec, Section 6.2.10, + // and the PCI FW spec, Section 4.5. + // + // The following is an example, and may need modification for + // specific implementations. + // + + Name (SUPP,0) // PCI _OSC Support Field value + Name (CTRL,0) // PCI _OSC Control Field value + + Method (_OSC, 4) { + + // + // Look for the PCI Host Bridge Interface UUID. + // Section 6.2.10.3 + // + + // + // Create DWord-adressable fields from the Capabilities Buffer + // Create CDW1 outside the test as it's used in the else clause. + // + + CreateDWordField (Arg3, 0, CDW1) + If (LEqual (Arg0, ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) { + + CreateDWordField (Arg3, 4, CDW2) + CreateDWordField (Arg3, 8, CDW3) + + // + // Save Capabilities DWord 2 & 3 + // + + Store (CDW2, SUPP) + Store (CDW3, CTRL) + + // + // Only allow native hot plug control if OS supports: + // ASPM + // Clock PM + // MSI/MSI-X + // + + If (LNotEqual (And (SUPP, 0x16), 0x16)) { + + // + // Mask bit 0 (and undefined bits) + // + + And (CTRL, 0x1E, CTRL) + } + + // + // Never allow native Hot plug, PME. + // Never allow SHPC (no SHPC controller in this system). + // Only allow PCIe AER control if PCIe AER Firmware-First is disab= led + // Allows PCI Express Capability Structure control + // + + If (AERF) { + And (CTRL, 0x10, CTRL) + } Else { + And (CTRL, 0x18, CTRL) + } + + // + // Check for unknown revision. + // + + If (LNotEqual (Arg1, One)) { + Or (CDW1, 0x08, CDW1) + } + + // + // Check if capabilities bits were masked. + // + + If (LNotEqual (CDW3, CTRL)) { + Or (CDW1, 0x10, CDW1) + } + + // + // Update DWORD3 in the buffer. + // + + Store (CTRL, CDW3) + Return (Arg3) + + } Else { + + // + // Unrecognized UUID + // + + Or (CDW1, 4, CDW1) + Return (Arg3) + } + } // End _OSC + + // + // Declare a _DSM method for various functions called by the OS. + // See the APCI spec, Section 9.14.1, + // and the PCI FW spec, Section 4.6. + // See also: + // http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fd= e-d599bac8184a/PCI-rsc.doc + // + + Method (_DSM, 0x4, Serialized) { + + // + // Match against the _DSM PCI GUID. + // + + If (LEqual (Arg0, ToUUID("E5C937D0-3553-4d7a-9117-EA4D19C3434D"))) { + + Switch (ToInteger(Arg2)) { + // + // Function 0: Return supported functions as a bitfield + // with one bit for each supported function. + // Bit 0 must always be set, as that represents + // function 0 (which is what is being called here). + // Support for different functions may depend on + // the revision ID of the interface, passed as Arg1. + // + + Case (0) { + + // + // Functions 0-7 are supported. + // + + Return (Buffer() {0x01}) + } + } + } + + // + // If not one of the function identifiers we recognize, then return = a buffer + // with bit 0 set to 0 indicating no functions supported. + // + + Return (Buffer() {0}) + } + + // + // Root Port 0 Device within the Root Complex. + // + Device (RP0) { + // + // Device 0, Function 0. + // + + Name (_ADR, 0x00000000) + } + + Method (_PXM, 0, NotSerialized) { + // Patch by code + Return(0xFF) + } + } // PCIF RCB3 diff --git a/Platform/Ampere/JadePkg/AcpiTables/PMU-S0.asi b/Platform/Amper= e/JadePkg/AcpiTables/PMU-S0.asi new file mode 100644 index 000000000000..0e9db557d925 --- /dev/null +++ b/Platform/Ampere/JadePkg/AcpiTables/PMU-S0.asi @@ -0,0 +1,1303 @@ +/** @file + + Copyright (c) 2020, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +Device(CMN0) { + Name(_HID, "ARMHC600") // Device Identification Objects + Name(_CID, "ARMHC600") + Name(_UID, 0) + Name(_CCA, ONE) + Name(_STR, Unicode("CMN0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceConsumer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000100010000000, // AddressMinimum - MIN + 0x000010001fffffff, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000010000000 // RangeLength - LEN + ) + QWordMemory ( + ResourceConsumer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000100012500000, // AddressMinimum - MIN + 0x00001000164fffff, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000004000000 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 314 } + }) +} + +Device(MC00) { + Name(_HID, "ARMHD620") + Name(_CID, "ARMHD620") + Name(_UID, 0) + Name(_CCA, ONE) + Name(_STR, Unicode("Socket 0: MCU0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000010008C000A00, // AddressMinimum - MIN + 0x000010008C000BFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000000200 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 312 } + }) +} + +Device(MC01) { + Name(_HID, "ARMHD620") + Name(_CID, "ARMHD620") + Name(_UID, 1) + Name(_CCA, ONE) + Name(_STR, Unicode("Socket 0: MCU1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000010008C400A00, // AddressMinimum - MIN + 0x000010008C400BFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000000200 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 312 } + }) +} + +Device(MC02) { + Name(_HID, "ARMHD620") + Name(_CID, "ARMHD620") + Name(_UID, 2) + Name(_CCA, ONE) + Name(_STR, Unicode("Socket 0: MCU2")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000010008C800A00, // AddressMinimum - MIN + 0x000010008C800BFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000000200 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 312 } + }) +} + +Device(MC03) { + Name(_HID, "ARMHD620") + Name(_CID, "ARMHD620") + Name(_UID, 3) + Name(_CCA, ONE) + Name(_STR, Unicode("Socket 0: MCU3")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000010008CC00A00, // AddressMinimum - MIN + 0x000010008CC00BFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000000200 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 312 } + }) +} + +Device(MC04) { + Name(_HID, "ARMHD620") + Name(_CID, "ARMHD620") + Name(_UID, 4) + Name(_CCA, ONE) + Name(_STR, Unicode("Socket 0: MCU4")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000010008D000A00, // AddressMinimum - MIN + 0x000010008D000BFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000000200 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 312 } + }) +} + +Device(MC05) { + Name(_HID, "ARMHD620") + Name(_CID, "ARMHD620") + Name(_UID, 5) + Name(_CCA, ONE) + Name(_STR, Unicode("Socket 0: MCU5")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000010008D400A00, // AddressMinimum - MIN + 0x000010008D400BFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000000200 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 312 } + }) +} + +Device(MC06) { + Name(_HID, "ARMHD620") + Name(_CID, "ARMHD620") + Name(_UID, 6) + Name(_CCA, ONE) + Name(_STR, Unicode("Socket 0: MCU6")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000010008D800A00, // AddressMinimum - MIN + 0x000010008D800BFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000000200 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 312 } + }) +} + +Device(MC07) { + Name(_HID, "ARMHD620") + Name(_CID, "ARMHD620") + Name(_UID, 7) + Name(_CCA, ONE) + Name(_STR, Unicode("Socket 0: MCU7")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000010008DC00A00, // AddressMinimum - MIN + 0x000010008DC00BFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000000200 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 312 } + }) +} + +Device(DU00) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 64 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x000000, + 0x000100 + } + } + } + }) +} + +Device(DU01) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x1) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x1 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 65 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x010000, + 0x010100 + } + } + } + }) +} + +Device(DU02) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x2) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x2 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 66 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x020000, + 0x020100 + } + } + } + }) +} + +Device(DU03) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x3) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x3 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 67 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x030000, + 0x030100 + } + } + } + }) +} + +Device(DU04) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x4) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x4 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 68 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x040000, + 0x040100 + } + } + } + }) +} + +Device(DU05) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x5) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x5 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 69 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x050000, + 0x050100 + } + } + } + }) +} + +Device(DU06) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x6) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x6 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 71 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x060000, + 0x060100 + } + } + } + }) +} + +Device(DU07) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x7) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x7 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 80 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x070000, + 0x070100 + } + } + } + }) +} + +Device(DU08) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x8) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x8 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 81 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x080000, + 0x080100 + } + } + } + }) +} + +Device(DU09) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x9) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x9 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 82 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x090000, + 0x090100 + } + } + } + }) +} + +Device(DU0A) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0xA) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0xA Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 83 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x0A0000, + 0x0A0100 + } + } + } + }) +} + +Device(DU0B) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0xB) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0xB Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 115 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x0B0000, + 0x0B0100 + } + } + } + }) +} + +Device(DU0C) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0xC) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0xC Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 116 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x0C0000, + 0x0C0100 + } + } + } + }) +} + +Device(DU0D) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0xD) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0xD Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 221 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x0D0000, + 0x0D0100 + } + } + } + }) +} + +Device(DU0E) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0xE) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0xE Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 222 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x0E0000, + 0x0E0100 + } + } + } + }) +} + +Device(DU0F) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0xF) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0xF Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 223 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x0F0000, + 0x0F0100 + } + } + } + }) +} + +Device(DU10) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x10) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x10 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 248 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100000, + 0x100100 + } + } + } + }) +} + +Device(DU11) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x11) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x11 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 249 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x110000, + 0x110100 + } + } + } + }) +} + +Device(DU12) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x12) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x12 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 250 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x120000, + 0x120100 + } + } + } + }) +} + +Device(DU13) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x13) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x13 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 251 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x130000, + 0x130100 + } + } + } + }) +} + +Device(DU14) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x14) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x14 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 252 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x140000, + 0x140100 + } + } + } + }) +} + +Device(DU15) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x15) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x15 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 253 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x150000, + 0x150100 + } + } + } + }) +} + +Device(DU16) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x16) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x16 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 254 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x160000, + 0x160100 + } + } + } + }) +} + +Device(DU17) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x17) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x17 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 255 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x170000, + 0x170100 + } + } + } + }) +} + +Device(DU18) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x18) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x18 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 297 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x180000, + 0x180100 + } + } + } + }) +} + +Device(DU19) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x19) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x19 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 298 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x190000, + 0x190100 + } + } + } + }) +} + +Device(DU1A) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x1A) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x1A Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 299 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x1A0000, + 0x1A0100 + } + } + } + }) +} + +Device(DU1B) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x1B) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x1B Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 300 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x1B0000, + 0x1B0100 + } + } + } + }) +} + +Device(DU1C) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x1C) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x1C Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 301 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x1C0000, + 0x1C0100 + } + } + } + }) +} + +Device(DU1D) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x1D) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x1D Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 313 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x1D0000, + 0x1D0100 + } + } + } + }) +} + +Device(DU1E) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x1E) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x1E Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 316 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x1E0000, + 0x1E0100 + } + } + } + }) +} + +Device(DU1F) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x1F) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x1F Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 317 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x1F0000, + 0x1F0100 + } + } + } + }) +} + +Device(DU20) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x20) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x20 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 318 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x200000, + 0x200100 + } + } + } + }) +} + +Device(DU21) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x21) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x21 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 319 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x210000, + 0x210100 + } + } + } + }) +} + +Device(DU22) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x22) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x22 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 344 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x220000, + 0x220100 + } + } + } + }) +} + +Device(DU23) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x23) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x23 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 345 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x230000, + 0x230100 + } + } + } + }) +} + +Device(DU24) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x24) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x24 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 346 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x240000, + 0x240100 + } + } + } + }) +} + +Device(DU25) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x25) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x25 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 347 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x250000, + 0x250100 + } + } + } + }) +} + +Device(DU26) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x26) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x26 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 348 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x260000, + 0x260100 + } + } + } + }) +} + +Device(DU27) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x27) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x27 Socket 0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 349 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x270000, + 0x270100 + } + } + } + }) +} diff --git a/Platform/Ampere/JadePkg/AcpiTables/PMU-S1.asi b/Platform/Amper= e/JadePkg/AcpiTables/PMU-S1.asi new file mode 100644 index 000000000000..1ae1bac8098b --- /dev/null +++ b/Platform/Ampere/JadePkg/AcpiTables/PMU-S1.asi @@ -0,0 +1,1303 @@ +/** @file + + Copyright (c) 2020, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +Device(CMN1) { + Name(_HID, "ARMHC600") // Device Identification Objects + Name(_CID, "ARMHC600") + Name(_UID, 1) + Name(_CCA, ONE) + Name(_STR, Unicode("CMN1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceConsumer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000500010000000, // AddressMinimum - MIN + 0x000050001fffffff, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000010000000 // RangeLength - LEN + ) + QWordMemory ( + ResourceConsumer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x0000500012500000, // AddressMinimum - MIN + 0x00005000164fffff, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000004000000 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 634 } + }) +} + +Device(MC10) { + Name(_HID, "ARMHD620") + Name(_CID, "ARMHD620") + Name(_UID, 8) + Name(_CCA, ONE) + Name(_STR, Unicode("Socket 1: MCU0")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000050008C000A00, // AddressMinimum - MIN + 0x000050008C000BFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000000200 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 632 } + }) +} + +Device(MC11) { + Name(_HID, "ARMHD620") + Name(_CID, "ARMHD620") + Name(_UID, 9) + Name(_CCA, ONE) + Name(_STR, Unicode("Socket 1: MCU1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000050008C400A00, // AddressMinimum - MIN + 0x000050008C400BFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000000200 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 632 } + }) +} + +Device(MC12) { + Name(_HID, "ARMHD620") + Name(_CID, "ARMHD620") + Name(_UID, 0xa) + Name(_CCA, ONE) + Name(_STR, Unicode("Socket 1: MCU2")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000050008C800A00, // AddressMinimum - MIN + 0x000050008C800BFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000000200 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 632 } + }) +} + +Device(MC13) { + Name(_HID, "ARMHD620") + Name(_CID, "ARMHD620") + Name(_UID, 0xb) + Name(_CCA, ONE) + Name(_STR, Unicode("Socket 1: MCU3")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000050008CC00A00, // AddressMinimum - MIN + 0x000050008CC00BFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000000200 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 632 } + }) +} + +Device(MC14) { + Name(_HID, "ARMHD620") + Name(_CID, "ARMHD620") + Name(_UID, 0xc) + Name(_CCA, ONE) + Name(_STR, Unicode("Socket 1: MCU4")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000050008D000A00, // AddressMinimum - MIN + 0x000050008D000BFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000000200 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 632 } + }) +} + +Device(MC15) { + Name(_HID, "ARMHD620") + Name(_CID, "ARMHD620") + Name(_UID, 0xd) + Name(_CCA, ONE) + Name(_STR, Unicode("Socket 1: MCU5")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000050008D400A00, // AddressMinimum - MIN + 0x000050008D400BFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000000200 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 632 } + }) +} + +Device(MC16) { + Name(_HID, "ARMHD620") + Name(_CID, "ARMHD620") + Name(_UID, 0xe) + Name(_CCA, ONE) + Name(_STR, Unicode("Socket 1: MCU6")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000050008D800A00, // AddressMinimum - MIN + 0x000050008D800BFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000000200 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 632 } + }) +} + +Device(MC17) { + Name(_HID, "ARMHD620") + Name(_CID, "ARMHD620") + Name(_UID, 0xf) + Name(_CCA, ONE) + Name(_STR, Unicode("Socket 1: MCU7")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + QWordMemory ( + ResourceProducer, // ResourceUsage + PosDecode, // Decode + MinFixed, // IsMinFixed + MaxFixed, // IsMaxFixed + NonCacheable, // Cacheable + ReadWrite, // ReadAndWrite + 0x0000000000000000, // AddressGranularity - GRA + 0x000050008DC00A00, // AddressMinimum - MIN + 0x000050008DC00BFF, // AddressMaximum - MAX + 0x0000000000000000, // AddressTranslation - TRA + 0x0000000000000200 // RangeLength - LEN + ) + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 632 } + }) +} + +Device(DU40) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x40) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x40 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 384 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100000000, + 0x100000100 + } + } + } + }) +} + +Device(DU41) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x41) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x41 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 385 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100010000, + 0x100010100 + } + } + } + }) +} + +Device(DU42) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x42) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x42 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 386 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100020000, + 0x100020100 + } + } + } + }) +} + +Device(DU43) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x43) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x43 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 387 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100030000, + 0x100030100 + } + } + } + }) +} + +Device(DU44) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x44) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x44 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 388 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100040000, + 0x100040100 + } + } + } + }) +} + +Device(DU45) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x45) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x45 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 389 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100050000, + 0x100050100 + } + } + } + }) +} + +Device(DU46) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x46) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x46 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 391 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100060000, + 0x100060100 + } + } + } + }) +} + +Device(DU47) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x47) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x47 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 400 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100070000, + 0x100070100 + } + } + } + }) +} + +Device(DU48) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x48) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x48 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 401 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100080000, + 0x100080100 + } + } + } + }) +} + +Device(DU49) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x49) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x49 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 402 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100090000, + 0x100090100 + } + } + } + }) +} + +Device(DU4A) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x4A) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x4A Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 403 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x1000A0000, + 0x1000A0100 + } + } + } + }) +} + +Device(DU4B) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x4B) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x4B Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 435 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x1000B0000, + 0x1000B0100 + } + } + } + }) +} + +Device(DU4C) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x4C) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x4C Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 436 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x1000C0000, + 0x1000C0100 + } + } + } + }) +} + +Device(DU4D) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x4D) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x4D Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 541 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x1000D0000, + 0x1000D0100 + } + } + } + }) +} + +Device(DU4E) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x4E) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x4E Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 542 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x1000E0000, + 0x1000E0100 + } + } + } + }) +} + +Device(DU4F) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x4F) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x4F Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 543 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x1000F0000, + 0x1000F0100 + } + } + } + }) +} + +Device(DU50) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x50) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x50 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 568 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100100000, + 0x100100100 + } + } + } + }) +} + +Device(DU51) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x51) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x51 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 569 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100110000, + 0x100110100 + } + } + } + }) +} + +Device(DU52) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x52) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x52 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 570 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100120000, + 0x100120100 + } + } + } + }) +} + +Device(DU53) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x53) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x53 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 571 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100130000, + 0x100130100 + } + } + } + }) +} + +Device(DU54) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x54) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x54 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 572 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100140000, + 0x100140100 + } + } + } + }) +} + +Device(DU55) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x55) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x55 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 573 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100150000, + 0x100150100 + } + } + } + }) +} + +Device(DU56) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x56) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x56 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 574 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100160000, + 0x100160100 + } + } + } + }) +} + +Device(DU57) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x57) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x57 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 575 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100170000, + 0x100170100 + } + } + } + }) +} + +Device(DU58) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x58) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x58 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 617 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100180000, + 0x100180100 + } + } + } + }) +} + +Device(DU59) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x59) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x59 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 618 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100190000, + 0x100190100 + } + } + } + }) +} + +Device(DU5A) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x5A) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x5A Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 619 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x1001A0000, + 0x1001A0100 + } + } + } + }) +} + +Device(DU5B) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x5B) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x5B Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 620 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x1001B0000, + 0x1001B0100 + } + } + } + }) +} + +Device(DU5C) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x5C) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x5C Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 621 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x1001C0000, + 0x1001C0100 + } + } + } + }) +} + +Device(DU5D) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x5D) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x5D Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 633 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x1001D0000, + 0x1001D0100 + } + } + } + }) +} + +Device(DU5E) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x5E) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x5E Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 636 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x1001E0000, + 0x1001E0100 + } + } + } + }) +} + +Device(DU5F) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x5F) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x5F Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 637 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x1001F0000, + 0x1001F0100 + } + } + } + }) +} + +Device(DU60) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x60) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x60 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 638 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100200000, + 0x100200100 + } + } + } + }) +} + +Device(DU61) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x61) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x61 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 639 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100210000, + 0x100210100 + } + } + } + }) +} + +Device(DU62) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x62) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x62 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 664 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100220000, + 0x100220100 + } + } + } + }) +} + +Device(DU63) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x63) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x63 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 665 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100230000, + 0x100230100 + } + } + } + }) +} + +Device(DU64) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x64) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x64 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 666 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100240000, + 0x100240100 + } + } + } + }) +} + +Device(DU65) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x65) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x65 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 667 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100250000, + 0x100250100 + } + } + } + }) +} + +Device(DU66) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x66) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x66 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 668 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100260000, + 0x100260100 + } + } + } + }) +} + +Device(DU67) { + Name(_HID, "ARMHD500") + Name(_CID, "ARMHD500") + Name(_UID, 0x67) + Name(_CCA, ONE) + Name(_STR, Unicode("DSU CPM 0x67 Socket 1")) + Method(_STA, 0, NotSerialized) { + Return (0x0f) + } + Name(_CRS, ResourceTemplate() { + Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 669 } + }) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) { + "cpus", + Package (2) { + 0x100270000, + 0x100270100 + } + } + } + }) +} diff --git a/Platform/Ampere/JadePkg/AcpiTables/PMU.asi b/Platform/Ampere/J= adePkg/AcpiTables/PMU.asi new file mode 100644 index 000000000000..0d177de8696d --- /dev/null +++ b/Platform/Ampere/JadePkg/AcpiTables/PMU.asi @@ -0,0 +1,10 @@ +/** @file + + Copyright (c) 2020, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +Include ("PMU-S0.asi") +Include ("PMU-S1.asi") diff --git a/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Bert.aslc b/Sil= icon/Ampere/AmpereAltraPkg/AcpiCommonTables/Bert.aslc new file mode 100644 index 000000000000..a80f1e81b24f --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Bert.aslc @@ -0,0 +1,33 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include + +#define BOOT_ERROR_REGION_LENGTH 0x50000 +#define BOOT_ERROR_REGION_BASE 0x0000000088230000 + +#pragma pack(1) + +EFI_ACPI_6_3_BOOT_ERROR_RECORD_TABLE_HEADER Bert =3D { + __ACPI_HEADER ( + EFI_ACPI_6_3_BOOT_ERROR_RECORD_TABLE_SIGNATURE, + EFI_ACPI_6_3_BOOT_ERROR_RECORD_TABLE_HEADER, + EFI_ACPI_6_3_BOOT_ERROR_RECORD_TABLE_REVISION + ), + BOOT_ERROR_REGION_LENGTH, + BOOT_ERROR_REGION_BASE +}; + +#pragma pack() + +// +// Reference the table being generated to prevent the optimizer from remov= ing +// the data structure from the executable +// +VOID* CONST ReferenceAcpiTable =3D &Bert; diff --git a/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Dbg2.aslc b/Sil= icon/Ampere/AmpereAltraPkg/AcpiCommonTables/Dbg2.aslc new file mode 100644 index 000000000000..bc2bbded11fd --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Dbg2.aslc @@ -0,0 +1,87 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include + +#pragma pack(1) + +#define DBG2_NUM_DEBUG_PORTS 1 +#define DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS 1 +#define DBG2_NAMESPACESTRING_FIELD_SIZE 10 +#define SERIAL_PORT_PL011_UART_ADDR_SIZE 0x8 + +#define NAME_STR_UART2 {'\\', '_', 'S', 'B', '.', 'U', 'R', 'T', '2', = '\0'} + +typedef struct { + EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT Dbg2Device; + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE BaseAddressRegister; + UINT32 AddressSize; + UINT8 NameSpaceString[DBG2_NAMES= PACESTRING_FIELD_SIZE]; +} DBG2_DEBUG_DEVICE_INFORMATION; + +typedef struct { + EFI_ACPI_DEBUG_PORT_2_DESCRIPTION_TABLE Description; + DBG2_DEBUG_DEVICE_INFORMATION Dbg2DeviceInfo[DBG2_NUM_DE= BUG_PORTS]; +} DBG2_TABLE; + + +#define DBG2_DEBUG_PORT_DDI(NumReg, SubType, UartBase, UartAddrLen, UartNa= meStr) { \ + { = \ + EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION, /* U= INT8 Revision */ \ + sizeof (DBG2_DEBUG_DEVICE_INFORMATION), /* U= INT16 Length */ \ + NumReg, /* U= INT8 NumberofGenericAddressRegisters */ \ + DBG2_NAMESPACESTRING_FIELD_SIZE, /* U= INT16 NameSpaceStringLength */ \ + OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, NameSpaceString), /* U= INT16 NameSpaceStringOffset */ \ + 0, /* U= INT16 OemDataLength */ \ + 0, /* U= INT16 OemDataOffset */ \ + EFI_ACPI_DBG2_PORT_TYPE_SERIAL, /* U= INT16 Port Type */ \ + SubType, /* U= INT16 Port Subtype */ \ + {EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE}, /* U= INT8 Reserved[2] */ \ + OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, BaseAddressRegister), /* U= INT16 BaseAddressRegister Offset */ \ + OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, AddressSize) /* U= INT16 AddressSize Offset */ \ + }, = \ + ARM_GAS32 (UartBase), /* EFI_ACPI_6_3_GENER= IC_ADDRESS_STRUCTURE BaseAddressRegister */ \ + UartAddrLen, /* UINT32 AddressSiz= e */ \ + UartNameStr /* UINT8 NameSpaceS= tring[DBG2_NAMESPACESTRING_FIELD_SIZE] */ \ + } + + +STATIC DBG2_TABLE Dbg2 =3D { + { + __ACPI_HEADER ( + EFI_ACPI_6_3_DEBUG_PORT_2_TABLE_SIGNATURE, + DBG2_TABLE, + EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION + ), + OFFSET_OF (DBG2_TABLE, Dbg2DeviceInfo), + DBG2_NUM_DEBUG_PORTS /* UINT32 Number= DbgDeviceInfo */ + }, + { + // Kernel Debug Port + DBG2_DEBUG_PORT_DDI ( + DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS, + EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_SBSA_GENERIC_UART, + FixedPcdGet64 (PcdSerialDbgRegisterBase), + SERIAL_PORT_PL011_UART_ADDR_SIZE, + NAME_STR_UART2 + ), + } +}; + +#pragma pack() + +// +// Reference the table being generated to prevent the optimizer from remov= ing +// the data structure from the executable +// +VOID* CONST ReferenceAcpiTable =3D &Dbg2; diff --git a/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Einj.asl b/Sili= con/Ampere/AmpereAltraPkg/AcpiCommonTables/Einj.asl new file mode 100644 index 000000000000..bf2cca55e935 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Einj.asl @@ -0,0 +1,165 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +[0004] Signature : "EINJ" [Error Injection tab= le] +[0004] Table Length : 00000150 +[0001] Revision : 01 +[0001] Checksum : 09 +[0006] Oem ID : "Ampere" +[0008] Oem Table ID : "Altra " +[0004] Oem Revision : 00000001 +[0004] Asl Compiler ID : "INTL" +[0004] Asl Compiler Revision : 20100528 + +[0004] Injection Header Length : 00000030 +[0001] Flags : 00 +[0003] Reserved : 000000 +[0004] Injection Entry Count : 00000009 + +[0001] Action : 00 [Begin Operation] +[0001] Instruction : 03 [Write Register Value] +[0001] Flags (decoded below) : 00 + Preserve Register Bits : 0 +[0001] Reserved : 00 + +[0012] Register Region : [Generic Address Structure] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000000088220140 + +[0008] Value : 0000000000000001 +[0008] Mask : FFFFFFFFFFFFFFFF + +[0001] Action : 01 [Get Trigger Table] +[0001] Instruction : 00 [Read Register] +[0001] Flags (decoded below) : 00 + Preserve Register Bits : 0 +[0001] Reserved : 00 + +[0012] Register Region : [Generic Address Structure] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000000088220040 + +[0008] Value : 0000000000000000 +[0008] Mask : FFFFFFFFFFFFFFFF + +[0001] Action : 08 [Set Error Type With Addres= s] +[0001] Instruction : 02 [Write Register] +[0001] Flags (decoded below) : 01 + Preserve Register Bits : 1 +[0001] Reserved : 00 + +[0012] Register Region : [Generic Address Structure] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 20 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 03 [DWord Access:32] +[0008] Address : 0000000088221000 + +[0008] Value : 00000000 +[0008] Mask : FFFFFFFF + +[0001] Action : 02 [Set Error Type] +[0001] Instruction : 02 [Write Register] +[0001] Flags (decoded below) : 01 + Preserve Register Bits : 1 +[0001] Reserved : 00 + +[0012] Register Region : [Generic Address Structure] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 20 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [DWord Access:64] +[0008] Address : 0000000088220080 + +[0008] Value : 0000000000000000 +[0008] Mask : FFFFFFFFFFFFFFFF + +[0001] Action : 03 [Get Error Type] +[0001] Instruction : 00 [Read Register] +[0001] Flags (decoded below) : 00 + Preserve Register Bits : 0 +[0001] Reserved : 00 + +[0012] Register Region : [Generic Address Structure] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 00000000882200c0 + +[0008] Value : 0000000000000000 +[0008] Mask : FFFFFFFFFFFFFFFF + +[0001] Action : 04 [End Operation] +[0001] Instruction : 03 [Write Register Value] +[0001] Flags (decoded below) : 01 + Preserve Register Bits : 1 +[0001] Reserved : 00 + +[0012] Register Region : [Generic Address Structure] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000000088220100 + +[0008] Value : 0000000000000000 +[0008] Mask : FFFFFFFFFFFFFFFF + +[0001] Action : 05 [Execute Operation] +[0001] Instruction : 03 [Write Register Value] +[0001] Flags (decoded below) : 01 + Preserve Register Bits : 1 +[0001] Reserved : 00 + +[0012] Register Region : [Generic Address Structure] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 20 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 03 [DWord Access:32] +[0008] Address : 0000100000543010 + +[0008] Value : B1700000 +[0008] Mask : FFFFFFFF + +[0001] Action : 06 [Check Busy Status] +[0001] Instruction : 01 [Read Register Value] +[0001] Flags (decoded below) : 00 + Preserve Register Bits : 0 +[0001] Reserved : 00 + +[0012] Register Region : [Generic Address Structure] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000000088220140 + +[0008] Value : 0000000000000001 +[0008] Mask : FFFFFFFFFFFFFFFF + +[0001] Action : 07 [Get Command Status] +[0001] Instruction : 00 [Read Register] +[0001] Flags (decoded below) : 01 + Preserve Register Bits : 1 +[0001] Reserved : 00 + +[0012] Register Region : [Generic Address Structure] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000000088220180 + +[0008] Value : 0000000000000000 +[0008] Mask : FFFFFFFFFFFFFFFF diff --git a/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Fadt.aslc b/Sil= icon/Ampere/AmpereAltraPkg/AcpiCommonTables/Fadt.aslc new file mode 100644 index 000000000000..5be828f1cdf0 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Fadt.aslc @@ -0,0 +1,87 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include + +// +// This macro defines the FADT flag options. +// +#define FADT_FLAGS (EFI_ACPI_6_3_HW_REDUCED_ACPI | \ + EFI_ACPI_6_3_PWR_BUTTON) + + +EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE Fadt =3D { + __ACPI_HEADER ( + EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, + EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE, + EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_REVISION + ), + 0, = // UINT32 FirmwareCtrl + 0, = // UINT32 Dsdt + EFI_ACPI_RESERVED_BYTE, = // UINT8 Reserved0 + EFI_ACPI_6_3_PM_PROFILE_PERFORMANCE_SERVER, = // UINT8 PreferredPmProfile + 0, = // UINT16 SciInt + 0, = // UINT32 SmiCmd + 0, = // UINT8 AcpiEnable + 0, = // UINT8 AcpiDisable + 0, = // UINT8 S4BiosReq + 0, = // UINT8 PstateCnt + 0, = // UINT32 Pm1aEvtBlk + 0, = // UINT32 Pm1bEvtBlk + 0, = // UINT32 Pm1aCntBlk + 0, = // UINT32 Pm1bCntBlk + 0, = // UINT32 Pm2CntBlk + 0, = // UINT32 PmTmrBlk + 0, = // UINT32 Gpe0Blk + 0, = // UINT32 Gpe1Blk + 0, = // UINT8 Pm1EvtLen + 0, = // UINT8 Pm1CntLen + 0, = // UINT8 Pm2CntLen + 0, = // UINT8 PmTmrLen + 0, = // UINT8 Gpe0BlkLen + 0, = // UINT8 Gpe1BlkLen + 0, = // UINT8 Gpe1Base + 0, = // UINT8 CstCnt + 0, = // UINT16 PLvl2Lat + 0, = // UINT16 PLvl3Lat + 0, = // UINT16 FlushSize + 0, = // UINT16 FlushStride + 0, = // UINT8 DutyOffset + 0, = // UINT8 DutyWidth + 0, = // UINT8 DayAlrm + 0, = // UINT8 MonAlrm + 0, = // UINT8 Century + 0, = // UINT16 IaPcBootArch + 0, = // UINT8 Reserved1 + FADT_FLAGS, = // UINT32 Flags + NULL_GAS, = // EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE ResetReg + 0, = // UINT8 ResetValue + EFI_ACPI_6_3_ARM_PSCI_COMPLIANT, = // UINT16 ArmBootArchFlags + EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_MINOR_REVISION, = // UINT8 MinorRevision + 0, = // UINT64 XFirmwareCtrl + 0, = // UINT64 XDsdt + NULL_GAS, = // EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk + NULL_GAS, = // EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk + NULL_GAS, = // EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk + NULL_GAS, = // EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk + NULL_GAS, = // EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk + NULL_GAS, = // EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk + NULL_GAS, = // EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XGpe0Blk + NULL_GAS, = // EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE XGpe1Blk + ARM_GAS32(0), = // EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE SleepControlReg + ARM_GAS32(0), = // EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE SleepStatusReg + 0 = // UINT64 HypervisorVendorIdentity +}; + +// +// Reference the table being generated to prevent the optimizer from remov= ing the +// data structure from the executable +// +VOID* CONST ReferenceAcpiTable =3D &Fadt; diff --git a/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Gtdt.aslc b/Sil= icon/Ampere/AmpereAltraPkg/AcpiCommonTables/Gtdt.aslc new file mode 100644 index 000000000000..3824bd6bb956 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Gtdt.aslc @@ -0,0 +1,180 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include + +#define SYSTEM_TIMER_BASE_ADDRESS 0xFFFFFFFFFFFFFFFF +#define CNT_READ_BASE_ADDRESS 0xFFFFFFFFFFFFFFFF + +#define SECURE_TIMER_EL1_GSIV 0x1D +#define NON_SECURE_TIMER_EL1_GSIV 0x1E +#define VIRTUAL_TIMER_GSIV 0x1B +#define NON_SECURE_EL2_GSIV 0x1A + +#define GTDT_TIMER_EDGE_TRIGGERED EFI_ACPI_6_3_GTDT_TIMER_FLAG_TIMER_INT= ERRUPT_MODE +#define GTDT_TIMER_LEVEL_TRIGGERED 0 +#define GTDT_TIMER_ACTIVE_LOW EFI_ACPI_6_3_GTDT_TIMER_FLAG_TIMER_INT= ERRUPT_POLARITY +#define GTDT_TIMER_ACTIVE_HIGH 0 +#define GTDT_TIMER_SAVE_CONTEXT EFI_ACPI_6_3_GTDT_TIMER_FLAG_ALWAYS_ON= _CAPABILITY +#define GTDT_TIMER_LOSE_CONTEXT 0 + +#define GTDT_GTIMER_FLAGS (GTDT_TIMER_LOSE_CONTEXT | GTDT_TIMER_A= CTIVE_HIGH | GTDT_TIMER_LEVEL_TRIGGERED) + +#define WATCHDOG_COUNT FixedPcdGet32 (PcdWatchdogCount) +#define PLATFORM_TIMER_COUNT (WATCHDOG_COUNT + 1) +#define TIMER_FRAMES_COUNT 3 + +#define GT_BLOCK_CTL_BASE 0x0000100002700000 +#define GT_BLOCK_FRAME0_CTL_BASE 0x0000100002710000 +#define GT_BLOCK_FRAME0_CTL_EL0_BASE 0xFFFFFFFFFFFFFFFF +#define GT_BLOCK_FRAME0_GSIV 0x58 + +#define GT_BLOCK_FRAME1_CTL_BASE 0x0000100002720000 +#define GT_BLOCK_FRAME1_CTL_EL0_BASE 0xFFFFFFFFFFFFFFFF +#define GT_BLOCK_FRAME1_GSIV 0x59 + +#define GT_BLOCK_FRAME2_CTL_BASE 0x0000100002730000 +#define GT_BLOCK_FRAME2_CTL_EL0_BASE 0xFFFFFFFFFFFFFFFF +#define GT_BLOCK_FRAME2_GSIV 0x5A + +#define GTX_TIMER_EDGE_TRIGGERED EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_F= LAG_TIMER_INTERRUPT_MODE +#define GTX_TIMER_LEVEL_TRIGGERED 0 +#define GTX_TIMER_ACTIVE_LOW EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_F= LAG_TIMER_INTERRUPT_POLARITY +#define GTX_TIMER_ACTIVE_HIGH 0 + +#define GTX_TIMER_FLAGS (GTX_TIMER_ACTIVE_HIGH | GTX_TIMER= _LEVEL_TRIGGERED) + +#define GTX_TIMER_SECURE EFI_ACPI_6_3_GTDT_GT_BLOCK_COMMON_= FLAG_SECURE_TIMER +#define GTX_TIMER_NON_SECURE 0 +#define GTX_TIMER_SAVE_CONTEXT EFI_ACPI_6_3_GTDT_GT_BLOCK_COMMON_= FLAG_ALWAYS_ON_CAPABILITY +#define GTX_TIMER_LOSE_CONTEXT 0 + +#define GTX_COMMON_FLAGS_S (GTX_TIMER_SAVE_CONTEXT | GTX_TIME= R_SECURE) +#define GTX_COMMON_FLAGS_NS (GTX_TIMER_SAVE_CONTEXT | GTX_TIME= R_NON_SECURE) + +#define SBSA_WATCHDOG_REFRESH_BASE 0x00001000027D0000 +#define SBSA_WATCHDOG_CONTROL_BASE 0x00001000027C0000 +#define SBSA_WATCHDOG_GSIV 0x5C + +#define SBSA_WATCHDOG_EDGE_TRIGGERED EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATC= HDOG_FLAG_TIMER_INTERRUPT_MODE +#define SBSA_WATCHDOG_LEVEL_TRIGGERED 0 +#define SBSA_WATCHDOG_ACTIVE_LOW EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATC= HDOG_FLAG_TIMER_INTERRUPT_POLARITY +#define SBSA_WATCHDOG_ACTIVE_HIGH 0 +#define SBSA_WATCHDOG_SECURE EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATC= HDOG_FLAG_SECURE_TIMER +#define SBSA_WATCHDOG_NON_SECURE 0 + +#define SBSA_WATCHDOG_FLAGS (SBSA_WATCHDOG_NON_SECURE | SBSA_WA= TCHDOG_ACTIVE_HIGH | SBSA_WATCHDOG_LEVEL_TRIGGERED) + +#pragma pack (1) + +typedef struct { + EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE Gtdt; + EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE GtBlock; + EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE Frames[TIMER_FRAME= S_COUNT]; +#if (WATCHDOG_COUNT !=3D 0) + EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE Watchdogs[WATCHDOG= _COUNT]; +#endif +} EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLES; + +#pragma pack () + +EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLES Gtdt =3D { + { + __ACPI_HEADER ( + EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, + EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLES, + EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION + ), + SYSTEM_TIMER_BASE_ADDRESS, // UINT64 Cnt= ControlBasePhysicalAddress + EFI_ACPI_RESERVED_DWORD, // UINT32 Res= erved + SECURE_TIMER_EL1_GSIV, // UINT32 Sec= urePL1TimerGSIV + GTDT_GTIMER_FLAGS, // UINT32 Sec= urePL1TimerFlags + NON_SECURE_TIMER_EL1_GSIV, // UINT32 Non= SecurePL1TimerGSIV + GTDT_GTIMER_FLAGS, // UINT32 Non= SecurePL1TimerFlags + VIRTUAL_TIMER_GSIV, // UINT32 Vir= tualTimerGSIV + GTDT_GTIMER_FLAGS, // UINT32 Vir= tualTimerFlags + NON_SECURE_EL2_GSIV, // UINT32 Non= SecurePL2TimerGSIV + GTDT_GTIMER_FLAGS, // UINT32 Non= SecurePL2TimerFlags + CNT_READ_BASE_ADDRESS, // UINT64 Cnt= ReadBasePhysicalAddress + PLATFORM_TIMER_COUNT, // UINT32 Pla= tformTimerCount + sizeof (EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE), // UINT32 Pla= tformTimerOffset + }, + { + EFI_ACPI_6_3_GTDT_GT_BLOCK, // UINT8 Type + sizeof(EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE) // UINT16 Length + + sizeof(EFI_ACPI_6_3_GTDT_GT_BLOCK_TIMER_STRUCTURE) * + TIMER_FRAMES_COUNT, + EFI_ACPI_RESERVED_BYTE, // UINT8 Reserved + GT_BLOCK_CTL_BASE, // UINT64 CntCtl= Base + TIMER_FRAMES_COUNT, // UINT32 GTBloc= kTimerCount + sizeof(EFI_ACPI_6_3_GTDT_GT_BLOCK_STRUCTURE) // UINT32 GTBloc= kTimerOffset + }, + { + { + 0, // UINT8 GTFra= meNumber + {EFI_ACPI_RESERVED_BYTE, + EFI_ACPI_RESERVED_BYTE, + EFI_ACPI_RESERVED_BYTE}, // UINT8 Reser= ved[3] + GT_BLOCK_FRAME0_CTL_BASE, // UINT64 CntB= aseX + GT_BLOCK_FRAME0_CTL_EL0_BASE, // UINT64 CntE= L0BaseX + GT_BLOCK_FRAME0_GSIV, // UINT32 GTxP= hysicalTimerGSIV + GTX_TIMER_FLAGS, // UINT32 GTxP= hysicalTimerFlags + 0, // UINT32 GTxV= irtualTimerGSIV + 0, // UINT32 GTxV= irtualTimerFlags + GTX_COMMON_FLAGS_NS // UINT32 GTxC= ommonFlags + }, + { + 1, // UINT8 GTFra= meNumber + {EFI_ACPI_RESERVED_BYTE, + EFI_ACPI_RESERVED_BYTE, + EFI_ACPI_RESERVED_BYTE}, // UINT8 Reser= ved[3] + GT_BLOCK_FRAME1_CTL_BASE, // UINT64 CntB= aseX + GT_BLOCK_FRAME1_CTL_EL0_BASE, // UINT64 CntE= L0BaseX + GT_BLOCK_FRAME1_GSIV, // UINT32 GTxP= hysicalTimerGSIV + GTX_TIMER_FLAGS, // UINT32 GTxP= hysicalTimerFlags + 0, // UINT32 GTxV= irtualTimerGSIV + 0, // UINT32 GTxV= irtualTimerFlags + GTX_COMMON_FLAGS_NS // UINT32 GTxC= ommonFlags + }, + { + 2, // UINT8 GTFra= meNumber + {EFI_ACPI_RESERVED_BYTE, + EFI_ACPI_RESERVED_BYTE, + EFI_ACPI_RESERVED_BYTE}, // UINT8 Reser= ved[3] + GT_BLOCK_FRAME2_CTL_BASE, // UINT64 CntB= aseX + GT_BLOCK_FRAME2_CTL_EL0_BASE, // UINT64 CntE= L0BaseX + GT_BLOCK_FRAME2_GSIV, // UINT32 GTxP= hysicalTimerGSIV + GTX_TIMER_FLAGS, // UINT32 GTxP= hysicalTimerFlags + 0, // UINT32 GTxV= irtualTimerGSIV + 0, // UINT32 GTxV= irtualTimerFlags + GTX_COMMON_FLAGS_NS // UINT32 GTxC= ommonFlags + }, + }, +#if (WATCHDOG_COUNT !=3D 0) + { + { + EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG, // UIN= T8 Type + sizeof(EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE), // UIN= T16 Length + EFI_ACPI_RESERVED_BYTE, // UIN= T8 Reserved + SBSA_WATCHDOG_REFRESH_BASE, // UIN= T64 RefreshFramePhysicalAddress + SBSA_WATCHDOG_CONTROL_BASE, // UIN= T64 WatchdogControlFramePhysicalAddress + SBSA_WATCHDOG_GSIV, // UIN= T32 WatchdogTimerGSIV + SBSA_WATCHDOG_FLAGS // UIN= T32 WatchdogTimerFlags + } + } +#endif +}; + +// +// Reference the table being generated to prevent the optimizer from remov= ing the +// data structure from the executable +// +VOID* CONST ReferenceAcpiTable =3D &Gtdt; diff --git a/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Hest.asl b/Sili= con/Ampere/AmpereAltraPkg/AcpiCommonTables/Hest.asl new file mode 100644 index 000000000000..4413428719b8 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Hest.asl @@ -0,0 +1,330 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +[0004] Signature : "HEST" [Hardware Error Sour= ce Table] +[0004] Table Length : 00000308 +[0001] Revision : 01 +[0001] Checksum : 20 +[0006] Oem ID : "Ampere" +[0008] Oem Table ID : "Altra " +[0004] Oem Revision : 00000001 +[0004] Asl Compiler ID : "INTL" +[0004] Asl Compiler Revision : 20100528 + +[0004] Error Source Count : 00000008 + +[0002] Subtable Type : 000A [Generic Hardware Error S= ource v2] +[0002] Source Id : 0000 +[0002] Related Source Id : FFFF +[0001] Reserved : 00 +[0001] Enabled : 01 +[0004] Records To Preallocate : 00000001 +[0004] Max Sections Per Record : 00000001 +[0004] Max Raw Data Length : 00001000 + +[0012] Error Status Address : [Generic Address Structure] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000000088200000 + +[0028] Notify : [Hardware Error Notification S= tructure] +[0001] Notify Type : 03 [SCI] +[0001] Notify Length : 1C +[0002] Configuration Write Enable : 0000 +[0004] PollInterval : 00000BB8 +[0004] Vector : 00000000 +[0004] Polling Threshold Value : 00000000 +[0004] Polling Threshold Window : 00000000 +[0004] Error Threshold Value : 00000000 +[0004] Error Threshold Window : 00000000 + +[0004] Error Status Block Length : 00001000 + +[0012] Read Ack Register : [Generic Address Structure v2] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000100000543010 + +[0008] Read Ack Preserve : 00000000 +[0008] Read Ack Write : B1D00000 + +[0002] Subtable Type : 000A [Generic Hardware Error S= ource v2] +[0002] Source Id : 0001 +[0002] Related Source Id : FFFF +[0001] Reserved : 00 +[0001] Enabled : 01 +[0004] Records To Preallocate : 00000001 +[0004] Max Sections Per Record : 00000001 +[0004] Max Raw Data Length : 00001000 + +[0012] Error Status Address : [Generic Address Structure] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000000088200008 + +[0028] Notify : [Hardware Error Notification S= tructure] +[0001] Notify Type : 00 [Polled] +[0001] Notify Length : 1C +[0002] Configuration Write Enable : 0000 +[0004] PollInterval : 00000BB8 +[0004] Vector : 00000000 +[0004] Polling Threshold Value : 00000000 +[0004] Polling Threshold Window : 00000000 +[0004] Error Threshold Value : 00000000 +[0004] Error Threshold Window : 00000000 + +[0004] Error Status Block Length : 00001000 + +[0012] Read Ack Register : [Generic Address Structure v2] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000100000543010 + +[0008] Read Ack Preserve : 00000000 +[0008] Read Ack Write : B1C00000 + +[0002] Subtable Type : 000A [Generic Hardware Error S= ource v2] +[0002] Source Id : 0002 +[0002] Related Source Id : FFFF +[0001] Reserved : 00 +[0001] Enabled : 01 +[0004] Records To Preallocate : 00000001 +[0004] Max Sections Per Record : 00000001 +[0004] Max Raw Data Length : 00001000 + +[0012] Error Status Address : [Generic Address Structure] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000000088200010 + +[0028] Notify : [Hardware Error Notification S= tructure] +[0001] Notify Type : 03 [SCI] +[0001] Notify Length : 1C +[0002] Configuration Write Enable : 0000 +[0004] PollInterval : 00000BB8 +[0004] Vector : 00000000 +[0004] Polling Threshold Value : 00000000 +[0004] Polling Threshold Window : 00000000 +[0004] Error Threshold Value : 00000000 +[0004] Error Threshold Window : 00000000 + +[0004] Error Status Block Length : 00001000 + +[0012] Read Ack Register : [Generic Address Structure v2] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000100000543010 + +[0008] Read Ack Preserve : 00000000 +[0008] Read Ack Write : B1F00000 + +[0002] Subtable Type : 000A [Generic Hardware Error S= ource v2] +[0002] Source Id : 0006 +[0002] Related Source Id : FFFF +[0001] Reserved : 00 +[0001] Enabled : 01 +[0004] Records To Preallocate : 00000001 +[0004] Max Sections Per Record : 00000001 +[0004] Max Raw Data Length : 00001000 + +[0012] Error Status Address : [Generic Address Structure] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000000088200030 + +[0028] Notify : [Hardware Error Notification S= tructure] +[0001] Notify Type : 03 [SCI] +[0001] Notify Length : 1C +[0002] Configuration Write Enable : 0000 +[0004] PollInterval : 00000BB8 +[0004] Vector : 00000000 +[0004] Polling Threshold Value : 00000000 +[0004] Polling Threshold Window : 00000000 +[0004] Error Threshold Value : 00000000 +[0004] Error Threshold Window : 00000000 + +[0004] Error Status Block Length : 00001000 + +[0012] Read Ack Register : [Generic Address Structure v2] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000100000543010 + +[0008] Read Ack Preserve : 00000000 +[0008] Read Ack Write : B1900000 + +[0002] Subtable Type : 000A [Generic Hardware Error S= ource v2] +[0002] Source Id : 0007 +[0002] Related Source Id : FFFF +[0001] Reserved : 00 +[0001] Enabled : 01 +[0004] Records To Preallocate : 00000001 +[0004] Max Sections Per Record : 00000001 +[0004] Max Raw Data Length : 00001000 + +[0012] Error Status Address : [Generic Address Structure] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000000088200038 + +[0028] Notify : [Hardware Error Notification S= tructure] +[0001] Notify Type : 03 [SCI] +[0001] Notify Length : 1C +[0002] Configuration Write Enable : 0000 +[0004] PollInterval : 00000BB8 +[0004] Vector : 00000000 +[0004] Polling Threshold Value : 00000000 +[0004] Polling Threshold Window : 00000000 +[0004] Error Threshold Value : 00000000 +[0004] Error Threshold Window : 00000000 + +[0004] Error Status Block Length : 00001000 + +[0012] Read Ack Register : [Generic Address Structure v2] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000100000543010 + +[0008] Read Ack Preserve : 00000000 +[0008] Read Ack Write : B1900001 + +[0002] Subtable Type : 000A [Generic Hardware Error S= ource v2] +[0002] Source Id : 0003 +[0002] Related Source Id : FFFF +[0001] Reserved : 00 +[0001] Enabled : 01 +[0004] Records To Preallocate : 00000001 +[0004] Max Sections Per Record : 00000001 +[0004] Max Raw Data Length : 00001000 + +[0012] Error Status Address : [Generic Address Structure] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000000088200018 + +[0028] Notify : [Hardware Error Notification S= tructure] +[0001] Notify Type : 03 [SCI] +[0001] Notify Length : 1C +[0002] Configuration Write Enable : 0000 +[0004] PollInterval : 00000BB8 +[0004] Vector : 00000000 +[0004] Polling Threshold Value : 00000000 +[0004] Polling Threshold Window : 00000000 +[0004] Error Threshold Value : 00000000 +[0004] Error Threshold Window : 00000000 + +[0004] Error Status Block Length : 00001000 + +[0012] Read Ack Register : [Generic Address Structure v2] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000500000543010 + +[0008] Read Ack Preserve : 00000000 +[0008] Read Ack Write : B1D00000 + +[0002] Subtable Type : 000A [Generic Hardware Error S= ource v2] +[0002] Source Id : 0004 +[0002] Related Source Id : FFFF +[0001] Reserved : 00 +[0001] Enabled : 01 +[0004] Records To Preallocate : 00000001 +[0004] Max Sections Per Record : 00000001 +[0004] Max Raw Data Length : 00001000 + +[0012] Error Status Address : [Generic Address Structure] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000000088200020 + +[0028] Notify : [Hardware Error Notification S= tructure] +[0001] Notify Type : 00 [Polled] +[0001] Notify Length : 1C +[0002] Configuration Write Enable : 0000 +[0004] PollInterval : 00000BB8 +[0004] Vector : 00000000 +[0004] Polling Threshold Value : 00000000 +[0004] Polling Threshold Window : 00000000 +[0004] Error Threshold Value : 00000000 +[0004] Error Threshold Window : 00000000 + +[0004] Error Status Block Length : 00001000 + +[0012] Read Ack Register : [Generic Address Structure v2] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000500000543010 + +[0008] Read Ack Preserve : 00000000 +[0008] Read Ack Write : B1C00000 + +[0002] Subtable Type : 000A [Generic Hardware Error S= ource v2] +[0002] Source Id : 0005 +[0002] Related Source Id : FFFF +[0001] Reserved : 00 +[0001] Enabled : 01 +[0004] Records To Preallocate : 00000001 +[0004] Max Sections Per Record : 00000001 +[0004] Max Raw Data Length : 00001000 + +[0012] Error Status Address : [Generic Address Structure] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000000088200028 + +[0028] Notify : [Hardware Error Notification S= tructure] +[0001] Notify Type : 03 [SCI] +[0001] Notify Length : 1C +[0002] Configuration Write Enable : 0000 +[0004] PollInterval : 00000BB8 +[0004] Vector : 00000000 +[0004] Polling Threshold Value : 00000000 +[0004] Polling Threshold Window : 00000000 +[0004] Error Threshold Value : 00000000 +[0004] Error Threshold Window : 00000000 + +[0004] Error Status Block Length : 00001000 + +[0012] Read Ack Register : [Generic Address Structure v2] +[0001] Space ID : 00 [SystemMemory] +[0001] Bit Width : 40 +[0001] Bit Offset : 00 +[0001] Encoded Access Width : 04 [QWord Access:64] +[0008] Address : 0000500000543010 + +[0008] Read Ack Preserve : 00000000 +[0008] Read Ack Write : B1F00000 diff --git a/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Sdei.asl b/Sili= con/Ampere/AmpereAltraPkg/AcpiCommonTables/Sdei.asl new file mode 100644 index 000000000000..3c0a048552cf --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Sdei.asl @@ -0,0 +1,17 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +[0004] Signature : "SDEI" +[0004] Table Length : 0000003E +[0001] Revision : 01 +[0001] Checksum : 59 +[0006] Oem ID : "Ampere" +[0008] Oem Table ID : "Altra " +[0004] Oem Revision : 00000001 +[0004] Asl Compiler ID : "INTL" +[0004] Asl Compiler Revision : 20160930 diff --git a/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Spcr.aslc b/Sil= icon/Ampere/AmpereAltraPkg/AcpiCommonTables/Spcr.aslc new file mode 100644 index 000000000000..42042f8a3474 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Spcr.aslc @@ -0,0 +1,81 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include + +STATIC EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE Spcr =3D { + __ACPI_HEADER ( + EFI_ACPI_6_3_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE, + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_REVISION + ), + // UINT8 InterfaceType; + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_ARM_PL011_= UART, + // UINT8 Reserved1[3]; + { + EFI_ACPI_RESERVED_BYTE, + EFI_ACPI_RESERVED_BYTE, + EFI_ACPI_RESERVED_BYTE + }, + // EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE BaseAddress; + ARM_GAS32 (FixedPcdGet64 (PcdSerialRegisterBase)), + // UINT8 InterruptType; + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC, + // UINT8 Irq; + 0, // Not used on ARM + // UINT32 GlobalSystemInterrupt; + FixedPcdGet32 (PL011UartInterrupt), + // UINT8 BaudRate; +#if (FixedPcdGet64 (PcdUartDefaultBaudRate) =3D=3D 9600) + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_9600, +#elif (FixedPcdGet64 (PcdUartDefaultBaudRate) =3D=3D 19200) + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_19200, +#elif (FixedPcdGet64 (PcdUartDefaultBaudRate) =3D=3D 57600) + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_57600, +#elif (FixedPcdGet64 (PcdUartDefaultBaudRate) =3D=3D 115200) + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_115200, +#else +#error Unsupported SPCR Baud Rate +#endif + // UINT8 Parity; + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_PARITY_NO_PARITY, + // UINT8 StopBits; + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_STOP_BITS_1, + // UINT8 FlowControl; + 0, + // UINT8 TerminalType; + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_TERMINAL_TYPE_VT_UTF8, + // UINT8 Reserved2; + EFI_ACPI_RESERVED_BYTE, + // UINT16 PciDeviceId; + 0xFFFF, + // UINT16 PciVendorId; + 0xFFFF, + // UINT8 PciBusNumber; + 0x00, + // UINT8 PciDeviceNumber; + 0x00, + // UINT8 PciFunctionNumber; + 0x00, + // UINT32 PciFlags; + 0x00000000, + // UINT8 PciSegment; + 0x00, + // UINT32 Reserved3; + EFI_ACPI_RESERVED_DWORD +}; + +// +// Reference the table being generated to prevent the optimizer from remov= ing the +// data structure from the executable +// +VOID* CONST ReferenceAcpiTable =3D &Spcr; diff --git a/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Ssdt.asl b/Sili= con/Ampere/AmpereAltraPkg/AcpiCommonTables/Ssdt.asl new file mode 100644 index 000000000000..cdb4bf5de9bf --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/Ssdt.asl @@ -0,0 +1,15 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +DefinitionBlock("Ssdt.aml", "SSDT", 2, "Ampere", "Altra ", 0x00000001) +{ + Method (MAIN, 0, NotSerialized) + { + Return (Zero) + } +} --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83827): https://edk2.groups.io/g/devel/message/83827 Mute This Topic: https://groups.io/mt/87123889/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83822+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83822+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167811751555.7177652273743; Wed, 17 Nov 2021 08:50:11 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id IGDCYY1788612xuWqZ19gPkb; Wed, 17 Nov 2021 08:50:11 -0800 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.125]) by mx.groups.io with SMTP id smtpd.web08.9766.1637167810623656758 for ; Wed, 17 Nov 2021 08:50:10 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IiN2/F5OqkWCW6GJDtEenLB4ddssmAeRM3HlEZUMa5ATu8/4QQ7L5ZDgDrOxnT+FefGyU8oifTmCS9uGBeBKa9PcMORIdZOX0Ss32OUalSwbI6z77gUWxx1cyYqvAtGxluXDauV69KtKTkmA8Y/Wd1vBKYGZ7MyqzKk5Wf3A7mY1yqkLFiiUbQGgQIbs2QKYMehrcmbO1DZHTdBdYo6RVYhz5Zl4bVfS6o3kFsTV1k+KadslWyZXefDe4zP75opW9MGVkMqTkQui3YSo+BRM1sz/twv/Aj9NGkcywHZGUsejb3oVvlDfDad69nHR+H7N7oXXqWj93nBgaNHZljIJRw== 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=yaoBNqO5uFJvoA2j4TEtTLqTX2Y7hQSxbcmDB9fMelQ=; b=CbJwe/HaLcZljhqh0SPem4uvdzzRYq/oOq9Lzj1LK5HHODbsGfmrWNRBxegGM7dy34Z8IEtR1wbgucR2+ZcYxGfdW/RV2LJY+PFBQB40xfP0WMa3VZ3wMYDXpARaekKa9VKfQZThBtyuunrWj5Ra6ZhqmVWxcuSmvqeCVmu+dNO4gUwJxMPiQ2AuU8Lnpapz0WaAbRnK5eu3PTYFNhDs5CnoIwKuDJvhX1L47SqlhPtVEvbWWlTALkJP6HpevYBfBbwm2gGDACWZ6i2fT4aomm2CWlYfIJoD/d4GSG++ufkBc8aRoYobBKi/Q3OUUHM8wBr4ua/MedkG+Ox+KhcoVg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB6454.prod.exchangelabs.com (2603:10b6:510:1b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.20; Wed, 17 Nov 2021 16:50:07 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:07 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 10/30] AmpereAltraPkg: Add Root Complex HOB data structures Date: Wed, 17 Nov 2021 23:47:07 +0700 Message-ID: <20211117164727.10922-11-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:50:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 14b6d21f-a62f-4161-09f1-08d9a9ea4f73 X-MS-TrafficTypeDiagnostic: PH0PR01MB6454: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: Sump/X1VOoQP2/C9AmXd1W+2vO+CryyGNFDUcLl0d0YEmRSWLPSxraHTkuCa/kAuqQatJg5S3gZCsNXuVdd49TYmKZN5ypfxC/2bhX0GXIXZHaUgwh8Pj0bzJD3C4vMYu/l0Lq9/P+2vJuuwjDmKA8eoHBWz6SfJFivDfV1aXF47aJH/+kB1HFshAEbLPbPxVVS1d2Zwc4CWSR2ga0+3TGfgx1mEuNbiCwoxQZZc8NXYqKS9IcXuNZX7qedY3psAA/PYD5sqXMBcWIvRUwo/us0/bvREmDeyU0WSbHVCp20Q/o+lfjXCrQlBbBvkTHKb0XjAaZ318+o9wUf05Sy2ajIhEHnwR0F2XDgXO/d1R0enUrEkCiyilvMWJy5u0x/9fxiS9IUKgUt/4AwQAXivVmkgndFQBG8hjZfIrmsYi+fr68QyrWolH+txk9GvyEzeu19iTFvG8OOlfUlJeBQWmOsRytQt80HgoHA4R4ZXQCPTdHq4mbHEZAqHSiKDwvgtxh/bSEX3BYQltD2nnRuaFGnKhAK5hsF05MR110KU/4KM94JN8d6YXyWkK2DNsZ76Wz7zidi54u/AhZEDg14/RdYG0kYBHBRJX5YgGJBbwH4WclI+Cr2us/dsiDyZQxlWxzy2L5SKldFByIML5fNiwy1rvvOAUQ1BB3p/F1vpB3So0mNetulb1sAFF5U3srw1LsyqHWD4IoMSuWc76mt13A== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?T6oK+HmPwZNjpK8E2YJXJ6gTce+OzieoY0NMO8hRqoemEuiUOXTL9/wlqb0A?= =?us-ascii?Q?sZfM+IA9Obrn5GkdoaMDcjHeM3a3nfO8v4ScSIvio7EZcWNVxYIomJ4xtjYR?= =?us-ascii?Q?LHUw48M5x/upmY2+BMyp2iIkWpimr/c82682MxM2EQ1rQ12lq0T2PgarVS7b?= =?us-ascii?Q?Aw32XP2Pgm8oI+hNdCLhJnRNYLjk1EWbXxfJVEeuyOZKupDP4ChUSsJjy+uG?= =?us-ascii?Q?KoMKVnL2kWmum4EYK+ot/0l/V+51fkG3TomWIqwhJCvUq60cNWoRiL1iVPWQ?= =?us-ascii?Q?BkjKaGBJ5OoUGiqTidDSGjeawIROF8fk5fEpxgvm4Y84TkDw5BHiDluToGat?= =?us-ascii?Q?Id5iq1NxwmTyX84DnLHnB/V09XWovS7Mg0nG8Reo1Ez89LVRAqI6hxzfJwCy?= =?us-ascii?Q?/kbwBxwQ3MOtd+KazhBGyqKwYXI8+D9j0WPPlawkmRxbODHAyH6ZxnB+WWY6?= =?us-ascii?Q?NCcpv73KhpUNn0fdu/yBcMs7aNmEtmUNMxzPFfSbbrcdi5/vfH2tDwNbveWH?= =?us-ascii?Q?RL7BZRUeSGo4fqpLKZllIGMpx1M0TenjSnjUilhcmj8wi7FqyXazTy15zzQa?= =?us-ascii?Q?Q6Qw0aSU+onm1PXz2QAP7MjCoqerJblGwXlmVBkSUq0qya3vY/CUYXTXzi8s?= =?us-ascii?Q?gkH5glquoPoHQUHUsWtevwmvX/smDInzf4xCURA8o3fr9vCz0F3dBh5EiGnN?= =?us-ascii?Q?mnozMGtqUmO3jetmCZ/QgHmSr5aRUJqnTmFq7blCH9d1UeLehbEuOejj2zNm?= =?us-ascii?Q?Ht/HWeh9vAq1oG6CkJkgCgQz7OwCsrTTg0/teWOd4qBvwKeU9Z9TLMMM9jqs?= =?us-ascii?Q?fBqIUe/xP47N0hhxiCfwqFSj/OsxD8ECxlXuJ4hD2paODhCYn/Nvpg2MA+uu?= =?us-ascii?Q?8yLoJnwpE6vNj/w+vAB6b9/Yo8/Vqn+pLMSCOTA19kjSBaPnLNxIH5DJ3Y9M?= =?us-ascii?Q?1+z4i8dr4spewh1D43m+BP4D0jBBWHNdpzlDyHj4Kff1vULZcbdntPoIZaZM?= =?us-ascii?Q?FwvAsn8ZUbTq/m8kCTB3I/HBW6KRfKrYg2hlURgHAY3+dQtopHG6t8K/Up42?= =?us-ascii?Q?QgRG5s75OXmX3VwPSOSVHFCUJJFOJFHSWZhw4NXXV9YsoX6jXvc4JVBR4QUX?= =?us-ascii?Q?rOTIZ7le4y0xHpMyP1oQoQE03uwvyzkXPmS1hNCqVI4E6H8fFdbeOMHq8Gxl?= =?us-ascii?Q?z2ZEobdcHQDDg0vPCFsoJeCd08YYJj+3ixQgqSbXcwp1fDRb2ON2+xUb8v0o?= =?us-ascii?Q?ON1pSjKgTj9pOwzv7V/P+lF2zvJPtlE8GRw32rnzbVEyDe0x1v2Oqn8Tr0YV?= =?us-ascii?Q?ngx2ipVzL26l0QeyBwhCX+6ZAzzWf2renHBMy3JmmfbTy2McM8k6k9tE4Iog?= =?us-ascii?Q?Pl0R/kkgQCHDBQk3SRPgWNUKGItscRvHHMYvzjzbotM7cuLpCLMCMggQ/ezG?= =?us-ascii?Q?uLa0utdzJ3oo2dOCxjiY5wQZ7Cp9DD3iX32Vii/DW66ysnrNTr4u0GycTJne?= =?us-ascii?Q?igoNBPr3Me4BzwB16eRrRk7QbODAJoI1VaC1lb4agN5e/70JrRpVTd1+DDnE?= =?us-ascii?Q?sjGnmCgjqZRexFe/cNx1nhr0yYKGtyXe6vl6iELcPeTF7zpahit0mabbk+En?= =?us-ascii?Q?/ZpApAdmTJLsBA7pMDChhxb3n4VCbPG8DzOnX5Tq/+z7ohAPwp5ReN0IIsQ1?= =?us-ascii?Q?j/UMMWwxqmDThdQRu8fXMn9qztk=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14b6d21f-a62f-4161-09f1-08d9a9ea4f73 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:07.2455 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LBLc7zhI4zaq2wUh7oHEibui9FptMf9ySjIp1jFr0icicryS1QeAh50lQuXhefWRgPXyrencyVoNn82oByynmgIMfFiUOWyRyKhtIi++LqQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6454 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: 9X4ZBp5nwv8z2eexBqN9hr5Yx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167811; bh=5vQhXFFgv90buUjbB2+zH1AmiGR5hgt4HE6yBUhluEc=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=eRtJu0dWUsQqyIkuA6UDKE16bp8+VWUkR7XfXTW5QWrqYG6sBD3rp6Hfq5+4rJvn0Kp F5ZOmv1BPgeH3/+ZuEf6DGCJAGyGbAkITPoU2lBz5ERwcooY5nNVCkt8q7ILEIaQ82Xd7 XyGPhjvSZn/4Gh7WnObXAOjt6pz7eSZFY90= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167813304100001 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen Provide common data structures and macros which will be consumed by various PCIe modules. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec | 3 + Silicon/Ampere/AmpereAltraPkg/Include/Guid/RootComplexInfoHob.h | 140 ++++= ++++++++++++++++ 2 files changed, 143 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Amp= ere/AmpereAltraPkg/AmpereAltraPkg.dec index c1226c296dad..e19925c68a0e 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -52,3 +52,6 @@ [Guids] =20 ## Include/Guid/PlatformInfoHob.h gPlatformInfoHobGuid =3D { 0x7f73e372, 0x7183, 0x4022, { 0xb3, 0= x76, 0x78, 0x30, 0x32, 0x6d, 0x79, 0xb4 } } + + ## Include/Guid/RootComplexInfoHob.h + gRootComplexInfoHobGuid =3D { 0x568a258a, 0xcaa1, 0x47e9, { 0xbb, 0= x89, 0x65, 0xa3, 0x73, 0x9b, 0x58, 0x75 } } diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Guid/RootComplexInfoHob.= h b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/RootComplexInfoHob.h new file mode 100644 index 000000000000..24599b781646 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/RootComplexInfoHob.h @@ -0,0 +1,140 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef ROOT_COMPLEX_INFO_HOB_H_ +#define ROOT_COMPLEX_INFO_HOB_H_ + +#define ROOT_COMPLEX_INFO_HOB_GUID \ + { 0x568a258a, 0xcaa1, 0x47e9, { 0xbb, 0x89, 0x65, 0xa3, 0x73, 0x9b, 0x58= , 0x75 } } + +extern GUID gRootComplexInfoHobGuid; + +#define PRESET_INVALID 0xFF + +// +// PCIe link width +// +#define LINK_WIDTH_NONE 0x00 +#define LINK_WIDTH_X1 0x01 +#define LINK_WIDTH_X2 0x02 +#define LINK_WIDTH_X4 0x04 +#define LINK_WIDTH_X8 0x08 +#define LINK_WIDTH_X16 0x10 + +// +// PCIe link speed +// +#define LINK_SPEED_NONE 0x00 +#define LINK_SPEED_GEN1 0x01 +#define LINK_SPEED_GEN2 0x02 +#define LINK_SPEED_GEN3 0x04 +#define LINK_SPEED_GEN4 0x08 + +typedef enum { + DevMapMode1 =3D 0, + DevMapMode2, + DevMapMode3, + DevMapMode4, + MaxDevMapMode =3D DevMapMode4 +} DEV_MAP_MODE; + +// +// PCIe controller index +// +typedef enum { + PcieController0 =3D 0, + PcieController1, + PcieController2, + PcieController3, + PcieController4, + MaxPcieControllerOfRootComplexA =3D PcieController4, + PcieController5, + PcieController6, + PcieController7, + MaxPcieController, + MaxPcieControllerOfRootComplexB =3D MaxPcieController +} AC01_PCIE_CONTROLLER_INDEX; + +// +// Root Complex type +// +typedef enum { + RootComplexTypeA, + RootComplexTypeB, + MaxRootComplexType =3D RootComplexTypeB +} AC01_ROOT_COMPLEX_TYPE; + +// +// Root Complex index +// +typedef enum { + RootComplexA0 =3D 0, + RootComplexA1, + RootComplexA2, + RootComplexA3, + MaxRootComplexA, + RootComplexB0 =3D MaxRootComplexA, + RootComplexB1, + RootComplexB2, + RootComplexB3, + MaxRootComplex, + MaxRootComplexB =3D MaxRootComplex +} AC01_ROOT_COMPLEX_INDEX; + +#pragma pack(1) + +// +// Data structure to store the PCIe controller information +// +typedef struct { + PHYSICAL_ADDRESS CsrBase; // Base address of CSR block + PHYSICAL_ADDRESS SnpsRamBase; // Base address of Synopsys SRAM + UINT8 MaxGen; // Max speed Gen-1/-2/-3/-4 + UINT8 CurrentGen; // Current speed Gen-1/-2/-3/-4 + UINT8 MaxWidth; // Max lanes x2/x4/x8/x16 + UINT8 CurWidth; // Current lanes x2/x4/x8/x16 + UINT8 ID; // ID of the controller within = Root Complex + UINT8 DevNum; // Device number as part of Bus= :Dev:Func + BOOLEAN Active; // Active? Used in bi-furcation= mode + BOOLEAN LinkUp; // PHY and PCIE linkup + BOOLEAN HotPlug; // Hotplug support +} AC01_PCIE_CONTROLLER; + +// +// Data structure to store the Root Complex information +// +typedef struct { + PHYSICAL_ADDRESS CsrBase; + PHYSICAL_ADDRESS TcuBase; + PHYSICAL_ADDRESS HostBridgeBase; + PHYSICAL_ADDRESS SerdesBase; + PHYSICAL_ADDRESS MmcfgBase; + PHYSICAL_ADDRESS MmioBase; + PHYSICAL_ADDRESS MmioSize; + PHYSICAL_ADDRESS Mmio32Base; + PHYSICAL_ADDRESS Mmio32Size; + AC01_PCIE_CONTROLLER Pcie[MaxPcieController]; + UINT8 MaxPcieController; + AC01_ROOT_COMPLEX_TYPE Type; + UINT8 ID; + DEV_MAP_MODE DevMapHigh:3; // Copy of High Devmap pr= ogrammed to Host bridge + DEV_MAP_MODE DevMapLow:3; // Copy of Low Devmap pro= grammed to Host bridge + DEV_MAP_MODE DefaultDevMapHigh:3; // Default of High devmap= based on board settings + DEV_MAP_MODE DefaultDevMapLow:3; // Default of Low devmap = based on board settings + UINT8 Socket; + BOOLEAN Active; + BOOLEAN DefaultActive; + UINT16 Logical; + UINT32 Flags; + UINT8 PresetGen3[MaxPcieController]; + UINT8 PresetGen4[MaxPcieController]; +} AC01_ROOT_COMPLEX; + +#pragma pack() + +#endif /* ROOT_COMPLEX_INFO_HOB_H_ */ --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83822): https://edk2.groups.io/g/devel/message/83822 Mute This Topic: https://groups.io/mt/87123874/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83823+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83823+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 16371678145091008.9856978495212; Wed, 17 Nov 2021 08:50:14 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id CxGkYY1788612xIRqwFVOsX6; Wed, 17 Nov 2021 08:50:14 -0800 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.128]) by mx.groups.io with SMTP id smtpd.web12.9705.1637167813172373156 for ; Wed, 17 Nov 2021 08:50:13 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jJMo5SVmb/4dMDZAKlsf69ZxWoynq0IHkzRimX4QQgcrOFv/YWx0oXEX5pw02aPe/wGZ4iRmxkiem+F4kHFEN5X38bU8lO04zeuJYboKsvz5Y9sUOcRhL0ZzV/CuM7zHWn9C6J/t25D0b0o/X0RzExjLtkJzXPsIIIBnupsc++lph3BaYXagtLz/lLsvrGLznwT52/p3R1aXoVb7lzNq50qezXWm4ru145B6IyBThTbLtA5KO354HxMjjittCUV9ULxMAdJy5tR2SkeW7SPfiq9jW3ELFVic/WrJMu4A1XxNXaFnqXKEthmh4Avl4jj29QJ8u9lqFw4ExRLjcytZRQ== 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=0484HMP6q1Kl4XYVFEIq6dDgU0BNVQDLAVc/QxwXgAQ=; b=F04Mo+gJlzEiR7/Xil9MXK+kRKP1gNlJ8fZx5fzhLMuKdsufUh5G43OiPLUG4SAxUigCMfEqp10/oiN87h81u5hUiiZiDqjgu9cskGQBrXwXiQQqmAUtgzE/3q/3e1oPzCRrku7bPYIJPPl9GE1sZ5Qp2fnh3U8URpt+nM8ibdB5jONyfJgvnlt2+xwFsEykMnMUNBiemMkpAGVqTjtwpgHmZhf3aXKfw0V2TcJj7TB0KhhyePgQols7bdsznrE+ioR7ZFg1MLN+MFk6m2p8XEk/z1LoT9/ae19RAT+qw48RkQGlzCESCUMhE9nPG+V4v9nigtIHYD0mVxGKkoxfWA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB6454.prod.exchangelabs.com (2603:10b6:510:1b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.20; Wed, 17 Nov 2021 16:50:11 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:10 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 11/30] AmpereAltraPkg: Add Ac01PcieLib library instance Date: Wed, 17 Nov 2021 23:47:08 +0700 Message-ID: <20211117164727.10922-12-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:50:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7adec854-1ca2-493d-5661-08d9a9ea517d X-MS-TrafficTypeDiagnostic: PH0PR01MB6454: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:121; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: tQohfOHtgfFbVHOQNQUpVdeIJowMyerZBb8IilXfAEfxrHuaTMKLaXlFtLSRTB0I2X2SbaDIbS4xSB8Kak9cOCwJ8IAwmVPodGvxjSpPu3d8b3RnA5mL98el1+emS4vszEIJYRl2MCXzkGUQ5fx8sWZRBlp2wCPvJ6owYCZkVqEEp0qCm4cgpA/xKCvHbFVbUHSMTlsI/PKwW2Jzw7HyvCg3edI8VE3Sex+GsBPmNm2OI4DpcbzQ8mKN3CySRyQ0HzKgz8U9fxn50jPbb1/ei8lpyAO59YbBC6Dz2Hbpz0nVRjYxSrKZKUj7Y9TZMd4h3k9MHNQFJbc7x8SO/4SoLrLqpqZ7ouHlo8MKjofVkvFO+w5zwuWJoAtaJ2Ksy7CjIF8V2hpQimyF5WfBo2wUL6+O5mihmFM84XZD1uFqAKeY7qgzuZffzenb3RDHjPlcPF7hYNoW5sCEp1JsiKvt9iiMlG/F7lpq43xKzg0akrJ1+CKyiKNIiCOdX+2CZZ0QwdHZBmBEkNucOg0/qgtFG8E4eMN0G0w3wftVA4VQsayR7XYlRphkTExFp83s/g1H8Hel1GwLJtDumERaaZeyyrB+00BLle/b1AgKov3xvE4IRjYwYJkr/XVYnvo/bgdk4gwmYhRqJ+aHarHIE4vPk4W+7tZxbDrnfomK2U4TfI6AKddSLh2oKgV7rdixYB6pAVgJ2SSuQF6uSgMgbKdiAg== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?G2oObD84c6OW9d43E4Lcq2P2fyfX9c4BkGwPwdRErTGD66K18idnVAtTPvV3?= =?us-ascii?Q?GmG9WwiRIgOsvL2OCAYVPu/73rjXpnBrXWIs2OOPLWZh6vwdRbNegDcc91Hf?= =?us-ascii?Q?1ZYSsN6EaL2qUIMHRytF/a3NJAGM3hEabV6+ck01Yfs4wqpmR50/8oRIL6ul?= =?us-ascii?Q?NGp3AifThMyiTOblZfvj2uSzGvj7tg37350lp1mZwszI8q4kvVqzF8PeuJiz?= =?us-ascii?Q?J38IO6VSnghrl7tx09vUgzSYgHT4qnIhMIL9wxtG80lbyQa3XfhVOTyCLv5k?= =?us-ascii?Q?hJR6wSk/lOMNOch+cB0/25dBl92zapT1WkrhVYmthc/iAbzVD/5aIU9NWgAa?= =?us-ascii?Q?yRg2LDD8frQIqPzQiWRK8wRRLK+mziuoGNV0f0sqBqzGe7wx6Ff3Jf0wHLbA?= =?us-ascii?Q?EtWajfw2FYc0cNctTaN5DazX4jBDxFNwM9V7CI+1AB3Szx1cXo1a+giW8Fmj?= =?us-ascii?Q?HpPOj+SdPjfeDDXYGR17IdWClOmZZAYCRwvhw0Sb/Q1zFuhFiN/0sGZOQh3H?= =?us-ascii?Q?jx4CVrpjnZy2XHevYD8zd8iXMSyPQBYNcm7MWaw9sZKBnBQF2QpMpkcGsktJ?= =?us-ascii?Q?Sj5DezX4UnDXjnLvww3OS5l3C5v7nW25gT1hl2b+op7BJ3w3N/ass0CH5tOg?= =?us-ascii?Q?SYUxqgP/iKutcAyxgRPHjAaXowPFxua1FNXAQ2u6dYOf0Ft4naI7iUfcgCHG?= =?us-ascii?Q?cOO81G+Nccmi/4pBJT7aESPyJyX0GGzNgSuPzi3OvYDWim1MMudxoIpZ4y/X?= =?us-ascii?Q?DowUmBdJn7cwxwLN18kpY1Cb44Zxh1hRnVs+TVE7wqSPVEPxvy5m4ufqHUOg?= =?us-ascii?Q?63joNFymqx+7dXeUYGq+VE16vp+bUQIX1km91X40RPtt9TwZ3IaPabmAN21X?= =?us-ascii?Q?3LICOnj61/pyHhNbo8p1FIP//Qg2GJyRdLx2ukTZqcXo7cjfmb4rUdOZ1c3a?= =?us-ascii?Q?7Fxgm5tIPqD0bCQ4VonTPcbt7KmgngQM36/oNVcNiWEY6qF8JFf4ND4TWuxt?= =?us-ascii?Q?x69e+C1BWXecg/7gHQf0yqaM9qPBzTwXbTh/lVyk496UkUC7N37G/4SF0/ku?= =?us-ascii?Q?QlfjClKqavD5UjPwD4xgd+LRX4XrQ926bf9sxDaB2tNHzVOef9ZLEN0JE3MS?= =?us-ascii?Q?ri8SZnWWxzFsPbiOyiIQgpc7xKNbpdbXp5ReMNBj5OXCf7JPyZHPhpvQRkak?= =?us-ascii?Q?ZFgiGqXaZ8PuYyVVAMmx1Y4u2tkvvPQewe+zdrwVD/kZY5fuFCT/UarsmMI3?= =?us-ascii?Q?0JxBJdJc+Hgw/7BgtAbKu7L6M8uuvBwPYHR9DgcQ5zXVGYk51uX3QwShGXhi?= =?us-ascii?Q?ldUfvQOxkhfrOomtb1AOeXjoIndMExjlMnnaQUBJdPweYbcDOBOGB5Akv6Ef?= =?us-ascii?Q?L3mZjRxybqrOz4J1nMTKReCQh/rJ9u+4WdxG1hIwbT1sHsfZhV0FtsU+z/qu?= =?us-ascii?Q?5bTrE9WkHgxgyq34wF81tXpIXjhEZ+macSh+7W1pNn10W2VYffsvd1mgL44D?= =?us-ascii?Q?R4xwaKR5bkC/iZMHl/WIYooyFxYF03e6adCRlqy2KUrYvwGBjDaBZu0xWyx4?= =?us-ascii?Q?KlzZHZZ/nuJ0ZoUELR8G6Gutnx5kutLHphJVYz/gb1WtGzRC6sjudCjqyiVJ?= =?us-ascii?Q?LVwtqgtoNb2tSWOOPg8A6JwUTQmbr6WmkaK4Lcr6wjCWEWWSohbQCVfR+GTI?= =?us-ascii?Q?baPv9Eo8gFInAFDjosjhQ6trepY=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7adec854-1ca2-493d-5661-08d9a9ea517d X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:10.7889 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kBIJQ8hPTo26bbfIrdEI18/+SqprcQNTJA3uzyjePPpI/c6Jd1BZr3eVouJwubxE0qsg0lKCozB41HgKx0U6V0Y28FPh3wdQJ+4BCriaeyc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6454 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: B8RDzdosAgPlN48xH5saXOwkx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167814; bh=IlJ2h1jhwOoaQjo0VY83vgG53hckoawj8dj5HcjD8tI=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=ZLanX7pzNdTSv1i1P2LEM6tfu8htY74BdOe5u2wm9lnItfsMWk/DlNP/Tu5Inj1SNVb cpTuR/x6RQunFTPJPHegg24CJo36vJKpN9PGIyLjhdZts8lY+iieEHi6t2HHPstNg7KOP RfMmMCqRNvlvVF43YYakziBeUQcELW9g30A= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167814983100005 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen Provides essential functions to initialize the PCIe Root Complex on Ampere Altra processor. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec = | 6 + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc = | 2 + Platform/Ampere/JadePkg/Jade.dsc = | 5 + Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/Ac01PcieLib.inf = | 42 + Silicon/Ampere/AmpereAltraPkg/Library/BoardPcieLibNull/BoardPcieLibNull.in= f | 25 + Silicon/Ampere/AmpereAltraPkg/Include/Library/Ac01PcieLib.h = | 49 + Silicon/Ampere/AmpereAltraPkg/Include/Library/BoardPcieLib.h = | 45 + Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.h = | 372 +++++ Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c = | 1419 ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Library/BoardPcieLibNull/BoardPcieLibNull.c = | 47 + 10 files changed, 2012 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Amp= ere/AmpereAltraPkg/AmpereAltraPkg.dec index e19925c68a0e..7bd4d3ac9462 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -43,6 +43,12 @@ [LibraryClasses] ## @libraryclass Defines a set of methods to access flash memory. FlashLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/FlashLib.h =20 + ## @libraryclass Defines a set of platform dependent functions + BoardPcieLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/BoardPcieLib.h + + ## @libraryclass Defines a set of methods to initialize Pcie + Ac01PcieLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/Ac01PcieLib.h + [Guids] ## NVParam MM GUID gNVParamMmGuid =3D { 0xE4AC5024, 0x29BE, 0x4ADC, { 0x93, 0= x36, 0x87, 0xB5, 0xA0, 0x76, 0x23, 0x2D } } diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index fa9b120b2c2b..5b767ecb024f 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -81,6 +81,8 @@ [LibraryClasses.common] NVParamLib|Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.i= nf MailboxInterfaceLib|Silicon/Ampere/AmpereAltraPkg/Library/MailboxInterfa= ceLib/MailboxInterfaceLib.inf SystemFirmwareInterfaceLib|Silicon/Ampere/AmpereAltraPkg/Library/SystemF= irmwareInterfaceLib/SystemFirmwareInterfaceLib.inf + PciePhyLib|Silicon/Ampere/AmpereAltraBinPkg/Library/PciePhyLib/PciePhyLi= b.inf + Ac01PcieLib|Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/Ac01PcieLi= b.inf AmpereCpuLib|Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCp= uLib.inf TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf I2cLib|Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.inf diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index e4b29e36fc8d..23a297d0dbeb 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -82,6 +82,11 @@ [LibraryClasses] # AcpiLib|EmbeddedPkg/Library/AcpiLib/AcpiLib.inf =20 + # + # Pcie Board + # + BoardPcieLib|Silicon/Ampere/AmpereAltraPkg/Library/BoardPcieLibNull/Boar= dPcieLibNull.inf + ##########################################################################= ###### # # Specific Platform Pcds diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/Ac01PcieLib.= inf b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/Ac01PcieLib.inf new file mode 100644 index 000000000000..8c8661265cd5 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/Ac01PcieLib.inf @@ -0,0 +1,42 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D Ac01PcieLib + FILE_GUID =3D 8ABFA0FC-313E-11E8-B467-0ED5F89F718B + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D Ac01PcieLib + +[Sources] + PcieCore.c + PcieCore.h + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraBinPkg/AmpereAltraBinPkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + ArmGenericTimerCounterLib + BaseLib + BoardPcieLib + DebugLib + HobLib + IoLib + PciePhyLib + SystemFirmwareInterfaceLib + TimerLib + +[Guids] + gPlatformInfoHobGuid + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/BoardPcieLibNull/BoardPc= ieLibNull.inf b/Silicon/Ampere/AmpereAltraPkg/Library/BoardPcieLibNull/Boar= dPcieLibNull.inf new file mode 100644 index 000000000000..435092b864ec --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/BoardPcieLibNull/BoardPcieLibNu= ll.inf @@ -0,0 +1,25 @@ +## @file +# +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D BoardPcieLibNull + FILE_GUID =3D 7820C925-F525-4101-8E64-87838356B7A6 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D BoardPcieLib + +[Sources.common] + BoardPcieLibNull.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseLib diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/Ac01PcieLib.h b/= Silicon/Ampere/AmpereAltraPkg/Include/Library/Ac01PcieLib.h new file mode 100644 index 000000000000..692bc2669915 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/Ac01PcieLib.h @@ -0,0 +1,49 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef AC01_PCIE_LIB_H_ +#define AC01_PCIE_LIB_H_ + +/** + Setup and initialize the AC01 PCIe Root Complex and underneath PCIe cont= rollers + + @param RootComplex Pointer to Root Complex structure + @param ReInit Re-init status + @param ReInitPcieIndex PCIe controller index + + @retval RETURN_SUCCESS The Root Complex has been initialized succe= ssfully. + @retval RETURN_DEVICE_ERROR PHY, Memory or PIPE is not ready. +**/ +RETURN_STATUS +Ac01PcieCoreSetupRC ( + IN AC01_ROOT_COMPLEX *RootComplex, + IN BOOLEAN ReInit, + IN UINT8 ReInitPcieIndex + ); + +/** + Verify the link status and retry to initialize the Root Complex if there= 's any issue. + + @param RootComplexList Pointer to the Root Complex list +**/ +VOID +Ac01PcieCorePostSetupRC ( + IN AC01_ROOT_COMPLEX *RootComplexList + ); + +/** + Callback function when the Host Bridge enumeration end. + + @param RootComplex Pointer to the Root Complex structure +**/ +VOID +Ac01PcieCoreEndEnumeration ( + IN AC01_ROOT_COMPLEX *RootComplex + ); + +#endif /* AC01_PCIE_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/BoardPcieLib.h b= /Silicon/Ampere/AmpereAltraPkg/Include/Library/BoardPcieLib.h new file mode 100644 index 000000000000..34e7dee702ec --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/BoardPcieLib.h @@ -0,0 +1,45 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef BOARD_PCIE_LIB_H_ +#define BOARD_PCIE_LIB_H_ + +#include + +/** + Assert PERST of the PCIe controller + + @param[in] RootComplex Root Complex instance. + @param[in] PcieIndex PCIe controller index of input Root Co= mplex. + @param[in] IsPullToHigh Target status for the PERST. + + @retval RETURN_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +RETURN_STATUS +EFIAPI +BoardPcieAssertPerst ( + IN AC01_ROOT_COMPLEX *RootComplex, + IN UINT8 PcieIndex, + IN BOOLEAN IsPullToHigh + ); + +/** + Override the segment number for a root complex with a board specific num= ber. + + @param[in] RootComplex Root Complex instance with properties. + + @retval Segment number corresponding to the input root complex. + Default segment number is 0x0F. +**/ +UINT16 +BoardPcieGetSegmentNumber ( + IN AC01_ROOT_COMPLEX *RootComplex + ); + +#endif /* BOARD_PCIE_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.h b= /Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.h new file mode 100644 index 000000000000..1db8a68b3df4 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.h @@ -0,0 +1,372 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef AC01_PCIE_CORE_H_ +#define AC01_PCIE_CORE_H_ + +#define BUS_SHIFT 20 +#define DEV_SHIFT 15 + +#define GET_LOW_8_BITS(x) ((x) & 0xFF) +#define GET_HIGH_8_BITS(x) (((x) >> 8) & 0xFF) +#define GET_LOW_16_BITS(x) ((x) & 0xFFFF) +#define GET_HIGH_16_BITS(x) (((x) >> 16) & 0xFFFF) +#define GET_CAPABILITY_PTR(x) (GET_LOW_16_BITS (x) >> 8) +#define GET_EXT_CAPABILITY_PTR(x) (GET_HIGH_16_BITS (x) >> 4) + +#define WORD_ALIGN_MASK 0x3 + +#define MAX_REINIT 3 // Number of soft reset re= try + +#define SLOT_POWER_LIMIT_75W 75 // Watt + +#define LINK_CHECK_SUCCESS 0 +#define LINK_CHECK_FAILED -1 +#define LINK_CHECK_WRONG_PARAMETER 1 + +#define AMPERE_PCIE_VENDOR_ID 0x1DEF +#define AC01_HOST_BRIDGE_DEVICE_ID_RCA 0xE100 +#define AC01_HOST_BRIDGE_DEVICE_ID_RCB 0xE110 +#define AC01_PCIE_BRIDGE_DEVICE_ID_RCA 0xE101 +#define AC01_PCIE_BRIDGE_DEVICE_ID_RCB 0xE111 + +#define MEMRDY_TIMEOUT 10 // 10 us +#define PIPE_CLOCK_TIMEOUT 20000 // 20,000 us +#define LTSSM_TRANSITION_TIMEOUT 100000 // 100 ms in total +#define EP_LINKUP_TIMEOUT (10 * 1000) // 10ms +#define LINK_WAIT_INTERVAL_US 50 + +#define PFA_MODE_ENABLE 0 +#define PFA_MODE_CLEAR 1 +#define PFA_MODE_READ 2 + +// +// Host Bridge registers +// +#define AC01_HOST_BRIDGE_RCA_DEV_MAP_REG 0x0 +#define AC01_HOST_BRIDGE_RCB_DEV_MAP_REG 0x4 +#define AC01_HOST_BRIDGE_VENDOR_DEVICE_ID_REG 0x10 + +// AC01_HOST_BRIDGE_RCA_DEV_MAP_REG +#define RCA_DEV_MAP_SET(dst, src) (((dst) & ~0x7) | (((UINT3= 2) (src)) & 0x7)) +#define RCA_DEV_MAP_GET(val) ((val) & 0x7) + +// AC01_HOST_BRIDGE_RCB_DEV_MAP_REG +#define RCB_DEV_MAP_LOW_SET(dst, src) (((dst) & ~0x7) | (((UINT3= 2) (src)) & 0x7)) +#define RCB_DEV_MAP_LOW_GET(val) ((val) & 0x7) + +#define RCB_DEV_MAP_HIGH_SET(dst, src) (((dst) & ~0x70) | (((UINT= 32) (src) << 4) & 0x70)) +#define RCB_DEV_MAP_HIGH_GET(val) (((val) & 0x7) >> 4) + +// AC01_HOST_BRIDGE_VENDOR_DEVICE_ID_REG +#define VENDOR_ID_SET(dst, src) (((dst) & ~0xFFFF) | (((UI= NT32) (src)) & 0xFFFF)) +#define VENDOR_ID_GET(val) ((val) & 0xFFFF) + +#define DEVICE_ID_SET(dst, src) (((dst) & ~0xFFFF0000) | (= ((UINT32) (src) << 16) & 0xFFFF0000)) +#define DEVICE_ID_GET(val) (((val) & 0xFFFF0000) >> 1= 6) + +// +// PCIe core registers +// +#define AC01_PCIE_CORE_LINK_CTRL_REG 0x0 +#define AC01_PCIE_CORE_LINK_STAT_REG 0x4 +#define AC01_PCIE_CORE_IRQ_SEL_REG 0xC +#define AC01_PCIE_CORE_HOT_PLUG_STAT_REG 0x28 +#define AC01_PCIE_CORE_IRQ_ENABLE_REG 0x30 +#define AC01_PCIE_CORE_IRQ_EVENT_STAT_REG 0x38 +#define AC01_PCIE_CORE_BLOCK_EVENT_STAT_REG 0x3C +#define AC01_PCIE_CORE_RESET_REG 0xC000 +#define AC01_PCIE_CORE_CLOCK_REG 0xC004 +#define AC01_PCIE_CORE_MEM_READY_REG 0xC104 +#define AC01_PCIE_CORE_RAM_SHUTDOWN_REG 0xC10C + +// AC01_PCIE_CORE_LINK_CTRL_REG +#define LTSSMENB_SET(dst, src) (((dst) & ~0x1) | (((UINT32) (= src)) & 0x1)) +#define HOLD_LINK_TRAINING 0 +#define START_LINK_TRAINING 1 +#define DEVICETYPE_SET(dst, src) (((dst) & ~0xF0) | (((UINT32) = (src) << 4) & 0xF0)) +#define DEVICETYPE_GET(val) (((val) & 0xF0) >> 4) + +// AC01_PCIE_CORE_LINK_STAT_REG +#define PHY_STATUS_MASK (1 << 2) +#define SMLH_LTSSM_STATE_MASK 0x3F00 +#define SMLH_LTSSM_STATE_GET(val) ((val & SMLH_LTSSM_STATE_MASK)= >> 8) +#define LTSSM_STATE_L0 0x11 +#define RDLH_SMLH_LINKUP_STATUS_GET(val) (val & 0x3) +#define PHY_STATUS_MASK_BIT 0x04 +#define SMLH_LINK_UP_MASK_BIT 0x02 +#define RDLH_LINK_UP_MASK_BIT 0x01 + +// AC01_PCIE_CORE_IRQ_SEL_REG +#define AER_SET(dst, src) (((dst) & ~0x1) | (((UINT32) (src)) & 0x1= )) +#define PME_SET(dst, src) (((dst) & ~0x2) | (((UINT32) (src) << 1) = & 0x2)) +#define LINKAUTOBW_SET(dst, src) (((dst) & ~0x4) | (((UINT32) (src) << 2) = & 0x4)) +#define BWMGMT_SET(dst, src) (((dst) & ~0x8) | (((UINT32) (src) << 3) = & 0x8)) +#define EQRQST_SET(dst, src) (((dst) & ~0x10) | (((UINT32) (src) << 4)= & 0x10)) +#define INTPIN_SET(dst, src) (((dst) & ~0xFF00) | (((UINT32) (src) << = 8) & 0xFF00)) +#define IRQ_INT_A 0x01 + +// AC01_PCIE_CORE_HOT_PLUG_STAT_REG +#define PWR_IND_SET(dst, src) (((dst) & ~0x1) | (((UINT32) (src)) & 0x1= )) +#define ATTEN_IND_SET(dst, src) (((dst) & ~0x2) | (((UINT32) (src) << 1) = & 0x2)) +#define PWR_CTRL_SET(dst, src) (((dst) & ~0x4) | (((UINT32) (src) << 2) = & 0x4)) +#define EML_CTRL_SET(dst, src) (((dst) & ~0x8) | (((UINT32) (src) << 3) = & 0x8)) + +// AC01_PCIE_CORE_BLOCK_EVENT_STAT_REG +#define LINKUP_MASK 0x1 + +// AC01_PCIE_CORE_RESET_REG +#define DWC_PCIE_SET(dst, src) (((dst) & ~0x1) | (((UINT32) (src)) & 0x1= )) +#define RESET_MASK 0x1 +#define ASSERT_RESET 0x1 + +// AC01_PCIE_CORE_CLOCK_REG +#define AXIPIPE_SET(dst, src) (((dst) & ~0x1) | (((UINT32) (src)) & 0x1= )) + +// AC01_PCIE_CORE_MEM_READY_REG +#define MEMORY_READY 0x1 + +// AC01_PCIE_CORE_RAM_SHUTDOWN_REG +#define SD_SET(dst, src) (((dst) & ~0x1) | (((UINT32) (src)) & 0x1= )) + +// +// AC01 PCIe Type 1 configuration registers +// +#define TYPE1_DEV_ID_VEND_ID_REG 0 +#define TYPE1_CLASS_CODE_REV_ID_REG 0x8 +#define TYPE1_CAP_PTR_REG 0x34 +#define SEC_LAT_TIMER_SUB_BUS_SEC_BUS_PRI_BUS_REG 0x18 +#define BRIDGE_CTRL_INT_PIN_INT_LINE_REG 0x3C +#define PCIE_CAPABILITY_BASE 0x70 +#define EXT_CAPABILITY_START_BASE 0x100 +#define AER_CAPABILITY_BASE 0x100 + +// TYPE1_DEV_ID_VEND_ID_REG +#define VENDOR_ID_SET(dst, src) (((dst) & ~0xFFFF) | (((UI= NT32) (src)) & 0xFFFF)) +#define DEVICE_ID_SET(dst, src) (((dst) & ~0xFFFF0000) | (= ((UINT32) (src) << 16) & 0xFFFF0000)) + +// TYPE1_CLASS_CODE_REV_ID_REG +#define BASE_CLASS_CODE_SET(dst, src) (((dst) & ~0xFF000000) | (= ((UINT32) (src) << 24) & 0xFF000000)) +#define DEFAULT_BASE_CLASS_CODE 6 +#define SUB_CLASS_CODE_SET(dst, src) (((dst) & ~0xFF0000) | ((= (UINT32) (src) << 16) & 0xFF0000)) +#define DEFAULT_SUB_CLASS_CODE 4 +#define PROGRAM_INTERFACE_SET(dst, src) (((dst) & ~0xFF00) | (((UI= NT32) (src) << 8) & 0xFF00)) +#define REVISION_ID_SET(dst, src) (((dst) & ~0xFF) | (((UINT= 32) (src)) & 0xFF)) +#define DEFAULT_REVISION_ID 4 + +// SEC_LAT_TIMER_SUB_BUS_SEC_BUS_PRI_BUS_REG +#define SUB_BUS_SET(dst, src) (((dst) & ~0xFF0000) | (((= UINT32) (src) << 16) & 0xFF0000)) +#define DEFAULT_SUB_BUS 0xFF +#define SEC_BUS_SET(dst, src) (((dst) & ~0xFF00) | (((UI= NT32) (src) << 8) & 0xFF00)) +#define PRIM_BUS_SET(dst, src) (((dst) & ~0xFF) | (((UINT= 32) (src)) & 0xFF)) +#define DEFAULT_PRIM_BUS 0x00 + +// BRIDGE_CTRL_INT_PIN_INT_LINE_REG +#define INT_PIN_SET(dst, src) (((dst) & ~0xFF00) | (((UI= NT32) (src) << 8) & 0xFF00)) + +// +// PCI Express Capability +// +#define PCIE_CAPABILITY_ID 0x10 +#define LINK_CAPABILITIES_REG 0xC +#define LINK_CONTROL_LINK_STATUS_REG 0x10 +#define SLOT_CAPABILITIES_REG 0x14 +#define DEVICE_CONTROL2_DEVICE_STATUS2_REG 0x28 +#define LINK_CAPABILITIES2_REG 0x2C +#define LINK_CONTROL2_LINK_STATUS2_REG 0x30 + +// LINK_CAPABILITIES_REG +#define CAP_ACTIVE_STATE_LINK_PM_SUPPORT_SET(dst, src) (((dst) & ~0xC00) |= (((UINT32)(src) << 10) & 0xC00)) +#define NO_ASPM_SUPPORTED 0x0 +#define L0S_SUPPORTED 0x1 +#define L1_SUPPORTED 0x2 +#define L0S_L1_SUPPORTED 0x3 +#define CAP_MAX_LINK_WIDTH_GET(val) ((val & 0x3F0) >> 4) +#define CAP_MAX_LINK_WIDTH_SET(dst, src) (((dst) & ~0x3F0) | (((UIN= T32) (src) << 4) & 0x3F0)) +#define CAP_MAX_LINK_WIDTH_X1 0x1 +#define CAP_MAX_LINK_WIDTH_X2 0x2 +#define CAP_MAX_LINK_WIDTH_X4 0x4 +#define CAP_MAX_LINK_WIDTH_X8 0x8 +#define CAP_MAX_LINK_WIDTH_X16 0x10 +#define CAP_MAX_LINK_SPEED_GET(val) ((val & 0xF)) +#define CAP_MAX_LINK_SPEED_SET(dst, src) (((dst) & ~0xF) | (((UINT3= 2) (src)) & 0xF)) +#define MAX_LINK_SPEED_25 0x1 +#define MAX_LINK_SPEED_50 0x2 +#define MAX_LINK_SPEED_80 0x3 +#define MAX_LINK_SPEED_160 0x4 +#define MAX_LINK_SPEED_320 0x5 + +// LINK_CONTROL_LINK_STATUS_REG +#define CAP_DLL_ACTIVE_GET(val) ((val & 0x20000000) >> 29) +#define CAP_SLOT_CLK_CONFIG_SET(dst, src) (((dst) & ~0x10000000) | (= ((UINT32) (src) << 28) & 0x10000000)) +#define CAP_NEGO_LINK_WIDTH_GET(val) ((val & 0x3F00000) >> 20) +#define CAP_LINK_SPEED_GET(val) ((val & 0xF0000) >> 16) +#define CAP_LINK_SPEED_SET(dst, src) (((dst) & ~0xF0000) | (((U= INT32) (src) << 16) & 0xF0000)) +#define CAP_LINK_SPEED_TO_VECTOR(val) (1 << ((val) - 1)) +#define CAP_EN_CLK_POWER_MAN_GET(val) ((val & 0x100) >> 8) +#define CAP_EN_CLK_POWER_MAN_SET(dst, src) (((dst) & ~0x100) | (((UIN= T32) (src) << 8) & 0x100)) +#define CAP_COMMON_CLK_SET(dst, src) (((dst) & ~0x40) | (((UINT= 32) (src) << 6) & 0x40)) +#define CAP_RETRAIN_LINK_SET(dst, src) (((dst) & ~0x20) | (((UINT= 32) (src) << 5) & 0x20)) +#define CAP_LINK_TRAINING_GET(val) ((val & 0x8000000) >> 27) +#define CAP_LINK_DISABLE_SET(dst, src) (((dst) & ~0x10) | (((UINT= 32)(src) << 4) & 0x10)) + +// SLOT_CAPABILITIES_REG +#define SLOT_HPC_SET(dst, src) (((dst) & ~0x40) | (((UINT= 32) (src) << 6) & 0x40)) +#define SLOT_CAP_SLOT_POWER_LIMIT_VALUE_SET(dst, src) \ + (((dst) & ~0x7F80) | (((UI= NT32)(src) << 7) & 0x7F80)) + +// DEVICE_CONTROL2_DEVICE_STATUS2_REG +#define CAP_CPL_TIMEOUT_VALUE_SET(dst, src) (((dst) & ~0xF) | (((UINT3= 2) (src)) & 0xF)) + +// LINK_CONTROL2_LINK_STATUS2_REG +#define CAP_TARGET_LINK_SPEED_SET(dst, src) (((dst) & ~0xF) | (((UINT3= 2) (src)) & 0xF)) + +// +// Advanced Error Reporting Capability +// +#define AER_CAPABILITY_ID 0x0001 +#define UNCORR_ERR_STATUS_OFF 0x04 +#define UNCORR_ERR_MASK_OFF 0x08 + +// UNCORR_ERR_MASK_OFF +#define CMPLT_TIMEOUT_ERR_MASK_SET(dst, src) (((dst) & ~0x4000) | (((UI= NT32) (src) << 14) & 0x4000)) +#define SDES_ERR_MASK_SET(dst, src) (((dst) & ~0x20) | (((UINT= 32)(src) << 5) & 0x20)) + +// +// Vendor specific RAS D.E.S Capability +// +#define RAS_DES_CAPABILITY_ID 0x000B +#define EVENT_COUNTER_CONTROL_REG 0x08 +#define EVENT_COUNTER_DATA_REG 0x0C + +// EVENT_COUNTER_CONTROL_REG +#define ECCR_GROUP_EVENT_SEL_SET(dst, src) (((dst) & ~0xFFF0000) | ((= (UINT32)(src) << 16) & 0xFFF0000)) +#define ECCR_GROUP_SEL_SET(dst, src) (((dst) & ~0xF000000) | ((= (UINT32)(src) << 24) & 0xF000000)) +#define ECCR_EVENT_SEL_SET(dst, src) (((dst) & ~0xFF0000) | (((= UINT32)(src) << 16) & 0xFF0000)) +#define ECCR_LANE_SEL_SET(dst, src) (((dst) & ~0xF00) | (((UIN= T32)(src) << 8) & 0xF00)) +#define ECCR_EVENT_COUNTER_ENABLE_SET(dst, src) (((dst) & ~0x1C) | (((UINT= 32)(src) << 2) & 0x1C)) +#define EVENT_COUNTER_ENABLE_NO_CHANGE 0x00 +#define EVENT_COUNTER_ENABLE_ALL_ON 0x07 +#define ECCR_EVENT_COUNTER_CLEAR_SET(dst, src) (((dst) & ~0x3) | (((UINT3= 2)(src)) & 0x3)) +#define EVENT_COUNTER_CLEAR_NO_CHANGE 0x00 +#define EVENT_COUNTER_CLEAR_ALL_CLEAR 0x03 + +// +// Secondary PCI Express Capability +// +#define SPCIE_CAPABILITY_ID 0x0019 +#define SPCIE_CAP_OFF_0C_REG 0x0C + +// SPCIE_CAP_OFF_0C_REG +#define DSP_TX_PRESET0_SET(dst,src) (((dst) & ~0xF) | (((UINT3= 2) (src)) & 0xF)) +#define DSP_TX_PRESET1_SET(dst,src) (((dst) & ~0xF0000) | (((U= INT32) (src) << 16) & 0xF0000)) +#define DEFAULT_GEN3_PRESET 0x05 + +// +// Physical Layer 16.0 GT/s Extended Capability +// +#define PL16G_CAPABILITY_ID 0x0026 +#define PL16G_STATUS_REG 0x0C +#define PL16G_CAP_OFF_20H_REG 0x20 + +// PL16G_STATUS_REG +#define PL16G_STATUS_EQ_CPL_GET(val) (val & 0x1) +#define PL16G_STATUS_EQ_CPL_P1_GET(val) ((val & 0x2) >> 1) +#define PL16G_STATUS_EQ_CPL_P2_GET(val) ((val & 0x4) >> 2) +#define PL16G_STATUS_EQ_CPL_P3_GET(val) ((val & 0x8) >> 3) + +// PL16G_CAP_OFF_20H_REG +#define DSP_16G_TX_PRESET0_SET(dst,src) (((dst) & ~0xF) | (((UINT3= 2) (src)) & 0xF)) +#define DSP_16G_TX_PRESET1_SET(dst,src) (((dst) & ~0xF00) | (((UIN= T32) (src) << 8) & 0xF00)) +#define DSP_16G_TX_PRESET2_SET(dst,src) (((dst) & ~0xF0000) | (((U= INT32) (src) << 16) & 0xF0000)) +#define DSP_16G_TX_PRESET3_SET(dst,src) (((dst) & ~0xF000000) | ((= (UINT32) (src) << 24) & 0xF000000)) +#define DSP_16G_RXTX_PRESET0_SET(dst,src) (((dst) & ~0xFF) | (((UINT= 32) (src)) & 0xFF)) +#define DSP_16G_RXTX_PRESET1_SET(dst,src) (((dst) & ~0xFF00) | (((UI= NT32) (src) << 8) & 0xFF00)) +#define DSP_16G_RXTX_PRESET2_SET(dst,src) (((dst) & ~0xFF0000) | (((= UINT32) (src) << 16) & 0xFF0000)) +#define DSP_16G_RXTX_PRESET3_SET(dst,src) (((dst) & ~0xFF000000) | (= ((UINT32) (src) << 24) & 0xFF000000)) +#define DEFAULT_GEN4_PRESET 0x57 + +// +// Port Logic +// +#define PORT_LINK_CTRL_OFF 0x710 +#define FILTER_MASK_2_OFF 0x720 +#define GEN2_CTRL_OFF 0x80C +#define GEN3_RELATED_OFF 0x890 +#define GEN3_EQ_CONTROL_OFF 0x8A8 +#define MISC_CONTROL_1_OFF 0x8BC +#define AMBA_ERROR_RESPONSE_DEFAULT_OFF 0x8D0 +#define AMBA_LINK_TIMEOUT_OFF 0x8D4 +#define AMBA_ORDERING_CTRL_OFF 0x8D8 +#define DTIM_CTRL0_OFF 0xAB0 +#define AUX_CLK_FREQ_OFF 0xB40 +#define CCIX_CTRL_OFF 0xC20 + +// PORT_LINK_CTRL_OFF +#define LINK_CAPABLE_SET(dst, src) (((dst) & ~0x3F0000) | (((= UINT32) (src) << 16) & 0x3F0000)) +#define LINK_CAPABLE_X1 0x1 +#define LINK_CAPABLE_X2 0x3 +#define LINK_CAPABLE_X4 0x7 +#define LINK_CAPABLE_X8 0xF +#define LINK_CAPABLE_X16 0x1F +#define LINK_CAPABLE_X32 0x3F +#define FAST_LINK_MODE_SET(dst, src) (((dst) & ~0x80) | (((UINT= 32) (src) << 7) & 0x80)) + +// FILTER_MASK_2_OFF +#define CX_FLT_MASK_VENMSG0_DROP_SET(dst, src) (((dst) & ~0x1) | (((UINT3= 2) (src)) & 0x1)) +#define CX_FLT_MASK_VENMSG1_DROP_SET(dst, src) (((dst) & ~0x2) | (((UINT3= 2) (src) << 1) & 0x2)) +#define CX_FLT_MASK_DABORT_4UCPL_SET(dst, src) (((dst) & ~0x4) | (((UINT3= 2) (src) << 2) & 0x4)) + +// GEN2_CTRL_OFF +#define NUM_OF_LANES_SET(dst, src) (((dst) & ~0x1F00) | (((UI= NT32) (src) << 8) & 0x1F00)) +#define NUM_OF_LANES_X2 0x2 +#define NUM_OF_LANES_X4 0x4 +#define NUM_OF_LANES_X8 0x8 +#define NUM_OF_LANES_X16 0x10 + +// GEN3_RELATED_OFF +#define RATE_SHADOW_SEL_SET(dst, src) (((dst) & ~0x3000000) | ((= (UINT32) (src) << 24) & 0x3000000)) +#define GEN3_DATA_RATE 0x00 +#define GEN4_DATA_RATE 0x01 +#define EQ_PHASE_2_3_SET(dst, src) (((dst) & ~0x200) | (((UIN= T32) (src) << 9) & 0x200)) +#define ENABLE_EQ_PHASE_2_3 0x00 +#define DISABLE_EQ_PHASE_2_3 0x01 +#define RXEQ_REGRDLESS_SET(dst, src) (((dst) & ~0x2000) | (((UI= NT32) (src) << 13) & 0x2000)) +#define ASSERT_RXEQ 0x01 + +// GEN3_EQ_CONTROL_OFF +#define GEN3_EQ_FB_MODE(dst, src) (((dst) & ~0xF) | ((UINT32= ) (src) & 0xF)) +#define FOM_METHOD 0x01 +#define GEN3_EQ_PRESET_VEC(dst, src) (((dst) & 0xFF0000FF) | ((= (UINT32) (src) << 8) & 0xFFFF00)) +#define EQ_DEFAULT_PRESET_VECTOR 0x370 +#define GEN3_EQ_INIT_EVAL(dst,src) (((dst) & ~0x1000000) | ((= (UINT32) (src) << 24) & 0x1000000)) +#define INCLUDE_INIT_FOM 0x01 + +// MISC_CONTROL_1_OFF +#define DBI_RO_WR_EN_SET(dst, src) (((dst) & ~0x1) | (((UINT3= 2) (src)) & 0x1)) +#define ENABLE_WR 0x01 +#define DISABLE_WR 0x00 + +// AMBA_ERROR_RESPONSE_DEFAULT_OFF +#define AMBA_ERROR_RESPONSE_CRS_SET(dst, src) (((dst) & ~0x18) | (((= UINT32) (src) << 3) & 0x18)) +#define AMBA_ERROR_RESPONSE_GLOBAL_SET(dst, src) (((dst) & ~0x1) | (((U= INT32) (src)) & 0x1)) + +// AMBA_LINK_TIMEOUT_OFF +#define LINK_TIMEOUT_PERIOD_DEFAULT_SET(dst, src) (((dst) & ~0xFF) | (((= UINT32) (src)) & 0xFF)) + +// AMBA_ORDERING_CTRL_OFF +#define AX_MSTR_ZEROLREAD_FW_SET(dst, src) (((dst) & ~0x80) | (((= UINT32) (src) << 7) & 0x80)) + +// DTIM_CTRL0_OFF +#define DTIM_CTRL0_ROOT_PORT_ID_SET(dst, src) (((dst) & ~0xFFFF) | (= ((UINT32) (src)) & 0xFFFF)) + +// AUX_CLK_FREQ_OFF +#define AUX_CLK_FREQ_SET(dst, src) (((dst) & ~0x1FF) | ((= (UINT32) (src)) & 0x1FF)) +#define AUX_CLK_500MHZ 500 + +#endif /* AC01_PCIE_CORE_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c b= /Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c new file mode 100644 index 000000000000..846e8593f57d --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c @@ -0,0 +1,1419 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "PcieCore.h" + +/** + Return the next extended capability base address + + @param RootComplex Pointer to AC01_ROOT_COMPLEX structure + @param PcieIndex PCIe controller index + @param IsRootComplex TRUE: Checking RootComplex configuration space + FALSE: Checking EP configuration space + @param ExtCapabilityId +**/ +PHYSICAL_ADDRESS +GetCapabilityBase ( + IN AC01_ROOT_COMPLEX *RootComplex, + IN UINT8 PcieIndex, + IN BOOLEAN IsRootComplex, + IN UINT16 ExtCapabilityId + ) +{ + BOOLEAN IsExtCapability =3D FALSE; + PHYSICAL_ADDRESS CfgBase; + UINT32 CapabilityId; + UINT32 NextCapabilityPtr; + UINT32 Val; + + if (IsRootComplex) { + CfgBase =3D RootComplex->MmcfgBase + (RootComplex->Pcie[PcieIndex].Dev= Num << DEV_SHIFT); + } else { + CfgBase =3D RootComplex->MmcfgBase + (RootComplex->Pcie[PcieIndex].Dev= Num << BUS_SHIFT); + } + + Val =3D MmioRead32 (CfgBase + TYPE1_CAP_PTR_REG); + NextCapabilityPtr =3D GET_LOW_8_BITS (Val); + + // Loop untill desired capability is found else return 0 + while (1) { + if ((NextCapabilityPtr & WORD_ALIGN_MASK) !=3D 0) { + // Not alignment, just return + return 0; + } + + Val =3D MmioRead32 (CfgBase + NextCapabilityPtr); + if (NextCapabilityPtr < EXT_CAPABILITY_START_BASE) { + CapabilityId =3D GET_LOW_8_BITS (Val); + } else { + CapabilityId =3D GET_LOW_16_BITS (Val); + } + + if (CapabilityId =3D=3D ExtCapabilityId) { + return (CfgBase + NextCapabilityPtr); + } + + if (NextCapabilityPtr < EXT_CAPABILITY_START_BASE) { + NextCapabilityPtr =3D GET_CAPABILITY_PTR (Val); + } else { + NextCapabilityPtr =3D GET_EXT_CAPABILITY_PTR (Val); + } + + if ((NextCapabilityPtr =3D=3D 0) && !IsExtCapability) { + IsExtCapability =3D TRUE; + NextCapabilityPtr =3D EXT_CAPABILITY_START_BASE; + } + + if ((NextCapabilityPtr =3D=3D 0) && IsExtCapability) { + return 0; + } + } +} + +/** + Configure equalization settings for Gen3 and Gen4 + + @param RootComplex Pointer to AC01_ROOT_COMPLEX structure + @param PcieIndex PCIe controller index +**/ +STATIC +VOID +ConfigureEqualization ( + IN AC01_ROOT_COMPLEX *RootComplex, + IN UINT8 PcieIndex + ) +{ + PHYSICAL_ADDRESS CfgBase; + PHYSICAL_ADDRESS Gen3RelatedAddr; + PHYSICAL_ADDRESS Gen3EqControlAddr; + UINT32 Val; + + CfgBase =3D RootComplex->MmcfgBase + (RootComplex->Pcie[PcieIndex].DevNu= m << DEV_SHIFT); + + // + // Gen3 and Gen4 EQ process use the same setting registers which are + // GEN3_RELATED_OFF and GEN3_EQ_CONTROL_OFF. Both are shadow registers + // and controlled by GEN3_RELATED_OFF[25:24]. + // + Gen3RelatedAddr =3D CfgBase + GEN3_RELATED_OFF; + Gen3EqControlAddr =3D CfgBase + GEN3_EQ_CONTROL_OFF; + + // + // Equalization setting for Gen3 + // + Val =3D MmioRead32 (Gen3RelatedAddr); + Val =3D RATE_SHADOW_SEL_SET (Val, GEN3_DATA_RATE); + MmioWrite32 (Gen3RelatedAddr, Val); + + Val =3D EQ_PHASE_2_3_SET (Val, ENABLE_EQ_PHASE_2_3); + Val =3D RXEQ_REGRDLESS_SET (Val, ASSERT_RXEQ); + MmioWrite32 (Gen3RelatedAddr, Val); + + Val =3D MmioRead32 (Gen3EqControlAddr); + Val =3D GEN3_EQ_FB_MODE (Val, FOM_METHOD); + Val =3D GEN3_EQ_PRESET_VEC (Val, EQ_DEFAULT_PRESET_VECTOR); + Val =3D GEN3_EQ_INIT_EVAL (Val, INCLUDE_INIT_FOM); + MmioWrite32 (Gen3EqControlAddr, Val); + + // + // Equalization setting for Gen4 + // + Val =3D MmioRead32 (Gen3RelatedAddr); + Val =3D RATE_SHADOW_SEL_SET (Val, GEN4_DATA_RATE); + MmioWrite32 (Gen3RelatedAddr, Val); + + Val =3D EQ_PHASE_2_3_SET (Val, ENABLE_EQ_PHASE_2_3); + Val =3D RXEQ_REGRDLESS_SET (Val, ASSERT_RXEQ); + MmioWrite32 (Gen3RelatedAddr, Val); + + Val =3D MmioRead32 (Gen3EqControlAddr); + Val =3D GEN3_EQ_FB_MODE (Val, FOM_METHOD); + Val =3D GEN3_EQ_PRESET_VEC (Val, EQ_DEFAULT_PRESET_VECTOR); + Val =3D GEN3_EQ_INIT_EVAL (Val, INCLUDE_INIT_FOM); + MmioWrite32 (Gen3EqControlAddr, Val); +} + +/** + Configure presets for Gen3 equalization + + @param RootComplex Pointer to AC01_ROOT_COMPLEX structure + @param PcieIndex PCIe controller index +**/ +STATIC +VOID +ConfigurePresetGen3 ( + IN AC01_ROOT_COMPLEX *RootComplex, + IN UINT8 PcieIndex + ) +{ + PHYSICAL_ADDRESS LaneEqControlAddr; + PHYSICAL_ADDRESS SpcieCapabilityBase; + UINT32 Idx; + UINT32 LinkWidth; + UINT32 Val; + + // Get the Secondary PCI Express Extended capability base address + SpcieCapabilityBase =3D GetCapabilityBase (RootComplex, PcieIndex, TRUE,= SPCIE_CAPABILITY_ID); + if (SpcieCapabilityBase =3D=3D 0) { + DEBUG (( + DEBUG_ERROR, + "PCIE%d.%d: Cannot get SPCIE capability address\n", + RootComplex->ID, + PcieIndex + )); + return; + } + + LinkWidth =3D RootComplex->Pcie[PcieIndex].MaxWidth; + + // Each register holds the Preset for 2 lanes + for (Idx =3D 0; Idx < (LinkWidth / 2); Idx++) { + LaneEqControlAddr =3D SpcieCapabilityBase + SPCIE_CAP_OFF_0C_REG + Idx= * sizeof (UINT32); + Val =3D MmioRead32 (LaneEqControlAddr); + Val =3D DSP_TX_PRESET0_SET (Val, DEFAULT_GEN3_PRESET); + Val =3D DSP_TX_PRESET1_SET (Val, DEFAULT_GEN3_PRESET); + MmioWrite32 (LaneEqControlAddr, Val); + } +} + +/** + Configure presets for Gen4 equalization + + @param RootComplex Pointer to AC01_ROOT_COMPLEX structure + @param PcieIndex PCIe controller index +**/ +STATIC +VOID +ConfigurePresetGen4 ( + IN AC01_ROOT_COMPLEX *RootComplex, + IN UINT8 PcieIndex + ) +{ + PHYSICAL_ADDRESS LaneEqControlAddr; + PHYSICAL_ADDRESS Pl16gCapabilityBase; + UINT32 Idx; + UINT32 LinkWidth; + UINT32 Val; + UINT8 Preset; + + // Get the Physical Layer 16.0 GT/s Extended capability base address + Pl16gCapabilityBase =3D GetCapabilityBase (RootComplex, PcieIndex, TRUE,= PL16G_CAPABILITY_ID); + if (Pl16gCapabilityBase =3D=3D 0) { + DEBUG (( + DEBUG_ERROR, + "PCIE%d.%d: Cannot get PL16G capability address\n", + RootComplex->ID, + PcieIndex + )); + return; + } + + if (RootComplex->PresetGen4[PcieIndex] =3D=3D PRESET_INVALID) { + Preset =3D DEFAULT_GEN4_PRESET; + } else { + Preset =3D RootComplex->PresetGen4[PcieIndex]; + } + + LinkWidth =3D RootComplex->Pcie[PcieIndex].MaxWidth; + + if (LinkWidth =3D=3D CAP_MAX_LINK_WIDTH_X2) { + LaneEqControlAddr =3D Pl16gCapabilityBase + PL16G_CAP_OFF_20H_REG; + Val =3D MmioRead32 (LaneEqControlAddr); + Val =3D DSP_16G_RXTX_PRESET0_SET (Val, Preset); + Val =3D DSP_16G_RXTX_PRESET1_SET (Val, Preset); + MmioWrite32 (LaneEqControlAddr, Val); + } else { + // Each register holds the Preset for 4 lanes + for (Idx =3D 0; Idx < (LinkWidth / 4); Idx++) { + LaneEqControlAddr =3D Pl16gCapabilityBase + PL16G_CAP_OFF_20H_REG + = Idx * sizeof (UINT32); + Val =3D MmioRead32 (LaneEqControlAddr); + Val =3D DSP_16G_RXTX_PRESET0_SET (Val, Preset); + Val =3D DSP_16G_RXTX_PRESET1_SET (Val, Preset); + Val =3D DSP_16G_RXTX_PRESET2_SET (Val, Preset); + Val =3D DSP_16G_RXTX_PRESET3_SET (Val, Preset); + MmioWrite32 (LaneEqControlAddr, Val); + } + } +} + +VOID +ProgramHostBridgeInfo ( + AC01_ROOT_COMPLEX *RootComplex + ) +{ + EFI_STATUS Status; + PHYSICAL_ADDRESS TargetAddress; + UINT32 Val; + + // Program Root Complex Bifurcation + if (RootComplex->Active) { + if (RootComplex->Type =3D=3D RootComplexTypeA) { + TargetAddress =3D RootComplex->HostBridgeBase + AC01_HOST_BRIDGE_RCA= _DEV_MAP_REG; + Status =3D MailboxMsgRegisterRead (RootComplex->Socket, TargetAddres= s, &Val); + if (!RETURN_ERROR (Status)) { + Val =3D RCA_DEV_MAP_SET (Val, RootComplex->DevMapLow); + MailboxMsgRegisterWrite (RootComplex->Socket, TargetAddress, Val); + } + } else { + TargetAddress =3D RootComplex->HostBridgeBase + AC01_HOST_BRIDGE_RCB= _DEV_MAP_REG; + Status =3D MailboxMsgRegisterRead (RootComplex->Socket, TargetAddres= s, &Val); + if (!RETURN_ERROR (Status)) { + Val =3D RCB_DEV_MAP_LOW_SET (Val, RootComplex->DevMapLow); + Val =3D RCB_DEV_MAP_HIGH_SET (Val, RootComplex->DevMapHigh); + MailboxMsgRegisterWrite (RootComplex->Socket, TargetAddress, Val); + } + } + } + + // Program Vendor ID and Device ID + TargetAddress =3D RootComplex->HostBridgeBase + AC01_HOST_BRIDGE_VENDOR_= DEVICE_ID_REG; + Status =3D MailboxMsgRegisterRead (RootComplex->Socket, TargetAddress, &= Val); + if (!RETURN_ERROR (Status)) { + Val =3D VENDOR_ID_SET (Val, AMPERE_PCIE_VENDOR_ID); + if (RootComplexTypeA =3D=3D RootComplex->Type) { + Val =3D DEVICE_ID_SET (Val, AC01_HOST_BRIDGE_DEVICE_ID_RCA); + } else { + Val =3D DEVICE_ID_SET (Val, AC01_HOST_BRIDGE_DEVICE_ID_RCB); + } + MailboxMsgRegisterWrite (RootComplex->Socket, TargetAddress, Val); + } +} + +VOID +ProgramRootPortInfo ( + AC01_ROOT_COMPLEX *RootComplex, + UINT32 PcieIndex + ) +{ + PHYSICAL_ADDRESS CfgBase; + PHYSICAL_ADDRESS TargetAddress; + UINT32 Val; + + CfgBase =3D RootComplex->MmcfgBase + (RootComplex->Pcie[PcieIndex].DevNu= m << DEV_SHIFT); + + // Program Class Code + TargetAddress =3D CfgBase + TYPE1_CLASS_CODE_REV_ID_REG; + Val =3D MmioRead32 (TargetAddress); + Val =3D REVISION_ID_SET (Val, DEFAULT_REVISION_ID); + Val =3D SUB_CLASS_CODE_SET (Val, DEFAULT_SUB_CLASS_CODE); + Val =3D BASE_CLASS_CODE_SET (Val, DEFAULT_BASE_CLASS_CODE); + MmioWrite32 (TargetAddress, Val); + + // Program Vendor ID and Device ID + TargetAddress =3D CfgBase + TYPE1_DEV_ID_VEND_ID_REG; + Val =3D MmioRead32 (TargetAddress); + Val =3D VENDOR_ID_SET (Val, AMPERE_PCIE_VENDOR_ID); + if (RootComplexTypeA =3D=3D RootComplex->Type) { + Val =3D DEVICE_ID_SET (Val, AC01_PCIE_BRIDGE_DEVICE_ID_RCA + PcieIndex= ); + } else { + Val =3D DEVICE_ID_SET (Val, AC01_PCIE_BRIDGE_DEVICE_ID_RCB + PcieIndex= ); + } + MmioWrite32 (TargetAddress, Val); +} + +VOID +ProgramLinkCapabilities ( + IN AC01_ROOT_COMPLEX *RootComplex, + IN UINT8 PcieIndex + ) +{ + PHYSICAL_ADDRESS CfgBase; + PHYSICAL_ADDRESS TargetAddress; + UINT32 Val; + UINT8 MaxWidth; + UINT8 MaxGen; + + CfgBase =3D RootComplex->MmcfgBase + (RootComplex->Pcie[PcieIndex].DevNu= m << DEV_SHIFT); + + MaxWidth =3D RootComplex->Pcie[PcieIndex].MaxWidth; + MaxGen =3D RootComplex->Pcie[PcieIndex].MaxGen; + + TargetAddress =3D CfgBase + PORT_LINK_CTRL_OFF; + Val =3D MmioRead32 (TargetAddress); + switch (MaxWidth) { + case LINK_WIDTH_X2: + Val =3D LINK_CAPABLE_SET (Val, LINK_CAPABLE_X2); + break; + + case LINK_WIDTH_X4: + Val =3D LINK_CAPABLE_SET (Val, LINK_CAPABLE_X4); + break; + + case LINK_WIDTH_X8: + Val =3D LINK_CAPABLE_SET (Val, LINK_CAPABLE_X8); + break; + + case LINK_WIDTH_X16: + default: + Val =3D LINK_CAPABLE_SET (Val, LINK_CAPABLE_X16); + break; + } + MmioWrite32 (TargetAddress, Val); + + TargetAddress =3D CfgBase + GEN2_CTRL_OFF; + Val =3D MmioRead32 (TargetAddress); + switch (MaxWidth) { + case LINK_WIDTH_X2: + Val =3D NUM_OF_LANES_SET (Val, NUM_OF_LANES_X2); + break; + + case LINK_WIDTH_X4: + Val =3D NUM_OF_LANES_SET (Val, NUM_OF_LANES_X4); + break; + + case LINK_WIDTH_X8: + Val =3D NUM_OF_LANES_SET (Val, NUM_OF_LANES_X8); + break; + + case LINK_WIDTH_X16: + default: + Val =3D NUM_OF_LANES_SET (Val, NUM_OF_LANES_X16); + break; + } + MmioWrite32 (TargetAddress, Val); + + TargetAddress =3D CfgBase + PCIE_CAPABILITY_BASE + LINK_CAPABILITIES_REG; + Val =3D MmioRead32 (TargetAddress); + switch (MaxWidth) { + case LINK_WIDTH_X2: + Val =3D CAP_MAX_LINK_WIDTH_SET (Val, CAP_MAX_LINK_WIDTH_X2); + break; + + case LINK_WIDTH_X4: + Val =3D CAP_MAX_LINK_WIDTH_SET (Val, CAP_MAX_LINK_WIDTH_X4); + break; + + case LINK_WIDTH_X8: + Val =3D CAP_MAX_LINK_WIDTH_SET (Val, CAP_MAX_LINK_WIDTH_X8); + break; + + case LINK_WIDTH_X16: + default: + Val =3D CAP_MAX_LINK_WIDTH_SET (Val, CAP_MAX_LINK_WIDTH_X16); + break; + } + + switch (MaxGen) { + case LINK_SPEED_GEN1: + Val =3D CAP_MAX_LINK_SPEED_SET (Val, MAX_LINK_SPEED_25); + break; + + case LINK_SPEED_GEN2: + Val =3D CAP_MAX_LINK_SPEED_SET (Val, MAX_LINK_SPEED_50); + break; + + case LINK_SPEED_GEN3: + Val =3D CAP_MAX_LINK_SPEED_SET (Val, MAX_LINK_SPEED_80); + break; + + default: + Val =3D CAP_MAX_LINK_SPEED_SET (Val, MAX_LINK_SPEED_160); + break; + } + // Enable ASPM Capability + Val =3D CAP_ACTIVE_STATE_LINK_PM_SUPPORT_SET (Val, L0S_L1_SUPPORTED); + MmioWrite32 (TargetAddress, Val); + + TargetAddress =3D CfgBase + PCIE_CAPABILITY_BASE + LINK_CONTROL2_LINK_ST= ATUS2_REG; + Val =3D MmioRead32 (TargetAddress); + switch (MaxGen) { + case LINK_SPEED_GEN1: + Val =3D CAP_TARGET_LINK_SPEED_SET (Val, MAX_LINK_SPEED_25); + break; + + case LINK_SPEED_GEN2: + Val =3D CAP_TARGET_LINK_SPEED_SET (Val, MAX_LINK_SPEED_50); + break; + + case LINK_SPEED_GEN3: + Val =3D CAP_TARGET_LINK_SPEED_SET (Val, MAX_LINK_SPEED_80); + break; + + default: + Val =3D CAP_TARGET_LINK_SPEED_SET (Val, MAX_LINK_SPEED_160); + break; + } + MmioWrite32 (TargetAddress, Val); +} + +VOID +DisableCompletionTimeOut ( + IN AC01_ROOT_COMPLEX *RootComplex, + IN UINT8 PcieIndex, + IN BOOLEAN IsMask + ) +{ + PHYSICAL_ADDRESS CfgBase; + PHYSICAL_ADDRESS TargetAddress; + UINT32 Val; + + CfgBase =3D RootComplex->MmcfgBase + (RootComplex->Pcie[PcieIndex].DevNu= m << DEV_SHIFT); + + TargetAddress =3D CfgBase + AER_CAPABILITY_BASE + UNCORR_ERR_MASK_OFF; + Val =3D MmioRead32 (TargetAddress); + Val =3D CMPLT_TIMEOUT_ERR_MASK_SET (Val, IsMask ? 1 : 0); + MmioWrite32 (TargetAddress, Val); +} + +BOOLEAN +EnableItsMemory ( + AC01_ROOT_COMPLEX *RootComplex, + UINT32 PcieIndex + ) +{ + PHYSICAL_ADDRESS CsrBase; + PHYSICAL_ADDRESS TargetAddress; + UINT32 TimeOut; + UINT32 Val; + + CsrBase =3D RootComplex->Pcie[PcieIndex].CsrBase; + + // Clear memory shutdown + TargetAddress =3D CsrBase + AC01_PCIE_CORE_RAM_SHUTDOWN_REG; + Val =3D MmioRead32 (TargetAddress); + Val =3D SD_SET (Val, 0); + MmioWrite32 (TargetAddress, Val); + + // Poll till ITS Memory is ready + TimeOut =3D MEMRDY_TIMEOUT; + do { + Val =3D MmioRead32 (CsrBase + AC01_PCIE_CORE_MEM_READY_REG); + if (Val & MEMORY_READY) { + return TRUE; + } + + TimeOut--; + MicroSecondDelay (1); + } while (TimeOut > 0); + + return FALSE; +} + +BOOLEAN +EnableAxiPipeClock ( + AC01_ROOT_COMPLEX *RootComplex, + UINT32 PcieIndex + ) +{ + PHYSICAL_ADDRESS CsrBase; + PHYSICAL_ADDRESS TargetAddress; + UINT32 TimeOut; + UINT32 Val; + + CsrBase =3D RootComplex->Pcie[PcieIndex].CsrBase; + + // Enable subsystem clock and release reset + TargetAddress =3D CsrBase + AC01_PCIE_CORE_CLOCK_REG; + Val =3D MmioRead32 (TargetAddress); + Val =3D AXIPIPE_SET (Val, 1); + MmioWrite32 (TargetAddress, Val); + + TargetAddress =3D CsrBase + AC01_PCIE_CORE_RESET_REG; + Val =3D MmioRead32 (TargetAddress); + Val =3D DWC_PCIE_SET (Val, 0); + MmioWrite32 (TargetAddress, Val); + + // + // Controller does not provide any indicator for reset released. + // Must wait at least 1us as per EAS. + // + MicroSecondDelay (1); + + // Poll till PIPE clock is stable + TimeOut =3D PIPE_CLOCK_TIMEOUT; + do { + Val =3D MmioRead32 (CsrBase + AC01_PCIE_CORE_LINK_STAT_REG); + if (!(Val & PHY_STATUS_MASK)) { + return TRUE; + } + + TimeOut--; + MicroSecondDelay (1); + } while (TimeOut > 0); + + return FALSE; +} + +VOID +SetLinkTimeout ( + AC01_ROOT_COMPLEX *RootComplex, + UINT32 PcieIndex, + UINTN Timeout + ) +{ + PHYSICAL_ADDRESS TargetAddress; + UINT32 Val; + + TargetAddress =3D RootComplex->MmcfgBase + (RootComplex->Pcie[PcieIndex]= .DevNum << DEV_SHIFT) + + AMBA_LINK_TIMEOUT_OFF; + + Val =3D MmioRead32 (TargetAddress); + Val =3D LINK_TIMEOUT_PERIOD_DEFAULT_SET (Val, Timeout); + MmioWrite32 (TargetAddress, Val); +} + +VOID +StartLinkTraining ( + AC01_ROOT_COMPLEX *RootComplex, + UINT32 PcieIndex, + BOOLEAN StartLink + ) +{ + PHYSICAL_ADDRESS TargetAddress; + UINT32 Val; + + TargetAddress =3D RootComplex->Pcie[PcieIndex].CsrBase + AC01_PCIE_CORE_= LINK_CTRL_REG; + + Val =3D MmioRead32 (TargetAddress); + Val =3D LTSSMENB_SET (Val, StartLink ? START_LINK_TRAINING : HOLD_LINK_T= RAINING); + MmioWrite32 (TargetAddress, Val); +} + +VOID +EnableDbiAccess ( + AC01_ROOT_COMPLEX *RootComplex, + UINT32 PcieIndex, + BOOLEAN EnableDbi + ) +{ + PHYSICAL_ADDRESS TargetAddress; + UINT32 Val; + + TargetAddress =3D RootComplex->MmcfgBase + (RootComplex->Pcie[PcieIndex]= .DevNum << DEV_SHIFT) + + MISC_CONTROL_1_OFF; + + Val =3D MmioRead32 (TargetAddress); + Val =3D DBI_RO_WR_EN_SET (Val, EnableDbi ? ENABLE_WR : DISABLE_WR); + MmioWrite32 (TargetAddress, Val); +} + +/** + Setup and initialize the AC01 PCIe Root Complex and underneath PCIe cont= rollers + + @param RootComplex Pointer to Root Complex structure + @param ReInit Re-init status + @param ReInitPcieIndex PCIe controller index + + @retval RETURN_SUCCESS The Root Complex has been initialized succe= ssfully. + @retval RETURN_DEVICE_ERROR PHY, Memory or PIPE is not ready. +**/ +RETURN_STATUS +Ac01PcieCoreSetupRC ( + IN AC01_ROOT_COMPLEX *RootComplex, + IN BOOLEAN ReInit, + IN UINT8 ReInitPcieIndex + ) +{ + PHYSICAL_ADDRESS CfgBase; + PHYSICAL_ADDRESS CsrBase; + PHYSICAL_ADDRESS TargetAddress; + RETURN_STATUS Status; + UINT32 Val; + UINT8 PcieIndex; + + DEBUG ((DEBUG_INFO, "Initializing Socket%d RootComplex%d\n", RootComplex= ->Socket, RootComplex->ID)); + + ProgramHostBridgeInfo (RootComplex); + + if (!ReInit) { + Status =3D PciePhyInit (RootComplex->SerdesBase); + if (RETURN_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to initialize the PCIe PHY\n", __FU= NCTION__)); + return RETURN_DEVICE_ERROR; + } + } + + // Setup each controller + for (PcieIndex =3D 0; PcieIndex < RootComplex->MaxPcieController; PcieIn= dex++) { + + if (ReInit) { + PcieIndex =3D ReInitPcieIndex; + } + + if (!RootComplex->Pcie[PcieIndex].Active) { + continue; + } + + DEBUG ((DEBUG_INFO, "Initializing Controller %d\n", PcieIndex)); + + CsrBase =3D RootComplex->Pcie[PcieIndex].CsrBase; + CfgBase =3D RootComplex->MmcfgBase + (RootComplex->Pcie[PcieIndex].Dev= Num << DEV_SHIFT); + + // Put Controller into reset if not in reset already + TargetAddress =3D CsrBase + AC01_PCIE_CORE_RESET_REG; + Val =3D MmioRead32 (TargetAddress); + if (!(Val & RESET_MASK)) { + Val =3D DWC_PCIE_SET (Val, ASSERT_RESET); + MmioWrite32 (TargetAddress, Val); + + // Delay 50ms to ensure controller finish its reset + MicroSecondDelay (50000); + } + + if (!EnableItsMemory (RootComplex, PcieIndex)) { + DEBUG ((DEBUG_ERROR, "- Pcie[%d] - ITS Memory is not ready\n", PcieI= ndex)); + return RETURN_DEVICE_ERROR; + } + + // Hold link training + StartLinkTraining (RootComplex, PcieIndex, FALSE); + + if (!EnableAxiPipeClock (RootComplex, PcieIndex)) { + DEBUG ((DEBUG_ERROR, "- Pcie[%d] - PIPE clock is not stable\n", Pcie= Index)); + return RETURN_DEVICE_ERROR; + } + + // Start PERST pulse + BoardPcieAssertPerst (RootComplex, PcieIndex, TRUE); + + // Allow programming to config space + EnableDbiAccess (RootComplex, PcieIndex, TRUE); + + // Program the power limit + TargetAddress =3D CfgBase + PCIE_CAPABILITY_BASE + SLOT_CAPABILITIES_R= EG; + Val =3D MmioRead32 (TargetAddress); + Val =3D SLOT_CAP_SLOT_POWER_LIMIT_VALUE_SET (Val, SLOT_POWER_LIMIT_75W= ); + MmioWrite32 (TargetAddress, Val); + + // Program DTI for ATS support + TargetAddress =3D CfgBase + DTIM_CTRL0_OFF; + Val =3D MmioRead32 (TargetAddress); + Val =3D DTIM_CTRL0_ROOT_PORT_ID_SET (Val, 0); + MmioWrite32 (TargetAddress, Val); + + // + // Program number of lanes used + // - Reprogram LINK_CAPABLE of PORT_LINK_CTRL_OFF + // - Reprogram NUM_OF_LANES of GEN2_CTRL_OFF + // - Reprogram CAP_MAX_LINK_WIDTH of LINK_CAPABILITIES_REG + // + ProgramLinkCapabilities (RootComplex, PcieIndex); + + // Set Zero byte request handling + TargetAddress =3D CfgBase + FILTER_MASK_2_OFF; + Val =3D MmioRead32 (TargetAddress); + Val =3D CX_FLT_MASK_VENMSG0_DROP_SET (Val, 0); + Val =3D CX_FLT_MASK_VENMSG1_DROP_SET (Val, 0); + Val =3D CX_FLT_MASK_DABORT_4UCPL_SET (Val, 0); + MmioWrite32 (TargetAddress, Val); + + TargetAddress =3D CfgBase + AMBA_ORDERING_CTRL_OFF; + Val =3D MmioRead32 (TargetAddress); + Val =3D AX_MSTR_ZEROLREAD_FW_SET (Val, 0); + MmioWrite32 (TargetAddress, Val); + + // + // Set Completion with CRS handling for CFG Request + // Set Completion with CA/UR handling non-CFG Request + // + TargetAddress =3D CfgBase + AMBA_ERROR_RESPONSE_DEFAULT_OFF; + Val =3D MmioRead32 (TargetAddress); + // 0x2: OKAY with FFFF_0001 and FFFF_FFFF + Val =3D AMBA_ERROR_RESPONSE_CRS_SET (Val, 0x2); + MmioWrite32 (TargetAddress, Val); + + // Set Legacy PCIE interrupt map to INTA + TargetAddress =3D CfgBase + BRIDGE_CTRL_INT_PIN_INT_LINE_REG; + Val =3D MmioRead32 (TargetAddress); + Val =3D INT_PIN_SET (Val, IRQ_INT_A); + MmioWrite32 (TargetAddress, Val); + + TargetAddress =3D CsrBase + AC01_PCIE_CORE_IRQ_SEL_REG; + Val =3D MmioRead32 (TargetAddress); + Val =3D INTPIN_SET (Val, IRQ_INT_A); + MmioWrite32 (TargetAddress, Val); + + if (RootComplex->Pcie[PcieIndex].MaxGen >=3D LINK_SPEED_GEN2) { + ConfigureEqualization (RootComplex, PcieIndex); + if (RootComplex->Pcie[PcieIndex].MaxGen >=3D LINK_SPEED_GEN3) { + ConfigurePresetGen3 (RootComplex, PcieIndex); + if (RootComplex->Pcie[PcieIndex].MaxGen >=3D LINK_SPEED_GEN4) { + ConfigurePresetGen4 (RootComplex, PcieIndex); + } + } + } + + // Link timeout after 1ms + SetLinkTimeout (RootComplex, PcieIndex, 1); + + DisableCompletionTimeOut (RootComplex, PcieIndex, TRUE); + + ProgramRootPortInfo (RootComplex, PcieIndex); + + // Enable common clock for downstream + TargetAddress =3D CfgBase + PCIE_CAPABILITY_BASE + LINK_CONTROL_LINK_S= TATUS_REG; + Val =3D MmioRead32 (TargetAddress); + Val =3D CAP_SLOT_CLK_CONFIG_SET (Val, 1); + Val =3D CAP_COMMON_CLK_SET (Val, 1); + MmioWrite32 (TargetAddress, Val); + + // Match aux_clk to system + TargetAddress =3D CfgBase + AUX_CLK_FREQ_OFF; + Val =3D MmioRead32 (TargetAddress); + Val =3D AUX_CLK_FREQ_SET (Val, AUX_CLK_500MHZ); + MmioWrite32 (TargetAddress, Val); + + // Assert PERST low to reset endpoint + BoardPcieAssertPerst (RootComplex, PcieIndex, FALSE); + + // Start link training + StartLinkTraining (RootComplex, PcieIndex, TRUE); + + // Complete the PERST pulse + BoardPcieAssertPerst (RootComplex, PcieIndex, TRUE); + + // Lock programming of config space + EnableDbiAccess (RootComplex, PcieIndex, FALSE); + + if (ReInit) { + return RETURN_SUCCESS; + } + } + + return RETURN_SUCCESS; +} + +BOOLEAN +PcieLinkUpCheck ( + IN AC01_PCIE_CONTROLLER *Pcie + ) +{ + PHYSICAL_ADDRESS CsrBase; + UINT32 BlockEvent; + UINT32 LinkStat; + + CsrBase =3D Pcie->CsrBase; + + // Check if card present + // smlh_ltssm_state[13:8] =3D 0 + // phy_status[2] =3D 0 + // smlh_link_up[1] =3D 0 + // rdlh_link_up[0] =3D 0 + LinkStat =3D MmioRead32 (CsrBase + AC01_PCIE_CORE_LINK_STAT_REG); + LinkStat =3D LinkStat & (SMLH_LTSSM_STATE_MASK | PHY_STATUS_MASK_BIT | + SMLH_LINK_UP_MASK_BIT | RDLH_LINK_UP_MASK_BIT); + if (LinkStat =3D=3D 0) { + return FALSE; + } + + BlockEvent =3D MmioRead32 (CsrBase + AC01_PCIE_CORE_BLOCK_EVENT_STAT_REG= ); + LinkStat =3D MmioRead32 (CsrBase + AC01_PCIE_CORE_LINK_STAT_REG); + + if (((BlockEvent & LINKUP_MASK) !=3D 0) + && (SMLH_LTSSM_STATE_GET(LinkStat) =3D=3D LTSSM_STATE_L0)) { + return TRUE; + } + + return FALSE; +} + +/** + Callback function when the Host Bridge enumeration end. + + @param RootComplex Pointer to the Root Complex structure +**/ +VOID +Ac01PcieCoreEndEnumeration ( + IN AC01_ROOT_COMPLEX *RootComplex + ) +{ + + PHYSICAL_ADDRESS TargetAddress; + UINT32 PcieIndex; + UINT32 Val; + + if (RootComplex =3D=3D NULL || !RootComplex->Active) { + return; + } + + // Clear uncorrectable error during enumuration phase. Mainly completion= timeout. + for (PcieIndex =3D 0; PcieIndex < RootComplex->MaxPcieController; PcieIn= dex++) { + if (!RootComplex->Pcie[PcieIndex].Active) { + continue; + } + + if (!PcieLinkUpCheck(&RootComplex->Pcie[PcieIndex])) { + // If link down/disabled after enumeration, disable completed time o= ut + DisableCompletionTimeOut (RootComplex, PcieIndex, TRUE); + } + + // Clear all errors + TargetAddress =3D RootComplex->MmcfgBase + ((PcieIndex + 1) << DEV_SHI= FT) \ + + AER_CAPABILITY_BASE + UNCORR_ERR_STATUS_OFF; + Val =3D MmioRead32 (TargetAddress); + if (Val !=3D 0) { + // Clear error by writting + MmioWrite32 (TargetAddress, Val); + } + } +} + +/** + Comparing current link status with the max capabilities of the link + + @param RootComplex Pointer to AC01_ROOT_COMPLEX structure + @param PcieIndex PCIe controller index + @param EpMaxWidth EP max link width + @param EpMaxGen EP max link speed + + @retval -1: Link status do not match with link max capabili= ties + 1: Link capabilites are invalid + 0: Link status are correct +**/ +INT32 +Ac01PcieCoreLinkCheck ( + IN AC01_ROOT_COMPLEX *RootComplex, + IN UINT8 PcieIndex, + IN UINT8 EpMaxWidth, + IN UINT8 EpMaxGen + ) +{ + PHYSICAL_ADDRESS CsrBase, CfgBase; + UINT32 Val, LinkStat; + UINT32 MaxWidth, MaxGen; + + CsrBase =3D RootComplex->Pcie[PcieIndex].CsrBase; + CfgBase =3D RootComplex->MmcfgBase + (RootComplex->Pcie[PcieIndex].DevNu= m << DEV_SHIFT); + + Val =3D MmioRead32 (CfgBase + PCIE_CAPABILITY_BASE + LINK_CAPABILITIES_R= EG); + if ((CAP_MAX_LINK_WIDTH_GET (Val) =3D=3D 0) || + (CAP_MAX_LINK_SPEED_GET (Val) =3D=3D 0)) { + DEBUG ((DEBUG_INFO, "\tPCIE%d.%d: Wrong RootComplex capabilities\n", R= ootComplex->ID, PcieIndex)); + return LINK_CHECK_WRONG_PARAMETER; + } + + if ((EpMaxWidth =3D=3D 0) || (EpMaxGen =3D=3D 0)) { + DEBUG ((DEBUG_INFO, "\tPCIE%d.%d: Wrong EP capabilities\n", RootComple= x->ID, PcieIndex)); + return LINK_CHECK_FAILED; + } + + // Compare RootComplex and EP capabilities + if (CAP_MAX_LINK_WIDTH_GET (Val) > EpMaxWidth) { + MaxWidth =3D EpMaxWidth; + } else { + MaxWidth =3D CAP_MAX_LINK_WIDTH_GET (Val); + } + + // Compare RootComplex and EP capabilities + if (CAP_MAX_LINK_SPEED_GET (Val) > EpMaxGen) { + MaxGen =3D EpMaxGen; + } else { + MaxGen =3D CAP_MAX_LINK_SPEED_GET (Val); + } + + LinkStat =3D MmioRead32 (CsrBase + AC01_PCIE_CORE_LINK_STAT_REG); + Val =3D MmioRead32 (CfgBase + PCIE_CAPABILITY_BASE + LINK_CONTROL_LINK_S= TATUS_REG); + DEBUG (( + DEBUG_INFO, + "PCIE%d.%d: Link MaxWidth %d MaxGen %d, AC01_PCIE_CORE_LINK_STAT_REG 0= x%x", + RootComplex->ID, + PcieIndex, + MaxWidth, + MaxGen, + LinkStat + )); + + // Checking all conditions of the link + // If one of them is not sastified, return link up fail + if ((CAP_NEGO_LINK_WIDTH_GET (Val) !=3D MaxWidth) || + (CAP_LINK_SPEED_GET (Val) !=3D MaxGen) || + (RDLH_SMLH_LINKUP_STATUS_GET (LinkStat) !=3D (SMLH_LINK_UP_MASK_BIT = | RDLH_LINK_UP_MASK_BIT))) + { + DEBUG ((DEBUG_INFO, "\tLinkCheck FAILED\n")); + return LINK_CHECK_FAILED; + } + + DEBUG ((DEBUG_INFO, "\tLinkCheck SUCCESS\n")); + return LINK_CHECK_SUCCESS; +} + +INT32 +PFACounterRead ( + IN AC01_ROOT_COMPLEX *RootComplex, + IN UINT8 PcieIndex, + IN UINT64 RasDesCapabilityBase + ) +{ + INT32 Ret =3D LINK_CHECK_SUCCESS; + UINT32 Val; + UINT8 ErrCode, ErrGrpNum; + + UINT32 ErrCtrlCfg[] =3D { + 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, 0x008, 0x009, = 0x00A, // Per Lane + 0x105, 0x106, 0x107, 0x108, 0x109, 0x10A, + 0x200, 0x201, 0x202, 0x203, 0x204, 0x205, 0x206, 0x207, + 0x300, 0x301, 0x302, 0x303, 0x304, 0x305, + 0x400, 0x401, = // Per Lane + 0x500, 0x501, 0x502, 0x503, 0x504, 0x505, 0x506, 0x507, 0x508, 0x509, = 0x50A, 0x50B, 0x50C, 0x50D + }; + + for (ErrCode =3D 0; ErrCode < ARRAY_SIZE (ErrCtrlCfg); ErrCode++) { + ErrGrpNum =3D GET_HIGH_8_BITS (ErrCtrlCfg[ErrCode]); + // Skipping per lane group + // Checking common lane group because AER error are included in common= group only + if ((ErrGrpNum !=3D 0) && (ErrGrpNum !=3D 4)) { + Val =3D MmioRead32 (RasDesCapabilityBase + EVENT_COUNTER_CONTROL_REG= ); + if (RootComplex->Type =3D=3D RootComplexTypeA) { + // RootComplexTypeA - 4 PCIe controller per port, 1 controller in = charge of 4 lanes + Val =3D ECCR_LANE_SEL_SET (Val, PcieIndex * 4); + } else { + // RootComplexTypeB - 8 PCIe controller per port, 1 controller in = charge of 2 lanes + Val =3D ECCR_LANE_SEL_SET (Val, PcieIndex * 2); + } + Val =3D ECCR_GROUP_EVENT_SEL_SET (Val, ErrCtrlCfg[ErrCode]); + MmioWrite32 (RasDesCapabilityBase + EVENT_COUNTER_CONTROL_REG, Val); + + // After setting Counter Control reg + // This delay just to make sure Counter Data reg is update with new = value + MicroSecondDelay (1); + Val =3D MmioRead32 (RasDesCapabilityBase + EVENT_COUNTER_DATA_REG); + if (Val !=3D 0) { + Ret =3D LINK_CHECK_FAILED; + DEBUG (( + DEBUG_ERROR, + "\tSocket%d RootComplex%d RP%d \t%s: %d \tGROUP:%d-EVENT:%d\n", + RootComplex->Socket, + RootComplex->ID, + PcieIndex, + Val, + ErrGrpNum, + GET_LOW_8_BITS (ErrCtrlCfg[ErrCode]) + )); + } + } + } + + return Ret; +} + +/** + Handle Predictive Failure Analysis command + + @param RootComplex Pointer to Root Complex structure + @param PcieIndex PCIe controller index + @param PFAMode The PFA mode + + @retval The link status +**/ +INT32 +Ac01PFACommand ( + IN AC01_ROOT_COMPLEX *RootComplex, + IN UINT8 PcieIndex, + IN UINT8 PFAMode + ) +{ + PHYSICAL_ADDRESS CfgBase; + PHYSICAL_ADDRESS RasDesCapabilityBase; + PHYSICAL_ADDRESS TargetAddress; + INT32 Ret =3D LINK_CHECK_SUCCESS; + UINT32 Val; + + CfgBase =3D RootComplex->MmcfgBase + (RootComplex->Pcie[PcieIndex].DevNu= m << DEV_SHIFT); + + // Allow programming to config space + EnableDbiAccess (RootComplex, PcieIndex, TRUE); + + // Get the RAS D.E.S. capability base address + RasDesCapabilityBase =3D GetCapabilityBase (RootComplex, PcieIndex, TRUE= , RAS_DES_CAPABILITY_ID); + if (RasDesCapabilityBase =3D=3D 0) { + DEBUG ((DEBUG_INFO, "PCIE%d.%d: Cannot get RAS DES capability address\= n", RootComplex->ID, PcieIndex)); + return LINK_CHECK_WRONG_PARAMETER; + } + + TargetAddress =3D RasDesCapabilityBase + EVENT_COUNTER_CONTROL_REG; + + switch (PFAMode) { + case PFA_MODE_ENABLE: + Val =3D MmioRead32 (TargetAddress); + Val =3D ECCR_EVENT_COUNTER_ENABLE_SET (Val, EVENT_COUNTER_ENABLE_ALL_O= N); + Val =3D ECCR_EVENT_COUNTER_CLEAR_SET (Val, EVENT_COUNTER_CLEAR_NO_CHAN= GE); + MmioWrite32 (TargetAddress, Val); + break; + + case PFA_MODE_CLEAR: + Val =3D MmioRead32 (TargetAddress); + Val =3D ECCR_EVENT_COUNTER_ENABLE_SET (Val, EVENT_COUNTER_ENABLE_NO_CH= ANGE); + Val =3D ECCR_EVENT_COUNTER_CLEAR_SET (Val, EVENT_COUNTER_CLEAR_ALL_CLE= AR); + MmioWrite32 (TargetAddress, Val); + break; + + case PFA_MODE_READ: + Ret =3D PFACounterRead (RootComplex, PcieIndex, RasDesCapabilityBase); + break; + + default: + DEBUG ((DEBUG_ERROR, "%a: Invalid PFA mode\n")); + } + + // Disable programming to config space + EnableDbiAccess (RootComplex, PcieIndex, FALSE); + + return Ret; +} + +UINT32 +EndpointCfgReady ( + IN AC01_ROOT_COMPLEX *RootComplex, + IN UINT8 PcieIndex + ) +{ + PHYSICAL_ADDRESS CfgBase; + UINT32 TimeOut; + UINT32 Val; + + CfgBase =3D RootComplex->MmcfgBase + (RootComplex->Pcie[PcieIndex].DevNu= m << BUS_SHIFT); + + // Loop read CfgBase value until got valid value or + // reach to timeout EP_LINKUP_TIMEOUT (or more depend on card) + TimeOut =3D EP_LINKUP_TIMEOUT; + do { + Val =3D MmioRead32 (CfgBase); + if (Val !=3D 0xFFFF0001 && Val !=3D 0xFFFFFFFF) { + return TRUE; + } + + TimeOut -=3D LINK_WAIT_INTERVAL_US; + MicroSecondDelay (LINK_WAIT_INTERVAL_US); + } while (TimeOut > 0); + + return FALSE; +} + +/** + Get link capabilities link width and speed of endpoint + + @param RootComplex[in] Pointer to AC01_ROOT_COMPLEX structure + @param PcieIndex[in] PCIe controller index + @param EpMaxWidth[out] EP max link width + @param EpMaxGen[out] EP max link speed +**/ +VOID +Ac01PcieCoreGetEndpointInfo ( + IN AC01_ROOT_COMPLEX *RootComplex, + IN UINT8 PcieIndex, + OUT UINT8 *EpMaxWidth, + OUT UINT8 *EpMaxGen + ) +{ + PHYSICAL_ADDRESS CfgBase; + PHYSICAL_ADDRESS PcieCapBase; + PHYSICAL_ADDRESS SecLatTimerAddr; + PHYSICAL_ADDRESS TargetAddress; + UINT32 RestoreVal; + UINT32 Val; + + CfgBase =3D RootComplex->MmcfgBase + (RootComplex->Pcie[PcieIndex].DevNu= m << DEV_SHIFT); + SecLatTimerAddr =3D CfgBase + SEC_LAT_TIMER_SUB_BUS_SEC_BUS_PRI_BUS_REG; + + *EpMaxWidth =3D 0; + *EpMaxGen =3D 0; + + // Allow programming to config space + EnableDbiAccess (RootComplex, PcieIndex, TRUE); + + Val =3D MmioRead32 (SecLatTimerAddr); + RestoreVal =3D Val; + Val =3D SUB_BUS_SET (Val, DEFAULT_SUB_BUS); + Val =3D SEC_BUS_SET (Val, RootComplex->Pcie[PcieIndex].DevNum); + Val =3D PRIM_BUS_SET (Val, DEFAULT_PRIM_BUS); + MmioWrite32 (SecLatTimerAddr, Val); + + if (EndpointCfgReady (RootComplex, PcieIndex)) { + PcieCapBase =3D GetCapabilityBase (RootComplex, PcieIndex, FALSE, PCIE= _CAPABILITY_ID); + if (PcieCapBase =3D=3D 0) { + DEBUG (( + DEBUG_ERROR, + "PCIE%d.%d Cannot get PCIe capability base address!\n", + RootComplex->ID, + PcieIndex + )); + } else { + Val =3D MmioRead32 (PcieCapBase + LINK_CAPABILITIES_REG); + *EpMaxWidth =3D CAP_MAX_LINK_WIDTH_GET (Val); + *EpMaxGen =3D CAP_MAX_LINK_SPEED_GET (Val); + DEBUG (( + DEBUG_INFO, + "PCIE%d.%d EP MaxWidth %d EP MaxGen %d \n", RootComplex->ID, + PcieIndex, + *EpMaxWidth, + *EpMaxGen + )); + + // From EP, enabling common clock for upstream + TargetAddress =3D PcieCapBase + LINK_CONTROL_LINK_STATUS_REG; + Val =3D MmioRead32 (TargetAddress); + Val =3D CAP_SLOT_CLK_CONFIG_SET (Val, 1); + Val =3D CAP_COMMON_CLK_SET (Val, 1); + MmioWrite32 (TargetAddress, Val); + } + } + + // Restore value in order to not affect enumeration process + MmioWrite32 (SecLatTimerAddr, RestoreVal); + + // Disable programming to config space + EnableDbiAccess (RootComplex, PcieIndex, FALSE); +} + +VOID +PollLinkUp ( + IN AC01_ROOT_COMPLEX *RootComplex, + IN UINT8 PcieIndex + ) +{ + UINT32 TimeOut; + + // Poll until link up + // This checking for linkup status and + // give LTSSM state the time to transit from DECTECT state to L0 state + // Total delay are 100ms, smaller number of delay cannot always make sure + // the state transition is completed + TimeOut =3D LTSSM_TRANSITION_TIMEOUT; + do { + if (PcieLinkUpCheck (&RootComplex->Pcie[PcieIndex])) { + DEBUG (( + DEBUG_INFO, + "\tPCIE%d.%d LinkStat is correct after soft reset, transition time= : %d\n", + RootComplex->ID, + PcieIndex, + TimeOut + )); + RootComplex->Pcie[PcieIndex].LinkUp =3D TRUE; + break; + } + + MicroSecondDelay (100); + TimeOut -=3D 100; + } while (TimeOut > 0); + + if (TimeOut <=3D 0) { + DEBUG ((DEBUG_ERROR, "\tPCIE%d.%d LinkStat TIMEOUT after re-init\n", R= ootComplex->ID, PcieIndex)); + } else { + DEBUG ((DEBUG_INFO, "PCIE%d.%d Link re-initialization passed!\n", Root= Complex->ID, PcieIndex)); + } +} + +/** + Check active PCIe controllers of RootComplex, retrain or soft reset if n= eeded + + @param RootComplex[in] Pointer to AC01_ROOT_COMPLEX structure + @param PcieIndex[in] PCIe controller index + + @retval -1: Link recovery had failed + 1: Link width and speed are not correct + 0: Link recovery succeed +**/ +INT32 +Ac01PcieCoreQoSLinkCheckRecovery ( + IN AC01_ROOT_COMPLEX *RootComplex, + IN UINT8 PcieIndex + ) +{ + INT32 LinkStatusCheck, RasdesChecking; + INT32 NumberOfReset =3D MAX_REINIT; + UINT8 EpMaxWidth, EpMaxGen; + + // PCIe controller is not active or Link is not up + // Nothing to be done + if ((!RootComplex->Pcie[PcieIndex].Active) || (!RootComplex->Pcie[PcieIn= dex].LinkUp)) { + return LINK_CHECK_WRONG_PARAMETER; + } + + do { + if (RootComplex->Pcie[PcieIndex].LinkUp) { + // Enable all of RASDES register to detect any training error + Ac01PFACommand (RootComplex, PcieIndex, PFA_MODE_ENABLE); + + // Accessing Endpoint and checking current link capabilities + Ac01PcieCoreGetEndpointInfo (RootComplex, PcieIndex, &EpMaxWidth, &E= pMaxGen); + LinkStatusCheck =3D Ac01PcieCoreLinkCheck (RootComplex, PcieIndex, E= pMaxWidth, EpMaxGen); + + // Delay to allow the link to perform internal operation and generate + // any error status update. This allows detection of any error obser= ved + // during initial link training. Possible evaluation time can be + // between 100ms to 200ms. + MicroSecondDelay (100000); + + // Check for error + RasdesChecking =3D Ac01PFACommand (RootComplex, PcieIndex, PFA_MODE_= READ); + + // Clear error counter + Ac01PFACommand (RootComplex, PcieIndex, PFA_MODE_CLEAR); + + // If link check functions return passed, then breaking out + // else go to soft reset + if (LinkStatusCheck !=3D LINK_CHECK_FAILED && + RasdesChecking !=3D LINK_CHECK_FAILED && + PcieLinkUpCheck (&RootComplex->Pcie[PcieIndex])) + { + return LINK_CHECK_SUCCESS; + } + + RootComplex->Pcie[PcieIndex].LinkUp =3D FALSE; + } + + // Trigger controller soft reset + DEBUG ((DEBUG_INFO, "PCIE%d.%d Start link re-initialization..\n", Root= Complex->ID, PcieIndex)); + Ac01PcieCoreSetupRC (RootComplex, TRUE, PcieIndex); + + PollLinkUp (RootComplex, PcieIndex); + + NumberOfReset--; + } while (NumberOfReset > 0); + + return LINK_CHECK_SUCCESS; +} + +VOID +Ac01PcieCoreUpdateLink ( + IN AC01_ROOT_COMPLEX *RootComplex, + OUT BOOLEAN *IsNextRoundNeeded, + OUT INT8 *FailedPciePtr, + OUT INT8 *FailedPcieCount + ) +{ + AC01_PCIE_CONTROLLER *Pcie; + PHYSICAL_ADDRESS CfgBase; + UINT8 PcieIndex; + UINT32 Index; + UINT32 Val; + + *IsNextRoundNeeded =3D FALSE; + *FailedPcieCount =3D 0; + for (Index =3D 0; Index < MaxPcieControllerOfRootComplexB; Index++) { + FailedPciePtr[Index] =3D -1; + } + + if (!RootComplex->Active) { + return; + } + + // Loop for all controllers + for (PcieIndex =3D 0; PcieIndex < RootComplex->MaxPcieController; PcieIn= dex++) { + Pcie =3D &RootComplex->Pcie[PcieIndex]; + CfgBase =3D RootComplex->MmcfgBase + (RootComplex->Pcie[PcieIndex].Dev= Num << DEV_SHIFT); + + if (Pcie->Active && !Pcie->LinkUp) { + if (PcieLinkUpCheck (Pcie)) { + Pcie->LinkUp =3D TRUE; + Val =3D MmioRead32 (CfgBase + PCIE_CAPABILITY_BASE + LINK_CONTROL_= LINK_STATUS_REG); + + DEBUG (( + DEBUG_INFO, + "%a Socket%d RootComplex%d RP%d NEGO_LINK_WIDTH: 0x%x LINK_SPEED= : 0x%x\n", + __FUNCTION__, + RootComplex->Socket, + RootComplex->ID, + PcieIndex, + CAP_NEGO_LINK_WIDTH_GET (Val), + CAP_LINK_SPEED_GET (Val) + )); + + // Doing link checking and recovery if needed + Ac01PcieCoreQoSLinkCheckRecovery (RootComplex, PcieIndex); + + // Link timeout after 32ms + SetLinkTimeout (RootComplex, PcieIndex, 32); + + // Un-mask Completion Timeout + DisableCompletionTimeOut (RootComplex, PcieIndex, FALSE); + + } else { + *IsNextRoundNeeded =3D FALSE; + FailedPciePtr[*FailedPcieCount] =3D PcieIndex; + *FailedPcieCount +=3D 1; + } + } + } +} + +/** + Verify the link status and retry to initialize the Root Complex if there= 's any issue. + + @param RootComplexList Pointer to the Root Complex list +**/ +VOID +Ac01PcieCorePostSetupRC ( + IN AC01_ROOT_COMPLEX *RootComplexList + ) +{ + UINT8 RCIndex, Idx; + BOOLEAN IsNextRoundNeeded, NextRoundNeeded; + UINT64 PrevTick, CurrTick, ElapsedCycle; + UINT64 TimerTicks64; + UINT8 ReInit; + INT8 FailedPciePtr[MaxPcieControllerOfRootComplexB]; + INT8 FailedPcieCount; + + ReInit =3D 0; + +_link_polling: + NextRoundNeeded =3D FALSE; + // + // It is not guaranteed the timer service is ready prior to PCI Dxe. + // Calculate system ticks for link training. + // + TimerTicks64 =3D ArmGenericTimerGetTimerFreq (); /* 1 Second */ + PrevTick =3D ArmGenericTimerGetSystemCount (); + ElapsedCycle =3D 0; + + do { + CurrTick =3D ArmGenericTimerGetSystemCount (); + if (CurrTick < PrevTick) { + ElapsedCycle +=3D MAX_UINT64 - PrevTick; + PrevTick =3D 0; + } + ElapsedCycle +=3D (CurrTick - PrevTick); + PrevTick =3D CurrTick; + } while (ElapsedCycle < TimerTicks64); + + for (RCIndex =3D 0; RCIndex < AC01_PCIE_MAX_ROOT_COMPLEX; RCIndex++) { + Ac01PcieCoreUpdateLink (&RootComplexList[RCIndex], &IsNextRoundNeeded,= FailedPciePtr, &FailedPcieCount); + if (IsNextRoundNeeded) { + NextRoundNeeded =3D TRUE; + } + } + + if (NextRoundNeeded && ReInit < MAX_REINIT) { + // + // Timer is up. Give another chance to re-program controller + // + ReInit++; + for (RCIndex =3D 0; RCIndex < AC01_PCIE_MAX_ROOT_COMPLEX; RCIndex++) { + Ac01PcieCoreUpdateLink (&RootComplexList[RCIndex], &IsNextRoundNeede= d, FailedPciePtr, &FailedPcieCount); + if (IsNextRoundNeeded) { + for (Idx =3D 0; Idx < FailedPcieCount; Idx++) { + if (FailedPciePtr[Idx] =3D=3D -1) { + continue; + } + + // + // Some controller still observes link-down. Re-init controller + // + Ac01PcieCoreSetupRC (&RootComplexList[RCIndex], TRUE, FailedPcie= Ptr[Idx]); + } + } + } + + goto _link_polling; + } +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/BoardPcieLibNull/BoardPc= ieLibNull.c b/Silicon/Ampere/AmpereAltraPkg/Library/BoardPcieLibNull/BoardP= cieLibNull.c new file mode 100644 index 000000000000..0916adb77539 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/BoardPcieLibNull/BoardPcieLibNu= ll.c @@ -0,0 +1,47 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +/** + Assert PERST of input PCIe controller + + @param[in] RootComplex RootComplex instance. + @param[in] PcieIndex PCIe controller index of input Root Co= mplex. + @param[in] Bifurcation Bifurcation mode of input Root Complex. + @param[in] IsPullToHigh Target status for the PERST. + + @retval RETURN_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +RETURN_STATUS +EFIAPI +BoardPcieAssertPerst ( + IN AC01_ROOT_COMPLEX *RootComplex, + IN UINT8 PcieIndex, + IN BOOLEAN IsPullToHigh + ) +{ + return RETURN_SUCCESS; +} + +/** + Override the segment number for a root complex with a board specific num= ber. + + @param[in] RootComplex Root Complex instance with properties. + + @retval Segment number corresponding to the input root complex. + Default segment number is 0x0F. +**/ +UINT16 +BoardPcieGetSegmentNumber ( + IN AC01_ROOT_COMPLEX *RootComplex + ) +{ + return 0x0F; +} --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83823): https://edk2.groups.io/g/devel/message/83823 Mute This Topic: https://groups.io/mt/87123876/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83824+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83824+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167816367452.95715317476845; Wed, 17 Nov 2021 08:50:16 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id IpXOYY1788612xFyPKhx80uK; Wed, 17 Nov 2021 08:50:15 -0800 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.124]) by mx.groups.io with SMTP id smtpd.web09.9819.1637167815285594766 for ; Wed, 17 Nov 2021 08:50:15 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VCaJDJ9/st1zoFrWM1nAosNmR4qgFoRj3PUCkVgg/VFhAJhlMAMBKdmrmbp7hD8+nBwfOEfCebsGFxMNr/fSHU01H/T5NB1QR5AHKb9V7LLGiU5UCfRRQOm2eUCuDVw2A7UvLnYkalumEP0g14eVUijgUJBBI6+LrVqOmOtSJxr8lcLaN0dXiRkcuUqQzxmiAPoaZJY9836lq5Qi/W0Yq6O1+eFJeJ7uyEHgZ56kw0acRCuUTdXOZDftCYPuS4n9MBcBgTnnQRlVLrLdeltLsvkQMkuaOe8guyS3cjIZkuGrJtCw9LQ37UW1mjMyCwyCfP1mM0lXe2zLZ29+3I4f5w== 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=seLKvNSZimDUciAUYHHIT5Kx/9/0/P7BuRnE5reScGQ=; b=L6BgAbWvzn5n6qBCvUbvrvVSLGmI5C2DQFzgb8ISBIIDgDVwVt9RDoMRRf9yAOvPRhpvSu63rc7HIBSjURmXFACLqcXJRGvFbeyQ8A+vhPp7AJ8HfVbXH7PCSVCMCjr2xjt/Rai3I7NuI9UdYSc8I4BcC761nftgiI39aaGw1MYipDnvB9AZAL1duLCetDXHK7PrKlmctn+zQQDNzRISNCR8xVUD7ciVAVz2EaL4chkTKoajcgi5qxFttketuR7F4NRPRcjdjkZ71X5Oo27CdNyAyU0HBzCPotBDBGP5isWN4ZZetpAuh/4U4cYAdcrFlOGNfaqm/R0U6O/wssBXyw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB6454.prod.exchangelabs.com (2603:10b6:510:1b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.20; Wed, 17 Nov 2021 16:50:14 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:14 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 12/30] JadePkg: Add BoardPcieLib library instance Date: Wed, 17 Nov 2021 23:47:09 +0700 Message-ID: <20211117164727.10922-13-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:50:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6a1cfa73-0673-4454-c8dc-08d9a9ea536f X-MS-TrafficTypeDiagnostic: PH0PR01MB6454: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: xzZ/96hDK5XjHoAFDIA/40PZEXKXfKtcX7ExCg5TubGT9CI+bP0bqHIdX8tnx5kIJK0YhnW2rUARU2jcVtWFji3giSnAFTtPKQTmfol6N7LbkymFEua4JzfpssMnZdYsqtFYoniCk+R0FCLpl7ULwoCprvkkCaIWPE+E8DEjCWyH9VUH8KD2ITkGiwXaklgxR3TUSqI7MmgNEtFNnS+kqOKKturi6RN2/M4n8pCuI74bGflBBtr7mLp56DvdyRhQUI4KmbmStycDWd1g8542yy+f0kA4iwxMOFbdK1qR9TBwltVHF//XxUWGYAQDjr+wRk45FGnn+D/ZOeW8rtQhKPqGTxNPxiHfCP+J50/yleDhhjcqFSxpSqEuaWG/8S3frpdq8XTcWYF//zr5hISy0ozwwXgnE6z8FLkA0ztf0pCcOmfa23JujAg3Nd4ns2QV1vC109gqQnnFwUQJ7xtLBDlq+fAWapV8sAr3HkggAm04qYGK01P9osrs83yQ/2M9YoY5TYfAz9BdMvteAgWAhNWwY9PL7kpkd3LeuLwBlh8rB7ygrjgKGpN7oeTCb5Ha2hcpIA+psVTDq7veSQuP4BNAbM/8TPUJGM8Dl5xTmkFzvxgD3HT87PIIBzz5HjWb6myUgn2fqCF0i+2EnKBdp+YNrW6QfCkyMVGonVE9KTGw47ElP8XfEtE8O2JdRTz6MFs+vEbXMjoGoCg2f3Uegw== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?uiqjePWNq9RCnUx86jbL7YGPlBSdcvgmi3mCgfXNt//mNy8nYM8sVKMidBkE?= =?us-ascii?Q?vgF9C6XrnOvSGgK0rpk01MiUACsDw4+RNvn1oAS0cu5Y0iMfKfICHIYYLMD3?= =?us-ascii?Q?ObN7lYKCip9+OqEHAeCsk/8XdPhf9ykVueae2ZzhGQ6BODszLN7nfGuTruHA?= =?us-ascii?Q?jJRj3oxulagfkbolbS8tNpJ+yuKGularJIRMI5N4Xz4iLQMm4momGJrfP/6m?= =?us-ascii?Q?/LZOhoDaask245cuT6HV/qp2fyYBbGY4SFqlXuZcYZE0SF8QaP3FpCgG3yVi?= =?us-ascii?Q?HrbVVJAiY8xbrTyyumHh06rCJEiAtQ83Rer+uWdWiqP5h7hTLJN0b0aNEGhA?= =?us-ascii?Q?bNsxLCFWZFII+ZfQbMsj4kQS4vhm/gTt4A+YvXpknowglxYBWYUh/hCn0vA9?= =?us-ascii?Q?Y9CEItNzb7yMw4AUylVSApET+VrnMTlG5X5jdfFKPfxq3FLYNfx1kMpsdBHa?= =?us-ascii?Q?y7Tet8FQvbpK2w2dAqnia8PhEe9t6bzXdBAn0fJUg16R8zNhY7eN7WfhvcRZ?= =?us-ascii?Q?ThYFaDqywsOKnYUyBO/2heUBThoI1raiI043/GlM04On4jUREmfVlFqO1sfJ?= =?us-ascii?Q?SwTvHLCoZptQo41yBUbfk47Jqb0ukcWswhdkjWeYGA+QjPdAPloJHp+A5OTL?= =?us-ascii?Q?ZfTaVp1GGOcMGhLsJDXsHp4ft4voYlJQIx+diVBJEuA4l1IXgC+ZNLGss046?= =?us-ascii?Q?q7klHz+LfdHdBcD0k00WFJ9CDukB1oSxbfSmITgMgnPEs8IL97TVP2nhV66s?= =?us-ascii?Q?dPcbypOWa+8O9+5NEgvueOEm8bglIiqxgXkhxk23Po7UPKVCXvoJWISPT5LR?= =?us-ascii?Q?spCoL7WipVJSRNkJLzgvm+GI2zEQCLq0+FiPKYN198qq5cqwyNdkWCbgBXr3?= =?us-ascii?Q?Z/Hm1GYwAHzWWGZz+04BLKT3bJPFcu0vPVb0LLbMiOpTbKWh49atwnTSS0mv?= =?us-ascii?Q?jS700/8C6Sw5aB50tnDti23WLYoomt885NuA0X+IVpJLAHxfW2Ev4CtVqscG?= =?us-ascii?Q?VwFO3YpsbQA7Cjbup4Q5F+DJC2k4fJRaXdTXv2irCl7bx6yuLysRkDgN0l1Z?= =?us-ascii?Q?H3zQx2GdYnw2j+7M5WEOzeQFs55ZdsxFN7HdquQCqJGt/SKg4iBEHHkEDOmS?= =?us-ascii?Q?WfL178ghwXuBLBJBL+kx3Qa21qoJ+E6bXiK1P2uZlW/z13En/s/J2bowHEwH?= =?us-ascii?Q?zf0T+h8fzP9WvdkxCwguRvVexBJpoZBNBaSx820KGEgL30QjDy9BGuX8wdPG?= =?us-ascii?Q?iHk8VgoDwS4yEm/YIdSafsmX5MuQqGLbQFQkE58ggPl5gaNVD+auS52Z9R6I?= =?us-ascii?Q?ci1PAiFUFKyMqQYsbcWgH5dek9H0at9xsJe/EQOyIHqk6GyumDCJgV7bGMPf?= =?us-ascii?Q?USE3mGJ19/WeZqnh6yOcPTGfTvyfkXvXnOIfO5t7zen9TTGxLjU0byCRbPex?= =?us-ascii?Q?RbfFOrS50ktcHZvwbhKJ+Dy0/2FlBcBgurQnM3e+zt+pQAz85L/zhLrOjHcD?= =?us-ascii?Q?olK/6uCJsV+azT0AM6j+1cxUGTMLZjv0XEqNH9l7DW0iahQYSl3rMs10jHbi?= =?us-ascii?Q?7bERr7gNQckFjBu98NA/gADedOdvl9Z1Rhni+kcqixLf5NMw1lPdEt/Sk3dL?= =?us-ascii?Q?j3X8iYrq4xEY4nsz6yabT7KzQhlpFIf8zVulr845dupVllWRxWVBcIyKGb0L?= =?us-ascii?Q?AIldRHOMDsuuIwmHvb2OVoPD2wM=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6a1cfa73-0673-4454-c8dc-08d9a9ea536f X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:14.0615 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PiSDNKtChz9WQel+GfU4YHwQBfhZ6OcdR5A/qDmlP910BmOJO69PNgsHiIZYdyAItm+4iHnawuJ+a0zrsovEQkyUwFAN+NMsjkGWSIqtXJY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6454 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: 0XqUNQ9FHEEa2EEeLUihth0fx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167815; bh=f4hCOvPC+7wWevStYvo2NG/3CPCGHmbafkVCPTO4Sno=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=S8mGfR0Rj+Ura2zWkA/kmXfiqeOJ1uOIICXjSP30naz3UIkA73y1w5Qx0ZrNQ0hGMze 4406jcUESM9U0l8415rMHz3KmsnOfgoNBjxGqS5LI9MlyfW+LMLIHbKZ1RYvvVhUBgY4a DDGA4uIomty86dKFikjKDbSkr+nEjwWLCIc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167817045100010 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen Provide Mt. Jade specific segment number for each Root Complex and function to handle the PCIe PERST. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Platform/Ampere/JadePkg/Jade.dsc | 2 +- Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.inf | 27 +++++ Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.c | 117 ++++++= ++++++++++++++ 3 files changed, 145 insertions(+), 1 deletion(-) diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index 23a297d0dbeb..9315c1c71cc7 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -85,7 +85,7 @@ [LibraryClasses] # # Pcie Board # - BoardPcieLib|Silicon/Ampere/AmpereAltraPkg/Library/BoardPcieLibNull/Boar= dPcieLibNull.inf + BoardPcieLib|Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.i= nf =20 ##########################################################################= ###### # diff --git a/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.inf = b/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.inf new file mode 100644 index 000000000000..1d722bceff2c --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.inf @@ -0,0 +1,27 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D BoardPcieLib + FILE_GUID =3D 062191A6-E113-4FD6-84C7-E400B4B34759 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D BoardPcieLib + +[Sources] + BoardPcieLib.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + DebugLib + GpioLib + TimerLib diff --git a/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.c b/= Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.c new file mode 100644 index 000000000000..f49764097219 --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.c @@ -0,0 +1,117 @@ +/** @file + Pcie board specific driver to handle asserting PERST signal to Endpoint + card. PERST asserting is via group of GPIO pins to CPLD as Platform Spec= ification. + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include + +#define RCA_MAX_PERST_GROUPVAL 62 +#define RCB_MAX_PERST_GROUPVAL 46 +#define DEFAULT_SEGMENT_NUMBER 0x0F + +VOID +BoardPcieReleaseAllPerst ( + IN UINT8 SocketId + ) +{ + UINT32 GpioIndex, GpioPin; + + // Write 1 to all GPIO[16..21] to release all PERST + GpioPin =3D AC01_GPIO_PINS_PER_SOCKET * SocketId + 16; + for (GpioIndex =3D 0; GpioIndex < 6; GpioIndex++) { + GpioModeConfig (GpioPin + GpioIndex, GpioConfigOutHigh); + } +} + +/** + Assert PERST of PCIe controller + + @param[in] RootComplex Root Complex instance. + @param[in] PcieIndex PCIe controller index of input Root Co= mplex. + @param[in] IsPullToHigh Target status for the PERST. + + @retval RETURN_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +RETURN_STATUS +EFIAPI +BoardPcieAssertPerst ( + IN AC01_ROOT_COMPLEX *RootComplex, + IN UINT8 PcieIndex, + IN BOOLEAN IsPullToHigh + ) +{ + UINT32 GpioGroupVal, Val, GpioIndex, GpioPin; + + if (!IsPullToHigh) { + if (RootComplex->Type =3D=3D RootComplexTypeA) { + // + // RootComplexTypeA: RootComplex->ID: 0->3 ; PcieIndex: 0->3 + // + GpioGroupVal =3D RCA_MAX_PERST_GROUPVAL - PcieIndex + - RootComplex->ID * MaxPcieControllerOfRootComplexA; + } else { + // + // RootComplexTypeB: RootComplex->ID: 4->7 ; PcieIndex: 0->7 + // + GpioGroupVal =3D RCB_MAX_PERST_GROUPVAL - PcieIndex + - (RootComplex->ID - MaxRootComplexA) * MaxPcieContro= llerOfRootComplexB; + } + + // Update the value of GPIO[16..21]. Corresponding PERST line will be = decoded by CPLD. + GpioPin =3D AC01_GPIO_PINS_PER_SOCKET * RootComplex->Socket + 16; + for (GpioIndex =3D 0; GpioIndex < 6; GpioIndex++) { + Val =3D (GpioGroupVal & 0x3F) & (1 << GpioIndex); + if (Val =3D=3D 0) { + GpioModeConfig (GpioPin + GpioIndex, GpioConfigOutLow); + } else { + GpioModeConfig (GpioPin + GpioIndex, GpioConfigOutHigh); + } + } + + // Keep reset as low as 100 ms as specification + MicroSecondDelay (100 * 1000); + } else { + BoardPcieReleaseAllPerst (RootComplex->Socket); + } + + return RETURN_SUCCESS; +} + +/** + Override the segment number for a root complex with a board specific num= ber. + + @param[in] RootComplex Root Complex instance with properties. + + @retval Segment number corresponding to the input root complex. + Default segment number is 0x0F. +**/ +UINT16 +BoardPcieGetSegmentNumber ( + IN AC01_ROOT_COMPLEX *RootComplex + ) +{ + UINT8 Ac01BoardSegment[PLATFORM_CPU_MAX_SOCKET][AC01_PCIE_MAX_ROOT_COMPL= EX] =3D + { + { 0x0C, 0x0D, 0x01, 0x00, 0x02, 0x03, 0x04, 0x= 05 }, + { 0x10, 0x11, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x= 0B } + }; + + if (RootComplex->Socket < PLATFORM_CPU_MAX_SOCKET + && RootComplex->ID < AC01_PCIE_MAX_ROOT_COMPLEX) { + return Ac01BoardSegment[RootComplex->Socket][RootComplex->ID]; + } + + return DEFAULT_SEGMENT_NUMBER; +} --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83824): https://edk2.groups.io/g/devel/message/83824 Mute This Topic: https://groups.io/mt/87123878/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83825+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83825+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 163716782021442.57842149390967; Wed, 17 Nov 2021 08:50:20 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id jVBMYY1788612xYgzuQFPN8w; Wed, 17 Nov 2021 08:50:19 -0800 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.102]) by mx.groups.io with SMTP id smtpd.web09.9821.1637167818891394120 for ; Wed, 17 Nov 2021 08:50:19 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DTjKTu0tidbjaH064P4lC0whkSH6NKAsWP696fnX+KWMuvjL+VMHSQ2n6vnTxBm1sCIUzWNU+ehThEOgXiujKz29vv2fQBwjtVIRCx536o0AcTTcl3dLxDaCbwPUrkkSPo9iHLzE5aDfuNeKW9A0aRcAZ1vPJocpsZpvlx2zbRjUDzVLSdI7NoevjnI3sh+7wVyLyeijfLwGLrcgwDGTBdhW0RxjtxSOQy9Q3pTTT4mYdy64SV7ERLNlSHlujypNHZSPclFZdDZVIC4tT69cklGxO/C8g8r2AiLcjzWxWAMKCoLVvQ6TrlN+pckJXYtWLZfG3P3qzbb4U4hG4aV2Zg== 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=xK5s+wsUUfr4kKLfa8F3OW3bztzjtGKXLKS0Y1976Xs=; b=jBYPOsDfu9AEo5GSUOmtWcpxw3VPMx9rKwxnn1iYr8CF1Ki6+iWj6USDFGHy9kLKnwwf2RWYvsMdo1+c0VvcNOFmC36PSuJjERLLRAuVtpLQQTF36+MIDNPc+gNwdaTo5whE5TADAoUPeFmMtPR78le7Tn3CXiISmbObED+BJmhbhKOo9aUlAfyRQcNywYSjcTttIS7v+PsgQxhf63WDsPaZnZH5FG1ZfMmTDRk7j8RNSFv6gOxpp3CnFDFd1Aw3BULu/RUAdRFYmMlk35uihdBDwQYv20D0VjdB+mC+9pf5F7W4lhTEptSkfKp26suK1CtBOabSyHFlrkpB7A3D7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB6454.prod.exchangelabs.com (2603:10b6:510:1b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.20; Wed, 17 Nov 2021 16:50:17 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:17 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 13/30] AmpereAltraPkg: Add driver to initialize PCIe Root Complex Date: Wed, 17 Nov 2021 23:47:10 +0700 Message-ID: <20211117164727.10922-14-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:50:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 149ccf71-1f42-4dca-b9cd-08d9a9ea5565 X-MS-TrafficTypeDiagnostic: PH0PR01MB6454: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: oYXaGhmYCY+xkPEasHWd+iguYhuPhEo8iH6Bc6psETQqFPYjMgqCFXqWLN/9ciOkt1j1KCA+c7Jl7X2VviCoNU8O2urOrJFV9O6S/JeNUTgJmu6r9+DzApwZZDLrvu5typFQJhXLwjjRFAJkOtHJlJkj4Ovp1w2xf+X3k/4q/5OnwdEZFLWcCrLPw/HMWK0eonSvb1/PhbaOW/k2VLtwN4gih4fIAeM+ODQfxuO7Z2EW5+a+PkJsIEoq+ZqV6whehJ73QyRYAsweeiJzgcfhlx2UK7x9HKmQx2R2S0+5G3OQ/DzgmF6NKi2qaT/0bjf6UV3CwnN6TlAprRk8QNTP7uV6j+yqoGg7/dVscT7fyKfsSYOOdZZhsTTl6RXCwW+XCl+srDEsv4HMYZaqzVtaz0YY+ZDytQ4CBTSrYtECuW/h2Uz1ZBy4mgtup+2WANUhbn1wPl6J85FykfauLIyRzEMk6li5aTiWB9Q0BwIhq+NE6EBiyrmB5bKe7+2a+rVILcB4wHUe3jH1j8KTyPgXqst9WULPuNXz6+Uhr1Hs/A7VoPRKKHwbI09apeu/BeFqknkscb6Z5xHTQJgfRAXXl8izPe7GgJQIdG5SJLwFHP98EdbllKhOF8V7hG08iQTsnnDCxuYCYHk5/kVJRcwiP7PZNxawSycbo/YQjuX9fQ3LRjsTyKP2CIZtkRi+YwIi/YGakXtP9bayOK49zRSKHg== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?MyfBh7dFMehz+bdik2xLaS5nbDTyIyovINmJ/+FlEYreqgStgqQKTXUeKbIM?= =?us-ascii?Q?zKQv4s34M3+/yFv95ampNKi6GxwktI6XsHB6rrNsrHIf5rRKvjn/JnzOyvR0?= =?us-ascii?Q?9XbiNSu3L9FYgSZn5U4vFgVLBRF7ecftVHUWZjorNowO8BhZudGJzCN0MjJ1?= =?us-ascii?Q?GbDd9H7nPTq7IBPgewfBDakK4sCZOj1FM9/Eg6IYV3ZRi+xUp/pI+sC07XQB?= =?us-ascii?Q?cJ8ZEif5R+KJ1j7CUyyVUY60fHlUa5z6C4YqMwhVJSELu2O2TjK1a1YgmcCq?= =?us-ascii?Q?gSSt+5Eax4rqXaSvJrTHQVvnNEhQAe7pLZBAENdV76DbiBbCBIQlnv3BQUbK?= =?us-ascii?Q?ruIP8Dk8eDbInhTMiVsjXsogWSJESe9PWQSlDN20MfFKJ+clHYzB6pfP4O1N?= =?us-ascii?Q?L6Ly6n6g5owXDfiRQaspHJGZMdFVj3at7a6LnpJWwnL3XVnYzSQ9cWfpBsdW?= =?us-ascii?Q?W45o1vieXGc0IzikmyRSTZZRtmOMz5Pjs4JUv8lQ5I3kUoBdvoL0hxNWAD7l?= =?us-ascii?Q?sgcAKZJAawZUh2dbbGNEkP1lrtlfObGZc2HWg8AOtsEubOecYGAv2CUhdXtp?= =?us-ascii?Q?AIrBeyKCfhI0myEx5Hd6n4X6poGA9WeworBHiPYasYcbD8JPJa7VVJSeP444?= =?us-ascii?Q?ETbs9HKVm0IttIbqICkydWWIvfm2GDarLVgYEEpCArDIW7Io2+AJewcGrTWn?= =?us-ascii?Q?WKA23/byHGzdqd2FcqAjn7ajaZ9ZtyXrbum1Dy45PLBm1QjTwYM9ISMOvm4y?= =?us-ascii?Q?BXDgwTe0TP8lc2sot8ZiaxOp/akVrAqMJwnphkUnlmzLXyf34t+7LQjxs6WA?= =?us-ascii?Q?N70QAAnIxtnGVoxU1DVvOkdU3S7cFeJbz6Ha93630kDoT/ww/pFpHe5eEsKu?= =?us-ascii?Q?cQaca84tsYuiTySuiJ9znBi2HQRFZfnWsyzrgsH8R3wU7d97vXz3Jiwr6hPe?= =?us-ascii?Q?nLj6upjfI2ELKhzAFQA9L7+l/USuU2e3oUi+Nkqa0kdRJDil55fx1kz/moRe?= =?us-ascii?Q?6lI8W6NgxoL/iDwQNFvtal2YXW+YnkhcJBAzYO/IsBIXT3KDcCXiHetG9r7q?= =?us-ascii?Q?00TjDyp4pFiATPorCl7b+qLuw3pQmQDuFN8PSe4JcmjdxZq6ZdBitr3zXJGM?= =?us-ascii?Q?aLpmrOwhQiU+WeoxyDJbDHkKxVAshkkJ4udXoIGi9L0VSpIReUMi0l2NKB7r?= =?us-ascii?Q?tTr6VH8RcdPuHOEdnpwXmAhU8075BSlR9/zzk55mupDM0pnWt694HRHR8NRd?= =?us-ascii?Q?b/u3tICWsfo/E0lPRwXYAT/5YAZDIFYx7WB6QLTgDSen4as0WrZv3B+kl2Tz?= =?us-ascii?Q?2lmLGyQBoKXvJk4TMm/euDKomh+ZsJ7jh105MxDok8rx4n0/vOQE5zBk68lb?= =?us-ascii?Q?v+mBL5SOIisblO7/zAhm2o2sHq1KWp3ENZ77L/9cs9ZAcFqSpEWOBAfw5TMK?= =?us-ascii?Q?nABtnqSGg/pqcl5kiRrSo4gVToKFNA4eEfojVe86Lu5q3LQjz228dTjtJMZ5?= =?us-ascii?Q?y54DQqD4FnqhL1xDUdKaLF2Iu2NlPNymNt+bAzrWW0tTJjGh+n+HfhT8miaU?= =?us-ascii?Q?CxD8UwebdOlpRzMzWc4KEPj7xFN08GA6gE+TOUSi+WSlOnxBryjiNtZ1iDPm?= =?us-ascii?Q?5SjnNfaZc4NpAs/IcFHgOcZzwxTibllg7j40ghDrUNEloae5m9JBTjiZhY4b?= =?us-ascii?Q?2WMvJG7mW4+Awz1qwGqECOJs080=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 149ccf71-1f42-4dca-b9cd-08d9a9ea5565 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:17.2863 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cT6OVjzCvfRuZykZA9uq+xQedsBLUNNnIVDOxqS3TxhkGdQfZToLUxJRZqe/ZaGv96NxCkAReeZZV1EdTE4dtHJMOkFHNJlRv7GYlBYM/ic= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6454 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: P7AXdrdutRutNL4EDNrdzaqrx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167819; bh=7Hvq4wQny0o93ngV43/KQ6S5eRdBwmYCVQLbVDM5RsQ=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=TpKka0RUpV9uRAO7E9i9wsC2SKzj3OACkPGVtjcOWd54LnRU9657Qlk/lrtiUC/6HXI XrXDBUL1PutRY8Vru5t4h0veYj7SB1zHSNrfg+HXO4ecvio7qb3x07FcaZy+bDmPpUiOC L7E2OQ2QJ2XBglrhIE9UduU7XwcrvPx5PrU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167821629100001 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen This driver takes responsibility for: - Parsing platform settings to build the Root Complex info HOB - Initializing each Root Complex Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc | = 1 + Platform/Ampere/JadePkg/Jade.fdf | = 1 + Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf | = 40 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.h | = 28 ++ Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h | = 45 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.c | 1= 57 ++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.c | 5= 14 ++++++++++++++++++++ 7 files changed, 786 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index 5b767ecb024f..b08bdd82177e 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -534,6 +534,7 @@ [Components.common] Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf Silicon/Ampere/AmpereAltraPkg/Drivers/FlashPei/FlashPei.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf ArmPkg/Drivers/CpuPei/CpuPei.inf UefiCpuPkg/CpuIoPei/CpuIoPei.inf MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index 078b63c867d6..2fef96deb767 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -162,6 +162,7 @@ [FV.FVMAIN_COMPACT] INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf INF MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRo= uterPei.inf INF MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf =20 # # Print platform information before passing control into the Driver Exec= ution Environment (DXE) phase diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.= inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf new file mode 100644 index 000000000000..17ac1672dac8 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf @@ -0,0 +1,40 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D PcieInitPei + FILE_GUID =3D CD3F92A7-9AE4-42F9-B2CC-B47A8615B85B + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D PcieInitEntry + +[Sources] + PcieInitPei.c + RootComplexNVParam.c + RootComplexNVParam.h + +[Packages] + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + Ac01PcieLib + AmpereCpuLib + BaseMemoryLib + BoardPcieLib + DebugLib + HobLib + PeimEntryPoint + +[Guids] + gRootComplexInfoHobGuid + gPlatformInfoHobGuid + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexN= VParam.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVP= aram.h new file mode 100644 index 000000000000..008a8db69f2c --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.h @@ -0,0 +1,28 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef GET_ROOT_COMPLEX_INFO_ +#define GET_ROOT_COMPLEX_INFO_ + +#define BITS_PER_BYTE 8 +#define BYTE_MASK 0xFF +#define PCIE_ERRATA_SPEED1 0x0001 // Limited speed errata + +#ifndef BIT +#define BIT(nr) (1 << (nr)) +#endif + +#define PCIE_GET_MAX_WIDTH(Pcie, Max) \ + !((Pcie).MaxWidth) ? (Max) : MIN ((Pcie).MaxWidth, (Max)) + +VOID +ParseRootComplexNVParamData ( + AC01_ROOT_COMPLEX *RootComplex + ); + +#endif /* GET_ROOT_COMPLEX_INFO_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h b/Silico= n/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h index 2310e4e1ce98..f3e6b4041737 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h @@ -229,4 +229,49 @@ // #define PLATFORM_CPM_UID_BIT_OFFSET 8 =20 +// +// Max number for AC01 PCIE Root Complexes +// +#define AC01_PCIE_MAX_ROOT_COMPLEX 16 + +// +// Max number for AC01 PCIE Root Complexes per socket +// +#define AC01_PCIE_MAX_RCS_PER_SOCKET 8 + +// +// The base address of {TCU, CSR, MMCONFIG} Registers +// +#define AC01_PCIE_CSR_BASE_LIST 0x33FFE0000000, 0x37FFE0000000, 0= x3BFFE0000000, 0x3FFFE0000000, 0x23FFE0000000, 0x27FFE0000000, 0x2BFFE00000= 00, 0x2FFFE0000000, 0x73FFE0000000, 0x77FFE0000000, 0x7BFFE0000000, 0x7FFFE= 0000000, 0x63FFE0000000, 0x67FFE0000000, 0x6BFFE0000000, 0x6FFFE0000000 + +// +// The base address of MMIO Registers +// +#define AC01_PCIE_MMIO_BASE_LIST 0x300000000000, 0x340000000000, 0= x380000000000, 0x3C0000000000, 0x200000000000, 0x240000000000, 0x2800000000= 00, 0x2C0000000000, 0x700000000000, 0x740000000000, 0x780000000000, 0x7C000= 0000000, 0x600000000000, 0x640000000000, 0x680000000000, 0x6C0000000000 + +// +// The size of MMIO space +// +#define AC01_PCIE_MMIO_SIZE_LIST 0x3FFE0000000, 0x3FFE0000000, 0x3= FFE0000000, 0x3FFE0000000, 0x3FFE0000000, 0x3FFE0000000, 0x3FFE0000000, 0x3= FFE0000000, 0x3FFE0000000, 0x3FFE0000000, 0x3FFE0000000, 0x3FFE0000000, 0x3= FFE0000000, 0x3FFE0000000, 0x3FFE0000000, 0x3FFE0000000 + +// +// The base address of MMIO32 Registers +// +#define AC01_PCIE_MMIO32_BASE_LIST 0x000020000000, 0x000028000000, 0= x000030000000, 0x000038000000, 0x000004000000, 0x000008000000, 0x0000100000= 00, 0x000018000000, 0x000060000000, 0x000068000000, 0x000070000000, 0x00007= 8000000, 0x000040000000, 0x000048000000, 0x000050000000, 0x000058000000 + +// +// The size of MMIO32 space +// +#define AC01_PCIE_MMIO32_SIZE_LIST 0x8000000, 0x8000000, 0x8000000, = 0x8000000, 0x4000000, 0x8000000, 0x8000000, 0x8000000, 0x8000000, 0x8000000= , 0x8000000, 0x8000000, 0x8000000, 0x8000000, 0x8000000, 0x8000000 + +// +// The base address of MMIO32 Registers +// +#define AC01_PCIE_MMIO32_BASE_1P_LIST 0x000040000000, 0x000050000000, 0= x000060000000, 0x000070000000, 0x000008000000, 0x000010000000, 0x0000200000= 00, 0x000030000000, 0, 0, 0, 0, 0, 0, 0, 0 + +// +// The size of MMIO32 1P space +// +#define AC01_PCIE_MMIO32_SIZE_1P_LIST 0x10000000, 0x10000000, 0x1000000= 0, 0x10000000, 0x8000000, 0x10000000, 0x10000000, 0x10000000, 0, 0, 0, 0, 0= , 0, 0, 0 + #endif /* PLATFORM_AC01_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.= c b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.c new file mode 100644 index 000000000000..cdd907d378e8 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.c @@ -0,0 +1,157 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "RootComplexNVParam.h" + +#define TCU_OFFSET 0 +#define SNPSRAM_OFFSET 0x9000 +#define HB_CSR_OFFSET 0x01000000 +#define PCIE0_CSR_OFFSET 0x01010000 +#define SERDES_CSR_OFFSET 0x01200000 +#define MMCONFIG_OFFSET 0x10000000 + +#define PCIE_CSR_SIZE 0x10000 + +STATIC AC01_ROOT_COMPLEX mRootComplexList[AC01_PCIE_MAX_ROOT_COMPLE= X]; +STATIC UINT64 mCsrBase[AC01_PCIE_MAX_ROOT_COMPLEX] = =3D { AC01_PCIE_CSR_BASE_LIST }; +STATIC UINT64 mMmio32Base[AC01_PCIE_MAX_ROOT_COMPLEX] = =3D { AC01_PCIE_MMIO32_BASE_LIST }; +STATIC UINT64 mMmio32Base1P[AC01_PCIE_MAX_ROOT_COMPLEX] = =3D { AC01_PCIE_MMIO32_BASE_1P_LIST }; +STATIC UINT64 mMmio32Size[AC01_PCIE_MAX_ROOT_COMPLEX] = =3D { AC01_PCIE_MMIO32_SIZE_LIST }; +STATIC UINT64 mMmio32Size1P[AC01_PCIE_MAX_ROOT_COMPLEX] = =3D { AC01_PCIE_MMIO32_SIZE_1P_LIST }; +STATIC UINT64 mMmioBase[AC01_PCIE_MAX_ROOT_COMPLEX] = =3D { AC01_PCIE_MMIO_BASE_LIST }; +STATIC UINT64 mMmioSize[AC01_PCIE_MAX_ROOT_COMPLEX] = =3D { AC01_PCIE_MMIO_SIZE_LIST }; + +VOID +BuildRootComplexData ( + VOID + ) +{ + AC01_ROOT_COMPLEX *RootComplex; + UINT8 RCIndex; + UINT8 PcieIndex; + + ZeroMem (&mRootComplexList, sizeof (AC01_ROOT_COMPLEX) * AC01_PCIE_MAX_R= OOT_COMPLEX); + + // + // Adjust Root Complex MMIO32 base address in 1P or 2P configuration + // + if (!IsSlaveSocketAvailable ()) { + CopyMem ((VOID *)&mMmio32Base, (VOID *)&mMmio32Base1P, sizeof (mMmio32= Base1P)); + CopyMem ((VOID *)&mMmio32Size, (VOID *)&mMmio32Size1P, sizeof (mMmio32= Size1P)); + } + + for (RCIndex =3D 0; RCIndex < AC01_PCIE_MAX_ROOT_COMPLEX; RCIndex++) { + RootComplex =3D &mRootComplexList[RCIndex]; + RootComplex->Active =3D TRUE; + RootComplex->DevMapLow =3D 0; + RootComplex->DevMapHigh =3D 0; + RootComplex->Socket =3D RCIndex / AC01_PCIE_MAX_RCS_PER_SOCKET; + RootComplex->ID =3D RCIndex % AC01_PCIE_MAX_RCS_PER_SOCKET; + RootComplex->CsrBase =3D mCsrBase[RCIndex]; + RootComplex->TcuBase =3D RootComplex->CsrBase + TCU_OFFSET; + RootComplex->HostBridgeBase =3D RootComplex->CsrBase + HB_CSR_OFFSET; + RootComplex->SerdesBase =3D RootComplex->CsrBase + SERDES_CSR_OFFSET; + RootComplex->MmcfgBase =3D RootComplex->CsrBase + MMCONFIG_OFFSET; + RootComplex->MmioBase =3D mMmioBase[RCIndex]; + RootComplex->MmioSize =3D mMmioSize[RCIndex]; + RootComplex->Mmio32Base =3D mMmio32Base[RCIndex]; + RootComplex->Mmio32Size =3D mMmio32Size[RCIndex]; + RootComplex->Type =3D (RootComplex->ID < MaxRootComplexA) ? RootComple= xTypeA : RootComplexTypeB; + RootComplex->MaxPcieController =3D (RootComplex->Type =3D=3D RootCompl= exTypeB) + ? MaxPcieControllerOfRootComplexB : M= axPcieControllerOfRootComplexA; + RootComplex->Logical =3D BoardPcieGetSegmentNumber (RootComplex); + + for (PcieIndex =3D 0; PcieIndex < RootComplex->MaxPcieController; Pcie= Index++) { + RootComplex->Pcie[PcieIndex].ID =3D PcieIndex; + RootComplex->Pcie[PcieIndex].CsrBase =3D RootComplex->CsrBase + PCIE= 0_CSR_OFFSET + PcieIndex * PCIE_CSR_SIZE; + RootComplex->Pcie[PcieIndex].SnpsRamBase =3D RootComplex->Pcie[PcieI= ndex].CsrBase + SNPSRAM_OFFSET; + RootComplex->Pcie[PcieIndex].DevNum =3D PcieIndex + 1; + } + + ParseRootComplexNVParamData (RootComplex); + + DEBUG (( + DEBUG_INFO, + " + S%d - RootComplex%a%d, MMCfgBase:0x%lx, MmioBase:0x%lx, Mmio32Ba= se:0x%lx, Enabled:%a\n", + RootComplex->Socket, + (RootComplex->Type =3D=3D RootComplexTypeA) ? "A" : "B", + RootComplex->ID, + RootComplex->MmcfgBase, + RootComplex->MmioBase, + RootComplex->Mmio32Base, + (RootComplex->Active) ? "Y" : "N" + )); + + DEBUG ((DEBUG_INFO, " + DevMapLo/Hi: 0x%x/0x%x\n", RootComplex->DevM= apLow, RootComplex->DevMapHigh)); + for (PcieIndex =3D 0; PcieIndex < RootComplex->MaxPcieController; Pcie= Index++) { + DEBUG (( + DEBUG_INFO, + " + PCIE%d:0x%lx - Enabled:%a - DevNum:0x%x\n", + PcieIndex, + RootComplex->Pcie[PcieIndex].CsrBase, + (RootComplex->Pcie[PcieIndex].Active) ? "Y" : "N", + RootComplex->Pcie[PcieIndex].DevNum + )); + } + } +} + +EFI_STATUS +EFIAPI +PcieInitEntry ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + AC01_ROOT_COMPLEX *RootComplex; + EFI_STATUS Status; + UINT8 Index; + + BuildRootComplexData (); + + // + // Initialize Root Complex and underneath controllers + // + for (Index =3D 0; Index < AC01_PCIE_MAX_ROOT_COMPLEX; Index++) { + RootComplex =3D &mRootComplexList[Index]; + if (!RootComplex->Active) { + continue; + } + + Status =3D Ac01PcieCoreSetupRC (RootComplex, FALSE, 0); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "RootComplex[%d]: Init Failed\n", Index)); + RootComplex->Active =3D FALSE; + continue; + } + } + + Ac01PcieCorePostSetupRC (mRootComplexList); + + // + // Build Root Complex info Hob + // + BuildGuidDataHob ( + &gRootComplexInfoHobGuid, + (VOID *)&mRootComplexList, + sizeof (mRootComplexList) + ); + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexN= VParam.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVP= aram.c new file mode 100644 index 000000000000..aa34a90b44c6 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.c @@ -0,0 +1,514 @@ +/** @file + Parsing NVPARAM board settings for bifurcation programming. + + NVPARAM board settings is spec-ed within Firmware Interface Requirement. + Bifurcation devmap is programmed before at SCP following the rule + + Root Complex Type-A devmap settings (RP =3D=3D Root Port) + ----------------------------------------- + | RP0 | RP1 | RP2 | RP3 | Devmap | + | (x16) | (x4) | (x8) | (x4) | (output) | + ------------------------------------------- + | Y | N | N | N | 0 | + | Y | N | Y | N | 1 | + | Y | N | Y | Y | 2 | + | Y | Y | Y | Y | 3 | + ----------------------------------------- + + Root Complex Type-B LOW (aka RCBxA) devmap settings (RP =3D=3D Root Port) + ---------------------------------------- + | RP0 | RP1 | RP2 | RP3 | Devmap | + | (x8) | (x2) | (x4) | (x3) | (output) | + ---------------------------------------- + | Y | N | N | N | 0 | + | Y | N | Y | N | 1 | + | Y | N | Y | Y | 2 | + | Y | Y | Y | Y | 3 | + ---------------------------------------- + + Root Complex Type-B HIGH (aka RCBxB) devmap settings (RP =3D=3D Root Por= t) + ---------------------------------------- + | RP4 | RP5 | RP6 | RP7 | Devmap | + | (x8) | (x2) | (x4) | (x3) | (output) | + ---------------------------------------- + | Y | N | N | N | 0 | + | Y | N | Y | N | 1 | + | Y | N | Y | Y | 2 | + | Y | Y | Y | Y | 3 | + ---------------------------------------- + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "RootComplexNVParam.h" + +STATIC +BOOLEAN +IsEmptyRC ( + AC01_ROOT_COMPLEX *RootComplex + ) +{ + UINT8 Idx; + + for (Idx =3D PcieController0; Idx < MaxPcieController; Idx++) { + if (RootComplex->Pcie[Idx].Active) { + return FALSE; + } + } + + return TRUE; +} + +VOID +SetRootComplexBifurcation ( + IN AC01_ROOT_COMPLEX *RootComplex, + IN UINT8 RPStart, + IN DEV_MAP_MODE DevMap + ) +{ + UINT8 MaxWidth; + + if (RPStart !=3D PcieController0 && RPStart !=3D PcieController4) { + return; + } + + if (RootComplex->Type !=3D RootComplexTypeB && RPStart =3D=3D PcieContro= ller4) { + return; + } + + if (RootComplex->Type =3D=3D RootComplexTypeA && RootComplex->Pcie[RPSta= rt].MaxWidth =3D=3D LINK_WIDTH_X16) { + RootComplex->Pcie[RPStart + 1].MaxWidth =3D LINK_WIDTH_X4; + RootComplex->Pcie[RPStart + 2].MaxWidth =3D LINK_WIDTH_X8; + RootComplex->Pcie[RPStart + 3].MaxWidth =3D LINK_WIDTH_X4; + } + + if (RootComplex->Type =3D=3D RootComplexTypeB && RootComplex->Pcie[RPSta= rt].MaxWidth =3D=3D LINK_WIDTH_X8) { + RootComplex->Pcie[RPStart + 1].MaxWidth =3D LINK_WIDTH_X2; + RootComplex->Pcie[RPStart + 2].MaxWidth =3D LINK_WIDTH_X4; + RootComplex->Pcie[RPStart + 3].MaxWidth =3D LINK_WIDTH_X2; + } + + switch (DevMap) { + case DevMapMode2: + MaxWidth =3D (RootComplex->Type =3D=3D RootComplexTypeA) ? LINK_WIDTH_= X8 : LINK_WIDTH_X4; + RootComplex->Pcie[RPStart].MaxWidth =3D PCIE_GET_MAX_WIDTH (RootComple= x->Pcie[RPStart], MaxWidth); + RootComplex->Pcie[RPStart + 1].Active =3D FALSE; + RootComplex->Pcie[RPStart + 2].MaxWidth =3D PCIE_GET_MAX_WIDTH (RootCo= mplex->Pcie[RPStart + 2], MaxWidth); + RootComplex->Pcie[RPStart + 2].Active =3D TRUE; + RootComplex->Pcie[RPStart + 3].Active =3D FALSE; + break; + + case DevMapMode3: + MaxWidth =3D (RootComplex->Type =3D=3D RootComplexTypeA) ? LINK_WIDTH_= X8 : LINK_WIDTH_X4; + RootComplex->Pcie[RPStart].MaxWidth =3D PCIE_GET_MAX_WIDTH (RootComple= x->Pcie[RPStart], MaxWidth); + RootComplex->Pcie[RPStart + 1].Active =3D FALSE; + MaxWidth =3D (RootComplex->Type =3D=3D RootComplexTypeA) ? LINK_WIDTH_= X4 : LINK_WIDTH_X2; + RootComplex->Pcie[RPStart + 2].MaxWidth =3D PCIE_GET_MAX_WIDTH (RootCo= mplex->Pcie[RPStart + 2], MaxWidth); + RootComplex->Pcie[RPStart + 2].Active =3D TRUE; + RootComplex->Pcie[RPStart + 3].MaxWidth =3D PCIE_GET_MAX_WIDTH (RootCo= mplex->Pcie[RPStart + 3], MaxWidth); + RootComplex->Pcie[RPStart + 3].Active =3D TRUE; + break; + + case DevMapMode4: + MaxWidth =3D (RootComplex->Type =3D=3D RootComplexTypeA) ? LINK_WIDTH_= X4 : LINK_WIDTH_X2; + RootComplex->Pcie[RPStart].MaxWidth =3D PCIE_GET_MAX_WIDTH (RootComple= x->Pcie[RPStart], MaxWidth); + RootComplex->Pcie[RPStart + 1].MaxWidth =3D PCIE_GET_MAX_WIDTH (RootCo= mplex->Pcie[RPStart + 1], MaxWidth); + RootComplex->Pcie[RPStart + 1].Active =3D TRUE; + RootComplex->Pcie[RPStart + 2].MaxWidth =3D PCIE_GET_MAX_WIDTH (RootCo= mplex->Pcie[RPStart + 2], MaxWidth); + RootComplex->Pcie[RPStart + 2].Active =3D TRUE; + RootComplex->Pcie[RPStart + 3].MaxWidth =3D PCIE_GET_MAX_WIDTH (RootCo= mplex->Pcie[RPStart + 3], MaxWidth); + RootComplex->Pcie[RPStart + 3].Active =3D TRUE; + break; + + case DevMapMode1: + default: + MaxWidth =3D (RootComplex->Type =3D=3D RootComplexTypeA) ? LINK_WIDTH_= X16 : LINK_WIDTH_X8; + RootComplex->Pcie[RPStart].MaxWidth =3D PCIE_GET_MAX_WIDTH (RootComple= x->Pcie[RPStart], MaxWidth); + RootComplex->Pcie[RPStart + 1].Active =3D FALSE; + RootComplex->Pcie[RPStart + 2].Active =3D FALSE; + RootComplex->Pcie[RPStart + 3].Active =3D FALSE; + break; + } +} + +VOID +GetDefaultDevMap ( + AC01_ROOT_COMPLEX *RootComplex + ) +{ + if (RootComplex->Pcie[PcieController0].Active + && RootComplex->Pcie[PcieController1].Active + && RootComplex->Pcie[PcieController2].Active + && RootComplex->Pcie[PcieController3].Active) { + RootComplex->DefaultDevMapLow =3D DevMapMode4; + } else if (RootComplex->Pcie[PcieController0].Active + && RootComplex->Pcie[PcieController2].Active + && RootComplex->Pcie[PcieController3].Active) { + RootComplex->DefaultDevMapLow =3D DevMapMode3; + } else if (RootComplex->Pcie[PcieController0].Active + && RootComplex->Pcie[PcieController2].Active) { + RootComplex->DefaultDevMapLow =3D DevMapMode2; + } else { + RootComplex->DefaultDevMapLow =3D DevMapMode1; + } + + if (RootComplex->Pcie[PcieController4].Active + && RootComplex->Pcie[PcieController5].Active + && RootComplex->Pcie[PcieController6].Active + && RootComplex->Pcie[PcieController7].Active) { + RootComplex->DefaultDevMapHigh =3D DevMapMode4; + } else if (RootComplex->Pcie[PcieController4].Active + && RootComplex->Pcie[PcieController6].Active + && RootComplex->Pcie[PcieController7].Active) { + RootComplex->DefaultDevMapHigh =3D DevMapMode3; + } else if (RootComplex->Pcie[PcieController4].Active + && RootComplex->Pcie[PcieController6].Active) { + RootComplex->DefaultDevMapHigh =3D DevMapMode2; + } else { + RootComplex->DefaultDevMapHigh =3D DevMapMode1; + } + + if (RootComplex->DevMapLow =3D=3D 0) { + RootComplex->DevMapLow =3D RootComplex->DefaultDevMapLow; + } + + if (RootComplex->Type =3D=3D RootComplexTypeB && RootComplex->DevMapHigh= =3D=3D 0) { + RootComplex->DevMapHigh =3D RootComplex->DefaultDevMapHigh; + } + + SetRootComplexBifurcation (RootComplex, PcieController0, RootComplex->De= vMapLow); + if (RootComplex->Type =3D=3D RootComplexTypeB) { + SetRootComplexBifurcation (RootComplex, PcieController4, RootComplex->= DevMapHigh); + } +} + +VOID +GetLaneAllocation ( + AC01_ROOT_COMPLEX *RootComplex + ) +{ + EFI_STATUS Status; + INTN RPIndex; + NVPARAM NvParamOffset; + UINT32 Value, Width; + + // Retrieve lane allocation and capabilities for each controller + if (RootComplex->Type =3D=3D RootComplexTypeA) { + NvParamOffset =3D (RootComplex->Socket =3D=3D 0) ? NV_SI_RO_BOARD_S0_R= CA0_CFG : NV_SI_RO_BOARD_S1_RCA0_CFG; + NvParamOffset +=3D RootComplex->ID * NV_PARAM_ENTRYSIZE; + } else { + // + // There're two NVParam entries per RootComplexTypeB + // + NvParamOffset =3D (RootComplex->Socket =3D=3D 0) ? NV_SI_RO_BOARD_S0_R= CB0_LO_CFG : NV_SI_RO_BOARD_S1_RCB0_LO_CFG; + NvParamOffset +=3D (RootComplex->ID - MaxRootComplexA) * (NV_PARAM_ENT= RYSIZE * 2); + } + + Status =3D NVParamGet (NvParamOffset, NV_PERM_ALL, &Value); + if (EFI_ERROR (Status)) { + Value =3D 0; + } + + for (RPIndex =3D 0; RPIndex < MaxPcieControllerOfRootComplexA; RPIndex++= ) { + Width =3D (Value >> (RPIndex * BITS_PER_BYTE)) & BYTE_MASK; + switch (Width) { + case 1: + case 2: + case 3: + case 4: + RootComplex->Pcie[RPIndex].MaxWidth =3D 1 << Width; + RootComplex->Pcie[RPIndex].MaxGen =3D LINK_SPEED_GEN3; + RootComplex->Pcie[RPIndex].Active =3D TRUE; + break; + + case 0: + default: + RootComplex->Pcie[RPIndex].MaxWidth =3D LINK_WIDTH_NONE; + RootComplex->Pcie[RPIndex].MaxGen =3D LINK_SPEED_NONE; + RootComplex->Pcie[RPIndex].Active =3D FALSE; + break; + } + } + + if (RootComplex->Type =3D=3D RootComplexTypeB) { + NvParamOffset +=3D NV_PARAM_ENTRYSIZE; + Status =3D NVParamGet (NvParamOffset, NV_PERM_ALL, &Value); + if (EFI_ERROR (Status)) { + Value =3D 0; + } + + for (RPIndex =3D MaxPcieControllerOfRootComplexA; RPIndex < MaxPcieCon= troller; RPIndex++) { + Width =3D (Value >> ((RPIndex - MaxPcieControllerOfRootComplexA) * B= ITS_PER_BYTE)) & BYTE_MASK; + switch (Width) { + case 1: + case 2: + case 3: + case 4: + RootComplex->Pcie[RPIndex].MaxWidth =3D 1 << Width; + RootComplex->Pcie[RPIndex].MaxGen =3D LINK_SPEED_GEN3; + RootComplex->Pcie[RPIndex].Active =3D TRUE; + break; + + case 0: + default: + RootComplex->Pcie[RPIndex].MaxWidth =3D LINK_WIDTH_NONE; + RootComplex->Pcie[RPIndex].MaxGen =3D LINK_SPEED_NONE; + RootComplex->Pcie[RPIndex].Active =3D FALSE; + break; + } + } + } + + // Do not proceed if no Root Port enabled + if (IsEmptyRC (RootComplex)) { + RootComplex->Active =3D FALSE; + } +} + +NVPARAM +GetGen3PresetNvParamOffset ( + AC01_ROOT_COMPLEX *RootComplex + ) +{ + NVPARAM NvParamOffset; + + if (RootComplex->Socket =3D=3D 0) { + if (RootComplex->Type =3D=3D RootComplexTypeA) { + if (RootComplex->ID < MaxRootComplexA) { + NvParamOffset =3D NV_SI_RO_BOARD_S0_RCA0_TXRX_G3PRESET + RootCompl= ex->ID * NV_PARAM_ENTRYSIZE; + } else { + NvParamOffset =3D NV_SI_RO_BOARD_S0_RCA4_TXRX_G3PRESET + (RootComp= lex->ID - MaxRootComplexA) * NV_PARAM_ENTRYSIZE; + } + } else { + // + // There're two NVParam entries per RootComplexTypeB + // + NvParamOffset =3D NV_SI_RO_BOARD_S0_RCB0A_TXRX_G3PRESET + (RootCompl= ex->ID - MaxRootComplexA) * (NV_PARAM_ENTRYSIZE * 2); + } + } else if (RootComplex->Type =3D=3D RootComplexTypeA) { + if (RootComplex->ID < MaxRootComplexA) { + NvParamOffset =3D NV_SI_RO_BOARD_S1_RCA2_TXRX_G3PRESET + (RootComple= x->ID - 2) * NV_PARAM_ENTRYSIZE; + } else { + NvParamOffset =3D NV_SI_RO_BOARD_S1_RCA4_TXRX_G3PRESET + (RootComple= x->ID - MaxRootComplexA) * NV_PARAM_ENTRYSIZE; + } + } else { + // + // There're two NVParam entries per RootComplexTypeB + // + NvParamOffset =3D NV_SI_RO_BOARD_S1_RCB0A_TXRX_G3PRESET + (RootComplex= ->ID - MaxRootComplexA) * (NV_PARAM_ENTRYSIZE * 2); + } + + return NvParamOffset; +} + +NVPARAM +GetGen4PresetNvParamOffset ( + AC01_ROOT_COMPLEX *RootComplex + ) +{ + NVPARAM NvParamOffset; + + if (RootComplex->Socket =3D=3D 0) { + if (RootComplex->Type =3D=3D RootComplexTypeA) { + if (RootComplex->ID < MaxRootComplexA) { + NvParamOffset =3D NV_SI_RO_BOARD_S0_RCA0_TXRX_G4PRESET + RootCompl= ex->ID * NV_PARAM_ENTRYSIZE; + } else { + NvParamOffset =3D NV_SI_RO_BOARD_S0_RCA4_TXRX_G4PRESET + (RootComp= lex->ID - MaxRootComplexA) * NV_PARAM_ENTRYSIZE; + } + } else { + // + // There're two NVParam entries per RootComplexTypeB + // + NvParamOffset =3D NV_SI_RO_BOARD_S0_RCB0A_TXRX_G4PRESET + (RootCompl= ex->ID - MaxRootComplexA) * (NV_PARAM_ENTRYSIZE * 2); + } + } else if (RootComplex->Type =3D=3D RootComplexTypeA) { + if (RootComplex->ID < MaxRootComplexA) { + NvParamOffset =3D NV_SI_RO_BOARD_S1_RCA2_TXRX_G4PRESET + (RootComple= x->ID - 2) * NV_PARAM_ENTRYSIZE; + } else { + NvParamOffset =3D NV_SI_RO_BOARD_S1_RCA4_TXRX_G4PRESET + (RootComple= x->ID - MaxRootComplexA) * NV_PARAM_ENTRYSIZE; + } + } else { + // + // There're two NVParam entries per RootComplexTypeB + // + NvParamOffset =3D NV_SI_RO_BOARD_S1_RCB0A_TXRX_G4PRESET + (RootComplex= ->ID - MaxRootComplexA) * (NV_PARAM_ENTRYSIZE * 2); + } + + return NvParamOffset; +} + +VOID +GetPresetSetting ( + AC01_ROOT_COMPLEX *RootComplex + ) +{ + EFI_STATUS Status; + INTN Index; + NVPARAM NvParamOffset; + UINT32 Value; + + // Load default value + for (Index =3D 0; Index < MaxPcieControllerOfRootComplexB; Index++) { + RootComplex->PresetGen3[Index] =3D PRESET_INVALID; + RootComplex->PresetGen4[Index] =3D PRESET_INVALID; + } + + NvParamOffset =3D GetGen3PresetNvParamOffset (RootComplex); + + Status =3D NVParamGet (NvParamOffset, NV_PERM_ALL, &Value); + if (!EFI_ERROR (Status)) { + for (Index =3D 0; Index < MaxPcieControllerOfRootComplexA; Index++) { + RootComplex->PresetGen3[Index] =3D (Value >> (Index * BITS_PER_BYTE)= ) & BYTE_MASK; + } + } + + if (RootComplex->Type =3D=3D RootComplexTypeB) { + NvParamOffset +=3D NV_PARAM_ENTRYSIZE; + Status =3D NVParamGet (NvParamOffset, NV_PERM_ALL, &Value); + if (!EFI_ERROR (Status)) { + for (Index =3D MaxPcieControllerOfRootComplexA; Index < MaxPcieContr= oller; Index++) { + RootComplex->PresetGen3[Index] =3D (Value >> ((Index - MaxPcieCont= rollerOfRootComplexA) * BITS_PER_BYTE)) & BYTE_MASK; + } + } + } + + NvParamOffset =3D GetGen4PresetNvParamOffset (RootComplex); + + Status =3D NVParamGet (NvParamOffset, NV_PERM_ALL, &Value); + if (!EFI_ERROR (Status)) { + for (Index =3D 0; Index < MaxPcieControllerOfRootComplexA; Index++) { + RootComplex->PresetGen4[Index] =3D (Value >> (Index * BITS_PER_BYTE)= ) & BYTE_MASK; + } + } + + if (RootComplex->Type =3D=3D RootComplexTypeB) { + NvParamOffset +=3D NV_PARAM_ENTRYSIZE; + Status =3D NVParamGet (NvParamOffset, NV_PERM_ALL, &Value); + if (!EFI_ERROR (Status)) { + for (Index =3D MaxPcieControllerOfRootComplexA; Index < MaxPcieContr= oller; Index++) { + RootComplex->PresetGen4[Index] =3D (Value >> ((Index - MaxPcieCont= rollerOfRootComplexA) * BITS_PER_BYTE)) & BYTE_MASK; + } + } + } +} + +VOID +GetMaxSpeedGen ( + AC01_ROOT_COMPLEX *RootComplex + ) +{ + UINT8 MaxSpeedGen[MaxPcieControllerOfRootComplexA] =3D { LINK_SPEED_GEN4= , LINK_SPEED_GEN4, LINK_SPEED_GEN4, LINK_SPEED_GEN4 }; // Bifurcati= on 0: RootComplexTypeA x16 / RootComplexTypeB x8 + UINT8 ErrataSpeedDevMap3[MaxPcieControllerOfRootComplexA] =3D { LINK_SPE= ED_GEN4, LINK_SPEED_GEN4, LINK_SPEED_GEN1, LINK_SPEED_GEN1 }; // Bifurcati= on 2: x8 x4 x4 (PCIE_ERRATA_SPEED1) + UINT8 ErrataSpeedDevMap4[MaxPcieControllerOfRootComplexA] =3D { LINK_SPE= ED_GEN1, LINK_SPEED_GEN1, LINK_SPEED_GEN1, LINK_SPEED_GEN1 }; // Bifurcati= on 3: x4 x4 x4 x4 (PCIE_ERRATA_SPEED1) + UINT8 ErrataSpeedRcb[MaxPcieControllerOfRootComplexA] =3D { LINK_SPEED_G= EN1, LINK_SPEED_GEN1, LINK_SPEED_GEN1, LINK_SPEED_GEN1 }; // RootCompl= exTypeB PCIE_ERRATA_SPEED1 + UINT8 Idx; + UINT8 *MaxGen; + + ASSERT (MaxPcieControllerOfRootComplexA =3D=3D 4); + ASSERT (MaxPcieController =3D=3D 8); + + // + // Due to hardware errata, for A0/A1* + // RootComplexTypeB is limited to Gen1 speed. + // RootComplexTypeA x16, x8 port supports up to Gen4, + // RootComplexTypeA x4 port only supports Gen1. + // + MaxGen =3D MaxSpeedGen; + if (RootComplex->Type =3D=3D RootComplexTypeB) { + if (RootComplex->Flags & PCIE_ERRATA_SPEED1) { + MaxGen =3D ErrataSpeedRcb; + } + } else { + switch (RootComplex->DevMapLow) { + case DevMapMode3: /* x8 x4 x4 */ + if (RootComplex->Flags & PCIE_ERRATA_SPEED1) { + MaxGen =3D ErrataSpeedDevMap3; + } + break; + + case DevMapMode4: /* x4 x4 x4 x4 */ + if (RootComplex->Flags & PCIE_ERRATA_SPEED1) { + MaxGen =3D ErrataSpeedDevMap4; + } + break; + + case DevMapMode2: /* x8 x8 */ + case DevMapMode1: /* x16 */ + default: + break; + } + } + + for (Idx =3D 0; Idx < MaxPcieControllerOfRootComplexA; Idx++) { + RootComplex->Pcie[Idx].MaxGen =3D RootComplex->Pcie[Idx].Active ? MaxG= en[Idx] : LINK_SPEED_NONE; + } + + if (RootComplex->Type =3D=3D RootComplexTypeB) { + for (Idx =3D MaxPcieControllerOfRootComplexA; Idx < MaxPcieController;= Idx++) { + RootComplex->Pcie[Idx].MaxGen =3D RootComplex->Pcie[Idx].Active ? + MaxGen[Idx - MaxPcieControllerOfRoot= ComplexA] : LINK_SPEED_NONE; + } + } +} + +VOID +ParseRootComplexNVParamData ( + IN OUT AC01_ROOT_COMPLEX *RootComplex + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + UINT32 EFuse; + UINT8 RootComplexID; + VOID *Hob; + + EFuse =3D 0; + Hob =3D GetFirstGuidHob (&gPlatformInfoHobGuid); + if (Hob !=3D NULL) { + PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + EFuse =3D PlatformHob->RcDisableMask[0] | (PlatformHob->RcDisableMask[= 1] << AC01_PCIE_MAX_RCS_PER_SOCKET); + DEBUG (( + DEBUG_INFO, + "RcDisableMask[0]: 0x%x [1]: 0x%x\n", + PlatformHob->RcDisableMask[0], + PlatformHob->RcDisableMask[1] + )); + + // Update errata flags for Ampere Altra + if ((PlatformHob->ScuProductId[0] & 0xff) =3D=3D 0x01) { + if (PlatformHob->AHBCId[0] =3D=3D 0x20100 + || PlatformHob->AHBCId[0] =3D=3D 0x21100 + || (IsSlaveSocketActive () + && (PlatformHob->AHBCId[1] =3D=3D 0x20100 + || PlatformHob->AHBCId[1] =3D=3D 0x21100))) + { + RootComplex->Flags |=3D PCIE_ERRATA_SPEED1; + DEBUG ((DEBUG_INFO, "RootComplex[%d]: Flags 0x%x\n", RootComplex->= ID, RootComplex->Flags)); + } + } + } + + RootComplexID =3D RootComplex->Socket * AC01_PCIE_MAX_RCS_PER_SOCKET + R= ootComplex->ID; + RootComplex->DefaultActive =3D !(EFuse & BIT (RootComplexID)) ? TRUE : F= ALSE; + if (!IsSlaveSocketActive () && RootComplex->Socket =3D=3D 1) { + RootComplex->DefaultActive =3D FALSE; + } + RootComplex->Active =3D RootComplex->Active && RootComplex->DefaultActiv= e; + + GetPresetSetting (RootComplex); + GetLaneAllocation (RootComplex); + GetDefaultDevMap (RootComplex); + GetMaxSpeedGen (RootComplex); +} --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83825): https://edk2.groups.io/g/devel/message/83825 Mute This Topic: https://groups.io/mt/87123881/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83826+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83826+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167822893821.2328042220184; Wed, 17 Nov 2021 08:50:22 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id wmEwYY1788612x1sWk42GoMY; Wed, 17 Nov 2021 08:50:22 -0800 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.126]) by mx.groups.io with SMTP id smtpd.web10.9746.1637167821741099374 for ; Wed, 17 Nov 2021 08:50:21 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ddTUwUlN4NVUES/DFCwNaqwILLA/r5Vgk9z7tHqtEdeT7VO+Th8JpAPP0FBWuXVf/eR+tjIlzHtS0jd2DI+7TWzzFnfXW70M8CpyY744EbDJ1LhnfD676/j7yRL4WrhlxYKViunSFo1vSxX5JnBrtu7NwE01scrh77pdIEW1R4kzLGJcTJpBFIP8d8Q4M8JnYEihZNa8owGpVK2ZtwwSRlXdBjqpZgNikxq/DrzN5+dzKkAYrJj6W8ejICWPrfbA3DjuqVBHynVAlKoVG7xYFFlU+OdlUS7cuCUcGWOqAHBvQs629Xt2zs3VJO7YOik+VIcwqBJ7aXSwvwBwxiXrlQ== 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=Sz4XJDfSLrk2dbtDQNnXqblZna7OXZrdjwDmj8Dy2Io=; b=G/u3rzHUln99WQIyK6ADzJ9i7LsfiFxCoeIZWYBLJBugQz/Y0yv149ANtaD8hRUWEiczDar8JmkztcQlLvQboICaEwtoOn3IysAWUytG7ekJJBAalL+JK8tuQju9W2YPiogu3SE7QuUBB45ByiBF4/tLYoGJ9rUHC3nKZpxfpP92fcwiletTaabI9j+YkDh8ObGdUXYUjaOVWZmBuvTP2TW0JQAVQHCZuvrKK/fywAXReKtSc+KmL7Ytw9iQECLeoriQ+iXZRwgjhololWamXfaQfJk1uxbiIxrtIAlgSQBAAnHZNQOuAyK0LX4ZjGrz283Bq7qtoLTtBq2q/7tsRQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB6454.prod.exchangelabs.com (2603:10b6:510:1b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.20; Wed, 17 Nov 2021 16:50:20 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:20 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 14/30] AmpereAltraPkg: Add PciHostBridgeLib library instance Date: Wed, 17 Nov 2021 23:47:11 +0700 Message-ID: <20211117164727.10922-15-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:50:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b965a43d-a991-41ce-1f14-08d9a9ea5750 X-MS-TrafficTypeDiagnostic: PH0PR01MB6454: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:660; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: G245O9bOSvJMMdWv68fEDtWACCCGYTYhHhpOjpdz+DSxIuo3/WuW1r+PpiCaYnJahw4seS0Cu+P3j63G1Mwy9SdbsKP9JQJ9Y0RDh4FwGKpsCRAimiu20ku4Q0U06DLgGRLNzCsTTFYaKc/QDObG1Q8tUDN4LGVKQ4/NsK32mSVcQu5k6fU0L3BGojeSZnjBOGki0yRmnviHXIxfSqHQ2TmdK7Aye8JzTsclNgpdOi7FC67FyZ1XWiSS+mA1aho2K0AZ4xrK736E4iahvyDJI4H4idfR3byScJMCyMoUjeAEkgsOWzcHczAHK8hAIRz76DBAQmMrZtPQReClADvraDbKnMiYr368nsypYVRWRRsDyryamIE+/aByoRZWhd65mWrAT87fRts/gvaay22MKbFLsbmLbguRJRcfPMiZ2Br8kAzOqTVdVK4ubLqe5X5KJz1WVIqTIM/DxdsqKnMHfWa2xwOB3dYuogOMbnHM/2FQplouUHE+m/AZgItdfg1pXAeCTLJJofLZivqzUwMDW/GZIx2qY5GopH2WylFyxu5TLfcZD88lq0EvN6GMhDH1lgt929raCf/SXUeDr7aLCDcct5Bis4we4MLzdWImU2PGpIAPV60UphNUaIqpD90+1h3PyDMXmKqvBLABFe4QxHU2haSusWeRCPVGQQeaP2fIYbj7FLz8kLvdoOZHl9erUNKN9YCO4uyPzE5D8c1Owg== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ACmQNPG+4UvzdITjZlU2wlbDGnMXQ9lv+5UsX4t6Qqu2LymrFMWbvYm4Bj4y?= =?us-ascii?Q?7wVADtFwB243+RdKjpLSD0C0FrRfWr6Gv3FK1F2QT9iU+MAElIBNzqX0Soof?= =?us-ascii?Q?DUjEWc3ROvQn3e1XvaiaC4e2SsZyC7FwiHX9jAd+t1OyEX/ddrf/lCLXoALK?= =?us-ascii?Q?Ng8nf/vhn/xGzsfRWFtbhrKGnIT2XGvUtYD6YwZ0EYLm3Q7NC8sf7M89AN9X?= =?us-ascii?Q?wa46AWVWTo/DMwJIiEgf2VlqbUP0orYXPm9vP3hhJa20hMdY9CYT5RKPfgkz?= =?us-ascii?Q?8MrWtCGeMDfCFCxAQcWFrZDS0M6xvqDQgsOUMUuxhmVVSza85+IyBpnTBq+w?= =?us-ascii?Q?3O6x8HMS3LbhWDSiiFak2oWU1Lh7YSRGHhSUf2J/2ZqbhVcyTRbEWw+lyyEV?= =?us-ascii?Q?JeYPpsO4fb78vqWnDCcQ3ErJjyb4rZPNrYWAbUG3Cbnoz8kyM0WhS9ehRBSa?= =?us-ascii?Q?FJkmzgJpEhuT9FXJkNotwjujD6qVeoGhBmuvwLNnEERGNJorymfwKXRe2svO?= =?us-ascii?Q?LtzpA51W2qzoc+dp6MKvWoDz69TAntAHPP7bxUzs+kL/hi5GUXG9DktMgn+h?= =?us-ascii?Q?/IakRAym2xqDfT4lEabCNFUZtAwwCypLnoqq4nFbPY7PUvpsVV7iGXP3xuqO?= =?us-ascii?Q?z+Eb4uEZWLH8Gs/sWDD3Vkn0txj61StZrIA9TF2+MhVO38bXBI1yHW5r5iWm?= =?us-ascii?Q?APcKoMRWJAvs/9XrjUEPhIGuw5sX6zg7CcUPp3dXGoDah/iv9dEuSwGcErs9?= =?us-ascii?Q?6m5TE4gRFu2qitoG6rxN0zFKGmUpr1F2MrZeIQm6Y0FT8tyjkyiJTtNixDPK?= =?us-ascii?Q?JJLfBt5HhAGrj1yXwDjdNUn8Z82Rvi/p0sXQKAGju/R3evnUU6hUPtDv1kce?= =?us-ascii?Q?zXXLL5vLE13iy/T4d/bXXtmInRlB76qxLsTOoUFygaWFBuizEMCfizkAGDEp?= =?us-ascii?Q?ALp3+6G9U6/mDDIXWi+PMhXfhOTYUGoSRd2F9/zjaRABr9knm3jtAKrMmxOr?= =?us-ascii?Q?GJP8haf6mMzPv+zmb9NVoVtn+tVyjBH7bco9hC0hEMRosqQO5aaT7lR+P2X8?= =?us-ascii?Q?95RUHYO4SO3kM4Ns9jh52rX/gSyKaqsrWjGztwzlGraL3RWKSRNSws4Ykrv8?= =?us-ascii?Q?sjYjWCv7bpym45qI1QfEA8QFx2h2a0VVNvDtoqpIalFKhUL2swqFQOKG1vXK?= =?us-ascii?Q?Pqh20Tyickyh8U/9YvsquMWHmg3q1IXiXX3cG9Hj6ZY741zXKgjF9SIi5+PV?= =?us-ascii?Q?xoudN6m0IFraKAjzx1IQPEnzxwkMsv1+BvVRwIofYbQ22R0biLztntvYdL75?= =?us-ascii?Q?0vtI0JJBcNRn2zWG0h52fsxHfHISokVQNpKNTprg4FrMAwj5L+CCARGplh5z?= =?us-ascii?Q?jUFQ4qwkBIQ+HQZO7DBuIy6gFp5EjbnmSwU2gDLd82HMtGn39RXmtyw62TrA?= =?us-ascii?Q?oGaya/TTLxYQBM144SMpkxeQsAazJWRqTWdbanD+Ugh+EQdakKpqKfcFigtt?= =?us-ascii?Q?Ov9VKGYoTXVvd5Tq37keMr1ocZxuCmzL3Nd2HsGPRn2TVoknvq0sArZm3Tmb?= =?us-ascii?Q?sTwzN3OtFKpIYMQ4GmuEaBuVpAcG9REjHLH5uEa0HfQkAOavES2NxW2LdiQQ?= =?us-ascii?Q?V8VeTj/8SbjiuErW6Jweb79VdBFiHvdyTYhIcP6UG4R5qhkjfUxdVhDNwRMu?= =?us-ascii?Q?C6zFgF0hWqgHm1cJDBhcc3+DlU0=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: b965a43d-a991-41ce-1f14-08d9a9ea5750 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:20.5251 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vbU3II/TgexX0ZA67S1lNGeLzij278gfWqC9IddgA3Py+kT8GQxhP0zBTlKByN/jiGToZJEYCPj9t26vq0S/QgkWfOXYNcFuV2HzswgPGOU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6454 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: 79ej9AiInaXp7AhPjEZ8EKJqx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167822; bh=nUJEyoVAsBg3rp296QIqlo0/BGcGQU6UQhFiU97jJ1w=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=ETXJHxoHepl2IcImzzNSv2IO/aL0df2lz/aYC+sQ7lA2ZM+J+kHzjjbyrocpbltoCyi Oq/a0IPe3RVc/tZLILmQgTTRi9Sy/jUyTuh/uF/JLhG0kl7KNwMVgKBVdpmFXdox4Lq41 2HqXYCOYHdlhwHyyhZ666Bq+lcP4Wh2NrRU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167823977100001 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen Provides the number of supported RootBridges and the resource allocated for each RootBridge. These information are essential to the HostBridge driver to initialize the PCIe subsystem. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc = | 1 + Silicon/Ampere/AmpereAltraPkg/Library/PciHostBridgeLib/PciHostBridgeLib.in= f | 39 +++ Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h = | 5 + Silicon/Ampere/AmpereAltraPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c = | 256 ++++++++++++++++++++ 4 files changed, 301 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index b08bdd82177e..e13777934173 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -225,6 +225,7 @@ [LibraryClasses.common.DXE_DRIVER] SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeS= ecurityManagementLib.inf PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.= inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf + PciHostBridgeLib|Silicon/Ampere/AmpereAltraPkg/Library/PciHostBridgeLib/= PciHostBridgeLib.inf =20 [LibraryClasses.common.UEFI_APPLICATION] UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiTianoCust= omDecompressLib.inf diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/PciHostBridgeLib/PciHost= BridgeLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/PciHostBridgeLib/PciH= ostBridgeLib.inf new file mode 100644 index 000000000000..fdc7ea8862dc --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/PciHostBridgeLib/PciHostBridgeL= ib.inf @@ -0,0 +1,39 @@ +## @file +# +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D PciHostBridgeLib + FILE_GUID =3D 9D0522E5-B5FD-4E3F-9D10-52AE221FA314 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D PciHostBridgeLib|DXE_DRIVER + +[Sources] + PciHostBridgeLib.c + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseMemoryLib + DebugLib + DevicePathLib + HobLib + MemoryAllocationLib + +[Guids] + gRootComplexInfoHobGuid + +[Protocols] + gEfiCpuIo2ProtocolGuid ## CONSUMES + +[Depex] + gEfiCpuIo2ProtocolGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h b/Silico= n/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h index f3e6b4041737..132c0d6d6cac 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h @@ -239,6 +239,11 @@ // #define AC01_PCIE_MAX_RCS_PER_SOCKET 8 =20 +// +// The size of IO space +// +#define AC01_PCIE_IO_SIZE 0x2000 + // // The base address of {TCU, CSR, MMCONFIG} Registers // diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/PciHostBridgeLib/PciHost= BridgeLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/PciHostBridgeLib/PciHos= tBridgeLib.c new file mode 100644 index 000000000000..cf0f0ee32147 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/PciHostBridgeLib/PciHostBridgeL= ib.c @@ -0,0 +1,256 @@ +/** @file + PCI Host Bridge Library instance for Ampere Altra-based platforms. + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +GLOBAL_REMOVE_IF_UNREFERENCED +STATIC CHAR16 CONST * CONST mPciHostBridgeLibAcpiAddressSpaceTypeStr[] =3D= { + L"Mem", L"I/O", L"Bus" +}; + +#pragma pack(1) +typedef struct { + ACPI_HID_DEVICE_PATH AcpiDevicePath; + EFI_DEVICE_PATH_PROTOCOL EndDevicePath; +} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH; +#pragma pack () + +STATIC EFI_PCI_ROOT_BRIDGE_DEVICE_PATH mEfiPciRootBridgeDevicePath =3D { + { + { + ACPI_DEVICE_PATH, + ACPI_DP, + { + (UINT8)(sizeof (ACPI_HID_DEVICE_PATH)), + (UINT8)((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) + } + }, + EISA_PNP_ID (0x0A08), // PCIe + 0 + }, { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { + END_DEVICE_PATH_LENGTH, + 0 + } + } +}; + +STATIC PCI_ROOT_BRIDGE mRootBridgeTemplate =3D { + 0, // Segment + 0, // Supports + 0, // Attributes + TRUE, // DmaAbove4G + FALSE, // NoExtendedConfigSpace + FALSE, // ResourceAssigned + EFI_PCI_HOST_BRIDGE_MEM64_DECODE, + { + // Bus + 0, + 0xFF, + 0 + }, { + // Io + 0, + 0, + 0 + }, { + // Mem + MAX_UINT64, + 0, + 0 + }, { + // MemAbove4G + MAX_UINT64, + 0, + 0 + }, { + // PMem + MAX_UINT64, + 0, + 0 + }, { + // PMemAbove4G + MAX_UINT64, + 0, + 0 + }, + (EFI_DEVICE_PATH_PROTOCOL *)&mEfiPciRootBridgeDevicePath +}; + +/** + Return all the root bridge instances in an array. + + @param Count Return the count of root bridge instances. + + @return All the root bridge instances in an array. + The array should be passed into PciHostBridgeFreeRootBridges() + when it's not used. +**/ +PCI_ROOT_BRIDGE * +EFIAPI +PciHostBridgeGetRootBridges ( + UINTN *Count + ) +{ + AC01_ROOT_COMPLEX *RootComplex; + AC01_ROOT_COMPLEX *RootComplexList; + EFI_PCI_ROOT_BRIDGE_DEVICE_PATH *DevicePath; + PCI_ROOT_BRIDGE *RootBridge; + PCI_ROOT_BRIDGE *RootBridges; + UINT8 Index; + UINT8 RootBridgeCount =3D 0; + VOID *Hob; + + Hob =3D GetFirstGuidHob (&gRootComplexInfoHobGuid); + if (Hob =3D=3D NULL) { + return NULL; + } + + RootComplexList =3D (AC01_ROOT_COMPLEX *)GET_GUID_HOB_DATA (Hob); + + RootBridges =3D AllocatePool (AC01_PCIE_MAX_ROOT_COMPLEX * sizeof (PCI_R= OOT_BRIDGE)); + if (RootBridges =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "%a: Failed to allocate RootBridges\n", __FUNCTIO= N__)); + return NULL; + } + + for (Index =3D 0; Index < AC01_PCIE_MAX_ROOT_COMPLEX; Index++) { + RootComplex =3D &RootComplexList[Index]; + if (!RootComplex->Active) { + continue; + } + RootBridge =3D &RootBridges[RootBridgeCount]; + CopyMem (RootBridge, &mRootBridgeTemplate, sizeof (PCI_ROOT_BRIDGE)); + + if (RootComplex->Mmio32Base !=3D 0) { + RootBridge->Mem.Base =3D RootComplex->Mmio32Base; + RootBridge->Mem.Limit =3D RootComplex->Mmio32Base + RootComplex->Mmi= o32Size - 1; + RootBridge->PMem.Base =3D RootBridge->Mem.Base; + RootBridge->PMem.Limit =3D RootBridge->Mem.Limit; + RootBridge->Io.Base =3D RootComplex->Mmio32Base + RootComplex->Mmio3= 2Size - AC01_PCIE_IO_SIZE; + RootBridge->Io.Limit =3D RootBridge->Mem.Limit; + } + + if (RootComplex->MmioBase !=3D 0) { + RootBridge->PMemAbove4G.Base =3D RootComplex->MmioBase; + RootBridge->PMemAbove4G.Limit =3D RootComplex->MmioBase + RootComple= x->MmioSize - 1; + } + + RootBridge->Segment =3D RootComplex->Logical; + + DevicePath =3D AllocateCopyPool ( + sizeof (EFI_PCI_ROOT_BRIDGE_DEVICE_PATH), + (VOID *)&mEfiPciRootBridgeDevicePath + ); + if (DevicePath =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "%a: Failed to allocate device path\n", __FUNCT= ION__)); + return NULL; + } + + // + // Embedded the Root Complex Index into the DevicePath + // This will be used later by the platform NotifyPhase() + // + DevicePath->AcpiDevicePath.UID =3D Index; + + RootBridge->DevicePath =3D (EFI_DEVICE_PATH_PROTOCOL *)DevicePath; + RootBridgeCount++; + } + + *Count =3D RootBridgeCount; + return RootBridges; +} + +/** + Free the root bridge instances array returned from PciHostBridgeGetRootB= ridges(). + + @param Bridges The root bridge instances array. + @param Count The count of the array. +**/ +VOID +EFIAPI +PciHostBridgeFreeRootBridges ( + PCI_ROOT_BRIDGE *Bridges, + UINTN Count + ) +{ + // + // Unsupported + // +} + +/** + Inform the platform that the resource conflict happens. + + @param HostBridgeHandle Handle of the Host Bridge. + @param Configuration Pointer to PCI I/O and PCI memory resource + descriptors. The Configuration contains the reso= urces + for all the root bridges. The resource for each = root + bridge is terminated with END descriptor and an + additional END is appended indicating the end of= the + entire resources. The resource descriptor field + values follow the description in + EFI_PCI_HOST_BRIDGE_RESOUrce_ALLOCATION_PROTOCOL + .SubmitResources(). +**/ +VOID +EFIAPI +PciHostBridgeResourceConflict ( + EFI_HANDLE HostBridgeHandle, + VOID *Configuration + ) +{ + EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor; + UINTN RootBridgeIndex; + DEBUG ((DEBUG_ERROR, "PciHostBridge: Resource conflict happens!\n")); + + RootBridgeIndex =3D 0; + Descriptor =3D (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)Configuration; + while (Descriptor->Desc =3D=3D ACPI_ADDRESS_SPACE_DESCRIPTOR) { + DEBUG ((DEBUG_ERROR, "RootBridge[%d]:\n", RootBridgeIndex++)); + for (; Descriptor->Desc =3D=3D ACPI_ADDRESS_SPACE_DESCRIPTOR; Descript= or++) { + ASSERT (Descriptor->ResType < + (sizeof (mPciHostBridgeLibAcpiAddressSpaceTypeStr) / + sizeof (mPciHostBridgeLibAcpiAddressSpaceTypeStr[0]) + ) + ); + DEBUG ((DEBUG_ERROR, " %s: Length/Alignment =3D 0x%lx / 0x%lx\n", + mPciHostBridgeLibAcpiAddressSpaceTypeStr[Descriptor->ResType= ], + Descriptor->AddrLen, Descriptor->AddrRangeMax + )); + if (Descriptor->ResType =3D=3D ACPI_ADDRESS_SPACE_TYPE_MEM) { + DEBUG ((DEBUG_ERROR, " Granularity/SpecificFlag =3D %ld / %02x= %s\n", + Descriptor->AddrSpaceGranularity, Descriptor->SpecificFlag, + ((Descriptor->SpecificFlag & + EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETC= HABLE + ) !=3D 0) ? L" (Prefetchable)" : L"" + )); + } + } + // + // Skip the END descriptor for root bridge + // + ASSERT (Descriptor->Desc =3D=3D ACPI_END_TAG_DESCRIPTOR); + Descriptor =3D (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)( + (EFI_ACPI_END_TAG_DESCRIPTOR *)Descriptor + 1 + ); + } +} --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83826): https://edk2.groups.io/g/devel/message/83826 Mute This Topic: https://groups.io/mt/87123888/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83828+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83828+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167828977844.9239804652799; Wed, 17 Nov 2021 08:50:28 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id i0uWYY1788612x7UJrf7fAHm; Wed, 17 Nov 2021 08:50:28 -0800 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.93]) by mx.groups.io with SMTP id smtpd.web10.9748.1637167827820064282 for ; Wed, 17 Nov 2021 08:50:28 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AeMiCUUoKfnGfgK4un8CE0mqWgz6ddQcNF6mv2SFL/Xt/NOH4uYbZRrYJ5ece8L2OL53tz/NU2DGdYrlrGjSBGdBSSeaiWUULxv2VUE4jxCKTPqmgY5kMh2PDz5mlY1hQjDZ2ee/GoS3SCbO2qwJ0km44iM39tdbIiXJln0OTEy47Qovui5/VQee/6KoEDUDQ+cwbfj9g1gL4Zng97uiIuM8Erd8ye77DYKzW9dMgOzEycfz4xC53C+jL3er/76M9ZiL3tJgCNG4FU3oRo5WnZ/e/r0TOAta80fMjD4ydUsFHd7nkjzDHcXNGOSnC2zgWBLzdBoeLma/21KENUnLSQ== 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=7B1uWOPBevX8og4VJOf9o68eV6NoOdRHmhnqsVYQtkM=; b=VG1vII18QWSoaChmjTfdaxRjownsr5/GzWD0XX9NjZ8crnvYnNwGke4NH5JMdjIbP9PCLhC9lmajpPvhIablCdZXLk2+yeMavUFBKE0aN2oSZM6V7OwB+FKIPLGX6E52E4R4DCTJMJ4n4y/DBR7P11v9H/fMBJGOe3FVWJfJoLYy//ltny9dxZgEsuT86c7BU9svlqZZUXox8dFoO1K3zpdm/TlhejJmWS6P/CYx5uyAR8jwvomAe9na80q2xcsLyMMk7pisuS9+0/f+ggcHY9n9n17qfnmdPLjz/DEnIfgXg85PfAcKV7xn8qANK5tcGGT8LGmY9uci4elEIyyeuQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB7521.prod.exchangelabs.com (2603:10b6:510:f4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Wed, 17 Nov 2021 16:50:23 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:23 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 15/30] AmpereAltraPkg: Add PciSegmentLib library instance Date: Wed, 17 Nov 2021 23:47:12 +0700 Message-ID: <20211117164727.10922-16-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:50:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cbd18228-7d3a-4890-60d5-08d9a9ea593f X-MS-TrafficTypeDiagnostic: PH0PR01MB7521: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: 6Si4nsPt0PokZHZ0zAYEusIorpIjgd+gOqohNPRT9qaZRjhwZ94/jo8B+rRvUe0gMUUEC+82c1Xn4TgYhsDvfRlyCKnB35FCg+kcNtnipU4OKn0A7f/Wrl7E/Wph+Xo/mE0j3rdngcTNWuo34JMo4QgyOyqJe+VYHqfTzUqBV+8AbnpVLLoeVblZmw+nEKxcEBbIjGy9fh9ng6scl/FK+kkgd8M6qEke75wiHXDPhurDG2rbB9KeuHGGGqU2CMfSH3G+dqMOxYm7MUl+4fySctO+9KTji9Oc6aqQVgpGYBJvHU0wedvoKQCccDEyy6UxaPLY8kF5H6jIi1pkmZtUaABJI2BoMO53ASyq1Vpyrlq7iOJ4P/9fuVJKv2TcOg2RDYzb6yjshrw5tPwusEQAQtQZwNS0qiFaoJTUwsRznbOqw7FhiPNoMnrtkov8+SMseWzGtUkDGZ52KfBcdC2ATnkN7hkpi5ZmKW7xGYpGkz0ReJdaj4rWx3LwYrP8iTdKs720hEWvQ9hFfFAsB5ElKLtbnjv8sbNftWBtICs2zJ9fBGG2H2gbBCO1thTVWL1Vfgo6XmQyiAFqQlsEs/pr2+1DlukuvWh3Rxdauv8dW5DXUoVV7U+/T50U2/tSEMv7gHxgkBDrRJR/itSDBKSZKeSwV2mPf2IVmk+YoJIJQ2RWsUlA9PjLMqW6Rv79IGHy2uGZBDnBIjOiP0KM0Tw3Gg== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?yiSvqPzKdtZwny5w7PoiavVP1WWLl6tRQeR9rQZRThG4Z+2QAO5NFMf6KvA6?= =?us-ascii?Q?mUTo0RYy76ewt/+nMHQPcQXTVmdpa1zF0Hm4LqiYUc/+SuYUfuqZwql+FZBB?= =?us-ascii?Q?LXO1Y+/I5iKPgzZ8vVig0HSSRKUhmomdYwRWYDf6oFLr44mhFsJMl0qcvNe7?= =?us-ascii?Q?VAk5sJriw6XqFTIWp7FKvlzw73XtIs4RGY+EQ4KSDCmNvtoxanTsOqvNyw6q?= =?us-ascii?Q?lEWbSweaF0riM8Vuitt9iUvyCIhazWw0ZVcH0YdEuoqY38ezPO7BTBHAf+Sz?= =?us-ascii?Q?8djQnI7Jk8RLalmGsCVqsJTePp9ydhcjLzv1f5ms2RauLfH7tchIVFVKXO2K?= =?us-ascii?Q?CsB2lwWoSnzF3NZBqU8PvttPPQjN6an4iKPrJTgPhqePzxH0Us5mpOhJdOps?= =?us-ascii?Q?8hXaBs5PqJxBgtTlz6tb06QeM5mf7LbbCjoY4/4psYE8mZhYtlxeFg5SW4XP?= =?us-ascii?Q?IaDCEKnB2GFjEoK+hmVx/lM5eW3RaY48Z1hKaV0I/V6yGbPu5fg1KbyRHHPW?= =?us-ascii?Q?dKNPQEoCb7grApOggr4eWY8EGM6kagL1wpJhda6AiqybGHpbvs2kBJP6P/+M?= =?us-ascii?Q?QWE4ihbNEgwwqoXYBnCmV3cY48ZIY1lUaJhkTGT5Q0lpEBP38IvUORvRqzNN?= =?us-ascii?Q?1xgUYCfSrK/ckeZCytF/tqNZVzlviizClwdukjnmNvcg81WRXQ4S4u8yW6Dx?= =?us-ascii?Q?0Si69gHU/oc/QJeiFd49r4IawcKsQwcO/gAZ9XGUoJlnWs1CqnTNBUfh7SB8?= =?us-ascii?Q?4CR7zAGpxL4x4CDyWFVM4/xh6OlNP4qqiPxMZZQ+umjWIxLXPH3GFoPUhj4O?= =?us-ascii?Q?rrH7KhclQVL3nR9/J7J09bUKeWvG3L+5bui8HQjmMWOilSEPJVzcmjaRsB9q?= =?us-ascii?Q?DzwW1ETLZQmhCuynZkOgc2hciKF7LXMTcmho/loUu+5CcmAFKqSxpy2IfB5U?= =?us-ascii?Q?wQ8cHHR8jH+cNYu5w8N9KS3pHUisehJGxcKYfJICTJjaywyI6PYvbywn+SlU?= =?us-ascii?Q?vuTscP8vyS//uEqRSSQNf8h/WidZOn7Rqx4IG3A5sO9OlwSRd1YDDYFsFL80?= =?us-ascii?Q?fOtWIRn8Ka61gD4WBGh1Y9Yqes8tTmjNxSlaw97jZvWdkAybAhTx4vQv2fMI?= =?us-ascii?Q?fXIz7ynHqjvKrunppjnNV3yJrwp4wROb191Pckv/GK+TuTH5dNfq2kjy6fqf?= =?us-ascii?Q?OwUmy/5alQPlaEVThvnbRsTLAmeT/qeFICcoYZqMh0/7YxbvHYQdErQS7AOS?= =?us-ascii?Q?IrLUb6W13xmckeKlB409QN4NnrURCUKAjYzKg02R2gF1Uza5sQSc4pdTFqjK?= =?us-ascii?Q?KZ2ExIUXB81kx4qYpFMrtx0Wm/G4oLr9wQvD0kyyy71ytv3YXI2PtgFrqxAg?= =?us-ascii?Q?IO5y+ZNyKBH0RzXJJsMChtkBaV+z3LUwLIwbtoRH4lhfVUvuC2i9WI9HdQmF?= =?us-ascii?Q?P5dimbD1vF8JX2rEtTowcTZ6Lr0hVi07/cOcjKUJt4FIIRoFsJEwgvGvpSpz?= =?us-ascii?Q?eIHYRhQpH0sKzFK/9hBFMG6KXi9aCLEHE/BU2+0+31hptfIivnj7zLyty7ZS?= =?us-ascii?Q?+6hzr6rrDcI/pUo3G1DEx9xeXjIVy6LIbUe7hVHvnggNN1I5dOHm2EE2YEBw?= =?us-ascii?Q?pEd//xgXtkF6Es6ubc8rGqLht+OcDyeyCVCbcmT+Co2gLo/oXS2EA/kUKK+H?= =?us-ascii?Q?8COVdRO3we/G+07mVs6Dulmnns0=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: cbd18228-7d3a-4890-60d5-08d9a9ea593f X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:23.7668 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: N7rHON6p72Icp+wcd7qKVQNFtns3itfgISqaRmzxumToSwxP0Dt9GgC1wJPg2hS88cPHV1sX7Immn2F6tAsADWBfSP/180eJJ9eonqf4MOY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7521 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: 61pZSlmB95pCmHbsTJjVJmbOx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167828; bh=Fxb5n2gCRdXrQ1Gu1vhuaCksG2cTlhLEo3FTJHJMJwA=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=EBPhjClykBuWxeXgikwOGrtk8656H1y2716rvNQseSDg/nWJ2DNFt8JcoeXNEh/me9l ndpLSgy9Tkb/ynCg/6mMZlmzv+k3fFIsv2kX5q9hB0rhUh4ef2LK2rjQEKdPP3VWyL9hD thxy4jvXlI1r3D+dY0J5JGCyc+mIFIMO/DQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167830878100007 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen Provides functions to handle the PCIe configuration requests. The target Root Complex is selected based on the segment number parsed from the input address. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc = | 1 + Silicon/Ampere/AmpereAltraPkg/Library/PciSegmentLibPci/PciSegmentLibPci.in= f | 32 + Silicon/Ampere/AmpereAltraPkg/Library/PciSegmentLibPci/PciSegmentLib.c = | 1523 ++++++++++++++++++++ 3 files changed, 1556 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index e13777934173..cea1ff6b26ef 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -226,6 +226,7 @@ [LibraryClasses.common.DXE_DRIVER] PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.= inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf PciHostBridgeLib|Silicon/Ampere/AmpereAltraPkg/Library/PciHostBridgeLib/= PciHostBridgeLib.inf + PciSegmentLib|Silicon/Ampere/AmpereAltraPkg/Library/PciSegmentLibPci/Pci= SegmentLibPci.inf =20 [LibraryClasses.common.UEFI_APPLICATION] UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiTianoCust= omDecompressLib.inf diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/PciSegmentLibPci/PciSegm= entLibPci.inf b/Silicon/Ampere/AmpereAltraPkg/Library/PciSegmentLibPci/PciS= egmentLibPci.inf new file mode 100644 index 000000000000..ca564997e609 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/PciSegmentLibPci/PciSegmentLibP= ci.inf @@ -0,0 +1,32 @@ +## @file +# +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D PciSegmentLibPci + FILE_GUID =3D 0AF5E76D-D31E-492B-AE69-A7B441FF62D9 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D PciSegmentLib + +[Sources] + PciSegmentLib.c + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + HobLib + IoLib + +[Guids] + gRootComplexInfoHobGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/PciSegmentLibPci/PciSegm= entLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/PciSegmentLibPci/PciSegmen= tLib.c new file mode 100644 index 000000000000..898558db8d3b --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/PciSegmentLibPci/PciSegmentLib.c @@ -0,0 +1,1523 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#define GET_SEG_NUM(Address) (((Address) >> 32) & 0xFFFF) +#define GET_BUS_NUM(Address) (((Address) >> 20) & 0x7F) +#define GET_DEV_NUM(Address) (((Address) >> 15) & 0x1F) +#define GET_FUNC_NUM(Address) (((Address) >> 12) & 0x07) +#define GET_REG_NUM(Address) ((Address) & 0xFFF) + +#define WORD_ALIGN_MASK 0x3 +#define WORD_GET_BYTE(Word, ByteOffset) (((Word) >> ((Byte= Offset) * 8)) & 0xFF) +#define WORD_SET_BYTE(Word, Byte, ByteOffset) \ + (((Word) & ~(0xFF << ((ByteOffset) * 8))) | ((UINT32)(Byte) << ((ByteOff= set) * 8))) + +#define WORD_GET_HALF_WORD(Word, ByteOffset) (((Word) >> ((Byte= Offset) * 8)) & 0xFFFF) +#define WORD_SET_HALF_WORD(Word, HalfWord, ByteOffset) \ + (((Word) & ~(0xFFFF << ((ByteOffset) * 8))) | ((UINT32)(HalfWord) << ((B= yteOffset) * 8))) + +#define HEADER_TYPE_REG 0x0C +#define GET_HEADER_TYPE(x) (((x) >> 16) & 0x7F) +#define PRIMARY_BUS_NUMBER_REG 0x18 + +/** + Assert the validity of a PCI Segment address. + A valid PCI Segment address should not contain 1's in bits 28..31 and 48= ..63. + + @param A The address to validate. + @param M Additional bits to assert to be zero. + +**/ +#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A,M) \ + ASSERT (((A) & (0xffff0000f0000000ULL | (M))) =3D=3D 0) + +/** + Convert the PCI Segment library address to PCI library address. + + @param A The address to convert. +**/ +#define PCI_SEGMENT_TO_PCI_ADDRESS(A) ((UINTN)(UINT32)A) + +/** + Get the MCFG Base address from the segment number. +**/ +UINTN +GetMmcfgBase ( + IN UINT16 SegmentNumber + ) +{ + AC01_ROOT_COMPLEX *RootComplexList; + UINTN Idx; + VOID *Hob; + + Hob =3D GetFirstGuidHob (&gRootComplexInfoHobGuid); + if (Hob =3D=3D NULL) { + return 0; + } + + RootComplexList =3D (AC01_ROOT_COMPLEX *)GET_GUID_HOB_DATA (Hob); + + for (Idx =3D 0; Idx < AC01_PCIE_MAX_ROOT_COMPLEX; Idx++) { + if (RootComplexList[Idx].Logical =3D=3D SegmentNumber) { + return RootComplexList[Idx].MmcfgBase; + } + } + + return 0; +} + +/** + Register a PCI device so PCI configuration registers may be accessed aft= er + SetVirtualAddressMap(). + + If any reserved bits in Address are set, then ASSERT(). + + @param Address The address that encodes the PCI Bus, Device, Function a= nd + Register. + + @retval RETURN_SUCCESS The PCI device was registered for runti= me access. + @retval RETURN_UNSUPPORTED An attempt was made to call this functi= on + after ExitBootServices(). + @retval RETURN_UNSUPPORTED The resources required to access the PC= I device + at runtime could not be mapped. + @retval RETURN_OUT_OF_RESOURCES There are not enough resources availabl= e to + complete the registration. + +**/ +RETURN_STATUS +EFIAPI +PciSegmentRegisterForRuntimeAccess ( + IN UINTN Address + ) +{ + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0); + return RETURN_UNSUPPORTED; +} + +/** + Reads an 8-bit PCI configuration register. + + Reads and returns the 8-bit PCI configuration register specified by Addr= ess. + This function must guarantee that all PCI read and write operations are = serialized. + + If any reserved bits in Address are set, then ASSERT(). + + @param Address Address that encodes the PCI Segment, Bus, Device, Fun= ction, and Register. + + @return The 8-bit PCI configuration register specified by Address. + +**/ +UINT8 +EFIAPI +PciSegmentRead8 ( + IN UINT64 Address + ) +{ + UINT32 Val32; + UINT64 AlignedAddr; + UINT8 Value; + UINTN CfgBase; + + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0); + + CfgBase =3D GetMmcfgBase (GET_SEG_NUM (Address)) + (Address & 0x0FFFFFFF= ); + AlignedAddr =3D CfgBase & ~WORD_ALIGN_MASK; + + Val32 =3D MmioRead32 (AlignedAddr); + Value =3D WORD_GET_BYTE (Val32, CfgBase & WORD_ALIGN_MASK); + + DEBUG (( + DEBUG_INFO, + "PCIe CFG RD8: 0x%p value: 0x%02X (0x%08llX 0x%08X)\n", + CfgBase, + Value, + AlignedAddr, + Val32 + )); + + return Value; +} + +/** + Writes an 8-bit PCI configuration register. + + Writes the 8-bit PCI configuration register specified by Address with th= e value specified by Value. + Value is returned. This function must guarantee that all PCI read and w= rite operations are serialized. + + If any reserved bits in Address are set, then ASSERT(). + + @param Address Address that encodes the PCI Segment, Bus, Device, F= unction, and Register. + @param Value The value to write. + + @return The value written to the PCI configuration register. + +**/ +UINT8 +EFIAPI +PciSegmentWrite8 ( + IN UINT64 Address, + IN UINT8 Value + ) +{ + UINT32 Val32; + UINT64 AlignedAddr; + UINTN CfgBase; + + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0); + + CfgBase =3D GetMmcfgBase (GET_SEG_NUM (Address)) + (Address & 0x0FFFFFFF= ); + AlignedAddr =3D CfgBase & ~WORD_ALIGN_MASK; + + Val32 =3D MmioRead32 (AlignedAddr); + Val32 =3D WORD_SET_BYTE (Val32, Value, CfgBase & WORD_ALIGN_MASK); + + MmioWrite32 (AlignedAddr, Val32); + + DEBUG (( + DEBUG_INFO, + "PCIe CFG WR8: 0x%p value: 0x%02X (0x%08llX 0x%08X)\n", + CfgBase, + Value, + AlignedAddr, + MmioRead32 ((UINT64)AlignedAddr) + )); + + return Value; +} + +/** + Performs a bitwise OR of an 8-bit PCI configuration register with an 8-b= it value. + + Reads the 8-bit PCI configuration register specified by Address, + performs a bitwise OR between the read result and the value specified by= OrData, + and writes the result to the 8-bit PCI configuration register specified = by Address. + The value written to the PCI configuration register is returned. + This function must guarantee that all PCI read and write operations are = serialized. + + If any reserved bits in Address are set, then ASSERT(). + + @param Address Address that encodes the PCI Segment, Bus, Device, Fun= ction, and Register. + @param OrData The value to OR with the PCI configuration register. + + @return The value written to the PCI configuration register. + +**/ +UINT8 +EFIAPI +PciSegmentOr8 ( + IN UINT64 Address, + IN UINT8 OrData + ) +{ + return PciSegmentWrite8 (PCI_SEGMENT_TO_PCI_ADDRESS (Address), (UINT8)(P= ciSegmentRead8 (Address) | OrData)); +} + +/** + Performs a bitwise AND of an 8-bit PCI configuration register with an 8-= bit value. + + Reads the 8-bit PCI configuration register specified by Address, + performs a bitwise AND between the read result and the value specified b= y AndData, + and writes the result to the 8-bit PCI configuration register specified = by Address. + The value written to the PCI configuration register is returned. + This function must guarantee that all PCI read and write operations are = serialized. + If any reserved bits in Address are set, then ASSERT(). + + @param Address Address that encodes the PCI Segment, Bus, Device, Fun= ction, and Register. + @param AndData The value to AND with the PCI configuration register. + + @return The value written to the PCI configuration register. + +**/ +UINT8 +EFIAPI +PciSegmentAnd8 ( + IN UINT64 Address, + IN UINT8 AndData + ) +{ + return PciSegmentWrite8 (Address, (UINT8)(PciSegmentRead8 (Address) & An= dData)); +} + +/** + Performs a bitwise AND of an 8-bit PCI configuration register with an 8-= bit value, + followed a bitwise OR with another 8-bit value. + + Reads the 8-bit PCI configuration register specified by Address, + performs a bitwise AND between the read result and the value specified b= y AndData, + performs a bitwise OR between the result of the AND operation and the va= lue specified by OrData, + and writes the result to the 8-bit PCI configuration register specified = by Address. + The value written to the PCI configuration register is returned. + This function must guarantee that all PCI read and write operations are = serialized. + + If any reserved bits in Address are set, then ASSERT(). + + @param Address Address that encodes the PCI Segment, Bus, Device, Fun= ction, and Register. + @param AndData The value to AND with the PCI configuration register. + @param OrData The value to OR with the PCI configuration register. + + @return The value written to the PCI configuration register. + +**/ +UINT8 +EFIAPI +PciSegmentAndThenOr8 ( + IN UINT64 Address, + IN UINT8 AndData, + IN UINT8 OrData + ) +{ + return PciSegmentWrite8 (Address, (UINT8)((PciSegmentRead8 (Address) & A= ndData) | OrData)); +} + +/** + Reads a bit field of a PCI configuration register. + + Reads the bit field in an 8-bit PCI configuration register. The bit fiel= d is + specified by the StartBit and the EndBit. The value of the bit field is + returned. + + If any reserved bits in Address are set, then ASSERT(). + If StartBit is greater than 7, then ASSERT(). + If EndBit is greater than 7, then ASSERT(). + If EndBit is less than StartBit, then ASSERT(). + + @param Address PCI configuration register to read. + @param StartBit The ordinal of the least significant bit in the bit fi= eld. + Range 0..7. + @param EndBit The ordinal of the most significant bit in the bit fie= ld. + Range 0..7. + + @return The value of the bit field read from the PCI configuration regis= ter. + +**/ +UINT8 +EFIAPI +PciSegmentBitFieldRead8 ( + IN UINT64 Address, + IN UINTN StartBit, + IN UINTN EndBit + ) +{ + return BitFieldRead8 (PciSegmentRead8 (Address), StartBit, EndBit); +} + +/** + Writes a bit field to a PCI configuration register. + + Writes Value to the bit field of the PCI configuration register. The bit + field is specified by the StartBit and the EndBit. All other bits in the + destination PCI configuration register are preserved. The new value of t= he + 8-bit register is returned. + + If any reserved bits in Address are set, then ASSERT(). + If StartBit is greater than 7, then ASSERT(). + If EndBit is greater than 7, then ASSERT(). + If EndBit is less than StartBit, then ASSERT(). + If Value is larger than the bitmask value range specified by StartBit an= d EndBit, then ASSERT(). + + @param Address PCI configuration register to write. + @param StartBit The ordinal of the least significant bit in the bit fi= eld. + Range 0..7. + @param EndBit The ordinal of the most significant bit in the bit fie= ld. + Range 0..7. + @param Value New value of the bit field. + + @return The value written back to the PCI configuration register. + +**/ +UINT8 +EFIAPI +PciSegmentBitFieldWrite8 ( + IN UINT64 Address, + IN UINTN StartBit, + IN UINTN EndBit, + IN UINT8 Value + ) +{ + return PciSegmentWrite8 ( + Address, + BitFieldWrite8 (PciSegmentRead8 (Address), StartBit, EndBit, Va= lue) + ); +} + +/** + Reads a bit field in an 8-bit PCI configuration, performs a bitwise OR, = and + writes the result back to the bit field in the 8-bit port. + + Reads the 8-bit PCI configuration register specified by Address, perform= s a + bitwise OR between the read result and the value specified by + OrData, and writes the result to the 8-bit PCI configuration register + specified by Address. The value written to the PCI configuration registe= r is + returned. This function must guarantee that all PCI read and write opera= tions + are serialized. Extra left bits in OrData are stripped. + + If any reserved bits in Address are set, then ASSERT(). + If StartBit is greater than 7, then ASSERT(). + If EndBit is greater than 7, then ASSERT(). + If EndBit is less than StartBit, then ASSERT(). + If OrData is larger than the bitmask value range specified by StartBit a= nd EndBit, then ASSERT(). + + @param Address PCI configuration register to write. + @param StartBit The ordinal of the least significant bit in the bit fi= eld. + Range 0..7. + @param EndBit The ordinal of the most significant bit in the bit fie= ld. + Range 0..7. + @param OrData The value to OR with the PCI configuration register. + + @return The value written back to the PCI configuration register. + +**/ +UINT8 +EFIAPI +PciSegmentBitFieldOr8 ( + IN UINT64 Address, + IN UINTN StartBit, + IN UINTN EndBit, + IN UINT8 OrData + ) +{ + return PciSegmentWrite8 ( + Address, + BitFieldOr8 (PciSegmentRead8 (Address), StartBit, EndBit, OrDat= a) + ); +} + +/** + Reads a bit field in an 8-bit PCI configuration register, performs a bit= wise + AND, and writes the result back to the bit field in the 8-bit register. + + Reads the 8-bit PCI configuration register specified by Address, perform= s a + bitwise AND between the read result and the value specified by AndData, = and + writes the result to the 8-bit PCI configuration register specified by + Address. The value written to the PCI configuration register is returned. + This function must guarantee that all PCI read and write operations are + serialized. Extra left bits in AndData are stripped. + + If any reserved bits in Address are set, then ASSERT(). + If StartBit is greater than 7, then ASSERT(). + If EndBit is greater than 7, then ASSERT(). + If EndBit is less than StartBit, then ASSERT(). + If AndData is larger than the bitmask value range specified by StartBit = and EndBit, then ASSERT(). + + @param Address PCI configuration register to write. + @param StartBit The ordinal of the least significant bit in the bit fi= eld. + Range 0..7. + @param EndBit The ordinal of the most significant bit in the bit fie= ld. + Range 0..7. + @param AndData The value to AND with the PCI configuration register. + + @return The value written back to the PCI configuration register. + +**/ +UINT8 +EFIAPI +PciSegmentBitFieldAnd8 ( + IN UINT64 Address, + IN UINTN StartBit, + IN UINTN EndBit, + IN UINT8 AndData + ) +{ + return PciSegmentWrite8 ( + Address, + BitFieldAnd8 (PciSegmentRead8 (Address), StartBit, EndBit, AndD= ata) + ); +} + +/** + Reads a bit field in an 8-bit port, performs a bitwise AND followed by a + bitwise OR, and writes the result back to the bit field in the 8-bit por= t. + + Reads the 8-bit PCI configuration register specified by Address, perform= s a + bitwise AND followed by a bitwise OR between the read result and + the value specified by AndData, and writes the result to the 8-bit PCI + configuration register specified by Address. The value written to the PCI + configuration register is returned. This function must guarantee that al= l PCI + read and write operations are serialized. Extra left bits in both AndDat= a and + OrData are stripped. + + If any reserved bits in Address are set, then ASSERT(). + If StartBit is greater than 7, then ASSERT(). + If EndBit is greater than 7, then ASSERT(). + If EndBit is less than StartBit, then ASSERT(). + If AndData is larger than the bitmask value range specified by StartBit = and EndBit, then ASSERT(). + If OrData is larger than the bitmask value range specified by StartBit a= nd EndBit, then ASSERT(). + + @param Address PCI configuration register to write. + @param StartBit The ordinal of the least significant bit in the bit fi= eld. + Range 0..7. + @param EndBit The ordinal of the most significant bit in the bit fie= ld. + Range 0..7. + @param AndData The value to AND with the PCI configuration register. + @param OrData The value to OR with the result of the AND operation. + + @return The value written back to the PCI configuration register. + +**/ +UINT8 +EFIAPI +PciSegmentBitFieldAndThenOr8 ( + IN UINT64 Address, + IN UINTN StartBit, + IN UINTN EndBit, + IN UINT8 AndData, + IN UINT8 OrData + ) +{ + return PciSegmentWrite8 ( + Address, + BitFieldAndThenOr8 (PciSegmentRead8 (Address), StartBit, EndBit= , AndData, OrData) + ); +} + +/** + Reads a 16-bit PCI configuration register. + + Reads and returns the 16-bit PCI configuration register specified by Add= ress. + This function must guarantee that all PCI read and write operations are = serialized. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 16-bit boundary, then ASSERT(). + + @param Address Address that encodes the PCI Segment, Bus, Device, Fun= ction, and Register. + + @return The 16-bit PCI configuration register specified by Address. + +**/ +UINT16 +EFIAPI +PciSegmentRead16 ( + IN UINT64 Address + ) +{ + UINT16 Value; + UINT32 Val32; + UINT64 AlignedAddr; + UINT8 HeaderType; + UINT8 PrimaryBus; + UINTN CfgBase; + + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1); + + PrimaryBus =3D 0; + CfgBase =3D GetMmcfgBase (GET_SEG_NUM (Address)) + (Address & 0x0FFFFFFE= ); + AlignedAddr =3D CfgBase & ~WORD_ALIGN_MASK; + + if ((GET_BUS_NUM (CfgBase) > 0) && (GET_DEV_NUM (CfgBase) > 0) && (GET_R= EG_NUM (CfgBase) =3D=3D 0)) { + Value =3D MmioRead32 (CfgBase); + DEBUG (( + DEBUG_INFO, + "PCIe CFG RD16: B%X|D%X 0x%p value: 0x%08X\n", + GET_BUS_NUM (CfgBase), + GET_DEV_NUM (CfgBase), + CfgBase, + Value + )); + + if (Value !=3D 0xFFFF) { + Val32 =3D MmioRead32 (CfgBase + HEADER_TYPE_REG); + + HeaderType =3D GET_HEADER_TYPE (Val32); + DEBUG ((DEBUG_INFO, " Peek RD: HeaderType=3D0x%02X\n", HeaderType)); + + // Type 1 Configuration Space Header + if (HeaderType !=3D 0) { + PrimaryBus =3D MmioRead32 (CfgBase + PRIMARY_BUS_NUMBER_REG); + DEBUG ((DEBUG_INFO, " Peek RD: PrimaryBus=3D0x%02X\n", PrimaryBus= )); + } + + if ((HeaderType =3D=3D 0) || (PrimaryBus !=3D 0)) { + Value =3D 0xFFFF; + DEBUG (( + DEBUG_INFO, + " Skip RD16 B%X|D%X PCIe CFG RD: 0x%p return 0xFFFF\n", + GET_BUS_NUM (CfgBase), + GET_DEV_NUM (CfgBase), + CfgBase + )); + return Value; + } + } + } + + Val32 =3D MmioRead32 (AlignedAddr); + Value =3D WORD_GET_HALF_WORD (Val32, CfgBase & WORD_ALIGN_MASK); + + DEBUG (( + DEBUG_INFO, + "PCIe CFG RD16: 0x%p value: 0x%04X (0x%08llX 0x%08X)\n", + CfgBase, + Value, + AlignedAddr, + Val32 + )); + + if (GET_REG_NUM (Address) =3D=3D 0xAE && Value =3D=3D 0xFFFF) { + DEBUG ((DEBUG_ERROR, "PANIC due to PCIe link issue - Addr 0x%llx\n", A= ddress)); + // Loop forever waiting for failsafe/watch dog time out + CpuDeadLoop (); + } + + return Value; +} + +/** + Writes a 16-bit PCI configuration register. + + Writes the 16-bit PCI configuration register specified by Address with t= he value specified by Value. + Value is returned. This function must guarantee that all PCI read and w= rite operations are serialized. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 16-bit boundary, then ASSERT(). + + @param Address Address that encodes the PCI Segment, Bus, Device, F= unction, and Register. + @param Value The value to write. + + @return The parameter of Value. + +**/ +UINT16 +EFIAPI +PciSegmentWrite16 ( + IN UINT64 Address, + IN UINT16 Value + ) +{ + UINT32 Val32; + UINT64 AlignedAddr; + UINTN CfgBase; + + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1); + + CfgBase =3D GetMmcfgBase (GET_SEG_NUM (Address)) + (Address & 0x0FFFFFFE= ); + AlignedAddr =3D CfgBase & ~WORD_ALIGN_MASK; + + Val32 =3D MmioRead32 (AlignedAddr); + Val32 =3D WORD_SET_HALF_WORD (Val32, Value, CfgBase & WORD_ALIGN_MASK); + + MmioWrite32 (AlignedAddr, Val32); + + DEBUG (( + DEBUG_INFO, + "PCIe CFG WR16: 0x%p value: 0x%04X (0x%08llX 0x%08X)\n", + CfgBase, + Value, + AlignedAddr, + MmioRead32 (AlignedAddr) + )); + + return Value; +} + +/** + Performs a bitwise OR of a 16-bit PCI configuration register with + a 16-bit value. + + Reads the 16-bit PCI configuration register specified by Address, perfor= ms a + bitwise OR between the read result and the value specified by OrData, and + writes the result to the 16-bit PCI configuration register specified by = Address. + The value written to the PCI configuration register is returned. This fu= nction + must guarantee that all PCI read and write operations are serialized. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 16-bit boundary, then ASSERT(). + + @param Address Address that encodes the PCI Segment, Bus, Device, Funct= ion and + Register. + @param OrData The value to OR with the PCI configuration register. + + @return The value written back to the PCI configuration register. + +**/ +UINT16 +EFIAPI +PciSegmentOr16 ( + IN UINT64 Address, + IN UINT16 OrData + ) +{ + return PciSegmentWrite16 (Address, (UINT16) (PciSegmentRead16 (Address) = | OrData)); +} + +/** + Performs a bitwise AND of a 16-bit PCI configuration register with a 16-= bit value. + + Reads the 16-bit PCI configuration register specified by Address, + performs a bitwise AND between the read result and the value specified b= y AndData, + and writes the result to the 16-bit PCI configuration register specified= by Address. + The value written to the PCI configuration register is returned. + This function must guarantee that all PCI read and write operations are = serialized. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 16-bit boundary, then ASSERT(). + + @param Address Address that encodes the PCI Segment, Bus, Device, Fun= ction, and Register. + @param AndData The value to AND with the PCI configuration register. + + @return The value written to the PCI configuration register. + +**/ +UINT16 +EFIAPI +PciSegmentAnd16 ( + IN UINT64 Address, + IN UINT16 AndData + ) +{ + return PciSegmentWrite16 (Address, (UINT16) (PciSegmentRead16 (Address) = & AndData)); +} + +/** + Performs a bitwise AND of a 16-bit PCI configuration register with a 16-= bit value, + followed a bitwise OR with another 16-bit value. + + Reads the 16-bit PCI configuration register specified by Address, + performs a bitwise AND between the read result and the value specified b= y AndData, + performs a bitwise OR between the result of the AND operation and the va= lue specified by OrData, + and writes the result to the 16-bit PCI configuration register specified= by Address. + The value written to the PCI configuration register is returned. + This function must guarantee that all PCI read and write operations are = serialized. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 16-bit boundary, then ASSERT(). + + @param Address Address that encodes the PCI Segment, Bus, Device, Fun= ction, and Register. + @param AndData The value to AND with the PCI configuration register. + @param OrData The value to OR with the PCI configuration register. + + @return The value written to the PCI configuration register. + +**/ +UINT16 +EFIAPI +PciSegmentAndThenOr16 ( + IN UINT64 Address, + IN UINT16 AndData, + IN UINT16 OrData + ) +{ + return PciSegmentWrite16 (Address, (UINT16) ((PciSegmentRead16 (Address)= & AndData) | OrData)); +} + +/** + Reads a bit field of a PCI configuration register. + + Reads the bit field in a 16-bit PCI configuration register. The bit fiel= d is + specified by the StartBit and the EndBit. The value of the bit field is + returned. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 16-bit boundary, then ASSERT(). + If StartBit is greater than 15, then ASSERT(). + If EndBit is greater than 15, then ASSERT(). + If EndBit is less than StartBit, then ASSERT(). + + @param Address PCI configuration register to read. + @param StartBit The ordinal of the least significant bit in the bit fi= eld. + Range 0..15. + @param EndBit The ordinal of the most significant bit in the bit fie= ld. + Range 0..15. + + @return The value of the bit field read from the PCI configuration regis= ter. + +**/ +UINT16 +EFIAPI +PciSegmentBitFieldRead16 ( + IN UINT64 Address, + IN UINTN StartBit, + IN UINTN EndBit + ) +{ + return BitFieldRead16 (PciSegmentRead16 (Address), StartBit, EndBit); +} + +/** + Writes a bit field to a PCI configuration register. + + Writes Value to the bit field of the PCI configuration register. The bit + field is specified by the StartBit and the EndBit. All other bits in the + destination PCI configuration register are preserved. The new value of t= he + 16-bit register is returned. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 16-bit boundary, then ASSERT(). + If StartBit is greater than 15, then ASSERT(). + If EndBit is greater than 15, then ASSERT(). + If EndBit is less than StartBit, then ASSERT(). + If Value is larger than the bitmask value range specified by StartBit an= d EndBit, then ASSERT(). + + @param Address PCI configuration register to write. + @param StartBit The ordinal of the least significant bit in the bit fi= eld. + Range 0..15. + @param EndBit The ordinal of the most significant bit in the bit fie= ld. + Range 0..15. + @param Value New value of the bit field. + + @return The value written back to the PCI configuration register. + +**/ +UINT16 +EFIAPI +PciSegmentBitFieldWrite16 ( + IN UINT64 Address, + IN UINTN StartBit, + IN UINTN EndBit, + IN UINT16 Value + ) +{ + return PciSegmentWrite16 ( + Address, + BitFieldWrite16 (PciSegmentRead16 (Address), StartBit, EndBit, = Value) + ); +} + +/** + Reads a bit field in a 16-bit PCI configuration, performs a bitwise OR, = writes + the result back to the bit field in the 16-bit port. + + Reads the 16-bit PCI configuration register specified by Address, perfor= ms a + bitwise OR between the read result and the value specified by + OrData, and writes the result to the 16-bit PCI configuration register + specified by Address. The value written to the PCI configuration registe= r is + returned. This function must guarantee that all PCI read and write opera= tions + are serialized. Extra left bits in OrData are stripped. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 16-bit boundary, then ASSERT(). + If StartBit is greater than 15, then ASSERT(). + If EndBit is greater than 15, then ASSERT(). + If EndBit is less than StartBit, then ASSERT(). + If OrData is larger than the bitmask value range specified by StartBit a= nd EndBit, then ASSERT(). + + @param Address PCI configuration register to write. + @param StartBit The ordinal of the least significant bit in the bit fi= eld. + Range 0..15. + @param EndBit The ordinal of the most significant bit in the bit fie= ld. + Range 0..15. + @param OrData The value to OR with the PCI configuration register. + + @return The value written back to the PCI configuration register. + +**/ +UINT16 +EFIAPI +PciSegmentBitFieldOr16 ( + IN UINT64 Address, + IN UINTN StartBit, + IN UINTN EndBit, + IN UINT16 OrData + ) +{ + return PciSegmentWrite16 ( + Address, + BitFieldOr16 (PciSegmentRead16 (Address), StartBit, EndBit, OrD= ata) + ); +} + +/** + Reads a bit field in a 16-bit PCI configuration register, performs a bit= wise + AND, writes the result back to the bit field in the 16-bit register. + + Reads the 16-bit PCI configuration register specified by Address, perfor= ms a + bitwise AND between the read result and the value specified by AndData, = and + writes the result to the 16-bit PCI configuration register specified by + Address. The value written to the PCI configuration register is returned. + This function must guarantee that all PCI read and write operations are + serialized. Extra left bits in AndData are stripped. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 16-bit boundary, then ASSERT(). + If StartBit is greater than 15, then ASSERT(). + If EndBit is greater than 15, then ASSERT(). + If EndBit is less than StartBit, then ASSERT(). + If AndData is larger than the bitmask value range specified by StartBit = and EndBit, then ASSERT(). + + @param Address Address that encodes the PCI Segment, Bus, Device, Fun= ction, and Register. + @param StartBit The ordinal of the least significant bit in the bit fi= eld. + Range 0..15. + @param EndBit The ordinal of the most significant bit in the bit fie= ld. + Range 0..15. + @param AndData The value to AND with the PCI configuration register. + + @return The value written back to the PCI configuration register. + +**/ +UINT16 +EFIAPI +PciSegmentBitFieldAnd16 ( + IN UINT64 Address, + IN UINTN StartBit, + IN UINTN EndBit, + IN UINT16 AndData + ) +{ + return PciSegmentWrite16 ( + Address, + BitFieldAnd16 (PciSegmentRead16 (Address), StartBit, EndBit, An= dData) + ); +} + +/** + Reads a bit field in a 16-bit port, performs a bitwise AND followed by a + bitwise OR, and writes the result back to the bit field in the + 16-bit port. + + Reads the 16-bit PCI configuration register specified by Address, perfor= ms a + bitwise AND followed by a bitwise OR between the read result and + the value specified by AndData, and writes the result to the 16-bit PCI + configuration register specified by Address. The value written to the PCI + configuration register is returned. This function must guarantee that al= l PCI + read and write operations are serialized. Extra left bits in both AndDat= a and + OrData are stripped. + + If any reserved bits in Address are set, then ASSERT(). + If StartBit is greater than 15, then ASSERT(). + If EndBit is greater than 15, then ASSERT(). + If EndBit is less than StartBit, then ASSERT(). + If AndData is larger than the bitmask value range specified by StartBit = and EndBit, then ASSERT(). + If OrData is larger than the bitmask value range specified by StartBit a= nd EndBit, then ASSERT(). + + @param Address PCI configuration register to write. + @param StartBit The ordinal of the least significant bit in the bit fi= eld. + Range 0..15. + @param EndBit The ordinal of the most significant bit in the bit fie= ld. + Range 0..15. + @param AndData The value to AND with the PCI configuration register. + @param OrData The value to OR with the result of the AND operation. + + @return The value written back to the PCI configuration register. + +**/ +UINT16 +EFIAPI +PciSegmentBitFieldAndThenOr16 ( + IN UINT64 Address, + IN UINTN StartBit, + IN UINTN EndBit, + IN UINT16 AndData, + IN UINT16 OrData + ) +{ + return PciSegmentWrite16 ( + Address, + BitFieldAndThenOr16 (PciSegmentRead16 (Address), StartBit, EndB= it, AndData, OrData) + ); +} + +/** + Reads a 32-bit PCI configuration register. + + Reads and returns the 32-bit PCI configuration register specified by Add= ress. + This function must guarantee that all PCI read and write operations are = serialized. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 32-bit boundary, then ASSERT(). + + @param Address Address that encodes the PCI Segment, Bus, Device, Fun= ction, and Register. + + @return The 32-bit PCI configuration register specified by Address. + +**/ +UINT32 +EFIAPI +PciSegmentRead32 ( + IN UINT64 Address + ) +{ + UINT32 Val32; + UINT32 Value; + UINT8 HeaderType; + UINT8 PrimaryBus; + UINTN CfgBase; + + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3); + + PrimaryBus =3D 0; + CfgBase =3D GetMmcfgBase (GET_SEG_NUM (Address)) + (Address & 0x0FFFFFFC= ); + + if ((GET_BUS_NUM (CfgBase) > 0) && (GET_DEV_NUM (CfgBase) > 0) && (GET_R= EG_NUM (CfgBase) =3D=3D 0)) { + Value =3D MmioRead32 (CfgBase); + DEBUG (( + DEBUG_INFO, + "PCIe CFG RD32: B%X|D%X 0x%p value: 0x%08X\n", + GET_BUS_NUM (CfgBase), + GET_DEV_NUM (CfgBase), + CfgBase, + Value + )); + + if (Value !=3D 0xFFFFFFFF) { + Val32 =3D MmioRead32 (CfgBase + HEADER_TYPE_REG); + + HeaderType =3D GET_HEADER_TYPE (Val32); + DEBUG ((DEBUG_INFO, " Peek RD: HeaderType=3D0x%02X\n", HeaderType)); + + // Type 1 Configuration Space Header + if (HeaderType !=3D 0) { + PrimaryBus =3D MmioRead32 (CfgBase + PRIMARY_BUS_NUMBER_REG); + DEBUG ((DEBUG_INFO, " Peek RD: PrimaryBus=3D0x%02X\n", PrimaryBus= )); + } + + if ((HeaderType =3D=3D 0) || (PrimaryBus !=3D 0)) { + Value =3D 0xFFFFFFFF; + DEBUG (( + DEBUG_INFO, + " Skip RD32 B%X|D%X PCIe CFG RD: 0x%p return 0xFFFFFFFF\n", + GET_BUS_NUM (CfgBase), + GET_DEV_NUM (CfgBase), + CfgBase + )); + return Value; + } + } + } else { + Value =3D MmioRead32 (CfgBase); + } + + DEBUG ((DEBUG_INFO, "PCIe CFG RD32: 0x%p value: 0x%08X\n", CfgBase, Valu= e)); + + return Value; +} + +/** + Writes a 32-bit PCI configuration register. + + Writes the 32-bit PCI configuration register specified by Address with t= he value specified by Value. + Value is returned. This function must guarantee that all PCI read and w= rite operations are serialized. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 32-bit boundary, then ASSERT(). + + @param Address Address that encodes the PCI Segment, Bus, Device, F= unction, and Register. + @param Value The value to write. + + @return The parameter of Value. + +**/ +UINT32 +EFIAPI +PciSegmentWrite32 ( + IN UINT64 Address, + IN UINT32 Value + ) +{ + UINTN CfgBase; + + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3); + + CfgBase =3D GetMmcfgBase (GET_SEG_NUM (Address)) + (Address & 0x0FFFFFFC= ); + MmioWrite32 (CfgBase, Value); + DEBUG (( + DEBUG_INFO, + "PCIe CFG WR32: 0x%p value: 0x%08X (0x%08X)\n", + CfgBase, + Value, + MmioRead32 (CfgBase) + )); + + return Value; +} + +/** + Performs a bitwise OR of a 32-bit PCI configuration register with a 32-b= it value. + + Reads the 32-bit PCI configuration register specified by Address, + performs a bitwise OR between the read result and the value specified by= OrData, + and writes the result to the 32-bit PCI configuration register specified= by Address. + The value written to the PCI configuration register is returned. + This function must guarantee that all PCI read and write operations are = serialized. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 32-bit boundary, then ASSERT(). + + @param Address Address that encodes the PCI Segment, Bus, Device, Fun= ction, and Register. + @param OrData The value to OR with the PCI configuration register. + + @return The value written to the PCI configuration register. + +**/ +UINT32 +EFIAPI +PciSegmentOr32 ( + IN UINT64 Address, + IN UINT32 OrData + ) +{ + return PciSegmentWrite32 (Address, PciSegmentRead32 (Address) | OrData); +} + +/** + Performs a bitwise AND of a 32-bit PCI configuration register with a 32-= bit value. + + Reads the 32-bit PCI configuration register specified by Address, + performs a bitwise AND between the read result and the value specified b= y AndData, + and writes the result to the 32-bit PCI configuration register specified= by Address. + The value written to the PCI configuration register is returned. + This function must guarantee that all PCI read and write operations are = serialized. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 32-bit boundary, then ASSERT(). + + @param Address Address that encodes the PCI Segment, Bus, Device, Fun= ction, and Register. + @param AndData The value to AND with the PCI configuration register. + + @return The value written to the PCI configuration register. + +**/ +UINT32 +EFIAPI +PciSegmentAnd32 ( + IN UINT64 Address, + IN UINT32 AndData + ) +{ + return PciSegmentWrite32 (Address, PciSegmentRead32 (Address) & AndData); +} + +/** + Performs a bitwise AND of a 32-bit PCI configuration register with a 32-= bit value, + followed a bitwise OR with another 32-bit value. + + Reads the 32-bit PCI configuration register specified by Address, + performs a bitwise AND between the read result and the value specified b= y AndData, + performs a bitwise OR between the result of the AND operation and the va= lue specified by OrData, + and writes the result to the 32-bit PCI configuration register specified= by Address. + The value written to the PCI configuration register is returned. + This function must guarantee that all PCI read and write operations are = serialized. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 32-bit boundary, then ASSERT(). + + @param Address Address that encodes the PCI Segment, Bus, Device, Fun= ction, and Register. + @param AndData The value to AND with the PCI configuration register. + @param OrData The value to OR with the PCI configuration register. + + @return The value written to the PCI configuration register. + +**/ +UINT32 +EFIAPI +PciSegmentAndThenOr32 ( + IN UINT64 Address, + IN UINT32 AndData, + IN UINT32 OrData + ) +{ + return PciSegmentWrite32 (Address, (PciSegmentRead32 (Address) & AndData= ) | OrData); +} + +/** + Reads a bit field of a PCI configuration register. + + Reads the bit field in a 32-bit PCI configuration register. The bit fiel= d is + specified by the StartBit and the EndBit. The value of the bit field is + returned. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 32-bit boundary, then ASSERT(). + If StartBit is greater than 31, then ASSERT(). + If EndBit is greater than 31, then ASSERT(). + If EndBit is less than StartBit, then ASSERT(). + + @param Address PCI configuration register to read. + @param StartBit The ordinal of the least significant bit in the bit fi= eld. + Range 0..31. + @param EndBit The ordinal of the most significant bit in the bit fie= ld. + Range 0..31. + + @return The value of the bit field read from the PCI configuration regis= ter. + +**/ +UINT32 +EFIAPI +PciSegmentBitFieldRead32 ( + IN UINT64 Address, + IN UINTN StartBit, + IN UINTN EndBit + ) +{ + return BitFieldRead32 (PciSegmentRead32 (Address), StartBit, EndBit); +} + +/** + Writes a bit field to a PCI configuration register. + + Writes Value to the bit field of the PCI configuration register. The bit + field is specified by the StartBit and the EndBit. All other bits in the + destination PCI configuration register are preserved. The new value of t= he + 32-bit register is returned. + + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 32-bit boundary, then ASSERT(). + If StartBit is greater than 31, then ASSERT(). + If EndBit is greater than 31, then ASSERT(). + If EndBit is less than StartBit, then ASSERT(). + If Value is larger than the bitmask value range specified by StartBit an= d EndBit, then ASSERT(). + + @param Address PCI configuration register to write. + @param StartBit The ordinal of the least significant bit in the bit fi= eld. + Range 0..31. + @param EndBit The ordinal of the most significant bit in the bit fie= ld. + Range 0..31. + @param Value New value of the bit field. + + @return The value written back to the PCI configuration register. + +**/ +UINT32 +EFIAPI +PciSegmentBitFieldWrite32 ( + IN UINT64 Address, + IN UINTN StartBit, + IN UINTN EndBit, + IN UINT32 Value + ) +{ + return PciSegmentWrite32 ( + Address, + BitFieldWrite32 (PciSegmentRead32 (Address), StartBit, EndBit, = Value) + ); +} + +/** + Reads a bit field in a 32-bit PCI configuration, performs a bitwise OR, = and + writes the result back to the bit field in the 32-bit port. + + Reads the 32-bit PCI configuration register specified by Address, perfor= ms a + bitwise OR between the read result and the value specified by + OrData, and writes the result to the 32-bit PCI configuration register + specified by Address. The value written to the PCI configuration registe= r is + returned. This function must guarantee that all PCI read and write opera= tions + are serialized. Extra left bits in OrData are stripped. + + If any reserved bits in Address are set, then ASSERT(). + If StartBit is greater than 31, then ASSERT(). + If EndBit is greater than 31, then ASSERT(). + If EndBit is less than StartBit, then ASSERT(). + If OrData is larger than the bitmask value range specified by StartBit a= nd EndBit, then ASSERT(). + + @param Address PCI configuration register to write. + @param StartBit The ordinal of the least significant bit in the bit fi= eld. + Range 0..31. + @param EndBit The ordinal of the most significant bit in the bit fie= ld. + Range 0..31. + @param OrData The value to OR with the PCI configuration register. + + @return The value written back to the PCI configuration register. + +**/ +UINT32 +EFIAPI +PciSegmentBitFieldOr32 ( + IN UINT64 Address, + IN UINTN StartBit, + IN UINTN EndBit, + IN UINT32 OrData + ) +{ + return PciSegmentWrite32 ( + Address, + BitFieldOr32 (PciSegmentRead32 (Address), StartBit, EndBit, OrD= ata) + ); +} + +/** + Reads a bit field in a 32-bit PCI configuration register, performs a bit= wise + AND, and writes the result back to the bit field in the 32-bit register. + + + Reads the 32-bit PCI configuration register specified by Address, perfor= ms a bitwise + AND between the read result and the value specified by AndData, and writ= es the result + to the 32-bit PCI configuration register specified by Address. The value= written to + the PCI configuration register is returned. This function must guarante= e that all PCI + read and write operations are serialized. Extra left bits in AndData ar= e stripped. + If any reserved bits in Address are set, then ASSERT(). + If Address is not aligned on a 32-bit boundary, then ASSERT(). + If StartBit is greater than 31, then ASSERT(). + If EndBit is greater than 31, then ASSERT(). + If EndBit is less than StartBit, then ASSERT(). + If AndData is larger than the bitmask value range specified by StartBit = and EndBit, then ASSERT(). + + @param Address Address that encodes the PCI Segment, Bus, Device, Fun= ction, and Register. + @param StartBit The ordinal of the least significant bit in the bit fi= eld. + Range 0..31. + @param EndBit The ordinal of the most significant bit in the bit fie= ld. + Range 0..31. + @param AndData The value to AND with the PCI configuration register. + + @return The value written back to the PCI configuration register. + +**/ +UINT32 +EFIAPI +PciSegmentBitFieldAnd32 ( + IN UINT64 Address, + IN UINTN StartBit, + IN UINTN EndBit, + IN UINT32 AndData + ) +{ + return PciSegmentWrite32 ( + Address, + BitFieldAnd32 (PciSegmentRead32 (Address), StartBit, EndBit, An= dData) + ); +} + +/** + Reads a bit field in a 32-bit port, performs a bitwise AND followed by a + bitwise OR, and writes the result back to the bit field in the + 32-bit port. + + Reads the 32-bit PCI configuration register specified by Address, perfor= ms a + bitwise AND followed by a bitwise OR between the read result and + the value specified by AndData, and writes the result to the 32-bit PCI + configuration register specified by Address. The value written to the PCI + configuration register is returned. This function must guarantee that al= l PCI + read and write operations are serialized. Extra left bits in both AndDat= a and + OrData are stripped. + + If any reserved bits in Address are set, then ASSERT(). + If StartBit is greater than 31, then ASSERT(). + If EndBit is greater than 31, then ASSERT(). + If EndBit is less than StartBit, then ASSERT(). + If AndData is larger than the bitmask value range specified by StartBit = and EndBit, then ASSERT(). + If OrData is larger than the bitmask value range specified by StartBit a= nd EndBit, then ASSERT(). + + @param Address PCI configuration register to write. + @param StartBit The ordinal of the least significant bit in the bit fi= eld. + Range 0..31. + @param EndBit The ordinal of the most significant bit in the bit fie= ld. + Range 0..31. + @param AndData The value to AND with the PCI configuration register. + @param OrData The value to OR with the result of the AND operation. + + @return The value written back to the PCI configuration register. + +**/ +UINT32 +EFIAPI +PciSegmentBitFieldAndThenOr32 ( + IN UINT64 Address, + IN UINTN StartBit, + IN UINTN EndBit, + IN UINT32 AndData, + IN UINT32 OrData + ) +{ + return PciSegmentWrite32 ( + Address, + BitFieldAndThenOr32 (PciSegmentRead32 (Address), StartBit, EndB= it, AndData, OrData) + ); +} + +/** + Reads a range of PCI configuration registers into a caller supplied buff= er. + + Reads the range of PCI configuration registers specified by StartAddress= and + Size into the buffer specified by Buffer. This function only allows the = PCI + configuration registers from a single PCI function to be read. Size is + returned. When possible 32-bit PCI configuration read cycles are used to= read + from StartAddress to StartAddress + Size. Due to alignment restrictions,= 8-bit + and 16-bit PCI configuration read cycles may be used at the beginning an= d the + end of the range. + + If any reserved bits in StartAddress are set, then ASSERT(). + If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). + If Size > 0 and Buffer is NULL, then ASSERT(). + + @param StartAddress Starting address that encodes the PCI Segment, Bus= , Device, + Function and Register. + @param Size Size in bytes of the transfer. + @param Buffer Pointer to a buffer receiving the data read. + + @return Size + +**/ +UINTN +EFIAPI +PciSegmentReadBuffer ( + IN UINT64 StartAddress, + IN UINTN Size, + OUT VOID *Buffer + ) +{ + UINTN ReturnValue; + + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (StartAddress, 0); + ASSERT (((StartAddress & 0xFFF) + Size) <=3D SIZE_4KB); + + if (Size =3D=3D 0) { + return Size; + } + + ASSERT (Buffer !=3D NULL); + + // + // Save Size for return + // + ReturnValue =3D Size; + + if ((StartAddress & BIT0) !=3D 0) { + // + // Read a byte if StartAddress is byte aligned + // + *(volatile UINT8 *)Buffer =3D PciSegmentRead8 (StartAddress); + StartAddress +=3D sizeof (UINT8); + Size -=3D sizeof (UINT8); + Buffer =3D (UINT8 *)Buffer + 1; + } + + if (Size >=3D sizeof (UINT16) && (StartAddress & BIT1) !=3D 0) { + // + // Read a word if StartAddress is word aligned + // + WriteUnaligned16 (Buffer, PciSegmentRead16 (StartAddress)); + StartAddress +=3D sizeof (UINT16); + Size -=3D sizeof (UINT16); + Buffer =3D (UINT16 *)Buffer + 1; + } + + while (Size >=3D sizeof (UINT32)) { + // + // Read as many double words as possible + // + WriteUnaligned32 (Buffer, PciSegmentRead32 (StartAddress)); + StartAddress +=3D sizeof (UINT32); + Size -=3D sizeof (UINT32); + Buffer =3D (UINT32 *)Buffer + 1; + } + + if (Size >=3D sizeof (UINT16)) { + // + // Read the last remaining word if exist + // + WriteUnaligned16 (Buffer, PciSegmentRead16 (StartAddress)); + StartAddress +=3D sizeof (UINT16); + Size -=3D sizeof (UINT16); + Buffer =3D (UINT16 *)Buffer + 1; + } + + if (Size >=3D sizeof (UINT8)) { + // + // Read the last remaining byte if exist + // + *(volatile UINT8 *)Buffer =3D PciSegmentRead8 (StartAddress); + } + + return ReturnValue; +} + +/** + Copies the data in a caller supplied buffer to a specified range of PCI + configuration space. + + Writes the range of PCI configuration registers specified by StartAddres= s and + Size from the buffer specified by Buffer. This function only allows the = PCI + configuration registers from a single PCI function to be written. Size is + returned. When possible 32-bit PCI configuration write cycles are used to + write from StartAddress to StartAddress + Size. Due to alignment restric= tions, + 8-bit and 16-bit PCI configuration write cycles may be used at the begin= ning + and the end of the range. + + If any reserved bits in StartAddress are set, then ASSERT(). + If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). + If Size > 0 and Buffer is NULL, then ASSERT(). + + @param StartAddress Starting address that encodes the PCI Segment, Bus= , Device, + Function and Register. + @param Size Size in bytes of the transfer. + @param Buffer Pointer to a buffer containing the data to write. + + @return The parameter of Size. + +**/ +UINTN +EFIAPI +PciSegmentWriteBuffer ( + IN UINT64 StartAddress, + IN UINTN Size, + IN VOID *Buffer + ) +{ + UINTN ReturnValue; + + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (StartAddress, 0); + ASSERT (((StartAddress & 0xFFF) + Size) <=3D SIZE_4KB); + + if (Size =3D=3D 0) { + return Size; + } + + ASSERT (Buffer !=3D NULL); + + // + // Save Size for return + // + ReturnValue =3D Size; + + if ((StartAddress & BIT0) !=3D 0) { + // + // Write a byte if StartAddress is byte aligned + // + PciSegmentWrite8 (StartAddress, *(UINT8 *)Buffer); + StartAddress +=3D sizeof (UINT8); + Size -=3D sizeof (UINT8); + Buffer =3D (UINT8 *)Buffer + 1; + } + + if (Size >=3D sizeof (UINT16) && (StartAddress & BIT1) !=3D 0) { + // + // Write a word if StartAddress is word aligned + // + PciSegmentWrite16 (StartAddress, ReadUnaligned16 (Buffer)); + StartAddress +=3D sizeof (UINT16); + Size -=3D sizeof (UINT16); + Buffer =3D (UINT16 *)Buffer + 1; + } + + while (Size >=3D sizeof (UINT32)) { + // + // Write as many double words as possible + // + PciSegmentWrite32 (StartAddress, ReadUnaligned32 (Buffer)); + StartAddress +=3D sizeof (UINT32); + Size -=3D sizeof (UINT32); + Buffer =3D (UINT32 *)Buffer + 1; + } + + if (Size >=3D sizeof (UINT16)) { + // + // Write the last remaining word if exist + // + PciSegmentWrite16 (StartAddress, ReadUnaligned16 (Buffer)); + StartAddress +=3D sizeof (UINT16); + Size -=3D sizeof (UINT16); + Buffer =3D (UINT16 *)Buffer + 1; + } + + if (Size >=3D sizeof (UINT8)) { + // + // Write the last remaining byte if exist + // + PciSegmentWrite8 (StartAddress, *(UINT8 *)Buffer); + } + + return ReturnValue; +} --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83828): https://edk2.groups.io/g/devel/message/83828 Mute This Topic: https://groups.io/mt/87123891/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83829+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83829+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 16371678295438.61614209688662; Wed, 17 Nov 2021 08:50:29 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id dGL5YY1788612xKPAFh3rIqB; Wed, 17 Nov 2021 08:50:29 -0800 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.93]) by mx.groups.io with SMTP id smtpd.web10.9748.1637167827820064282 for ; Wed, 17 Nov 2021 08:50:28 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LjBVIc93PaCYzXqBkOU7JtJEuYm5CtvdGvcgborW4EiofFt9j/TIQnO2tXDV9gs76ZNQtxQV7NBO7T/epc+On0HJgFbJkAoos861BuomIPDP3tQA2DQDVsR14Wf9jzQrL1Eya7M+Ne7OqPQ8+Plxq838owksInLxjc8MCB7tbkzQlCbVk42E/91rGIcRn8dEmgwYCc1a1NeQTbnkxQuqLimltx9p9gvPbWnAeh3VQIy89/oeGrTKdpwbfMfZxu/qWMvbmyNPDziRW/PxtF/9AIbWWd+Ht9AbFJWA043+D88vqz5TtIjc8/OJTzHMUapxNrjC9IQsov9wtF+zGmsWzg== 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=ELMldcqA1TrLFQrQsZzS3txHDSAxIIxO9Of+bTXpXb4=; b=Tev0aXrYOjvsjzPEZBSepPmdCpCSrUCOiiXO3gZf10bWJXUB6AmgYlSQy5wSNGpr2sF9baVYZ94SqXourZa8B7W3yiTqRrHgGh7h1jGNZwXAm+K57Bg/8VsVgyPe5Vc6EkUG9T/WRaRElcGsO1ToMaVZ4dsnGJj1JbLPyrWoQak4gKePS0neIfKBeuiLaSZK34yaVTpWxy6W6bNB6+OVMHLJv8syEikL/XZkRyvriVRZE1fegPrEv1+QwZZ4NV4BPoOeHzmqioIwmc7sTLlt7zyeti7ng2fjYoZ7ZpK0ylq6ZuIgA7Prt7x9aYFoSpocUtvUE4ZCseJocBE2aZitHg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB7521.prod.exchangelabs.com (2603:10b6:510:f4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Wed, 17 Nov 2021 16:50:27 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:27 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 16/30] JadePkg: Enable PciHostBridgeDxe driver Date: Wed, 17 Nov 2021 23:47:13 +0700 Message-ID: <20211117164727.10922-17-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:50:24 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1b291a46-0aa2-4e95-cce8-08d9a9ea5b33 X-MS-TrafficTypeDiagnostic: PH0PR01MB7521: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:160; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: tHW/2GSOZWTrOIaPeSCn0PecnnipzKxZ/r05onJIwbDgkfFij8NyaXds6go098G4Hj2feZzOVtV70MtEmvLLT20tHZokARI4CFfquctVemfzBytJoNzC7A77BdHPcwdNbv/dhHZDd5r0bUCZM/ETwKmvrhEnQqeKtj0cPvXiw2zQLRNYcCH7r98hqAPj/Sdi6q3RjvsSVhIO3k+pS00TIFxdc/85fkQwDojyKRjAxJWHBaun9jFoRXaB6jbjYTNntF9n2l0DZRKcIyrhAQ86+GN3NAv3Ftmn7SIihXJ8p7uJXh9Z2u3+q9o/xD3V8wrdQ4FIgE5AqDVOn2Vf/Lti0IIua838io6r36vrK6oRdpzH3H+ejOXbkkX75IafyMqRYV14v+jtgv4iT+sKxYrOWWapeN1gYP2+3xBJQHXSris4k8GxNdl71wUNws1B7nJGFprhTUp7uMnKOgiimrAk2QBEuA2oACcpCNdZm+8PL52PeOf5axM5OGtJpVhn8GUXQw9q8+pkBF1FXx0rJ/hgVBeiotoldTKWQo2Ld8rkd0v6qZs1MhtOKd68t1rJfDLctuwXOmvATspfhCV0bzf6uOgBrU1gLUXLtCwSb4GiR/wlFcvId3GLuvZHH8EqihegS8fcm3KMuPCCr6MVuB1SZ96W5rWCx7GPOAsTcu+D1y0J0hIghG0+XeoiNcw6hLDX5llP0x04IUKoEPdRh0Ah5w== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?4eewyxhaxgfvK+uTnGubeppK+8ejjc3WZhc5NSzX1l779SZlia1t1TpTMj8x?= =?us-ascii?Q?gmZz62ymcyKVdImrd+A+hA4t926qP9WBAsNBQkcprngShMEA7LIle6sMUZHx?= =?us-ascii?Q?ZcD9UkQIrC7MeBObkQNTe+DPxWL7I0RhP4wKNueKB0YLdGABPVHyFCTR0jRd?= =?us-ascii?Q?VcPKvi51c1oZ19P3vjo0k7eaDsW0VyUxvn00YQjQYjYWqs8zUQp8M3M9iXek?= =?us-ascii?Q?aVwJOj0loHs3I3gGBU5H/+abOBCDPk/ZOCYhtCGlnQ925mRWgHe+MRghgapI?= =?us-ascii?Q?QQ72lnzz/5zHTyrtbKsuc91lYSSY3+WrVl0mm7AnNgkviGSdxfSiBeXu1lfS?= =?us-ascii?Q?uP8zGU6qyhjAbqW22UC93K3l3i3WFOva+uciLSCSc/bLgUIhYi2XLqMFpCv+?= =?us-ascii?Q?irmNPVDIIc+woXKN81QAVuV4SLHD/5xHYu8HsLvQvHIKsCKqqbs8gDiViojj?= =?us-ascii?Q?IoqkHpE8EcseMJjU8te3woYRDFi7sTk7x2Xi2N6w2yvF1I3Rjc0jgPWE6087?= =?us-ascii?Q?t/6/YyX+vlfZAOjrDN9DokyInR1wE/ginKAx0kANuOI4SWWOMQSAWmUjGg1N?= =?us-ascii?Q?ylUm1HV4YAmcB9yyJV1hwFLOAPqsuU7sysPCN7W2WoszImS6harJzEE9g6RV?= =?us-ascii?Q?XrB16gkV+5gkz4l/zqTr9IUiAdud/vncrolU3nJq6ZnkexcPKv5UUQkKky8N?= =?us-ascii?Q?Z60XE3G0qSkpyXhqkspm5UrLoDzoT5MclHMPns8LotzPXZJMU7nW+drYzYgj?= =?us-ascii?Q?EUTvH8eXKve7Udphvejpkfhp7ENdU1vYLNXPH6vi53oqrlJJWLMbAuTkrnO9?= =?us-ascii?Q?X6G68kf+o6rFpMQ/c3HLTaP3I9c558A94Lu4bFRR6RTN5PFHx/mtRU2MtC+h?= =?us-ascii?Q?NRcI6Xw4gXZSH1PC93Lo8xRemVRALuNuuJdmGYlZZuMc8dsHT2BjDi9cqN8P?= =?us-ascii?Q?wJIpbPkQTe2rYfBFwrJwgmfNxTw3ufD7s91o4u2jIqJ1r6QTE7cMzvUYJ1tf?= =?us-ascii?Q?RItT/aliVkS2UPOJP7+U1H+VFwLdP7h5Dn3d+BMOWrQmMNQV8mxjwCFPe5YH?= =?us-ascii?Q?2W7YqjtiAUjzT2cHzA9IUvyWT2bcZajGeWhMycLw/PSnlzKa+yD0a7eTvjy6?= =?us-ascii?Q?Nd95veNClrNuJTo/uVJHNRt7rY6nZ+QSYcHg5yoGi9C3hxSzeMfsij1WK14g?= =?us-ascii?Q?xbr5gEYyn+xZcNUKxhS4xkYr7mCslyOxBWJ66T6Wa67934zh4sI9BZ+G39vu?= =?us-ascii?Q?HOK8M8GY8Np1vUqorcGZWzw09BNaDH8xmRQuGQU2672pcfuQS45U7vNngeO7?= =?us-ascii?Q?FRXa+VqHlqh3g7NIQ+8z/vYwpdmlgV9UQLXKfYXbeb3O2ZBX0a+pz1isE9WU?= =?us-ascii?Q?oAmAvwCUpsSU9w/sA5Y2efCJSACzenosuC5mTOpgqeJktMbsEBt1baC6SnPE?= =?us-ascii?Q?zpmX2xGzHhEAb7wAEDF/oytHCs4oGHDhv4ziKGfqkV5p1OCfJISlrd+abCvw?= =?us-ascii?Q?LYyMwGAQs3fTw7nu+uOR9yMVoAr2xctDoybW8mJHnt5U85m0HqgSCKU1qLB3?= =?us-ascii?Q?tHThz78AeMITjYs1IIbKFGErt/43TZ4KSHftMHFtNnxQ9s+nTdySC8T4PnRy?= =?us-ascii?Q?xX3yfi1BrNyAIS5vt5wClLgjmyDaqqgGtR/SA05A9LVUAd8J1ZcYMME1mfWH?= =?us-ascii?Q?PdzI8fsskmVNGkKCUCuS4PRAenM=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b291a46-0aa2-4e95-cce8-08d9a9ea5b33 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:27.1947 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ajQb1io7nQg/6wvjEDBWpK7Pa/Y4VqjusuRZqg4XDxXIM/klT4DaurbX2l8wncsxo78mOPbm7BDqukuxaHUhfgbgR5LryhDlyZg6qc413r0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7521 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: wQ63pOX0RVvOntYmdjINmx0Ex1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167829; bh=At1k/ElwbWXDbSGf4PpYVjxCBWuNHYJVGlx1Ec3Sngs=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=nL+WWSUIGJDT25OeAc7AYU/Ypdcby1GybwfdIamruJBcwyVfk2T9vzDaBtoQG01fhVZ b3Fr26Q2Z3TSAcKxHo8cwfu0vDIUFrJA4f5bD+y6EkE6A4N7cxywgPFOo0LiU7apnnWle mW/aJWeq2F6yvsrj+2TXttzDtLRST9Fi/v8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167830885100008 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen This change also enables the drivers for SCSI, NVMe, USB keyboard, and USB storage devices. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc | 33 ++++++++++++++++= ++++ Platform/Ampere/JadePkg/Jade.fdf | 33 ++++++++++++++++= ++++ 2 files changed, 66 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index cea1ff6b26ef..2f331e41893e 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -651,6 +651,39 @@ [Components.common] MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf FatPkg/EnhancedFatDxe/Fat.inf =20 + # + # SCSI Bus and Disk Driver + # + MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf + MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf + + # + # SATA Support + # + MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf + MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf + MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf + MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDevic= eDxe.inf + + # + # NVME Support + # + MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf + + # + # USB Support + # + MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf + MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf + MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf + MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf + + # + # PCIe Support + # + MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf + MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf + # # Bds # diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index 2fef96deb767..6de01dfe36d5 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -263,6 +263,39 @@ [FV.FvMain] INF FatPkg/EnhancedFatDxe/Fat.inf INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.i= nf =20 + # + # SCSI Bus and Disk Driver + # + INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf + INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf + + # + # SATA Support + # + INF MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf + INF MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf + INF MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf + INF MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciD= eviceDxe.inf + + # + # NVME Support + # + INF MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf + + # + # USB Support + # + INF MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf + INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf + INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf + INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf + + # + # PCIe Support + # + INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf + INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf + # # UEFI application (Shell Embedded Boot Loader) # --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83829): https://edk2.groups.io/g/devel/message/83829 Mute This Topic: https://groups.io/mt/87123892/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83830+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83830+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167833412340.3288729976522; Wed, 17 Nov 2021 08:50:33 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id QYE8YY1788612xWhBJRuz0fo; Wed, 17 Nov 2021 08:50:33 -0800 X-Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.107.92.127]) by mx.groups.io with SMTP id smtpd.web08.9775.1637167832195912003 for ; Wed, 17 Nov 2021 08:50:32 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QofjgwhS1J89SU1x1cE81bwCNlt9AatOnS5RweXb9B9mk2eEZPL3PoHBcPMpLOQQcdaxHdCX9gncLCEAcM+92/K0Lkl/ozUXl9QC+NbJDE+cvByEO34tt0gS/5t4jy3K3dD5YiQSe9LFuc3up3DoESH471/ojsrrKx2gVEbkvlH7mRoygaep9jVCdTnVgh/PrbLire4Qbk2Pe5Lo/50mxhui86wjaGh1k6g/LBLY2UUESjq+5qpAhdZc9PXHM98MVsGmd+MFtmwH7xVtjufLsBQsCtNy0565ih7ynf64mj8DKYzRK63N+e3iBXtC7gXbo2eG+N0NGITi/gesU8H+wA== 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=7O25SsjQe6JsI3Yltfez/MOUj2dYEuhP5nTVskfstvM=; b=jsqygubPP6YO64KZFXxvX8d6jHhxuLi8bfU6yVlcCgz/WiD4CTUdG8j4ONkgQxFxYat6SoA/hKl0+5h1Dc5TKqv99lW/hKFaiXq9JZ0LGw8QO662utanL1b2vzIxhM0S+sNwP9Xk+3s63I1608Ol4cCSz7yRTEgu+TxOvGCJwSa1NQPuJqbCoCkMJwT7inYgvjaQg/xhjpq7JLECYro5iAQF9WN4NH9ii/quYBiycC1bvVPyh22sAbXQzD9PWSJ3hUq/zCPe6F/ReQAc5O2keljStFpskJzOs65aiA4tVZb9ICAgUo1VdohkYGzVndugO5RpgQvgj81wEuRBIWHvWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB7521.prod.exchangelabs.com (2603:10b6:510:f4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Wed, 17 Nov 2021 16:50:30 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:30 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 17/30] JadePkg: Add PciPlatformDxe driver Date: Wed, 17 Nov 2021 23:47:14 +0700 Message-ID: <20211117164727.10922-18-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:50:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 594b92b2-3394-4a92-b7e1-08d9a9ea5d37 X-MS-TrafficTypeDiagnostic: PH0PR01MB7521: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: eYWL75Jzue7tPPc/IRTUhZzyHLgm50ln6k2QarYxjL5UX8kYyZZ0TykT4ajBOwU4YE4wwv+PLeu240IPd8KXXmE4ozwuAmiN+o1h8bv49L3ppmR8FbNGvG7zawkenlFirogPwtyArOrrB83Tk0l3ICE9FJbm3hnTPmsxh2ZtQR5SLnNcZfa2Z4yQ+dZOWNtgRo11f7CXy7BvvxSpxWFOFz5ueGKbIqcuA8IYihTAW3sIXJjAd00XAaCiK45F14Znzn6o/EMH9hB4Egar5BL7l8z6NwCwDFxAZlVvFgeT2WamwM2d9HNqGjYQjb99NeIl1XxRrTGlMfY7vISdHam5cToEaSbp80MTFHy0zulAKh2FUZBsct2Ah8SIEwaMB2ixElxgQLQPk5biIINEI5BRgCqAdoXJeRFCbcVOICpmM5g7X88JFhitRVjPlk95TOTaDCUEA6qyLWFqM7WAHm4XMmYsk2SAuJkU61oX3VaIAv0fcHX/rUAEYk8Zk8/sGDw/NhO8PfVPAac3wsOhkJRnx5cjHdN7/JOPOMZ29d+n9iZ/12pqThJBwamuwfaA6iGLaVnO+Lz6ufkBW05eZIPNfeRGrcpUNvkJOJuVg7l2CU2PUrpL2FqmxXBi9Ml35gd+EGFvMuSi+F90SfePRzQPKPA1Y2rvUdMPugKd+5rlGF/gJ4KIwpPs4LUU1NrvTwjvVfqHYJG9g6iu4h85qSutGCcRF2liR0n2pM2SXb1Xf4I= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?rnhU2cAbH8/YkwXRzew6AlvBvtP4bY6PMkX3ICGWBpFZHr2HlrdWkqqlP2nf?= =?us-ascii?Q?dfcQFddodoEqrqZEWvScDeWgfw6Fpz6qk30sXi/EcUy/LLpPeidwPsrEkc75?= =?us-ascii?Q?Ka2T4ynyb1hMP9op2xX5/7EoQ0WeEXGe4nK4dLI2Fr/6l7vUaLjkiaW1rTaz?= =?us-ascii?Q?gbV3lfguGj4Al/leosF1hjJidiGL2XNs841jBRPNDWkSKFn/3r8iyEFPjRZ4?= =?us-ascii?Q?IFEuBMtPEJdfBMvzLUs3wvpkzYUSvNZqXn9iRrSZUKM0mNE5FpBJ+XrMc70d?= =?us-ascii?Q?RlmNKTrwTBk6TyUCB8vzyJl10F5HO0SgwKuodIyRjd1R+o7Ber7wUyrz4NkY?= =?us-ascii?Q?KgmUY7JRWX75IGcRuVaCgncCdFvyUyBkjOSZBT8r6AF+7d9bHeP2P3o0U2CK?= =?us-ascii?Q?UO1b1PU6QHiOB5CwnTTsNiqn4tp2Ut8PG0T+Z/JxGraAMFEUkO5l2JUXLi9+?= =?us-ascii?Q?LR15DnTiDiTXU+V/VOMO0kVytWZENLcfpwwO1BGQDdt8XZLYIa1zRre+vg67?= =?us-ascii?Q?Kh2dtWh5kA6nana3HALzLlaeEeGxSU5Kj3DI9s62YJ05tKCyppFDCJDwy2NW?= =?us-ascii?Q?0EVO2FQJ1aRvXJeB0jpxt0nBb9LNc4g9uaEzj0MsqZpA3hU0z8mM4T+hxKUP?= =?us-ascii?Q?9+PQX8N62UBgy6XSl/Xvg7X9DH/GqU2PlB6BGkzgddTSt1TwmZHfwR5diGlP?= =?us-ascii?Q?UDFxciMQRzKamSWUYTDXgEG0LcICGmCFZaIZIr79PiarkoxH83fCJsoUPWUQ?= =?us-ascii?Q?GoSf5pZBQsZ4W0XUMXI0JHvr2SsHkg+9qrBvHtvwBSeo5WseFO3kTsfKCTEh?= =?us-ascii?Q?BfRX2MehUM56GHP05g8OXuyDUQEM0t8b0nqWFVupbwQvqsIz0FcLUao+7ZG1?= =?us-ascii?Q?iv53xPyMb63aabWFUhlJfLXlY9tZouNIHjN5uQH8uNO1Y1lvashR7dmPgIj2?= =?us-ascii?Q?iupIOUTPoC7eCZd7kJTrlMHEWgq7vTAw0Q4PVyXMyjzKz7At8iD26KchEpy6?= =?us-ascii?Q?AyVmmbUE+otXzYpw1UQndDnzi61YwxicQfRs4xq3YwqKgDb0hWMn/uSVH6Uk?= =?us-ascii?Q?MAbVvACHMt33jMJyMx19QL8UkeC0LxLJpxnHyn2HdleWeDzjk0G2q2owLCn5?= =?us-ascii?Q?w6/7KCxvgT8EOJwcDfCdSy9NE/xkCagOMsuaGQJBENv2T/lRODqedkQTT1MJ?= =?us-ascii?Q?EKEcDnFkIbxfB86LkDY/91+fBSlztisSpoenEnhoRbMN0Ix33AlFeVsQB63M?= =?us-ascii?Q?MHbFLjIABG1N6AZiDIcsmIRxUzxYu+dMA2Vo0bw0st2CX2JLzLXRAuWqGkkV?= =?us-ascii?Q?e5LwTVM1lZOSBlNQecI2gMY1dXsu/aP4XX3Ao/UfaCQ9H6Q1IkXym8hL01p6?= =?us-ascii?Q?PzSKGp1S18hZ9UCVZN9LcsQXC2zMovRsCjK2RtWGGf2wN/TVHYeRbqUuyprN?= =?us-ascii?Q?aaZYG/wT98lbaMeLGMSeCb6X9US2BzY9D43SPeTlbNMmqbK3lsFr0d6XEBmm?= =?us-ascii?Q?yFerEX2mvqRyVd9WJ7vp57SrZIzUewZKdUmluYV+RNJbhJTram7PcJlDvZnH?= =?us-ascii?Q?UVquMXJNSG6BfzJqrKRDtZIRXq00NU5XiKZVEX1bis9271NhQkKFRBg4MFKz?= =?us-ascii?Q?Im/l4l6ilReoC5D2VFjLvjN1idrhfEnfrHWdVQ2vduw767fH17OQRUPTDQQK?= =?us-ascii?Q?dgUg2U7+Cb2wI4V7zQcrbKXIvh8=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 594b92b2-3394-4a92-b7e1-08d9a9ea5d37 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:30.4693 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Tyb533/fsZ/LTpHUgTOeJyhYrJzdGzQ/syrViq0xDLZoM09C8n5vV2BI8ZhrNWs9USEKExg81MVSIoksWof8pLaS8Z/IuMsm1xkK4jUcwWc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7521 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: kmlRN2E33qhmcIbauPrcyzFUx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167833; bh=uCho1rLCrbIAeReaTDyraRPxt/3PYlZ15Y0n3cTS/SE=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=rLauFn7kgRT3OS9bc0TxyPBR1dHFSeyv8SmSv67ZTIxQ4ZnS83LTNwHYrKBj191Xj5V xyS2sk/WZWoCYXzYH419aZ7OUmJRESnzYf4sglESXdOdv5awYZOonxfD824IxsBMuUdjE JGqVk+eMfNvMKX9wpHEZN5caucFvaNAdMa0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167835440100001 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen Registers the Platform NotifyPhase() to prevent unexpected issues caused by the enabled PCIe controllers with unstable link. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Platform/Ampere/JadePkg/Jade.dsc | 5 + Platform/Ampere/JadePkg/Jade.fdf | 1 + Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.inf | 41 ++= ++ Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.c | 258 ++= ++++++++++++++++++ 4 files changed, 305 insertions(+) diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index 9315c1c71cc7..ffba757a6130 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -129,3 +129,8 @@ [Components.common] Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/AcpiCommonTables.inf Platform/Ampere/JadePkg/AcpiTables/AcpiTables.inf + + # + # PCIe + # + Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.inf diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index 6de01dfe36d5..99c361174974 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -295,6 +295,7 @@ [FV.FvMain] # INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf + INF Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.inf =20 # # UEFI application (Shell Embedded Boot Loader) diff --git a/Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.= inf b/Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.inf new file mode 100644 index 000000000000..ddf6eeb759eb --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.inf @@ -0,0 +1,41 @@ +## @file +# +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D PciPlatformDxe + FILE_GUID =3D 73276F3D-DCBC-49B2-9890-7564F917501D + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D PciPlatformDriverEntry + +[Sources] + PciPlatformDxe.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + Ac01PcieLib + DebugLib + HobLib + TimerLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Protocols] + gEfiDevicePathProtocolGuid + gEfiPciHostBridgeResourceAllocationProtocolGuid + gEfiPciPlatformProtocolGuid + +[Guids] + gRootComplexInfoHobGuid + +[Depex] + TRUE diff --git a/Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.= c b/Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.c new file mode 100644 index 000000000000..865dfb891a24 --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.c @@ -0,0 +1,258 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#pragma pack(1) +typedef struct { + ACPI_HID_DEVICE_PATH AcpiDevicePath; + EFI_DEVICE_PATH_PROTOCOL EndDevicePath; +} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH; +#pragma pack () + +/** + Callback funciton for EndEnumeration notification from PCI stack. + + @param[in] RootBridgeIndex Index to identify of PCIE Root bridge. + @param[in] Phase The phase of enumeration as informed f= rom PCI stack. +**/ +VOID +NotifyPhaseCallBack ( + IN UINTN RootBridgeIndex, + IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase + ) +{ + AC01_ROOT_COMPLEX *RootComplexList; + VOID *Hob; + + Hob =3D GetFirstGuidHob (&gRootComplexInfoHobGuid); + if (Hob =3D=3D NULL) { + return; + } + + RootComplexList =3D (AC01_ROOT_COMPLEX *)GET_GUID_HOB_DATA (Hob); + + switch (Phase) { + case EfiPciHostBridgeEndEnumeration: + Ac01PcieCoreEndEnumeration (&RootComplexList[RootBridgeIndex]); + break; + + case EfiPciHostBridgeBeginEnumeration: + // 100ms that help fixing completion timeout issue + MicroSecondDelay (100000); + break; + + case EfiPciHostBridgeBeginBusAllocation: + case EfiPciHostBridgeEndBusAllocation: + case EfiPciHostBridgeBeginResourceAllocation: + case EfiPciHostBridgeAllocateResources: + case EfiPciHostBridgeSetResources: + case EfiPciHostBridgeFreeResources: + case EfiPciHostBridgeEndResourceAllocation: + case EfiMaxPciHostBridgeEnumerationPhase: + break; + } +} + +/** + + Perform initialization by the phase indicated. + + @param This Pointer to the EFI_PCI_PLATFORM_PROTO= COL instance. + @param HostBridge The associated PCI host bridge handle. + @param Phase The phase of the PCI controller enume= ration. + @param ChipsetPhase Defines the execution phase of the PC= I chipset driver. + + @retval EFI_SUCCESS Must return with success. + +**/ +EFI_STATUS +EFIAPI +PhaseNotify ( + IN EFI_PCI_PLATFORM_PROTOCOL *This, + IN EFI_HANDLE HostBridge, + IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase, + IN EFI_PCI_CHIPSET_EXECUTION_PHASE ChipsetPhase + ) +{ + EFI_PCI_ROOT_BRIDGE_DEVICE_PATH *RootBridgeDevPath; + EFI_HANDLE RootBridgeHandle =3D N= ULL; + EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *ResAlloc =3D NULL; + EFI_STATUS Status; + + if (ChipsetPhase !=3D ChipsetExit) { + return EFI_SUCCESS; + } + + // + // Get HostBridgeInstance from HostBridge handle. + // + Status =3D gBS->HandleProtocol ( + HostBridge, + &gEfiPciHostBridgeResourceAllocationProtocolGuid, + (VOID **)&ResAlloc + ); + + while (TRUE) { + Status =3D ResAlloc->GetNextRootBridge (ResAlloc, &RootBridgeHandle); + if (EFI_ERROR (Status)) { + break; + } + + Status =3D gBS->HandleProtocol ( + RootBridgeHandle, + &gEfiDevicePathProtocolGuid, + (VOID **)&RootBridgeDevPath + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a %d: Failed to locate RootBridge DevicePath\= n", __FUNCTION__, __LINE__)); + break; + } + + NotifyPhaseCallBack (RootBridgeDevPath->AcpiDevicePath.UID, Phase); + } + + return EFI_SUCCESS; +} + +/** + + The PlatformPrepController() function can be used to notify the platform= driver so that + it can perform platform-specific actions. No specific actions are requir= ed. + Several notification points are defined at this time. More synchronizati= on points may be + added as required in the future. The PCI bus driver calls the platform d= river twice for + every PCI controller-once before the PCI Host Bridge Resource Allocation= Protocol driver + is notified, and once after the PCI Host Bridge Resource Allocation Prot= ocol driver has + been notified. + This member function may not perform any error checking on the input par= ameters. It also + does not return any error codes. If this member function detects any err= or condition, it + needs to handle those errors on its own because there is no way to surfa= ce any errors to + the caller. + + @param This Pointer to the EFI_PCI_PLATFORM_PROTOC= OL instance. + @param HostBridge The associated PCI host bridge handle. + @param RootBridge The associated PCI root bridge handle. + @param PciAddress The address of the PCI device on the P= CI bus. + @param Phase The phase of the PCI controller enumer= ation. + @param ChipsetPhase Defines the execution phase of the PCI= chipset driver. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_UNSUPPORTED Not supported. + +**/ +EFI_STATUS +EFIAPI +PlatformPrepController ( + IN EFI_PCI_PLATFORM_PROTOCOL *This, + IN EFI_HANDLE HostBridge, + IN EFI_HANDLE RootBridge, + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress, + IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase, + IN EFI_PCI_CHIPSET_EXECUTION_PHASE ChipsetPhase + ) +{ + return EFI_UNSUPPORTED; +} + +/** + Set the PciPolicy as EFI_RESERVE_ISA_IO_NO_ALIAS | EFI_RESERVE_VGA_IO_NO= _ALIAS. + + @param This The pointer to the Protocol itself. + @param PciPolicy The returned Policy. + + @retval EFI_UNSUPPORTED Function not supported. + @retval EFI_INVALID_PARAMETER Invalid PciPolicy value. + +**/ +EFI_STATUS +EFIAPI +GetPlatformPolicy ( + IN CONST EFI_PCI_PLATFORM_PROTOCOL *This, + OUT EFI_PCI_PLATFORM_POLICY *PciPolicy + ) +{ + return EFI_UNSUPPORTED; +} + +/** + + Return a PCI ROM image for the onboard device represented by PciHandle. + + @param This Protocol instance pointer. + @param PciHandle PCI device to return the ROM image fo= r. + @param RomImage PCI Rom Image for onboard device. + @param RomSize Size of RomImage in bytes. + + @retval EFI_SUCCESS RomImage is valid. + @retval EFI_NOT_FOUND No RomImage. + +**/ +EFI_STATUS +EFIAPI +GetPciRom ( + IN CONST EFI_PCI_PLATFORM_PROTOCOL *This, + IN EFI_HANDLE PciHandle, + OUT VOID **RomImage, + OUT UINTN *RomSize + ) +{ + return EFI_NOT_FOUND; +} + +// +// Interface defintion of PCI Platform protocol. +// +EFI_PCI_PLATFORM_PROTOCOL mPciPlatformProtocol =3D { + .PlatformNotify =3D PhaseNotify, + .PlatformPrepController =3D PlatformPrepController, + .GetPlatformPolicy =3D GetPlatformPolicy, + .GetPciRom =3D GetPciRom +}; + +/** + + The Entry point of the Pci Platform Driver. + + @param ImageHandle Handle to the image. + @param SystemTable Handle to System Table. + + @retval EFI_STATUS Status of the function calling. + +**/ +EFI_STATUS +PciPlatformDriverEntry ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_HANDLE PciPlatformHandle; + + // + // Install on a new handle + // + PciPlatformHandle =3D NULL; + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &PciPlatformHandle, + &gEfiPciPlatformProtocolGuid, + &mPciPlatformProtocol, + NULL + ); + + return Status; +} --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83830): https://edk2.groups.io/g/devel/message/83830 Mute This Topic: https://groups.io/mt/87123894/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83831+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83831+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167839634368.6156057220686; Wed, 17 Nov 2021 08:50:39 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id NQd8YY1788612x4VkxbceS9w; Wed, 17 Nov 2021 08:50:39 -0800 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.123]) by mx.groups.io with SMTP id smtpd.web12.9717.1637167838646754662 for ; Wed, 17 Nov 2021 08:50:38 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TsnpLWB0JLWLNE4kPaLYZ85I0JNnPJlz38GMTG14XlB4ANa4qHYAeAElfqc5pOftuEStjOHX28ubU38jDI1TuhmpiCm0NSYPBaV56MxCXkK9qNnr1n4eqmlPh6hIDk59J+q0iivCY/cIOvBlOmuFs3vSDQU6RtxndO1faS5Lu72ZOr2C7iGHL8pnKfzwUhTewSzeb83yQpice8nVlcY3NHsgc5DChwjdl1mroFupsvAKPg3hOSmeXPh7T1OeWIZB3eSVJkBmCXomXdiLu3LuY5DbFmSm3MUq+yqysifF6OvhZCEAsCcDqZ4G1Hu7uVbO1W37021dWXbEFTo6BqGLzA== 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=sCRH5R9dzmQM1JOXlnzy4HiSAORvQVY91wzeZ1aLxSE=; b=NVncdKkxvPK2dOjTp32Vfc28Lnn+z/903OQKgkHRJ0AmjCzfJylWBSAI5uTzTaxIh3RTyyQKqGOm365P279erX54eJW2op5R9wl0SS62yaiRJNApufiPrdKQYtoZPULX7Rls7LvIskGkVeywoWqnPFQdqUJL22oSkL+q0ZfLVRmlBG2xKy/5Zjoj9zmGFGM+K68WSlrhEYmfe0Fe4YUteC9hs1HVbwRtLd4T8sLIIUdP5M/C0+SMXpaGfT1L6qG29w5OJBAM7OCsT4giPBpGy14BejPT6F7UcZ9lpiKxSwsrK8RQcI/PYHlljDqOSyYBHguQzPxRR2B/J+gQSr/mhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB7521.prod.exchangelabs.com (2603:10b6:510:f4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Wed, 17 Nov 2021 16:50:33 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:33 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 18/30] JadePkg: Add ACPI tables to support PCIe Date: Wed, 17 Nov 2021 23:47:15 +0700 Message-ID: <20211117164727.10922-19-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:50:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b3f9545b-b7c5-4c66-c5e8-08d9a9ea5f2a X-MS-TrafficTypeDiagnostic: PH0PR01MB7521: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: JtcRNiHvE3P34ylyjW1MiM8Q1kCRATsLrl7HhWKfP1JJhRssl47mqPNC8wdQXBHU0uStxFveSk9Y1u97MrB3YnhFwJnu/C/GgJ1QDHhbIXZZ5YCnAvckAg+LYzv5IAxioER7KZgCCScxfmMUyt+lRfLlzNpfwrr4HPmTEUfpszp25NupVah1RdVZEI25WeXEskVT8keoiRmyTQ49jgKybtdS/kKuwdrLCskq6E30gCDxS39+jW1tL/NzxZSO1SFchxKsVPSHGs4U8vlQNv+ZboOOwygX7UMRkQ4yEzYSYnGbW7uihKFyyguLEscAlG+PEFVEWyS7UIyZ7WR8kGBjGw4P4O2kuyEQWEIySAsJ26F3PeumjjkP64OcFeWJu/iVWaTAssMV52WwUlsU7vBbCfCnUO+UcQZvhlgx8HIi7JDC8yFeRWxxq5UReho6MH3kliU+APs5C0a4b/UyYC6QQ64hqlL7cIwxnQ0gjWTct0FirbSIv51Vw3M/w1SqstNoqlz7P2aGA1QhtTcC52lIo1qLD1Jy+rnlRlzGU4wTK8Cz7Mg6ry9Qa23iLa2sOKIM2os4KS2C/1F6oJVo73i9YLrJJvHskVcNgxcrWfYCPYXhOOB8uoOTiNSMGYC2pUl/zcUu9tWmbqEmBNlysTqzqRm1CCeZMNRnIKvrP8s1Hp4im3Tv8BpBZZXU71HbWYKUFrHQrnR5UWLDcUidrwf9kQ== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?afqNKudLk+pnFsyJ2J+ZzvzCsbviBNUaDMPZhR01OkjVGjTKxHE9f5yL1IhK?= =?us-ascii?Q?vFXQHjkH74FuFFygCEMsowsG9iCs+dhc4fit4ZDICgulxuK1L1HbkGBakRvi?= =?us-ascii?Q?MDECyrZE0jqBbDoDJZSZIRC/EnnDmTkbn+1YQukJjnOUeY36Extz0s3bLoKG?= =?us-ascii?Q?pm0Ay+k5lsiJyJ0ofmwDdtwprMqluKYCdkzmUVLj3+0C9tNzu/5sYJBbKiS9?= =?us-ascii?Q?XaHIf/MaTllmcIiYd3MxrizG1eD/7aqwqIKc5M+vJSv052z7lO2UtGbjH/HK?= =?us-ascii?Q?5HfraaTTNr+eoL9sAHG3SQxGanriL9gvMQAANClaB644+/7fQuQ0nxl4uJhr?= =?us-ascii?Q?+Ncn3IkRxzG+i8CyfYeIIwQB0fTK1ASGAaMWVXRe+GRJq8bVwzuvfQhOnDUK?= =?us-ascii?Q?3AObWmSXSjcpwLfKH9uY+sctw/81Qwa/hrIEkdMhL21Hd+3R9EetgCS4xOeC?= =?us-ascii?Q?lP52QTGyWqG2tlxwF6TO7c8/wOw2wvCamx6S5NV4l16mpp+YeWfufu8vPFX/?= =?us-ascii?Q?MecoV6UhuQzmqpCzvfRa0PCuvYMab6NSR/2EXKIHOZmGExMqsITKXFWVM2uW?= =?us-ascii?Q?RmIBE9rIxQIAwu2qQIfJb9LRXSc0OO6yXr6ctxrWIILDdAXSgu5ik8OQCHut?= =?us-ascii?Q?SI2eNb/mB9xCvahokzDPC9djScfNWkRUJP1n+WHJ7v3oJJPc1BQJC6OY9AGf?= =?us-ascii?Q?oXHD+QYqLFD2Sc8dQcEoJ7nQsC0qV6jRqbCaeFT1nNvrybMSjuXkTUypj/QC?= =?us-ascii?Q?I8FJ2oITDS5R2lP1sDB4E3V3oDcgHYFP61vaLpw7BdtuAoyVlZ7BV+dBqUXJ?= =?us-ascii?Q?LbHdZ1r4HMmm6+G4uL/HQTm/fxtD69UmoxXW6vpxKsBu7YYgX44z6XcIJGmi?= =?us-ascii?Q?yM0j2HHzafQnVgVonnmnp8ZyfWsMk6b5ynbgWP8bV5CkCTqMx8x8ejGxHtAR?= =?us-ascii?Q?ZRY1p3EajQXTAAO3YbG2ciCq+/jzJfm7PGJNHxyORrfslW2EkCvvk1Wt9e90?= =?us-ascii?Q?2sA9jAgCxi233fYyNZhan45dP+ShyOYbPNFnwqtpzjYz9xTYsWaCGHaihk3T?= =?us-ascii?Q?L0k+Hp2ut6r1edan7EgvxQqwthLCfLQTJTqDRV2uGyLJHh/c5NwOj1GbSY1j?= =?us-ascii?Q?zoKft92ctVAfdaIe+LOhnPTA+aOt0R8WOw92j0u3zPHrQLWhSf9aRFBEJegS?= =?us-ascii?Q?LH/PDfArTWBSvih1hLQ3qxODztkXu51NAAAy7M1JAi6Vp1ReSB23BQ7w+BZ0?= =?us-ascii?Q?bWhT+be87MuH6JnKXuKElv+hMs/HPPRMU0iv7dh7AcUPZLvql/a4vJ+yDTYV?= =?us-ascii?Q?yJH975h9yKHxe0MlVANKKIYV0PN3tLV3PMZSHQGcIDtBOL6hAnj4hp3TpZ2r?= =?us-ascii?Q?d7YDlUS6w35e28mBoiqtlp1ryRAn5XKBMxLSwznCdHPyJJwJ1MqsR84USseI?= =?us-ascii?Q?I9tfS7gsNJU33/Qs2O8flBWUcCAtLAjaZFmQ9OaV4f8Be6Ad2btBYhUSqhou?= =?us-ascii?Q?n5eC7NVdTy4fyOX5vtJoZHOZuH3Lq0eJW5vgV6csSL+93WJ+e4jfGjigjQsI?= =?us-ascii?Q?bWzHeMcz5c/9t8hX/np0EB9ie4irUmZOiMktliIm+KnPyygVBSl4h6Zpub5x?= =?us-ascii?Q?Ff2qB4+W8uwLJMH6UhNSrF1BN0YMRncmUgiUjUYckX7WPFF8FOLl8W734UW2?= =?us-ascii?Q?YCcWRF8yqAVkaZafEAzU+cVVjbM=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3f9545b-b7c5-4c66-c5e8-08d9a9ea5f2a X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:33.6842 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wOVKyYdXVF8Zv6bbJ70kg2RmEyV05XkwXxnAD6xW+zFXEKVZ6o/afmw95ltH3ngd7BkpAJODeK10XD3GpammCZx0qOYr4BOi6kvpktfxLIo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7521 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: ea91s4hgfbqsQEmJ3AoNVfpWx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167839; bh=fCwGtK1sFteVlw+snChBNjFlTqm9xX3Gizh+yNtdaCg=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=VnWLijusViWm1s5mMT0DdSYUK9zGRNZpmDKLympmwggz7rtspOiuhkren9ncdh6/bPG jC9B+O4/0AOay5b2MFT0754hBmnHbNZh27Q7yJ2nwtC0ljRzso5N20apBm6IRRJDXqb63 2b+nvbhUjYmnp4KJ/nKnqjXvkh9QL/RDgUU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167840220100002 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen Add IORT and MCFG tables to let the OS discover the PCIe resources. This driver also fixup the DSDT table to adapt with the difference between 1P and 2P system. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Acked-by: Leif Lindholm --- Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 4 + Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform.h | 12 + Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h | 60 = ++++ Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiDsdt.c | 90 = +++++ Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiIort.c | 349 = ++++++++++++++++++++ Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiMcfg.c | 151 = +++++++++ Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.c | 10 + 7 files changed, 676 insertions(+) diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDx= e.inf b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf index 72e78fb4e31e..415f795d2a54 100644 --- a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf @@ -18,7 +18,9 @@ [Sources.common] AcpiApei.c AcpiApei.h AcpiDsdt.c + AcpiIort.c AcpiMadt.c + AcpiMcfg.c AcpiNfit.c AcpiPcct.c AcpiPlatform.h @@ -43,6 +45,7 @@ [LibraryClasses] BaseLib DebugLib FlashLib + HobLib MailboxInterfaceLib SystemFirmwareInterfaceLib TimerLib @@ -66,6 +69,7 @@ [Guids] gEfiAcpiTableGuid gEfiEventReadyToBootGuid gPlatformInfoHobGuid + gRootComplexInfoHobGuid =20 [Protocols] gEfiAcpiTableProtocolGuid ## ALWAYS_CONSUMED diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform.h= b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform.h index b5035067a47b..170aeff24d59 100644 --- a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform.h +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform.h @@ -71,4 +71,16 @@ AcpiInstallSratTable ( VOID ); =20 +EFI_STATUS +EFIAPI +AcpiInstallMcfg ( + VOID + ); + +EFI_STATUS +EFIAPI +AcpiInstallIort ( + VOID + ); + #endif /* ACPI_PLATFORM_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h b/Silico= n/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h index 132c0d6d6cac..d45688f88401 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h @@ -279,4 +279,64 @@ // #define AC01_PCIE_MMIO32_SIZE_1P_LIST 0x10000000, 0x10000000, 0x1000000= 0, 0x10000000, 0x8000000, 0x10000000, 0x10000000, 0x10000000, 0, 0, 0, 0, 0= , 0, 0, 0 =20 +// +// DSDT RCA2 PCIe MMIO32 Attribute +// +#define AC01_PCIE_RCA2_QMEM_LIST 0x0000000000000000, 0x00000000600= 00000, 0x000000006FFFFFFF, 0x0000000000000000, 0x0000000010000000 + +// +// DSDT RCA3 PCIe MMIO32 Attribute +// +#define AC01_PCIE_RCA3_QMEM_LIST 0x0000000000000000, 0x00000000700= 00000, 0x000000007FFFFFFF, 0x0000000000000000, 0x0000000010000000 + +// +// DSDT RCB0 PCIe MMIO32 Attribute +// +#define AC01_PCIE_RCB0_QMEM_LIST 0x0000000000000000, 0x00000000010= 00000, 0x000000000FFFFFFF, 0x0000000000000000, 0x000000000F000000 + +// +// DSDT RCB1 PCIe MMIO32 Attribute +// +#define AC01_PCIE_RCB1_QMEM_LIST 0x0000000000000000, 0x00000000100= 00000, 0x000000001FFFFFFF, 0x0000000000000000, 0x0000000010000000 + +// +// DSDT RCB2 PCIe MMIO32 Attribute +// +#define AC01_PCIE_RCB2_QMEM_LIST 0x0000000000000000, 0x00000000200= 00000, 0x000000002FFFFFFF, 0x0000000000000000, 0x0000000010000000 + +// +// DSDT RCB3 PCIe MMIO32 Attribute +// +#define AC01_PCIE_RCB3_QMEM_LIST 0x0000000000000000, 0x00000000300= 00000, 0x000000003FFFFFFF, 0x0000000000000000, 0x0000000010000000 + +// +// TBU PMU IRQ array +// +#define AC01_SMMU_TBU_PMU_IRQS_LIST 224, 230, 236, 242, 160, 170, 180= , 190, 544, 550, 556, 562, 480, 490, 500, 510 + +// +// TCU PMU IRQ array +// +#define AC01_SMMU_TCU_PMU_IRQS_LIST 256, 257, 258, 259, 260, 261, 262= , 263, 576, 577, 578, 579, 580, 581, 582, 583 + +// +// Max TBU PMU of Root Complex A +// +#define AC01_RCA_MAX_TBU_PMU 6 + +// +// Max TBU PMU of Root Complex B +// +#define AC01_RCB_MAX_TBU_PMU 10 + +// +// TBU Base offset of Root Complex A +// +#define AC01_RCA_TBU_PMU_OFFSET_LIST 0x40000, 0x60000, 0xA0000, 0xE000= 0, 0x100000, 0x140000 + +// +// TBU Base offset of Root Complex B +// +#define AC01_RCB_TBU_PMU_OFFSET_LIST 0x40000, 0x60000, 0xA0000, 0xE000= 0, 0x120000, 0x160000, 0x180000, 0x1C0000, 0x200000, 0x240000 + #endif /* PLATFORM_AC01_H_ */ diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiDsdt.c b/P= latform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiDsdt.c index 82bfbb90f07f..885ad8fc3511 100644 --- a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiDsdt.c +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiDsdt.c @@ -6,6 +6,7 @@ =20 **/ =20 +#include #include #include #include @@ -40,6 +41,24 @@ typedef struct { OP_REGION_DWORD_DATA RegionBase; OP_REGION_DWORD_DATA RegionLen; } AML_OP_REGION; + +typedef struct { + UINT64 AddressGranularity; + UINT64 AddressMin; + UINT64 AddressMax; + UINT64 AddressTranslation; + UINT64 RangeLength; +} QWORD_MEMORY; + +STATIC QWORD_MEMORY mQMemList[] =3D { + { AC01_PCIE_RCA2_QMEM_LIST }, + { AC01_PCIE_RCA3_QMEM_LIST }, + { AC01_PCIE_RCB0_QMEM_LIST }, + { AC01_PCIE_RCB1_QMEM_LIST }, + { AC01_PCIE_RCB2_QMEM_LIST }, + { AC01_PCIE_RCB3_QMEM_LIST } +}; + #pragma pack() =20 EFI_STATUS @@ -543,6 +562,76 @@ AcpiPatchPcieAerFwFirst ( return Status; } =20 +VOID +AcpiPatchPcieMmio32 ( + EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol, + EFI_ACPI_HANDLE TableHandle + ) +{ + AC01_ROOT_COMPLEX *RootComplexList; + CHAR8 *NextDescriptor, *Buffer; + CHAR8 NodePath[256]; + EFI_ACPI_DATA_TYPE DataType; + EFI_ACPI_HANDLE ObjectHandle; + EFI_STATUS Status; + EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor; + UINTN DataSize; + UINTN Idx; + VOID *Hob; + + Hob =3D GetFirstGuidHob (&gRootComplexInfoHobGuid); + if (Hob =3D=3D NULL) { + return; + } + + RootComplexList =3D (AC01_ROOT_COMPLEX *)GET_GUID_HOB_DATA (Hob); + + for (Idx =3D 0; Idx < AC01_PCIE_MAX_ROOT_COMPLEX; Idx++) { + if (!RootComplexList[Idx].Active) { + // + // Patch for disabled Root Complex + // + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.PCI%X._STA", Idx); + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePath, 0x= 0); + continue; + } + + if (!IsSlaveSocketActive () && Idx <=3D SOCKET0_LAST_RC) { + // + // Patch MMIO32 resource in 1P system + // + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.PCI%X.RBUF", Idx); + Status =3D AcpiSdtProtocol->FindPath (TableHandle, NodePath, &Object= Handle); + if (EFI_ERROR (Status)) { + continue; + } + + Status =3D AcpiSdtProtocol->GetOption (ObjectHandle, 2, &DataType, (= VOID *)&Buffer, &DataSize); + if (EFI_ERROR (Status)) { + continue; + } + + if (DataType !=3D EFI_ACPI_DATA_TYPE_CHILD) { + AcpiSdtProtocol->Close (ObjectHandle); + continue; + } + + NextDescriptor =3D Buffer + 5; // Point to first address space descr= iptor + while ((NextDescriptor - Buffer) < DataSize) { + Descriptor =3D (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)NextDescriptor; + if (Descriptor->Desc =3D=3D ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR + && Descriptor->ResType =3D=3D ACPI_ADDRESS_SPACE_TYPE_MEM) { + CopyMem (&Descriptor->AddrSpaceGranularity, &mQMemList[Idx - 2],= sizeof (QWORD_MEMORY)); + break; + } + NextDescriptor +=3D (Descriptor->Len + sizeof (ACPI_LARGE_RESOURCE= _HEADER)); + } + + AcpiSdtProtocol->Close (ObjectHandle); + } + } +} + EFI_STATUS AcpiPatchDsdtTable ( VOID @@ -593,6 +682,7 @@ AcpiPatchDsdtTable ( AcpiPatchNvdimm (AcpiSdtProtocol, TableHandle); AcpiPatchPcieNuma (AcpiSdtProtocol, TableHandle); AcpiPatchPcieAerFwFirst (AcpiSdtProtocol, TableHandle); + AcpiPatchPcieMmio32 (AcpiSdtProtocol, TableHandle); =20 AcpiSdtProtocol->Close (TableHandle); AcpiUpdateChecksum ((UINT8 *)Table, Table->Length); diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiIort.c b/P= latform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiIort.c new file mode 100644 index 000000000000..b8f8cfa356af --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiIort.c @@ -0,0 +1,349 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define __AC01_ID_MAPPING(In, Num, Out, Ref, Flags) \ + { \ + In, \ + Num, \ + Out, \ + OFFSET_OF (AC01_IO_REMAPPING_STRUCTURE, Ref), \ + Flags \ + } + +#define TCU_TO_SMMU_OFFSET 0x2000 +#define PAGE1_TO_PMCG_OFFSET 0x10000 + +STATIC AC01_ROOT_COMPLEX *mRootComplexList; + +STATIC UINT32 mTbuPmuIrqArray[] =3D { AC01_SMMU_TBU_PMU_IRQS_LIST }; +STATIC UINT32 mTcuPmuIrqArray[] =3D { AC01_SMMU_TCU_PMU_IRQS_LIST }; +STATIC UINT64 mRcaTbuPmuOffset[] =3D { AC01_RCA_TBU_PMU_OFFSET_LIST }; +STATIC UINT64 mRcbTbuPmuOffset[] =3D { AC01_RCB_TBU_PMU_OFFSET_LIST }; + +#pragma pack(1) + +typedef struct { + EFI_ACPI_6_0_IO_REMAPPING_NODE Node; + UINT64 Base; + UINT32 Flags; + UINT32 Reserved; + UINT64 VatosAddress; + UINT32 Model; + UINT32 Event; + UINT32 Pri; + UINT32 Gerr; + UINT32 Sync; + UINT32 ProximityDomain; + UINT32 DeviceIdMapping; +} EFI_ACPI_6_2_IO_REMAPPING_SMMU3_NODE; + +typedef struct { + EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE Node; + UINT32 ItsIdentifier; +} AC01_ITS_NODE; + +typedef struct { + EFI_ACPI_6_0_IO_REMAPPING_RC_NODE Node; + EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE RcIdMapping; +} AC01_RC_NODE; + +typedef struct { + EFI_ACPI_6_2_IO_REMAPPING_SMMU3_NODE Node; + EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE InterruptMsiMapping; + EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE InterruptMsiMappingSingle; +} AC01_SMMU_NODE; + +typedef struct { + EFI_ACPI_6_0_IO_REMAPPING_TABLE Iort; + AC01_ITS_NODE ItsNode[2]; + AC01_RC_NODE RcNode[2]; + AC01_SMMU_NODE SmmuNode[2]; +} AC01_IO_REMAPPING_STRUCTURE; + +#pragma pack() + +EFI_ACPI_6_0_IO_REMAPPING_TABLE mIortHeader =3D { + .Header =3D __ACPI_HEADER ( + EFI_ACPI_6_0_IO_REMAPPING_TABLE_SIGNATURE, + AC01_IO_REMAPPING_STRUCTURE, + EFI_ACPI_IO_REMAPPING_TABLE_REVISION + ), + .NumNodes =3D 0, // To be filled + .NodeOffset =3D sizeof (EFI_ACPI_6_0_IO_REMAPPING_TABLE), + 0 +}; + +AC01_ITS_NODE mItsNodeTemplate =3D { + .Node =3D { + { + EFI_ACPI_IORT_TYPE_ITS_GROUP, + sizeof (EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE) + 4, + 0x0, + 0x0, + 0x0, + 0x0, + }, + .NumItsIdentifiers =3D 1, + }, + .ItsIdentifier =3D 1, +}; + +AC01_RC_NODE mRcNodeTemplate =3D { + { + { + EFI_ACPI_IORT_TYPE_ROOT_COMPLEX, + sizeof (AC01_RC_NODE), + 0x1, + 0x0, + 0x1, + OFFSET_OF (AC01_RC_NODE, RcIdMapping), + }, + EFI_ACPI_IORT_MEM_ACCESS_PROP_CCA, + 0x0, + 0x0, + EFI_ACPI_IORT_MEM_ACCESS_FLAGS_CPM | + EFI_ACPI_IORT_MEM_ACCESS_FLAGS_DACS, + EFI_ACPI_IORT_ROOT_COMPLEX_ATS_UNSUPPORTED, + .PciSegmentNumber =3D 0, + .MemoryAddressSize =3D 64, + }, + __AC01_ID_MAPPING (0x0, 0xffff, 0x0, SmmuNode, 0), +}; + +AC01_SMMU_NODE mSmmuNodeTemplate =3D { + { + { + EFI_ACPI_IORT_TYPE_SMMUv3, + sizeof (AC01_SMMU_NODE), + 0x2, // Revision + 0x0, + 0x2, // Mapping Count + OFFSET_OF (AC01_SMMU_NODE, InterruptMsiMapping), + }, + .Base =3D 0, + EFI_ACPI_IORT_SMMUv3_FLAG_COHAC_OVERRIDE | EFI_ACPI_IORT_SMMUv3_FLAG_P= ROXIMITY_DOMAIN, + 0, + 0, + 0, + 0, + 0, + 0x0, + 0x0, + 0, // Proximity domain - need fill in + .DeviceIdMapping =3D 1, + }, + __AC01_ID_MAPPING (0x0, 0xffff, 0, SmmuNode, 0), + __AC01_ID_MAPPING (0x0, 0x1, 0, SmmuNode, 1), +}; + +EFI_ACPI_6_0_IO_REMAPPING_PMCG_NODE mPmcgNodeTemplate =3D { + { + EFI_ACPI_IORT_TYPE_PMCG, + sizeof (EFI_ACPI_6_0_IO_REMAPPING_PMCG_NODE), + 0x1, + 0x0, + 0x0, + 0x0, + }, + 0, // Page 0 Base. Need to be filled + 0, // GSIV. Need to be filled + 0, // Node reference. Need to be filled + 0, // Page 1 Base. Need to be filled +}; + +STATIC +VOID +ConstructIort ( + VOID *IortBuffer, + UINT32 RcCount, + UINT32 SmmuPmuAgentCount, + UINT32 HeaderCount, + INT32 *EnabledRCs + ) +{ + AC01_ROOT_COMPLEX *RootComplex; + UINT32 Idx, Idx1; + UINT32 ItsOffset[AC01_PCIE_MAX_ROOT_COMPLEX]; + UINT32 SmmuNodeOffset[AC01_PCIE_MAX_ROOT_COMPLEX]; + UINT64 *TbuPmuOffset; + UINTN MaxTbuPmu; + VOID *IortIter, *SmmuIter, *PmcgIter; + + IortIter =3D IortBuffer; + mIortHeader.Header.Length =3D HeaderCount; + mIortHeader.NumNodes =3D (3 * RcCount) + SmmuPmuAgentCount, + CopyMem (IortIter, &mIortHeader, sizeof (EFI_ACPI_6_0_IO_REMAPPING_TABLE= )); + + IortIter +=3D sizeof (EFI_ACPI_6_0_IO_REMAPPING_TABLE); + for (Idx =3D 0; Idx < RcCount; Idx++) { + ItsOffset[Idx] =3D IortIter - IortBuffer; + mItsNodeTemplate.ItsIdentifier =3D EnabledRCs[Idx]; + CopyMem (IortIter, &mItsNodeTemplate, sizeof (AC01_ITS_NODE)); + IortIter +=3D sizeof (AC01_ITS_NODE); + } + + SmmuIter =3D IortIter + RcCount * sizeof (AC01_RC_NODE); + PmcgIter =3D SmmuIter + RcCount * sizeof (AC01_SMMU_NODE); + for (Idx =3D 0; Idx < RcCount; Idx++) { + SmmuNodeOffset[Idx] =3D SmmuIter - IortBuffer; + RootComplex =3D &mRootComplexList[EnabledRCs[Idx]]; + mSmmuNodeTemplate.Node.Base =3D RootComplex->TcuBase; + mSmmuNodeTemplate.InterruptMsiMapping.OutputBase =3D EnabledRCs[Idx] <= < 16; + mSmmuNodeTemplate.InterruptMsiMapping.OutputReference =3D ItsOffset[Id= x]; + mSmmuNodeTemplate.InterruptMsiMappingSingle.OutputBase =3D EnabledRCs[= Idx] << 16; + mSmmuNodeTemplate.InterruptMsiMappingSingle.OutputReference =3D ItsOff= set[Idx]; + /* All RCs on master be assigned to node 0, while remote RCs will be a= ssigned to first remote node */ + mSmmuNodeTemplate.Node.ProximityDomain =3D 0; + if ((RootComplex->TcuBase & SLAVE_SOCKET_BASE_ADDRESS_OFFSET) !=3D 0) { + // RootComplex on remote socket + switch (CpuGetSubNumaMode ()) { + case SUBNUMA_MODE_MONOLITHIC: + mSmmuNodeTemplate.Node.ProximityDomain +=3D MONOLITIC_NUM_OF_REGIO= N; + break; + case SUBNUMA_MODE_HEMISPHERE: + mSmmuNodeTemplate.Node.ProximityDomain +=3D HEMISPHERE_NUM_OF_REGI= ON; + break; + case SUBNUMA_MODE_QUADRANT: + mSmmuNodeTemplate.Node.ProximityDomain +=3D QUADRANT_NUM_OF_REGION; + break; + } + } + CopyMem (SmmuIter, &mSmmuNodeTemplate, sizeof (AC01_SMMU_NODE)); + SmmuIter +=3D sizeof (AC01_SMMU_NODE); + + if (SmmuPmuAgentCount =3D=3D 0) { + continue; + } + + // + // Add TBU PMCG nodes + // + if (RootComplex->Type =3D=3D RootComplexTypeA) { + MaxTbuPmu =3D AC01_RCA_MAX_TBU_PMU; + TbuPmuOffset =3D mRcaTbuPmuOffset; + } else { + MaxTbuPmu =3D AC01_RCB_MAX_TBU_PMU; + TbuPmuOffset =3D mRcbTbuPmuOffset; + } + + for (Idx1 =3D 0; Idx1 < MaxTbuPmu; Idx1++) { + mPmcgNodeTemplate.Base =3D RootComplex->TcuBase + TCU_TO_SMMU_OFFSET= + TbuPmuOffset[Idx1]; + mPmcgNodeTemplate.Page1Base =3D mPmcgNodeTemplate.Base + PAGE1_TO_PM= CG_OFFSET; + mPmcgNodeTemplate.NodeReference =3D SmmuNodeOffset[Idx]; + mPmcgNodeTemplate.OverflowInterruptGsiv =3D mTbuPmuIrqArray[EnabledR= Cs[Idx]] + Idx1; + CopyMem (PmcgIter, &mPmcgNodeTemplate, sizeof (mPmcgNodeTemplate)); + PmcgIter +=3D sizeof (mPmcgNodeTemplate); + } + + // + // Add TCU PMCG node + // + mPmcgNodeTemplate.Base =3D RootComplex->TcuBase + TCU_TO_SMMU_OFFSET; + mPmcgNodeTemplate.Page1Base =3D mPmcgNodeTemplate.Base + PAGE1_TO_PMCG= _OFFSET; + mPmcgNodeTemplate.NodeReference =3D SmmuNodeOffset[Idx]; + mPmcgNodeTemplate.OverflowInterruptGsiv =3D mTcuPmuIrqArray[EnabledRCs= [Idx]]; + CopyMem (PmcgIter, &mPmcgNodeTemplate, sizeof (mPmcgNodeTemplate)); + PmcgIter +=3D sizeof (mPmcgNodeTemplate); + } + + for (Idx =3D 0; Idx < RcCount; Idx++) { + mRcNodeTemplate.Node.PciSegmentNumber =3D mRootComplexList[EnabledRCs[= Idx]].Logical; + mRcNodeTemplate.RcIdMapping.OutputReference =3D SmmuNodeOffset[Idx]; + CopyMem (IortIter, &mRcNodeTemplate, sizeof (AC01_RC_NODE)); + IortIter +=3D sizeof (AC01_RC_NODE); + } +} + +EFI_STATUS +EFIAPI +AcpiInstallIort ( + VOID + ) +{ + EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; + EFI_STATUS Status; + INT32 EnabledRCs[AC01_PCIE_MAX_ROOT_COMPLEX]; + UINT32 RcCount, SmmuPmuAgentCount, TotalCount; + UINT8 Idx; + UINTN TableKey; + VOID *Hob; + VOID *IortBuffer; + + Hob =3D GetFirstGuidHob (&gRootComplexInfoHobGuid); + if (Hob =3D=3D NULL) { + return EFI_NOT_FOUND; + } + + mRootComplexList =3D (AC01_ROOT_COMPLEX *)GET_GUID_HOB_DATA (Hob); + + for (Idx =3D 0, RcCount =3D 0; Idx < AC01_PCIE_MAX_ROOT_COMPLEX; Idx++) { + if (mRootComplexList[Idx].Active) { + EnabledRCs[RcCount++] =3D Idx; + } + } + EnabledRCs[RcCount] =3D -1; + + Status =3D gBS->LocateProtocol ( + &gEfiAcpiTableProtocolGuid, + NULL, + (VOID **)&AcpiTableProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "IORT: Unable to locate ACPI table entry\n")); + return Status; + } + + SmmuPmuAgentCount =3D 0; + for (Idx =3D 0; Idx < RcCount; Idx++) { + if (mRootComplexList[EnabledRCs[Idx]].Type =3D=3D RootComplexTypeA) { + SmmuPmuAgentCount +=3D AC01_RCA_MAX_TBU_PMU; + } else { + SmmuPmuAgentCount +=3D AC01_RCB_MAX_TBU_PMU; + } + // Plus 1 TCU + SmmuPmuAgentCount +=3D 1; + } + + TotalCount =3D sizeof (EFI_ACPI_6_0_IO_REMAPPING_TABLE) + + RcCount * (sizeof (AC01_ITS_NODE) + sizeof (AC01_RC_NODE) += sizeof (AC01_SMMU_NODE)) + + SmmuPmuAgentCount * sizeof (EFI_ACPI_6_0_IO_REMAPPING_PMCG_= NODE); + + IortBuffer =3D AllocateZeroPool (TotalCount); + if (IortBuffer =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + ConstructIort (IortBuffer, RcCount, SmmuPmuAgentCount, TotalCount, Enabl= edRCs); + + Status =3D AcpiTableProtocol->InstallAcpiTable ( + AcpiTableProtocol, + IortBuffer, + TotalCount, + &TableKey + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "IORT: Unable to install IORT table entry\n")); + } + + FreePool (IortBuffer); + return Status; +} diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiMcfg.c b/P= latform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiMcfg.c new file mode 100644 index 000000000000..0b04246f06fa --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiMcfg.c @@ -0,0 +1,151 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Required to be 1 to match the kernel quirk for ECAM +#define EFI_ACPI_MCFG_OEM_REVISION 1 + +STATIC AC01_ROOT_COMPLEX *mRootComplexList; + +#pragma pack(1) + +typedef struct +{ + UINT64 BaseAddress; + UINT16 SegGroupNum; + UINT8 StartBusNum; + UINT8 EndBusNum; + UINT32 Reserved2; +} EFI_MCFG_CONFIG_STRUCTURE; + +typedef struct +{ + EFI_ACPI_DESCRIPTION_HEADER Header; + UINT64 Reserved1; +} EFI_MCFG_TABLE_CONFIG; + +#pragma pack() + +EFI_MCFG_TABLE_CONFIG mMcfgHeader =3D { + { + EFI_ACPI_6_1_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRES= S_DESCRIPTION_TABLE_SIGNATURE, + 0, // To be filled + 1, + 0x00, // Checksum will be updated at runtime + EFI_ACPI_OEM_ID, + EFI_ACPI_OEM_TABLE_ID, + EFI_ACPI_MCFG_OEM_REVISION, + EFI_ACPI_CREATOR_ID, + EFI_ACPI_CREATOR_REVISION + }, + 0x0000000000000000, // Reserved +}; + +EFI_MCFG_CONFIG_STRUCTURE mMcfgNodeTemplate =3D { + .BaseAddress =3D 0, + .SegGroupNum =3D 0, + .StartBusNum =3D 0, + .EndBusNum =3D 255, + .Reserved2 =3D 0, +}; + +STATIC +VOID +ConstructMcfg ( + VOID *McfgBuffer, + UINT32 McfgCount, + INT32 *EnabledRCs + ) +{ + AC01_ROOT_COMPLEX *RootComplex; + UINT32 Idx; + VOID *Iter =3D McfgBuffer; + + mMcfgHeader.Header.Length =3D McfgCount; + CopyMem (Iter, &mMcfgHeader, sizeof (EFI_MCFG_TABLE_CONFIG)); + + Iter +=3D sizeof (EFI_MCFG_TABLE_CONFIG); + for (Idx =3D 0; EnabledRCs[Idx] !=3D -1; Idx++) { + RootComplex =3D &mRootComplexList[EnabledRCs[Idx]]; + mMcfgNodeTemplate.BaseAddress =3D RootComplex->MmcfgBase; + mMcfgNodeTemplate.SegGroupNum =3D RootComplex->Logical; + CopyMem (Iter, &mMcfgNodeTemplate, sizeof (EFI_MCFG_CONFIG_STRUCTURE)); + Iter +=3D sizeof (EFI_MCFG_CONFIG_STRUCTURE); + } +} + +EFI_STATUS +EFIAPI +AcpiInstallMcfg ( + VOID + ) +{ + EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; + EFI_STATUS Status; + INT32 EnabledRCs[AC01_PCIE_MAX_ROOT_COMPLEX]; + UINT32 RcCount, McfgCount; + UINT8 Idx; + UINTN TableKey; + VOID *Hob; + VOID *McfgBuffer; + + Hob =3D GetFirstGuidHob (&gRootComplexInfoHobGuid); + if (Hob =3D=3D NULL) { + return EFI_NOT_FOUND; + } + + mRootComplexList =3D (AC01_ROOT_COMPLEX *)GET_GUID_HOB_DATA (Hob); + + for (Idx =3D 0, RcCount =3D 0; Idx < AC01_PCIE_MAX_ROOT_COMPLEX; Idx++) { + if (mRootComplexList[Idx].Active) { + EnabledRCs[RcCount++] =3D Idx; + } + } + EnabledRCs[RcCount] =3D -1; + + Status =3D gBS->LocateProtocol ( + &gEfiAcpiTableProtocolGuid, + NULL, + (VOID **)&AcpiTableProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "MCFG: Unable to locate ACPI table entry\n")); + return Status; + } + + McfgCount =3D sizeof (EFI_MCFG_TABLE_CONFIG) + sizeof (EFI_MCFG_CONFIG_S= TRUCTURE) * RcCount; + McfgBuffer =3D AllocateZeroPool (McfgCount); + if (McfgBuffer =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + ConstructMcfg (McfgBuffer, McfgCount, EnabledRCs); + + Status =3D AcpiTableProtocol->InstallAcpiTable ( + AcpiTableProtocol, + McfgBuffer, + McfgCount, + &TableKey + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "MCFG: Unable to install MCFG table entry\n")); + } + FreePool (McfgBuffer); + return Status; +} diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDx= e.c b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.c index c4022eb056e0..117f3872a84a 100644 --- a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.c +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.c @@ -93,6 +93,16 @@ InstallAcpiOnReadyToBoot ( DEBUG ((DEBUG_INFO, "Installed NFIT table\n")); } =20 + Status =3D AcpiInstallIort (); + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "Installed IORT table\n")); + } + + Status =3D AcpiInstallMcfg (); + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "Installed MCFG table\n")); + } + Status =3D AcpiPopulateBert (); if (!EFI_ERROR (Status)) { DEBUG ((DEBUG_INFO, "Populate BERT record\n")); --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83831): https://edk2.groups.io/g/devel/message/83831 Mute This Topic: https://groups.io/mt/87123897/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83832+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83832+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167840154138.29294563229098; Wed, 17 Nov 2021 08:50:40 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id BCgVYY1788612xG2nTEYMUGr; Wed, 17 Nov 2021 08:50:39 -0800 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.123]) by mx.groups.io with SMTP id smtpd.web12.9717.1637167838646754662 for ; Wed, 17 Nov 2021 08:50:39 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bj/2QkjeKRrO4G7zpsc4xKWM83zrwTQ+agSPJnhj8nTO3JY8w3wdptnFUkQjFMebSTi3vR7KO6srtLWTFGENbENguhgn5RRZ4LAXMHTaUqrpp4MY0Cyia77cmWn4RqY9/9I+O2M3pFVG5PFIdd6+DRZxhOBZFcxNXY2PDotwRD+G1cK8rhsVwsWSc+yB6eGBMixvn3roKBnja9fQXpZ4PS97MA6hHg3ShiDpDrfeMVb86oyIIxW7H+XFL3lbYxo8ffBTZqXpqoNYU03drM3Jd2UIS2ESd2PFokPOMGx2uPqRgN7eCv7KsbsWCldLpsuJbqCZbbqep7ubP7uu6h7h9Q== 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=Lzmzckpa6i81TP0gpsnmwed25l7Qo9Zij5jIZvujE3o=; b=T95L3RszP9fdiTWYsitoExnCzPKyzenUJRMF8kHiiv8FnWh9JKvZgg54dsJprbsD4ndIdZvPu+Zw7os5SMaInf7udIt7C1il890BqIxkCT5/5J2KVrAeKdCXx4UBR8zg8g2GB7fZQ8XQyW+4VFonmR/LPBgjPNrY2T6AMbJUaDgCIuqqhL77re9Pbdl9Gsy/UGBAJ+noIjwAAao6mZZ8Ha1OuNG+EyjT0oz7XtPwvwOL8FeoweRsN9LgJvxHmN7CSzV1v4zCVzAbS+/QO1gJEnJBFfS/j3+NkWvtd9P+GR30xfkaprCrQhkrPCu96IIcGzi5p3BEZhw8XokyG1bi8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB7521.prod.exchangelabs.com (2603:10b6:510:f4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Wed, 17 Nov 2021 16:50:37 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:37 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 19/30] JadePkg: Add ASpeed GOP driver Date: Wed, 17 Nov 2021 23:47:16 +0700 Message-ID: <20211117164727.10922-20-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:50:33 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f14ac3aa-5513-41ad-2e96-08d9a9ea611a X-MS-TrafficTypeDiagnostic: PH0PR01MB7521: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: 7BRDwFH/l3Pf7dC8cisxAk0UjUxFrTf954or0basChycbkl/LXlhw1TS8RIzqFoHyV3aiJkIyxu9PwFXzb+xjGEWapbtKfCgnabZwqWgKA+PFYkBf1uKVl0uVC4Z+BIglzo60/qCA4vIaJTJoRWdzbH7Kxv1tUB/qiIfw/bcU7LhaexkNt7yCUraOx2uF8m+WPphxgXbiGi8Nxm4YhmUSJNWEddl3Z3dnyHW/vK9YKBE/R1NH6YqeYJGPkwhvp1Zm+WlHaOg9hRUs/0Q3/4XbPN6xsCaa8wDgLIdQj2UZ18I+MY8SHVIe9SDi5cwED/uAAs3dLOBoG6piW97oUZbFTqS9Xl1irBdSV3O6Jr7YnDBG4QBziSNLkSZdaP9NAleWlVIPv6yKsJpscW7/O/yJOiOJkTmlgnWO+PzspWkSgI1daXTy57curcEqvDq4HCrp9Kqvd5dzomaHLrZtZ8Kn33DhtW/NRcrZmYe3ll786RYWveARabBcUTsczGRcGQ0bz8E/zPp7GSSNS2GCYxU4cIx2XuMrS3ZXTja5a1cqL0I2cjzPsrLpnuZg/MkH/j+1D/7Hd+C4jFR05zkYqXpVlTJLwb9bwnmRjZP/WrqK1wnAsrGI1g87bNoC+GnRrWj87FlcdtYVbZf2TtJ37ybpTUjt3dl2UQwG+ceeDvKUv4EwqinYAswoEaNIaV/91E8i4n1ps8m0yHdrgskRQfudQ== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?bLhZXwZB4HOwaOVEpMYIjLw1sIfFNHELrNjVdfsztBmiWRWKQVjElw1R2Bm/?= =?us-ascii?Q?9unGsmRB7sJrgycc/WG/SFOHfSjywotlr5+WgjrR0i7lvgBn7vrddWiJdG5L?= =?us-ascii?Q?m4KHC4OM3oYo71IQiIommIflCh3slNE4jQyXSNjw7ln3ThNuDYGY141IRfAN?= =?us-ascii?Q?8M1i+t9S0psrx5fDs9s+7UpZDx6i3Pl1krq3BtyCQM7L/weNLXy09oMDAk4h?= =?us-ascii?Q?V+2zpXWxcw0RP7sYu+hi8v3Q3X+Rdj1O6UHEPOvjLjj5k14Y8QC93yYDkb3x?= =?us-ascii?Q?crsfj0GjGP+VNsd0M0BtM+uO2EgWYf54p1wlxvMIGC0pLQGo8ah3MrbgO8AO?= =?us-ascii?Q?K2WtiMU6HWj4aRX7y1eLIc9HEr1PZpKLVsB2m3aKheIkfj0A9IzTAF9nZaiQ?= =?us-ascii?Q?DW734IFmEPMwefaBHlrQCUsOL38zOh68q4rZyl4f6QI1eWGWU2M34SGUiBxo?= =?us-ascii?Q?E9xkFfm9eNlDX26qj8rN/DkqFb6VABiH85J3kBytMI/azkt1OJWGdFVGNwlk?= =?us-ascii?Q?kZkbAOFsALjVpB/R9N4/pki5I/ZNhsaw4D2SfC1PCx/TjsftEnaTLq0XVIsg?= =?us-ascii?Q?FKj2w6Fu8a2j+g1vT+nQEHNSl0TYj4aU5Ax190zxZ78qITDZh2VH88jq5INT?= =?us-ascii?Q?G1MdrT3ugj7cH3oQJcjVYG+g0veR68/6460Eibno/HJIz98G+Oc3XHZMDzVF?= =?us-ascii?Q?m3u1Z5JVHvUqKfe/nAl7RfoKnW57ztkjwiYtXZngY1yF7ozsoMWMmz2YLGc7?= =?us-ascii?Q?euxT7uwslSKwrHIvtMovVkLTeiQ3wobtIyG0PboY7f4ypiU9KlHaYdslQoAy?= =?us-ascii?Q?oD6IyAZ8qA1pgXCxYISgj6KPvzE8hZ6eNpgko25HZGv4/cnTUsGIAi/B0HRf?= =?us-ascii?Q?0AebAakoYobJnrBOzQELvfxAEsEpQu3pRv/29e3EO6omjPK9T9wL8tFiTHVH?= =?us-ascii?Q?xmgsvSA4FIn/OHSz0p1iaHTyiHEfR2orfX1VV9by8/vdNEnzCOCpA01KA5Yh?= =?us-ascii?Q?dqfLHEuNLzUUY1ocin2hOkT+p5fSCWUS0gqo9y/KQQWTSJQX3GtYp0etihnE?= =?us-ascii?Q?pWlFUQO6cJsLVq80iR8h7VRPuOFSFmflnJ0x87mnrnU/OKYbOsxY/uluYRoL?= =?us-ascii?Q?0D7AlsBHY+dt06TXvpIPjMScQRQBEDj2AvoWwsZOouYgOl+qLMKVxfwjNBE2?= =?us-ascii?Q?MTq4R+9sfSx/HbWT80HfemgpMAIjI43dQwHvcKwq2miryMCrlSdUJ6AgA2mm?= =?us-ascii?Q?dMpZztGxARMiu2EsXVEQXxjaR2VTeNVURQ+jDyYtd2ORuBletXSl4nBBWBAT?= =?us-ascii?Q?Z+dQTqP3skLzblpfFwMEk7HgLUf37eo2TDzGmi206ZDGBB2Vn0p4dSaYxFXE?= =?us-ascii?Q?eG90FiNz6RKMSZNDXtKOrSmflsIVeNU4hnMu09f1DE89/wAgr5fHk9LTE2qv?= =?us-ascii?Q?NjVgUOwvQ3nT7bB25b6Sc8StYz29kRCsrdFAR4fc3ITiYizIWLo+IBwdNmS+?= =?us-ascii?Q?iXe34Tt6DsDkLSWWiq4TR9icah8AM1ZE7yR+KmmPp9RDni/iR+WkWYOiOS+i?= =?us-ascii?Q?71v1tkOuQl7Q21HrsSTGcwjrCazmEicLNzgxDS2Eg46ZfO1ojxuvkuf6rpva?= =?us-ascii?Q?oB0p/OQ0z6YrK76a99iBoQ5j536TIuTNdgkq9MecOSjSALb3spNeuVJ9FVL2?= =?us-ascii?Q?jaPdeA4DAqJPIMrcDR1npzylFOo=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: f14ac3aa-5513-41ad-2e96-08d9a9ea611a X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:36.9717 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uqZUOzc4b9bT4AdiJK/a9hwQCfWoR2tiJNrMbyoMq6MmQZyzQRDSwgh1CIvsg75HoiZBm8auP2HSbEeBTo41Og5kMiw/CGDSzJcEgmQ8tSk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7521 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: hmkMuxDDyqLoh7MeI3b1oJegx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167839; bh=nL5Yi/3YYcuYoMF1XhDSkKF53KF7RqycSRXJ2dk4m14=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=mVZR+rLrjG7mPtEyWgUJqsL0+X6xmiCNj0/dvva3KEJSRWin9mfegXg68djRyyfyqfh /1QpijyYKBqqGv2zRYP7U8bILUtYDJeTN6yW/TLHPky29VE/xEkSZnLBwRGZvNHnzdK00 g/zIzoAEqn0Pdu4fjprpcaWJPHx0jqMvPmI= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167842066100006 Content-Type: text/plain; charset="utf-8" This wires up the pre-built binary placed in the edk2-non-osi repository for PCIe VGA Controller support. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Platform/Ampere/JadePkg/Jade.dsc | 12 ++++++++++++ Platform/Ampere/JadePkg/Jade.fdf | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index ffba757a6130..76fb7396444a 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -113,6 +113,13 @@ [PcdsFixedAtBuild.common] !endif =20 =20 +[PcdsPatchableInModule] + # + # Console Resolution (HD mode) + # + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|1024 + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|768 + ##########################################################################= ###### # # Specific Platform Component @@ -134,3 +141,8 @@ [Components.common] # PCIe # Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.inf + + # + # VGA Aspeed + # + Drivers/ASpeed/ASpeedGopBinPkg/ASpeedAst2500GopDxe.inf diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index 99c361174974..ebf7d957d70d 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -297,6 +297,11 @@ [FV.FvMain] INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf INF Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.inf =20 + # + # VGA Aspeed + # + INF Drivers/ASpeed/ASpeedGopBinPkg/ASpeedAst2500GopDxe.inf + # # UEFI application (Shell Embedded Boot Loader) # --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83832): https://edk2.groups.io/g/devel/message/83832 Mute This Topic: https://groups.io/mt/87123898/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83833+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83833+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167843240165.54247424348762; Wed, 17 Nov 2021 08:50:43 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id ssbKYY1788612xh4uFSRvcmi; Wed, 17 Nov 2021 08:50:42 -0800 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.94]) by mx.groups.io with SMTP id smtpd.web12.9719.1637167842194444383 for ; Wed, 17 Nov 2021 08:50:42 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hJr2oRoeCy8SYAqCuhyuljZzCL9n/UB6vwS1Zz4SDxuAh0t5xcKIajeLz0bLeXopFCp7fdpz5OxY1frEAsr9yvUpeQiHPv4kWZ1sZePdea/vS7HXQ0Ap3TkpmxAON33dEPgCq3PwcOWH6mA8ZKTlIHeJsEjmIbA0pBJ8wh1/EDDqrLd8/Zb/g9S1sHs0RrMHDJZd0gYGP1NRnboZDmZkj2XKUlqMG7hVhkZa+v/kMqM24+8vfczn+WH91Hr0mKbD0OJ8gQe+9+9MIxIeku10v/5DUW4bIaKCspkkqAsgWJn5Ifo0Alfkn+NQQ5dFUGefpgV57daYj9rcpE2EhY9cPQ== 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=esSI/ua7cPEA5mv8OHPRPS+Tc+yKSEdZ99JNT2YWlxc=; b=Wc3135KJmydScbe0gJehnfgi4ipFQP0NvZQOQBg6UFkcxvZYaXKkd5ObWy3qP1ENbU3bE8a5d2HSO+3sCGRBQoR42xBxS2mWj/SC8ws+QtMrj1l97bDKV8KiqLpIMy1Et4CIR8gaf3X//Z6SfMizeXshH+H/hdSl+doQu3ZPN6duiJaps38Y50PXBKSnh7wQUtRNPEBx8vnPvLI1X3lNrxD9vK7/hx/ty6ytyC2s7Jqvo52cTo2TatkMyi9cLoSfV4zm/9qLpkOiKcJh76Rku26gdbVWGnFuwFwyQUN1y8sEALaUADJ1LZ3we7G97aO3bh31xvPrrSnkGtcbbQsNZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB7400.prod.exchangelabs.com (2603:10b6:510:10b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.19; Wed, 17 Nov 2021 16:50:40 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:40 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 20/30] AmpereAltraPkg: Add Random Number Generator Support Date: Wed, 17 Nov 2021 23:47:17 +0700 Message-ID: <20211117164727.10922-21-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:50:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8b520804-f526-412e-9aac-08d9a9ea630e X-MS-TrafficTypeDiagnostic: PH0PR01MB7400: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: tGYvSQlDBe9PoWvU+3Ps9v0zz6OA8yvJ8CqDXVGrRPdQTkwx2x6N0SpXSoZD0y6UUlNCVd4uwjRX01KjRz2Vl7TQogJceYxsJJmOUqKhJB4z9TRCFbQWsATWp8zkyybqhumQbm1QrAFdtVDN2fu6+naJFBrcVDkFNWPtMWA9OChZ2zawA5Z9DoBaGiWIwPtYCdFfv3kSgBcLkPP1sWAYD6tbGrcXmVuqh3rhqeJIlspFQRbspvk1yMfIIsutOIo7q5fM3SA5D02dQIg8qGY3NtfVHO9e11WXqz7Y/ZjWhNL4T4BCJ4WHqOnCTMSzN5kfPqKyCHt3+9ZrZngy1mRWORiQRRkEkcxnKzdFXaplzyCNaYtDKXNkFW+38MdORv+mnexvNCIgg7ID2GsAhQEVVWTqMRap4nRj2/QO+2YiZ6K2CnCTBLE4eF5S5y9ruyd527n5QU88hht11vx6XTbOYOa0ZTirJvKQuGwV5CPSfIdcMzBdWeIiVV4dYyToIn7eW9I+G0xj3xQtOKhU5sVBVCWvJGuwboC0Sylc09GMlFkfqV7V89T2kYpepM5Je6b1U3qDUXPjzbY8epsXcRLpKuKjJh6CmosSY8XDUi6i8D2dAy/WNywgmUDp44qvL82n0iYYo9xJyqFhyzb0nSzT7OOOeVY+juLYZzW3KF5K0zfWesbUfdi7U3BORBNvFbgMKzLpxF/TkIICe2iCkzSS34sgXTUp5Jumn/CwicmjArT15ImZ0w45WRU+Qi3OpOgkWj89IvneVJzWYL5Q5OivrQ== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?X2eCDGgFYUzn+OfKb6HsFpY3XvQCnVQZj90ngMyFJI+6yHkgEEtvyJoFNpLV?= =?us-ascii?Q?3A31l8w9BSP/HVO48hkWPpbR/grQnu1l5CCoQ1PIirvisUTvqLxVuiKzOZGp?= =?us-ascii?Q?cHetDy4vYnoTvP+nhDT80ttGNfb/EuR7x6cMOW0Jl2pqObx6KuzCfNV/kaKt?= =?us-ascii?Q?aZhX4FNWngmuyIFXdNXyJbrEZJAe4SKLyH37dlgnA5j5kht6SyGNjRHZtWNH?= =?us-ascii?Q?I6DDXE4eZxEtBTZpCYSdu9y4qpkDb37wnpthX6l3O6NnTbTxt25kIbS1dqQt?= =?us-ascii?Q?g0Fljdug3BcgLI/B8x9IcdH0bVqJ2TiTJdFOHovSqi0J/2zGRibwxdlcLF95?= =?us-ascii?Q?lFBq7v+mLWtZVtqoECt6QEZYwkN1b54qKHeKeEMWf8O+rbp2KlbSspTx5Dmf?= =?us-ascii?Q?vktAuas11476IuiOnxY176MPsy+CXRp8eTDPMcqqTMSMW1KnxN9GSKhNGO3y?= =?us-ascii?Q?eamdYzmfQXCVUfMl6i8TQuy4XLDqRbJtRG+QIUAfSDt/dRJwiLeqF89uTWZz?= =?us-ascii?Q?HL/32EQmblEW9nYULC1HQKdLtLeFl9s1FTTZmp9zddL5z+F5vu9lzCWJ0pof?= =?us-ascii?Q?B3+YQ0dHiaLJUN+RHVe50Ksd/+cnxlNVgCJg8zpRVPuUTzrZ4DsHwq5c0oVC?= =?us-ascii?Q?ihLzY/zHcGE/wn0C8f09WV5WTtp+smb3rsUrz47qb6gyOoUcK6NqWi83XijJ?= =?us-ascii?Q?JrfyAf642/l1t18Y8/057+36XFJ4RKF7ZRi53OphoIWVfDMADfgRIpKZisKD?= =?us-ascii?Q?EMayrz1QARO2I1yCljt5ub/0VnfaE/HzZmHgcPjc9OQU581VergG85DEDhvw?= =?us-ascii?Q?sebrGOYOAHqAPwXC9HMfJL7HyDf8bxd3c+zIQ/sZMfHmu5iOa/uf3eqqYdDN?= =?us-ascii?Q?gmJbgZ8ieu2PVQWN0OOmv6x1VYFfqjB7hwFtxPmR40rxtflb+uljY+lajIMo?= =?us-ascii?Q?qiHLJbGDSgnaSmkymj3wqsqfW2Yj0fMSAjo/0D1JDcqrhEylbtvkhfnuWlt1?= =?us-ascii?Q?FiD11yZBTqDxyBD2Fl7cOp3/MsQ/gXpnG7j1c5OM8covwScIwyvIY1tJVJ7a?= =?us-ascii?Q?6ic45IU+vSjuGIWoM7v1CMJiVSrZTf10ZVLleUcJl23PVAs/RldsO2JtIalW?= =?us-ascii?Q?Y9t7ELWD9mlZzFJ1Cl9M+FANE90tLTK2lvC8o0vXBgwnA2813DFszDCbsAiu?= =?us-ascii?Q?DZYcMbae3ufOo9OqRskbMo83TaURMeAy0gw4PYdct6CPPTk/UtUlv8QdCGYv?= =?us-ascii?Q?hrfEquwsBEUM4lNMZ9WjZibgYYkMEQppi7Rb1OQ+soNosSl6ACDEuNU2MbMi?= =?us-ascii?Q?4J1Wk8b4Kp2ZPHYpOg1LAeUE5TUnYG1zbpkah7+fzcCEK4tt+Xj76x4Fs32x?= =?us-ascii?Q?VYc6wSyTn9xpZbmyeLEqmmJ9QUwyXq7wXpa/pOhfplJI4n02ytlJZtuFZs6P?= =?us-ascii?Q?h1VSdC/imhkjnwRPwsJ3hDHeEcwxvoJDrGZDN3vvqnQhGQRXU89MUD7lzRrd?= =?us-ascii?Q?h14Q9yKQeZ41PqhELU9RPbz/KSuGmSGJbyHiBGaqyJme2YLIsh3FohmtRDTz?= =?us-ascii?Q?yvgVxoSMGwXCQTvZnlxLYOww7CUqvqRNlV7P7NsFUTXDxXvuushksF6x8Ibe?= =?us-ascii?Q?Gu7OTUBHr95YKExPiUFZn27cSy/+acwx12M5bx34c+7BCbOcHp0FPnka2TLa?= =?us-ascii?Q?J4iySwDNHUINPIJNZaHfBZsmybM=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b520804-f526-412e-9aac-08d9a9ea630e X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:40.1358 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Ap4P0wkRZuUOTS67VMYHQRiFXuQyaSS0qtScqh32B/tbG9Ea+AmZi5We8YQ5vklAPhU8e7Eqfo/n8MQ5rlL73u7hY3/cR9lwJVjXzajHDPY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7400 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: x2YIJsgMXHWEuEbM6uFcZJ3Qx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167842; bh=1WkQ2z/FyOIjf0YCO1EgS91kRPmVTVEvNtnWnMbFctA=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=cyfTCb2lkYT5jyiz5/xjrJZq3imZekglRcSjm2Rd3C+LUzakD6Url2AxTkrvpBnFrGC Ep6Ogc9weEi2Mgbw3yqM1oeuRG7BaMhwwK2qc4Ud0Mqk257e2GFdgGlS0mpLGJAWlYmSm 2dfmmpjgBXCNlA8eNUOhTLILZw6L5rXTX3s= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167844556100002 Content-Type: text/plain; charset="utf-8" This change is to produce RNG protocol which is required by several modules. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc | 5 + Platform/Ampere/JadePkg/Jade.fdf | 5 + Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.inf | 43 +++++ Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.c | 164 +++++++= +++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.uni | 10 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxeExtra.uni | 9 ++ 6 files changed, 236 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index 2f331e41893e..36d96ff9a63f 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -684,6 +684,11 @@ [Components.common] MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf =20 + # + # Random Number Generator Support + # + Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.inf + # # Bds # diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index ebf7d957d70d..b527f9ce7dfa 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -302,6 +302,11 @@ [FV.FvMain] # INF Drivers/ASpeed/ASpeedGopBinPkg/ASpeedAst2500GopDxe.inf =20 + # + # Random Number Generator Support + # + INF Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.inf + # # UEFI application (Shell Embedded Boot Loader) # diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.inf b/Sili= con/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.inf new file mode 100644 index 000000000000..c5f249e31090 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.inf @@ -0,0 +1,43 @@ +## @file +# +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D RngDxe + FILE_GUID =3D 4FCC006E-C740-4027-BC97-787907C8D286 + MODULE_TYPE =3D DXE_RUNTIME_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D RngDriverEntry + MODULE_UNI_FILE =3D RngDxe.uni + +[Sources.common] + RngDxe.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + TrngLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + +[Guids] + gEfiRngAlgorithmRaw ## SOMETIMES_PRODUCES ## GUID = # Unique ID of the algorithm for RNG + +[Protocols] + gEfiRngProtocolGuid ## PRODUCES + +[UserExtensions.TianoCore."ExtraFiles"] + RngDxeExtra.uni + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.c b/Silico= n/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.c new file mode 100644 index 000000000000..bb8140cfeb2f --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.c @@ -0,0 +1,164 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include + +/** + Returns information about the random number generation implementation. + + @param[in] This A pointer to the EFI_RNG_PROTOCOL in= stance. + @param[in,out] RNGAlgorithmListSize On input, the size in bytes of RNGAl= gorithmList. + On output with a return code of EFI_= SUCCESS, the size + in bytes of the data returned in RNG= AlgorithmList. On output + with a return code of EFI_BUFFER_TOO= _SMALL, + the size of RNGAlgorithmList require= d to obtain the list. + @param[out] RNGAlgorithmList A caller-allocated memory buffer fil= led by the driver + with one EFI_RNG_ALGORITHM element f= or each supported + RNG algorithm. The list must not cha= nge across multiple + calls to the same driver. The first = algorithm in the list + is the default algorithm for the dri= ver. + + @retval EFI_SUCCESS The RNG algorithm list was returned = successfully. + @retval EFI_INVALID_PARAMETER One or more of the parameters are in= correct. + @retval EFI_BUFFER_TOO_SMALL The buffer RNGAlgorithmList is too s= mall to hold the result. + +**/ +EFI_STATUS +EFIAPI +RngGetInfo ( + IN EFI_RNG_PROTOCOL *This, + IN OUT UINTN *RNGAlgorithmListSize, + OUT EFI_RNG_ALGORITHM *RNGAlgorithmList + ) +{ + if (This =3D=3D NULL || RNGAlgorithmListSize =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + if (*RNGAlgorithmListSize < sizeof (EFI_RNG_ALGORITHM)) { + *RNGAlgorithmListSize =3D sizeof (EFI_RNG_ALGORITHM); + return EFI_BUFFER_TOO_SMALL; + } + + if (RNGAlgorithmList =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + *RNGAlgorithmListSize =3D sizeof (EFI_RNG_ALGORITHM); + CopyGuid (RNGAlgorithmList, &gEfiRngAlgorithmRaw); + + return EFI_SUCCESS; +} + +/** + Produces and returns an RNG value using either the default or specified = RNG algorithm. + + @param[in] This A pointer to the EFI_RNG_PROTOCOL in= stance. + @param[in] RNGAlgorithm A pointer to the EFI_RNG_ALGORITHM t= hat identifies the RNG + algorithm to use. May be NULL in whi= ch case the function will + use its default RNG algorithm. + @param[in] RNGValueLength The length in bytes of the memory bu= ffer pointed to by + RNGValue. The driver shall return ex= actly this numbers of bytes. + @param[out] RNGValue A caller-allocated memory buffer fil= led by the driver with the + resulting RNG value. + + @retval EFI_SUCCESS The RNG value was returned successfu= lly. + @retval EFI_UNSUPPORTED The algorithm specified by RNGAlgori= thm is not supported by + this driver. + @retval EFI_DEVICE_ERROR An RNG value could not be retrieved = due to a hardware or + firmware error. + @retval EFI_INVALID_PARAMETER RNGValue is NULL or RNGValueLength i= s zero. + +**/ +EFI_STATUS +EFIAPI +RngGetRNG ( + IN EFI_RNG_PROTOCOL *This, + IN EFI_RNG_ALGORITHM *RNGAlgorithm, OPTIONAL + IN UINTN RNGValueLength, + OUT UINT8 *RNGValue + ) +{ + EFI_STATUS Status; + + if (This =3D=3D NULL || RNGValueLength =3D=3D 0 || RNGValue =3D=3D NULL)= { + return EFI_INVALID_PARAMETER; + } + + // + // We only support the raw algorithm, so reject requests for anything el= se + // + if (RNGAlgorithm !=3D NULL && + !CompareGuid (RNGAlgorithm, &gEfiRngAlgorithmRaw)) + { + return EFI_UNSUPPORTED; + } + + Status =3D GenerateRandomNumbers (RNGValue, RNGValueLength); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a:%d Failed to generate a random number. \n", + __FUNCTION__, + __LINE__ + )); + return Status; + } + + return EFI_SUCCESS; +} + +/* + * The Random Number Generator (RNG) protocol + */ +EFI_RNG_PROTOCOL mRng =3D { + RngGetInfo, + RngGetRNG +}; + +/** + The user Entry Point for the Random Number Generator (RNG) driver. + + @param[in] ImageHandle The firmware allocated handle for the EFI imag= e. + @param[in] SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The entry point is executed successfully. + @retval EFI_NOT_SUPPORTED Platform does not support RNG. + @retval Other Some error occurs when executing this entry po= int. + +**/ +EFI_STATUS +EFIAPI +RngDriverEntry ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_HANDLE Handle; + + // + // Install UEFI RNG (Random Number Generator) Protocol + // + Handle =3D NULL; + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &Handle, + &gEfiRngProtocolGuid, + &mRng, + NULL + ); + + return Status; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.uni b/Sili= con/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.uni new file mode 100644 index 000000000000..cd9dde97a236 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxe.uni @@ -0,0 +1,10 @@ +// +// Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// + + +#string STR_MODULE_ABSTRACT #language en-US "Produces UEFI Ran= dom Number Generator protocol" + +#string STR_MODULE_DESCRIPTION #language en-US "This module will = produce UEFI Random Number Generator protocol." diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxeExtra.uni b= /Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxeExtra.uni new file mode 100644 index 000000000000..9a3696b25442 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RngDxe/RngDxeExtra.uni @@ -0,0 +1,9 @@ +// +// Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// + +#string STR_PROPERTIES_MODULE_NAME +#language en-US +"Ampere UEFI Random Number Generator DXE" --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83833): https://edk2.groups.io/g/devel/message/83833 Mute This Topic: https://groups.io/mt/87123900/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83834+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83834+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167846988708.7336263800241; Wed, 17 Nov 2021 08:50:46 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id UTenYY1788612xYIZeJ4zDvx; Wed, 17 Nov 2021 08:50:46 -0800 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.137]) by mx.groups.io with SMTP id smtpd.web08.9776.1637167845709898893 for ; Wed, 17 Nov 2021 08:50:45 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I8gwhTdRQiEpX/CLt8U9RlQOcsB3VQRO9eiaCC6iCXhnyufriXOdsHNWiddnTTzNumnmN2CU8AkKTiuBf2K24ADJz9m4lppO7dGwr/1FNzMbbqA1eIyj+QrugOsjYYriIxjUQxV71+2wOzlmdIEgTPHlm3423iWwYB+OVGL3jf5/jkq/t5ni0lCsjah8n6k7nrGUNwue3JxJL9YwIHkJsIwcTHZHo/A0RjRZLC/jJsvyL/QCtTzJO8kpqTAxlRPljtqe61SyNYLHfDKlEjxrP/9i+k3n8WNKTDe7CTaQ5CdhAnuRNHS1l0yUa+Ntq/ZoWzZPHtR9pFI5gD4AwuAO2A== 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=2WMCBiGmPoiXtHeZZBSdMrzBzxLP86P+MpIwaSa53s4=; b=coQvU+QsoYoROUdKxcJ+e1l6hPexqJq+6Yame06bhpeqVTj3Pv3POpG5LePwR5lPuoCfSDoCV8xUETk30jwl0NDMIC5Fesizrpnile0oOiM96W7OkT0+KpRum/9g2rVVgMyCxxyneWmNHUjdI2amw40tvjXl2OrvKNvTZR89t9py4KeGam4qiVF62b6QaCY9VPrVcV9rZuV9ILDboJf00AjOdtLxcJ5hEqkED/fgEpyqEnFaa7JjfVLf+mRWnNTBxXamC/i98oDZrcR07/04JQ+1tefU1hRRWdY8aDfJzCOZOI4l5Z9yCAKqE9QEBQeEsKW/SVX7pHRZHTBXIC008g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB7521.prod.exchangelabs.com (2603:10b6:510:f4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Wed, 17 Nov 2021 16:50:43 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:43 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Quan Nguyen , Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 21/30] JadePkg: Add SMBIOS tables support Date: Wed, 17 Nov 2021 23:47:18 +0700 Message-ID: <20211117164727.10922-22-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:50:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 92ae4d68-a401-42e9-3474-08d9a9ea650d X-MS-TrafficTypeDiagnostic: PH0PR01MB7521: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: ZM76MdOZJL+uT51TdXtvpPo/QLDaBHo8pLr1B5fPHi/DBe3fXcGG2usj11RzwuPEl64lmex3TLB+lgwfoYEKlou/s70Ab9Ut8Jl9+wZ6u1mBZqOEyzy+bWTJ+dqOa9QzGM28oxwSYvNz4DAx3TTzA/hX0Ub34mYG+tAU9A69SdRgDOk5uSkSVW3mbHFi2/pqMK7Dhj0We2pRsNhZl1g8laNvqCBL13KmTp/nYqcNOYewNsBaV/LDlmInFdArLfcPxEfgDytA1kuyXz4445+WHa46TNK4MlCOMwn2MPTblUVpOx5lUm1PR22UVEY7/kKdMXiktNZzbIdtkFOQNwpw98z++9GPmcu32DlDI/1j6P1p3udix8VudQVGbwvsTL0zGhcf0yRmmDNkXiMKNfcbQYvev+0lmTZqIOoGwcTC6dpDSJ9yM6i0NDvSlk0zIz7je+9fAy3j1oJB3UCGTSZgnJBIIQ+DjMIXlDsLjVOtILAOMBGoPc3fpWM/Vu87xuI2sa9otqeWtB8HwIEiZIppTXH5mqPH5s3613R1otTHoZIUPDr84AmrNRNMTvT1lBfVJXI3mSHPj8yzJGgeDZGTrQdF50ncGbsSXrhknTjGZfTHj1H5dKzDoh8f+8+mt22nNgU95++bVLsGTvhSdqS4i9bRC8udZrYqPRoKU6Rrx/PqektZc/U0fKHd97imIN7AIWZzoOnjNLC3nbBnv2dmKCJUrlVkbY/Wt+1dlSjRU+ad4m+4IPEB+Xa4iacpRPq6UWq01veMixPrp2295ASwxpmSWclWhyBcTZHIxlqdFUe5RBfZ3MzdqKacrbcnMM77 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?n19aCI//vyntr2js7vvuzhdIcOUbR62jy7FKVZqCf27kD05vM1Hy/OfQNrdt?= =?us-ascii?Q?rX8Ww/k/TzM11y2Ly8i2g93CznxI0Iqkw3aTjbV59i5sMAPpuZ4ewDcKAw9g?= =?us-ascii?Q?Ms/4ugZdqa3STk97DQ2KuRN4mO560CLeAEs4Xo1FrbzZ8fx5MR67+2/4kHx+?= =?us-ascii?Q?iZkSZqQ7THzoIt/HgE/Ho1QMb0Gx4AJ0Wa6jzdtFcel3Jb6+WLD4MZyC2wJg?= =?us-ascii?Q?kt4z/rcfuMghVfBwUrLmXPQ7FcnmKjiedYqHktX/VF/841h822+Y9IvJhA3A?= =?us-ascii?Q?1wYYpXniVilvy6q29ljyRm0UT2rPC6opHcEvMjLeO+wIGbXBdwWsk00Ew+b8?= =?us-ascii?Q?bU0ynrd0Mi4TX06dG39ihRF5ZSEBn9r2nytzEIgxXj8tJqQEuySZkLxOlBJy?= =?us-ascii?Q?5SmFutPcjKybuw+cJtlrDaSdLu4MJTOt+Dzk8Aw28sOmFHEB+V3/uv/flDVr?= =?us-ascii?Q?LEhfO1hZrSO3gYBqgcJwq7k2dxxVvbMVuff8ghjdQt/elo08dPif+Ae9HE4u?= =?us-ascii?Q?LvkHsebt3vF+gW6nukxfPUcLXNs+mk/SvTUbDLcmDy/HNgqilPcPxHxi6cKM?= =?us-ascii?Q?OSHG/I94Drz9lfuCeFb2IdsJ5MPFzTGrHHMnRqH6rsp5qD4LTgg+9OzUoe09?= =?us-ascii?Q?rRk3niBdaNilTMrjSHhBFGpvEVz/f0xBeVm7ADmanCLg0jPSFxD5Az9eOgit?= =?us-ascii?Q?43vf+TyCqe4YEBX8QjtocziYIp6UNW8AlAbfBVYv2NO+ig3PwCUXuKFBN0Tr?= =?us-ascii?Q?FcVMNwiLWrbNy2p5KBegdyZ4p4HwRMjX+oAr0SaQexMfsR63rco+pi3NGhh0?= =?us-ascii?Q?UjKfv48qwIFnBwS7N3cxRXG46ubSHPP1mfbShsgs3WWpJDumm3urKGL5N74k?= =?us-ascii?Q?CfGMQkouw6cjr2Q5pn8hX9MzCRTnUiq5BSzh1NB04uXZOS4iHVGS56mF3XXv?= =?us-ascii?Q?zYNUmL1pVn+B34A0TR+ZWJN2ZX12LvTdtUWiiFKY/hWmw96AnAyWUyfZTjZT?= =?us-ascii?Q?DYhmLqv92wKk9+W3x8IWMrgG61U3dYZi630QuRFlEtTHj5l+CXbtMiyu3CWO?= =?us-ascii?Q?UKrT5uZhIOWQEX14EFfAsFvkEp1YS7G/Q1KH31Pqf3fMB19kyBAK1XtZiSq7?= =?us-ascii?Q?2H+Qc7MGk7ptqwM2mveIZU2nyW0yf+2BL+3akXVkLK5MCgbn2CLnN56q9b/w?= =?us-ascii?Q?+uAPHG7UCJtQF8u+U+iMH9/ZwrJvNPY57k7nATJNv2Y7ORhrbHSl6rcpzIFO?= =?us-ascii?Q?vBee7C/z+IClCCr6wbSY86YMJw88OAwH2y2QpVQqIRKJFU5XbipuJ63kVHsI?= =?us-ascii?Q?Ai/cKy6fvMrWaI2rB7o7sp748YShrfnUuKP9RjuJtqGq1BSUQm8Pkvtb+Td2?= =?us-ascii?Q?Y0AiTbn52yFnApaQtIj2lJdGxPZ7HlneSi685dfZwCtcyYUMmqgwVRRczY9o?= =?us-ascii?Q?cDVBOvpjnrQt2cradFmjlqcOvxj/Y9l3DFnL4WsYeOCPpE55LMukZA//CZgC?= =?us-ascii?Q?I6Am1KA4QUGmpU1jcW4xZUG8ESw3W3VmQVy15amGjEZJltshmnwv0Vmhk7Jv?= =?us-ascii?Q?EH9qnYxlXr7Na1NKYwRowwx9jdojBYJCmvcUd4Or2fVvrLkTM4DRuIaT0ynj?= =?us-ascii?Q?Dsl73rPJrtoIl8E8/IlYPW0TohSRTJ59L55BiV05xcQ2M6BqbXSvQqOmlSwk?= =?us-ascii?Q?bEV8vAGnBkdoLamfIv0FtdmFiGU=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92ae4d68-a401-42e9-3474-08d9a9ea650d X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:43.5766 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2VvepOxPLS5q0NoiBuHr2s1My3i2AoBg/Fidb1l5zazLdYrkMpiEEX7WT+pWNfwrM+XtQXhyyz3tcAMImiqZCN8Ug+mmhJ95jdV8p19UH3w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7521 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: l3MKTCJoxZEdwFPRPECZarHwx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167846; bh=qgM8/j3oo8MJa3daBN5A5n2b5nim0q/j9FOZodNNU2w=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=WaOuVve08k5//j+Uem9OXV4s75KlN52gC5hQW2TTjjoRjy98n3ptnusb8UiBH/k8aMh 1gXc0TObJ3Yc2Orlwdlt8xivPNGVAY97IBTI6EgeeDXT82RwccIdtEJrsFeUuZSOLad4X vTPjC1Ov/oUeLP2ZnAi/TwrKDWfPy1wWReI= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167848985100002 Content-Type: text/plain; charset="utf-8" From: Quan Nguyen This supports various SMBIOS tables type 0, 1, 2, 3, 4, 7, 8, 9, 11, 13, 16, 17, 19, 24 and 32. SMBIOS Type 1, 2 and 3 are hardcoded as Host-BMC communication is not supported yet. And, this module does not support fixup tables to reflect changes of the system at booting time. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec | = 12 + Platform/Ampere/JadePkg/Jade.dsc | = 35 + Platform/Ampere/JadePkg/Jade.fdf | = 8 + Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.inf | = 45 + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | = 53 + Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.inf | = 36 + Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.c | = 704 ++++++++++++ Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | = 1153 ++++++++++++++++++++ Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.c | = 325 ++++++ 9 files changed, 2371 insertions(+) diff --git a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec b/Silicon= /Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec index f8b06ef81de5..625a9b2b1e89 100644 --- a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec +++ b/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec @@ -63,8 +63,20 @@ [PcdsFixedAtBuild] gAmpereTokenSpaceGuid.PcdSmproNsMailboxIndex|0x1|UINT32|0x00000003 gAmpereTokenSpaceGuid.PcdPmproDbBaseReg|0x100001540000|UINT64|0x00000004 =20 + # + # SMBIOS Type 1 Pcd + # + gAmpereTokenSpaceGuid.PcdSmbiosTables1MajorVersion|0|UINT8|0x00000005 + gAmpereTokenSpaceGuid.PcdSmbiosTables1MinorVersion|0|UINT8|0x00000006 + [PcdsFixedAtBuild, PcdsDynamic, PcdsDynamicEx] # # Firmware Volume Pcds # gAmpereTokenSpaceGuid.PcdFvBlockSize|0|UINT32|0xB0000001 + + # + # SMBIOS, default or template values + # + # SMBIOS Type 0 - BIOS Information + gAmpereTokenSpaceGuid.PcdSmbiosTables0BiosReleaseDate|"MM/DD/YYYY"|VOID*= |0xB0000002 # Must follow this MM/DD/YYYY SMBIOS date format diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index 76fb7396444a..03932215b499 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -87,6 +87,8 @@ [LibraryClasses] # BoardPcieLib|Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.i= nf =20 + OemMiscLib|Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.inf + ##########################################################################= ###### # # Specific Platform Pcds @@ -98,12 +100,34 @@ [PcdsFeatureFlag.common] # gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE =20 +[PcdsFixedAtBuild] +!ifdef $(FIRMWARE_VER) + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"$(FIRMWARE_VER= )" +!endif + [PcdsFixedAtBuild.common] # # Platform config UUID # gAmpereTokenSpaceGuid.PcdPlatformConfigUuid|"$(PLATFORM_CONFIG_UUID)" =20 + # + # SMBIOS PCDs + # + gArmTokenSpaceGuid.PcdProcessorManufacturer|L"Ampere(R)" + gArmTokenSpaceGuid.PcdProcessorVersion|L"Ampere(R) Altra(R) Processor" + + gAmpereTokenSpaceGuid.PcdSmbiosTables1MajorVersion|$(MAJOR_VER) + gAmpereTokenSpaceGuid.PcdSmbiosTables1MinorVersion|$(MINOR_VER) + + # Clearing BIT0 in this PCD prevents installing a 32-bit SMBIOS entry po= int, + # if the entry point version is >=3D 3.0. AARCH64 OSes cannot assume the + # presence of the 32-bit entry point anyway (because many AARCH64 systems + # don't have 32-bit addressable physical RAM), and the additional alloca= tions + # below 4 GB needlessly fragment the memory map. So expose the 64-bit en= try + # point only, for entry point versions >=3D 3.0. + gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosEntryPointProvideMethod|0x2 + !if $(SECURE_BOOT_ENABLE) =3D=3D TRUE # Override the default values from SecurityPkg to ensure images # from all sources are verified in secure boot @@ -112,6 +136,9 @@ [PcdsFixedAtBuild.common] gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0= x04 !endif =20 +[PcdsDynamicDefault.common.DEFAULT] + # SMBIOS Type 0 - BIOS Information + gAmpereTokenSpaceGuid.PcdSmbiosTables0BiosReleaseDate|"MM/DD/YYYY" =20 [PcdsPatchableInModule] # @@ -146,3 +173,11 @@ [Components.common] # VGA Aspeed # Drivers/ASpeed/ASpeedGopBinPkg/ASpeedAst2500GopDxe.inf + + # + # SMBIOS + # + MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf + ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf + Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.inf diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index b527f9ce7dfa..647281fb6b8d 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -338,4 +338,12 @@ [FV.FvMain] INF RuleOverride=3DACPITABLE Silicon/Ampere/AmpereAltraPkg/AcpiCommonTab= les/AcpiCommonTables.inf INF RuleOverride=3DACPITABLE Platform/Ampere/JadePkg/AcpiTables/AcpiTabl= es.inf =20 + # + # SMBIOS + # + INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + INF Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.= inf + INF ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf + INF Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.inf + !include Silicon/Ampere/AmpereSiliconPkg/FvRules.fdf.inc diff --git a/Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfo= Dxe.inf b/Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe= .inf new file mode 100644 index 000000000000..b8500da4143d --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.inf @@ -0,0 +1,45 @@ +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D SmbiosMemInfoDxe + FILE_GUID =3D ECF38190-EBF8-11EA-B646-830715BDF83A + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D SmbiosMemInfoDxeEntry + +[Sources] + SmbiosMemInfoDxe.c + +[Packages] + ArmPkg/ArmPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + AmpereCpuLib + ArmLib + BaseLib + BaseMemoryLib + DebugLib + HobLib + MemoryAllocationLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + +[Protocols] + gEfiSmbiosProtocolGuid ## CONSUMED + +[Guids] + gPlatformInfoHobGuid + +[Depex] + gEfiSmbiosProtocolGuid diff --git a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatfo= rmDxe.inf b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatfor= mDxe.inf new file mode 100644 index 000000000000..a70af6faa212 --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.i= nf @@ -0,0 +1,53 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D SmbiosPlatformDxe + FILE_GUID =3D F0CC7D0B-CD83-4DDA-A5D4-613AB02D4E52 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D SmbiosPlatformDxeEntry + +[Sources] + SmbiosPlatformDxe.c + +[Packages] + ArmPkg/ArmPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + HobLib + MemoryAllocationLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + +[Protocols] + gEfiSmbiosProtocolGuid ## CONSUMED + +[Pcd] + # Type 0 + gAmpereTokenSpaceGuid.PcdSmbiosTables0BiosReleaseDate + gAmpereTokenSpaceGuid.PcdSmbiosTables1MajorVersion + gAmpereTokenSpaceGuid.PcdSmbiosTables1MinorVersion + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString + + gArmTokenSpaceGuid.PcdFdSize + +[Guids] + gPlatformInfoHobGuid + +[Depex] + gEfiSmbiosProtocolGuid diff --git a/Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.inf b/Pl= atform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.inf new file mode 100644 index 000000000000..b67ce01fb27f --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.inf @@ -0,0 +1,36 @@ +#/** @file +# OemMiscLib.inf +# +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved. +# Copyright (c) 2021, NUVIA Inc. All rights reserved. +# Copyright (c) 2018, Hisilicon Limited. All rights reserved. +# Copyright (c) 2018, Linaro Limited. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION =3D 1.29 + BASE_NAME =3D OemMiscLib + FILE_GUID =3D A84551A1-CF71-4CC4-A63B-B087048A87AD + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D OemMiscLib + +[Sources.common] + OemMiscLib.c + +[Packages] + ArmPkg/ArmPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + AmpereCpuLib + ArmLib + BaseLib + BaseMemoryLib + DebugLib diff --git a/Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfo= Dxe.c b/Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.c new file mode 100644 index 000000000000..673a819ec606 --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.c @@ -0,0 +1,704 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define TYPE16_ADDITIONAL_STRINGS \ + "\0" /* no string*/ + +#define TYPE17_ADDITIONAL_STRINGS \ + "Device Locator not set \0" \ + "Bank Locator not set \0" \ + "Manufacturer not set \0" \ + "Serial Number not set \0" \ + "Asset Tag not set \0" \ + "Part Number not set \0" \ + +#define TYPE19_ADDITIONAL_STRINGS \ + "\0" /* no string */ + +// +// Type definition and contents of the default SMBIOS table. +// This table covers only the minimum structures required by +// the SMBIOS specification (section 6.2, version 3.0) +// +#pragma pack(1) +typedef struct { + SMBIOS_TABLE_TYPE16 Base; + CHAR8 Strings[sizeof (TYPE16_ADDITIONAL_STRINGS)]; +} ARM_TYPE16; + +typedef struct { + SMBIOS_TABLE_TYPE17 Base; + CHAR8 Strings[sizeof (TYPE17_ADDITIONAL_STRINGS)]; +} ARM_TYPE17; + +typedef struct { + SMBIOS_TABLE_TYPE19 Base; + CHAR8 Strings[sizeof (TYPE19_ADDITIONAL_STRINGS)]; +} ARM_TYPE19; + +#pragma pack() +// Type 16 Physical Memory Array +STATIC ARM_TYPE16 mArmDefaultType16 =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE16), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + MemoryArrayLocationSystemBoard, // on motherboard + MemoryArrayUseSystemMemory, // system RAM + MemoryErrorCorrectionMultiBitEcc, // ECC RAM + 0x80000000, + 0xFFFE, // No error information structure + 0x10, + 0x40000000000ULL, + }, + TYPE16_ADDITIONAL_STRINGS +}; + +// Type 17 Memory Device +STATIC ARM_TYPE17 mArmDefaultType17 =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_MEMORY_DEVICE, + sizeof (SMBIOS_TABLE_TYPE17), + SMBIOS_HANDLE_PI_RESERVED, + }, + 0xFFFF, // array to which this module belongs + 0xFFFE, // no errors + 72, // single DIMM with ECC + 64, // data width of this device (64-bits) + 0, // no module installed + 0x09, // DIMM + 1, // part of a set + 1, // device locator + 2, // bank locator + MemoryTypeDdr4, // DDR4 + {}, // type detail + 0, // ? MHz + 3, // manufacturer + 4, // serial + 5, // asset tag + 6, // part number + 0, // rank + }, + TYPE17_ADDITIONAL_STRINGS +}; + +// Type 19 Memory Array Mapped Address +STATIC ARM_TYPE19 mArmDefaultType19 =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS, + sizeof (SMBIOS_TABLE_TYPE19), + SMBIOS_HANDLE_PI_RESERVED, + }, + 0xFFFFFFFF, // invalid, look at extended addr field + 0xFFFFFFFF, + 0xFFFF, // handle + 1, + 0x0, + 0x0, + }, + TYPE19_ADDITIONAL_STRINGS +}; + +typedef struct _JEDEC_MF_ID { + UINT8 VendorId; + CHAR8 *ManufacturerString; +} JEDEC_MF_ID; + +JEDEC_MF_ID Bank0Table[] =3D { + { 0x01, "AMD" }, + { 0x04, "Fujitsu" }, + { 0x07, "Hitachi" }, + { 0x89, "Intel" }, + { 0x10, "NEC" }, + { 0x97, "Texas Instrument" }, + { 0x98, "Toshiba" }, + { 0x1c, "Mitsubishi" }, + { 0x1f, "Atmel" }, + { 0x20, "STMicroelectronics" }, + { 0xa4, "IBM" }, + { 0x2c, "Micron Technology" }, + { 0xad, "SK Hynix" }, + { 0xb0, "Sharp" }, + { 0xb3, "IDT" }, + { 0x3e, "Oracle" }, + { 0xbf, "SST" }, + { 0x40, "ProMos/Mosel" }, + { 0xc1, "Infineon" }, + { 0xc2, "Macronix" }, + { 0x45, "SanDisk" }, + { 0xce, "Samsung" }, + { 0xda, "Winbond" }, + { 0xe0, "LG Semi" }, + { 0x62, "Sanyo" }, + { 0xff, "Undefined" } +}; + +JEDEC_MF_ID Bank1Table[] =3D { + { 0x98, "Kingston" }, + { 0xba, "PNY" }, + { 0x4f, "Transcend" }, + { 0x7a, "Apacer" }, + { 0xff, "Undefined" } +}; + +JEDEC_MF_ID Bank2Table[] =3D { + { 0x9e, "Corsair" }, + { 0xfe, "Elpida" }, + { 0xff, "Undefined" } +}; + +JEDEC_MF_ID Bank3Table[] =3D { + { 0x0b, "Nanya" }, + { 0x94, "Mushkin" }, + { 0x25, "Kingmax" }, + { 0xff, "Undefined" } +}; + +JEDEC_MF_ID Bank4Table[] =3D { + { 0xb0, "OCZ" }, + { 0xcb, "A-DATA" }, + { 0xcd, "G Skill" }, + { 0xef, "Team" }, + { 0xff, "Undefined" } +}; + +JEDEC_MF_ID Bank5Table[] =3D { + { 0x02, "Patriot" }, + { 0x9b, "Crucial" }, + { 0x51, "Qimonda" }, + { 0x57, "AENEON" }, + { 0xf7, "Avant" }, + { 0xff, "Undefined" } +}; + +JEDEC_MF_ID Bank6Table[] =3D { + { 0x34, "Super Talent" }, + { 0xd3, "Silicon Power" }, + { 0xff, "Undefined" } +}; + +JEDEC_MF_ID Bank7Table[] =3D { + { 0xff, "Undefined" } +}; + +JEDEC_MF_ID *ManufacturerJedecIdBankTable[] =3D { + Bank0Table, + Bank1Table, + Bank2Table, + Bank3Table, + Bank4Table, + Bank5Table, + Bank6Table, + Bank7Table +}; + +STATIC +UINTN +GetStringPackSize ( + CHAR8 *StringPack + ) +{ + UINTN StrCount; + CHAR8 *StrStart; + + if ((*StringPack =3D=3D 0) && (*(StringPack + 1) =3D=3D 0)) { + return 0; + } + + // String section ends in double-null (0000h) + for (StrCount =3D 0, StrStart =3D StringPack; + ((*StrStart !=3D 0) || (*(StrStart + 1) !=3D 0)); StrStart++, StrCo= unt++) + { + } + + return StrCount + 2; // Included the double NULL +} + +// Update String at String number to String Pack +EFI_STATUS +UpdateStringPack ( + CHAR8 *StringPack, + CHAR8 *String, + UINTN StringNumber + ) +{ + CHAR8 *StrStart; + UINTN StrIndex; + UINTN InputStrLen; + UINTN TargetStrLen; + UINTN BufferSize; + CHAR8 *Buffer; + + StrStart =3D StringPack; + for (StrIndex =3D 1; StrIndex < StringNumber; StrStart++) { + // A string ends in 00h + if (*StrStart =3D=3D 0) { + StrIndex++; + } + // String section ends in double-null (0000h) + if ((*StrStart =3D=3D 0) && (*(StrStart + 1) =3D=3D 0)) { + return EFI_NOT_FOUND; + } + } + + if (*StrStart =3D=3D 0) { + StrStart++; + } + + InputStrLen =3D AsciiStrLen (String); + TargetStrLen =3D AsciiStrLen (StrStart); + BufferSize =3D GetStringPackSize (StrStart + TargetStrLen + 1); + + // Replace the String if length matched + // OR this is the last string + if ((InputStrLen =3D=3D TargetStrLen) || (BufferSize =3D=3D 0)) { + CopyMem (StrStart, String, InputStrLen); + } + // Otherwise, buffer is needed to apply new string + else { + Buffer =3D AllocateZeroPool (BufferSize); + if (Buffer =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + CopyMem (Buffer, StrStart + TargetStrLen + 1, BufferSize); + CopyMem (StrStart, String, InputStrLen + 1); + CopyMem (StrStart + InputStrLen + 1, Buffer, BufferSize); + + FreePool (Buffer); + } + + return EFI_SUCCESS; +} + +UINT8 +GetMemoryType ( + IN UINT8 *SpdData + ) +{ + return (SpdData[2] =3D=3D 0x08) ? 1 : // DDR2 + (SpdData[2] =3D=3D 0x0B) ? 2 : // DDR3 + (SpdData[2] =3D=3D 0x0C) ? 3 : 0; // DDR4 +} + +EFI_STATUS +UpdateManufacturer ( + IN VOID *Table, + IN UINT8 *SpdData + ) +{ + EFI_STATUS Status =3D EFI_SUCCESS; + UINTN i; + UINT8 Data8; + UINT8 MemType; + JEDEC_MF_ID *IdTblPtr =3D NULL; + + MemType =3D GetMemoryType (SpdData); + + switch (MemType) { + case 1: + for (i =3D 0; i < 8; i++) { // DDR2 + Data8 =3D SpdData[64 + i]; + if (Data8 !=3D 0x7f) { + break; + } + } + break; + + case 2: // DDR3 + i =3D SpdData[117] & 0x7f; // Remove parity bit + Data8 =3D SpdData[118]; + break; + + case 3: // DDR4 + i =3D SpdData[320] & 0x7f; // Remove parity bit + Data8 =3D SpdData[321]; + break; + + default: + return EFI_UNSUPPORTED; // Not supported + } + + if (i > 7) { + i =3D 7; + } + IdTblPtr =3D ManufacturerJedecIdBankTable[i]; + + // Search in Manufacturer table + while ((IdTblPtr->VendorId !=3D Data8) && (IdTblPtr->VendorId !=3D 0xff)= ) { + IdTblPtr++; + } + + if (IdTblPtr->VendorId !=3D 0xff) { + Status =3D UpdateStringPack ( + ((ARM_TYPE17 *)Table)->Strings, + IdTblPtr->ManufacturerString, + ((ARM_TYPE17 *)Table)->Base.Manufacturer + ); + } + + return Status; +} + +EFI_STATUS +UpdateSerialNumber ( + IN VOID *Table, + IN UINT8 *SpdData + ) +{ + UINT8 MemType; + UINTN Offset; + CHAR8 Str[64]; + + MemType =3D GetMemoryType (SpdData); + + switch (MemType) { + case 1: + Offset =3D 95; + break; + + case 2: // DDR3 + Offset =3D 122; + break; + + case 3: // DDR4 + Offset =3D 325; + break; + + default: + return EFI_UNSUPPORTED; // Not supported + } + + AsciiSPrint ( + Str, + sizeof (Str), + "%02X%02X%02X%02X", + SpdData[Offset], + SpdData[Offset + 1], + SpdData[Offset + 2], + SpdData[Offset + 3] + ); + + return UpdateStringPack ( + ((ARM_TYPE17 *)Table)->Strings, + Str, + ((ARM_TYPE17 *)Table)->Base.SerialNumber + ); +} + +CHAR8 +Printable ( + IN CHAR8 Character + ) +{ + if((Character >=3D 0x20) && (Character <=3D 0x7E)) { + return Character; + } + + return ' '; +} + +EFI_STATUS +UpdatePartNumber ( + IN VOID *Table, + IN UINT8 *SpdData + ) +{ + UINT8 MemType; + UINTN Offset; + CHAR8 Str[64]; + + MemType =3D GetMemoryType (SpdData); + + switch (MemType) { + case 1: + Offset =3D 73; + break; + + case 2: // DDR3 + Offset =3D 128; + break; + + case 3: // DDR4 + Offset =3D 329; + break; + + default: + return EFI_UNSUPPORTED; // Not supported + } + + AsciiSPrint ( + Str, + sizeof (Str), + "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", + Printable (SpdData[Offset]), + Printable (SpdData[Offset + 1]), + Printable (SpdData[Offset + 2]), + Printable (SpdData[Offset + 3]), + Printable (SpdData[Offset + 4]), + Printable (SpdData[Offset + 5]), + Printable (SpdData[Offset + 6]), + Printable (SpdData[Offset + 7]), + Printable (SpdData[Offset + 8]), + Printable (SpdData[Offset + 9]), + Printable (SpdData[Offset + 10]), + Printable (SpdData[Offset + 11]), + Printable (SpdData[Offset + 12]), + Printable (SpdData[Offset + 13]), + Printable (SpdData[Offset + 14]), + Printable (SpdData[Offset + 15]), + Printable (SpdData[Offset + 16]), + Printable (SpdData[Offset + 17]) + ); + + return UpdateStringPack ( + ((ARM_TYPE17 *)Table)->Strings, + Str, + ((ARM_TYPE17 *)Table)->Base.PartNumber + ); +} + +/** + Install SMBIOS Type 16 17 and 19 table + + @param Smbios SMBIOS protocol. +**/ +EFI_STATUS +InstallMemStructures ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status =3D EFI_SUCCESS; + EFI_SMBIOS_HANDLE SmbiosHandle; + EFI_SMBIOS_HANDLE Type16Handle; + PLATFORM_INFO_HOB *PlatformHob; + PLATFORM_DIMM *Dimm; + CHAR8 *Table; + VOID *Hob; + UINTN Index; + UINTN SlotIndex; + UINTN MemRegionIndex; + UINT64 MemorySize =3D 0; + CHAR8 Str[64]; + + ASSERT (Smbios !=3D NULL); + + /* Get the Platform HOB */ + Hob =3D GetFirstGuidHob (&gPlatformInfoHobGuid); + ASSERT (Hob !=3D NULL); + if (Hob =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + + Table =3D AllocateZeroPool (sizeof (ARM_TYPE17)); + if (Table =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + for ( Index =3D 0; Index < GetNumberOfSupportedSockets (); Index++ ) { + // Copy template to Type 16 + CopyMem (Table, (VOID *)&mArmDefaultType16, sizeof (ARM_TYPE16)); + + ((ARM_TYPE16 *)Table)->Base.MaximumCapacity =3D 0x80000000; + ((ARM_TYPE16 *)Table)->Base.ExtendedMaximumCapacity =3D 0x40000000000U= LL; /* 4TB per socket */ + ((ARM_TYPE16 *)Table)->Base.MemoryErrorCorrection =3D MemoryErrorCorre= ctionMultiBitEcc; + + // Install Type 16 and hold the handle so that the subsequence type17/= 19 could use + Type16Handle =3D ((ARM_TYPE16 *)Table)->Base.Hdr.Handle; + Status =3D Smbios->Add ( + Smbios, + NULL, + &Type16Handle, + (EFI_SMBIOS_TABLE_HEADER *)Table + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: adding SMBIOS type 16 socket %d failed\n",= __FUNCTION__, Index)); + FreePool (Table); + // stop adding rather than continuing + return Status; + } + + for (SlotIndex =3D 0; SlotIndex < PlatformHob->DimmList.BoardDimmSlots= ; SlotIndex++) { + // Copy Tempplate to Type 17 + CopyMem (Table, (VOID *)&mArmDefaultType17, sizeof (ARM_TYPE17)); + + // Fill up type 17 table's content here + Dimm =3D &PlatformHob->DimmList.Dimm[SlotIndex]; + if (Dimm->NodeId !=3D Index) { + continue; + } + + if (Dimm->Info.DimmStatus =3D=3D DIMM_INSTALLED_OPERATIONAL) { + + UpdateManufacturer ((VOID *)Table, Dimm->SpdData.Data); + UpdateSerialNumber ((VOID *)Table, Dimm->SpdData.Data); + UpdatePartNumber ((VOID *)Table, Dimm->SpdData.Data); + + MemorySize =3D Dimm->Info.DimmSize * 1024; + if (MemorySize >=3D 0x7FFF) { + ((ARM_TYPE17 *)Table)->Base.Size =3D 0x7FFF; + ((ARM_TYPE17 *)Table)->Base.ExtendedSize =3D MemorySize; + } else { + ((ARM_TYPE17 *)Table)->Base.Size =3D (UINT16)MemorySize; + ((ARM_TYPE17 *)Table)->Base.ExtendedSize =3D 0; + } + + ((ARM_TYPE17 *)Table)->Base.MemoryType =3D 0x1A; /* DDR4 */ + ((ARM_TYPE17 *)Table)->Base.Speed =3D (UINT16)PlatformHob->DramInf= o.MaxSpeed; + ((ARM_TYPE17 *)Table)->Base.ConfiguredMemoryClockSpeed =3D (UINT16= )PlatformHob->DramInfo.MaxSpeed; + ((ARM_TYPE17 *)Table)->Base.Attributes =3D Dimm->Info.DimmNrRank &= 0x0F; + ((ARM_TYPE17 *)Table)->Base.ConfiguredVoltage =3D 1200; + ((ARM_TYPE17 *)Table)->Base.MinimumVoltage =3D 1140; + ((ARM_TYPE17 *)Table)->Base.MaximumVoltage =3D 1260; + ((ARM_TYPE17 *)Table)->Base.DeviceSet =3D 0; // None + + if (Dimm->Info.DimmType =3D=3D UDIMM || Dimm->Info.DimmType =3D=3D= SODIMM) { + ((ARM_TYPE17 *)Table)->Base.TypeDetail.Unbuffered =3D 1; /* BIT = 14: unregistered */ + } else if (Dimm->Info.DimmType =3D=3D RDIMM + || Dimm->Info.DimmType =3D=3D LRDIMM + || Dimm->Info.DimmType =3D=3D RSODIMM) + { + ((ARM_TYPE17 *)Table)->Base.TypeDetail.Registered =3D 1; /* BIT = 13: registered */ + } + // We should determine if need to set technology to NVDIMM-* when = supported + ((ARM_TYPE17 *)Table)->Base.MemoryTechnology =3D 0x3; // DRAM + } + AsciiSPrint (Str, sizeof (Str), "Socket %d DIMM %d", Index, SlotInde= x); + UpdateStringPack (((ARM_TYPE17 *)Table)->Strings, Str, ((ARM_TYPE17 = *)Table)->Base.DeviceLocator); + AsciiSPrint (Str, sizeof (Str), "Bank %d", SlotIndex); + UpdateStringPack (((ARM_TYPE17 *)Table)->Strings, Str, ((ARM_TYPE17 = *)Table)->Base.BankLocator); + AsciiSPrint (Str, sizeof (Str), "Array %d Asset Tag %d", Index, Slot= Index); + UpdateStringPack (((ARM_TYPE17 *)Table)->Strings, Str, ((ARM_TYPE17 = *)Table)->Base.AssetTag); + + // Update Type 16 handle + ((ARM_TYPE17 *)Table)->Base.MemoryArrayHandle =3D Type16Handle; + + // Install structure + SmbiosHandle =3D ((ARM_TYPE17 *)Table)->Base.Hdr.Handle; + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)Table + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: adding SMBIOS type 17 Socket %d Slot %d failed\n", + __FUNCTION__, + Index, + SlotIndex + )); + FreePool (Table); + // stop adding rather than continuing + return Status; + } + } + + for (MemRegionIndex =3D 0; MemRegionIndex < PlatformHob->DramInfo.NumR= egion; MemRegionIndex++) { + // Copy Tempplate to Type 19 + CopyMem (Table, (VOID *)&mArmDefaultType19, sizeof (ARM_TYPE19)); + + if (PlatformHob->DramInfo.NvdRegion[MemRegionIndex] > 0 + || PlatformHob->DramInfo.Socket[MemRegionIndex] !=3D Index) + { + continue; + } + + ((ARM_TYPE19 *)Table)->Base.StartingAddress =3D 0xFFFFFFFF; + ((ARM_TYPE19 *)Table)->Base.EndingAddress =3D 0xFFFFFFFF; + ((ARM_TYPE19 *)Table)->Base.ExtendedStartingAddress =3D PlatformHob-= >DramInfo.Base[MemRegionIndex]; + ((ARM_TYPE19 *)Table)->Base.ExtendedEndingAddress =3D PlatformHob->D= ramInfo.Base[MemRegionIndex] + + PlatformHob->Dra= mInfo.Size[MemRegionIndex] - 1; + + if (MemorySize !=3D 0) { + ((ARM_TYPE19 *)Table)->Base.PartitionWidth =3D (PlatformHob->DramI= nfo.Size[MemRegionIndex] - 1) / MemorySize + 1; + } + + // Update Type 16 handle + ((ARM_TYPE19 *)Table)->Base.MemoryArrayHandle =3D Type16Handle; + + // Install structure + SmbiosHandle =3D ((ARM_TYPE19 *)Table)->Base.Hdr.Handle; + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)Table + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: adding SMBIOS type 19 Socket %d MemRegion %d failed\n", + __FUNCTION__, + Index, + MemRegionIndex + )); + FreePool (Table); + // stop adding rather than continuing + return Status; + } + } + } + + FreePool (Table); + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +SmbiosMemInfoDxeEntry ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_PROTOCOL *Smbios; + + // + // Find the SMBIOS protocol + // + Status =3D gBS->LocateProtocol ( + &gEfiSmbiosProtocolGuid, + NULL, + (VOID **)&Smbios + ); + + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Unable to locate SMBIOS Protocol")); + ASSERT_EFI_ERROR (Status); + return Status; + } + + Status =3D InstallMemStructures (Smbios); + DEBUG ((DEBUG_ERROR, "SmbiosMemInfoDxe install: %r\n", Status)); + + return Status; +} diff --git a/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatfo= rmDxe.c b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformD= xe.c new file mode 100644 index 000000000000..add89f5978d6 --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -0,0 +1,1153 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Type0 Data +#define VENDOR_TEMPLATE "Ampere(R)\0" +#define BIOS_VERSION_TEMPLATE "TianoCore 0.00.00000000 (SYS: 0.00.00000000= )\0" +#define RELEASE_DATE_TEMPLATE "MM/DD/YYYY\0" + +#define TYPE0_ADDITIONAL_STRINGS \ + VENDOR_TEMPLATE /* Vendor */ \ + BIOS_VERSION_TEMPLATE /* BiosVersion */ \ + RELEASE_DATE_TEMPLATE /* BiosReleaseDate */ + +// Type1 Data +#define MANUFACTURER_TEMPLATE "Ampere(R)\0" +#define PRODUCT_NAME_TEMPLATE "Mt. Jade\0" +#define SYS_VERSION_TEMPLATE "PR010\0" +#define SERIAL_TEMPLATE "123456789ABCDEFF123456789ABCDEFF\0" +#define SKU_TEMPLATE "FEDCBA9876543211FEDCBA9876543211\0" +#define FAMILY_TEMPLATE "Altra\0" + +#define TYPE1_ADDITIONAL_STRINGS \ + MANUFACTURER_TEMPLATE /* Manufacturer */ \ + PRODUCT_NAME_TEMPLATE /* Product Name */ \ + SYS_VERSION_TEMPLATE /* Version */ \ + SERIAL_TEMPLATE /* Serial Number */ \ + SKU_TEMPLATE /* SKU Number */ \ + FAMILY_TEMPLATE /* Family */ + +#define TYPE2_ADDITIONAL_STRINGS \ + MANUFACTURER_TEMPLATE /* Manufacturer */ \ + PRODUCT_NAME_TEMPLATE /* Product Name */ \ + "EVT2\0" /* Version */ \ + "Serial Not Set\0" /* Serial */ \ + "Base of Chassis\0" /* board location */ \ + "FF\0" /* Version */ \ + "FF\0" /* Version */ + +#define CHASSIS_VERSION_TEMPLATE "None \0" +#define CHASSIS_SERIAL_TEMPLATE "Serial Not Set \0" +#define CHASSIS_ASSET_TAG_TEMPLATE "Asset Tag Not Set \0" + +#define TYPE3_ADDITIONAL_STRINGS \ + MANUFACTURER_TEMPLATE /* Manufacturer */ \ + CHASSIS_VERSION_TEMPLATE /* Version */ \ + CHASSIS_SERIAL_TEMPLATE /* Serial */ \ + CHASSIS_ASSET_TAG_TEMPLATE /* Asset Tag */ \ + SKU_TEMPLATE /* SKU Number */ + +#define TYPE8_ADDITIONAL_STRINGS \ + "VGA1 - Rear VGA Connector\0" \ + "DB-15 Male (VGA) \0" + +#define TYPE9_ADDITIONAL_STRINGS \ + "Socket 0 Riser 1 x32 - Slot 1\0" + +#define TYPE11_ADDITIONAL_STRINGS \ + "www.amperecomputing.com\0" + +#define TYPE13_ADDITIONAL_STRINGS \ + "en|US|iso8859-1\0" + +#define TYPE41_ADDITIONAL_STRINGS \ + "Onboard VGA\0" + +#define ADDITIONAL_STR_INDEX_1 0x01 +#define ADDITIONAL_STR_INDEX_2 0x02 +#define ADDITIONAL_STR_INDEX_3 0x03 +#define ADDITIONAL_STR_INDEX_4 0x04 +#define ADDITIONAL_STR_INDEX_5 0x05 +#define ADDITIONAL_STR_INDEX_6 0x06 + +// +// Type definition and contents of the default SMBIOS table. +// This table covers only the minimum structures required by +// the SMBIOS specification (section 6.2, version 3.0) +// +#pragma pack(1) +typedef struct { + SMBIOS_TABLE_TYPE0 Base; + CHAR8 Strings[sizeof (TYPE0_ADDITIONAL_STRINGS)]; +} ARM_TYPE0; + +typedef struct { + SMBIOS_TABLE_TYPE1 Base; + CHAR8 Strings[sizeof (TYPE1_ADDITIONAL_STRINGS)]; +} ARM_TYPE1; + +typedef struct { + SMBIOS_TABLE_TYPE2 Base; + CHAR8 Strings[sizeof (TYPE2_ADDITIONAL_STRINGS)]; +} ARM_TYPE2; + +typedef struct { + SMBIOS_TABLE_TYPE3 Base; + CHAR8 Strings[sizeof (TYPE3_ADDITIONAL_STRINGS)]; +} ARM_TYPE3; + +typedef struct { + SMBIOS_TABLE_TYPE8 Base; + CHAR8 Strings[sizeof (TYPE8_ADDITIONAL_STRINGS)]; +} ARM_TYPE8; + +typedef struct { + SMBIOS_TABLE_TYPE9 Base; + CHAR8 Strings[sizeof (TYPE9_ADDITIONAL_STRINGS)]; +} ARM_TYPE9; + +typedef struct { + SMBIOS_TABLE_TYPE11 Base; + CHAR8 Strings[sizeof (TYPE11_ADDITIONAL_STRINGS)]; +} ARM_TYPE11; + +typedef struct { + SMBIOS_TABLE_TYPE13 Base; + CHAR8 Strings[sizeof (TYPE13_ADDITIONAL_STRINGS)]; +} ARM_TYPE13; + +typedef struct { + SMBIOS_TABLE_TYPE41 Base; + CHAR8 Strings[sizeof (TYPE41_ADDITIONAL_STRINGS)]; +} ARM_TYPE41; + +#pragma pack() + +// Type 0 BIOS information +STATIC ARM_TYPE0 mArmDefaultType0 =3D { + { + { // Header + EFI_SMBIOS_TYPE_BIOS_INFORMATION, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE0), // UINT8 Length, The length of the= structure's string-set is not included. + SMBIOS_HANDLE_PI_RESERVED, + }, + + ADDITIONAL_STR_INDEX_1, // SMBIOS_TABLE_STRING Vendor + ADDITIONAL_STR_INDEX_2, // SMBIOS_TABLE_STRING BiosVersion + 0, // UINT16 BiosSegment + ADDITIONAL_STR_INDEX_3, // SMBIOS_TABLE_STRING BiosReleaseDa= te + 0, // UINT8 BiosSize + + // MISC_BIOS_CHARACTERISTICS BiosCharacteristics + { + 0,0,0,0,0,0, + 1, // PCI supported + 0, + 1, // PNP supported + 0, + 1, // BIOS upgradable + 0, 0, 0, + 0, // Boot from CD + 1, // selectable boot + }, + + // BIOSCharacteristicsExtensionBytes[2] + { + 0, + 0, + }, + + 0, // UINT8 SystemBiosMajorRelease + 0, // UINT8 SystemBiosMinorRelease + + // If the system does not have field upgradeable embedded controller + // firmware, the value is 0FFh + 0xFF, // UINT8 EmbeddedControllerFirmwareMajorRel= ease + 0xFF // UINT8 EmbeddedControllerFirmwareMinorRel= ease + }, + + // Text strings (unformatted area) + TYPE0_ADDITIONAL_STRINGS +}; + +// Type 1 System information +STATIC ARM_TYPE1 mArmDefaultType1 =3D { + { + { // Header + EFI_SMBIOS_TYPE_SYSTEM_INFORMATION, + sizeof (SMBIOS_TABLE_TYPE1), + SMBIOS_HANDLE_PI_RESERVED, + }, + + ADDITIONAL_STR_INDEX_1, = // Manufacturer + ADDITIONAL_STR_INDEX_2, = // Product Name + ADDITIONAL_STR_INDEX_3, = // Version + ADDITIONAL_STR_INDEX_4, = // Serial Number + { 0x12345678, 0x9ABC, 0xDEFF, { 0x12,0x34,0x56,0x78,0x9A,0xBC,0xDE,0xF= F }}, // UUID + SystemWakeupTypePowerSwitch, = // Wakeup type + ADDITIONAL_STR_INDEX_5, = // SKU Number + ADDITIONAL_STR_INDEX_6, = // Family + }, + + // Text strings (unformatted) + TYPE1_ADDITIONAL_STRINGS +}; + +// Type 2 Baseboard +STATIC ARM_TYPE2 mArmDefaultType2 =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_BASEBOARD_INFORMATION, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE2), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + ADDITIONAL_STR_INDEX_1, // Manufacturer + ADDITIONAL_STR_INDEX_2, // Product Name + ADDITIONAL_STR_INDEX_3, // Version + ADDITIONAL_STR_INDEX_4, // Serial + 0, // Asset tag + {1}, // motherboard, not replaceable + ADDITIONAL_STR_INDEX_5, // location of board + 0xFFFF, // chassis handle + BaseBoardTypeMotherBoard, + 0, + {0}, + }, + TYPE2_ADDITIONAL_STRINGS +}; + +// Type 3 Enclosure +STATIC CONST ARM_TYPE3 mArmDefaultType3 =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE3), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + ADDITIONAL_STR_INDEX_1, // Manufacturer + MiscChassisTypeRackMountChassis, // Rack-mounted chassis + ADDITIONAL_STR_INDEX_2, // version + ADDITIONAL_STR_INDEX_3, // serial + ADDITIONAL_STR_INDEX_4, // asset tag + ChassisStateUnknown, // boot chassis state + ChassisStateSafe, // power supply state + ChassisStateSafe, // thermal state + ChassisSecurityStatusNone, // security state + {0,0,0,0}, // OEM defined + 2, // 2U height + 2, // number of power cords + 0, // no contained elements + 3, // ContainedElementRecordLength; + }, + TYPE3_ADDITIONAL_STRINGS +}; + +// Type 8 Port Connector Information +STATIC CONST ARM_TYPE8 mArmDefaultType8Vga =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE8), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + ADDITIONAL_STR_INDEX_1, // InternalReferenceDesignator String + PortConnectorTypeDB15Female, // InternalConnectorType; + ADDITIONAL_STR_INDEX_2, // ExternalReferenceDesignator String + PortTypeOther, // ExternalConnectorType; + PortTypeVideoPort, // PortType; + }, + "VGA1 - Rear VGA Connector\0" \ + "DB-15 Male (VGA)\0" +}; + +// Type 8 Port Connector Information +STATIC CONST ARM_TYPE8 mArmDefaultType8USBFront =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE8), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + ADDITIONAL_STR_INDEX_1, // InternalReferenceDesignator String + PortConnectorTypeUsb, // InternalConnectorType; + ADDITIONAL_STR_INDEX_2, // ExternalReferenceDesignator String + PortTypeOther, // ExternalConnectorType; + PortTypeUsb, // PortType; + }, + "Front Panel USB 3.0\0" \ + "USB\0" +}; + +// Type 8 Port Connector Information +STATIC CONST ARM_TYPE8 mArmDefaultType8USBRear =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE8), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + ADDITIONAL_STR_INDEX_1, // InternalReferenceDesignator String + PortConnectorTypeUsb, // InternalConnectorType; + ADDITIONAL_STR_INDEX_2, // ExternalReferenceDesignator String + PortTypeOther, // ExternalConnectorType; + PortTypeUsb, // PortType; + }, + "Rear Panel USB 3.0\0" \ + "USB\0" +}; + +// Type 8 Port Connector Information +STATIC CONST ARM_TYPE8 mArmDefaultType8NetRJ45 =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE8), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + ADDITIONAL_STR_INDEX_1, // InternalReferenceDesignator String + PortConnectorTypeRJ45, // InternalConnectorType; + ADDITIONAL_STR_INDEX_2, // ExternalReferenceDesignator String + PortConnectorTypeRJ45, // ExternalConnectorType; + PortTypeNetworkPort, // PortType; + }, + "RJ1 - BMC RJ45 Port\0" \ + "RJ45 Connector\0" +}; + +// Type 8 Port Connector Information +STATIC CONST ARM_TYPE8 mArmDefaultType8NetOcp =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE8), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + ADDITIONAL_STR_INDEX_1, // InternalReferenceDesignator String + PortTypeOther, // InternalConnectorType; + ADDITIONAL_STR_INDEX_2, // ExternalReferenceDesignator String + PortTypeOther, // ExternalConnectorType; + PortTypeNetworkPort, // PortType; + }, + "OCP1 - OCP NIC 3.0 Connector\0" \ + "OCP NIC 3.0\0" +}; + +// Type 8 Port Connector Information +STATIC CONST ARM_TYPE8 mArmDefaultType8Uart =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE8), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + ADDITIONAL_STR_INDEX_1, // InternalReferenceDesignator String + PortTypeOther, // InternalConnectorType; + ADDITIONAL_STR_INDEX_2, // ExternalReferenceDesignator String + PortConnectorTypeDB9Female, // ExternalConnectorType; + PortTypeSerial16550Compatible, // PortType; + }, + "UART1 - BMC UART5 Connector\0" \ + "DB-9 female\0" +}; + +// Type 9 System Slots +STATIC ARM_TYPE9 mArmDefaultType9Sk0RiserX32Slot1 =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_SYSTEM_SLOTS, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE9), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + ADDITIONAL_STR_INDEX_1, + SlotTypePciExpressGen3, + SlotDataBusWidth16X, + SlotUsageAvailable, + SlotLengthLong, + 0, + {0, 0, 1}, // Provides 3.3 Volts + {1}, // PME + 0, + 0, + 0, + }, + "S0 Riser 1 x32 - Slot 1\0" +}; + +// Type 9 System Slots +STATIC ARM_TYPE9 mArmDefaultType9Sk0RiserX32Slot2 =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_SYSTEM_SLOTS, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE9), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + ADDITIONAL_STR_INDEX_1, + SlotTypePciExpressGen3, + SlotDataBusWidth8X, + SlotUsageAvailable, + SlotLengthLong, + 0, + {0, 0, 1}, // Provides 3.3 Volts + {1}, // PME + 4, + 0, + 0, + }, + "S0 Riser x32 - Slot 2\0" +}; + +// Type 9 System Slots +STATIC ARM_TYPE9 mArmDefaultType9Sk0RiserX32Slot3 =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_SYSTEM_SLOTS, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE9), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + ADDITIONAL_STR_INDEX_1, + SlotTypePciExpressGen3, + SlotDataBusWidth8X, + SlotUsageAvailable, + SlotLengthLong, + 0, + {0, 0, 1}, // Provides 3.3 Volts + {1}, // PME + 5, + 0, + 0, + }, + "S0 Riser x32 - Slot 3\0" +}; + +// Type 9 System Slots +STATIC ARM_TYPE9 mArmDefaultType9Sk1RiserX24Slot1 =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_SYSTEM_SLOTS, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE9), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + ADDITIONAL_STR_INDEX_1, + SlotTypePciExpressGen3, + SlotDataBusWidth8X, + SlotUsageAvailable, + SlotLengthLong, + 0, + {0, 0, 1}, // Provides 3.3 Volts + {1}, // PME + 7, + 0, + 0, + }, + "S1 Riser x24 - Slot 1\0" +}; + +// Type 9 System Slots +STATIC ARM_TYPE9 mArmDefaultType9Sk1RiserX24Slot2 =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_SYSTEM_SLOTS, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE9), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + ADDITIONAL_STR_INDEX_1, + SlotTypePciExpressGen3, + SlotDataBusWidth8X, + SlotUsageAvailable, + SlotLengthLong, + 0, + {0, 0, 1}, // Provides 3.3 Volts + {1}, // PME + 8, + 0, + 0, + }, + "S1 Riser x24 - Slot 2\0" +}; + +// Type 9 System Slots +STATIC ARM_TYPE9 mArmDefaultType9Sk1RiserX24Slot3 =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_SYSTEM_SLOTS, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE9), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + ADDITIONAL_STR_INDEX_1, + SlotTypePciExpressGen3, + SlotDataBusWidth8X, + SlotUsageAvailable, + SlotLengthLong, + 0, + {0, 0, 1}, // Provides 3.3 Volts + {1}, // PME + 9, + 0, + 0, + }, + "S1 Riser x24 - Slot 3\0" +}; + +// Type 9 System Slots +STATIC ARM_TYPE9 mArmDefaultType9Sk1RiserX8Slot1 =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_SYSTEM_SLOTS, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE9), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + ADDITIONAL_STR_INDEX_1, + SlotTypePciExpressGen3, + SlotDataBusWidth8X, + SlotUsageAvailable, + SlotLengthLong, + 0, + {0, 0, 1}, // Provides 3.3 Volts + {1}, // PME + 8, + 0, + 0, + }, + "S1 Riser x8 - Slot 1\0" +}; + +// Type 9 System Slots +STATIC ARM_TYPE9 mArmDefaultType9Sk0OcpNic =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_SYSTEM_SLOTS, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE9), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + ADDITIONAL_STR_INDEX_1, + SlotTypePciExpressGen3, + SlotDataBusWidth16X, + SlotUsageAvailable, + SlotLengthLong, + 0, + {0, 0, 1}, // Provides 3.3 Volts + {1}, // PME + 1, + 0, + 0, + }, + "S0 OCP NIC 3.0\0" +}; + +// Type 9 System Slots +STATIC ARM_TYPE9 mArmDefaultType9Sk1NvmeM2Slot1 =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_SYSTEM_SLOTS, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE9), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + ADDITIONAL_STR_INDEX_1, + SlotTypePciExpressGen3, + SlotDataBusWidth4X, + SlotUsageAvailable, + SlotLengthLong, + 0, + {0, 0, 1}, // Provides 3.3 Volts + {1}, // PME + 5, + 0, + 0, + }, + "S1 NVMe M.2 - Slot 1\0" +}; + +// Type 9 System Slots +STATIC ARM_TYPE9 mArmDefaultType9Sk1NvmeM2Slot2 =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_SYSTEM_SLOTS, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE9), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + ADDITIONAL_STR_INDEX_1, + SlotTypePciExpressGen3, + SlotDataBusWidth4X, + SlotUsageAvailable, + SlotLengthLong, + 0, + {0, 0, 1}, // Provides 3.3 Volts + {1}, // PME + 5, + 0, + 0, + }, + "S1 NVMe M.2 - Slot 2\0" +}; + +// Type 11 OEM Strings +STATIC ARM_TYPE11 mArmDefaultType11 =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_OEM_STRINGS, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE11), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + ADDITIONAL_STR_INDEX_1 + }, + TYPE11_ADDITIONAL_STRINGS +}; + +// Type 13 BIOS Language Information +STATIC ARM_TYPE13 mArmDefaultType13 =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE13), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + 1, + 0, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + 1, + }, + TYPE13_ADDITIONAL_STRINGS +}; + +// Type 24 Hardware Security +STATIC SMBIOS_TABLE_TYPE24 mArmDefaultType24 =3D { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_HARDWARE_SECURITY, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE24), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + 0 +}; + +// Type 32 System Boot Information +STATIC SMBIOS_TABLE_TYPE32 mArmDefaultType32 =3D { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE32), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + {0, 0, 0, 0, 0, 0}, + 0 +}; + +// Type 38 IPMI Device Information +STATIC SMBIOS_TABLE_TYPE38 mArmDefaultType38 =3D { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_IPMI_DEVICE_INFORMATION, // UINT8 Type + sizeof (SMBIOS_TABLE_TYPE38), // UINT8 Length + SMBIOS_HANDLE_PI_RESERVED, + }, + IPMIDeviceInfoInterfaceTypeSSIF, + 0x20, + 0x20, + 0xFF, + 0x20 +}; + +// Type 41 Onboard Devices Extended Information +STATIC ARM_TYPE41 mArmDefaultType41 =3D { + { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_ONBOARD_DEVICES_EXTENDED_INFORMATION, + sizeof (SMBIOS_TABLE_TYPE41), + SMBIOS_HANDLE_PI_RESERVED, + }, + 1, + 0x83, // OnBoardDeviceExtendedTypeVideo, Enabled + 1, + 4, + 2, + 0, + }, + TYPE41_ADDITIONAL_STRINGS +}; + +// Type 42 System Boot Information +STATIC SMBIOS_TABLE_TYPE42 mArmDefaultType42 =3D { + { // SMBIOS_STRUCTURE Hdr + EFI_SMBIOS_TYPE_MANAGEMENT_CONTROLLER_HOST_INTERFACE, + sizeof (SMBIOS_TABLE_TYPE42), + SMBIOS_HANDLE_PI_RESERVED, + }, + MCHostInterfaceTypeOemDefined, + 4, + {0xFF, 0, 0, 0} +}; + +STATIC CONST VOID *DefaultCommonTables[] =3D +{ + &mArmDefaultType0, + &mArmDefaultType1, + &mArmDefaultType2, + &mArmDefaultType8Vga, + &mArmDefaultType8USBFront, + &mArmDefaultType8USBRear, + &mArmDefaultType8NetRJ45, + &mArmDefaultType8NetOcp, + &mArmDefaultType8Uart, + &mArmDefaultType9Sk0RiserX32Slot1, + &mArmDefaultType9Sk0RiserX32Slot2, + &mArmDefaultType9Sk0RiserX32Slot3, + &mArmDefaultType9Sk1RiserX24Slot1, + &mArmDefaultType9Sk1RiserX24Slot2, + &mArmDefaultType9Sk1RiserX24Slot3, + &mArmDefaultType9Sk1RiserX8Slot1, + &mArmDefaultType9Sk0OcpNic, + &mArmDefaultType9Sk1NvmeM2Slot1, + &mArmDefaultType9Sk1NvmeM2Slot2, + &mArmDefaultType11, + &mArmDefaultType13, + &mArmDefaultType24, + &mArmDefaultType32, + &mArmDefaultType38, + &mArmDefaultType41, + &mArmDefaultType42, + NULL +}; + +typedef struct { + CHAR8 MonthNameStr[4]; // example "Jan", Compiler build date, month + CHAR8 DigitStr[3]; // example "01", Smbios date format, month +} MonthStringDig; + +STATIC MonthStringDig MonthMatch[12] =3D { + { "Jan", "01" }, + { "Feb", "02" }, + { "Mar", "03" }, + { "Apr", "04" }, + { "May", "05" }, + { "Jun", "06" }, + { "Jul", "07" }, + { "Aug", "08" }, + { "Sep", "09" }, + { "Oct", "10" }, + { "Nov", "11" }, + { "Dec", "12" } +}; + +STATIC +VOID +ConstructBuildDate ( + OUT CHAR8 *DateBuf + ) +{ + UINTN i; + + // GCC __DATE__ format is "Feb 2 1996" + // If the day of the month is less than 10, it is padded with a space on= the left + CHAR8 *BuildDate =3D __DATE__; + + // SMBIOS spec date string: MM/DD/YYYY + CHAR8 SmbiosDateStr[sizeof (RELEASE_DATE_TEMPLATE)] =3D { 0 }; + + SmbiosDateStr[sizeof (RELEASE_DATE_TEMPLATE) - 1] =3D '\0'; + + SmbiosDateStr[2] =3D '/'; + SmbiosDateStr[5] =3D '/'; + + // Month + for (i =3D 0; i < sizeof (MonthMatch) / sizeof (MonthMatch[0]); i++) { + if (AsciiStrnCmp (&BuildDate[0], MonthMatch[i].MonthNameStr, AsciiStrL= en (MonthMatch[i].MonthNameStr)) =3D=3D 0) { + CopyMem (&SmbiosDateStr[0], MonthMatch[i].DigitStr, AsciiStrLen (Mon= thMatch[i].DigitStr)); + break; + } + } + + // Day + CopyMem (&SmbiosDateStr[3], &BuildDate[4], 2); + if (BuildDate[4] =3D=3D ' ') { + // day is less then 10, SAPCE filed by compiler, SMBIOS requires 0 + SmbiosDateStr[3] =3D '0'; + } + + // Year + CopyMem (&SmbiosDateStr[6], &BuildDate[7], 4); + + CopyMem (DateBuf, SmbiosDateStr, AsciiStrLen (RELEASE_DATE_TEMPLATE)); +} + +STATIC +UINT8 +GetBiosVerMajor ( + VOID + ) +{ + return (PcdGet8 (PcdSmbiosTables1MajorVersion)); +} + +STATIC +UINT8 +GetBiosVerMinor ( + VOID + ) +{ + return (PcdGet8 (PcdSmbiosTables1MinorVersion)); +} + +STATIC +UINTN +GetStringPackSize ( + CHAR8 *StringPack + ) +{ + UINTN StrCount; + CHAR8 *StrStart; + + if ((*StringPack =3D=3D 0) && (*(StringPack + 1) =3D=3D 0)) { + return 0; + } + + // String section ends in double-null (0000h) + for (StrCount =3D 0, StrStart =3D StringPack; + ((*StrStart !=3D 0) || (*(StrStart + 1) !=3D 0)); StrStart++, StrCo= unt++) + { + } + + return StrCount + 2; // Included the double NULL +} + +// Update String at String number to String Pack +EFI_STATUS +UpdateStringPack ( + CHAR8 *StringPack, + CHAR8 *String, + UINTN StringNumber + ) +{ + CHAR8 *StrStart; + UINTN StrIndex; + UINTN InputStrLen; + UINTN TargetStrLen; + UINTN BufferSize; + CHAR8 *Buffer; + + StrStart =3D StringPack; + for (StrIndex =3D 1; StrIndex < StringNumber; StrStart++) { + // A string ends in 00h + if (*StrStart =3D=3D 0) { + StrIndex++; + } + // String section ends in double-null (0000h) + if ((*StrStart =3D=3D 0) && (*(StrStart + 1) =3D=3D 0)) { + return EFI_NOT_FOUND; + } + } + + if (*StrStart =3D=3D 0) { + StrStart++; + } + + InputStrLen =3D AsciiStrLen (String); + TargetStrLen =3D AsciiStrLen (StrStart); + BufferSize =3D GetStringPackSize (StrStart + TargetStrLen + 1); + + // Replace the String if length matched + // OR this is the last string + if (InputStrLen =3D=3D TargetStrLen || (BufferSize =3D=3D 0)) { + CopyMem (StrStart, String, InputStrLen); + } + // Otherwise, buffer is needed to apply new string + else { + Buffer =3D AllocateZeroPool (BufferSize); + if (Buffer =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + CopyMem (Buffer, StrStart + TargetStrLen + 1, BufferSize); + CopyMem (StrStart, String, InputStrLen + 1); + CopyMem (StrStart + InputStrLen + 1, Buffer, BufferSize); + + FreePool (Buffer); + } + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS +UpdateSmbiosType0 ( + PLATFORM_INFO_HOB *PlatformHob + ) +{ + EFI_STATUS Status =3D EFI_SUCCESS; + MISC_BIOS_CHARACTERISTICS_EXTENSION *MiscExt =3D NULL; + CHAR8 *ReleaseDateBuf =3D NULL; + CHAR8 *PcdReleaseDate =3D NULL; + CHAR8 AsciiVersion[32]; + UINTN Index; + CHAR8 BiosVersionStr[128]; + CHAR8 *StringPack; + CHAR8 SizeOfFirmwareVer; + UINT16 *FirmwareVersionPcdPtr; + + // + // Update Type0 information + // + + ReleaseDateBuf =3D &mArmDefaultType0.Strings[0] + + sizeof (VENDOR_TEMPLATE) - 1 + + sizeof (BIOS_VERSION_TEMPLATE) - 1; + PcdReleaseDate =3D (CHAR8 *)PcdGetPtr (PcdSmbiosTables0BiosReleaseDate); + + if (AsciiStrnCmp (PcdReleaseDate, RELEASE_DATE_TEMPLATE, AsciiStrLen (RE= LEASE_DATE_TEMPLATE)) =3D=3D 0) { + // If PCD is still template date MM/DD/YYYY, use compiler date + ConstructBuildDate (ReleaseDateBuf); + } else { + // PCD is updated somehow, use PCD date + CopyMem (ReleaseDateBuf, PcdReleaseDate, AsciiStrLen (PcdReleaseDate)); + } + + if (PcdGet32 (PcdFdSize) < SIZE_16MB) { + mArmDefaultType0.Base.BiosSize =3D (PcdGet32 (PcdFdSize) / SIZE_64KB) = - 1; + + mArmDefaultType0.Base.ExtendedBiosSize.Size =3D 0; + mArmDefaultType0.Base.ExtendedBiosSize.Unit =3D 0; + } else { + // Need to update Extended BIOS ROM Size + mArmDefaultType0.Base.BiosSize =3D 0xFF; + + // As a reminder + ASSERT (FALSE); + } + + // Type0 BIOS Characteristics Extension Byte 1 + MiscExt =3D (MISC_BIOS_CHARACTERISTICS_EXTENSION *)&(mArmDefaultType0.Ba= se.BIOSCharacteristicsExtensionBytes); + + MiscExt->BiosReserved.AcpiIsSupported =3D 1; + + // Type0 BIOS Characteristics Extension Byte 2 + MiscExt->SystemReserved.BiosBootSpecIsSupported =3D 1; + MiscExt->SystemReserved.FunctionKeyNetworkBootIsSupported =3D 1; + MiscExt->SystemReserved.UefiSpecificationSupported =3D 1; + + // Type0 BIOS Release + // Decide another way: If the system does not support the use of this + // field, the value is 0FFh + mArmDefaultType0.Base.SystemBiosMajorRelease =3D GetBiosVerMajor (); + mArmDefaultType0.Base.SystemBiosMinorRelease =3D GetBiosVerMinor (); + + // + // Format of PcdFirmwareVersionString is + // "(MAJOR_VER).(MINOR_VER).(BUILD) Build YYYY.MM.DD", we only need + // "(MAJOR_VER).(MINOR_VER).(BUILD)" showed in Bios version. Using + // space character to determine this string. Another case uses null + // character to end while loop. + // + SizeOfFirmwareVer =3D 0; + FirmwareVersionPcdPtr =3D (UINT16 *)PcdGetPtr (PcdFirmwareVersionString); + while (*FirmwareVersionPcdPtr !=3D ' ' && *FirmwareVersionPcdPtr !=3D '\= 0') { + SizeOfFirmwareVer++; + FirmwareVersionPcdPtr++; + } + + AsciiSPrint ( + BiosVersionStr, + sizeof (BiosVersionStr), + "TianoCore %.*s (SYS: %a.%a)", + SizeOfFirmwareVer, + PcdGetPtr (PcdFirmwareVersionString), + PlatformHob->SmPmProVer, + PlatformHob->SmPmProBuild + ); + StringPack =3D mArmDefaultType0.Strings; + + UpdateStringPack (StringPack, BiosVersionStr, ADDITIONAL_STR_INDEX_2); + + /* Update SMBIOS Type 0 EC Info */ + CopyMem ( + (VOID *)&AsciiVersion, + (VOID *)&PlatformHob->SmPmProVer, + sizeof (PlatformHob->SmPmProVer) + ); + /* The AsciiVersion is formated as "major.minor" */ + for (Index =3D 0; Index < (UINTN)AsciiStrLen (AsciiVersion); Index++) { + if (AsciiVersion[Index] =3D=3D '.') { + AsciiVersion[Index] =3D '\0'; + break; + } + } + + mArmDefaultType0.Base.EmbeddedControllerFirmwareMajorRelease =3D + (UINT8)AsciiStrDecimalToUintn (AsciiVersion); + mArmDefaultType0.Base.EmbeddedControllerFirmwareMinorRelease =3D + (UINT8)AsciiStrDecimalToUintn (AsciiVersion + Index + 1); + + return Status; +} + +STATIC +EFI_STATUS +InstallType3Structure ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status =3D EFI_SUCCESS; + EFI_SMBIOS_HANDLE SmbiosHandle; + + ASSERT (Smbios !=3D NULL); + + SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER*) &mArmDefaultType3)->Handle; + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmDefaultType3 + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "adding SMBIOS type 3 failed\n")); + // stop adding rather than continuing + return Status; + } + + // Save this handle to type 2 table + mArmDefaultType2.Base.ChassisHandle =3D SmbiosHandle; + + return Status; +} + +/** + Install a whole table worth of structures + + @param Smbios SMBIOS protocol. + @param DefaultTables A pointer to the default SMBIOS table stru= cture. +**/ +EFI_STATUS +InstallStructures ( + IN EFI_SMBIOS_PROTOCOL *Smbios, + IN CONST VOID *DefaultTables[] + ) +{ + EFI_STATUS Status =3D EFI_SUCCESS; + EFI_SMBIOS_HANDLE SmbiosHandle; + UINTN TableIndex; + + ASSERT (Smbios !=3D NULL); + + for (TableIndex =3D 0; DefaultTables[TableIndex] !=3D NULL; TableIndex++= ) { + SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER *)DefaultTables[TableIndex]= )->Handle; + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)DefaultTables[TableIndex] + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: adding %d failed\n", __FUNCTION__, TableIn= dex)); + + // stop adding rather than continuing + return Status; + } + } + + return EFI_SUCCESS; +} + +STATIC +VOID +UpdateSmbiosInfo ( + VOID + ) +{ + VOID *Hob; + PLATFORM_INFO_HOB *PlatformHob; + + /* Get the Platform HOB */ + Hob =3D GetFirstGuidHob (&gPlatformInfoHobGuid); + ASSERT (Hob !=3D NULL); + if (Hob =3D=3D NULL) { + return; + } + + PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + + // + // Update Type0 information + // + UpdateSmbiosType0 (PlatformHob); + +} + +/** + Install all structures from the DefaultTables structure + + @param Smbios SMBIOS protocol + +**/ +EFI_STATUS +InstallAllStructures ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status =3D EFI_SUCCESS; + + ASSERT (Smbios !=3D NULL); + + // Update SMBIOS Tables + UpdateSmbiosInfo (); + + // Install Type 3 table + InstallType3Structure (Smbios); + + // Install Tables + Status =3D InstallStructures (Smbios, DefaultCommonTables); + ASSERT_EFI_ERROR (Status); + + return Status; +} + +/** + Installs SMBIOS information for ARM platforms + + @param ImageHandle Module's image handle + @param SystemTable Pointer of EFI_SYSTEM_TABLE + + @retval EFI_SUCCESS Smbios data successfully installed + @retval Other Smbios data was not installed + +**/ +EFI_STATUS +EFIAPI +SmbiosPlatformDxeEntry ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_PROTOCOL *Smbios; + + // + // Find the SMBIOS protocol + // + Status =3D gBS->LocateProtocol ( + &gEfiSmbiosProtocolGuid, + NULL, + (VOID **)&Smbios + ); + + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D InstallAllStructures (Smbios); + DEBUG ((DEBUG_ERROR, "SmbiosPlatform install - %r\n", Status)); + + return Status; +} diff --git a/Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.c b/Plat= form/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.c new file mode 100644 index 000000000000..6f5869b1ef1c --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.c @@ -0,0 +1,325 @@ +/** @file +* OemMiscLib.c +* +* Copyright (c) 2021, Ampere Computing LLC. All rights reserved. +* Copyright (c) 2021, NUVIA Inc. All rights reserved. +* Copyright (c) 2018, Hisilicon Limited. All rights reserved. +* Copyright (c) 2018, Linaro Limited. All rights reserved. +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define MHZ_SCALE_FACTOR 1000000 + +UINT32 +GetCacheConfig ( + IN UINT32 CacheLevel, + IN BOOLEAN DataCache, + IN BOOLEAN UnifiedCache + ) +{ + CSSELR_DATA Csselr; + UINT64 Ccsidr; + BOOLEAN SupportWB; + BOOLEAN SupportWT; + + Csselr.Data =3D 0; + Csselr.Bits.Level =3D CacheLevel - 1; + Csselr.Bits.InD =3D (!DataCache && !UnifiedCache); + + Ccsidr =3D ReadCCSIDR (Csselr.Data); + SupportWT =3D (Ccsidr & (1 << 31)) ? TRUE : FALSE; + SupportWB =3D (Ccsidr & (1 << 30)) ? TRUE : FALSE; + + if (SupportWT && SupportWB) { + return 2; // Varies with Memory Address + } + + if (SupportWT) { + return 0; // Write Through + } + + if (SupportWB) { + return 1; // Write Back + } + + return 3; // Unknown +} + +/** Gets the CPU frequency of the specified processor. + + @param ProcessorIndex Index of the processor to get the frequency for. + + @return CPU frequency in Hz +**/ +UINTN +EFIAPI +OemGetCpuFreq ( + IN UINT8 ProcessorIndex + ) +{ + return CpuGetCurrentFreq (ProcessorIndex); +} + +/** Gets information about the specified processor and stores it in + the structures provided. + + @param ProcessorIndex Index of the processor to get the information for. + @param ProcessorStatus Processor status. + @param ProcessorCharacteristics Processor characteritics. + @param MiscProcessorData Miscellaneous processor information. + + @return TRUE on success, FALSE on failure. +**/ +BOOLEAN +EFIAPI +OemGetProcessorInformation ( + IN UINTN ProcessorIndex, + IN OUT PROCESSOR_STATUS_DATA *ProcessorStatus, + IN OUT PROCESSOR_CHARACTERISTIC_FLAGS *ProcessorCharacteristics, + IN OUT OEM_MISC_PROCESSOR_DATA *MiscProcessorData + ) +{ + UINT16 ProcessorCount; + + ProcessorCount =3D GetNumberOfActiveSockets (); + + if (ProcessorIndex < ProcessorCount) { + ProcessorStatus->Bits.CpuStatus =3D 1; // CPU enabled + ProcessorStatus->Bits.Reserved1 =3D 0; + ProcessorStatus->Bits.SocketPopulated =3D 1; + ProcessorStatus->Bits.Reserved2 =3D 0; + } else { + ProcessorStatus->Bits.CpuStatus =3D 0; // CPU disabled + ProcessorStatus->Bits.Reserved1 =3D 0; + ProcessorStatus->Bits.SocketPopulated =3D 0; + ProcessorStatus->Bits.Reserved2 =3D 0; + } + + ProcessorCharacteristics->ProcessorReserved1 =3D 0; + ProcessorCharacteristics->ProcessorUnknown =3D 0; + ProcessorCharacteristics->Processor64BitCapable =3D 1; + ProcessorCharacteristics->ProcessorMultiCore =3D 1; + ProcessorCharacteristics->ProcessorHardwareThread =3D 0; + ProcessorCharacteristics->ProcessorExecuteProtection =3D 1; + ProcessorCharacteristics->ProcessorEnhancedVirtualization =3D 1; + ProcessorCharacteristics->ProcessorPowerPerformanceCtrl =3D 1; + ProcessorCharacteristics->Processor128BitCapable =3D 0; + ProcessorCharacteristics->ProcessorReserved2 =3D 0; + + MiscProcessorData->Voltage =3D CpuGetVoltage (ProcessorIndex); + MiscProcessorData->CurrentSpeed =3D (UINT16)(CpuGetCurrentFreq (Processo= rIndex) / MHZ_SCALE_FACTOR); + MiscProcessorData->MaxSpeed =3D (UINT16)(CpuGetMaxFreq (ProcessorInd= ex) / MHZ_SCALE_FACTOR); + MiscProcessorData->CoreCount =3D GetMaximumNumberOfCores (); + MiscProcessorData->ThreadCount =3D GetMaximumNumberOfCores (); + MiscProcessorData->CoresEnabled =3D GetNumberOfActiveCoresPerSocket (Pro= cessorIndex); + + return TRUE; +} + +/** Gets information about the cache at the specified cache level. + + @param ProcessorIndex The processor to get information for. + @param CacheLevel The cache level to get information for. + @param DataCache Whether the cache is a data cache. + @param UnifiedCache Whether the cache is a unified cache. + @param SmbiosCacheTable The SMBIOS Type7 cache information structure. + + @return TRUE on success, FALSE on failure. +**/ +BOOLEAN +EFIAPI +OemGetCacheInformation ( + IN UINT8 ProcessorIndex, + IN UINT8 CacheLevel, + IN BOOLEAN DataCache, + IN BOOLEAN UnifiedCache, + IN OUT SMBIOS_TABLE_TYPE7 *SmbiosCacheTable + ) +{ + SmbiosCacheTable->CacheConfiguration =3D CacheLevel - 1; + SmbiosCacheTable->CacheConfiguration |=3D (1 << 7); // Enable + SmbiosCacheTable->CacheConfiguration |=3D (GetCacheConfig (CacheLevel, D= ataCache, UnifiedCache) << 8); + + SmbiosCacheTable->SupportedSRAMType.Unknown =3D 0; + SmbiosCacheTable->SupportedSRAMType.Synchronous =3D 1; + SmbiosCacheTable->CurrentSRAMType.Unknown =3D 0; + SmbiosCacheTable->CurrentSRAMType.Synchronous =3D 1; + + if (CacheLevel =3D=3D 1 && !DataCache && !UnifiedCache) { + SmbiosCacheTable->ErrorCorrectionType =3D CacheErrorParity; + } else { + SmbiosCacheTable->ErrorCorrectionType =3D CacheErrorSingleBit; + } + + return TRUE; +} + +/** Gets the maximum number of processors supported by the platform. + + @return The maximum number of processors. +**/ +UINT8 +EFIAPI +OemGetMaxProcessors ( + VOID + ) +{ + return GetNumberOfSupportedSockets (); +} + +/** Gets the type of chassis for the system. + + @retval The type of the chassis. +**/ +MISC_CHASSIS_TYPE +EFIAPI +OemGetChassisType ( + VOID + ) +{ + return MiscChassisTypeRackMountChassis; +} + +/** Returns whether the specified processor is present or not. + + @param ProcessIndex The processor index to check. + + @return TRUE is the processor is present, FALSE otherwise. +**/ +BOOLEAN +EFIAPI +OemIsProcessorPresent ( + IN UINTN ProcessorIndex + ) +{ + // + // Platform only supports 2 sockets: Master and Slave. + // The master socket is always online. + // + if (ProcessorIndex =3D=3D 0) { + return TRUE; + } else if (ProcessorIndex =3D=3D 1) { + return IsSlaveSocketAvailable (); + } + + return FALSE; +} + +/** Updates the HII string for the specified field. + + @param HiiHandle The HII handle. + @param TokenToUpdate The string to update. + @param Field The field to get information about. +**/ +VOID +EFIAPI +OemUpdateSmbiosInfo ( + IN EFI_HII_HANDLE HiiHandle, + IN EFI_STRING_ID TokenToUpdate, + IN OEM_MISC_SMBIOS_HII_STRING_FIELD Field + ) +{ + return; +} + +/** Fetches the Type 32 boot information status. + + @return Boot status. +**/ +MISC_BOOT_INFORMATION_STATUS_DATA_TYPE +EFIAPI +OemGetBootStatus ( + VOID + ) +{ + return BootInformationStatusNoError; +} + +/** Fetches the chassis status when it was last booted. + + @return Chassis status. +**/ +MISC_CHASSIS_STATE +EFIAPI +OemGetChassisBootupState ( + VOID + ) +{ + return ChassisStateSafe; +} + +/** Fetches the chassis power supply/supplies status when last booted. + + @return Chassis power supply/supplies status. +**/ +MISC_CHASSIS_STATE +EFIAPI +OemGetChassisPowerSupplyState ( + VOID + ) +{ + return ChassisStateSafe; +} + +/** Fetches the chassis thermal status when last booted. + + @return Chassis thermal status. +**/ +MISC_CHASSIS_STATE +EFIAPI +OemGetChassisThermalState ( + VOID + ) +{ + return ChassisStateSafe; +} + +/** Fetches the chassis security status when last booted. + + @return Chassis security status. +**/ +MISC_CHASSIS_SECURITY_STATE +EFIAPI +OemGetChassisSecurityStatus ( + VOID + ) +{ + return ChassisSecurityStatusNone; +} + +/** Fetches the chassis height in RMUs (Rack Mount Units). + + @return The height of the chassis. +**/ +UINT8 +EFIAPI +OemGetChassisHeight ( + VOID + ) +{ + return 1U; +} + +/** Fetches the number of power cords. + + @return The number of power cords. +**/ +UINT8 +EFIAPI +OemGetChassisNumPowerCords ( + VOID + ) +{ + return 2; +} --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83834): https://edk2.groups.io/g/devel/message/83834 Mute This Topic: https://groups.io/mt/87123902/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83835+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83835+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167848777471.11237690179235; Wed, 17 Nov 2021 08:50:48 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id tStMYY1788612xny6fMRoNMx; Wed, 17 Nov 2021 08:50:48 -0800 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.123]) by mx.groups.io with SMTP id smtpd.web11.9790.1637167847849599234 for ; Wed, 17 Nov 2021 08:50:48 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xf+uIRYZyOoeABevMqYtIUf2dl/YxeCiMQAZCs86jBMz7n6taJ03VijuczS5AoGiQK6bU/Pjf6IN5pMuYGUSbb71DvqbsGRk5KdNGc/CQ6kz79QwybHkJYYo94sIT/OV8PUIdzZTUs7stc930U6SImMclSTBAuu6poKsjIlArC1Rvtll2ZSOnYxPLxMyjW3eVupX3YPJEY8J7u2x7BS7xu/c/AVMIhBqeC2h78xxPDzV9c1drd6hrPAOJ5zgUCmSfgW9yB6gFLSw3Lqi8BkT51S88r+LfgvsLQ8YWp32QCjxcn+q+eXyLa89a+W0q8zvsv7u2sot+zZcebRNIqGd+Q== 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=TRBU1TRgfRRoslPUz5/dxCiK7HXh9uOlN+hqcW0vgtE=; b=TJCD5BHxM6xNl95b+dUsg2XaBI422qNwrkGJRKS3DsRI0jp7IMIQYVqT325gVFpw0vD5SLgbPWd61MbeDCOo6QuDCYmPleBnukmAkMWPjTcLaoJribZOf4UiAH3hMqd0CN6IEJVAl8yUhG0Z073UA22gR25Jx6OQUYwpK4rakPad1V6vgFyYb1s733ZFE9KpCi7NVlPeKIL3q/nNP0dxngffSBax0ncQfo2QvhW+aKLmo48TyRbThY2Bkp692hP/6gw0wqBMVdLKuYZAkFX1TDV66FtlErb+IqUPx9qP3wLCgyH/MfWS4c2xMP7MtcPPLI9lYULAPR/qjgB/FM9JtA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB7521.prod.exchangelabs.com (2603:10b6:510:f4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Wed, 17 Nov 2021 16:50:46 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:46 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 22/30] AmpereAltraPkg: Add DebugInfoPei module Date: Wed, 17 Nov 2021 23:47:19 +0700 Message-ID: <20211117164727.10922-23-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:50:43 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0d3e500a-654b-4a86-8ce3-08d9a9ea66fb X-MS-TrafficTypeDiagnostic: PH0PR01MB7521: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1850; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: xVRE1jGB0VzE2hNM7bI+/YF0kY+2PuMKTNQiXMSo7gSjCZcUhgathj44iWbMFRsCijJgHAhroA0iN5zzT2y+Hu5sFt0utGXJ2WpaGNtVsZVexDrGWguYoqRSdgjdaf+Jt4skNkdcSAEDKZGRku2UIWI5DbHMoSTBrsZrad7+patpj8EfS6EWfD6/mucvP62YKKI/DxVCuz8sDrGo0icu7h9efAXOVzFC7KDTW4jpPzOfWY1bdYht8PboIZ1n4CS32Z7YWRLwxN8vbh2lcxtp4C5aM3putM4KAAGml0WKa0eca4Tj9ZB0USa6jz+/pwkdEiBcXPyL+UWwfv/yTBQbipVHdZmUGcKsSJ6a8Ure6hUwnxLKwjO4Tgs2Aol1qhaz8Ao/wrjamnlJvqcLMm1eZr6nGc/3sM+q4Yg663ANZHHYZbX9sDtaxitbWSGpi0aPmQI6cOpbW4cZLgkMo0WXev8IZLbKpcR56EdROzIPABExQd55bJ19s+iZbN6HMp0CGbhzysIEo5uLF9WTaoMgVmI9dQi2YIJ/UwW31tAe1Fzd0Urd7eASYEmv4+IFw1wgSjlOXKhX2LNUF0eur+E7pLQ9nrydVinT0XiCcAIYB1TPsPw9pwXKyinutIT8iTeXEKRXVFTS+2mjw4DL+eRHUG6itrgwf/N0zZsQJWCDhVV4l9l/gjacIEqs5QYjY6Ix4+6bbzdu1zWVbcoIpF5JzQ== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?I5b4CiPz61jV8ajUirqwwQG2CblYEko0EfsHX4QPaOSUj/tp5MWswbz0r18g?= =?us-ascii?Q?9+ODdNJyBCLnzYR28ixrUrFMosqmO/gdKVZA69mn1e1KPHFKRB4qSBaB0CKU?= =?us-ascii?Q?Sf9nuXmpwL/1HfElhwXUz+Ab4IXEKF2wINLkt2uSjfd7Zr7MdaJ5qHzkL6XP?= =?us-ascii?Q?b36VsTrdulUc7DiIFxlcGIRnRJvTE3yBVMBqUbDzmbXh6umJhc7rcLMbIaPG?= =?us-ascii?Q?OxmAz+O/CqTY7+swPAJrTE86r5hsCpFZPU9pm0e7X8AHBleJno61C6157i0m?= =?us-ascii?Q?0oxojfMn1q4e/GnUK+WGvnASClPaeFyL70XIeMt6Ljr+Dpxp9g6xRSc+Yjdl?= =?us-ascii?Q?PR8jPE9Qz2Ntf4+nFzhkmYdYlujgnD/qqObeloqVUEYChuu8Z5P+kuhbQW5a?= =?us-ascii?Q?68oiPo1zFnJhzq+5A3IeeqD/nRl97NXlOVHl3SiUKHHt3CrpFP2V6e163Sip?= =?us-ascii?Q?9A4haZuReNSntXP80DqIUIzENS533kSwrmGXs6Ss9t8ylUS9yfcV0coP7fWR?= =?us-ascii?Q?7gEyl1jU3lC19a9nRONDypQ9j0vWYngzGVWANsdy793oXFuTyffdIL6ni4/E?= =?us-ascii?Q?Pqi2vTJkYnva+waF5Xq+ZX+0WmUij9c8oVinJievGgoAPiqps5ANvXD5675/?= =?us-ascii?Q?kCijmvEI4QGb364gz1ErNJEJkdimIiPwjNTzi9uMvAuTr5+A9oOAJTSr745i?= =?us-ascii?Q?K4rZosOCMUu0wbmzj/cO3iYI4qksBT/Bmj0ppkJxsxQON8Rv4pFu52tK61QS?= =?us-ascii?Q?UeVdFTvX/Kusv13a78VeOJtBzPL46vvLtjZyIeUN6QMqOCLeja7hyuaX7QcT?= =?us-ascii?Q?SMAzJ4yeWo5TWUd9QKLDzapiVkjQqlWJZHP49+f91lnKms+OJBcqoUH6ecda?= =?us-ascii?Q?ZZH7V3dJDRV46YbmKiWJ4jTxbCcakRmN0prJy4G39NK9frJFhQZ/LGS2e7dg?= =?us-ascii?Q?Ln20zLjCClRPOs+Qt0Aaiz7HvKf0eddnvhMhgzGe1px3op5hmoIc1DtmemQA?= =?us-ascii?Q?VzsC+dYGy01p0MeCHluhDQNB0vQZFMyTFJK7C18gM4jsQ0042KISnVrUeG8O?= =?us-ascii?Q?IEqFNrLIb2+o8d6AuKJZpQr7HS2/DTzjZPrihT5jqLd0hsFbMzmbZnKkGWUd?= =?us-ascii?Q?oB3+90gCv+pSFkOmjXNDb1m2Y4gW9jRUhnVypZB8KHovI0RqWh9zIVBaUBkz?= =?us-ascii?Q?KRJZkgwGOAepY8NMDitCHET9+seRItWoyGvP+/tvJDQHVSfxhBqeosqkGBce?= =?us-ascii?Q?NI+AHvUauFIHgFWitJuI0yMUNm1bvDTTug6tUZRDPBaqmiBGoyiyqi0GEtoN?= =?us-ascii?Q?1T50UDe4aGz2p1e3kOzRr6TFNyAhX6Pc8Yu1rJiVDelPnRnitzuiIkPYmPJm?= =?us-ascii?Q?BxHLWysGsPxlIjVVsGJqPc+3xJy2OReuTn2ZalGyQKBmh6d8Ogz2Tv+gCa1F?= =?us-ascii?Q?VuTrGoddCpy10od5wphLt1ev7H+6bipUHkAVyJwVax0jhqh6sGOywPleSwn1?= =?us-ascii?Q?FbILYQJKJMwYa/BeFytLMj02tGLYyWdzTMqi990QpRFFkONHDNub4QzqhWk5?= =?us-ascii?Q?ipk94x6OiwUp1gQHy1uDFkOcn7WU1kTdYhTyCdvB02GGMlkuT0e8cgvbdGbE?= =?us-ascii?Q?JYhr9cIXiF3u0flEcR+r/0ZF6IJKU2rPt4kAcJqAOS8ZkTYkOXuTKVPwCulz?= =?us-ascii?Q?vw69VuxLDDDBSrmuK0MkgmMNyTQ=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0d3e500a-654b-4a86-8ce3-08d9a9ea66fb X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:46.6929 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PrEXbJwD8mUDqG5GfJA2FbVDez/K8blSTFn1JuWh0xswRzIwSIiYshIIYJDeJWG3uKHeOg5BvyZOvor0CUPyywq0Br6ogmwZQj6E2SA/7tE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7521 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: jOL3rUVTZeCYStTMuyd35yhMx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167848; bh=WJeDDwKAzkR0G6lX6avX9iE7iqtIM+GZG4wfpG0emik=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=nB95NK/mZ2MQZf26Dw/xv4QDoGTSPiDW4QRopy6edNPDWcPeKVm8x0XJmXQvq6L5fQy K5MJUaDN2JlxItzIc1PuAMXQGz3lYBPmFBQwpmdTiHsLKAKEJ+66tE8qqwD/SAcPENhqN el/1GoIaBZBO+u3kZgaC/HxdMIqK2NT6PAs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167849218100005 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen Helps to show various system information like CPU info and Board Setting values to UART console during boot process. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc | 4 + Platform/Ampere/JadePkg/Jade.fdf | 2 + Silicon/Ampere/AmpereAltraPkg/Drivers/DebugInfoPei/DebugInfoPei.inf | 40 = ++++ Silicon/Ampere/AmpereAltraPkg/Drivers/DebugInfoPei/DebugInfoPei.c | 209 = ++++++++++++++++++++ 4 files changed, 255 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index 36d96ff9a63f..f4007d654ec8 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -535,6 +535,10 @@ [Components.common] ArmPlatformPkg/PlatformPei/PlatformPeim.inf Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/DebugInfoPei/DebugInfoPei.inf { + + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPor= t.inf + } Silicon/Ampere/AmpereAltraPkg/Drivers/FlashPei/FlashPei.inf Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf ArmPkg/Drivers/CpuPei/CpuPei.inf diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index 647281fb6b8d..a59b12633691 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -167,6 +167,8 @@ [FV.FVMAIN_COMPACT] # # Print platform information before passing control into the Driver Exec= ution Environment (DXE) phase # + INF Silicon/Ampere/AmpereAltraPkg/Drivers/DebugInfoPei/DebugInfoPei.inf + INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf =20 FILE FV_IMAGE =3D 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/DebugInfoPei/DebugInfoPe= i.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/DebugInfoPei/DebugInfoPei.inf new file mode 100644 index 000000000000..e9c383565ce5 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/DebugInfoPei/DebugInfoPei.inf @@ -0,0 +1,40 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D DebugInfo + FILE_GUID =3D C0571D26-6176-11E9-8647-D663BD873D93 + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D DebugInfoPeiEntryPoint + +[Sources] + DebugInfoPei.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + AmpereCpuLib + ArmLib + DebugLib + HobLib + NVParamLib + PeimEntryPoint + +[Guids] + gPlatformInfoHobGuid + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/DebugInfoPei/DebugInfoPe= i.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/DebugInfoPei/DebugInfoPei.c new file mode 100644 index 000000000000..2bb01b686abc --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/DebugInfoPei/DebugInfoPei.c @@ -0,0 +1,209 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define GB_SCALE_FACTOR 1073741824 +#define MB_SCALE_FACTOR 1048576 +#define KB_SCALE_FACTOR 1024 +#define MHZ_SCALE_FACTOR 1000000 + +/** + Print any existence NVRAM. +**/ +STATIC VOID +PrintNVRAM ( + VOID + ) +{ + EFI_STATUS Status; + NVPARAM Idx; + UINT32 Val; + UINT16 ACLRd =3D NV_PERM_ALL; + BOOLEAN Flag; + + Flag =3D FALSE; + for (Idx =3D NV_PREBOOT_PARAM_START; Idx <=3D NV_PREBOOT_PARAM_MAX; Idx = +=3D NVPARAM_SIZE) { + Status =3D NVParamGet (Idx, ACLRd, &Val); + if (!EFI_ERROR (Status)) { + if (!Flag) { + DebugPrint (DEBUG_INIT, "Pre-boot Configuration Setting:\n"); + Flag =3D TRUE; + } + DebugPrint (DEBUG_INIT, " %04X: 0x%X (%d)\n", (UINT32)Idx, Val, V= al); + } + } + + Flag =3D FALSE; + for (Idx =3D NV_MANU_PARAM_START; Idx <=3D NV_MANU_PARAM_MAX; Idx +=3D N= VPARAM_SIZE) { + Status =3D NVParamGet (Idx, ACLRd, &Val); + if (!EFI_ERROR (Status)) { + if (!Flag) { + DebugPrint (DEBUG_INIT, "Manufacturer Configuration Setting:\n"); + Flag =3D TRUE; + } + DebugPrint (DEBUG_INIT, " %04X: 0x%X (%d)\n", (UINT32)Idx, Val, V= al); + } + } + + Flag =3D FALSE; + for (Idx =3D NV_USER_PARAM_START; Idx <=3D NV_USER_PARAM_MAX; Idx +=3D N= VPARAM_SIZE) { + Status =3D NVParamGet (Idx, ACLRd, &Val); + if (!EFI_ERROR (Status)) { + if (!Flag) { + DebugPrint (DEBUG_INIT, "User Configuration Setting:\n"); + Flag =3D TRUE; + } + DebugPrint (DEBUG_INIT, " %04X: 0x%X (%d)\n", (UINT32)Idx, Val, V= al); + } + } + + Flag =3D FALSE; + for (Idx =3D NV_BOARD_PARAM_START; Idx <=3D NV_BOARD_PARAM_MAX; Idx +=3D= NVPARAM_SIZE) { + Status =3D NVParamGet (Idx, ACLRd, &Val); + if (!EFI_ERROR (Status)) { + if (!Flag) { + DebugPrint (DEBUG_INIT, "Board Configuration Setting:\n"); + Flag =3D TRUE; + } + DebugPrint (DEBUG_INIT, " %04X: 0x%X (%d)\n", (UINT32)Idx, Val, V= al); + } + } +} + +STATIC +CHAR8 * +GetCCIXLinkSpeed ( + IN UINTN Speed + ) +{ + switch (Speed) { + case 1: + return "2.5 GT/s"; + + case 2: + return "5 GT/s"; + + case 3: + return "8 GT/s"; + + case 4: + case 6: + return "16 GT/s"; + + case 0xa: + return "20 GT/s"; + + case 0xf: + return "25 GT/s"; + } + + return "Unknown"; +} + +/** + Print system info +**/ +STATIC VOID +PrintSystemInfo ( + VOID + ) +{ + UINTN Idx; + VOID *Hob; + PLATFORM_INFO_HOB *PlatformHob; + + Hob =3D GetFirstGuidHob (&gPlatformInfoHobGuid); + if (Hob =3D=3D NULL) { + return; + } + + PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + + DebugPrint (DEBUG_INIT, "SCP FW version : %a\n", (const CHAR8 *)Platf= ormHob->SmPmProVer); + DebugPrint (DEBUG_INIT, "SCP FW build date : %a\n", (const CHAR8 *)Platf= ormHob->SmPmProBuild); + + DebugPrint (DEBUG_INIT, "Failsafe status : %d\n", Platfo= rmHob->FailSafeStatus); + DebugPrint (DEBUG_INIT, "Reset status : %d\n", Platfo= rmHob->ResetStatus); + DebugPrint (DEBUG_INIT, "CPU info\n"); + DebugPrint (DEBUG_INIT, " CPU ID : %X\n", ArmRea= dMidr ()); + DebugPrint (DEBUG_INIT, " CPU Clock : %d MHz\n", Pl= atformHob->CpuClk / MHZ_SCALE_FACTOR); + DebugPrint (DEBUG_INIT, " Number of active sockets : %d\n", GetNum= berOfActiveSockets ()); + DebugPrint (DEBUG_INIT, " Number of active cores : %d\n", GetNum= berOfActiveCores ()); + if (IsSlaveSocketActive ()) { + DebugPrint (DEBUG_INIT, + " Inter Socket Connection 0 : Width: x%d / Speed %a\n", + PlatformHob->Link2PWidth[0], + GetCCIXLinkSpeed (PlatformHob->Link2PSpeed[0]) + ); + DebugPrint (DEBUG_INIT, + " Inter Socket Connection 1 : Width: x%d / Speed %a\n", + PlatformHob->Link2PWidth[1], + GetCCIXLinkSpeed (PlatformHob->Link2PSpeed[1]) + ); + } + for (Idx =3D 0; Idx < GetNumberOfActiveSockets (); Idx++) { + DebugPrint (DEBUG_INIT, " Socket[%d]: Core voltage : %d\n", Idx= , PlatformHob->CoreVoltage[Idx]); + DebugPrint (DEBUG_INIT, " Socket[%d]: SCU ProductID : %X\n", Idx= , PlatformHob->ScuProductId[Idx]); + DebugPrint (DEBUG_INIT, " Socket[%d]: Max cores : %d\n", Idx= , PlatformHob->MaxNumOfCore[Idx]); + DebugPrint (DEBUG_INIT, " Socket[%d]: Warranty : %d\n", Idx= , PlatformHob->Warranty[Idx]); + DebugPrint (DEBUG_INIT, " Socket[%d]: Subnuma : %d\n", Idx= , PlatformHob->SubNumaMode[Idx]); + DebugPrint (DEBUG_INIT, " Socket[%d]: RC disable mask : %X\n", Idx= , PlatformHob->RcDisableMask[Idx]); + DebugPrint (DEBUG_INIT, " Socket[%d]: AVS enabled : %d\n", Idx= , PlatformHob->AvsEnable[Idx]); + DebugPrint (DEBUG_INIT, " Socket[%d]: AVS voltage : %d\n", Idx= , PlatformHob->AvsVoltageMV[Idx]); + } + + DebugPrint (DEBUG_INIT, "SOC info\n"); + DebugPrint (DEBUG_INIT, " DDR Frequency : %d MHz\n", Pl= atformHob->DramInfo.MaxSpeed); + for (Idx =3D 0; Idx < GetNumberOfActiveSockets (); Idx++) { + DebugPrint (DEBUG_INIT, " Socket[%d]: Soc voltage : %d\n", Idx= , PlatformHob->SocVoltage[Idx]); + DebugPrint (DEBUG_INIT, " Socket[%d]: DIMM1 voltage : %d\n", Idx= , PlatformHob->Dimm1Voltage[Idx]); + DebugPrint (DEBUG_INIT, " Socket[%d]: DIMM2 voltage : %d\n", Idx= , PlatformHob->Dimm2Voltage[Idx]); + } + + DebugPrint (DEBUG_INIT, " PCP Clock : %d MHz\n", Pl= atformHob->PcpClk / MHZ_SCALE_FACTOR); + DebugPrint (DEBUG_INIT, " SOC Clock : %d MHz\n", Pl= atformHob->SocClk / MHZ_SCALE_FACTOR); + DebugPrint (DEBUG_INIT, " SYS Clock : %d MHz\n", Pl= atformHob->SysClk / MHZ_SCALE_FACTOR); + DebugPrint (DEBUG_INIT, " AHB Clock : %d MHz\n", Pl= atformHob->AhbClk / MHZ_SCALE_FACTOR); +} + +/** + Entry point function for the PEIM + + @param FileHandle Handle of the file being invoked. + @param PeiServices Describes the list of possible PEI Services. + + @return EFI_SUCCESS If we installed our PPI + +**/ +EFI_STATUS +EFIAPI +DebugInfoPeiEntryPoint ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + PrintSystemInfo (); + PrintNVRAM (); + + return EFI_SUCCESS; +} --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83835): https://edk2.groups.io/g/devel/message/83835 Mute This Topic: https://groups.io/mt/87123905/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83836+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83836+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167853462146.3480541862923; Wed, 17 Nov 2021 08:50:53 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id LBmLYY1788612xiVxqsijAfw; Wed, 17 Nov 2021 08:50:53 -0800 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.136]) by mx.groups.io with SMTP id smtpd.web08.9778.1637167852143409009 for ; Wed, 17 Nov 2021 08:50:52 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Asg/2DNPV+YWFAGqng95rq0zC/ZnjDydzcSYC9iHlx82sjbgVN9LBxSzjQor87rAborn0bpsNxaK3v0RH3eWefR3cftedFsGYwmZ2EYuqYtRGMR4ZDtKgf4AapSYF6d/llZG3S9AI5L52ToH2AuDAbtrNnQGv5qPAyIB/fa32YrSPlicv9HhJAm+eNQqQTHe8btd80QeEB//LBYXUum8DJi7ESL7nymZZhoDCIHVQibDi1/MSfIigcetroRAT4C6lH8EjOAhHO0s1SpJhbDwt0e81eCdeUjrPNicbJxV1P43V2fQRBIS4yR3rgts7HyGdjbTtY0//SgGCvglRhodtw== 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=K7PT95X5UGZTALYVaKJCVpsJhGFnPLke/IrH5S/a8WY=; b=Oy+Ytb6gD6N8JCZx5OyXYbyT6LRZnHW3DjTy50a3XoGaFkGMbEQpxzMFE9fLZ8qOGQI2t1nsJ2dIaiXwZj+tcfJg3ODzWdVwYo1a4fh2/jglxAtu6dfpXmYNBpdBbQcqlLq0PhH0Qe77u3omC6RmFlVMFepTRpwDlO7HQOwwjXDje4Xre28+uqC0Vu60N0EyVcxDKfAA7ulRuujrOYUAjJiWuamguzi4gupFmAYDFzDO0NlCf8bJbUBnR5vnWyaF5snovoOUuzmnpoXxARlsPCUEL4uWdY/6pxPeXucEm/ikkVIve00IYVikJGPJMEjSgq0NKAvKwn6BK/0Oze6TRQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB7521.prod.exchangelabs.com (2603:10b6:510:f4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Wed, 17 Nov 2021 16:50:50 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:50 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 23/30] AmpereAltraPkg: Add configuration screen for PCIe Date: Wed, 17 Nov 2021 23:47:20 +0700 Message-ID: <20211117164727.10922-24-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:50:46 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 66e719ea-812e-4010-aa4f-08d9a9ea68d7 X-MS-TrafficTypeDiagnostic: PH0PR01MB7521: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: W3qiTH3VXEOehL0sKQqfkn1Hym9uBG39tf+A7YjIjd9iJMY1VmEHYOxpWXvezgU4zU7HftEV/0o/9vRlnAjWLjwj22t+rKMRWaqU0JlwdUMLU5MURcqafBfVFEN3hJS65z77mnzayHGUfPjovcoJ+syYCtgriHmXs08DOEIMoivb/3hKQdQr3cYulUptfgbcabEdQOWQYUBSTGVSjIPA8NMJQOMiYZ06BTGCrcQr7LordAuYsPXSRlgkIsiXDywDA5ZmHs49HIhUeS6itpLlh2tqYBIh2IXUfY7wXSmzuNS16WppPX8If1NcX7J4B1VGOOgMfP9IzYQ9ZUGuDL2BQpHcxWnl4s9Re/MPSJXcxLFnVAJRFcp31zhjJ7BUISnlbyN5c6zSfZplQngGcQtwhtsd68FjqP51YOe19uoOFUTA7luu6Tdw5hlL4ZwrJpdneQumztYUX9+zAm4ZpFSkbUi5f7Kq5i7Z9cjb55L/aw7qVn2IIh4PFh9VnYKbsusCxh900zZZ76fJ3LQixumlzkLYejY6zW5P1aoXBV/hwRiIJ4dnCQwdRCQyEbiUI21XsVl0Qp8J/Dw4m4OcWQtM4gyjKhtSxS8LA8NM/syzlhmnPnRY4aiFhNYFjr/kh1kijlQkCMu290weHX/Q4o80NtDq37+v+Bvqt3cgvx7vnDq7wpZxMPMiLEGrpX0yjRHoE8+q7511GZgpa4RJoPghZh9wP2fXQWiMiQf7bV7Tuo2yBFhNZsnuOAYZdo0PQStNzAHVRcNTkQ8LzMT4xBar+Q== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?UShRrmNhp+M+x7+Bv6hD8u7TIpELTWDobbzdeiocY1qN2TxTboUPBKGaC127?= =?us-ascii?Q?celR4Ud+yEjXC0cLeWxjxzUZGS51igF0fAVcSgMuOHy2a0I+h+6peD4EJRly?= =?us-ascii?Q?OXKBymqz8sm+gBW/gj8kZD7wWkH/XDmCa9ylGYsdQ+P/N8TW2Oe5M1ncLklJ?= =?us-ascii?Q?+yyqYHZGOCIByfsdWpFD634xgh+B3KPkP5fNvyHVBVDGih1PVqvTqRq89nMb?= =?us-ascii?Q?RVb+TI5MIjCRLlaEqSyiBrTi7hJFRrny7K+u0JD0wxw9KWb0xh1U+RX4+N4U?= =?us-ascii?Q?dcs70XTZvBQq3JqD0GeZv6RJ3P0DJDdPvQvrOB9bsa2qQjDnO6yjO/UCQ64a?= =?us-ascii?Q?ZFmCms8OSEjet6gOWhONvE/qVkq9MKPBZH3KlXh+Yftq+IxaD/8FSgcq+w48?= =?us-ascii?Q?I4q0WeMOvqy5V6h/2HqZSpv2E22CLPWJHYdPjupR5NawOA7GIM5GBuvqcvIk?= =?us-ascii?Q?WIK+I8S7hlGNjDEWilwDtDmlaA1n2TQ+4dPZyg4SMtfNIRM485Vn9A/RrzCE?= =?us-ascii?Q?B4+jUORaA4QPEaVvwfPk+W37FjiHgAyDNLdLiQujbfIhUwipXawnQOTtW1hC?= =?us-ascii?Q?PTNn5cZzBRq5sDAPPdw2bFv8ppOMlzy80bYC05lgAi7IY7c8Z4aRE2JZ37xb?= =?us-ascii?Q?NW9cPqnk4QLr7j20KoCugWpAVqkBRYJj+p6pO2VE53BeixZ156RojLTnvmu2?= =?us-ascii?Q?ebf3a0b4QXOMgas6S5oV7zToyvuR0OQpAGkmQiZ2FNj34Cks5gds2EcvdVKs?= =?us-ascii?Q?nwLlixJ8azjQMq7eSe/+Zm2UQeO/n9ZVJ0VetBbcy66qmcPtUzO+gLZ0mZW4?= =?us-ascii?Q?4G4/HIZjHfOhIoPWN51UV0NnRkUMqRav3dBSRfm0YO5NPHAXIHM2w69TUVmb?= =?us-ascii?Q?VlZobEpMMG5s6yD07SX9CRopwOhqK2rJAZo6lNPMtxQ8EU2h0LI/dS/wQr/a?= =?us-ascii?Q?HMNQsv7FZT4Win/tS4ErW08rgLOR9/luwt9nyDSzklOqtVoWoouRgqdr/GKC?= =?us-ascii?Q?zfPhs+46ENH6uvhczu1UrU15qfO9ahE8z/MdyAq2nqVkjR+j2tF1xkN/IdhK?= =?us-ascii?Q?8qP1ipDo3CkEf/+5ChhZ91BBWjwBz3tXDLZL263p6oUzPIaGl62VaaJ5TdoB?= =?us-ascii?Q?sLl5ZD3UVlyGstj4IUBjDxKr0Urm8VhiA4iiUesEXXTa/NVF92+FcZJT0c/U?= =?us-ascii?Q?xQieHoUaOOKSGilwRJODMXEWqqnf4sH6nmXbIJUtzMj5+YANGflCIB4lbxEk?= =?us-ascii?Q?NZdl4AAYEXAL1diaZgpGktvLzyul179+J/ZjCTSv7pnGa/rl2flQ/Ng1Nxld?= =?us-ascii?Q?Q5V8YnxKm+uM179Kfxv/g6QCtfdvhIrRHENw+Y5RcaVynL3Y9E0sH652FtZ2?= =?us-ascii?Q?gdOWS6apre8J8NefdS4rlsoPfGdmjB57333X1tj7ChavHD2ASww0xlUBaexL?= =?us-ascii?Q?SiMmnbdGwiNkTnLln1e9Up9U79K5fSio63R8MOR/v1QoPLxrr9rAsy7sTBWL?= =?us-ascii?Q?FMb3gOQaNsKjfKkwZskbkq706kyZ1lPwulLegYwHp15kdT+UVlMpPYAvNLVM?= =?us-ascii?Q?GGF7swvhHRclSWPcQqKQlu3GTbYak7xUQCyTOAPa4dh/vg89E82tVmlbtLWE?= =?us-ascii?Q?IPsdsLS54qiqEMriH7Smj3OqPhZ9ApW747D3ceNRFa4BfxOXxbKks0d/Nle+?= =?us-ascii?Q?rb/MsXdNz3C7cGeqnuWdQf2dxGE=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 66e719ea-812e-4010-aa4f-08d9a9ea68d7 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:49.9366 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BQ4+ffkVpHdHNQ3VLqfEW+8SpJ7ueC5jFZqfpj2ixt5Ps/D9T8LN8Kw8yx4WlOMfQCkz42HlkJo162ypqdWdRPL+bi68QfOgc+I/qw8R+ek= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7521 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: IDS5C7m5yWIhbxApmKHg4dYmx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167853; bh=q0m5hj+5pRqcRI257rMnfyqe6guDv4Qif7rolDKBQvo=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=hjsVGyTgtI77Qo5sj6BtL9QnuByBrqWVpxi+WJQM33W4KNi1M9Io3xC2XB242o56Ix0 1gHmKRg80KdvOvizUSCtYAdFNXI83Pmdyp/kQ50t80RO0+S8nU0aXY8fs5833SdUuEefb f+mxbGOWUaGCHm1R8+ZkZ5aVI9IteNvLugE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167854977100002 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen This menu screen allows the user to: - Enable/Disable each Root Complex - Enable/Disable SMMU support - Enable/Disable Strong Ordering - Set Bifurcation mode for each Root Complex Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Acked-by: Leif Lindholm --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec = | 3 + Platform/Ampere/JadePkg/Jade.dsc = | 5 + Platform/Ampere/JadePkg/Jade.fdf = | 5 + Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConf= igDxe.inf | 61 + Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConf= igDxe.h | 114 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConf= igNVDataStruct.h | 91 ++ Silicon/Ampere/AmpereAltraPkg/Include/Guid/RootComplexConfigHii.h = | 33 + Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConf= igVfr.vfr | 219 ++++ Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConf= igDxe.c | 1226 ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConf= igDxe.uni | 102 ++ 10 files changed, 1859 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Amp= ere/AmpereAltraPkg/AmpereAltraPkg.dec index 7bd4d3ac9462..460255768aed 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -61,3 +61,6 @@ [Guids] =20 ## Include/Guid/RootComplexInfoHob.h gRootComplexInfoHobGuid =3D { 0x568a258a, 0xcaa1, 0x47e9, { 0xbb, 0= x89, 0x65, 0xa3, 0x73, 0x9b, 0x58, 0x75 } } + + ## Include/Guid/RootComplexConfigHii.h + gRootComplexConfigFormSetGuid =3D { 0xE84E70D6, 0xE4B2, 0x4C6E, { 0x98, = 0x51, 0xCB, 0x2B, 0xAC, 0x77, 0x7D, 0xBB } } diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index 03932215b499..6c4294bef159 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -181,3 +181,8 @@ [Components.common] Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.inf + + # + # HII + # + Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexCo= nfigDxe.inf diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index a59b12633691..f7ef95247f79 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -348,4 +348,9 @@ [FV.FvMain] INF ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf INF Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.inf =20 + # + # HII + # + INF Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootCompl= exConfigDxe.inf + !include Silicon/Ampere/AmpereSiliconPkg/FvRules.fdf.inc diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/Roo= tComplexConfigDxe.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexCo= nfigDxe/RootComplexConfigDxe.inf new file mode 100644 index 000000000000..b0c66109a92a --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComple= xConfigDxe.inf @@ -0,0 +1,61 @@ +## @file +# +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D RootComplexConfigDxe + FILE_GUID =3D 9820A15A-ECFE-404B-97C8-A2B76F0AB103 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D RootComplexDriverEntry + +[Sources.common] + RootComplexConfigDxe.c + RootComplexConfigDxe.h + RootComplexConfigDxe.uni + RootComplexConfigNVDataStruct.h + RootComplexConfigVfr.vfr + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + AmpereCpuLib + BaseLib + BaseMemoryLib + DebugLib + DevicePathLib + HiiLib + HobLib + MemoryAllocationLib + NVParamLib + PrintLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiRuntimeServicesTableLib + +[Protocols] + gEfiDevicePathProtocolGuid + gEfiHiiStringProtocolGuid ## CONSUMES + gEfiHiiConfigRoutingProtocolGuid ## CONSUMES + gEfiHiiConfigAccessProtocolGuid ## PRODUCES + gEfiHiiDatabaseProtocolGuid ## CONSUMES + gEfiConfigKeywordHandlerProtocolGuid ## CONSUMES + +[Guids] + gEfiIfrTianoGuid ## CONSUMES + gPlatformInfoHobGuid ## CONSUMES + gPlatformManagerFormsetGuid ## CONSUMES + gRootComplexConfigFormSetGuid ## CONSUMES + gRootComplexInfoHobGuid ## CONSUMES + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/Roo= tComplexConfigDxe.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConf= igDxe/RootComplexConfigDxe.h new file mode 100644 index 000000000000..c02ee765a19a --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComple= xConfigDxe.h @@ -0,0 +1,114 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef BOARD_PCIE_SCREEN_H_ +#define BOARD_PCIE_SCREEN_H_ + +#include "RootComplexConfigNVDataStruct.h" + +// +// This is the generated IFR binary data for each formset defined in VFR. +// This data array is ready to be used as input of HiiAddPackages() to +// create a packagelist (which contains Form packages, String packages, et= c). +// +extern UINT8 RootComplexConfigVfrBin[]; + +// +// This is the generated String package data for all .UNI files. +// This data array is ready to be used as input of HiiAddPackages() to +// create a packagelist (which contains Form packages, String packages, et= c). +// +extern UINT8 RootComplexConfigDxeStrings[]; + +#define MAX_EDITABLE_ELEMENTS 3 +#define RC0_STATUS_OFFSET \ + OFFSET_OF (ROOT_COMPLEX_CONFIG_VARSTORE_DATA, RCStatus[0]) +#define RC0_BIFUR_LO_OFFSET \ + OFFSET_OF (ROOT_COMPLEX_CONFIG_VARSTORE_DATA, RCBifurcationLow[0]) +#define RC0_BIFUR_HI_OFFSET \ + OFFSET_OF (ROOT_COMPLEX_CONFIG_VARSTORE_DATA, RCBifurcationHigh[0]) +#define SMMU_PMU_OFFSET \ + OFFSET_OF (ROOT_COMPLEX_CONFIG_VARSTORE_DATA, SmmuPmu) + +#define STRONG_ORDERING_OFFSET \ + OFFSET_OF (NVPARAM_ROOT_COMPLEX_CONFIG_VARSTORE_DATA, PcieStrongOrdering) + +// +// Signature: Ampere Computing PCIe Screen +// +#define SCREEN_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('A', 'C', 'P', 'S') + +#define MAX_STRING_SIZE 32 + +#define STRONG_ORDERING_DEFAULT_OPTION_VALUE 1 +#define STRONG_ORDERING_DEFAULT_NVPARAM_VALUE 0xFFFFFFFF + +typedef struct { + UINTN Signature; + + EFI_HANDLE DriverHandle; + EFI_HII_HANDLE HiiHandle; + ROOT_COMPLEX_CONFIG_VARSTORE_DATA VarStoreConfig; + NVPARAM_ROOT_COMPLEX_CONFIG_VARSTORE_DATA NVParamVarStoreConfig; + + // + // Consumed protocol + // + EFI_HII_DATABASE_PROTOCOL *HiiDatabase; + EFI_HII_STRING_PROTOCOL *HiiString; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL *HiiKeywordHandler; + + // + // Produced protocol + // + EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess; +} SCREEN_PRIVATE_DATA; + +typedef struct { + UINTN PciDevIdx; + EFI_STRING_ID GotoStringId; + EFI_STRING_ID GotoHelpStringId; + UINT16 GotoKey; + BOOLEAN ShowItem; +} SETUP_GOTO_DATA; + +#define SCREEN_PRIVATE_FROM_THIS(a) \ + CR (a, SCREEN_PRIVATE_DATA, ConfigAccess, SCREEN_PRIVATE_DATA_SIGNATURE) + +#pragma pack(1) + +/// +/// HII specific Vendor Device Path definition. +/// +typedef struct { + VENDOR_DEVICE_PATH VendorDevicePath; + EFI_DEVICE_PATH_PROTOCOL End; +} HII_VENDOR_DEVICE_PATH; + +#pragma pack() + +UINT8 +PcieRCDevMapLowDefaultSetting ( + IN UINTN RCIndex, + IN SCREEN_PRIVATE_DATA *PrivateData + ); + +UINT8 +PcieRCDevMapHighDefaultSetting ( + IN UINTN RCIndex, + IN SCREEN_PRIVATE_DATA *PrivateData + ); + +BOOLEAN +PcieRCActiveDefaultSetting ( + IN UINTN RCIndex, + IN SCREEN_PRIVATE_DATA *PrivateData + ); + +#endif /* BOARD_PCIE_SCREEN_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/Roo= tComplexConfigNVDataStruct.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/RootCo= mplexConfigDxe/RootComplexConfigNVDataStruct.h new file mode 100644 index 000000000000..3350f6eb7fe4 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComple= xConfigNVDataStruct.h @@ -0,0 +1,91 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef BOARD_PCIE_VFR_H_ +#define BOARD_PCIE_VFR_H_ + +#include + +#define VARSTORE_ID 0x1234 +#define FORM_ID 0x1235 +#define RC0_FORM_ID 0x1236 +#define RC1_FORM_ID 0x1237 +#define RC2_FORM_ID 0x1238 +#define RC3_FORM_ID 0x1239 +#define RC4_FORM_ID 0x123A +#define RC5_FORM_ID 0x123B +#define RC6_FORM_ID 0x123C +#define RC7_FORM_ID 0x123D +#define RC8_FORM_ID 0x123E +#define RC9_FORM_ID 0x123F +#define RC10_FORM_ID 0x1240 +#define RC11_FORM_ID 0x1241 +#define RC12_FORM_ID 0x1242 +#define RC13_FORM_ID 0x1243 +#define RC14_FORM_ID 0x1244 +#define RC15_FORM_ID 0x1245 + +#define QUESTION_ID_BASE 0x8002 +#define GOTO_ID_BASE 0x8040 + +#define SMMU_PMU_ID 0x9000 +#define STRONG_ORDERING_ID 0x9001 + +#define NVPARAM_VARSTORE_NAME L"PcieIfrNVParamData" +#define NVPARAM_VARSTORE_ID 0x1233 + +#pragma pack(1) + +// +// NVParam data structure definition +// +typedef struct { + BOOLEAN PcieStrongOrdering; +} NVPARAM_ROOT_COMPLEX_CONFIG_VARSTORE_DATA; + +#pragma pack() + +// +// Labels definition +// +#define LABEL_UPDATE 0x2223 +#define LABEL_END 0x2224 +#define LABEL_RC0_UPDATE 0x2225 +#define LABEL_RC0_END 0x2226 +#define LABEL_RC1_UPDATE 0x2227 +#define LABEL_RC1_END 0x2228 +#define LABEL_RC2_UPDATE 0x2229 +#define LABEL_RC2_END 0x222A +#define LABEL_RC3_UPDATE 0x222B +#define LABEL_RC3_END 0x222C +#define LABEL_RC4_UPDATE 0x222D +#define LABEL_RC4_END 0x222E +#define LABEL_RC5_UPDATE 0x222F +#define LABEL_RC5_END 0x2230 +#define LABEL_RC6_UPDATE 0x2231 +#define LABEL_RC6_END 0x2232 +#define LABEL_RC7_UPDATE 0x2233 +#define LABEL_RC7_END 0x2234 +#define LABEL_RC8_UPDATE 0x2235 +#define LABEL_RC8_END 0x2236 +#define LABEL_RC9_UPDATE 0x2237 +#define LABEL_RC9_END 0x2238 +#define LABEL_RC10_UPDATE 0x2239 +#define LABEL_RC10_END 0x223A +#define LABEL_RC11_UPDATE 0x223B +#define LABEL_RC11_END 0x223C +#define LABEL_RC12_UPDATE 0x223D +#define LABEL_RC12_END 0x223E +#define LABEL_RC13_UPDATE 0x223F +#define LABEL_RC13_END 0x2240 +#define LABEL_RC14_UPDATE 0x2241 +#define LABEL_RC14_END 0x2242 +#define LABEL_RC15_UPDATE 0x2243 +#define LABEL_RC15_END 0x2244 + +#endif /* BOARD_PCIE_VFR_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Guid/RootComplexConfigHi= i.h b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/RootComplexConfigHii.h new file mode 100644 index 000000000000..d82604cdf85e --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/RootComplexConfigHii.h @@ -0,0 +1,33 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef ROOT_COMPLEX_CONFIG_HII_H_ +#define ROOT_COMPLEX_CONFIG_HII_H_ + +#include + +#define ROOT_COMPLEX_CONFIG_FORMSET_GUID \ + { \ + 0xE84E70D6, 0xE4B2, 0x4C6E, { 0x98, 0x51, 0xCB, 0x2B, 0xAC, 0x77, 0x7= D, 0xBB } \ + } + +extern EFI_GUID gRootComplexConfigFormSetGuid; + +// +// NV data structure definition +// +typedef struct { + BOOLEAN RCStatus[AC01_PCIE_MAX_ROOT_COMPLEX]; + UINT8 RCBifurcationLow[AC01_PCIE_MAX_ROOT_COMPLEX]; + UINT8 RCBifurcationHigh[AC01_PCIE_MAX_ROOT_COMPLEX]; + UINT32 SmmuPmu; +} ROOT_COMPLEX_CONFIG_VARSTORE_DATA; + +#define ROOT_COMPLEX_CONFIG_VARSTORE_NAME L"PcieIfrNVData" + +#endif /* ROOT_COMPLEX_CONFIG_HII_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/Roo= tComplexConfigVfr.vfr b/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexCo= nfigDxe/RootComplexConfigVfr.vfr new file mode 100644 index 000000000000..4772d3c45cfb --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComple= xConfigVfr.vfr @@ -0,0 +1,219 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include "RootComplexConfigNVDataStruct.h" + +formset + guid =3D ROOT_COMPLEX_CONFIG_FORMSET_GUID, + title =3D STRING_TOKEN(STR_PCIE_FORM), + help =3D STRING_TOKEN(STR_PCIE_FORM_HELP), + classguid =3D gPlatformManagerFormsetGuid, + + // + // Define a variable Storage + // + varstore ROOT_COMPLEX_CONFIG_VARSTORE_DATA, + varid =3D VARSTORE_ID, + name =3D PcieIfrNVData, + guid =3D ROOT_COMPLEX_CONFIG_FORMSET_GUID; + + varstore NVPARAM_ROOT_COMPLEX_CONFIG_VARSTORE_DATA, + varid =3D NVPARAM_VARSTORE_ID, + name =3D PcieIfrNVParamData, + guid =3D ROOT_COMPLEX_CONFIG_FORMSET_GUID; + + form + formid =3D FORM_ID, + title =3D STRING_TOKEN(STR_PCIE_FORM); + + subtitle text =3D STRING_TOKEN(STR_PCIE_FORM); + + label LABEL_UPDATE; + // dynamic content here + label LABEL_END; + endform; + + form + formid =3D RC0_FORM_ID, + title =3D STRING_TOKEN(STR_PCIE_RC0_FORM); + + subtitle text =3D STRING_TOKEN(STR_PCIE_RC0_FORM); + + label LABEL_RC0_UPDATE; + // dynamic content here + label LABEL_RC0_END; + endform; + + form + formid =3D RC1_FORM_ID, + title =3D STRING_TOKEN(STR_PCIE_RC1_FORM); + + subtitle text =3D STRING_TOKEN(STR_PCIE_RC1_FORM); + + label LABEL_RC1_UPDATE; + // dynamic content here + label LABEL_RC1_END; + endform; + + form + formid =3D RC2_FORM_ID, + title =3D STRING_TOKEN(STR_PCIE_RC2_FORM); + + subtitle text =3D STRING_TOKEN(STR_PCIE_RC2_FORM); + + label LABEL_RC2_UPDATE; + // dynamic content here + label LABEL_RC2_END; + endform; + + form + formid =3D RC3_FORM_ID, + title =3D STRING_TOKEN(STR_PCIE_RC3_FORM); + + subtitle text =3D STRING_TOKEN(STR_PCIE_RC3_FORM); + + label LABEL_RC3_UPDATE; + // dynamic content here + label LABEL_RC3_END; + endform; + + form + formid =3D RC4_FORM_ID, + title =3D STRING_TOKEN(STR_PCIE_RC4_FORM); + + subtitle text =3D STRING_TOKEN(STR_PCIE_RC4_FORM); + + label LABEL_RC4_UPDATE; + // dynamic content here + label LABEL_RC4_END; + endform; + + form + formid =3D RC5_FORM_ID, + title =3D STRING_TOKEN(STR_PCIE_RC5_FORM); + + subtitle text =3D STRING_TOKEN(STR_PCIE_RC5_FORM); + + label LABEL_RC5_UPDATE; + // dynamic content here + label LABEL_RC5_END; + endform; + + form + formid =3D RC6_FORM_ID, + title =3D STRING_TOKEN(STR_PCIE_RC6_FORM); + + subtitle text =3D STRING_TOKEN(STR_PCIE_RC6_FORM); + + label LABEL_RC6_UPDATE; + // dynamic content here + label LABEL_RC6_END; + endform; + + form + formid =3D RC7_FORM_ID, + title =3D STRING_TOKEN(STR_PCIE_RC7_FORM); + + subtitle text =3D STRING_TOKEN(STR_PCIE_RC7_FORM); + + label LABEL_RC7_UPDATE; + // dynamic content here + label LABEL_RC7_END; + endform; + + form + formid =3D RC8_FORM_ID, + title =3D STRING_TOKEN(STR_PCIE_RC8_FORM); + + subtitle text =3D STRING_TOKEN(STR_PCIE_RC8_FORM); + + label LABEL_RC8_UPDATE; + // dynamic content here + label LABEL_RC8_END; + endform; + + form + formid =3D RC9_FORM_ID, + title =3D STRING_TOKEN(STR_PCIE_RC9_FORM); + + subtitle text =3D STRING_TOKEN(STR_PCIE_RC9_FORM); + + label LABEL_RC9_UPDATE; + // dynamic content here + label LABEL_RC9_END; + endform; + + form + formid =3D RC10_FORM_ID, + title =3D STRING_TOKEN(STR_PCIE_RC10_FORM); + + subtitle text =3D STRING_TOKEN(STR_PCIE_RC10_FORM); + + label LABEL_RC10_UPDATE; + // dynamic content here + label LABEL_RC10_END; + endform; + + form + formid =3D RC11_FORM_ID, + title =3D STRING_TOKEN(STR_PCIE_RC11_FORM); + + subtitle text =3D STRING_TOKEN(STR_PCIE_RC11_FORM); + + label LABEL_RC11_UPDATE; + // dynamic content here + label LABEL_RC11_END; + endform; + + form + formid =3D RC12_FORM_ID, + title =3D STRING_TOKEN(STR_PCIE_RC12_FORM); + + subtitle text =3D STRING_TOKEN(STR_PCIE_RC12_FORM); + + label LABEL_RC12_UPDATE; + // dynamic content here + label LABEL_RC12_END; + endform; + + form + formid =3D RC13_FORM_ID, + title =3D STRING_TOKEN(STR_PCIE_RC13_FORM); + + subtitle text =3D STRING_TOKEN(STR_PCIE_RC13_FORM); + + label LABEL_RC13_UPDATE; + // dynamic content here + label LABEL_RC13_END; + endform; + + form + formid =3D RC14_FORM_ID, + title =3D STRING_TOKEN(STR_PCIE_RC14_FORM); + + subtitle text =3D STRING_TOKEN(STR_PCIE_RC14_FORM); + + label LABEL_RC14_UPDATE; + // dynamic content here + label LABEL_RC14_END; + endform; + + form + formid =3D RC15_FORM_ID, + title =3D STRING_TOKEN(STR_PCIE_RC15_FORM); + + subtitle text =3D STRING_TOKEN(STR_PCIE_RC15_FORM); + + label LABEL_RC15_UPDATE; + // dynamic content here + label LABEL_RC15_END; + endform; + +endformset; diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/Roo= tComplexConfigDxe.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConf= igDxe/RootComplexConfigDxe.c new file mode 100644 index 000000000000..e03be2a2f9dc --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComple= xConfigDxe.c @@ -0,0 +1,1226 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "RootComplexConfigDxe.h" + +BOOLEAN mReadOnlyStrongOrdering; +CHAR16 mPcieNvparamVarstoreName[] =3D NVPARAM_VARSTORE_NAME; +CHAR16 gPcieVarstoreName[] =3D ROOT_COMPLEX_CONFIG_VARSTORE_NAM= E; +EFI_GUID gPcieFormSetGuid =3D ROOT_COMPLEX_CONFIG_FORMSET_GUID; + +SCREEN_PRIVATE_DATA *mPrivateData =3D NULL; + +HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath =3D { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8)(sizeof (VENDOR_DEVICE_PATH)), + (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + ROOT_COMPLEX_CONFIG_FORMSET_GUID + }, + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { + (UINT8)(END_DEVICE_PATH_LENGTH), + (UINT8)((END_DEVICE_PATH_LENGTH) >> 8) + } + } +}; + +BOOLEAN +IsEmptyRC ( + IN AC01_ROOT_COMPLEX *RootComplex + ) +{ + UINT8 Idx; + + for (Idx =3D PcieController0; Idx < MaxPcieController; Idx++) { + if (RootComplex->Pcie[Idx].Active) { + return FALSE; + } + } + + return TRUE; +} + +AC01_ROOT_COMPLEX * +GetRootComplex ( + UINT8 Index + ) +{ + AC01_ROOT_COMPLEX *RootComplexList; + VOID *Hob; + + Hob =3D GetFirstGuidHob (&gRootComplexInfoHobGuid); + if (Hob =3D=3D NULL) { + return NULL; + } + + RootComplexList =3D (AC01_ROOT_COMPLEX *)GET_GUID_HOB_DATA (Hob); + return &RootComplexList[Index]; +} + +/** + This function allows a caller to extract the current configuration for o= ne + or more named elements from the target driver. + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param Request A null-terminated Unicode string in + format. + @param Progress On return, points to a character in the R= equest + string. Points to the string's null termi= nator if + request was successful. Points to the mos= t recent + '&' before the first failing name/value p= air (or + the beginning of the string if the failur= e is in + the first name/value pair) if the request= was not + successful. + @param Results A null-terminated Unicode string in + format which has all valu= es filled + in for the names in the Request string. S= tring to + be allocated by the called function. + @retval EFI_SUCCESS The Results is filled with the requested = values. + @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results. + @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown nam= e. + @retval EFI_NOT_FOUND Routing data doesn't match any storage in= this + driver. +**/ +EFI_STATUS +EFIAPI +ExtractConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Request, + OUT EFI_STRING *Progress, + OUT EFI_STRING *Results + ) +{ + EFI_STATUS Status; + UINTN BufferSize; + SCREEN_PRIVATE_DATA *PrivateData; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + EFI_STRING ConfigRequest; + UINTN Size; + CHAR16 *StrPointer; + BOOLEAN AllocatedRequest; + UINT8 *VarStoreConfig; + UINT32 Value; + + if (Progress =3D=3D NULL || Results =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + if (Request =3D=3D NULL) { + return EFI_NOT_FOUND; + } + + // + // Initialize the local variables. + // + ConfigRequest =3D NULL; + Size =3D 0; + *Progress =3D Request; + AllocatedRequest =3D FALSE; + + PrivateData =3D SCREEN_PRIVATE_FROM_THIS (This); + HiiConfigRouting =3D PrivateData->HiiConfigRouting; + + // + // Check routing data in . + // Note: if only one Storage is used, then this checking could be skippe= d. + // + if (HiiIsConfigHdrMatch (Request, &gPcieFormSetGuid, mPcieNvparamVarstor= eName)) { + VarStoreConfig =3D (UINT8 *)&PrivateData->NVParamVarStoreConfig; + ASSERT (VarStoreConfig !=3D NULL); + + Status =3D NVParamGet ( + NV_SI_MESH_S0_CXG_RC_STRONG_ORDERING_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + ASSERT_EFI_ERROR (Status); + if (Value !=3D 0) { + PrivateData->NVParamVarStoreConfig.PcieStrongOrdering =3D TRUE; + } + + Status =3D NVParamGet ( + NV_SI_MESH_S1_CXG_RC_STRONG_ORDERING_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + ASSERT_EFI_ERROR (Status); + if (Value !=3D 0) { + PrivateData->NVParamVarStoreConfig.PcieStrongOrdering =3D TRUE; + } + + BufferSize =3D sizeof (NVPARAM_ROOT_COMPLEX_CONFIG_VARSTORE_DATA); + + } else if (HiiIsConfigHdrMatch (Request, &gPcieFormSetGuid, gPcieVarstor= eName)) { + VarStoreConfig =3D (UINT8 *)&PrivateData->VarStoreConfig; + ASSERT (VarStoreConfig !=3D NULL); + + // + // Get Buffer Storage data from EFI variable. + // Try to get the current setting from variable. + // + BufferSize =3D sizeof (ROOT_COMPLEX_CONFIG_VARSTORE_DATA); + Status =3D gRT->GetVariable ( + gPcieVarstoreName, + &gPcieFormSetGuid, + NULL, + &BufferSize, + VarStoreConfig + ); + if (EFI_ERROR (Status)) { + return EFI_NOT_FOUND; + } + + } else { + return EFI_NOT_FOUND; + } + + // + // Set Request to the unified request string. + // + ConfigRequest =3D Request; + + // + // Check whether Request includes Request Element. + // + if (StrStr (Request, L"OFFSET") =3D=3D NULL) { + // + // Check Request Element does exist in Request String + // + StrPointer =3D StrStr (Request, L"PATH"); + if (StrPointer =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + if (StrStr (StrPointer, L"&") =3D=3D NULL) { + // + // Allocate and fill a buffer large enough to hold the t= emplate + // followed by "&OFFSET=3D0&WIDTH=3DWWWWWWWWWWWWWWWW" followed by a = Null-terminator + // + Size =3D (StrLen (Request) + 32 + 1) * sizeof (CHAR16); + ConfigRequest =3D AllocateZeroPool (Size); + ASSERT (ConfigRequest !=3D NULL); + AllocatedRequest =3D TRUE; + UnicodeSPrint ( + ConfigRequest, + Size, + L"%s&OFFSET=3D0&WIDTH=3D%016LX", + Request, + (UINT64)BufferSize + ); + } + } + + // + // Convert buffer data to by helper function BlockToConfig() + // + Status =3D HiiConfigRouting->BlockToConfig ( + HiiConfigRouting, + ConfigRequest, + VarStoreConfig, + BufferSize, + Results, + Progress + ); + + // + // Free the allocated config request string. + // + if (AllocatedRequest) { + FreePool (ConfigRequest); + } + + // + // Set Progress string to the original request string. + // + if (Request =3D=3D NULL) { + *Progress =3D NULL; + } else if (StrStr (Request, L"OFFSET") =3D=3D NULL) { + *Progress =3D Request + StrLen (Request); + } + + return Status; +} + +/** + This function processes the results of changes in configuration. + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param Configuration A null-terminated Unicode string in + format. + @param Progress A pointer to a string filled in with the = offset of + the most recent '&' before the first fail= ing + name/value pair (or the beginning of the = string if + the failure is in the first name/value pa= ir) or + the terminating NULL if all was successfu= l. + @retval EFI_SUCCESS The Results is processed successfully. + @retval EFI_INVALID_PARAMETER Configuration is NULL. + @retval EFI_NOT_FOUND Routing data doesn't match any storage in= this + driver. +**/ +EFI_STATUS +EFIAPI +RouteConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Configuration, + OUT EFI_STRING *Progress + ) +{ + EFI_STATUS Status; + UINTN BufferSize; + SCREEN_PRIVATE_DATA *PrivateData; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + UINT8 *VarStoreConfig; + UINT32 Value; + + if (Configuration =3D=3D NULL || Progress =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + PrivateData =3D SCREEN_PRIVATE_FROM_THIS (This); + HiiConfigRouting =3D PrivateData->HiiConfigRouting; + *Progress =3D Configuration; + + if (HiiIsConfigHdrMatch (Configuration, &gPcieFormSetGuid, mPcieNvparamV= arstoreName)) { + VarStoreConfig =3D (UINT8 *)&PrivateData->NVParamVarStoreConfig; + BufferSize =3D sizeof (NVPARAM_ROOT_COMPLEX_CONFIG_VARSTORE_DATA); + } else if (HiiIsConfigHdrMatch (Configuration, &gPcieFormSetGuid, gPcieV= arstoreName)) { + BufferSize =3D sizeof (ROOT_COMPLEX_CONFIG_VARSTORE_DATA); + VarStoreConfig =3D (UINT8 *)&PrivateData->VarStoreConfig; + } + ASSERT (VarStoreConfig !=3D NULL); + + // + // Check if configuring Name/Value storage + // + if (StrStr (Configuration, L"OFFSET") =3D=3D NULL) { + // + // Don't have any Name/Value storage names + // + return EFI_SUCCESS; + } + + // + // Convert to buffer data by helper function ConfigToBlock() + // + Status =3D HiiConfigRouting->ConfigToBlock ( + HiiConfigRouting, + Configuration, + (UINT8 *)VarStoreConfig, + &BufferSize, + Progress + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Check routing data in . + // + if (HiiIsConfigHdrMatch (Configuration, &gPcieFormSetGuid, mPcieNvparamV= arstoreName)) { + Value =3D PrivateData->NVParamVarStoreConfig.PcieStrongOrdering ? + STRONG_ORDERING_DEFAULT_NVPARAM_VALUE : 0; + + if (!mReadOnlyStrongOrdering) { + // + // Update whole 16 RCs. + // + Status =3D NVParamSet ( + NV_SI_MESH_S0_CXG_RC_STRONG_ORDERING_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Value + ); + ASSERT_EFI_ERROR (Status); + + // + // No need to check slave present + // + Status =3D NVParamSet ( + NV_SI_MESH_S1_CXG_RC_STRONG_ORDERING_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Value + ); + ASSERT_EFI_ERROR (Status); + } + } else if (HiiIsConfigHdrMatch (Configuration, &gPcieFormSetGuid, gPcieV= arstoreName)) { + // + // Store Buffer Storage back to variable + // + Status =3D gRT->SetVariable ( + gPcieVarstoreName, + &gPcieFormSetGuid, + EFI_VARIABLE_NON_VOLATILE | + EFI_VARIABLE_BOOTSERVICE_ACCESS | + EFI_VARIABLE_RUNTIME_ACCESS, + sizeof (ROOT_COMPLEX_CONFIG_VARSTORE_DATA), + (ROOT_COMPLEX_CONFIG_VARSTORE_DATA *)VarStoreConfig + ); + } + + return Status; +} + +/** + This function processes the results of changes in configuration. + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param Action Specifies the type of action taken by the= browser. + @param QuestionId A unique value which is sent to the origi= nal + exporting driver so that it can identify = the type + of data to expect. + @param Type The type of value for the question. + @param Value A pointer to the data being sent to the o= riginal + exporting driver. + @param ActionRequest On return, points to the action requested= by the + callback function. + @retval EFI_SUCCESS The callback successfully handled the act= ion. + @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold t= he + variable and its data. + @retval EFI_DEVICE_ERROR The variable could not be saved. + @retval EFI_UNSUPPORTED The specified Action is not supported by = the + callback. +**/ +EFI_STATUS +EFIAPI +DriverCallback ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN EFI_BROWSER_ACTION Action, + IN EFI_QUESTION_ID QuestionId, + IN UINT8 Type, + IN EFI_IFR_TYPE_VALUE *Value, + OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest + ) +{ + SCREEN_PRIVATE_DATA *PrivateData; + EFI_STATUS Status; + + if (((Value =3D=3D NULL) && + (Action !=3D EFI_BROWSER_ACTION_FORM_OPEN) && + (Action !=3D EFI_BROWSER_ACTION_FORM_CLOSE)) || + (ActionRequest =3D=3D NULL)) + { + return EFI_INVALID_PARAMETER; + } + + PrivateData =3D SCREEN_PRIVATE_FROM_THIS (This); + + Status =3D EFI_SUCCESS; + + switch (Action) { + case EFI_BROWSER_ACTION_FORM_OPEN: + break; + + case EFI_BROWSER_ACTION_FORM_CLOSE: + break; + + case EFI_BROWSER_ACTION_DEFAULT_STANDARD: + case EFI_BROWSER_ACTION_DEFAULT_MANUFACTURING: + if (QuestionId =3D=3D SMMU_PMU_ID) { + // + // SMMU PMU + // + Value->u32 =3D 0; + break; + } + + if (QuestionId =3D=3D STRONG_ORDERING_ID) { + // + // Strong Ordering + // + Value->u8 =3D STRONG_ORDERING_DEFAULT_OPTION_VALUE; + break; + } + + switch ((QuestionId - 0x8002) % MAX_EDITABLE_ELEMENTS) { + case 0: + Value->u8 =3D PcieRCActiveDefaultSetting ((QuestionId - 0x8002) / MA= X_EDITABLE_ELEMENTS, PrivateData); + break; + + case 1: + Value->u8 =3D PcieRCDevMapLowDefaultSetting ((QuestionId - 0x8002) /= MAX_EDITABLE_ELEMENTS, PrivateData); + break; + + case 2: + Value->u8 =3D PcieRCDevMapHighDefaultSetting ((QuestionId - 0x8002) = / MAX_EDITABLE_ELEMENTS, PrivateData); + break; + } + break; + + case EFI_BROWSER_ACTION_RETRIEVE: + case EFI_BROWSER_ACTION_CHANGING: + case EFI_BROWSER_ACTION_SUBMITTED: + break; + + default: + Status =3D EFI_UNSUPPORTED; + break; + } + + return Status; +} + +/** + This function return default settings for Dev Map Low. + + @param RootComplex RootComplex ID. + @param PrivateData Private data. + + @retval Default dev settings. +**/ +UINT8 +PcieRCDevMapLowDefaultSetting ( + IN UINTN RCIndex, + IN SCREEN_PRIVATE_DATA *PrivateData + ) +{ + AC01_ROOT_COMPLEX *RootComplex =3D GetRootComplex (RCIndex); + + return RootComplex->DefaultDevMapLow; +} + +/** + This function return default settings for Dev Map High. + + @param RootComplex RootComplex ID. + @param PrivateData Private data. + + @retval Default dev settings. +**/ +UINT8 +PcieRCDevMapHighDefaultSetting ( + IN UINTN RCIndex, + IN SCREEN_PRIVATE_DATA *PrivateData + ) +{ + AC01_ROOT_COMPLEX *RootComplex =3D GetRootComplex (RCIndex); + + return RootComplex->DefaultDevMapHigh; +} + +BOOLEAN +PcieRCActiveDefaultSetting ( + IN UINTN RCIndex, + IN SCREEN_PRIVATE_DATA *PrivateData + ) +{ + AC01_ROOT_COMPLEX *RootComplex =3D GetRootComplex (RCIndex); + + return RootComplex->DefaultActive; +} + +VOID * +CreateDevMapOptions ( + AC01_ROOT_COMPLEX *RootComplex + ) +{ + EFI_STRING_ID StringId; + VOID *OptionsOpCodeHandle; + + OptionsOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (OptionsOpCodeHandle !=3D NULL); + + StringId =3D RootComplex->Type =3D=3D RootComplexTypeA ? + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_VALUE0) : + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_VALUE4); + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + StringId, + 0, + EFI_IFR_NUMERIC_SIZE_1, + DevMapMode1 + ); + + StringId =3D RootComplex->Type =3D=3D RootComplexTypeA ? + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_VALUE1) : + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_VALUE5); + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + StringId, + 0, + EFI_IFR_NUMERIC_SIZE_1, + DevMapMode2 + ); + + StringId =3D RootComplex->Type =3D=3D RootComplexTypeA ? + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_VALUE2) : + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_VALUE6); + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + StringId, + 0, + EFI_IFR_NUMERIC_SIZE_1, + DevMapMode3 + ); + + StringId =3D RootComplex->Type =3D=3D RootComplexTypeA ? + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_VALUE3) : + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_VALUE7); + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + StringId, + 0, + EFI_IFR_NUMERIC_SIZE_1, + DevMapMode4 + ); + + return OptionsOpCodeHandle; +} + +/** + This function sets up the first elements of the form. + @param RootComplex RootComplex ID. + @param PrivateData Private data. + + @retval EFI_SUCCESS The form is set up successfully. +**/ +EFI_STATUS +PcieRCScreenSetup ( + IN UINTN RCIndex, + IN SCREEN_PRIVATE_DATA *PrivateData + ) +{ + AC01_ROOT_COMPLEX *RootComplex; + CHAR16 Str[MAX_STRING_SIZE]; + EFI_IFR_GUID_LABEL *EndLabel; + EFI_IFR_GUID_LABEL *StartLabel; + UINT16 BifurHiVarOffset; + UINT16 BifurLoVarOffset; + UINT16 DisabledStatusVarOffset; + UINT8 QuestionFlags, QuestionFlagsSubItem; + VOID *EndOpCodeHandle; + VOID *OptionsOpCodeHandle; + VOID *StartOpCodeHandle; + + RootComplex =3D GetRootComplex (RCIndex); + + // Initialize the container for dynamic opcodes + StartOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (StartOpCodeHandle !=3D NULL); + EndOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (EndOpCodeHandle !=3D NULL); + + // Create Hii Extend Label OpCode as the start opcode + StartLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode ( + StartOpCodeHandle, + &gEfiIfrTianoGuid, + NULL, + sizeof (EFI_IFR_GUID_LABEL) + ); + StartLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + StartLabel->Number =3D LABEL_RC0_UPDATE + 2 * RCIndex; + + // Create Hii Extend Label OpCode as the end opcode + EndLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode ( + EndOpCodeHandle, + &gEfiIfrTianoGuid, + NULL, + sizeof (EFI_IFR_GUID_LABEL) + ); + EndLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + EndLabel->Number =3D LABEL_RC0_END + 2 * RCIndex; + + // Create textbox to show the socket number which current Root Complex b= elongs to + HiiCreateTextOpCode ( + StartOpCodeHandle, + STRING_TOKEN (STR_PCIE_SOCKET), + STRING_TOKEN (STR_PCIE_SOCKET_HELP), + HiiSetString ( + PrivateData->HiiHandle, + 0, + (RootComplex->Socket) ? L"1" : L"0", + NULL + ) + ); + + // Create textbox to show the Root Complex type + HiiCreateTextOpCode ( + StartOpCodeHandle, + STRING_TOKEN (STR_PCIE_RC_TYPE), + STRING_TOKEN (STR_PCIE_RC_TYPE_HELP), + HiiSetString ( + PrivateData->HiiHandle, + 0, + (RootComplex->Type =3D=3D RootComplexTypeA) ? L"Root Complex Type-A"= : L"Root Complex Type-B", + NULL + ) + ); + + UnicodeSPrint (Str, sizeof (Str), L"Root Complex #%2d", RCIndex); + + DisabledStatusVarOffset =3D (UINT16)RC0_STATUS_OFFSET + sizeof (BOOLEAN)= * RCIndex; + BifurLoVarOffset =3D (UINT16)RC0_BIFUR_LO_OFFSET + sizeof (UINT8) * RCIn= dex; + BifurHiVarOffset =3D (UINT16)RC0_BIFUR_HI_OFFSET + sizeof (UINT8) * RCIn= dex; + + QuestionFlags =3D EFI_IFR_FLAG_RESET_REQUIRED | EFI_IFR_FLAG_CALLBACK; + if (IsEmptyRC (RootComplex) + || (GetNumberOfActiveSockets () =3D=3D 1 && RootComplex->Socket =3D= =3D 1)) + { + // + // Do not allow changing if none of Root Port underneath enabled + // or slave Root Complex on 1P system. + // + QuestionFlags |=3D EFI_IFR_FLAG_READ_ONLY; + } + + // Create the Root Complex Disable checkbox + HiiCreateCheckBoxOpCode ( + StartOpCodeHandle, // Container for dynamic cre= ated opcodes + 0x8002 + MAX_EDITABLE_ELEMENTS * RCIndex, // QuestionId (or "key") + VARSTORE_ID, // VarStoreId + DisabledStatusVarOffset, // VarOffset in Buffer Stora= ge + HiiSetString ( + PrivateData->HiiHandle, + 0, + Str, + NULL + ), // Prompt + STRING_TOKEN (STR_PCIE_RC_STATUS_HELP), // Help + QuestionFlags, // QuestionFlags + 0, // CheckBoxFlags + NULL // DefaultsOpCodeHandle + ); + + if (RootComplex->Type =3D=3D RootComplexTypeA) { + // + // Create Option OpCode to display bifurcation for RootComplexTypeA + // + OptionsOpCodeHandle =3D CreateDevMapOptions (RootComplex); + + if (RootComplex->DefaultDevMapLow !=3D 0) { + QuestionFlags |=3D EFI_IFR_FLAG_READ_ONLY; + } + + HiiCreateOneOfOpCode ( + StartOpCodeHandle, // Container for dynamic c= reated opcodes + 0x8003 + MAX_EDITABLE_ELEMENTS * RCIndex, // Question ID (or call it= "key") + VARSTORE_ID, // VarStore ID + BifurLoVarOffset, // Offset in Buffer Storage + STRING_TOKEN (STR_PCIE_RCA_BIFUR), // Question prompt text + STRING_TOKEN (STR_PCIE_RCA_BIFUR_HELP), // Question help text + QuestionFlags, // Question flag + EFI_IFR_NUMERIC_SIZE_1, // Data type of Question V= alue + OptionsOpCodeHandle, // Option Opcode list + NULL // Default Opcode is NULl + ); + } else { + // + // Create Option OpCode to display bifurcation for RootComplexTypeB-Low + // + OptionsOpCodeHandle =3D CreateDevMapOptions (RootComplex); + + QuestionFlagsSubItem =3D QuestionFlags; + if (RootComplex->DefaultDevMapLow !=3D 0) { + QuestionFlagsSubItem |=3D EFI_IFR_FLAG_READ_ONLY; + } + + HiiCreateOneOfOpCode ( + StartOpCodeHandle, // Container for dynamic = created opcodes + 0x8003 + MAX_EDITABLE_ELEMENTS * RCIndex, // Question ID (or call i= t "key") + VARSTORE_ID, // VarStore ID + BifurLoVarOffset, // Offset in Buffer Stora= ge + STRING_TOKEN (STR_PCIE_RCB_LO_BIFUR), // Question prompt text + STRING_TOKEN (STR_PCIE_RCB_LO_BIFUR_HELP), // Question help text + QuestionFlagsSubItem, // Question flag + EFI_IFR_NUMERIC_SIZE_1, // Data type of Question = Value + OptionsOpCodeHandle, // Option Opcode list + NULL // Default Opcode is NULl + ); + + // + // Create Option OpCode to display bifurcation for RootComplexTypeB-Hi= gh + // + OptionsOpCodeHandle =3D CreateDevMapOptions (RootComplex); + + QuestionFlagsSubItem =3D QuestionFlags; + if (RootComplex->DefaultDevMapHigh !=3D 0) { + QuestionFlagsSubItem |=3D EFI_IFR_FLAG_READ_ONLY; + } + + HiiCreateOneOfOpCode ( + StartOpCodeHandle, // Container for dynamic = created opcodes + 0x8004 + MAX_EDITABLE_ELEMENTS * RCIndex, // Question ID (or call i= t "key") + VARSTORE_ID, // VarStore ID + BifurHiVarOffset, // Offset in Buffer Stora= ge + STRING_TOKEN (STR_PCIE_RCB_HI_BIFUR), // Question prompt text + STRING_TOKEN (STR_PCIE_RCB_HI_BIFUR_HELP), // Question help text + QuestionFlagsSubItem, // Question flag + EFI_IFR_NUMERIC_SIZE_1, // Data type of Question = Value + OptionsOpCodeHandle, // Option Opcode list + NULL // Default Opcode is NULl + ); + } + + HiiUpdateForm ( + PrivateData->HiiHandle, // HII handle + &gPcieFormSetGuid, // Formset GUID + RC0_FORM_ID + RCIndex, // Form ID + StartOpCodeHandle, // Label for where to insert opcodes + EndOpCodeHandle // Insert data + ); + + HiiFreeOpCodeHandle (StartOpCodeHandle); + HiiFreeOpCodeHandle (EndOpCodeHandle); + + return EFI_SUCCESS; +} + +/** + This function sets up the first elements of the form. + + @param PrivateData Private data. + + @retval EFI_SUCCESS The form is set up successfully. +**/ +EFI_STATUS +PcieMainScreenSetup ( + IN SCREEN_PRIVATE_DATA *PrivateData + ) +{ + VOID *StartOpCodeHandle; + EFI_IFR_GUID_LABEL *StartLabel; + VOID *EndOpCodeHandle; + EFI_IFR_GUID_LABEL *EndLabel; + CHAR16 Str[MAX_STRING_SIZE]; + UINTN RootComplex; + SETUP_GOTO_DATA *GotoItem =3D NULL; + EFI_QUESTION_ID GotoId; + UINT8 QuestionFlags; + + // Initialize the container for dynamic opcodes + StartOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (StartOpCodeHandle !=3D NULL); + EndOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (EndOpCodeHandle !=3D NULL); + + // Create Hii Extend Label OpCode as the start opcode + StartLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode ( + StartOpCodeHandle, + &gEfiIfrTianoGuid, + NULL, + sizeof (EFI_IFR_GUID_LABEL) + ); + StartLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + StartLabel->Number =3D LABEL_UPDATE; + + // Create Hii Extend Label OpCode as the end opcode + EndLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode ( + EndOpCodeHandle, + &gEfiIfrTianoGuid, + NULL, + sizeof (EFI_IFR_GUID_LABEL) + ); + EndLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + EndLabel->Number =3D LABEL_END; + + QuestionFlags =3D EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED; + + HiiCreateCheckBoxOpCode ( + StartOpCodeHandle, // Container for dynamic crea= ted opcodes + SMMU_PMU_ID, // Question ID + VARSTORE_ID, // VarStore ID + (UINT16)SMMU_PMU_OFFSET, // Offset in Buffer Storage + STRING_TOKEN (STR_PCIE_SMMU_PMU_PROMPT), // Question prompt text + STRING_TOKEN (STR_PCIE_SMMU_PMU_HELP), // Question help text + QuestionFlags, + 0, + NULL + ); + + if (mReadOnlyStrongOrdering) { + QuestionFlags |=3D EFI_IFR_FLAG_READ_ONLY; + } + + HiiCreateCheckBoxOpCode ( + StartOpCodeHandle, // Container for dynam= ic created opcodes + STRONG_ORDERING_ID, // Question ID + NVPARAM_VARSTORE_ID, // VarStore ID + (UINT16)STRONG_ORDERING_OFFSET, // Offset in Buffer St= orage + STRING_TOKEN (STR_PCIE_STRONG_ORDERING_PROMPT), // Question prompt text + STRING_TOKEN (STR_PCIE_STRONG_ORDERING_HELP), // Question help text + QuestionFlags, + STRONG_ORDERING_DEFAULT_OPTION_VALUE, + NULL + ); + + // + // Create the a seperated line + // + HiiCreateTextOpCode ( + StartOpCodeHandle, + STRING_TOKEN (STR_PCIE_FORM_SEPERATE_LINE), + STRING_TOKEN (STR_PCIE_FORM_SEPERATE_LINE), + STRING_TOKEN (STR_PCIE_FORM_SEPERATE_LINE) + ); + + // Create Goto form for each RootComplex + for (RootComplex =3D 0; RootComplex < AC01_PCIE_MAX_ROOT_COMPLEX; RootCo= mplex++) { + + GotoItem =3D AllocateZeroPool (sizeof (SETUP_GOTO_DATA)); + if (GotoItem =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + GotoItem->PciDevIdx =3D RootComplex; + + GotoId =3D GOTO_ID_BASE + (UINT16)RootComplex; + + // Update HII string + UnicodeSPrint (Str, sizeof (Str), L"Root Complex #%2d", RootComplex); + GotoItem->GotoStringId =3D HiiSetString ( + PrivateData->HiiHandle, + 0, + Str, + NULL + ); + GotoItem->GotoHelpStringId =3D STRING_TOKEN (STR_PCIE_GOTO_HELP); + GotoItem->ShowItem =3D TRUE; + + // Add goto control + HiiCreateGotoOpCode ( + StartOpCodeHandle, + RC0_FORM_ID + RootComplex, + GotoItem->GotoStringId, + GotoItem->GotoHelpStringId, + EFI_IFR_FLAG_CALLBACK, + GotoId + ); + } + + HiiUpdateForm ( + PrivateData->HiiHandle, // HII handle + &gPcieFormSetGuid, // Formset GUID + FORM_ID, // Form ID + StartOpCodeHandle, // Label for where to insert opcodes + EndOpCodeHandle // Insert data + ); + + HiiFreeOpCodeHandle (StartOpCodeHandle); + HiiFreeOpCodeHandle (EndOpCodeHandle); + + return EFI_SUCCESS; +} + +VOID +NVParamVarstoreInit ( + VOID + ) +{ + BOOLEAN BoardSettingValid; + BOOLEAN UserSettingValid; + BOOLEAN Update; + EFI_STATUS Status; + UINT32 UserValue; + UINT32 InitValue; + + mReadOnlyStrongOrdering =3D FALSE; + + // S0 + UserSettingValid =3D FALSE; + Status =3D NVParamGet ( + NV_SI_MESH_S0_CXG_RC_STRONG_ORDERING_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &UserValue + ); + if (!EFI_ERROR (Status)) { + UserSettingValid =3D TRUE; + } + + // + // InitValue will be default value or board setting value. + // + BoardSettingValid =3D FALSE; + Status =3D NVParamGet ( + NV_SI_RO_BOARD_MESH_S0_CXG_RC_STRONG_ORDERING_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &InitValue + ); + if (!EFI_ERROR (Status) && InitValue > 0) { + BoardSettingValid =3D TRUE; + mReadOnlyStrongOrdering =3D TRUE; + } else { + InitValue =3D STRONG_ORDERING_DEFAULT_NVPARAM_VALUE; + } + + Update =3D TRUE; + if ((UserSettingValid && (UserValue =3D=3D InitValue)) + || (!BoardSettingValid && UserSettingValid && (UserValue =3D=3D 0)))= { + Update =3D FALSE; + } + + if (Update) { + Status =3D NVParamSet ( + NV_SI_MESH_S0_CXG_RC_STRONG_ORDERING_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + InitValue + ); + ASSERT_EFI_ERROR (Status); + } + + // + // No need to check slave present. + // + UserSettingValid =3D FALSE; + Status =3D NVParamGet ( + NV_SI_MESH_S1_CXG_RC_STRONG_ORDERING_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &UserValue + ); + if (!EFI_ERROR (Status)) { + UserSettingValid =3D TRUE; + } + + // + // InitValue will be default value or board setting value. + // + BoardSettingValid =3D FALSE; + Status =3D NVParamGet ( + NV_SI_RO_BOARD_MESH_S1_CXG_RC_STRONG_ORDERING_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &InitValue + ); + if (!EFI_ERROR (Status) && InitValue > 0) { + BoardSettingValid =3D TRUE; + mReadOnlyStrongOrdering =3D TRUE; + } else { + InitValue =3D STRONG_ORDERING_DEFAULT_NVPARAM_VALUE; + } + + Update =3D TRUE; + if ((UserSettingValid && (UserValue =3D=3D InitValue)) + || (!BoardSettingValid && UserSettingValid && (UserValue =3D=3D 0)))= { + Update =3D FALSE; + } + + if (Update) { + Status =3D NVParamSet ( + NV_SI_MESH_S1_CXG_RC_STRONG_ORDERING_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + InitValue + ); + ASSERT_EFI_ERROR (Status); + } +} + +/** + Build PCIe menu screen. + + @retval EFI_SUCCESS The operation is successful. + + @retval Others An error occurred. +**/ +EFI_STATUS +EFIAPI +RootComplexDriverEntry ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + AC01_ROOT_COMPLEX *RootComplex; + BOOLEAN IsUpdated; + EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL *HiiKeywordHandler; + EFI_HANDLE DriverHandle; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + EFI_HII_DATABASE_PROTOCOL *HiiDatabase; + EFI_HII_HANDLE HiiHandle; + EFI_HII_STRING_PROTOCOL *HiiString; + EFI_STATUS Status; + ROOT_COMPLEX_CONFIG_VARSTORE_DATA *VarStoreConfig; + UINT8 RCIndex; + UINTN BufferSize; + + // + // Initialize driver private data + // + mPrivateData =3D AllocateZeroPool (sizeof (SCREEN_PRIVATE_DATA)); + if (mPrivateData =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + mPrivateData->Signature =3D SCREEN_PRIVATE_DATA_SIGNATURE; + mPrivateData->ConfigAccess.ExtractConfig =3D ExtractConfig; + mPrivateData->ConfigAccess.RouteConfig =3D RouteConfig; + mPrivateData->ConfigAccess.Callback =3D DriverCallback; + + // + // Locate Hii Database protocol + // + Status =3D gBS->LocateProtocol ( + &gEfiHiiDatabaseProtocolGuid, + NULL, + (VOID **)&HiiDatabase + ); + if (EFI_ERROR (Status)) { + return Status; + } + mPrivateData->HiiDatabase =3D HiiDatabase; + + // + // Locate HiiString protocol + // + Status =3D gBS->LocateProtocol ( + &gEfiHiiStringProtocolGuid, + NULL, + (VOID **)&HiiString + ); + if (EFI_ERROR (Status)) { + return Status; + } + mPrivateData->HiiString =3D HiiString; + + // + // Locate ConfigRouting protocol + // + Status =3D gBS->LocateProtocol ( + &gEfiHiiConfigRoutingProtocolGuid, + NULL, + (VOID **)&HiiConfigRouting + ); + if (EFI_ERROR (Status)) { + return Status; + } + mPrivateData->HiiConfigRouting =3D HiiConfigRouting; + + // + // Locate keyword handler protocol + // + Status =3D gBS->LocateProtocol ( + &gEfiConfigKeywordHandlerProtocolGuid, + NULL, + (VOID **)&HiiKeywordHandler + ); + if (EFI_ERROR (Status)) { + return Status; + } + mPrivateData->HiiKeywordHandler =3D HiiKeywordHandler; + + DriverHandle =3D NULL; + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &DriverHandle, + &gEfiDevicePathProtocolGuid, + &mHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &mPrivateData->ConfigAccess, + NULL + ); + ASSERT_EFI_ERROR (Status); + + mPrivateData->DriverHandle =3D DriverHandle; + + // + // Publish our HII data + // + HiiHandle =3D HiiAddPackages ( + &gPcieFormSetGuid, + DriverHandle, + RootComplexConfigDxeStrings, + RootComplexConfigVfrBin, + NULL + ); + if (HiiHandle =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + mPrivateData->HiiHandle =3D HiiHandle; + + // + // Initialize NVParam varstore configuration data + // + NVParamVarstoreInit (); + + // + // Initialize efi varstore configuration data + // + VarStoreConfig =3D &mPrivateData->VarStoreConfig; + ZeroMem (VarStoreConfig, sizeof (ROOT_COMPLEX_CONFIG_VARSTORE_DATA)); + + // Get Buffer Storage data from EFI variable + BufferSize =3D sizeof (ROOT_COMPLEX_CONFIG_VARSTORE_DATA); + Status =3D gRT->GetVariable ( + gPcieVarstoreName, + &gPcieFormSetGuid, + NULL, + &BufferSize, + VarStoreConfig + ); + + IsUpdated =3D FALSE; + + if (EFI_ERROR (Status)) { + VarStoreConfig->SmmuPmu =3D 0; /* Disable by default */ + IsUpdated =3D TRUE; + } + // Update board settings to menu + for (RCIndex =3D 0; RCIndex < AC01_PCIE_MAX_ROOT_COMPLEX; RCIndex++) { + RootComplex =3D GetRootComplex (RCIndex); + + if (EFI_ERROR (Status)) { + VarStoreConfig->RCBifurcationLow[RCIndex] =3D RootComplex->DevMapLow; + VarStoreConfig->RCBifurcationHigh[RCIndex] =3D RootComplex->DevMapHi= gh; + VarStoreConfig->RCStatus[RCIndex] =3D RootComplex->Active; + IsUpdated =3D TRUE; + } + } + + if (IsUpdated) { + // Update Buffer Storage + Status =3D gRT->SetVariable ( + gPcieVarstoreName, + &gPcieFormSetGuid, + EFI_VARIABLE_NON_VOLATILE | + EFI_VARIABLE_BOOTSERVICE_ACCESS | + EFI_VARIABLE_RUNTIME_ACCESS, + sizeof (ROOT_COMPLEX_CONFIG_VARSTORE_DATA), + VarStoreConfig + ); + if (EFI_ERROR (Status)) { + return Status; + } + } + Status =3D PcieMainScreenSetup (mPrivateData); + ASSERT_EFI_ERROR (Status); + + for (RCIndex =3D 0; RCIndex < AC01_PCIE_MAX_ROOT_COMPLEX; RCIndex++) { + Status =3D PcieRCScreenSetup (RCIndex, mPrivateData); + ASSERT_EFI_ERROR (Status); + } + + return Status; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/Roo= tComplexConfigDxe.uni b/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexCo= nfigDxe/RootComplexConfigDxe.uni new file mode 100644 index 000000000000..f28fda05def9 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComple= xConfigDxe.uni @@ -0,0 +1,102 @@ +// +// Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// + +#langdef en-US "English" + +#string STR_PCIE_FORM #language en-US "PCIe Root Complex= Configuration" +#string STR_PCIE_FORM_HELP #language en-US "Configure Root Co= mplex" + +#string STR_PCIE_FORM_SEPERATE_LINE #language en-US "" + +///// + +#string STR_PCIE_GOTO #language en-US "" +#string STR_PCIE_GOTO_HELP #language en-US "Change On Board R= oot Complex Settings." + +#string STR_PCIE_RC_STATUS #language en-US "" +#string STR_PCIE_RC_STATUS_HELP #language en-US "Enable / Disable = Root Complex" + +#string STR_PCIE_RCA_BIFUR #language en-US "Bifurcation x16" +#string STR_PCIE_RCA_BIFUR_HELP #language en-US "Set bifurcation m= ode for x16 Root Complex Type-A" + +#string STR_PCIE_RCB_LO_BIFUR #language en-US "Bifurcation 1st x= 8" +#string STR_PCIE_RCB_LO_BIFUR_HELP #language en-US "Set bifurcation m= ode for 1st x8 Root Complex Type-B" + +#string STR_PCIE_RCB_HI_BIFUR #language en-US "Bifurcation 2nd x= 8" +#string STR_PCIE_RCB_HI_BIFUR_HELP #language en-US "Set bifurcation m= ode for 2nd x8 Root Complex Type-B" + +///// + +#string STR_PCIE_RC0_FORM #language en-US "Root Complex 0 Co= nfiguration" +#string STR_PCIE_RC0_FORM_HELP #language en-US "Root Complex 0 Co= nfiguration" + +#string STR_PCIE_RC1_FORM #language en-US "Root Complex 1 Co= nfiguration" +#string STR_PCIE_RC1_FORM_HELP #language en-US "Root Complex 1 Co= nfiguration" + +#string STR_PCIE_RC2_FORM #language en-US "Root Complex 2 Co= nfiguration" +#string STR_PCIE_RC2_FORM_HELP #language en-US "Root Complex 2 Co= nfiguration" + +#string STR_PCIE_RC3_FORM #language en-US "Root Complex 3 Co= nfiguration" +#string STR_PCIE_RC3_FORM_HELP #language en-US "Root Complex 3 Co= nfiguration" + +#string STR_PCIE_RC4_FORM #language en-US "Root Complex 4 Co= nfiguration" +#string STR_PCIE_RC4_FORM_HELP #language en-US "Root Complex 4 Co= nfiguration" + +#string STR_PCIE_RC5_FORM #language en-US "Root Complex 5 Co= nfiguration" +#string STR_PCIE_RC5_FORM_HELP #language en-US "Root Complex 5 Co= nfiguration" + +#string STR_PCIE_RC6_FORM #language en-US "Root Complex 6 Co= nfiguration" +#string STR_PCIE_RC6_FORM_HELP #language en-US "Root Complex 6 Co= nfiguration" + +#string STR_PCIE_RC7_FORM #language en-US "Root Complex 7 Co= nfiguration" +#string STR_PCIE_RC7_FORM_HELP #language en-US "Root Complex 7 Co= nfiguration" + +#string STR_PCIE_RC8_FORM #language en-US "Root Complex 8 Co= nfiguration" +#string STR_PCIE_RC8_FORM_HELP #language en-US "Root Complex 8 Co= nfiguration" + +#string STR_PCIE_RC9_FORM #language en-US "Root Complex 9 Co= nfiguration" +#string STR_PCIE_RC9_FORM_HELP #language en-US "Root Complex 9 Co= nfiguration" + +#string STR_PCIE_RC10_FORM #language en-US "Root Complex 10 C= onfiguration" +#string STR_PCIE_RC10_FORM_HELP #language en-US "Root Complex 10 C= onfiguration" + +#string STR_PCIE_RC11_FORM #language en-US "Root Complex 11 C= onfiguration" +#string STR_PCIE_RC11_FORM_HELP #language en-US "Root Complex 11 C= onfiguration" + +#string STR_PCIE_RC12_FORM #language en-US "Root Complex 12 C= onfiguration" +#string STR_PCIE_RC12_FORM_HELP #language en-US "Root Complex 12 C= onfiguration" + +#string STR_PCIE_RC13_FORM #language en-US "Root Complex 13 C= onfiguration" +#string STR_PCIE_RC13_FORM_HELP #language en-US "Root Complex 13 C= onfiguration" + +#string STR_PCIE_RC14_FORM #language en-US "Root Complex 14 C= onfiguration" +#string STR_PCIE_RC14_FORM_HELP #language en-US "Root Complex 14 C= onfiguration" + +#string STR_PCIE_RC15_FORM #language en-US "Root Complex 15 C= onfiguration" +#string STR_PCIE_RC15_FORM_HELP #language en-US "Root Complex 15 C= onfiguration" + +#string STR_PCIE_BIFUR_SELECT_VALUE0 #language en-US "x16" +#string STR_PCIE_BIFUR_SELECT_VALUE1 #language en-US "x8+x8" +#string STR_PCIE_BIFUR_SELECT_VALUE2 #language en-US "x8+x4+x4" +#string STR_PCIE_BIFUR_SELECT_VALUE3 #language en-US "x4+x4+x4+x4" +#string STR_PCIE_BIFUR_SELECT_VALUE4 #language en-US "x8" +#string STR_PCIE_BIFUR_SELECT_VALUE5 #language en-US "x4+x4" +#string STR_PCIE_BIFUR_SELECT_VALUE6 #language en-US "x4+x2+x2" +#string STR_PCIE_BIFUR_SELECT_VALUE7 #language en-US "x2+x2+x2+x2" + +#string STR_PCIE_SOCKET #language en-US "Socket" +#string STR_PCIE_SOCKET_HELP #language en-US "Socket 0 - Master= ; Socket 1 - Slave" +#string STR_PCIE_SOCKET_VALUE #language en-US "" + +#string STR_PCIE_RC_TYPE #language en-US "Type" +#string STR_PCIE_RC_TYPE_HELP #language en-US "Type-A: x16 lanes= bifurcated down to x4; Type-B: 2 of x8 lanes, each bifurcated down to x2" +#string STR_PCIE_RC_TYPE_VALUE #language en-US "" + +#string STR_PCIE_SMMU_PMU_PROMPT #language en-US "SMMU Pmu" +#string STR_PCIE_SMMU_PMU_HELP #language en-US "Enable/Disable PM= U feature for SMMU" + +#string STR_PCIE_STRONG_ORDERING_PROMPT #language en-US "PCIe Strong Order= ing" +#string STR_PCIE_STRONG_ORDERING_HELP #language en-US "Enable/disable PC= Ie Strong Ordering with internal bus" --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83836): https://edk2.groups.io/g/devel/message/83836 Mute This Topic: https://groups.io/mt/87123906/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83837+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83837+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167855902773.555700140729; Wed, 17 Nov 2021 08:50:55 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id RlcfYY1788612xmfqoZjclY6; Wed, 17 Nov 2021 08:50:55 -0800 X-Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.107.92.115]) by mx.groups.io with SMTP id smtpd.web11.9792.1637167854688814086 for ; Wed, 17 Nov 2021 08:50:55 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m50NB52i3WyzHWveCN+z+w3W7JRcbAN1mtZeMfvzQD53TPLRuHDJ/E7hj3ekBAqQ15JdNXvfXyPfH8dZadQ5BFsK9VzzS6tsUkEX5LDEavpOrMASQcpIBDUfBR7wbf7vdvwxfGd7KWCvMgldaVVkkTGsKltEH50aXGEQsgsDstnbzU/z4KScYIpCyHGBguNnWzBngql8veZpv0kJrLRXWHsG8gpM78pRZJtRqHUCG4uHZrU8iTh2A/c+wgkLb9yqcwzdRLg5nj/xnUVkCqIFqI/Wv08AfihviILq4dWJQpGgCpt4MHaV5Z1c/al+ntGLVUSclZ+wsxnNKUqB2wEN2A== 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=6JecveFthjg0jYJ+kOAIoPkmwZ9VgUGUR/WIneSLfkg=; b=lDAJcs02t5IcarUoXqk396dF+jO7BOwyxTNPkzklvwklnbJbeLvvbIWrigmrdhqIlvZyXERTH9HmDRjare5EGI3jVT1i/LANeJbbs1WeN9nDKD7Mwkp8Vg+uqYGKcCvlcp4TwKezmwO0c+C4O531OD/b+pG/wsvYBwT6ODwxs/L+IYrjLU4Ii3zjlxxM9xicvoF1rQL6vvcCheWFvLnRyoc72QM2+HHRdT5kt/icotNkGhv47Ad9uom+o/xbB1+7KBXs9vmt16HOKRKx97UFolwxLJUOn4eG5deaiSkjeWFtYTI5JIGugt7zlCDbro1mPpGK0zfyelk95sjeS55+mA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB7521.prod.exchangelabs.com (2603:10b6:510:f4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Wed, 17 Nov 2021 16:50:53 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:53 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 24/30] Ampere: Utilize the PCIe User setting Date: Wed, 17 Nov 2021 23:47:21 +0700 Message-ID: <20211117164727.10922-25-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:50:50 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4ad7842d-bd5c-469c-6d94-08d9a9ea6ac3 X-MS-TrafficTypeDiagnostic: PH0PR01MB7521: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: tmh6KZ71Tf3g+6qXPSun17Or86kIzt5BtqJ2rPnGgUePvyzIGfcEDb4lGuUGnc3o1QmUyNOxF+buN4aKYTLBcqW6UNXD2PNmdxz1zsNxP1afpm6FCAlcKW8uT1S9WmJOpSW1bOkG90FHzntdZij+S8jAs0FYlnesARTW9t/8iXKzH4Md822jVXEuIbKps4JwYpy0zYrbhR6K7//DrSZNN/swmTH/l+cdZd4boGbAwNoQSVOaQ52fA9UrzL9UrnB7nxaHbpO6otQKZ6HsKvFWHLNfS0KoCmsU89Pu2OBa1TfjaYSAPwtl6dYdjmyc7hBGVmCsNM2N+Zd/Xif6ksix+9U8/V6wCl7RcNr2JmPoBz/MPOaKbe0jkUThl2YVTFaYeZhqQ9w4CGFls1ZNx4XEHGMaob1OOd+mH74IAp6vpamsOvbHBUXhBrG3g1pFiFx21b20ZYVYxQRPvK1EzBTpGA7NQuSr2b/nP6EmjNTsviejokMMgQg6tWTqz3cnUwtcs7tC9TTj6pzuzDXxv1R5p3/ufBQRSaPeUKei4w2CQ2KlNPH26dfA1EtVI4C5bpdu27rVBImQ7kGq3ul1YrieRNsEpVNH4CwlQc6l/huYQ7vemest3YtLeOx5EFURm8o2DIEjXI07U3poS6zuumfJXvXAJkVj/Dggx3OPnhe2Qu1Ap01uL0o5h8ah5yJE/2AHUaxVIGMc6nYbCzXrTD/r/g== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?5+WHdOuce+sk6H1403mP6MuIgVr09zOdESIguZwbkv7QRVnzOxGPkch6Zzxi?= =?us-ascii?Q?h7hb1fcXjqwqXxe7/1F31fp2OTQCE42cBsdYNbZc9qso7dfB6WYEqXMTQ7dy?= =?us-ascii?Q?nZ6SUPPpsphZm+/2RKIug57NpY8pf10f56/aDUoqYPdNLD0hVYxtdR49L1RC?= =?us-ascii?Q?Xbi8aSHsAl6o7bWmnh5U7cQik/K8AydorIOg9ogSw9uDOYtcIvsCkR53/Fsc?= =?us-ascii?Q?BRd306Zf+ubKELD0D4kWe/oE0kA013QE/gGyj9mnLy/eNADPWPzsQuF2EFOn?= =?us-ascii?Q?zHWapfDDVU61wCSOX7R3oBeBuuGxVzjlkSUnlvcp2wcQwPrGgDhurcZwEgaU?= =?us-ascii?Q?xCKSKkqxAFBMg6huVO4qHjnhZjnSNx7Uq612ovXeixk0tMzWzOUxlNmHjFll?= =?us-ascii?Q?CTPFWRp1qGloHXCKu7W51tFbMZNtB30GO3PmrPEPbDGFH5tPLI0uVODB48sG?= =?us-ascii?Q?dzC85aUwIulX24hE1sQ19oAaUoOVjDr2aTY0M47jJC9zib2yoP3oH2zNkdqg?= =?us-ascii?Q?IBUUGf94GhTPaaDYgCsOfdSAdvmvqBHG6u442BURQ7AgKFXjGCETyTsh9s8J?= =?us-ascii?Q?33hKDhb3ISpIrrRBNlmt6i4k58aAbvnWYaVTsEvAz15gXIRgVLKBWyVT6bat?= =?us-ascii?Q?4JUvTrN2Bj+RcMm8ABVaLahqMlBr2d4X/85+sqhdPJ17+hGaN5UgzCmB/ZeW?= =?us-ascii?Q?s7QQ7tk2gDvWxes/Q7LzYvyXUChuztCDzvskD4RX7zBzcXGhWQZ6pHL6qMGG?= =?us-ascii?Q?cnAsOSuQZ36Zpjn3Y+wcp+IgOobGITY/7SjZmIO3GuMC/tcnQAY1mhWHAlRo?= =?us-ascii?Q?BPfINU0m59Zpc9wO0rZdqnzgxLyqZP7w7GNW5/qpS2N4NZnASW4BCfgteN1b?= =?us-ascii?Q?6UKLXrlxct/e0x/vLKRG7C3XgBGCL2mYcXCW1iX5aPvhd82VDkv3L/Bcnmel?= =?us-ascii?Q?SAF1gM1cy1zbL7dNPG7qC1CeddoFfUhYAPxabnt8VfYDS6IglpmLtovjREcY?= =?us-ascii?Q?xYzRgQAfsgwHDDcKalihO1sSGoMgAVuiQDXKKRk3oaUlkTe03ODj59tl2Cg/?= =?us-ascii?Q?RzgtBpbsb6WuYlhoHMlkfQ91Twmp/qUakeORxC8TyFuXDY8sJFG57nbOTg01?= =?us-ascii?Q?++WlgwmWtltFLZTL4gHdhSe3iTYizV4lEtrbdL65UX6JS6t+braC3R4NLVZu?= =?us-ascii?Q?ao8PSPNF8QA7uVro0+0o8v/FMyHFwHsq13kytNiLA/xG2itP7wpaWB3l76jN?= =?us-ascii?Q?w4yW2xNGSVnL0LL73B1hXv9TxPLygNfZpuZBixdFTTM0Sqr5Vm+cG4CU3EQy?= =?us-ascii?Q?DlzhgkLAvvksMZj9o0YgyUthEg1pUkE3S4xmFpO2PY7EKzbEK+U9D4A7pQre?= =?us-ascii?Q?1/k2ZkFDARDcwWSmMjFenVAjXAeHrftkRgHYH0qgmwfUYJ+l2cTq99e9C2qC?= =?us-ascii?Q?p/AfLekniruWOpiNFLPFwk7ZfiM7wytyFoajKno2py5ec5dIO1Ot11LvTMTp?= =?us-ascii?Q?dkwp+fPV3Ue7KB96i/jkyeU4ij/nrk+xd5Id452gF2i8xXGB2recoDX2yP+N?= =?us-ascii?Q?zbQnAPV97ulaVNV8iDzJZ8Zv2BFSo4CKyqd7psumCcYMCkRNQ/MjryhKmVL9?= =?us-ascii?Q?plZ/bCoRcq/Qkjicg/vYbNCdiFDvjkMizO9PFcNRgyhz7zk4Pv+pTclXtHeH?= =?us-ascii?Q?flzQh+BLhfjeieK0ZJ7XCRtA+n8=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4ad7842d-bd5c-469c-6d94-08d9a9ea6ac3 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:53.0619 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: T/AvV3BEw237ZRuhsaJpFRyWQ8bV848GMCPe4fR7VOhJt1qEbKv36921CrXrAV7uU71qxhn2K7TSWJcCeY/eMRl6PynEb7TKuVURMEisIRI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7521 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: iOLymvaPWEIRFsEtMGMkht48x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167855; bh=mrs9pP6qYZcPyIHQol9wnZWs8TX88CCBcVDbnAJ4SO4=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=Z1ncAk4bW9F/jXg52hI11pcrHAeiSZok/naOyfpOhUvL2Rl/r0r6LFkD96RwdSTeTK6 1jLOeICZzLMFrazR0tzh2Rb7BApEshVk2yJsYL5rw7dNPl2xoiUl07psfFAx9LvksUQwA 8eteAeSvZNlDl7ma5PpMViP4B818SmJHeQs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167857354100002 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen This change allows to configure the PCIe bifurcation mode and update the ACPI IORT tables based on the PCIe User setting. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 2 + Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf | 5 += ++ Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiIort.c | 32 += +++++++++++---- Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.c | 40 += +++++++++++++++++-- 4 files changed, 69 insertions(+), 10 deletions(-) diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDx= e.inf b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf index 415f795d2a54..804e761a1524 100644 --- a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf @@ -52,6 +52,7 @@ [LibraryClasses] UefiBootServicesTableLib UefiDriverEntryPoint UefiLib + UefiRuntimeServicesTableLib =20 [Pcd] gArmPlatformTokenSpaceGuid.PcdCoreCount @@ -70,6 +71,7 @@ [Guids] gEfiEventReadyToBootGuid gPlatformInfoHobGuid gRootComplexInfoHobGuid + gRootComplexConfigFormSetGuid =20 [Protocols] gEfiAcpiTableProtocolGuid ## ALWAYS_CONSUMED diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.= inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf index 17ac1672dac8..32d60bec1440 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.inf @@ -31,9 +31,14 @@ [LibraryClasses] DebugLib HobLib PeimEntryPoint + PeiServicesLib + +[Ppis] + gEfiPeiReadOnlyVariable2PpiGuid =20 [Guids] gRootComplexInfoHobGuid + gRootComplexConfigFormSetGuid gPlatformInfoHobGuid =20 [Depex] diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiIort.c b/P= latform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiIort.c index b8f8cfa356af..97be85c51f25 100644 --- a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiIort.c +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiIort.c @@ -7,6 +7,7 @@ **/ =20 #include +#include #include #include #include @@ -17,6 +18,7 @@ #include #include #include +#include #include #include =20 @@ -282,8 +284,10 @@ AcpiInstallIort ( EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; EFI_STATUS Status; INT32 EnabledRCs[AC01_PCIE_MAX_ROOT_COMPLEX]; + ROOT_COMPLEX_CONFIG_VARSTORE_DATA VarStoreConfig; UINT32 RcCount, SmmuPmuAgentCount, TotalCount; UINT8 Idx; + UINTN BufferSize; UINTN TableKey; VOID *Hob; VOID *IortBuffer; @@ -313,14 +317,28 @@ AcpiInstallIort ( } =20 SmmuPmuAgentCount =3D 0; - for (Idx =3D 0; Idx < RcCount; Idx++) { - if (mRootComplexList[EnabledRCs[Idx]].Type =3D=3D RootComplexTypeA) { - SmmuPmuAgentCount +=3D AC01_RCA_MAX_TBU_PMU; - } else { - SmmuPmuAgentCount +=3D AC01_RCB_MAX_TBU_PMU; + + // + // Check SMMU setting + // + BufferSize =3D sizeof (VarStoreConfig); + Status =3D gRT->GetVariable ( + ROOT_COMPLEX_CONFIG_VARSTORE_NAME, + &gRootComplexConfigFormSetGuid, + NULL, + &BufferSize, + &VarStoreConfig + ); + if (!EFI_ERROR (Status) && VarStoreConfig.SmmuPmu) { + for (Idx =3D 0; Idx < RcCount; Idx++) { + if (mRootComplexList[EnabledRCs[Idx]].Type =3D=3D RootComplexTypeA) { + SmmuPmuAgentCount +=3D AC01_RCA_MAX_TBU_PMU; + } else { + SmmuPmuAgentCount +=3D AC01_RCB_MAX_TBU_PMU; + } + // Plus 1 TCU + SmmuPmuAgentCount +=3D 1; } - // Plus 1 TCU - SmmuPmuAgentCount +=3D 1; } =20 TotalCount =3D sizeof (EFI_ACPI_6_0_IO_REMAPPING_TABLE) + diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.= c b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.c index cdd907d378e8..17f6112ea207 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.c +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/PcieInitPei.c @@ -8,6 +8,7 @@ =20 #include =20 +#include #include #include #include @@ -15,7 +16,9 @@ #include #include #include +#include #include +#include =20 #include "RootComplexNVParam.h" =20 @@ -43,8 +46,39 @@ BuildRootComplexData ( ) { AC01_ROOT_COMPLEX *RootComplex; + BOOLEAN ConfigFound; + EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariablePpi; + EFI_STATUS Status; + ROOT_COMPLEX_CONFIG_VARSTORE_DATA RootComplexConfig; UINT8 RCIndex; UINT8 PcieIndex; + UINTN DataSize; + + ConfigFound =3D FALSE; + + // + // Get the Root Complex config from NVRAM + // + Status =3D PeiServicesLocatePpi ( + &gEfiPeiReadOnlyVariable2PpiGuid, + 0, + NULL, + (VOID **)&VariablePpi + ); + if (!EFI_ERROR (Status)) { + DataSize =3D sizeof (RootComplexConfig); + Status =3D VariablePpi->GetVariable ( + VariablePpi, + ROOT_COMPLEX_CONFIG_VARSTORE_NAME, + &gRootComplexConfigFormSetGuid, + NULL, + &DataSize, + &RootComplexConfig + ); + if (!EFI_ERROR (Status)) { + ConfigFound =3D TRUE; + } + } =20 ZeroMem (&mRootComplexList, sizeof (AC01_ROOT_COMPLEX) * AC01_PCIE_MAX_R= OOT_COMPLEX); =20 @@ -58,9 +92,9 @@ BuildRootComplexData ( =20 for (RCIndex =3D 0; RCIndex < AC01_PCIE_MAX_ROOT_COMPLEX; RCIndex++) { RootComplex =3D &mRootComplexList[RCIndex]; - RootComplex->Active =3D TRUE; - RootComplex->DevMapLow =3D 0; - RootComplex->DevMapHigh =3D 0; + RootComplex->Active =3D ConfigFound ? RootComplexConfig.RCStatus[RCInd= ex] : TRUE; + RootComplex->DevMapLow =3D ConfigFound ? RootComplexConfig.RCBifurcati= onLow[RCIndex] : 0; + RootComplex->DevMapHigh =3D ConfigFound ? RootComplexConfig.RCBifurcat= ionLow[RCIndex] : 0; RootComplex->Socket =3D RCIndex / AC01_PCIE_MAX_RCS_PER_SOCKET; RootComplex->ID =3D RCIndex % AC01_PCIE_MAX_RCS_PER_SOCKET; RootComplex->CsrBase =3D mCsrBase[RCIndex]; --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83837): https://edk2.groups.io/g/devel/message/83837 Mute This Topic: https://groups.io/mt/87123908/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83838+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83838+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167858812451.5214337157979; Wed, 17 Nov 2021 08:50:58 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id REQDYY1788612xQ9xgohX69f; Wed, 17 Nov 2021 08:50:58 -0800 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.106]) by mx.groups.io with SMTP id smtpd.web12.9721.1637167857639626033 for ; Wed, 17 Nov 2021 08:50:57 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NvODhNo1Ped4hY8rbjuv+dHjW3KIJPvS5k4E1xaYhGFG7dAir9jDQ9I6Zln995/20QeRWnJlWOI96T36c3ZxgxnB9WTw6wyQcQNSkTJTmfw5VOrQMd7XxPRdadmbtWXhoFQhgf/0IXo0ymz921rPZ4PFtTK08R0LjUVtJ0v/J5X9jo3bAe1F/d4Ks3RtmNL80WOlYEEsdDHaUShSlrAQjBMgYNtRcacT4TUaSw+04R+loruEV+A0OmovE9F6emwoFqiYY9UP+YTeVyhtiQ1BTvpjv3Xk9VGGuvtGvM2ksbjJojEuyNQUh8X/MxSvaX9/GZ/wrcI9mDkQrpnsJ4wcyA== 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=YgmFyp8rHTwjXAQG4mdxKlUkKizuq49vHG9QWF+xMR8=; b=OyV9A6v4l0NCqgD7fEFpdrCeGZh6O7wDkB650NX5qTXSU3RwhesaQmKJIOc3IapVfcylhJBbBYREq1XrjX+G4gtdGlx5k3SvjAM5AWPLb/OVDoNb2RpnlzHhO54w9lFqqPdQkJG4rI5iBk7OQeTCYk7TKojaptV+GNtJtUN73N/cG8k5ZNPzVFFCM1VU0eszvLQ13UOO3bFv1kyVHaLUmfr+lt57M2WEHpc4DV60zuzLTI/UYQLyeAmhDHiWWzZuiHe7K/3I9hpZEl72ZXKKZatWcTvojRn7ARBl1/WAILBswyRsbycAEwIVAKFh7Ivb0Jwq6mGSe7USkdW0Pz/SBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB7521.prod.exchangelabs.com (2603:10b6:510:f4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Wed, 17 Nov 2021 16:50:56 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:56 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 25/30] AmpereAltraPkg: Add platform info screen Date: Wed, 17 Nov 2021 23:47:22 +0700 Message-ID: <20211117164727.10922-26-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:50:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: de788acf-b6b6-409c-d26d-08d9a9ea6ca1 X-MS-TrafficTypeDiagnostic: PH0PR01MB7521: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:14; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: /ZPJISiWSUb/cMu0fyS74VwXFvEnn81bX4V61LGjT88X5T8dqfzojVAtOAcn2BzuGyBVBCFNy5VKktD3jaioGlwqmZnfcV9/zPwyQ+LYT3t/Md97DDHWUVdfKnEIssjib05IdmpvN2p4287lADbEOh5INLWJ0abAyytPQQ6++zhQKyYrnMvQoGr73B6WbcOBg0/zKacZ/u/7Htzdfr5tsI0IysXQjaIhfpQlvK+huG74yZ4pwySQ628aseiwZcKcVZamO/4PnJ7S3RdXlQ7HujBf/V9WWVilkK16cLLvtFZZEEa3wwxe8NDab0Ec75uEMI14xklszOE/KbVTuaZayONW4/LLgvCNMUVcU6S3Sr4e4MwmDFfRlot6YaXyNJbLc9WG+CrXDO8K13zfbBY4vT/OJomCFcNacWFEjbo6sJbqZihFR2RxZNFGnlvBGcGLlHDu9rq91RiJPxUpPt3H5s2I04YkL3/zBosatbP8aOoY7Vtxlu1EKKpDNRQ/XbcUXUMy6Y+bvtFu0p+HiKHTxhCTNPnYQzMEzvdxxnGUQJ8/t/AQKmvcXbxmnlnVO5QK5Vkhe0qvPN33ZbPNXyc+cMhdJYdyhVeHPIPAUK1JnI/Q3ZPFlYBw3w4YEVo53p/pD+eUJ+Wac9XugEvRV2t0cDcpUoHDHjDgBdX5wIxbsdL5E9cADddGcd+MOEglSj2b3c+cBaYTNMZtBwIBmexecWIijR53ScNItSRMeA73s7A= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?yXZZ7JfnBuVxkq14TrQ9c5YUJuD2fETGL86vogl9RhJG9TzW8mO4lJxtfveR?= =?us-ascii?Q?yonNNV/3TJRzEjagQAIw5USC1gvkoLsbxgcb34lTQ5nKQJMcAnExGvi70JcJ?= =?us-ascii?Q?2McZd2yqyM/X1qz2tnl8h6EwyW7C26mtaiCHb3A/NUKV5rAds0DAPqEHWzm/?= =?us-ascii?Q?5gIl1/lZJJzUYKQWnRjK0C8g0qoRMPpxkFW1P4QAH3iZ8P50ncbqarV06KWz?= =?us-ascii?Q?XabC8WZd6fDpnhES4wp/tPeJNWONqmMhhIiQJtGKcdwfIpiYIVesU+/F+vyZ?= =?us-ascii?Q?yM90M+LMRf8M4z3V+IuiG0TZYBa93Uw7eR6dQIi7LkeBPTrrKZ21KpgmPaTS?= =?us-ascii?Q?43m2Ch1808B3G6Sq6a0VTiS6r7AzGlgYMyWfc1oeqzjMjEwV205dzgroOmUu?= =?us-ascii?Q?DI1sbuK3SsdE7n3ismDDm/ae0INc86A12TvanBpXjVd089alxCLwBbO17UyE?= =?us-ascii?Q?ZTtK6yBzt7ER3IbHqqBJz4RMkylUAPy7usddiVYyM7r8j7mb/viseeXqFoEE?= =?us-ascii?Q?SVFlUTu8tiDEVcxdLhLp37JOvoBSy6ge73UlhGA6hvr0wsumorEoZAQi0bu6?= =?us-ascii?Q?hBgfYEVtVmYLhKN6qLDnJl0McYsoeuvbGgx6E+QQwLp+fQvcr4RdEuTcGTq1?= =?us-ascii?Q?4CdNV+S0TcwP1ywIRMF+fXzaxC3g4nNsOM+FA/XsqmyLRuYW9tKieeh3aF/Y?= =?us-ascii?Q?2hqCS0jz6AYdKNubEjnL+IeQ/nnTFCGEuJ7xmBY9qNhl7CDhfjso0vUOpC9R?= =?us-ascii?Q?bxqiTHtz6BTiqyeYSXlqG1EaQaMG29W87c/RWd9Aw4c2q+VAUn1YCFlN9wsA?= =?us-ascii?Q?OQvu9TB2xtRP6Q5hO4T0z+TsqU98dWWfHlC1P7BukFJEbrOfgrv9hZ4MvyXa?= =?us-ascii?Q?eo8luo0iXjp1PEAFAy8z7WIK9ndvSJm7cFADDoXjRyfjpBEojhyjI6JFN7iR?= =?us-ascii?Q?99gcNtVqFdDQSLOug/1UG1UaPRSL3EKZH0iIXPKQkMUJpOb+FzyXRItlX7Eo?= =?us-ascii?Q?Z6BIRZpFSPY69umAq03SnjDxKZYaXDZE+Z6H5KCbuaUEfU84VDSW5asQbuYv?= =?us-ascii?Q?7nHBkD4V55hjOLCKkR+bmK3m+rosJyJQYmR4rTPfRBEKkIegHosFXageOgXI?= =?us-ascii?Q?RuZ/yqAB223tWDyyldiZ0QL0sWQaC7n4D/tYrJv31gh5oK4ZzCkCqGHFQpwC?= =?us-ascii?Q?3DzU9UD7pfMVt3diA6UJ/FHu3SO/MqMYAOd2fjpKWjDK1Hz9vwM75/UN3/vd?= =?us-ascii?Q?UyOxGgyODtDnYmJzVIOOq174dYaQjeG8OlxmzswFAgqvf+3cJV7yOs+X0da/?= =?us-ascii?Q?45LWaqUshye6DlEwpQk53AN4BaUNanYLQLnOe82JaG84cTnCvRhVC0h7bl0V?= =?us-ascii?Q?c2m5SNX68k6XlB3/QxyEuQ3bfM7agrUy4VGMtNpS4FCwTQhl1/o1eOBI/Cf4?= =?us-ascii?Q?RFZ6KHsAZPxWVeGroB7N+b5siIEkzggh7xVr8xkb/OPOsF6iQ2CxSnF9zYHj?= =?us-ascii?Q?EQX9qFZucjrbhQmILaAPYttoEYi1D7zlflSUwli3hjAz6WP6GDWdwTsGQSQL?= =?us-ascii?Q?x1POnrjDi2tqCXr50IY6zLFiMUPhcF6Hbrufo5nlNKetsae11P/uqRbvPHew?= =?us-ascii?Q?Sru8zdXKq+ruyK/v5lVszs5ZL0C/0shlSXesx5ibT3lQJc7rBvm9XKDe6fdR?= =?us-ascii?Q?IefZ6FFLTur/6rHYcB1GyA/DarI=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: de788acf-b6b6-409c-d26d-08d9a9ea6ca1 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:56.2100 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kmTA7M5mICsKYwftHfFsXQgEYRjQwBRVxMz0khez/Y9WEmwImJuveCOLLAdqFrdsafsmYAUy04/xw0Tx7Q9Fm/Y81fiLoJizvbt9z8Wchhk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7521 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: WTycUndoDpkJEWCy7gM5neadx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167858; bh=RE9LjcWHq7911m0+YCmQz2WK1gtIVIME3O+NUc0JiOU=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=VPO0GWyA9W/X5DAPywcsAtf4sTDMWa2BMCkKg/h4yenmCg40qp1aCBnelhMkctBJUvp wsud51MmTtcqahIYdXjCp4booXqC+Fft2OfZDmrS1GTaoKCSgHJxT5Dnae43foV8VgH3w z0sVrxJWtmTjUi2KUBQ5KJ6OFdnnRV9JihM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167859512100008 Content-Type: text/plain; charset="utf-8" Provide screen menu with basic platform information include: * Platform name * SCP firmware info * System bus clock frequency. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Platform/Ampere/JadePkg/Jade.dsc = | 1 + Platform/Ampere/JadePkg/Jade.fdf = | 1 + Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf = | 52 +++ Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoHii.h = | 22 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoVfr.vfr = | 112 ++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.c = | 390 ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoStrings.= uni | 56 +++ 7 files changed, 634 insertions(+) diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index 6c4294bef159..deddd3b5fdde 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -186,3 +186,4 @@ [Components.common] # HII # Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexCo= nfigDxe.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index f7ef95247f79..3109bc225f5d 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -352,5 +352,6 @@ [FV.FvMain] # HII # INF Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootCompl= exConfigDxe.inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDx= e.inf =20 !include Silicon/Ampere/AmpereSiliconPkg/FvRules.fdf.inc diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/Platform= InfoDxe.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/Platfor= mInfoDxe.inf new file mode 100644 index 000000000000..e04422249b76 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe= .inf @@ -0,0 +1,52 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D PlatformInfoDxe + FILE_GUID =3D 6FDFB3E8-105E-48C4-94AA-3D7646F9B50D + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D PlatformInfoEntryPoint + +[Sources.common] + PlatformInfoDxe.c + PlatformInfoHii.h + PlatformInfoVfr.vfr + PlatformInfoStrings.uni + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + AmpereCpuLib + BaseLib + BaseMemoryLib + DebugLib + DevicePathLib + DevicePathLib + HiiLib + HobLib + IoLib + MemoryAllocationLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + +[Guids] + gPlatformManagerFormsetGuid + gEfiIfrTianoGuid + gPlatformInfoHobGuid + +[Protocols] + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/Platform= InfoHii.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformI= nfoHii.h new file mode 100644 index 000000000000..7f363160afc8 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoHii= .h @@ -0,0 +1,22 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef PLATFORM_INFO_HII_H_ +#define PLATFORM_INFO_HII_H_ + +#define PLATFORM_INFO_FORMSET_GUID \ + { \ + 0x8DF0F6FB, 0x65A5, 0x434B, { 0xB2, 0xA6, 0xCE, 0xDF, 0xD2, 0x0A, 0x96= , 0x8A } \ + } + +#define LABEL_UPDATE 0x2223 +#define LABEL_END 0x2224 + +#define PLATFORM_INFO_FORM_ID 0x1 + +#endif diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/Platform= InfoVfr.vfr b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/Platfor= mInfoVfr.vfr new file mode 100644 index 000000000000..5dd32a30f0ad --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoVfr= .vfr @@ -0,0 +1,112 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "PlatformInfoHii.h" + +formset + guid =3D PLATFORM_INFO_FORMSET_GUID, + title =3D STRING_TOKEN(STR_PLATFORM_INFO_FORM), + help =3D STRING_TOKEN(STR_PLATFORM_INFO_FORM_HELP), + classguid =3D gPlatformManagerFormsetGuid, + + form + formid =3D PLATFORM_INFO_FORM_ID, + title =3D STRING_TOKEN(STR_PLATFORM_INFO_FORM); + subtitle text =3D STRING_TOKEN(STR_PLATFORM_INFO_FORM_HELP); + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_BOARD), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_BOARD), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_BOARD_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_SCPVER), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_SCPVER), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_SCPVER_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_SCPBUILD), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_SCPBUILD), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_SCPBUILD_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_CPUINFO), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_CPUINFO), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_CPUINFO_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_CPUCLK), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_CPUCLK), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_CPUCLK_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_PCPCLK), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_PCPCLK), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_PCPCLK_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_L1ICACHE), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_L1ICACHE), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_L1ICACHE_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_L1DCACHE), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_L1DCACHE), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_L1DCACHE_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_L2CACHE), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_L2CACHE), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_L2CACHE_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_SOCCLK), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_SOCCLK), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_SOCCLK_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_SYSCLK), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_SYSCLK), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_SYSCLK_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_PLATFORM_INFO_AHBCLK), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_AHBCLK), + text =3D STRING_TOKEN(STR_PLATFORM_INFO_AHBCLK_VALUE), + flags =3D 0, + key =3D 0; + + label LABEL_UPDATE; + // dynamic content here + label LABEL_END; + + endform; + +endformset; diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/Platform= InfoDxe.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformI= nfoDxe.c new file mode 100644 index 000000000000..82d2cf131c16 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe= .c @@ -0,0 +1,390 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "PlatformInfoHii.h" + +// +// uni string and Vfr Binary data. +// +extern UINT8 PlatformInfoVfrBin[]; +extern UINT8 PlatformInfoDxeStrings[]; + +EFI_HANDLE mDriverHandle =3D NULL; +EFI_HII_HANDLE mHiiHandle =3D NULL; + +#pragma pack(1) + +// +// HII specific Vendor Device Path definition. +// +typedef struct { + VENDOR_DEVICE_PATH VendorDevicePath; + EFI_DEVICE_PATH_PROTOCOL End; +} HII_VENDOR_DEVICE_PATH; + +#pragma pack() + +// PLATFORM_INFO_FORMSET_GUID +EFI_GUID gPlatformInfoFormSetGuid =3D PLATFORM_INFO_FORMSET_GUID; + +HII_VENDOR_DEVICE_PATH mPlatformInfoHiiVendorDevicePath =3D { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8)(sizeof (VENDOR_DEVICE_PATH)), + (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + PLATFORM_INFO_FORMSET_GUID + }, + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { + (UINT8)(END_DEVICE_PATH_LENGTH), + (UINT8)((END_DEVICE_PATH_LENGTH) >> 8) + } + } +}; + +#define MAX_STRING_SIZE 64 +#define MHZ_SCALE_FACTOR 1000000 + +STATIC +CHAR8 * +GetCCIXLinkSpeed ( + IN UINTN Speed + ) +{ + switch (Speed) { + case 1: + return "2.5 GT/s"; + + case 2: + return "5 GT/s"; + + case 3: + return "8 GT/s"; + + case 4: + case 6: + return "16 GT/s"; + + case 0xa: + return "20 GT/s"; + + case 0xf: + return "25 GT/s"; + } + + return "Unknown"; +} + +STATIC +EFI_STATUS +UpdatePlatformInfoScreen ( + IN EFI_HII_HANDLE *HiiHandle + ) +{ + VOID *Hob; + PLATFORM_INFO_HOB *PlatformHob; + CHAR16 Str[MAX_STRING_SIZE]; + + VOID *StartOpCodeHandle; + EFI_IFR_GUID_LABEL *StartLabel; + VOID *EndOpCodeHandle; + EFI_IFR_GUID_LABEL *EndLabel; + + /* Get the Platform HOB */ + Hob =3D GetFirstGuidHob (&gPlatformInfoHobGuid); + if (Hob =3D=3D NULL) { + return EFI_DEVICE_ERROR; + } + PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + + /* SCP Version */ + AsciiStrToUnicodeStrS ((const CHAR8 *)PlatformHob->SmPmProVer, Str, MAX_= STRING_SIZE); + HiiSetString ( + HiiHandle, + STRING_TOKEN (STR_PLATFORM_INFO_SCPVER_VALUE), + Str, + NULL + ); + + /* SCP build */ + AsciiStrToUnicodeStrS ((const CHAR8 *)PlatformHob->SmPmProBuild, Str, MA= X_STRING_SIZE); + HiiSetString ( + HiiHandle, + STRING_TOKEN (STR_PLATFORM_INFO_SCPBUILD_VALUE), + Str, + NULL + ); + + /* CPU Info */ + AsciiStrToUnicodeStrS ((const CHAR8 *)PlatformHob->CpuInfo, Str, MAX_STR= ING_SIZE); + UnicodeSPrint (Str, sizeof (Str), L"%s", Str); + HiiSetString ( + HiiHandle, + STRING_TOKEN (STR_PLATFORM_INFO_CPUINFO_VALUE), + Str, + NULL + ); + + /* CPU clock */ + UnicodeSPrint (Str, sizeof (Str), L"%dMHz", PlatformHob->CpuClk / MHZ_SC= ALE_FACTOR); + HiiSetString ( + HiiHandle, + STRING_TOKEN (STR_PLATFORM_INFO_CPUCLK_VALUE), + Str, + NULL + ); + + /* PCP clock */ + UnicodeSPrint (Str, sizeof (Str), L"%dMHz", PlatformHob->PcpClk / MHZ_SC= ALE_FACTOR); + HiiSetString ( + HiiHandle, + STRING_TOKEN (STR_PLATFORM_INFO_PCPCLK_VALUE), + Str, + NULL + ); + + /* SOC clock */ + UnicodeSPrint (Str, sizeof (Str), L"%dMHz", PlatformHob->SocClk / MHZ_SC= ALE_FACTOR); + HiiSetString ( + HiiHandle, + STRING_TOKEN (STR_PLATFORM_INFO_SOCCLK_VALUE), + Str, + NULL + ); + + /* L1 Cache */ + UnicodeSPrint (Str, sizeof (Str), L"64KB"); + HiiSetString ( + HiiHandle, + STRING_TOKEN (STR_PLATFORM_INFO_L1ICACHE_VALUE), + Str, + NULL + ); + HiiSetString ( + HiiHandle, + STRING_TOKEN (STR_PLATFORM_INFO_L1DCACHE_VALUE), + Str, + NULL + ); + + /* L2 Cache */ + UnicodeSPrint (Str, sizeof (Str), L"1MB"); + HiiSetString ( + HiiHandle, + STRING_TOKEN (STR_PLATFORM_INFO_L2CACHE_VALUE), + Str, + NULL + ); + + /* AHB clock */ + UnicodeSPrint (Str, sizeof (Str), L"%dMHz", PlatformHob->AhbClk / MHZ_SC= ALE_FACTOR); + HiiSetString ( + HiiHandle, + STRING_TOKEN (STR_PLATFORM_INFO_AHBCLK_VALUE), + Str, + NULL + ); + + /* SYS clock */ + UnicodeSPrint (Str, sizeof (Str), L"%dMHz", PlatformHob->SysClk / MHZ_SC= ALE_FACTOR); + HiiSetString ( + HiiHandle, + STRING_TOKEN (STR_PLATFORM_INFO_SYSCLK_VALUE), + Str, + NULL + ); + + /* Initialize the container for dynamic opcodes */ + StartOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (StartOpCodeHandle !=3D NULL); + + EndOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (EndOpCodeHandle !=3D NULL); + + /* Create Hii Extend Label OpCode as the start opcode */ + StartLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode ( + StartOpCodeHandle, + &gEfiIfrTianoGuid, + NULL, + sizeof (EFI_IFR_GUID_LABEL) + ); + ASSERT (StartLabel !=3D NULL); + StartLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + StartLabel->Number =3D LABEL_UPDATE; + + /* Create Hii Extend Label OpCode as the end opcode */ + EndLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode ( + EndOpCodeHandle, + &gEfiIfrTianoGuid, + NULL, + sizeof (EFI_IFR_GUID_LABEL) + ); + ASSERT (EndLabel !=3D NULL); + EndLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + EndLabel->Number =3D LABEL_END; + + if (IsSlaveSocketActive ()) { + /* Create the inter socket link text string */ + UnicodeSPrint ( + Str, + sizeof (Str), + L"Width x%d / Speed %a", + PlatformHob->Link2PWidth[0], + GetCCIXLinkSpeed (PlatformHob->Link2PSpeed[0]) + ); + + HiiSetString ( + mHiiHandle, + STRING_TOKEN (STR_CPU_FORM_INTER_SOCKET_LINK0_VALUE), + Str, + NULL + ); + + HiiCreateTextOpCode ( + StartOpCodeHandle, + STRING_TOKEN (STR_CPU_FORM_INTER_SOCKET_LINK0), + STRING_TOKEN (STR_CPU_FORM_INTER_SOCKET_LINK0), + STRING_TOKEN (STR_CPU_FORM_INTER_SOCKET_LINK0_VALUE) + ); + + UnicodeSPrint ( + Str, + sizeof (Str), + L"Width x%d / Speed %a", + PlatformHob->Link2PWidth[1], + GetCCIXLinkSpeed (PlatformHob->Link2PSpeed[1]) + ); + + HiiSetString ( + mHiiHandle, + STRING_TOKEN (STR_CPU_FORM_INTER_SOCKET_LINK1_VALUE), + Str, + NULL + ); + + HiiCreateTextOpCode ( + StartOpCodeHandle, + STRING_TOKEN (STR_CPU_FORM_INTER_SOCKET_LINK1), + STRING_TOKEN (STR_CPU_FORM_INTER_SOCKET_LINK1), + STRING_TOKEN (STR_CPU_FORM_INTER_SOCKET_LINK1_VALUE) + ); + } + + HiiUpdateForm ( + mHiiHandle, // HII handle + &gPlatformInfoFormSetGuid, // Formset GUID + PLATFORM_INFO_FORM_ID, // Form ID + StartOpCodeHandle, // Label for where to insert opcodes + EndOpCodeHandle // Insert data + ); + + HiiFreeOpCodeHandle (StartOpCodeHandle); + HiiFreeOpCodeHandle (EndOpCodeHandle); + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +PlatformInfoUnload ( + VOID + ) +{ + if (mDriverHandle !=3D NULL) { + gBS->UninstallMultipleProtocolInterfaces ( + mDriverHandle, + &gEfiDevicePathProtocolGuid, + &mPlatformInfoHiiVendorDevicePath, + NULL + ); + mDriverHandle =3D NULL; + } + + if (mHiiHandle !=3D NULL) { + HiiRemovePackages (mHiiHandle); + } + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +PlatformInfoEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &mDriverHandle, + &gEfiDevicePathProtocolGuid, + &mPlatformInfoHiiVendorDevicePath, + NULL + ); + ASSERT_EFI_ERROR (Status); + + // + // Publish our HII data + // + mHiiHandle =3D HiiAddPackages ( + &gPlatformInfoFormSetGuid, + mDriverHandle, + PlatformInfoDxeStrings, + PlatformInfoVfrBin, + NULL + ); + if (mHiiHandle =3D=3D NULL) { + gBS->UninstallMultipleProtocolInterfaces ( + mDriverHandle, + &gEfiDevicePathProtocolGuid, + &mPlatformInfoHiiVendorDevicePath, + NULL + ); + return EFI_OUT_OF_RESOURCES; + } + + Status =3D UpdatePlatformInfoScreen (mHiiHandle); + if (EFI_ERROR (Status)) { + PlatformInfoUnload (); + DEBUG (( + DEBUG_ERROR, + "%a %d Fail to update the platform info screen \n", + __FUNCTION__, + __LINE__ + )); + return Status; + } + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/Platform= InfoStrings.uni b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/Pla= tformInfoStrings.uni new file mode 100644 index 000000000000..235d104c217f --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoStr= ings.uni @@ -0,0 +1,56 @@ +// +// Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// + +#langdef en-US "English" + +#string STR_PLATFORM_INFO_FORM #language en-US "Platf= orm Board Information" +#string STR_PLATFORM_INFO_FORM_HELP #language en-US "Platf= orm Board Information" + +#string STR_PLATFORM_INFO_SEPERATE_LINE #language en-US "" + +#string STR_PLATFORM_INFO_BOARD #language en-US "Board" +#string STR_PLATFORM_INFO_BOARD_VALUE #language en-US "Mt. J= ade" + +#string STR_PLATFORM_INFO_SCPVER #language en-US "SCP F= W Version" +#string STR_PLATFORM_INFO_SCPVER_VALUE #language en-US "0" + +#string STR_PLATFORM_INFO_RCVER #language en-US "Refer= ence Code version" +#string STR_PLATFORM_INFO_RCVER_VALUE #language en-US "0" + +#string STR_PLATFORM_INFO_SCPBUILD #language en-US "SCP F= W Build" +#string STR_PLATFORM_INFO_SCPBUILD_VALUE #language en-US "0" + +#string STR_PLATFORM_INFO_CPUINFO #language en-US "CPU" +#string STR_PLATFORM_INFO_CPUINFO_VALUE #language en-US " " + +#string STR_PLATFORM_INFO_CPUCLK #language en-US "CPU C= lock" +#string STR_PLATFORM_INFO_CPUCLK_VALUE #language en-US "0MHz" + +#string STR_PLATFORM_INFO_PCPCLK #language en-US "PCP C= lock" +#string STR_PLATFORM_INFO_PCPCLK_VALUE #language en-US "0MHz" + +#string STR_PLATFORM_INFO_L1ICACHE #language en-US "L1I C= ACHE" +#string STR_PLATFORM_INFO_L1ICACHE_VALUE #language en-US "0KB" + +#string STR_PLATFORM_INFO_L1DCACHE #language en-US "L1D C= ACHE" +#string STR_PLATFORM_INFO_L1DCACHE_VALUE #language en-US "0KB" + +#string STR_PLATFORM_INFO_L2CACHE #language en-US "L2 CA= CHE" +#string STR_PLATFORM_INFO_L2CACHE_VALUE #language en-US "0KB" + +#string STR_PLATFORM_INFO_SOCCLK #language en-US "SOC C= lock" +#string STR_PLATFORM_INFO_SOCCLK_VALUE #language en-US "0MHz" + +#string STR_PLATFORM_INFO_SYSCLK #language en-US "Sys C= lock" +#string STR_PLATFORM_INFO_SYSCLK_VALUE #language en-US "0MHz" + +#string STR_PLATFORM_INFO_AHBCLK #language en-US "AHB C= lock" +#string STR_PLATFORM_INFO_AHBCLK_VALUE #language en-US "0MHz" + +#string STR_CPU_FORM_INTER_SOCKET_LINK0 #language en-US "Inter= Socket Connection: Link 0" +#string STR_CPU_FORM_INTER_SOCKET_LINK0_VALUE #language en-US "" +#string STR_CPU_FORM_INTER_SOCKET_LINK1 #language en-US "Inter= Socket Connection: Link 1" +#string STR_CPU_FORM_INTER_SOCKET_LINK1_VALUE #language en-US "" --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83838): https://edk2.groups.io/g/devel/message/83838 Mute This Topic: https://groups.io/mt/87123910/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83839+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83839+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167863752272.42929211645946; Wed, 17 Nov 2021 08:51:03 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id ZqbkYY1788612xEwG8DaYbmp; Wed, 17 Nov 2021 08:51:03 -0800 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.134]) by mx.groups.io with SMTP id smtpd.web09.9831.1637167862285539132 for ; Wed, 17 Nov 2021 08:51:02 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fYYxqnZNA78XdoLNBjj4SJfy9AbgE5i25loMgL3mv6zIr2ScP2pEX1nCQYXeIfsFpMEmbdjqCqqualiereAKbHv3Zr8GF7CONj/UK7tklzMv4PoWRoZcjzCtYVf7Pz3xRYpNis9t78/8dKn4sBgxN4UsP2/vDajBQCqu0qOd9Sxckr4Fg3FP7tQOFN6QqeGV/MaajavegBcr3eVFLwnRpkivid6e2GM8VKOsCHqMf7mm7/u7SsxPeMdDpWV4EmEiLh7catUMORgSId/bMPe28ivXo2I8Q9XFMgUxbFnYxgpPgEN/p4JxjxlIZT8OkE6/SzBhBO5SXcj4OCjPtrIzJw== 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=6MGOiJyoySRHEG4tklFss6xUYcSpbyuYTiZz7MJ8Ans=; b=NI8Gu1LZAIdfgvD2TDODBc23n6ne1DCZBlHjT3+FnN6oNOEVJYhpOnFCiUXeI6md+LdIViok8uQJ4Bdk+1o281GXpM32Dvz1ip2KLsK+equl5dO1LWI/Awf+iwF0Ap89jhktBBK4paSEWr+emid6Hiqq1+Q81UNWUWdRasEflzKSzb5DF5SYwOpZoPz+XtN/4k34STmw++FMv3efYufgKHmWSDmFZjfOHyRc8U0a3xExSp/op0naTaymrHWlpneTxTiGWbxuirVeF3Ai0F0MS6b6IVctOaDM5pCP+g0xrTvM8pM4l2/64bGcWr/hdZvPwFCAvrdxCn7Fp5fRCnncYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB7400.prod.exchangelabs.com (2603:10b6:510:10b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.19; Wed, 17 Nov 2021 16:50:59 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:50:59 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 26/30] AmpereAltraPkg: Add configuration screen for Memory Date: Wed, 17 Nov 2021 23:47:23 +0700 Message-ID: <20211117164727.10922-27-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:50:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 85427c88-e02c-45d3-b5be-08d9a9ea6e83 X-MS-TrafficTypeDiagnostic: PH0PR01MB7400: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: fhvDK8Lu7bpb+8mYQt0ms2sQZWaGvcQC2jAc83GEO+uV0YHlaeBQt7epAwMsVvtHBS386y3oONOpWDA8ALyVzZAgciSc3nPB9uiizS3rkMqXH6E5RekI9C8lPBQae/vwSZUttj892r+yImKCFtsWkdAid0+IIScxqktItwrFI18aKC9J0iJzWgUYxKD+BTpoChuu3FJrNTW5a29gTefOOamj3nWO4i2UFqdIl/XCpTiMuJMXXRNp5IJVPJtXT7oNZCzftvLLpzAv42NCStqp5GlQ9BS91QVjo+aZ0ftVteG33N8js3m9u9M/c3A8wZeGQ02fUN7S/AdEkVA04BwcvWjAI31OS/j6tsf/QvsrXf/EoAO50XpiLL3tje7zRbwkxorL9qlFrzhcam0p7D06mtdIi/CGmR/fRAUxzImz+Ta+7vzY7K+QMZx3oLt6nrWmwwvOkrxFY0fHmYR7tpJ4+jxBvciknJNilvpc63PYIeOIN5uxr+Cl+O/ZJTKkQdWRpR0vLyVOWCFnEg6hx5DAOVfk+dTznoTMKez/mYAziU7dJrJ4fK0QqPIePbGlIbVGeF/NmIB8ndiT6ndDXeEBD4GsHuhZXCZXz3VaS3aszwc01XuMnQi5umWm9V6hCGLDCnFQNSmgSBATLkpXJaoy89yeT7IxzxzG+1gYArWMCsBzyWavm3liYkLiwdc7B8G3Mi3aiLWhmWC0ffikUyJ9PZZ3xn18++xOI/Da03y+nOmVqXhvQGoTgMQaZCtAQH+8d1H7WR+H2u7aQqqXP+tAfQ== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?S1ZpQDileHl3Oe5jk+zKE+q5xroOnecRiKYr+JtzysV24u6SrwVeNzXT1DeB?= =?us-ascii?Q?Np1B2pynW1ljpDE4fYdNtmNbidKXg2KwoYwiiihR2pk6VCLnwtBHrMF2YZ3c?= =?us-ascii?Q?y4drKynpeyMteoZpvmZxGVcsT993X4syvj1o2lqLRuAyRO4beiKvEiMtt/+5?= =?us-ascii?Q?B9lAEGrd17WoCGAuSPoF9caK2XAEs4BHMHKPl2FoKUAdb4GmmTt58K9UWK4q?= =?us-ascii?Q?eKeXZ9SuraVMZfrj0Q9lqW8AGuEDh9N5pm8qjGJ9Q1qDjE8IJpFi4U3hsHG4?= =?us-ascii?Q?xoGQGfrFQ3TlJ00B8hNiH4wZxq1fVTfdJuNZ7y+wHRwF1MIWGX1Ijcy3KX9Y?= =?us-ascii?Q?OOkRMvTQ+kdGZrT4/rRfhdzK6Ue3SCkgkJGxzeM+n6kEehOs0ZFNRa0AFWAE?= =?us-ascii?Q?EwI/6QE1u/g6J1gCFcw+l2xUli4X1Fwq8OLVaym/i0cxtfhvOjcc05YTBIIz?= =?us-ascii?Q?p/RvREQAd9bCJI3afC+DneJ66S6AkvsbhhldOpQLfc3klodKlFQK62fxql7I?= =?us-ascii?Q?yW7S3/nnnMC/bJyb0UjQLwymn+1vVk+b9/QTeYSehRxLuVwnUCh6/Fje0lXd?= =?us-ascii?Q?I8g3cqfWBdIC4qHunvpEoMYkc4F2a+EfL+HZbfneOkTWBmnW3C8BHS+D4Iu9?= =?us-ascii?Q?z6evHci06SwPirJJDDKcxDcSaHntltq9Xsw7e4kNeH0kSuDZlkF+pAsG7uYG?= =?us-ascii?Q?zd8hKzRbL8rlJQtuLPFFmuV+5i0lSpCseRFjRDn4p37vNG1OBDXGXD7XLnYk?= =?us-ascii?Q?Yd8aDXr5DGvKbNM28AdS4I1FKxKSb8yNT1B5v4x6YABOyFheZFJ/d1VMZmlh?= =?us-ascii?Q?ZfDU4VFiHLILIrXhjNGYR71WK630ijNPCFjlimoeS+E8IkKB7xhOGUvHkr2B?= =?us-ascii?Q?KKG3GXUQf/MxUGcqCeMiRQ8VF1AmFnf4+vfa153tVwloKNUkAt+R97hbVtOs?= =?us-ascii?Q?4LYIF8aT5743makhp8pb3LuurnvunKR8MNOAfQcDnXq4LuU/hevWp1tE/ysf?= =?us-ascii?Q?BDRW+nkOyCtwBv1IAX/1ssPR0ZW2VIO/59xUVSh++4h8Yj6vlcQFDfN83Kzb?= =?us-ascii?Q?gLBB7f7095QuU39epB5M7S/f4LWk1qIwQU8zyUtGjn8qgoQy9nlo2Tt7gQ4v?= =?us-ascii?Q?rqsV7kV/dVDbYb3X08fnN76wZGNSkwUFy+ws8gEAUkWuMEX0vAS0wD6WcXBW?= =?us-ascii?Q?Bd0TWTnoSrNoQ0tf1h+XQcUUDOUBrn1cNPyOVr5M8a0+REOJIENNtGLnFu3A?= =?us-ascii?Q?Sax23l9tND1ZVX+M90VBr+BjERLb+DUFZVorX+5J/daFVapKfxDL7jmh3Gvs?= =?us-ascii?Q?nUDJg9ZgS8uJOEwJyJuUpP5bGaCWliEa0RIkcneqGauawjIx23BhXA+9NV3w?= =?us-ascii?Q?N7wvRGWcH+1Ccx7PvzZ+ffXgA8TiddrYYFR79O9NaE9150F+EGIzWORWTb3k?= =?us-ascii?Q?Gd33kr98GHE1F7LTS23eTnFtVHQE0Rz/8BErv5QknRR9Kl8K6IcT1A1zzauS?= =?us-ascii?Q?NRp0xNSHgcp1UEv0l6VNVmsuEr87ejw6h91Aut+o7bS54JJArthMdb3dvvX3?= =?us-ascii?Q?TBjAai2P7gqWTAnEpoNQhXCSP1kz+b4ixcLI1ZAxQtCYz6tG2vHfIbHj667V?= =?us-ascii?Q?dB8C9EQMrte3d2AlCjfMRUesTyPyIT5ksNu3itL8wVVO6ImCMy/0sUa0ADHX?= =?us-ascii?Q?EtIBoGUCgmE6mXWWeTR8p4MRKJ0=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 85427c88-e02c-45d3-b5be-08d9a9ea6e83 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:50:59.7833 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KjamhewSNvdVRpw4/yiXtMUbEfpmvPGHO11wYdkLJIhTWkczVo9lYep7ljtSN0OU+/lI8PwymbFjkKZ4s64rIvwonBwSmmFc1eDKw8N9ZeU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7400 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: TQ2FCQSwjY5gQvimnAqJoTfxx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167863; bh=7sZklPpQAFHn+E+Z5AUG2LCQjWOTHrwB9lc3drlZxXU=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=MTRmUMPHbiIH92vXDZ69Srbng5fJzoM9PJ/Q6/boO3J/emC5J5XwMZ+uNxSOrwB9jAt C/HECmp192J5oQvga99UihgobWP6DNu5HdysM8pSv7Rb9QQxdzzJBPgNjzruagD6HXVmt cqqDM5/JrrAbEHIyGmpHiCyqZFouVUsVltc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167865350100001 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen Provide memory screen with below info: * Memory total capacity * Memory RAS and Performance Configuration * Per DIMM Information Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Acked-by: Leif Lindholm --- Platform/Ampere/JadePkg/Jade.dsc = | 1 + Platform/Ampere/JadePkg/Jade.fdf = | 1 + Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.inf = | 59 + Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreen.h = | 159 +++ Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreenNVDataStruct= .h | 47 + Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreenVfr.vfr = | 62 + Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoNvramLib.c = | 394 ++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreen.c = | 1395 ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.uni = | 9 + Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxeExtra.uni = | 9 + Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreenStrings.uni = | 64 + 11 files changed, 2200 insertions(+) diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index deddd3b5fdde..5cebd1e9d0c3 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -187,3 +187,4 @@ [Components.common] # Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexCo= nfigDxe.inf Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.inf diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index 3109bc225f5d..9a3236669858 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -353,5 +353,6 @@ [FV.FvMain] # INF Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootCompl= exConfigDxe.inf INF Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDx= e.inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.inf =20 !include Silicon/Ampere/AmpereSiliconPkg/FvRules.fdf.inc diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.in= f b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.inf new file mode 100644 index 000000000000..a608133deb5b --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.inf @@ -0,0 +1,59 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D MemInfoDxe + MODULE_UNI_FILE =3D MemInfoDxe.uni + FILE_GUID =3D D9EFCEFE-189B-4599-BB07-04F0A8DF5C2F + MODULE_TYPE =3D DXE_DRIVER + ENTRY_POINT =3D MemInfoScreenInitialize + +[Sources] + MemInfoNvramLib.c + MemInfoScreen.c + MemInfoScreen.h + MemInfoScreenStrings.uni + MemInfoScreenNVDataStruct.h + MemInfoScreenVfr.vfr + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + AmpereCpuLib + BaseLib + DevicePathLib + HiiLib + HobLib + MemoryAllocationLib + NVParamLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + +[Guids] + gEfiIfrTianoGuid ## PRODUCES ## UNDEFINED + gPlatformManagerFormsetGuid + gPlatformInfoHobGuid + +[Protocols] + gEfiDevicePathProtocolGuid ## CONSUMES + gEfiHiiConfigRoutingProtocolGuid ## CONSUMES + gEfiHiiConfigAccessProtocolGuid ## PRODUCES + +[Depex] + TRUE + +[UserExtensions.TianoCore."ExtraFiles"] + MemInfoDxeExtra.uni diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreen= .h b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreen.h new file mode 100644 index 000000000000..9dce952c9932 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreen.h @@ -0,0 +1,159 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef MEM_INFO_SCREEN_H_ +#define MEM_INFO_SCREEN_H_ + +#include + +#include +#include +#include +#include +#include +#include + +#include "MemInfoScreenNVDataStruct.h" + +// +// This is the generated IFR binary data for each formset defined in VFR. +// This data array is ready to be used as input of HiiAddPackages() to +// create a packagelist (which contains Form packages, String packages, et= c). +// +extern UINT8 MemInfoScreenVfrBin[]; + +// +// This is the generated String package data for all .UNI files. +// This data array is ready to be used as input of HiiAddPackages() to +// create a packagelist (which contains Form packages, String packages, et= c). +// +extern UINT8 MemInfoDxeStrings[]; + +typedef enum { + EccDisabled =3D 0, + EccSecded, + EccSymbol, + EccMax +} DDR_ECC_MODE; + +typedef enum { + ErrCtlrDeDisable =3D 0, + ErrCtlrDeEnable, + ErrCtlrDeMax +} DDR_ERROR_CTRL_MODE_DE; + +typedef enum { + ErrCtlrFiDisable =3D 0, + ErrCtlrFiEnable, + ErrCtlrFiMax +} DDR_ERROR_CTRL_MODE_FI; + +#define MEM_INFO_DDR_SPEED_SEL_OFFSET OFFSET_OF (MEM_I= NFO_VARSTORE_DATA, DDRSpeedSel) +#define MEM_INFO_ECC_MODE_SEL_OFFSET OFFSET_OF (MEM_I= NFO_VARSTORE_DATA, EccMode) +#define MEM_INFO_ERR_CTRL_DE_MODE_SEL_OFFSET OFFSET_OF (MEM_I= NFO_VARSTORE_DATA, ErrCtrl_DE) +#define MEM_INFO_ERR_CTRL_FI_MODE_SEL_OFFSET OFFSET_OF (MEM_I= NFO_VARSTORE_DATA, ErrCtrl_FI) +#define MEM_INFO_ERR_SLAVE_32BIT_OFFSET OFFSET_OF (MEM_I= NFO_VARSTORE_DATA, Slave32bit) +#define MEM_INFO_DDR_SCRUB_OFFSET OFFSET_OF (MEM_I= NFO_VARSTORE_DATA, ScrubPatrol) +#define MEM_INFO_DDR_DEMAND_SCRUB_OFFSET OFFSET_OF (MEM_I= NFO_VARSTORE_DATA, DemandScrub) +#define MEM_INFO_DDR_WRITE_CRC_OFFSET OFFSET_OF (MEM_I= NFO_VARSTORE_DATA, WriteCrc) +#define MEM_INFO_FGR_MODE_OFFSET OFFSET_OF (MEM_I= NFO_VARSTORE_DATA, FGRMode) +#define MEM_INFO_REFRESH2X_MODE_OFFSET OFFSET_OF (MEM_I= NFO_VARSTORE_DATA, Refresh2x) +#define MEM_INFO_NVDIMM_MODE_SEL_OFFSET OFFSET_OF (MEM_I= NFO_VARSTORE_DATA, NvdimmModeSel) + +#define MEM_INFO_SCREEN_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('M= ', 'E', 'M', 'i') + +#define MEM_INFO_DDR_SPEED_SEL_QUESTION_ID 0x8001 +#define MEM_INFO_FORM_PERFORMANCE_QUESTION_ID 0x8002 +#define MEM_INFO_FORM_PERFORMANCE_ECC_QUESTION_ID 0x8003 +#define MEM_INFO_FORM_PERFORMANCE_ERR_CTRL_DE_QUESTION_ID 0x8004 +#define MEM_INFO_FORM_PERFORMANCE_ERR_CTRL_FI_QUESTION_ID 0x8005 +#define MEM_INFO_DDR_SLAVE_32BIT_QUESTION_ID 0x8006 +#define MEM_INFO_DDR_SCRUB_PATROL_QUESTION_ID 0x8007 +#define MEM_INFO_DDR_DEMAND_SCRUB_QUESTION_ID 0x8008 +#define MEM_INFO_DDR_WRITE_CRC_QUESTION_ID 0x8009 +#define MEM_INFO_FGR_MODE_QUESTION_ID 0x800A +#define MEM_INFO_REFRESH2X_MODE_QUESTION_ID 0x800B +#define MEM_INFO_FORM_NVDIMM_QUESTION_ID 0x800C +#define MEM_INFO_FORM_NVDIMM_MODE_SEL_QUESTION_ID 0x800D + +#define MAX_NUMBER_OF_HOURS_IN_A_DAY 24 + +#define DDR_DEFAULT_SCRUB_PATROL_DURATION 24 +#define DDR_DEFAULT_DEMAND_SCRUB 1 +#define DDR_DEFAULT_WRITE_CRC 0 +#define DDR_DEFAULT_FGR_MODE 0 +#define DDR_DEFAULT_REFRESH2X_MODE 0 +#define DDR_DEFAULT_NVDIMM_MODE_SEL 3 + +#define DDR_FGR_MODE_GET(Value) ((Value) & 0x3) /* Bit 0, 1 */ +#define DDR_FGR_MODE_SET(Dst, Src) do { Dst =3D (((Dst) & ~0x3) | (= (Src) & 0x3)); } while (0) + +#define DDR_REFRESH_2X_GET(Value) ((Value) & 0x10000) >> 16 /* Bit= 16 only */ +#define DDR_REFRESH_2X_SET(Dst, Src) do { Dst =3D (((Dst) & ~0x10000)= | ((Src) & 0x1) << 16); } while (0) + +#define DDR_NVDIMM_MODE_SEL_MASK 0x7FFFFFFF +#define DDR_NVDIMM_MODE_SEL_VALID_BIT BIT31 + +typedef struct { + UINTN Signature; + + EFI_HANDLE DriverHandle; + EFI_HII_HANDLE HiiHandle; + MEM_INFO_VARSTORE_DATA VarStoreConfig; + + // + // Consumed protocol + // + EFI_HII_DATABASE_PROTOCOL *HiiDatabase; + EFI_HII_STRING_PROTOCOL *HiiString; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL *HiiKeywordHandler; + EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2; + + // + // Produced protocol + // + EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess; +} MEM_INFO_SCREEN_PRIVATE_DATA; + +#define MEM_INFO_SCREEN_PRIVATE_FROM_THIS(a) CR (a, MEM_INFO_SCREEN_PRIVA= TE_DATA, ConfigAccess, MEM_INFO_SCREEN_PRIVATE_DATA_SIGNATURE) + +#pragma pack(1) + +/// +/// HII specific Vendor Device Path definition. +/// +typedef struct { + VENDOR_DEVICE_PATH VendorDevicePath; + EFI_DEVICE_PATH_PROTOCOL End; +} HII_VENDOR_DEVICE_PATH; + +#pragma pack() + +EFI_STATUS +MemInfoScreenInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); + +EFI_STATUS +MemInfoScreenUnload ( + IN EFI_HANDLE ImageHandle + ); + +EFI_STATUS +MemInfoNvparamGet ( + OUT MEM_INFO_VARSTORE_DATA *VarStoreConfig + ); + +EFI_STATUS +MemInfoNvparamSet ( + IN MEM_INFO_VARSTORE_DATA *VarStoreConfig + ); + +#endif /* MEM_INFO_SCREEN_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreen= NVDataStruct.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoSc= reenNVDataStruct.h new file mode 100644 index 000000000000..75960c367880 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreenNVDataS= truct.h @@ -0,0 +1,47 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef MEM_INFO_SCREEN_NV_DATA_STRUCT_H_ +#define MEM_INFO_SCREEN_NV_DATA_STRUCT_H_ + +#define MEM_INFO_VARSTORE_NAME L"MemInfoIfrNVData" +#define MEM_INFO_VARSTORE_ID 0x1234 +#define MEM_INFO_FORM_ID 0x1235 +#define MEM_INFO_FORM_PERFORMANCE_ID 0x1236 +#define MEM_INFO_FORM_NVDIMM_ID 0x1237 +#define MEM_INFO_FORM_SET_GUID { 0xd58338ee, 0xe9f7, 0x= 4d8d, { 0xa7, 0x08, 0xdf, 0xb2, 0xc6, 0x66, 0x1d, 0x61 } } +#define MEM_INFO_FORM_SET_PERFORMANCE_GUID { 0x4a072c78, 0x42f9, 0x= 11ea, { 0xb7, 0x7f, 0x2e, 0x28, 0xce, 0x88, 0x12, 0x62 } } + +#pragma pack(1) + +// +// NV data structure definition +// +typedef struct { + UINT32 DDRSpeedSel; + UINT32 EccMode; + UINT32 ErrCtrl_DE; + UINT32 ErrCtrl_FI; + UINT32 Slave32bit; + UINT32 ScrubPatrol; + UINT32 DemandScrub; + UINT32 WriteCrc; + UINT32 FGRMode; + UINT32 Refresh2x; + UINT32 NvdimmModeSel; +} MEM_INFO_VARSTORE_DATA; + +// +// Labels definition +// +#define LABEL_UPDATE 0x2223 +#define LABEL_END 0x2224 + +#pragma pack() + +#endif diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreen= Vfr.vfr b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreenVfr= .vfr new file mode 100644 index 000000000000..e3d7aa0c44bd --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreenVfr.vfr @@ -0,0 +1,62 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include "MemInfoScreenNVDataStruct.h" + +formset + guid =3D MEM_INFO_FORM_SET_GUID, + title =3D STRING_TOKEN(STR_MEM_INFO_FORM), + help =3D STRING_TOKEN(STR_MEM_INFO_FORM_HELP), + classguid =3D gPlatformManagerFormsetGuid, + + // + // Define a variable Storage + // + varstore MEM_INFO_VARSTORE_DATA, + varid =3D MEM_INFO_VARSTORE_ID, + name =3D MemInfoIfrNVData, + guid =3D MEM_INFO_FORM_SET_GUID; + + form + formid =3D MEM_INFO_FORM_ID, + title =3D STRING_TOKEN(STR_MEM_INFO_FORM); + + subtitle text =3D STRING_TOKEN(STR_MEM_INFO_FORM); + + label LABEL_UPDATE; + // dynamic content here + label LABEL_END; + + endform; + + form + formid =3D MEM_INFO_FORM_PERFORMANCE_ID, + title =3D STRING_TOKEN(STR_MEM_INFO_PERFORMANCE_FORM); + + subtitle text =3D STRING_TOKEN(STR_MEM_INFO_PERFORMANCE_FORM); + + label LABEL_UPDATE; + // dynamic content here + label LABEL_END; + + endform; + + form + formid =3D MEM_INFO_FORM_NVDIMM_ID, + title =3D STRING_TOKEN(STR_MEM_INFO_NVDIMM_FORM); + + subtitle text =3D STRING_TOKEN(STR_MEM_INFO_NVDIMM_FORM); + + label LABEL_UPDATE; + // dynamic content here + label LABEL_END; + + endform; + +endformset; diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoNvramL= ib.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoNvramLib.c new file mode 100644 index 000000000000..32b8c9f416b8 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoNvramLib.c @@ -0,0 +1,394 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include + +#include "MemInfoScreen.h" +#include "NVParamDef.h" + +#define DDR_NVPARAM_ERRCTRL_DE_FIELD_SHIFT 0 +#define DDR_NVPARAM_ERRCTRL_DE_FIELD_MASK 0x1 + +#define DDR_NVPARAM_ERRCTRL_FI_FIELD_SHIFT 1 +#define DDR_NVPARAM_ERRCTRL_FI_FIELD_MASK 0x2 + +/** + This is function collects meminfo from NVParam + + @param Data The buffer to return the contents. + + @retval EFI_SUCCESS Get response data successfully. + @retval Other value Failed to get meminfo from NVParam +**/ +EFI_STATUS +MemInfoNvparamGet ( + OUT MEM_INFO_VARSTORE_DATA *VarStoreConfig + ) +{ + UINT32 Value; + EFI_STATUS Status; + + ASSERT (VarStoreConfig !=3D NULL); + + Status =3D NVParamGet ( + NV_SI_DDR_SPEED, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + VarStoreConfig->DDRSpeedSel =3D 0; /* Default auto mode */ + } else { + VarStoreConfig->DDRSpeedSel =3D Value; + } + + Status =3D NVParamGet ( + NV_SI_DDR_ECC_MODE, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + VarStoreConfig->EccMode =3D EccSecded; /* Default enable */ + } else { + VarStoreConfig->EccMode =3D Value; + } + + Status =3D NVParamGet ( + NV_SI_DDR_ERRCTRL, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + VarStoreConfig->ErrCtrl_DE =3D ErrCtlrDeEnable; + VarStoreConfig->ErrCtrl_FI =3D ErrCtlrFiEnable; + } else { + VarStoreConfig->ErrCtrl_DE =3D (Value & DDR_NVPARAM_ERRCTRL_DE_FIELD_M= ASK) >> DDR_NVPARAM_ERRCTRL_DE_FIELD_SHIFT; + VarStoreConfig->ErrCtrl_FI =3D (Value & DDR_NVPARAM_ERRCTRL_FI_FIELD_M= ASK) >> DDR_NVPARAM_ERRCTRL_FI_FIELD_SHIFT; + } + + Status =3D NVParamGet ( + NV_SI_DDR_SLAVE_32BIT_MEM_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + VarStoreConfig->Slave32bit =3D 0; /* Default disabled */ + } else { + VarStoreConfig->Slave32bit =3D Value; + } + + Status =3D NVParamGet ( + NV_SI_DDR_SCRUB_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + VarStoreConfig->ScrubPatrol =3D DDR_DEFAULT_SCRUB_PATROL_DURATION; + } else { + VarStoreConfig->ScrubPatrol =3D Value; + } + + Status =3D NVParamGet ( + NV_SI_DDR_WR_BACK_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + VarStoreConfig->DemandScrub =3D DDR_DEFAULT_DEMAND_SCRUB; + } else { + VarStoreConfig->DemandScrub =3D Value; + } + + Status =3D NVParamGet ( + NV_SI_DDR_CRC_MODE, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + VarStoreConfig->WriteCrc =3D DDR_DEFAULT_WRITE_CRC; + } else { + VarStoreConfig->WriteCrc =3D Value; + } + + Status =3D NVParamGet ( + NV_SI_DDR_REFRESH_GRANULARITY, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + VarStoreConfig->FGRMode =3D DDR_DEFAULT_FGR_MODE; + VarStoreConfig->Refresh2x =3D DDR_DEFAULT_REFRESH2X_MODE; + } else { + VarStoreConfig->FGRMode =3D DDR_FGR_MODE_GET (Value); + VarStoreConfig->Refresh2x =3D DDR_REFRESH_2X_GET (Value); + } + + Status =3D NVParamGet ( + NV_SI_NVDIMM_MODE, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + VarStoreConfig->NvdimmModeSel =3D DDR_DEFAULT_NVDIMM_MODE_SEL; + } else { + VarStoreConfig->NvdimmModeSel =3D Value & DDR_NVDIMM_MODE_SEL_MASK; /*= Mask out valid bit */ + } + + return EFI_SUCCESS; +} + +/** + This is function stores meminfo to corresponding NVParam + + @param VarStoreConfig The contents for the variable. + + @retval EFI_SUCCESS Set data successfully. + @retval Other value Failed to set meminfo to NVParam + +**/ +EFI_STATUS +MemInfoNvparamSet ( + IN MEM_INFO_VARSTORE_DATA *VarStoreConfig + ) +{ + EFI_STATUS Status; + UINT32 Value, TmpValue, Value2, Update; + + ASSERT (VarStoreConfig !=3D NULL); + + /* Set DDR speed */ + Status =3D NVParamGet ( + NV_SI_DDR_SPEED, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU |NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status) || Value !=3D VarStoreConfig->DDRSpeedSel) { + Status =3D NVParamSet ( + NV_SI_DDR_SPEED, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU |NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + VarStoreConfig->DDRSpeedSel + ); + if (EFI_ERROR (Status)) { + return Status; + } + } + + /* Set ECC mode */ + Status =3D NVParamGet ( + NV_SI_DDR_ECC_MODE, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU |NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status) || Value !=3D VarStoreConfig->EccMode) { + Status =3D NVParamSet ( + NV_SI_DDR_ECC_MODE, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU |NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + VarStoreConfig->EccMode + ); + if (EFI_ERROR (Status)) { + return Status; + } + } + + /* Set ErrCtrl */ + TmpValue =3D (VarStoreConfig->ErrCtrl_DE << DDR_NVPARAM_ERRCTRL_DE_FIELD= _SHIFT) | + (VarStoreConfig->ErrCtrl_FI << DDR_NVPARAM_ERRCTRL_FI_FIELD_S= HIFT); + Status =3D NVParamGet ( + NV_SI_DDR_ERRCTRL, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU |NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status) || Value !=3D TmpValue ) { + Status =3D NVParamSet ( + NV_SI_DDR_ERRCTRL, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU |NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + TmpValue + ); + if (EFI_ERROR (Status)) { + return Status; + } + } + + /* Set slave's 32bit region */ + TmpValue =3D VarStoreConfig->Slave32bit; + Status =3D NVParamGet ( + NV_SI_DDR_SLAVE_32BIT_MEM_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU |NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status) || Value !=3D TmpValue ) { + if (TmpValue =3D=3D 0) { + /* Default is disabled so just clear nvparam */ + Status =3D NVParamClr ( + NV_SI_DDR_SLAVE_32BIT_MEM_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU |NV_PERM_BMC + ); + } else { + Status =3D NVParamSet ( + NV_SI_DDR_SLAVE_32BIT_MEM_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU |NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + TmpValue + ); + } + if (EFI_ERROR (Status)) { + return Status; + } + } + + /* Set Scrub patrol */ + TmpValue =3D VarStoreConfig->ScrubPatrol; + Status =3D NVParamGet ( + NV_SI_DDR_SCRUB_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU |NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status) || Value !=3D TmpValue ) { + if (TmpValue =3D=3D DDR_DEFAULT_SCRUB_PATROL_DURATION) { + Status =3D NVParamClr ( + NV_SI_DDR_SCRUB_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU |NV_PERM_BMC + ); + } else { + Status =3D NVParamSet ( + NV_SI_DDR_SCRUB_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU |NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + TmpValue + ); + } + if (EFI_ERROR (Status)) { + return Status; + } + } + + /* Demand Scrub */ + TmpValue =3D VarStoreConfig->DemandScrub; + Status =3D NVParamGet ( + NV_SI_DDR_WR_BACK_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU |NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status) || Value !=3D TmpValue ) { + if (TmpValue =3D=3D DDR_DEFAULT_DEMAND_SCRUB) { + Status =3D NVParamClr ( + NV_SI_DDR_WR_BACK_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU |NV_PERM_BMC + ); + } else { + Status =3D NVParamSet ( + NV_SI_DDR_WR_BACK_EN, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU |NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + TmpValue + ); + } + if (EFI_ERROR (Status)) { + return Status; + } + } + + /* Write CRC */ + TmpValue =3D VarStoreConfig->WriteCrc; + Status =3D NVParamGet ( + NV_SI_DDR_CRC_MODE, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status) || Value !=3D TmpValue ) { + if (TmpValue =3D=3D DDR_DEFAULT_WRITE_CRC) { + Status =3D NVParamClr ( + NV_SI_DDR_CRC_MODE, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC + ); + } else { + Status =3D NVParamSet ( + NV_SI_DDR_CRC_MODE, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + TmpValue + ); + } + if (EFI_ERROR (Status)) { + return Status; + } + } + + /* Write FGR/Refresh2X */ + Value =3D 0; + Update =3D 0; + TmpValue =3D VarStoreConfig->FGRMode; + Status =3D NVParamGet ( + NV_SI_DDR_REFRESH_GRANULARITY, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + Value2 =3D DDR_FGR_MODE_GET (Value); + if ((EFI_ERROR (Status) && TmpValue !=3D DDR_DEFAULT_FGR_MODE) + || Value2 !=3D TmpValue) + { + DDR_FGR_MODE_SET (Value, TmpValue); + Update =3D 1; + } + + Value2 =3D DDR_REFRESH_2X_GET (Value); + TmpValue =3D VarStoreConfig->Refresh2x; + if ((EFI_ERROR (Status) && TmpValue !=3D DDR_DEFAULT_REFRESH2X_MODE) + || Value2 !=3D TmpValue) + { + DDR_REFRESH_2X_SET (Value, TmpValue); + Update =3D 1; + } + + if (Update =3D=3D 1) { + Status =3D NVParamSet ( + NV_SI_DDR_REFRESH_GRANULARITY, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Value + ); + if (EFI_ERROR (Status)) { + return Status; + } + } + + /* Write NVDIMM-N Mode selection */ + Value =3D 0; + TmpValue =3D VarStoreConfig->NvdimmModeSel; + Status =3D NVParamGet ( + NV_SI_NVDIMM_MODE, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + Value2 =3D Value & DDR_NVDIMM_MODE_SEL_MASK; /* Mask out valid bit */ + if (EFI_ERROR (Status) || Value2 !=3D TmpValue ) { + if (TmpValue =3D=3D DDR_DEFAULT_NVDIMM_MODE_SEL) { + Status =3D NVParamClr ( + NV_SI_NVDIMM_MODE, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC + ); + } else { + Value =3D TmpValue | DDR_NVDIMM_MODE_SEL_VALID_BIT; /* Add valid bit= */ + Status =3D NVParamSet ( + NV_SI_NVDIMM_MODE, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Value + ); + } + if (EFI_ERROR (Status)) { + return Status; + } + } + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreen= .c b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreen.c new file mode 100644 index 000000000000..4f75e1625de9 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreen.c @@ -0,0 +1,1395 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "MemInfoScreen.h" + +#define MAX_STRING_SIZE 64 +#define GB_SCALE_FACTOR (1024*1024*1024) +#define MB_SCALE_FACTOR (1024*1024) + +EFI_GUID gMemInfoFormSetGuid =3D MEM_INFO_FORM_SET_GUID; + +HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath =3D { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8)(sizeof (VENDOR_DEVICE_PATH)), + (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + MEM_INFO_FORM_SET_GUID + }, + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { + (UINT8)(END_DEVICE_PATH_LENGTH), + (UINT8)((END_DEVICE_PATH_LENGTH) >> 8) + } + } +}; + +EFI_HANDLE DriverHandle =3D NULL; +MEM_INFO_SCREEN_PRIVATE_DATA *mPrivateData =3D NULL; + +/** + This function allows a caller to extract the current configuration for o= ne + or more named elements from the target driver. + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param Request A null-terminated Unicode string in + format. + @param Progress On return, points to a character in the R= equest + string. Points to the string's null termi= nator if + request was successful. Points to the mos= t recent + '&' before the first failing name/value p= air (or + the beginning of the string if the failur= e is in + the first name/value pair) if the request= was not + successful. + @param Results A null-terminated Unicode string in + format which has all valu= es filled + in for the names in the Request string. S= tring to + be allocated by the called function. + @retval EFI_SUCCESS The Results is filled with the requested = values. + @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown nam= e. + @retval EFI_NOT_FOUND Routing data doesn't match any storage in= this + driver. +**/ +EFI_STATUS +EFIAPI +ExtractConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Request, + OUT EFI_STRING *Progress, + OUT EFI_STRING *Results + ) +{ + EFI_STATUS Status; + UINTN BufferSize; + MEM_INFO_SCREEN_PRIVATE_DATA *PrivateData; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + EFI_STRING ConfigRequest; + EFI_STRING ConfigRequestHdr; + UINTN Size; + CHAR16 *StrPointer; + BOOLEAN AllocatedRequest; + + if (Progress =3D=3D NULL || Results =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + // + // Initialize the local variables. + // + ConfigRequestHdr =3D NULL; + ConfigRequest =3D NULL; + Size =3D 0; + *Progress =3D Request; + AllocatedRequest =3D FALSE; + + PrivateData =3D MEM_INFO_SCREEN_PRIVATE_FROM_THIS (This); + HiiConfigRouting =3D PrivateData->HiiConfigRouting; + + // + // Get Buffer Storage data from EFI variable. + // Try to get the current setting from variable. + // + BufferSize =3D sizeof (MEM_INFO_VARSTORE_DATA); + Status =3D MemInfoNvparamGet (&PrivateData->VarStoreConfig); + if (EFI_ERROR (Status)) { + return EFI_NOT_FOUND; + } + + if (Request =3D=3D NULL) { + // + // Request is set to NULL, construct full request string. + // + + // + // Allocate and fill a buffer large enough to hold the tem= plate + // followed by "&OFFSET=3D0&WIDTH=3DWWWWWWWWWWWWWWWW" followed by a Nu= ll-terminator + // + ConfigRequestHdr =3D HiiConstructConfigHdr (&gMemInfoFormSetGuid, MEM_= INFO_VARSTORE_NAME, PrivateData->DriverHandle); + Size =3D (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16); + ConfigRequest =3D AllocateZeroPool (Size); + ASSERT (ConfigRequest !=3D NULL); + AllocatedRequest =3D TRUE; + UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=3D0&WIDTH=3D%016LX", C= onfigRequestHdr, (UINT64)BufferSize); + FreePool (ConfigRequestHdr); + ConfigRequestHdr =3D NULL; + } else { + // + // Check routing data in . + // Note: if only one Storage is used, then this checking could be skip= ped. + // + if (!HiiIsConfigHdrMatch (Request, &gMemInfoFormSetGuid, NULL)) { + return EFI_NOT_FOUND; + } + + // + // Set Request to the unified request string. + // + ConfigRequest =3D Request; + + // + // Check whether Request includes Request Element. + // + if (StrStr (Request, L"OFFSET") =3D=3D NULL) { + // + // Check Request Element does exist in Request String + // + StrPointer =3D StrStr (Request, L"PATH"); + if (StrPointer =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + if (StrStr (StrPointer, L"&") =3D=3D NULL) { + Size =3D (StrLen (Request) + 32 + 1) * sizeof (CHAR16); + ConfigRequest =3D AllocateZeroPool (Size); + ASSERT (ConfigRequest !=3D NULL); + AllocatedRequest =3D TRUE; + UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=3D0&WIDTH=3D%016LX= ", Request, (UINT64)BufferSize); + } + } + } + + // + // Check if requesting Name/Value storage + // + if (StrStr (ConfigRequest, L"OFFSET") =3D=3D NULL) { + // + // Don't have any Name/Value storage names + // + Status =3D EFI_SUCCESS; + } else { + // + // Convert buffer data to by helper function BlockToConfi= g() + // + Status =3D HiiConfigRouting->BlockToConfig ( + HiiConfigRouting, + ConfigRequest, + (UINT8 *)&PrivateData->VarStoreConfig, + BufferSize, + Results, + Progress + ); + } + + // + // Free the allocated config request string. + // + if (AllocatedRequest) { + FreePool (ConfigRequest); + } + + if (ConfigRequestHdr !=3D NULL) { + FreePool (ConfigRequestHdr); + } + // + // Set Progress string to the original request string. + // + if (Request =3D=3D NULL) { + *Progress =3D NULL; + } else if (StrStr (Request, L"OFFSET") =3D=3D NULL) { + *Progress =3D Request + StrLen (Request); + } + + return Status; +} + +/** + This function processes the results of changes in configuration. + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param Configuration A null-terminated Unicode string in + format. + @param Progress A pointer to a string filled in with the = offset of + the most recent '&' before the first fail= ing + name/value pair (or the beginning of the = string if + the failure is in the first name/value pa= ir) or + the terminating NULL if all was successfu= l. + @retval EFI_SUCCESS The Results is processed successfully. + @retval EFI_INVALID_PARAMETER Configuration is NULL. + @retval EFI_NOT_FOUND Routing data doesn't match any storage in= this + driver. +**/ +EFI_STATUS +EFIAPI +RouteConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Configuration, + OUT EFI_STRING *Progress + ) +{ + EFI_STATUS Status; + UINTN BufferSize; + MEM_INFO_SCREEN_PRIVATE_DATA *PrivateData; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + + if (Configuration =3D=3D NULL || Progress =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + PrivateData =3D MEM_INFO_SCREEN_PRIVATE_FROM_THIS (This); + HiiConfigRouting =3D PrivateData->HiiConfigRouting; + *Progress =3D Configuration; + + // + // Check routing data in . + // Note: if only one Storage is used, then this checking could be skippe= d. + // + if (!HiiIsConfigHdrMatch (Configuration, &gMemInfoFormSetGuid, NULL)) { + return EFI_NOT_FOUND; + } + + // + // Get Buffer Storage data from NVParam + // + Status =3D MemInfoNvparamGet (&PrivateData->VarStoreConfig); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Check if configuring Name/Value storage + // + if (StrStr (Configuration, L"OFFSET") =3D=3D NULL) { + // + // Don't have any Name/Value storage names + // + return EFI_SUCCESS; + } + + // + // Convert to buffer data by helper function ConfigToBlock() + // + BufferSize =3D sizeof (MEM_INFO_VARSTORE_DATA); + Status =3D HiiConfigRouting->ConfigToBlock ( + HiiConfigRouting, + Configuration, + (UINT8 *)&PrivateData->VarStoreConfig, + &BufferSize, + Progress + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Store Buffer Storage back to NVParam + // + Status =3D MemInfoNvparamSet (&PrivateData->VarStoreConfig); + + return Status; +} + +/** + This function processes the results of changes in configuration. + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param Action Specifies the type of action taken by the= browser. + @param QuestionId A unique value which is sent to the origi= nal + exporting driver so that it can identify = the type + of data to expect. + @param Type The type of value for the question. + @param Value A pointer to the data being sent to the o= riginal + exporting driver. + @param ActionRequest On return, points to the action requested= by the + callback function. + @retval EFI_SUCCESS The callback successfully handled the act= ion. + @retval EFI_INVALID_PARAMETER Configuration is NULL. + @retval EFI_UNSUPPORTED The specified Action is not supported by = the + callback. +**/ +EFI_STATUS +EFIAPI +DriverCallback ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN EFI_BROWSER_ACTION Action, + IN EFI_QUESTION_ID QuestionId, + IN UINT8 Type, + IN EFI_IFR_TYPE_VALUE *Value, + OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest + ) +{ + if (((Value =3D=3D NULL) && (Action !=3D EFI_BROWSER_ACTION_FORM_OPEN) + && (Action !=3D EFI_BROWSER_ACTION_FORM_CLOSE)) + || (ActionRequest =3D=3D NULL)) + { + return EFI_INVALID_PARAMETER; + } + + switch (Action) { + case EFI_BROWSER_ACTION_FORM_OPEN: + case EFI_BROWSER_ACTION_FORM_CLOSE: + break; + + case EFI_BROWSER_ACTION_DEFAULT_STANDARD: + case EFI_BROWSER_ACTION_DEFAULT_MANUFACTURING: + { + switch (QuestionId) { + case MEM_INFO_DDR_SPEED_SEL_QUESTION_ID: + // + // DDR speed selection default to auto + // + Value->u32 =3D 0; + break; + + case MEM_INFO_FORM_PERFORMANCE_ECC_QUESTION_ID: + // + // ECC mode default to be enabled + // + Value->u32 =3D EccSecded; + break; + + case MEM_INFO_FORM_PERFORMANCE_ERR_CTRL_DE_QUESTION_ID: + // + // ErrCtrl_DE default to be enabled + // + Value->u32 =3D ErrCtlrDeEnable; + break; + + case MEM_INFO_FORM_PERFORMANCE_ERR_CTRL_FI_QUESTION_ID: + // + // ErrCtrl_FI default to be enabled + // + Value->u32 =3D ErrCtlrDeEnable; + break; + + case MEM_INFO_DDR_SLAVE_32BIT_QUESTION_ID: + // + // Slave's 32bit region to be disabled + // + Value->u32 =3D 0; + break; + + case MEM_INFO_DDR_SCRUB_PATROL_QUESTION_ID: + Value->u32 =3D DDR_DEFAULT_SCRUB_PATROL_DURATION; + break; + + case MEM_INFO_DDR_DEMAND_SCRUB_QUESTION_ID: + Value->u32 =3D DDR_DEFAULT_DEMAND_SCRUB; + break; + + case MEM_INFO_DDR_WRITE_CRC_QUESTION_ID: + Value->u32 =3D DDR_DEFAULT_WRITE_CRC; + break; + + case MEM_INFO_FGR_MODE_QUESTION_ID: + Value->u32 =3D DDR_DEFAULT_FGR_MODE; + break; + + case MEM_INFO_REFRESH2X_MODE_QUESTION_ID: + Value->u32 =3D DDR_DEFAULT_REFRESH2X_MODE; + break; + + case MEM_INFO_FORM_NVDIMM_MODE_SEL_QUESTION_ID: + Value->u32 =3D DDR_DEFAULT_NVDIMM_MODE_SEL; + break; + } + } + break; + + case EFI_BROWSER_ACTION_RETRIEVE: + case EFI_BROWSER_ACTION_CHANGING: + case EFI_BROWSER_ACTION_SUBMITTED: + break; + + default: + return EFI_UNSUPPORTED; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +UpdateMemInfo ( + PLATFORM_INFO_HOB *PlatformHob + ) +{ + MEM_INFO_SCREEN_PRIVATE_DATA *PrivateData =3D mPrivateData; + CHAR16 Str[MAX_STRING_SIZE]; + EFI_HOB_RESOURCE_DESCRIPTOR *ResHob; + UINT64 Size; + + /* Update Total memory */ + UnicodeSPrint (Str, sizeof (Str), L"%d GB", PlatformHob->DramInfo.TotalS= ize / GB_SCALE_FACTOR); + HiiSetString ( + PrivateData->HiiHandle, + STRING_TOKEN (STR_MEM_INFO_TOTAL_MEM_VALUE), + Str, + NULL + ); + + /* Update effective memory */ + Size =3D 0; + ResHob =3D (EFI_HOB_RESOURCE_DESCRIPTOR *)GetFirstHob (EFI_HOB_TYPE_RESO= URCE_DESCRIPTOR); + while (ResHob !=3D NULL) { + if ((ResHob->ResourceType =3D=3D EFI_RESOURCE_SYSTEM_MEMORY)) { + Size +=3D ResHob->ResourceLength; + } + ResHob =3D (EFI_HOB_RESOURCE_DESCRIPTOR *)GetNextHob (EFI_HOB_TYPE_RES= OURCE_DESCRIPTOR,(VOID *)((UINTN)ResHob + ResHob->Header.HobLength)); + } + UnicodeSPrint (Str, sizeof (Str), L"%d GB", Size / GB_SCALE_FACTOR); + HiiSetString ( + PrivateData->HiiHandle, + STRING_TOKEN (STR_MEM_INFO_EFFECT_MEM_VALUE), + Str, + NULL + ); + + /* Update current DDR speed */ + UnicodeSPrint (Str, sizeof (Str), L"%d MHz", PlatformHob->DramInfo.MaxSp= eed); + HiiSetString ( + PrivateData->HiiHandle, + STRING_TOKEN (STR_MEM_INFO_CURRENT_SPEED_VALUE), + Str, + NULL + ); + + return EFI_SUCCESS; +} + +EFI_STATUS +AddMemorySpeedSelection ( + PLATFORM_INFO_HOB *PlatformHob, + VOID *StartOpCodeHandle + ) +{ + VOID *OptionsOpCodeHandle; + + // + // Create Option OpCode to display speed configuration + // + OptionsOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (OptionsOpCodeHandle !=3D NULL); + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_MEM_INFO_SPEED_SELECT_VALUE0), + 0, + EFI_IFR_NUMERIC_SIZE_4, + 0 + ); + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_MEM_INFO_SPEED_SELECT_VALUE1), + 0, + EFI_IFR_NUMERIC_SIZE_4, + 2133 + ); + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_MEM_INFO_SPEED_SELECT_VALUE2), + 0, + EFI_IFR_NUMERIC_SIZE_4, + 2400 + ); + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_MEM_INFO_SPEED_SELECT_VALUE3), + 0, + EFI_IFR_NUMERIC_SIZE_4, + 2666 + ); + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_MEM_INFO_SPEED_SELECT_VALUE4), + 0, + EFI_IFR_NUMERIC_SIZE_4, + 2933 + ); + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_MEM_INFO_SPEED_SELECT_VALUE5), + 0, + EFI_IFR_NUMERIC_SIZE_4, + 3200 + ); + + HiiCreateOneOfOpCode ( + StartOpCodeHandle, // Container for = dynamic created opcodes + MEM_INFO_DDR_SPEED_SEL_QUESTION_ID, // Question ID (o= r call it "key") + MEM_INFO_VARSTORE_ID, // VarStore ID + (UINT16)MEM_INFO_DDR_SPEED_SEL_OFFSET, // Offset in Buff= er Storage + STRING_TOKEN (STR_MEM_INFO_SPEED_SELECT_PROMPT), // Question promp= t text + STRING_TOKEN (STR_MEM_INFO_SPEED_SELECT_HELP), // Question help = text + EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED, // Question flag + EFI_IFR_NUMERIC_SIZE_4, // Data type of Q= uestion Value + OptionsOpCodeHandle, // Option Opcode = list + NULL // Default Opcode= is NULl + ); + + HiiFreeOpCodeHandle (OptionsOpCodeHandle); + + return EFI_SUCCESS; +} + +EFI_STATUS +AddFgrModeSelection ( + PLATFORM_INFO_HOB *PlatformHob, + VOID *StartOpCodeHandle + ) +{ + VOID *OptionsOpCodeHandle; + + // + // Create Option OpCode to display FGR mode configuration + // + OptionsOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (OptionsOpCodeHandle !=3D NULL); + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_MEM_INFO_FGR_MODE_VALUE0), + 0, + EFI_IFR_NUMERIC_SIZE_4, + 0 + ); + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_MEM_INFO_FGR_MODE_VALUE1), + 0, + EFI_IFR_NUMERIC_SIZE_4, + 1 + ); + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_MEM_INFO_FGR_MODE_VALUE2), + 0, + EFI_IFR_NUMERIC_SIZE_4, + 2 + ); + + HiiCreateOneOfOpCode ( + StartOpCodeHandle, // Container for = dynamic created opcodes + MEM_INFO_FGR_MODE_QUESTION_ID, // Question ID (o= r call it "key") + MEM_INFO_VARSTORE_ID, // VarStore ID + (UINT16)MEM_INFO_FGR_MODE_OFFSET, // Offset in Buff= er Storage + STRING_TOKEN (STR_MEM_INFO_FGR_MODE_PROMPT), // Question promp= t text + STRING_TOKEN (STR_MEM_INFO_FGR_MODE_HELP), // Question help = text + EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED, // Question flag + EFI_IFR_NUMERIC_SIZE_4, // Data type of Q= uestion Value + OptionsOpCodeHandle, // Option Opcode l= ist + NULL // Default Opcode= is NULl + ); + + HiiFreeOpCodeHandle (OptionsOpCodeHandle); + + return EFI_SUCCESS; +} + +EFI_STATUS +AddDimmListInfo ( + PLATFORM_INFO_HOB *PlatformHob, + VOID *StartOpCodeHandle + ) +{ + MEM_INFO_SCREEN_PRIVATE_DATA *PrivateData =3D mPrivateData; + CHAR16 Str[MAX_STRING_SIZE], Str1[MAX_STRING_SIZE]; + UINTN Count; + PLATFORM_DIMM_INFO *DimmInfo; + EFI_STRING_ID StringId; + + // + // Display DIMM list info + // + HiiCreateSubTitleOpCode ( + StartOpCodeHandle, + STRING_TOKEN (STR_MEM_INFO_DIMM_INFO), + 0, + 0, + 0 + ); + + for (Count =3D 0; Count < PlatformHob->DimmList.BoardDimmSlots; Count++)= { + DimmInfo =3D &PlatformHob->DimmList.Dimm[Count].Info; + switch (DimmInfo->DimmType) { + case UDIMM: + UnicodeSPrint (Str, sizeof (Str), L"%s", L"UDIMM"); + break; + + case RDIMM: + UnicodeSPrint (Str, sizeof (Str), L"%s", L"RDIMM"); + break; + + case SODIMM: + UnicodeSPrint (Str, sizeof (Str), L"%s", L"SODIMM"); + break; + + case LRDIMM: + UnicodeSPrint (Str, sizeof (Str), L"%s", L"LRDIMM"); + break; + + case RSODIMM: + UnicodeSPrint (Str, sizeof (Str), L"%s", L"RSODIMM"); + break; + + case NVRDIMM: + UnicodeSPrint (Str, sizeof (Str), L"%s", L"NV-RDIMM"); + break; + + default: + UnicodeSPrint (Str, sizeof (Str), L"Unknown Type"); + } + if (DimmInfo->DimmStatus =3D=3D DIMM_INSTALLED_OPERATIONAL) { + UnicodeSPrint (Str1, sizeof (Str1), L"Slot %2d: %d GB %s Installed&O= perational", Count + 1, DimmInfo->DimmSize, Str); + } else if (DimmInfo->DimmStatus =3D=3D DIMM_NOT_INSTALLED) { + UnicodeSPrint (Str1, sizeof (Str1), L"Slot %2d: Not Installed", Coun= t + 1, PlatformHob->DimmList.Dimm[Count].NodeId); + } else if (DimmInfo->DimmStatus =3D=3D DIMM_INSTALLED_NONOPERATIONAL) { + UnicodeSPrint (Str1, sizeof (Str1), L"Slot %2d: Installed&Non-Operat= ional", Count + 1, PlatformHob->DimmList.Dimm[Count].NodeId); + } else { + UnicodeSPrint (Str1, sizeof (Str1), L"Slot %2d: Installed&Failed", C= ount + 1, PlatformHob->DimmList.Dimm[Count].NodeId); + } + + StringId =3D HiiSetString (PrivateData->HiiHandle, 0, Str1, NULL); + + HiiCreateSubTitleOpCode ( + StartOpCodeHandle, + StringId, + 0, + 0, + 0 + ); + } + + return EFI_SUCCESS; +} + +EFI_STATUS +MemInfoMainScreen ( + PLATFORM_INFO_HOB *PlatformHob + ) +{ + MEM_INFO_SCREEN_PRIVATE_DATA *PrivateData =3D mPrivateData; + EFI_IFR_GUID_LABEL *StartLabel; + EFI_IFR_GUID_LABEL *EndLabel; + VOID *StartOpCodeHandle; + VOID *EndOpCodeHandle; + EFI_STATUS Status; + + Status =3D UpdateMemInfo (PlatformHob); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Get Buffer Storage data from EFI variable + // + Status =3D MemInfoNvparamGet (&PrivateData->VarStoreConfig); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Initialize the container for dynamic opcodes + // + StartOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (StartOpCodeHandle !=3D NULL); + + EndOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (EndOpCodeHandle !=3D NULL); + + // + // Create Hii Extend Label OpCode as the start opcode + // + StartLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (StartOpCodeHan= dle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL)); + StartLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + StartLabel->Number =3D LABEL_UPDATE; + + // + // Create Hii Extend Label OpCode as the end opcode + // + EndLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (EndOpCodeHandle,= &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL)); + EndLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + EndLabel->Number =3D LABEL_END; + + // + // Create a total mem title + // + HiiCreateTextOpCode ( + StartOpCodeHandle, + STRING_TOKEN (STR_MEM_INFO_TOTAL_MEM), + STRING_TOKEN (STR_MEM_INFO_TOTAL_MEM), + STRING_TOKEN (STR_MEM_INFO_TOTAL_MEM_VALUE) + ); + + // + // Create a effective mem title + // + HiiCreateTextOpCode ( + StartOpCodeHandle, + STRING_TOKEN (STR_MEM_INFO_EFFECT_MEM), + STRING_TOKEN (STR_MEM_INFO_EFFECT_MEM), + STRING_TOKEN (STR_MEM_INFO_EFFECT_MEM_VALUE) + ); + + // + // Create a current speed title + // + HiiCreateTextOpCode ( + StartOpCodeHandle, + STRING_TOKEN (STR_MEM_INFO_CURRENT_SPEED), + STRING_TOKEN (STR_MEM_INFO_CURRENT_SPEED), + STRING_TOKEN (STR_MEM_INFO_CURRENT_SPEED_VALUE) + ); + + if (IsSlaveSocketActive ()) { + // + // Display enable slave's 32bit region + // + HiiCreateCheckBoxOpCode ( + StartOpCodeHandle, // Container f= or dynamic created opcodes + MEM_INFO_DDR_SLAVE_32BIT_QUESTION_ID, // Question ID + MEM_INFO_VARSTORE_ID, // VarStore ID + (UINT16)MEM_INFO_ERR_SLAVE_32BIT_OFFSET, // Offset in B= uffer Storage + STRING_TOKEN (STR_MEM_INFO_ENABLE_32GB_SLAVE_PROMPT), // Question pr= ompt text + STRING_TOKEN (STR_MEM_INFO_ENABLE_32GB_SLAVE_HELP), // Question he= lp text + EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED, + 0, + NULL + ); + } + + Status =3D AddMemorySpeedSelection (PlatformHob, StartOpCodeHandle); + ASSERT_EFI_ERROR (Status); + + Status =3D AddFgrModeSelection (PlatformHob, StartOpCodeHandle); + ASSERT_EFI_ERROR (Status); + + // + // Create a Goto OpCode to ras memory configuration + // + HiiCreateGotoOpCode ( + StartOpCodeHandle, // Container for dy= namic created opcodes + MEM_INFO_FORM_PERFORMANCE_ID, // Target Form ID + STRING_TOKEN (STR_MEM_INFO_PERFORMANCE_FORM), // Prompt text + STRING_TOKEN (STR_MEM_INFO_PERFORMANCE_FORM_HELP), // Help text + 0, // Question flag + MEM_INFO_FORM_PERFORMANCE_QUESTION_ID // Question ID + ); + + // + // Create a Goto OpCode to nvdimm-n configuration + // + HiiCreateGotoOpCode ( + StartOpCodeHandle, // Container for dynamic= created opcodes + MEM_INFO_FORM_NVDIMM_ID, // Target Form ID + STRING_TOKEN (STR_MEM_INFO_NVDIMM_FORM), // Prompt text + STRING_TOKEN (STR_MEM_INFO_NVDIMM_FORM_HELP), // Help text + 0, // Question flag + MEM_INFO_FORM_NVDIMM_QUESTION_ID // Question ID + ); + + Status =3D AddDimmListInfo (PlatformHob, StartOpCodeHandle); + ASSERT_EFI_ERROR (Status); + + HiiUpdateForm ( + PrivateData->HiiHandle, // HII handle + &gMemInfoFormSetGuid, // Formset GUID + MEM_INFO_FORM_ID, // Form ID + StartOpCodeHandle, // Label for where to insert opcodes + EndOpCodeHandle // Insert data + ); + + HiiFreeOpCodeHandle (StartOpCodeHandle); + HiiFreeOpCodeHandle (EndOpCodeHandle); + + return Status; +} + +EFI_STATUS +MemInfoMainPerformanceScreen ( + PLATFORM_INFO_HOB *PlatformHob + ) +{ + EFI_STATUS Status; + MEM_INFO_SCREEN_PRIVATE_DATA *PrivateData =3D mPrivateData; + VOID *StartOpCodeHandle; + VOID *OptionsEccOpCodeHandle, *OptionsScrubOpCod= eHandle; + EFI_IFR_GUID_LABEL *StartLabel; + VOID *EndOpCodeHandle; + EFI_IFR_GUID_LABEL *EndLabel; + EFI_STRING_ID StringId; + CHAR16 Str[MAX_STRING_SIZE]; + UINTN Idx; + + Status =3D EFI_SUCCESS; + + // + // Initialize the container for dynamic opcodes + // + StartOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (StartOpCodeHandle !=3D NULL); + + EndOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (EndOpCodeHandle !=3D NULL); + + // + // Create Hii Extend Label OpCode as the start opcode + // + StartLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (StartOpCodeHan= dle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL)); + StartLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + StartLabel->Number =3D LABEL_UPDATE; + + // + // Create Hii Extend Label OpCode as the end opcode + // + EndLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (EndOpCodeHandle,= &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL)); + EndLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + EndLabel->Number =3D LABEL_END; + + /* Display ECC mode selection */ + OptionsEccOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (OptionsEccOpCodeHandle !=3D NULL); + + UnicodeSPrint (Str, sizeof (Str), L"Disabled"); + StringId =3D HiiSetString (PrivateData->HiiHandle, 0, Str, NULL); + + HiiCreateOneOfOptionOpCode ( + OptionsEccOpCodeHandle, + StringId, + 0, + EFI_IFR_NUMERIC_SIZE_4, + 0 + ); + + UnicodeSPrint (Str, sizeof (Str), L"SECDED"); + StringId =3D HiiSetString (PrivateData->HiiHandle, 0, Str, NULL); + + HiiCreateOneOfOptionOpCode ( + OptionsEccOpCodeHandle, + StringId, + 0, + EFI_IFR_NUMERIC_SIZE_4, + 1 + ); + + UnicodeSPrint (Str, sizeof (Str), L"Symbol"); + StringId =3D HiiSetString (PrivateData->HiiHandle, 0, Str, NULL); + + HiiCreateOneOfOptionOpCode ( + OptionsEccOpCodeHandle, + StringId, + 0, + EFI_IFR_NUMERIC_SIZE_4, + 2 + ); + + HiiCreateOneOfOpCode ( + StartOpCodeHandle, // Container for = dynamic created opcodes + MEM_INFO_FORM_PERFORMANCE_ECC_QUESTION_ID, // Question ID (o= r call it "key") + MEM_INFO_VARSTORE_ID, // VarStore ID + (UINT16)MEM_INFO_ECC_MODE_SEL_OFFSET, // Offset in Buff= er Storage + STRING_TOKEN (STR_MEM_INFO_ENABLE_ECC_PROMPT), // Question promp= t text + STRING_TOKEN (STR_MEM_INFO_ENABLE_ECC_HELP), // Question help = text + EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED, // Question flag + EFI_IFR_NUMERIC_SIZE_4, // Data type of Q= uestion Value + OptionsEccOpCodeHandle, // Option Opcode = list + NULL // Default Opcode= is NULl + ); + + /* + * Display ErrCtrl options + */ + HiiCreateCheckBoxOpCode ( + StartOpCodeHandle, // Container for= dynamic created opcodes + MEM_INFO_FORM_PERFORMANCE_ERR_CTRL_DE_QUESTION_ID, // Question ID + MEM_INFO_VARSTORE_ID, // VarStore ID + (UINT16)MEM_INFO_ERR_CTRL_DE_MODE_SEL_OFFSET, // Offset in Buf= fer Storage + STRING_TOKEN (STR_MEM_INFO_ENABLE_ERRCTRL_DE_PROMPT), // Question prom= pt text + STRING_TOKEN (STR_MEM_INFO_ENABLE_ERRCTRL_DE_HELP), // Question help= text + EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED, + 0, + NULL + ); + + HiiCreateCheckBoxOpCode ( + StartOpCodeHandle, // Container for= dynamic created opcodes + MEM_INFO_FORM_PERFORMANCE_ERR_CTRL_FI_QUESTION_ID, // Question ID + MEM_INFO_VARSTORE_ID, // VarStore ID + (UINT16)MEM_INFO_ERR_CTRL_FI_MODE_SEL_OFFSET, // Offset in Buf= fer Storage + STRING_TOKEN (STR_MEM_INFO_ENABLE_ERRCTRL_FI_PROMPT), // Question prom= pt text + STRING_TOKEN (STR_MEM_INFO_ENABLE_ERRCTRL_FI_HELP), // Question help= text + EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED, + 0, + NULL + ); + + /* Display Scrub Patrol selection */ + OptionsScrubOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (OptionsScrubOpCodeHandle !=3D NULL); + + UnicodeSPrint (Str, sizeof (Str), L"Disabled"); + StringId =3D HiiSetString (PrivateData->HiiHandle, 0, Str, NULL); + + HiiCreateOneOfOptionOpCode ( + OptionsScrubOpCodeHandle, + StringId, + 0, + EFI_IFR_NUMERIC_SIZE_4, + 0 + ); + + for (Idx =3D 1; Idx <=3D MAX_NUMBER_OF_HOURS_IN_A_DAY; Idx++) { + UnicodeSPrint (Str, sizeof (Str), L"%d", Idx); + StringId =3D HiiSetString ( + PrivateData->HiiHandle, + 0, + Str, + NULL + ); + HiiCreateOneOfOptionOpCode ( + OptionsScrubOpCodeHandle, + StringId, + 0, + EFI_IFR_NUMERIC_SIZE_4, + Idx + ); + } + + HiiCreateOneOfOpCode ( + StartOpCodeHandle, // Container for = dynamic created opcodes + MEM_INFO_DDR_SCRUB_PATROL_QUESTION_ID, // Question ID (o= r call it "key") + MEM_INFO_VARSTORE_ID, // VarStore ID + (UINT16)MEM_INFO_DDR_SCRUB_OFFSET, // Offset in Buff= er Storage + STRING_TOKEN (STR_MEM_INFO_ENABLE_SCRUB), // Question promp= t text + STRING_TOKEN (STR_MEM_INFO_ENABLE_SCRUB_HELP), // Question help = text + EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED, // Question flag + EFI_IFR_NUMERIC_SIZE_4, // Data type of Q= uestion Value + OptionsScrubOpCodeHandle, // Option Opcode = list + NULL // Default Opcode= is NULl + ); + + /* + * Display Demand Scrub options + */ + HiiCreateCheckBoxOpCode ( + StartOpCodeHandle, // Container f= or dynamic created opcodes + MEM_INFO_DDR_DEMAND_SCRUB_QUESTION_ID, // Question ID + MEM_INFO_VARSTORE_ID, // VarStore ID + (UINT16)MEM_INFO_DDR_DEMAND_SCRUB_OFFSET, // Offset in B= uffer Storage + STRING_TOKEN (STR_MEM_INFO_ENABLE_DEMAND_SCRUB_PROMPT), // Question pr= ompt text + STRING_TOKEN (STR_MEM_INFO_ENABLE_DEMAND_SCRUB_HELP), // Question he= lp text + EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED, + 0, + NULL + ); + + /* + * Display Write CRC options + */ + HiiCreateCheckBoxOpCode ( + StartOpCodeHandle, // Container for = dynamic created opcodes + MEM_INFO_DDR_WRITE_CRC_QUESTION_ID, // Question ID + MEM_INFO_VARSTORE_ID, // VarStore ID + (UINT16)MEM_INFO_DDR_WRITE_CRC_OFFSET, // Offset in Buff= er Storage + STRING_TOKEN (STR_MEM_INFO_ENABLE_WRITE_CRC_PROMPT), // Question promp= t text + STRING_TOKEN (STR_MEM_INFO_ENABLE_WRITE_CRC_HELP), // Question help = text + EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED, + 0, + NULL + ); + + /* + * Display CVE-2020-10255 options + */ + HiiCreateCheckBoxOpCode ( + StartOpCodeHandle, // Container for dy= namic created opcodes + MEM_INFO_REFRESH2X_MODE_QUESTION_ID, // Question ID + MEM_INFO_VARSTORE_ID, // VarStore ID + (UINT16)MEM_INFO_REFRESH2X_MODE_OFFSET, // Offset in Buffer= Storage + STRING_TOKEN (STR_MEM_INFO_REFRESH2X_MODE_PROMPT), // Question prompt = text + STRING_TOKEN (STR_MEM_INFO_REFRESH2X_MODE_HELP), // Question help te= xt + EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED, + 0, + NULL + ); + + HiiUpdateForm ( + PrivateData->HiiHandle, // HII handle + &gMemInfoFormSetGuid, // Formset GUID + MEM_INFO_FORM_PERFORMANCE_ID, // Form ID + StartOpCodeHandle, // Label for where to insert opco= des + EndOpCodeHandle // Insert data + ); + + HiiFreeOpCodeHandle (StartOpCodeHandle); + HiiFreeOpCodeHandle (EndOpCodeHandle); + HiiFreeOpCodeHandle (OptionsEccOpCodeHandle); + HiiFreeOpCodeHandle (OptionsScrubOpCodeHandle); + + return Status; +} + +EFI_STATUS +MemInfoMainNvdimmScreen ( + PLATFORM_INFO_HOB *PlatformHob + ) +{ + EFI_STATUS Status; + MEM_INFO_SCREEN_PRIVATE_DATA *PrivateData; + VOID *StartOpCodeHandle; + VOID *OptionsOpCodeHandle; + EFI_IFR_GUID_LABEL *StartLabel; + VOID *EndOpCodeHandle; + EFI_IFR_GUID_LABEL *EndLabel; + CHAR16 Str[MAX_STRING_SIZE]; + + Status =3D EFI_SUCCESS; + PrivateData =3D mPrivateData; + + if (PlatformHob =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + // + // Initialize the container for dynamic opcodes + // + StartOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (StartOpCodeHandle !=3D NULL); + + EndOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (EndOpCodeHandle !=3D NULL); + + // + // Create Hii Extend Label OpCode as the start opcode + // + StartLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode ( + StartOpCodeHandle, + &gEfiIfrTianoGuid, + NULL, + sizeof (EFI_IFR_GUID_LABEL) + ); + StartLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + StartLabel->Number =3D LABEL_UPDATE; + + // + // Create Hii Extend Label OpCode as the end opcode + // + EndLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode ( + EndOpCodeHandle, + &gEfiIfrTianoGuid, + NULL, + sizeof (EFI_IFR_GUID_LABEL) + ); + EndLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + EndLabel->Number =3D LABEL_END; + + // + // Update Current NVDIMM-N Mode title Socket0 + // + switch (PlatformHob->DramInfo.NvdimmMode[0]) { + case 0: + UnicodeSPrint (Str, sizeof (Str), L"%s", L"Non-NVDIMM"); + break; + + case 1: + UnicodeSPrint (Str, sizeof (Str), L"%s", L"Non-Hashed"); + break; + + case 2: + UnicodeSPrint (Str, sizeof (Str), L"%s", L"Hashed"); + break; + + default: + UnicodeSPrint (Str, sizeof (Str), L"%s", L"Unknown"); + break; + } + + HiiSetString ( + PrivateData->HiiHandle, + STRING_TOKEN (STR_MEM_INFO_NVDIMM_CUR_MODE_SK0_VALUE), + Str, + NULL + ); + + HiiCreateTextOpCode ( + StartOpCodeHandle, + STRING_TOKEN (STR_MEM_INFO_NVDIMM_CUR_MODE_SK0), + STRING_TOKEN (STR_MEM_INFO_NVDIMM_CUR_MODE_SK0), + STRING_TOKEN (STR_MEM_INFO_NVDIMM_CUR_MODE_SK0_VALUE) + ); + + // + // Update Current NVDIMM-N Mode title Socket1 + // + if (IsSlaveSocketActive ()) { + switch (PlatformHob->DramInfo.NvdimmMode[1]) { + case 0: + UnicodeSPrint (Str, sizeof (Str), L"%s", L"Non-NVDIMM"); + break; + + case 1: + UnicodeSPrint (Str, sizeof (Str), L"%s", L"Non-Hashed"); + break; + + case 2: + UnicodeSPrint (Str, sizeof (Str), L"%s", L"Hashed"); + break; + + default: + UnicodeSPrint (Str, sizeof (Str), L"%s", L"Unknown"); + break; + } + + HiiSetString ( + PrivateData->HiiHandle, + STRING_TOKEN (STR_MEM_INFO_NVDIMM_CUR_MODE_SK1_VALUE), + Str, + NULL + ); + + HiiCreateTextOpCode ( + StartOpCodeHandle, + STRING_TOKEN (STR_MEM_INFO_NVDIMM_CUR_MODE_SK1), + STRING_TOKEN (STR_MEM_INFO_NVDIMM_CUR_MODE_SK1), + STRING_TOKEN (STR_MEM_INFO_NVDIMM_CUR_MODE_SK1_VALUE) + ); + } + // + // Create Option OpCode to NVDIMM-N Mode Selection + // + OptionsOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (OptionsOpCodeHandle !=3D NULL); + + // + // Create OpCode to NVDIMM-N Mode Selection + // + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_MEM_INFO_NVDIMM_MODE_SEL_VALUE0), + 0, + EFI_IFR_NUMERIC_SIZE_4, + 0 + ); + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_MEM_INFO_NVDIMM_MODE_SEL_VALUE1), + 0, + EFI_IFR_NUMERIC_SIZE_4, + 1 + ); + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_MEM_INFO_NVDIMM_MODE_SEL_VALUE2), + 0, + EFI_IFR_NUMERIC_SIZE_4, + 2 + ); + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_MEM_INFO_NVDIMM_MODE_SEL_VALUE3), + 0, + EFI_IFR_NUMERIC_SIZE_4, + 3 + ); + + HiiCreateOneOfOpCode ( + StartOpCodeHandle, // Container for = dynamic created opcodes + MEM_INFO_FORM_NVDIMM_MODE_SEL_QUESTION_ID, // Question ID (o= r call it "key") + MEM_INFO_VARSTORE_ID, // VarStore ID + (UINT16)MEM_INFO_NVDIMM_MODE_SEL_OFFSET, // Offset in Buff= er Storage + STRING_TOKEN (STR_MEM_INFO_NVDIMM_MODE_SEL_PROMPT), // Question promp= t text + STRING_TOKEN (STR_MEM_INFO_NVDIMM_MODE_SEL_HELP), // Question help = text + EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED, // Question flag + EFI_IFR_NUMERIC_SIZE_4, // Data type of Q= uestion Value + OptionsOpCodeHandle, // Option Opcode = list + NULL // Default Opcode= is NULl + ); + + HiiUpdateForm ( + PrivateData->HiiHandle, // HII handle + &gMemInfoFormSetGuid, // Formset GUID + MEM_INFO_FORM_NVDIMM_ID, // Form ID + StartOpCodeHandle, // Label for where to insert opco= des + EndOpCodeHandle // Insert data + ); + + HiiFreeOpCodeHandle (StartOpCodeHandle); + HiiFreeOpCodeHandle (EndOpCodeHandle); + HiiFreeOpCodeHandle (OptionsOpCodeHandle); + + return Status; +} + +/** + This function sets up the first elements of the form. + @param PrivateData Private data. + @retval EFI_SUCCESS The form is set up successfully. +**/ +EFI_STATUS +MemInfoScreenSetup ( + VOID + ) +{ + EFI_STATUS Status; + VOID *Hob; + PLATFORM_INFO_HOB *PlatformHob; + + /* Get the Platform HOB */ + Hob =3D GetFirstGuidHob (&gPlatformInfoHobGuid); + if (Hob =3D=3D NULL) { + return EFI_DEVICE_ERROR; + } + PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + + Status =3D MemInfoMainScreen (PlatformHob); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D MemInfoMainPerformanceScreen (PlatformHob); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D MemInfoMainNvdimmScreen (PlatformHob); + if (EFI_ERROR (Status)) { + return Status; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +MemInfoScreenInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_HII_HANDLE HiiHandle; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + BOOLEAN ActionFlag; + EFI_STRING ConfigRequestHdr; + + // + // Initialize driver private data + // + mPrivateData =3D AllocateZeroPool (sizeof (MEM_INFO_SCREEN_PRIVATE_DATA)= ); + if (mPrivateData =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + mPrivateData->Signature =3D MEM_INFO_SCREEN_PRIVATE_DATA_SIGNATURE; + + mPrivateData->ConfigAccess.ExtractConfig =3D ExtractConfig; + mPrivateData->ConfigAccess.RouteConfig =3D RouteConfig; + mPrivateData->ConfigAccess.Callback =3D DriverCallback; + + // + // Locate ConfigRouting protocol + // + Status =3D gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL,= (VOID **)&HiiConfigRouting); + if (EFI_ERROR (Status)) { + return Status; + } + mPrivateData->HiiConfigRouting =3D HiiConfigRouting; + + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &DriverHandle, + &gEfiDevicePathProtocolGuid, + &mHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &mPrivateData->ConfigAccess, + NULL + ); + ASSERT_EFI_ERROR (Status); + + mPrivateData->DriverHandle =3D DriverHandle; + + // + // Publish our HII data + // + HiiHandle =3D HiiAddPackages ( + &gMemInfoFormSetGuid, + DriverHandle, + MemInfoDxeStrings, + MemInfoScreenVfrBin, + NULL + ); + if (HiiHandle =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + mPrivateData->HiiHandle =3D HiiHandle; + + // + // Try to read NV config EFI variable first + // + ConfigRequestHdr =3D HiiConstructConfigHdr ( + &gMemInfoFormSetGuid, + MEM_INFO_VARSTORE_NAME, + DriverHandle + ); + ASSERT (ConfigRequestHdr !=3D NULL); + + // + // Validate Current Setting + // + ActionFlag =3D HiiValidateSettings (ConfigRequestHdr); + if (!ActionFlag) { + MemInfoScreenUnload (ImageHandle); + return EFI_INVALID_PARAMETER; + } + FreePool (ConfigRequestHdr); + + Status =3D MemInfoScreenSetup (); + ASSERT_EFI_ERROR (Status); + + return EFI_SUCCESS; +} + +EFI_STATUS +MemInfoScreenUnload ( + IN EFI_HANDLE ImageHandle + ) +{ + ASSERT (mPrivateData !=3D NULL); + + if (DriverHandle !=3D NULL) { + gBS->UninstallMultipleProtocolInterfaces ( + DriverHandle, + &gEfiDevicePathProtocolGuid, + &mHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &mPrivateData->ConfigAccess, + NULL + ); + DriverHandle =3D NULL; + } + + if (mPrivateData->HiiHandle !=3D NULL) { + HiiRemovePackages (mPrivateData->HiiHandle); + } + + FreePool (mPrivateData); + mPrivateData =3D NULL; + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.un= i b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.uni new file mode 100644 index 000000000000..a8c7cb99d6a7 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.uni @@ -0,0 +1,9 @@ +// +// Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// + +#string STR_MODULE_ABSTRACT #language en-US "An Altra DDR scre= en setup driver" + +#string STR_MODULE_DESCRIPTION #language en-US "This driver expos= es a screen setup for DDR information and configuration." diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxeExt= ra.uni b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxeExtra.u= ni new file mode 100644 index 000000000000..f44f210594be --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxeExtra.uni @@ -0,0 +1,9 @@ +// +// Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// + +#string STR_PROPERTIES_MODULE_NAME +#language en-US +"Ampere Altra MemInfo DXE Driver" diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreen= Strings.uni b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScree= nStrings.uni new file mode 100644 index 000000000000..d170f9ee7313 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreenStrings= .uni @@ -0,0 +1,64 @@ +=EF=BB=BF// +// Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// + +#langdef en-US "English" // English + +#string STR_MEM_INFO_FORM #language en-US "Memory Config= uration" +#string STR_MEM_INFO_FORM_HELP #language en-US "Memory Config= uration" +#string STR_MEM_INFO_TOTAL_MEM #language en-US "Total Memory" +#string STR_MEM_INFO_TOTAL_MEM_VALUE #language en-US "0 GB" +#string STR_MEM_INFO_EFFECT_MEM #language en-US "Effective Mem= ory" +#string STR_MEM_INFO_EFFECT_MEM_VALUE #language en-US "0 MB" +#string STR_MEM_INFO_CURRENT_SPEED #language en-US "Memory Speed" +#string STR_MEM_INFO_CURRENT_SPEED_VALUE #language en-US "0 MHz" +#string STR_MEM_INFO_SPEED_SELECT_PROMPT #language en-US "Memory Operat= ing Speed Selection" +#string STR_MEM_INFO_SPEED_SELECT_HELP #language en-US "Force specifi= c Memory Operating Speed or use Auto setting." +#string STR_MEM_INFO_SPEED_SELECT_VALUE0 #language en-US "Auto" +#string STR_MEM_INFO_SPEED_SELECT_VALUE1 #language en-US "2133" +#string STR_MEM_INFO_SPEED_SELECT_VALUE2 #language en-US "2400" +#string STR_MEM_INFO_SPEED_SELECT_VALUE3 #language en-US "2666" +#string STR_MEM_INFO_SPEED_SELECT_VALUE4 #language en-US "2933" +#string STR_MEM_INFO_SPEED_SELECT_VALUE5 #language en-US "3200" +#string STR_MEM_INFO_DIMM_INFO #language en-US "DIMM Informat= ion" + +#string STR_MEM_INFO_PERFORMANCE_FORM #language en-US "Memory= RAS and Performance Configuration" +#string STR_MEM_INFO_PERFORMANCE_FORM_HELP #language en-US "Displa= ys and provides options to change the memory RAS and performance Settings" +#string STR_MEM_INFO_ENABLE_ECC_PROMPT #language en-US "ECC mo= de" +#string STR_MEM_INFO_ENABLE_ECC_HELP #language en-US "ECC mo= de: Disabled, SECDED or Symbol" +#string STR_MEM_INFO_ENABLE_ERRCTRL_DE_PROMPT #language en-US "Defer = uncorrectable read errors" +#string STR_MEM_INFO_ENABLE_ERRCTRL_DE_HELP #language en-US "When e= nabled the DMC defers uncorrectable read errors to the consumer by sending = an OK response and setting the TXDAT poison flag on the CHI-B interconnect.= If this bit is clear the DMC defaults to non-deferred behavior when encoun= tering an unrecoverable error" +#string STR_MEM_INFO_ENABLE_ERRCTRL_FI_PROMPT #language en-US "Fault = handling interrupt" +#string STR_MEM_INFO_ENABLE_ERRCTRL_FI_HELP #language en-US "Enable= s fault handling interrupt. The fault handling interrupt is raised to give = notice that ECC fault has been recorded" +#string STR_MEM_INFO_ENABLE_SCRUB #language en-US "Scrub = Patrol duration (hour)" +#string STR_MEM_INFO_ENABLE_SCRUB_HELP #language en-US "Select= duration (hour) for Scrub Patrol" +#string STR_MEM_INFO_ENABLE_DEMAND_SCRUB_PROMPT #language en-US "Demand= scrub" +#string STR_MEM_INFO_ENABLE_DEMAND_SCRUB_HELP #language en-US "Enable= /Disable the ability to write corrected data back to the memory once a corr= ectable error is detected" +#string STR_MEM_INFO_ENABLE_WRITE_CRC_PROMPT #language en-US "Write = CRC" +#string STR_MEM_INFO_ENABLE_WRITE_CRC_HELP #language en-US "Enable= /Disable Cyclic Redundancy Check (CRC) functionality on write data. Be note= d that enabling CRC will degrade Write bandwidth" + + +#string STR_MEM_INFO_ENABLE_32GB_SLAVE_PROMPT #language en-US "Enable= Slave 32bit memory region" +#string STR_MEM_INFO_ENABLE_32GB_SLAVE_HELP #language en-US "Enable= s 32bit memory region (2GB) for slave socket" +#string STR_MEM_INFO_FGR_MODE_PROMPT #language en-US "Fine G= ranularity Refresh (FGR)" +#string STR_MEM_INFO_FGR_MODE_VALUE0 #language en-US "1x" +#string STR_MEM_INFO_FGR_MODE_VALUE1 #language en-US "2x" +#string STR_MEM_INFO_FGR_MODE_VALUE2 #language en-US "4x" +#string STR_MEM_INFO_FGR_MODE_HELP #language en-US "Select= DDR Fine Granularity Refresh (FGR) mode 1x/2x/4x" +#string STR_MEM_INFO_REFRESH2X_MODE_PROMPT #language en-US "CVE-20= 20-10255 mitigation" +#string STR_MEM_INFO_REFRESH2X_MODE_HELP #language en-US "Enable= mitigation for CVE-2020-10255, TRRespass" + +#string STR_MEM_INFO_NVDIMM_FORM #language en-US "NVDIMM= -N Configuration" +#string STR_MEM_INFO_NVDIMM_FORM_HELP #language en-US "Displa= ys and provides options to change the NVDIMM-N Settings" +#string STR_MEM_INFO_NVDIMM_CUR_MODE_SK0 #language en-US "Socket= 0 Configured Mode" +#string STR_MEM_INFO_NVDIMM_CUR_MODE_SK1 #language en-US "Socket= 1 Configured Mode" +#string STR_MEM_INFO_NVDIMM_CUR_MODE_SK0_VALUE #language en-US "Non-NV= DIMM" +#string STR_MEM_INFO_NVDIMM_CUR_MODE_SK1_VALUE #language en-US "Non-NV= DIMM" +#string STR_MEM_INFO_NVDIMM_MODE_SEL_PROMPT #language en-US "Mode S= election" +#string STR_MEM_INFO_NVDIMM_MODE_SEL_VALUE0 #language en-US "Non-NV= DIMM" +#string STR_MEM_INFO_NVDIMM_MODE_SEL_VALUE1 #language en-US "Non-Ha= shed" +#string STR_MEM_INFO_NVDIMM_MODE_SEL_VALUE2 #language en-US "Hashed" +#string STR_MEM_INFO_NVDIMM_MODE_SEL_VALUE3 #language en-US "Auto" +#string STR_MEM_INFO_NVDIMM_MODE_SEL_HELP #language en-US "Select= NVDIMM-N Mode (Non-NVDIMM/Non-Hashed/Hashed/Auto)" --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83839): https://edk2.groups.io/g/devel/message/83839 Mute This Topic: https://groups.io/mt/87123912/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83840+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83840+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167865605215.70543688063174; Wed, 17 Nov 2021 08:51:05 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id v386YY1788612xDBZoTbuoQH; Wed, 17 Nov 2021 08:51:05 -0800 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.103]) by mx.groups.io with SMTP id smtpd.web09.9832.1637167864512811204 for ; Wed, 17 Nov 2021 08:51:04 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=an/l33Bo0s+mtia9HLYGhPv+8kQ5AXdURLrQqdf6t6eo4GNne/usZIdR9A8MVBvwF8XLsKu4ORwGbD9FlDpU9PEAMX8I4fQ0UC09/xmLrkOvnlVyZyPQIFRCHChxdd5CECjHFAF6sMxO7r7MC2FE4Mo8JYiSZyNjJVeRHc1otKixOYRf5HzOj5jg7AxK0dAuSkK5tgvB+TLF3mXdcRVmVDDmbLj6GzMtIxIig5Oyy2gGC9bINSB6oodJa+Sx+nTm2T3BhvQlaLZkt7KcGHDLMr+X8l6DsuNsliHE/oA6yuHzLTxGsgZEz/HE2JpUUt/hm5dJnaqyQilK5GaO8VAX9w== 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=mEjQOYrEOKpbcNtY3WMegr1vqUZST6m2vUAM2AzxTbQ=; b=MrD1UQyuv2YfgMZHExghtMoGzEgQufyvFveHckPJT9LhOgbMSwYlnJTVMB/yNf+IC3NgqjVex/kF13pk/YYAj2Qbx5F9PYHYzvFtgj7LItUNRaZie37V743p9+JrEZuh5/j7Q7JKSIiD7afMd9LlSXWDQNW0rSiccItxDma0xpU5mScKsIMWn54iFcCSZcAcw+tP5cVPpCI/n08BeDMfIVALgX29ruExyVC6LSoPsCTA629yG5FlOkQx7r3cSlb635uP7jBaRfm6933zJpGCbbrj1O83jW3y7wsEuLDJJ2R+zDjBom93WeLSpF/JcDtSKuUBVZFTvtf9enAmGx0mDA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB7400.prod.exchangelabs.com (2603:10b6:510:10b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.19; Wed, 17 Nov 2021 16:51:03 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:51:02 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 27/30] AmpereAltraPkg: Add configuration screen for CPU Date: Wed, 17 Nov 2021 23:47:24 +0700 Message-ID: <20211117164727.10922-28-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:51:00 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 58cb1753-2541-4d3e-6ddc-08d9a9ea70a3 X-MS-TrafficTypeDiagnostic: PH0PR01MB7400: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:69; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: 1p659PxOYOAX56jp2S48YtN5NQKWUenj9PjMOwkPz/lp4NtUGcxAd46CYNULwo9suP6DH0o695fZngxslta608hV4BWB+nuaMjEiX4eh6ddfQHDKI52jJpwJiOJQgj5aLrjqphRWxZXUAW6hlSKepMCGR6jeQBd54IcuDbMNtYxnUa5jcorH+mhtIuBImbtnCQYiKXUbgMbPZHB7d6lMlRyQ9Za69FGDd2To3eVkOmaiAzav9vvDPbnjZZ+6Cpl0jebY4oBMhZUuo+PW4dZmfJDM6soLbAYKMTen4EZsT6Jt0V/7ld2eKcECRQX9+kiztVHBfblhJdHqGFk6/rYyo1/dF6VfDX/FFtK26ZIAClE1zjMcDmxG0GXW5k5VhHhb5PBMQDHd6phiZhNQqdEs5V3C+5coMCiFOb/mLI9QiNhvy9KtewsHCANIMOxOZWTHTOAz/BxleMfJkMnClrwBRnortjBm/TjMX3tV5spNKAnCDqp2NcsP0ZBEFY8pKIN3bVlaxbwV5+5NDLqdNPnRBsGrzWmbARitb55RUsWFx35nzwL732z6vGq8stiK3ICvTT9FZq7Muw0ntltBgWWuu863Gz513gZOw82peIm1JxgO1oTgeMkruWml8vaMP4A1YyDfDTxfK7gmUeSvNbVeHCw+gLCPIECmRLTQtR7Arzi9pSzHvI8/ZpNc5YM6QZwjFPtP1r9qC2GGwA4G4lwOMM3JZO1egEFLvJYYmJnvREeH1s5XGo0Vg67aZHytzlPVd0u+eXWFO2TpHNBFlGn28w== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?L16x5hEHbGYo4mFzAHQIGzpPLrjITFu5zxjKScr9CsUz8/bH/8hWdj5yAqEI?= =?us-ascii?Q?NsKJHUoXDXw9nkYh3GPeVwxK+vv4nXo70eNEFiOgG8DBDfwSMrRtUH+/l/ce?= =?us-ascii?Q?vPmUwmgO5gCQkv8eRIz45P7D/J5re3hhcH10LVfQhaAC/3xR2LxqspHASC3D?= =?us-ascii?Q?pzA4UOvwuCQjHrtHDmq1P5mtPSzJ6ZdZLKMNffsaUCDA5kqeuV8LNN8OurJS?= =?us-ascii?Q?OfThNnQo1/B71nCYixz4dfKVHWnRHFi0HuyR86xS9GEOysv0L/kA/QsCmW+z?= =?us-ascii?Q?O56Vr3KA3SJSvBhLNHnASO95b5fNW1BnvOf2rbDPJnQ1ndHOlbLw3Cas2jzg?= =?us-ascii?Q?xyzklHp0VoZGK/tXVWkj625+VMzyKyuAA9DSAYKmlOsHuWgl3DqtIlBzvKI8?= =?us-ascii?Q?YmmV3gmgsDLKK1uYUdCJvEnXF3CotFZ44fTeakznViZKufRLddsPefse1XYg?= =?us-ascii?Q?NebRb9AJVFM2asNsL4DQRaqGHNeOd6XK+Fv6nez3jf6j3Jmh4Y3H5RExIOKX?= =?us-ascii?Q?3Xza5jnqDqWAY2Ne3WVW8YFlboOWG670YQzT/vg/o1U08YxkdK5QSfbNILGS?= =?us-ascii?Q?oH0cYfK/SKpSW9jYkOsYlvfvyy7G2/eiof9u+ViM7fJ4fAbyjTJ3sd2l+/nH?= =?us-ascii?Q?noWVEKxxndQYOazxOu8FGeJDwQBB4EqkYrnWZvTMQurSGpQ83l2cfaEc+uuR?= =?us-ascii?Q?NmFv03YDI1j3LhM84yGSB78udQsQFSBaMchpgKScstnMpRgnhTSWDgMpXpra?= =?us-ascii?Q?6jLopcUHegA+hk4geq6wJr/e9Hxm3EGBfqZ/xknleD2W2KXKZvWb6eVFGP8F?= =?us-ascii?Q?hlHo55phY1iESh8LHMPnBZSbSyp6RWCVgDRG//MDw5+ORcIQTAGwR7xtrDtV?= =?us-ascii?Q?LNPXvPLkVlLrclCn9HdVwKKthZeHY2AY51JzWI8SPfxlSJcfrKcs20CEk2FL?= =?us-ascii?Q?Z/LGonQKcY30m4vMpCLvWmkHWdHQTZdoJpo9u0HFokeB3GTYHeagIzFfv3b3?= =?us-ascii?Q?WhklKliB0QEhfxBuOdB5kmbYg5GFKbEbYmYCYPWr76bO84PumyBmzgcvnbYq?= =?us-ascii?Q?UFXKI9tAZmyZ1I/rjXxnVdQFkkM8fWCB1y3zetwBgOwL4FGEY1CF8mVGYzPe?= =?us-ascii?Q?16WzgVKKzC+4X5BVzjnZHnnMR43u81+08DFYRkSXQGzNYvZHsUKJ5Qwuu3LO?= =?us-ascii?Q?nSL7b9NSqR6Z4M9OvG+IBZORLxFTybRRULDL2ou90C8Sj/ezlP4pLAtJsNS/?= =?us-ascii?Q?EmCoU2019b9x7Ha0oAi081Bcy/jfk9CvPHMnP+rAWte+yy9DBkGr3M5dz7Bd?= =?us-ascii?Q?zx1++Gh8PEEP9p3nQBw1+eRM5LQ8kWofASo+l79ZZ/MKZTi2o/vDj/fieZzp?= =?us-ascii?Q?owTnhtpAN3SexwvefYEFtrBhGMQY5gx4XNwCCFZOKbKLpvuoSZolM0QVFLP8?= =?us-ascii?Q?2JqIzqbLuue5jAeDtdmLEyLkh7zaR7JJ/Xug3p2bpyRPRi0oOUL8OS18uzm3?= =?us-ascii?Q?qT+uIrCn8TrtlrFdtTDjd6sZv0ay38WKyr5qvui8RzWFZEU7Od4IAP4h2w4f?= =?us-ascii?Q?WVzh70vkxyXVDWaAtOlKfxCzkbHPR4/vxYCTPid0jFrCQowx5orMMxR7gOs1?= =?us-ascii?Q?9nYVYaml614QNjw1knwUTR5x0WDyO3K948mZ3nAWYI3dAIhMPzklhTn2V/sq?= =?us-ascii?Q?XOo5umGmSm+2JR6LHXiX8IuUOXY=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 58cb1753-2541-4d3e-6ddc-08d9a9ea70a3 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:51:02.9165 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oz2xnJfWAKonHZo3Ct4ee5k7vPKonsQ3z3fT3rHCYKx4PVgSrtPpXV4v+mdvtC8YAQyZ8mOeh87+bgDhP4rYoeis8GUCvYDh1v2P+jzBopg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7400 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: 6IvybmUdLHonZizVc5RQHypxx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167865; bh=mrkk1IdfNKNJfIXrECH6yq0aLoGC1sm33aYw/s8Rt/s=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=AlAIn9g1WbCPpbauu6roDrHYX6gFWQ1Jz194m/U15Mi6+zk+j4VMPz9AaEtySXCY2Cm 1eL5Hs0bNom2RXpWxyIic24F0aoSv+ahK3YEZ4Yzy23pc1k05fFsWkXSTT8ZCA5IXxTvQ 4d6lAUwguHDB/Po8Cx7xt5g4XHZgXb+aTXU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167867628100002 Content-Type: text/plain; charset="utf-8" This screen is to add configuration regarding CPU. Currently, this screen just adds a option for SubNUMA mode selection. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec = | 3 + Platform/Ampere/JadePkg/Jade.dsc = | 1 + Platform/Ampere/JadePkg/Jade.fdf = | 1 + Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.inf = | 58 +++ Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.h = | 52 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigNVDataStruc.h = | 19 + Silicon/Ampere/AmpereAltraPkg/Include/Guid/CpuConfigHii.h = | 19 + Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigVfr.vfr = | 43 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.c = | 530 ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigStrings.uni = | 17 + 10 files changed, 743 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Amp= ere/AmpereAltraPkg/AmpereAltraPkg.dec index 460255768aed..68e235b06c0c 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -64,3 +64,6 @@ [Guids] =20 ## Include/Guid/RootComplexConfigHii.h gRootComplexConfigFormSetGuid =3D { 0xE84E70D6, 0xE4B2, 0x4C6E, { 0x98, = 0x51, 0xCB, 0x2B, 0xAC, 0x77, 0x7D, 0xBB } } + + ## Include/Guid/CpuConfigHii.h + gCpuConfigFormSetGuid =3D { 0x43FAA144, 0xA2DF, 0x4050, { 0xA7, 0= xFD, 0xEE, 0x17, 0xC9, 0xB8, 0x88, 0x8E } } diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index 5cebd1e9d0c3..4dff28de920a 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -188,3 +188,4 @@ [Components.common] Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexCo= nfigDxe.inf Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.inf diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index 9a3236669858..869d802eccd4 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -354,5 +354,6 @@ [FV.FvMain] INF Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootCompl= exConfigDxe.inf INF Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDx= e.inf INF Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.inf =20 !include Silicon/Ampere/AmpereSiliconPkg/FvRules.fdf.inc diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDx= e.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.inf new file mode 100644 index 000000000000..2b13ef526685 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.inf @@ -0,0 +1,58 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D CpuConfigDxe + MODULE_UNI_FILE =3D CpuConfigDxe.uni + FILE_GUID =3D A20D8E6E-EE6C-43C5-809F-19BB930653AE + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D CpuConfigDxeEntryPoint + +[Sources.common] + CpuConfigDxe.c + CpuConfigDxe.h + CpuConfigNVDataStruc.h + CpuConfigVfr.vfr + CpuConfigStrings.uni + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + ArmLib + BaseLib + DebugLib + DevicePathLib + HiiLib + HobLib + IoLib + MemoryAllocationLib + NVParamLib + PcdLib + PrintLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + UefiRuntimeServicesTableLib + +[Protocols] + gEfiHiiConfigRoutingProtocolGuid ## CONSUMES + gEfiHiiConfigAccessProtocolGuid ## PRODUCES + gEfiDevicePathProtocolGuid ## PRODUCES + +[Guids] + gCpuConfigFormSetGuid + gPlatformManagerFormsetGuid + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDx= e.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.h new file mode 100644 index 000000000000..b7e74a09da5b --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.h @@ -0,0 +1,52 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef CPU_CONFIG_H_ +#define CPU_CONFIG_H_ + +#include "CpuConfigNVDataStruc.h" + +// +// This is the generated IFR binary data for each formset defined in VFR. +// +extern UINT8 CpuConfigVfrBin[]; + +// +// This is the generated String package data for all .UNI files. +// +extern UINT8 CpuConfigDxeStrings[]; + +#define CPU_CONFIG_PRIVATE_SIGNATURE SIGNATURE_32 ('C', 'P', 'U', '_') + +typedef struct { + UINTN Signature; + + EFI_HANDLE DriverHandle; + EFI_HII_HANDLE HiiHandle; + CPU_VARSTORE_DATA Configuration; + + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + + EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess; +} CPU_CONFIG_PRIVATE_DATA; + +#define CPU_CONFIG_PRIVATE_FROM_THIS(a) CR (a, CPU_CONFIG_PRIVATE_DATA, C= onfigAccess, CPU_CONFIG_PRIVATE_SIGNATURE) + +#pragma pack(1) + +/// +/// HII specific Vendor Device Path definition. +/// +typedef struct { + VENDOR_DEVICE_PATH VendorDevicePath; + EFI_DEVICE_PATH_PROTOCOL End; +} HII_VENDOR_DEVICE_PATH; + +#pragma pack() + +#endif /* CPU_CONFIG_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigNV= DataStruc.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigN= VDataStruc.h new file mode 100644 index 000000000000..dbcaebded1b7 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigNVDataStr= uc.h @@ -0,0 +1,19 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef CPU_CONFIG_NV_DATA_STRUC_H_ +#define CPU_CONFIG_NV_DATA_STRUC_H_ + +#pragma pack(1) +typedef struct { + UINT32 CpuSubNumaMode; +} CPU_VARSTORE_DATA; + +#pragma pack() + +#endif /* CPU_CONFIG_NV_DATA_STRUC_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Guid/CpuConfigHii.h b/Si= licon/Ampere/AmpereAltraPkg/Include/Guid/CpuConfigHii.h new file mode 100644 index 000000000000..71c8492f76a1 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/CpuConfigHii.h @@ -0,0 +1,19 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef CPU_CONFIG_HII_H_ +#define CPU_CONFIG_HII_H_ + +#define CPU_CONFIGURATION_FORMSET_GUID \ + { \ + 0x43FAA144, 0xA2DF, 0x4050, { 0xA7, 0xFD, 0xEE, 0x17, 0xC9, 0xB8, 0x88= , 0x8E } \ + } + +extern EFI_GUID gCpuConfigFormSetGuid; + +#endif /* CPU_CONFIG_HII_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigVf= r.vfr b/Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigVfr.vfr new file mode 100644 index 000000000000..8e68b1e9dcb7 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigVfr.vfr @@ -0,0 +1,43 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include "CpuConfigNVDataStruc.h" + +#define SUBNUMA_MODE_FORM_ID 1 + +formset + guid =3D CPU_CONFIGURATION_FORMSET_GUID, + title =3D STRING_TOKEN(STR_CPU_FORM), + help =3D STRING_TOKEN(STR_CPU_FORM_HELP), + classguid =3D gPlatformManagerFormsetGuid, + + varstore CPU_VARSTORE_DATA, + name =3D CpuConfigNVData, + guid =3D CPU_CONFIGURATION_FORMSET_GUID; + + form + formid =3D SUBNUMA_MODE_FORM_ID, + title =3D STRING_TOKEN(STR_CPU_FORM); + subtitle text =3D STRING_TOKEN(STR_CPU_FORM_HELP); + + oneof + varid =3D CpuConfigNVData.CpuSubNumaMode, + prompt =3D STRING_TOKEN(STR_CPU_SUBNUMA_MODE_PROMPT), + help =3D STRING_TOKEN(STR_CPU_SUBNUMA_MODE_HELP), + flags =3D RESET_REQUIRED, + option text =3D STRING_TOKEN(STR_CPU_SUBNUMA_MODE_MONOLITHIC), value= =3D 0x0, flags =3D DEFAULT; + option text =3D STRING_TOKEN(STR_CPU_SUBNUMA_MODE_HEMISPHERE), value= =3D 0x1, flags =3D 0; + option text =3D STRING_TOKEN(STR_CPU_SUBNUMA_MODE_QUADRANT), value = =3D 0x2, flags =3D 0; + endoneof; + + endform; + +endformset; diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDx= e.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.c new file mode 100644 index 000000000000..c5ba48edadbb --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.c @@ -0,0 +1,530 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "CpuConfigDxe.h" + +// +// Default settings definitions +// +#define NV_SI_SUBNUMA_MODE_DEFAULT 0x00 /* Monolithic mode */ +#define WA_ERRATUM_1542419_DEFAULT 0x00 /* Disable I-Cache coherency */ +#define NEAR_ATOMIC_DISABLE_DEFAULT 0x00 /* Enable Near Atomic */ +#define CPU_SLC_REPLACE_POLICY 0x00 /* eLRU */ + +CHAR16 CpuVarstoreDataName[] =3D L"CpuConfigNVData"; + +EFI_HANDLE mDriverHandle =3D NULL; +CPU_CONFIG_PRIVATE_DATA *mPrivateData =3D NULL; + +HII_VENDOR_DEVICE_PATH mCpuConfigHiiVendorDevicePath =3D { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8)(sizeof (VENDOR_DEVICE_PATH)), + (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + CPU_CONFIGURATION_FORMSET_GUID + }, + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { + (UINT8)(END_DEVICE_PATH_LENGTH), + (UINT8)((END_DEVICE_PATH_LENGTH) >> 8) + } + } +}; + +STATIC +EFI_STATUS +CpuNvParamGet ( + OUT CPU_VARSTORE_DATA *Configuration + ) +{ + EFI_STATUS Status; + UINT32 Value; + + ASSERT (Configuration !=3D NULL); + + Status =3D NVParamGet ( + NV_SI_SUBNUMA_MODE, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a %d Fail to get NVParam, %r\n", __FUNCTION__, = __LINE__, Status)); + Configuration->CpuSubNumaMode =3D SUBNUMA_MODE_MONOLITHIC; + } else { + Configuration->CpuSubNumaMode =3D Value; + } + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS +CpuNvParamSet ( + IN CPU_VARSTORE_DATA *Configuration + ) +{ + EFI_STATUS Status; + UINT32 Value; + + ASSERT (Configuration !=3D NULL); + + Status =3D NVParamGet ( + NV_SI_SUBNUMA_MODE, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + ASSERT_EFI_ERROR (Status); + + if (EFI_ERROR (Status) || Value !=3D Configuration->CpuSubNumaMode) { + Status =3D NVParamSet ( + NV_SI_SUBNUMA_MODE, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Configuration->CpuSubNumaMode + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a %d Fail to set NVParam, %r\n", __FUNCTION__= , __LINE__, Status)); + ASSERT_EFI_ERROR (Status); + return Status; + } + } + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS +SetupDefaultSettings ( + VOID + ) +{ + EFI_STATUS Status; + UINT32 Value; + + // + // Subnuma Mode + // + Status =3D NVParamGet ( + NV_SI_SUBNUMA_MODE, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + Status =3D NVParamSet ( + NV_SI_SUBNUMA_MODE, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + NV_SI_SUBNUMA_MODE_DEFAULT + ); + if (EFI_ERROR (Status)) { + return Status; + } + } + + // + // ARM ERRATA 1542419 workaround + // + Status =3D NVParamSet ( + NV_SI_ERRATUM_1542419_WA, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + WA_ERRATUM_1542419_DEFAULT + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Near atomic + // + Status =3D NVParamSet ( + NV_SI_NEAR_ATOMIC_DISABLE, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + NEAR_ATOMIC_DISABLE_DEFAULT + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // SLC Replacement Policy + // + Status =3D NVParamSet ( + NV_SI_HNF_AUX_CTL_32_63, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + CPU_SLC_REPLACE_POLICY + ); + if (EFI_ERROR (Status)) { + return Status; + } + + return EFI_SUCCESS; +} + +/** + This function allows a caller to extract the current configuration for o= ne + or more named elements from the target driver. + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param Request A null-terminated Unicode string in + format. + @param Progress On return, points to a character in the R= equest + string. Points to the string's null termi= nator if + request was successful. Points to the mos= t recent + '&' before the first failing name/value p= air (or + the beginning of the string if the failur= e is in + the first name/value pair) if the request= was not + successful. + @param Results A null-terminated Unicode string in + format which has all valu= es filled + in for the names in the Request string. S= tring to + be allocated by the called function. + + @retval EFI_SUCCESS The Results is filled with the requested = values. + @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results. + @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown nam= e. + @retval EFI_NOT_FOUND Routing data doesn't match any storage in= this + driver. + +**/ +EFI_STATUS +EFIAPI +CpuConfigExtractConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Request, + OUT EFI_STRING *Progress, + OUT EFI_STRING *Results + ) +{ + EFI_STATUS Status; + UINTN BufferSize; + CPU_CONFIG_PRIVATE_DATA *PrivateData; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + EFI_STRING ConfigRequest; + EFI_STRING ConfigRequestHdr; + UINTN Size; + BOOLEAN AllocatedRequest; + + if (Progress =3D=3D NULL || Results =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + // + // Initialize the local variables. + // + ConfigRequestHdr =3D NULL; + ConfigRequest =3D NULL; + Size =3D 0; + *Progress =3D Request; + AllocatedRequest =3D FALSE; + + if ((Request !=3D NULL) && !HiiIsConfigHdrMatch (Request, &gCpuConfigFor= mSetGuid, CpuVarstoreDataName)) { + return EFI_NOT_FOUND; + } + + PrivateData =3D CPU_CONFIG_PRIVATE_FROM_THIS (This); + HiiConfigRouting =3D PrivateData->HiiConfigRouting; + + // + // Get current setting from NVParam. + // + Status =3D CpuNvParamGet (&PrivateData->Configuration); + if (EFI_ERROR (Status)) { + return Status; + } + // + // Convert buffer data to by helper function BlockToConfig() + // + BufferSize =3D sizeof (CPU_VARSTORE_DATA); + ConfigRequest =3D Request; + if ((Request =3D=3D NULL) || (StrStr (Request, L"OFFSET") =3D=3D NULL)) { + // + // Request has no request element, construct full request string. + // Allocate and fill a buffer large enough to hold the tem= plate + // followed by "&OFFSET=3D0&WIDTH=3DWWWWWWWWWWWWWWWW" followed by a Nu= ll-terminator + // + ConfigRequestHdr =3D HiiConstructConfigHdr (&gCpuConfigFormSetGuid, Cp= uVarstoreDataName, PrivateData->DriverHandle); + Size =3D (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16); + ConfigRequest =3D AllocateZeroPool (Size); + ASSERT (ConfigRequest !=3D NULL); + if (ConfigRequest =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + AllocatedRequest =3D TRUE; + UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=3D0&WIDTH=3D%016LX", C= onfigRequestHdr, (UINT64)BufferSize); + FreePool (ConfigRequestHdr); + } + + // + // Convert buffer data to by helper function BlockToConfig() + // + Status =3D HiiConfigRouting->BlockToConfig ( + HiiConfigRouting, + ConfigRequest, + (UINT8 *)&PrivateData->Configuration, + BufferSize, + Results, + Progress + ); + + // + // Free the allocated config request string. + // + if (AllocatedRequest) { + FreePool (ConfigRequest); + ConfigRequest =3D NULL; + } + + // + // Set Progress string to the original request string. + // + if (Request =3D=3D NULL) { + *Progress =3D NULL; + } else if (StrStr (Request, L"OFFSET") =3D=3D NULL) { + *Progress =3D Request + StrLen (Request); + } + + return Status; +} + +/** + This function processes the results of changes in configuration. + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param Configuration A null-terminated Unicode string in + format. + @param Progress A pointer to a string filled in with the = offset of + the most recent '&' before the first fail= ing + name/value pair (or the beginning of the = string if + the failure is in the first name/value pa= ir) or + the terminating NULL if all was successfu= l. + + @retval EFI_SUCCESS The Results is processed successfully. + @retval EFI_INVALID_PARAMETER Configuration is NULL. + @retval EFI_NOT_FOUND Routing data doesn't match any storage in= this + driver. + +**/ +EFI_STATUS +EFIAPI +CpuConfigRouteConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Configuration, + OUT EFI_STRING *Progress + ) +{ + EFI_STATUS Status; + UINTN BufferSize; + CPU_CONFIG_PRIVATE_DATA *PrivateData; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + + if (Configuration =3D=3D NULL || Progress =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + PrivateData =3D CPU_CONFIG_PRIVATE_FROM_THIS (This); + HiiConfigRouting =3D PrivateData->HiiConfigRouting; + *Progress =3D Configuration; + + // + // Check routing data in . + // Note: if only one Storage is used, then this checking could be skippe= d. + // + if (!HiiIsConfigHdrMatch (Configuration, &gCpuConfigFormSetGuid, CpuVars= toreDataName)) { + return EFI_NOT_FOUND; + } + + // + // Get configuration data from NVParam + // + Status =3D CpuNvParamGet (&PrivateData->Configuration); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Convert to buffer data by helper function ConfigToBlock() + // + BufferSize =3D sizeof (CPU_VARSTORE_DATA); + Status =3D HiiConfigRouting->ConfigToBlock ( + HiiConfigRouting, + Configuration, + (UINT8 *)&PrivateData->Configuration, + &BufferSize, + Progress + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Store configuration data back to NVParam + // + Status =3D CpuNvParamSet (&PrivateData->Configuration); + if (EFI_ERROR (Status)) { + return Status; + } + + return Status; +} + +/** + This function processes the results of changes in configuration. + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param Action Specifies the type of action taken by the= browser. + @param QuestionId A unique value which is sent to the origi= nal + exporting driver so that it can identify = the type + of data to expect. + @param Type The type of value for the question. + @param Value A pointer to the data being sent to the o= riginal + exporting driver. + @param ActionRequest On return, points to the action requested= by the + callback function. + + @retval EFI_SUCCESS The callback successfully handled the act= ion. + @retval EFI_INVALID_PARAMETER The setup browser call this function with= invalid parameters. + +**/ +EFI_STATUS +EFIAPI +CpuConfigCallback ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN EFI_BROWSER_ACTION Action, + IN EFI_QUESTION_ID QuestionId, + IN UINT8 Type, + IN EFI_IFR_TYPE_VALUE *Value, + OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest + ) +{ + if (Action !=3D EFI_BROWSER_ACTION_CHANGING) { + // + // Do nothing for other UEFI Action. Only do call back when data is ch= anged. + // + return EFI_UNSUPPORTED; + } + if (((Value =3D=3D NULL) && (Action !=3D EFI_BROWSER_ACTION_FORM_OPEN) &= & (Action !=3D EFI_BROWSER_ACTION_FORM_CLOSE))|| + (ActionRequest =3D=3D NULL)) + { + return EFI_INVALID_PARAMETER; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +CpuConfigDxeEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_HII_HANDLE HiiHandle; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + + // + // Initialize driver private data + // + mPrivateData =3D AllocateZeroPool (sizeof (CPU_CONFIG_PRIVATE_DATA)); + if (mPrivateData =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + mPrivateData->Signature =3D CPU_CONFIG_PRIVATE_SIGNATURE; + + mPrivateData->ConfigAccess.ExtractConfig =3D CpuConfigExtractConfig; + mPrivateData->ConfigAccess.RouteConfig =3D CpuConfigRouteConfig; + mPrivateData->ConfigAccess.Callback =3D CpuConfigCallback; + + // + // Locate ConfigRouting protocol + // + Status =3D gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL,= (VOID **)&HiiConfigRouting); + if (EFI_ERROR (Status)) { + return Status; + } + mPrivateData->HiiConfigRouting =3D HiiConfigRouting; + + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &mDriverHandle, + &gEfiDevicePathProtocolGuid, + &mCpuConfigHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &mPrivateData->ConfigAccess, + NULL + ); + ASSERT_EFI_ERROR (Status); + + mPrivateData->DriverHandle =3D mDriverHandle; + + // + // Publish our HII data + // + HiiHandle =3D HiiAddPackages ( + &gCpuConfigFormSetGuid, + mDriverHandle, + CpuConfigDxeStrings, + CpuConfigVfrBin, + NULL + ); + if (HiiHandle =3D=3D NULL) { + gBS->UninstallMultipleProtocolInterfaces ( + mDriverHandle, + &gEfiDevicePathProtocolGuid, + &mCpuConfigHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &mPrivateData->ConfigAccess, + NULL + ); + return EFI_OUT_OF_RESOURCES; + } + + mPrivateData->HiiHandle =3D HiiHandle; + + // + // With the fresh system, the NVParam value is invalid (0xFFFFFFFF). + // It causes reading from the NVParam is failed. + // So, the NVParam should be setting with default values if any params i= s invalid. + // + Status =3D SetupDefaultSettings (); + if (EFI_ERROR (Status)) { + return Status; + } + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigSt= rings.uni b/Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigStr= ings.uni new file mode 100644 index 000000000000..70c01f65e4b6 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigStrings.u= ni @@ -0,0 +1,17 @@ +// +// Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// + +#langdef en-US "English" + +#string STR_CPU_FORM #language en-US "CPU C= onfiguration" +#string STR_CPU_FORM_HELP #language en-US "CPU C= onfiguration" +#string STR_CPU_FORM_SEPERATE_LINE #language en-US "" + +#string STR_CPU_SUBNUMA_MODE_PROMPT #language en-US "ANC m= ode" +#string STR_CPU_SUBNUMA_MODE_HELP #language en-US "Provi= des 3 modes: Monolithic, Hemisphere, Quadrant. System with Monolithic mode = has single NUMA partition per socket. System with Hemisphere has 2 NUMA par= titions per socket. System with Quandrant has 4 NUMA partitions per socket" +#string STR_CPU_SUBNUMA_MODE_MONOLITHIC #language en-US "Monol= ithic" +#string STR_CPU_SUBNUMA_MODE_HEMISPHERE #language en-US "Hemis= phere" +#string STR_CPU_SUBNUMA_MODE_QUADRANT #language en-US "Quadr= ant" --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83840): https://edk2.groups.io/g/devel/message/83840 Mute This Topic: https://groups.io/mt/87123913/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83841+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83841+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167869069660.6342880570752; Wed, 17 Nov 2021 08:51:09 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id DlvJYY1788612xRBYMZxEH06; Wed, 17 Nov 2021 08:51:08 -0800 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.100]) by mx.groups.io with SMTP id smtpd.web12.9725.1637167867918179256 for ; Wed, 17 Nov 2021 08:51:08 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A8bxAc8v9Qx3s6iRWAqnG+SJ7Yc+HqchRzBCgp/4N7FfuVcWRnTcCX9pwUoXrePksW4MH6QtGPwRIzqhW+JJfZyy7SHDC6IdCq4nEoBpVDImEvmPNDT1/v+pFnZi7dUrfkc+HCOPL72fVEz4Ffsl+xBKcMggVKMcwn0z8XNjmsGLzqDiLNcWtRomA6Hiy1VW+zQaqWhihhu/efjzO2AZ9OiC9uz3wyQB2yu0vxlukN6bc7o7zoTU1u9krxQQRCFHalVd1XJbTjfng76lbiyZgI85XQrpT1mwNZQcWD7O3RHpXjMPPiGWB9cZ1Njj++PQAhKQFfY3rufEPp5t0OuktQ== 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=eqdaIIyzyY9BKffZ9JdEkMqNFo1yXc7sm3oyOP9WtOs=; b=kdQqvPGen3/cF8jmZuJPoJIMGuaC+qKYt/XaoTuaqvV8k8g6kHHTU9BopZZ/ZMRvRzDSlXfY7pn8by7haImR1spy0l0ijuzxFuxVCRQjUncZXgoz4pD0/h0m4BkiUUvRAKWc3TqE9bVGkAGUyGNV8dyumBAdm68E2NzZR1L7hQhX1ygcLAXhtXwZMpPsj9KCxn3Q7cjV7mmG4etHH/VynyIz0u1n2FkB8DFNRgxACyzbXB2KNWgKdhcsPOaI9YJhEFm35Jcqa3IiC3qt8jncNKT9CjDFjXi0atY7rt7VXkmeafuQw3bcCKRoy9q4JmGly9isD4rXplAvUn7xkp+/vA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB7400.prod.exchangelabs.com (2603:10b6:510:10b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.19; Wed, 17 Nov 2021 16:51:06 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:51:06 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 28/30] AmpereAltraPkg: Add configuration screen for ACPI Date: Wed, 17 Nov 2021 23:47:25 +0700 Message-ID: <20211117164727.10922-29-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:51:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 82c740c1-c55a-4106-2073-08d9a9ea7282 X-MS-TrafficTypeDiagnostic: PH0PR01MB7400: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:207; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: vN00aELO/g8y+PrACeuGS5U4cR4EMAhrOeyeu/EGTD/pNXd95lSbxJHLuxKEM+NDsjuY2/kSwiGx/Ed9fk82OGweNasfMmR3oAyT8b9uPhWM4OHV/KPL6Ivi/Amw+1iT9yEgm2MjbZHrbExWI1B89eUv3RB3fZpdOmxBjAgOpjVM8yC5erPNDH+n3BcW/DPqrIXtRZMYzhpwtgohw29keR5Eop9BRrX1+nQnj0fovdpeagzx5IyRnsYiTJTHRA1ZFglk1xvslh1fpQmFNE3W2yjTk5TmbuaEiWSHatCdUBsBNAdxOMj/PPgcGqTsFaNL5LN3Op0DTFuN4d23MRKkJkVQUFQAT2mG9OH6jYBJeGMPfNhZ0UV0RdzbDkw9bDohFBo+WQautXSUE+TLQ+H6p9pf8ekohrk5qOjXLJRjZHqPAPPL1mImxD6GY631FNqmxq2DkxX6s/D8lNMA27vyJ0eN/C1zyP+gsQkdYDLJEJvgFNLZiUQZGx5TYYSrK8tfvQ/MddY8UdP6BEp62yHKJXq6B0uXMFl/atIXOrDgzEiswnrt6dW/vqbSw0RBIPMVzCc1zVky3VWlHh84j1c++wCZey3cqXy8V5yRhQW5yffTP97Qyp19+WCWpMserSX4FwAyUbNLlBot981ZtiCRXvY/R7x89chvjY/8ureVjralkZKQOKLEPcyIdxGvK+OrgH+O1VYZyjOwCUO5ecYBoUINUkJQnJ8ZvV5ZiFN9aEIaZKDUcyVJYXpZ8a3uKSyxicxq7WzDfykiY/fOWw7qEg== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?GtaUFl47wQxQLD5nlWNE7KYBYCp3qYq8OAnUal6adz/BgX07+ajBwpKrSykG?= =?us-ascii?Q?MT7NRtg1cFlrfeeU/uKcYKumzQKkH9nOMorYF6SsM+12AFk3jGgbzvpo3UBZ?= =?us-ascii?Q?ibjjtiw95OEgNNo/x6LyzjHbeUheOP9Ht/q0XT1oR9+VRxUrL/aTRz5xd5dU?= =?us-ascii?Q?wvA0/8amkg06foDTctPB08b/IK+xOq8Zdu4HHg3Fygw8jimEJ2D9Y0D3jJoP?= =?us-ascii?Q?9uEUalojogohTNhUShvU+PMJDJ9o06njUxt2BwbxNeFvxlbdGm+LIcuxu+SA?= =?us-ascii?Q?lWwsK6ThU1+xa2+xs7TOqFgqwz1Lbxlhmr2HqJ91cf016GZAyRYimnKitGra?= =?us-ascii?Q?que6kjoolcUcfrksiscwSuUwBJctYE7Xshi+qU3F9BkK1VST06kKW9iqrx1u?= =?us-ascii?Q?QoB47w30yBYD6Yh/xqi66Ak0Ai2rIam16Fc9kMyZxTVFH6vf0IxnstnjJvuP?= =?us-ascii?Q?+pGyngpjXJkVwJkos9MrRCk0WvMXOMfgndqMmaz+1l8GSx9+6aeK4Bn92IIE?= =?us-ascii?Q?7Y+SYlrt6kzj3yumB/eryrP1ASWClKO9fHnJxBtEBvQVCjmumMLS5P8OrvzI?= =?us-ascii?Q?+rTj0legVqcgPNFMfrUo2k1aGkQT/uJizNs4HXr/NB6uu1Pfr1/6paWwrmjV?= =?us-ascii?Q?CH6yI95pQWwguML08Js9EOYahUsYvzlhc/wRo4OBFUWhDyBapYeNG2NiFKyk?= =?us-ascii?Q?zoXprqKxe0TCOG9FQZ5VARsVzRxcN8TdBzufTjV70Ag/nHEfRiescmptN7Ke?= =?us-ascii?Q?GmPwqx4dZkOXELKYNBq8xfrDgaXAu405InzlqhJX9cP4kKxdkg7MwRQ6Pk4r?= =?us-ascii?Q?QHmCLKUC3ugdCh2Gusqol06wdvWLfvsdXdIs0qdzsDQ8ALvCfulIdkv8s1QV?= =?us-ascii?Q?Ely0xr1PGUngQf8YFug+bb8vYqe0yHVDMEKhvWiIeiKuruExeNwkMPJbe/yR?= =?us-ascii?Q?8EaS48EJQeI34U/d2KfFK1N8H6As4mcJxCtZyXBadAmSMcZVolhA7LU0QQU0?= =?us-ascii?Q?OkzVjFiHaq554HBWfaLk+oFfPyb6VPMP9mI62MwONK1/0006sbMUUL1ujyVi?= =?us-ascii?Q?o0UxXaNCkijLJhhE0hxcJkSPIYoYpxhlCphXUpAzzQU7W97Udkz/9qmZOTlY?= =?us-ascii?Q?iFi3N7g8F6BvZUj2FT6zR3U6h+5Mf109bLLe3tgJ8X3ZirGB9RZMXBiMbIH9?= =?us-ascii?Q?gZmoYajn8nAKypzGp/RubfDUFeZrnYyG0lvrL8uaDlFH3U0e/MMnm7/xIHuS?= =?us-ascii?Q?M2gSMHxJPCtKbXviTX3L0tKzEnfdXNJU7XA+s8DYCIXt5QD983MEAix3B35D?= =?us-ascii?Q?dD8I/Re+drgh+IWYR6R3GRHxTRW6z8dlXyeOWYxlGVQZvKL4RYFj+XY2uxjS?= =?us-ascii?Q?Nz18OkoiJH7TsBBYC5cQzQOr6z2h2vpSatVacaSw+VodluHVje+A9I8Hk6bO?= =?us-ascii?Q?2gU0hEiP27NH3roVY1F9hgCil6po7yjWt914K3PluaU8Z4/vcy1gIYDAYULQ?= =?us-ascii?Q?zox48RPZtPi9E8IgJ6Ir5hIyJTp1WfXyhVKZ2vkYs0yoENh7U2XUbMbfG9of?= =?us-ascii?Q?BIx5yPH7fEETOS0gr/0dPp45qXuS7x15u8SZSxeQuCmOmFkjpGjvkgc+BlRd?= =?us-ascii?Q?j7mvzqJ96Onc6gaZ3SPgzeGsIaczhbz8v43s++HtCJEsFlGEoEi3Wl6wdW/R?= =?us-ascii?Q?kNYDAd1aMUarj5m7xBB5dys3bXk=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82c740c1-c55a-4106-2073-08d9a9ea7282 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:51:06.0557 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lrBLV9A/Smvx/aXVbQk8xPfvGwqmjOKrJ+FkAR/wDC9CHVmTAKEoHfbx2HP9AknmMcQI55J52V56KsUJMGM4yeZfrKUKObalocSIgCNF06s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7400 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: wLjkeO92jOU60pJMiCVhC7xxx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167868; bh=sFkvAukfhVFDkkZx9ZhNn8eAX65RHS5i6IoF0qbOmi0=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=vX4Bltnx8dtKsX1VTcC2DRR8ME8rwf5RnpLY2xvJDm01G9DEgK6Lphh4ZAHMKf0I0+5 LsWTlq3NBw7oDgkDi16kKvQVpJu6jZ8gr4PCXCArNQk+mARoDLyMoW6UMGgt3kzyvSCcz iFDH1X44uGvPhlWcqJ3fWIMhLguBGNeP+5Q= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167870104100001 Content-Type: text/plain; charset="utf-8" This supports: * Enable/Disable APEI Support * Enable/Disable CPPC Support * Enable/Disable LPI support * Enable/Disable Max Performance Mode Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec = | 3 + Platform/Ampere/JadePkg/Jade.dsc = | 1 + Platform/Ampere/JadePkg/Jade.fdf = | 1 + Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf = | 1 + Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.inf = | 58 ++ Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.h = | 2 + Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.h = | 62 ++ Silicon/Ampere/AmpereAltraPkg/Include/AcpiConfigNVDataStruct.h = | 28 + Silicon/Ampere/AmpereAltraPkg/Include/Guid/AcpiConfigHii.h = | 19 + Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigVfr.vfr = | 69 ++ Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c = | 23 +- Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.c = | 728 ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigStrings.uni = | 27 + 13 files changed, 1020 insertions(+), 2 deletions(-) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Amp= ere/AmpereAltraPkg/AmpereAltraPkg.dec index 68e235b06c0c..d795c9229691 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -67,3 +67,6 @@ [Guids] =20 ## Include/Guid/CpuConfigHii.h gCpuConfigFormSetGuid =3D { 0x43FAA144, 0xA2DF, 0x4050, { 0xA7, 0= xFD, 0xEE, 0x17, 0xC9, 0xB8, 0x88, 0x8E } } + + ## Include/Guid/AcpiConfigHii.h + gAcpiConfigFormSetGuid =3D { 0x0ceb6764, 0xd415, 0x4b01, { 0xa8, 0x43, 0= xd1, 0x01, 0xbc, 0xb0, 0xd8, 0x29 } } diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index 4dff28de920a..b476bc05a600 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -189,3 +189,4 @@ [Components.common] Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe.inf Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.inf Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.inf diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index 869d802eccd4..87b04faa9e9a 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -355,5 +355,6 @@ [FV.FvMain] INF Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDx= e.inf INF Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.inf INF Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.inf =20 !include Silicon/Ampere/AmpereSiliconPkg/FvRules.fdf.inc diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDx= e.inf b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf index 804e761a1524..8ab6a790ce07 100644 --- a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf @@ -69,6 +69,7 @@ [Guids] gArmMpCoreInfoGuid gEfiAcpiTableGuid gEfiEventReadyToBootGuid + gAcpiConfigFormSetGuid gPlatformInfoHobGuid gRootComplexInfoHobGuid gRootComplexConfigFormSetGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfig= Dxe.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe= .inf new file mode 100644 index 000000000000..005ab65e39f8 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.inf @@ -0,0 +1,58 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D AcpiConfigDxe + FILE_GUID =3D F36685AE-2623-4231-ABC0-2C151451E6B7 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D AcpiConfigEntryPoint + +[Sources.common] + AcpiConfigDxe.c + AcpiConfigDxe.h + AcpiConfigVfr.vfr + AcpiConfigStrings.uni + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + AcpiLib + BaseLib + BaseMemoryLib + DebugLib + DevicePathLib + HiiLib + HobLib + MemoryAllocationLib + SystemFirmwareInterfaceLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + +[Guids] + gPlatformManagerFormsetGuid + gAcpiConfigFormSetGuid + gEfiEventReadyToBootGuid + gPlatformInfoHobGuid + +[Protocols] + gEfiAcpiSdtProtocolGuid ## COMSUMES + gEfiDevicePathProtocolGuid ## CONSUMES + gEfiHiiConfigRoutingProtocolGuid ## CONSUMES + gEfiHiiConfigAccessProtocolGuid ## PRODUCES + +[Depex] + gEfiVariableArchProtocolGuid AND + gEfiVariableWriteArchProtocolGuid diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.h b/P= latform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.h index 61648f107efe..4a3b99d481bb 100644 --- a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.h +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.h @@ -9,7 +9,9 @@ #ifndef ACPI_APEI_H_ #define ACPI_APEI_H_ =20 +#include #include +#include #include #include #include diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfig= Dxe.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.h new file mode 100644 index 000000000000..8a2cc2f5e679 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.h @@ -0,0 +1,62 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef ACPI_CONFIG_DXE_H_ +#define ACPI_CONFIG_DXE_H_ + +// +// This is the generated IFR binary data for each formset defined in VFR. +// +extern UINT8 AcpiConfigVfrBin[]; + +// +// This is the generated String package data for all .UNI files. +// +extern UINT8 AcpiConfigDxeStrings[]; + +// +// Signature: Ampere Computing ACPI Configuration +// +#define ACPI_CONFIG_PRIVATE_SIGNATURE SIGNATURE_32 ('A', 'C', 'A', 'C') + +typedef struct { + UINTN Signature; + + EFI_HANDLE DriverHandle; + EFI_HII_HANDLE HiiHandle; + ACPI_CONFIG_VARSTORE_DATA Configuration; + PLATFORM_INFO_HOB *PlatformHob; + EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol; + EFI_ACPI_HANDLE AcpiTableHandle; + + // + // Consumed protocol + // + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + + // + // Produced protocol + // + EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess; +} ACPI_CONFIG_PRIVATE_DATA; + +#define ACPI_CONFIG_PRIVATE_FROM_THIS(a) CR (a, ACPI_CONFIG_PRIVATE_DATA,= ConfigAccess, ACPI_CONFIG_PRIVATE_SIGNATURE) + +#pragma pack(1) + +/// +/// HII specific Vendor Device Path definition. +/// +typedef struct { + VENDOR_DEVICE_PATH VendorDevicePath; + EFI_DEVICE_PATH_PROTOCOL End; +} HII_VENDOR_DEVICE_PATH; + +#pragma pack() + +#endif diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/AcpiConfigNVDataStruct.h= b/Silicon/Ampere/AmpereAltraPkg/Include/AcpiConfigNVDataStruct.h new file mode 100644 index 000000000000..a56bfa9aa694 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/AcpiConfigNVDataStruct.h @@ -0,0 +1,28 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef ACPI_CONFIG_NV_DATA_STRUC_H_ +#define ACPI_CONFIG_NV_DATA_STRUC_H_ + +#pragma pack(1) + +// +// ACPI Configuration NV data structure definition +// +typedef struct { + UINT32 EnableApeiSupport; + UINT32 AcpiCppcEnable; + UINT32 AcpiLpiEnable; + UINT32 AcpiTurboSupport; + UINT32 AcpiTurboMode; + UINT32 Reserved[4]; +} ACPI_CONFIG_VARSTORE_DATA; + +#pragma pack() + +#endif /* ACPI_CONFIG_NV_DATA_STRUC_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Guid/AcpiConfigHii.h b/S= ilicon/Ampere/AmpereAltraPkg/Include/Guid/AcpiConfigHii.h new file mode 100644 index 000000000000..1779a4543769 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/AcpiConfigHii.h @@ -0,0 +1,19 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef ACPI_CONFIG_FORMSET_GUID_H_ +#define ACPI_CONFIG_FORMSET_GUID_H_ + +#define ACPI_CONFIGURATION_FORMSET_GUID \ + { \ + 0x0ceb6764, 0xd415, 0x4b01, { 0xa8, 0x43, 0xd1, 0x01, 0xbc, 0xb0, 0xd8= , 0x29 } \ + } + +extern EFI_GUID gAcpiConfigFormSetGuid; + +#endif /* ACPI_CONFIG_FORMSET_GUID_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfig= Vfr.vfr b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigVfr= .vfr new file mode 100644 index 000000000000..3962aa227037 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigVfr.vfr @@ -0,0 +1,69 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + + +#include +#include + +#define ACPI_CONFIG_FORM_ID 1 + +formset + guid =3D ACPI_CONFIGURATION_FORMSET_GUID, + title =3D STRING_TOKEN(STR_ACPI_FORM), + help =3D STRING_TOKEN(STR_ACPI_FORM_HELP), + classguid =3D gPlatformManagerFormsetGuid, + + varstore ACPI_CONFIG_VARSTORE_DATA, + name =3D AcpiConfigNVData, + guid =3D ACPI_CONFIGURATION_FORMSET_GUID; + + form + formid =3D ACPI_CONFIG_FORM_ID, + title =3D STRING_TOKEN(STR_ACPI_FORM); + subtitle text =3D STRING_TOKEN(STR_ACPI_FORM_HELP); + + oneof + varid =3D AcpiConfigNVData.EnableApeiSupport, + prompt =3D STRING_TOKEN(STR_ACPI_APEI_SUPPORT_PROMPT), + help =3D STRING_TOKEN(STR_ACPI_APEI_SUPPORT_HELP), + option text =3D STRING_TOKEN(STR_ACPI_COMMON_DISABLE), value =3D 0, = flags =3D 0; + option text =3D STRING_TOKEN(STR_ACPI_COMMON_ENABLE), value =3D 1, f= lags =3D DEFAULT; + endoneof; + + oneof + varid =3D AcpiConfigNVData.AcpiCppcEnable, + prompt =3D STRING_TOKEN(STR_ACPI_CPPC_PROMPT), + help =3D STRING_TOKEN(STR_ACPI_CPPC_HELP), + option text =3D STRING_TOKEN(STR_ACPI_COMMON_DISABLE), value =3D 0, = flags =3D 0; + option text =3D STRING_TOKEN(STR_ACPI_COMMON_ENABLE), value =3D 1, f= lags =3D DEFAULT; + endoneof; + + oneof + varid =3D AcpiConfigNVData.AcpiLpiEnable, + prompt =3D STRING_TOKEN(STR_ACPI_LPI_PROMPT), + help =3D STRING_TOKEN(STR_ACPI_LPI_HELP), + option text =3D STRING_TOKEN(STR_ACPI_COMMON_DISABLE), value =3D 0, = flags =3D 0; + option text =3D STRING_TOKEN(STR_ACPI_COMMON_ENABLE), value =3D 1, f= lags =3D DEFAULT; + endoneof; + + grayoutif ideqval AcpiConfigNVData.AcpiTurboSupport =3D=3D 0; + oneof + varid =3D AcpiConfigNVData.AcpiTurboMode, + prompt =3D STRING_TOKEN(STR_ACPI_TURBO_PROMPT), + help =3D STRING_TOKEN(STR_ACPI_TURBO_HELP), + option text =3D STRING_TOKEN(STR_ACPI_COMMON_ENABLE), value =3D 1,= flags =3D DEFAULT; + option text =3D STRING_TOKEN(STR_ACPI_COMMON_DISABLE), value =3D 0= , flags =3D 0; + suppressif ideqval AcpiConfigNVData.AcpiTurboSupport > 0; + option text =3D STRING_TOKEN(STR_ACPI_UNSUPPORTED), value =3D 2, f= lags =3D 0; + endif; + endoneof; + endif; + + endform; + +endformset; diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c b/P= latform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c index 58c511db99a7..aec96e6aec04 100644 --- a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c @@ -423,8 +423,27 @@ AcpiApeiUpdate ( VOID ) { - if (!IsSlaveSocketActive ()) { - AcpiApeiHestUpdateTable1P (); + EFI_STATUS Status; + ACPI_CONFIG_VARSTORE_DATA AcpiConfigData; + UINTN BufferSize; + + BufferSize =3D sizeof (ACPI_CONFIG_VARSTORE_DATA); + Status =3D gRT->GetVariable ( + L"AcpiConfigNVData", + &gAcpiConfigFormSetGuid, + NULL, + &BufferSize, + &AcpiConfigData + ); + if (!EFI_ERROR (Status) && (AcpiConfigData.EnableApeiSupport =3D=3D 0)) { + AcpiApeiUninstallTable (EFI_ACPI_6_3_BOOT_ERROR_RECORD_TABLE_SIGNATURE= ); + AcpiApeiUninstallTable (EFI_ACPI_6_3_HARDWARE_ERROR_SOURCE_TABLE_SIGNA= TURE); + AcpiApeiUninstallTable (EFI_ACPI_6_3_SOFTWARE_DELEGATED_EXCEPTIONS_INT= ERFACE_TABLE_SIGNATURE); + AcpiApeiUninstallTable (EFI_ACPI_6_3_ERROR_INJECTION_TABLE_SIGNATURE); + } else { + if (!IsSlaveSocketActive ()) { + AcpiApeiHestUpdateTable1P (); + } } =20 if (!IsSdeiEnabled ()) { diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfig= Dxe.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.c new file mode 100644 index 000000000000..6ba39ad4409b --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.c @@ -0,0 +1,728 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "AcpiConfigDxe.h" + +#define ACPI_VARSTORE_ATTRIBUTES EFI_VARIABLE_BOOTSERVICE_ACCESS | \ + EFI_VARIABLE_RUNTIME_ACCESS | \ + EFI_VARIABLE_NON_VOLATILE + +CHAR16 AcpiVarstoreDataName[] =3D L"AcpiConfigNVData"; + +EFI_HANDLE mDriverHandle =3D NULL; +ACPI_CONFIG_PRIVATE_DATA *mPrivateData =3D NULL; + +HII_VENDOR_DEVICE_PATH mAcpiConfigHiiVendorDevicePath =3D { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8)(sizeof (VENDOR_DEVICE_PATH)), + (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + ACPI_CONFIGURATION_FORMSET_GUID + }, + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { + (UINT8)(END_DEVICE_PATH_LENGTH), + (UINT8)((END_DEVICE_PATH_LENGTH) >> 8) + } + } +}; + +/** + This function allows a caller to extract the current configuration for o= ne + or more named elements from the target driver. + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param Request A null-terminated Unicode string in + format. + @param Progress On return, points to a character in the R= equest + string. Points to the string's null termi= nator if + request was successful. Points to the mos= t recent + '&' before the first failing name/value p= air (or + the beginning of the string if the failur= e is in + the first name/value pair) if the request= was not + successful. + @param Results A null-terminated Unicode string in + format which has all valu= es filled + in for the names in the Request string. S= tring to + be allocated by the called function. + + @retval EFI_SUCCESS The Results is filled with the requested = values. + @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results. + @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown nam= e. + @retval EFI_NOT_FOUND Routing data doesn't match any storage in= this + driver. + +**/ +EFI_STATUS +EFIAPI +ExtractConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Request, + OUT EFI_STRING *Progress, + OUT EFI_STRING *Results + ) +{ + EFI_STATUS Status; + UINTN BufferSize; + ACPI_CONFIG_PRIVATE_DATA *PrivateData; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + EFI_STRING ConfigRequest; + EFI_STRING ConfigRequestHdr; + UINTN Size; + BOOLEAN AllocatedRequest; + + if (Progress =3D=3D NULL || Results =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + // + // Initialize the local variables. + // + ConfigRequestHdr =3D NULL; + ConfigRequest =3D NULL; + Size =3D 0; + *Progress =3D Request; + AllocatedRequest =3D FALSE; + + if ((Request !=3D NULL) && !HiiIsConfigHdrMatch (Request, &gAcpiConfigFo= rmSetGuid, AcpiVarstoreDataName)) { + return EFI_NOT_FOUND; + } + + PrivateData =3D ACPI_CONFIG_PRIVATE_FROM_THIS (This); + HiiConfigRouting =3D PrivateData->HiiConfigRouting; + + // + // Get Buffer Storage data from EFI variable. + // Try to get the current setting from variable. + // + BufferSize =3D sizeof (ACPI_CONFIG_VARSTORE_DATA); + Status =3D gRT->GetVariable ( + AcpiVarstoreDataName, + &gAcpiConfigFormSetGuid, + NULL, + &BufferSize, + &PrivateData->Configuration + ); + if (EFI_ERROR (Status)) { + return EFI_NOT_FOUND; + } + + // + // Convert buffer data to by helper function BlockToConfig() + // + BufferSize =3D sizeof (ACPI_CONFIG_VARSTORE_DATA); + ConfigRequest =3D Request; + if ((Request =3D=3D NULL) || (StrStr (Request, L"OFFSET") =3D=3D NULL)) { + // + // Request has no request element, construct full request string. + // Allocate and fill a buffer large enough to hold the tem= plate + // followed by "&OFFSET=3D0&WIDTH=3DWWWWWWWWWWWWWWWW" followed by a Nu= ll-terminator + // + ConfigRequestHdr =3D HiiConstructConfigHdr ( + &gAcpiConfigFormSetGuid, + AcpiVarstoreDataName, + PrivateData->DriverHandle + ); + Size =3D (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16); + ConfigRequest =3D AllocateZeroPool (Size); + ASSERT (ConfigRequest !=3D NULL); + if (ConfigRequest =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + AllocatedRequest =3D TRUE; + UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=3D0&WIDTH=3D%016LX", C= onfigRequestHdr, (UINT64)BufferSize); + FreePool (ConfigRequestHdr); + } + + // + // Convert buffer data to by helper function BlockToConfig() + // + Status =3D HiiConfigRouting->BlockToConfig ( + HiiConfigRouting, + ConfigRequest, + (UINT8 *)&PrivateData->Configuration, + BufferSize, + Results, + Progress + ); + + // + // Free the allocated config request string. + // + if (AllocatedRequest) { + FreePool (ConfigRequest); + ConfigRequest =3D NULL; + } + + // + // Set Progress string to the original request string. + // + if (Request =3D=3D NULL) { + *Progress =3D NULL; + } else if (StrStr (Request, L"OFFSET") =3D=3D NULL) { + *Progress =3D Request + StrLen (Request); + } + + return Status; +} + +/** + This function processes the results of changes in configuration. + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param Configuration A null-terminated Unicode string in + format. + @param Progress A pointer to a string filled in with the = offset of + the most recent '&' before the first fail= ing + name/value pair (or the beginning of the = string if + the failure is in the first name/value pa= ir) or + the terminating NULL if all was successfu= l. + + @retval EFI_SUCCESS The Results is processed successfully. + @retval EFI_INVALID_PARAMETER Configuration is NULL. + @retval EFI_NOT_FOUND Routing data doesn't match any storage in= this + driver. + +**/ +EFI_STATUS +EFIAPI +RouteConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Configuration, + OUT EFI_STRING *Progress + ) +{ + EFI_STATUS Status; + UINTN BufferSize; + ACPI_CONFIG_PRIVATE_DATA *PrivateData; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + + if (Configuration =3D=3D NULL || Progress =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + PrivateData =3D ACPI_CONFIG_PRIVATE_FROM_THIS (This); + HiiConfigRouting =3D PrivateData->HiiConfigRouting; + *Progress =3D Configuration; + + // + // Check routing data in . + // Note: if only one Storage is used, then this checking could be skippe= d. + // + if (!HiiIsConfigHdrMatch (Configuration, &gAcpiConfigFormSetGuid, AcpiVa= rstoreDataName)) { + return EFI_NOT_FOUND; + } + + // + // Get Buffer Storage data from EFI variable + // + BufferSize =3D sizeof (ACPI_CONFIG_VARSTORE_DATA); + Status =3D gRT->GetVariable ( + AcpiVarstoreDataName, + &gAcpiConfigFormSetGuid, + NULL, + &BufferSize, + &PrivateData->Configuration + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Convert to buffer data by helper function ConfigToBlock() + // + BufferSize =3D sizeof (ACPI_CONFIG_VARSTORE_DATA); + Status =3D HiiConfigRouting->ConfigToBlock ( + HiiConfigRouting, + Configuration, + (UINT8 *)&PrivateData->Configuration, + &BufferSize, + Progress + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Store Buffer Storage back to EFI variable + // + Status =3D gRT->SetVariable ( + AcpiVarstoreDataName, + &gAcpiConfigFormSetGuid, + ACPI_VARSTORE_ATTRIBUTES, + sizeof (ACPI_CONFIG_VARSTORE_DATA), + &PrivateData->Configuration + ); + + return Status; +} + +/** + This function processes the results of changes in configuration. + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param Action Specifies the type of action taken by the= browser. + @param QuestionId A unique value which is sent to the origi= nal + exporting driver so that it can identify = the type + of data to expect. + @param Type The type of value for the question. + @param Value A pointer to the data being sent to the o= riginal + exporting driver. + @param ActionRequest On return, points to the action requested= by the + callback function. + + @retval EFI_SUCCESS The callback successfully handled the act= ion. + @retval EFI_INVALID_PARAMETER The setup browser call this function with= invalid parameters. + +**/ +EFI_STATUS +EFIAPI +DriverCallback ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN EFI_BROWSER_ACTION Action, + IN EFI_QUESTION_ID QuestionId, + IN UINT8 Type, + IN EFI_IFR_TYPE_VALUE *Value, + OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest + ) +{ + if (Action !=3D EFI_BROWSER_ACTION_CHANGING) { + // + // Do nothing for other UEFI Action. Only do call back when data is ch= anged. + // + return EFI_UNSUPPORTED; + } + if (((Value =3D=3D NULL) + && (Action !=3D EFI_BROWSER_ACTION_FORM_OPEN) + && (Action !=3D EFI_BROWSER_ACTION_FORM_CLOSE)) + || (ActionRequest =3D=3D NULL)) + { + return EFI_INVALID_PARAMETER; + } + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS +AcpiNVDataUpdate ( + IN ACPI_CONFIG_PRIVATE_DATA *PrivateData + ) +{ + EFI_STATUS Status; + PLATFORM_INFO_HOB *PlatformHob; + UINT32 TurboSupport; + + ASSERT (PrivateData !=3D NULL); + + PlatformHob =3D PrivateData->PlatformHob; + TurboSupport =3D PlatformHob->TurboCapability[0] + PlatformHob->TurboCap= ability[1]; + + if (TurboSupport =3D=3D 0) { + PrivateData->Configuration.AcpiTurboMode =3D 2; // Unsupported mode + PrivateData->Configuration.AcpiTurboSupport =3D 0; + } else { + PrivateData->Configuration.AcpiTurboSupport =3D 1; + } + + Status =3D gRT->SetVariable ( + AcpiVarstoreDataName, + &gAcpiConfigFormSetGuid, + ACPI_VARSTORE_ATTRIBUTES, + sizeof (ACPI_CONFIG_VARSTORE_DATA), + &PrivateData->Configuration + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a %d gRT->SetVariable() failed \n", __FUNCTION_= _, __LINE__)); + return Status; + } + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS +UpdateTurboModeConfig ( + IN ACPI_CONFIG_PRIVATE_DATA *PrivateData + ) +{ + EFI_STATUS Status; + PLATFORM_INFO_HOB *PlatformHob; + BOOLEAN EnableTurbo; + + ASSERT (PrivateData !=3D NULL); + + if (PrivateData->Configuration.AcpiTurboSupport !=3D 0) { + PlatformHob =3D PrivateData->PlatformHob; + EnableTurbo =3D (PrivateData->Configuration.AcpiTurboMode !=3D 0) ? TR= UE : FALSE; + + if (PlatformHob->TurboCapability[0] !=3D 0) { + Status =3D MailboxMsgTurboConfig (0, EnableTurbo); + if (EFI_ERROR (Status)) { + return Status; + } + } + + if (PlatformHob->TurboCapability[1] !=3D 0) { + Status =3D MailboxMsgTurboConfig (1, EnableTurbo); + if (EFI_ERROR (Status)) { + return Status; + } + } + } else { + DEBUG ((DEBUG_INFO, "%a: Turbo mode is unsupported! \n", __FUNCTION__)= ); + } + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS +UpdateCPPCConfig ( + IN ACPI_CONFIG_PRIVATE_DATA *PrivateData + ) +{ + EFI_STATUS Status; + CHAR8 Buffer[64]; + + ASSERT (PrivateData !=3D NULL); + + AsciiSPrint (Buffer, sizeof (Buffer), "\\_SB.CPCE"); + Status =3D AcpiAmlObjectUpdateInteger ( + PrivateData->AcpiSdtProtocol, + PrivateData->AcpiTableHandle, + Buffer, + PrivateData->Configuration.AcpiCppcEnable + ); + ASSERT_EFI_ERROR (Status); + + return Status; +} + +STATIC +EFI_STATUS +UpdateLPIConfig ( + IN ACPI_CONFIG_PRIVATE_DATA *PrivateData + ) +{ + EFI_STATUS Status; + CHAR8 Buffer[64]; + + ASSERT (PrivateData !=3D NULL); + + AsciiSPrint (Buffer, sizeof (Buffer), "\\_SB.LPIE"); + Status =3D AcpiAmlObjectUpdateInteger ( + PrivateData->AcpiSdtProtocol, + PrivateData->AcpiTableHandle, + Buffer, + PrivateData->Configuration.AcpiLpiEnable + ); + ASSERT_EFI_ERROR (Status); + + return Status; +} + +STATIC +VOID +UpdateAcpiOnReadyToBoot ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol; + EFI_ACPI_DESCRIPTION_HEADER *Table; + EFI_ACPI_HANDLE TableHandle; + UINTN TableKey; + UINTN TableIndex; + + ASSERT (mPrivateData !=3D NULL); + + // + // Find the AcpiTable protocol + // + Status =3D gBS->LocateProtocol ( + &gEfiAcpiSdtProtocolGuid, + NULL, + (VOID **)&AcpiSdtProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Unable to locate ACPI table protocol\n")); + return; + } + + mPrivateData->AcpiSdtProtocol =3D AcpiSdtProtocol; + + TableIndex =3D 0; + Status =3D AcpiLocateTableBySignature ( + AcpiSdtProtocol, + EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATUR= E, + &TableIndex, + &Table, + &TableKey + ); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + return; + } + + Status =3D AcpiSdtProtocol->OpenSdt (TableKey, &TableHandle); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + return; + } + + mPrivateData->AcpiTableHandle =3D TableHandle; + + Status =3D UpdateCPPCConfig (mPrivateData); + if (EFI_ERROR (Status)) { + return; + } + + Status =3D UpdateLPIConfig (mPrivateData); + if (EFI_ERROR (Status)) { + return; + } + + Status =3D UpdateTurboModeConfig (mPrivateData); + if (EFI_ERROR (Status)) { + return; + } + + // + // Close DSDT Table + // + AcpiSdtProtocol->Close (TableHandle); + AcpiUpdateChecksum ((UINT8 *)Table, Table->Length); +} + +STATIC +EFI_STATUS +AcpiConfigUnload ( + VOID + ) +{ + ASSERT (mPrivateData !=3D NULL); + + if (mDriverHandle !=3D NULL) { + gBS->UninstallMultipleProtocolInterfaces ( + mDriverHandle, + &gEfiDevicePathProtocolGuid, + &mAcpiConfigHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &mPrivateData->ConfigAccess, + NULL + ); + mDriverHandle =3D NULL; + } + + if (mPrivateData->HiiHandle !=3D NULL) { + HiiRemovePackages (mPrivateData->HiiHandle); + } + + FreePool (mPrivateData); + mPrivateData =3D NULL; + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +AcpiConfigEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_HII_HANDLE HiiHandle; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + UINTN BufferSize; + ACPI_CONFIG_VARSTORE_DATA *Configuration; + BOOLEAN ActionFlag; + EFI_STRING ConfigRequestHdr; + EFI_EVENT ReadyToBootEvent; + PLATFORM_INFO_HOB *PlatformHob; + VOID *Hob; + + // + // Initialize the local variables. + // + ConfigRequestHdr =3D NULL; + + // + // Initialize driver private data + // + mPrivateData =3D AllocateZeroPool (sizeof (ACPI_CONFIG_PRIVATE_DATA)); + if (mPrivateData =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + mPrivateData->Signature =3D ACPI_CONFIG_PRIVATE_SIGNATURE; + + mPrivateData->ConfigAccess.ExtractConfig =3D ExtractConfig; + mPrivateData->ConfigAccess.RouteConfig =3D RouteConfig; + mPrivateData->ConfigAccess.Callback =3D DriverCallback; + + // + // Get the Platform HOB + // + Hob =3D GetFirstGuidHob (&gPlatformInfoHobGuid); + ASSERT (Hob !=3D NULL); + if (Hob =3D=3D NULL) { + AcpiConfigUnload (); + return EFI_DEVICE_ERROR; + } + PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + + mPrivateData->PlatformHob =3D PlatformHob; + + // + // Locate ConfigRouting protocol + // + Status =3D gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL,= (VOID **)&HiiConfigRouting); + if (EFI_ERROR (Status)) { + return Status; + } + mPrivateData->HiiConfigRouting =3D HiiConfigRouting; + + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &mDriverHandle, + &gEfiDevicePathProtocolGuid, + &mAcpiConfigHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &mPrivateData->ConfigAccess, + NULL + ); + ASSERT_EFI_ERROR (Status); + + mPrivateData->DriverHandle =3D mDriverHandle; + + // + // Publish our HII data + // + HiiHandle =3D HiiAddPackages ( + &gAcpiConfigFormSetGuid, + mDriverHandle, + AcpiConfigDxeStrings, + AcpiConfigVfrBin, + NULL + ); + if (HiiHandle =3D=3D NULL) { + gBS->UninstallMultipleProtocolInterfaces ( + mDriverHandle, + &gEfiDevicePathProtocolGuid, + &mAcpiConfigHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &mPrivateData->ConfigAccess, + NULL + ); + return EFI_OUT_OF_RESOURCES; + } + + mPrivateData->HiiHandle =3D HiiHandle; + + // + // Initialize configuration data + // + Configuration =3D &mPrivateData->Configuration; + ZeroMem (Configuration, sizeof (ACPI_CONFIG_VARSTORE_DATA)); + + // + // Try to read NV config EFI variable first + // + ConfigRequestHdr =3D HiiConstructConfigHdr (&gAcpiConfigFormSetGuid, Acp= iVarstoreDataName, mDriverHandle); + ASSERT (ConfigRequestHdr !=3D NULL); + + BufferSize =3D sizeof (ACPI_CONFIG_VARSTORE_DATA); + Status =3D gRT->GetVariable (AcpiVarstoreDataName, &gAcpiConfigFormSetGu= id, NULL, &BufferSize, Configuration); + if (EFI_ERROR (Status)) { + // + // Store zero data Buffer Storage to EFI variable + // + Status =3D gRT->SetVariable ( + AcpiVarstoreDataName, + &gAcpiConfigFormSetGuid, + ACPI_VARSTORE_ATTRIBUTES, + sizeof (ACPI_CONFIG_VARSTORE_DATA), + Configuration + ); + if (EFI_ERROR (Status)) { + AcpiConfigUnload (); + return Status; + } + // + // EFI variable for NV config doesn't exit, we should build this varia= ble + // based on default values stored in IFR + // + ActionFlag =3D HiiSetToDefaults (ConfigRequestHdr, EFI_HII_DEFAULT_CLA= SS_STANDARD); + if (!ActionFlag) { + AcpiConfigUnload (); + return EFI_INVALID_PARAMETER; + } + } else { + // + // EFI variable does exist and Validate Current Setting + // + ActionFlag =3D HiiValidateSettings (ConfigRequestHdr); + if (!ActionFlag) { + AcpiConfigUnload (); + return EFI_INVALID_PARAMETER; + } + } + FreePool (ConfigRequestHdr); + + Status =3D gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + UpdateAcpiOnReadyToBoot, + NULL, + &gEfiEventReadyToBootGuid, + &ReadyToBootEvent + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Fail to create ready to boot event %r!\n", Statu= s)); + return Status; + } + + Status =3D AcpiNVDataUpdate (mPrivateData); + if (EFI_ERROR (Status)) { + return Status; + } + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfig= Strings.uni b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfi= gStrings.uni new file mode 100644 index 000000000000..21a6188518fd --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigStrings= .uni @@ -0,0 +1,27 @@ +// +// Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// + +#langdef en-US "English" + +#string STR_ACPI_FORM #language en-US "ACPI= Configuration" +#string STR_ACPI_FORM_HELP #language en-US "ACPI= Configuration" + +#string STR_ACPI_FORM_SEPERATE_LINE #language en-US "" +#string STR_ACPI_COMMON_ENABLE #language en-US "Enab= led" +#string STR_ACPI_COMMON_DISABLE #language en-US "Disa= bled" +#string STR_ACPI_UNSUPPORTED #language en-US "Unsu= pported" + +#string STR_ACPI_APEI_SUPPORT_PROMPT #language en-US "APEI= Support" +#string STR_ACPI_APEI_SUPPORT_HELP #language en-US "Enab= le/Disable ACPI Platform Error Interface support" + +#string STR_ACPI_CPPC_PROMPT #language en-US "CPPC= Support" +#string STR_ACPI_CPPC_HELP #language en-US "Enab= les or Disables System ability to CPPC (Collaborative Processor Performance= Control)" + +#string STR_ACPI_LPI_PROMPT #language en-US "LPI = Support" +#string STR_ACPI_LPI_HELP #language en-US "Enab= les or Disables System ability to LPI (Lower Power Idle)" + +#string STR_ACPI_TURBO_PROMPT #language en-US "Max = Performance" +#string STR_ACPI_TURBO_HELP #language en-US "Enab= les or Disables System ability to Max Performance" --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83841): https://edk2.groups.io/g/devel/message/83841 Mute This Topic: https://groups.io/mt/87123915/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83842+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83842+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1637167872562821.6284279076091; Wed, 17 Nov 2021 08:51:12 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id yS3xYY1788612xRoc2b8yZOF; Wed, 17 Nov 2021 08:51:12 -0800 X-Received: from NAM12-DM6-obe.outbound.protection.outlook.com (NAM12-DM6-obe.outbound.protection.outlook.com [40.107.243.132]) by mx.groups.io with SMTP id smtpd.web12.9726.1637167871376728389 for ; Wed, 17 Nov 2021 08:51:11 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TyZ9PKSDkUFPRUwmD/wVn/hBs1Mnl27bWQfwnJfy0X4DIbSy45OGorj2nl0U0vbZdy3T8I9pTGH6E6mo0Vvs1ru07gI/93YGi0CPr7jnOj/uLgzHz+A4xU2oNkajTiTAoNLkzSlErcfsThFMM1er2g2Wlsv5x/0wUWVDz2oyIqiSMhITvV+Jf0oCm1Xh+ISPp0B1PMkPIz4IyVI2uDw3N4fIVeq0UsUHMfCIrlHABiPZTRAJC5N3y9PWpjVb1Q1/+CLPtfxvANCOOa1ppv14vRAlSH1craX0Mlygh3OMQ4nRtiWOShHaE4rfIt+0wme24Zfu7mEc8KQVAsB4a71SlA== 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=fRQLU3/v2ZrA+2YVqPLG7bSZhfuQCT/yPUNIwHM9KGw=; b=QLReXdJNHWHGwesFoijIMd/xgVkM6TkYXyLBT7v3gavTFj2toD58pdE9+JyNtmpk6jJ2fMFsuj0kuWAkn+kOTTJnJPvo/9LkeMMu2bGS5UWpoe4NJ2tbL0fYhIZA3Z43+BeagqWv7ZvH+RERzCAVnEubrvMt0PA6NBmYw5RNeK37w/bf7cEWrbYWZilZp29FN4v+znJyXF0VC3yaE7qCk3g8sTGPoep2gbyhRizlu9wdlFnZCNQYLmP4De5karhRQKuzNCV8XZFpb9SdKbioA+UxeEFejFhzIBEUrtxd7k2inAHEwUyW9z1DKv7k1xyapEbGUJTHz9o3FUELb61xMQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB7400.prod.exchangelabs.com (2603:10b6:510:10b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.19; Wed, 17 Nov 2021 16:51:09 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:51:09 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Quan Nguyen , Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 29/30] AmpereAltraPkg: Add configuration screen for RAS Date: Wed, 17 Nov 2021 23:47:26 +0700 Message-ID: <20211117164727.10922-30-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:51:06 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 02cde70c-6ad4-411f-aa09-08d9a9ea747f X-MS-TrafficTypeDiagnostic: PH0PR01MB7400: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:96; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: 7wPzmPeMqhIv1fR/g7X49XZ/Gmt3FzR15HkuDbC12FTY9Nc3u9Jr/Aslp4X9PfMHb4k04hdRUcEz1CUHtRc56hT67DFTeKoq+Zsf5W4gqzkNHNAUu+ZJcTcbvLWkZeUout5sWXlElQDe4+kCmNDfOpSbFpZbC+5+hND45DN3qOyCN42E+RbZCszjcYrApRUbv+4L/b+T+frf+ZZYHTjBNgAjLGn49tuzNzdYnYYmx/tfAg5dcuGFXwbruJ49K8ctPCn9cN/s8r+rpwOmHpyRey3OtufHj7QQCf90PrqG4sIXQrhJP2jvCh/XYO6ep+VwAJsYJ/HROUtQ8Psrf8x1qH7HJTOJLtSzRXbDWI+3sqb4dF8e0pomRmCHp/1xQmP0qG4Duikhbo71r3Nolv4gbMhXlS8Hgb42yXbo8eKybQHLFiLj9JUVNDpKG/E6H/lKw0PgdAzB3QVfbJgAwFQFVZ9XVIznuoHypbUPg3sB4egEzU/YVPtw+Prae7UQ7rozba2VxDiZsQfDXSBlIidQm0OjMhjcP8LeRwUj3RpZOq1yXer+e0Q0dUdwyBUTYSNq0HBkp/r9BbY2xStdrTYL/9Q4EVlilz9sqn/4zCT+E+o5E9CUJ/Ax9tsMOUrH7bjb3KI+9zj4mcYiX4JWu2F9J8onMT3Piz1fWcQoPKTbk1kD5FfkOiJ22k+hD0ZSt76YCK45CpqayCKD1cKQ7/f8vbEeiyFdS3v0EemDMAAIjnKHuZESxvcb3yCcUchOT3fo+jpniVt0eIjl6pLxXCO08g== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?2iRfsWTAWghmSrZjR0xIWorY19KQBvsarsjvDYy8f3Htld6tjG6mwn2abpQs?= =?us-ascii?Q?0qLLT/wptFhDZAZj0GImQPltvnFCB74bbbwCPjXA0pyEf4YhmSaj4HxyYMWm?= =?us-ascii?Q?ueitzJNrABbtwUX8qqNuGSw9k8OmHNLPo6N4Xe7x0Esrw6qQm9kGDKSe5hqX?= =?us-ascii?Q?NGEHhopbNn51Vs9MnUNuVe4lldeljQ791QWp1VTX5oylKGoLYSvNLZM3mpHQ?= =?us-ascii?Q?nKmCFu/W5JLdQd7Y85DV/qNODtKfkwCrdjRkgDOPWWl/bVuAPifGQqOYj2b4?= =?us-ascii?Q?9OAZ4K/xt2wwGRCQENmwQ7AkMMFWbm5gweMkztDwWwPCZWPeiyaXPt6Yb7Jg?= =?us-ascii?Q?6LEHEUMY40HAajsnOuIaKt+LDW0Ar5D/fkPPe8M5nrPuCwW4D7+oaAWaGC0U?= =?us-ascii?Q?x9L6Sw2xmfXgyssR4UTbyetI4AII+8uI6UjIS25gxW3v9Gj5vt9ZJPOjqozG?= =?us-ascii?Q?JuOeHam0527nerxpk53bYy80iJF47W2tCDtSjTnd73Z9XJTCZzafJhSGCPfu?= =?us-ascii?Q?W6PPtfr/fULh79pnjCzoJEE/bC0FuCIPc2t9SdRnWQ0h1+6QHzH6WVtdsVGy?= =?us-ascii?Q?NE3Wc9vc+mt4O17HOtnRh8swk6fkRtdB4piXTCqb9aoh0EA30Ulvkuq/bPVe?= =?us-ascii?Q?u8ORF631s8WAMacTK8ApYI7+tMb1rQQpq3KGx0KLaS9vaBp/NZZEDjyKhdlB?= =?us-ascii?Q?oha1NmDtR30QAD6lmh5Dli4tCMVrnpBu0dgMGJkrPGEvc+/f+mI1++gRirUS?= =?us-ascii?Q?xfkdjMH2cQ5yuLEXo6H2wp041tN5Aga9bFPNmQZ5NX8Mtyvp+qCuN5wAETfx?= =?us-ascii?Q?uTGqKaQ2+sLCAXZsrbmOLIULSmAzuz5Feso7oy0iiQXRQsGyhNLZqG3I7X6/?= =?us-ascii?Q?8AEOFSaPipqI4HJfWA7YHgkTvU+So7Fqntn9FhyOEx1LkBw+ndI+iMNRQuTc?= =?us-ascii?Q?CG6a1sE35+lSKJSyEEBofQjVIRWm2JtX8iP0ltzQNvmJw6dLvPdh0OqtW8nG?= =?us-ascii?Q?ZQqCRCbrx6ndqOMTaoPSHQi6CWwQ+EL0NMQTM0iYHx7jU9v86Ix8uwxbdouL?= =?us-ascii?Q?nfsnA/1029+f5W/+QAUQFF8ZijLA6dyht9l4gGwblFOF7Mt07hICCKn0ovTC?= =?us-ascii?Q?jZCO/O5CiTwi4eQv4aSFPSMPcxJfRaqYqcOzHZoHHbUvC96pKbUfpzxmZAKK?= =?us-ascii?Q?UgdzjsQe98D9L99FYzSNJ3x0lcHDFbhW1NJEHIUFEp7uN7H3/MEKm9BSLeFP?= =?us-ascii?Q?BxL2CnLgUPnZ3ZTolWx2mtf93w4wiNgbs1lg9y6RRluP8/VR1EcsmnE2l+xC?= =?us-ascii?Q?i6qJNyeEgIHKlM1oRZfaTH/8LixiBehpIkhFL+PZIqhFJjQ3ybFq9zuu1/tz?= =?us-ascii?Q?MW4xzNKgHVDF2OrndoeRl6/P/lLNlpXu0SqWmDhwkMq/6zxWNk8TKCI7Nayd?= =?us-ascii?Q?rxrgEwld6+M45H0IfHyWxwFRPoIsNpQOE4XoA5ElV0zC27VP1juIaLSW/Exf?= =?us-ascii?Q?2ZQDoW/fuqE2gVw14KxylEVlWjLyFY4bVUm089bQpnWar9mlwj5uFY0B1u2v?= =?us-ascii?Q?GGr3FVZFYQ3zS6xUiE6PrBtus8WxiMlPt5Qv7ikkchpM+DbOpeyXyTU5+mOv?= =?us-ascii?Q?dXnnjreWN00+juJegVUl0k+3lMNkPYnGygcYctv11xG1g2kEOkc8tJR9FX4U?= =?us-ascii?Q?JornUVyacnFxrIveysBnHe8vDOU=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 02cde70c-6ad4-411f-aa09-08d9a9ea747f X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:51:09.5105 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SwSWK/uHd56coHIQGhuX1BC0MiShvidyti/rRKpBRwxudFFv6MlRc27bLGRoenb9V4p7tGjcs6djojSmDX3lITEorbWyq5jxEZOi+qAGV4E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7400 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: 9R1fybfmOILtK0kjuS65jzuXx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167872; bh=dW+HoPc1NFdFxlR4BFQr3pJHBVT1tPI8A/pom8xZOJY=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=b/yPNM8axNt9OivkoBOSdt8BjUhzg87xy6TPe/8mRUf4mavKWJFiCaxEwkY5CZZNW/y RBSR3yTVCE61P4y07e7XevQAYGnzDvkh0VeQg7xhDaEWnASK5U0pXzVa7DBHwAT8rDvbP qGNS1r/gF9dsVREaqtmboTFZqtneBK661sU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167874476100001 Content-Type: text/plain; charset="utf-8" From: Quan Nguyen This supports user to enable/disable RAS APEI components running in the system firmware such as HEST, BERT, and EINJ. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Platform/Ampere/JadePkg/Jade.dsc = | 1 + Platform/Ampere/JadePkg/Jade.fdf = | 1 + Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDxe.inf = | 56 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDxe.h = | 61 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigNVDataStruct.h= | 46 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigVfr.vfr = | 95 +++ Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDxe.c = | 821 ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigStrings.uni = | 38 + 8 files changed, 1119 insertions(+) diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index b476bc05a600..980f431fc4de 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -190,3 +190,4 @@ [Components.common] Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.inf Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.inf Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDxe.inf diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index 87b04faa9e9a..e88c95c57abe 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -356,5 +356,6 @@ [FV.FvMain] INF Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.inf INF Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.inf INF Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDxe.inf =20 !include Silicon/Ampere/AmpereSiliconPkg/FvRules.fdf.inc diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDx= e.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDxe.inf new file mode 100644 index 000000000000..9b03ed57944f --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDxe.inf @@ -0,0 +1,56 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001A + BASE_NAME =3D RasConfigDxe + FILE_GUID =3D 5b5ee6e3-3135-45f7-ad21-46a3f36813cc + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D RasConfigEntryPoint + +[Sources.common] + RasConfigNVDataStruct.h + RasConfigDxe.c + RasConfigDxe.h + RasConfigVfr.vfr + RasConfigStrings.uni + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + AmpereCpuLib + BaseLib + BaseMemoryLib + DebugLib + DevicePathLib + DevicePathLib + HiiLib + MemoryAllocationLib + NVParamLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + UefiRuntimeServicesTableLib + +[Guids] + gEfiIfrTianoGuid + gPlatformManagerFormsetGuid + gAcpiConfigFormSetGuid + +[Protocols] + gEfiDevicePathProtocolGuid ## CONSUMES + gEfiHiiConfigRoutingProtocolGuid ## CONSUMES + gEfiHiiConfigAccessProtocolGuid ## PRODUCES + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDx= e.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDxe.h new file mode 100644 index 000000000000..1258fbeda6a1 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDxe.h @@ -0,0 +1,61 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef RAS_CONFIG_DXE_H_ +#define RAS_CONFIG_DXE_H_ + +#include "RasConfigNVDataStruct.h" + +// +// This is the generated IFR binary data for each formset defined in VFR. +// +extern UINT8 RasConfigVfrBin[]; + +// +// This is the generated String package data for all .UNI files. +// +extern UINT8 RasConfigDxeStrings[]; + +#define RAS_DDR_CE_THRESHOLD_OFST OFFSET_OF (RAS_CONFIG_VARSTORE_DATA, Ras= DdrCeThreshold) +#define RAS_2P_CE_THRESHOLD_OFST OFFSET_OF (RAS_CONFIG_VARSTORE_DATA, Ras= 2pCeThreshold) + +#define RAS_CONFIG_PRIVATE_SIGNATURE SIGNATURE_32 ('R', 'A', 'S', 'C') + +typedef struct { + UINTN Signature; + + EFI_HANDLE DriverHandle; + EFI_HII_HANDLE HiiHandle; + RAS_CONFIG_VARSTORE_DATA Configuration; + + // + // Consumed protocol + // + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + + // + // Produced protocol + // + EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess; +} RAS_CONFIG_PRIVATE_DATA; + +#define RAS_CONFIG_PRIVATE_FROM_THIS(a) CR (a, RAS_CONFIG_PRIVATE_DATA, C= onfigAccess, RAS_CONFIG_PRIVATE_SIGNATURE) + +#pragma pack(1) + +/// +/// HII specific Vendor Device Path definition. +/// +typedef struct { + VENDOR_DEVICE_PATH VendorDevicePath; + EFI_DEVICE_PATH_PROTOCOL End; +} HII_VENDOR_DEVICE_PATH; + +#pragma pack() + +#endif /* RAS_CONFIG_DXE_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigNV= DataStruct.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfig= NVDataStruct.h new file mode 100644 index 000000000000..8c528f043c27 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigNVDataStr= uct.h @@ -0,0 +1,46 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef RAS_CONFIG_NV_DATA_STRUCT_H_ +#define RAS_CONFIG_NV_DATA_STRUCT_H_ + +#define RAS_CONFIG_VARSTORE_ID 0x1234 +#define RAS_CONFIG_FORM_ID 0x1235 + +#define RAS_VARSTORE_NAME L"RasConfigNVData" + +#define RAS_CONFIG_FORMSET_GUID \ + { \ + 0x96934cc6, 0xcb15, 0x4d8a, { 0xbe, 0x5f, 0x8e, 0x7d, 0x55, 0x0e, 0xc9= , 0xc6 } \ + } + +// +// Labels definition +// +#define LABEL_UPDATE 0x3234 +#define LABEL_END 0xffff + +#pragma pack(1) + +// +// Ras Configuration NV data structure definition +// +typedef struct { + UINT32 RasHardwareEinj; + UINT32 RasPcieAerFwFirstEnabled; + UINT32 RasBertEnabled; + UINT32 RasSdeiEnabled; + UINT32 RasDdrCeThreshold; + UINT32 Ras2pCeThreshold; + UINT32 RasCpmCeThreshold; + UINT32 RasLinkErrThreshold; +} RAS_CONFIG_VARSTORE_DATA; + +#pragma pack() + +#endif /* RAS_CONFIG_NV_DATA_STRUCT_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigVf= r.vfr b/Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigVfr.vfr new file mode 100644 index 000000000000..ec38eb186c1b --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigVfr.vfr @@ -0,0 +1,95 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "RasConfigNVDataStruct.h" + +formset + guid =3D RAS_CONFIG_FORMSET_GUID, + title =3D STRING_TOKEN(STR_RAS_FORM), + help =3D STRING_TOKEN(STR_RAS_FORM_HELP), + classguid =3D gPlatformManagerFormsetGuid, + + // + // Define a variable Storage + // + varstore RAS_CONFIG_VARSTORE_DATA, + varid =3D RAS_CONFIG_VARSTORE_ID, + name =3D RasConfigNVData, + guid =3D RAS_CONFIG_FORMSET_GUID; + + form formid =3D RAS_CONFIG_FORM_ID, + title =3D STRING_TOKEN(STR_RAS_FORM); + + subtitle text =3D STRING_TOKEN(STR_RAS_FORM); + + oneof varid =3D RasConfigNVData.RasHardwareEinj, + prompt =3D STRING_TOKEN(STR_RAS_HARDWARE_EINJ_PROMPT), + help =3D STRING_TOKEN(STR_RAS_HARDWARE_EINJ_HELP), + flags =3D NUMERIC_SIZE_4 | RESET_REQUIRED, + option text =3D STRING_TOKEN(STR_RAS_COMMON_ENABLE), value =3D 1, fl= ags =3D DEFAULT; + option text =3D STRING_TOKEN(STR_RAS_COMMON_DISABLE), value =3D 0, f= lags =3D 0; + + endoneof; + + oneof varid =3D RasConfigNVData.RasPcieAerFwFirstEnabled, + prompt =3D STRING_TOKEN(STR_RAS_PCIE_AER_FW_FIRST_PROMPT), + help =3D STRING_TOKEN(STR_RAS_PCIE_AER_FW_FIRST_HELP), + flags =3D NUMERIC_SIZE_4 | RESET_REQUIRED, + option text =3D STRING_TOKEN(STR_RAS_COMMON_ENABLE), value =3D 1, fl= ags =3D 0; + option text =3D STRING_TOKEN(STR_RAS_COMMON_DISABLE), value =3D 0, f= lags =3D DEFAULT; + + endoneof; + + oneof varid =3D RasConfigNVData.RasBertEnabled, + prompt =3D STRING_TOKEN(STR_RAS_BERT_ENABLED_PROMPT), + help =3D STRING_TOKEN(STR_RAS_BERT_ENABLED_HELP), + flags =3D NUMERIC_SIZE_4 | RESET_REQUIRED, + option text =3D STRING_TOKEN(STR_RAS_COMMON_ENABLE), value =3D 1, fl= ags =3D DEFAULT; + option text =3D STRING_TOKEN(STR_RAS_COMMON_DISABLE), value =3D 0, f= lags =3D 0; + + endoneof; + + oneof varid =3D RasConfigNVData.RasSdeiEnabled, + prompt =3D STRING_TOKEN(STR_RAS_SDEI_ENABLED_PROMPT), + help =3D STRING_TOKEN(STR_RAS_SDEI_ENABLED_HELP), + flags =3D NUMERIC_SIZE_4 | RESET_REQUIRED, + option text =3D STRING_TOKEN(STR_RAS_COMMON_ENABLE), value =3D 1, fl= ags =3D 0; + option text =3D STRING_TOKEN(STR_RAS_COMMON_DISABLE), value =3D 0, f= lags =3D DEFAULT; + + endoneof; + + label LABEL_UPDATE; + // + // This is where we will dynamically add other Action type op-code + // + label LABEL_END; + + numeric varid =3D RasConfigNVData.RasCpmCeThreshold, + prompt =3D STRING_TOKEN(STR_RAS_CPM_CE_THRESHOLD_PROMPT), + help =3D STRING_TOKEN(STR_RAS_CPM_CE_THRESHOLD_HELP), + flags =3D NUMERIC_SIZE_4 | RESET_REQUIRED, + minimum =3D 1, + maximum =3D 8192, + default =3D 1, + + endnumeric; + + numeric varid =3D RasConfigNVData.RasLinkErrThreshold, + prompt =3D STRING_TOKEN(STR_RAS_LINK_ERR_THRESHOLD_PROMPT), + help =3D STRING_TOKEN(STR_RAS_LINK_ERR_THRESHOLD_HELP), + flags =3D NUMERIC_SIZE_4 | RESET_REQUIRED, + minimum =3D 1, + maximum =3D 8192, + default =3D 1, + + endnumeric; + + + endform; + +endformset; diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDx= e.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDxe.c new file mode 100644 index 000000000000..2da012faec9d --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDxe.c @@ -0,0 +1,821 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "RasConfigDxe.h" + +CHAR16 RasConfigVarstoreDataName[] =3D L"RasConfigNVData"; + +EFI_HANDLE mDriverHandle =3D NULL; +RAS_CONFIG_PRIVATE_DATA *mPrivateData =3D NULL; + +EFI_GUID mRasConfigFormSetGuid =3D RAS_CONFIG_FORMSET_GUID; + +// +// Default RAS Settings +// +#define RAS_DEFAULT_HARDWARE_EINJ_SUPPORT 0 +#define RAS_DEFAULT_PCIE_AER_FW_FIRST 0 +#define RAS_DEFAULT_BERT_SUPPORT 1 +#define RAS_DEFAULT_SDEI_SUPPORT 0 +#define RAS_DEFAULT_DDR_CE_THRESHOLD 1 +#define RAS_DEFAULT_2P_CE_THRESHOLD 1 +#define RAS_DEFAULT_PROCESSOR_CE_THRESHOLD 1 +#define RAS_DEFAULT_DDR_LINK_ERROR_THRESHOLD 1 + + +HII_VENDOR_DEVICE_PATH mRasConfigHiiVendorDevicePath =3D { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8)(sizeof (VENDOR_DEVICE_PATH)), + (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + RAS_CONFIG_FORMSET_GUID + }, + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { + (UINT8)(END_DEVICE_PATH_LENGTH), + (UINT8)((END_DEVICE_PATH_LENGTH) >> 8) + } + } +}; + +BOOLEAN +IsDdrCeWindowEnabled ( + VOID + ) +{ + UINT32 DdrCeWindow; + EFI_STATUS Status; + + Status =3D NVParamGet ( + NV_SI_RO_BOARD_RAS_DDR_CE_WINDOW, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &DdrCeWindow + ); + if (EFI_ERROR (Status)) { + return FALSE; + } + + return (DdrCeWindow !=3D 0) ? TRUE : FALSE; +} + +EFI_STATUS +RasConfigNvParamGet ( + OUT RAS_CONFIG_VARSTORE_DATA *Configuration + ) +{ + EFI_STATUS Status; + UINT32 Value; + + Status =3D NVParamGet ( + NV_SI_HARDWARE_EINJ, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + Value =3D RAS_DEFAULT_HARDWARE_EINJ_SUPPORT; + Status =3D NVParamSet ( + NV_SI_HARDWARE_EINJ, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Value + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a:%d NVParamSet() failed!\n", __FUNCTION__, _= _LINE__)); + ASSERT_EFI_ERROR (Status); + Value =3D 0; + } + } + Configuration->RasHardwareEinj =3D Value; + + Status =3D NVParamGet ( + NV_SI_RAS_PCIE_AER_FW_FIRST, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + Value =3D RAS_DEFAULT_PCIE_AER_FW_FIRST; + Status =3D NVParamSet ( + NV_SI_RAS_PCIE_AER_FW_FIRST, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Value + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a:%d NVParamSet() failed!\n", __FUNCTION__, _= _LINE__)); + ASSERT_EFI_ERROR (Status); + Value =3D 0; + } + } + Configuration->RasPcieAerFwFirstEnabled =3D Value; + + Status =3D NVParamGet ( + NV_SI_RAS_BERT_ENABLED, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + Value =3D RAS_DEFAULT_BERT_SUPPORT; + Status =3D NVParamSet ( + NV_SI_RAS_BERT_ENABLED, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Value + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a:%d NVParamSet() failed!\n", __FUNCTION__, _= _LINE__)); + ASSERT_EFI_ERROR (Status); + Value =3D 0; + } + } + Configuration->RasBertEnabled =3D Value; + + Status =3D NVParamGet ( + NV_SI_RAS_SDEI_ENABLED, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + Value =3D RAS_DEFAULT_SDEI_SUPPORT; + Status =3D NVParamSet ( + NV_SI_RAS_SDEI_ENABLED, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Value + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a:%d NVParamSet() failed!\n", __FUNCTION__, _= _LINE__)); + ASSERT_EFI_ERROR (Status); + Value =3D 0; + } + } + Configuration->RasSdeiEnabled =3D Value; + + Status =3D NVParamGet ( + NV_SI_DDR_CE_RAS_THRESHOLD, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + Value =3D RAS_DEFAULT_DDR_CE_THRESHOLD; + Status =3D NVParamSet ( + NV_SI_DDR_CE_RAS_THRESHOLD, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Value + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a:%d NVParamSet() failed!\n", __FUNCTION__, _= _LINE__)); + ASSERT_EFI_ERROR (Status); + Value =3D 0; + } + } + Configuration->RasDdrCeThreshold =3D Value; + + Status =3D NVParamGet ( + NV_SI_2P_CE_RAS_THRESHOLD, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + Value =3D RAS_DEFAULT_2P_CE_THRESHOLD; + Status =3D NVParamSet ( + NV_SI_2P_CE_RAS_THRESHOLD, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Value + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a:%d NVParamSet() failed!\n", __FUNCTION__, _= _LINE__)); + ASSERT_EFI_ERROR (Status); + Value =3D 0; + } + } + Configuration->Ras2pCeThreshold =3D Value; + + Status =3D NVParamGet ( + NV_SI_CPM_CE_RAS_THRESHOLD, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + Value =3D RAS_DEFAULT_PROCESSOR_CE_THRESHOLD; + Status =3D NVParamSet ( + NV_SI_CPM_CE_RAS_THRESHOLD, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Value + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a:%d NVParamSet() failed!\n", __FUNCTION__, _= _LINE__)); + ASSERT_EFI_ERROR (Status); + Value =3D 0; + } + } + Configuration->RasCpmCeThreshold =3D Value; + + Status =3D NVParamGet ( + NV_SI_LINK_ERR_THRESHOLD, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + Value =3D RAS_DEFAULT_DDR_LINK_ERROR_THRESHOLD; + Status =3D NVParamSet ( + NV_SI_LINK_ERR_THRESHOLD, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Value + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a:%d NVParamSet() failed!\n", __FUNCTION__, _= _LINE__)); + ASSERT_EFI_ERROR (Status); + Value =3D 0; + } + } + Configuration->RasLinkErrThreshold =3D Value; + + return EFI_SUCCESS; +} + +EFI_STATUS +RasConfigNvParamSet ( + IN RAS_CONFIG_VARSTORE_DATA *Configuration + ) +{ + EFI_STATUS Status; + + Status =3D NVParamSet ( + NV_SI_HARDWARE_EINJ, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Configuration->RasHardwareEinj + ); + ASSERT_EFI_ERROR (Status); + + Status =3D NVParamSet ( + NV_SI_RAS_PCIE_AER_FW_FIRST, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Configuration->RasPcieAerFwFirstEnabled + ); + ASSERT_EFI_ERROR (Status); + + Status =3D NVParamSet ( + NV_SI_RAS_BERT_ENABLED, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Configuration->RasBertEnabled + ); + ASSERT_EFI_ERROR (Status); + + Status =3D NVParamSet ( + NV_SI_RAS_SDEI_ENABLED, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Configuration->RasSdeiEnabled + ); + ASSERT_EFI_ERROR (Status); + + Status =3D NVParamSet ( + NV_SI_DDR_CE_RAS_THRESHOLD, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Configuration->RasDdrCeThreshold + ); + ASSERT_EFI_ERROR (Status); + + Status =3D NVParamSet ( + NV_SI_2P_CE_RAS_THRESHOLD, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Configuration->Ras2pCeThreshold + ); + ASSERT_EFI_ERROR (Status); + + Status =3D NVParamSet ( + NV_SI_CPM_CE_RAS_THRESHOLD, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Configuration->RasCpmCeThreshold + ); + ASSERT_EFI_ERROR (Status); + + Status =3D NVParamSet ( + NV_SI_LINK_ERR_THRESHOLD, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + Configuration->RasLinkErrThreshold + ); + ASSERT_EFI_ERROR (Status); + + return EFI_SUCCESS; +} + +/** + This function allows a caller to extract the current configuration for o= ne + or more named elements from the target driver. + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param Request A null-terminated Unicode string in + format. + @param Progress On return, points to a character in the R= equest + string. Points to the string's null termi= nator if + request was successful. Points to the mos= t recent + '&' before the first failing name/value p= air (or + the beginning of the string if the failur= e is in + the first name/value pair) if the request= was not + successful. + @param Results A null-terminated Unicode string in + format which has all valu= es filled + in for the names in the Request string. S= tring to + be allocated by the called function. + + @retval EFI_SUCCESS The Results is filled with the requested = values. + @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results. + @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown nam= e. + @retval EFI_NOT_FOUND Routing data doesn't match any storage in= this + driver. + +**/ +EFI_STATUS +EFIAPI +RasConfigExtractConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Request, + OUT EFI_STRING *Progress, + OUT EFI_STRING *Results + ) +{ + EFI_STATUS Status; + UINTN BufferSize; + RAS_CONFIG_PRIVATE_DATA *PrivateData; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + EFI_STRING ConfigRequest; + EFI_STRING ConfigRequestHdr; + UINTN Size; + BOOLEAN AllocatedRequest; + + if (Progress =3D=3D NULL || Results =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + // + // Initialize the local variables. + // + ConfigRequestHdr =3D NULL; + ConfigRequest =3D NULL; + Size =3D 0; + *Progress =3D Request; + AllocatedRequest =3D FALSE; + + if ((Request !=3D NULL) && !HiiIsConfigHdrMatch (Request, &mRasConfigFor= mSetGuid, RasConfigVarstoreDataName)) { + return EFI_NOT_FOUND; + } + + PrivateData =3D RAS_CONFIG_PRIVATE_FROM_THIS (This); + HiiConfigRouting =3D PrivateData->HiiConfigRouting; + + // + // Get current setting from NVParam. + // + Status =3D RasConfigNvParamGet (&PrivateData->Configuration); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Convert buffer data to by helper function BlockToConfig() + // + BufferSize =3D sizeof (RAS_CONFIG_VARSTORE_DATA); + ConfigRequest =3D Request; + if ((Request =3D=3D NULL) || (StrStr (Request, L"OFFSET") =3D=3D NULL)) { + // + // Request has no request element, construct full request string. + // Allocate and fill a buffer large enough to hold the tem= plate + // followed by "&OFFSET=3D0&WIDTH=3DWWWWWWWWWWWWWWWW" followed by a Nu= ll-terminator + // + ConfigRequestHdr =3D HiiConstructConfigHdr (&mRasConfigFormSetGuid, Ra= sConfigVarstoreDataName, PrivateData->DriverHandle); + Size =3D (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16); + ConfigRequest =3D AllocateZeroPool (Size); + ASSERT (ConfigRequest !=3D NULL); + if (ConfigRequest =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + AllocatedRequest =3D TRUE; + UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=3D0&WIDTH=3D%016LX", C= onfigRequestHdr, (UINT64)BufferSize); + FreePool (ConfigRequestHdr); + } + + // + // Convert buffer data to by helper function BlockToConfig() + // + Status =3D HiiConfigRouting->BlockToConfig ( + HiiConfigRouting, + ConfigRequest, + (UINT8 *)&PrivateData->Configuration, + BufferSize, + Results, + Progress + ); + + // + // Free the allocated config request string. + // + if (AllocatedRequest) { + FreePool (ConfigRequest); + ConfigRequest =3D NULL; + } + + // + // Set Progress string to the original request string. + // + if (Request =3D=3D NULL) { + *Progress =3D NULL; + } else if (StrStr (Request, L"OFFSET") =3D=3D NULL) { + *Progress =3D Request + StrLen (Request); + } + + return Status; +} + +/** + This function processes the results of changes in configuration. + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param Configuration A null-terminated Unicode string in + format. + @param Progress A pointer to a string filled in with the = offset of + the most recent '&' before the first fail= ing + name/value pair (or the beginning of the = string if + the failure is in the first name/value pa= ir) or + the terminating NULL if all was successfu= l. + + @retval EFI_SUCCESS The Results is processed successfully. + @retval EFI_INVALID_PARAMETER Configuration is NULL. + @retval EFI_NOT_FOUND Routing data doesn't match any storage in= this + driver. + +**/ +EFI_STATUS +EFIAPI +RasConfigRouteConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Configuration, + OUT EFI_STRING *Progress + ) +{ + EFI_STATUS Status; + UINTN BufferSize; + RAS_CONFIG_PRIVATE_DATA *PrivateData; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + + if (Configuration =3D=3D NULL || Progress =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + PrivateData =3D RAS_CONFIG_PRIVATE_FROM_THIS (This); + HiiConfigRouting =3D PrivateData->HiiConfigRouting; + *Progress =3D Configuration; + + // + // Check routing data in . + // Note: if only one Storage is used, then this checking could be skippe= d. + // + if (!HiiIsConfigHdrMatch (Configuration, &mRasConfigFormSetGuid, RasConf= igVarstoreDataName)) { + return EFI_NOT_FOUND; + } + + // + // Get configuration data from NVParam + // + Status =3D RasConfigNvParamGet (&PrivateData->Configuration); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Convert to buffer data by helper function ConfigToBlock() + // + BufferSize =3D sizeof (RAS_CONFIG_VARSTORE_DATA); + Status =3D HiiConfigRouting->ConfigToBlock ( + HiiConfigRouting, + Configuration, + (UINT8 *)&PrivateData->Configuration, + &BufferSize, + Progress + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Store configuration data back to NVParam + // + Status =3D RasConfigNvParamSet (&PrivateData->Configuration); + if (EFI_ERROR (Status)) { + return Status; + } + + return Status; +} + +/** + This function processes the results of changes in configuration. + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param Action Specifies the type of action taken by the= browser. + @param QuestionId A unique value which is sent to the origi= nal + exporting driver so that it can identify = the type + of data to expect. + @param Type The type of value for the question. + @param Value A pointer to the data being sent to the o= riginal + exporting driver. + @param ActionRequest On return, points to the action requested= by the + callback function. + + @retval EFI_SUCCESS The callback successfully handled the act= ion. + @retval EFI_INVALID_PARAMETER The setup browser call this function with= invalid parameters. + +**/ +EFI_STATUS +EFIAPI +RasConfigCallback ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN EFI_BROWSER_ACTION Action, + IN EFI_QUESTION_ID QuestionId, + IN UINT8 Type, + IN EFI_IFR_TYPE_VALUE *Value, + OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest + ) +{ + if (Action !=3D EFI_BROWSER_ACTION_CHANGING) { + // + // Do nothing for other UEFI Action. Only do call back when data is ch= anged. + // + return EFI_UNSUPPORTED; + } + if (((Value =3D=3D NULL) + && (Action !=3D EFI_BROWSER_ACTION_FORM_OPEN) + && (Action !=3D EFI_BROWSER_ACTION_FORM_CLOSE)) + || (ActionRequest =3D=3D NULL)) + { + return EFI_INVALID_PARAMETER; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +UpdateRasConfigScreen ( + IN RAS_CONFIG_PRIVATE_DATA *PrivateData + ) +{ + EFI_STATUS Status; + VOID *StartOpCodeHandle; + EFI_IFR_GUID_LABEL *StartLabel; + VOID *EndOpCodeHandle; + EFI_IFR_GUID_LABEL *EndLabel; + + // + // Initialize the container for dynamic opcodes + // + StartOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (StartOpCodeHandle !=3D NULL); + + EndOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (EndOpCodeHandle !=3D NULL); + + // + // Create Hii Extend Label OpCode as the start opcode + // + StartLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode ( + StartOpCodeHandle, + &gEfiIfrTianoGuid, + NULL, + sizeof (EFI_IFR_GUID_LABEL) + ); + if (StartLabel =3D=3D NULL) { + Status =3D EFI_OUT_OF_RESOURCES; + goto FreeOpCodeBuffer; + } + StartLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + StartLabel->Number =3D LABEL_UPDATE; + + // + // Create Hii Extend Label OpCode as the end opcode + // + EndLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode ( + EndOpCodeHandle, + &gEfiIfrTianoGuid, + NULL, + sizeof (EFI_IFR_GUID_LABEL) + ); + if (EndLabel =3D=3D NULL) { + Status =3D EFI_OUT_OF_RESOURCES; + goto FreeOpCodeBuffer; + } + EndLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + EndLabel->Number =3D LABEL_END; + + // + // Create the numeric for DDR CE threshold + // + if (!IsDdrCeWindowEnabled ()) { + HiiCreateNumericOpCode ( + StartOpCodeHandle, // Container for dyn= amic created opcodes + 0x8004, // Question ID + RAS_CONFIG_VARSTORE_ID, // VarStore ID + (UINT16)RAS_DDR_CE_THRESHOLD_OFST, // Offset in Buffer = Storage + STRING_TOKEN (STR_RAS_DDR_CE_THRESHOLD_PROMPT), // Question prompt t= ext + STRING_TOKEN (STR_RAS_DDR_CE_THRESHOLD_HELP), + EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED, + EFI_IFR_NUMERIC_SIZE_4, + 1, + 8192, + 1, + NULL + ); + } + + // + // Create the numeric for 2P CE threshold + // + if (IsSlaveSocketActive ()) { + HiiCreateNumericOpCode ( + StartOpCodeHandle, // Container for dyna= mic created opcodes + 0x8005, // Question ID + RAS_CONFIG_VARSTORE_ID, // VarStore ID + (UINT16)RAS_2P_CE_THRESHOLD_OFST, // Offset in Buffer S= torage + STRING_TOKEN (STR_RAS_2P_CE_THRESHOLD_PROMPT), // Question prompt te= xt + STRING_TOKEN (STR_RAS_2P_CE_THRESHOLD_HELP), + EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED, + EFI_IFR_NUMERIC_SIZE_4, + 1, + 8192, + 1, + NULL + ); + } + + Status =3D HiiUpdateForm ( + PrivateData->HiiHandle, // HII handle + &mRasConfigFormSetGuid, // Formset GUID + RAS_CONFIG_FORM_ID, // Form ID + StartOpCodeHandle, // Label for where to insert opcodes + EndOpCodeHandle // Insert data + ); + +FreeOpCodeBuffer: + HiiFreeOpCodeHandle (StartOpCodeHandle); + HiiFreeOpCodeHandle (EndOpCodeHandle); + + return Status; +} + +EFI_STATUS +EFIAPI +RasConfigUnload ( + VOID + ) +{ + ASSERT (mPrivateData !=3D NULL); + + if (mDriverHandle !=3D NULL) { + gBS->UninstallMultipleProtocolInterfaces ( + mDriverHandle, + &gEfiDevicePathProtocolGuid, + &mRasConfigHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &mPrivateData->ConfigAccess, + NULL + ); + mDriverHandle =3D NULL; + } + + if (mPrivateData->HiiHandle !=3D NULL) { + HiiRemovePackages (mPrivateData->HiiHandle); + } + + FreePool (mPrivateData); + mPrivateData =3D NULL; + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +RasConfigEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_HII_HANDLE HiiHandle; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + + // + // Initialize driver private data + // + mPrivateData =3D AllocateZeroPool (sizeof (RAS_CONFIG_PRIVATE_DATA)); + if (mPrivateData =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + mPrivateData->Signature =3D RAS_CONFIG_PRIVATE_SIGNATURE; + + mPrivateData->ConfigAccess.ExtractConfig =3D RasConfigExtractConfig; + mPrivateData->ConfigAccess.RouteConfig =3D RasConfigRouteConfig; + mPrivateData->ConfigAccess.Callback =3D RasConfigCallback; + + // + // Locate ConfigRouting protocol + // + Status =3D gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL,= (VOID **)&HiiConfigRouting); + if (EFI_ERROR (Status)) { + return Status; + } + mPrivateData->HiiConfigRouting =3D HiiConfigRouting; + + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &mDriverHandle, + &gEfiDevicePathProtocolGuid, + &mRasConfigHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &mPrivateData->ConfigAccess, + NULL + ); + ASSERT_EFI_ERROR (Status); + + mPrivateData->DriverHandle =3D mDriverHandle; + + // + // Publish our HII data + // + HiiHandle =3D HiiAddPackages ( + &mRasConfigFormSetGuid, + mDriverHandle, + RasConfigDxeStrings, + RasConfigVfrBin, + NULL + ); + if (HiiHandle =3D=3D NULL) { + gBS->UninstallMultipleProtocolInterfaces ( + mDriverHandle, + &gEfiDevicePathProtocolGuid, + &mRasConfigHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &mPrivateData->ConfigAccess, + NULL + ); + return EFI_OUT_OF_RESOURCES; + } + + mPrivateData->HiiHandle =3D HiiHandle; + + Status =3D UpdateRasConfigScreen (mPrivateData); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a %d Fail to update Memory Configuration screen \n", + __FUNCTION__, + __LINE__ + )); + RasConfigUnload (); + ASSERT_EFI_ERROR (Status); + return Status; + } + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigSt= rings.uni b/Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigStr= ings.uni new file mode 100644 index 000000000000..c502093a2bbf --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigStrings.u= ni @@ -0,0 +1,38 @@ +// +// Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// + +#langdef en-US "English" + +#string STR_RAS_FORM #language en-US "RAS C= onfiguration" +#string STR_RAS_FORM_HELP #language en-US "RAS C= onfiguration" + +#string STR_RAS_FORM_SEPERATE_LINE #language en-US "" +#string STR_RAS_COMMON_ENABLE #language en-US "Enabl= ed" +#string STR_RAS_COMMON_DISABLE #language en-US "Disab= led" + +#string STR_RAS_HARDWARE_EINJ_PROMPT #language en-US "Hardw= are EINJ" +#string STR_RAS_HARDWARE_EINJ_HELP #language en-US "Enabl= e hardware EINJ support, if disabled EINJ is software simulated" + +#string STR_RAS_PCIE_AER_FW_FIRST_PROMPT #language en-US "PCIe = AER Firmware First" +#string STR_RAS_PCIE_AER_FW_FIRST_HELP #language en-US "Enabl= e firmware to detect PCIe AER, if disabled OS detects AER" + +#string STR_RAS_BERT_ENABLED_PROMPT #language en-US "Enabl= e BERT" +#string STR_RAS_BERT_ENABLED_HELP #language en-US "Enabl= e Boot Error Record Table, if disabled BERT will not be populated" + +#string STR_RAS_SDEI_ENABLED_PROMPT #language en-US "Enabl= e SDEI" +#string STR_RAS_SDEI_ENABLED_HELP #language en-US "Enabl= e Software Delegated Exception Interface for NMI support" + +#string STR_RAS_DDR_CE_THRESHOLD_PROMPT #language en-US "DDR C= E Threshold" +#string STR_RAS_DDR_CE_THRESHOLD_HELP #language en-US "Numbe= r of DDR CEs to occur before using SCI notification to OS rather than polle= d notification" + +#string STR_RAS_2P_CE_THRESHOLD_PROMPT #language en-US "2P CE= Threshold" +#string STR_RAS_2P_CE_THRESHOLD_HELP #language en-US "Numbe= r of 2P CEs to occur before using SCI notification to OS rather than polled= notification" + +#string STR_RAS_CPM_CE_THRESHOLD_PROMPT #language en-US "Proce= ssor CE Threshold" +#string STR_RAS_CPM_CE_THRESHOLD_HELP #language en-US "Numbe= r of processor CEs to occur before using SCI notification to OS rather than= polled notification" + +#string STR_RAS_LINK_ERR_THRESHOLD_PROMPT #language en-US "DDR L= ink Error Threshold" +#string STR_RAS_LINK_ERR_THRESHOLD_HELP #language en-US "Numbe= r of DDR link errors before considering it fatal severity" --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83842): https://edk2.groups.io/g/devel/message/83842 Mute This Topic: https://groups.io/mt/87123917/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 07:01:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+83843+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+83843+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=pass(p=none dis=none) header.from=groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 163716787598262.966603027892575; Wed, 17 Nov 2021 08:51:15 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id pqP3YY1788612xYjasWFlN5A; Wed, 17 Nov 2021 08:51:15 -0800 X-Received: from NAM12-DM6-obe.outbound.protection.outlook.com (NAM12-DM6-obe.outbound.protection.outlook.com [40.107.243.137]) by mx.groups.io with SMTP id smtpd.web10.9756.1637167874855866773 for ; Wed, 17 Nov 2021 08:51:15 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GUbXa9jZ2tcZJXmkr4KjqKPAjfl/8klkCXQNGiUlWm3IIml+5ksIbCCUuQwyKcop/v10GXmy2GHiI10edMilLE+DZEm3JfAgG3EuLqeQsZB3+DS/GMkC4h2qvVXXCPRPZ7LYg8p4oJZI7FOdtXaEniFOtHfZ2nq8omU79LXJILJeZQHso8JK+aqSyQ92pcayA5CK7FGUDOexjeT73vP+blGQ9l42IrE6pNVymefkKEmlDtoMD1YH1OTr/zjQvQoO147W3oipsKbcnXyfmen3ckng854bvQhzBhnST82qFEsHNYXb7cMjUpVxaL2OlNig+XPcVdrsl/tEw3laTfsprw== 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=DYe2ZQ9GvlEyFz/ruEq6Qb6P5QVQkjF+Lqjl1fLbWzA=; b=mKaHRzVvU2yWSFk9KKOG/T0TOykTM4tYRhU38ECaCg6vf+30XTEMwtKm/F+FGCb1SuCDceEWmdBgyG3rWzFXOzJrjmO0yWHzQqxs7HKWICHGpy3VIy8TH5NL3nR+H9VQZ4TI52H8DV6/cS8OpiQrXQ7dDtXhthlK5TZiTbrqPAXcIkGN7LeiFRjIibmpXHNOMrWzPT7JoT+W/41SSm4/thY0jkfZaqkxNy54Rxnl4pZ8LAieEieyT+oU1aN9nM7jYMhih8OpCX83gM4w9VhN1RJhjQ1Xb5kv5vLwoovyVC2lcfcOoxh2WCst3495Yhm7Mwmm+GdH+61Sw9IpGMTNxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB7400.prod.exchangelabs.com (2603:10b6:510:10b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.19; Wed, 17 Nov 2021 16:51:13 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4713.019; Wed, 17 Nov 2021 16:51:13 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [edk2-platforms][PATCH v5 30/30] AmpereAltraPkg: Add configuration screen for Watchdog timer Date: Wed, 17 Nov 2021 23:47:27 +0700 Message-ID: <20211117164727.10922-31-nhi@os.amperecomputing.com> In-Reply-To: <20211117164727.10922-1-nhi@os.amperecomputing.com> References: <20211117164727.10922-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HKAPR04CA0001.apcprd04.prod.outlook.com (2603:1096:203:d0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Wed, 17 Nov 2021 16:51:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ae55fa27-a016-42d9-5de1-08d9a9ea7682 X-MS-TrafficTypeDiagnostic: PH0PR01MB7400: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: bV1ti0mEwuWXt0ksocbUMCFuU6rA791V+2nh0w1XQORvODAPAPM9+L9qkiObDFRiAxZ6SGJmu1BnOxYBje4jXMNDAi27AG0R1xDR94cpJUpLv5Z/1OwCb0AFDfj5yfm8SRSCkZPW2dp2MevLPKDgOgDM7PNbFlv8jJ1f3IufvuGKY/AsILroosY3dQmY9TMxNP1XBHGAddATVSzC65NrG3IryelmPDys1kZ8Ip5KEmsuLwk3U2tsojV/knAOHBdLbY9sbEPvsLh2sfMWRvdOF3AzoySKrBDHBTHDo86YfCFhpJv2ytRkBsmxrUSi4X1+32MIdXB8npVul2I/o7GORzvyVU7zr5ATX9/PHiAXyLn+LqkTP316U2MHg1lZzQmSQGG670Wja2L5ymFaKQYcydoXXW5TfMhZlvMDUQ/JBTyJ96xfgptesTONJdWpRZ+aijcmzxci9LtnKtdPkOuErc1x1CKpiJarfligQYvW0sf8yR2heffcYK77HomM2cQIOwDtOjzKFW4zXiMO8N/FC+PSruDxuQPMftPlc63PlhVDfeBnw0wVxSAT41rM+FqTiYJk1mt3r3YIKssCzvB2okdDLKDAv1Av+NgPsU/94Ii064hGtw9VK8sKHUxdo8G2Ei3Kp5ogxFQr+m1GrtadlmkwqJ4nvfkfhBQzaRpzMonvpoYBEmNjm1+nahIOWCfyX3h5bI5IhmrJY//Gqv6/BWraaELv2KWAHfujZFERU807ZP0OrCvv/fRvrwruKIN61oc7L/fHg4Jy0XOTCRYus64VSHfYA56zkaGzmmEpua0= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?rYHDG0F9Ph2jDRBeCHwIdlKiZVOXdpMsR6qVEW6aejfVwwPOMkrUF7GF13Fk?= =?us-ascii?Q?mXX9wKoBhVCVTmkMc095pvY+ZtKuVJx8OgX8alpogCxgTBuABHYZXK9YYf+V?= =?us-ascii?Q?/H0uWUPrceWn5LUuHYU3KhuHiB/w53dIKUR6tUpbmPNnQQsg8rPxYuKf6NFR?= =?us-ascii?Q?QkLZUnFWerGOzLReLv7u7y8yZIweIgmnnpAmQU+wU2IS5u4yTF4qyQhlG0oD?= =?us-ascii?Q?r1Zjk2WABAH/CALuePyDA1pV2Mm0zfVTxEMkKmU+T9yKSpTZAmvYNrctREV6?= =?us-ascii?Q?eSop2OWnJf6zEfyKpJ6Qu7+Y1Aq7q4nG38e7cFCbKwk8+sWQ1530pyneOYQB?= =?us-ascii?Q?9Fo8475/JwJkdBzljYXTyO1jZSPS9F7SSD0nJ2BIN0mR3nCIP4ZbUNGEH7Yj?= =?us-ascii?Q?oXaVtpcUPHjw0IKk6KpUfylbW6G+1WUzXbWxlS3ABBk6dIXvNa3e3Fh/ANOq?= =?us-ascii?Q?yS/9mfzRKqAzRUHj9ZydnUP4q4+fHSJrgrsYs7NdgalaSAwPEW7/FGoL4agT?= =?us-ascii?Q?ZR+vTnTaExDqkhCM0+xfsqSi7ZmMPWB8fsO/mE3hL1ViNiT9hKECxzyRAMxj?= =?us-ascii?Q?K6+rsVgTv8idAlrU2gMixgrxahKhghkfBBZ9VMgKlVdfVAr72LZqn3FYRgkQ?= =?us-ascii?Q?mfbkONQxCPVjs+JuWZoS9ynfiZqfZ/dLi99Mw8Ce8XOsGdO/Ol2Q94XNQztV?= =?us-ascii?Q?1ZXuIyu1K7YNeZt86FdkDeLgVsaa/cQfbW9fRxLcB/zSjY4BUJkYO37LXzkN?= =?us-ascii?Q?TWIA5v6g37NeK2C0qHftoP/ZHHITjUo53JUwytJ43chwqX8Soy2yZTZg4+HJ?= =?us-ascii?Q?i5xFYPLY9LQr/OnFSBa02evAxBow5L+fp7ITgVOHg+l+f3HGewvhHt7uC3OU?= =?us-ascii?Q?OwyCK/BDMAQ3Vb27B+U9WPq+NQgO7aMvaQTl42qBGr2wSac8fo2bx7dEyyrS?= =?us-ascii?Q?ny/bZDekfGTblEMqRfDjJgxeQQnLFjblt4Xm3KMnqaKuI0H1Ha3CEn6SpYOU?= =?us-ascii?Q?/wxmuXcl9cK2IRTJBRXeKizvHHMkxdrAZo+ds1r9Sxc4Q/qtOrW/XpVWW5Tg?= =?us-ascii?Q?oysgtN9QWO93IDT1CcSVX96O7HmRGyLmvsVuDO/TH6WCxsFmADV9VnHSHPpR?= =?us-ascii?Q?YW1Y5IcyP36ZZnkxg1T6y57EN+ajzhHgF8UHk14nLFH8JNvHOJz/s5MNY/Ip?= =?us-ascii?Q?LUsrYiSt18dNxyGd38itXcpWj6VVAseub0KvP5z6YCqCPZhtA+RinzDrfhGh?= =?us-ascii?Q?AoXjJ6Qfx2gEIKJiQZ/vzrlzGo6OC1zTmk00axwVBKVUUVDOVZPyHy4LBlJ7?= =?us-ascii?Q?7Nyi/t+LSjFgS6I/5Z2kvstQ8HoQmYClMQg5l8kWX5xON6DCI9QcghWBZdhF?= =?us-ascii?Q?MBwu9FgAA0Sbnj5H5HBvPXOAVkCCN7Nk6c7nycD5JgVz2kBi6RdEhAG+kaYZ?= =?us-ascii?Q?FnsOUveX8Z3NklJw0xT5UDg0onJdVWLOULoCdzSTbMUdkueJqnpZW6DKydJ3?= =?us-ascii?Q?BbZ7xIxv6q1nfis8RhEFGjnM89fLEdMLwcEQHI96yKrYOD7I0DRUz+vzqOB9?= =?us-ascii?Q?W1sSDDb7php6UaLjiof5evRwZFM69OGF+y2oRBT0+866WQYn2BlTvtllVN7u?= =?us-ascii?Q?xBiOgZDutefmzFULoPGn+XSz/bo90sf/K6DjHjoJ0KVnYDH9yfTIksx1g9Wr?= =?us-ascii?Q?kQNSDauTkGHWucmYvNXmMBECg+Q=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae55fa27-a016-42d9-5de1-08d9a9ea7682 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2021 16:51:12.9275 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Lx644DWv3vuLuvrP2HzP3lzsfsl5JZere+Z4nn82PNcrQfnOa+18egKbsoUTQYjCsXSzNVwUpIMp+UnaiWL1jylJg7X4q4X6dqsMv18riGc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB7400 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com X-Gm-Message-State: xbup28atDSqLd1JzcfRqB6N8x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637167875; bh=FAYhD8dRNca5itybNLdqpRrPWR+fu19mOyIaeANWwTs=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=j/S3UczC6p0HVeNxTmKDsle/JKd627MmPQBq0UfrgDg2Jz8BnFt5ffGLCuQtQZMqZcQ HmvmsSH7iVZOw/2sY6IwFruSHNbyIuD5nqLzt2EQIKxSOg/CZ+HWw6q1DDLko3xRgLe5S biCEl36BKCtEm2cpFXJR/VgKXHbgJO2TwL8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637167876955100002 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen This adds an option to configure the timeout of the secure watchdog timer which are used to monitor the pre-UEFI system booting. The system will be reset if the timer expires. The default timeout is 5 minutes. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec = | 3 + Platform/Ampere/JadePkg/Jade.dsc = | 1 + Platform/Ampere/JadePkg/Jade.fdf = | 1 + Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfigDxe.= inf | 50 +++ Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfigDxe.= h | 73 ++++ Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfigNVDa= taStruct.h | 25 ++ Silicon/Ampere/AmpereAltraPkg/Include/Guid/WatchdogConfigHii.h = | 19 + Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfigVfr.= vfr | 45 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfigDxe.= c | 435 ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfigStri= ngs.uni | 22 + 10 files changed, 674 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Amp= ere/AmpereAltraPkg/AmpereAltraPkg.dec index d795c9229691..d43bf1a6f296 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -70,3 +70,6 @@ [Guids] =20 ## Include/Guid/AcpiConfigHii.h gAcpiConfigFormSetGuid =3D { 0x0ceb6764, 0xd415, 0x4b01, { 0xa8, 0x43, 0= xd1, 0x01, 0xbc, 0xb0, 0xd8, 0x29 } } + + ## Include/Guid/WatchdogConfigHii.h + gWatchdogConfigFormSetGuid =3D { 0xC3F8EC6E, 0x95EE, 0x460C, { 0xA4, 0= x8D, 0xEA, 0x54, 0x2F, 0xFF, 0x01, 0x61 } } diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index 980f431fc4de..eea3eec7f529 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -191,3 +191,4 @@ [Components.common] Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.inf Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.inf Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDxe.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfigDx= e.inf diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index e88c95c57abe..3c2d315ec23a 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -357,5 +357,6 @@ [FV.FvMain] INF Silicon/Ampere/AmpereAltraPkg/Drivers/CpuConfigDxe/CpuConfigDxe.inf INF Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.inf INF Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDxe.inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConf= igDxe.inf =20 !include Silicon/Ampere/AmpereSiliconPkg/FvRules.fdf.inc diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/Watchd= ogConfigDxe.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/W= atchdogConfigDxe.inf new file mode 100644 index 000000000000..3ed37bfb15da --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfi= gDxe.inf @@ -0,0 +1,50 @@ +## @file +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D WatchdogConfigDxe + FILE_GUID =3D 135A0CA5-4851-4EF5-9E1A-C6E4610C39A9 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D WatchdogConfigInitialize + +[Sources.common] + WatchdogConfigNVDataStruct.h + WatchdogConfigVfr.vfr + WatchdogConfigStrings.uni + WatchdogConfigDxe.c + WatchdogConfigDxe.h + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + DevicePathLib + HiiLib + NVParamLib + PrintLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Guids] + gPlatformManagerFormsetGuid + gWatchdogConfigFormSetGuid + +[Protocols] + gEfiDevicePathProtocolGuid ## CONSUMES + gEfiHiiConfigRoutingProtocolGuid ## CONSUMES + gEfiHiiConfigAccessProtocolGuid ## PRODUCES + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/Watchd= ogConfigDxe.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/Wat= chdogConfigDxe.h new file mode 100644 index 000000000000..95fc6c8f6269 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfi= gDxe.h @@ -0,0 +1,73 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef WATCHDOG_CONFIG_DXE_H_ +#define WATCHDOG_CONFIG_DXE_H_ + +#include + +#include +#include + +#include "WatchdogConfigNVDataStruct.h" + +// +// This is the generated IFR binary data for each formset defined in VFR. +// +extern UINT8 WatchdogConfigVfrBin[]; + +// +// This is the generated String package data for all .UNI files. +// +extern UINT8 WatchdogConfigDxeStrings[]; + +#define WATCHDOG_CONFIG_PRIVATE_SIGNATURE SIGNATURE_32 ('W', 'D', 'T', 'C') + +typedef struct { + UINTN Signature; + + EFI_HANDLE DriverHandle; + EFI_HII_HANDLE HiiHandle; + WATCHDOG_CONFIG_VARSTORE_DATA Configuration; + + // + // Consumed protocol + // + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + + // + // Produced protocol + // + EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess; +} WATCHDOG_CONFIG_PRIVATE_DATA; + +#define WATCHDOG_CONFIG_PRIVATE_FROM_THIS(a) CR (a, WATCHDOG_CONFIG_PRIVA= TE_DATA, ConfigAccess, WATCHDOG_CONFIG_PRIVATE_SIGNATURE) + +#pragma pack(1) + +/// +/// HII specific Vendor Device Path definition. +/// +typedef struct { + VENDOR_DEVICE_PATH VendorDevicePath; + EFI_DEVICE_PATH_PROTOCOL End; +} HII_VENDOR_DEVICE_PATH; + +#pragma pack() + +EFI_STATUS +WatchdogConfigNvParamSet ( + IN WATCHDOG_CONFIG_VARSTORE_DATA *VarStoreConfig + ); + +EFI_STATUS +WatchdogConfigNvParamGet ( + OUT WATCHDOG_CONFIG_VARSTORE_DATA *VarStoreConfig + ); + +#endif /* WATCHDOG_CONFIG_DXE_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/Watchd= ogConfigNVDataStruct.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConf= igDxe/WatchdogConfigNVDataStruct.h new file mode 100644 index 000000000000..89fbd69d9538 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfi= gNVDataStruct.h @@ -0,0 +1,25 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef WATCHDOG_CONFIG_NV_DATA_STRUCT_H_ +#define WATCHDOG_CONFIG_NV_DATA_STRUCT_H_ + +#include + +#define WATCHDOG_CONFIG_VARSTORE_ID 0x1234 +#define WATCHDOG_CONFIG_FORM_ID 0x1235 + +#define SWDT_DEFAULT_VALUE 300 // 5 minutes + +#pragma pack(1) +typedef struct { + UINT32 SecureWatchdogTimerTimeout; +} WATCHDOG_CONFIG_VARSTORE_DATA; +#pragma pack() + +#endif /* WATCHDOG_CONFIG_NV_DATA_STRUCT_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Guid/WatchdogConfigHii.h= b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/WatchdogConfigHii.h new file mode 100644 index 000000000000..16319d61a759 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/WatchdogConfigHii.h @@ -0,0 +1,19 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef WATCHDOG_CONFIG_HII_H_ +#define WATCHDOG_CONFIG_HII_H_ + +#define WATCHDOG_CONFIG_FORMSET_GUID \ + { \ + 0xC3F8EC6E, 0x95EE, 0x460C, { 0xA4, 0x8D, 0xEA, 0x54, 0x2F, 0xFF, 0x01= , 0x61 } \ + } + +extern EFI_GUID gWatchdogConfigFormSetGuid; + +#endif /* WATCHDOG_CONFIG_HII_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/Watchd= ogConfigVfr.vfr b/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/W= atchdogConfigVfr.vfr new file mode 100644 index 000000000000..18d2bf3d2547 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfi= gVfr.vfr @@ -0,0 +1,45 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "WatchdogConfigNVDataStruct.h" + +formset + guid =3D WATCHDOG_CONFIG_FORMSET_GUID, + title =3D STRING_TOKEN(STR_WATCHDOG_CONFIG_FORM), + help =3D STRING_TOKEN(STR_WATCHDOG_CONFIG_FORM_HELP), + classguid =3D gPlatformManagerFormsetGuid, + + // + // Define a variable Storage + // + varstore WATCHDOG_CONFIG_VARSTORE_DATA, + varid =3D WATCHDOG_CONFIG_VARSTORE_ID, + name =3D WatchdogConfigNVData, + guid =3D WATCHDOG_CONFIG_FORMSET_GUID; + + form + formid =3D WATCHDOG_CONFIG_FORM_ID, + title =3D STRING_TOKEN(STR_WATCHDOG_CONFIG_FORM); + subtitle text =3D STRING_TOKEN(STR_WATCHDOG_CONFIG_FORM_HELP); + + oneof varid =3D WatchdogConfigNVData.SecureWatchdogTimerTimeout, + prompt =3D STRING_TOKEN(STR_SWDT_TIMEOUT), + help =3D STRING_TOKEN(STR_SWDT_TIMEOUT_HELP), + flags =3D RESET_REQUIRED, + option text =3D STRING_TOKEN (STR_WDT_TIME_DISABLE), value =3D 0, fl= ags =3D 0; + option text =3D STRING_TOKEN (STR_WDT_TIME_5MIN), value =3D 300, fla= gs =3D 0; + option text =3D STRING_TOKEN (STR_WDT_TIME_6MIN), value =3D 360, fla= gs =3D 0; + option text =3D STRING_TOKEN (STR_WDT_TIME_10MIN), value =3D 600, fl= ags =3D 0; + option text =3D STRING_TOKEN (STR_WDT_TIME_15MIN), value =3D 900, fl= ags =3D 0; + option text =3D STRING_TOKEN (STR_WDT_TIME_20MIN), value =3D 1200, f= lags =3D 0; + default =3D SWDT_DEFAULT_VALUE, + endoneof; + + endform; + +endformset; diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/Watchd= ogConfigDxe.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/Wat= chdogConfigDxe.c new file mode 100644 index 000000000000..8165729eeccd --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfi= gDxe.c @@ -0,0 +1,435 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "WatchdogConfigDxe.h" + +CHAR16 WatchDogConfigVarstoreDataName[] =3D L"WatchdogConfigNVData"; + +EFI_HANDLE mDriverHandle =3D NULL; +WATCHDOG_CONFIG_PRIVATE_DATA *mPrivateData =3D NULL; + +HII_VENDOR_DEVICE_PATH mWatchdogConfigHiiVendorDevicePath =3D { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8)(sizeof (VENDOR_DEVICE_PATH)), + (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + WATCHDOG_CONFIG_FORMSET_GUID + }, + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { + (UINT8)(END_DEVICE_PATH_LENGTH), + (UINT8)((END_DEVICE_PATH_LENGTH) >> 8) + } + } +}; + +EFI_STATUS +WatchdogConfigNvParamGet ( + OUT WATCHDOG_CONFIG_VARSTORE_DATA *VarStoreConfig + ) +{ + EFI_STATUS Status; + UINT32 Value; + BOOLEAN SetDefault; + + SetDefault =3D FALSE; + Status =3D NVParamGet ( + NV_SI_SEC_WDT_BIOS_EXP_MINS, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + VarStoreConfig->SecureWatchdogTimerTimeout =3D SWDT_DEFAULT_VALUE; + if (Status =3D=3D EFI_NOT_FOUND) { + SetDefault =3D TRUE; + } else { + ASSERT (FALSE); + } + } else { + VarStoreConfig->SecureWatchdogTimerTimeout =3D Value; + } + + if (SetDefault) { + WatchdogConfigNvParamSet (VarStoreConfig); + } + + return EFI_SUCCESS; +} + +EFI_STATUS +WatchdogConfigNvParamSet ( + IN WATCHDOG_CONFIG_VARSTORE_DATA *VarStoreConfig + ) +{ + EFI_STATUS Status; + UINT32 Value; + + Status =3D NVParamGet ( + NV_SI_SEC_WDT_BIOS_EXP_MINS, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status) + || Value !=3D VarStoreConfig->SecureWatchdogTimerTimeout) + { + Status =3D NVParamSet ( + NV_SI_SEC_WDT_BIOS_EXP_MINS, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + VarStoreConfig->SecureWatchdogTimerTimeout + ); + if (EFI_ERROR (Status)) { + return Status; + } + } + + return EFI_SUCCESS; +} + +/** + This function allows a caller to extract the current configuration for o= ne + or more named elements from the target driver. + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param Request A null-terminated Unicode string in + format. + @param Progress On return, points to a character in the= Request + string. Points to the string's null termi= nator if + request was successful. Points to the mos= t recent + '&' before the first failing name/value p= air (or + the beginning of the string if the failur= e is in + the first name/value pair) if the request= was not + successful. + @param Results A null-terminated Unicode string in + format which has all valu= es filled + in for the names in the Request string. S= tring to + be allocated by the called function. + + @retval EFI_SUCCESS The Results is filled with the requested = values. + @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results. + @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown nam= e. + @retval EFI_NOT_FOUND Routing data doesn't match any storage in= this + driver. + +**/ +EFI_STATUS +EFIAPI +WatchdogConfigExtractConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Request, + OUT EFI_STRING *Progress, + OUT EFI_STRING *Results + ) +{ + EFI_STATUS Status; + UINTN BufferSize; + WATCHDOG_CONFIG_PRIVATE_DATA *PrivateData; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + EFI_STRING ConfigRequest; + EFI_STRING ConfigRequestHdr; + UINTN Size; + BOOLEAN AllocatedRequest; + + if (Progress =3D=3D NULL || Results =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + // + // Initialize the local variables. + // + ConfigRequestHdr =3D NULL; + ConfigRequest =3D NULL; + Size =3D 0; + *Progress =3D Request; + AllocatedRequest =3D FALSE; + + if ((Request !=3D NULL) && !HiiIsConfigHdrMatch (Request, &gWatchdogConf= igFormSetGuid, WatchDogConfigVarstoreDataName)) { + return EFI_NOT_FOUND; + } + + PrivateData =3D WATCHDOG_CONFIG_PRIVATE_FROM_THIS (This); + HiiConfigRouting =3D PrivateData->HiiConfigRouting; + + // + // Get current setting from NVParam. + // + Status =3D WatchdogConfigNvParamGet (&PrivateData->Configuration); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Convert buffer data to by helper function BlockToConfig() + // + BufferSize =3D sizeof (WATCHDOG_CONFIG_VARSTORE_DATA); + ConfigRequest =3D Request; + if ((Request =3D=3D NULL) || (StrStr (Request, L"OFFSET") =3D=3D NULL)) { + // + // Request has no request element, construct full request string. + // Allocate and fill a buffer large enough to hold the tem= plate + // followed by "&OFFSET=3D0&WIDTH=3DWWWWWWWWWWWWWWWW" followed by a Nu= ll-terminator + // + ConfigRequestHdr =3D HiiConstructConfigHdr (&gWatchdogConfigFormSetGui= d, WatchDogConfigVarstoreDataName, PrivateData->DriverHandle); + Size =3D (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16); + ConfigRequest =3D AllocateZeroPool (Size); + ASSERT (ConfigRequest !=3D NULL); + if (ConfigRequest =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + AllocatedRequest =3D TRUE; + UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=3D0&WIDTH=3D%016LX", C= onfigRequestHdr, (UINT64)BufferSize); + FreePool (ConfigRequestHdr); + } + + // + // Convert buffer data to by helper function BlockToConfig() + // + Status =3D HiiConfigRouting->BlockToConfig ( + HiiConfigRouting, + ConfigRequest, + (UINT8 *)&PrivateData->Configuration, + BufferSize, + Results, + Progress + ); + + // + // Free the allocated config request string. + // + if (AllocatedRequest) { + FreePool (ConfigRequest); + ConfigRequest =3D NULL; + } + + // + // Set Progress string to the original request string. + // + if (Request =3D=3D NULL) { + *Progress =3D NULL; + } else if (StrStr (Request, L"OFFSET") =3D=3D NULL) { + *Progress =3D Request + StrLen (Request); + } + + return Status; +} + +/** + This function processes the results of changes in configuration. + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param Configuration A null-terminated Unicode string in + format. + @param Progress A pointer to a string filled in with the = offset of + the most recent '&' before the first fail= ing + name/value pair (or the beginning of the = string if + the failure is in the first name/value pa= ir) or + the terminating NULL if all was successfu= l. + + @retval EFI_SUCCESS The Results is processed successfully. + @retval EFI_INVALID_PARAMETER Configuration is NULL. + @retval EFI_NOT_FOUND Routing data doesn't match any storage in= this + driver. + +**/ +EFI_STATUS +EFIAPI +WatchdogConfigRouteConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Configuration, + OUT EFI_STRING *Progress + ) +{ + EFI_STATUS Status; + UINTN BufferSize; + WATCHDOG_CONFIG_PRIVATE_DATA *PrivateData; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + + if (Configuration =3D=3D NULL || Progress =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + PrivateData =3D WATCHDOG_CONFIG_PRIVATE_FROM_THIS (This); + HiiConfigRouting =3D PrivateData->HiiConfigRouting; + *Progress =3D Configuration; + + // + // Check routing data in . + // Note: if only one Storage is used, then this checking could be skippe= d. + // + if (!HiiIsConfigHdrMatch (Configuration, &gWatchdogConfigFormSetGuid, Wa= tchDogConfigVarstoreDataName)) { + return EFI_NOT_FOUND; + } + + // + // Get configuration data from NVParam + // + Status =3D WatchdogConfigNvParamGet (&PrivateData->Configuration); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Convert to buffer data by helper function ConfigToBlock() + // + BufferSize =3D sizeof (WATCHDOG_CONFIG_VARSTORE_DATA); + Status =3D HiiConfigRouting->ConfigToBlock ( + HiiConfigRouting, + Configuration, + (UINT8 *)&PrivateData->Configuration, + &BufferSize, + Progress + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Store configuration data back to NVParam + // + Status =3D WatchdogConfigNvParamSet (&PrivateData->Configuration); + if (EFI_ERROR (Status)) { + return Status; + } + + return Status; +} + +/** + This function processes the results of changes in configuration. + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL. + @param Action Specifies the type of action taken by the= browser. + @param QuestionId A unique value which is sent to the origi= nal + exporting driver so that it can identify = the type + of data to expect. + @param Type The type of value for the question. + @param Value A pointer to the data being sent to the o= riginal + exporting driver. + @param ActionRequest On return, points to the action requested= by the + callback function. + + @retval EFI_SUCCESS The callback successfully handled the act= ion. + @retval EFI_INVALID_PARAMETER The setup browser call this function with= invalid parameters. + +**/ +EFI_STATUS +EFIAPI +WatchdogConfigCallback ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN EFI_BROWSER_ACTION Action, + IN EFI_QUESTION_ID QuestionId, + IN UINT8 Type, + IN EFI_IFR_TYPE_VALUE *Value, + OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest + ) +{ + if (Action !=3D EFI_BROWSER_ACTION_CHANGING) { + // + // Do nothing for other UEFI Action. Only do call back when data is ch= anged. + // + return EFI_UNSUPPORTED; + } + if (((Value =3D=3D NULL) + && (Action !=3D EFI_BROWSER_ACTION_FORM_OPEN) + && (Action !=3D EFI_BROWSER_ACTION_FORM_CLOSE)) + || (ActionRequest =3D=3D NULL)) + { + return EFI_INVALID_PARAMETER; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +WatchdogConfigInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_HII_HANDLE HiiHandle; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + + // + // Initialize driver private data + // + mPrivateData =3D AllocateZeroPool (sizeof (WATCHDOG_CONFIG_PRIVATE_DATA)= ); + if (mPrivateData =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + mPrivateData->Signature =3D WATCHDOG_CONFIG_PRIVATE_SIGNATURE; + + mPrivateData->ConfigAccess.ExtractConfig =3D WatchdogConfigExtractConfig; + mPrivateData->ConfigAccess.RouteConfig =3D WatchdogConfigRouteConfig; + mPrivateData->ConfigAccess.Callback =3D WatchdogConfigCallback; + + // + // Locate ConfigRouting protocol + // + Status =3D gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL,= (VOID **)&HiiConfigRouting); + if (EFI_ERROR (Status)) { + return Status; + } + mPrivateData->HiiConfigRouting =3D HiiConfigRouting; + + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &mDriverHandle, + &gEfiDevicePathProtocolGuid, + &mWatchdogConfigHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &mPrivateData->ConfigAccess, + NULL + ); + ASSERT_EFI_ERROR (Status); + + mPrivateData->DriverHandle =3D mDriverHandle; + + // + // Publish our HII data + // + HiiHandle =3D HiiAddPackages ( + &gWatchdogConfigFormSetGuid, + mDriverHandle, + WatchdogConfigDxeStrings, + WatchdogConfigVfrBin, + NULL + ); + if (HiiHandle =3D=3D NULL) { + gBS->UninstallMultipleProtocolInterfaces ( + mDriverHandle, + &gEfiDevicePathProtocolGuid, + &mWatchdogConfigHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &mPrivateData->ConfigAccess, + NULL + ); + return EFI_OUT_OF_RESOURCES; + } + + mPrivateData->HiiHandle =3D HiiHandle; + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/Watchd= ogConfigStrings.uni b/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigD= xe/WatchdogConfigStrings.uni new file mode 100644 index 000000000000..25f4747abfdc --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfi= gStrings.uni @@ -0,0 +1,22 @@ +// +// Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved. +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// + +#langdef en-US "English" + +#string STR_WATCHDOG_CONFIG_FORM #language en-US "Watchdog Configur= ation" +#string STR_WATCHDOG_CONFIG_FORM_HELP #language en-US "Watchdog Configur= ation" + +#string STR_WDT_TIME_DISABLE #language en-US "Disabled" +#string STR_WDT_TIME_3MIN #language en-US "3 minutes" +#string STR_WDT_TIME_4MIN #language en-US "4 minutes" +#string STR_WDT_TIME_5MIN #language en-US "5 minutes" +#string STR_WDT_TIME_6MIN #language en-US "6 minutes" +#string STR_WDT_TIME_10MIN #language en-US "10 minutes" +#string STR_WDT_TIME_15MIN #language en-US "15 minutes" +#string STR_WDT_TIME_20MIN #language en-US "20 minutes" + +#string STR_SWDT_TIMEOUT #language en-US "Secure Watchdog = Timeout" +#string STR_SWDT_TIMEOUT_HELP #language en-US "Timeout when SCP= will reset system if it doesn't receive response from ARMv8." --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#83843): https://edk2.groups.io/g/devel/message/83843 Mute This Topic: https://groups.io/mt/87123918/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-