From nobody Thu Apr 25 11:35:07 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+80704+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+80704+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721565830485.08404053944207; Wed, 15 Sep 2021 08:59:25 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id dYnlYY1788612xdSLxPqDvpp; Wed, 15 Sep 2021 08:59:25 -0700 X-Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.91]) by mx.groups.io with SMTP id smtpd.web08.10068.1631721563892015702 for ; Wed, 15 Sep 2021 08:59:24 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DZsubDJTIYXNjJ6BzWcXmZa1UycSPDySazLR9KRR+d6wBK4KEd8vXhy7bgL7Vsrjr/Lyojc3ldK+uebwGDxBlEDcdaY+WOjAtqAgLH0B2hnIzuHscAKHqXS9IZwUzD1l7ck688Mlp7w+APvYDU+YDfHOiZaRI9LODX4NCeHVAGWuQGrjG+VbhT8z/AZv6GqflCVa2vYmtQFHtHy14SF6niyXD8ynWsLujqqOTCyHJ66q+2Mf31ohg9sQWwVOc1cjE9KN4ThSxpwnEShv2/ME9GeYvY4Fd4Q7tj5RrLMLc9WiWRxB2Q6axFN0oUBUTbNj+ODk3lEsv4XAQAICsjZoqA== 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; bh=5wtQslBH3U3ENqzwqRxq/BMJaOTkZ/CBdI3vWGxL5ug=; b=GPDuiJehqbG2oI5nZTbLAwu1z8lfFZFLj1taU3U5HF0R549yj6juP3lN1pI/RhyWYVxJHXJN+MAC3tyodseQuJw4tCwqtLHUBlNJ/qRYPXNkV5SMgLco7ksbnq9JgB4ZF/ZdTE4RcBE2t+6O3/1u3rpWW1/Xj88piOj3m8Qh/BnfgTVordouZGwvZTr8y82xP8QUrhitPzoFn/9LBFEKbKuJu8fgjZBAtfpzbS84fihOt1iLltauITsm/m6PP0cnMlettRb8ZdHpOi/NBmN8sVNVVCv+QFDnVyemVAKSeluomTN3Fx+1YUCAXQjlh92/AVi9YC3bfDcX0HAkLqaqow== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM6PR01MB5513.prod.exchangelabs.com (2603:10b6:5:151::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.17; Wed, 15 Sep 2021 15:59:14 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 15:59: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] [PATCH v3 01/28] Ampere: Initial support for Ampere Altra processor and Mt. Jade platform Date: Wed, 15 Sep 2021 22:55:00 +0700 Message-ID: <20210915155527.8176-2-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 15:59:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 603185b6-5f90-4c82-bf5d-08d97861c34b X-MS-TrafficTypeDiagnostic: DM6PR01MB5513: X-MS-Exchange-Transport-Forked: True 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: q1qPOP8ryXHdmBKLIdYaOVW8+iR9ha3HhOGmwlkQi2JGvt8RBeOTgkjoPKwOa+9sDMRumyvGZaPX+eYV7nSqo2zAJt50Ta6tZ/YQy33rxiOmvtxiv+5t8DcYz8vvFAv3VIHq8Zq3O6NK7KQ+IH8ekt3UDqwsdnfR5aPOtQURb1A+2gmEtpVCgJqjT8++BtH+cixHrGuhHCjOiRseJd1NBQNpc/gJ9G1POm65lb6PA44UQqScDL1ePraskvro6q6U500lCnqNz1eRo2gF6HClW3fapdKty9sDq/8R5etw/4ND57R/RiF/VtbfHNC1+tsAXudutKtwXU744mrFhKbsbMx1Zgs4S1MsQ3viVt5rpZDlz5EWA5BHMwK6qLRg7E2ITsqvBkeddM8EZn0g1byFz4wXfy+HYKO7VFMTeakRZ1m6B42W8e6/0unRr4xwHYSVWQsSKd0IdCopsZ6j5LJ60VmpQDkmXnlyLErbTdIUmgW1vOU5nwDR/TcHHeOKusjlP59REy64sCntD3oehyDt8p+qoh/2mSrKMPwrLet6+cBQOj9eg+T/gFfcgAQ4UAyKxHH7Ydo7B/HY4BPZTS2JQBfQlE9XtuL/3C3O57ArsVFaTRZCaqA3CJYaNQ6hloE06G8GVBFAv7dYfSKw946eDOUA8prE4WOPZ6Z4w+7nI+6ObT+3HGuT/CV7gXlT8alFxgLCSG96rlFqNF6jeIiKkbU6oelNBDG2lfBj2dW+sCQ= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?NuHxf7GDpokA2S6l+nwGysrz836Zqo/FErebGg3VwHGRd6lu9msJ9fD+aWLB?= =?us-ascii?Q?G50aN1+MOQAzJFk6RMR9JgyVpr6lZVeDAZL9revPR0ssGUqQ2fwNuocPEOBh?= =?us-ascii?Q?0Vyrb0VBAe0orhqFkEkJ3no8X8zurz6tzLNan1Qdkm1EDeta6rpsFx7JFOcl?= =?us-ascii?Q?9t/SoWLiIiNbHD0llQwlLf5h/+I6BC856CewORU+484tdWmqAeOY5ayOm9/U?= =?us-ascii?Q?PYJ9QCUeOCRanop/KHXESurV0L1L4UKEkewzORaHWKL2ZuU8DdmytECylgL9?= =?us-ascii?Q?mQkXMT/hogdNW8qjB/zMp3I+sQTtsTO4M3wVgcahmbAvlHaCtkLXd/rEzXUM?= =?us-ascii?Q?WL+zgp4BOHGDVjRMDQVdb3Hwwk7r8evgGevx7Z7AYs+irRK7LkXN9yLznmNp?= =?us-ascii?Q?o5brOx9UzGDWitECajOZsKQ10Np0lAk90BWluCAwr+ohRs9Fn6wvSduY6FV9?= =?us-ascii?Q?DWoyN297euhQfjKiAECi6lOZTo024ZJOmhMKyChgd3B5JSznTOV0Mapae2sG?= =?us-ascii?Q?cMfZXVQvs2ydOY+yjxFQIqRs1fMkax39oalibDY2gOsDuBuK+9LIxH6ZTrFu?= =?us-ascii?Q?ATTm8ew+D2QgzcJmff+3JXQIH4oaPI4DoJy95jJiN+FD6Plgh8S4YAWS/5Hg?= =?us-ascii?Q?/juwKUrlIE8SjD6n5Ps/5v+xY3eH0YeRghq66x4FBREmnKVkAEYi6A8HgKBb?= =?us-ascii?Q?dDAt4SXbk7XOxtig9uBGxiVtQLByZhGeikvIrTc79vMgk7hkeDrENjWShwGY?= =?us-ascii?Q?3pUn4t4O6/CtzIV0aXoIZ7Tem4J3XaNJXugqYdtx1k3HsMuXHzvLq8+Ri/jc?= =?us-ascii?Q?xDtfVob+Fgfoszbu9cZwILY+IhHTtnVs/w3MaHodGxGyzqWjnp0AjnQJKKje?= =?us-ascii?Q?5LDth3DB94XtIjDzTCUUyJ3bVD5+clmumPEA89K/jrUoGBDMJG+l6Kf1z0BZ?= =?us-ascii?Q?ve2rc7Rjwr9oVZDzZ1Hp237hZUcE4pu3QmvrDh53HMxMUR9kkMO0gfyacLdR?= =?us-ascii?Q?trWuclw2hLgsZOPk9mvoWb5TFUhITMcAvT5KXIqirHkBYfXZIquCcy0BM62o?= =?us-ascii?Q?9GURPUiR1szSbEuNwxUt80a2B563bE1dc1BYY9lrMI6yO5ik9s53tVet4J/J?= =?us-ascii?Q?MUlm3AO7rEdVi/9li2XWecwq3hCmuTpAS9/707136Mg4WJsO+7TT7zwsKt3A?= =?us-ascii?Q?f9XC3SyeaO73XBGZIfe7yDEOgDufak1VfiUhZSr19ShsIc8emMmwAEClCEXV?= =?us-ascii?Q?rE0nrcfktp2L9nZ3AIJLLkt6uprmoGqxy03+0Hyl7GDe2iaBZbjIYZEsnKA9?= =?us-ascii?Q?H3Q8WijQjgRT6ANmvp8slBva?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 603185b6-5f90-4c82-bf5d-08d97861c34b X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 15:59:14.5510 (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: Hxyg/GU48D7uADzJVE7eHEUsjmDGb7+Iv2E3M78zK4q6LCjhK7tMBLFLw+XPKZmkevnCKORZZ28JfL6/FTQEO2vDbOLNCBFqTHDK+hqOZvg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR01MB5513 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: Oqqt7Qh8OJhWGbTxZfwUsthGx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721565; bh=MPDgMe8YyPIjO28nq8kO+G1RPaOZENhmchlU6OIIVpA=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=JqfXLhqXlCInFJ/unMOefvnJJAqEXGMOVek5l88p7ajimmWmOA22bME8HVxWB4wrX3y kkBE1r7Jn25sQGmqsRBz26+XduwneZiB1EHQHit+ibjQN/f76b7jW0hVPubiTTA9bPGI1 wwSIAutFmBgIFEaw3NnaUS4axcHIXEt7cPg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721567592100005 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: Vu Nguyen Reviewed-by: Leif Lindholm --- Platform/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec = | 28 + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec = | 42 ++ Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec = | 46 ++ Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc = | 682 ++++++++++++++++++++ Platform/Ampere/JadePkg/Jade.dsc = | 102 +++ Platform/Ampere/JadePkg/Jade.fdf = | 225 +++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf = | 41 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.inf = | 64 ++ 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 | 63 ++ Silicon/Ampere/AmpereAltraPkg/Library/MmCommunicationLib/MmCommunicationLi= b.inf | 35 + Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.inf = | 32 + Silicon/Ampere/AmpereAltraPkg/Library/PlatformPeiLib/PlatformPeiLib.inf = | 42 ++ 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/PlatformInfoHobGuid.h = | 17 + Silicon/Ampere/AmpereAltraPkg/Include/Library/AmpereCpuLib.h = | 276 ++++++++ Silicon/Ampere/AmpereAltraPkg/Include/Library/MailboxInterfaceLib.h = | 172 +++++ Silicon/Ampere/AmpereAltraPkg/Include/Library/MmCommunicationLib.h = | 19 + Silicon/Ampere/AmpereAltraPkg/Include/Library/NVParamLib.h = | 133 ++++ Silicon/Ampere/AmpereAltraPkg/Include/Library/SystemFirmwareInterfaceLib.h= | 282 ++++++++ Silicon/Ampere/AmpereAltraPkg/Include/Library/TrngLib.h = | 31 + Silicon/Ampere/AmpereAltraPkg/Include/MmLib.h = | 79 +++ Silicon/Ampere/AmpereAltraPkg/Include/NVParamDef.h = | 525 +++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h = | 317 +++++++++ Silicon/Ampere/AmpereAltraPkg/Include/PlatformInfoHob.h = | 182 ++++++ Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/PlatformMemoryMap.h = | 135 ++++ Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.c = | 52 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.c = | 151 +++++ Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.c = | 43 ++ Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLibCommon.c = | 637 ++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAmpereCpuLib.c = | 138 ++++ Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.c = | 169 +++++ Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLibMemory.= c | 257 ++++++++ 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 = | 202 ++++++ Silicon/Ampere/AmpereAltraPkg/Library/PlatformPeiLib/PlatformPeiLib.c = | 40 ++ 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 ++ Platform/Ampere/AmperePlatformPkg/FvRules.fdf.inc = | 176 +++++ Platform/Ampere/JadePkg/JadeBoardSetting.cfg = | 224 +++++++ Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformHelper.S = | 45 ++ Silicon/Ampere/AmpereAltraPkg/Library/RngLib/RngLib.uni = | 13 + 50 files changed, 7084 insertions(+) diff --git a/Platform/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec b/Plat= form/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec new file mode 100644 index 000000000000..7c1d1f84f780 --- /dev/null +++ b/Platform/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec @@ -0,0 +1,28 @@ +## @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 AmperePlatformPkg + PACKAGE_GUID =3D 7A78F1B2-E9BE-4F94-891C-385ED524036C + 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] + +[LibraryClasses] + +[Guids] diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Amp= ere/AmpereAltraPkg/AmpereAltraPkg.dec new file mode 100644 index 000000000000..f0a5bd04ec22 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -0,0 +1,42 @@ +## @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 } } + + ## Include/Guid/PlatformInfoHobGuid.h + gPlatformHobGuid =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..770b4a12bc0b --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -0,0 +1,682 @@ +## @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 + PlatformPeiLib|Silicon/Ampere/AmpereAltraPkg/Library/PlatformPeiLib/Plat= formPeiLib.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 + +!ifdef $(EDK2_SKIP_PEICORE) + 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 +!endif + + 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 + +[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 + 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 + + # + # System Memory Base + # + gArmTokenSpaceGuid.PcdSystemMemoryBase|0x90000000 + + # + # 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] + # + # Fist DRAM Memory region under 4GB address range + # + gArmTokenSpaceGuid.PcdSystemMemorySize|0x70000000 + + 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 + Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/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 + + # + # 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 + MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.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..1e580b5c4904 --- /dev/null +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -0,0 +1,102 @@ +## @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 EDK2_SKIP_PEICORE =3D TRUE + 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..8ed6df381aed --- /dev/null +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -0,0 +1,225 @@ +## @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 +# T.B.D +# + +##########################################################################= ###### +# +# 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 Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/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 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 + + # + # 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 MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.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 Platform/Ampere/AmperePlatformPkg/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..c1bcdbad9392 --- /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] + gPlatformHobGuid + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryIni= tPeim.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInit= Peim.inf new file mode 100644 index 000000000000..8d857b9612b4 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.i= nf @@ -0,0 +1,64 @@ +## @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 MemoryInit + FILE_GUID =3D AC939A4D-D185-463F-A0CE-4120BF0ACF79 + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D InitializeMemory + +[Sources] + MemoryInitPeim.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + ArmLib + ArmPlatformLib + DebugLib + HobLib + MemoryInitPeiLib + PeimEntryPoint + +[Guids] + gEfiMemoryTypeInformationGuid + gPlatformHobGuid + +[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 + +[Pcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize + +[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..da36bac3b3cb --- /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] + gPlatformHobGuid 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..eade773da3cc --- /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 + gPlatformHobGuid 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..b6dc7d2ec04a --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/MemoryInitPeiLib/MemoryInitPeiL= ib.inf @@ -0,0 +1,63 @@ +## @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 + +[Pcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize + +[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..2d506913f733 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.inf @@ -0,0 +1,32 @@ +## @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 + +[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/PlatformPeiLib/PlatformP= eiLib.inf b/Silicon/Ampere/AmpereAltraPkg/Library/PlatformPeiLib/PlatformPe= iLib.inf new file mode 100644 index 000000000000..524b3fe777b8 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/PlatformPeiLib/PlatformPeiLib.i= nf @@ -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 ArmPlatformPeiLib + FILE_GUID =3D 49D37060-70B5-11E0-AA2D-0002A5D5C51B + MODULE_TYPE =3D SEC + VERSION_STRING =3D 0.1 + LIBRARY_CLASS =3D PlatformPeiLib + +[Sources] + PlatformPeiLib.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 + ArmPlatformLib + ArmSmcLib + DebugLib + HobLib + PcdLib + PeiServicesLib + +[FixedPcd] + gArmTokenSpaceGuid.PcdFvBaseAddress + gArmTokenSpaceGuid.PcdFvSize + +[Depex] + TRUE 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/PlatformInfoHobGuid= .h b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/PlatformInfoHobGuid.h new file mode 100644 index 000000000000..5b199bf2b4e8 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/PlatformInfoHobGuid.h @@ -0,0 +1,17 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef PLATFORM_INFO_HOB_GUID_H_ +#define PLATFORM_INFO_HOB_GUID_H_ + +#define PLATFORM_INFO_HOB_GUID \ + { 0x7f73e372, 0x7183, 0x4022, { 0xb3, 0x76, 0x78, 0x30, 0x32, 0x6d, 0x79= , 0xb4 } } + +extern EFI_GUID gPlatformHobGuid; + +#endif /* PLATFORM_INFO_HOB_GUID_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..78d14998978b --- /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 +IsSlaveSocketPresent ( + 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..9bae501b3382 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/MmCommunicationLib.h @@ -0,0 +1,19 @@ +/** @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_ + +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..d0c2a6e3bffa --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/NVParamLib.h @@ -0,0 +1,133 @@ +/** @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 + * + * @param: Parameter ID to retrieve + * @acl_rd: Permission for read operation. See NV_PERM_XXX. + * @val: Pointer to an UINT32 to store the value + * @return: EFI_INVALID_PARAMETER if parameter is invalid + * EFI_NOT_FOUND if value is not set + * EFI_UNSUPPORTED if service unavailable + * EFI_ACCESS_DENIED if permission not allowed + * Otherwise, 0 for success + * + * NOTE: If you need a signed value, cast it. It is expected that the + * caller will carry the correct permission over various call sequences. + * + */ +EFI_STATUS +NVParamGet ( + IN UINT32 Param, + IN UINT16 ACLRd, + OUT UINT32 *Val + ); + +/* + * Set a non-volatile parameter + * + * @param: Parameter ID to set + * @acl_rd: Permission for read operation + * @acl_wr: Permission for write operation + * @val: Unsigned int value to set. + * @return: EFI_INVALID_PARAMETER if parameter is invalid + * EFI_UNSUPPORTED if service unavailable + * EFI_ACCESS_DENIED if permission not allowed + * Otherwise, 0 for success + * + * 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. + * + */ +EFI_STATUS +NVParamSet ( + IN UINT32 Param, + IN UINT16 ACLRd, + IN UINT16 ACLWr, + IN UINT32 Val + ); + +/* + * Clear a non-volatile parameter + * + * @param: Parameter ID to set + * @acl_wr: Permission for write operation + * @return: EFI_INVALID_PARAMETER if parameter is invalid + * EFI_UNSUPPORTED if service unavailable + * EFI_ACCESS_DENIED if permission not allowed + * Otherwise, 0 for success + * + * NOTE: It is expected that the caller will carry the correct permission + * over various call sequences. + * + */ +EFI_STATUS +NVParamClr ( + IN UINT32 Param, + IN UINT16 ACLWr + ); + +/* + * Clear all non-volatile parameters + * + * @return: EFI_UNSUPPORTED if service unavailable + * Otherwise, 0 for success + */ +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/MmLib.h b/Silicon/Ampere= /AmpereAltraPkg/Include/MmLib.h new file mode 100644 index 000000000000..e348b71b5e58 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/MmLib.h @@ -0,0 +1,79 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef MM_LIB_H_ +#define MM_LIB_H_ + +enum { + MM_SPINOR_FUNC_GET_INFO, + MM_SPINOR_FUNC_READ, + MM_SPINOR_FUNC_WRITE, + MM_SPINOR_FUNC_ERASE, + MM_SPINOR_FUNC_GET_NVRAM_INFO, + MM_SPINOR_FUNC_GET_NVRAM2_INFO, + MM_SPINOR_FUNC_GET_FAILSAFE_INFO +}; + +enum { + MM_NVPARAM_FUNC_READ =3D 1, + MM_NVPARAM_FUNC_WRITE, + MM_NVPARAM_FUNC_CLEAR, + MM_NVPARAM_FUNC_CLEAR_ALL +}; + +#define MM_SPINOR_RES_SUCCESS 0xAABBCC00 +#define MM_SPINOR_RES_FAIL 0xAABBCCFF + +#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 + +#define EFI_MM_MAX_PAYLOAD_U64_E 10 +#define EFI_MM_MAX_PAYLOAD_SIZE (EFI_MM_MAX_PAYLOAD_U64_E * sizeof(UINT6= 4)) +#define EFI_MM_MAX_TMP_BUF_SIZE 0x1000000 + +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 + * of the header + */ + UINTN MsgLength; +} EFI_MM_COMM_HEADER_NOPAYLOAD; + +typedef struct { + UINT64 Data[EFI_MM_MAX_PAYLOAD_U64_E]; +} EFI_MM_COMM_PAYLOAD; + +typedef struct { + EFI_MM_COMM_HEADER_NOPAYLOAD EfiMmHdr; + EFI_MM_COMM_PAYLOAD PayLoad; +} EFI_MM_COMM_REQUEST; + +typedef struct { + UINT64 Status; + UINT64 DeviceBase; + UINT64 PageSize; + UINT64 SectorSize; + UINT64 DeviceSize; +} EFI_MM_COMMUNICATE_SPINOR_RES; + +typedef struct { + UINT64 Status; + UINT64 NVBase; + UINT64 NVSize; +} EFI_MM_COMMUNICATE_SPINOR_NVINFO_RES; + +typedef struct { + UINT64 Status; + UINT64 Value; +} EFI_MM_COMMUNICATE_NVPARAM_RES; + +#endif /* MM_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..ceeb0c28c69e --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/NVParamDef.h @@ -0,0 +1,525 @@ +/** @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_ + +typedef enum { + /* + * SoC validation pre-boot non-volatile setting + * + * These parameters will reset to default value on failsafe. + * They are not used in production life cycle. + */ + NV_PREBOOT_PARAM_START =3D 0x000000, + NV_SI_PCP_VDMC =3D (1 * 8) + NV_PREBOOT_PARAM= _START, + NV_SI_FAILSAFE_RETRY =3D (2 * 8) + NV_PREBOOT_PARAM= _START, + NV_SI_DDR_PPR_EN =3D (3 * 8) + NV_PREBOOT_PARAM= _START, + NV_SI_DDR_RESERVED0 =3D (4 * 8) + NV_PREBOOT_PARAM= _START, + NV_SI_DDR_RESERVED1 =3D (5 * 8) + NV_PREBOOT_PARAM= _START, + NV_SI_DDR_LOG_LEVEL =3D (6 * 8) + NV_PREBOOT_PARAM= _START, + NV_SI_DDR_RESERVED2 =3D (7 * 8) + NV_PREBOOT_PARAM= _START, + NV_SI_DDR_RD_DBI_EN =3D (8 * 8) + NV_PREBOOT_PARAM= _START, + NV_SI_DDR_WR_DBI_EN =3D (9 * 8) + NV_PREBOOT_PARAM= _START, + NV_SI_DDR_RETRY_EN =3D (10 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_BANK_HASH_EN =3D (11 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_RESERVED3 =3D (12 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_RCD_PARITY_EN =3D (13 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_WRPATH_CLK_GATE_EN =3D (14 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_IOCAL_MARGIN =3D (15 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_RTR_S_MARGIN =3D (16 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_RTR_L_MARGIN =3D (17 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_RTR_CS_MARGIN =3D (18 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_WTW_S_MARGIN =3D (19 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_WTW_L_MARGIN =3D (20 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_WTW_CS_MARGIN =3D (21 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_RTW_S_MARGIN =3D (22 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_RTW_L_MARGIN =3D (23 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_RTW_CS_MARGIN =3D (24 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_WTR_S_MARGIN =3D (25 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_WTR_L_MARGIN =3D (26 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_WTR_CS_MARGIN =3D (27 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_PARITY_EN =3D (28 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_SLC_DISABLE =3D (29 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_SLC_SIZE =3D (30 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_SLC_SCRUB =3D (31 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_CCIX_DISABLE =3D (32 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_ESM_RESERVED =3D (33 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_PHY_CAL_MODE =3D (34 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_RAS_TEST_EN =3D (35 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_EYE_SCREEN_TEST_EN =3D (36 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_EYE_MASK_RD_MARGIN =3D (37 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_EYE_MASK_WR_MARGIN =3D (38 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_RDODT_ON_MARGIN =3D (39 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_RDODT_OFF_MARGIN =3D (40 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_WRODT_ON_MARGIN =3D (41 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_WRODT_OFF_MARGIN =3D (42 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_SLC_OCM_EN =3D (43 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_ESM_WIDTH =3D (44 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_TM2_DISABLE =3D (45 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_CPUPLL_FREQ_MHZ =3D (46 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_ERR_INJECT_MASK_SK0 =3D (47 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_ERR_INJECT_MASK_SK1 =3D (48 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_CXG_DISABLE_EARLY_COMPACK =3D (49 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_CXG_ENABLE_SAME_ADDR_COMP_ORDER =3D (50 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_TURNAROUND_CONTROL =3D (51 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_HIT_TURNAROUND_CONTROL =3D (52 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_QOS_CLASS_CONTROL =3D (53 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_ESCALATION_CONTROL =3D (54 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_QV_CONTROL_31_00 =3D (55 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_QV_CONTROL_63_32 =3D (56 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_CREDIT_CONTROL =3D (57 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_WRITE_PRIORITY_CONTROL_31_00 =3D (58 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_WRITE_PRIORITY_CONTROL_63_32 =3D (59 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_QUEUE_THRESHOLD_CONTROL_31_00 =3D (60 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_QUEUE_THRESHOLD_CONTROL_63_32 =3D (61 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_ATF_FAILURE_FAILSAFE =3D (62 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_UEFI_FAILURE_FAILSAFE =3D (63 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_STRIPE_DECODE =3D (64 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_DEBUG_CTRL =3D (65 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_CXG_RA_DEVNR_ORD_WFC_DIS =3D (66 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_PHY_DLL_TRACK_UPD_THRESHOLD =3D (67 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_PHY_DLL_TRACK_UPD_THRESHOLD_AC =3D (68 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_PHY_INIT_UPDATE_CONFIG =3D (69 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_PHY_UPDATE_CONTROL =3D (70 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_PROFILE_EN =3D (71 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_PCIE_PHY_SETTING =3D (72 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_PHY_CAL_THRESHOLD =3D (73 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_PHY_CAL_INTERVAL_CNT =3D (74 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_RESERVED =3D (75 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_S0_RHS_RCA_EN =3D (76 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_S1_RHS_RCA_EN =3D (77 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_2P_DPLL =3D (78 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_2P_ALI_CFG =3D (79 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_2P_ALI_CFG_LINK_RETRAIN =3D (80 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_2P_ALI_CFG_CRC =3D (81 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_RT_CONTROL_31_00 =3D (82 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_RT_CONTROL_63_32 =3D (83 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_DDR_TIMEOUT_CONTROL =3D (84 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_CPU_LPI_FREQ_DISABLE =3D (85 * 8) + NV_PREBOOT_PARA= M_START, + NV_SI_CPU_LPI_FREQ_ENERGY_THRSHLD =3D (86 * 8) + NV_PREBOOT_PARA= M_START, + NV_PMPRO_REGION1_LOAD_START =3D NV_SI_SLC_DISABLE, + NV_PMPRO_REGION1_LOAD_END =3D NV_SI_CPU_LPI_FREQ_ENERGY_= THRSHLD, + /* NOTE: Add before NV_PREBOOT_PARAM_MAX and increase its value */ + NV_PREBOOT_PARAM_MAX =3D (86 * 8) + NV_PREBOOT_PARA= M_START, + + /* + * Manufactory non-volatile memory + * + * These parameters will reset to default value on failsafe. + */ + NV_MANU_PARAM_START =3D 0x004000, + NV_SI_DDR_VMARGIN =3D (0 * 8) + NV_MANU_PARAM_ST= ART, + NV_PMPRO_REGION2_LOAD_START =3D NV_SI_DDR_VMARGIN, + NV_SI_SOC_VMARGIN =3D (1 * 8) + NV_MANU_PARAM_ST= ART, + NV_SI_AVS_VMARGIN =3D (2 * 8) + NV_MANU_PARAM_ST= ART, + NV_SI_TPC_TM1_MARGIN =3D (3 * 8) + NV_MANU_PARAM_ST= ART, + NV_SI_TPC_TM2_MARGIN =3D (4 * 8) + NV_MANU_PARAM_ST= ART, + NV_SI_TPC_FREQ_THROTTLE =3D (5 * 8) + NV_MANU_PARAM_ST= ART, + NV_SI_T_LTLM_EN =3D (6 * 8) + NV_MANU_PARAM_ST= ART, + NV_SI_T_LTLM_THRSHLD =3D (7 * 8) + NV_MANU_PARAM_ST= ART, + NV_SI_T_GTLM_THRSHLD =3D (8 * 8) + NV_MANU_PARAM_ST= ART, + NV_SI_P_LM_EN =3D (9 * 8) + NV_MANU_PARAM_ST= ART, + NV_SI_P_LM_THRSHLD =3D (10 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_TPC_OVERTEMP_ISR_DISABLE =3D (11 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_VPP_VMARGIN =3D (12 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PMPRO_FAILURE_FAILSAFE =3D (13 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_FAILSAFE_DISABLE =3D (14 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLIMIT_APM_DS_PERCENTAGE =3D (15 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLIMIT_APM_EP_MS =3D (16 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLIMIT_APM_PM1_PERCENTAGE_TDP =3D (17 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_CPU_LPI_RESERVED0 =3D (18 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_CPU_LPI_RESERVED1 =3D (19 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_CCIX_OPT_CONFIG =3D (20 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_MESH_FREQ_MARGIN =3D (21 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_MESH_TURBO_EN =3D (22 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PWR_HEADROOM_WATT =3D (23 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_EXTRA_PCP_VOLT_MV =3D (24 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_CPU_LPI_HYST_CNT =3D (25 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_DVFS_VOLT_INC_STEP_MV =3D (26 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_DVFS_VOLT_DEC_STEP_MV =3D (27 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLIMIT_APM_TEMP_THLD =3D (28 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLIMIT_APM_EN =3D (29 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_VDM_EN =3D (30 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_VDM_VMARGIN_MV =3D (31 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLT_EN =3D (32 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLT_SOCKET =3D (33 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLT_MCU_MASK =3D (34 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLT_RANK_MASK =3D (35 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLT_SLICE_MASK =3D (36 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLT_BIT_MASK =3D (37 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLT_X_PARAM =3D (38 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLT_Y_PARAM =3D (39 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLT_X_LEFT =3D (40 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLT_X_RIGHT =3D (41 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLT_X_STEP =3D (42 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLT_Y_BOTTOM =3D (43 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLT_Y_TOP =3D (44 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLT_Y_STEP =3D (45 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLT_START_ADDR_LO =3D (46 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLT_START_ADDR_UP =3D (47 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLT_SIZE =3D (48 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLT_THREAD_CNT =3D (49 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLT_SCREEN =3D (50 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_PLT_RSVD =3D (51 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_DVFS_VOLT_CHANGE_BY_STEP_EN =3D (52 * 8) + NV_MANU_PARAM_S= TART, + NS_SI_DVFS_TCAL_F_LIMIT =3D (53 * 8) + NV_MANU_PARAM_S= TART, + NS_SI_DVFS_TCAL_T_LIMIT =3D (54 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_CCIX_DIAG_CTRL1 =3D (55 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_CCIX_DIAG_CTRL2 =3D (56 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_DDR_TCAL_EN =3D (57 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_DDR_TCAL_DIMM_LOW_TEMP_THRESHOLD =3D (58 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_DDR_TCAL_DIMM_HIGH_TEMP_THRESHOLD =3D (59 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_DDR_TCAL_MCU_LOW_TEMP_THRESHOLD =3D (60 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_DDR_TCAL_MCU_HIGH_TEMP_THRESHOLD =3D (61 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_DDR_TCAL_LOW_TEMP_VOLT_OFF_MV =3D (62 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_DDR_TCAL_PERIOD_SEC =3D (63 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_DDR_TCAL_SOC_VOLT_CAP_MV =3D (64 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_ALTRAMAX_ICCMAX_EN =3D (65 * 8) + NV_MANU_PARAM_S= TART, + NV_SI_MESH_TURBO_ACTIVITY_THRESHOLD =3D (66 * 8) + NV_MANU_PARAM_S= TART, + NV_PMPRO_REGION2_LOAD_END =3D NV_SI_MESH_TURBO_ACTIVITY_= THRESHOLD, + /* NOTE: Add before NV_MANU_PARAM_MAX and increase its value */ + NV_MANU_PARAM_MAX =3D (66 * 8) + NV_MANU_PARAM_S= TART, + + /* + * User non-volatile memory + * + * These parameters will reset to default value on failsafe. + */ + NV_USER_PARAM_START =3D 0x008000, + NV_SI_S0_PCP_ACTIVECPM_0_31 =3D (0 * 8) + NV_USER_PARAM_ST= ART, + NV_SI_S0_PCP_ACTIVECPM_32_63 =3D (1 * 8) + NV_USER_PARAM_ST= ART, + NV_SI_S1_PCP_ACTIVECPM_0_31 =3D (2 * 8) + NV_USER_PARAM_ST= ART, + NV_SI_S1_PCP_ACTIVECPM_32_63 =3D (3 * 8) + NV_USER_PARAM_ST= ART, + NV_SI_WDT_BIOS_EXP_MINS =3D (4 * 8) + NV_USER_PARAM_ST= ART, + NV_SI_DDR_CE_RAS_THRESHOLD =3D (5 * 8) + NV_USER_PARAM_ST= ART, + NV_SI_DDR_CE_RAS_INTERVAL =3D (6 * 8) + NV_USER_PARAM_ST= ART, + NV_SI_DDR_SPEED =3D (7 * 8) + NV_USER_PARAM_ST= ART, + NV_SI_DDR_SCRUB_EN =3D (8 * 8) + NV_USER_PARAM_ST= ART, + NV_SI_DDR_ECC_MODE =3D (9 * 8) + NV_USER_PARAM_ST= ART, + NV_SI_S0_RCA_PCI_DEVMAP =3D (10 * 8) + NV_USER_PARAM_S= TART, + NV_SI_S0_RCB_PCI_DEVMAP =3D (11 * 8) + NV_USER_PARAM_S= TART, + NV_SI_S1_RCA_PCI_DEVMAP =3D (12 * 8) + NV_USER_PARAM_S= TART, + NV_SI_S1_RCB_PCI_DEVMAP =3D (13 * 8) + NV_USER_PARAM_S= TART, + NV_SI_DDR_ERRCTRL =3D (14 * 8) + NV_USER_PARAM_S= TART, + NV_SI_DDR_REFRESH_GRANULARITY =3D (15 * 8) + NV_USER_PARAM_S= TART, + NV_SI_SUBNUMA_MODE =3D (16 * 8) + NV_USER_PARAM_S= TART, + NV_SI_ERRATUM_1542419_WA =3D (17 * 8) + NV_USER_PARAM_S= TART, + NV_SI_NEAR_ATOMIC_DISABLE =3D (18 * 8) + NV_USER_PARAM_S= TART, + NV_SI_DDR_SLAVE_32BIT_MEM_EN =3D (19 * 8) + NV_USER_PARAM_S= TART, + NV_SI_CPUECTLR_EL1_0_31 =3D (20 * 8) + NV_USER_PARAM_S= TART, + NV_SI_CPUECTLR_EL1_32_63 =3D (21 * 8) + NV_USER_PARAM_S= TART, + NV_SI_HARDWARE_EINJ =3D (22 * 8) + NV_USER_PARAM_S= TART, + NV_SI_2P_CE_RAS_THRESHOLD =3D (23 * 8) + NV_USER_PARAM_S= TART, + NV_SI_2P_CE_RAS_INTERVAL =3D (24 * 8) + NV_USER_PARAM_S= TART, + NV_SI_RAS_BERT_ENABLED =3D (25 * 8) + NV_USER_PARAM_S= TART, + NV_SI_HNF_AUX_CTL_0_31 =3D (26 * 8) + NV_USER_PARAM_S= TART, + NV_SI_HNF_AUX_CTL_32_63 =3D (27 * 8) + NV_USER_PARAM_S= TART, + NV_SI_CPM_CE_RAS_THRESHOLD =3D (28 * 8) + NV_USER_PARAM_S= TART, + NV_SI_CPM_CE_RAS_INTERVAL =3D (29 * 8) + NV_USER_PARAM_S= TART, + NV_SI_HNF_AUX_CTL_0_31_WR_EN_MASK =3D (30 * 8) + NV_USER_PARAM_S= TART, + NV_SI_HNF_AUX_CTL_32_63_WR_EN_MASK =3D (31 * 8) + NV_USER_PARAM_S= TART, + NV_SI_DDR_WR_BACK_EN =3D (32 * 8) + NV_USER_PARAM_S= TART, + NV_SI_CPUECTLR_EL1_0_31_WR_EN_MASK =3D (33 * 8) + NV_USER_PARAM_S= TART, + NV_SI_CPUECTLR_EL1_32_63_WR_EN_MASK =3D (34 * 8) + NV_USER_PARAM_S= TART, + NV_SI_LINK_ERR_THRESHOLD =3D (35 * 8) + NV_USER_PARAM_S= TART, + NV_SI_SEC_WDT_BIOS_EXP_MINS =3D (36 * 8) + NV_USER_PARAM_S= TART, + NV_SI_NVDIMM_MODE =3D (37 * 8) + NV_USER_PARAM_S= TART, + NV_SI_RAS_SDEI_ENABLED =3D (38 * 8) + NV_USER_PARAM_S= TART, + NV_SI_NVDIMM_PROV_MASK_S0 =3D (39 * 8) + NV_USER_PARAM_S= TART, + NV_SI_NVDIMM_PROV_MASK_S1 =3D (40 * 8) + NV_USER_PARAM_S= TART, + NV_SI_DDR_ZQCS_EN =3D (41 * 8) + NV_USER_PARAM_S= TART, + NV_SI_DDR_CRC_MODE =3D (42 * 8) + NV_USER_PARAM_S= TART, + NV_SI_CXG_RA_AUX_CTL_0_31 =3D (43 * 8) + NV_USER_PARAM_S= TART, + NV_SI_CXG_RA_AUX_CTL_32_63 =3D (44 * 8) + NV_USER_PARAM_S= TART, + NV_SI_CXG_RA_AUX_CTL_0_31_WR_EN_MASK =3D (45 * 8) + NV_USER_PARAM_S= TART, + NV_SI_CXG_RA_AUX_CTL_32_63_WR_EN_MASK =3D (46 * 8) + NV_USER_PARAM_S= TART, + NV_SI_CXLA_AUX_CTL_0_31 =3D (47 * 8) + NV_USER_PARAM_S= TART, + NV_SI_CXLA_AUX_CTL_32_63 =3D (48 * 8) + NV_USER_PARAM_S= TART, + NV_SI_CXLA_AUX_CTL_0_31_WR_EN_MASK =3D (49 * 8) + NV_USER_PARAM_S= TART, + NV_SI_CXLA_AUX_CTL_32_63_WR_EN_MASK =3D (50 * 8) + NV_USER_PARAM_S= TART, + NV_SI_DDR_LOW_POWER_CFG =3D (51 * 8) + NV_USER_PARAM_S= TART, + NV_SI_ALERT_DIMM_SHUTDOWN_EN =3D (52 * 8) + NV_USER_PARAM_S= TART, + NV_SI_DFS_EN =3D (53 * 8) + NV_USER_PARAM_S= TART, + NV_SI_RAS_PCIE_AER_FW_FIRST =3D (54 * 8) + NV_USER_PARAM_S= TART, + NV_SI_RAS_DRAM_EINJ_NOTRIGGER =3D (55 * 8) + NV_USER_PARAM_S= TART, + NV_SI_RAS_AEST_PROC_EN =3D (56 * 8) + NV_USER_PARAM_S= TART, + NV_SI_MESH_S0_CXG_RC_STRONG_ORDERING_EN =3D (57 * 8) + NV_USER_PARAM_S= TART, + NV_SI_MESH_S1_CXG_RC_STRONG_ORDERING_EN =3D (58 * 8) + NV_USER_PARAM_S= TART, + NV_SI_2P_RESERVED0 =3D (59 * 8) + NV_USER_PARAM_S= TART, + NV_SI_2P_RESERVED1 =3D (60 * 8) + NV_USER_PARAM_S= TART, + NV_SI_2P_RESERVED2 =3D (61 * 8) + NV_USER_PARAM_S= TART, + NV_SI_HCR_EL2_CTL_LOW =3D (62 * 8) + NV_USER_PARAM_S= TART, + NV_SI_HCR_EL2_CTL_HIGH =3D (63 * 8) + NV_USER_PARAM_S= TART, + NV_SI_ESM_SPEED =3D (64 * 8) + NV_USER_PARAM_S= TART, + /* NOTE: Add before NV_USER_PARAM_MAX and increase its value */ + NV_USER_PARAM_MAX =3D (64 * 8) + NV_USER_PARAM_S= TART, + NV_PMPRO_REGION3_LOAD_START =3D NV_USER_PARAM_START, + NV_PMPRO_REGION3_LOAD_END =3D 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. + */ + NV_BOARD_PARAM_START =3D 0x00C000, + NV_SI_RO_BOARD_VENDOR =3D (0 * 8) + NV_BOARD_PARAM_S= TART, /* Default: 0x0000CD3A - Follow BMC FRU format */ + NV_PMPRO_REGION4_LOAD_START =3D NV_SI_RO_BOARD_VENDOR, + NV_SI_RO_BOARD_TYPE =3D (1 * 8) + NV_BOARD_PARAM_S= TART, /* Default: 0x00000000 - Follow BMC FRU format */ + NV_SI_RO_BOARD_REV =3D (2 * 8) + NV_BOARD_PARAM_S= TART, /* Default: 0x00000000 Follow BMC FRU format */ + NV_SI_RO_BOARD_CFG =3D (3 * 8) + NV_BOARD_PARAM_S= TART, /* Default: 0x00000000 Follow BMC FRU format */ + NV_SI_RO_BOARD_S0_DIMM_AVAIL =3D (4 * 8) + NV_BOARD_PARAM_S= TART, /* Default: 0x0000FFFF */ + NV_SI_RO_BOARD_S1_DIMM_AVAIL =3D (5 * 8) + NV_BOARD_PARAM_S= TART, /* Default: 0x0000FFFF */ + NV_SI_RO_BOARD_SPI0CS0_FREQ_KHZ =3D (6 * 8) + NV_BOARD_PARAM_S= TART, /* Default: 33000 */ + NV_SI_RO_BOARD_SPI0CS1_FREQ_KHZ =3D (7 * 8) + NV_BOARD_PARAM_S= TART, /* Default: 33000 */ + NV_SI_RO_BOARD_SPI1CS0_FREQ_KHZ =3D (8 * 8) + NV_BOARD_PARAM_S= TART, /* Default: 10000 */ + NV_SI_RO_BOARD_SPI1CS1_FREQ_KHZ =3D (9 * 8) + NV_BOARD_PARAM_S= TART, /* Default: 10000 */ + NV_SI_RO_BOARD_TPM_LOC =3D (10 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_I2C0_FREQ_KHZ =3D (11 * 8) + NV_BOARD_PARAM_= START, /* Default: 400 */ + NV_SI_RO_BOARD_I2C1_FREQ_KHZ =3D (12 * 8) + NV_BOARD_PARAM_= START, /* Default: 400 */ + NV_SI_RO_BOARD_I2C2_10_FREQ_KHZ =3D (13 * 8) + NV_BOARD_PARAM_= START, /* Default: 400 */ + NV_SI_RO_BOARD_I2C3_FREQ_KHZ =3D (14 * 8) + NV_BOARD_PARAM_= START, /* Default: 400 */ + NV_SI_RO_BOARD_I2C9_FREQ_KHZ =3D (15 * 8) + NV_BOARD_PARAM_= START, /* Default: 400 */ + NV_SI_RO_BOARD_2P_CFG =3D (16 * 8) + NV_BOARD_PARAM_= START, /* Default: 0xFFFFFF01 */ + NV_SI_RO_BOARD_S0_RCA0_CFG =3D (17 * 8) + NV_BOARD_PARAM_= START, + NV_SI_RO_BOARD_S0_RCA1_CFG =3D (18 * 8) + NV_BOARD_PARAM_= START, + NV_SI_RO_BOARD_S0_RCA2_CFG =3D (19 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00000004 */ + NV_SI_RO_BOARD_S0_RCA3_CFG =3D (20 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00000004 */ + NV_SI_RO_BOARD_S0_RCB0_LO_CFG =3D (21 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S0_RCB0_HI_CFG =3D (22 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S0_RCB1_LO_CFG =3D (23 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S0_RCB1_HI_CFG =3D (24 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S0_RCB2_LO_CFG =3D (25 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S0_RCB2_HI_CFG =3D (26 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00000003 */ + NV_SI_RO_BOARD_S0_RCB3_LO_CFG =3D (27 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00000003 */ + NV_SI_RO_BOARD_S0_RCB3_HI_CFG =3D (28 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S1_RCA0_CFG =3D (29 * 8) + NV_BOARD_PARAM_= START, + NV_SI_RO_BOARD_S1_RCA1_CFG =3D (30 * 8) + NV_BOARD_PARAM_= START, + NV_SI_RO_BOARD_S1_RCA2_CFG =3D (31 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x02020202 */ + NV_SI_RO_BOARD_S1_RCA3_CFG =3D (32 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00030003 */ + NV_SI_RO_BOARD_S1_RCB0_LO_CFG =3D (33 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00000003 */ + NV_SI_RO_BOARD_S1_RCB0_HI_CFG =3D (34 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S1_RCB1_LO_CFG =3D (35 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S1_RCB1_HI_CFG =3D (36 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00000003 */ + NV_SI_RO_BOARD_S1_RCB2_LO_CFG =3D (37 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S1_RCB2_HI_CFG =3D (38 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S1_RCB3_LO_CFG =3D (39 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_S1_RCB3_HI_CFG =3D (40 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00020002 */ + NV_SI_RO_BOARD_T_LTLM_DELTA_P0 =3D (41 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00000001 */ + NV_SI_RO_BOARD_T_LTLM_DELTA_P1 =3D (42 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00000002 */ + NV_SI_RO_BOARD_T_LTLM_DELTA_P2 =3D (43 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00000003 */ + NV_SI_RO_BOARD_T_LTLM_DELTA_P3 =3D (44 * 8) + NV_BOARD_PARAM_= START, /* Default: 0x00000004 */ + NV_SI_RO_BOARD_T_LTLM_DELTA_M1 =3D (45 * 8) + NV_BOARD_PARAM_= START, /* Default: 0xFFFFFFFF */ + NV_SI_RO_BOARD_T_LTLM_DELTA_M2 =3D (46 * 8) + NV_BOARD_PARAM_= START, /* Default: 0xFFFFFFFE */ + NV_SI_RO_BOARD_T_LTLM_DELTA_M3 =3D (47 * 8) + NV_BOARD_PARAM_= START, /* Default: 0xFFFFFFFD */ + NV_SI_RO_BOARD_P_LM_PID_P =3D (48 * 8) + NV_BOARD_PARAM_= START, + NV_SI_RO_BOARD_P_LM_PID_I =3D (49 * 8) + NV_BOARD_PARAM_= START, + NV_SI_RO_BOARD_P_LM_PID_I_L_THOLD =3D (50 * 8) + NV_BOARD_PARAM_= START, + NV_SI_RO_BOARD_P_LM_PID_I_H_THOLD =3D (51 * 8) + NV_BOARD_PARAM_= START, + NV_SI_RO_BOARD_P_LM_PID_D =3D (52 * 8) + NV_BOARD_PARAM_= START, + NV_SI_RO_BOARD_P_LM_EXP_SMOOTH_CONST =3D (53 * 8) + NV_BOARD_PARAM_= START, + /* + * NV_SI_RO_BOARD_TPM_ALG_ID: 0=3DDefault to SHA256, 1=3DSHA1, 2=3DSHA256 + * Any other value will lead to default digest. + */ + NV_SI_RO_BOARD_TPM_ALG_ID =3D (54 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x00000002 */ + NV_SI_RO_BOARD_DDR_SPEED_GRADE =3D (55 * 8) + NV_BOAR= D_PARAM_START, /* Default: 3200 */ + NV_SI_RO_BOARD_DDR_S0_RTT_WR =3D (56 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x20020000 */ + NV_SI_RO_BOARD_DDR_S1_RTT_WR =3D (57 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x20020000 */ + NV_SI_RO_BOARD_DDR_S0_RTT_NOM =3D (58 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x31060177 */ + NV_SI_RO_BOARD_DDR_S1_RTT_NOM =3D (59 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x31060177 */ + NV_SI_RO_BOARD_DDR_S0_RTT_PARK =3D (60 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x30060070 */ + NV_SI_RO_BOARD_DDR_S1_RTT_PARK =3D (61 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x30060070 */ + NV_SI_RO_BOARD_DDR_CS0_RDODT_MASK_1DPC =3D (62 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x000000 */ + NV_SI_RO_BOARD_DDR_CS1_RDODT_MASK_1DPC =3D (63 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x000000 */ + NV_SI_RO_BOARD_DDR_CS2_RDODT_MASK_1DPC =3D (64 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x000000 */ + NV_SI_RO_BOARD_DDR_CS3_RDODT_MASK_1DPC =3D (65 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x000000 */ + NV_SI_RO_BOARD_DDR_CS0_RDODT_MASK_2DPC =3D (66 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x044C0CCC */ + NV_SI_RO_BOARD_DDR_CS1_RDODT_MASK_2DPC =3D (67 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x084C0CCC */ + NV_SI_RO_BOARD_DDR_CS2_RDODT_MASK_2DPC =3D (68 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x04130333 */ + NV_SI_RO_BOARD_DDR_CS3_RDODT_MASK_2DPC =3D (69 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x08130333 */ + NV_SI_RO_BOARD_DDR_CS0_WRODT_MASK_1DPC =3D (70 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x01130333 */ + NV_SI_RO_BOARD_DDR_CS1_WRODT_MASK_1DPC =3D (71 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x02230333 */ + NV_SI_RO_BOARD_DDR_CS2_WRODT_MASK_1DPC =3D (72 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x01430333 */ + NV_SI_RO_BOARD_DDR_CS3_WRODT_MASK_1DPC =3D (73 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x02830333 */ + NV_SI_RO_BOARD_DDR_CS0_WRODT_MASK_2DPC =3D (74 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x055EDEED */ + NV_SI_RO_BOARD_DDR_CS1_WRODT_MASK_2DPC =3D (75 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x0A5DEDDE */ + NV_SI_RO_BOARD_DDR_CS2_WRODT_MASK_2DPC =3D (76 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x055B7BB7 */ + NV_SI_RO_BOARD_DDR_CS3_WRODT_MASK_2DPC =3D (77 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x0A57B77B */ + NV_SI_RO_BOARD_DDR_PHY_TERM_DQ_CTRL_1DPC =3D (78 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x5 */ + NV_SI_RO_BOARD_DDR_PHY_TERM_DQ_VAL_1DPC =3D (79 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x90DD90 */ + NV_SI_RO_BOARD_DDR_PHY_TERM_DQS_CTRL_1DPC =3D (80 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x5 */ + NV_SI_RO_BOARD_DDR_PHY_TERM_DQS_VAL_1DPC =3D (81 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x90DD90 */ + NV_SI_RO_BOARD_DDR_PHY_TERM_DQ_CTRL_2DPC =3D (82 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x5 */ + NV_SI_RO_BOARD_DDR_PHY_TERM_DQ_VAL_2DPC =3D (83 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x90DD90 */ + NV_SI_RO_BOARD_DDR_PHY_TERM_DQS_CTRL_2DPC =3D (84 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x5 */ + NV_SI_RO_BOARD_DDR_PHY_TERM_DQS_VAL_2DPC =3D (85 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x90DD90 */ + NV_SI_RO_BOARD_DDR_PHY_VREFDQ_RANGE_VAL_1DPC =3D (86 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x24 */ + NV_SI_RO_BOARD_DDR_DRAM_VREFDQ_RANGE_VAL_1DPC =3D (87 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x001A001A */ + NV_SI_RO_BOARD_DDR_PHY_VREFDQ_RANGE_VAL_2DPC =3D (88 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x50 */ + NV_SI_RO_BOARD_DDR_DRAM_VREFDQ_RANGE_VAL_2DPC =3D (89 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x00240020 */ + NV_SI_RO_BOARD_DDR_CLK_WRDQ_DLY_DEFAULT =3D (90 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x02800280 */ + NV_SI_RO_BOARD_DDR_RDDQS_DQ_DLY_DEFAULT =3D (91 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x90909090 */ + NV_SI_RO_BOARD_DDR_WRDQS_SHIFT_DEFAULT =3D (92 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_DDR_ADCMD_DLY_DEFAULT =3D (93 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x00C000C0 */ + NV_SI_RO_BOARD_DDR_CLK_WRDQ_DLY_ADJ =3D (94 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_DDR_RDDQS_DQ_DLY_ADJ =3D (95 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_DDR_PHY_VREF_ADJ =3D (96 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_DDR_DRAM_VREF_ADJ =3D (97 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_DDR_WR_PREAMBLE_CYCLE =3D (98 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x02010201 */ + NV_SI_RO_BOARD_DDR_ADCMD_2T_MODE =3D (99 * 8) + NV_BOAR= D_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_I2C_VRD_CONFIG_INFO =3D (100 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_DDR_PHY_FEATURE_CTRL =3D (101 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_BMC_HANDSHAKE_SPI_ACCESS =3D (102 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x01050106 */ + NV_SI_RO_BOARD_DIMM_TEMP_THRESHOLD =3D (103 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x5F4 */ + NV_SI_RO_BOARD_DIMM_SPD_COMPARE_DISABLE =3D (104 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x0 */ + NV_SI_RO_BOARD_S0_PCIE_CLK_CFG =3D (105 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S0_RCA4_CFG =3D (106 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x02020202 */ + NV_SI_RO_BOARD_S0_RCA5_CFG =3D (107 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x02020202 */ + NV_SI_RO_BOARD_S0_RCA6_CFG =3D (108 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x02020202 */ + NV_SI_RO_BOARD_S0_RCA7_CFG =3D (109 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x02020003 */ + NV_SI_RO_BOARD_S0_RCA0_TXRX_G3PRESET =3D (110 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S0_RCA1_TXRX_G3PRESET =3D (111 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S0_RCA2_TXRX_G3PRESET =3D (112 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S0_RCA3_TXRX_G3PRESET =3D (113 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S0_RCB0A_TXRX_G3PRESET =3D (114 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S0_RCB0B_TXRX_G3PRESET =3D (115 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S0_RCB1A_TXRX_G3PRESET =3D (116 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S0_RCB1B_TXRX_G3PRESET =3D (117 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S0_RCB2A_TXRX_G3PRESET =3D (118 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S0_RCB2B_TXRX_G3PRESET =3D (119 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S0_RCB3A_TXRX_G3PRESET =3D (120 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S0_RCB3B_TXRX_G3PRESET =3D (121 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S0_RCA4_TXRX_G3PRESET =3D (122 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S0_RCA5_TXRX_G3PRESET =3D (123 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S0_RCA6_TXRX_G3PRESET =3D (124 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S0_RCA7_TXRX_G3PRESET =3D (125 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S0_RCA0_TXRX_G4PRESET =3D (126 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCA1_TXRX_G4PRESET =3D (127 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCA2_TXRX_G4PRESET =3D (128 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCA3_TXRX_G4PRESET =3D (129 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCB0A_TXRX_G4PRESET =3D (130 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCB0B_TXRX_G4PRESET =3D (131 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCB1A_TXRX_G4PRESET =3D (132 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCB1B_TXRX_G4PRESET =3D (133 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCB2A_TXRX_G4PRESET =3D (134 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCB2B_TXRX_G4PRESET =3D (135 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCB3A_TXRX_G4PRESET =3D (136 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCB3B_TXRX_G4PRESET =3D (137 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCA4_TXRX_G4PRESET =3D (138 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCA5_TXRX_G4PRESET =3D (139 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCA6_TXRX_G4PRESET =3D (140 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S0_RCA7_TXRX_G4PRESET =3D (141 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_PCIE_CLK_CFG =3D (142 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S1_RCA4_CFG =3D (143 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x02020202 */ + NV_SI_RO_BOARD_S1_RCA5_CFG =3D (144 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x02020202 */ + NV_SI_RO_BOARD_S1_RCA6_CFG =3D (145 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x02020202 */ + NV_SI_RO_BOARD_S1_RCA7_CFG =3D (146 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x02020003 */ + NV_SI_RO_BOARD_S1_RCA2_TXRX_G3PRESET =3D (147 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S1_RCA3_TXRX_G3PRESET =3D (148 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S1_RCB0A_TXRX_G3PRESET =3D (149 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S1_RCB0B_TXRX_G3PRESET =3D (150 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S1_RCB1A_TXRX_G3PRESET =3D (151 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S1_RCB1B_TXRX_G3PRESET =3D (152 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S1_RCB2A_TXRX_G3PRESET =3D (153 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S1_RCB2B_TXRX_G3PRESET =3D (154 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S1_RCB3A_TXRX_G3PRESET =3D (155 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S1_RCB3B_TXRX_G3PRESET =3D (156 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S1_RCA4_TXRX_G3PRESET =3D (157 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S1_RCA5_TXRX_G3PRESET =3D (158 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S1_RCA6_TXRX_G3PRESET =3D (159 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S1_RCA7_TXRX_G3PRESET =3D (160 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_S1_RCA2_TXRX_G4PRESET =3D (161 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCA3_TXRX_G4PRESET =3D (162 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCB0A_TXRX_G4PRESET =3D (163 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCB0B_TXRX_G4PRESET =3D (164 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCB1A_TXRX_G4PRESET =3D (165 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCB1B_TXRX_G4PRESET =3D (166 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCB2A_TXRX_G4PRESET =3D (167 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCB2B_TXRX_G4PRESET =3D (168 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCB3A_TXRX_G4PRESET =3D (169 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCB3B_TXRX_G4PRESET =3D (170 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCA4_TXRX_G4PRESET =3D (171 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCA5_TXRX_G4PRESET =3D (172 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCA6_TXRX_G4PRESET =3D (173 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_S1_RCA7_TXRX_G4PRESET =3D (174 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x57575757 */ + NV_SI_RO_BOARD_2P_CE_MASK_THRESHOLD =3D (175 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x00000003 */ + NV_SI_RO_BOARD_2P_CE_MASK_INTERVAL =3D (176 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x000001A4 */ + NV_SI_RO_BOARD_SX_PHY_CFG_SETTING =3D (177 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_DDR_PHY_DC_CLK =3D (178 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x00018000 */ + NV_SI_RO_BOARD_DDR_PHY_DC_DATA =3D (179 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x80018000 */ + NV_SI_RO_BOARD_SX_RCA0_TXRX_20GPRESET =3D (180 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_SX_RCA1_TXRX_20GPRESET =3D (181 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_SX_RCA2_TXRX_20GPRESET =3D (182 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_SX_RCA3_TXRX_20GPRESET =3D (183 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_SX_RCA0_TXRX_25GPRESET =3D (184 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_SX_RCA1_TXRX_25GPRESET =3D (185 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_SX_RCA2_TXRX_25GPRESET =3D (186 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_SX_RCA3_TXRX_25GPRESET =3D (187 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_DDR_2X_REFRESH_TEMP_THRESHOLD =3D (188 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x00550055 */ + NV_SI_RO_BOARD_PCP_VRD_VOUT_WAIT_US =3D (189 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x00000064 */ + NV_SI_RO_BOARD_PCP_VRD_VOUT_RESOLUTION_MV =3D (190 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x00000005 */ + NV_SI_RO_BOARD_DVFS_VOLT_READ_BACK_EN =3D (191 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x00000001 */ + NV_SI_RO_BOARD_DVFS_VOLT_READ_BACK_TIME =3D (192 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x00000002 */ + NV_SI_RO_BOARD_DVFS_VOUT_20MV_RAMP_TIME_US =3D (193 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x00000005 */ + NV_SI_RO_BOARD_PCIE_AER_FW_FIRST =3D (194 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_RTC_GPI_LOCK_BYPASS =3D (195 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_TPM_DISABLE =3D (196 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_MESH_S0_CXG_RC_STRONG_ORDERING_EN =3D (197 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_MESH_S1_CXG_RC_STRONG_ORDERING_EN =3D (198 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_GPIO_SW_WATCHDOG_EN =3D (199 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_PCIE_HP_DISABLE =3D (200 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_I2C_VRD_VOUT_FORMAT =3D (201 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_I2C_VRD_SMBUS_CMD_FLAGS =3D (202 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_CUST_SPM_LOCATION =3D (203 * 8) + NV_BOA= RD_PARAM_START, + NV_SI_RO_BOARD_RAS_DDR_CE_WINDOW =3D (204 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x00000000 */ + NV_SI_RO_BOARD_RAS_DDR_CE_TH1 =3D (205 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x000001F4 */ + NV_SI_RO_BOARD_RAS_DDR_CE_TH2 =3D (206 * 8) + NV_BOA= RD_PARAM_START, /* Default: 0x00001388 */ + NV_PMPRO_REGION4_LOAD_END =3D NV_SI_RO_BOARD_RAS= _DDR_CE_TH2, + /* NOTE: Add before NV_BOARD_PARAM_MAX and increase its value */ + NV_BOARD_PARAM_MAX =3D (206 * 8) + NV_BOA= RD_PARAM_START, +} 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..66286bfff145 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h @@ -0,0 +1,317 @@ +/** @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) + +// +// 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 + +// +// 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 + +// +// Maximum number of memory supported. +// +#define PLATFORM_MAX_MEMORY_REGION 4 + +// +// The Array of Soc Gpio Base Address +// +#define GPIO_DWAPB_BASE_ADDR 0x1000026f0000, 0x1000026e0000, = 0x1000027b0000, 0x1000026d0000, 0x5000026f0000, 0x5000026e0000, 0x5000027b0= 000, 0x5000026d0000 + +// +// The Array of Soc Gpi Base Address +// +#define GPI_DWAPB_BASE_ADDR 0x1000026d0000, 0x5000026d0000 + +// +// Number of Pins Per Each Contoller +// +#define GPIO_DWAPB_PINS_PER_CONTROLLER 8 + +// +// Number of Pins Each Socket +// +#define GPIO_DWAPB_PINS_PER_SOCKET 32 + +// +// The maximum number of I2C bus +// +#define MAX_PLATFORM_I2C_BUS_NUM 2 + +// +// The base address of DW I2C +// +#define PLATFORM_I2C_REGISTER_BASE 0x1000026B0000ULL, 0x10000275000= 0ULL + +// +// Offset of failsafe testing feature +// +#define NV_UEFI_FAILURE_FAILSAFE_OFFSET 0x1F8 + +// +// Maximum number of memory controller supports NVDIMM-N per socket +// +#define PLATFORM_NVDIMM_MCU_MAX_PER_SK 2 + +// +// Maximum number of NVDIMM-N per memory controller +// +#define PLATFORM_NVDIMM_NUM_MAX_PER_MCU 1 + +// +// Maximum number of NVDIMM region per socket +// +#define PLATFORM_NVDIMM_REGION_MAX_PER_SK 2 + +// +// Socket 0 base address of NVDIMM non-hashed region 0 +// +#define PLATFORM_NVDIMM_SK0_NHASHED_REGION0 0x0B0000000000ULL + +// +// Socket 0 base address of NVDIMM non-hashed region 1 +// +#define PLATFORM_NVDIMM_SK0_NHASHED_REGION1 0x0F0000000000ULL + +// +// Socket 1 base address of NVDIMM non-hashed region 0 +// +#define PLATFORM_NVDIMM_SK1_NHASHED_REGION0 0x430000000000ULL + +// +// Socket 1 base address of NVDIMM non-hashed region 1 +// +#define PLATFORM_NVDIMM_SK1_NHASHED_REGION1 0x470000000000ULL + +// +// DIMM ID of NVDIMM-N device 1 +// +#define PLATFORM_NVDIMM_NVD1_DIMM_ID 6 + +// +// DIMM ID of NVDIMM-N device 2 +// +#define PLATFORM_NVDIMM_NVD2_DIMM_ID 14 + +// +// DIMM ID of NVDIMM-N device 3 +// +#define PLATFORM_NVDIMM_NVD3_DIMM_ID 22 + +// +// DIMM ID of NVDIMM-N device 4 +// +#define PLATFORM_NVDIMM_NVD4_DIMM_ID 30 + +// +// NFIT device handle of NVDIMM-N device 1 +// +#define PLATFORM_NVDIMM_NVD1_DEVICE_HANDLE 0x0330 + +// +// NFIT device handle of NVDIMM-N device 2 +// +#define PLATFORM_NVDIMM_NVD2_DEVICE_HANDLE 0x0770 + +// +// NFIT device handle of NVDIMM-N device 3 +// +#define PLATFORM_NVDIMM_NVD3_DEVICE_HANDLE 0x1330 + +// +// NFIT device handle of NVDIMM-N device 4 +// +#define PLATFORM_NVDIMM_NVD4_DEVICE_HANDLE 0x1770 + +// +// Interleave ways of non-hashed NVDIMM-N +// +#define PLATFORM_NVDIMM_NHASHED_INTERLEAVE_WAYS 1 + +// +// Interleave ways of hashed NVDIMM-N +// +#define PLATFORM_NVDIMM_HASHED_INTERLEAVE_WAYS 2 + +// +// Region offset of hashed NVDIMM-N +// +#define PLATFORM_NVDIMM_HASHED_REGION_OFFSET 512 + +// +// The base address of master socket GIC redistributor registers +// +#define GICR_MASTER_BASE_REG 0x100100140000 + +// +// The base address of GIC distributor registers +// +#define GICD_BASE_REG 0x100100000000 + +// +// The base address of slave socket GIC redistributor registers +// +#define GICR_SLAVE_BASE_REG 0x500100140000 + +// +// The base address of slave socket GIC distributor registers +// +#define GICD_SLAVE_BASE_REG 0x500100000000 + +// +// CSR Address base for slave socket +// +#define SLAVE_SOCKET_BASE_ADDRESS_OFFSET 0x400000000000 + +// +// 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 + +// +// SMpro EFUSE Shadow register +// +#define SMPRO_EFUSE_SHADOW0 (FixedPcdGet64 (PcdSmproEfuseShadow0)) + +// +// 2P Configuration Register +// +#define CFG2P_OFFSET 0x200 + +// +// Slave socket present +// +#define SLAVE_PRESENT_N BIT1 + +// +// Max number for AC01 PCIE Root Complexes per socket +// +#define AC01_MAX_RCS_PER_SOCKET 8 + +// +// Max number for AC01 PCIE Root Complexes +// +#define AC01_MAX_PCIE_ROOT_COMPLEX 16 + +// +// Max number for AC01 PCIE Root Bridge under each Root Complex +// +#define AC01_MAX_PCIE_ROOT_BRIDGE 1 + +// +// The base address of {TCU, CSR, MMCONFIG} Registers +// +#define AC01_PCIE_REGISTER_BASE 0x33FFE0000000, 0x37FFE0000000, 0x3BFF= E0000000, 0x3FFFE0000000, 0x23FFE0000000, 0x27FFE0000000, 0x2BFFE0000000, 0= x2FFFE0000000, 0x73FFE0000000, 0x77FFE0000000, 0x7BFFE0000000, 0x7FFFE00000= 00, 0x63FFE0000000, 0x67FFE0000000, 0x6BFFE0000000, 0x6FFFE0000000 + +// +// The base address of MMIO Registers +// +#define AC01_PCIE_MMIO_BASE 0x300000000000, 0x340000000000, 0x3800= 00000000, 0x3C0000000000, 0x200000000000, 0x240000000000, 0x280000000000, 0= x2C0000000000, 0x700000000000, 0x740000000000, 0x780000000000, 0x7C00000000= 00, 0x600000000000, 0x640000000000, 0x680000000000, 0x6C0000000000 + +// +// The base address of MMIO32 Registers +// +#define AC01_PCIE_MMIO32_BASE 0x000020000000, 0x000028000000, 0x0000= 30000000, 0x000038000000, 0x000001000000, 0x000008000000, 0x000010000000, 0= x000018000000, 0x000060000000, 0x000068000000, 0x000070000000, 0x0000780000= 00, 0x000040000000, 0x000048000000, 0x000050000000, 0x000058000000 + +// +// The base address of MMIO32 Registers +// +#define AC01_PCIE_MMIO32_BASE_1P 0x000040000000, 0x000050000000, 0x0000= 60000000, 0x000070000000, 0x000001000000, 0x000010000000, 0x000020000000, 0= x000030000000, 0, 0, 0, 0, 0, 0, 0, 0 + +// +// DSDT RCA2 PCIe Meme32 Attribute +// +#define AC01_PCIE_RCA2_QMEM 0x0000000000000000, 0x0000000060000000= , 0x000000006FFFFFFF, 0x0000000000000000, 0x0000000010000000 + +// +// DSDT RCA3 PCIe Meme32 Attribute +// +#define AC01_PCIE_RCA3_QMEM 0x0000000000000000, 0x0000000070000000= , 0x000000007FFFFFFF, 0x0000000000000000, 0x0000000010000000 + +// +// DSDT RCB0 PCIe Meme32 Attribute +// +#define AC01_PCIE_RCB0_QMEM 0x0000000000000000, 0x0000000001000000= , 0x000000000FFFFFFF, 0x0000000000000000, 0x000000000F000000 + +// +// DSDT RCB1 PCIe Meme32 Attribute +// +#define AC01_PCIE_RCB1_QMEM 0x0000000000000000, 0x0000000010000000= , 0x000000001FFFFFFF, 0x0000000000000000, 0x0000000010000000 + +// +// DSDT RCB2 PCIe Meme32 Attribute +// +#define AC01_PCIE_RCB2_QMEM 0x0000000000000000, 0x0000000020000000= , 0x000000002FFFFFFF, 0x0000000000000000, 0x0000000010000000 + +// +// DSDT RCB3 PCIe Meme32 Attribute +// +#define AC01_PCIE_RCB3_QMEM 0x0000000000000000, 0x0000000030000000= , 0x000000003FFFFFFF, 0x0000000000000000, 0x0000000010000000 + +// +// The start of TBU PMU IRQ array. +// +#define AC01_SMMU_TBU_PMU_IRQS 224, 230, 236, 242, 160, 170, 180, 190= , 544, 550, 556, 562, 480, 490, 500, 510 + +// +// The start of TCU PMU IRQ array +// +#define AC01_SMMU_TCU_PMU_IRQS 256, 257, 258, 259, 260, 261, 262, 263= , 576, 577, 578, 579, 580, 581, 582, 583 + +#endif /* PLATFORM_AC01_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/PlatformInfoHob.h b/Sili= con/Ampere/AmpereAltraPkg/Include/PlatformInfoHob.h new file mode 100644 index 000000000000..f8abcb92a17c --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/PlatformInfoHob.h @@ -0,0 +1,182 @@ +/** @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 + +/* DIMM type */ +enum { + UDIMM, + RDIMM, + SODIMM, + RSODIMM, + LRDIMM, + NVRDIMM +}; + +/* DIMM status */ +enum { + DIMM_NOT_INSTALLED =3D 0, + DIMM_INSTALLED_OPERATIONAL, /* installed and operational */ + DIMM_INSTALLED_NONOPERATIONAL, /* installed and non-operational */ + DIMM_INSTALLED_FAILED /* 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 { + PLATFORM_ALGORITHM_SHA1 =3D 1, + PLATFORM_ALGORITHM_SHA256 +} 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/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/Drivers/ATFHobPei/ATFHobPeim.c b= /Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.c new file mode 100644 index 000000000000..04def9fa2e42 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.c @@ -0,0 +1,52 @@ +/** @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 + +VOID +BuildPlatformInformationHob ( + VOID + ) +{ + VOID *Hob; + + /* The ATF HOB handoff base is at PcdSystemMemoryBase */ + Hob =3D GetNextGuidHob ( + &gPlatformHobGuid, + (CONST VOID *)FixedPcdGet64 (PcdSystemMemoryBase) + ); + if (Hob !=3D NULL) { + BuildGuidDataHob ( + &gPlatformHobGuid, + 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/Drivers/MemoryInitPeim/MemoryIni= tPeim.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPe= im.c new file mode 100644 index 000000000000..4098b4664bf8 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.c @@ -0,0 +1,151 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +/* + * The protocols, PPI and GUID defintions for this module + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +EFI_STATUS +EFIAPI +MemoryPeim ( + IN EFI_PHYSICAL_ADDRESS UefiMemoryBase, + IN UINT64 UefiMemorySize + ); + +VOID +BuildMemoryTypeInformationHob ( + VOID + ) +{ + EFI_MEMORY_TYPE_INFORMATION Info[10]; + + Info[0].Type =3D EfiACPIReclaimMemory; + Info[0].NumberOfPages =3D PcdGet32 (PcdMemoryTypeEfiACPIReclaimMemory); + Info[1].Type =3D EfiACPIMemoryNVS; + Info[1].NumberOfPages =3D PcdGet32 (PcdMemoryTypeEfiACPIMemoryNVS); + Info[2].Type =3D EfiReservedMemoryType; + Info[2].NumberOfPages =3D PcdGet32 (PcdMemoryTypeEfiReservedMemoryType); + Info[3].Type =3D EfiRuntimeServicesData; + Info[3].NumberOfPages =3D PcdGet32 (PcdMemoryTypeEfiRuntimeServicesData); + Info[4].Type =3D EfiRuntimeServicesCode; + Info[4].NumberOfPages =3D PcdGet32 (PcdMemoryTypeEfiRuntimeServicesCode); + Info[5].Type =3D EfiBootServicesCode; + Info[5].NumberOfPages =3D PcdGet32 (PcdMemoryTypeEfiBootServicesCode); + Info[6].Type =3D EfiBootServicesData; + Info[6].NumberOfPages =3D PcdGet32 (PcdMemoryTypeEfiBootServicesData); + Info[7].Type =3D EfiLoaderCode; + Info[7].NumberOfPages =3D PcdGet32 (PcdMemoryTypeEfiLoaderCode); + Info[8].Type =3D EfiLoaderData; + Info[8].NumberOfPages =3D PcdGet32 (PcdMemoryTypeEfiLoaderData); + + /* Terminator for the list */ + Info[9].Type =3D EfiMaxMemoryType; + Info[9].NumberOfPages =3D 0; + + BuildGuidDataHob (&gEfiMemoryTypeInformationGuid, &Info, sizeof (Info)); +} + +EFI_STATUS +EFIAPI +InitializeMemory ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + EFI_STATUS Status; + UINTN SystemMemoryBase; + UINTN SystemMemoryTop; + UINTN FdBase; + UINTN FdTop; + UINTN UefiMemoryBase; + UINTN Index; + VOID *Hob; + PLATFORM_INFO_HOB *PlatformHob; + + DEBUG ((DEBUG_INFO, "Memory Init PEIM Loaded\n")); + + Hob =3D GetFirstGuidHob (&gPlatformHobGuid); + ASSERT (Hob !=3D NULL); + if (Hob =3D=3D NULL) { + return EFI_DEVICE_ERROR; + } + + PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + + /* Find system memory top of the first node */ + SystemMemoryTop =3D 0; + for (Index =3D 0; Index < PlatformHob->DramInfo.NumRegion; Index++) { + if (SystemMemoryTop <=3D PlatformHob->DramInfo.Base[Index] && + PlatformHob->DramInfo.Node[Index] =3D=3D 0 && + (PlatformHob->DramInfo.Base[Index] + + PlatformHob->DramInfo.Size[Index] - 1) <=3D 0xFFFFFFFF) + { + SystemMemoryTop =3D PlatformHob->DramInfo.Base[Index] + PlatformHob-= >DramInfo.Size[Index]; + } + } + + DEBUG ((DEBUG_INFO, "PEIM memory configuration.\n")); + + SystemMemoryBase =3D (UINTN)FixedPcdGet64 (PcdSystemMemoryBase); + FdBase =3D (UINTN)PcdGet64 (PcdFdBaseAddress); + FdTop =3D FdBase + (UINTN)PcdGet32 (PcdFdSize); + + // In case the firmware has been shadowed in the System Memory + if ((FdBase >=3D SystemMemoryBase) && (FdTop <=3D SystemMemoryTop)) { + // + // Check if there is enough space between the top of the system memory= and the top of the + // firmware to place the UEFI memory (for PEI & DXE phases) + // + if (SystemMemoryTop - FdTop >=3D FixedPcdGet32 (PcdSystemMemoryUefiReg= ionSize)) { + UefiMemoryBase =3D SystemMemoryTop - FixedPcdGet32 (PcdSystemMemoryU= efiRegionSize); + } else { + // Check there is enough space for the UEFI memory + ASSERT (SystemMemoryBase + FixedPcdGet32 (PcdSystemMemoryUefiRegionS= ize) <=3D FdBase); + + UefiMemoryBase =3D FdBase - FixedPcdGet32 (PcdSystemMemoryUefiRegion= Size); + } + } else { + // Check the Firmware does not overlapped with the system memory + ASSERT ((FdBase < SystemMemoryBase) || (FdBase >=3D SystemMemoryTop)); + ASSERT ((FdTop <=3D SystemMemoryBase) || (FdTop > SystemMemoryTop)); + + UefiMemoryBase =3D SystemMemoryTop - FixedPcdGet32 (PcdSystemMemoryUef= iRegionSize); + } + + Status =3D PeiServicesInstallPeiMemory ( + UefiMemoryBase, + FixedPcdGet32 (PcdSystemMemoryUefiRegionSize) + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Error: Failed to install Pei Memory\n")); + } else { + DEBUG ((DEBUG_INFO, "Info: Installed Pei Memory\n")); + } + ASSERT_EFI_ERROR (Status); + + // Initialize MMU and Memory HOBs (Resource Descriptor HOBs) + Status =3D MemoryPeim (UefiMemoryBase, FixedPcdGet32 (PcdSystemMemoryUef= iRegionSize)); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Error: Failed to initialize MMU and Memory HOBS\= n")); + } + ASSERT_EFI_ERROR (Status); + + return Status; +} 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..6f5a604180dd --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/AmpereCpuLib.c @@ -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 +#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 ( + &gPlatformHobGuid, + (CONST VOID *)FixedPcdGet64 (PcdSystemMemoryBase) + ); + if (mPlatformInfoHob =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "%a: Failed to get gPlatformHobGuid!\n", __FUNC= TION__)); + 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..a2aeb3fc725c --- /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 +IsSlaveSocketPresent ( + 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..fb8b7161a072 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeAmpereCpuLi= b.c @@ -0,0 +1,138 @@ +/** @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 + +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 ( + &gPlatformHobGuid, + (CONST VOID *)FixedPcdGet64 (PcdSystemMemoryBase) + ); + if (Hob =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "%a: Failed to get gPlatformHobGuid!\n", __FUNCTI= ON__)); + 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..8c1eb93f00fd --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLib.c @@ -0,0 +1,169 @@ +/** @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 + +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..4a03ab4319af --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/ArmPlatformLib/ArmPlatformLibMe= mory.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 "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 (&gPlatformHobGuid); + 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; + Count++; + } + + /* SPM MM NS Buffer for MmCommunicateDxe */ + VirtualMemoryTable[++Index].PhysicalBase =3D PcdGet64 (PcdMmBufferBase); + VirtualMemoryTable[Index].VirtualBase =3D PcdGet64 (PcdMmBufferBase); + VirtualMemoryTable[Index].Length =3D PcdGet64 (PcdMmBufferSize); + VirtualMemoryTable[Index].Attributes =3D DDR_ATTRIBUTES_CACHED; + + /* 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..81506f00512c --- /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..794a0a77c25f --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/NVParamLib/NVParamLib.c @@ -0,0 +1,202 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include + +EFI_MM_COMM_REQUEST mCommBuffer; + +STATIC VOID +UefiMmCreateNVParamReq ( + IN VOID *Data, + IN UINT64 Size + ) +{ + CopyGuid (&mCommBuffer.EfiMmHdr.HeaderGuid, &gNVParamMmGuid); + mCommBuffer.EfiMmHdr.MsgLength =3D Size; + + if (Size !=3D 0) { + ASSERT (Data); + ASSERT (Size <=3D EFI_MM_MAX_PAYLOAD_SIZE); + + CopyMem (mCommBuffer.PayLoad.Data, Data, Size); + } +} + +EFI_STATUS +NVParamGet ( + IN UINT32 Param, + IN UINT16 ACLRd, + OUT UINT32 *Val + ) +{ + EFI_STATUS Status; + EFI_MM_COMMUNICATE_NVPARAM_RES *MmNVParamRes; + UINT64 MmData[5]; + UINTN Size; + + MmData[0] =3D MM_NVPARAM_FUNC_READ; + MmData[1] =3D Param; + MmData[2] =3D (UINT64)ACLRd; + + UefiMmCreateNVParamReq ((VOID *)&MmData, sizeof (MmData)); + + Size =3D sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status =3D MmCommunicationCommunicate ( + (VOID *)&mCommBuffer, + &Size + ); + if (EFI_ERROR (Status)) { + return Status; + } + + MmNVParamRes =3D (EFI_MM_COMMUNICATE_NVPARAM_RES *)&mCommBuffer.PayLoad; + 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; + } +} + +EFI_STATUS +NVParamSet ( + IN UINT32 Param, + IN UINT16 ACLRd, + IN UINT16 ACLWr, + IN UINT32 Val + ) +{ + EFI_STATUS Status; + EFI_MM_COMMUNICATE_NVPARAM_RES *MmNVParamRes; + UINT64 MmData[5]; + UINTN Size; + + 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; + + UefiMmCreateNVParamReq ((VOID *)&MmData, sizeof (MmData)); + Size =3D sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status =3D MmCommunicationCommunicate ( + (VOID *)&mCommBuffer, + &Size + ); + if (EFI_ERROR (Status)) { + return Status; + } + + MmNVParamRes =3D (EFI_MM_COMMUNICATE_NVPARAM_RES *)&mCommBuffer.PayLoad; + 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; + } +} + +EFI_STATUS +NVParamClr ( + IN UINT32 Param, + IN UINT16 ACLWr + ) +{ + EFI_STATUS Status; + EFI_MM_COMMUNICATE_NVPARAM_RES *MmNVParamRes; + UINT64 MmData[5]; + UINTN Size; + + MmData[0] =3D MM_NVPARAM_FUNC_CLEAR; + MmData[1] =3D Param; + MmData[2] =3D 0; + MmData[3] =3D (UINT64)ACLWr; + + UefiMmCreateNVParamReq ((VOID *)&MmData, sizeof (MmData)); + Size =3D sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status =3D MmCommunicationCommunicate ( + (VOID *)&mCommBuffer, + &Size + ); + if (EFI_ERROR (Status)) { + return Status; + } + + MmNVParamRes =3D (EFI_MM_COMMUNICATE_NVPARAM_RES *)&mCommBuffer.PayLoad; + 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; + } +} + +EFI_STATUS +NVParamClrAll ( + VOID + ) +{ + EFI_STATUS Status; + EFI_MM_COMMUNICATE_NVPARAM_RES *MmNVParamRes; + UINT64 MmData[5]; + UINTN Size; + + MmData[0] =3D MM_NVPARAM_FUNC_CLEAR_ALL; + + UefiMmCreateNVParamReq ((VOID *)&MmData, sizeof (MmData)); + Size =3D sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status =3D MmCommunicationCommunicate ( + (VOID *)&mCommBuffer, + &Size + ); + if (EFI_ERROR (Status)) { + return Status; + } + + MmNVParamRes =3D (EFI_MM_COMMUNICATE_NVPARAM_RES *)&mCommBuffer.PayLoad; + 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/PlatformPeiLib/PlatformP= eiLib.c b/Silicon/Ampere/AmpereAltraPkg/Library/PlatformPeiLib/PlatformPeiL= ib.c new file mode 100644 index 000000000000..3ae3ecd60719 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/PlatformPeiLib/PlatformPeiLib.c @@ -0,0 +1,40 @@ +/** @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 + +EFI_STATUS +EFIAPI +PlatformPeim ( + VOID + ) +{ + UINT64 FvMainBase; + UINT32 FvMainSize; + + // Build FV_MAIN Hand-off block (HOB) to let DXE IPL pick up correctly + FvMainBase =3D FixedPcdGet64 (PcdFvBaseAddress); + FvMainSize =3D FixedPcdGet32 (PcdFvSize); + ASSERT (FvMainSize !=3D 0); + + BuildFvHob (FvMainBase, FvMainSize); + + 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/Platform/Ampere/AmperePlatformPkg/FvRules.fdf.inc b/Platform/A= mpere/AmperePlatformPkg/FvRules.fdf.inc new file mode 100644 index 000000000000..027b3cf6dee4 --- /dev/null +++ b/Platform/Ampere/AmperePlatformPkg/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) + } diff --git a/Platform/Ampere/JadePkg/JadeBoardSetting.cfg b/Platform/Ampere= /JadePkg/JadeBoardSetting.cfg new file mode 100644 index 000000000000..3761930d0263 --- /dev/null +++ b/Platform/Ampere/JadePkg/JadeBoardSetting.cfg @@ -0,0 +1,224 @@ +## +# Mt. Jade Board Setting +# +# This is a collection of board and hardware configurations +# for an Altra-based ARM64 platform. It is stored in the persistent storag= e. +# +# Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +# +# Name, offset (hex), value +# value can be hex or decimal +# + +NV_SI_RO_BOARD_VENDOR, 0x0000, 0x0000CD3A +NV_SI_RO_BOARD_TYPE, 0x0008, 0x00000000 +NV_SI_RO_BOARD_REV, 0x0010, 0x00000000 +NV_SI_RO_BOARD_CFG, 0x0018, 0x00000000 +NV_SI_RO_BOARD_S0_DIMM_AVAIL, 0x0020, 0x0000FFFF +NV_SI_RO_BOARD_S1_DIMM_AVAIL, 0x0028, 0x0000FFFF +NV_SI_RO_BOARD_SPI0CS0_FREQ_KHZ, 0x0030, 0x000080E8 +NV_SI_RO_BOARD_SPI0CS1_FREQ_KHZ, 0x0038, 0x000080E8 +NV_SI_RO_BOARD_SPI1CS0_FREQ_KHZ, 0x0040, 0x00002710 +NV_SI_RO_BOARD_SPI1CS1_FREQ_KHZ, 0x0048, 0x00002710 +NV_SI_RO_BOARD_TPM_LOC, 0x0050, 0x00000000 +NV_SI_RO_BOARD_I2C0_FREQ_KHZ, 0x0058, 0x00000190 +NV_SI_RO_BOARD_I2C1_FREQ_KHZ, 0x0060, 0x00000190 +NV_SI_RO_BOARD_I2C2_10_FREQ_KHZ, 0x0068, 0x00000190 +NV_SI_RO_BOARD_I2C3_FREQ_KHZ, 0x0070, 0x00000190 +NV_SI_RO_BOARD_I2C9_FREQ_KHZ, 0x0078, 0x00000190 +NV_SI_RO_BOARD_2P_CFG, 0x0080, 0xFFFFFF01 +NV_SI_RO_BOARD_S0_RCA0_CFG, 0x0088, 0x00000000 +NV_SI_RO_BOARD_S0_RCA1_CFG, 0x0090, 0x00000000 +NV_SI_RO_BOARD_S0_RCA2_CFG, 0x0098, 0x00000004 +NV_SI_RO_BOARD_S0_RCA3_CFG, 0x00A0, 0x00000004 +NV_SI_RO_BOARD_S0_RCB0_LO_CFG, 0x00A8, 0x00020002 +NV_SI_RO_BOARD_S0_RCB0_HI_CFG, 0x00B0, 0x00020002 +NV_SI_RO_BOARD_S0_RCB1_LO_CFG, 0x00B8, 0x00020002 +NV_SI_RO_BOARD_S0_RCB1_HI_CFG, 0x00C0, 0x00020002 +NV_SI_RO_BOARD_S0_RCB2_LO_CFG, 0x00C8, 0x00020002 +NV_SI_RO_BOARD_S0_RCB2_HI_CFG, 0x00D0, 0x00000003 +NV_SI_RO_BOARD_S0_RCB3_LO_CFG, 0x00D8, 0x00000003 +NV_SI_RO_BOARD_S0_RCB3_HI_CFG, 0x00E0, 0x00020002 +NV_SI_RO_BOARD_S1_RCA0_CFG, 0x00E8, 0x00000000 +NV_SI_RO_BOARD_S1_RCA1_CFG, 0x00F0, 0x00000000 +NV_SI_RO_BOARD_S1_RCA2_CFG, 0x00F8, 0x02020202 +NV_SI_RO_BOARD_S1_RCA3_CFG, 0x0100, 0x00030003 +NV_SI_RO_BOARD_S1_RCB0_LO_CFG, 0x0108, 0x00000003 +NV_SI_RO_BOARD_S1_RCB0_HI_CFG, 0x0110, 0x00020002 +NV_SI_RO_BOARD_S1_RCB1_LO_CFG, 0x0118, 0x00020002 +NV_SI_RO_BOARD_S1_RCB1_HI_CFG, 0x0120, 0x00000003 +NV_SI_RO_BOARD_S1_RCB2_LO_CFG, 0x0128, 0x00020002 +NV_SI_RO_BOARD_S1_RCB2_HI_CFG, 0x0130, 0x00020002 +NV_SI_RO_BOARD_S1_RCB3_LO_CFG, 0x0138, 0x00020002 +NV_SI_RO_BOARD_S1_RCB3_HI_CFG, 0x0140, 0x00020002 +NV_SI_RO_BOARD_T_LTLM_DELTA_P0, 0x0148, 0x00000001 +NV_SI_RO_BOARD_T_LTLM_DELTA_P1, 0x0150, 0x00000002 +NV_SI_RO_BOARD_T_LTLM_DELTA_P2, 0x0158, 0x00000003 +NV_SI_RO_BOARD_T_LTLM_DELTA_P3, 0x0160, 0x00000004 +NV_SI_RO_BOARD_T_LTLM_DELTA_M1, 0x0168, 0xFFFFFFFF +NV_SI_RO_BOARD_T_LTLM_DELTA_M2, 0x0170, 0xFFFFFFFE +NV_SI_RO_BOARD_T_LTLM_DELTA_M3, 0x0178, 0xFFFFFFFD +NV_SI_RO_BOARD_P_LM_PID_P, 0x0180, 0x00000000 +NV_SI_RO_BOARD_P_LM_PID_I, 0x0188, 0x00000000 +NV_SI_RO_BOARD_P_LM_PID_I_L_THOLD, 0x0190, 0x00000000 +NV_SI_RO_BOARD_P_LM_PID_I_H_THOLD, 0x0198, 0x00000000 +NV_SI_RO_BOARD_P_LM_PID_D, 0x01A0, 0x00000000 +NV_SI_RO_BOARD_P_LM_EXP_SMOOTH_CONST, 0x01A8, 0x00000000 +NV_SI_RO_BOARD_TPM_ALG_ID, 0x01B0, 0x00000002 +NV_SI_RO_BOARD_DDR_SPEED_GRADE, 0x01B8, 0x00000C80 +NV_SI_RO_BOARD_DDR_S0_RTT_WR, 0x01C0, 0x20020000 +NV_SI_RO_BOARD_DDR_S1_RTT_WR, 0x01C8, 0x20020000 +NV_SI_RO_BOARD_DDR_S0_RTT_NOM, 0x01D0, 0x31060177 +NV_SI_RO_BOARD_DDR_S1_RTT_NOM, 0x01D8, 0x31060177 +NV_SI_RO_BOARD_DDR_S0_RTT_PARK, 0x01E0, 0x30060070 +NV_SI_RO_BOARD_DDR_S1_RTT_PARK, 0x01E8, 0x30060070 +NV_SI_RO_BOARD_DDR_CS0_RDODT_MASK_1DPC, 0x01F0, 0x00000000 +NV_SI_RO_BOARD_DDR_CS1_RDODT_MASK_1DPC, 0x01F8, 0x00000000 +NV_SI_RO_BOARD_DDR_CS2_RDODT_MASK_1DPC, 0x0200, 0x00000000 +NV_SI_RO_BOARD_DDR_CS3_RDODT_MASK_1DPC, 0x0208, 0x00000000 +NV_SI_RO_BOARD_DDR_CS0_RDODT_MASK_2DPC, 0x0210, 0x044C0CCC +NV_SI_RO_BOARD_DDR_CS1_RDODT_MASK_2DPC, 0x0218, 0x084C0CCC +NV_SI_RO_BOARD_DDR_CS2_RDODT_MASK_2DPC, 0x0220, 0x04130333 +NV_SI_RO_BOARD_DDR_CS3_RDODT_MASK_2DPC, 0x0228, 0x08130333 +NV_SI_RO_BOARD_DDR_CS0_WRODT_MASK_1DPC, 0x0230, 0x01130333 +NV_SI_RO_BOARD_DDR_CS1_WRODT_MASK_1DPC, 0x0238, 0x02230333 +NV_SI_RO_BOARD_DDR_CS2_WRODT_MASK_1DPC, 0x0240, 0x01430333 +NV_SI_RO_BOARD_DDR_CS3_WRODT_MASK_1DPC, 0x0248, 0x02830333 +NV_SI_RO_BOARD_DDR_CS0_WRODT_MASK_2DPC, 0x0250, 0x055EDEED +NV_SI_RO_BOARD_DDR_CS1_WRODT_MASK_2DPC, 0x0258, 0x0A5DEDDE +NV_SI_RO_BOARD_DDR_CS2_WRODT_MASK_2DPC, 0x0260, 0x055B7BB7 +NV_SI_RO_BOARD_DDR_CS3_WRODT_MASK_2DPC, 0x0268, 0x0A57B77B +NV_SI_RO_BOARD_DDR_PHY_TERM_DQ_CTRL_1DPC, 0x0270, 0x00000005 +NV_SI_RO_BOARD_DDR_PHY_TERM_DQ_VAL_1DPC, 0x0278, 0x0090DD90 +NV_SI_RO_BOARD_DDR_PHY_TERM_DQS_CTRL_1DPC, 0x0280, 0x00000005 +NV_SI_RO_BOARD_DDR_PHY_TERM_DQS_VAL_1DPC, 0x0288, 0x0090DD90 +NV_SI_RO_BOARD_DDR_PHY_TERM_DQ_CTRL_2DPC, 0x0290, 0x00000005 +NV_SI_RO_BOARD_DDR_PHY_TERM_DQ_VAL_2DPC, 0x0298, 0x0090DD90 +NV_SI_RO_BOARD_DDR_PHY_TERM_DQS_CTRL_2DPC, 0x02A0, 0x00000005 +NV_SI_RO_BOARD_DDR_PHY_TERM_DQS_VAL_2DPC, 0x02A8, 0x0090DD90 +NV_SI_RO_BOARD_DDR_PHY_VREFDQ_RANGE_VAL_1DPC, 0x02B0, 0x00000024 +NV_SI_RO_BOARD_DDR_DRAM_VREFDQ_RANGE_VAL_1DPC, 0x02B8, 0x001A001A +NV_SI_RO_BOARD_DDR_PHY_VREFDQ_RANGE_VAL_2DPC, 0x02C0, 0x00000050 +NV_SI_RO_BOARD_DDR_DRAM_VREFDQ_RANGE_VAL_2DPC, 0x02C8, 0x00240020 +NV_SI_RO_BOARD_DDR_CLK_WRDQ_DLY_DEFAULT, 0x02D0, 0x02800280 +NV_SI_RO_BOARD_DDR_RDDQS_DQ_DLY_DEFAULT, 0x02D8, 0x90909090 +NV_SI_RO_BOARD_DDR_WRDQS_SHIFT_DEFAULT, 0x02E0, 0x00000000 +NV_SI_RO_BOARD_DDR_ADCMD_DLY_DEFAULT, 0x02E8, 0x00C000C0 +NV_SI_RO_BOARD_DDR_CLK_WRDQ_DLY_ADJ, 0x02F0, 0x00000000 +NV_SI_RO_BOARD_DDR_RDDQS_DQ_DLY_ADJ, 0x02F8, 0x00000000 +NV_SI_RO_BOARD_DDR_PHY_VREF_ADJ, 0x0300, 0x00000000 +NV_SI_RO_BOARD_DDR_DRAM_VREF_ADJ, 0x0308, 0x00000000 +NV_SI_RO_BOARD_DDR_WR_PREAMBLE_CYCLE, 0x0310, 0x02010201 +NV_SI_RO_BOARD_DDR_ADCMD_2T_MODE, 0x0318, 0x00000000 +NV_SI_RO_BOARD_I2C_VRD_CONFIG_INFO, 0x0320, 0x00000000 +NV_SI_RO_BOARD_DDR_PHY_FEATURE_CTRL, 0x0328, 0x00000000 +NV_SI_RO_BOARD_BMC_HANDSHAKE_SPI_ACCESS, 0x0330, 0x01050106 +NV_SI_RO_BOARD_DIMM_TEMP_THRESHOLD, 0x0338, 0x000005F4 +NV_SI_RO_BOARD_DIMM_SPD_COMPARE_DISABLE, 0x0340, 0x00000000 +NV_SI_RO_BOARD_S0_PCIE_CLK_CFG, 0x0348, 0x00000000 +NV_SI_RO_BOARD_S0_RCA4_CFG, 0x0350, 0x02020202 +NV_SI_RO_BOARD_S0_RCA5_CFG, 0x0358, 0x02020202 +NV_SI_RO_BOARD_S0_RCA6_CFG, 0x0360, 0x02020202 +NV_SI_RO_BOARD_S0_RCA7_CFG, 0x0368, 0x02020003 +NV_SI_RO_BOARD_S0_RCA0_TXRX_G3PRESET, 0x0370, 0x00000000 +NV_SI_RO_BOARD_S0_RCA1_TXRX_G3PRESET, 0x0378, 0x00000000 +NV_SI_RO_BOARD_S0_RCA2_TXRX_G3PRESET, 0x0380, 0x00000000 +NV_SI_RO_BOARD_S0_RCA3_TXRX_G3PRESET, 0x0388, 0x00000000 +NV_SI_RO_BOARD_S0_RCB0A_TXRX_G3PRESET, 0x0390, 0x00000000 +NV_SI_RO_BOARD_S0_RCB0B_TXRX_G3PRESET, 0x0398, 0x00000000 +NV_SI_RO_BOARD_S0_RCB1A_TXRX_G3PRESET, 0x03A0, 0x00000000 +NV_SI_RO_BOARD_S0_RCB1B_TXRX_G3PRESET, 0x03A8, 0x00000000 +NV_SI_RO_BOARD_S0_RCB2A_TXRX_G3PRESET, 0x03B0, 0x00000000 +NV_SI_RO_BOARD_S0_RCB2B_TXRX_G3PRESET, 0x03B8, 0x00000000 +NV_SI_RO_BOARD_S0_RCB3A_TXRX_G3PRESET, 0x03C0, 0x00000000 +NV_SI_RO_BOARD_S0_RCB3B_TXRX_G3PRESET, 0x03C8, 0x00000000 +NV_SI_RO_BOARD_S0_RCA4_TXRX_G3PRESET, 0x03D0, 0x00000000 +NV_SI_RO_BOARD_S0_RCA5_TXRX_G3PRESET, 0x03D8, 0x00000000 +NV_SI_RO_BOARD_S0_RCA6_TXRX_G3PRESET, 0x03E0, 0x00000000 +NV_SI_RO_BOARD_S0_RCA7_TXRX_G3PRESET, 0x03E8, 0x00000000 +NV_SI_RO_BOARD_S0_RCA0_TXRX_G4PRESET, 0x03F0, 0x57575757 +NV_SI_RO_BOARD_S0_RCA1_TXRX_G4PRESET, 0x03F8, 0x57575757 +NV_SI_RO_BOARD_S0_RCA2_TXRX_G4PRESET, 0x0400, 0x57575757 +NV_SI_RO_BOARD_S0_RCA3_TXRX_G4PRESET, 0x0408, 0x57575757 +NV_SI_RO_BOARD_S0_RCB0A_TXRX_G4PRESET, 0x0410, 0x57575757 +NV_SI_RO_BOARD_S0_RCB0B_TXRX_G4PRESET, 0x0418, 0x57575757 +NV_SI_RO_BOARD_S0_RCB1A_TXRX_G4PRESET, 0x0420, 0x57575757 +NV_SI_RO_BOARD_S0_RCB1B_TXRX_G4PRESET, 0x0428, 0x57575757 +NV_SI_RO_BOARD_S0_RCB2A_TXRX_G4PRESET, 0x0430, 0x57575757 +NV_SI_RO_BOARD_S0_RCB2B_TXRX_G4PRESET, 0x0438, 0x57575757 +NV_SI_RO_BOARD_S0_RCB3A_TXRX_G4PRESET, 0x0440, 0x57575757 +NV_SI_RO_BOARD_S0_RCB3B_TXRX_G4PRESET, 0x0448, 0x57575757 +NV_SI_RO_BOARD_S0_RCA4_TXRX_G4PRESET, 0x0450, 0x57575757 +NV_SI_RO_BOARD_S0_RCA5_TXRX_G4PRESET, 0x0458, 0x57575757 +NV_SI_RO_BOARD_S0_RCA6_TXRX_G4PRESET, 0x0460, 0x57575757 +NV_SI_RO_BOARD_S0_RCA7_TXRX_G4PRESET, 0x0468, 0x57575757 +NV_SI_RO_BOARD_S1_PCIE_CLK_CFG, 0x0470, 0x00000000 +NV_SI_RO_BOARD_S1_RCA4_CFG, 0x0478, 0x02020202 +NV_SI_RO_BOARD_S1_RCA5_CFG, 0x0480, 0x02020202 +NV_SI_RO_BOARD_S1_RCA6_CFG, 0x0488, 0x02020202 +NV_SI_RO_BOARD_S1_RCA7_CFG, 0x0490, 0x02020003 +NV_SI_RO_BOARD_S1_RCA2_TXRX_G3PRESET, 0x0498, 0x00000000 +NV_SI_RO_BOARD_S1_RCA3_TXRX_G3PRESET, 0x04A0, 0x00000000 +NV_SI_RO_BOARD_S1_RCB0A_TXRX_G3PRESET, 0x04A8, 0x00000000 +NV_SI_RO_BOARD_S1_RCB0B_TXRX_G3PRESET, 0x04B0, 0x00000000 +NV_SI_RO_BOARD_S1_RCB1A_TXRX_G3PRESET, 0x04B8, 0x00000000 +NV_SI_RO_BOARD_S1_RCB1B_TXRX_G3PRESET, 0x04C0, 0x00000000 +NV_SI_RO_BOARD_S1_RCB2A_TXRX_G3PRESET, 0x04C8, 0x00000000 +NV_SI_RO_BOARD_S1_RCB2B_TXRX_G3PRESET, 0x04D0, 0x00000000 +NV_SI_RO_BOARD_S1_RCB3A_TXRX_G3PRESET, 0x04D8, 0x00000000 +NV_SI_RO_BOARD_S1_RCB3B_TXRX_G3PRESET, 0x04E0, 0x00000000 +NV_SI_RO_BOARD_S1_RCA4_TXRX_G3PRESET, 0x04E8, 0x00000000 +NV_SI_RO_BOARD_S1_RCA5_TXRX_G3PRESET, 0x04F0, 0x00000000 +NV_SI_RO_BOARD_S1_RCA6_TXRX_G3PRESET, 0x04F8, 0x00000000 +NV_SI_RO_BOARD_S1_RCA7_TXRX_G3PRESET, 0x0500, 0x00000000 +NV_SI_RO_BOARD_S1_RCA2_TXRX_G4PRESET, 0x0508, 0x57575757 +NV_SI_RO_BOARD_S1_RCA3_TXRX_G4PRESET, 0x0510, 0x57575757 +NV_SI_RO_BOARD_S1_RCB0A_TXRX_G4PRESET, 0x0518, 0x57575757 +NV_SI_RO_BOARD_S1_RCB0B_TXRX_G4PRESET, 0x0520, 0x57575757 +NV_SI_RO_BOARD_S1_RCB1A_TXRX_G4PRESET, 0x0528, 0x57575757 +NV_SI_RO_BOARD_S1_RCB1B_TXRX_G4PRESET, 0x0530, 0x57575757 +NV_SI_RO_BOARD_S1_RCB2A_TXRX_G4PRESET, 0x0538, 0x57575757 +NV_SI_RO_BOARD_S1_RCB2B_TXRX_G4PRESET, 0x0540, 0x57575757 +NV_SI_RO_BOARD_S1_RCB3A_TXRX_G4PRESET, 0x0548, 0x57575757 +NV_SI_RO_BOARD_S1_RCB3B_TXRX_G4PRESET, 0x0550, 0x57575757 +NV_SI_RO_BOARD_S1_RCA4_TXRX_G4PRESET, 0x0558, 0x57575757 +NV_SI_RO_BOARD_S1_RCA5_TXRX_G4PRESET, 0x0560, 0x57575757 +NV_SI_RO_BOARD_S1_RCA6_TXRX_G4PRESET, 0x0568, 0x57575757 +NV_SI_RO_BOARD_S1_RCA7_TXRX_G4PRESET, 0x0570, 0x57575757 +NV_SI_RO_BOARD_2P_CE_MASK_THRESHOLD, 0x0578, 0x00000003 +NV_SI_RO_BOARD_2P_CE_MASK_INTERVAL, 0x0580, 0x000001A4 +NV_SI_RO_BOARD_SX_PHY_CFG_SETTING, 0x0588, 0x00000000 +NV_SI_RO_BOARD_DDR_PHY_DC_CLK, 0x0590, 0x00018000 +NV_SI_RO_BOARD_DDR_PHY_DC_DATA, 0x0598, 0x80018000 +NV_SI_RO_BOARD_SX_RCA0_TXRX_20GPRESET, 0x05A0, 0x00000000 +NV_SI_RO_BOARD_SX_RCA1_TXRX_20GPRESET, 0x05A8, 0x00000000 +NV_SI_RO_BOARD_SX_RCA2_TXRX_20GPRESET, 0x05B0, 0x00000000 +NV_SI_RO_BOARD_SX_RCA3_TXRX_20GPRESET, 0x05B8, 0x00000000 +NV_SI_RO_BOARD_SX_RCA0_TXRX_25GPRESET, 0x05C0, 0x00000000 +NV_SI_RO_BOARD_SX_RCA1_TXRX_25GPRESET, 0x05C8, 0x00000000 +NV_SI_RO_BOARD_SX_RCA2_TXRX_25GPRESET, 0x05D0, 0x00000000 +NV_SI_RO_BOARD_SX_RCA3_TXRX_25GPRESET, 0x05D8, 0x00000000 +NV_SI_RO_BOARD_DDR_2X_REFRESH_TEMP_THRESHOLD, 0x05E0, 0x00550055 +NV_SI_RO_BOARD_PCP_VRD_VOUT_WAIT_US, 0x05E8, 0x00000064 +NV_SI_RO_BOARD_PCP_VRD_VOUT_RESOLUTION_MV, 0x05F0, 0x00000005 +NV_SI_RO_BOARD_DVFS_VOLT_READ_BACK_EN, 0x05F8, 0x00000001 +NV_SI_RO_BOARD_DVFS_VOLT_READ_BACK_TIME, 0x0600, 0x00000002 +NV_SI_RO_BOARD_DVFS_VOUT_20MV_RAMP_TIME_US, 0x0608, 0x00000005 +NV_SI_RO_BOARD_PCIE_AER_FW_FIRST, 0x0610, 0x00000000 +NV_SI_RO_BOARD_RTC_GPI_LOCK_BYPASS, 0x0618, 0x00000000 +NV_SI_RO_BOARD_TPM_DISABLE, 0x0620, 0x00000000 +NV_SI_RO_BOARD_MESH_S0_CXG_RC_STRONG_ORDERING_EN, 0x0628, 0x00000000 +NV_SI_RO_BOARD_MESH_S1_CXG_RC_STRONG_ORDERING_EN, 0x0630, 0x00000000 +NV_SI_RO_BOARD_GPIO_SW_WATCHDOG_EN, 0x0638, 0x00000000 +NV_SI_RO_BOARD_PCIE_HP_DISABLE, 0x0640, 0x00000000 +NV_SI_RO_BOARD_I2C_VRD_VOUT_FORMAT, 0x0648, 0x00000000 +NV_SI_RO_BOARD_I2C_VRD_SMBUS_CMD_FLAGS, 0x0650, 0x00000000 +NV_SI_RO_BOARD_CUST_SPM_LOCATION, 0x0658, 0x00000000 +NV_SI_RO_BOARD_RAS_DDR_CE_WINDOW, 0x0660, 0x00000000 +NV_SI_RO_BOARD_RAS_DDR_CE_TH1, 0x0668, 0x000001F4 +NV_SI_RO_BOARD_RAS_DDR_CE_TH2, 0x0670, 0x00001388 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." --=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 (#80704): https://edk2.groups.io/g/devel/message/80704 Mute This Topic: https://groups.io/mt/85631130/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 Thu Apr 25 11:35:07 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+80702+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+80702+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721561349963.8649008356806; Wed, 15 Sep 2021 08:59:21 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 0hIZYY1788612xx57XDx3mz1; Wed, 15 Sep 2021 08:59:21 -0700 X-Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.109]) by mx.groups.io with SMTP id smtpd.web08.10065.1631721560246865362 for ; Wed, 15 Sep 2021 08:59:20 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T3odyhXpRhZKVcgZ4wrhn/HICOkmmotLlqrOrENr2TM+kgEZC8fWExR+SKwVcb2YIdQaCZId4AX1UZt3z3aRgl4q0GbjmztXHIGUg1qLi6ZkClCCkQTelbvAx4EiMhK0NyEji0y9J/RX4CBJJFw9U4noD3ihQfTNpCtpR2htRL6WpVqI1qr3cSauKT52lWenrkI9P8mfVKAtm+OywVALNgjGjgQ6kBoZOR3T+Zm3jFa/U58Uudx0AQmfqCjzP9Q9b7HWGm95o/khrrMzDb4wa5/zfUUeUzZdn9KAKfWMH52qoFQf/K5vvKCj3WcQipVjsVX8AG7+5oyA8R3KSDEw1Q== 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; bh=xo0MIZytkoONbKv73KiVLILRL7WQPMNSQLZSPkh8OgA=; b=ndB8q3xE9Mo6F9inkvAi1XFWhLk1tGkyfk3SfoUGS7LvnGbt/lCjgfaLbU59BWySrYOHRmhU6CbqkTmK46AuLfSvIJCRqlzj5vDQbshWS7zV4zUJAZTGoZLiFz1Pzf2cmJZ/mb8aAuinMNqCMYSKFbXU5JHd/5T/pFC8YhjsxH7MFrkqFqGI/NaC5Utu+QOwA4HfWv70FEzlxyd4emwTpur8G1/qhL7b99GPpB8DTDH3n4ipqwvmETBHL8ICc35VnBadXycB4M8ypa/HSV9V6hDqqN3dy6p02vZPt6xdXxH3J7nwsrmkV37D5v+ZnnEUTMw2AnRX68LjtuIjCFRMwQ== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM6PR01MB5513.prod.exchangelabs.com (2603:10b6:5:151::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.17; Wed, 15 Sep 2021 15:59:18 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 15:59:18 +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] [PATCH v3 02/28] AmpereAltraPkg: Add MmCommunication modules Date: Wed, 15 Sep 2021 22:55:01 +0700 Message-ID: <20210915155527.8176-3-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 15:59:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fed39019-f2cb-49de-fc43-08d97861c5e9 X-MS-TrafficTypeDiagnostic: DM6PR01MB5513: X-MS-Exchange-Transport-Forked: True 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: VF4Y4TqBF96RGe6A3S+xE1reDSfYot73Hy+Hw06jGvNgLfBWclncL0FxD1wDLsAqALDMLrNXc+jOHFM1FuN4+t5+uuhpAFzRlhkGyXBRXlH3p4iX7ha/WTJr41PmfrSi1zNK402Y/ShV9u/iN0l6b1MKHOt4pFOuR/54Mf8bOat+3L07tIT2DDsTQ71KP3A4drtwItz/oT9vLDRzMl9NjxXOfdhxDSTzq0ytSWb0jZmGFl1/L7/otx0ItuX2q5FbqNyvzDOHYNLisqKQb8knQGt6GWBURUK8DWzh5BWF8BUdNKnNke6HRdjpxrRespZoQBnFmaZjV24KGWNfQjVg1fKMp9Yac+tBqG6EI1xUpTG7NIEUoTXOLsnSGrhkgbl3ajU93jsaYRKKwv5aSeOuPgqq+oc152qgrnAsjhdacSjl4jYIkvkKLXzNHrxPB0Q9PntcoaDyIM965WtfCXSGx/PPgVEmqbq7tVgtMhLsPpE7iqAHhyynVV6Wyx+SWViti+EI8WPWpMDJzFaaH7y8ngc3/N6PZoO2eJv2/hxAMLgOdcKwQ3qPyH1wtcehWniwT6nceW2Ct+9VbkHd5mqTRa+kYd/qDAgJTg24/svUClJC8C+mvZXgvbcQdlUknqKot5JS3aIWlqL27paBtwFTPI5Yftlqn6ysXf+PollfX8z7MuSErnOz/Gy1snZm0IQ9WxtzQltzGjgegkBq8zbMXQ== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Gv+FvrJY6qgWg57AhQIlLb2PO1r9f+LxCdh/s2lu4SaIg7S6gM1S+vchVkuC?= =?us-ascii?Q?xyWRtto2yWTPLjzuHJaD0KFpJEOvU2rtmPm/wsabgsO1WLXR9JjGlZaJXTfJ?= =?us-ascii?Q?paNqS8dTfwOZTJMR+8tXxZLrFNn2UfW+zhWyJ/s8yggqBSjhLCtgZtN0ftv3?= =?us-ascii?Q?0WaQZSEBTzttzUOKj2WVokye+EaWW1uxLFOff7ITMw80nyRC3AiTH+uowNxY?= =?us-ascii?Q?JTmJv7AA4m3BI8DliMrgfL1LEbZZt4sPHcTe0mtJ17+fj9xPEQMOFam3OhuR?= =?us-ascii?Q?C9EiaKi4hJhIGj7feUXh1g86dln4VC0voAYNElN6hGL469ga/TlrSWDFQNMJ?= =?us-ascii?Q?XJCmApWY78mIUWbbnusgY8i1LDgSoSHxQ10by1sVDzyTwlOP3jqrTTPdzZEY?= =?us-ascii?Q?erT5fLToIozXMHDynL7Ni5LCkVLxjymU1nAT/veHN2aJjfcn8RpcPQHx0tNH?= =?us-ascii?Q?L1TfEbujYCCEMdlmj9WshX1nIvuSrE8wHdJwqsFRLox5Co9yKHyGs7fxgi01?= =?us-ascii?Q?JcmSkAExF1dQSl2Fnh4Y2e71tE35e2leinwec+OjOihjUM6DJy3Yi8qrshgw?= =?us-ascii?Q?wPzuZP47xEDmBzUKs2Dr7+AawkNRqOKUSMA94kqrOWpA78D4O1w6kBVWv/D4?= =?us-ascii?Q?NQmWOk0ZRMtXZZJBaQ3o3kMV4dV3D6+2CMhGvnVHPwZ2SXiToAeInLpXp5MA?= =?us-ascii?Q?xT7xJHaesso5wSvFE46CCvafiKOkOhw8Av10M4Yn33JST5PQtxRXQMWVvSes?= =?us-ascii?Q?xhDGu6TTW5h44GOOzdCT41vmNQ5Y3kppu8z5k5WfOMxSFGGB0pv/0FmwG8zM?= =?us-ascii?Q?Ty+wOHAGXxDyeeZY5J4MTvcYLVOcGShNfikZHXIyATRkw5B6FT8vT57nqn1I?= =?us-ascii?Q?BGPfjV6P/GOmQQlvv9oxdSm81QpfBaJreBnOT7O30N0cE2sMlpBGJxk+bh0z?= =?us-ascii?Q?cjGIvLz7cYue0wuQvZbb0yt1dajUuwx2Rb5hl500BSRBocGqBJQim9xCsW0e?= =?us-ascii?Q?8kxIAx4WHOZHa/l2gsDfkex+IlK8kGNoWP76+uvfkJTgMpB//S3ugfiph7in?= =?us-ascii?Q?X/jBQ8IGCf5MvyDpJgAPaayI87ED7f3Fh5amjGLWd+Z1zcZoPQI36JEiV4Y0?= =?us-ascii?Q?e0dwgzQzr6F+/fWzhEXFu4Q4tG7YKnEw6ycZ58t4ZU1cy/UuVmt00g8sgoZ0?= =?us-ascii?Q?rZv2UM3kVE6GGeJwGQW+yqCk4xb1/jskCaxZ3JdWrRw7v3Pwj2pnZnuQKP2z?= =?us-ascii?Q?8EULBse7mtW8jud1R2QD7jc5EzsgsY+na4226LAFNotmeDlWT2BZB6xiyuwu?= =?us-ascii?Q?TF6moQTaVjhopZfmH44qOxWH?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: fed39019-f2cb-49de-fc43-08d97861c5e9 X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 15:59:18.2159 (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: XS3Gf2teRvfnp/Mxfg1atUqm1bhflqBv41tpRm3QUE0kmCOglc5EDttZ1f6j8T7FiIYFMit9LmMgN2JT5LUb4k96kdiYzibRDGlcltSG7dc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR01MB5513 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: pYHvDNkMjHlmWm9VB7XMshzux1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721561; bh=LyuwhngsHSwTStkgJonU7Bz1htogsk+thujUcL0nEeI=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=G1mm5tVB0LGvStR1eNLTxNPIPX1OtmkstVPXaxRCFALoQkPEWvaPGJagK1EtIJgB2+y yeqUhhSnlaIwl5E3hy4Xz4PtiUoFEfm/Vcvgtr11Q/+dAIj6yQ1K+KOhLZV2WN7hQTFsN ohxCQkCvKl+yTJeXdzRwtOMB+/+on1qK4Yk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721562798100001 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen The MmCommunicationDxe module is derived from ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf. The MmCommunication PEI and DXE modules implement the MM Communication protocol (EFI_MM_COMMUNICATION_PROTOCOL) as defined in the PI 1.5 specification for the interface between UEFI and MM services in the secure world. 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: Vu Nguyen Reviewed-by: Leif Lindholm --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec = | 3 + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc = | 2 + Platform/Ampere/JadePkg/Jade.fdf = | 3 + Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunication.i= nf | 57 +++ Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunicationPe= i.inf | 34 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunicate.h = | 22 + Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunication.c= | 454 ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunicationPe= i.c | 37 ++ 8 files changed, 612 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Amp= ere/AmpereAltraPkg/AmpereAltraPkg.dec index f0a5bd04ec22..73097afaf841 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -38,5 +38,8 @@ [Guids] ## NVParam MM GUID gNVParamMmGuid =3D { 0xE4AC5024, 0x29BE, 0x4ADC, { 0x93, 0= x36, 0x87, 0xB5, 0xA0, 0x76, 0x23, 0x2D } } =20 + ## SPI NOR Proxy MM GUID + gSpiNorMmGuid =3D { 0xC8D76438, 0x4D3C, 0x4BEA, { 0xBF, 0= x86, 0x92, 0x6B, 0x83, 0x07, 0xA2, 0x39 } } + ## Include/Guid/PlatformInfoHobGuid.h gPlatformHobGuid =3D { 0x7f73e372, 0x7183, 0x4022, { 0xb3, 0= x76, 0x78, 0x30, 0x32, 0x6d, 0x79, 0xb4 } } diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index 770b4a12bc0b..7dadf15b7825 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -525,6 +525,7 @@ [Components.common] ArmPlatformPkg/PlatformPei/PlatformPeim.inf Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunication= Pei.inf ArmPkg/Drivers/CpuPei/CpuPei.inf UefiCpuPkg/CpuIoPei/CpuIoPei.inf MdeModulePkg/Universal/Variable/Pei/VariablePei.inf @@ -573,6 +574,7 @@ [Components.common] EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunication= .inf =20 # # Environment Variables Protocol diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index 8ed6df381aed..905289844378 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 Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.= inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunica= tionPei.inf INF ArmPkg/Drivers/CpuPei/CpuPei.inf INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf @@ -141,6 +142,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/MmCommunicationDxe/MmCommunica= tion.inf } =20 INF MdeModulePkg/Core/Dxe/DxeMain.inf @@ -163,6 +165,7 @@ [FV.FvMain] INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunica= tion.inf =20 # # Environment Variables Protocol diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCom= munication.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/M= mCommunication.inf new file mode 100644 index 000000000000..3efff142944f --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunicat= ion.inf @@ -0,0 +1,57 @@ +#/** @file +# +# This module implements the MM Communication Protocol (EFI_MM_COMMUNICAT= ION_PROTOCOL) +# as defined in the PI 1.5 specification. +# +# Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D ArmMmCommunication + FILE_GUID =3D 09EE81D3-F15E-43F4-85B4-CB9873DA5D6B + MODULE_TYPE =3D DXE_RUNTIME_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D MmCommunicationInitialize + +# +# The following is for reference only and not required by +# build tools +# +# VALID_ARCHITECTURES =3D AARCH64 +# + +[Sources.AARCH64] + MmCommunicate.h + MmCommunication.c + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + ArmLib + ArmSmcLib + BaseMemoryLib + DebugLib + DxeServicesTableLib + HobLib + UefiDriverEntryPoint + +[Protocols] + gEfiMmCommunicationProtocolGuid ## PRODUCES + +[Guids] + gEfiEndOfDxeEventGroupGuid + gEfiEventExitBootServicesGuid + gEfiEventReadyToBootGuid + +[Pcd.common] + gArmTokenSpaceGuid.PcdMmBufferBase + gArmTokenSpaceGuid.PcdMmBufferSize + +[Depex] + gEfiCpuArchProtocolGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCom= municationPei.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPe= i/MmCommunicationPei.inf new file mode 100644 index 000000000000..3a985840a0a0 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunicat= ionPei.inf @@ -0,0 +1,34 @@ +## @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 MmCommunicationPei + FILE_GUID =3D B5AE0F80-DF81-11EA-8B6E-0800200C9A66 + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D MmCommunicationPeiEntryPoint + +[Sources] + MmCommunicationPei.c + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + HobLib + PcdLib + PeimEntryPoint + +[Pcd] + gArmTokenSpaceGuid.PcdMmBufferBase + gArmTokenSpaceGuid.PcdMmBufferSize + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCom= municate.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCom= municate.h new file mode 100644 index 000000000000..804ba58afb72 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunicat= e.h @@ -0,0 +1,22 @@ +/** @file + + Copyright (c) 2016-2018, ARM Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef MM_COMMUNICATE_H_ +#define MM_COMMUNICATE_H_ + +#define MM_MAJOR_VER_MASK 0xEFFF0000 +#define MM_MINOR_VER_MASK 0x0000FFFF +#define MM_MAJOR_VER_SHIFT 16 + +#define MM_MAJOR_VER(x) (((x) & MM_MAJOR_VER_MASK) >> MM_MAJOR_VER_SHIFT) +#define MM_MINOR_VER(x) ((x) & MM_MINOR_VER_MASK) + +#define MM_CALLER_MAJOR_VER 0x1UL +#define MM_CALLER_MINOR_VER 0x0 + +#endif /* MM_COMMUNICATE_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCom= munication.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmC= ommunication.c new file mode 100644 index 000000000000..271fc755548f --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunicat= ion.c @@ -0,0 +1,454 @@ +/** @file + + Copyright (c) 2020, Ampere Computing LLC + Copyright (c) 2016-2018, ARM Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "MmCommunicate.h" + +#define MM_EARLY_MEM_ALLOCATE 1 + +// +// Address, Length of the pre-allocated buffer for communication with the = secure +// world. +// +STATIC ARM_MEMORY_REGION_DESCRIPTOR mNsCommBuffMemRegion; + +// Notification event when virtual address map is set. +STATIC EFI_EVENT mSetVirtualAddressMapEvent; + +// +// Handle to install the MM Communication Protocol +// +STATIC EFI_HANDLE mMmCommunicateHandle; + +/** + Communicates with a registered handler. + + This function provides an interface to send and receive messages to the + Standalone MM environment on behalf of UEFI services. This function is = part + of the MM Communication Protocol that may be called in physical mode pri= or to + SetVirtualAddressMap() and in virtual mode after SetVirtualAddressMap(). + + @param[in] This The EFI_MM_COMMUNICATION_PROTOCOL + instance. + @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 +**/ +STATIC +EFI_STATUS +EFIAPI +MmCommunicationCommunicate ( + IN CONST EFI_MM_COMMUNICATION_PROTOCOL *This, + 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 + // relying 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; +} + +// +// MM Communication Protocol instance +// +EFI_MM_COMMUNICATION_PROTOCOL mMmCommunication =3D { + MmCommunicationCommunicate +}; + +/** + Notification callback on SetVirtualAddressMap event. + + This function notifies the MM communication protocol interface on + SetVirtualAddressMap event and converts pointers used in this driver + from physical to virtual address. + + @param Event SetVirtualAddressMap event. + @param Context A context when the SetVirtualAddressMap triggered. + + @retval EFI_SUCCESS The function executed successfully. + @retval Other Some error occurred when executing this function. + +**/ +STATIC +VOID +EFIAPI +NotifySetVirtualAddressMap ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + + Status =3D gRT->ConvertPointer ( + EFI_OPTIONAL_PTR, + (VOID **)&mNsCommBuffMemRegion.VirtualBase + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: Unable to convert MM runtime pointer. Status:0x%r\n", + __FUNCTION__, + Status + )); + } + +} + +STATIC +EFI_STATUS +GetMmCompatibility () +{ + EFI_STATUS Status; + UINT32 MmVersion; + ARM_SMC_ARGS MmVersionArgs; + + // MM_VERSION uses SMC32 calling conventions + MmVersionArgs.Arg0 =3D ARM_SMC_ID_MM_VERSION_AARCH32; + + ArmCallSmc (&MmVersionArgs); + + MmVersion =3D MmVersionArgs.Arg0; + + if ((MM_MAJOR_VER (MmVersion) =3D=3D MM_CALLER_MAJOR_VER) && + (MM_MINOR_VER (MmVersion) >=3D MM_CALLER_MINOR_VER)) + { + DEBUG (( + DEBUG_INFO, + "MM Version: Major=3D0x%x, Minor=3D0x%x\n", + MM_MAJOR_VER (MmVersion), + MM_MINOR_VER (MmVersion) + )); + Status =3D EFI_SUCCESS; + } else { + DEBUG (( + DEBUG_ERROR, + "Incompatible MM Versions.\n Current Version: Major=3D0x%x, " + "Minor=3D0x%x.\n Expected: Major=3D0x%x, Minor>=3D0x%x.\n", + MM_MAJOR_VER (MmVersion), + MM_MINOR_VER (MmVersion), + MM_CALLER_MAJOR_VER, + MM_CALLER_MINOR_VER + )); + Status =3D EFI_UNSUPPORTED; + } + + return Status; +} + +STATIC EFI_GUID *CONST mGuidedEventGuid[] =3D { + &gEfiEndOfDxeEventGroupGuid, + &gEfiEventExitBootServicesGuid, + &gEfiEventReadyToBootGuid, +}; + +STATIC EFI_EVENT mGuidedEvent[ARRAY_SIZE (mGuidedEventGuid)]; + +/** + Event notification that is fired when GUIDed Event Group is signaled. + + @param Event The Event that is being processed, not use= d. + @param Context Event Context, not used. + +**/ +STATIC +VOID +EFIAPI +MmGuidedEventNotify ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_MM_COMMUNICATE_HEADER Header; + UINTN Size; + + // + // Use Guid to initialize EFI_SMM_COMMUNICATE_HEADER structure + // + CopyGuid (&Header.HeaderGuid, Context); + Header.MessageLength =3D 1; + Header.Data[0] =3D 0; + + Size =3D sizeof (Header); + MmCommunicationCommunicate (&mMmCommunication, &Header, &Size); +} + +/** + The Entry Point for MM Communication + + This function installs the MM communication protocol interface and finds= out + what type of buffer management will be required prior to invoking the + communication SMC. + + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The entry point is executed successfully. + @retval Other Some error occurred when executing this entry poi= nt. + +**/ +EFI_STATUS +EFIAPI +MmCommunicationInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + UINTN Index; + + // Check if we can make the MM call + Status =3D GetMmCompatibility (); + if (EFI_ERROR (Status)) { + goto ReturnErrorStatus; + } + + mNsCommBuffMemRegion.PhysicalBase =3D PcdGet64 (PcdMmBufferBase); + // During boot, virtual and physical are same + mNsCommBuffMemRegion.VirtualBase =3D mNsCommBuffMemRegion.PhysicalBase; + mNsCommBuffMemRegion.Length =3D PcdGet64 (PcdMmBufferSize); + + ASSERT (mNsCommBuffMemRegion.PhysicalBase !=3D 0); + + ASSERT (mNsCommBuffMemRegion.Length !=3D 0); + +#if !defined(MM_EARLY_MEM_ALLOCATE) + Status =3D gDS->AddMemorySpace ( + EfiGcdMemoryTypeReserved, + mNsCommBuffMemRegion.PhysicalBase, + mNsCommBuffMemRegion.Length, + EFI_MEMORY_WB | + EFI_MEMORY_XP | + EFI_MEMORY_RUNTIME + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: Failed to add MM-NS Buffer Memory Space\n", + __FUNCTION__ + )); + goto ReturnErrorStatus; + } + + Status =3D gDS->SetMemorySpaceAttributes ( + mNsCommBuffMemRegion.PhysicalBase, + mNsCommBuffMemRegion.Length, + EFI_MEMORY_WB | EFI_MEMORY_XP | EFI_MEMORY_RUNTIME + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: Failed to set MM-NS Buffer Memory attributes\n", + __FUNCTION__ + )); + goto CleanAddedMemorySpace; + } +#endif + + // Install the communication protocol + Status =3D gBS->InstallProtocolInterface ( + &mMmCommunicateHandle, + &gEfiMmCommunicationProtocolGuid, + EFI_NATIVE_INTERFACE, + &mMmCommunication + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: Failed to install MM communication protocol\n", + __FUNCTION__ + )); + goto CleanAddedMemorySpace; + } + + // Register notification callback when virtual address is associated + // with the physical address. + // Create a Set Virtual Address Map event. + Status =3D gBS->CreateEvent ( + EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE, + TPL_NOTIFY, + NotifySetVirtualAddressMap, + NULL, + &mSetVirtualAddressMapEvent + ); + ASSERT_EFI_ERROR (Status); + + for (Index =3D 0; Index < ARRAY_SIZE (mGuidedEventGuid); Index++) { + Status =3D gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_CALLBACK, + MmGuidedEventNotify, + mGuidedEventGuid[Index], + mGuidedEventGuid[Index], + &mGuidedEvent[Index] + ); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + while (Index-- > 0) { + gBS->CloseEvent (mGuidedEvent[Index]); + } + goto UninstallProtocol; + } + } + return EFI_SUCCESS; + +UninstallProtocol: + gBS->UninstallProtocolInterface ( + mMmCommunicateHandle, + &gEfiMmCommunicationProtocolGuid, + &mMmCommunication + ); + +CleanAddedMemorySpace: +#if !defined(MM_EARLY_MEM_ALLOCATE) + gDS->RemoveMemorySpace ( + mNsCommBuffMemRegion.PhysicalBase, + mNsCommBuffMemRegion.Length + ); +#endif + +ReturnErrorStatus: + return EFI_INVALID_PARAMETER; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCom= municationPei.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/= MmCommunicationPei.c new file mode 100644 index 000000000000..d3925015612f --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunicat= ionPei.c @@ -0,0 +1,37 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#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 +MmCommunicationPeiEntryPoint ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + EFI_PHYSICAL_ADDRESS MmBufferBase =3D PcdGet64 (PcdMmBufferBase); + UINT64 MmBufferSize =3D PcdGet64 (PcdMmBufferSize); + + BuildMemoryAllocationHob (MmBufferBase, MmBufferSize, EfiRuntimeServices= Data); + + 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 (#80702): https://edk2.groups.io/g/devel/message/80702 Mute This Topic: https://groups.io/mt/85631122/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 Thu Apr 25 11:35:07 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+80703+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+80703+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721564980285.6954665880727; Wed, 15 Sep 2021 08:59:24 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id DUy4YY1788612xfdlxZgFBwa; Wed, 15 Sep 2021 08:59:24 -0700 X-Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.91]) by mx.groups.io with SMTP id smtpd.web08.10068.1631721563892015702 for ; Wed, 15 Sep 2021 08:59:24 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XEHTvfc9pD0zTvvl6JwENW3mfBk6O6SRMfH08+U4PiNcyOG15WRspEC+ZH7BKPtpBFJXeFBhnVOTm8eIgfRqVNsUG5lP6WN6ICmjxqpdaHL8X0WP26qLpOkwWXKNUTF9yik5IoPB5BGLlMjatJtD62Rjdots/EGqLoTsq6xMpLYYc27B5u+Wqg40CDEsQruSsBQKGjfl50FrKoFL57QVw0UN3/k3mPcOoJ2LQxW6YJ1nUnYURCXI0eRJLlWIYvPZVuXNWo5qomWSVAmyCiwlTf+62S4nv8KjVQD+2TJ8CD7g1fl47PXu3aDN9zuuy/EgET6WnrNI+hnJZ45g+4ig7A== 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; bh=rN+QvZpMlzV6IdcBjFhEVtzfx8bVZ3Be7hZJe6Ew5jo=; b=hvMD5SFBbY93ifRkSv4RqoJbNOAWNEcPVg/3tMgeXtmj4orJ2nVPy57XcGMRSvQpS9+F20lV86PK3Lq+uaWSXSNMOJn+wxE847S3mZlxVv9F8n6rqeP3Ijv+diKYPSP7KIhyNNOdPWcfZAy6dx7EVaiPNPnzmwe/fv4mXYvAfT/BT0yuHmYqUYk4DJGhzTFslYEFLUg0CMs0s/0jyDY4/Zf5/0nqPixfR1G2EbWfcZJGhe7HvoButFDzwDORdaXNItgwtGe3CNSZT+gKqLIQUZsPGB3HiB4p+zv+LmB6DIEz92UsGUyfSJqj2B+eIT6ob258aIgtPucERMH0E7v+YQ== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM6PR01MB5513.prod.exchangelabs.com (2603:10b6:5:151::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.17; Wed, 15 Sep 2021 15:59:22 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 15:59:22 +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] [PATCH v3 03/28] AmperePlatformPkg: Implement FailSafe library Date: Wed, 15 Sep 2021 22:55:02 +0700 Message-ID: <20210915155527.8176-4-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 15:59:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b0791852-cc6c-4891-4a6e-08d97861c84c X-MS-TrafficTypeDiagnostic: DM6PR01MB5513: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: 4kB5as/S2e3Xvc1RBmnq7ha4bB3iUR7wl4zAY39yVAO2JNJF7iawU9weiXd/VXd3BoA+JzZMvrJJ5RQXvNcnjuEdp/tnsAO9x2YR0hY0tPFpy6fjv3E6z7G5l2CC+sGKZ/f9klMjCIP+UaooS8etqMQYU9Y0LYUKhnhpbIe5b849beB/w91DIBMyEIk2nXWJgyLBgb5GYTe7hdnC8gNBidtEd3bixRNl59PIv2Fr3AGeAoasxyKbkDX2TpR1yTmdnLBPY/U5oZnzdmjM+ez5Zq0eYCtEm/LdgE8uOsL6aJstNX+U8BL3Wv/rUr+VYryeSzMRypMQyjnbM3r2NWZ3PT8030gUWBasvRG6wThPa7WxC/In4oIYakdijYH1YBAe8+DzpVARAfjohWsMxOmfFFzX0d3+jDVN7/4rtWs7w3NK7hEtZBFf/tLEpYdqQaL1cA9FhEGiadSxm3+r9WbGtrdwrdyEXPN2picL3+1za0SLOQmGWNXKHwwP97pXGXO2sUbRth6hGLXkvJwbZhs6Dv2VYDaY5dRevA8D2oj8Mp6UEwnE+Hqrx1m6CJXkpXvBxJllVvfafRiZraRVR0k3vQ5CA+wrwkVTGmFrsYv4im9hpO+7PN5hEpT5QkJdIgstfAFvFdDSI+OudgRLypjXF6+psN7/c4AETavnq3VO/gG13+DdJEYUXtQNmZOQnV9RBSajddwZvAk1vdAPQRt2OQ== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?faUrpfgfrOrepyfKIWtf7u0OY3eu2y9PmwSI/fP+V/F1qvKIYsw49eko5Dqg?= =?us-ascii?Q?WhKEShCvWUkPjYnEoacG9PsKgKW5M7Z0z24kprB8t+MNlumVtGvZcpS7kure?= =?us-ascii?Q?oFzshiYPYLMYPcHEfKdr3/QESxsgX0fB27HsHcMzXPcxmo7O8tF7bW1h56Lu?= =?us-ascii?Q?aOWDIojawFcQMadRYjJ5Gvjaq3Dqz9lWA7mEwvRGLASSW+MEN4/c3I/Fvmj1?= =?us-ascii?Q?DaUlI8nVH80G5RR3yuOVtUSt/vORYJ50KsZIK6aVmmn6kkjOL8MS65ldTKNk?= =?us-ascii?Q?tlc+iMoijIKkGKCA1zN9sdRv3mb05aYjBN2Wq5Mh3YIAV/lta8/XFxs2cpJb?= =?us-ascii?Q?bzSY4/Z+86m5q24Rn/oPqL7l6bEUXFZk0Yv3gjy8MDM5zJ+BWqyhp8Av661B?= =?us-ascii?Q?dRTnzrJEpCvIIRRAh7FLcRxq7cODypD5nkcu4GGfTLfQ8hTyWiMMLADRZlCV?= =?us-ascii?Q?rYkBViE/3UVd0lHBEAYnWrmZJfbZkwayyNRrLOx/eEo+sORAhqLSqLvq0eRq?= =?us-ascii?Q?O2jAFjO7bYE7t7Hf9/ayWfcp0PQjLV62Cqq1HMgVCzspNzBwTnz7gJqBxGqQ?= =?us-ascii?Q?9DVY8DLr4XThlrNNa4ymztZyelL4wqlJkRd7Ha3eT72sKuMF+XwpfYN8OWUs?= =?us-ascii?Q?oQBn2dI6lebz39hmSGW8dS8rTxie2umNyHhkbP5WPha3fuZcuug7BiC16W+c?= =?us-ascii?Q?+58tmDVVuvPBr+HkZ3j9Hl53OdM341A+RImrfVux/m2S5zaDl+KYJcgB51hl?= =?us-ascii?Q?sXzos5se0wFUDYpGX7g7kDNpKAdi2dyzvPN9dnT4ADuKbL/51GnwIIK4mBt4?= =?us-ascii?Q?aUuU2n0uG/yozBdNJJfYLmA9PdJquad3FSxiZIQmOVv5Xoa9rRrZhi03IZZ0?= =?us-ascii?Q?g90XmAHiiiRgsCc+JcGF8lI6xs8ieULuutcMiXq4k7UkUNjK7eVhq0vElCHk?= =?us-ascii?Q?1w6q39msuytkk5lccjliZpWe1SwPJ2kuieNbQBEG6mZQiVflU3cDTUO+jKET?= =?us-ascii?Q?0O8NsQ0kwaRLpBCclMsLYhYfKroJerBTv2UmR7cHky5YmK0DV7lQpBzWMn4a?= =?us-ascii?Q?fpWA8iUKk9viM/M0aPeqiqCxLpYjAvicNlulH/D3sIy8kUFFRBRQe6+tfVCD?= =?us-ascii?Q?AIjs2MSh0GnTq2vPf7im+GKupHMy2xCMd3G9R0hvyAaW67G2WrUdxW0yk443?= =?us-ascii?Q?9x/HOgXCDvUntFleCq92+5WYv8FmgZw1ZM/n1GzuNx4Bj7uROGmgbkw+R9sL?= =?us-ascii?Q?zN25PAwcNFbMQJ/ZwKCyohjr1/2I51MYpS3mrGU4UWJc/oWIM5UceOvJ45Ps?= =?us-ascii?Q?Xt2ARmGsoFUu79CMREEVWT66?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: b0791852-cc6c-4891-4a6e-08d97861c84c X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 15:59:22.2376 (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: 6lZs+VUtZ4zDNkpLdiPPg+Cxep413beGeFXQiCC06fNU2rpV6XVlLIMuFbj8PnEfAqL6917jrLKgdRQbYXgzYHbe5y+hvWlv/6Xx8PmcuGY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR01MB5513 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: pzy100UCfb7wgEsCSFq74QAEx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721564; bh=sxZ36QfS8qlqdZFfK3hIeq7loHq5DKdo7stbMSZpeMw=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=m/sMb2fa8JMPh7U0NNIHvFOqOi8vygpn5J7uiU+DJX9iiDUU36LyyMeNgqW4FrqROdU GJ/FKHhvzCSHiXE4KkSp5tvmOyhQalXpFPRKtIDJ/IUlivCj6Zg21DsMwrx9PKupQAje7 3CCBF2h/M2eRM6vSQQzLU6S3eTGplNUaqdg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721565314100002 Content-Type: text/plain; charset="utf-8" The Ampere Altra System Firmware provides a fail-safe feature to help recover the system if there are setting changes such as Core voltage, DRAM parameters that cause the UEFI failed to boot. The FailSafeLib supports API calls to Secure World to: * Get the FailSafe region information. * Get the current FailSafe status. * Inform to FailSafe monitor that the system boots successfully. * Simulate UEFI boot failure due to config wrong NVPARAM for testing failsafe feature. This library will be consumed by FailSafe DXE driver. 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/AmperePlatformPkg/AmperePlatformPkg.dec | = 3 + Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSafeLib.inf | 4= 1 +++ Platform/Ampere/AmperePlatformPkg/Include/Library/FailSafeLib.h | 6= 2 ++++ Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSafeLib.c | 31= 3 ++++++++++++++++++++ 4 files changed, 419 insertions(+) diff --git a/Platform/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec b/Plat= form/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec index 7c1d1f84f780..6e33d96c7ea5 100644 --- a/Platform/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec +++ b/Platform/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec @@ -22,7 +22,10 @@ [Defines] # ##########################################################################= ###### [Includes] + Include # Root include for the package =20 [LibraryClasses] + ## @libraryclass Provides functions to support FailSafe operations. + FailSafeLib|Platform/Ampere/AmperePlatformPkg/Include/Library/FailSafeLi= b.h =20 [Guids] diff --git a/Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSafe= Lib.inf b/Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSafeLib= .inf new file mode 100644 index 000000000000..456b9d5fc85b --- /dev/null +++ b/Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSafeLib.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 FailSafeLib + FILE_GUID =3D 3403D080-6D76-11E7-907B-A6006AD3DBA0 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D FailSafeLib + +[Sources] + FailSafeLib.c + +[Protocols] + gEfiMmCommunicationProtocolGuid ## CONSUMES + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + Platform/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + ArmSmcLib + BaseLib + BaseMemoryLib + DebugLib + HobLib + IoLib + NVParamLib + +[Guids] + gSpiNorMmGuid diff --git a/Platform/Ampere/AmperePlatformPkg/Include/Library/FailSafeLib.= h b/Platform/Ampere/AmperePlatformPkg/Include/Library/FailSafeLib.h new file mode 100644 index 000000000000..7ebd1c8a74a2 --- /dev/null +++ b/Platform/Ampere/AmperePlatformPkg/Include/Library/FailSafeLib.h @@ -0,0 +1,62 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef FAILSAFE_LIB_H_ +#define FAILSAFE_LIB_H_ + +enum { + MM_SPINOR_FUNC_GET_INFO, + MM_SPINOR_FUNC_READ, + MM_SPINOR_FUNC_WRITE, + MM_SPINOR_FUNC_ERASE, + MM_SPINOR_FUNC_GET_NVRAM_INFO, + MM_SPINOR_FUNC_GET_NVRAM2_INFO, + MM_SPINOR_FUNC_GET_FAILSAFE_INFO +}; + +#define MM_SPINOR_RES_SUCCESS 0xAABBCC00 +#define MM_SPINOR_RES_FAIL 0xAABBCCFF + +enum { + FAILSAFE_BOOT_NORMAL =3D 0, + FAILSAFE_BOOT_LAST_KNOWN_SETTINGS, + FAILSAFE_BOOT_DEFAULT_SETTINGS, + FAILSAFE_BOOT_DDR_DOWNGRADE, + FAILSAFE_BOOT_SUCCESSFUL +}; + +/** + Get the FailSafe region information. +**/ +EFI_STATUS +EFIAPI +FailSafeGetRegionInfo ( + UINT64 *Offset, + UINT64 *Size + ); + +/** + Inform to FailSafe monitor that the system boots successfully. +**/ +EFI_STATUS +EFIAPI +FailSafeBootSuccessfully ( + VOID + ); + +/** + Simulate UEFI boot failure due to config wrong NVPARAM for + testing failsafe feature +**/ +EFI_STATUS +EFIAPI +FailSafeTestBootFailure ( + VOID + ); + +#endif /* FAILSAFE_LIB_H_ */ diff --git a/Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSafe= Lib.c b/Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSafeLib.c new file mode 100644 index 000000000000..d74962d73396 --- /dev/null +++ b/Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSafeLib.c @@ -0,0 +1,313 @@ +/** @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 EFI_MM_MAX_PAYLOAD_U64_E 10 +#define EFI_MM_MAX_PAYLOAD_SIZE (EFI_MM_MAX_PAYLOAD_U64_E * sizeof (UINT= 64)) + +EFI_MM_COMMUNICATION_PROTOCOL *mFlashLibMmCommProtocol =3D NULL; + +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 + * of the header + */ + UINTN MsgLength; +} EFI_MM_COMM_HEADER_NOPAYLOAD; + +typedef struct { + UINT64 Data[EFI_MM_MAX_PAYLOAD_U64_E]; +} EFI_MM_COMM_SPINOR_PAYLOAD; + +typedef struct { + EFI_MM_COMM_HEADER_NOPAYLOAD EfiMmHdr; + EFI_MM_COMM_SPINOR_PAYLOAD PayLoad; +} EFI_MM_COMM_REQUEST; + +typedef struct { + UINT64 Status; +} EFI_MM_COMMUNICATE_SPINOR_RES; + +typedef struct { + UINT64 Status; + UINT64 FailSafeBase; + UINT64 FailSafeSize; +} EFI_MM_COMMUNICATE_SPINOR_FAILSAFE_INFO_RES; + +EFI_MM_COMM_REQUEST mEfiMmSpiNorReq; + +#pragma pack(1) +typedef struct { + UINT8 ImgMajorVer; + UINT8 ImgMinorVer; + UINT32 NumRetry1; + UINT32 NumRetry2; + UINT32 MaxRetry; + UINT8 Status; + /* + * Byte[3]: Reserved + * Byte[2]: Slave MCU Failure Mask + * Byte[1]: Reserved + * Byte[0]: Master MCU Failure Mask + */ + UINT32 MCUFailsMask; + UINT16 CRC16; + UINT8 Reserved[3]; +} FAIL_SAFE_CONTEXT; + +#pragma pack() + +STATIC +EFI_STATUS +UefiMmCreateSpiNorReq ( + VOID *Data, + UINT64 Size + ) +{ + CopyGuid (&mEfiMmSpiNorReq.EfiMmHdr.HeaderGuid, &gSpiNorMmGuid); + mEfiMmSpiNorReq.EfiMmHdr.MsgLength =3D Size; + + if (Size !=3D 0) { + ASSERT (Data); + ASSERT (Size <=3D EFI_MM_MAX_PAYLOAD_SIZE); + + CopyMem (mEfiMmSpiNorReq.PayLoad.Data, Data, Size); + } + + return EFI_SUCCESS; +} + +STATIC +INTN +CheckCrc16 ( + UINT8 *Pointer, + INTN Count + ) +{ + INTN Crc =3D 0; + INTN Index; + + while (--Count >=3D 0) { + Crc =3D Crc ^ (INTN)*Pointer++ << 8; + for (Index =3D 0; Index < 8; ++Index) { + if ((Crc & 0x8000) !=3D 0) { + Crc =3D Crc << 1 ^ 0x1021; + } else { + Crc =3D Crc << 1; + } + } + } + + return Crc & 0xFFFF; +} + +BOOLEAN +FailSafeValidCRC ( + FAIL_SAFE_CONTEXT *FailSafeBuf + ) +{ + UINT8 Valid; + UINT16 Crc; + UINT32 Len; + + Len =3D sizeof (FAIL_SAFE_CONTEXT); + Crc =3D FailSafeBuf->CRC16; + FailSafeBuf->CRC16 =3D 0; + + Valid =3D (Crc =3D=3D CheckCrc16 ((UINT8 *)FailSafeBuf, Len)); + FailSafeBuf->CRC16 =3D Crc; + + return Valid; +} + +BOOLEAN +FailSafeFailureStatus ( + UINT8 Status + ) +{ + if ((Status =3D=3D FAILSAFE_BOOT_LAST_KNOWN_SETTINGS) || + (Status =3D=3D FAILSAFE_BOOT_DEFAULT_SETTINGS) || + (Status =3D=3D FAILSAFE_BOOT_DDR_DOWNGRADE)) + { + return TRUE; + } + + return FALSE; +} + +EFI_STATUS +EFIAPI +FailSafeGetRegionInfo ( + UINT64 *Offset, + UINT64 *Size + ) +{ + EFI_MM_COMMUNICATE_SPINOR_FAILSAFE_INFO_RES *MmSpiNorFailSafeInfoRes; + UINT64 MmData[5]; + UINTN DataSize; + EFI_STATUS Status; + + if (mFlashLibMmCommProtocol =3D=3D NULL) { + Status =3D gBS->LocateProtocol ( + &gEfiMmCommunicationProtocolGuid, + NULL, + (VOID **)&mFlashLibMmCommProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Can't locate gEfiMmCommunicationProtocolGu= id\n", __FUNCTION__)); + return Status; + } + } + + MmData[0] =3D MM_SPINOR_FUNC_GET_FAILSAFE_INFO; + UefiMmCreateSpiNorReq ((VOID *)&MmData, sizeof (MmData)); + + DataSize =3D sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status =3D mFlashLibMmCommProtocol->Communicate ( + mFlashLibMmCommProtocol, + (VOID *)&mEfiMmSpiNorReq, + &DataSize + ); + ASSERT_EFI_ERROR (Status); + + MmSpiNorFailSafeInfoRes =3D (EFI_MM_COMMUNICATE_SPINOR_FAILSAFE_INFO_RES= *)&mEfiMmSpiNorReq.PayLoad; + if (MmSpiNorFailSafeInfoRes->Status !=3D MM_SPINOR_RES_SUCCESS) { + DEBUG (( + DEBUG_ERROR, + "%a: Get flash information failed: 0x%llx\n", + __FUNCTION__, + MmSpiNorFailSafeInfoRes->Status + )); + return EFI_DEVICE_ERROR; + } + + *Offset =3D MmSpiNorFailSafeInfoRes->FailSafeBase; + *Size =3D MmSpiNorFailSafeInfoRes->FailSafeSize; + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +FailSafeBootSuccessfully ( + VOID + ) +{ + EFI_MM_COMMUNICATE_SPINOR_RES *MmSpiNorRes; + UINT64 MmData[5]; + UINTN Size; + EFI_STATUS Status; + UINT64 FailSafeStartOffset; + UINT64 FailSafeSize; + FAIL_SAFE_CONTEXT FailSafeBuf; + + Status =3D FailSafeGetRegionInfo (&FailSafeStartOffset, &FailSafeSize); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to get context region information\n",= __FUNCTION__)); + return EFI_DEVICE_ERROR; + } + + MmData[0] =3D MM_SPINOR_FUNC_READ; + MmData[1] =3D FailSafeStartOffset; + MmData[2] =3D (UINT64)sizeof (FAIL_SAFE_CONTEXT); + MmData[3] =3D (UINT64)&FailSafeBuf; + UefiMmCreateSpiNorReq ((VOID *)&MmData, sizeof (MmData)); + + Size =3D sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status =3D mFlashLibMmCommProtocol->Communicate ( + mFlashLibMmCommProtocol, + (VOID *)&mEfiMmSpiNorReq, + &Size + ); + ASSERT_EFI_ERROR (Status); + + MmSpiNorRes =3D (EFI_MM_COMMUNICATE_SPINOR_RES *)&mEfiMmSpiNorReq.PayLoa= d; + if (MmSpiNorRes->Status !=3D MM_SPINOR_RES_SUCCESS) { + DEBUG (( + DEBUG_ERROR, + "%a: Read context failed: 0x%llx\n", + __FUNCTION__, + MmSpiNorRes->Status + )); + return EFI_DEVICE_ERROR; + } + + /* + * If failsafe context is valid, and: + * - The status indicate non-failure, then don't clear it + * - The status indicate a failure, then go and clear it + */ + if (FailSafeValidCRC (&FailSafeBuf) + && !FailSafeFailureStatus (FailSafeBuf.Status)) { + return EFI_SUCCESS; + } + + MmData[0] =3D MM_SPINOR_FUNC_ERASE; + MmData[1] =3D FailSafeStartOffset; + MmData[2] =3D FailSafeSize; + UefiMmCreateSpiNorReq ((VOID *)&MmData, sizeof (MmData)); + + Size =3D sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status =3D mFlashLibMmCommProtocol->Communicate ( + mFlashLibMmCommProtocol, + (VOID *)&mEfiMmSpiNorReq, + &Size + ); + ASSERT_EFI_ERROR (Status); + + MmSpiNorRes =3D (EFI_MM_COMMUNICATE_SPINOR_RES *)&mEfiMmSpiNorReq.PayLoa= d; + if (MmSpiNorRes->Status !=3D MM_SPINOR_RES_SUCCESS) { + DEBUG (( + DEBUG_ERROR, + "%a: Erase context failed: 0x%llx\n", + __FUNCTION__, + MmSpiNorRes->Status + )); + return EFI_DEVICE_ERROR; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +FailSafeTestBootFailure ( + VOID + ) +{ + EFI_STATUS Status; + UINT32 Value =3D 0; + + /* + * Simulate UEFI boot failure due to config wrong NVPARAM for + * testing failsafe feature + */ + Status =3D NVParamGet (NV_UEFI_FAILURE_FAILSAFE_OFFSET, NV_PERM_ALL, &Va= lue); + if (!EFI_ERROR (Status) && (Value =3D=3D 1)) { + while (1) { + } + } + + 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 (#80703): https://edk2.groups.io/g/devel/message/80703 Mute This Topic: https://groups.io/mt/85631128/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 Thu Apr 25 11:35:07 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+80705+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+80705+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721569057732.9048307226573; Wed, 15 Sep 2021 08:59:29 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id OxXSYY1788612xu0EZ0pQFrE; Wed, 15 Sep 2021 08:59:28 -0700 X-Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.131]) by mx.groups.io with SMTP id smtpd.web12.10032.1631721567789808902 for ; Wed, 15 Sep 2021 08:59:27 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A23VHLZqjMPky6QiDq1h05Ewg4gZ5Zo9vD+y5LmEnFGiiVFAagU4ebNBL+cSBWX+7CAo4olQgngNTWXrCd7FoR+vRyau/KrXpH8LtN7NdkzWWVzDCkxIzRfJXwPUZEnRVduuYe6TFi3oNCzr3ZCuWyu7rXHfQOrq1wL/B0ELwxBhrasXT8RDIpZGtv+oXfvWhuJgL6WU8GQPde+EqEuaYfBdAlqwh6jGS7faSUQiWgb4MjpcJsf4z6Scv3xhTDucai3Bif/TwxN9i+f7upSkDalITUvUzJYyFgFHk+u9UNDj6UPl5ad90aBLbqP1YVTDdSa4LWv46M8URTsa2VCyqw== 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; bh=68j/3IKT8UYDTRdL5F2sak9r95PLew4cVrkXXY2qH14=; b=iy8C5aVaRQLu8IPFxKTAcsmZiRVxkoYPiNXcz4tJY2kS02SmxUJlnKy8UxQolBGpeMQFM2OWxc9QeSOgU5urxYLrCx1U12bMuuOwss43ntMYeTmJRNWf3a0ZfqXHirQOv6RXLjtwOU/rdRgjIpsVu105cHMpQf9z/8Jzb0wYr3R1XWVRBhZoBEfUHPWjTP5vXvGcvojpTpsEB5CeFCVG3bi/7ADzERsOtHL22+bT7zthuTE1BA3y+8r/bZHP7J7GgzxSq8nNfxd+Pndw8KHta/+pkh+CfLKEDCH2MNM6xhr0j/ZUmb1/CqEw9CSNTNKK6SE+1VRF1ypz4T7czo9cTg== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM6PR01MB5513.prod.exchangelabs.com (2603:10b6:5:151::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.17; Wed, 15 Sep 2021 15:59:26 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 15:59:26 +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] [PATCH v3 04/28] AmperePlatformPkg: Add FailSafe and WDT support Date: Wed, 15 Sep 2021 22:55:03 +0700 Message-ID: <20210915155527.8176-5-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 15:59:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f3a41fa2-8be2-42c9-1562-08d97861ca80 X-MS-TrafficTypeDiagnostic: DM6PR01MB5513: X-MS-Exchange-Transport-Forked: True 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: 6dnkhXmwkuaDrh/222xgKOrWVj8d1I14CVDgxTGsBNZXLHa5t3HPVW36/EJ7mnD13FAMQfTiOYi+uJtZr7TaB5oOeZC48yq330knimscrUMiyR/rwggw6gScF3yr4po3R6rgVkGv8u4r+pMM7SJTWeSQTQvCNDAqdpt1Fb+yI9Uyfsn6AvYi//0rQ67myZw/jl+2Z3LBdXuD5h0ivwXBD7ERBvGs50dUhzYw1Yw1kliNN/HRVQPoGMn1rJaWCqQLx4ifksIrjnSbyDi3LO6w8v2QGSebG0/mdc4hRo1OGhTYzdDsVNiOqtjcWjku3uvJo3tzyNroie8ZA1RMbYCmnnb+E9O3mo+u/87ofqla54QOSAOUWshDC9ASJPBJIuyatZefx23Uv9GnRt1bhurWR+eQ2PoaVqi/pEiyI8/lai4NMRbdnNybXWMkTLlWjXcrAjOL/8eYgEWCZSPux9479C25AzcHqG1dFUD/ijpLMjqI5ctk+mwTWMKMr9txuVOURNahTLb6dXkQck4uITj1qsdBWcwBK5PY9ePFsAQ0c1aJX+u2gmCOJY+79tgaYuz8tm6ZyHQyAMsb4/4rXsHKRH+Az2yrYfxIgFuCK+MZAV2CFA0UeeF5vUWu3nfnGGzlAVMkTGQxQSCeLBoHAnSGfCFx4PldSOti29BEUHq3uUuly8yLu7FRQ53Y5AA/WTIqwhy3k2bJ2lLjaXKHFrb7XkTwFgRQW03Lpaxos7XV4n4= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?wsQw17bW8+4nZ1P708s8dj9AlhlqwG36KsAX3Y3myk8uh+jzsduX4uODhAkx?= =?us-ascii?Q?bU1+nQvcBdtvb0wRXV6hFrDYh83DYLHKQmBXb6kmf53Hz9Q1RrIyzEl+HWh8?= =?us-ascii?Q?UJOEwGlq/bdVTDmnAwWNbEbNknXHmirr3ZgjP4zSaMEz4/z67msxJFuF+f2T?= =?us-ascii?Q?qj46qyqTWu/Pm6LWjbzcqNXeuEAkcmGw5vllJ3xjpv22VevA9oxZ1i4oo6Lr?= =?us-ascii?Q?W54DsB4xKbxQQXROoXy9b02ZaBvFfPu+Wt6LzgANsHqo4L1SWvxTZQIQatd0?= =?us-ascii?Q?NS7M2IkcuJrR35bw/jSchMVMk8XsZAGhbFjhBJH9t+Thrty7J2YvH4z/4RQ3?= =?us-ascii?Q?2j+yMvNe+ggstC035ejskLA9d+b5WDBSG5TyQCptL1AlQTZUQ48n6PF6v9Fc?= =?us-ascii?Q?ij/sBeIb5NnvMEdaVhyZgGxhIOTeI+qfhT3gzmqne+0tLsOlQtTBhIVP6hbi?= =?us-ascii?Q?iZXWZi2NnlN16JoI7Pn3dE00dcnOE5vZzmZN/iThCIkQzzUJsAlN0uZ1EXTf?= =?us-ascii?Q?7ZsysjwEUP06s7vjHciG/KiYnMXt8RAaxkvi+d9MmTNGbPhi/aeazS17uzOW?= =?us-ascii?Q?LhP9ghNZy8J+S/0YNsW+J0VHJXG4qKHO4TxeetklMP47pb/b+4ZQeaoQFLqF?= =?us-ascii?Q?sucJtWRK+psCnpIJScLZpo8OOHZCmYF6qQVSnBZViAv4Jemz8vGa8wzMeoDx?= =?us-ascii?Q?YDN6UGhSImt2TtePTVxe7eOnBCUW5D3o0vEwgbsmxCywb68mkf9rzhDRVso/?= =?us-ascii?Q?aZlQL2ElwmaKbaDE3pmwUIm1cmeVc9ILOLmBv2lVZIe9bjdS2ylUOAYVSLq6?= =?us-ascii?Q?cIg+PDgS/PdpYt/p0YQqOKlRXWb//STUIajReOOpEfJpI4v1MfI+N2j8UCt1?= =?us-ascii?Q?jGIKqNqYCtmEN0jDC75uF8XOXINddo/ZKneAHxGIcZfVcP9LAjVtPc93WSJP?= =?us-ascii?Q?PGcsQvIHtvM3a4lD+h0aIP2iKhzi5VQ35qprpYfabban7pKnDcSoqtSng+pn?= =?us-ascii?Q?NKdryw9jN/eeWnehQXNqui76TLLPJH7KGHgF9rysmcimcN3qv/jLPHUptsZZ?= =?us-ascii?Q?vLb8og9pmKpYvKBkzbj3MtARhw6W9/Kv1OCuWVe1u0qdymyGYTFcn4qyqK6Q?= =?us-ascii?Q?gaWsS/mCPEYphSfcwVcwJxyHxl+zQFmdz1R11MLUmPN18gLq1VaewMKf4f+a?= =?us-ascii?Q?lVQf+kHJFNpjglRiw6ejIj7X/0L5VidjWBvgy7IK8pVCiXhgBT/dSaBSOPHG?= =?us-ascii?Q?0vtYgFuNvKHSdrGEj63Uy2ZO21koirSBxqv9+i/Gcr+Yf2mu70xTji4Td+UE?= =?us-ascii?Q?h7i/9QgAIUOaX0CSadqjVSuD?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3a41fa2-8be2-42c9-1562-08d97861ca80 X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 15:59:25.9255 (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: liVBCYGGakg9S2Eqlg/mGnG3qAZ5ikcWqNPuVEDXC2t5iaK1gqDYzyXOfg3DpTl2nGT/yWhFFpdGnRmX20uVQ2aaYmevmS7nUrG85ahBC3E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR01MB5513 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: wwgIl4zJYEzAd7g6NCEci6sux1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721568; bh=5l76zM+i2OvfvOKyKg/4RKU5K29RgyYsM45drtnkU6g=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=jYloS/e+yoXrZs6N3DZHsoyWRU4vRscBeIasf+SmlOgg+Vm9mr7SwTx16Hj+5cNYTin XiMpFoDuw48kizBir1ONwOIlPxGuafwfyhzNIBFN4ZVKD7A/NQD2ESZ68O1/Z1wqh0EVl RFxDOICS4Hn+aDUsYs37NAcQsijeb+RS4cs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721569784100010 Content-Type: text/plain; charset="utf-8" The FailSafeDxe is a driver for the FailSafe feature which reverts the system's configuration to known good values if the system fails to boot up multiple times. Also, this driver implements the Watchdog Timer Architectural Protocol to reset the system if it hangs, which is implemented by the MdeModulePkg/Universal/WatchdogTimerDxe module. So, the WDT is now used exclusively by the FailSafeDxe. By default, when system starts, it configures the secure watchdog timer with a default value of 5 minutes. If the system boots up cleanly to the considered good stage, the counter is cleared as it indicates FailSafe monitor (ATF) that has booted up successfully. If the timer expires, it is considered a failed boot and the system is rebooted. 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.dsc | = 9 + Platform/Ampere/JadePkg/Jade.fdf | = 6 +- Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe.inf | 5= 4 +++ Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafe.h | 2= 0 ++ Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/Watchdog.h | 2= 9 ++ Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe.c | 18= 4 ++++++++++ Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/Watchdog.c | 35= 7 ++++++++++++++++++++ 8 files changed, 658 insertions(+), 2 deletions(-) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index 7dadf15b7825..89c143cd28e6 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -593,7 +593,6 @@ [Components.common] # Timer # ArmPkg/Drivers/TimerDxe/TimerDxe.inf - MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf =20 # # ARM GIC Dxe diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index 1e580b5c4904..0681835dd175 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -77,6 +77,11 @@ [LibraryClasses] # RealTimeClockLib|EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualReal= TimeClockLib.inf =20 + # + # Library for FailSafe support + # + FailSafeLib|Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSa= feLib.inf + ##########################################################################= ###### # # Specific Platform Pcds @@ -100,3 +105,7 @@ [PcdsFixedAtBuild.common] # ##########################################################################= ###### [Components.common] + # + # FailSafe and Watchdog Timer + # + Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe.inf diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index 905289844378..80a86d7c1156 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -185,7 +185,11 @@ [FV.FvMain] # Timer # INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf - INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf + + # + # FailSafe and Watchdog Timer + # + INF Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe.inf =20 # # ARM GIC Dxe diff --git a/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafe= Dxe.inf b/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe= .inf new file mode 100644 index 000000000000..60de10c95c85 --- /dev/null +++ b/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe.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 FailSafeDxe + FILE_GUID =3D 7BC4F970-B1CF-11E6-80F5-76304DEC7EB7 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D FailSafeDxeEntryPoint + +[Sources] + FailSafe.h + FailSafeDxe.c + Watchdog.c + Watchdog.h + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Platform/Ampere/AmperePlatformPkg/AmperePlatformPkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + ArmSmcLib + DebugLib + FailSafeLib + NVParamLib + PcdLib + TimerLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + UefiRuntimeServicesTableLib + +[Pcd] + gArmTokenSpaceGuid.PcdGenericWatchdogControlBase + gArmTokenSpaceGuid.PcdGenericWatchdogEl2IntrNum + +[Protocols] + gEfiWatchdogTimerArchProtocolGuid ## PRODUCES + gHardwareInterrupt2ProtocolGuid ## CONSUMES + +[Depex] + gHardwareInterrupt2ProtocolGuid diff --git a/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafe= .h b/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafe.h new file mode 100644 index 000000000000..8bf3a98f1d8e --- /dev/null +++ b/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafe.h @@ -0,0 +1,20 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef FAILSAFE_H_ +#define FAILSAFE_H_ + +#include + +BOOLEAN +EFIAPI +IsFailSafeOff ( + VOID + ); + +#endif /* FAILSAFE_H_ */ diff --git a/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/Watchdog= .h b/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/Watchdog.h new file mode 100644 index 000000000000..6c9106fdbea5 --- /dev/null +++ b/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/Watchdog.h @@ -0,0 +1,29 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef GENERIC_WATCHDOG_H_ +#define GENERIC_WATCHDOG_H_ + +#include + +/* The number of 100ns periods (the unit of time passed to these functions) + in a second */ +#define TIME_UNITS_PER_SECOND 10000000 + +/** + The function to install Watchdog timer protocol to the system + + @retval Return EFI_SUCCESS if install Watchdog timer protocol s= uccessfully. + **/ +EFI_STATUS +EFIAPI +WatchdogTimerInstallProtocol ( + EFI_WATCHDOG_TIMER_ARCH_PROTOCOL **WatchdogTimerProtocol + ); + +#endif /* GENERIC_WATCHDOG_H_ */ diff --git a/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafe= Dxe.c b/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe.c new file mode 100644 index 000000000000..4e4aab9e5353 --- /dev/null +++ b/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe.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 +#include +#include + +#include "FailSafe.h" +#include "Watchdog.h" + +STATIC UINTN gWatchdogOSTimeout; +STATIC BOOLEAN gFailSafeOff; +STATIC EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *gWatchdogTimer; + +EFI_STATUS +EFIAPI +FailSafeTestBootFailure ( + VOID + ); + +STATIC VOID +FailSafeTurnOff ( + VOID + ) +{ + EFI_STATUS Status; + + if (IsFailSafeOff ()) { + return; + } + + Status =3D FailSafeBootSuccessfully (); + ASSERT_EFI_ERROR (Status); + + gFailSafeOff =3D TRUE; + + /* Disable Watchdog timer */ + gWatchdogTimer->SetTimerPeriod (gWatchdogTimer, 0); +} + +BOOLEAN +EFIAPI +IsFailSafeOff ( + VOID + ) +{ + return gFailSafeOff; +} + +/** + The function to disable Watchdog timer when enter Setup screen + **/ +VOID +WdtTimerEnterSetupScreenCallback ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + /* Make sure FailSafe is turned off */ + FailSafeTurnOff (); +} + +/** + The function to refresh Watchdog timer in the event before booting + **/ +VOID +WdtTimerBeforeBootCallback ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + /* + * At this point, the system is considered boot successfully to BIOS + */ + FailSafeTurnOff (); + + /* + * It is BIOS's responsibility to setup Watchdog when load an EFI applic= ation + * after this step + */ +} + +/** + The function to refresh Watchdog timer in the event before exiting boot = services + **/ +VOID +WdtTimerExitBootServiceCallback ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + + /* Enable Watchdog timer for OS booting */ + if (gWatchdogOSTimeout !=3D 0) { + gWatchdogTimer->SetTimerPeriod ( + gWatchdogTimer, + gWatchdogOSTimeout * TIME_UNITS_PER_SECOND + ); + } else { + /* Disable Watchdog timer */ + gWatchdogTimer->SetTimerPeriod (gWatchdogTimer, 0); + } +} + +/** + This function is a hook called when user loads the manufacturing + or optimal defaults. + + @param Defaults : (NVRAM_VARIABLE *)optimal or manufacturing + @Data : Messagebox + + @retval VOID +**/ +VOID +LoadNVRAMDefaultConfig ( + IN VOID *Defaults, + IN UINTN Data + ) +{ + NVParamClrAll (); +} + +/** + Main entry for this driver. + + @param ImageHandle Image handle this driver. + @param SystemTable Pointer to SystemTable. + + @retval EFI_SUCESS This function always complete successfully. + +**/ +EFI_STATUS +EFIAPI +FailSafeDxeEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_EVENT ExitBootServicesEvent; + EFI_STATUS Status; + + gFailSafeOff =3D FALSE; + + FailSafeTestBootFailure (); + + /* We need to setup non secure Watchdog to ensure that the system will + * boot to OS successfully. + * + * The BIOS doesn't handle Watchdog interrupt so we expect WS1 asserted = EL3 + * when Watchdog timeout triggered + */ + + Status =3D WatchdogTimerInstallProtocol (&gWatchdogTimer); + ASSERT_EFI_ERROR (Status); + + // We should register a callback function before entering to Setup screen + // rather than always call it at DXE phase. + FailSafeTurnOff (); + + /* Register event before exit boot services */ + Status =3D gBS->CreateEvent ( + EVT_SIGNAL_EXIT_BOOT_SERVICES, + TPL_NOTIFY, + WdtTimerExitBootServiceCallback, + NULL, + &ExitBootServicesEvent + ); + ASSERT_EFI_ERROR (Status); + + return Status; +} diff --git a/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/Watchdog= .c b/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/Watchdog.c new file mode 100644 index 000000000000..34329d04206a --- /dev/null +++ b/Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/Watchdog.c @@ -0,0 +1,357 @@ +/** @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 "FailSafe.h" +#include "Watchdog.h" + +/* Watchdog timer controller registers */ +#define WDT_CTRL_BASE_REG FixedPcdGet64 (PcdGenericWat= chdogControlBase) +#define WDT_CTRL_WCS_OFF 0x0 +#define WDT_CTRL_WCS_ENABLE_MASK 0x1 +#define WDT_CTRL_WOR_OFF 0x8 +#define WDT_CTRL_WCV_OFF 0x10 +#define WS0_INTERRUPT_SOURCE FixedPcdGet32 (PcdGenericWat= chdogEl2IntrNum) + +STATIC UINT64 mNumTimerTicks; +STATIC EFI_HARDWARE_INTERRUPT2_PROTOCOL *mInterruptProtocol; +BOOLEAN mInterruptWS0Enabled; + +STATIC +VOID +WatchdogTimerWriteOffsetRegister ( + UINT32 Value + ) +{ + MmioWrite32 (WDT_CTRL_BASE_REG + WDT_CTRL_WOR_OFF, Value); +} + +STATIC +VOID +WatchdogTimerWriteCompareRegister ( + UINT64 Value + ) +{ + MmioWrite64 (WDT_CTRL_BASE_REG + WDT_CTRL_WCV_OFF, Value); +} + +STATIC +EFI_STATUS +WatchdogTimerEnable ( + IN BOOLEAN Enable + ) +{ + UINT32 Val =3D MmioRead32 ((UINTN)(WDT_CTRL_BASE_REG + WDT_CTRL_WCS_OFF= )); + + if (Enable) { + Val |=3D WDT_CTRL_WCS_ENABLE_MASK; + } else { + Val &=3D ~WDT_CTRL_WCS_ENABLE_MASK; + } + MmioWrite32 ((UINTN)(WDT_CTRL_BASE_REG + WDT_CTRL_WCS_OFF), Val); + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS +WatchdogTimerSetup ( + VOID + ) +{ + EFI_STATUS Status; + + /* Disable Watchdog timer */ + WatchdogTimerEnable (FALSE); + + if (!mInterruptWS0Enabled) { + Status =3D mInterruptProtocol->EnableInterruptSource ( + mInterruptProtocol, + WS0_INTERRUPT_SOURCE + ); + ASSERT_EFI_ERROR (Status); + + mInterruptWS0Enabled =3D TRUE; + } + + if (mNumTimerTicks =3D=3D 0) { + return EFI_SUCCESS; + } + + /* If the number of required ticks is greater than the max the Watchdog's + offset register (WOR) can hold, we need to manually compute and set + the compare register (WCV) */ + if (mNumTimerTicks > MAX_UINT32) { + /* We need to enable the Watchdog *before* writing to the compare regi= ster, + because enabling the Watchdog causes an "explicit refresh", which + clobbers the compare register (WCV). In order to make sure this doe= sn't + trigger an interrupt, set the offset to max. */ + WatchdogTimerWriteOffsetRegister (MAX_UINT32); + WatchdogTimerEnable (TRUE); + WatchdogTimerWriteCompareRegister (ArmGenericTimerGetSystemCount () + = mNumTimerTicks); + } else { + WatchdogTimerWriteOffsetRegister ((UINT32)mNumTimerTicks); + WatchdogTimerEnable (TRUE); + } + + return EFI_SUCCESS; +} + + +/* This function is called when the Watchdog's first signal (WS0) goes hig= h. + It uses the ResetSystem Runtime Service to reset the board. +*/ +VOID +EFIAPI +WatchdogTimerInterruptHandler ( + IN HARDWARE_INTERRUPT_SOURCE Source, + IN EFI_SYSTEM_CONTEXT SystemContext + ) +{ + STATIC CONST CHAR16 ResetString[]=3D L"The generic Watchdog timer ran ou= t."; + + mInterruptProtocol->EndOfInterrupt (mInterruptProtocol, Source); + + if (!IsFailSafeOff ()) { + /* Not handling interrupt as ATF is monitoring it */ + return; + } + + WatchdogTimerEnable (FALSE); + + gRT->ResetSystem ( + EfiResetCold, + EFI_TIMEOUT, + StrSize (ResetString), + (VOID *)&ResetString + ); + + /* If we got here then the reset didn't work */ + ASSERT (FALSE); +} + +/** + This function registers the handler NotifyFunction so it is called every= time + the Watchdog timer expires. It also passes the amount of time since the= last + handler call to the NotifyFunction. + If NotifyFunction is not NULL and a handler is not already registered, + then the new handler is registered and EFI_SUCCESS is returned. + If NotifyFunction is NULL, and a handler is already registered, + then that handler is unregistered. + If an attempt is made to register a handler when a handler is already + registered, then EFI_ALREADY_STARTED is returned. + If an attempt is made to unregister a handler when a handler is not + registered, then EFI_INVALID_PARAMETER is returned. + + @param This The EFI_TIMER_ARCH_PROTOCOL instance. + @param NotifyFunction The function to call when a timer interrupt fir= es. + This function executes at TPL_HIGH_LEVEL. The D= XE + Core will register a handler for the timer inte= rrupt, + so it can know how much time has passed. This + information is used to signal timer based event= s. + NULL will unregister the handler. + + @retval EFI_UNSUPPORTED The code does not support NotifyFunction. + +**/ +EFI_STATUS +EFIAPI +WatchdogTimerRegisterHandler ( + IN CONST EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, + IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction + ) +{ + /* Not support. Watchdog will reset the board */ + return EFI_UNSUPPORTED; +} + +/** + This function sets the amount of time to wait before firing the Watchdog + timer to TimerPeriod 100ns units. If TimerPeriod is 0, then the Watchdog + timer is disabled. + + @param This The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance. + @param TimerPeriod The amount of time in 100ns units to wait before + the Watchdog timer is fired. If TimerPeriod is = zero, + then the Watchdog timer is disabled. + + @retval EFI_SUCCESS The Watchdog timer has been programmed to = fire + in Time 100ns units. + @retval EFI_DEVICE_ERROR A Watchdog timer could not be programmed d= ue + to a device error. + +**/ +EFI_STATUS +EFIAPI +WatchdogTimerSetPeriod ( + IN CONST EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, + IN UINT64 TimerPeriod // In 100ns units + ) +{ + mNumTimerTicks =3D (ArmGenericTimerGetTimerFreq () * TimerPeriod) / TIM= E_UNITS_PER_SECOND; + + if (!IsFailSafeOff ()) { + /* Not support Watchdog timer service until FailSafe is off as ATF is = monitoring it */ + return EFI_SUCCESS; + } + + return WatchdogTimerSetup (); +} + +/** + This function retrieves the period of timer interrupts in 100ns units, + returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPer= iod + is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 = is + returned, then the timer is currently disabled. + + @param This The EFI_TIMER_ARCH_PROTOCOL instance. + @param TimerPeriod A pointer to the timer period to retrieve in + 100ns units. If 0 is returned, then the timer is + currently disabled. + + + @retval EFI_SUCCESS The timer period was returned in TimerPeri= od. + @retval EFI_INVALID_PARAMETER TimerPeriod is NULL. + +**/ +EFI_STATUS +EFIAPI +WatchdogTimerGetPeriod ( + IN CONST EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, + OUT UINT64 *TimerPeriod + ) +{ + if (TimerPeriod =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + *TimerPeriod =3D ((TIME_UNITS_PER_SECOND / ArmGenericTimerGetTimerFreq (= )) * mNumTimerTicks); + + return EFI_SUCCESS; +} + +/** + Interface structure for the Watchdog Architectural Protocol. + + @par Protocol Description: + This protocol provides a service to set the amount of time to wait + before firing the Watchdog timer, and it also provides a service to + register a handler that is invoked when the Watchdog timer fires. + + @par When the Watchdog timer fires, control will be passed to a handler + if one has been registered. If no handler has been registered, + or the registered handler returns, then the system will be + reset by calling the Runtime Service ResetSystem(). + + @param RegisterHandler + Registers a handler that will be called each time the + Watchdogtimer interrupt fires. TimerPeriod defines the minimum + time between timer interrupts, so TimerPeriod will also + be the minimum time between calls to the registered + handler. + NOTE: If the Watchdog resets the system in hardware, then + this function will not have any chance of executing. + + @param SetTimerPeriod + Sets the period of the timer interrupt in 100ns units. + This function is optional, and may return EFI_UNSUPPORTED. + If this function is supported, then the timer period will + be rounded up to the nearest supported timer period. + + @param GetTimerPeriod + Retrieves the period of the timer interrupt in 100ns units. + +**/ +STATIC EFI_WATCHDOG_TIMER_ARCH_PROTOCOL gWatchdogTimer =3D { + (EFI_WATCHDOG_TIMER_REGISTER_HANDLER)WatchdogTimerRegisterHandler, + (EFI_WATCHDOG_TIMER_SET_TIMER_PERIOD)WatchdogTimerSetPeriod, + (EFI_WATCHDOG_TIMER_GET_TIMER_PERIOD)WatchdogTimerGetPeriod +}; + +EFI_STATUS +EFIAPI +WatchdogTimerInstallProtocol ( + EFI_WATCHDOG_TIMER_ARCH_PROTOCOL **WatchdogTimerProtocol + ) +{ + EFI_STATUS Status; + EFI_HANDLE Handle; + EFI_TPL CurrentTpl; + + /* Make sure the Watchdog Timer Architectural Protocol has not been inst= alled + in the system yet. + This will avoid conflicts with the universal Watchdog */ + ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiWatchdogTimerArchProtocolG= uid); + + ASSERT (ArmGenericTimerGetTimerFreq () !=3D 0); + + /* Install interrupt handler */ + Status =3D gBS->LocateProtocol ( + &gHardwareInterrupt2ProtocolGuid, + NULL, + (VOID **)&mInterruptProtocol + ); + ASSERT_EFI_ERROR (Status); + + /* + * We don't want to be interrupted while registering Watchdog interrupt = source as the interrupt + * may be trigger in the middle because the interrupt line already enabl= ed in the EL3. + */ + CurrentTpl =3D gBS->RaiseTPL (TPL_HIGH_LEVEL); + + Status =3D mInterruptProtocol->RegisterInterruptSource ( + mInterruptProtocol, + WS0_INTERRUPT_SOURCE, + WatchdogTimerInterruptHandler + ); + ASSERT_EFI_ERROR (Status); + + /* Don't enable interrupt until FailSafe off */ + mInterruptWS0Enabled =3D FALSE; + Status =3D mInterruptProtocol->DisableInterruptSource ( + mInterruptProtocol, + WS0_INTERRUPT_SOURCE + ); + ASSERT_EFI_ERROR (Status); + + gBS->RestoreTPL (CurrentTpl); + + Status =3D mInterruptProtocol->SetTriggerType ( + mInterruptProtocol, + WS0_INTERRUPT_SOURCE, + EFI_HARDWARE_INTERRUPT2_TRIGGER_LEVEL_HIGH + ); + ASSERT_EFI_ERROR (Status); + + /* Install the Timer Architectural Protocol onto a new handle */ + Handle =3D NULL; + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &Handle, + &gEfiWatchdogTimerArchProtocolGuid, + &gWatchdogTimer, + NULL + ); + ASSERT_EFI_ERROR (Status); + + mNumTimerTicks =3D 0; + + if (WatchdogTimerProtocol !=3D NULL) { + *WatchdogTimerProtocol =3D &gWatchdogTimer; + } + + 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 (#80705): https://edk2.groups.io/g/devel/message/80705 Mute This Topic: https://groups.io/mt/85631133/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 Thu Apr 25 11:35:07 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+80706+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+80706+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721573342944.8308987092848; Wed, 15 Sep 2021 08:59:33 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id bYdVYY1788612xW5yoPLdSsj; Wed, 15 Sep 2021 08:59:32 -0700 X-Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.91]) by mx.groups.io with SMTP id smtpd.web08.10070.1631721571896610643 for ; Wed, 15 Sep 2021 08:59:32 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YlN4g/JPgWQUmXPuWcpdFoLBbd0bzLPDpQOQ3orgcYKRoc0UM6zoH262mw3939+sljPCoPihnX3r6fDakqOBEk7eYKEdmRUrX/ACn6iIxjobffb37w9W3topEh04r2qazjTcfRCZQ4Nc1qW7wDdpcGR50zZ3ZZzrNfPvGLsp5yYdRCIUD9wPPjaoosPdRAxjsYhF5tlcSZo1ouR1RhZkJtjg4pFT31HK+yp5SZJ022qRs6HwbXBsy6xKb19YXB27EyOE8rhuxAk7nBYSfNhIG4StnCG+SpEHkJWJr9EuuPnH8UhoTATpON9hzMO24a6cXGUQQIw3XtamifN3V7i4mg== 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; bh=ICGt2OYNsFf3Basb/jdLpq6+L0Vu2fw8thwwum+6cik=; b=TK6mQL6/PRTAaUsWgCzQtj+pubeVnk8MElCBkgd1XsJFoUzyV7MCo8ac8JDuEKfwReq2G/T1omMTjt+IVQ0VKRemVaFjnc32oBfChLPZRKGy064Xs6rz72Na6NG3C+ICaCn9zPUUDVHktTL7B5VXO+ClS2HAIQkdidxBflH/cUKAPEUxvvFWGJPmq1H1TsAhmGrvLUnGV6jefcsHfS7Nr2y2kc2Bt9b7cdmaRwrAFfG1Un29oBSsMi+mAYiBUbsGiy3V8WCLUY3L2a293vBnPZtGDCHh415GJpj5F6vwHaDI2ipmCcIOtjcYD42Fahoi2z1lm3fmCEiWER+YeaMXQA== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM6PR01MB5513.prod.exchangelabs.com (2603:10b6:5:151::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.17; Wed, 15 Sep 2021 15:59:29 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 15:59:29 +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] [PATCH v3 05/28] AmpereAltraPkg: Add DwI2cLib library Date: Wed, 15 Sep 2021 22:55:04 +0700 Message-ID: <20210915155527.8176-6-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 15:59:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 77650048-256a-4b38-61ac-08d97861ccc0 X-MS-TrafficTypeDiagnostic: DM6PR01MB5513: X-MS-Exchange-Transport-Forked: True 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: HWcHGgfi9e4JbHEsOGV3cEpxG77TZ0hlwujdqofFERl/rkP8PEtQYa28QBK+wDCsFYq3JojWGvfUkV/toamQYlkwp8DTn3C7RY8ANgtTOwuxuRS9ZDqcVBjSY+8SWavHR9d2+lrVGKHyM1PvZtdd+y3c11FjRlcLo+BMHu2RCaXFuiyRocaGu/NA0UOzG19A703IuWLccaUt0KMN13IVuJ7TIMvDIBgxX0SJ3OP4yz5dFzirB9xZc5N0BWZPtw095v2RWYcrx+Q9k1ylz5a/KyxszQjPZnKcsXhWpzPigkcfBxeZPiGsSyBGbqGRURG4x33lSa2KjjWOVrtsqmAhy0BYN6/SqQ4iPWwqLQf1wbitBSWfx0/N+7+sSuLg9jUk4B4NEevAaYl2+wvTz4zkGUrMaAaNAAl4CoDXivUs8yVd0umtVOh/8GZWpQYwvrlEdJ6ejXu66S1mQNViKVb+gNFjsYkL/qX7ercytgYEKhFBGD6iRM2fmsU74gzQXfh/HL6c4Hud7hqTvHlyTLfvAzU0fYjdHTDDBQy7os1FAyLIqywz+hI+IEMzeiGYclaPKwywGg+GpBPPjb/mt5+DOZ15AokjuEmXwTjOaezmwSf+LJ3uZi7CGyhNV+JcGtwqEGzEvqn73CoaP0SJ+Nhf8HdkERPnW1gpzDfwUvGkW17yQqwXACKF8x6zPX9ucDQlruprPOhxcw4uYXvfN+/ljA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?NrDTe7ml1VQ8jnfTaUXdkFN6M1v8C91w3bosvOnbFAGpg9aw207OXseHuURB?= =?us-ascii?Q?FpUkc/oZdj061FmRLIpxPVvr9IdsZQputimcVpVGAi5wXXr/14t+4yKJq4He?= =?us-ascii?Q?utr8Uz8qpQ5qZxOlwBcZSIRpKpDxcpml+VmQ/zb5H2IpK7+d7jX/Y299g9ca?= =?us-ascii?Q?2TowQZlLGrM8I2DjtdLR5Ih7KIgTGfHazGEbodrnHhAdhLqDYDfrCC5EMylQ?= =?us-ascii?Q?H6B+WwprNhaWJs4WBNtAnwB1pG3d5HJGTVh75718hZxAv6hjM9h59kCRwsZS?= =?us-ascii?Q?/6FsO1nAmUjNr8lX1xu+Xs41PQWJJpZHdbHXfPa5kOcJf/yUt3/a/Rl2X2GS?= =?us-ascii?Q?kX+KoUvFIXsdSKZMieP0WUG3V9qbQuWNRnp7ftm8n2fA+wsFWKPy6Gy8ik11?= =?us-ascii?Q?xZMBidJP1kfgcdnHR4vcFmNEmpVZWjMHcXtu/Wint7xfMWQrzCpGJeqncxTF?= =?us-ascii?Q?ItZkWMel9AWtpzicAfkb59Yd1tkpLqUT4HFGxDp5AyhgHdYnj+OEG44EhwUv?= =?us-ascii?Q?Ij/fmcEBU9Dd0TPuorIu0vTrEuFu1VFVS/zN/HWsd2ORPnJT8L2K8fx4pOhl?= =?us-ascii?Q?f1SHMQ8z/mEYn8kqJfUUP2GehS/DZw0at68F63kpBl92fQgSp/p9Yx7nINpI?= =?us-ascii?Q?LRDyFKNbCBdxo3ShVxjl2KRXK0bimqY09Z4rzC4jaoyRCnGGhGSX/EBUaYVt?= =?us-ascii?Q?Phb9ffLQohqcE23fh324y5/rW95XwXnrTXjzbWE8rDQPMMIdTmIPbXc73RDO?= =?us-ascii?Q?Gp2aA6AXZmDYLDQPBecAgWphqLgXM8mxhcggCdPHGa3JLH9SBsn9Z6RcpYUs?= =?us-ascii?Q?FM7oR1Dx3R1Q4UNicLNqi7YR1ZNSjzlGWhlVxqcLcNolV32RMjQcLyiXHx0D?= =?us-ascii?Q?erKnmqHYFJcL9efpyHmOHAiwuUEnnfomJa9OTnI5LBDhFLLskHGNReurtYmP?= =?us-ascii?Q?H/jRJpkRGH9D9vqHFtxFPhDx+OJc08fJXamwZZw/rCU49YFGZTT0VvXbdziK?= =?us-ascii?Q?KDbUdtb/wIaKrDppy4gBFxwa/oCCrCVkcp4QiwKFst4TIciq02aU28VJIIsY?= =?us-ascii?Q?/kSti3pikIozGR2Jprt7f0dFuRHsdlofpNstOY0JIrAW8MBXTkmgEnnSUUVy?= =?us-ascii?Q?+hqF0jra6vAYivalmIYx9xMFwFWgmHWpYwNg/jbC4lL0bPUY++gXV3fcOOTX?= =?us-ascii?Q?qwykMXBg5DdKwGeM9q4GKA2OK6pW7Yh47E5Gjh4HW6ca8ak9xWX6wGJpwujk?= =?us-ascii?Q?wJF56W3SxcsBhqLchiaAQhA/maFzKPRtq9TsHrY5N+sfGSpl9ShQKa7m/PpD?= =?us-ascii?Q?BbdHdbl4j/TycAEHjel8lCYx?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 77650048-256a-4b38-61ac-08d97861ccc0 X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 15:59:29.6064 (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: 4BsxZou/Ea/+wjbdOxG65TCWaQnLEtYH0Q46JfXRZaUONwcHoQB0GjieGtyENsbj3ZRqp7JcogvHUhHJJ2EhPdGW258LJ/79DXmkInPDjQE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR01MB5513 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: pSA0nLhgzDpTV0PtjuBwaYVJx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721572; bh=Pzx+iR2CtXvSS9wQiFwcNouxwzrYCmwQlUaWzWHIdD4=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=OVFAjyQuOv4hwHupcVn+unF55eFBGKsQcvfObeBY7Ai+6erJlUpIfkjTxm1nthGHW+s 2TkDdVovo0ZvUOaouWeuNrZWhp6ZdewvfFJWIyVjdGPw0cTWPlf1l40nUgNaMn/xPS0es rHYXR0s08v8hLmJc9vpECfHiPLZlXRqVn/Y= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721575474100001 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: Vu Nguyen 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/Library/DwI2cLib/DwI2cLib.c | 883 ++++++++= ++++++++++++ 4 files changed, 1024 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Amp= ere/AmpereAltraPkg/AmpereAltraPkg.dec index 73097afaf841..8be6a329bb26 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..091f5f9b310c --- /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 + gPlatformHobGuid 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/Library/DwI2cLib/DwI2cLib.c b/Si= licon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.c new file mode 100644 index 000000000000..ca89863aec69 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/DwI2cLib/DwI2cLib.c @@ -0,0 +1,883 @@ +/** @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 + +#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[MAX_PLATFORM_I2C_BUS_NUM] = =3D {FALSE}; +STATIC UINTN mI2cBaseArray[MAX_PLATFORM_I2C_BUS_NUM] =3D {PLATF= ORM_I2C_REGISTER_BASE}; +STATIC DW_I2C_CONTEXT_T mI2cBusList[MAX_PLATFORM_I2C_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 MAX_PLATFORM_I2C_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 MAX_PLATFORM_I2C_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 MAX_PLATFORM_I2C_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 < MAX_PLATFORM_I2C_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 MAX_PLATFORM_I2C_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 (&gPlatformHobGuid); + 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 (#80706): https://edk2.groups.io/g/devel/message/80706 Mute This Topic: https://groups.io/mt/85631136/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 Thu Apr 25 11:35:07 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+80707+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+80707+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721576355533.9328660624676; Wed, 15 Sep 2021 08:59:36 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ZyZzYY1788612xxqjCfnQLaM; Wed, 15 Sep 2021 08:59:35 -0700 X-Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.90]) by mx.groups.io with SMTP id smtpd.web12.10036.1631721574597518376 for ; Wed, 15 Sep 2021 08:59:34 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OhRxfdNzLdzGp66GK/Twkde2nCL4Zov6KTnNbeOYpO8V2W7akAVesFMuG9nruczsYVCPqIgi+yotSKYKglitJZ/Ozd2ZuN5wuyw9XuSxmKJSUw01cb6dgdhk7F7d8JE+v6waMPWk0sVOgMRuxwi2qjiHNGVLiSliLSJtInk4JnnT7vMDVrd7qil5YhTYh/OIkE9y+PCfaOWDhooup8Tg8HJiTuBe2hF6tzrzliTRkNpfMLQi6bZ+Z8pIOyADM6j2PdA68NEuFcRFTQaiuWmCcaPW4rL13tuYL6UDvz2fff8ZfrhhQQC+ZTiS49ZGxYKRleiYm2YPn0CRxvdjD7rUhg== 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; bh=jbQ9ue+GrnNMy72qv4vYV9xohmQOGMRu/4sjNmzUDSQ=; b=bsLnxWsB6FinqdEgA/GI/qGLPTS9NA5q7RtVnc0ROVbgSGo8SZIb2yetcD7unFD1nIRgzaSdKm3UsmXz2ghoZUHGHyT2nfP7+q8kNxueLyOIO+2Qwo8+6SIXQK6Vma72iqJER5GTb5qq//rqM22eNO+Lp1nf5i3RA9WdBKNnuj7sUl2bgjDcgf473bYASgF4zVeqLraRT9s+a9cCuascNon+r+Gp//eU6sxaWSyUwa7WC0zdqOe+Oj69mStKHdRyH8V6gPkT2ujIN5+vFDjlwOMvOydVeVDYbzVwP+LGpIUbtzb5wd27H+KBUOr5r6mWsb3KBUXxbSzGvt3Hz79O0A== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM6PR01MB5513.prod.exchangelabs.com (2603:10b6:5:151::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.17; Wed, 15 Sep 2021 15:59:33 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 15:59: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] [PATCH v3 06/28] AmpereAltraPkg: Add DwGpioLib library Date: Wed, 15 Sep 2021 22:55:05 +0700 Message-ID: <20210915155527.8176-7-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 15:59:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 25eb6396-8497-46f8-477e-08d97861cee8 X-MS-TrafficTypeDiagnostic: DM6PR01MB5513: X-MS-Exchange-Transport-Forked: True 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: zXOm4o82C/4yTMT1Ivqh48qNRl/A26dTtkyOUIvEpiCVJGijwkh5hiGa2ZsKZQzmtQtjk/PLuQ8F2eoGEr6hStrMxHw1w+f32ZgG3kJlR1ltBlHsAiR+anrw+aX38CXMspfJWJnsfS8EqbUwJIAsbwJtzBaUS/TTba95xQisvIaEa/+E1+gZa4pd81xKoTXn9XxMUOXTUF2mYMLzV3Qhx+UC4USvX9EzWeIfn/hX7we6muP1W5lYIIvoae4zl5BUlCwohYszAQtIyDWcyDWZ4wKe8rh1Pnsle7HTTIzDo3Ro+91JUrkIUURwSPzi2EYRrbYXywoKajX5E/UCTb8MBG5GatXqcMOnTB88EeEAsA0eFiFI2dyL3x98fd77NiERbYmwOpQZY6Tud8SlgxQB2cpq+2znldQN+4d0qPNawccfjm9gIE6MiSKkurp7xR3NN8Dg38r7+vBvrBARTzExi4d6Sv1GXOXTkHd7Ydddss5LMqljz7oTIHHu0o5FXdSOxVETcOs2vlMmAaMAjOafXAZHMYZWW9ajalL0Ixc7iXeZDRRVAmqXqzArQF9PFwKLH192hKIF5v5JDwzTrwojMvwhAVi8KhVY77l+IZsbiV5GatnhdRcBdnaey8MPKZ7Qvg8afRrmaVQhW3plsb+/Q2LC9ZXlovxd2h8G0Z8FlmCk8hwGHZSNvwqsjJLiF2CzDQva3YGszWClE3KYcFVOuw== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?O6pMQvv2Wqv+AGO1QVTjvtyIi3x8gVm8gQPrAcswfRC2daXQmZHrRyv14u65?= =?us-ascii?Q?A7Nm0/75+qCSBVWud294hx+IcTEia/Fdycj6eNgrRw4r3lCXslFX7GdFvjsI?= =?us-ascii?Q?GpzM11IPkVSCc1CZsulzeIyt8H+SOVT758OEfoL7h/M61LOaMHZVIgfK4bG6?= =?us-ascii?Q?lzrOTMhy2wE/g5FEZ70Zut4cx3udvaG2HrAyXkKrzL2fUmABISlctwq6NMaH?= =?us-ascii?Q?rEqy87K8Ivd/0JaW50zBYnuaBrHqXScWMMid4agebBI/5HhWE1IefOHfEeow?= =?us-ascii?Q?6Ni5oIZt3skXrgj4nh+/a7TdGhfdmvgxZa/+PsQhZyYHDrdLU2qx9mcrKjQi?= =?us-ascii?Q?rCuw8J4cko1B3Ugy5E/hrHQOETCYr9FQPEWjoe+TzQnwkk/qTEHRKRyJ4sZ8?= =?us-ascii?Q?HiL04Pzzis1pnFeIwzBN4VPm+ac9SzNj3Q1UdJTQPLKUiVeW1GS8FnxqNBNK?= =?us-ascii?Q?wT4Aq6wrXjzIFemwrdIBvFbahtw8nN6EgUpcz1on8YQL+7pKmEzW3zjDq6Fm?= =?us-ascii?Q?MMCzywk2I8RKje+TRBpDZBJIdCjuOWmGo+mMSPD/pR/D8/Bvvy3U2Dvrr/q1?= =?us-ascii?Q?EJF5efRes2qZakYkCwUn8Hw7UBYbaBxwjDXx0jE3X/eEWKifBJBY8wRqIV+q?= =?us-ascii?Q?SrcGl6TA/UXhj0wI0aD9IJq1axAkyZ4UZEYja2rCou3bJvz1wDptyu2rgpcY?= =?us-ascii?Q?L152JzQDteTYfNU4SOjFKumGUWsJTzxmCZwijTBwr1JH6dupdgNsWzG6dHcj?= =?us-ascii?Q?4hINu06NyClqwruQGa5eNErQonyt9lQGOIKsFspHOEYma8J42gCtIIEODO2v?= =?us-ascii?Q?vo1xxKUiNxzjGNdTjj8uPf1gDIsRrJs42/jdZSfcFAhU83Nrp7SHv3uK96uk?= =?us-ascii?Q?kvF89OvN/mHhvUriWjjEIUVTxplaVslcACjLiyVskzkvW8dvZrHZvwQn5D2J?= =?us-ascii?Q?PuD9AgjfLXw1A7Guz/kk1F0goWYDLL9d70BA9LoWMlG7mmDpxi+eskONKiye?= =?us-ascii?Q?O8bz+e03/LNuuJKdgrzg+Rjv4y2spmpADi2WWljMOeRZ2tPjGbG2haGwhQX2?= =?us-ascii?Q?780d7hknD4upWRRmIiczQyWytJVMtRVSCY/nT6DWx44FISPmowRHgDlk62pA?= =?us-ascii?Q?w5Lka4hxWA+zd0hrSDOZNzIR3ouVn+gZYywKvTyZc+jajdxCT/2xlhWq4iwi?= =?us-ascii?Q?lKD7B0UJDefjohNrSFeBdj6SJH+47KvVEs+xSIIBs+n/DREe298+G3g8S8PE?= =?us-ascii?Q?3GomY59qWihjQ/dChTnCpVJbeQ/X7CX9W3hDRQAtYX6RBFN41s4sZymAQhdE?= =?us-ascii?Q?d4BtdwcMPKTKmVpADQ/Dnjfb?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25eb6396-8497-46f8-477e-08d97861cee8 X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 15:59:33.2393 (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: cZ2umoG+5PvoWcHycF+r/CsSo+q1WjhMGQZXSydAliyqLVOSCO4P7ebIISd4DR46xUETonHyPlTDHtBMk5q3dmjH0bQrYbDuOs8aeL5gc0E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR01MB5513 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: ZfkafRvy3vAvRr1aIbwQ5BUYx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721575; bh=1lpOD7DMh6fKqNqAMyO9SyiSxTkCbYDrM4iDQXcA0ik=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=NeE44ewC3DEYi0np26d27sNbfc5IV28/BiLIdGzaiFE13cvg0OjOCPrROADiD5PG3Ry SYBglWQVNLIsOV+0I5zwKeX18kt+t3u1f3pBn6Llf+2skIimJ80o7fvo4yU0R1tZmH2nO ybjBkQFS5WchojGgax05mS6H2+XBWeTg7tc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721577908100007 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: Vu Nguyen 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/Library/DwGpioLib/DwGpioLib.c | 314 ++++++= ++++++++++++++ 4 files changed, 426 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Amp= ere/AmpereAltraPkg/AmpereAltraPkg.dec index 8be6a329bb26..be827dd19a96 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..cb201bc98322 --- /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_ + +enum SocGpioConfigMode { + GPIO_CONFIG_OUT_LOW =3D 0, + GPIO_CONFIG_OUT_HI, + GPIO_CONFIG_OUT_LOW_TO_HIGH, + GPIO_CONFIG_OUT_HIGH_TO_LOW, + GPIO_CONFIG_IN, + MAX_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, + UINTN 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/Library/DwGpioLib/DwGpioLib.c b/= Silicon/Ampere/AmpereAltraPkg/Library/DwGpioLib/DwGpioLib.c new file mode 100644 index 000000000000..dbb53f7d57d2 --- /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 { GPIO_DWAPB_BASE_ADDR }; +STATIC UINT64 GpiBaseAddr[] =3D { GPI_DWAPB_BASE_ADDR }; +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 GPIO_DWAPB_PINS_PER_CONTROLLER * NumberOfController= s; + + if (NumberOfControllers =3D=3D 0 || Pin >=3D TotalPins) { + return 0; + } + + return GpioBaseAddr[Pin / GPIO_DWAPB_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 % GPIO_DWAPB_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 % GPIO_DWAPB_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 % GPIO_DWAPB_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, + UINTN Mode + ) +{ + UINT32 NumberOfControllers =3D sizeof (GpioBaseAddr) / sizeof (UINT64); + UINT32 NumersOfPins =3D NumberOfControllers * GPIO_DWAPB_PINS_PER_CONTRO= LLER; + UINT32 Delay =3D 10; + + if (Mode < GPIO_CONFIG_OUT_LOW + || Mode >=3D MAX_GPIO_CONFIG_MODE + || Pin > NumersOfPins - 1 + || Pin < 0) + { + return EFI_INVALID_PARAMETER; + } + + switch (Mode) { + case GPIO_CONFIG_OUT_LOW: + GpioConfig (Pin, GPIO_OUT); + GpioWriteBit (Pin, 0); + DEBUG ((DEBUG_INFO, "GPIO pin %d configured as output low\n", Pin)); + break; + + case GPIO_CONFIG_OUT_HI: + GpioConfig (Pin, GPIO_OUT); + GpioWriteBit (Pin, 1); + DEBUG ((DEBUG_INFO, "GPIO pin %d configured as output high\n", Pin)); + break; + + case GPIO_CONFIG_OUT_LOW_TO_HIGH: + 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 GPIO_CONFIG_OUT_HIGH_TO_LOW: + 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 GPIO_CONFIG_IN: + 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 / GPIO_DWAPB_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 (#80707): https://edk2.groups.io/g/devel/message/80707 Mute This Topic: https://groups.io/mt/85631138/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 Thu Apr 25 11:35:07 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+80708+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+80708+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721582309456.4094745614225; Wed, 15 Sep 2021 08:59:42 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 9K3uYY1788612xjkvmsVNv4G; Wed, 15 Sep 2021 08:59:41 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.121]) by mx.groups.io with SMTP id smtpd.web11.9839.1631721581192250169 for ; Wed, 15 Sep 2021 08:59:41 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BQ8k6c24nkdNhVLCXx63NsAQr4D2D+aa4xFN76lPu7dOmDxVifBjkzw/gm9np2CSrMo5XZ8PCC/uxdqqso+tzU9Agu/6AQutAYNfnv+3PlGRz+KqfzC1R7M9PD/gA8bIwisjYjczRG487zVCpS9E15DScNYN4Wmxd96pjItfdKVq5ye+31vHPNuKECoXB4a/eo6Mw8Yj4eNcw4wYrzyI9QFLyQf6zlHcEdbb+u5y8/8e3/pKNCeBrJTJ2zF2icSv3v5TqZtc2uUJGZYYGdOQc1VDsxcyJX+P3XRgT9z+zQkAqzS/feeNs8XVRsweyztEtwtazQtaud63dm6kJJDMfA== 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; bh=u3ysgJ1NiXmHhT6ted83S8oDEHysOA64FW4TcOuKTX4=; b=d+ALDjv0vXUGYb/RsXgq+GAMVOXikXKTW7dfWAf4/rao+FM5aUehEjN1Ij69BNfDmFhTFP77QvzOMFh1J9bpICnC+h2rN8h3acdf7aoz6LwKInF+dv6kZyp38jmmkrDiJgwUeWzjq6t8NEd1PCT/yj59Vjmxfk6qtgZ0aYXNpr0DRwrHnuZHHJMVNXVdrQ9GmbX91IbIm1WWvH07yPLFSrYULDfBlaJFmRIt0Sznmv6neeXaraegDdPsxWd3uLqlKycAQoO6yLR1QOBg534cJAyY4BAOTGGOpIybUhxi8HiOHu+wNSQ7SvWvDobqbRFH0ZCbdQkfhjOX3KpieIi19g== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR0101MB3065.prod.exchangelabs.com (2603:10b6:4:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15; Wed, 15 Sep 2021 15:59:36 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 15:59:36 +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] [PATCH v3 07/28] JadePkg: Implement RealTimeClockLib for PCF85063 Date: Wed, 15 Sep 2021 22:55:06 +0700 Message-ID: <20210915155527.8176-8-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 15:59:33 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d410df8a-0655-44cf-2087-08d97861d10d X-MS-TrafficTypeDiagnostic: DM5PR0101MB3065: X-MS-Exchange-Transport-Forked: True 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: lJgvOKBEvjbUR2dcgLqGBQF6NWQTPyHS5g9JsXIFCdu3leL/Y/2uVUKRFB//0CkhqzPTLsQyPvQ3wr0TO1/2x05rDWjscIMTAt5f0mPVZUrXUPgFrR+QMVdlRyd5gDOfJcL5d9Aa7/3vweX7WydYT+RSQiIa60Wti2Z4xn/Grjd+854yKBy2HDAyH3ot3FhZTH95g4td4B/EthfoU9SSLugFnZu4sOr0kpvQV9hQIRstoLx8gUl5lSBtr6CuAW8MwHTiAz5A4yShRvqTYNoJiosR6pfMmo/fOTup8yCD11Mgp+bKLPOqZJU0m2Ie919u6vT4augmYazmMQVH0AdWelYNM2l3gB8lYBJR5gRt3xz8TU2jFjgoJQoTApSGblC8PtmpUlifd3/GdppLDqElC+Xzvlbp1Bkai2w6XvHiCT3waSXHW4SMS54OiDjffdCaKOoE22vzMa1xAJZYDlUcO6gNVfYjSSvaphzCYIYbd7oAJ3L/vk854x4+O26t250ucclmHqe/iMkP7rXzmGv5kvM7cMQy1GvBH7Fqu09uoci3rOodl1S7nAFS/4mBwmhjW1tWHoE+2wJx0ZcVrNVq5sIbu0H7K1TyEURvAJ0w3nkKBszR2dAFCT2cjUWQghDa9FX5LiEK19rpmrs6OesHBtbaEta5Z2GYBCG8MZPKGLzKXBjUoZmfBRXzz1NMzy9l5drGsEDCJ/jgCTIVwO+ZNA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?fg6iH6wR4dInwUwkmjHXMtHfLcGUlHu3ruxkmJIK/ctVhhnY5UusC8go9btl?= =?us-ascii?Q?p41SRgdAR2UAsfhE51hkwL+PyDWYKLGfXfIyOrpcGpyZzHfHiDFjlFLF/4Ol?= =?us-ascii?Q?3fIkdGZOZ0xYDPWGLzHWpsMHN6ihHvwpioOcrU9ky5CdAae72XrgXGzkDpF7?= =?us-ascii?Q?zMbZV0SKIcUOWYFLKUt396AzhSKnmt28Nk7Vv1LRI/xEC0dUiVkT91ZNEh3W?= =?us-ascii?Q?7cRFg1zbQYYvLlV1/80nfHh1cT780A1JvrJrJagBQ1Euq93d7cWuDNKB6XMJ?= =?us-ascii?Q?UhWkWPk1K9ho8UDjtfmKbeNw6c2C4yBXQKE4UjbLUfvDrWuObghDuH25EIau?= =?us-ascii?Q?5XIH6CAdER/4fWIjjunm5qyX+VdyKYaMKSLWsfirmAktpRpMRzcYN9RbdD4D?= =?us-ascii?Q?dkcy5hbOOfXqRfnciIF1e/+qVYyGc/Yzgj2Rn1zLFyFxls4bvQCgYEDTEnKD?= =?us-ascii?Q?jc/+p410FaKzypWf51XvyJeBtNb5RtzgZeJIsUBfNdo5pLUIBha7FUdQ8gDC?= =?us-ascii?Q?mECCm7Ony4RJunzux0s+OUpOdxT7DrtK/qz8+QMcgT1CjlSzMNQfQ/PEkWPU?= =?us-ascii?Q?EZ6d0VhbPh5xZtn0sy7xNe/2pjkWgdCDRxxo7l5y1Aojg+VP+OjrHz1PJrPI?= =?us-ascii?Q?VIokcFxgR2fLyZBPw9pOFRxFWMGQYOFDGfjMfxr/YUPVrImK4wiTS2W1fxwQ?= =?us-ascii?Q?vqJtyy+LyX9/qI0llbLwd1AW2oeNRdSwNIgjPwsL0+IEVJGj8o2EcgWh9wpA?= =?us-ascii?Q?FzfUVGRAHAjorj3wexQaYFjfGQFEuwfa8zQHzcLF1l+BRun4/wh1drKQXaKs?= =?us-ascii?Q?R2lJUnziPSaqmMYe2ett1r9ovGN0U+fFCNm2PIJfQopTPNs8aWUmKEnxQJJ5?= =?us-ascii?Q?H8MdPkKaAdKwHn46UB0y5B3EE/x7T4mOEtpgk4ng4ANLn8IYSHr37hua6aZO?= =?us-ascii?Q?WjqEcytT97/ro7uBVvKaHlF11eSqiSfD2n9ND6WiWmn0cUMtnczFDXCnufX8?= =?us-ascii?Q?U04T1ptBfvC04LKV5Fd5WKipmrtSmYzoAmE/XnE6+NN2lkzBISLf1WW5pL69?= =?us-ascii?Q?ad+rgPEWAqhAifVnXNvnDDoNofS8NhUv+EcS/Gnx5HRdh9SehO1AMpu/0w0f?= =?us-ascii?Q?cnJyxMiMdbunFnzsUBX/xtHAS1A0+/CA2zI479dmBjeBBfmNkhuw76ivwDIL?= =?us-ascii?Q?uj+h1dZ/ocBWhZoqSveBoMYKlJ1v+pYRawL8d+UUkSxyUOdhkCHPIKMtsDK3?= =?us-ascii?Q?ebL8PEdq00GkqKT+gI0uzUHkAxQ2TPIh7gpAcj9z2KbAfg5aolDlxak8j/tX?= =?us-ascii?Q?nSL5roFpQAoGY6O3MQl+vC0n?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: d410df8a-0655-44cf-2087-08d97861d10d X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 15:59:36.7782 (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: QEPcTsDHdjjyRZP5I5lSa9WoT+hHbK8+ACQ5pYnyc6cYnzadPaT6X8DjOXt7+fcymvKH3W74MFTgo7jpr2fGzRZMS+vqfk+/K5EGZsK1xv0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0101MB3065 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: LT6zqCi4zmOsmVKuLWe5vxiYx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721581; bh=54r/j5VbBlyPUsIk3hGa+q84hVlrfmXpEUdMFE4yiII=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=lwIa5h4A75L4rXuUzBNDBW8x6Uy9fKbQVT3AubAbmd6wpqiJSuf7gNFgDFxTSdJsZ7g oHxOtcbzJu4/GMhwO1+KYUIHyf79v9EkGORWtsHxgtLehnEZQmtKD/X/0yyPQKr3zwl8f axigo+OC1feLX+jq+uoMSkcI5srPCI7A1Lk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721583622100002 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen 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: Vu Nguyen 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 89c143cd28e6..5f7a56133777 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -84,6 +84,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 =20 # diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index 0681835dd175..332cd8ac0c8e 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -75,7 +75,7 @@ [LibraryClasses] # # RTC Library: Common RTC # - RealTimeClockLib|EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualReal= TimeClockLib.inf + RealTimeClockLib|Platform/Ampere/JadePkg/Library/PCF85063RealTimeClockLi= b/PCF85063RealTimeClockLib.inf =20 # # Library for FailSafe support 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 (#80708): https://edk2.groups.io/g/devel/message/80708 Mute This Topic: https://groups.io/mt/85631141/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 Thu Apr 25 11:35:07 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+80709+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+80709+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721585847906.1125246237939; Wed, 15 Sep 2021 08:59:45 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id wXgBYY1788612xf8Q5wkkQ3e; Wed, 15 Sep 2021 08:59:45 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.109]) by mx.groups.io with SMTP id smtpd.web11.9841.1631721584665754295 for ; Wed, 15 Sep 2021 08:59:44 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DErJ5pyuLh85J1q5/zx0B7SAwCayfthifncPVALyOerWYqCAXTsTxNFBTdGDiiW6ZLGZSRxxcYpJZWo9ye4ukaruVxbgQdmgaraqwFAwYHcg3a7KEcvWmgpIf06jU5ipiSx5OpT+QkXxHvEsg4FpxnyciqfC9aFsxenR2r4b3bowuX6sCmYX601cey3rrGUrkTji6CfG3TYPqCdHUugFc7RoMAuNYv18bzlzdLNLSn+a/F1OBva7+gAUd699WOwcs6oNb3USk9quvfwhpYxK+aaw7IJhZHiOm13WIFWgucGGzXr+wah40mOT/o8cyA0zt7VCOGa6AofOD5pm2i/y5A== 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; bh=fIV8/Kty+yf+YYK/Ui542Kn2QEa/lkrmWBqQKjQWx9c=; b=TbF56HPecmX2zcyv3GjtDHBgp5iCx8M16+v8mlpFF6ztKaVvPkJGxHhXnJIG0GfbbPOfTxoi9pfsTEYSYNvuAelTt54alh6a0mPlqagwKzny+evdTUmjF/p8POXUxf1EcXBgjT196eDKp1AT5K7z5hGwtgEvClWtiQ3E1F2Dh9ZD8igLE2B+z0Tr05VnzoZ5ZyFTogw6VKLxdya8+9H3S2V/eEFedmXwQaa9BIzz0swy+Xj8iCTBnGUxJSYfjtmG0fS+HP6c0xyGoRbw7RCg5E2PXVFdDT6x8jrqX/ghr6/P6J/kgE5DPH+zOTGx5jlmam4LNU8mqadVi2FBFuEhhA== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR0101MB3065.prod.exchangelabs.com (2603:10b6:4:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15; Wed, 15 Sep 2021 15:59:40 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 15:59: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, Quan Nguyen , Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-devel] [PATCH v3 08/28] AmpereAltraPkg: Add BootProgress support Date: Wed, 15 Sep 2021 22:55:07 +0700 Message-ID: <20210915155527.8176-9-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 15:59:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 494a2c11-daee-4dda-4997-08d97861d354 X-MS-TrafficTypeDiagnostic: DM5PR0101MB3065: X-MS-Exchange-Transport-Forked: True 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: 8dussmCld6KAc2RCXX0HbkvN+GE9eyktQxYfVTaIvK+xJAul3x+5C7C1asmTrcA7QFpd48d5glkSFxI6RRMe9CmzwNle8nGdBYsjhkKsJGHHkOWgF58b0EF4jv8i57ua/txEXN7Wj1VlnaWe1dKyIAFFtw14IzHpafaaRnHwoRKkUnstgdqtFeaKlMXmiFGLQZegHR/78/C7q7FzDALzINWoyIdLGBqjsgVyr0ksOg1pAFmm5+V4jp9bYFMuMSac+PYurJC38ufJo75YQdes916Vuc9l1ofXZNiWRtyPhArXoJ+i+oZlS7KyDUYdkrH9O4mPf4JDgX663HeoxSiArSIejTfZYn3hdtDlBf7wb81zG3WEUDExOME2cFSM1KgEM6p24WcuqF8SNUJPCMiBotITd2dBXXraUH7Hghx78SvZMTcIqagWqYK9YAOXn3lJg0Eu785+vS4IWOsomJgo1uHgWqbcazTDAhdSjj8t3G27AzvJ8JQupl/aY5aE/BXhfV5pzoNCR++kPYa9uYL4EaSV+2Zvj/1lEdib8Y5nGnCFDtcQDgCQD2OTTYLnox+CRyTtWDG/xU6w6mkpMy0pYGeqxkofnEiOhbDmCrSUMxzGa6YnOT8mcyt6rba8iJLE2dfaBBkZIFE0Yu36kZojmn9skvo+GS5XMIe/iE9Zmze29zafUIuOnBgwadO7C+9Y115GRrgYJGxbyApyVt1d2Q== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?16pmjcr/pUVxvE8pZOY5LkoVJm7GEVS0PdkOc/wAhtRAlhkFblusGyHXdskL?= =?us-ascii?Q?eIxBwqLzBfrrustiZrrE1YK8UwYx8dQ2SDH7l0S70FVmJphI7+jBFiYTPtnt?= =?us-ascii?Q?IOpa09zXM0/uARp8c0Y5j1fKdftGlRmObVkNVLcsKaaLgYES/GF8YKVVbZgr?= =?us-ascii?Q?MQj8jmdaPXG9fw3r0QIixBxjDnT+ZHtqo+iznD3CaUBkYhCBpSFWGZPhSG4d?= =?us-ascii?Q?5jJY9EgABv8Mv5atkX09JudxNSTGAYhYSAPBi7lxT1uGxBjDR6r+znIQZd5f?= =?us-ascii?Q?3KFAyc27vwEv4CFgbuwejf4qEGVgzGIrK2vboxwlL6uB7mWRFXdThdaKDYi4?= =?us-ascii?Q?oi5ijAs/1oyNAhkWQfU/dRLuUX1BP+vpWJDnyvSaVqMsDLerTWw4GFek9BTk?= =?us-ascii?Q?89TumSCKXCJ508UZTGWJfWiUG/wx3bEGNCw/viIxC7QfD+MDmkWdr0yP2+B0?= =?us-ascii?Q?rVdd7usN7DGHrl1BiKX2PBzkx31aSlCFMZtF+0lTmCme813wfesRITc8cMc7?= =?us-ascii?Q?UXYejdSM0IiIuk26nvVn3SqCzHvPJV0ZhW6EAC1Hrb2pOQi6ABDzFj+R9MV1?= =?us-ascii?Q?YW+gO0TXkavX+CLj2gR87MXkb+AXpFOjossjKAKvmnhzSk/+oPvNoZEosmVY?= =?us-ascii?Q?X2abH/6XZSCkqKEsHx4gTw0XAMrphJ5UH5YRCJQRw6X8Lw8528hQuw3ltDsD?= =?us-ascii?Q?FKO9I+W8xkHwzJRBVgQkiziGnjg1qz75Rk3EUcAmN8/d0VECTyZZnOtck9R+?= =?us-ascii?Q?LiPvEtr2evHFsU3vGCJp9hOx9xipjjhkl9Xs3KLWn08Vb7gzz/4YJbcj1V7u?= =?us-ascii?Q?du+dzZAEP7pRpDQ8Y5U+/8oPfpmsA50u9c3cI+iRNXw9e51P1tPT+E+Gbf9l?= =?us-ascii?Q?vYPkWRDOvSs4m4t/cT1rsngEFDj1sghxNK1ozujlqlqnOBtMOdsvc1YzALLH?= =?us-ascii?Q?j4xoJLFqFp2HXBWt3nHnEWr5fv/WAUGG3axwnTFTm9IuRGQG9QQmzTJIXe3Z?= =?us-ascii?Q?U42P8NVSDT7E6A8SR2mTSi6QVauyWy7Jdi4tuoySh2nZ7qMR1DiCIY3LQAdo?= =?us-ascii?Q?ByIxyqKyehQN+2nywwl/40zwZ8TrfY8/6qqRRGi/kg/88uFywHXhPaUwe3Ud?= =?us-ascii?Q?L8HaLAOB/bQbCisaFSGPQVwS4fmaMS5Xwh/N1x0uTZ98S0VwVCK+soRUlaEE?= =?us-ascii?Q?ZZhcx/FU5Oy3GgAUP7wbpzGDbuzrLhueSM52StZScwQFqIJDA8hOzSG4+HZZ?= =?us-ascii?Q?GoGem+I59RHGx5g75yYYB2huKUR07zEnkVcU+V9iBomzVWFDO5nLkyrF+mgG?= =?us-ascii?Q?WnBY4VPinyzTnAcUe74E3Tlo?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 494a2c11-daee-4dda-4997-08d97861d354 X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 15:59:40.7320 (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: YPol8ik6/VWgLaOOrp8yPf31TecVsbNd07f/r0eT8B0sSAA+N6+a4PW22dqLfGHSdM5lCdohhZyhn/XQ8d1vzaGsSJnOkcbps7XK3VQ5kAY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0101MB3065 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: 8JEZ6xlJQTaUs4BU7enxImytx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721585; bh=O9Tq+pN8xo473OAnebYwr1Chcjxxz3Ht0qHOLxovP7c=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=OhU6n1+MZfwmlnFKw7zctJa9h1yG3aYEvrCDXXXwnMpF4j/X2KMu/GpJ2D2Jt/ENBCF Q0KSpl9WItYKnh58ufSjtUNGMEgQiw882f1ffJMNJVAWKf0aISAg6dE0KSj1TkOYbcQ3h 1+dkx9oPBoMJlDw1WY0Q9wqe55t4ELhLV7k= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721586570100006 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: Quan Nguyen 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 | 211 ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressPeim/BootPr= ogressPeim.c | 210 +++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressDxe/BootPro= gressDxe.uni | 16 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressPeim/BootPr= ogressPeim.uni | 18 ++ 8 files changed, 559 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index 5f7a56133777..bb144183164d 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -537,6 +537,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 @@ -547,6 +548,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 80a86d7c1156..1857296a8ea5 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -102,6 +102,7 @@ [FV.FVMAIN_COMPACT] INF Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf INF Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.= inf INF Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunica= tionPei.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..f87a4d53179f --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressDxe/Bo= otProgressDxe.c @@ -0,0 +1,211 @@ +/** @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; + +enum BOOT_PROGRESS_STATE { + BOOT_NOTSTART =3D 0, + BOOT_START =3D 1, + BOOT_COMPLETE =3D 2, + BOOT_FAILED =3D 3, +}; + +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 BOOT_START; + +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 BOOT_FAILED; + } 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 BOOT_COMPLETE; + } + + 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..c677e27a00ce --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/BootProgress/BootProgressPeim/B= ootProgressPeim.c @@ -0,0 +1,210 @@ +/** @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 + +enum BOOT_PROGRESS_STATE { + BOOT_NOTSTART =3D 0, + BOOT_START =3D 1, + BOOT_COMPLETE =3D 2, + BOOT_FAILED =3D 3, +}; + +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 BOOT_START when start +STATIC UINT8 mBootstate =3D BOOT_START; + +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 BOOT_FAILED; + } + + 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 (#80709): https://edk2.groups.io/g/devel/message/80709 Mute This Topic: https://groups.io/mt/85631143/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 Thu Apr 25 11:35:07 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+80710+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+80710+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721588728483.3607933185215; Wed, 15 Sep 2021 08:59:48 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id FKQcYY1788612x9wWLK5ntda; Wed, 15 Sep 2021 08:59:48 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.114]) by mx.groups.io with SMTP id smtpd.web08.10073.1631721587574695851 for ; Wed, 15 Sep 2021 08:59:47 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IZzj0yqnQcMeF5DQOrWsvGxjt53/sMYEzRqs8z2EYPlMVnpQ2l8RHR6ILh2fIDXYEhah9LLUztGLmD2NAMjSMlmY9TBa6WBI5Hxg2CiH/JmPmc9MdTlecTfPgYdKWb905wZwESezFzBTGUreghSIFSXv4L7Kc3XjeNItUJTZDs7Ocegdzg18yXnK/MYYLy9qSVIVgxUkuzMS9pdbMAJYM+cbLUmUegl6fpvUWuRjJDtE7Yhn8d2v6d4sLBq9sRE9BIZ+K476hWWsAp6ytvH6TBBpgB3VVpzowwdu+Y3PhOID3QIkrSk5Q+UEoexnRjQTuuf0jQqKBlr69QgWY78org== 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; bh=3AD0aQ/6/TEwTYWFNt8k9Pv4wEhI/gVaAcaDbCpa+h0=; b=UqJ9hkHmw39WL7f6AnWhdkk2QuyP6SgJHjzpjqFaQYa3qtblCaG1NAMW5R32DjpQq8ZFZJe0IIlJKfM7Zc5EA+C6JX6OmXLmKb5aw3rUkdyDmMN3yRrs0LTRw0BX2/7gqzjXf7SvDY1fQgl7HBiMQOvLyaCj0PqRTmt7yidm4U7b7463ys90ZFoHclz5LfPsLGAX8mteAtr/dX5C5yRuK/plUi0QBM9ExXklhUsqIrROeciTj/SsAQvyyL67FtMz2/9MunGmPlarfph6cR0fMJcloPmzQtjLcxCg9bzQsseLKdDMbLY6086ExORpochWBBmWTz/JU83RcYU/TDSqag== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR0101MB3065.prod.exchangelabs.com (2603:10b6:4:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15; Wed, 15 Sep 2021 15:59:44 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 15:59:44 +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] [PATCH v3 09/28] AmpereAltraPkg: Support UEFI non-volatile variable Date: Wed, 15 Sep 2021 22:55:08 +0700 Message-ID: <20210915155527.8176-10-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 15:59:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6a2892e0-77d8-45a0-2ece-08d97861d585 X-MS-TrafficTypeDiagnostic: DM5PR0101MB3065: X-MS-Exchange-Transport-Forked: True 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: AHlxPE/xIgXqF9uBtXmudEw/t6b+iwC8VKymVKcZiN1S8vazIdbMaeCi3y7J/m4R6EyFSJhLjhpwoeZBFyP70izEVMoIFfxTp+B4yMV7+F7cLOXjs0hvhzPTeP+pndTGBBGlfTnhK7ncZLvnFEVbMCwJrtkB631JkSegivg2PEylWDN53xIC0OwCcf0tFqAYWFRLWDnJ9Sy1iUfxjZ4o3kWJTj5wOzfKe6fEKxqEeUwAvKfPIv8LQl/K01NKerkOQzT1+2KaYhYwyGXaCR5PGvFESX2Yz5n7pL/isZCxI1efxFVsppHW3bIxbqcSpw2KU15wAYshp4beaVvICra+1tlNUh1GhzEZn+eUHh/sFa4T5bWURL1qHGTwxElD+wyQa+8sD4DyBCeP8vzGNrH1VdX+Y0FhiiiRj3Rs0/qdfsmySXJ1+4wbvrGENRT5DagtRlIkdtYEts6/NY5ywIImaOqIMO1tYmkUtg3kxY11G9cFEMTbkdDivYOEydqtVf/HS3P5X/S1IQRfAvrk9nPXoAV9+9b5bRAAvJtPhc4vV6JukiSZwv+hhhSQv1IFVEDrHKvOGEXxH/G9pAph+uLjfBg50UW1yLX8aH+leWU6FWgaq6NGkbt1RvBtU1wcoAFGCe6+3TMd60AlQ9XK3clc6LFzgVMMEx2hEjNb5tdwn9OMIqaWp5YdmJvIhbv+AOQjFYZnl90Ror+jhgMXlu4dEGWYJSA2IrrohXThgo5pHxc= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?iaUFnsS3OExK4N6OMTSv8nr0239u6OfpbbkdMTwcU+SFkwfJyc2sRNYJ0UNK?= =?us-ascii?Q?BZKgroJmPBEIqRE8hXp5sWt1/UQ+Bwww5SZ9lTrQDogHes9SJoA6SswZeyRj?= =?us-ascii?Q?YqwyB+tZyd0Ic04wySVTTLArc4dOLLps3GjjFbMoHmrcgiCzBOs8nP1JZd1l?= =?us-ascii?Q?2NdanTBnEculjfX2m6vhvcqOMe2Sg+gaLe2mQ8FH/pNdJe4TARMVTAnhHXtC?= =?us-ascii?Q?8jhJn8Rfj7TXYiFY+bYOi/OcNxC3QFou4tMkbmyAc+mRXmCZyVepC6AJS88H?= =?us-ascii?Q?GodxqztNaYh/F/DacwOmLZ2FFn69HkDZdSZnrRf65qT0e2rw67IaooficUnL?= =?us-ascii?Q?TX3b87b6/qWzJdIZOR3NQCmRwXiab+NTgSIOmozu8TsqszGkXVSyCN8er1DN?= =?us-ascii?Q?5MdRmOShoviXTdK4oNf2iKDgH2+UY7wHFq0PSmJ2lXksGDTiOqqQP47puLl/?= =?us-ascii?Q?Xsq9emicKynRuaYEKgeSx0mfz8FANcy1FyV7/LstsCdD0jCXqKR+aJ11MsZD?= =?us-ascii?Q?5hzApx5TRXp9heIovS7ZQfFSK5TCHfXcRI4yTkZQPsqStM8G4DCdq3DHl1DL?= =?us-ascii?Q?KrVo4o+Ef1pBI0BGDnWP/N8WSDv3kZcQCBC/7gJph2xQavRTBvnjdsyL/+88?= =?us-ascii?Q?qgOM4OIHK8Hwg1VJIZcuaRs3OwBioC9mtx4p/tHdLnI3XcDM98Qsn0j5M/ur?= =?us-ascii?Q?xXLwSKMpBnuSv+OnzfJU2+tvsZgpkfEuA6KiPowVtxfqk1P1pt6GhYUAaGPH?= =?us-ascii?Q?iK80E8wfQjEKkWWNl7l1/DELSHxPnFA5ZL6zYQ0jRfLsZPZhuZfZhneON/Au?= =?us-ascii?Q?r1FMKzH9bop0FTLp2lkzRPaLcX1+vOwbQj9Rk8zfJ9z7Q2/+axPn2/LbBrtd?= =?us-ascii?Q?wd0vi2/4XP1QJW3qrz6sX/4OGQQed+PPODe8j2dvcSp7p+U4+f+tSzjK1XEH?= =?us-ascii?Q?HEAly/gREdh7l5nvR/TLP7XCFCdu7hbClQtW0yuHBW+hJKEmG79C8os+n/h4?= =?us-ascii?Q?dw4Z5z4E5GEl9YmdjuvcXFpHpsjK7i+6QHVnagPWTUP2glYwtVFJ9ujk0AQH?= =?us-ascii?Q?jsvDu/gOeLxdh62Et8oVgIr+5oncMzvIgE3Av7HzdyTX8QmJ3M9VjAZ66oI9?= =?us-ascii?Q?5xKBCUDL/OD4NK9YvI6AAJB7JmZznDtft7lwtpYOnMbpc7lFiPadrmlNc97w?= =?us-ascii?Q?+9g/K1UnFmLzMDIwVqVaUcNfL9NR6Oq9Go1DmM5yBw3rmhxeGKBhCt55uoVV?= =?us-ascii?Q?ucVAhSqHY6sI2mkBDkV66+XuL7jEWYiW2KbA60qAHD/85LDVYeLyDxwlWJsb?= =?us-ascii?Q?B/ly4fVgSwORmZPhM2LObhB2?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6a2892e0-77d8-45a0-2ece-08d97861d585 X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 15:59:44.4149 (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: utiS9h1J3d6gxAyZLov3a/p+MN6qq3oLwUWWaIO/VWvEBPUk7HAs2wPJ31Wf/KiWiqHEdB44cK1znOYc1y3xzgTkZd+LNhwk1mtvvJfoatU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0101MB3065 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: xOLmwks9G8HjGaCTDfXYKkYAx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721588; bh=JfRwKzJHSkneaBqHRiKqUqNU1wvTd2mdZsr15zSrbNs=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=VycrWMMW+Z4Kgp3vSARzOjQFhapj5BTJnmvt69HUhpqb4o8EJfDoOwQBTug912iLkW5 hjR3AT4wpBkhwP6nbXhl+1Ri5xfB0Y5qlmcFT9vPs+i+QCcYMjKmSpS+CeZuNIHflqliL Jn5N3MFXY6mU4wXTUvb2XZgln75cWhAHkXs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721589352100001 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen This supports storing the UEFI non-volatile varibles on flash through the MM communication interface instead of emulating. Below are modules added for this support: * FlashLib provides APIs to access flash through MM service. * 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: Vu Nguyen --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec | 3 + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec | 8 + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc | 10 +- 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 | 52 ++ Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.inf | 36 ++ Silicon/Ampere/AmpereAltraPkg/Include/Library/FlashLib.h | 42 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c | 525 ++= ++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/FlashPei/FlashPei.c | 273 ++= ++++++++ Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.c | 358 ++= +++++++++++ 12 files changed, 1424 insertions(+), 4 deletions(-) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Amp= ere/AmpereAltraPkg/AmpereAltraPkg.dec index be827dd19a96..d5b12a81e9bf 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -37,6 +37,9 @@ [LibraryClasses] ## @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 + ## @libraryclass Defines a set of methods to access flash memory. + FlashLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/FlashLib.h + ## @libraryclass Defines a set of methods to generate random numbers b= y using Hardware RNG. TrngLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/TrngLib.h =20 diff --git a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec b/Silicon= /Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec index 6ebdf7db0a57..646a53fc031c 100644 --- a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec +++ b/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec @@ -31,6 +31,11 @@ [Guids] [Ppis] =20 [PcdsFixedAtBuild] + # + # NVRAM + # + gAmpereTokenSpaceGuid.PcdNvramUuid|"C416535D-970B-41B9-859A-3CAF0FAF198C= "|VOID*|0x00000010 + # # SMpro PMpro Pcds # @@ -44,3 +49,6 @@ [PcdsFixedAtBuild, PcdsDynamic, PcdsDynamicEx] # Firmware Volume Pcds # gAmpereTokenSpaceGuid.PcdFvBlockSize|0|UINT32|0xB0000001 + + # NVRam Pcds + gAmpereTokenSpaceGuid.PcdNvramErased|FALSE|BOOLEAN|0xB0000009 diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index bb144183164d..7f84ac2df50a 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -226,6 +226,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 + FlashLib|Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.inf =20 [LibraryClasses.common.UEFI_APPLICATION] UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiTianoCust= omDecompressLib.inf @@ -256,6 +257,7 @@ [LibraryClasses.common.DXE_RUNTIME_DRIVER] =20 EfiResetSystemLib|ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSyste= mLib.inf ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf + FlashLib|Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.inf AmpereCpuLib|Silicon/Ampere/AmpereAltraPkg/Library/AmpereCpuLib/RuntimeA= mpereCpuLib.inf =20 [LibraryClasses.ARM,LibraryClasses.AARCH64] @@ -508,6 +510,8 @@ [PcdsDynamicDefault.common] gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0x0 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|0x0 =20 + gAmpereTokenSpaceGuid.PcdNvramErased|FALSE + ##########################################################################= ###### # # Component Section - list of all EDK II Component Entries defined by this= Platform @@ -528,8 +532,10 @@ [Components.common] Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.inf Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunication= Pei.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 { @@ -583,9 +589,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 332cd8ac0c8e..c670fd0f34b6 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -52,6 +52,7 @@ [Defines] DEFINE EDK2_SKIP_PEICORE =3D TRUE DEFINE SECURE_BOOT_ENABLE =3D FALSE DEFINE INCLUDE_TFTP_COMMAND =3D TRUE + DEFINE NVRAM_UUID =3D 84BC921F-9D4A-4D1D-A1A1-1AE13EDD07E5 =20 # # Network definition @@ -89,6 +90,10 @@ [LibraryClasses] ##########################################################################= ###### [PcdsFeatureFlag.common] [PcdsFixedAtBuild.common] + # + # NVRAM + # + gAmpereTokenSpaceGuid.PcdNvramUuid|"$(NVRAM_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 1857296a8ea5..375455086d0b 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 -# T.B.D +# 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 ##########################################################################= ###### # @@ -102,9 +155,11 @@ [FV.FVMAIN_COMPACT] INF Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf INF Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.= inf INF Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunica= tionPei.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/ReportStatusCodeRouter/RuntimeDxe/ReportStatu= sCodeRouterRuntimeDxe.inf INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandle= rRuntimeDxe.inf INF Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationDxe/MmCommunica= tion.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..782278615094 --- /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 + gEfiMmCommunicationProtocolGuid ## CONSUMES + +[Depex] + gEfiMmCommunicationProtocolGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashPei/FlashPei.inf b/= Silicon/Ampere/AmpereAltraPkg/Drivers/FlashPei/FlashPei.inf new file mode 100644 index 000000000000..9b640adb6421 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashPei/FlashPei.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 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 + MmCommunicationLib + PcdLib + PeimEntryPoint + +[Guids] + gSpiNorMmGuid + +[FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 + + gAmpereTokenSpaceGuid.PcdNvramErased + gAmpereTokenSpaceGuid.PcdNvramUuid + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.inf b/= Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.inf new file mode 100644 index 000000000000..2d5003d1af17 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.inf @@ -0,0 +1,36 @@ +## @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 DXE_DRIVER + VERSION_STRING =3D 0.1 + LIBRARY_CLASS =3D FlashLib + CONSTRUCTOR =3D FlashLibConstructor + +[Sources.common] + FlashLib.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + BaseMemoryLib + DebugLib + MemoryAllocationLib + +[Guids] + gSpiNorMmGuid + +[Protocols] + gEfiMmCommunicationProtocolGuid 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..9207dee643a5 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/FlashLib.h @@ -0,0 +1,42 @@ +/** @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_ + +EFI_STATUS +EFIAPI +FlashGetNvRamInfo ( + OUT UINT64 *NvRamBase, + OUT UINT32 *NvRamSize + ); + +EFI_STATUS +EFIAPI +FlashEraseCommand ( + IN UINT8 *pBlockAddress, + IN UINT32 Length + ); + +EFI_STATUS +EFIAPI +FlashProgramCommand ( + IN UINT8 *pByteAddress, + IN UINT8 *Byte, + IN OUT UINTN *Length + ); + +EFI_STATUS +EFIAPI +FlashReadCommand ( + IN UINT8 *pByteAddress, + OUT UINT8 *Byte, + IN OUT UINTN *Length + ); + +#endif /* FLASH_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.= c b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c new file mode 100644 index 000000000000..dcd92151b7d2 --- /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 ( + (UINT8 *)(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 FlashProgramCommand ( + (UINT8 *)(mNvFlashBase + Lba * mFlashBlockSize + Offset), + Buffer, + NumBytes + ); + + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Failed to do flash program\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 ( + (UINT8 *)(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 ((UINT64 *)&mNvFlashBase, (UINT32 *)&mNvFla= shSize); + 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..0939f1b70869 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashPei/FlashPei.c @@ -0,0 +1,273 @@ +/** @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 + +EFI_MM_COMM_REQUEST mEfiMmSpiNorReq; + +STATIC +EFI_STATUS +UefiMmCreateSpiNorReq ( + VOID *Data, + UINT64 Size + ) +{ + CopyGuid (&mEfiMmSpiNorReq.EfiMmHdr.HeaderGuid, &gSpiNorMmGuid); + mEfiMmSpiNorReq.EfiMmHdr.MsgLength =3D Size; + + if (Size !=3D 0) { + ASSERT (Data); + ASSERT (Size <=3D EFI_MM_MAX_PAYLOAD_SIZE); + + CopyMem (mEfiMmSpiNorReq.PayLoad.Data, Data, Size); + } + + return EFI_SUCCESS; +} + +/** + 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 (PcdNvramUuid)= ]; + CHAR8 StoredUuid[PcdGetSize (PcdNvramUuid= )]; + EFI_MM_COMMUNICATE_SPINOR_NVINFO_RES *MmSpiNorNVInfoRes; + EFI_MM_COMMUNICATE_SPINOR_RES *MmSpiNorRes; + EFI_STATUS Status; + UINT64 FWNvRamStartOffset; + UINT64 MmData[5]; + UINTN NvRamSize; + UINTN Size; + VOID *NvRamAddress; + +#if defined(RAM_BLOCKIO_START_ADDRESS) && defined(RAM_BLOCKIO_SIZE) + EFI_MM_COMMUNICATE_SPINOR_NVINFO_RES *MmSpiNorNV2InfoRes; + UINT64 NV2Base, NV2Size; +#endif + + NvRamAddress =3D (VOID *)PcdGet64 (PcdFlashNvStorageVariableBase64); + NvRamSize =3D FixedPcdGet32 (PcdFlashNvStorageVariableSize) + + FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) + + FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize); + + /* Find out about the start offset of NVRAM to be passed to SMC */ + ZeroMem ((VOID *)MmData, sizeof (MmData)); + MmData[0] =3D MM_SPINOR_FUNC_GET_NVRAM_INFO; + UefiMmCreateSpiNorReq ((VOID *)&MmData, sizeof (MmData)); + + Size =3D sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status =3D MmCommunicationCommunicate ( + (VOID *)&mEfiMmSpiNorReq, + &Size + ); + ASSERT_EFI_ERROR (Status); + + MmSpiNorNVInfoRes =3D (EFI_MM_COMMUNICATE_SPINOR_NVINFO_RES *)&mEfiMmSpi= NorReq.PayLoad; + if (MmSpiNorNVInfoRes->Status !=3D MM_SPINOR_RES_SUCCESS) { + /* Old FW so just exit */ + return EFI_SUCCESS; + } + FWNvRamStartOffset =3D MmSpiNorNVInfoRes->NVBase; + + CopyMem ((VOID *)BuildUuid, PcdGetPtr (PcdNvramUuid), sizeof (BuildUuid)= ); + if (MmSpiNorNVInfoRes->NVSize < (NvRamSize * 2 + sizeof (BuildUuid))) { + /* NVRAM size provided by FW is not enough */ + return EFI_INVALID_PARAMETER; + } + + /* We stored BIOS UUID build at the offset NVRAM_SIZE * 2 */ + ZeroMem ((VOID *)MmData, sizeof (MmData)); + MmData[0] =3D MM_SPINOR_FUNC_READ; + MmData[1] =3D (UINT64)(FWNvRamStartOffset + NvRamSize * 2); + MmData[2] =3D (UINT64)sizeof (StoredUuid); + MmData[3] =3D (UINT64)StoredUuid; + UefiMmCreateSpiNorReq ((VOID *)&MmData, sizeof (MmData)); + + Size =3D sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status =3D MmCommunicationCommunicate ( + (VOID *)&mEfiMmSpiNorReq, + &Size + ); + ASSERT_EFI_ERROR (Status); + + MmSpiNorRes =3D (EFI_MM_COMMUNICATE_SPINOR_RES *)&mEfiMmSpiNorReq.PayLoa= d; + if (MmSpiNorRes->Status !=3D MM_SPINOR_RES_SUCCESS) { + return Status; + } + + if (CompareMem ((VOID *)StoredUuid, (VOID *)BuildUuid, sizeof (BuildUuid= ))) { + ZeroMem ((VOID *)MmData, sizeof (MmData)); + MmData[0] =3D MM_SPINOR_FUNC_ERASE; + MmData[1] =3D (UINT64)FWNvRamStartOffset; + MmData[2] =3D (UINT64)(NvRamSize * 2); + UefiMmCreateSpiNorReq ((VOID *)&MmData, sizeof (MmData)); + + Size =3D sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status =3D MmCommunicationCommunicate ( + (VOID *)&mEfiMmSpiNorReq, + &Size + ); + ASSERT_EFI_ERROR (Status); + + MmSpiNorRes =3D (EFI_MM_COMMUNICATE_SPINOR_RES *)&mEfiMmSpiNorReq.PayL= oad; + if (MmSpiNorRes->Status !=3D MM_SPINOR_RES_SUCCESS) { + return Status; + } + + ZeroMem ((VOID *)MmData, sizeof (MmData)); + MmData[0] =3D MM_SPINOR_FUNC_WRITE; + MmData[1] =3D (UINT64)FWNvRamStartOffset; + MmData[2] =3D (UINT64)(NvRamSize * 2); + MmData[3] =3D (UINT64)NvRamAddress; + UefiMmCreateSpiNorReq ((VOID *)&MmData, sizeof (MmData)); + + Size =3D sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status =3D MmCommunicationCommunicate ( + (VOID *)&mEfiMmSpiNorReq, + &Size + ); + ASSERT_EFI_ERROR (Status); + + MmSpiNorRes =3D (EFI_MM_COMMUNICATE_SPINOR_RES *)&mEfiMmSpiNorReq.PayL= oad; + if (MmSpiNorRes->Status !=3D MM_SPINOR_RES_SUCCESS) { + return Status; + } + + /* Update UUID */ + ZeroMem ((VOID *)MmData, sizeof (MmData)); + MmData[0] =3D MM_SPINOR_FUNC_ERASE; + MmData[1] =3D (UINT64)(FWNvRamStartOffset + NvRamSize * 2); + MmData[2] =3D (UINT64)sizeof (BuildUuid); + UefiMmCreateSpiNorReq ((VOID *)&MmData, sizeof (MmData)); + + Size =3D sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status =3D MmCommunicationCommunicate ( + (VOID *)&mEfiMmSpiNorReq, + &Size + ); + ASSERT_EFI_ERROR (Status); + + MmSpiNorRes =3D (EFI_MM_COMMUNICATE_SPINOR_RES *)&mEfiMmSpiNorReq.PayL= oad; + if (MmSpiNorRes->Status !=3D MM_SPINOR_RES_SUCCESS) { + return Status; + } + + ZeroMem ((VOID *)MmData, sizeof (MmData)); + MmData[0] =3D MM_SPINOR_FUNC_WRITE; + MmData[1] =3D (UINT64)(FWNvRamStartOffset + NvRamSize * 2); + MmData[2] =3D (UINT64)sizeof (BuildUuid); + MmData[3] =3D (UINT64)BuildUuid; + UefiMmCreateSpiNorReq ((VOID *)&MmData, sizeof (MmData)); + + Size =3D sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status =3D MmCommunicationCommunicate ( + (VOID *)&mEfiMmSpiNorReq, + &Size + ); + ASSERT_EFI_ERROR (Status); + + MmSpiNorRes =3D (EFI_MM_COMMUNICATE_SPINOR_RES *)&mEfiMmSpiNorReq.PayL= oad; + if (MmSpiNorRes->Status !=3D MM_SPINOR_RES_SUCCESS) { + return Status; + } + DEBUG ((DEBUG_INFO, "UUID Changed, Update Storage with FV NVRAM\n")); + + /* Indicate that NVRAM was cleared */ + PcdSetBoolS (PcdNvramErased, TRUE); + } else { + /* Copy the stored NVRAM to RAM */ + ZeroMem ((VOID *)MmData, sizeof (MmData)); + MmData[0] =3D MM_SPINOR_FUNC_READ; + MmData[1] =3D (UINT64)FWNvRamStartOffset; + MmData[2] =3D (UINT64)(NvRamSize * 2); + MmData[3] =3D (UINT64)NvRamAddress; + UefiMmCreateSpiNorReq ((VOID *)&MmData, sizeof (MmData)); + + Size =3D sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status =3D MmCommunicationCommunicate ( + (VOID *)&mEfiMmSpiNorReq, + &Size + ); + ASSERT_EFI_ERROR (Status); + + MmSpiNorRes =3D (EFI_MM_COMMUNICATE_SPINOR_RES *)&mEfiMmSpiNorReq.PayL= oad; + if (MmSpiNorRes->Status !=3D MM_SPINOR_RES_SUCCESS) { + return Status; + } + DEBUG ((DEBUG_INFO, "Identical UUID, copy stored NVRAM to RAM\n")); + } + +#if defined(RAM_BLOCKIO_START_ADDRESS) && defined(RAM_BLOCKIO_SIZE) + /* Find out about the start offset of NVRAM2 to be passed to SMC */ + ZeroMem ((VOID *)MmData, sizeof (MmData)); + MmData[0] =3D MM_SPINOR_FUNC_GET_NVRAM2_INFO; + UefiMmCreateSpiNorReq ((VOID *)&MmData, sizeof (MmData)); + + Size =3D sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status =3D MmCommunicationCommunicate ( + (VOID *)&mEfiMmSpiNorReq, + &Size + ); + ASSERT_EFI_ERROR (Status); + + MmSpiNorNV2InfoRes =3D (EFI_MM_COMMUNICATE_SPINOR_NVINFO_RES *)&mEfiMmSp= iNorReq.PayLoad; + if (MmSpiNorNV2InfoRes->Status =3D=3D MM_SPINOR_RES_SUCCESS) { + NV2Base =3D MmSpiNorNV2InfoRes->NVBase; + NV2Size =3D MmSpiNorNV2InfoRes->NVSize; + /* Make sure the requested size is smaller than allocated */ + if (RAM_BLOCKIO_SIZE <=3D NV2Size) { + /* Copy the ramdisk image to RAM */ + ZeroMem ((VOID *)MmData, sizeof (MmData)); + MmData[0] =3D MM_SPINOR_FUNC_READ; + MmData[1] =3D (UINT64)NV2Base; /* Start virtual address */ + MmData[2] =3D (UINT64)RAM_BLOCKIO_SIZE; + MmData[3] =3D (UINT64)RAM_BLOCKIO_START_ADDRESS; + UefiMmCreateSpiNorReq ((VOID *)&MmData, sizeof (MmData)); + + Size =3D sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status =3D MmCommunicationCommunicate ( + (VOID *)&mEfiMmSpiNorReq, + &Size + ); + ASSERT_EFI_ERROR (Status); + + MmSpiNorRes =3D (EFI_MM_COMMUNICATE_SPINOR_RES *)&mEfiMmSpiNorReq.Pa= yLoad; + ASSERT (MmSpiNorRes->Status =3D=3D MM_SPINOR_RES_SUCCESS); + } + + BuildMemoryAllocationHob ( + (EFI_PHYSICAL_ADDRESS)RAM_BLOCKIO_START_ADDRESS, + EFI_SIZE_TO_PAGES (RAM_BLOCKIO_SIZE) * EFI_PAGE_SIZE, + EfiLoaderData + ); + } +#endif + + return EFI_SUCCESS; +} 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..cd77aed3cfe1 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.c @@ -0,0 +1,358 @@ +/** @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 + +STATIC EFI_MM_COMMUNICATION_PROTOCOL *mMmCommunicationProtocol =3D NULL; +STATIC EFI_MM_COMM_REQUEST *mCommBuffer =3D NULL; + +BOOLEAN mIsEfiRuntime; +UINT8 *mTmpBufVirt; +UINT8 *mTmpBufPhy; + +/** + 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 +FlashLibAddressChangeEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + gRT->ConvertPointer (0x0, (VOID **)&mTmpBufVirt); + gRT->ConvertPointer (0x0, (VOID **)&mCommBuffer); + gRT->ConvertPointer (0x0, (VOID **)&mMmCommunicationProtocol); + + mIsEfiRuntime =3D TRUE; +} + +EFI_STATUS +EFIAPI +FlashLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_EVENT VirtualAddressChangeEvent =3D NULL; + EFI_STATUS Status =3D EFI_SUCCESS; + + mCommBuffer =3D AllocateRuntimeZeroPool (sizeof (EFI_MM_COMM_REQUEST)); + ASSERT (mCommBuffer !=3D NULL); + + mTmpBufPhy =3D AllocateRuntimeZeroPool (EFI_MM_MAX_TMP_BUF_SIZE); + mTmpBufVirt =3D mTmpBufPhy; + ASSERT (mTmpBufPhy !=3D NULL); + + Status =3D gBS->LocateProtocol ( + &gEfiMmCommunicationProtocolGuid, + 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 EFI_SUCCESS; +} + +STATIC +EFI_STATUS +FlashMmCommunicate ( + IN OUT VOID *CommBuffer, + IN OUT UINTN *CommSize + ) +{ + if (mMmCommunicationProtocol =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + return mMmCommunicationProtocol->Communicate ( + mMmCommunicationProtocol, + CommBuffer, + CommSize + ); +} + +STATIC +EFI_STATUS +UefiMmCreateSpiNorReq ( + IN VOID *Data, + IN UINT64 Size + ) +{ + if (mCommBuffer =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + CopyGuid (&mCommBuffer->EfiMmHdr.HeaderGuid, &gSpiNorMmGuid); + mCommBuffer->EfiMmHdr.MsgLength =3D Size; + + if (Size !=3D 0) { + ASSERT (Data); + ASSERT (Size <=3D EFI_MM_MAX_PAYLOAD_SIZE); + + CopyMem (mCommBuffer->PayLoad.Data, Data, Size); + } + + return EFI_SUCCESS; +} + +/** + Convert Virtual Address to Physical Address at Runtime Services + + @param VirtualPtr Virtual Address Pointer + @param Size Total bytes of the buffer + + @retval Ptr Return the pointer of the converted address + +**/ +STATIC +UINT8 * +ConvertVirtualToPhysical ( + IN UINT8 *VirtualPtr, + IN UINTN Size + ) +{ + if (mIsEfiRuntime) { + ASSERT (VirtualPtr !=3D NULL); + CopyMem ((VOID *)mTmpBufVirt, (VOID *)VirtualPtr, Size); + return (UINT8 *)mTmpBufPhy; + } + + return (UINT8 *)VirtualPtr; +} + +/** + Convert Physical Address to Virtual Address at Runtime Services + + @param VirtualPtr Physical Address Pointer + @param Size Total bytes of the buffer + +**/ +STATIC +VOID +ConvertPhysicaltoVirtual ( + IN UINT8 *PhysicalPtr, + IN UINTN Size + ) +{ + if (mIsEfiRuntime) { + ASSERT (PhysicalPtr !=3D NULL); + CopyMem ((VOID *)PhysicalPtr, (VOID *)mTmpBufVirt, Size); + } +} + +EFI_STATUS +EFIAPI +FlashGetNvRamInfo ( + OUT UINT64 *NvRamBase, + OUT UINT32 *NvRamSize + ) +{ + EFI_MM_COMMUNICATE_SPINOR_NVINFO_RES *MmSpiNorNVInfoRes; + EFI_STATUS Status; + UINT64 MmData[5]; + UINTN Size; + + MmData[0] =3D MM_SPINOR_FUNC_GET_NVRAM_INFO; + + Status =3D UefiMmCreateSpiNorReq ((VOID *)&MmData, sizeof (MmData)); + if (EFI_ERROR (Status)) { + return Status; + } + + Size =3D sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status =3D FlashMmCommunicate ( + mCommBuffer, + &Size + ); + if (EFI_ERROR (Status)) { + return Status; + } + + MmSpiNorNVInfoRes =3D (EFI_MM_COMMUNICATE_SPINOR_NVINFO_RES *)&mCommBuff= er->PayLoad; + if (MmSpiNorNVInfoRes->Status =3D=3D MM_SPINOR_RES_SUCCESS) { + *NvRamBase =3D MmSpiNorNVInfoRes->NVBase; + *NvRamSize =3D MmSpiNorNVInfoRes->NVSize; + DEBUG ((DEBUG_INFO, "NVInfo Base 0x%llx, Size 0x%lx\n", *NvRamBase, *N= vRamSize)); + } + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +FlashEraseCommand ( + IN UINT8 *pBlockAddress, + IN UINT32 Length + ) +{ + EFI_MM_COMMUNICATE_SPINOR_RES *MmSpiNorRes; + EFI_STATUS Status; + UINT64 MmData[5]; + UINTN Size; + + ASSERT (pBlockAddress !=3D NULL); + + MmData[0] =3D MM_SPINOR_FUNC_ERASE; + MmData[1] =3D (UINT64)pBlockAddress; + MmData[2] =3D Length; + + Status =3D UefiMmCreateSpiNorReq ((VOID *)&MmData, sizeof (MmData)); + if (EFI_ERROR (Status)) { + return Status; + } + + Size =3D sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status =3D FlashMmCommunicate ( + mCommBuffer, + &Size + ); + if (EFI_ERROR (Status)) { + return Status; + } + + MmSpiNorRes =3D (EFI_MM_COMMUNICATE_SPINOR_RES *)&mCommBuffer->PayLoad; + if (MmSpiNorRes->Status !=3D MM_SPINOR_RES_SUCCESS) { + DEBUG ((DEBUG_ERROR, "Flash Erase: Device error %llx\n", MmSpiNorRes->= Status)); + return EFI_DEVICE_ERROR; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +FlashProgramCommand ( + IN UINT8 *pByteAddress, + IN UINT8 *Byte, + IN OUT UINTN *Length + ) +{ + EFI_MM_COMMUNICATE_SPINOR_RES *MmSpiNorRes; + EFI_STATUS Status; + UINT64 MmData[5]; + UINTN Remain, Size, NumWrite; + UINTN Count =3D 0; + + ASSERT (pByteAddress !=3D NULL); + ASSERT (Byte !=3D NULL); + ASSERT (Length !=3D NULL); + + 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 (UINT64)pByteAddress; + MmData[2] =3D NumWrite; + MmData[3] =3D (UINT64)ConvertVirtualToPhysical (Byte + Count, NumWrite= ); + + Status =3D UefiMmCreateSpiNorReq ((VOID *)&MmData, sizeof (MmData)); + if (EFI_ERROR (Status)) { + return Status; + } + + Size =3D sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status =3D FlashMmCommunicate ( + mCommBuffer, + &Size + ); + if (EFI_ERROR (Status)) { + return Status; + } + + MmSpiNorRes =3D (EFI_MM_COMMUNICATE_SPINOR_RES *)&mCommBuffer->PayLoad; + if (MmSpiNorRes->Status !=3D MM_SPINOR_RES_SUCCESS) { + DEBUG ((DEBUG_ERROR, "Flash program: Device error 0x%llx\n", MmSpiNo= rRes->Status)); + return EFI_DEVICE_ERROR; + } + + Remain -=3D NumWrite; + Count +=3D NumWrite; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +FlashReadCommand ( + IN UINT8 *pByteAddress, + OUT UINT8 *Byte, + IN OUT UINTN *Length + ) +{ + EFI_MM_COMMUNICATE_SPINOR_RES *MmSpiNorRes; + EFI_STATUS Status; + UINT64 MmData[5]; + UINTN Remain, Size, NumRead; + UINTN Count =3D 0; + + ASSERT (pByteAddress !=3D NULL); + ASSERT (Byte !=3D NULL); + ASSERT (Length !=3D NULL); + + 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 (UINT64)pByteAddress; + MmData[2] =3D NumRead; + MmData[3] =3D (UINT64)ConvertVirtualToPhysical (Byte + Count, NumRead); + + Status =3D UefiMmCreateSpiNorReq ((VOID *)&MmData, sizeof (MmData)); + if (EFI_ERROR (Status)) { + return Status; + } + + Size =3D sizeof (EFI_MM_COMM_HEADER_NOPAYLOAD) + sizeof (MmData); + Status =3D FlashMmCommunicate ( + mCommBuffer, + &Size + ); + if (EFI_ERROR (Status)) { + return Status; + } + + MmSpiNorRes =3D (EFI_MM_COMMUNICATE_SPINOR_RES *)&mCommBuffer->PayLoad; + if (MmSpiNorRes->Status !=3D MM_SPINOR_RES_SUCCESS) { + DEBUG ((DEBUG_ERROR, "Flash Read: Device error %llx\n", MmSpiNorRes-= >Status)); + return EFI_DEVICE_ERROR; + } + + ConvertPhysicaltoVirtual (Byte + Count, NumRead); + Remain -=3D NumRead; + Count +=3D NumRead; + } + + 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 (#80710): https://edk2.groups.io/g/devel/message/80710 Mute This Topic: https://groups.io/mt/85631144/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 Thu Apr 25 11:35:07 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+80711+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+80711+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721591656254.5081578399422; Wed, 15 Sep 2021 08:59:51 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id CBM5YY1788612x2u5nVkJqYj; Wed, 15 Sep 2021 08:59:51 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.101]) by mx.groups.io with SMTP id smtpd.web08.10074.1631721590744114829 for ; Wed, 15 Sep 2021 08:59:50 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DZXziQhmUqECZstREEu5I5G3nATc5VAEImjT7pH/DOzBIcUROXIaK2GreRmwsSTE575Kra2d7dIV3DuuKQ/m5SxNdg9oXtJ1KYhUlSKeLa/P8NYlTIx8A8QE9LSpcocsLEa8+xfBEAbMvvIcFomo9ubtlq9C+le5QRpzYH58NH9be7ihu6rmKjyKL+930/OQqedsWhkOv4SbJVZv7XWeCOWdFiWJcnUxjVSRMuTYBTNOHPGaemPvyfwMT18OBUw6oeqWwj0wXj1s4s3xplFO7g+cwbBxggeYQbQYZxn7OdVseTYaH4Rxbv4q6NtXMNddMHgmp78zoLHYFlJMxMcHGQ== 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; bh=M3ZntUjn10OxQWz++HiAdilLRbw3aSqCcyaCXu5rVI0=; b=RfkL02iPm4DNhpEzH6bXMoPc084ByiTJt7sStDKSXVCm9l88o+5xjhw2ESqQFHOoLyfJC463CRv6xJuJn2V4TamS9CFXul2aEtghdPW04UZnR0b6LpTdj8ijqKAfZm5QTvmj7Li2Zu5GQUpjg8GavG4/tyRkHWdrTQr1I44g+jqCkJ6bWDTuGKJ1QrgWF/CwrfjpqIjD0C6kOjOWu/dRqjP9syWB/G0Cc4Li7kkIVJjmuEf4ZBloyix/54UMQw6KwQ1LW8HDT9mBm5ZZue9wWCkNPU6Psul4M9MvZNz/UkC4fiIfcnYeAXVH781rAAolzzNL9EFN/JJa1Jz1A0nJFA== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR0101MB3065.prod.exchangelabs.com (2603:10b6:4:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15; Wed, 15 Sep 2021 15:59:48 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 15:59:48 +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] [PATCH v3 10/28] AmpereSiliconPkg: Add PlatformManagerUiLib library instance Date: Wed, 15 Sep 2021 22:55:09 +0700 Message-ID: <20210915155527.8176-11-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 15:59:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 34a0d23b-09c2-4571-3b13-08d97861d7b6 X-MS-TrafficTypeDiagnostic: DM5PR0101MB3065: X-MS-Exchange-Transport-Forked: True 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: fGGC4chPoCsR9W2oOukLmXqrUzkf8o8+cvPKTsvX0quBkkdJcgTjYDcCrH3gXPZmdKSaCFnX0hFBNAs7uaPeRlwUwLyr4tD6Lmcr1nXd0IgrL7XTdD1u2eT7TbdcalNylTwl4xFPA03udkeWqe85OdFaZPWzAUBBn1RY9Vmy0O9GEMe9oSykXFh5oSjoS1VMlkiiIPkLwElIPHILvgxC84YtgSy4xoVwW9ztILpFrpeny3r99AxydlwUrl6EiXnuvBBHzc34DmeWse99/eIheyt8u1BT6VSqa7oqkQuhBf7M1t6LHv5dsoBU4NsUuZrzaQJY2+M+gxZDVQmFdcLHFGWDs3TYDp/joVXphjEEhSDUAM0KBP40378QZN6NI0BkHtGc3M/GitBp94U+0faYvbufVIdIQlcmDV8nDG2u7h5A+1FRwtulcbv5vXlDp6thb7G9DFUUhrg4IyZHT8kuALXUpG7atIO/vHpH3BPayMc37+gmRSB0nvM4y8rsm7xaj1XOSZ0RyVIjL8lWfrNiO8UMwLJ7VOy+YBgXDrILe2rBEnJZvLdANNaeM3ZH/wOJaV4GCYfjDOhC9F8WdlSxrpOqe8malnoZUw8h28K/doMEjD/VUnTo2qJL0qwWobwWFlrnN0VItLiok91dfFCdxiM/V+1D5I2YzFj4jfMW2GtIqdigbeI1fpBGQKpfzm1AgUS3HoDi/1nERC7AiUMAlQolNIL1aKSloZpIRSFMoTVkLQSNc/tV9DedcOR1c15O X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?dy0DGapM646rIQ6QszgXvmYtwaVTklSVHXHzTefTykVEtb8r8YiPAyjlZnVY?= =?us-ascii?Q?/qoUxiWhLu8AXIONUGXDVGnnGtv2J2Pwd5eomgTdjs8oRcDnW2fcsF1MF5YQ?= =?us-ascii?Q?JbOSSBGFiFEPhBBt+ztSiw9M/xKo/NXIQrAEb44tQQo23J9g+broj64f5VnJ?= =?us-ascii?Q?Uwsyj6env5ee0hMTVRgn6m2Hg47IIM3iG/JSvkeBPEecDGj0PRhTXmGHwSHN?= =?us-ascii?Q?pM90Lahh3CTbH5qDhM4NA6A31izFw2mluRL7cI6hrOLtQ/lJ6G8mz+KxEOHy?= =?us-ascii?Q?k62a8vC7YUgKqmi9ceFv02FAd92d2PvuKvso3FGfuf9hn6yvfwYngC9sUfYA?= =?us-ascii?Q?3dy7qUUk7dFBJi9IX6UD14HUW/nm6zJKuCAg0bX6m1SngkriKQfyOsAcfHpD?= =?us-ascii?Q?PF6B5n4WL9JQGjdkDsv3SVWGYU1f0CpvPMs2+DKz5cJz4dYmAL0jyDFlpkkp?= =?us-ascii?Q?qGabYlOSWwJ03yupuVk7w6Z+5szwzc3Sz8dpppDXnBnj+YD+PfWkJOEwmq/m?= =?us-ascii?Q?2a+rC1VqAtk/I6785AZyUtR9K6/EZnVdCy/9N3WRnckypge8xVmGPd4rFpDY?= =?us-ascii?Q?HZkfemK5DGgWd7iJoVtxVvt4L3AxIA4SsSx401v0FeHb49PCkehmq/ajjcxr?= =?us-ascii?Q?kdPloZUh9MpknanSnzGs0kVAZRc/VDTqkrX+kv17S+XE50Wq5vtKBovCkcJc?= =?us-ascii?Q?9kARAABdFlipZ4ZzLofvzAEShbIvfS8YgCHmx1NX4OYFH22e4DdWVxIKupdv?= =?us-ascii?Q?1wNOiZkpg3bd2rR1pzFOc2BmfLRkQB8BZCZLdLcx+XUCgBfqXJz5upXolxDW?= =?us-ascii?Q?2w7FfU6vxmWlZpMjf9PVrgBwfp9Wy0wqHu4Fwj1tk3ILnhhcJIcgNIuSobEC?= =?us-ascii?Q?VfaQUZJApiwM1VQbJpQ8We+de6n9tq8Fn72FF7jcLg1FNYTxhRkVWKheq5uE?= =?us-ascii?Q?rX+yOjm4v7Wigw63uWR72APWNYse8o6bbu12W1hdvIQgfXZwaNHcdGkJE8Lw?= =?us-ascii?Q?DY2SLJDqeIbGdlfr71IT9cLvA2sT+L2JpphmOMVFKxpkcC8uSkUwDwCmXsQF?= =?us-ascii?Q?WxAyrGGj4GEeoChwrbIeYj4jsbSUgp5WZ28faWBE8X8Zk89freSIKymufOTd?= =?us-ascii?Q?MDL2MPsuILTHWqTvxVtFF6BIkT5j9NksvDaE1QfudvbHHkRTODrQjeaE4AOM?= =?us-ascii?Q?niIJAs9c+bU2CDPKGkiExNR/KhqHCojg/4S24mUuv62EtPBRTK+H2M6y8MvZ?= =?us-ascii?Q?VlP2qiG5T3urw4jnVQTz7qB89uY443272uAjn6qZBBesDG7Tl2889nAFsvLg?= =?us-ascii?Q?DtSgA3BGCMHlUSJwiRh+9PJe?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 34a0d23b-09c2-4571-3b13-08d97861d7b6 X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 15:59:48.1007 (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: nIF7s62sY8CpUYBOrSL5eNrSit49Bf6wzLtID3VsPDacdzwOpWWPrL07VjeY3aYi6vK+HasDnf0fELKPR4Isshp1nr0uJwFf68ZVNQeQ3B4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0101MB3065 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: MB45sCOiy4EMDKtmldZNwjpbx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721591; bh=G6kI9MuInlpMSaL9YPy8Q3pOyGS+tRZfjjw3FjZdSQo=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=YrfA+rlWakw0w6v+Zqpc+pVVZkL6mKJUHf01BkHLPqclQXPRN//HGIe+mXbS+rUEJXZ 3wQGZghAfc0cp++Mj/rqR9XZ9OM024JHiV2psBU6C3KlkZDTKrkqHK7iKtIusewwWiTzQ W041Hz+ECzKlQgxT7BS4mm9cZMBmB3FLE7g= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721593729100001 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: Vu Nguyen 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 646a53fc031c..36b1249c7a08 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 7f84ac2df50a..aee00f114666 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -656,6 +656,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 (#80711): https://edk2.groups.io/g/devel/message/80711 Mute This Topic: https://groups.io/mt/85631145/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 Thu Apr 25 11:35:07 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+80715+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+80715+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721615645918.3107325920353; Wed, 15 Sep 2021 09:00:15 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id GhW7YY1788612xagSHIF5eBu; Wed, 15 Sep 2021 09:00:14 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.138]) by mx.groups.io with SMTP id smtpd.web09.9881.1631721613180321102 for ; Wed, 15 Sep 2021 09:00:13 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EAnMrICZ1X+HDIxzssI2z0/fwBxxih3WVP3bXrzNZXHJ/Tcd5cWua6LJcvOyTmoNK8X2AtnmKcYEdxBx45OfOLsC1+bv8i0xU7Y1L1d3X5mDcD6NKAoJSC7TepD1+fRPzgs/zCsDX4B0CgG7hcAm/qno1/CqbS17lX2GH4CJJ+NnEKh01Jy0+CtansagXKVYRgUuLvfHpqOw/msJN5EaSX88Niu1TSfWPYTVNR2m42ebqlplmOxgXpbUy7QRNqp++FNiIRHQL25i8IC+IX47gkQ8fWIQSe77el5i8ZBlgrK17zCDkdGX9nZ0kiSEXxPodBkOJRVhZIFm4TYijnSrNg== 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; bh=6zneTg9h4PS4w3qI5Fv4AybupquqxLycHiRJcoeBijY=; b=Cxf7Jx31zqTLibTqGmYG2VyeKCIcgRKGYGEqR1hCveBHw99yoHhrRKeIf1Z087niw4I65Na/afpCUw33kF08l+ul/cWKW4KwQhd5AOOfuYosmNyjZSzQogsDDF/0jtnLVgMrrLjOrJQoKtUJjHHAGqjnRot1RlwwiBoMRmRnUgyva14Mz6C1wSDSxQQKX/jPLa9dhkfVRZa9idLIaJut1DxoRpcUxtcuBHeYALuUwLH4SAaZMXO/AafI/4EJgx9uC4prkmu8XZkY4bQtqnPQPhy0YMk71ca/7CPCBWqhl7+tVA73xe5qSYaV9xoatmU6BaG3fPNlyZ0FQ8lZhxpzjg== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR0101MB3065.prod.exchangelabs.com (2603:10b6:4:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15; Wed, 15 Sep 2021 15:59:52 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 15:59:52 +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] [PATCH v3 11/28] AmpereAltraPkg, JadePkg: Add ACPI support Date: Wed, 15 Sep 2021 22:55:10 +0700 Message-ID: <20210915155527.8176-12-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 15:59:48 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bd7913eb-cf83-460a-9db5-08d97861d9ec X-MS-TrafficTypeDiagnostic: DM5PR0101MB3065: X-MS-Exchange-Transport-Forked: True 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: xG567xy/9+gxZTMGnVbs6UPo6beVlxTAgoOwltARfqScGCSEYCJW0HUsq0EiumQuY+4jVoBtNQBQj/aooCqbNW5u/Adkome7cPpW3ugfCB5uLHZGNeiy3fUVsh1SyMnBq6h68IgZS+Y2AB+RhD6XZvnJZWqzi5ChKnOH9uP52m8XAq+5vu9xOVBJyU8XIU2ugKtIUUKRj8mey/XqbLIxOyaXvftjsQAoObSAq2IJkCTVsccDCbVd2RKoQnLXs8qPwnOLe+r9wAwtD6u8aNbhYM0wjz9i8mFhkIqDwrNqUDWU/qOy+5GCDk5cOrsvYu9vEfnVNo04lJ4Xk5jRiVVhfYSGOOtD2t49QLWQj7hn/SAMuBjGfGhkA+ZeRhqwbszZ1geDWPypDYOjrf3YPW1ozTC63m8to4HZBYnWqR+tbWvOw+Ki6ZuXPUBAsYzNh3E0+wNlAWIp0qlL40/HxhKDHEkY9UPraTuHnM8pIv0H8M/nXqMCbzpkQ2RPQ4hpyOREyPPhE21lM+6qwyfxCeA/KVt2/gXfMKRNCe+CAKhHeTFh9QQX3hTfzF8Z8V1StH4dR8fd2dJF9l5yeigxdtpsCBgPzbXUNwQJgc5IpnKIZt9jUPOYfMhPwDasIk+gZRDDCUlW5LlkHWmL1wW+wWrJCTOe6AiAY6lvFSb+mBT2PSwWt2U45Q2qA2ENZUkYX5n7QcrkokYPtV7RDlhSkgZrgqsvAaDfc4LbaBPJdqbD90qBb3TK7Lq4r+I3UPLCvQ6hVyQCI/V0n0eCXT4njwtiruWgHXTftc/feSwtu/cGDGWrsiebH9u+ZuuXIKM92dAU X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?A5MykeJ2DqyFodvHB3xM3nH6xOlSl3tel9ZE8ZoLIU3Z/zfuTSsN++zdZH6O?= =?us-ascii?Q?AlL2CPt903Xgrk8EIXKHgXnjUX+x19DByHxjeUDfxekuRrnlvYnGtXwVfgOM?= =?us-ascii?Q?GjY2ulT/iVHrFTT2o6hUKlGsPkZbNpXh2OYOv+g2bmXnmKVGVxk27F+SZWSi?= =?us-ascii?Q?Wdu8gYmYG2B3MVH9NL66JszrWWDi1Ugj+GhDKRzLPAw70IgPbFj8vRBkSQjI?= =?us-ascii?Q?jlZJI3+Xu0Cg6iykjOVcGme7wrjpe7ljNrtONA9gxh8xBBW4xNF+AvqmEkxe?= =?us-ascii?Q?QEufBJtlvJSUYGCmzizEWezy93YP3Tda9aFtcxt5MSdq/LuKUuufQjshIhrO?= =?us-ascii?Q?Y1UQotlUSUv8tgXXxPWgs9U220Jx0zCFlrZJkmVntItnOjulAWpg8G4hhUv7?= =?us-ascii?Q?7CuS/QmCHVO0leiXorZgWf4cD5TI4TcHgz0qzWUGJiUGt90t2EkVb4DV36ml?= =?us-ascii?Q?jIy95ZEWKNoMt047XKjpWSrMqa3QemTWrXPUPkoIYxm4r4mTd0yNyZpSgwVs?= =?us-ascii?Q?PTIVbputQLQ5BfLc7kdYdJ+ye0ubW5aoGl8kNauv5QFCKUO8+w3iWatQ4GVK?= =?us-ascii?Q?P7GVbGi0ru+/C+GchmjVARfuKxrvUcvdm1GPrhixNuRhW2Ow0LQ+/uMKl4d6?= =?us-ascii?Q?76sdTcwej9TFSTZS9mhpyHNYw3B7J/DaPh2MtQUH0yrnyzcGWGsUl/1aQtDy?= =?us-ascii?Q?4TcT8rC4rKyk5LlTldkeJ2488L1QpHEqOSWuQxlMnkInXBwySHCnAsqBdpkR?= =?us-ascii?Q?DeRKmZ/eHf8xMdXAP4XJk0jP+VLl1fKVemj4bzLJob9dhCrWa/WLFvi0bwmV?= =?us-ascii?Q?kaFhdK+ziiZmDzdZxkLad1Qr9FQsqgVEH/Mua3NtfNjAut8MBnZSmJKCDYRw?= =?us-ascii?Q?c/Opyce2TMwYWTbynUtAeq6ELJrsY4KWiyvIyyF6QKKemJ7K0clIJAXKxccM?= =?us-ascii?Q?RAySaMSYH0Rna1BxiwSF2APeZYlObMPfF6dbVYirrKaBgLE6/pu6JPGwQX/8?= =?us-ascii?Q?o1NaDqeAGtXVbf6yQBlFSnWwj6bRwT/iOxrkrK8eX4nR/ytk1XQiKpkA/rDS?= =?us-ascii?Q?7vep3fmPuGv2sPqijpotaKpU2ZXbM+9zVZep+WEGDHrOgMMpg222oYtsTU4j?= =?us-ascii?Q?fGf4c+u4SMsah8hedBUnK3sCbuH7OEOzwzJimbD5HoU6NWjuaFEGvGHhMkSc?= =?us-ascii?Q?pYMziPpoMm3e5sReaDIc6rYMQEGr2UOgpaicdM2aJ1C5h6MEiD3zrAuKSRUa?= =?us-ascii?Q?AEyDcrLOQjHkXYWacgWXcenVBX9sY0P3D0Pz7bnFSBI74dyitmqLKrAUaXT1?= =?us-ascii?Q?3I/Eq53nkFyQu0Faq+ujO3xJ?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd7913eb-cf83-460a-9db5-08d97861d9ec X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 15:59:52.6471 (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: me/92a4JFy7G3YB8HSlBAMPA1Yo5U6kOOt968B895WI5oNATo1q1xFhLyeJaXvxD1KCWzDf7QVNTBIBa/qETbuyOCnKvbjmKUWcqe4n4oxM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0101MB3065 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: S1TZg0flxnGMbcTiRXeHifcUx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721615; bh=z87Y0924D8VWLt9jnOvpnG5BmLz+qXFHdA8iHPQ/JnU=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=kWWLvzXPMcLkq8ddlz0gxdk7mcKfu97UCntH368bmDFMrqApGGy8x9uBj4Zmz7uxB7m On9EoHzENNygxXs38o9e98sQHOaIBFF44evXp5z+O3SQr5FwmTa1L8dHqMgoleHzNwQq+ lJvDEQLFjv1ETqqlvIIPCwkydZmXBGF17i0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721617567100005 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 | 21= + Platform/Ampere/JadePkg/Jade.fdf | 8= + Platform/Ampere/JadePkg/AcpiTables/AcpiTables.inf | 20= + Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 77= + Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/AcpiCommonTables.inf | 44= + Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.h | 121= + Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiNfit.h | 49= + Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform.h | 75= + Silicon/Ampere/AmpereAltraPkg/Include/AcpiHeader.h | 37= + Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c | 449= ++ 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= + 39 files changed, 24446 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index aee00f114666..4af85f721cb3 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -468,6 +468,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 c670fd0f34b6..118c03eab42f 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -83,12 +83,22 @@ [LibraryClasses] # FailSafeLib|Platform/Ampere/AmperePlatformPkg/Library/FailSafeLib/FailSa= feLib.inf =20 + # + # ACPI Libraries + # + AcpiLib|EmbeddedPkg/Library/AcpiLib/AcpiLib.inf + ##########################################################################= ###### # # Specific Platform Pcds # ##########################################################################= ###### [PcdsFeatureFlag.common] + # + # Activate AcpiSdtProtocol + # + gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE + [PcdsFixedAtBuild.common] # # NVRAM @@ -114,3 +124,14 @@ [Components.common] # FailSafe and Watchdog Timer # Platform/Ampere/AmperePlatformPkg/Drivers/FailSafeDxe/FailSafeDxe.inf + + # + # 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 375455086d0b..2c6f9fac76fd 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -289,4 +289,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 Platform/Ampere/AmperePlatformPkg/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..2b2a3728a406 --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf @@ -0,0 +1,77 @@ +## @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 + AcpiPptt.c + AcpiPlatform.h + AcpiPlatformDxe.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 + UefiRuntimeServicesTableLib + +[Pcd] + gArmPlatformTokenSpaceGuid.PcdCoreCount + gArmPlatformTokenSpaceGuid.PcdClusterCount + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision + gAmpereTokenSpaceGuid.PcdPmproDbBaseReg + gAmpereTokenSpaceGuid.PcdSmproDbBaseReg + +[Guids] + gArmMpCoreInfoGuid + gEfiAcpiTableGuid + gEfiEventReadyToBootGuid + gPlatformHobGuid + +[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..2e763422cbc6 --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.h @@ -0,0 +1,121 @@ +/** @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_ERROR_TYPE 0x7F +#define BERT_UEFI_FAILURE 5 +#define RAS_2P_TYPE 0x03 +#define BERT_DEFAULT_ERROR_SEVERITY 0x1 +#define GENERIC_ERROR_DATA_REVISION 0x300 + + +#define PLAT_CRASH_ITERATOR_SIZE 0x398 +#define SMPRO_CRASH_SIZE 0x800 +#define PMPRO_CRASH_SIZE 0x800 +#define HEST_NUM_ENTRIES_PER_SOC 3 + +#define CURRENT_BERT_VERSION 0x10 +#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 S1PmproRegisters[PMPRO_CRASH_SIZE]; + UINT8 S1SmproRegisters[SMPRO_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..920579281dd5 --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiNfit.h @@ -0,0 +1,49 @@ +/** @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 (PLATFORM_NVDIMM_MCU_MAX_PER_SK * PLATFORM_NVD= IMM_NUM_MAX_PER_MCU) +#define ONE_GB (1024 * 1024 * 1024) + +enum NvdimmMode { + NVDIMM_DISABLED =3D 0, + NVDIMM_NON_HASHED =3D 1, + NVDIMM_HASHED =3D 2 +}; + +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[PLATFORM_NVDIMM_REGION_MAX_PER_SK]; + 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..a321bfbf3adb --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform.h @@ -0,0 +1,75 @@ +/** @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 +#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/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c b/P= latform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c new file mode 100644 index 000000000000..a216edac60ce --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c @@ -0,0 +1,449 @@ +/** @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 ( + (UINT8 *)BERT_FLASH_OFFSET, + (UINT8 *)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; + + CrashSize =3D PLAT_CRASH_ITERATOR_SIZE * + GetNumberOfSupportedSockets () * + GetMaximumNumberOfCores (); + CrashSize +=3D 2 * (SMPRO_CRASH_SIZE + PMPRO_CRASH_SIZE); + CrashSize +=3D sizeof (WrappedError->Bed.Vendor) + sizeof (WrappedError-= >Bed.BertRev); + + 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 (WrappedError->Bed.Vendor.Type =3D=3D RAS_2P_TYPE || + (WrappedError->Bed.Vendor.Type =3D=3D BERT_ERROR_TYPE && + (WrappedError->Bed.Vendor.SubType =3D=3D 0 || + WrappedError->Bed.Vendor.SubType =3D=3D BERT_UEFI_FAILURE))) + { + 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 BERT_ERROR_TYPE; + 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 ((UINT8 *)Offset, Length); + FlashProgramCommand ( + (UINT8 *)Offset, + (UINT8 *)&(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 ((UINT8 *)Offset, Length); + FlashProgramCommand ( + (UINT8 *)Offset, + (UINT8 *)&(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 ((UINT8 *)Offset, Length); + FlashProgramCommand ( + (UINT8 *)Offset, + (UINT8 *)&(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 ((UINT8 *)Offset, Length); + FlashProgramCommand ( + (UINT8 *)Offset, + (UINT8 *)&(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 ((UINT8 *)Offset, Length); + FlashProgramCommand ((UINT8 *)Offset, (UINT8 *)&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..3c0a4860e62d --- /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 (&gPlatformHobGuid); + 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 (&gPlatformHobGuid); + 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 NVDIMM_NON_HAS= HED) { + 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 + PLATFORM_NVDIMM_SK0_NHASHED_REGION0) + { + /* 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 + PLATFORM_NVDIMM_SK0_NHASHED_REGION1) + { + /* 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 NVDIMM_NON_HAS= HED) { + 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 + PLATFORM_NVDIMM_SK1_NHASHED_REGION0) + { + /* 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 + PLATFORM_NVDIMM_SK1_NHASHED_REGION1) + { + /* 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..1dea9ba2f2bc --- /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, + GICR_MASTER_BASE_REG, /* 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 */ + GICD_BASE_REG, /* 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 GICR_SLAVE_BASE_REG; + } + + return Size; +} + +UINT32 +AcpiInstallMadtGicIts ( + VOID *EntryPointer, + UINT32 Index + ) +{ + EFI_ACPI_6_3_GIC_ITS_STRUCTURE *GicItsEntryPointer =3D EntryPointer; + UINTN Size, Offset; + UINT64 GicBase =3D GICD_BASE_REG; + UINT32 ItsId =3D Index; + + if (Index > SOCKET0_LAST_RC) { /* Socket 1, Index: 8-15 */ + GicBase =3D GICD_SLAVE_BASE_REG; + 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 (!IsSlaveSocketPresent ()) { + 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 (!IsSlaveSocketPresent ()) { + 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..fe59c47932d1 --- /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 (&gPlatformHobGuid); + 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 (&gPlatformHobGuid); + 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 NVDIMM_HASHED) { + NvdInfo =3D &NvdData[Socket].NvdInfo[NVDIMM_SK0]; + NvdInfo->DeviceHandle =3D + (Socket =3D=3D 0) ? PLATFORM_NVDIMM_NVD1_DEVICE_HANDLE : + PLATFORM_NVDIMM_NVD3_DEVICE_HANDLE; + NvdInfo->InterleaveWays =3D PLATFORM_NVDIMM_HASHED_INTERLEAVE_WAYS; + NvdInfo->RegionOffset =3D 0; + AcpiNvdInfoInit ( + NvdInfo, + (Socket =3D=3D 0) ? PLATFORM_NVDIMM_NVD1_DIMM_ID : + PLATFORM_NVDIMM_NVD3_DIMM_ID + ); + + NvdInfo =3D &NvdData[Socket].NvdInfo[1]; + NvdInfo->DeviceHandle =3D + (Socket =3D=3D 0) ? PLATFORM_NVDIMM_NVD2_DEVICE_HANDLE : + PLATFORM_NVDIMM_NVD4_DEVICE_HANDLE; + NvdInfo->InterleaveWays =3D PLATFORM_NVDIMM_HASHED_INTERLEAVE_WAYS; + NvdInfo->RegionOffset =3D PLATFORM_NVDIMM_HASHED_REGION_OFFSET; + AcpiNvdInfoInit ( + NvdInfo, + (Socket =3D=3D 0) ? PLATFORM_NVDIMM_NVD2_DIMM_ID : + PLATFORM_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; + } + /* NVDIMM_NON_HASHED */ + 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 + PLATFORM_NVDIMM_SK0_NHASHED_REGION0 || + PlatformHob->DramInfo.Base[RegionId] =3D=3D + PLATFORM_NVDIMM_SK1_NHASHED_REGION0) + { + NvdInfo =3D &NvdData[Socket].NvdInfo[0]; + NvdInfo->DeviceHandle =3D + (Socket =3D=3D 0) ? PLATFORM_NVDIMM_NVD1_DEVICE_HANDLE : + PLATFORM_NVDIMM_NVD3_DEVICE_HANDLE; + NvdInfo->InterleaveWays =3D PLATFORM_NVDIMM_NHASHED_INTERLEAVE_WAYS; + NvdInfo->RegionOffset =3D 0; + AcpiNvdInfoInit ( + NvdInfo, + (Socket =3D=3D 0) ? PLATFORM_NVDIMM_NVD1_DIMM_ID : + PLATFORM_NVDIMM_NVD3_DIMM_ID + ); + + } else if (PlatformHob->DramInfo.Base[RegionId] =3D=3D + PLATFORM_NVDIMM_SK0_NHASHED_REGION1 || + PlatformHob->DramInfo.Base[RegionId] =3D=3D + PLATFORM_NVDIMM_SK1_NHASHED_REGION1) + { + NvdInfo =3D &NvdData[Socket].NvdInfo[1]; + NvdInfo->DeviceHandle =3D + (Socket =3D=3D 0) ? PLATFORM_NVDIMM_NVD2_DEVICE_HANDLE : + PLATFORM_NVDIMM_NVD4_DEVICE_HANDLE; + NvdInfo->InterleaveWays =3D PLATFORM_NVDIMM_NHASHED_INTERLEAVE_WAYS; + NvdInfo->RegionOffset =3D 0; + AcpiNvdInfoInit ( + NvdInfo, + (Socket =3D=3D 0) ? PLATFORM_NVDIMM_NVD2_DIMM_ID : + PLATFORM_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 (&gPlatformHobGuid); + 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 NVDIMM_HASHED) { + /* 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 { /* NVDIMM_NON_HASHED */ + 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 PLATFORM_NVDIMM_SK0_NHASHED_REGI= ON0) || + (NvdRegionBase =3D=3D PLATFORM_NVDIMM_SK1_NHASHED_REGION= 0)) ? + 0 : PLATFORM_NVDIMM_NUM_MAX_PER_MCU; + MaxNvdCount =3D NvdCount + PLATFORM_NVDIMM_NUM_MAX_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..4a04343c9ea0 --- /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_ERROR, "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..ccd4f9eaeca9 --- /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 (&gPlatformHobGuid); + 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 (&gPlatformHobGuid); + 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 (!IsSlaveSocketPresent ()) { + 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 (!IsSlaveSocketPresent ()) { + 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 (#80715): https://edk2.groups.io/g/devel/message/80715 Mute This Topic: https://groups.io/mt/85631181/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 Thu Apr 25 11:35:07 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+80712+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+80712+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721602979852.421609339483; Wed, 15 Sep 2021 09:00:02 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id BiZEYY1788612xCCFKABloPS; Wed, 15 Sep 2021 09:00:02 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.101]) by mx.groups.io with SMTP id smtpd.web08.10078.1631721601274623016 for ; Wed, 15 Sep 2021 09:00:01 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CVbfoKodWFRTLGXENkurIS8VSxLfk7UjI0h6eEUB1pIQ2BfKM29vHGcQW3TNJrpdAPTOgTFj8xNOKEaoFeWu2uNyPC60rUQiSa7C5hN68Pi/jaYiibpxjObc6nydrxB52fIMXIVIpRt7YSc+ilvaF2MvZwbTl1TQHvc/YAW8xFRLe5JDNMJ+4wrcFWq+pJk7zlKKVAmkobomDLEU1QE16WtorkamUMykVBoZQAjg6HdBe6VKX/wmXF+Z9+ECoRaZB7pu4SFqlF75Cy911HhgrIzG2QYoexkOydbAE9ubzhl9gcRNeQXTr1J9VbS8czTI5fOVDaSYU0SHHsYJ53hGXg== 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; bh=0sdNAVCuDwWq4iKSq1qjf4ckq/HHPrZOz0efQQ8F5ak=; b=WMzHV+IDq0bX8S/cNQQyV+ziCho0RdSMVyQyNA20WmDBTJfK304r6OopfEcWa6hrts9+HGN0bCf9CRBC4jWUXsdWqFEULc8758ltKG9a1odsZ0Xv+qZRXXuhWd94uo79HEtc5oYcaOX67rjlbwQp4jWohAliWqWc/ew9CQXWT8LgWlk5zi0v630DcX6XyTh7GYO1QNsN1eYV1b5iDaO+iK67slrfhAEvYccHMqt+tyn9qTjiZZMrGAZoBSOkfsQbx/1o4Jjt1s52hkHzuy7ctjOMnPMTW4Ox3F14ETjOzKP/Eq2th21tC4ucmNB7SN+PpCa0N5K+CZTG7Kflorq9AA== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR0101MB3065.prod.exchangelabs.com (2603:10b6:4:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15; Wed, 15 Sep 2021 15:59:56 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 15:59: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] [PATCH v3 12/28] AmpereAltraPkg: Add Ac01PcieLib library instance Date: Wed, 15 Sep 2021 22:55:11 +0700 Message-ID: <20210915155527.8176-13-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 15:59:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 761bf82d-c998-4b87-dc94-08d97861dcac X-MS-TrafficTypeDiagnostic: DM5PR0101MB3065: X-MS-Exchange-Transport-Forked: True 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: lItzW4GXkVYcmdmOTmcds3bUwESdctw5YCMrfA4aIKNuqemupz4NENw+FYm2BGhLOFDKd3DEElOBgswbgxT4jhR8A6rhj3eKkI3ZDzn8A86hRmXMWOO4uEV7COyjnfSdpRkSDuOhxsDv+X7/iw+adku5V727rDvkCgU4PYbSh5G0NCuEe8NoULWed1N+0m+YW7fit/7MukzEz32FIhWbHy1KYIL4scnICWHvfJcnJgCNsWREbqxeG911l4svpZaRuWzoiurNZCK9TYXeQN0HZhdl/YJpy+Y2iQ0XvP/vGHJygeItHNZgCJk7EpXMd1bj9VTUApsNZh2jfqQJPW5TS82ivq+LjBmVOj4Y1SDEgn5vJhCc0Lxd2achPNsnislDQEfg80E5oaiWLGutpR/1ew62VN+EhzFdz446bhUcjvUK2w/1wMPPj9bqoEiJPx5N+XQwhDRogtkohQNwh5Y682aOLzBnPsXP9rb+gtvMkk5lM/WsN0vxv96Dtm7hM6T3RJOhBFXWAb7rSuovHCNQCKMBdG2YQkN4aVxVTehFromcAHmoJc0HsCGMDurteIbivGqOdawQhMc6Hv7gjYTSNO9J0CjTPefD+tNFLQpHwbrfxkochzHxvSwW+UivyzeDk0Ooifj8l2oas3FkyYBbpmOFkNQHXn2ORKkfOvwk4vLLJLqOCPJgI3SkMcwRzFuVbuLKWBMwaxrnLsNJnWPsyg== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?CN76TF5SRs3pV8WNPKJXRGW0SGu0fF9C8WNbehCk+3r3t8RI52/T4AP8i7b9?= =?us-ascii?Q?aubr0B+qG+5CkRQ6uPDBQqLCMcs03VqI8FDv4Zy02EPLEWf/D/IAcGUGmmV/?= =?us-ascii?Q?iQ5RzsJZgMC3dCk6K5cq4FVnUNvnLzHIiJTKE1HPia9Ds+GnHFvWdjsW4KJC?= =?us-ascii?Q?afSKz1WEwV2xCUUnM4qKL46S6nZk1Bq/qhMV7HCcVaVg27RVS96oAyjo+cSh?= =?us-ascii?Q?Jb1s//w5fE2VlTkJa+ZEQw6V2PZHAGt1VpplB0shJVJaYHh1TUQ0R0Uvxk5s?= =?us-ascii?Q?sUsf4tbnFEG/4yOQWUNxRe7NG+IKpEjjl5D3MIRQDmlTYKBtaY+G7ae7eI7i?= =?us-ascii?Q?2VandXzznvuLfWB1kSmQ/yapOffCfgVa+uHPe7Ld5FneGcoEqi6CvVuBcYQu?= =?us-ascii?Q?7B5NNZRMbGOzqGSad6wtme/QEDdvs+YoHQKZ8zscwuL8eiXNRqE/8gzjZf0F?= =?us-ascii?Q?x/0ADmF0fAZXLyCCmU8UVrgJCZa2Kw79zGQZQ3Q2o0xMTdXER8W1Fa5h/X2z?= =?us-ascii?Q?55rAIf1cUHu04KGBxGfWD0wA8bu0C2bs+IEpl3QGaGxa6BX/c2Sthkz3QgzS?= =?us-ascii?Q?xLdf1gawBG+aHCc7UFJYN0dlWTFlN4ixEs6W8SANge5viKN2U5264u8uougD?= =?us-ascii?Q?TxQAcEwQvBveXMtFG4zhcCEURQ6m2HXKdUmbvcSaemQ7WguvIdPuTiKJh41W?= =?us-ascii?Q?wgX9DZ0ZC1h2UfheBrOb/D9oKPrsQFDud9RhS2/vWDGpDEMSFMJrBmDMk8gq?= =?us-ascii?Q?WIaQNGJbgrts7OMGRl8j1oDZY6byCM7eoBoHmRawVqroWVIARIypSFIs6ks6?= =?us-ascii?Q?lOneLG5gOgdQTqmA/xIS6F3+cificOQqg+PeE7LFybrt6ro0jhaRyC/KKwQ9?= =?us-ascii?Q?lVNw0g9rzmU0wUPr7Gpjf39bh9EsRAg3Jrzi4IFe9EsEgvYKjMoIeHSzZQRE?= =?us-ascii?Q?emRHfO2DkMIEG4+Vv7lvAt41SDx9kMFwOdlRP0bePIbwWmFG4bnh2ExVqBfP?= =?us-ascii?Q?w4G4IZlSws2bMU4HfLEsaKJH+kAJvvPrylYmN9nYoNMKAudoC9vJ7quXlMab?= =?us-ascii?Q?m9c7KFv58d9bicwrjSGHtxRSm5yC+8p3PUgm6Bbp9MRr85O9WXmaQl8gZFEq?= =?us-ascii?Q?KrOLUXMs6P6JicLpr4mRkX3DOXaMMr9vEBNfPEENS2B+266Gc9wJpXI+Rrub?= =?us-ascii?Q?fr5JbZmvsZA008GnSiWnsLdZsO+6oUsPUmOn+JjXZ14N5AKZHwZzYpDIp3t8?= =?us-ascii?Q?lD65vwsLVhOIunf5mbkvziICSZgnrq0/HcFwgbkaryDI44qSof/T0kn5bScc?= =?us-ascii?Q?0TLy1DgefViTlXpi5tEq0EFk?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 761bf82d-c998-4b87-dc94-08d97861dcac X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 15:59:56.3770 (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: 2q5PlOj+1ltueNeGyGXyxKK1p+jFvTZGutWHnOKDzuTinCyGrebD1tJaL1xpU3llDldOdasB2x5aqATzTHL+gPHOZEv2RmU1803/L8okhz8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0101MB3065 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: pnjgwkB6ljHEaVWTXgIBfFqTx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721602; bh=k9DAeFJRrptUHPDsL068RXpNRGpAn4nJAfz7UsHJQLU=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=CLIQ6KYrC9E67uP+p/mHBY5MEPPq3GV8/bWAk4Wz80PtdTZpADIKprmg4fgZ7dUfool 3f1QcbCEVoD7UB6gcScBGmtXSXJw52SpCFp+NR5tsGOhZ5dLxoxnvP5CxT2P9eLREJV3U 7CAJgsu1Quo8FnvEeZLBMZpQtTvjGURl+4c= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721605108100001 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen Provides essential functions to initialize the PCIe Root Complex of 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: Vu Nguyen --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec | 6 + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc | 1 + Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/Ac01PcieLib.inf | 67 + Silicon/Ampere/AmpereAltraPkg/Include/Ac01PcieCommon.h | 128 = ++ Silicon/Ampere/AmpereAltraPkg/Include/Library/Ac01PcieLib.h | 163 = ++ Silicon/Ampere/AmpereAltraPkg/Include/Library/BoardPcieLib.h | 92 = ++ Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h | 19 = +- Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.h | 649 = ++++++++ Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCoreCapCfg.h | 63 + Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PciePatchAcpi.h | 30 + Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c | 1659 = ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCoreLib.c | 556 = +++++++ Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PciePatchAcpi.c | 646 = ++++++++ 13 files changed, 4077 insertions(+), 2 deletions(-) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Amp= ere/AmpereAltraPkg/AmpereAltraPkg.dec index d5b12a81e9bf..93da9b38def5 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -37,6 +37,12 @@ [LibraryClasses] ## @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 + ## @libraryclass Defines a set of methods to initialize Pcie + Ac01PcieLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/Ac01PcieLib.h + + ## @libraryclass Defines a set of platform PCIe functions + BoardPcieLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/BoardPcieLib.h + ## @libraryclass Defines a set of methods to access flash memory. FlashLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/FlashLib.h =20 diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index 4af85f721cb3..d4e1b84c0276 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -82,6 +82,7 @@ [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 + 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/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/Ac01PcieLib.= inf b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/Ac01PcieLib.inf new file mode 100644 index 000000000000..e2b0f293eb24 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/Ac01PcieLib.inf @@ -0,0 +1,67 @@ +## @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 DXE_DRIVER + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D Ac01PcieLib + +[Sources] + PcieCore.c + PcieCore.h + PcieCoreCapCfg.h + PcieCoreLib.c + PciePatchAcpi.c + PciePatchAcpi.h + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraBinPkg/AmpereAltraBinPkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + AcpiLib + AmpereCpuLib + ArmLib + BaseLib + BaseMemoryLib + BoardPcieLib + DebugLib + GpioLib + IoLib + MemoryAllocationLib + PcdLib + PciePhyLib + SerialPortLib + SystemFirmwareInterfaceLib + TimerLib + UefiBootServicesTableLib + UefiLib + UefiRuntimeServicesTableLib + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision + +[Protocols] + gEfiAcpiTableProtocolGuid # PROTOCOL ALWAYS_CONSUMED + gEfiAcpiSdtProtocolGuid # PROTOCOL ALWAYS_CONSUMED + +[Guids] + gPlatformHobGuid + +[Depex] + gEfiAcpiTableProtocolGuid AND gEfiAcpiSdtProtocolGuid diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Ac01PcieCommon.h b/Silic= on/Ampere/AmpereAltraPkg/Include/Ac01PcieCommon.h new file mode 100644 index 000000000000..b72c305f4637 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Ac01PcieCommon.h @@ -0,0 +1,128 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef AC01_PCIE_COMMON_H_ +#define AC01_PCIE_COMMON_H_ + +#define PRESET_INVALID 0xFF + +// +// PCIe link width +// +enum { + LNKW_NONE =3D 0, + LNKW_X1 =3D 0x1, + LNKW_X2 =3D 0x2, + LNKW_X4 =3D 0x4, + LNKW_X8 =3D 0x8, + LNKW_X16 =3D 0x10, +}; + +// +// PCIe link speed +// +enum { + SPEED_NONE =3D 0, + SPEED_GEN1 =3D 0x1, + SPEED_GEN2 =3D 0x2, + SPEED_GEN3 =3D 0x4, + SPEED_GEN4 =3D 0x8, +}; + +// +// PCIe controller number +// +enum { + PCIE_0 =3D 0, + PCIE_1, + PCIE_2, + PCIE_3, + PCIE_4, + MAX_PCIE_A =3D PCIE_4, + PCIE_5, + PCIE_6, + PCIE_7, + MAX_PCIE, + MAX_PCIE_B =3D MAX_PCIE +}; + +// +// Root Complex type +// +enum { + RCA, + RCB +}; + +// +// Root Complex number +// +enum { + RCA0 =3D 0, + RCA1, + RCA2, + RCA3, + MAX_RCA, + RCB0 =3D MAX_RCA, + RCB1, + RCB2, + RCB3, + MAX_RCB, + MAX_RC =3D MAX_RCB +}; + +// +// Data structure to store the PCIe controller information +// +typedef struct { + UINT64 CsrAddr; // Pointer to CSR Address + UINT64 SnpsRamAddr; // Pointer to Synopsys SRAM address + UINT8 MaxGen; // Max speed Gen-1/-2/-3/-4 + UINT8 CurGen; // 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 Compl= ex + 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; + +// +// Data structure to store the Root Complex information +// +typedef struct { + UINT64 BaseAddr; + UINT64 TcuAddr; + UINT64 HBAddr; + UINT64 MsgAddr; + UINT64 SerdesAddr; + UINT64 MmcfgAddr; + UINT64 MmioAddr; + UINT64 MmioSize; + UINT64 Mmio32Addr; + UINT64 Mmio32Size; + UINT64 IoAddr; + AC01_PCIE Pcie[MAX_PCIE_B]; + UINT8 MaxPcieController; + UINT8 Type; + UINT8 ID; + UINT8 DevMapHigh:3; // Copy of High Devmap programmed to H= ost bridge + UINT8 DevMapLow:3; // Copy of Low Devmap programmed to Ho= st bridge + UINT8 DefaultDevMapHigh:3; // Default of High devmap based on boa= rd settings + UINT8 DefaultDevMapLow:3; // Default of Low devmap based on boar= d settings + UINT8 Socket; + BOOLEAN Active; + UINT8 Logical; + VOID *RootBridge; // Pointer to Stack PCI_ROOT_BRIDGE + UINT32 Flags; // Flags + UINT8 PresetGen3[MAX_PCIE_B]; // Preset for Gen3 + UINT8 PresetGen4[MAX_PCIE_B]; // Preset for Gen4 +} AC01_RC; + +#endif diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Library/Ac01PcieLib.h b/= Silicon/Ampere/AmpereAltraPkg/Include/Library/Ac01PcieLib.h new file mode 100644 index 000000000000..47c6452a0499 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/Ac01PcieLib.h @@ -0,0 +1,163 @@ +/** @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_ + +#include +#include + +/** + Get RootBridge disable status. + + @param[in] HBIndex Index to identify of PCIE Host bridge. + @param[in] RBIndex Index to identify of underneath PCIE R= oot bridge. + + @retval BOOLEAN Return RootBridge disable status. +**/ +BOOLEAN +Ac01PcieCheckRootBridgeDisabled ( + IN UINTN HBIndex, + IN UINTN RBIndex + ); + +/** + Prepare to start PCIE core BSP driver + + @retval EFI_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +EFI_STATUS +Ac01PcieSetup ( + VOID + ); + +/** + Prepare to end PCIE core BSP driver. +**/ +VOID +Ac01PcieEnd ( + VOID + ); + +/** + Get Total HostBridge. + + @retval UINTN Return Total HostBridge. +**/ +UINT8 +Ac01PcieGetTotalHBs ( + VOID + ); + +/** + Get Total RootBridge per HostBridge. + + @param[in] RCIndex Index to identify of Root Complex. + + @retval UINTN Return Total RootBridge per HostBridge. +**/ +UINT8 +Ac01PcieGetTotalRBsPerHB ( + IN UINTN RCIndex + ); + +/** + Get RootBridge Attribute. + + @param[in] HBIndex Index to identify of PCIE Host bridge. + @param[in] RBIndex Index to identify of underneath PCIE R= oot bridge. + + @retval UINTN Return RootBridge Attribute. +**/ +UINTN +Ac01PcieGetRootBridgeAttribute ( + IN UINTN HBIndex, + IN UINTN RBIndex + ); + +/** + Get RootBridge Segment number + + @param[in] HBIndex Index to identify of PCIE Host bridge. + @param[in] RBIndex Index to identify of underneath PCIE R= oot bridge. + + @retval UINTN Return RootBridge Segment number. +**/ +UINTN +Ac01PcieGetRootBridgeSegmentNumber ( + IN UINTN HBIndex, + IN UINTN RBIndex + ); + +/** + Initialize Host bridge + + @param[in] HBIndex Index to identify of PCIE Host bridge. + + @retval EFI_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +EFI_STATUS +Ac01PcieSetupHostBridge ( + IN UINTN HBIndex + ); + +/** + Initialize Root bridge + + @param[in] HBIndex Index to identify of PCIE Host bridge. + @param[in] RBIndex Index to identify of underneath PCIE R= oot bridge. + @param[in] RootBridgeInstance The pointer of instance of the Root br= idge IO. + + @retval EFI_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +EFI_STATUS +Ac01PcieSetupRootBridge ( + IN UINTN HBIndex, + IN UINTN RBIndex, + IN PCI_ROOT_BRIDGE *RootBridge + ); + +/** + Reads/Writes an PCI configuration register. + + @param[in] RootInstance Pointer to RootInstance structure. + @param[in] Address Address which want to read or write to. + @param[in] Write Indicate that this is a read or write = command. + @param[in] Width Specify the width of the data. + @param[in, out] Data The buffer to hold the data. + + @retval EFI_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +EFI_STATUS +Ac01PcieConfigRW ( + IN VOID *RootInstance, + IN UINT64 Address, + IN BOOLEAN Write, + IN UINTN Width, + IN OUT VOID *Data + ); + +/** + Callback funciton for EndEnumeration notification from PCI stack. + + @param[in] HBIndex Index to identify of PCIE Host bridge. + @param[in] RBIndex Index to identify of underneath PCIE R= oot bridge. + @param[in] Phase The phase of enumeration as informed f= rom PCI stack. +**/ +VOID +Ac01PcieHostBridgeNotifyPhase ( + IN UINTN HBIndex, + IN UINTN RBIndex, + IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase + ); + +#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..772a85dd5677 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Library/BoardPcieLib.h @@ -0,0 +1,92 @@ +/** @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 + +/** + Override the segment number for a root complex with a board specific num= ber. + + @param[in] RC Root Complex instance with properties. + @param[out] SegmentNumber Return segment number. + + @retval EFI_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +EFI_STATUS +EFIAPI +BoardPcieGetRCSegmentNumber ( + IN AC01_RC *RC, + OUT UINTN *SegmentNumber + ); + +/** + Check if SMM PMU enabled in board screen. + + @param[out] IsSmmuPmuEnabled TRUE if the SMMU PMU enabled, otherwis= e FALSE. + + @retval EFI_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +EFI_STATUS +EFIAPI +BoardPcieCheckSmmuPmuEnabled ( + OUT BOOLEAN *IsSmmuPmuEnabled + ); + +/** + Build PCIe menu screen. + + @param[in] RCList List of Root Complex with properties. + + @retval EFI_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +EFI_STATUS +EFIAPI +BoardPcieScreenInitialize ( + IN AC01_RC *RCList + ); + +/** + Parse platform Root Complex information. + + @param[out] RC Root Complex instance to store the pla= tform information. + + @retval EFI_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +EFI_STATUS +EFIAPI +BoardPcieParseRCParams ( + OUT AC01_RC *RC + ); + +/** + Assert PERST of input PCIe controller + + @param[in] RC Root Complex 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 EFI_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +EFI_STATUS +EFIAPI +BoardPcieAssertPerst ( + IN AC01_RC *RC, + IN UINT32 PcieIndex, + IN UINT8 Bifurcation, + IN BOOLEAN IsPullToHigh + ); + +#endif /* BOARD_PCIE_LIB_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h b/Silico= n/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h index 66286bfff145..ed25c6eaa3b8 100644 --- a/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Platform/Ac01.h @@ -264,15 +264,30 @@ // #define AC01_PCIE_MMIO_BASE 0x300000000000, 0x340000000000, 0x3800= 00000000, 0x3C0000000000, 0x200000000000, 0x240000000000, 0x280000000000, 0= x2C0000000000, 0x700000000000, 0x740000000000, 0x780000000000, 0x7C00000000= 00, 0x600000000000, 0x640000000000, 0x680000000000, 0x6C0000000000 =20 +// +// The size of MMIO space +// +#define AC01_PCIE_MMIO_SIZE 0x3FFE0000000, 0x3FFE0000000, 0x3FFE00= 00000, 0x3FFE0000000, 0x3FFE0000000, 0x3FFE0000000, 0x3FFE0000000, 0x3FFE00= 00000, 0x3FFE0000000, 0x3FFE0000000, 0x3FFE0000000, 0x3FFE0000000, 0x3FFE00= 00000, 0x3FFE0000000, 0x3FFE0000000, 0x3FFE0000000 + // // The base address of MMIO32 Registers // -#define AC01_PCIE_MMIO32_BASE 0x000020000000, 0x000028000000, 0x0000= 30000000, 0x000038000000, 0x000001000000, 0x000008000000, 0x000010000000, 0= x000018000000, 0x000060000000, 0x000068000000, 0x000070000000, 0x0000780000= 00, 0x000040000000, 0x000048000000, 0x000050000000, 0x000058000000 +#define AC01_PCIE_MMIO32_BASE 0x000020000000, 0x000028000000, 0x0000= 30000000, 0x000038000000, 0x000004000000, 0x000008000000, 0x000010000000, 0= x000018000000, 0x000060000000, 0x000068000000, 0x000070000000, 0x0000780000= 00, 0x000040000000, 0x000048000000, 0x000050000000, 0x000058000000 + +// +// The size of MMIO32 space +// +#define AC01_PCIE_MMIO32_SIZE 0x8000000, 0x8000000, 0x8000000, 0x800= 0000, 0x4000000, 0x8000000, 0x8000000, 0x8000000, 0x8000000, 0x8000000, 0x8= 000000, 0x8000000, 0x8000000, 0x8000000, 0x8000000, 0x8000000 =20 // // The base address of MMIO32 Registers // -#define AC01_PCIE_MMIO32_BASE_1P 0x000040000000, 0x000050000000, 0x0000= 60000000, 0x000070000000, 0x000001000000, 0x000010000000, 0x000020000000, 0= x000030000000, 0, 0, 0, 0, 0, 0, 0, 0 +#define AC01_PCIE_MMIO32_BASE_1P 0x000040000000, 0x000050000000, 0x0000= 60000000, 0x000070000000, 0x000008000000, 0x000010000000, 0x000020000000, 0= x000030000000, 0, 0, 0, 0, 0, 0, 0, 0 + +// +// The size of MMIO32 1P space +// +#define AC01_PCIE_MMIO32_SIZE_1P 0x10000000, 0x10000000, 0x10000000, 0x= 10000000, 0x8000000, 0x10000000, 0x10000000, 0x10000000, 0, 0, 0, 0, 0, 0, = 0, 0 =20 // // DSDT RCA2 PCIe Meme32 Attribute diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.h b= /Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.h new file mode 100644 index 000000000000..f84f7cec9fae --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.h @@ -0,0 +1,649 @@ +/** @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_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "PcieCoreCapCfg.h" + +#ifdef ENABLE_DEBUG_CFG +#define DEBUG_PCIE_CFG(arg...) \ + if (DebugCodeEnabled()) { \ + DEBUG ((DEBUG_INFO,"PCICore (CFG): ")); \ + DEBUG ((DEBUG_INFO,## arg)); \ + } +#else +#define DEBUG_PCIE_CFG(arg...) +#endif + +#ifdef ENABLE_DEBUG_CSR +#define DEBUG_PCIE_CSR(arg...) \ + if (DebugCodeEnabled()) { \ + DEBUG ((DEBUG_INFO,"PCICore (CSR): ")); \ + DEBUG ((DEBUG_INFO,## arg)); \ + } +#else +#define DEBUG_PCIE_CSR(arg...) +#endif + +#ifdef ENABLE_DEBUG_PHY +#define DEBUG_PCIE_PHY(arg...) \ + if (DebugCodeEnabled()) { \ + DEBUG ((DEBUG_INFO,"PCICore (PHY): ")); \ + DEBUG ((DEBUG_INFO,## arg)); \ + } +#else +#define DEBUG_PCIE_PHY(arg...) +#endif + +#ifdef ENABLE_DEBUG_INFO +#define DEBUG_PCIE_INFO(arg...) \ + if (DebugCodeEnabled()) { \ + DEBUG ((DEBUG_INFO,"PCICore (DBG): ")); \ + DEBUG ((DEBUG_INFO,## arg)); \ + } +#else +#define DEBUG_PCIE_INFO(arg...) +#endif + +#define DEBUG_PCIE_ERR(arg...) \ + DEBUG ((DEBUG_ERROR,"PCICore (ERROR): ")); \ + DEBUG ((DEBUG_ERROR,## arg)); + +#ifndef BIT +#define BIT(nr) (1 << (nr)) +#endif + + +#define SLOT_POWER_LIMIT 75 // Watt + +#define MAX_REINIT 3 + +#define LINK_CHECK_SUCCESS 0 +#define LINK_CHECK_FAILED -1 +#define LINK_CHECK_WRONG_PARAMETER 1 + +#define PFA_REG_ENABLE 0 +#define PFA_REG_READ 1 +#define PFA_REG_CLEAR 2 + +#define AMPERE_PCIE_VENDORID 0x1DEF +#define AC01_HOST_BRIDGE_DEVICEID_RCA 0xE100 +#define AC01_HOST_BRIDGE_DEVICEID_RCB 0xE110 +#define AC01_PCIE_BRIDGE_DEVICEID_RCA 0xE101 +#define AC01_PCIE_BRIDGE_DEVICEID_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 LINK_POLL_US_TIMER 1 +#define IO_SPACE 0x2000 + +#define TCU_OFFSET 0 +#define HB_CSR_OFFSET 0x01000000 +#define PCIE0_CSR_OFFSET 0x01010000 +#define SNPSRAM_OFFSET 0x9000 +#define SERDES_CSR_OFFSET 0x01200000 +#define MMCONFIG_OFFSET 0x10000000 + + +/* DATA LINK registers */ +#define DLINK_VENDOR_CAP_ID 0x25 +#define DLINK_VSEC 0x80000001 +#define DATA_LINK_FEATURE_CAP_OFF 0X4 + +/* PL16 CAP registers */ +#define PL16_CAP_ID 0x26 +#define PL16G_CAP_OFF_20H_REG_OFF 0x20 +#define PL16G_STATUS_REG_OFF 0x0C +#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) +#define DSP_16G_TX_PRESET0_SET(dst,src) (((dst) & ~0xF) | (((UINT32) (src)= ) & 0xF)) +#define DSP_16G_TX_PRESET1_SET(dst,src) (((dst) & ~0xF00) | (((UINT32) (sr= c) << 8) & 0xF00)) +#define DSP_16G_TX_PRESET2_SET(dst,src) (((dst) & ~0xF0000) | (((UINT32) (= 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) | (((UINT32) (s= rc)) & 0xFF)) +#define DSP_16G_RXTX_PRESET1_SET(dst,src) (((dst) & ~0xFF00) | (((UINT32) = (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) | (((UINT= 32) (src) << 24) & 0xFF000000)) + +/* PCIe PF0_PORT_LOGIC registers */ +#define PORT_LOCIG_VC0_P_RX_Q_CTRL_OFF 0x748 +#define PORT_LOCIG_VC0_NP_RX_Q_CTRL_OFF 0x74C + +/* TCU registers */ +#define SMMU_GBPA 0x044 + +/* SNPSRAM Synopsys Memory Read/Write Margin registers */ +#define SPRF_RMR 0x0 +#define SPSRAM_RMR 0x4 +#define TPRF_RMR 0x8 +#define TPSRAM_RMR 0xC + +// +// Host bridge registers +// +#define HBRCAPDMR 0x0 +#define HBRCBPDMR 0x4 +#define HBPDVIDR 0x10 +#define HBPRBNR 0x14 +#define HBPREVIDR 0x18 +#define HBPSIDR 0x1C +#define HBPCLSSR 0x20 + +// HBRCAPDMR +#define RCAPCIDEVMAP_SET(dst, src) (((dst) & ~0x7) | (((UINT32) (src)) & 0= x7)) +#define RCAPCIDEVMAP_GET(val) ((val) & 0x7) + +// HBRCBPDMR +#define RCBPCIDEVMAPLO_SET(dst, src) (((dst) & ~0x7) | (((UINT32) (src)) &= 0x7)) +#define RCBPCIDEVMAPLO_GET(val) ((val) & 0x7) + +#define RCBPCIDEVMAPHI_SET(dst, src) (((dst) & ~0x70) | (((UINT32) (src) <= < 4) & 0x70)) +#define RCBPCIDEVMAPHI_GET(val) (((val) & 0x7) >> 4) + +// HBPDVIDR +#define PCIVENDID_SET(dst, src) (((dst) & ~0xFFFF) | (((UINT32) (src)) & = 0xFFFF)) +#define PCIVENDID_GET(val) ((val) & 0xFFFF) + +#define PCIDEVID_SET(dst, src) (((dst) & ~0xFFFF0000) | (((UINT32) (src) <= < 16) & 0xFFFF0000)) +#define PCIDEVID_GET(val) (((val) & 0xFFFF0000) >> 16) + +// HBPRBNR +#define PCIRBNUM_SET(dst, src) (((dst) & ~0x1F) | (((UINT32) (src)) & 0x1F= )) + +// HBPREVIDR +#define PCIREVID_SET(dst, src) (((dst) & ~0xFF) | (((UINT32) (src)) & 0xFF= )) + +// HBPSIDR +#define PCISUBSYSVENDID_SET(dst, src) (((dst) & ~0xFFFF) | (((UINT32) (src= )) & 0xFFFF)) + +#define PCISUBSYSID_SET(dst, src) (((dst) & ~0xFFFF0000) | (((UINT32) (src= ) << 16) & 0xFFFF0000)) + +// HBPCLSSR +#define CACHELINESIZE_SET(dst, src) (((dst) & ~0xFF) | (((UINT32) (src)) &= 0xFF)) + +// +// PCIE core register +// +#define LINKCTRL 0x0 +#define LINKSTAT 0x4 +#define IRQSEL 0xC +#define HOTPLUGSTAT 0x28 +#define IRQENABLE 0x30 +#define IRQEVENTSTAT 0x38 +#define BLOCKEVENTSTAT 0x3c +#define RESET 0xC000 +#define CLOCK 0xC004 +#define MEMRDYR 0xC104 +#define RAMSDR 0xC10C + +// LINKCTRL +#define LTSSMENB_SET(dst, src) (((dst) & ~0x1) | (((UINT32) (src)) & 0x1)) +#define DEVICETYPE_SET(dst, src) (((dst) & ~0xF0) | (((UINT32) (src) << 4)= & 0xF0)) +#define DEVICETYPE_GET(val) (((val) & 0xF0) >> 4) + +// LINKSTAT +#define PHY_STATUS_MASK (1 << 2) +#define SMLH_LTSSM_STATE_MASK 0x3f00 +#define SMLH_LTSSM_STATE_GET(val) ((val & 0x3F00) >> 8) +#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 + +// IRQSEL +#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) & 0x= 8)) +#define EQRQST_SET(dst, src) (((dst) & ~0x10) | (((UINT32) (src) << 4) & 0= x10)) +#define INTPIN_SET(dst, src) (((dst) & ~0xFF00) | (((UINT32) (src) << 8) &= 0xFF00)) + +// SLOTCAP +#define SLOT_HPC_SET(dst, src) (((dst) & ~0x40) | (((UINT32) (src) << 6) &= 0x40)) + +// SLOT_CAPABILITIES_REG, PCIE_CAP_SLOT_POWER_LIMIT_VALUE bits[14:7] +#define SLOT_CAP_SLOT_POWER_LIMIT_VALUE_SET(dst, src) \ + (((dst) & ~0x7F80) | (((UINT32)(src) << 7) & 0= x7F80)) + +// HOTPLUGSTAT +#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)) + +// IRQENABLE +#define LINKUP_SET(dst, src) (((dst) & ~0x40) | (((UINT32) (src) << 6) & 0= x40)) + +// IRQEVENTSTAT +#define BLOCK_INT_MASK (1 << 4) +#define INT_MASK (1 << 3) + +// BLOCKEVENTSTAT +#define LINKUP_MASK (1 << 0) + +// RESET +#define DWCPCIE_SET(dst, src) (((dst) & ~0x1) | (((UINT32) (src)) & 0x1)) +#define RESET_MASK 0x1 + +// CLOCK +#define AXIPIPE_SET(dst, src) (((dst) & ~0x1) | (((UINT32) (src)) & 0x1)) + +// RAMSDR +#define SD_SET(dst, src) (((dst) & ~0x1) | (((UINT32) (src)) & 0x1)) + +// +// PHY registers +// +#define RSTCTRL 0x0 +#define PHYCTRL 0x4 +#define RAMCTRL 0x8 +#define RAMSTAT 0xC +#define PLLCTRL 0x10 +#define PHYLPKCTRL 0x14 +#define PHYTERMOFFSET0 0x18 +#define PHYTERMOFFSET1 0x1C +#define PHYTERMOFFSET2 0x20 +#define PHYTERMOFFSET3 0x24 +#define RXTERM 0x28 +#define PHYDIAGCTRL 0x2C + +// RSTCTRL +#define PHY_RESET_SET(dst, src) (((dst) & ~0x1) | (((UINT32) (src)) & 0x1)) + +// PHYCTRL +#define PWR_STABLE_SET(dst, src) (((dst) & ~0x1) | (((UINT32) (src)) & 0x1= )) + +// +// PCIe config space 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 CON_STATUS_REG (PM_CAP + 0x4) +#define LINK_CAPABILITIES_REG (PCIE_CAP + 0xc) +#define LINK_CONTROL_LINK_STATUS_REG (PCIE_CAP + 0x10) +#define SLOT_CAPABILITIES_REG (PCIE_CAP + 0x14) +#define DEVICE_CONTROL2_DEVICE_STATUS2_REG (PCIE_CAP + 0x28) +#define LINK_CAPABILITIES2_REG (PCIE_CAP + 0x2c) +#define LINK_CONTROL2_LINK_STATUS2_REG (PCIE_CAP + 0x30) +#define UNCORR_ERR_STATUS_OFF (AER_CAP + 0x4) +#define UNCORR_ERR_MASK_OFF (AER_CAP + 0x8) +#define RESOURCE_CON_REG_VC0 (VC_CAP + 0x14) +#define RESOURCE_CON_REG_VC1 (VC_CAP + 0x20) +#define RESOURCE_STATUS_REG_VC1 (VC_CAP + 0x24) +#define SD_CONTROL1_REG (RAS_DES_CAP+0xA0) +#define CCIX_TP_CAP_TP_HDR2_OFF (CCIX_TP_CAP + 0x8) +#define ESM_MNDTRY_RATE_CAP_OFF (CCIX_TP_CAP + 0xc) +#define ESM_STAT_OFF (CCIX_TP_CAP + 0x14) +#define ESM_CNTL_OFF (CCIX_TP_CAP + 0x18) +#define ESM_LN_EQ_CNTL_25G_0_OFF (CCIX_TP_CAP + 0x2c) +#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 + +#define DEV_MASK 0x00F8000 +#define BUS_MASK 0xFF00000 +#define BUS_NUM(Addr) ((((UINT64)(Addr)) & BUS_MASK) >> 20) +#define DEV_NUM(Addr) ((((UINT64)(Addr)) & DEV_MASK) >> 15) +#define CFG_REG(Addr) (((UINT64)Addr) & 0x7FFF) + +// TYPE1_DEV_ID_VEND_ID_REG +#define VENDOR_ID_SET(dst, src) (((dst) & ~0xFFFF) | (((UINT32) (src)) & 0= xFFFF)) +#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 SUBCLASS_CODE_SET(dst, src) (((dst) & ~0xFF0000) | (((UINT32) (src= ) << 16) & 0xFF0000)) +#define PROGRAM_INTERFACE_SET(dst, src) (((dst) & ~0xFF00) | (((UINT32) (s= rc) << 8) & 0xFF00)) +#define REVISION_ID_SET(dst, src) (((dst) & ~0xFF) | (((UINT32) (src)) & 0= xFF)) + +// SEC_LAT_TIMER_SUB_BUS_SEC_BUS_PRI_BUS_REG +#define DEFAULT_SUB_BUS 0xFF +#define SUB_BUS_SET(dst, src) (((dst) & ~0xFF0000) | (((UINT32) (src) << 1= 6) & 0xFF0000)) +#define SEC_BUS_SET(dst, src) (((dst) & ~0xFF00) | (((UINT32) (src) << 8) = & 0xFF00)) +#define PRIM_BUS_SET(dst, src) (((dst) & ~0xFF) | (((UINT32) (src)) & 0xFF= )) + +// BRIDGE_CTRL_INT_PIN_INT_LINE_REG +#define INT_PIN_SET(dst, src) (((dst) & ~0xFF00) | (((UINT32) (src) << 8) = & 0xFF00)) + +// CON_STATUS_REG +#define POWER_STATE_SET(dst, src) (((dst) & ~0x3) | (((UINT32) (src)) & 0x= 3)) + +// DEVICE_CONTROL2_DEVICE_STATUS2_REG +#define CAP_CPL_TIMEOUT_VALUE_SET(dst, src) (((dst) & ~0xF) | (((UINT32) (= src)) & 0xF)) + +// LINK_CAPABILITIES_REG +#define CAP_ID 0x10 +#define LINK_CAPABILITIES_REG_OFF 0xC +#define LINK_CONTROL_LINK_STATUS_OFF 0x10 +#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_WIDTH_GET(val) ((val & 0x3F0) >> 4) +#define CAP_MAX_LINK_WIDTH_SET(dst, src) (((dst) & ~0x3F0) | (((UIN= T32) (src) << 4) & 0x3F0)) +#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 +#define CAP_MAX_LINK_SPEED_GET(val) ((val & 0xF)) +#define CAP_MAX_LINK_SPEED_SET(dst, src) (((dst) & ~0xF) | (((UINT3= 2) (src)) & 0xF)) +#define CAP_SLOT_CLK_CONFIG_SET(dst, src) (((dst) & ~0x10000000) | (= ((UINT32) (src) << 28) & 0x10000000)) +#define NO_ASPM_SUPPORTED 0x0 +#define L0S_SUPPORTED 0x1 +#define L1_SUPPORTED 0x2 +#define L0S_L1_SUPPORTED 0x3 +#define CAP_ACTIVE_STATE_LINK_PM_SUPPORT_SET(dst, src) (((dst) & ~0xC00) |= (((UINT32)(src) << 10) & 0xC00)) + +// LINK_CONTROL_LINK_STATUS_REG +#define CAP_DLL_ACTIVE_GET(val) ((val & 0x20000000) >> 29) +#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) BIT((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_RETRAIN_LINK_SET(dst, src) (((dst) & ~0x20) | (((UINT= 32) (src) << 5) & 0x20)) +#define CAP_COMMON_CLK_SET(dst, src) (((dst) & ~0x40) | (((UINT= 32) (src) << 6) & 0x40)) +#define CAP_LINK_TRAINING_GET(val) ((val & 0x8000000) >> 27) +#define CAP_LINK_DISABLE_SET(dst, src) (((dst) & ~0x10) | (((UINT= 32)(src) << 4) & 0x10)) + +// LINK_CAPABILITIES2_REG +#define LINK_SPEED_VECTOR_25 BIT(0) +#define LINK_SPEED_VECTOR_50 BIT(1) +#define LINK_SPEED_VECTOR_80 BIT(2) +#define LINK_SPEED_VECTOR_160 BIT(3) +#define LINK_SPEED_VECTOR_320 BIT(4) +#define CAP_SUPPORT_LINK_SPEED_VECTOR_GET(val) ((val & 0xFE) >> 1) +#define CAP_SUPPORT_LINK_SPEED_VECTOR_SET(dst, src) (((dst) & ~0xFE) | (((= UINT32) (src) << 1) & 0xFE)) +#define CAP_EQ_CPL_GET(val) ((val & 0x20000) >> 17) +#define CAP_EQ_CPL_P1_GET(val) ((val & 0x40000) >> 18) +#define CAP_EQ_CPL_P2_GET(val) ((val & 0x80000) >> 19) +#define CAP_EQ_CPL_P3_GET(val) ((val & 0x100000) >> 20) + +// LINK_CONTROL2_LINK_STATUS2_REG +#define CAP_TARGET_LINK_SPEED_SET(dst, src) (((dst) & ~0xF) | (((UINT3= 2) (src)) & 0xF)) + +// Secondary Capability +#define SPCIE_CAP_ID 0x19 +#define CAP_OFF_0C 0x0C +#define LINK_CONTROL3_REG_OFF 0x4 +#define DSP_TX_PRESET0_SET(dst,src) (((dst) & ~0xF) | (((UINT32) (src)) &= 0xF)) +#define DSP_TX_PRESET1_SET(dst,src) (((dst) & ~0xF0000) | (((UINT32) (src= ) << 16) & 0xF0000)) + +// UNCORR_ERR_STATUS_OFF +#define CMPLT_TIMEOUT_ERR_STATUS_GET(val) ((val & 0x4000) >> 14) +#define CMPLT_TIMEOUT_ERR_STATUS_SET(dst, src) (((dst) & ~0x4000) | (((UIN= T32) (src) << 14) & 0x4000)) + +// UNCORR_ERR_MASK_OFF +#define CMPLT_TIMEOUT_ERR_MASK_SET(dst, src) (((dst) & ~0x4000) | (((UINT3= 2) (src) << 14) & 0x4000)) +#define SDES_ERR_MASK_SET(dst, src) (((dst) & ~0x20) | (((UINT32)(src) << = 5) & 0x20)) + +// RESOURCE_STATUS_REG_VC1 +#define VC_NEGO_PENDING_VC1_GET(val) ((val & 0x20000) >> 17) + +// SD_CONTROL1_REG +#define FORCE_DETECT_LANE_EN_SET(dst, src) (((dst) & ~0x10000) | (((UINT32= ) (src) << 16) & 0x10000)) + +// CCIX_TP_CAP_TP_HDR2_OFF +#define ESM_REACH_LENGTH_GET(val) ((val & 0x60000) >> 17) +#define ESM_CALIBRATION_TIME_GET(val) ((val & 0x700000) >> 20) +#define ESM_CALIBRATION_TIME_SET(dst, src) (((dst) & ~0x700000) | (((UINT3= 2) (src) << 20) & 0x700000)) + +// ESM_STAT_OFF +#define ESM_CALIB_CMPLT_GET(val) ((val & 0x80) >> 7) +#define ESM_CURNT_DATA_RATE_GET(val) ((val & 0x7F) >> 0) + +// ESM_CNTL_OFF +#define QUICK_EQ_TIMEOUT_SET(dst, src) (((dst) & ~0x1C000000) | (((UINT32)= (src) << 26) & 0x1C000000)) +#define LINK_REACH_TARGET_GET(val) ((val & 0x1000000) >> 24) +#define LINK_REACH_TARGET_SET(dst, src) (((dst) & ~0x1000000) | (((UINT32)= (src) << 24) & 0x1000000)) +#define ESM_EXT_EQ3_DSP_TIMEOUT_GET(val) ((val & 0x700000) >> 20) +#define ESM_EXT_EQ3_DSP_TIMEOUT_SET(dst, src) (((dst) & ~0x700000) | (((UI= NT32) (src) << 20) & 0x700000)) +#define ESM_EXT_EQ2_USP_TIMEOUT_GET(val) ((val & 0x70000) >> 16) +#define ESM_EXT_EQ2_USP_TIMEOUT_SET(dst, src) (((dst) & ~0x70000) | (((UIN= T32) (src) << 16) & 0x70000)) +#define ESM_ENABLE_SET(dst, src) (((dst) & ~0x8000) | (((UINT32) (src) << = 15) & 0x8000)) +#define ESM_DATA_RATE1_SET(dst, src) (((dst) & ~0x7F00) | (((UINT32) (src)= << 8) & 0x7F00)) +#define ESM_PERFORM_CAL_SET(dst, src) (((dst) & ~0x80) | (((UINT32) (src) = << 7) & 0x80)) +#define ESM_DATA_RATE0_SET(dst, src) (((dst) & ~0x7F) | (((UINT32) (src)) = & 0x7F)) + +// PORT_LINK_CTRL_OFF +#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 LINK_CAPABLE_SET(dst, src) (((dst) & ~0x3F0000) | (((UINT32) (src)= << 16) & 0x3F0000)) +#define FAST_LINK_MODE_SET(dst, src) (((dst) & ~0x80) | (((UINT32) (src) <= < 7) & 0x80)) + +// FILTER_MASK_2_OFF +#define CX_FLT_MASK_VENMSG0_DROP_SET(dst, src) (((dst) & ~0x1) | (((UINT32= ) (src)) & 0x1)) +#define CX_FLT_MASK_VENMSG1_DROP_SET(dst, src) (((dst) & ~0x2) | (((UINT32= ) (src) << 1) & 0x2)) +#define CX_FLT_MASK_DABORT_4UCPL_SET(dst, src) (((dst) & ~0x4) | (((UINT32= ) (src) << 2) & 0x4)) + +// GEN2_CTRL_OFF +#define NUM_OF_LANES_X2 0x2 +#define NUM_OF_LANES_X4 0x4 +#define NUM_OF_LANES_X8 0x8 +#define NUM_OF_LANES_X16 0x10 +#define NUM_OF_LANES_SET(dst, src) (((dst) & ~0x1F00) | (((UINT32) (src) <= < 8) & 0x1F00)) + +// GEN3_RELATED_OFF +#define RATE_SHADOW_SEL_SET(dst, src) (((dst) & ~0x3000000) | (((UINT32) (= src) << 24) & 0x3000000)) +#define EQ_PHASE_2_3_SET(dst, src) (((dst) & ~0x200) | (((UINT32) (src) <<= 9) & 0x200)) +#define RXEQ_REGRDLESS_SET(dst, src) (((dst) & ~0x2000) | (((UINT32) (src)= << 13) & 0x2000)) + +// GEN3_EQ_CONTROL_OFF +#define GEN3_EQ_FB_MODE(dst, src) (((dst) & ~0xF) | ((UINT32) (src) & 0xF)) +#define GEN3_EQ_PRESET_VEC(dst, src) (((dst) & 0xFF0000FF) | (((UINT32) (s= rc) << 8) & 0xFFFF00)) +#define GEN3_EQ_INIT_EVAL(dst,src) (((dst) & ~0x1000000) | (((UINT32) (src= ) << 24) & 0x1000000)) + +// MISC_CONTROL_1_OFF +#define DBI_RO_WR_EN_SET(dst, src) (((dst) & ~0x1) | (((UINT32) (src)) & 0= x1)) + +// 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) | (((UINT= 32) (src)) & 0x1)) + +// AMBA_LINK_TIMEOUT_OFF +#define LINK_TIMEOUT_PERIOD_DEFAULT_SET(dst, src) (((dst) & ~0xFF) | (((UI= NT32) (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) | (((UINT= 32) (src)) & 0xFFFF)) + +// AUX_CLK_FREQ_OFF +#define AUX_CLK_500MHZ 500 +#define AUX_CLK_FREQ_SET(dst, src) (((dst) & ~0x1FF) | (((UINT32) (src)) &= 0x1FF)) + +#define EXT_CAP_OFFSET_START 0x100 + +// 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) | ((= (UINT32)(src) << 8) & 0xF00)) +#define ECCR_EVENT_COUNTER_ENABLE_SET(dst, src) (((dst) & ~0x1C) | (((= UINT32)(src) << 2) & 0x1C)) +#define ECCR_EVENT_COUNTER_CLEAR_SET(dst, src) (((dst) & ~0x3) | (((U= INT32)(src)) & 0x3)) + +// PFA Registers offests +#define RAS_DES_CAP_ID 0xB +#define EVENT_COUNTER_CONTROL_REG_OFF 0x8 +#define EVENT_COUNTER_DATA_REG_OFF 0xC + +#define MAX_NUM_ERROR_CODE 47 +#define DEFAULT_COMMON_LANE_NUM 15 + +enum LTSSM_STATE { + S_DETECT_QUIET =3D 0, + S_DETECT_ACT, + S_POLL_ACTIVE, + S_POLL_COMPLIANCE, + S_POLL_CONFIG, + S_PRE_DETECT_QUIET, + S_DETECT_WAIT, + S_CFG_LINKWD_START, + S_CFG_LINKWD_ACEPT, + S_CFG_LANENUM_WAI, + S_CFG_LANENUM_ACEPT, + S_CFG_COMPLETE, + S_CFG_IDLE, + S_RCVRY_LOCK, + S_RCVRY_SPEED, + S_RCVRY_RCVRCFG, + S_RCVRY_IDLE, + S_L0, + S_L0S, + S_L123_SEND_EIDLE, + S_L1_IDLE, + S_L2_IDLE, + S_L2_WAKE, + S_DISABLED_ENTRY, + S_DISABLED_IDLE, + S_DISABLED, + S_LPBK_ENTRY, + S_LPBK_ACTIVE, + S_LPBK_EXIT, + S_LPBK_EXIT_TIMEOUT, + S_HOT_RESET_ENTRY, + S_HOT_RESET, + S_RCVRY_EQ0, + S_RCVRY_EQ1, + S_RCVRY_EQ2, + S_RCVRY_EQ3, + MAX_LTSSM_STATE +}; + +INT32 +Ac01PcieCfgOut32 ( + VOID *Addr, + UINT32 Val + ); + +INT32 +Ac01PcieCfgOut16 ( + VOID *Addr, + UINT16 Val + ); + +INT32 +Ac01PcieCfgOut8 ( + VOID *Addr, + UINT8 Val + ); + +INT32 +Ac01PcieCfgIn32 ( + VOID *Addr, + UINT32 *Val + ); + +INT32 +Ac01PcieCfgIn16 ( + VOID *Addr, + UINT16 *Val + ); + +INT32 +Ac01PcieCfgIn8 ( + VOID *Addr, + UINT8 *Val + ); + +INT32 +Ac01PcieCoreSetup ( + AC01_RC *RC + ); + +VOID +Ac01PcieCoreResetPort ( + AC01_RC *RC + ); + +VOID +Ac01PcieClearConfigPort ( + AC01_RC *RC + ); + +AC01_RC * +GetRCList ( + UINT8 Idx + ); + +VOID +Ac01PcieCoreBuildRCStruct ( + AC01_RC *RC, + UINT64 RegBase, + UINT64 MmioBase, + UINT64 MmioSize, + UINT64 Mmio32Base, + UINT64 Mmio32Size + ); + +INT32 +Ac01PcieCoreSetupRC ( + IN AC01_RC *RC, + IN UINT8 ReInit, + IN UINT8 ReInitPcieIndex + ); + +VOID +Ac01PcieCoreUpdateLink ( + IN AC01_RC *RC, + OUT BOOLEAN *IsNextRoundNeeded, + OUT INT8 *FailedPciePtr, + OUT INT8 *FailedPcieCount + ); + +VOID +Ac01PcieCoreEndEnumeration ( + AC01_RC *RC + ); + +INT32 +Ac01PcieCoreQoSLinkCheckRecovery ( + IN AC01_RC *RC, + IN INTN PcieIndex + ); + +#endif /* AC01_PCIE_CORE_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCoreCapC= fg.h b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCoreCapCfg.h new file mode 100644 index 000000000000..c3914673b852 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCoreCapCfg.h @@ -0,0 +1,63 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef AC01_PCIE_CAP_CFG_H_ +#define AC01_PCIE_CAP_CFG_H_ + +/* PCIe config space capabilities offset */ +#define PM_CAP 0x40 +#define MSI_CAP 0x50 +#define PCIE_CAP 0x70 +#define MSIX_CAP 0xB0 +#define SLOT_CAP 0xC0 +#define VPD_CAP 0xD0 +#define SATA_CAP 0xE0 +#define CFG_NEXT_CAP 0x40 +#define PM_NEXT_CAP 0x70 +#define MSI_NEXT_CAP 0x00 +#define PCIE_NEXT_CAP 0x00 +#define MSIX_NEXT_CAP 0x00 +#define SLOT_NEXT_CAP 0x00 +#define VPD_NEXT_CAP 0x00 +#define SATA_NEXT_CAP 0x00 +#define BASE_CAP 0x100 +#define AER_CAP 0x100 +#define VC_CAP 0x148 +#define SN_CAP 0x178 +#define PB_CAP 0x178 +#define ARI_CAP 0x178 +#define SPCIE_CAP_x8 0x148 +#define SPCIE_CAP 0x178 +#define PL16G_CAP 0x1A8 +#define MARGIN_CAP 0x1D8 +#define PL32G_CAP 0x220 +#define SRIOV_CAP 0x220 +#define TPH_CAP 0x220 +#define ATS_CAP 0x220 +#define ACS_CAP 0x230 +#define PRS_CAP 0x238 +#define LTR_CAP 0x248 +#define L1SUB_CAP 0x248 +#define PASID_CAP 0x248 +#define DPA_CAP 0x248 +#define DPC_CAP 0x248 +#define MPCIE_CAP 0x248 +#define FRSQ_CAP 0x248 +#define RTR_CAP 0x248 +#define LN_CAP 0x248 +#define RAS_DES_CAP 0x248 +#define VSECRAS_CAP 0x348 +#define DLINK_CAP 0x380 +#define PTM_CAP 0x38C +#define PTM_VSEC_CAP 0x38C +#define CCIX_TP_CAP 0x38C +#define CXS_CAP 0x3D0 +#define RBAR_CAP 0x3E8 +#define VF_RBAR_CAP 0x3E8 + +#endif /* AC01_PCIE_CAP_CFG_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PciePatchAcp= i.h b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PciePatchAcpi.h new file mode 100644 index 000000000000..2dfefdf97159 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PciePatchAcpi.h @@ -0,0 +1,30 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef AC01_PCIE_PATCH_ACPI_H_ +#define AC01_PCIE_PATCH_ACPI_H_ + +EFI_STATUS +EFIAPI +AcpiPatchPciMem32 ( + INT8 *PciSegEnabled + ); + +EFI_STATUS +EFIAPI +AcpiInstallMcfg ( + INT8 *PciSegEnabled + ); + +EFI_STATUS +EFIAPI +AcpiInstallIort ( + INT8 *PciSegEnabled + ); + +#endif /* AC01_PCIE_PATCH_ACPI_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..684dd808a96a --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c @@ -0,0 +1,1659 @@ +/** @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 "PcieCore.h" + +STATIC INT32 +Ac01PcieCsrOut32 ( + VOID *Addr, + UINT32 Val + ) +{ + MmioWrite32 ((UINT64)Addr, Val); + DEBUG_PCIE_CSR ( + "PCIE CSR WR: 0x%p value: 0x%08X (0x%08X)\n", + Addr, + Val, + MmioRead32 ((UINT64)Addr) + ); + + return 0; +} + +STATIC INT32 +Ac01PcieCsrOut32Serdes ( + VOID *Addr, + UINT32 Val + ) +{ + MmioWrite32 ((UINT64)Addr, Val); + DEBUG_PCIE_CSR ( + "PCIE CSR WR: 0x%p value: 0x%08X (0x%08X)\n", + Addr, + Val, + MmioRead32 ((UINT64)Addr) + ); + + return 0; +} + +STATIC INT32 +Ac01PcieCsrIn32 ( + VOID *Addr, + UINT32 *Val + ) +{ + *Val =3D MmioRead32 ((UINT64)Addr); + DEBUG_PCIE_CSR ("PCIE CSR RD: 0x%p value: 0x%08X\n", Addr, *Val); + + return 0; +} + +STATIC INT32 +Ac01PcieCsrIn32Serdes ( + VOID *Addr, + UINT32 *Val + ) +{ + *Val =3D MmioRead32 ((UINT64)Addr); + DEBUG_PCIE_CSR ("PCIE CSR RD: 0x%p value: 0x%08X\n", Addr, *Val); + + return 0; +} + +VOID +Ac01PcieMmioRd ( + UINT64 Addr, + UINT32 *Val + ) +{ + Ac01PcieCsrIn32Serdes ((VOID *)Addr, (UINT32 *)Val); +} + +VOID +Ac01PcieMmioWr ( + UINT64 Addr, + UINT32 Val + ) +{ + Ac01PcieCsrOut32Serdes ((VOID *)Addr, (UINT32)Val); +} + +VOID +Ac01PciePuts ( + CONST CHAR8 *Msg + ) +{ + DEBUG_PCIE_PHY ("%a\n", __FUNCTION__); +} + +VOID +Ac01PciePutInt ( + UINT32 val + ) +{ + DEBUG_PCIE_PHY ("%a\n", __FUNCTION__); +} + +VOID +Ac01PciePutHex ( + UINT64 val + ) +{ + DEBUG_PCIE_PHY ("%a\n", __FUNCTION__); +} + +INT32 +Ac01PcieDebugPrint ( + CONST CHAR8 *fmt, + ... + ) +{ + DEBUG_PCIE_PHY ("%a\n", __FUNCTION__); + return 0; +} + +VOID +Ac01PcieDelay ( + UINT32 Val + ) +{ + MicroSecondDelay (Val); +} + +/** + Write 32-bit value to config space address + + @param Addr Address within config space + @param Val 32-bit value to write +**/ +INT32 +Ac01PcieCfgOut32 ( + IN VOID *Addr, + IN UINT32 Val + ) +{ + MmioWrite32 ((UINT64)Addr, Val); + DEBUG_PCIE_CFG ( + "PCIE CFG WR: 0x%p value: 0x%08X (0x%08X)\n", + Addr, + Val, + MmioRead32 ((UINT64)Addr) + ); + + return 0; +} + +/** + Write 16-bit value to config space address + + @param Addr Address within config space + @param Val 16-bit value to write +**/ +INT32 +Ac01PcieCfgOut16 ( + IN VOID *Addr, + IN UINT16 Val + ) +{ + UINT64 AlignedAddr =3D (UINT64)Addr & ~0x3; + UINT32 Val32 =3D MmioRead32 (AlignedAddr); + + switch ((UINT64)Addr & 0x3) { + case 2: + Val32 &=3D ~0xFFFF0000; + Val32 |=3D (UINT32)Val << 16; + break; + + case 0: + default: + Val32 &=3D ~0xFFFF; + Val32 |=3D Val; + break; + } + MmioWrite32 (AlignedAddr, Val32); + DEBUG_PCIE_CFG ( + "PCIE CFG WR16: 0x%p value: 0x%04X (0x%08llX 0x%08X)\n", + Addr, + Val, + AlignedAddr, + MmioRead32 ((UINT64)AlignedAddr) + ); + + return 0; +} + +/** + Write 8-bit value to config space address + + @param Addr Address within config space + @param Val 8-bit value to write +**/ +INT32 +Ac01PcieCfgOut8 ( + IN VOID *Addr, + IN UINT8 Val + ) +{ + UINT64 AlignedAddr =3D (UINT64)Addr & ~0x3; + UINT32 Val32 =3D MmioRead32 (AlignedAddr); + + switch ((UINT64)Addr & 0x3) { + case 0: + Val32 &=3D ~0xFF; + Val32 |=3D Val; + break; + + case 1: + Val32 &=3D ~0xFF00; + Val32 |=3D (UINT32)Val << 8; + break; + + case 2: + Val32 &=3D ~0xFF0000; + Val32 |=3D (UINT32)Val << 16; + break; + + case 3: + default: + Val32 &=3D ~0xFF000000; + Val32 |=3D (UINT32)Val << 24; + break; + } + MmioWrite32 (AlignedAddr, Val32); + DEBUG_PCIE_CFG ( + "PCIE CFG WR8: 0x%p value: 0x%04X (0x%08llX 0x%08X)\n", + Addr, + Val, + AlignedAddr, + MmioRead32 ((UINT64)AlignedAddr) + ); + + return 0; +} + +/** + Read 32-bit value from config space address + + @param Addr Address within config space + @param Val Point to address for read value +**/ +INT32 +Ac01PcieCfgIn32 ( + IN VOID *Addr, + OUT UINT32 *Val + ) +{ + UINT32 RegC, Reg18; + UINT8 MfHt, Ht, Primary =3D 0, Sec =3D 0, Sub =3D 0; + + if ((BUS_NUM (Addr) > 0) && (DEV_NUM (Addr) > 0) && (CFG_REG (Addr) =3D= =3D 0)) { + *Val =3D MmioRead32 ((UINT64)Addr); + DEBUG_PCIE_CFG ( + "PCIE CFG RD: B%X|D%X 0x%p value: 0x%08X\n", + BUS_NUM (Addr), + DEV_NUM (Addr), + Addr, + *Val + ); + + if (*Val !=3D 0xffffffff) { + RegC =3D MmioRead32 ((UINT64)Addr + 0xC); + DEBUG_PCIE_CFG ("Peek PCIE MfHt RD32: 0x%p value: 0x%08X\n", Addr + = 0xc, RegC); + MfHt =3D RegC >> 16; + DEBUG_PCIE_CFG (" Peek RD8 MfHt=3D0x%02X\n", MfHt); + + Ht =3D MfHt & 0x7F; + if (Ht !=3D 0) { /* Type 1 header */ + Reg18 =3D MmioRead32 ((UINT64)Addr + 0x18); + Primary =3D Reg18; Sec =3D Reg18 >> 8; Sub =3D Reg18 >> 16; + DEBUG_PCIE_CFG ( + " Bus Peek PCIE Sub:%01X Sec:%01X Primary:%01X RD: 0x%p value:= 0x%08X\n", + Sub, + Sec, + Primary, + Addr + 0x18, + Reg18 + ); + } + if ((Ht =3D=3D 0) || (Primary !=3D 0)) { /* Ampere Altra RPs Primary= Bus is 0b */ + *Val =3D 0xffffffff; + DEBUG_PCIE_CFG ( + " Skip RD32 B%X|D%X PCIE CFG RD: 0x%p return 0xffffffff\n", + BUS_NUM (Addr), + DEV_NUM (Addr), + Addr + ); + } + } + } else { + *Val =3D MmioRead32 ((UINT64)Addr); + } + DEBUG_PCIE_CFG ("PCIE CFG RD: 0x%p value: 0x%08X\n", Addr, *Val); + + return 0; +} + +/** + Read 16-bit value from config space address + + @param Addr Address within config space + @param Val Point to address for read value +**/ +INT32 +Ac01PcieCfgIn16 ( + IN VOID *Addr, + OUT UINT16 *Val + ) +{ + UINT64 AlignedAddr =3D (UINT64)Addr & ~0x3; + UINT32 RegC, Reg18; + UINT8 MfHt, Primary =3D 0, Sec =3D 0, Sub =3D 0; + UINT32 Val32; + + if ((BUS_NUM (Addr) > 0) && (DEV_NUM (Addr) > 0) && (CFG_REG (Addr) =3D= =3D 0)) { + *Val =3D MmioRead32 ((UINT64)Addr); + DEBUG_PCIE_CFG ( + "PCIE CFG16 RD: B%X|D%X 0x%p value: 0x%08X\n", + BUS_NUM (Addr), + DEV_NUM (Addr), + Addr, + *Val + ); + + if (*Val !=3D 0xffff) { + RegC =3D MmioRead32 ((UINT64)Addr + 0xC); + DEBUG_PCIE_CFG (" Peek PCIE MfHt RD: 0x%p value: 0x%08X\n", Addr + = 0xc, RegC); + MfHt =3D RegC >> 16; + DEBUG_PCIE_CFG (" Peek RD8 MfHt=3D0x%02X\n", MfHt); + + + if ((MfHt & 0x7F)!=3D 0) { /* Type 1 header */ + Reg18 =3D MmioRead32 ((UINT64)Addr + 0x18); + Primary =3D Reg18; Sec =3D Reg18 >> 8; Sub =3D Reg18 >> 16; + DEBUG_PCIE_CFG ( + " Bus Peek PCIE Sub:%01X Sec:%01X Primary:%01X RD: 0x%p value:= 0x%08X\n", + Sub, + Sec, + Primary, + Addr + 0x18, + Reg18 + ); + } + if ((MfHt =3D=3D 0) || (Primary !=3D 0)) { /* QS RPs Primary Bus is = 0b */ + *Val =3D 0xffff; + DEBUG_PCIE_CFG ( + " Skip RD16 B%X|D%X PCIE CFG RD: 0x%p return 0xffff\n", + BUS_NUM (Addr), + DEV_NUM (Addr), + Addr + ); + return 0; + } + } + } + + Val32 =3D MmioRead32 (AlignedAddr); + switch ((UINT64)Addr & 0x3) { + case 2: + *Val =3D Val32 >> 16; + break; + + case 0: + default: + *Val =3D Val32; + break; + } + DEBUG_PCIE_CFG ( + "PCIE CFG RD16: 0x%p value: 0x%04X (0x%08llX 0x%08X)\n", + Addr, + *Val, + AlignedAddr, + Val32 + ); + + return 0; +} + +/** + Read 8-bit value from config space address + + @param Addr Address within config space + @param Val Point to address for read value +**/ +INT32 +Ac01PcieCfgIn8 ( + IN VOID *Addr, + OUT UINT8 *Val + ) +{ + UINT64 AlignedAddr =3D (UINT64)Addr & ~0x3; + UINT32 Val32 =3D MmioRead32 (AlignedAddr); + switch ((UINT64)Addr & 0x3) { + case 3: + *Val =3D Val32 >> 24; + break; + + case 2: + *Val =3D Val32 >> 16; + break; + + case 1: + *Val =3D Val32 >> 8; + break; + + case 0: + default: + *Val =3D Val32; + break; + } + DEBUG_PCIE_CFG ( + "PCIE CFG RD8: 0x%p value: 0x%02X (0x%08llX 0x%08X)\n", + Addr, + *Val, + AlignedAddr, + Val32 + ); + + return 0; +} + +/** + Return the next extended capability address + + @param RC Pointer to AC01_RC structure + @param PcieIndex PCIe index + @param IsRC 0x1: Checking RC configuration space + 0x0: Checking EP configuration space + @param ExtendedCapId +**/ +UINT64 +PcieCheckCap ( + IN AC01_RC *RC, + IN INTN PcieIndex, + IN BOOLEAN IsRC, + IN UINT16 ExtendedCapId + ) +{ + VOID *CfgAddr; + UINT32 Val =3D 0, NextCap =3D 0, CapId =3D 0, ExCap =3D 0; + + if (IsRC) { + CfgAddr =3D (VOID *)(RC->MmcfgAddr + (RC->Pcie[PcieIndex].DevNum << 15= )); + } else { + CfgAddr =3D (VOID *)(RC->MmcfgAddr + (RC->Pcie[PcieIndex].DevNum << 20= )); + } + + Ac01PcieCsrIn32 (CfgAddr + TYPE1_CAP_PTR_REG, &Val); + NextCap =3D Val & 0xFF; + + // Loop untill desired capability is found else return 0 + while (1) { + if ((NextCap & 0x3) !=3D 0) { + /* Not alignment, just return */ + return 0; + } + Ac01PcieCsrIn32 (CfgAddr + NextCap, &Val); + if (NextCap < EXT_CAP_OFFSET_START) { + CapId =3D Val & 0xFF; + } else { + CapId =3D Val & 0xFFFF; + } + + if (CapId =3D=3D ExtendedCapId) { + return (UINT64)(CfgAddr + NextCap); + } + + if (NextCap < EXT_CAP_OFFSET_START) { + NextCap =3D (Val & 0xFFFF) >> 8; + } else { + NextCap =3D (Val & 0xFFFF0000) >> 20; + } + + if ((NextCap =3D=3D 0) && (ExCap =3D=3D 0)) { + ExCap =3D 1; + NextCap =3D EXT_CAP_OFFSET_START; + } + + if ((NextCap =3D=3D 0) && (ExCap =3D=3D 1)) { + return (UINT64)0; + } + } +} + +/** + Read 8-bit value from config space address + + @param RC Pointer to AC01_RC strucutre + @param RegBase Base address of CSR, TCU, Hostbridge, Msg, Serdes, a= nd MMCFG register + @param MmioBase Base address of 64-bit MMIO + @param MmioSize Size of 64-bit MMIO space + @param Mmio32Base Base address of 32-bit MMIO + @param Mmio32Size Size of 32-bit MMIO space +**/ +VOID +Ac01PcieCoreBuildRCStruct ( + AC01_RC *RC, + UINT64 RegBase, + UINT64 MmioBase, + UINT64 MmioSize, + UINT64 Mmio32Base, + UINT64 Mmio32Size + ) +{ + INTN PcieIndex; + + RC->BaseAddr =3D RegBase; + RC->TcuAddr =3D RegBase + TCU_OFFSET; + RC->HBAddr =3D RegBase + HB_CSR_OFFSET; + RC->SerdesAddr =3D RegBase + SERDES_CSR_OFFSET; + RC->MmcfgAddr =3D RegBase + MMCONFIG_OFFSET; + RC->MmioAddr =3D MmioBase; + RC->MmioSize =3D MmioSize; + RC->Mmio32Addr =3D Mmio32Base; + RC->Mmio32Size =3D Mmio32Size; + RC->IoAddr =3D Mmio32Base + Mmio32Size - IO_SPACE; + + RC->Type =3D (RC->ID < MAX_RCA) ? RCA : RCB; + RC->MaxPcieController =3D (RC->Type =3D=3D RCB) ? MAX_PCIE_B : MAX_PCIE_= A; + + BoardPcieParseRCParams (RC); + + for (PcieIndex =3D 0; PcieIndex < RC->MaxPcieController; PcieIndex++) { + RC->Pcie[PcieIndex].ID =3D PcieIndex; + RC->Pcie[PcieIndex].CsrAddr =3D RC->BaseAddr + PCIE0_CSR_OFFSET + Pcie= Index*0x10000; + RC->Pcie[PcieIndex].SnpsRamAddr =3D RC->Pcie[PcieIndex].CsrAddr + SNPS= RAM_OFFSET; + RC->Pcie[PcieIndex].DevNum =3D PcieIndex + 1; + } + + DEBUG_PCIE_INFO ( + " + S%d - RC%a%d, MMCfgAddr:0x%lx, MmioAddr:0x%lx, MmioSize:0x%lx, Mmi= o32Addr:0x%lx, Mmio32Size:0x%lx, Enabled:%a\n", + RC->Socket, + (RC->Type =3D=3D RCA) ? "A" : "B", + RC->ID, + RC->MmcfgAddr, + RC->MmioAddr, + RC->MmioSize, + RC->Mmio32Addr, + RC->Mmio32Size, + (RC->Active) ? "Y" : "N" + ); + DEBUG_PCIE_INFO (" + DevMapLow/High: 0x%x/0x%x\n", RC->DevMapLow, RC->= DevMapHigh); + for (PcieIndex =3D 0; PcieIndex < RC->MaxPcieController; PcieIndex++) { + DEBUG_PCIE_INFO ( + " + PCIE%d:0x%lx - Enabled:%a - DevNum:0x%x\n", + PcieIndex, + RC->Pcie[PcieIndex].CsrAddr, + (RC->Pcie[PcieIndex].Active) ? "Y" : "N", + RC->Pcie[PcieIndex].DevNum + ); + } +} + +/** + Configure equalization settings + + @param RC Pointer to AC01_RC structure + @param PcieIndex PCIe index +**/ +STATIC +VOID +Ac01PcieConfigureEqualization ( + IN AC01_RC *RC, + IN INTN PcieIndex + ) +{ + VOID *CfgAddr; + UINT32 Val; + + CfgAddr =3D (VOID *)(RC->MmcfgAddr + (RC->Pcie[PcieIndex].DevNum << 15)); + + // Select the FoM method, need double-write to convey settings + Ac01PcieCfgIn32 (CfgAddr + GEN3_EQ_CONTROL_OFF, &Val); + Val =3D GEN3_EQ_FB_MODE (Val, 0x1); + Val =3D GEN3_EQ_PRESET_VEC (Val, 0x3FF); + Val =3D GEN3_EQ_INIT_EVAL (Val, 0x1); + Ac01PcieCfgOut32 (CfgAddr + GEN3_EQ_CONTROL_OFF, Val); + Ac01PcieCfgOut32 (CfgAddr + GEN3_EQ_CONTROL_OFF, Val); + Ac01PcieCfgIn32 (CfgAddr + GEN3_EQ_CONTROL_OFF, &Val); +} + +/** + Configure presets for GEN3 equalization + + @param RC Pointer to AC01_RC structure + @param PcieIndex PCIe index +**/ +STATIC +VOID +Ac01PcieConfigurePresetGen3 ( + IN AC01_RC *RC, + IN INTN PcieIndex + ) +{ + VOID *CfgAddr, *SpcieBaseAddr; + UINT32 Val, Idx; + CfgAddr =3D (VOID *)(RC->MmcfgAddr + (RC->Pcie[PcieIndex].DevNum << 15)); + + // Bring to legacy mode + Ac01PcieCfgIn32 (CfgAddr + GEN3_RELATED_OFF, &Val); + Val =3D RATE_SHADOW_SEL_SET (Val, 0); + Ac01PcieCfgOut32 (CfgAddr + GEN3_RELATED_OFF, Val); + Val =3D EQ_PHASE_2_3_SET (Val, 0); + Val =3D RXEQ_REGRDLESS_SET (Val, 1); + Ac01PcieCfgOut32 (CfgAddr + GEN3_RELATED_OFF, Val); + + // Generate SPCIE capability address + SpcieBaseAddr =3D (VOID *)PcieCheckCap (RC, PcieIndex, 0x1, SPCIE_CAP_ID= ); + if (SpcieBaseAddr =3D=3D 0) { + DEBUG_PCIE_ERR ( + "PCIE%d.%d: Cannot get SPCIE capability address\n", + RC->ID, + PcieIndex + ); + return; + } + + for (Idx=3D0; Idx < RC->Pcie[PcieIndex].MaxWidth/2; Idx++) { + // Program Preset to Gen3 EQ Lane Control + Ac01PcieCfgIn32 (SpcieBaseAddr + CAP_OFF_0C + Idx*4, &Val); + Val =3D DSP_TX_PRESET0_SET (Val, 0x7); + Val =3D DSP_TX_PRESET1_SET (Val, 0x7); + Ac01PcieCfgOut32 (SpcieBaseAddr + CAP_OFF_0C + Idx*4, Val); + } +} + +/** + Configure presets for GEN4 equalization + + @param RC Pointer to AC01_RC structure + @param PcieIndex PCIe index +**/ +STATIC +VOID +Ac01PcieConfigurePresetGen4 ( + IN AC01_RC *RC, + IN INTN PcieIndex + ) +{ + UINT32 Val; + VOID *CfgAddr, *SpcieBaseAddr, *Pl16BaseAddr; + UINT32 LinkWidth, i; + UINT8 Preset; + + CfgAddr =3D (VOID *)(RC->MmcfgAddr + (RC->Pcie[PcieIndex].DevNum << 15)); + + // Bring to legacy mode + Ac01PcieCfgIn32 (CfgAddr + GEN3_RELATED_OFF, &Val); + Val =3D RATE_SHADOW_SEL_SET (Val, 1); + Ac01PcieCfgOut32 (CfgAddr + GEN3_RELATED_OFF, Val); + Val =3D EQ_PHASE_2_3_SET (Val, 0); + Val =3D RXEQ_REGRDLESS_SET (Val, 1); + Ac01PcieCfgOut32 (CfgAddr + GEN3_RELATED_OFF, Val); + + // Generate the PL16 capability address + Pl16BaseAddr =3D (VOID *)PcieCheckCap (RC, PcieIndex, 0x1, PL16_CAP_ID); + if (Pl16BaseAddr =3D=3D 0) { + DEBUG_PCIE_ERR ( + "PCIE%d.%d: Cannot get PL16 capability address\n", + RC->ID, + PcieIndex + ); + return; + } + + // Generate the SPCIE capability address + SpcieBaseAddr =3D (VOID *)PcieCheckCap (RC, PcieIndex, 0x1, SPCIE_CAP_ID= ); + if (SpcieBaseAddr =3D=3D 0) { + DEBUG_PCIE_ERR ( + "PCIE%d.%d: Cannot get SPICE capability address\n", + RC->ID, + PcieIndex + ); + return; + } + + // Configure downstream Gen4 Tx preset + if (RC->PresetGen4[PcieIndex] =3D=3D PRESET_INVALID) { + Preset =3D 0x57; // Default Gen4 preset + } else { + Preset =3D RC->PresetGen4[PcieIndex]; + } + + LinkWidth =3D RC->Pcie[PcieIndex].MaxWidth; + if (LinkWidth =3D=3D 0x2) { + Ac01PcieCfgIn32 (Pl16BaseAddr + PL16G_CAP_OFF_20H_REG_OFF, &Val); + Val =3D DSP_16G_RXTX_PRESET0_SET (Val, Preset); + Val =3D DSP_16G_RXTX_PRESET1_SET (Val, Preset); + Ac01PcieCfgOut32 (Pl16BaseAddr + PL16G_CAP_OFF_20H_REG_OFF, Val); + } else { + for (i =3D 0; i < LinkWidth/4; i++) { + Ac01PcieCfgIn32 (Pl16BaseAddr + PL16G_CAP_OFF_20H_REG_OFF + i*4, &Va= l); + 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); + Ac01PcieCfgOut32 (Pl16BaseAddr + PL16G_CAP_OFF_20H_REG_OFF + i*4, Va= l); + } + } + + // Configure Gen3 preset + for (i =3D 0; i < LinkWidth/2; i++) { + Ac01PcieCfgIn32 (SpcieBaseAddr + CAP_OFF_0C + i*4, &Val); + Val =3D DSP_TX_PRESET0_SET (Val, 0x7); + Val =3D DSP_TX_PRESET1_SET (Val, 0x7); + Ac01PcieCfgOut32 (SpcieBaseAddr + CAP_OFF_0C + i*4, Val); + } +} + +STATIC BOOLEAN +RasdpMitigationCheck ( + AC01_RC *RC, + INTN PcieIndex + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + VOID *Hob; + + Hob =3D GetFirstGuidHob (&gPlatformHobGuid); + PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + if ((PlatformHob->ScuProductId[0] & 0xff) =3D=3D 0x01) { + if (AsciiStrCmp ((CONST CHAR8 *)PlatformHob->CpuVer, "A0") =3D=3D 0) { + return ((RC->Type =3D=3D RCB)||(PcieIndex > 0)) ? TRUE : FALSE; + } + } + + return FALSE; +} + +/** + Setup and initialize the AC01 PCIe Root Complex and underneath PCIe con= trollers + + @param RC Pointer to Root Complex structure + @param ReInit Re-init status + @param ReInitPcieIndex PCIe index +**/ +INT32 +Ac01PcieCoreSetupRC ( + IN AC01_RC *RC, + IN UINT8 ReInit, + IN UINT8 ReInitPcieIndex + ) +{ + VOID *CsrAddr, *CfgAddr, *SnpsRamAddr, *DlinkBaseAddr; + INTN PcieIndex; + INTN TimeOut; + UINT32 Val; + PHY_CONTEXT PhyCtx =3D { 0 }; + PHY_PLAT_RESOURCE PhyPlatResource =3D { 0 }; + INTN Ret; + UINT16 NextExtendedCapabilityOff; + UINT32 VsecVal; + + DEBUG_PCIE_INFO ("Initializing Socket%d RC%d\n", RC->Socket, RC->ID); + + if (ReInit =3D=3D 0) { + // Initialize SERDES + ZeroMem (&PhyCtx, sizeof (PhyCtx)); + PhyCtx.SdsAddr =3D RC->SerdesAddr; + PhyCtx.PcieCtrlInfo |=3D ((RC->Socket & 0x1) << 2); + PhyCtx.PcieCtrlInfo |=3D ((RC->ID & 0x7) << 4); + PhyCtx.PcieCtrlInfo |=3D 0xF << 8; + PhyPlatResource.MmioRd =3D Ac01PcieMmioRd; + PhyPlatResource.MmioWr =3D Ac01PcieMmioWr; + PhyPlatResource.UsDelay =3D Ac01PcieDelay; + PhyPlatResource.Puts =3D Ac01PciePuts; + PhyPlatResource.PutInt =3D Ac01PciePutInt; + PhyPlatResource.PutHex =3D Ac01PciePutInt; + PhyPlatResource.PutHex64 =3D Ac01PciePutHex; + PhyPlatResource.DebugPrint =3D Ac01PcieDebugPrint; + PhyCtx.PhyPlatResource =3D &PhyPlatResource; + + Ret =3D SerdesInitClkrst (&PhyCtx); + if (Ret !=3D PHY_INIT_PASS) { + return -1; + } + } + + // Setup each controller + for (PcieIndex =3D 0; PcieIndex < RC->MaxPcieController; PcieIndex++) { + + if (ReInit =3D=3D 1) { + PcieIndex =3D ReInitPcieIndex; + } + + if (!RC->Pcie[PcieIndex].Active) { + continue; + } + + DEBUG_PCIE_INFO ("Initializing Controller %d\n", PcieIndex); + + CsrAddr =3D (VOID *)RC->Pcie[PcieIndex].CsrAddr; + SnpsRamAddr =3D (VOID *)RC->Pcie[PcieIndex].SnpsRamAddr; + CfgAddr =3D (VOID *)(RC->MmcfgAddr + (RC->Pcie[PcieIndex].DevNum << 15= )); + + // Put Controller into reset if not in reset already + Ac01PcieCsrIn32 (CsrAddr + RESET, &Val); + if (!(Val & RESET_MASK)) { + Val =3D DWCPCIE_SET (Val, 1); + Ac01PcieCsrOut32 (CsrAddr + RESET, Val); + + // Delay 50ms to ensure controller finish its reset + MicroSecondDelay (50000); + } + + // Clear memory shutdown + Ac01PcieCsrIn32 (CsrAddr + RAMSDR, &Val); + Val =3D SD_SET (Val, 0); + Ac01PcieCsrOut32 (CsrAddr + RAMSDR, Val); + + // Poll till mem is ready + TimeOut =3D MEMRDY_TIMEOUT; + do { + Ac01PcieCsrIn32 (CsrAddr + MEMRDYR, &Val); + if (Val & 1) { + break; + } + + TimeOut--; + MicroSecondDelay (1); + } while (TimeOut > 0); + + if (TimeOut <=3D 0) { + DEBUG_PCIE_ERR ("- Pcie[%d] - Mem not ready\n", PcieIndex); + return -1; + } + + // Hold link training + Ac01PcieCsrIn32 (CsrAddr + LINKCTRL, &Val); + Val =3D LTSSMENB_SET (Val, 0); + Ac01PcieCsrOut32 (CsrAddr + LINKCTRL, Val); + + // Enable subsystem clock and release reset + Ac01PcieCsrIn32 (CsrAddr + CLOCK, &Val); + Val =3D AXIPIPE_SET (Val, 1); + Ac01PcieCsrOut32 (CsrAddr + CLOCK, Val); + Ac01PcieCsrIn32 (CsrAddr + RESET, &Val); + Val =3D DWCPCIE_SET (Val, 0); + Ac01PcieCsrOut32 (CsrAddr + RESET, 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 { + Ac01PcieCsrIn32 (CsrAddr + LINKSTAT, &Val); + if (!(Val & PHY_STATUS_MASK)) { + break; + } + + TimeOut--; + MicroSecondDelay (1); + } while (TimeOut > 0); + + if (TimeOut <=3D 0) { + DEBUG_PCIE_ERR ("- Pcie[%d] - PIPE clock is not stable\n", PcieIndex= ); + return -1; + } + + // Start PERST pulse + BoardPcieAssertPerst (RC, PcieIndex, 0, TRUE); + + // Allow programming to config space + Ac01PcieCsrIn32 (CfgAddr + MISC_CONTROL_1_OFF, &Val); + Val =3D DBI_RO_WR_EN_SET (Val, 1); + Ac01PcieCsrOut32 (CfgAddr + MISC_CONTROL_1_OFF, Val); + + // In order to detect the NVMe disk for booting without disk, + // need to set Hot-Plug Slot Capable during port initialization. + // It will help PCI Linux driver to initialize its slot iomem resource, + // the one is used for detecting the disk when it is inserted. + Ac01PcieCsrIn32 (CfgAddr + SLOT_CAPABILITIES_REG, &Val); + Val =3D SLOT_HPC_SET (Val, 1); + // Program the power limit + Val =3D SLOT_CAP_SLOT_POWER_LIMIT_VALUE_SET (Val, SLOT_POWER_LIMIT); + Ac01PcieCsrOut32 (CfgAddr + SLOT_CAPABILITIES_REG, Val); + + + // Apply RASDP error mitigation for all x8, x4, and x2 controllers + // This includes all RCB root ports, and every RCA root port controller + // except for index 0 (i.e. x16 controllers are exempted from this WA) + if (RasdpMitigationCheck (RC, PcieIndex)) { + // Change the Read Margin dual ported RAMs + Val =3D 0x10; // Margin to 0x0 (most conservative setting) + Ac01PcieCsrOut32 (SnpsRamAddr + TPSRAM_RMR, Val); + + // Generate the DLINK capability address + DlinkBaseAddr =3D (VOID *)(RC->MmcfgAddr + (RC->Pcie[PcieIndex].DevN= um << 15)); + NextExtendedCapabilityOff =3D 0x100; // This is the 1st extended cap= ability offset + do { + Ac01PcieCsrIn32 (DlinkBaseAddr + NextExtendedCapabilityOff, &Val); + if (Val =3D=3D 0xFFFFFFFF) { + DlinkBaseAddr =3D 0x0; + break; + } + if ((Val & 0xFFFF) =3D=3D DLINK_VENDOR_CAP_ID) { + Ac01PcieCsrIn32 (DlinkBaseAddr + NextExtendedCapabilityOff + 0x4= , &VsecVal); + if (VsecVal =3D=3D DLINK_VSEC) { + DlinkBaseAddr =3D DlinkBaseAddr + NextExtendedCapabilityOff; + break; + } + } + NextExtendedCapabilityOff =3D (Val >> 20); + } while (NextExtendedCapabilityOff !=3D 0); + + // Disable the scaled credit mode + if (DlinkBaseAddr !=3D 0x0) { + Val =3D 1; + Ac01PcieCsrOut32 (DlinkBaseAddr + DATA_LINK_FEATURE_CAP_OFF, Val); + Ac01PcieCsrIn32 (DlinkBaseAddr + DATA_LINK_FEATURE_CAP_OFF, &Val); + if (Val !=3D 1) { + DEBUG_PCIE_ERR ("- Pcie[%d] - Unable to disable scaled credit\n"= , PcieIndex); + return -1; + } + } else { + DEBUG_PCIE_ERR ("- Pcie[%d] - Unable to locate data link feature c= ap offset\n", PcieIndex); + return -1; + } + + // Reduce Posted Credits to 1 packet header and data credit for all + // impacted controllers. Also zero credit scale values for both + // data and packet headers. + Val=3D0x40201020; + Ac01PcieCsrOut32 (CfgAddr + PORT_LOCIG_VC0_P_RX_Q_CTRL_OFF, Val); + } + + // Program DTI for ATS support + Ac01PcieCsrIn32 (CfgAddr + DTIM_CTRL0_OFF, &Val); + Val =3D DTIM_CTRL0_ROOT_PORT_ID_SET (Val, 0); + Ac01PcieCsrOut32 (CfgAddr + DTIM_CTRL0_OFF, 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 + // + Ac01PcieCsrIn32 (CfgAddr + PORT_LINK_CTRL_OFF, &Val); + switch (RC->Pcie[PcieIndex].MaxWidth) { + case LNKW_X2: + Val =3D LINK_CAPABLE_SET (Val, LINK_CAPABLE_X2); + break; + + case LNKW_X4: + Val =3D LINK_CAPABLE_SET (Val, LINK_CAPABLE_X4); + break; + + case LNKW_X8: + Val =3D LINK_CAPABLE_SET (Val, LINK_CAPABLE_X8); + break; + + case LNKW_X16: + default: + Val =3D LINK_CAPABLE_SET (Val, LINK_CAPABLE_X16); + break; + } + Ac01PcieCsrOut32 (CfgAddr + PORT_LINK_CTRL_OFF, Val); + Ac01PcieCsrIn32 (CfgAddr + GEN2_CTRL_OFF, &Val); + switch (RC->Pcie[PcieIndex].MaxWidth) { + case LNKW_X2: + Val =3D NUM_OF_LANES_SET (Val, NUM_OF_LANES_X2); + break; + + case LNKW_X4: + Val =3D NUM_OF_LANES_SET (Val, NUM_OF_LANES_X4); + break; + + case LNKW_X8: + Val =3D NUM_OF_LANES_SET (Val, NUM_OF_LANES_X8); + break; + + case LNKW_X16: + default: + Val =3D NUM_OF_LANES_SET (Val, NUM_OF_LANES_X16); + break; + } + Ac01PcieCsrOut32 (CfgAddr + GEN2_CTRL_OFF, Val); + Ac01PcieCsrIn32 (CfgAddr + LINK_CAPABILITIES_REG, &Val); + switch (RC->Pcie[PcieIndex].MaxWidth) { + case LNKW_X2: + Val =3D CAP_MAX_LINK_WIDTH_SET (Val, CAP_MAX_LINK_WIDTH_X2); + break; + + case LNKW_X4: + Val =3D CAP_MAX_LINK_WIDTH_SET (Val, CAP_MAX_LINK_WIDTH_X4); + break; + + case LNKW_X8: + Val =3D CAP_MAX_LINK_WIDTH_SET (Val, CAP_MAX_LINK_WIDTH_X8); + break; + + case LNKW_X16: + default: + Val =3D CAP_MAX_LINK_WIDTH_SET (Val, CAP_MAX_LINK_WIDTH_X16); + break; + } + + switch (RC->Pcie[PcieIndex].MaxGen) { + case SPEED_GEN1: + Val =3D CAP_MAX_LINK_SPEED_SET (Val, MAX_LINK_SPEED_25); + break; + + case SPEED_GEN2: + Val =3D CAP_MAX_LINK_SPEED_SET (Val, MAX_LINK_SPEED_50); + break; + + case 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); + Ac01PcieCsrOut32 (CfgAddr + LINK_CAPABILITIES_REG, Val); + + Ac01PcieCsrIn32 (CfgAddr + LINK_CONTROL2_LINK_STATUS2_REG, &Val); + switch (RC->Pcie[PcieIndex].MaxGen) { + case SPEED_GEN1: + Val =3D CAP_TARGET_LINK_SPEED_SET (Val, MAX_LINK_SPEED_25); + break; + + case SPEED_GEN2: + Val =3D CAP_TARGET_LINK_SPEED_SET (Val, MAX_LINK_SPEED_50); + break; + + case 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; + } + Ac01PcieCsrOut32 (CfgAddr + LINK_CONTROL2_LINK_STATUS2_REG, Val); + + // Set Zero byte request handling + Ac01PcieCsrIn32 (CfgAddr + FILTER_MASK_2_OFF, &Val); + 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); + Ac01PcieCsrOut32 (CfgAddr + FILTER_MASK_2_OFF, Val); + Ac01PcieCsrIn32 (CfgAddr + AMBA_ORDERING_CTRL_OFF, &Val); + Val =3D AX_MSTR_ZEROLREAD_FW_SET (Val, 0); + Ac01PcieCsrOut32 (CfgAddr + AMBA_ORDERING_CTRL_OFF, Val); + + // + // Set Completion with CRS handling for CFG Request + // Set Completion with CA/UR handling non-CFG Request + // + Ac01PcieCsrIn32 (CfgAddr + AMBA_ERROR_RESPONSE_DEFAULT_OFF, &Val); + Val =3D AMBA_ERROR_RESPONSE_CRS_SET (Val, 0x2); + Ac01PcieCsrOut32 (CfgAddr + AMBA_ERROR_RESPONSE_DEFAULT_OFF, Val); + + // Set Legacy PCIE interrupt map to INTA + Ac01PcieCsrIn32 (CfgAddr + BRIDGE_CTRL_INT_PIN_INT_LINE_REG, &Val); + Val =3D INT_PIN_SET (Val, 1); + Ac01PcieCsrOut32 (CfgAddr + BRIDGE_CTRL_INT_PIN_INT_LINE_REG, Val); + Ac01PcieCsrIn32 (CsrAddr + IRQSEL, &Val); + Val =3D INTPIN_SET (Val, 1); + Ac01PcieCsrOut32 (CsrAddr + IRQSEL, Val); + + if (RC->Pcie[PcieIndex].MaxGen !=3D SPEED_GEN1) { + Ac01PcieConfigureEqualization (RC, PcieIndex); + if (RC->Pcie[PcieIndex].MaxGen =3D=3D SPEED_GEN3) { + Ac01PcieConfigurePresetGen3 (RC, PcieIndex); + } else if (RC->Pcie[PcieIndex].MaxGen =3D=3D SPEED_GEN4) { + Ac01PcieConfigurePresetGen4 (RC, PcieIndex); + } + } + + // Mask Completion Timeout + Ac01PcieCsrIn32 (CfgAddr + AMBA_LINK_TIMEOUT_OFF, &Val); + Val =3D LINK_TIMEOUT_PERIOD_DEFAULT_SET (Val, 1); + Ac01PcieCsrOut32 (CfgAddr + AMBA_LINK_TIMEOUT_OFF, Val); + Ac01PcieCsrIn32 (CfgAddr + UNCORR_ERR_MASK_OFF, &Val); + Val =3D CMPLT_TIMEOUT_ERR_MASK_SET (Val, 1); + // AER surprise link down error should be masked due to hotplug is ena= bled + // This event must be handled by Hotplug handler, instead of error han= dler + Val =3D SDES_ERR_MASK_SET (Val, 1); + Ac01PcieCsrOut32 (CfgAddr + UNCORR_ERR_MASK_OFF, Val); + + // Program Class Code + Ac01PcieCsrIn32 (CfgAddr + TYPE1_CLASS_CODE_REV_ID_REG, &Val); + Val =3D REVISION_ID_SET (Val, 4); + Val =3D SUBCLASS_CODE_SET (Val, 4); + Val =3D BASE_CLASS_CODE_SET (Val, 6); + Ac01PcieCsrOut32 (CfgAddr + TYPE1_CLASS_CODE_REV_ID_REG, Val); + + // Program VendorID and DeviceID + Ac01PcieCsrIn32 (CfgAddr + TYPE1_DEV_ID_VEND_ID_REG, &Val); + Val =3D VENDOR_ID_SET (Val, AMPERE_PCIE_VENDORID); + if (RCA =3D=3D RC->Type) { + Val =3D DEVICE_ID_SET (Val, AC01_PCIE_BRIDGE_DEVICEID_RCA + PcieInde= x); + } else { + Val =3D DEVICE_ID_SET (Val, AC01_PCIE_BRIDGE_DEVICEID_RCB + PcieInde= x); + } + Ac01PcieCsrOut32 (CfgAddr + TYPE1_DEV_ID_VEND_ID_REG, Val); + + // Enable common clock for downstream + Ac01PcieCsrIn32 (CfgAddr + LINK_CONTROL_LINK_STATUS_REG, &Val); + Val =3D CAP_SLOT_CLK_CONFIG_SET (Val, 1); + Val =3D CAP_COMMON_CLK_SET (Val, 1); + Ac01PcieCsrOut32 (CfgAddr + LINK_CONTROL_LINK_STATUS_REG, Val); + + // Match aux_clk to system + Ac01PcieCsrIn32 (CfgAddr + AUX_CLK_FREQ_OFF, &Val); + Val =3D AUX_CLK_FREQ_SET (Val, AUX_CLK_500MHZ); + Ac01PcieCsrOut32 (CfgAddr + AUX_CLK_FREQ_OFF, Val); + + // Assert PERST low to reset endpoint + BoardPcieAssertPerst (RC, PcieIndex, 0, FALSE); + + // Start link training + Ac01PcieCsrIn32 (CsrAddr + LINKCTRL, &Val); + Val =3D LTSSMENB_SET (Val, 1); + Ac01PcieCsrOut32 (CsrAddr + LINKCTRL, Val); + + // Complete the PERST pulse + BoardPcieAssertPerst (RC, PcieIndex, 0, TRUE); + + // Lock programming of config space + Ac01PcieCsrIn32 (CfgAddr + MISC_CONTROL_1_OFF, &Val); + Val =3D DBI_RO_WR_EN_SET (Val, 0); + Ac01PcieCsrOut32 (CfgAddr + MISC_CONTROL_1_OFF, Val); + + if (ReInit =3D=3D 1) { + return 0; + } + } + + // Program VendorID and DeviceId + if (!EFI_ERROR (MailboxMsgRegisterRead (RC->Socket, RC->HBAddr + HBPDVI= DR, &Val))) { + Val =3D PCIVENDID_SET (Val, AMPERE_PCIE_VENDORID); + if (RCA =3D=3D RC->Type) { + Val =3D PCIDEVID_SET (Val, AC01_HOST_BRIDGE_DEVICEID_RCA); + } else { + Val =3D PCIDEVID_SET (Val, AC01_HOST_BRIDGE_DEVICEID_RCB); + } + MailboxMsgRegisterWrite (RC->Socket, RC->HBAddr + HBPDVIDR, Val); + } + + return 0; +} + +BOOLEAN +PcieLinkUpCheck ( + IN AC01_PCIE *Pcie + ) +{ + VOID *CsrAddr; + UINT32 BlockEvent, LinkStat; + + CsrAddr =3D (VOID *)Pcie->CsrAddr; + + // 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 + Ac01PcieCsrIn32 (CsrAddr + LINKSTAT, &LinkStat); + 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 0x0000) { + return FALSE; + } + + Ac01PcieCsrIn32 (CsrAddr + BLOCKEVENTSTAT, &BlockEvent); + Ac01PcieCsrIn32 (CsrAddr + LINKSTAT, &LinkStat); + + if (((BlockEvent & LINKUP_MASK) !=3D 0) + && (SMLH_LTSSM_STATE_GET(LinkStat) =3D=3D S_L0)) + { + DEBUG_PCIE_INFO ("%a Linkup\n", __FUNCTION__); + return TRUE; + } + + return FALSE; +} + +VOID +Ac01PcieCoreEndEnumeration ( + AC01_RC *RC + ) +{ + VOID *Reg; + UINTN Index; + UINT32 Val; + VOID *CfgAddr; + + if (RC =3D=3D NULL || !RC->Active) { + return; + } + + // Clear uncorrectable error during enumuration phase. Mainly completion= timeout. + for (Index =3D 0; Index < RC->MaxPcieController; Index++) { + if (!RC->Pcie[Index].Active) { + continue; + } + if (!PcieLinkUpCheck(&RC->Pcie[Index])) { + // If link down/disabled after enumeration, disable completed time o= ut + CfgAddr =3D (VOID *)(RC->MmcfgAddr + (RC->Pcie[Index].DevNum << 15)); + Ac01PcieCsrIn32 (CfgAddr + UNCORR_ERR_MASK_OFF, &Val); + Val =3D CMPLT_TIMEOUT_ERR_MASK_SET (Val, 1); + Ac01PcieCsrOut32 (CfgAddr + UNCORR_ERR_MASK_OFF, Val); + } + // Clear all errors + Reg =3D (VOID *)((UINT64)RC->MmcfgAddr + ((Index + 1) << 15) + UNCORR_= ERR_STATUS_OFF); + Ac01PcieCfgIn32 (Reg, &Val); + if (Val !=3D 0) { + // Clear error by writting + Ac01PcieCfgOut32 (Reg, Val); + } + } +} + +/** + Comparing current link status with the max capabilities of the link + + @param RC Pointer to AC01_RC structure + @param PcieIndex PCIe index + @param EpMaxWidth EP max link width + @param EpMaxGen EP max link speed + @retval -1: Link status do not match with link max capabil= ities + 1: Link capabilites are invalid + 0: Link status are correct +**/ +INT32 +Ac01PcieCoreLinkCheck ( + IN AC01_RC *RC, + IN INTN PcieIndex, + IN UINT8 EpMaxWidth, + IN UINT8 EpMaxGen + ) +{ + VOID *CsrAddr, *CfgAddr; + UINT32 Val, LinkStat; + UINT32 MaxWidth, MaxGen; + + CsrAddr =3D (VOID *)RC->Pcie[PcieIndex].CsrAddr; + CfgAddr =3D (VOID *)(RC->MmcfgAddr + (RC->Pcie[PcieIndex].DevNum << 15)); + + Ac01PcieCsrIn32 (CfgAddr + LINK_CAPABILITIES_REG, &Val); + if ((CAP_MAX_LINK_WIDTH_GET (Val) =3D=3D 0) || + (CAP_MAX_LINK_SPEED_GET (Val) =3D=3D 0)) { + DEBUG_PCIE_INFO ("\tPCIE%d.%d: Wrong RC capabilities\n", RC->ID, PcieI= ndex); + return LINK_CHECK_WRONG_PARAMETER; + } + + if ((EpMaxWidth =3D=3D 0) || (EpMaxGen =3D=3D 0)) { + DEBUG_PCIE_INFO ("\tPCIE%d.%d: Wrong EP capabilities\n", RC->ID, PcieI= ndex); + return LINK_CHECK_FAILED; + } + + // Compare RC and EP capabilities + if (CAP_MAX_LINK_WIDTH_GET (Val) > EpMaxWidth) { + MaxWidth =3D EpMaxWidth; + } else { + MaxWidth =3D CAP_MAX_LINK_WIDTH_GET (Val); + } + + // Compare RC and EP capabilities + if (CAP_MAX_LINK_SPEED_GET (Val) > EpMaxGen) { + MaxGen =3D EpMaxGen; + } else { + MaxGen =3D CAP_MAX_LINK_SPEED_GET (Val); + } + + Ac01PcieCsrIn32 (CsrAddr + LINKSTAT, &LinkStat); + Ac01PcieCsrIn32 (CfgAddr + LINK_CONTROL_LINK_STATUS_REG, &Val); + DEBUG_PCIE_INFO ( + "PCIE%d.%d: Link MaxWidth %d MaxGen %d, LINKSTAT 0x%x", + RC->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_PCIE_INFO ("\tLinkCheck FAILED\n"); + return LINK_CHECK_FAILED; + } + + DEBUG_PCIE_INFO ("\tLinkCheck SUCCESS\n"); + return LINK_CHECK_SUCCESS; +} + +INT32 +Ac01PFAEnableAll ( + IN AC01_RC *RC, + IN INTN PcieIndex, + IN INTN PFAMode + ) +{ + VOID *RasDesVSecBase; + VOID *CfgAddr; + UINT8 ErrCode, ErrGrpNum; + UINT32 Val; + INT32 Ret =3D LINK_CHECK_SUCCESS; + + UINT32 ErrCtrlCfg[MAX_NUM_ERROR_CODE] =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 + }; + + CfgAddr =3D (VOID *)(RC->MmcfgAddr + (RC->Pcie[PcieIndex].DevNum << 15)); + + // Allow programming to config space + Ac01PcieCsrIn32 (CfgAddr + MISC_CONTROL_1_OFF, &Val); + Val =3D DBI_RO_WR_EN_SET (Val, 1); + Ac01PcieCsrOut32 (CfgAddr + MISC_CONTROL_1_OFF, Val); + + // Generate the RAS DES capability address + // RAS_DES_CAP_ID =3D 0xB + RasDesVSecBase =3D (VOID *)PcieCheckCap (RC, PcieIndex, 0x1, RAS_DES_CAP= _ID); + if (RasDesVSecBase =3D=3D 0) { + DEBUG_PCIE_INFO ("PCIE%d.%d: Cannot get RAS DES capability address\n",= RC->ID, PcieIndex); + return LINK_CHECK_WRONG_PARAMETER; + } + + if (PFAMode =3D=3D PFA_REG_ENABLE) { + // PFA Counters Enable + Ac01PcieCsrIn32 (RasDesVSecBase + EVENT_COUNTER_CONTROL_REG_OFF, &Val); + Val =3D ECCR_EVENT_COUNTER_ENABLE_SET (Val, 0x7); + Val =3D ECCR_EVENT_COUNTER_CLEAR_SET (Val, 0); + Ac01PcieCsrOut32 (RasDesVSecBase + EVENT_COUNTER_CONTROL_REG_OFF, Val); + } else if (PFAMode =3D=3D PFA_REG_CLEAR) { + // PFA Counters Clear + Ac01PcieCsrIn32 (RasDesVSecBase + EVENT_COUNTER_CONTROL_REG_OFF, &Val); + Val =3D ECCR_EVENT_COUNTER_ENABLE_SET (Val, 0); + Val =3D ECCR_EVENT_COUNTER_CLEAR_SET (Val, 0x3); + Ac01PcieCsrOut32 (RasDesVSecBase + EVENT_COUNTER_CONTROL_REG_OFF, Val); + } else { + // PFA Counters Read + for (ErrCode =3D 0; ErrCode < MAX_NUM_ERROR_CODE; ErrCode++) { + ErrGrpNum =3D (ErrCtrlCfg[ErrCode] & 0xF00) >> 8; + // Skipping per lane group + // Checking common lane group because AER error are included in comm= on group only + if ((ErrGrpNum !=3D 0) && (ErrGrpNum !=3D 4)) { + Ac01PcieCsrIn32 (RasDesVSecBase + EVENT_COUNTER_CONTROL_REG_OFF, &= Val); + if (RC->Type =3D=3D RCA) { // RCA - 4 PCIe controller per port, 1 = controller in charge of 4 lanes + Val =3D ECCR_LANE_SEL_SET (Val, PcieIndex*4); + } else { // RCB - 8 PCIe controller per port, 1 controller in char= ge of 2 lanes + Val =3D ECCR_LANE_SEL_SET (Val, PcieIndex*2); + } + Val =3D ECCR_GROUP_EVENT_SEL_SET (Val, ErrCtrlCfg[ErrCode]); + Ac01PcieCsrOut32 (RasDesVSecBase + EVENT_COUNTER_CONTROL_REG_OFF, = Val); + + // After setting Counter Control reg + // This delay just to make sure Counter Data reg is update with ne= w value + MicroSecondDelay (1); + Ac01PcieCsrIn32 (RasDesVSecBase + EVENT_COUNTER_DATA_REG_OFF, &Val= ); + if (Val !=3D 0) { + Ret =3D LINK_CHECK_FAILED; + DEBUG_PCIE_INFO ( + "\tS%d RC%d RP%d \t%s: %d \tGROUP:%d-EVENT:%d\n", + RC->Socket, + RC->ID, + PcieIndex, + Val, + ((ErrCtrlCfg[ErrCode] & 0xF00) >> 8), // Group + (ErrCtrlCfg[ErrCode] & 0x0FF) // Event + ); + } + } + } + } + + // Disable programming to config space + Ac01PcieCsrIn32 (CfgAddr + MISC_CONTROL_1_OFF, &Val); + Val =3D DBI_RO_WR_EN_SET (Val, 0); + Ac01PcieCsrOut32 (CfgAddr + MISC_CONTROL_1_OFF, Val); + + return Ret; +} + +/** + Get link capabilities link width and speed of endpoint + + @param RC[in] Pointer to AC01_RC 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_RC *RC, + IN INTN PcieIndex, + OUT UINT8 *EpMaxWidth, + OUT UINT8 *EpMaxGen + ) +{ + VOID *PcieCapBaseAddr, *EpCfgAddr; + VOID *RcCfgAddr; + UINT32 Val, RestoreVal; + UINTN TimeOut; + + RcCfgAddr =3D (VOID *)(RC->MmcfgAddr + (RC->Pcie[PcieIndex].DevNum << 15= )); + + // Allow programming to config space + Ac01PcieCsrIn32 (RcCfgAddr + MISC_CONTROL_1_OFF, &Val); + Val =3D DBI_RO_WR_EN_SET (Val, 1); + Ac01PcieCsrOut32 (RcCfgAddr + MISC_CONTROL_1_OFF, Val); + + Ac01PcieCsrIn32 (RcCfgAddr + SEC_LAT_TIMER_SUB_BUS_SEC_BUS_PRI_BUS_REG, = &Val); + RestoreVal =3D Val; + Val =3D SUB_BUS_SET (Val, DEFAULT_SUB_BUS); /* Set DEFAULT_S= UB_BUS to Subordinate bus */ + Val =3D SEC_BUS_SET (Val, RC->Pcie[PcieIndex].DevNum); /* Set RC->Pcie[= PcieIndex].DevNum to Secondary bus */ + Val =3D PRIM_BUS_SET (Val, 0x0); /* Set 0x0 to Pr= imary bus */ + Ac01PcieCsrOut32 (RcCfgAddr + SEC_LAT_TIMER_SUB_BUS_SEC_BUS_PRI_BUS_REG,= Val); + EpCfgAddr =3D (VOID *)(RC->MmcfgAddr + (RC->Pcie[PcieIndex].DevNum << 20= )); /* Bus 1, dev 0, func 0 */ + + // Loop read EpCfgAddr value until got valid value or + // reach to timeout EP_LINKUP_TIMEOUT (or more depend on card) + TimeOut =3D EP_LINKUP_TIMEOUT; + do { + Ac01PcieCsrIn32 (EpCfgAddr, &Val); + if (Val !=3D 0xFFFF0001 && Val !=3D 0xFFFFFFFF) { + break; + } + MicroSecondDelay (LINK_WAIT_INTERVAL_US); + TimeOut -=3D LINK_WAIT_INTERVAL_US; + } while (TimeOut > 0); + + Ac01PcieCsrIn32 (EpCfgAddr, &Val); + + // Check whether EP config space is accessible or not + if (Val =3D=3D 0xFFFFFFFF) { + *EpMaxWidth =3D 0; // Invalid Width + *EpMaxGen =3D 0; // Invalid Speed + DEBUG_PCIE_INFO ("PCIE%d.%d Cannot access EP config space!\n", RC->ID,= PcieIndex); + } else { + PcieCapBaseAddr =3D (VOID *)PcieCheckCap (RC, PcieIndex, 0x0, CAP_ID); + if (PcieCapBaseAddr =3D=3D 0) { + *EpMaxWidth =3D 0; // Invalid Width + *EpMaxGen =3D 0; // Invalid Speed + DEBUG_PCIE_INFO ( + "PCIE%d.%d Cannot get PCIe capability extended address!\n", + RC->ID, + PcieIndex + ); + } else { + Ac01PcieCsrIn32 (PcieCapBaseAddr + LINK_CAPABILITIES_REG_OFF, &Val); + *EpMaxWidth =3D (Val >> 4) & 0x3F; + *EpMaxGen =3D Val & 0xF; + DEBUG_PCIE_INFO ( + "PCIE%d.%d EP MaxWidth %d EP MaxGen %d \n", RC->ID, + PcieIndex, + *EpMaxWidth, + *EpMaxGen + ); + + // From EP, enabling common clock for upstream + Ac01PcieCsrIn32 (PcieCapBaseAddr + LINK_CONTROL_LINK_STATUS_OFF, &Va= l); + Val =3D CAP_SLOT_CLK_CONFIG_SET (Val, 1); + Val =3D CAP_COMMON_CLK_SET (Val, 1); + Ac01PcieCsrOut32 (PcieCapBaseAddr + LINK_CONTROL_LINK_STATUS_OFF, Va= l); + } + } + + // Restore value in order to not affect enumeration process + Ac01PcieCsrOut32 (RcCfgAddr + SEC_LAT_TIMER_SUB_BUS_SEC_BUS_PRI_BUS_REG,= RestoreVal); + + // Disable programming to config space + Ac01PcieCsrIn32 (RcCfgAddr + MISC_CONTROL_1_OFF, &Val); + Val =3D DBI_RO_WR_EN_SET (Val, 0); + Ac01PcieCsrOut32 (RcCfgAddr + MISC_CONTROL_1_OFF, Val); +} + +/** + Check active PCIe controllers of RC, retrain or soft reset if needed + + @param RC[in] Pointer to AC01_RC 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_RC *RC, + IN INTN PcieIndex + ) +{ + VOID *CsrAddr; + INTN TimeOut; + INT32 NumberOfReset =3D MAX_REINIT; // Number of soft reset retry + UINT8 EpMaxWidth, EpMaxGen; + INT32 LinkStatusCheck, RasdesChecking; + + // PCIe controller is not active or Link is not up + // Nothing to be done + if ((!RC->Pcie[PcieIndex].Active) || (!RC->Pcie[PcieIndex].LinkUp)) { + return LINK_CHECK_WRONG_PARAMETER; + } + + do { + + if (RC->Pcie[PcieIndex].LinkUp) { + // Enable all of RASDES register to detect any training error + Ac01PFAEnableAll (RC, PcieIndex, PFA_REG_ENABLE); + + // Accessing Endpoint and checking current link capabilities + Ac01PcieCoreGetEndpointInfo (RC, PcieIndex, &EpMaxWidth, &EpMaxGen); + LinkStatusCheck =3D Ac01PcieCoreLinkCheck (RC, PcieIndex, EpMaxWidth= , 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 Ac01PFAEnableAll (RC, PcieIndex, PFA_REG_READ); + + // Clear error counter + Ac01PFAEnableAll (RC, PcieIndex, PFA_REG_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 (&RC->Pcie[PcieIndex])) + { + return LINK_CHECK_SUCCESS; + } + + RC->Pcie[PcieIndex].LinkUp =3D FALSE; + } + + // Trigger controller soft reset + DEBUG_PCIE_INFO ("PCIE%d.%d Start link re-initialization..\n", RC->ID,= PcieIndex); + Ac01PcieCoreSetupRC (RC, 1, PcieIndex); + + // 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 s= ure + // the state transition is completed + TimeOut =3D LTSSM_TRANSITION_TIMEOUT; + CsrAddr =3D (VOID *)RC->Pcie[PcieIndex].CsrAddr; + do { + if (PcieLinkUpCheck (&RC->Pcie[PcieIndex])) { + DEBUG_PCIE_INFO ( + "\tPCIE%d.%d LinkStat is correct after soft reset, transition ti= me: %d\n", + RC->ID, + PcieIndex, + TimeOut + ); + RC->Pcie[PcieIndex].LinkUp =3D TRUE; + break; + } + + MicroSecondDelay (100); + TimeOut -=3D 100; + } while (TimeOut > 0); + + if (TimeOut <=3D 0) { + DEBUG_PCIE_INFO ("\tPCIE%d.%d LinkStat TIMEOUT after re-init\n", RC-= >ID, PcieIndex); + } else { + DEBUG_PCIE_INFO ("PCIE%d.%d Link re-initialization passed!\n", RC->I= D, PcieIndex); + } + + NumberOfReset--; + } while (NumberOfReset > 0); + + return LINK_CHECK_SUCCESS; +} + +VOID +Ac01PcieCoreUpdateLink ( + IN AC01_RC *RC, + OUT BOOLEAN *IsNextRoundNeeded, + OUT INT8 *FailedPciePtr, + OUT INT8 *FailedPcieCount + ) +{ + INTN PcieIndex; + AC01_PCIE *Pcie; + UINT32 i; + UINT32 Val; + VOID *CfgAddr; + + *IsNextRoundNeeded =3D FALSE; + *FailedPcieCount =3D 0; + for (i =3D 0; i < MAX_PCIE_B; i++) { + FailedPciePtr[i] =3D -1; + } + + if (!RC->Active) { + return; + } + + // Loop for all controllers + for (PcieIndex =3D 0; PcieIndex < RC->MaxPcieController; PcieIndex++) { + Pcie =3D &RC->Pcie[PcieIndex]; + CfgAddr =3D (VOID *)(RC->MmcfgAddr + (RC->Pcie[PcieIndex].DevNum << 15= )); + + if (Pcie->Active && !Pcie->LinkUp) { + if (PcieLinkUpCheck (Pcie)) { + Pcie->LinkUp =3D TRUE; + Ac01PcieCsrIn32 (CfgAddr + LINK_CONTROL_LINK_STATUS_REG, &Val); + DEBUG_PCIE_INFO ( + "%a S%d RC%d RP%d NEGO_LINK_WIDTH: 0x%x LINK_SPEED: 0x%x\n", + __FUNCTION__, + RC->Socket, + RC->ID, + PcieIndex, + CAP_NEGO_LINK_WIDTH_GET (Val), + CAP_LINK_SPEED_GET (Val) + ); + + // Doing link checking and recovery if needed + Ac01PcieCoreQoSLinkCheckRecovery (RC, PcieIndex); + + // Un-mask Completion Timeout + Ac01PcieCsrIn32 (CfgAddr + AMBA_LINK_TIMEOUT_OFF, &Val); + Val =3D LINK_TIMEOUT_PERIOD_DEFAULT_SET (Val, 32); + Ac01PcieCsrOut32 (CfgAddr + AMBA_LINK_TIMEOUT_OFF, Val); + Ac01PcieCsrIn32 (CfgAddr + UNCORR_ERR_MASK_OFF, &Val); + Val =3D CMPLT_TIMEOUT_ERR_MASK_SET (Val, 0); + Ac01PcieCsrOut32 (CfgAddr + UNCORR_ERR_MASK_OFF, Val); + } else { + *IsNextRoundNeeded =3D FALSE; + FailedPciePtr[*FailedPcieCount] =3D PcieIndex; + *FailedPcieCount +=3D 1; + } + } + } +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCoreLib.= c b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCoreLib.c new file mode 100644 index 000000000000..42a0f240763c --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCoreLib.c @@ -0,0 +1,556 @@ +/** @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 "PcieCore.h" +#include "PciePatchAcpi.h" + +STATIC UINT64 RCRegBase[AC01_MAX_PCIE_ROOT_COMPLEX] =3D { AC01_PCIE_REGIS= TER_BASE }; +STATIC UINT64 RCMmioBase[AC01_MAX_PCIE_ROOT_COMPLEX] =3D { AC01_PCIE_MMIO= _BASE }; +STATIC UINT64 RCMmioSize[AC01_MAX_PCIE_ROOT_COMPLEX] =3D {AC01_PCIE_MMIO_= SIZE}; +STATIC UINT64 RCMmio32Base[AC01_MAX_PCIE_ROOT_COMPLEX] =3D { AC01_PCIE_MM= IO32_BASE }; +STATIC UINT64 RCMmio32Base1P[AC01_MAX_PCIE_ROOT_COMPLEX] =3D { AC01_PCIE_= MMIO32_BASE_1P }; +STATIC UINT64 RCMmio32Size[AC01_MAX_PCIE_ROOT_COMPLEX] =3D {AC01_PCIE_MMI= O32_SIZE}; +STATIC UINT64 RCMmio32Size1P[AC01_MAX_PCIE_ROOT_COMPLEX] =3D {AC01_PCIE_M= MIO32_SIZE_1P}; +STATIC AC01_RC RCList[AC01_MAX_PCIE_ROOT_COMPLEX]; +STATIC INT8 PciList[AC01_MAX_PCIE_ROOT_COMPLEX]; + +STATIC +VOID +SerialPrint ( + IN CONST CHAR8 *FormatString, + ... + ) +{ + UINT8 Buf[64]; + VA_LIST Marker; + UINTN NumberOfPrinted; + + VA_START (Marker, FormatString); + NumberOfPrinted =3D AsciiVSPrint ((CHAR8 *)Buf, sizeof (Buf), FormatStri= ng, Marker); + SerialPortWrite (Buf, NumberOfPrinted); + VA_END (Marker); +} + +AC01_RC * +GetRCList ( + UINT8 Idx + ) +{ + return &RCList[Idx]; +} + +/** + Map BusDxe Host bridge and Root bridge Indexes to PCIE core BSP driver = Root Complex Index. + + @param HBIndex Index to identify of PCIE Host bridge. + @param RBIndex Index to identify of PCIE Root bridge. + @retval UINT8 Index to identify Root Complex instance f= rom global RCList. +**/ +STATIC +UINT8 +GetRCIndex ( + IN UINT8 HBIndex, + IN UINT8 RBIndex + ) +{ + // + // BusDxe addresses resources based on Host bridge and Root bridge. + // Map those to Root Complex index/instance known for Pcie Core BSP driv= er + // + return HBIndex * AC01_MAX_PCIE_ROOT_BRIDGE + RBIndex; +} + +/** + Prepare to start PCIE core BSP driver + + @retval EFI_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +EFI_STATUS +Ac01PcieSetup ( + VOID + ) +{ + AC01_RC *RC; + INTN RCIndex; + + ZeroMem (&RCList, sizeof (AC01_RC) * AC01_MAX_PCIE_ROOT_COMPLEX); + + // Adjust MMIO32 base address 1P vs 2P + if (!IsSlaveSocketPresent ()) { + CopyMem ((VOID *)&RCMmio32Base, (VOID *)&RCMmio32Base1P, sizeof (RCMmi= o32Base1P)); + CopyMem ((VOID *)&RCMmio32Size, (VOID *)&RCMmio32Size1P, sizeof (RCMmi= o32Size1P)); + } + + for (RCIndex =3D 0; RCIndex < AC01_MAX_PCIE_ROOT_COMPLEX; RCIndex++) { + RC =3D &RCList[RCIndex]; + RC->Socket =3D RCIndex / AC01_MAX_RCS_PER_SOCKET; + RC->ID =3D RCIndex % AC01_MAX_RCS_PER_SOCKET; + + Ac01PcieCoreBuildRCStruct ( + RC, + RCRegBase[RCIndex], + RCMmioBase[RCIndex], + RCMmioSize[RCIndex], + RCMmio32Base[RCIndex], + RCMmio32Size[RCIndex] + ); + } + + // Build the UEFI menu + BoardPcieScreenInitialize (RCList); + + return EFI_SUCCESS; +} + +/** + Get Total HostBridge. + + @retval UINTN Return Total HostBridge. +**/ +UINT8 +Ac01PcieGetTotalHBs ( + VOID + ) +{ + return AC01_MAX_PCIE_ROOT_COMPLEX; +} + +/** + Get Total RootBridge per HostBridge. + + @param[in] RCIndex Index to identify of Root Complex. + + @retval UINTN Return Total RootBridge per HostBridge. +**/ +UINT8 +Ac01PcieGetTotalRBsPerHB ( + IN UINTN RCIndex + ) +{ + return AC01_MAX_PCIE_ROOT_BRIDGE; +} + +/** + Get RootBridge Attribute. + + @param[in] HBIndex Index to identify of PCIE Host bridge. + @param[in] RBIndex Index to identify of underneath PCIE R= oot bridge. + + @retval UINTN Return RootBridge Attribute. +**/ +UINTN +Ac01PcieGetRootBridgeAttribute ( + IN UINTN HBIndex, + IN UINTN RBIndex + ) +{ + return EFI_PCI_HOST_BRIDGE_MEM64_DECODE; +} + +/** + Get RootBridge Segment number + + @param[in] HBIndex Index to identify of PCIE Host bridge. + @param[in] RBIndex Index to identify of underneath PCIE R= oot bridge. + + @retval UINTN Return RootBridge Segment number. +**/ +UINTN +Ac01PcieGetRootBridgeSegmentNumber ( + IN UINTN HBIndex, + IN UINTN RBIndex + ) +{ + UINTN RCIndex; + AC01_RC *RC; + UINTN SegmentNumber; + + RCIndex =3D GetRCIndex (HBIndex, RBIndex); + RC =3D &RCList[RCIndex]; + SegmentNumber =3D RCIndex; + + // Get board specific overrides + BoardPcieGetRCSegmentNumber (RC, &SegmentNumber); + RC->Logical =3D SegmentNumber; + + return SegmentNumber; +} + +STATIC +VOID +SortPciList ( + INT8 *PciList + ) +{ + INT8 Idx1, Idx2; + + for (Idx2 =3D 0, Idx1 =3D 0; Idx2 < AC01_MAX_PCIE_ROOT_COMPLEX; Idx2++) { + if (PciList[Idx2] < 0) { + continue; + } + PciList[Idx1] =3D PciList[Idx2]; + if (Idx1 !=3D Idx2) { + PciList[Idx2] =3D -1; + } + Idx1++; + } + + for (Idx2 =3D 0; Idx2 < Idx1; Idx2++) { + DEBUG_PCIE_INFO ( + " %a: PciList[%d]=3D%d TcuAddr=3D0x%llx\n", + __FUNCTION__, + Idx2, + PciList[Idx2], + RCList[PciList[Idx2]].TcuAddr + ); + } +} + +/** + Get RootBridge disable status. + + @param[in] HBIndex Index to identify of PCIE Host bridge. + @param[in] RBIndex Index to identify of underneath PCIE R= oot bridge. + + @retval BOOLEAN Return RootBridge disable status. +**/ +BOOLEAN +Ac01PcieCheckRootBridgeDisabled ( + IN UINTN HBIndex, + IN UINTN RBIndex + ) +{ + UINTN RCIndex; + INT8 Ret; + + RCIndex =3D HBIndex; + Ret =3D !RCList[RCIndex].Active; + if (Ret) { + PciList[HBIndex] =3D -1; + } else { + PciList[HBIndex] =3D HBIndex; + } + if (HBIndex =3D=3D (AC01_MAX_PCIE_ROOT_COMPLEX -1)) { + SortPciList (PciList); + if (!IsSlaveSocketPresent ()) { + AcpiPatchPciMem32 (PciList); + } + AcpiInstallMcfg (PciList); + AcpiInstallIort (PciList); + } + return Ret; +} + +/** + Initialize Host bridge + + @param[in] HBIndex Index to identify of PCIE Host bridge. + + @retval EFI_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +EFI_STATUS +Ac01PcieSetupHostBridge ( + IN UINTN HBIndex + ) +{ + return EFI_SUCCESS; +} + +/** + Initialize Root bridge + + @param[in] HBIndex Index to identify of PCIE Host bridge. + @param[in] RBIndex Index to identify of underneath PCIE R= oot bridge. + @param[in] RootBridgeInstance The pointer of instance of the Root br= idge IO. + + @retval EFI_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +EFI_STATUS +Ac01PcieSetupRootBridge ( + IN UINTN HBIndex, + IN UINTN RBIndex, + IN PCI_ROOT_BRIDGE *RootBridge + ) +{ + UINTN RCIndex; + AC01_RC *RC; + UINT32 Result; + + RCIndex =3D GetRCIndex (HBIndex, RBIndex); + RC =3D &RCList[RCIndex]; + if (!RC->Active) { + return EFI_DEVICE_ERROR; + } + + RC->RootBridge =3D (VOID *)RootBridge; + + // Initialize Root Complex and underneath controllers + Result =3D Ac01PcieCoreSetupRC (RC, 0, 0); + if (Result) { + DEBUG_PCIE_ERR ("RootComplex[%d]: Init Failed\n", RCIndex); + + goto Error; + } + + // Populate resource aperture + RootBridge->Bus.Base =3D 0x0; + RootBridge->Bus.Limit =3D 0xFF; + RootBridge->Io.Base =3D RC->IoAddr; + RootBridge->Io.Limit =3D RC->IoAddr + IO_SPACE - 1; + RootBridge->Mem.Base =3D RC->Mmio32Addr; + RootBridge->Mem.Limit =3D (RootBridge->Mem.Base) ? (RootBridge->Mem.Base= + RC->Mmio32Size - 1) : 0; + RootBridge->PMem.Base =3D RootBridge->Mem.Base; + RootBridge->PMem.Limit =3D RootBridge->Mem.Limit; + RootBridge->MemAbove4G.Base =3D MAX_UINT64; + RootBridge->MemAbove4G.Limit =3D 0x0; + RootBridge->PMemAbove4G.Base =3D RC->MmioAddr; + RootBridge->PMemAbove4G.Limit =3D (RootBridge->PMemAbove4G.Base) ? (Root= Bridge->PMemAbove4G.Base + RC->MmioSize - 1) : 0; + + DEBUG_PCIE_INFO (" + Bus: 0x%lx - 0x%lx\n", RootBridge->Bus.Base, Roo= tBridge->Bus.Limit); + DEBUG_PCIE_INFO (" + Io: 0x%lx - 0x%lx\n", RootBridge->Io.Base, Root= Bridge->Io.Limit); + DEBUG_PCIE_INFO (" + Mem: 0x%lx - 0x%lx\n", RootBridge->Mem.Base, Roo= tBridge->Mem.Limit); + DEBUG_PCIE_INFO (" + PMem: 0x%lx - 0x%lx\n", RootBridge->PMem.Base, Ro= otBridge->PMem.Limit); + DEBUG_PCIE_INFO (" + 4GMem: 0x%lx - 0x%lx\n", RootBridge->MemAbove4G.Ba= se, RootBridge->MemAbove4G.Limit); + DEBUG_PCIE_INFO (" + 4GPMem: 0x%lx - 0x%lx\n", RootBridge->PMemAbove4G.B= ase, RootBridge->PMemAbove4G.Limit); + + return EFI_SUCCESS; + +Error: + RC->Active =3D FALSE; + return EFI_DEVICE_ERROR; +} + +/** + Reads/Writes an PCI configuration register. + + @param[in] RootInstance Pointer to RootInstance structure. + @param[in] Address Address which want to read or write to. + @param[in] Write Indicate that this is a read or write = command. + @param[in] Width Specify the width of the data. + @param[in, out] Data The buffer to hold the data. + + @retval EFI_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +EFI_STATUS +Ac01PcieConfigRW ( + IN VOID *RootInstance, + IN UINT64 Address, + IN BOOLEAN Write, + IN UINTN Width, + IN OUT VOID *Data + ) +{ + AC01_RC *RC =3D NULL; + VOID *CfgBase =3D NULL; + UINTN RCIndex; + UINT32 Reg; + UINT32 Segment; + + Segment =3D RShiftU64 (Address, 32) & 0xFFFF; + + for (RCIndex =3D 0; RCIndex < AC01_MAX_PCIE_ROOT_COMPLEX; RCIndex++) { + RC =3D &RCList[RCIndex]; + if (RC->RootBridge !=3D NULL) { + if (RC->RootBridge =3D=3D RootInstance + || (RootInstance =3D=3D NULL + && ((PCI_ROOT_BRIDGE *)RC->RootBridge)->Segment =3D=3D Segment= )) { + break; + } + } + } + + if ((RCIndex =3D=3D AC01_MAX_PCIE_ROOT_COMPLEX) || (RC =3D=3D NULL)) { + DEBUG_PCIE_ERR ("Can't find Root Bridge instance:%p\n", RootInstance); + return EFI_INVALID_PARAMETER; + } + + Reg =3D Address & 0xFFF; + + CfgBase =3D (VOID *)((UINT64)RC->MmcfgAddr + (Address & 0x0FFFF000)); + if (Write) { + switch (Width) { + case 1: + Ac01PcieCfgOut8 ((VOID *)(CfgBase + (Reg & (~(Width - 1)))), *((UINT= 8 *)Data)); + break; + + case 2: + Ac01PcieCfgOut16 ((VOID *)(CfgBase + (Reg & (~(Width - 1)))), *((UIN= T16 *)Data)); + break; + + case 4: + Ac01PcieCfgOut32 ((VOID *)(CfgBase + (Reg & (~(Width - 1)))), *((UIN= T32 *)Data)); + break; + + default: + return EFI_INVALID_PARAMETER; + } + } else { + switch (Width) { + case 1: + Ac01PcieCfgIn8 ((VOID *)(CfgBase + (Reg & (~(Width - 1)))), (UINT8 *= )Data); + break; + + case 2: + Ac01PcieCfgIn16 ((VOID *)(CfgBase + (Reg & (~(Width - 1)))), (UINT16= *)Data); + if (Reg =3D=3D 0xAE && (*((UINT16 *)Data)) =3D=3D 0xFFFF) { + SerialPrint ("PANIC due to PCIE RC:%d link issue\n", RC->ID); + // Loop forever waiting for failsafe/watch dog time out + do { + } while (1); + } + break; + + case 4: + Ac01PcieCfgIn32 ((VOID *)(CfgBase + (Reg & (~(Width - 1)))), (UINT32= *)Data); + break; + + default: + return EFI_INVALID_PARAMETER; + } + } + + return EFI_SUCCESS; +} + +VOID +Ac01PcieCorePollLinkUp ( + VOID + ) +{ + INTN RCIndex, PcieIndex, i; + BOOLEAN IsNextRoundNeeded =3D FALSE, NextRoundNeeded; + UINT64 PrevTick, CurrTick, ElapsedCycle; + UINT64 TimerTicks64; + UINT8 ReInit; + INT8 FailedPciePtr[MAX_PCIE_B]; + INT8 FailedPcieCount; + + ReInit =3D 0; + +_link_polling: + NextRoundNeeded =3D 0; + // + // 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 { + // Update timer + CurrTick =3D ArmGenericTimerGetSystemCount (); + if (CurrTick < PrevTick) { + ElapsedCycle +=3D (UINT64)(~0x0ULL) - PrevTick; + PrevTick =3D 0; + } + ElapsedCycle +=3D (CurrTick - PrevTick); + PrevTick =3D CurrTick; + } while (ElapsedCycle < TimerTicks64); + + for (RCIndex =3D 0; RCIndex < AC01_MAX_PCIE_ROOT_COMPLEX; RCIndex++) { + Ac01PcieCoreUpdateLink (&RCList[RCIndex], &IsNextRoundNeeded, FailedPc= iePtr, &FailedPcieCount); + if (IsNextRoundNeeded) { + NextRoundNeeded =3D 1; + } + } + + if (NextRoundNeeded && ReInit < MAX_REINIT) { + // Timer is up. Give another chance to re-program controller + ReInit++; + for (RCIndex =3D 0; RCIndex < AC01_MAX_PCIE_ROOT_COMPLEX; RCIndex++) { + Ac01PcieCoreUpdateLink (&RCList[RCIndex], &IsNextRoundNeeded, Failed= PciePtr, &FailedPcieCount); + if (IsNextRoundNeeded) { + for (i =3D 0; i < FailedPcieCount; i++) { + PcieIndex =3D FailedPciePtr[i]; + if (PcieIndex =3D=3D -1) { + continue; + } + + // Some controller still observes link-down. Re-init controller + Ac01PcieCoreSetupRC (&RCList[RCIndex], 1, PcieIndex); + } + } + } + + goto _link_polling; + } +} + +/** + Prepare to end PCIE core BSP driver +**/ +VOID +Ac01PcieEnd ( + VOID + ) +{ + Ac01PcieCorePollLinkUp (); +} + +/** + Callback funciton for EndEnumeration notification from PCI stack. + + @param[in] HBIndex Index to identify of PCIE Host bridge. + @param[in] RBIndex Index to identify of underneath PCIE R= oot bridge. + @param[in] Phase The phase of enumeration as informed f= rom PCI stack. +**/ +VOID +Ac01PcieHostBridgeNotifyPhase ( + IN UINTN HBIndex, + IN UINTN RBIndex, + IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase + ) +{ + AC01_RC *RC; + UINTN RCIndex; + + RCIndex =3D GetRCIndex (HBIndex, RBIndex); + RC =3D &RCList[RCIndex]; + + switch (Phase) { + case EfiPciHostBridgeEndEnumeration: + Ac01PcieCoreEndEnumeration (RC); + 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; + } +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PciePatchAcp= i.c b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PciePatchAcpi.c new file mode 100644 index 000000000000..b15dea459a07 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PciePatchAcpi.c @@ -0,0 +1,646 @@ +/** @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 "PcieCore.h" + +#define ACPI_RESOURCE_NAME_ADDRESS16 0x88 +#define ACPI_RESOURCE_NAME_ADDRESS64 0x8A + +#define RCA_NUM_TBU_PMU 6 +#define RCB_NUM_TBU_PMU 10 + +// Required to be 1 to match the kernel quirk for ECAM +#define EFI_ACPI_MCFG_OEM_REVISION 1 + +STATIC UINT32 gTbuPmuIrqArray[] =3D { AC01_SMMU_TBU_PMU_IRQS }; +STATIC UINT32 gTcuPmuIrqArray[] =3D { AC01_SMMU_TCU_PMU_IRQS }; + +#pragma pack(1) +typedef struct +{ + UINT64 ullBaseAddress; + UINT16 usSegGroupNum; + UINT8 ucStartBusNum; + UINT8 ucEndBusNum; + UINT32 Reserved2; +} EFI_MCFG_CONFIG_STRUCTURE; + +typedef struct +{ + EFI_ACPI_DESCRIPTION_HEADER Header; + UINT64 Reserved1; +} EFI_MCFG_TABLE_CONFIG; + +typedef struct { + UINT64 AddressGranularity; + UINT64 AddressMin; + UINT64 AddressMax; + UINT64 AddressTranslation; + UINT64 RangeLength; +} QWordMemory; + +typedef struct ResourceEntry { + UINT8 ResourceType; + UINT16 ResourceSize; + UINT8 Attribute; + UINT8 Byte0; + UINT8 Byte1; + VOID *ResourcePtr; +} RESOURCE; + +STATIC QWordMemory Qmem[] =3D { + { AC01_PCIE_RCA2_QMEM }, + { AC01_PCIE_RCA3_QMEM }, + { AC01_PCIE_RCB0_QMEM }, + { AC01_PCIE_RCB1_QMEM }, + { AC01_PCIE_RCB2_QMEM }, + { AC01_PCIE_RCB3_QMEM } +}; + +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; + +#define FIELD_OFFSET(type, name) __builtin_offsetof (type, name) +#define __AC01_ID_MAPPING(In, Num, Out, Ref, Flags) \ + { \ + In, \ + Num, \ + Out, \ + FIELD_OFFSET (AC01_IO_REMAPPING_STRUCTURE, Ref), \ + Flags \ + } + +EFI_STATUS +EFIAPI +AcpiPatchPciMem32 ( + INT8 *PciSegEnabled + ) +{ + EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol; + EFI_STATUS Status; + UINTN Idx, Ix; + EFI_ACPI_DESCRIPTION_HEADER *Table; + UINTN TableKey; + UINTN TableIndex; + EFI_ACPI_HANDLE TableHandle, SegHandle; + CHAR8 Buffer[256]; + CHAR8 *KB, *B; + EFI_ACPI_DATA_TYPE DataType; + UINTN DataSize, Mem32; + RESOURCE *Rs; + QWordMemory *Qm; + UINT8 Segment; + + Status =3D gBS->LocateProtocol (&gEfiAcpiSdtProtocolGuid, NULL, (VOID **= )&AcpiSdtProtocol); + if (EFI_ERROR (Status)) { + DEBUG_PCIE_ERR ("Unable to locate ACPI table protocol Guid\n"); + return Status; + } + + TableIndex =3D 0; + Status =3D AcpiLocateTableBySignature ( + AcpiSdtProtocol, + EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATUR= E, + &TableIndex, + &Table, + &TableKey + ); + Status =3D AcpiSdtProtocol->OpenSdt (TableKey, &TableHandle); + if (EFI_ERROR (Status)) { + DEBUG_PCIE_ERR ("Unable to open DSDT table\n"); + return Status; + } + + for (Idx =3D 0; PciSegEnabled[Idx] !=3D -1; Idx++) { + if (PciSegEnabled[Idx] > SOCKET0_LAST_RC) { /* Physical segment */ + break; + } + if (PciSegEnabled[Idx] < SOCKET0_FIRST_RC) { + continue; + } + + /* DSDT PCI devices to use Physical segment */ + AsciiSPrint (Buffer, sizeof (Buffer), "\\_SB.PCI%x.RBUF", PciSegEnable= d[Idx]); + Status =3D AcpiSdtProtocol->FindPath (TableHandle, (VOID *)Buffer, &Se= gHandle); + if (EFI_ERROR (Status)) { + continue; + } + + for (Ix =3D 0; Ix < 3; Ix++) { + Status =3D AcpiSdtProtocol->GetOption ( + SegHandle, + Ix, + &DataType, + (VOID *)&B, + &DataSize + ); + KB =3D B; + if (EFI_ERROR (Status)) { + continue; + } + + if (Ix =3D=3D 0) { /* B[0] =3D=3D AML_NAME_OP */ + if (!((DataSize =3D=3D 1) && (DataType =3D=3D EFI_ACPI_DATA_TYPE_O= PCODE))) { + break; + } + } else if (Ix =3D=3D 1) { /* *B =3D=3D "RBUF" */ + if (!((DataSize =3D=3D 4) && (DataType =3D=3D EFI_ACPI_DATA_TYPE_N= AME_STRING))) { + break; + } + } else { /* Ix:2 11 42 07 0A 6E 88 ... */ + if (DataType !=3D EFI_ACPI_DATA_TYPE_CHILD) { + break; + } + + KB +=3D 5; /* Point to Resource type */ + Rs =3D (RESOURCE *)KB; + Mem32 =3D 0; + while ((Mem32 =3D=3D 0) && ((KB - B) < DataSize)) { + if (Rs->ResourceType =3D=3D ACPI_RESOURCE_NAME_ADDRESS16) { + KB +=3D (Rs->ResourceSize + 3); /* Type + Size */ + Rs =3D (RESOURCE *)KB; + } else if (Rs->ResourceType =3D=3D ACPI_RESOURCE_NAME_ADDRESS64)= { + + if (Rs->Attribute =3D=3D 0x00) { /* The first QWordMemory */ + Mem32 =3D 1; + Segment =3D PciSegEnabled[Idx] - 2; + Qm =3D (QWordMemory *)&(Rs->ResourcePtr); + *Qm =3D Qmem[Segment]; /* Physical segment */ + } + KB +=3D (Rs->ResourceSize + 3); /* Type + Size */ + Rs =3D (RESOURCE *)KB; + } + } + if (Mem32 !=3D 0) { + Status =3D AcpiSdtProtocol->SetOption ( + SegHandle, + Ix, + (VOID *)B, + DataSize + ); + } + } + } + + AcpiSdtProtocol->Close (SegHandle); + } + + AcpiSdtProtocol->Close (TableHandle); + AcpiUpdateChecksum ((UINT8 *)Table, Table->Length); + + return Status; +} + +VOID +ConstructMcfg ( + VOID *McfgPtr, + INT8 *PciSegEnabled, + UINT32 McfgCount + ) +{ + EFI_MCFG_TABLE_CONFIG McfgHeader =3D { + { + EFI_ACPI_6_1_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDR= ESS_DESCRIPTION_TABLE_SIGNATURE, + McfgCount, + 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 TMcfg =3D { + .ullBaseAddress =3D 0, + .usSegGroupNum =3D 0, + .ucStartBusNum =3D 0, + .ucEndBusNum =3D 255, + .Reserved2 =3D 0, + }; + UINT32 Idx; + VOID *TMcfgPtr =3D McfgPtr; + AC01_RC *Rc; + + CopyMem (TMcfgPtr, &McfgHeader, sizeof (EFI_MCFG_TABLE_CONFIG)); + TMcfgPtr +=3D sizeof (EFI_MCFG_TABLE_CONFIG); + for (Idx =3D 0; PciSegEnabled[Idx] !=3D -1; Idx++) { + Rc =3D GetRCList (PciSegEnabled[Idx]); /* Logical */ + TMcfg.ullBaseAddress =3D Rc->MmcfgAddr; + TMcfg.usSegGroupNum =3D Rc->Logical; + CopyMem (TMcfgPtr, &TMcfg, sizeof (EFI_MCFG_CONFIG_STRUCTURE)); + TMcfgPtr +=3D sizeof (EFI_MCFG_CONFIG_STRUCTURE); + } +} + +EFI_STATUS +EFIAPI +AcpiInstallMcfg ( + INT8 *PciSegEnabled + ) +{ + UINT32 RcCount, McfgCount; + EFI_ACPI_TABLE_PROTOCOL *AcpiSdtProtocol; + UINTN TableKey; + EFI_STATUS Status; + VOID *McfgPtr; + + Status =3D gBS->LocateProtocol ( + &gEfiAcpiTableProtocolGuid, + NULL, + (VOID **)&AcpiSdtProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG_PCIE_ERR ("MCFG: Unable to locate ACPI table entry\n"); + return Status; + } + for (RcCount =3D 0; PciSegEnabled[RcCount] !=3D -1; RcCount++) { + } + McfgCount =3D sizeof (EFI_MCFG_TABLE_CONFIG) + sizeof (EFI_MCFG_CONFIG_S= TRUCTURE) * RcCount; + McfgPtr =3D AllocateZeroPool (McfgCount); + if (McfgPtr =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + ConstructMcfg (McfgPtr, PciSegEnabled, McfgCount); + Status =3D AcpiSdtProtocol->InstallAcpiTable ( + AcpiSdtProtocol, + McfgPtr, + McfgCount, + &TableKey + ); + if (EFI_ERROR (Status)) { + DEBUG_PCIE_ERR ("MCFG: Unable to install MCFG table entry\n"); + } + FreePool (McfgPtr); + return Status; +} + +STATIC +VOID +ConstructIort ( + VOID *IortPtr, + UINT32 RcCount, + UINT32 SmmuPmuAgentCount, + UINT32 HeaderCount, + INT8 *PciSegEnabled + ) +{ + EFI_ACPI_6_0_IO_REMAPPING_TABLE TIort =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 (3 * RcCount) + SmmuPmuAgentCount, + .NodeOffset =3D sizeof (EFI_ACPI_6_0_IO_REMAPPING_TABLE), + 0 + }; + + AC01_ITS_NODE TItsNode =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 TRcNode =3D { + { + { + EFI_ACPI_IORT_TYPE_ROOT_COMPLEX, + sizeof (AC01_RC_NODE), + 0x1, + 0x0, + 0x1, + FIELD_OFFSET (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 TSmmuNode =3D { + { + { + EFI_ACPI_IORT_TYPE_SMMUv3, + sizeof (AC01_SMMU_NODE), + 0x2, /* Revision */ + 0x0, + 0x2, /* Mapping Count */ + FIELD_OFFSET (AC01_SMMU_NODE, InterruptMsiMapping), + }, + .Base =3D 0, + EFI_ACPI_IORT_SMMUv3_FLAG_COHAC_OVERRIDE, + 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 TPmcgNode =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. */ + }; + + UINT32 Idx, Idx1, SmmuNodeOffset[AC01_MAX_PCIE_ROOT_COMPLEX]; + VOID *TIortPtr =3D IortPtr, *SmmuPtr, *PmcgPtr; + UINT32 ItsOffset[AC01_MAX_PCIE_ROOT_COMPLEX]; + AC01_RC *Rc; + UINTN NumTbuPmu; + + TIort.Header.Length =3D HeaderCount; + CopyMem (TIortPtr, &TIort, sizeof (EFI_ACPI_6_0_IO_REMAPPING_TABLE)); + TIortPtr +=3D sizeof (EFI_ACPI_6_0_IO_REMAPPING_TABLE); + for (Idx =3D 0; Idx < RcCount; Idx++) { + ItsOffset[Idx] =3D TIortPtr - IortPtr; + TItsNode.ItsIdentifier =3D PciSegEnabled[Idx]; /* Physical */ + CopyMem (TIortPtr, &TItsNode, sizeof (AC01_ITS_NODE)); + TIortPtr +=3D sizeof (AC01_ITS_NODE); + } + + SmmuPtr =3D TIortPtr + RcCount * sizeof (AC01_RC_NODE); + PmcgPtr =3D SmmuPtr + RcCount * sizeof (AC01_SMMU_NODE); + for (Idx =3D 0; Idx < RcCount; Idx++) { + SmmuNodeOffset[Idx] =3D SmmuPtr - IortPtr; + Rc =3D GetRCList (PciSegEnabled[Idx]); /* Physical RC */ + TSmmuNode.Node.Base =3D Rc->TcuAddr; + TSmmuNode.InterruptMsiMapping.OutputBase =3D PciSegEnabled[Idx] << 16; + TSmmuNode.InterruptMsiMapping.OutputReference =3D ItsOffset[Idx]; + TSmmuNode.InterruptMsiMappingSingle.OutputBase =3D PciSegEnabled[Idx] = << 16; + TSmmuNode.InterruptMsiMappingSingle.OutputReference =3D ItsOffset[Idx]; + /* All RCs on master be assigned to node 0, while remote RCs be assign= ed to first remote node */ + TSmmuNode.Node.Flags =3D EFI_ACPI_IORT_SMMUv3_FLAG_PROXIMITY_DOMAIN; + TSmmuNode.Node.ProximityDomain =3D 0; + if ((Rc->TcuAddr & SLAVE_SOCKET_BASE_ADDRESS_OFFSET) !=3D 0) { + /* RC on remote socket */ + TSmmuNode.Node.Flags =3D EFI_ACPI_IORT_SMMUv3_FLAG_PROXIMITY_DOMAIN; + switch (CpuGetSubNumaMode ()) { + case SUBNUMA_MODE_MONOLITHIC: + TSmmuNode.Node.ProximityDomain +=3D MONOLITIC_NUM_OF_REGION; + break; + case SUBNUMA_MODE_HEMISPHERE: + TSmmuNode.Node.ProximityDomain +=3D HEMISPHERE_NUM_OF_REGION; + break; + case SUBNUMA_MODE_QUADRANT: + TSmmuNode.Node.ProximityDomain +=3D QUADRANT_NUM_OF_REGION; + break; + } + } + CopyMem (SmmuPtr, &TSmmuNode, sizeof (AC01_SMMU_NODE)); + SmmuPtr +=3D sizeof (AC01_SMMU_NODE); + + if (!SmmuPmuAgentCount) { + continue; + } + + /* Add PMCG nodes */ + if (Rc->Type =3D=3D RCA) { + NumTbuPmu =3D RCA_NUM_TBU_PMU; + } else { + NumTbuPmu =3D RCB_NUM_TBU_PMU; + } + for (Idx1 =3D 0; Idx1 < NumTbuPmu; Idx1++) { + TPmcgNode.Base =3D Rc->TcuAddr; + if (NumTbuPmu =3D=3D RCA_NUM_TBU_PMU) { + switch (Idx1) { + case 0: + TPmcgNode.Base +=3D 0x40000; + break; + + case 1: + TPmcgNode.Base +=3D 0x60000; + break; + + case 2: + TPmcgNode.Base +=3D 0xA0000; + break; + + case 3: + TPmcgNode.Base +=3D 0xE0000; + break; + + case 4: + TPmcgNode.Base +=3D 0x100000; + break; + + case 5: + TPmcgNode.Base +=3D 0x140000; + break; + } + } else { + switch (Idx1) { + case 0: + TPmcgNode.Base +=3D 0x40000; + break; + + case 1: + TPmcgNode.Base +=3D 0x60000; + break; + + case 2: + TPmcgNode.Base +=3D 0xA0000; + break; + + case 3: + TPmcgNode.Base +=3D 0xE0000; + break; + + case 4: + TPmcgNode.Base +=3D 0x120000; + break; + + case 5: + TPmcgNode.Base +=3D 0x160000; + break; + + case 6: + TPmcgNode.Base +=3D 0x180000; + break; + + case 7: + TPmcgNode.Base +=3D 0x1C0000; + break; + + case 8: + TPmcgNode.Base +=3D 0x200000; + break; + + case 9: + TPmcgNode.Base +=3D 0x240000; + break; + } + } + TPmcgNode.Page1Base =3D TPmcgNode.Base + 0x12000; + TPmcgNode.Base +=3D 0x2000; + TPmcgNode.NodeReference =3D SmmuNodeOffset[Idx]; + TPmcgNode.OverflowInterruptGsiv =3D gTbuPmuIrqArray[PciSegEnabled[Id= x]] + Idx1; + CopyMem (PmcgPtr, &TPmcgNode, sizeof (TPmcgNode)); + PmcgPtr +=3D sizeof (TPmcgNode); + } + + /* TCU PMCG */ + TPmcgNode.Base =3D Rc->TcuAddr; + TPmcgNode.Base +=3D 0x2000; + TPmcgNode.Page1Base =3D Rc->TcuAddr + 0x12000; + TPmcgNode.NodeReference =3D SmmuNodeOffset[Idx]; + TPmcgNode.OverflowInterruptGsiv =3D gTcuPmuIrqArray[PciSegEnabled[Idx]= ]; + CopyMem (PmcgPtr, &TPmcgNode, sizeof (TPmcgNode)); + PmcgPtr +=3D sizeof (TPmcgNode); + } + + for (Idx =3D 0; Idx < RcCount; Idx++) { + TRcNode.Node.PciSegmentNumber =3D GetRCList (PciSegEnabled[Idx])->Logi= cal; /* Logical */ + TRcNode.RcIdMapping.OutputReference =3D SmmuNodeOffset[Idx]; + CopyMem (TIortPtr, &TRcNode, sizeof (AC01_RC_NODE)); + TIortPtr +=3D sizeof (AC01_RC_NODE); + } +} + +EFI_STATUS +EFIAPI +AcpiInstallIort ( + INT8 *PciSegEnabled + ) +{ + EFI_STATUS Status; + EFI_ACPI_TABLE_PROTOCOL *AcpiSdtProtocol; + UINTN TableKey; + VOID *IortPtr; + BOOLEAN IsSmmuPmuEnabled; + UINT32 RcCount, SmmuPmuAgentCount, TotalCount; + + Status =3D gBS->LocateProtocol ( + &gEfiAcpiTableProtocolGuid, + NULL, + (VOID **)&AcpiSdtProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG_PCIE_ERR ("IORT: Unable to locate ACPI table entry\n"); + return Status; + } + + for (RcCount =3D 0, SmmuPmuAgentCount =3D 0; PciSegEnabled[RcCount] !=3D= -1; RcCount++) { + if ((GetRCList (PciSegEnabled[RcCount]))->Type =3D=3D RCA) { + SmmuPmuAgentCount +=3D RCA_NUM_TBU_PMU; + } else { + SmmuPmuAgentCount +=3D RCB_NUM_TBU_PMU; + } + SmmuPmuAgentCount +=3D 1; /* Only 1 TCU */ + } + + BoardPcieCheckSmmuPmuEnabled (&IsSmmuPmuEnabled); + if (!IsSmmuPmuEnabled) { + SmmuPmuAgentCount =3D 0; + } + + 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); + + IortPtr =3D AllocateZeroPool (TotalCount); + if (IortPtr =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + ConstructIort (IortPtr, RcCount, SmmuPmuAgentCount, TotalCount, PciSegEn= abled); + + Status =3D AcpiSdtProtocol->InstallAcpiTable ( + AcpiSdtProtocol, + IortPtr, + TotalCount, + &TableKey + ); + if (EFI_ERROR (Status)) { + DEBUG_PCIE_ERR ("IORT: Unable to install IORT table entry\n"); + } + FreePool (IortPtr); + 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 (#80712): https://edk2.groups.io/g/devel/message/80712 Mute This Topic: https://groups.io/mt/85631150/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 Thu Apr 25 11:35:07 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+80713+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+80713+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721606821643.7094429414897; Wed, 15 Sep 2021 09:00:06 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id P8SGYY1788612xlXBiZxaX7v; Wed, 15 Sep 2021 09:00:06 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.129]) by mx.groups.io with SMTP id smtpd.web09.9879.1631721605522505155 for ; Wed, 15 Sep 2021 09:00:05 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ge83k/TxxIcRIP1QT+z/mPzEXGAn2uRvOJ7QkJ8gLWxKFrQZuNkggcu488Al/mIafb8jVvv/Fv6ADfVTD9tCnGL0W6dqvYMHVP4S0wWRcEKhcPBi+Re9ktzmD/FiEU/bjtnLKDIAlQsDJRO9hZbS/EfBVgA6oPWnnUuNEg9iZihslpb+jRLzLCVOGOTGyQ1w6/sPIyaQK1SsZTQIXeS1nZNEnJ3PBij+9glj8K0hYCLtk2WaIHx/4VzKhXho+oBznRORpWd1qEDmdwR2c61lbm99ek34DOyL4WO8rss5dfOCc5eDkKJq5RhCjlDjEYQ6bBAjQqs5g18a/FamslvHcw== 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; bh=eW2kOxVM3atIEvcKJPaTV7CgfqGJXFbRQuAwo6WAX8I=; b=JCg0jALXgI8MdOz5icS9kIABXWq8rSixenhyb+C6ivE4Jn2S8BMydkrg0XqnIodZdhkBOuX3Grp09ze/6XCEcTsiNH7k7PaR7aczYm62TsEs+e6SVR7rYcdXgKmrnfS70hIo+Vr/rhhB8OjEjBdExPS21cUkZPqwk9xVlo8Ainpc/Ymp/2/ogGEx7P+QkDfTfsfr/bKhl4mt+B2EdPe2wIrV7LZ4Va10kFv5NGfzA4t05XzTMSwpurf3mxUr2RAxeZullTz/j7JuTwnWGkk0tjqgFKniSel9+0snOQckUIOcnMUi7Yr8GkqGL9fp85W5IHOhF5NgjvpjMpR/U5RzKw== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR0101MB3065.prod.exchangelabs.com (2603:10b6:4:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15; Wed, 15 Sep 2021 16:00:00 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 16:00: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] [PATCH v3 13/28] JadePkg: Add BoardPcieLib library instance Date: Wed, 15 Sep 2021 22:55:12 +0700 Message-ID: <20210915155527.8176-14-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 15:59:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0f96e7b9-4397-465d-5a1f-08d97861ded7 X-MS-TrafficTypeDiagnostic: DM5PR0101MB3065: X-MS-Exchange-Transport-Forked: True 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: TeMK3qAm+FJ8pnSD9AOVM/c/9xVA/q2GGpjs1wgwmdGm9i2vBck72LmRzedhPoxoZloJip9Wcc2thmUjLBCqEkgAphT3q25kEoLG6OJ+9h8axfkPgDjXEEMmmSdSzKm4gfamtrjsIT3mp8iPCciL0H6mitPoKE8yBprd9qL+fAOmVSR25v99zF6YzFnJB3KaUTCffVbjsrjoN+FI+zYMzcdmHT47UjQS7qM/JO3cd8iw8/Zga6zrW+vFMSCCqvRzQQyjUjJhqIp1OoSno6JGzIeY6NxDXK2qnP48/pYUzzh4pymlg2ZrdWBy1kTA3P5D8LjmX1kCD+gXVMLvq4q/ThmrAXCWNhZ5+SmBiywwFXFn3NSnJH0i12/Ek/WHWRQXeeB/7TQOk4cMpKgmBd6iiCzCzKRUnC1JwX7AZomZeM6xbqZpO1aZasrGEmsrcGyl+ZbjrTl6noKhj5BgvXasxSZHSxWPy89P9UyAu/F/91fO8gRVE0B3AJL//WxAc/q9gMejCgi63b6oeOIXl3nct0OyjaNHVwIF+5Mn83zcVdsv4RTHJ+aWefkGoTv3QsQsv7jjwPJ2dNHaiiqVw2GJyxMfjHhwWFuNZUC9yeoPemRstYqp+RYxqqFRv+UF6wwo0YFvokpsOyzJvOqdoa8KQHF9BTUYw7Y6WHbK7vGmvhF7wbXCo4FxTTXr9k0dJj1TA9HUQPHuM2Q6aDlj/1IiArhfENxOvbpdFrWj+nF4r27cLy97jwjMPriBd7hglubJ X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?1qK8fShSfOgk0A50QONxxvImWG2G7gD/uDyBGv77Ngivp2WcvLEl1t4RTiqO?= =?us-ascii?Q?GKheTkTkBPvadfoZUJx2rRfV9K3IfJX3WNwlAZscUItQhrUVB3rczIc/G7Hz?= =?us-ascii?Q?7Vam7cfEkKFgqXdADEQNtClla5pGoXAZVZ4+EPt5keijR/fIHUo9KK74k8Zd?= =?us-ascii?Q?SdITySZNJQI0oPrcXtMB5RvivFP92PzhDzMYljMhqrq6aSikuyUp0e6kHvP9?= =?us-ascii?Q?k6cAqd48VpcCnRKnCJcbigNLV3PmV04h9ij4DfVBOvSrdltzwSq9QGuIgFm2?= =?us-ascii?Q?t1H7UND8x4yBi+HmXLu2dJqLdgQ12xQMxqiFb1djWHCo+VrTQUGc7Qu3HdyU?= =?us-ascii?Q?NhaJqthiEDsKuvy7PJJElNpXRi5blIlTXgV5GTAnPu6+fi0NIR/tXV9m7I+e?= =?us-ascii?Q?ITLLuAqcu4KTFtlB/4nUCWvaE+bkO1O0BmbOFi+TCC5szm37qUwSMpDyqG3/?= =?us-ascii?Q?uaFgcB+Hb2L85rUisYmpifdHybL/ImiCNLXdlxaPnQg+q0JX7ViYn1ckiFfK?= =?us-ascii?Q?ufQrnMf6QwXM5XiFQhQriJyCUbo1ufAp1H8R8l9nOQP7AcW4gcMNG33bygqx?= =?us-ascii?Q?cm4hffudruEP0Hjmq2NzZe8680zPGZEFqeSWaS7EHT+A96Qp+5z90KvY7AJW?= =?us-ascii?Q?ZNxANDe9ZWluDtCCTheWEk/jhgVqAxp21brqWC8SjxqRJzvAD2kXquWTZ9Lj?= =?us-ascii?Q?nvl17v4kC25GGaMdwjTM7E/TtH3IWuKzg7ZBvtiUzKF/EwVF7nvq0l3qXD6/?= =?us-ascii?Q?XPnUDsZOm1N04ikFxIg2TZngJYfU/zHuR4sJVZ4UPM00sjIYMGONMlQfaOE3?= =?us-ascii?Q?iWmk2l+lt9GW9HFDa7dkohac0N8+4x3MvNiL9GToKRASCzRWisgUPpL+JRna?= =?us-ascii?Q?a8vqgMMBdnJDeh3k7c3O5vYjgLwSdFZHZaV6ZWOhscyxV+9WVC6XPV5Ybgas?= =?us-ascii?Q?jr8KbqDbToBqtnNyFWFch3oU8mAX0I6/RzxDM3Z87pKG2OThq02pLarD6vBS?= =?us-ascii?Q?ao2dWi1WoFXy0eRncPd33qmW4y1rWQ4IT/wlMkgwsTjkO8T+65C8SLl4wOxa?= =?us-ascii?Q?yasz7hMytPbz+CXY8e45QC5NNB/mqtB7UbhyiwaAX/fsFy8HHiPYh/vSOeF4?= =?us-ascii?Q?KuZHudeUDt9OsVvdJ3vnwi/NeP3OLBG3smISrM3M3vznm6SdjY2wL7mcAl8R?= =?us-ascii?Q?yRpgX8KKxq42jnpUwwAC+tzWZQfzmOYsBYu4hh9NM0ZmMoLrIXgixBYXAHa9?= =?us-ascii?Q?fKrf4N0YXkc0ZPERvPoEhmUNxMieig8iOfFyk+AQU0wyLW3aHU4wFyUbWblc?= =?us-ascii?Q?Bjiwk622FAm9/7LS5QkzidxC?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f96e7b9-4397-465d-5a1f-08d97861ded7 X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 16:00:00.5036 (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: yO8FJcZnYETzDnMU7mt+XPX5WPjQplf7SijBFLUiPT6MRGMIBC0wn3aqQYr7bQA8iu9KOe0q4VTZrY1KwDVAzvMc4bJSHpQq8S3QGd9m9a8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0101MB3065 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: ZEPMQp6SLUgsowLZYu9QtFqRx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721606; bh=MQq9r37qpKcastI7bUVtYXMdMGJD8lNBkDxdC736Ux4=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=nPuMVLbcwqMCyD1VUyImk+o7C7yVpKkHvu7Hf/oBNkUauGDvqWNGBhWZLDXAX/jy9Z7 nCaIVRj0TK4qdPxa5GW4ThLKSa1+omRGuweTpxIzjiJ0PZsJ6MgO1XGfKxMImDm2buDGR U663lzecim+Wb1n7PiyfwUtfnXXAIbdq8Oo= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721608887100002 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen Provides basic features like: * Screen menu to change the bifurcation setting of each Root Complex. Note that we can only make change for the Root Complex which doesn't come with a default value in the BoardSetting. * Parsing the BoardSetting and coordinate with saved setting to enable corresponding PCIe controller of each Root Complex. * Config speed and lane of enabled controller. 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: Vu Nguyen --- Platform/Ampere/JadePkg/Jade.dsc | 7 +- Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.inf | 59 + Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcie.h | 45 + Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieScreen.h | 114 ++ Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieVfr.h | 99 ++ Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieVfr.vfr | 217 ++= ++ Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcie.c | 436 ++= +++++ Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieCommon.c | 329 ++= ++++ Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieScreen.c | 1244 ++= ++++++++++++++++++ Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieScreen.uni | 102 ++ 10 files changed, 2651 insertions(+), 1 deletion(-) diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index 118c03eab42f..afea3407a256 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -52,7 +52,7 @@ [Defines] DEFINE EDK2_SKIP_PEICORE =3D TRUE DEFINE SECURE_BOOT_ENABLE =3D FALSE DEFINE INCLUDE_TFTP_COMMAND =3D TRUE - DEFINE NVRAM_UUID =3D 84BC921F-9D4A-4D1D-A1A1-1AE13EDD07E5 + DEFINE NVRAM_UUID =3D 27AF4DFF-028B-4237-80B9-828FA74132F4 =20 # # Network definition @@ -88,6 +88,11 @@ [LibraryClasses] # AcpiLib|EmbeddedPkg/Library/AcpiLib/AcpiLib.inf =20 + # + # Pcie Board + # + BoardPcieLib|Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.i= nf + ##########################################################################= ###### # # Specific Platform Pcds diff --git a/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.inf = b/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.inf new file mode 100644 index 000000000000..75e3560f4fca --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.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 BoardPcieLib + FILE_GUID =3D 062191A6-E113-4FD6-84C7-E400B4B34759 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D BoardPcieLib + +[Sources] + BoardPcie.c + BoardPcieCommon.c + BoardPcieScreen.c + BoardPcieScreen.h + BoardPcieScreen.uni + BoardPcieVfr.h + BoardPcieVfr.vfr + +[Packages] + ArmPlatformPkg/ArmPlatformPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + AmpereCpuLib + BaseLib + DevicePathLib + GpioLib + HiiLib + HobLib + MemoryAllocationLib + SystemFirmwareInterfaceLib + UefiBootServicesTableLib + UefiRuntimeServicesTableLib + +[Protocols] + gEfiDevicePathProtocolGuid + gEfiHiiStringProtocolGuid ## CONSUMES + gEfiHiiConfigRoutingProtocolGuid ## CONSUMES + gEfiHiiConfigAccessProtocolGuid ## PRODUCES + gEfiHiiDatabaseProtocolGuid ## CONSUMES + gEfiConfigKeywordHandlerProtocolGuid ## CONSUMES + +[Guids] + gEfiIfrTianoGuid ## CONSUMES + gPlatformManagerFormsetGuid ## CONSUMES + gPlatformHobGuid ## CONSUMES + +[Depex] + TRUE diff --git a/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcie.h b/Pla= tform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcie.h new file mode 100644 index 000000000000..73ba3ee83ac2 --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcie.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_H_ +#define BOARD_PCIE_H_ + +#include + +#define BITS_PER_BYTE 8 +#define BYTE_MASK 0xFF +#define PCIE_ERRATA_SPEED1 0x0001 // Limited speed errata + +enum DEV_MAP_MODE { + DEV_MAP_1_CONTROLLER =3D 0, + DEV_MAP_2_CONTROLLERS, + DEV_MAP_3_CONTROLLERS, + DEV_MAP_4_CONTROLLERS, +}; + +BOOLEAN +IsEmptyRC ( + IN AC01_RC *RC + ); + +VOID +BoardPcieSetupDevmap ( + IN AC01_RC *RC + ); + +VOID +BoardPcieGetLaneAllocation ( + IN AC01_RC *RC + ); + +VOID +BoardPcieGetSpeed ( + IN AC01_RC *RC + ); + +#endif /* BOARD_PCIE_H_ */ diff --git a/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieScreen.h= b/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieScreen.h new file mode 100644 index 000000000000..b95c99588a56 --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieScreen.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 "BoardPcieVfr.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 BoardPcieVfrBin[]; + +// +// 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 BoardPcieLibStrings[]; + +#define MAX_EDITABLE_ELEMENTS 3 +#define RC0_STATUS_OFFSET \ + OFFSET_OF (VARSTORE_DATA, RCStatus[0]) +#define RC0_BIFUR_LO_OFFSET \ + OFFSET_OF (VARSTORE_DATA, RCBifurcationLow[0]) +#define RC0_BIFUR_HI_OFFSET \ + OFFSET_OF (VARSTORE_DATA, RCBifurcationHigh[0]) +#define SMMU_PMU_OFFSET \ + OFFSET_OF (VARSTORE_DATA, SmmuPmu) + +#define STRONG_ODERING_OFFSET \ + OFFSET_OF (NVPARAM_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; + VARSTORE_DATA VarStoreConfig; + NVPARAM_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/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieVfr.h b/= Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieVfr.h new file mode 100644 index 000000000000..badb1c80f9ab --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieVfr.h @@ -0,0 +1,99 @@ +/** @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_NAME L"PcieIfrNVData" +#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 FORM_SET_GUID { 0xe84e70d6, 0xe4b2, 0x4c6e, { 0x98, 0x51, = 0xcb, 0x2b, 0xac, 0x77, 0x7d, 0xbb } } + +#define GOTO_ID_BASE 0x8040 + +#define NVPARAM_VARSTORE_NAME L"PcieIfrNVParamData" +#define NVPARAM_VARSTORE_ID 0x1233 + +#pragma pack(1) + +// +// NV data structure definition +// +typedef struct { + BOOLEAN RCStatus[AC01_MAX_PCIE_ROOT_COMPLEX]; + UINT8 RCBifurcationLow[AC01_MAX_PCIE_ROOT_COMPLEX]; + UINT8 RCBifurcationHigh[AC01_MAX_PCIE_ROOT_COMPLEX]; + UINT32 SmmuPmu; +} VARSTORE_DATA; + +// +// NVParam data structure definition +// +typedef struct { + BOOLEAN PcieStrongOrdering; +} NVPARAM_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/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieVfr.vfr = b/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieVfr.vfr new file mode 100644 index 000000000000..7fb9adb67030 --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieVfr.vfr @@ -0,0 +1,217 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "BoardPcieVfr.h" + +formset + guid =3D FORM_SET_GUID, + title =3D STRING_TOKEN(STR_PCIE_FORM), + help =3D STRING_TOKEN(STR_PCIE_FORM_HELP), + classguid =3D gPlatformManagerFormsetGuid, + + // + // Define a variable Storage + // + varstore VARSTORE_DATA, + varid =3D VARSTORE_ID, + name =3D PcieIfrNVData, + guid =3D FORM_SET_GUID; + + varstore NVPARAM_VARSTORE_DATA, + varid =3D NVPARAM_VARSTORE_ID, + name =3D PcieIfrNVParamData, + guid =3D FORM_SET_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/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcie.c b/Pla= tform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcie.c new file mode 100644 index 000000000000..bb4c1863b54b --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcie.c @@ -0,0 +1,436 @@ +/** @file + + Pcie board specific driver to handle asserting PERST signal to Endpoint + card and parsing NVPARAM board settings for bifurcation programming. + + PERST asserting is via group of GPIO pins to CPLD as Platform Specificat= ion. + + NVPARAM board settings is spec-ed within Firmware Interface Requirement. + Bifuration 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 LO (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 LO (aka RCBxB) devmap settings (RP =3D=3D Root Port) + ---------------------------------------- + | 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 +#include +#include +#include +#include +#include + +#include "BoardPcie.h" +#include "BoardPcieVfr.h" + +#ifndef BIT +#define BIT(nr) (1 << (nr)) +#endif + +#define RCA_MAX_PERST_GROUPVAL 62 +#define RCB_MAX_PERST_GROUPVAL 46 + +extern CHAR16 gPcieVarstoreName[]; +extern EFI_GUID gPcieFormSetGuid; + +VOID +EFIAPI +BoardPcieLoadPreset ( + IN AC01_RC *RC + ) +{ + UINT32 Nv; + INTN NvParam; + INTN Ret; + INTN Index; + + // Load default value + for (Index =3D 0; Index < MAX_PCIE_B; Index++) { + RC->PresetGen3[Index] =3D PRESET_INVALID; + RC->PresetGen4[Index] =3D PRESET_INVALID; + } + + // Load override value + if (RC->Socket =3D=3D 0) { + if (RC->Type =3D=3D RCA) { + if (RC->ID < MAX_RCA) { + NvParam =3D NV_SI_RO_BOARD_S0_RCA0_TXRX_G3PRESET + RC->ID * NV_PAR= AM_ENTRYSIZE; + } else { + NvParam =3D NV_SI_RO_BOARD_S0_RCA4_TXRX_G3PRESET + (RC->ID - MAX_R= CA) * NV_PARAM_ENTRYSIZE; + } + } else { + // + // There're two NVParam entries per RCB + // + NvParam =3D NV_SI_RO_BOARD_S0_RCB0A_TXRX_G3PRESET + (RC->ID - MAX_RC= A) * (NV_PARAM_ENTRYSIZE * 2); + } + } else if (RC->Type =3D=3D RCA) { + if (RC->ID < MAX_RCA) { + NvParam =3D NV_SI_RO_BOARD_S1_RCA2_TXRX_G3PRESET + (RC->ID - 2) * NV= _PARAM_ENTRYSIZE; + } else { + NvParam =3D NV_SI_RO_BOARD_S1_RCA4_TXRX_G3PRESET + (RC->ID - MAX_RCA= ) * NV_PARAM_ENTRYSIZE; + } + } else { + // + // There're two NVParam entries per RCB + // + NvParam =3D NV_SI_RO_BOARD_S1_RCB0A_TXRX_G3PRESET + (RC->ID - MAX_RCA)= * (NV_PARAM_ENTRYSIZE * 2); + } + + Ret =3D NVParamGet ((NVPARAM)NvParam, NV_PERM_ALL, &Nv); + if (Ret =3D=3D EFI_SUCCESS) { + for (Index =3D 0; Index < MAX_PCIE_A; Index++) { + RC->PresetGen3[Index] =3D (Nv >> (Index * BITS_PER_BYTE)) & BYTE_MAS= K; + } + } + + if (RC->Type =3D=3D RCB) { + NvParam +=3D NV_PARAM_ENTRYSIZE; + Ret =3D NVParamGet ((NVPARAM)NvParam, NV_PERM_ALL, &Nv); + if (Ret =3D=3D EFI_SUCCESS) { + for (Index =3D MAX_PCIE_A; Index < MAX_PCIE; Index++) { + RC->PresetGen3[Index] =3D (Nv >> ((Index - MAX_PCIE_A) * BITS_PER_= BYTE)) & BYTE_MASK; + } + } + } + + if (RC->Socket =3D=3D 0) { + if (RC->Type =3D=3D RCA) { + if (RC->ID < MAX_RCA) { + NvParam =3D NV_SI_RO_BOARD_S0_RCA0_TXRX_G4PRESET + RC->ID * NV_PAR= AM_ENTRYSIZE; + } else { + NvParam =3D NV_SI_RO_BOARD_S0_RCA4_TXRX_G4PRESET + (RC->ID - MAX_R= CA) * NV_PARAM_ENTRYSIZE; + } + } else { + // + // There're two NVParam entries per RCB + // + NvParam =3D NV_SI_RO_BOARD_S0_RCB0A_TXRX_G4PRESET + (RC->ID - MAX_RC= A) * (NV_PARAM_ENTRYSIZE * 2); + } + } else if (RC->Type =3D=3D RCA) { + if (RC->ID < MAX_RCA) { + NvParam =3D NV_SI_RO_BOARD_S1_RCA2_TXRX_G4PRESET + (RC->ID - 2) * NV= _PARAM_ENTRYSIZE; + } else { + NvParam =3D NV_SI_RO_BOARD_S1_RCA4_TXRX_G4PRESET + (RC->ID - MAX_RCA= ) * NV_PARAM_ENTRYSIZE; + } + } else { + // + // There're two NVParam entries per RCB + // + NvParam =3D NV_SI_RO_BOARD_S1_RCB0A_TXRX_G4PRESET + (RC->ID - MAX_RCA)= * (NV_PARAM_ENTRYSIZE * 2); + } + + Ret =3D NVParamGet ((NVPARAM)NvParam, NV_PERM_ALL, &Nv); + if (Ret =3D=3D EFI_SUCCESS) { + for (Index =3D 0; Index < MAX_PCIE_A; Index++) { + RC->PresetGen4[Index] =3D (Nv >> (Index * BITS_PER_BYTE)) & BYTE_MAS= K; + } + } + + if (RC->Type =3D=3D RCB) { + NvParam +=3D NV_PARAM_ENTRYSIZE; + Ret =3D NVParamGet ((NVPARAM)NvParam, NV_PERM_ALL, &Nv); + if (Ret =3D=3D EFI_SUCCESS) { + for (Index =3D MAX_PCIE_A; Index < MAX_PCIE; Index++) { + RC->PresetGen4[Index] =3D (Nv >> ((Index - MAX_PCIE_A) * BITS_PER_= BYTE)) & BYTE_MASK; + } + } + } +} + +/** + Parse platform Root Complex information. + + @param[out] RC Root Complex instance to store the pla= tform information. + + @retval EFI_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +EFI_STATUS +EFIAPI +BoardPcieParseRCParams ( + OUT AC01_RC *RC + ) +{ + UINT32 Efuse; + PLATFORM_INFO_HOB *PlatformHob; + UINT8 PlatRCId; + EFI_STATUS Status; + VOID *Hob; + UINTN BufferSize; + VARSTORE_DATA VarStoreConfig =3D { + .RCStatus =3D {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, + TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE}, + .RCBifurcationLow =3D {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + .RCBifurcationHigh =3D {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0= }, + .SmmuPmu =3D 0 + }; + + DEBUG ((DEBUG_INFO, "%a - Socket%d RC%d\n", __FUNCTION__, RC->Socket, RC= ->ID)); + + PlatRCId =3D RC->Socket * AC01_MAX_RCS_PER_SOCKET + RC->ID; + // Get RC activation status + BufferSize =3D sizeof (VARSTORE_DATA); + Status =3D gRT->GetVariable ( + gPcieVarstoreName, + &gPcieFormSetGuid, + NULL, + &BufferSize, + &VarStoreConfig + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "%a - Failed to read PCIE variable data from confi= g store.\n", __FUNCTION__)); + } + + RC->Active =3D VarStoreConfig.RCStatus[PlatRCId]; + RC->DevMapLow =3D VarStoreConfig.RCBifurcationLow[PlatRCId]; + RC->DevMapHigh =3D VarStoreConfig.RCBifurcationHigh[PlatRCId]; + + DEBUG (( + DEBUG_INFO, + "%a - Socket%d RC%d is %s\n", + __FUNCTION__, + RC->Socket, + RC->ID, + (RC->Active) ? "ACTIVE" : "INACTIVE" + )); + + if (!IsSlaveSocketActive () && RC->Socket =3D=3D 1) { + RC->Active =3D FALSE; + } + + if (RC->Active) { + // + // Consolidate with E-fuse + // + Efuse =3D 0; + Hob =3D GetFirstGuidHob (&gPlatformHobGuid); + if (Hob !=3D NULL) { + PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + Efuse =3D PlatformHob->RcDisableMask[0] | (PlatformHob->RcDisableMas= k[1] << AC01_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))) + { + RC->Flags |=3D PCIE_ERRATA_SPEED1; + DEBUG ((DEBUG_INFO, "RC[%d]: Flags 0x%x\n", RC->ID, RC->Flags)); + } + } + } + + RC->Active =3D (RC->Active && !(Efuse & BIT (PlatRCId))) ? TRUE : FALS= E; + } + + /* Load Gen3/Gen4 preset */ + BoardPcieLoadPreset (RC); + BoardPcieGetLaneAllocation (RC); + BoardPcieSetupDevmap (RC); + BoardPcieGetSpeed (RC); + + return EFI_SUCCESS; +} + +VOID +EFIAPI +BoardPcieReleaseAllPerst ( + IN UINT8 SocketId + ) +{ + UINT32 GpioIndex, GpioPin; + + // Write 1 to all GPIO[16..21] to release all PERST + GpioPin =3D GPIO_DWAPB_PINS_PER_SOCKET * SocketId + 16; + for (GpioIndex =3D 0; GpioIndex < 6; GpioIndex++) { + GpioModeConfig (GpioPin + GpioIndex, GPIO_CONFIG_OUT_HI); + } +} + +/** + Assert PERST of input PCIe controller + + @param[in] RC Root Complex 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 EFI_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +EFI_STATUS +EFIAPI +BoardPcieAssertPerst ( + IN AC01_RC *RC, + IN UINT32 PcieIndex, + IN UINT8 Bifurcation, + IN BOOLEAN IsPullToHigh + ) +{ + UINT32 GpioGroupVal, Val, GpioIndex, GpioPin; + + if (!IsPullToHigh) { // Pull PERST to Low + if (RC->Type =3D=3D RCA) { // RCA: RC->ID: 0->3 ; PcieIndex: 0->3 + GpioGroupVal =3D RCA_MAX_PERST_GROUPVAL - RC->ID * MAX_PCIE_A - Pcie= Index; + } else { // RCB: RC->ID: 4->7 ; PcieIndex: 0->7 + GpioGroupVal =3D RCB_MAX_PERST_GROUPVAL - (RC->ID - MAX_RCA) * MAX_P= CIE_B - PcieIndex; + } + + // Update the value of GPIO[16..21]. Corresponding PERST line will be = decoded by CPLD. + GpioPin =3D GPIO_DWAPB_PINS_PER_SOCKET * RC->Socket + 16; + for (GpioIndex =3D 0; GpioIndex < 6; GpioIndex++) { + Val =3D (GpioGroupVal & 0x3F) & (1 << GpioIndex); + if (Val =3D=3D 0) { + GpioModeConfig (GpioPin + GpioIndex, GPIO_CONFIG_OUT_LOW); + } else { + GpioModeConfig (GpioPin + GpioIndex, GPIO_CONFIG_OUT_HI); + } + } + + // Keep reset as low as 100 ms as specification + MicroSecondDelay (100 * 1000); + } else { // Pull PERST to High + BoardPcieReleaseAllPerst (RC->Socket); + } + + return EFI_SUCCESS; +} + +/** + Override the segment number for a root complex with a board specific num= ber. + + @param[in] RC Root Complex instance with properties. + @param[out] SegmentNumber Return segment number. + + @retval EFI_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +EFI_STATUS +EFIAPI +BoardPcieGetRCSegmentNumber ( + IN AC01_RC *RC, + OUT UINTN *SegmentNumber + ) +{ + if (RC->Socket =3D=3D 0) { + if (RC->Type =3D=3D RCA) { + switch (RC->ID) { + case RCA0: + *SegmentNumber =3D 12; + break; + + case RCA1: + *SegmentNumber =3D 13; + break; + + case RCA2: + *SegmentNumber =3D 1; + break; + + case RCA3: + *SegmentNumber =3D 0; + break; + + default: + *SegmentNumber =3D 16; + } + } else { /* Socket0, CCIX: RCA0 and RCA1 */ + *SegmentNumber =3D RC->ID - 2; + } + } else { /* Socket1, CCIX: RCA0 and RCA1 */ + if (RC->ID =3D=3D RCA0 || RC->ID =3D=3D RCA1) { + *SegmentNumber =3D 16; + } else { + *SegmentNumber =3D 4 + RC->ID; + } + } + + return EFI_SUCCESS; +} + +/** + Check if SMM PMU enabled in board screen. + + @param[out] IsSmmuPmuEnabled TRUE if the SMMU PMU enabled, otherwis= e FALSE. + + @retval EFI_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +EFI_STATUS +EFIAPI +BoardPcieCheckSmmuPmuEnabled ( + OUT BOOLEAN *IsSmmuPmuEnabled + ) +{ + VARSTORE_DATA VarStoreConfig; + UINTN BufferSize; + EFI_STATUS Status; + + *IsSmmuPmuEnabled =3D FALSE; + + // Get Buffer Storage data from EFI variable + BufferSize =3D sizeof (VARSTORE_DATA); + Status =3D gRT->GetVariable ( + gPcieVarstoreName, + &gPcieFormSetGuid, + NULL, + &BufferSize, + &VarStoreConfig + ); + if (!EFI_ERROR (Status)) { + *IsSmmuPmuEnabled =3D VarStoreConfig.SmmuPmu; + } + + return EFI_SUCCESS; +} diff --git a/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieCommon.c= b/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieCommon.c new file mode 100644 index 000000000000..05fff88ba601 --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieCommon.c @@ -0,0 +1,329 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include + +#include "BoardPcie.h" + +/* Host bridge registers */ +#define RCA_DEV_MAP_OFFSET 0x0 +#define RCB_DEV_MAP_OFFSET 0x4 + +/* RCA_DEV_MAP_OFFSET */ +#define RCA_DEV_MAP_SET(dst, src) \ + (((dst) & ~0x7) | (((UINT32)(src)) & 0x7)) + +/* RCB_DEV_MAP_OFFSET */ +#define RCB_DEV_MAP_LOW_SET(dst, src) \ + (((dst) & ~0x7) | (((UINT32)(src)) & 0x7)) +#define RCB_DEV_MAP_HIGH_SET(dst, src) \ + (((dst) & ~0x70) | (((UINT32)(src) << 4) & 0x70)) + +#define PCIE_GET_MAX_WIDTH(Pcie, Max) \ + !((Pcie).MaxWidth) ? (Max) : MIN((Pcie).MaxWidth, (Max)) + +BOOLEAN +IsEmptyRC ( + IN AC01_RC *RC + ) +{ + INTN Idx; + + for (Idx =3D PCIE_0; Idx < MAX_PCIE; Idx++) { + if (RC->Pcie[Idx].Active) { + return FALSE; + } + } + + return TRUE; +} + +VOID +BoardPcieSetRCBifurcation ( + IN AC01_RC *RC, + IN UINT8 RPStart, + IN UINT8 DevMap + ) +{ + UINT8 MaxWidth; + + if (RPStart !=3D PCIE_0 && RPStart !=3D PCIE_4) { + return; + } + + if (RC->Type !=3D RCB && RPStart =3D=3D PCIE_4) { + return; + } + + if (RC->Type =3D=3D RCA && RC->Pcie[RPStart].MaxWidth =3D=3D LNKW_X16) { + RC->Pcie[RPStart + 1].MaxWidth =3D LNKW_X4; + RC->Pcie[RPStart + 2].MaxWidth =3D LNKW_X8; + RC->Pcie[RPStart + 3].MaxWidth =3D LNKW_X4; + } + + if (RC->Type =3D=3D RCB && RC->Pcie[RPStart].MaxWidth =3D=3D LNKW_X8) { + RC->Pcie[RPStart + 1].MaxWidth =3D LNKW_X2; + RC->Pcie[RPStart + 2].MaxWidth =3D LNKW_X4; + RC->Pcie[RPStart + 3].MaxWidth =3D LNKW_X2; + } + + switch (DevMap) { + case DEV_MAP_2_CONTROLLERS: + MaxWidth =3D (RC->Type =3D=3D RCA) ? LNKW_X8 : LNKW_X4; + RC->Pcie[RPStart].MaxWidth =3D PCIE_GET_MAX_WIDTH (RC->Pcie[RPStart], = MaxWidth); + RC->Pcie[RPStart + 1].Active =3D FALSE; + RC->Pcie[RPStart + 2].MaxWidth =3D PCIE_GET_MAX_WIDTH (RC->Pcie[RPStar= t + 2], MaxWidth); + RC->Pcie[RPStart + 2].Active =3D TRUE; + RC->Pcie[RPStart + 3].Active =3D FALSE; + break; + + case DEV_MAP_3_CONTROLLERS: + MaxWidth =3D (RC->Type =3D=3D RCA) ? LNKW_X8 : LNKW_X4; + RC->Pcie[RPStart].MaxWidth =3D PCIE_GET_MAX_WIDTH (RC->Pcie[RPStart], = MaxWidth); + RC->Pcie[RPStart + 1].Active =3D FALSE; + MaxWidth =3D (RC->Type =3D=3D RCA) ? LNKW_X4 : LNKW_X2; + RC->Pcie[RPStart + 2].MaxWidth =3D PCIE_GET_MAX_WIDTH (RC->Pcie[RPStar= t + 2], MaxWidth); + RC->Pcie[RPStart + 2].Active =3D TRUE; + RC->Pcie[RPStart + 3].MaxWidth =3D PCIE_GET_MAX_WIDTH (RC->Pcie[RPStar= t + 3], MaxWidth); + RC->Pcie[RPStart + 3].Active =3D TRUE; + break; + + case DEV_MAP_4_CONTROLLERS: + MaxWidth =3D (RC->Type =3D=3D RCA) ? LNKW_X4 : LNKW_X2; + RC->Pcie[RPStart].MaxWidth =3D PCIE_GET_MAX_WIDTH (RC->Pcie[RPStart], = MaxWidth); + RC->Pcie[RPStart + 1].MaxWidth =3D PCIE_GET_MAX_WIDTH (RC->Pcie[RPStar= t + 1], MaxWidth); + RC->Pcie[RPStart + 1].Active =3D TRUE; + RC->Pcie[RPStart + 2].MaxWidth =3D PCIE_GET_MAX_WIDTH (RC->Pcie[RPStar= t + 2], MaxWidth); + RC->Pcie[RPStart + 2].Active =3D TRUE; + RC->Pcie[RPStart + 3].MaxWidth =3D PCIE_GET_MAX_WIDTH (RC->Pcie[RPStar= t + 3], MaxWidth); + RC->Pcie[RPStart + 3].Active =3D TRUE; + break; + + case DEV_MAP_1_CONTROLLER: + default: + MaxWidth =3D (RC->Type =3D=3D RCA) ? LNKW_X16 : LNKW_X8; + RC->Pcie[RPStart].MaxWidth =3D PCIE_GET_MAX_WIDTH (RC->Pcie[RPStart], = MaxWidth); + RC->Pcie[RPStart + 1].Active =3D FALSE; + RC->Pcie[RPStart + 2].Active =3D FALSE; + RC->Pcie[RPStart + 3].Active =3D FALSE; + break; + } +} + +VOID +BoardPcieGetLaneAllocation ( + IN AC01_RC *RC + ) +{ + INTN RPIndex, Ret; + UINT32 Nv, Width; + NVPARAM NvParam; + + // Retrieve lane allocation and capabilities for each controller + if (RC->Type =3D=3D RCA) { + NvParam =3D ((RC->Socket =3D=3D 0) ? NV_SI_RO_BOARD_S0_RCA0_CFG : NV_S= I_RO_BOARD_S1_RCA0_CFG) + + RC->ID * NV_PARAM_ENTRYSIZE; + } else { + // + // There're two NVParam entries per RCB + // + NvParam =3D ((RC->Socket =3D=3D 0) ? NV_SI_RO_BOARD_S0_RCB0_LO_CFG : N= V_SI_RO_BOARD_S1_RCB0_LO_CFG) + + (RC->ID - MAX_RCA) * (NV_PARAM_ENTRYSIZE * 2); + } + + Ret =3D NVParamGet (NvParam, NV_PERM_ALL, &Nv); + Nv =3D (Ret !=3D EFI_SUCCESS) ? 0 : Nv; + + for (RPIndex =3D 0; RPIndex < MAX_PCIE_A; RPIndex++) { + Width =3D (Nv >> (RPIndex * BITS_PER_BYTE)) & BYTE_MASK; + switch (Width) { + case 1: + case 2: + case 3: + case 4: + RC->Pcie[RPIndex].MaxWidth =3D 1 << Width; + RC->Pcie[RPIndex].MaxGen =3D SPEED_GEN3; + RC->Pcie[RPIndex].Active =3D TRUE; + break; + + case 0: + default: + RC->Pcie[RPIndex].MaxWidth =3D LNKW_NONE; + RC->Pcie[RPIndex].MaxGen =3D SPEED_NONE; + RC->Pcie[RPIndex].Active =3D FALSE; + break; + } + } + + if (RC->Type =3D=3D RCB) { + NvParam +=3D NV_PARAM_ENTRYSIZE; + Ret =3D NVParamGet (NvParam, NV_PERM_ALL, &Nv); + Nv =3D (Ret !=3D EFI_SUCCESS) ? 0 : Nv; + + for (RPIndex =3D MAX_PCIE_A; RPIndex < MAX_PCIE; RPIndex++) { + Width =3D (Nv >> ((RPIndex - MAX_PCIE_A) * BITS_PER_BYTE)) & BYTE_MA= SK; + switch (Width) { + case 1: + case 2: + case 3: + case 4: + RC->Pcie[RPIndex].MaxWidth =3D 1 << Width; + RC->Pcie[RPIndex].MaxGen =3D SPEED_GEN3; + RC->Pcie[RPIndex].Active =3D TRUE; + break; + + case 0: + default: + RC->Pcie[RPIndex].MaxWidth =3D LNKW_NONE; + RC->Pcie[RPIndex].MaxGen =3D SPEED_NONE; + RC->Pcie[RPIndex].Active =3D FALSE; + break; + } + } + } + + // Do not proceed if no Root Port enabled + if (IsEmptyRC (RC)) { + RC->Active =3D FALSE; + } +} + +VOID +BoardPcieSetupDevmap ( + IN AC01_RC *RC + ) +{ + UINT32 Val; + + if (RC->Pcie[PCIE_0].Active + && RC->Pcie[PCIE_1].Active + && RC->Pcie[PCIE_2].Active + && RC->Pcie[PCIE_3].Active) + { + RC->DefaultDevMapLow =3D DEV_MAP_4_CONTROLLERS; + } else if (RC->Pcie[PCIE_0].Active + && RC->Pcie[PCIE_2].Active + && RC->Pcie[PCIE_3].Active) + { + RC->DefaultDevMapLow =3D DEV_MAP_3_CONTROLLERS; + } else if (RC->Pcie[PCIE_0].Active + && RC->Pcie[PCIE_2].Active) + { + RC->DefaultDevMapLow =3D DEV_MAP_2_CONTROLLERS; + } else { + RC->DefaultDevMapLow =3D DEV_MAP_1_CONTROLLER; + } + + if (RC->Pcie[PCIE_4].Active + && RC->Pcie[PCIE_5].Active + && RC->Pcie[PCIE_6].Active + && RC->Pcie[PCIE_7].Active) + { + RC->DefaultDevMapHigh =3D DEV_MAP_4_CONTROLLERS; + } else if (RC->Pcie[PCIE_4].Active + && RC->Pcie[PCIE_6].Active + && RC->Pcie[PCIE_7].Active) + { + RC->DefaultDevMapHigh =3D DEV_MAP_3_CONTROLLERS; + } else if (RC->Pcie[PCIE_4].Active + && RC->Pcie[PCIE_6].Active) + { + RC->DefaultDevMapHigh =3D DEV_MAP_2_CONTROLLERS; + } else { + RC->DefaultDevMapHigh =3D DEV_MAP_1_CONTROLLER; + } + + if (RC->DevMapLow =3D=3D DEV_MAP_1_CONTROLLER) { + RC->DevMapLow =3D RC->DefaultDevMapLow; + } + + if (RC->Type =3D=3D RCB && RC->DevMapHigh =3D=3D DEV_MAP_1_CONTROLLER) { + RC->DevMapHigh =3D RC->DefaultDevMapHigh; + } + + BoardPcieSetRCBifurcation (RC, PCIE_0, RC->DevMapLow); + if (RC->Type =3D=3D RCB) { + BoardPcieSetRCBifurcation (RC, PCIE_4, RC->DevMapHigh); + } + + if (RC->Active) { + if (RC->Type =3D=3D RCA) { + if (!EFI_ERROR (MailboxMsgRegisterRead (RC->Socket, RC->HBAddr + RCA= _DEV_MAP_OFFSET, &Val))) { + Val =3D RCA_DEV_MAP_SET (Val, RC->DevMapLow); + MailboxMsgRegisterWrite (RC->Socket, RC->HBAddr + RCA_DEV_MAP_OFFS= ET, Val); + } + } else { + if (!EFI_ERROR (MailboxMsgRegisterRead (RC->Socket, RC->HBAddr + RCB= _DEV_MAP_OFFSET, &Val))) { + Val =3D RCB_DEV_MAP_LOW_SET (Val, RC->DevMapLow); + Val =3D RCB_DEV_MAP_HIGH_SET (Val, RC->DevMapHigh); + MailboxMsgRegisterWrite (RC->Socket, RC->HBAddr + RCB_DEV_MAP_OFFS= ET, Val); + } + } + } +} + +VOID +BoardPcieGetSpeed ( + IN AC01_RC *RC + ) +{ + UINT8 MaxGenTbl[MAX_PCIE_A] =3D { SPEED_GEN4, SPEED_GEN4, SPEED_GEN4, SP= EED_GEN4 }; // Bifurcation 0: RCA x16 / RCB x8 + UINT8 MaxGenTblX8X4X4[MAX_PCIE_A] =3D { SPEED_GEN4, SPEED_GEN4, SPEED_GE= N1, SPEED_GEN1 }; // Bifurcation 2: x8 x4 x4 (PCIE_ERRATA_SPEED1) + UINT8 MaxGenTblX4X4X4X4[MAX_PCIE_A] =3D { SPEED_GEN1, SPEED_GEN1, SPEED_= GEN1, SPEED_GEN1 }; // Bifurcation 3: x4 x4 x4 x4 (PCIE_ERRATA_SPEED1) + UINT8 MaxGenTblRCB[MAX_PCIE_A] =3D { SPEED_GEN1, SPEED_GEN1, SPEED_GEN1,= SPEED_GEN1 }; // RCB PCIE_ERRATA_SPEED1 + INTN RPIdx; + UINT8 *MaxGen; + + ASSERT (MAX_PCIE_A =3D=3D 4); + ASSERT (MAX_PCIE =3D=3D 8); + + // + // Due to hardware errata, for A0/A1* + // RCB is limited to Gen1 speed. + // RCA x16, x8 port supports up to Gen4, + // RCA x4 port only supports Gen1. + // + MaxGen =3D MaxGenTbl; + if (RC->Type =3D=3D RCB) { + if (RC->Flags & PCIE_ERRATA_SPEED1) { + MaxGen =3D MaxGenTblRCB; + } + } else { + switch (RC->DevMapLow) { + case DEV_MAP_3_CONTROLLERS: /* x8 x4 x4 */ + if (RC->Flags & PCIE_ERRATA_SPEED1) { + MaxGen =3D MaxGenTblX8X4X4; + } + break; + + case DEV_MAP_4_CONTROLLERS: /* X4 x4 x4 x4 */ + if (RC->Flags & PCIE_ERRATA_SPEED1) { + MaxGen =3D MaxGenTblX4X4X4X4; + } + break; + + case DEV_MAP_2_CONTROLLERS: /* x8 x8 */ + default: + break; + } + } + + for (RPIdx =3D 0; RPIdx < MAX_PCIE_A; RPIdx++) { + RC->Pcie[RPIdx].MaxGen =3D RC->Pcie[RPIdx].Active ? MaxGen[RPIdx] : SP= EED_NONE; + } + + if (RC->Type =3D=3D RCB) { + for (RPIdx =3D MAX_PCIE_A; RPIdx < MAX_PCIE; RPIdx++) { + RC->Pcie[RPIdx].MaxGen =3D RC->Pcie[RPIdx].Active ? + MaxGen[RPIdx - MAX_PCIE_A] : SPEED_NONE; + } + } +} diff --git a/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieScreen.c= b/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieScreen.c new file mode 100644 index 000000000000..eed53c6abed7 --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieScreen.c @@ -0,0 +1,1244 @@ +/** @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 "BoardPcie.h" +#include "BoardPcieScreen.h" + +#ifndef BIT +#define BIT(nr) (1 << (nr)) +#endif + +BOOLEAN mReadOnlyStrongOrdering; +CHAR16 mPcieNvparamVarstoreName[] =3D NVPARAM_VARSTORE_NAME; +CHAR16 gPcieVarstoreName[] =3D VARSTORE_NAME; +EFI_GUID gPcieFormSetGuid =3D FORM_SET_GUID; + +SCREEN_PRIVATE_DATA *mPrivateData =3D NULL; + +AC01_RC RCList[AC01_MAX_PCIE_ROOT_COMPLEX]; + +HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath =3D { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8)(sizeof (VENDOR_DEVICE_PATH)), + (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + FORM_SET_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; + 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_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 (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_VARSTORE_DATA); + } else if (HiiIsConfigHdrMatch (Configuration, &gPcieFormSetGuid, gPcieV= arstoreName)) { + BufferSize =3D sizeof (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 ? STRO= NG_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 (VARSTORE_DATA), + (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 0x9000) { + // + // SMMU PMU + // + Value->u32 =3D 0; + break; + } + + if (QuestionId =3D=3D 0x9001) { + // + // 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 LO. + @param RC Root Complex ID. + @param PrivateData Private data. + + @retval Default dev settings. +**/ +UINT8 +PcieRCDevMapLowDefaultSetting ( + IN UINTN RCIndex, + IN SCREEN_PRIVATE_DATA *PrivateData + ) +{ + AC01_RC *RC =3D &RCList[RCIndex]; + + return RC->DefaultDevMapLow; +} + +/** + This function return default settings for Dev Map HI. + @param RC Root Complex ID. + @param PrivateData Private data. + + @retval Default dev settings. +**/ +UINT8 +PcieRCDevMapHighDefaultSetting ( + IN UINTN RCIndex, + IN SCREEN_PRIVATE_DATA *PrivateData + ) +{ + AC01_RC *RC =3D &RCList[RCIndex]; + + return RC->DefaultDevMapHigh; +} + +BOOLEAN +PcieRCActiveDefaultSetting ( + IN UINTN RCIndex, + IN SCREEN_PRIVATE_DATA *PrivateData + ) +{ + PLATFORM_INFO_HOB *PlatformHob; + VOID *Hob; + UINT32 Efuse; + + Hob =3D GetFirstGuidHob (&gPlatformHobGuid); + if (Hob !=3D NULL) { + PlatformHob =3D (PLATFORM_INFO_HOB *)GET_GUID_HOB_DATA (Hob); + Efuse =3D PlatformHob->RcDisableMask[0] | (PlatformHob->RcDisableMask[= 1] << AC01_MAX_RCS_PER_SOCKET); + return (!(Efuse & BIT (RCIndex))) ? TRUE : FALSE; + } + + return FALSE; +} + +/** + This function sets up the first elements of the form. + @param RC Root Complex 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 + ) +{ + VOID *StartOpCodeHandle; + EFI_IFR_GUID_LABEL *StartLabel; + VOID *EndOpCodeHandle; + EFI_IFR_GUID_LABEL *EndLabel; + VOID *OptionsOpCodeHandle; + VOID *OptionsHiOpCodeHandle; + CHAR16 Str[MAX_STRING_SIZE]; + UINT16 DisabledStatusVarOffset; + UINT16 BifurLoVarOffset; + UINT16 BifurHiVarOffset; + UINT8 QuestionFlags, QuestionFlagsSubItem; + AC01_RC *RC; + + RC =3D &RCList[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 tell socket + HiiCreateTextOpCode ( + StartOpCodeHandle, + STRING_TOKEN (STR_PCIE_SOCKET), + STRING_TOKEN (STR_PCIE_SOCKET_HELP), + HiiSetString ( + PrivateData->HiiHandle, + 0, + (RC->Socket) ? L"1" : L"0", + NULL + ) + ); + + // Create textbox to tell Root Complex type + HiiCreateTextOpCode ( + StartOpCodeHandle, + STRING_TOKEN (STR_PCIE_RC_TYPE), + STRING_TOKEN (STR_PCIE_RC_TYPE_HELP), + HiiSetString ( + PrivateData->HiiHandle, + 0, + (RC->Type =3D=3D RCA) ? 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) * RCIndex; + BifurHiVarOffset =3D (UINT16)RC0_BIFUR_HI_OFFSET + + sizeof (UINT8) * RCIndex; + + QuestionFlags =3D EFI_IFR_FLAG_RESET_REQUIRED | EFI_IFR_FLAG_CALLBACK; + if (IsEmptyRC (RC) + || (GetNumberOfActiveSockets () =3D=3D 1 && RC->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 RC disabled 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 (RC->Type =3D=3D RCA) { + // Create Option OpCode to display bifurcation for RCA + OptionsOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (OptionsOpCodeHandle !=3D NULL); + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_VALUE0), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 0 // Devmap=3D0 + ); + + + if (RC->DefaultDevMapLow !=3D 0) { + QuestionFlags |=3D EFI_IFR_FLAG_READ_ONLY; + } + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_VALUE1), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 1 // Devmap=3D1 + ); + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_VALUE2), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 2 // Devmap=3D2 + ); + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_VALUE3), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 3 // Devmap=3D3 + ); + + 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 RCB-Lo + OptionsOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (OptionsOpCodeHandle !=3D NULL); + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_VALUE4), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 0 // Devmap=3D0 + ); + + QuestionFlagsSubItem =3D QuestionFlags; + if (RC->DefaultDevMapLow !=3D 0) { + QuestionFlagsSubItem |=3D EFI_IFR_FLAG_READ_ONLY; + } + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_VALUE5), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 1 // Devmap=3D1 + ); + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_VALUE6), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 2 // Devmap=3D2 + ); + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle, + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_VALUE7), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 3 // Devmap=3D3 + ); + + 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 RCB-Hi + OptionsHiOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (OptionsHiOpCodeHandle !=3D NULL); + + QuestionFlagsSubItem =3D QuestionFlags; + if (RC->DefaultDevMapHigh !=3D 0) { + QuestionFlagsSubItem |=3D EFI_IFR_FLAG_READ_ONLY; + } + + HiiCreateOneOfOptionOpCode ( + OptionsHiOpCodeHandle, + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_VALUE4), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 0 // Devmap=3D0 + ); + + HiiCreateOneOfOptionOpCode ( + OptionsHiOpCodeHandle, + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_VALUE5), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 1 // Devmap=3D1 + ); + + HiiCreateOneOfOptionOpCode ( + OptionsHiOpCodeHandle, + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_VALUE6), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 2 // Devmap=3D2 + ); + + HiiCreateOneOfOptionOpCode ( + OptionsHiOpCodeHandle, + STRING_TOKEN (STR_PCIE_BIFUR_SELECT_VALUE7), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 3 // Devmap=3D3 + ); + + 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 + OptionsHiOpCodeHandle, // 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 RC; + 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 + 0x9000, // 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 + 0x9001, // Question ID + NVPARAM_VARSTORE_ID, // VarStore ID + (UINT16)STRONG_ODERING_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 RC + for (RC =3D 0; RC < AC01_MAX_PCIE_ROOT_COMPLEX; RC++) { + + GotoItem =3D AllocateZeroPool (sizeof (SETUP_GOTO_DATA)); + if (GotoItem =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + GotoItem->PciDevIdx =3D RC; + + GotoId =3D GOTO_ID_BASE + (UINT16)RC; + + // Update HII string + UnicodeSPrint (Str, sizeof (Str), L"Root Complex #%2d", RC); + 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 + RC, + 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. + + @param[in] RCList List of Root Complex with properties. + + @retval EFI_SUCCESS The operation is successful. + @retval Others An error occurred. +**/ +EFI_STATUS +EFIAPI +BoardPcieScreenInitialize ( + IN AC01_RC *NewRCList + ) +{ + EFI_STATUS Status; + EFI_HANDLE DriverHandle; + EFI_HII_HANDLE HiiHandle; + EFI_HII_DATABASE_PROTOCOL *HiiDatabase; + EFI_HII_STRING_PROTOCOL *HiiString; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL *HiiKeywordHandler; + UINTN BufferSize; + BOOLEAN IsUpdated; + VARSTORE_DATA *VarStoreConfig; + UINT8 RCIndex; + AC01_RC *RC; + + // + // 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, + BoardPcieLibStrings, + BoardPcieVfrBin, + NULL + ); + if (HiiHandle =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + mPrivateData->HiiHandle =3D HiiHandle; + + // Make a shadow copy all Root Complexes' properties + CopyMem ((VOID *)RCList, (VOID *)NewRCList, sizeof (RCList)); + + // + // Initialize NVParam varstore configuration data + // + NVParamVarstoreInit (); + + // + // Initialize efi varstore configuration data + // + VarStoreConfig =3D &mPrivateData->VarStoreConfig; + ZeroMem (VarStoreConfig, sizeof (VARSTORE_DATA)); + + // Get Buffer Storage data from EFI variable + BufferSize =3D sizeof (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_MAX_PCIE_ROOT_COMPLEX; RCIndex++) { + RC =3D &RCList[RCIndex]; + + if (EFI_ERROR (Status)) { + VarStoreConfig->RCBifurcationLow[RCIndex] =3D RC->DevMapLow; + VarStoreConfig->RCBifurcationHigh[RCIndex] =3D RC->DevMapHigh; + VarStoreConfig->RCStatus[RCIndex] =3D RC->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 (VARSTORE_DATA), + VarStoreConfig + ); + if (EFI_ERROR (Status)) { + return Status; + } + } + Status =3D PcieMainScreenSetup (mPrivateData); + ASSERT_EFI_ERROR (Status); + + for (RCIndex =3D 0; RCIndex < AC01_MAX_PCIE_ROOT_COMPLEX; RCIndex++) { + Status =3D PcieRCScreenSetup (RCIndex, mPrivateData); + ASSERT_EFI_ERROR (Status); + } + + return Status; +} diff --git a/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieScreen.u= ni b/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieScreen.uni new file mode 100644 index 000000000000..5739a35b4ee5 --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieScreen.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 (#80713): https://edk2.groups.io/g/devel/message/80713 Mute This Topic: https://groups.io/mt/85631176/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 Thu Apr 25 11:35:07 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+80714+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+80714+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 16317216081701005.3213228967995; Wed, 15 Sep 2021 09:00:08 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id e3eGYY1788612xXJ4IYlRvIj; Wed, 15 Sep 2021 09:00:07 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.124]) by mx.groups.io with SMTP id smtpd.web10.9924.1631721607033104649 for ; Wed, 15 Sep 2021 09:00:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kFPChMh9/VVAutEBg5L6oP9JEJZKjlssiIm7OLw1EP+sf9WAqNPCdIW985eqzcW5VBbZ3e7OUTXURN6KVYFZvSCUN1qHllg4c4YSm9V40FaO7aCEZCvoNFrvBxMARxMU86mVe5VjZ/G9SxOHy5EfkcPEp/UCdygnBo/IgdGRADAHrjkX5mXzkF27i2ONuCcM9spSxRR5QRKWscrHlqwL6KkVNWxouDS84ag88XzW+BxDtfcWfv9/SfCbbMItRSOjZiqp+ggVh/pqrmgiwz6JXc8CWc9bJybKPGFz3M+DRHRnHQgZuJXmtI3BqPmW7dui1NFy0Kre9VIGMQcLE1Rh7A== 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; bh=TciqjOgEvIzFCV/C2wDBwP+5HYvmp9ZWN2+DrDO2F90=; b=Brb5phWc1A/tcaTP44bRCcNmN88Fb5TgTPaoGQW1sDcj9VIUDaCXeGXfNjtnsE//rNR+u7SKT7NVy6IJ4NNBBlhStT2t7Zu8J0UghXFY4SHwMXMrzxpv3/O4EGfcIK1TgL6LDsDdx9DuFpzY9AfSioxmMrnklMXxjF5O3GwSxG3zEfPZ+0BNMK9+kic8GYbE4PTZwAIU/byvWdag9D9IO1AQes58oqRr9ZDZAKqDl/s8wmKuxDbgwhJaPSN6nBShxG/pqNHz2G2bdsB8edy6LA7WkCY4S0OUUegQDeLMTFUNnn7M36Cwni9XIQcJKfNTlpUp17KlRPiYIC1K4S3Ysw== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR0101MB3065.prod.exchangelabs.com (2603:10b6:4:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15; Wed, 15 Sep 2021 16:00:04 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 16:00: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] [PATCH v3 14/28] Ampere: PCIe: Add PciHostBridgeLib library instance Date: Wed, 15 Sep 2021 22:55:13 +0700 Message-ID: <20210915155527.8176-15-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 16:00:00 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a5b9ebb6-b2bd-485b-83da-08d97861e152 X-MS-TrafficTypeDiagnostic: DM5PR0101MB3065: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:605; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: WgYqrbOdaUk6BVJonLIPntirJANzpD4jyreVQ+g7AQkcLfQF8koXF0zQD0aR8S5YcnCG8ujAeOBaa1kVJmcrnWgDgK4wzb0kLmRXhHJg93B6GKU5B2Y4PNwx+rSwdaVumRGS4BsURlNf5jLhQy6AqcF/bSv1eWonK8Wza4H5XRmK1OdcO9akNF/FSgMdvqWoTXP3o/tDxX/HEeostAUAgG410umzhA5WhB1P1hSGqq5Qxzy7EqXHskgTt0Gg7he75H5i7XxPDxUu20M/RC76d7ygzUppYU83Uk9T9JQwimJZgOARE++K1yNZ2NUa+BC9Zv+9dFt7Z5C29WpEj+3WyUzVVRBShO6ihGMkbgGNOHbPBAQSN06bhyV2ZJkudBVAOD2pS6yNvOQBSH0+cnfK8dF8L8AOAxGO3NrrA1mZ9fGa1zXU1XrsdUpBZuZ3Ej4ODUpkB4VUbEV7FAOcJhPBvNFhYtuNKav3EeaYKedQzx+jcmNsTA93Ts95Eu7EsDnhp+SPfMccYsXXVxYwjPfUSyp+5GTlOcWHtKfCcklGFIwFeV5mcWt9tAdTldmwYWFvhGl60ZdQ5Nj76PgRIXr68rQuO5cLA1EHl92RHkt92yGs6VN4WsQUWIaKUlXQjXeQDfgpO3pLG1HU7nvVxPMk1J6qGbY9ZAixXuBgfAVrQ4ES+k2kKdedoD5ehDrTrAF5J2quptSwWBxscHcEOBD9eg== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?YKLx9tzqpXkZcfj13wEsuDXmSTzIJnyIwLCIbpB29NbiIOPM8E/GmaWuRq24?= =?us-ascii?Q?Ta7xXWF5auec1h7gb+QdMtsB1bzib7m6fdOtdxvBcCcMiTBtuInUxw55yEkh?= =?us-ascii?Q?yNAoTbXBegPSJf8E5Fda3sUMtdlldL37csor68epNK9oSsaudx/nzDwXXOcl?= =?us-ascii?Q?tU+gksiS5lOr8cI1JCHcu/NLkIChVEUfK7J8C1GppmzoAlJDw5+rEre7H3u0?= =?us-ascii?Q?Gewsueszjm4Wc29a9ZF6HIzlmMJFAuMQfz4GOhignV+4zTnjlE0HjAfLzYfc?= =?us-ascii?Q?QZU9erAxre7W/daIBxEr8ydEMuVue1QXfSzYp4pOkCz33agyfynH9dIb3Yl9?= =?us-ascii?Q?M3IzF75hfwVPCE87eGFqXBanS0Chh2qd7pylnNFYsSyxN3f34AMbWVzwCpgS?= =?us-ascii?Q?ASclfCObZw5jHYpMFoEcy3zcRM/0N2yWv+wAB9VA3sOUtcVzODwVXx5pjAye?= =?us-ascii?Q?nikkxOsj5h4U9JlRNfwAJoxyFUDLZpgKso4w/mw3AUuv3tA7TdUaLbUJIIr1?= =?us-ascii?Q?MWuFHqdXQE81MBW9gxryDLVnaqve44G2sDCFDiPGh1uWFEaqgwMzYjt2skXH?= =?us-ascii?Q?zlSbIFgoWz8v6JbiaKIWGPZ6g8XEmP3dJMJo/XhHUIZPkuHtrwVMzXZaasHC?= =?us-ascii?Q?quIHkxyL5MiLjkKNzyZu+dmMdnHVXfqyES072KHyicFKBDJsAFr4moOtybPn?= =?us-ascii?Q?b6Ay8YN9N5vfJA7Da346NhifKKyD2HHxx5wbJRubYaD5qMZrSuOg1upG1rl6?= =?us-ascii?Q?Vj38o1naMiYIQ+PD+TQ3OswNoVacAeA/cTlrvujwFrHlBK8RW8X079uQnPWE?= =?us-ascii?Q?gFpSlhvQ4DFrPbgFj+qlqdYcs5QN0byX+3VXgTh3fUor+RFEMmhJBGYndLPF?= =?us-ascii?Q?KI7+fi2VurlFcI9HyExLECHUMXddKFqTq6qKSU5tvvaUTlUZUwvXwGskWdJk?= =?us-ascii?Q?Dt7+T17jBAH0W2/adO0OynAR8wtgskrEIv8NwsGqqFKRRgTxu/ZFuldfpLxv?= =?us-ascii?Q?z2mIxhtfCuGK++mHTyKX82zN/Esw87OJnW8dpXHq6Dzop+13qzclVq6ptp1u?= =?us-ascii?Q?XJI4l5mTEl+T9cm20N+KheQ6/j+LqlN+tuqt8gou6xnaTAXwgqUQt+pWNyzm?= =?us-ascii?Q?p90OLIDZX2Ob81TwDxIvK9JGG/Kp3ZhRfyW4PKhJLuFgEYn2wReAcI7g7D3m?= =?us-ascii?Q?MJ4YQ8No7gBNg3Za2w8F+AtHGEFeCjYT0TzPAMsAt6mMYnLJGU/ZOGpx2smo?= =?us-ascii?Q?iiWdQrceuh/Ki3BeaZn59++EJCqJtTZJ0GH/9ydGpIYrr40Ss+zsMhgMJcSO?= =?us-ascii?Q?XLX5hjq0tRV9NgB9pUwODavu?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: a5b9ebb6-b2bd-485b-83da-08d97861e152 X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 16:00:04.1475 (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: 2ms6z+Y7iI1v4WtUNJPR9ENVErRmSe74/LsgMX2zPuIrd6gBzWrTVf17p93SuCHuzsedMani7xYd5C3B949FXqsbhyHnDkDXCZFqtDfcsX8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0101MB3065 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: UBkCGWe4YVEbrXi5HVXHB34ix1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721607; bh=YQtXzXoP0B7MlBEXCgP3sCDw/Zp/TVxlTm1rY9ha+kc=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=UYP2BkR73/HBWZYNY7vro8Bo1Wi9nLi0Veie4WPO89aDAyqMiyXNPvHaXfgSQEu8pSW VodtQQZe69lVgkhyZiqrN34z1Pah6V/JXCsadZkaqrIRrH5A7F7moxCsFSLDILUYJw32N HwdaSKg38nzjQc0yDWEL/s9mQ1bXc52i9N4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721609310100005 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: Vu Nguyen --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc = | 1 + Silicon/Ampere/AmpereAltraPkg/Library/PciHostBridgeLib/PciHostBridgeLib.in= f | 48 +++ Silicon/Ampere/AmpereAltraPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c = | 378 ++++++++++++++++++++ 3 files changed, 427 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index d4e1b84c0276..dc66b711aba8 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -228,6 +228,7 @@ [LibraryClasses.common.DXE_DRIVER] PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.= inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf FlashLib|Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.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..a8ee0c2b9278 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/PciHostBridgeLib/PciHostBridgeL= ib.inf @@ -0,0 +1,48 @@ +## @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 + CONSTRUCTOR =3D HostBridgeConstructor + +[Sources] + PciHostBridgeLib.c + +[Packages] + ArmPkg/ArmPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + Ac01PcieLib + AcpiLib + BaseLib + BaseMemoryLib + DebugLib + DevicePathLib + IoLib + MemoryAllocationLib + PrintLib + UefiBootServicesTableLib + +[Guids] + gEfiEventReadyToBootGuid + +[Protocols] + gEfiCpuIo2ProtocolGuid ## CONSUMES + +[Depex] + gEfiCpuIo2ProtocolGuid 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..281f20b4bb63 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/PciHostBridgeLib/PciHostBridgeL= ib.c @@ -0,0 +1,378 @@ +/** @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 +#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, + 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 +}; + +UINT8 mRootBridgeCount =3D 0; +PCI_ROOT_BRIDGE *mRootBridges =3D NULL; + +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; +} + +/** + This function will be called when ReadyToBoot event is signaled. + + @param Event signaled event + @param Context calling context + + @retval VOID +**/ +VOID +EFIAPI +PciHostBridgeReadyToBootEvent ( + EFI_EVENT Event, + VOID *Context + ) +{ + EFI_STATUS Status; + EFI_ACPI_SDT_PROTOCOL *AcpiSdtProtocol; + EFI_ACPI_DESCRIPTION_HEADER *Table; + UINTN TableKey; + UINTN TableIndex; + EFI_ACPI_HANDLE TableHandle; + CHAR8 NodePath[256]; + UINTN Count; + UINTN Idx1; + UINTN Idx2; + + Count =3D 0; + + Status =3D gBS->LocateProtocol ( + &gEfiAcpiSdtProtocolGuid, + NULL, + (VOID **)&AcpiSdtProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Unable to locate ACPI table protocol\n")); + return; + } + + 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, "%a %d Status =3D %r \n", __FUNCTION__, __LINE__,= Status)); + ASSERT_EFI_ERROR (Status); + return; + } + + Status =3D AcpiSdtProtocol->OpenSdt (TableKey, &TableHandle); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + AcpiSdtProtocol->Close (TableHandle); + return; + } + + for (Idx1 =3D 0; Idx1 < Ac01PcieGetTotalHBs (); Idx1++) { + for (Idx2 =3D 0; Idx2 < Ac01PcieGetTotalRBsPerHB (Idx1); Idx2++) { + AsciiSPrint (NodePath, sizeof (NodePath), "\\_SB.PCI%X._STA", Count); + if (Ac01PcieCheckRootBridgeDisabled (Idx1, Idx2)) { + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePath, = 0x0); + } else { + UpdateStatusMethodObject (AcpiSdtProtocol, TableHandle, NodePath, = 0xf); + } + Count++; + } + } + + AcpiSdtProtocol->Close (TableHandle); + AcpiUpdateChecksum ((UINT8 *)Table, Table->Length); + + // + // Close the event, so it will not be signalled again. + // + gBS->CloseEvent (Event); +} + +EFI_STATUS +HostBridgeConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + UINT8 Index; + EFI_PCI_ROOT_BRIDGE_DEVICE_PATH *DevicePath; + EFI_EVENT EvtReadyToBoot; + + mRootBridges =3D AllocatePool (Ac01PcieGetTotalHBs () * sizeof (PCI_ROOT= _BRIDGE)); + if (mRootBridges =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + Status =3D Ac01PcieSetup (); + if (EFI_ERROR (Status)) { + return Status; + } + + for (Index =3D 0; Index < Ac01PcieGetTotalHBs (); Index++) { + CopyMem (&mRootBridges[mRootBridgeCount], &mRootBridgeTemplate, sizeof= (PCI_ROOT_BRIDGE)); + + Status =3D Ac01PcieSetupRootBridge (Index, 0, (VOID *)&mRootBridges[mR= ootBridgeCount]); + if (EFI_ERROR (Status)) { + continue; + } + mRootBridges[mRootBridgeCount].Segment =3D Ac01PcieGetRootBridgeSegmen= tNumber (Index, 0); + + DevicePath =3D AllocateCopyPool ( + sizeof (EFI_PCI_ROOT_BRIDGE_DEVICE_PATH), + (VOID *)&mEfiPciRootBridgeDevicePath + ); + if (DevicePath =3D=3D NULL) { + continue; + } + + // + // Embedded RC Index to the DevicePath + // This will be used later by the platform NotifyPhase() + // + DevicePath->AcpiDevicePath.UID =3D Index; + + mRootBridges[mRootBridgeCount].DevicePath =3D (EFI_DEVICE_PATH_PROTOCO= L *)DevicePath; + mRootBridgeCount++; + } + + Ac01PcieEnd (); + + // + // Register event to fixup ACPI table + // + Status =3D gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, // Type, + TPL_NOTIFY, // NotifyTpl + PciHostBridgeReadyToBootEvent, // NotifyFunction + NULL, // NotifyContext + &gEfiEventReadyToBootGuid, // EventGroup + &EvtReadyToBoot // Event + ); + ASSERT_EFI_ERROR (Status); + + return EFI_SUCCESS; +} + +/** + 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 + ) +{ + *Count =3D mRootBridgeCount; + return mRootBridges; +} + +/** + 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 (#80714): https://edk2.groups.io/g/devel/message/80714 Mute This Topic: https://groups.io/mt/85631180/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 Thu Apr 25 11:35:07 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+80718+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+80718+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721619086312.72544465196313; Wed, 15 Sep 2021 09:00:19 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id PcIgYY1788612xpxubLnkeVc; Wed, 15 Sep 2021 09:00:18 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.103]) by mx.groups.io with SMTP id smtpd.web09.9885.1631721618065960246 for ; Wed, 15 Sep 2021 09:00:18 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RbQHR0PPw27wOFHyevr8dV3jOYEiCTXyitVNxzbEBgmo5T2p0tQ6o2V5WxPgtlpe/GgEtCA5KQebE3eXdBQOIAJiYPrdx/4J/4np970kF3ncbaOYRy4r6IaGD+49QljrbxPihnelHQye9lrQgMLOU7Uv7qp1z9HKBdNkIC7Y7J/MKy2fIaMg3qpmhFnQYj0SoBb1C/9yeUoSc6/f2DyrlTDbbQPHvMOuhgEIFRgR1nrhph0mCb8f5pMB/5HWCB6M+u2ggreM1JRNatpnj4ELM8r3S3Fxj81CX42X7vxvUhBadxLucfh3/Zen4OEY1NAKv1iExstIRGdyg/32c53W3Q== 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; bh=K1hwPhHx7Xbmim6fvEeu79FICzH2MwDINnAzX0Zto5Q=; b=hfNxMPqroHBy+u1/YLZbvStDocEYNTrpyBX3bjJj//T2WD1haKahI5m5iLaGl9ATvWdTCQZQd2F9Leuu/oPa1FsCp8jq+fIMx4BFhPYQpiap8F2l6f3l8CW4crz8NhftfC93CILveAkTedcfjB2KtMEF3JGw6uR3JTRqRYOIfJTdytEiQa07iAc4QJYHZwS51oWP/S1weWLfXRWUzgC6F727DVHjBgNJzmuAW02HkQexLFht0qpxAagOkxmQIPQ1w1iaML61X0qQu0IGbT3zeFBmL99gSM/3pubCVJCZ6aXVi14VEsRXFOSZVigeW9Jx9hJ7sQR1RbEbPJ+HV9/HRA== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR0101MB3065.prod.exchangelabs.com (2603:10b6:4:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15; Wed, 15 Sep 2021 16:00:08 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 16:00:08 +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] [PATCH v3 15/28] Ampere: PCIe: Add PciSegmentLib library instance Date: Wed, 15 Sep 2021 22:55:14 +0700 Message-ID: <20210915155527.8176-16-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 16:00:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 19c01780-46fe-4b0b-9680-08d97861e3a3 X-MS-TrafficTypeDiagnostic: DM5PR0101MB3065: X-MS-Exchange-Transport-Forked: True 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: xliCZkdZ06vjLfmC7/DvRxDNNAqvuB79AxxRP+rVcuExbCh9Rh95Mv44c+EA9L7fr7bccEJMhj9/nydnYzVJ/6EoR1z3bDufFrmg9lPiqbpgv3DmnyZTTQxeMVxFWsZwR6d01HfrZG6a+Ok2rHa1WeMUhvN9w1xZfmemkHAlN/fACg1E58kclvzvuf1vFbBTAXx3INgufJcz8NCb/4tXXRmQRxrj0mLtHwtRob8oezpX/MFIhTIH81nhZ9AHWBTHAJ7GrNdWqIyTOxAQ+ql84hHfkrz06M1HK4ZukxzPRBYqnT8L3yeallaHpaP/0F63pcNxcjcbWHKgvRj/Y9gBZTHog01m/pSsLROJR/aSLD7dMny1Ej3/KtkyZawjscInW0NKvUtGtw6AOkVT5rRC2zJ2jdBuWhMLuA+B8y0PmAVjtBvh9TWwMFBBwDAxtff0NznWzgTS74b35iEYZ72085yU8BE/LEi59WvIGjPqObey8hakhFwzFdoCi5DoKWo1PJK2xetHqvogV30Kp5uez8EmU7Z598c2krGDLN80taI3HMJZN+Gl5urLVCC+KmIHuZzZLwn93gUgCR0VUU18ubVQnZAJNQlMpbRc2uDQ2DWJn5/3QNlOivujunPw95tMWjcAtukDxCC1wZBrH7FhAJMtSwyRx8E/goQOjV1kCYefTNb8ZQchaIXkwYdT8L5Vqzu9t6SgZmZDG7ev6jxqgg== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?MeCnwBYYVqjegBZ5i6te9h5IMPpt0VgriP2SGh8Uq+C7sVMTSw177V9Qs1md?= =?us-ascii?Q?pFIq4J1ije2MGBqS3YmuNuNcTGG7FMhxMqOGQk+QzJrb93609MBPBxQ3Hp/G?= =?us-ascii?Q?J6WTRGTobYd0ly8ZxrHMcWjx0FIm9lAXu90YRa/tZbRfcB2a+FoBSNQ95yaB?= =?us-ascii?Q?Rte0FZ+LTaK2vMBD8PnU+HAXifddqwKaBMKBLibez6lzDYcm/yhpzYS+6R7f?= =?us-ascii?Q?9jgoSeNOOLzBgz4TnR2OVJPkcHKSP1vliiDPnhAY6C50+Tf95vTvFfOEcRgS?= =?us-ascii?Q?yFB2m34be+XqGXicKHm4hFb6Ys6Oo358UebEBgvQysx0ldi/J4FYmVGO6bQ3?= =?us-ascii?Q?WrajlFh5sjYZ0A7iLvuCQVreu5bsJU5yRKiCi4tn6E+u6NgWuDvmOQVBDK2U?= =?us-ascii?Q?DbhB6U8Gme707WXCmcs9T/00qyJH9ky8SxFSy/iIpR27lh5Us6OfkBGWlSFm?= =?us-ascii?Q?p5kv3/PGNknlkMYmpG7VU/F7POEI4ZuiHj2LCI5YphSOt8g+M8BWDM1gmVbH?= =?us-ascii?Q?Q+QN9kiHR7WGadvCw4mvEKFFnFAZyyPVhNPJzAf9LUrxQvLMAlJz46063crV?= =?us-ascii?Q?q3oO6nt5hpsGQNsKx1kWQ3B2JcgVTIwSM04XC/E4dQ3diqV0VllqrqV1I+/d?= =?us-ascii?Q?phHklyNhUlsy/k4mPeFwsFzSa86UEh07JABbNN+Fe/8N3tZJsXPiFWlwWr8A?= =?us-ascii?Q?lKyRfABunMKMfPIgeHK5mTcXEsUU0IQsAYxcN/hJJcU+ci3jmnmYsBOyifjq?= =?us-ascii?Q?66j3zQCzUp/NIPzApvrbTTXe3fMEw601V9Yu8uzOLrjzbD57mQCn0Rn73o47?= =?us-ascii?Q?TK8BAPhDjMsZAsv8Mq4KKRytgTB3JzxBghDomznGoZ4Nkert2NNQOP0J91dP?= =?us-ascii?Q?nsjSVyFSOZGLY8GY7uFh9SM3Qb8FRNozjzbCbb3weYWL7wmUGzbA6e6xBS2Q?= =?us-ascii?Q?xfrSThAXqT651jO3yOGi+PgrCY5dED5pMQH9G0WG+XUdINXELBXHR5tcc0gU?= =?us-ascii?Q?TNf35Kg8TDNYD2CuI+BLxnYnkaUAWhLIPaCRKJm02A4AQ0CcVYbqBENNNQE9?= =?us-ascii?Q?tRbEbgoXBxkoadhOzUr0lTD0ai8eBVo66iQmxOKa2JFaWRs0jSoG8hg7lsmq?= =?us-ascii?Q?XlakBBJ8QAHxNKuZo4fV6QTY7ueEp+rM/DuAonrMyccZPtV1fELNWhtSGw4d?= =?us-ascii?Q?x71meuJD0IK1/e0uKBs1PkM3In1/FNIUuqHO2zKa5zzm5Q0Yyit+aBRoS8Sq?= =?us-ascii?Q?99EtWktd/EPOduIIrVXgCUwBXPF0pjDKakRxYaNqlFFeUafWKAsnmqYIsVls?= =?us-ascii?Q?9fZHG6byQgtn+sD8vqGSvVUE?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 19c01780-46fe-4b0b-9680-08d97861e3a3 X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 16:00:07.9783 (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: d+pqZtw9vjQqvoGsxRPN9Fz1R9xZni+4KuzUFp0m7QBGKT5zBqHfCbUO8FW3yxxXBtxR3/1nsTFPxXNh4OpQL3t1ObntgfbropbgZTdW/20= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0101MB3065 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: gwhwYVqomb85fm1v8YhXdYjRx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721618; bh=EqodeGkV/v6TJjiaPxMWeoA/4RknopgPlEa37KyL1aY=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=qaUxFJgvjB2kHQpWWw/KYDxWTT6ger3fTk+NNkJ2zo1TtMYn1zmaA1HIkrYdHC37MUu 1hobpv1ms7XEDtgDUQ5ieiaPYaGxi5UiV3eDkiDg990w2ONAsdzJdM02cazSjfgEu2dgx MZZChgRRjgo/tv5gg7epw0+EXx3kllBlbOM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721621580100001 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen Provides wrapper calls to the Ac01PcieLib to handle the PCIe access. As Ampere Altra processor supports upto 16 PCIe Root Complexs, the target Root Complex will depend 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: Vu Nguyen --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc = | 1 + Silicon/Ampere/AmpereAltraPkg/Library/PciSegmentLibPci/PciSegmentLibPci.in= f | 28 + Silicon/Ampere/AmpereAltraPkg/Library/PciSegmentLibPci/PciSegmentLib.c = | 1189 ++++++++++++++++++++ 3 files changed, 1218 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index dc66b711aba8..dbcd1c9acaa2 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -229,6 +229,7 @@ [LibraryClasses.common.DXE_DRIVER] MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf FlashLib|Silicon/Ampere/AmpereAltraPkg/Library/FlashLib/FlashLib.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..64897653e126 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/PciSegmentLibPci/PciSegmentLibP= ci.inf @@ -0,0 +1,28 @@ +## @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] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + Ac01PcieLib + BaseLib + DebugLib 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..c893c56dfadf --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Library/PciSegmentLibPci/PciSegmentLib.c @@ -0,0 +1,1189 @@ +/** @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 + +/** + 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 + and the segment should be 0. + + @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) + +/** + 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 PciRegisterForRuntimeAccess (PCI_SEGMENT_TO_PCI_ADDRESS (Address)= ); +} + +/** + 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 + ) +{ + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0); + + return PciRead8 (PCI_SEGMENT_TO_PCI_ADDRESS (Address)); +} + +/** + 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 + ) +{ + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0); + + return PciWrite8 (PCI_SEGMENT_TO_PCI_ADDRESS (Address), 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 PciWrite8 (PCI_SEGMENT_TO_PCI_ADDRESS (Address), (UINT8)(PciSegme= ntRead8 (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 + ) +{ + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1); + + return PciRead16 (PCI_SEGMENT_TO_PCI_ADDRESS (Address)); +} + +/** + 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 + ) +{ + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 1); + + return PciWrite16 (PCI_SEGMENT_TO_PCI_ADDRESS (Address), 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 + ) +{ + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3); + + return PciRead32 (PCI_SEGMENT_TO_PCI_ADDRESS (Address)); +} + +/** + 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 + ) +{ + ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3); + + return PciWrite32 (PCI_SEGMENT_TO_PCI_ADDRESS (Address), 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 + ) +{ + EFI_STATUS Status; + + 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); + + Status =3D Ac01PcieConfigRW (NULL, StartAddress, FALSE, Size, Buffer); + ASSERT_EFI_ERROR (Status); + + return Size; +} + +/** + 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 + ) +{ + EFI_STATUS Status; + + 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); + + Status =3D Ac01PcieConfigRW (NULL, StartAddress, TRUE, Size, Buffer); + ASSERT_EFI_ERROR (Status); + + return Size; +} --=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 (#80718): https://edk2.groups.io/g/devel/message/80718 Mute This Topic: https://groups.io/mt/85631185/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 Thu Apr 25 11:35:07 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+80716+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+80716+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721616431700.1162225625976; Wed, 15 Sep 2021 09:00:16 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id DrxUYY1788612xgmONPkHKxF; Wed, 15 Sep 2021 09:00:16 -0700 X-Received: from NAM02-DM3-obe.outbound.protection.outlook.com (NAM02-DM3-obe.outbound.protection.outlook.com [40.107.95.114]) by mx.groups.io with SMTP id smtpd.web09.9883.1631721615523271725 for ; Wed, 15 Sep 2021 09:00:15 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yo3SSWPfgSWWpJi03XZv7OXeghyxsR4cwMHOc/gBdZ9zWdRtiC+raBWBCNDJNfUcCjgxWLIbHrmxZYCol885eiSlCwM9raLxfEcruXRWgfzE4nv41xXoNaP2+NchGyL6gZ+V/k44bOKOWbwdX0PaiWWVgi49ICpelsZP258e+GcE4Y2lE7Cq7dNTJMwGJzTulWQwI3Xe7YbGNQ5wTpRJuinKy6syi/23UfoiIwNx99lEb0DO6EktQwWkf9Tvz54tre+wbrDNkB3cw2JObtC53ww8etrMqSY8JLHmVFESEfgygSaQvcMiuHW5qBPNit21yGuu4urwvLipZXPIbQa79w== 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; bh=0KD7+wYXTvazwF0csIkoZb2lzgIZX4zVg8FTLekpmMA=; b=F84Vb3pZ8yTyBh+EoTZBaMcKTcz0wfgmAKD6urkCqjU5vWOjPg6w35nFgf8Q6ZABONn8NGWUtoYAkO9QdYpOXSRSleyV7OL+B72Bd9TrbycGEUF/3BB/5RbBICOF5y+QW+KBTIsdl41nPUqVCDLDVW+AgN82MQZW3qGFmQgGfkjshezVpXO6hEJ+8D+1SaJkTIIpCJd+6Gq8J74N4dQ5puwZgmHe+eW7Dk/wVwXDRCOPrW1fmdvI/2knlfsOyiabOdHFG1Cv1DnYnzviNflc0jtAqYRXYn3mmcMTlGIZYoXc+H41q9FnsVxBzZxbJypHMRihbt1xe2ZIO/IIYK7JnA== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR01MB2761.prod.exchangelabs.com (2603:10b6:3:fd::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Wed, 15 Sep 2021 16:00:13 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 16:00: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] [PATCH v3 16/28] JadePkg: Enable PCIe-related libraries and device drivers Date: Wed, 15 Sep 2021 22:55:15 +0700 Message-ID: <20210915155527.8176-17-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 16:00:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6fb92592-8973-4b0f-c69b-08d97861e5c4 X-MS-TrafficTypeDiagnostic: DM5PR01MB2761: X-MS-Exchange-Transport-Forked: True 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: sgJLXMbT8OFfi6f/ubNa/bsBGiUn8yOV088Nvc62hTlYxv+Oc7YlkDvrx4DdTROk6GCqFzkIS4KSpb5YiIAXNDncBmhdYQPyKpA1tpi9n5HOMTTeUuIsKRV+7P9oxqrAHnBzSbFKTq9e3/HVqivWp5+DYybcSdG4irmgF6/cJBlKoAlsdy5YLtfJxfpDA65wQGQwbiemA08womuotDbgGz+sDrW6XYPv3TkXU0vEOgE17XdnVHzuQDsRUttme7Aq/yC7T4HqNdkTKUx3MwipnTDqYYP+dAOO/LVhqorI00e636EnSx+qb3hYPZK3HIekF68Vqo19D8hnsO0e3qI8WFqvTMUhZ71u8qOq94LTcsq96aJ6ebKCszbPI49VyaKEvfAmTQUT7brfQNiIvfOP6Q82yh+zOskfV6588yGsYTyRdiEPWNCvVFo16TJL7BIibjUbEDl2tDVWNSZ6wNU3e+vVO1yY2nEm7ANkzvLXh0eOVXafpiasB8aP6WI0R1hBr7f4Mq2CRIIzcmO+ubOEvI2J4SKp1W1EmY4G5/ubPn1w5XyAs/plzEENn8avj6OVR2H9WkAMtLjQSR+zHZLcR/CCMLhBgr/BgZLWDTwY563pDQ5reBnpP2HvRF98T1xQ0KAu275tsUgOElY9ca0qCj3YO4vxtkUgS41td5l4uWchtnGgRs0bN07oWLVcvND2SCaYhRar4nXCPVm95PLPww== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?PnMDAe+4jGPYBnNCJ7kST8OKinfT7n47U7ohT6VlVsYJmFzrfjzW1CUSMClH?= =?us-ascii?Q?cqyhI2EWinAcQNcCpZeDh1GktCrVz5pNH2IY3TLRNDzZlGaEyPNQq+HafcGu?= =?us-ascii?Q?zwA9Pw3qRPVoCFmJEqmow8qJMG9SCyZCuYgN4VqE3deOcegMKsZMNaAvGGCe?= =?us-ascii?Q?nohp/oD4eFSDZmV0Y2kcNYZLu+13F1myl4flbQct4sMGV0iQ62gxKnEriXvk?= =?us-ascii?Q?/24vnCvpIsOJVCy7epuR35UZ6FWldx3F7EyuuaOKQB9tCzV9zRYXwzs0qweM?= =?us-ascii?Q?7hX43kQ2/Kst69fT3iinH3TEML74enb2Hlf9yppPRY26ni7enFjoeatz6Tsi?= =?us-ascii?Q?2TW0jo1o3T9L7VQkVPHNBFvH9hDOBZ2JNnGDyrfk/lTEQEsYY5X8xvQabPV+?= =?us-ascii?Q?AMDaZDyxUXEWs/FEtJZ7ghztPYACPOCMIHiTcBRverTQPMjPcg6RFM6t4Zfe?= =?us-ascii?Q?jRP39hp2tylOECusRq80DIAhBsh8apMfeSKauP3T2CrOWFoBH7OZKJI+Pi4s?= =?us-ascii?Q?FTJ3090BEv9mkSlSOFZEGWtJFWa+qPDyf0LnyQahmFjg7cFqrc70cNCWcnUk?= =?us-ascii?Q?HPCWBLTcwltJVuZAMsaM0M0NBu8TMiqY4fLE+jFQcYvBGseGZKU+FnxZSsHt?= =?us-ascii?Q?9t39pQYLer9HNMZl/vTKYXpDysg0Hw4Yku9P3qy2MEMMLSkURro0viQ2zetm?= =?us-ascii?Q?A/PSE65usk9Gq6acmKGtsTTolmp499gSlJ0056iMW0rdMiS9aQbsP1qWEwAa?= =?us-ascii?Q?5PglFSypEtG/eJlOb8yCEwZBz1r6FpJIIo1lZDSyoM+lEB33CnPUXbAufF8n?= =?us-ascii?Q?3KGZshdOAp77cJOTxXMi2IvPZrfUpqbpwPw541arvmRJDKQtd80mgawR0uGk?= =?us-ascii?Q?IrM0Bwz7U3r1tShTPk9N3BVxk7B3rM3wLkPw1AaAfC/PqisGhOFwZV7WNgnZ?= =?us-ascii?Q?LqBdKeNpf7RJQF0RV0LRTqEGgOr8OkLneQWSvrdwVlRb9FTasSDr6drA1LDt?= =?us-ascii?Q?Mo4UOQlVa/KWPRjHgmBBWNrsvW61jAYN/hmoNfzV26lXcbRIGGZoHeSQ6Kt9?= =?us-ascii?Q?U6l4+yv83Q3en831c1gA/qSDe367727TdvnNiPQNyePeBc53oC2OQH6ayYHD?= =?us-ascii?Q?R+2+5/1a0kCkzMvCNG7PpJW2xt6KNsyXqIcpT4kzq4L4/tiWFiTNJvIwNHnq?= =?us-ascii?Q?aAfIcVxf2uG5swFukzTl7Y39wMCHrvJMRkzu698tCpVM5qGDVUWhM37R14mL?= =?us-ascii?Q?3/uObJFwCFYEe2t/RK2LNgeAvCA8jcaEWCA9da3IALOHIgwQa/FLP7XTGMAd?= =?us-ascii?Q?FLQDB+6ecYSblnoeB9YiUdC4?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6fb92592-8973-4b0f-c69b-08d97861e5c4 X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 16:00:11.4783 (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: B/DjQIOqMFSDtXZMVWNaDnPk9gI+NZkJLAsdS4rSfwn/3QiQi0l37gHFUP5axJ9mXcQDQdEOPGbJ9EhraoaCR056WOlwQryHEuvAfGTlXhU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR01MB2761 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: t6xMGn8gmD06Sued1LZSQtDrx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721616; bh=pm1t32dbWsuvsP4BbplQYbCgcucSOp/JOCEMe281KUY=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=cAh4JebX+kG0S2zClhwyllzQoACGln3Xh1L/7Kux0c+JO6p38do8PEGwvs4AxJlhxnP cYMoj5JUFEm323u1rOOgewxwQdKm/XJD+aWaY7zbPsZFNdwY5IukGgL3RkCvMFHSbFBV2 i4EaBlpFBif25hpKySvf27S71jsDuQlXJ/s= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721616984100001 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen This change also enables the support 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: Vu Nguyen Reviewed-by: Leif Lindholm --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc | 34 ++++++++++++++++= ++++ Platform/Ampere/JadePkg/Jade.fdf | 33 ++++++++++++++++= +++ 2 files changed, 67 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index dbcd1c9acaa2..655cf0258608 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -82,6 +82,7 @@ [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 @@ -657,6 +658,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 2c6f9fac76fd..3f1ad9a49cd0 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -266,6 +266,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 (#80716): https://edk2.groups.io/g/devel/message/80716 Mute This Topic: https://groups.io/mt/85631182/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 Thu Apr 25 11:35:07 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+80717+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+80717+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 163172161732515.13327945814774; Wed, 15 Sep 2021 09:00:17 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 3hnsYY1788612xwqPQkaath3; Wed, 15 Sep 2021 09:00:17 -0700 X-Received: from NAM02-DM3-obe.outbound.protection.outlook.com (NAM02-DM3-obe.outbound.protection.outlook.com [40.107.95.107]) by mx.groups.io with SMTP id smtpd.web12.10046.1631721616333308369 for ; Wed, 15 Sep 2021 09:00:16 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NNHq8iZw/GK7A7RBO5pOz7Vcy+tM6DpMwGPew/IAkhK6PHENVwDabv1MdvTusHuj3g3mv57dbwRlbqp2UBoyrULYxt2bh+dSoRhhgwygGwHN8bliW75BsYSl6osySdn7952GskSAO2rZiEf2nCCghc1T5GSg0KrCI1Z5Pd8zLMpS3r9vRyl+nuscL+PBUfserSh8dUelMVE1Xq0YAJEo5oVjIEVgvaGPTOjGsD3pJpdMbi2UEkoMg5oBDle1D7aU+SeG4J7Gs74tbmvV1EY+T812dUfVG9swtAiiAtSdy0PjRvzGzPNDO93l534OiNYTdwQvqlXDuxWYjOVRYZ9FPA== 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; bh=jhpGGqMuhUKiI6qOxOdfwe0n7QLBAQMTe/LcMgenKDw=; b=IcQnNPcMf0D2VD7yS/KgrkTwFFJfl6n0de76wpE5XwXSt60UqIfYysQ4dngnjaeqWci9X2Nm3iDXEHUeHGwiLDnX8X9iG6y/EO7wUgMSNs4d9xpGWaB+SzhC/2DORefsi58Uy1LevPtGiOKUHi61Q1g5IFzDd10HsCwo4P4/QkV/xJjM0aiaKv4yRepzRtal60Bji0CkHzDeQh956WbJ+HEi5uVbO9xbJE1R8aDMFqdDiuwxD7oCpTgwPjFfLN8yamC+m2WCdmw6ENfZ2B7pZRRGyB3uKiPuQkfXpXxC3NljXvsOTexiwcNuOqxvkCtHBcw3NN5+k9R2KTaPIuXtuA== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR01MB2761.prod.exchangelabs.com (2603:10b6:3:fd::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Wed, 15 Sep 2021 16:00:15 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 16:00:15 +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] [PATCH v3 17/28] JadePkg: Add ASpeed GOP driver Date: Wed, 15 Sep 2021 22:55:16 +0700 Message-ID: <20210915155527.8176-18-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 16:00:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 35f36c1b-a9a8-4591-a058-08d97861e7e0 X-MS-TrafficTypeDiagnostic: DM5PR01MB2761: X-MS-Exchange-Transport-Forked: True 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: Xc/s7g4qsKpbyZp0lpKTt243k3+amDPKXZMKV9HSCtr3sBicQjwDVReHfprSzZyI55phHemLF1kzv7xCRO3YL5yVW+QBz+2i08bZQxy7YQBW/MJMSOEMEZWYMEHMvK74MJZN+IpyebKl1Uq/Djk9sktVRhWW6vY+zB8YbfKvNIkT2w5XmukGEoqlnK6SpshH6gey1lfAsquxghIrerKC2ZozpUkDJNpVPghdN45U68/4tkkrBTWmdCmBDV1BHECoIA/IGpW9VP5hLEKzAL6Y2nl2ThG771TPgz4YYra7p9FI1l7jXUCW6D6X/tt0xjT66u3z0n+H0d0LY9OdC0zclymIRjTGOJNTa/qBmhkh3kZYMYHfaXoVG2zhhuB12u7v6R2DQe2A3XOWM2o/N6GybEaO2Lp12L6Szbgub837WZX8BRUFXDsFwwtGU06yZBM0KRBqgi6Jw/y2D61muwmy6T2s7f3elfWtSDKMkD6+e1PAWknPGsAS4Q0esYs8nzs3kX9UDfeo0+HPJbY8ELzhSieuJWX7qWmaRyVTgEhldkKR+Z0+FiTG6XGI3iRqmdC6LfHkJdPT1zZna9MLsH93IWk3GEAMuUYVpMB6bWDA9GXhtKMHvjBnhlS7CW+ReeaN4ypi8I2tXrATIIVVcwtgbbcvxlOVr59+/+Ysd94MWqL+6hTl3O0sCH5bmLTpENFn8nZaCVsU0pDGKjSfHtNHUQ== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?izyU0JvUqbqrf8ySIRaC2V0BxGFDmxjm8+lO1GkWTvspIR9/uUdEwguhRHHk?= =?us-ascii?Q?VzoVGLcoi5N8lI47mUaoAZdkIKEgILDYXfPvg2Hy0TuIjXoKg/DhvejvpMli?= =?us-ascii?Q?zJMv+z/fD7AyolKyOxOsaLqwhTkV8nMSTYnlKN19dhCnVDDQCqpn1oa9woks?= =?us-ascii?Q?B9ojCT4YAovIAOJRTzF/C7ZA7UqZQll6//ivdvrnaVJNP8i9C3VKG4C3G+2g?= =?us-ascii?Q?pEvPDxBkPfyNDpZvoHneS2yV3ANHPzce3oRH1VAmfruqt2ndeJCJ5Qap1dzn?= =?us-ascii?Q?hx+/YGT1F8jT7F8QS4tqHP8FET6OKdt1OIHBV2uNcvXDLLLaspYQmn8Flify?= =?us-ascii?Q?JfXUShRRm/8pvtHX+RUivo5WxfFp+laukBP9cV2YtE4zbjn/lfCgpffMyu1T?= =?us-ascii?Q?l2K0pfHLiKgE79gWt2sIxTh2FCXkaZBCGrJwtoVNZj5qeFYvo7M2/9xWXeA2?= =?us-ascii?Q?Ncku5/zih4gfO/4a5bYaK3hnzCNbRoPmZ1O11r4l4F9P2iGdOcgMHRm5TZ0r?= =?us-ascii?Q?EQuNtMSa5AHTHVUmaO4gB1E4asPmHU0LOa2P3m79/WMqILDIH+9hi+hc8msu?= =?us-ascii?Q?MKFXSEGsZpU1iIeGbrmHm2A1C5L2ytyOdgXh65h842eZwTj/rISkuOl1+05u?= =?us-ascii?Q?nmbEfSjfU7SNOXuIlq124OQTI/76xZCRJkskt0DSFyT6dp93bXseoYfiQb0T?= =?us-ascii?Q?PWxEnRvTUEnGUuG/28kDCB4Fe+kucKBQtvEebYinHMrq5SQ50GfIcgZHyTUx?= =?us-ascii?Q?dS93zJoX9mBJQkLge20Mat2l6Eh53N4PPEa8etRWGCEhwrSmpRBCP5ZGSVZk?= =?us-ascii?Q?rGC8MLYbkWS9Vm4ZihsZvYcEzW9A49HCdaDes37P3zVFFuhIdJZbqPA9Nr3b?= =?us-ascii?Q?+38Q14OO/QJWJX62y2ntj/67HlHk4NhCkakcS7iIzwkHPZcpHKmM9vVy6kdT?= =?us-ascii?Q?oF5OYui904AlKcE1bKeJ4Wdkcq8jG9f+oHDakfklrEy7noUiLK89FEmw7wuF?= =?us-ascii?Q?RZPQVuha99YPqD5Y/iU7hOjLkGTuAtg7Zped6gf8M93fFa1NFzRkLKVkiYQv?= =?us-ascii?Q?qtKhYxP+m6RY4aNBNnFBXth7YwQk4NzitffImDwa00nH758C5GSkkxOYK3aE?= =?us-ascii?Q?iC1lIYRFpg7117B7hueRZPfteo5y+ifpa+Ndhp5mqkcAIWevFICkxw6cNqkp?= =?us-ascii?Q?eq13iyMJB5LR5coaBcKF73+Ffd5Q8kRluahQbBPv/okgM/kAvNCKHbpKIm7U?= =?us-ascii?Q?g5NXJCyAivLGpPGw5PQBkcUSlR/5xJEYU/2mA0wiN9Mv0lE9fK+AYZ2hT9V9?= =?us-ascii?Q?6LGYPuCR+nDhO9LZhNA1fYVj?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35f36c1b-a9a8-4591-a058-08d97861e7e0 X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 16:00:15.1522 (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: RQiYhRQya210A4UAPwG5YOy5JYRpwVVw4oEbTgjipCcOJizAO+TXOaVvFcmWb2GKT//PwRcQqP/WlnImWIxAj9MakqhCJ/O2A3PgkZCOeNA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR01MB2761 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: SY9xbFEeM2kXPcvg05Ldx59lx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721617; bh=BwaDv1QQTCJTZspaJT1BHTs2jhhwZAsEnCFjE0O9SrY=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=vGiaMltK2GpWM6FbfpldU0zRscXSU5elKFCTUjYgioAR3xVbaEx0kjp+81eBFhCu4i2 eA73TBlM4cH2MsKVWT7rEMVQWoacCTM4RXNfUmYdfUNy7ZU1QvPhPz4PWtPFdaKyKm9F8 oZcFsfguJrRxzh/+po1OsVnADyikrDAWa98= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721618929100010 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 afea3407a256..b733f8430806 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -119,6 +119,13 @@ [PcdsFixedAtBuild.common] !endif =20 =20 +[PcdsPatchableInModule] + # + # Console Resolution (HD mode) + # + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|1024 + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|768 + ##########################################################################= ###### # # Specific Platform Component @@ -140,3 +147,8 @@ [Components.common] Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/AcpiCommonTables.inf Platform/Ampere/JadePkg/AcpiTables/AcpiTables.inf + + # + # VGA Aspeed + # + Drivers/ASpeed/ASpeedGopBinPkg/ASpeedAst2500GopDxe.inf diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index 3f1ad9a49cd0..195da2d63a7a 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -299,6 +299,11 @@ [FV.FvMain] INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.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 (#80717): https://edk2.groups.io/g/devel/message/80717 Mute This Topic: https://groups.io/mt/85631183/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 Thu Apr 25 11:35:07 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+80719+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+80719+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 163172162605099.20218111061251; Wed, 15 Sep 2021 09:00:26 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id CUUlYY1788612xdAD0qcjm2C; Wed, 15 Sep 2021 09:00:25 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.119]) by mx.groups.io with SMTP id smtpd.web10.9928.1631721624746800119 for ; Wed, 15 Sep 2021 09:00:25 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mrH0ISoGaoSJV20DXTeM8VS59TTMFk++OoKKIjqHoIlHNorvxYQJHOUJg3HbfwrYO+GgNPQm9ra7o+8tnp8ixN6S0uk6hVA/c20BNfg3L7baKi9s7TsZqOQ9u77IW9ueCx5DITJv67TO7KxwbYSq3vFo+RBdPqLgLBoRTEBqy6p0fgElxzrOqpPXHr+oQkk3/gUG3YO1WAe0NJQHcuXgH7Wr9lGawNXrj7sMiif8wx9SMUY/RoGRgG3Ul5iXe7iLch+bgytGg7tG8EzdLn58+3DHcfi2ITuwphFc5HlnSjXshFQ2Wtza07jC6NvcymaBfIVHBjTPhZqGeiKWLm9Ehg== 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; bh=sxO6z1RCpFVFQIbUp5OFoSItj3vy1mEur95YQD0uSM0=; b=P+UciPf7bFaNZC06UWOSyY5tGgVV03JyYDvULMhpDMuXR4EHpzqbD/FAn63laF/tsHRjhDxyXF+nim8N0Nm79RB1OciofJYFKpyq43nchD7Dc8gPvTh5f/b+L+NONHZ9OELwyKvAoEVCE520GoNiZPICJpdpIegK/a3RT8WD9ja9CeBsAIkdRdr3bTa80w2ycKFWQ/BoDyRgZW8d3KQNPZnuwqiC/D+V6VRAeR6gQxWuBO2RFTZ/PIsBCLsFde4z2OOEjA1c0c/uJo5U6vMPFQaUYFv/+OKjktAdsh5u2AmFVUzfsPbB+lwpkXtVkHhUZnMnYRWynPQnSrsWiz4jqA== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR0101MB3065.prod.exchangelabs.com (2603:10b6:4:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15; Wed, 15 Sep 2021 16:00:18 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 16:00:18 +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] [PATCH v3 18/28] Ampere: PCIe: Add PciPlatformDxe driver Date: Wed, 15 Sep 2021 22:55:17 +0700 Message-ID: <20210915155527.8176-19-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 16:00:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 78c50498-4f7b-4faa-6bf9-08d97861ea0b X-MS-TrafficTypeDiagnostic: DM5PR0101MB3065: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: Cm2vejn16GlNwT972Z1eNb2nRezar/pAKWpYT0N9cKD5KJ86b1y4QAAx3tawafqTaoIAno+pXpv4b0UtYcQOtzidixTT80+DEkuljy18n50ExmQe6XZAhhIkYw1IBJori49/Np7coBrzh9uFBqmb5Q/BtjG2Z31AUdOJer6QpfmKGnCTIjYjxiw17qWnFmhqOmEUYX0H3kdAj6YUQUN7DAGB1yPl40zMuXtvlv1Ecxg7ErzZzqIyFxyU2mtLnET2KHkBnsYcRvw8c0kt+mSmmy7goSPIHNPbcZ8pFD3Oi77PNardhGOWcrLXKWivKTMzbIETIpWoK4O2t4ZG7WBLl+pHSaLNu8EY2NqbG4eZDMLFIUFo6Kr5VoBIi6FnuyKXm+yfWnhf/JNpjp/fDNL7CWK+b+9WMfmQZyo1Wc54yqM0xKYGYcLKDrrlBqBzlRgGV+bkzerggUfDe2ohAdxMuvodGETv2EKtiv1XAYLZaMlyUtBr7KssNB5BZ8nDtRgLG4ma87hZGlzYQDmnl8QJB2SH+x5x0gcVebAwd6/GoJx75Il3IYvxA4hvrOcEJuEQC0gVefN5tH5D3PlcDIzUmfM2+KHB5hR0LH3vcDGnvfiHIGVI12N/nTFSbsjgV9DU6a2JPGP8gT+HFXFrQYrs1f/RRKbuuc2htbUk0jaS2e6AN8rDbAefUU2ik342rC2zV1zCGD7KxvVP0o0txmPdZZcO5cCnB3GJm0efUJkJqvA= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?V0iqGY3fdp84GJArky49XgCYSiMjxXXaC76HT4tW/HP0W0t7x9Gne0HJ/d0O?= =?us-ascii?Q?WSNfD01Ne99c31/VFNpTtfQp3Lc/hp52TFxx24X2ewCxgz3xY3wjChV1REAb?= =?us-ascii?Q?6ZssnJ1BFUKZDfQM02KaB1+OFs56nWqUkt9yCufVCG3AQ98N1jZhe8Ur8Eby?= =?us-ascii?Q?V6Y+FXdi5A3bNVJOO6JTrmtrUoS/R37OZux/wpBGLNWm9lJGGg5OWPbU97rk?= =?us-ascii?Q?+qyZms9HnoGQuI0biEsuJU5nwZg5R+Lbjbki1oJPpGejhbYML/TB4agSfxTi?= =?us-ascii?Q?jHa5V1ja3qoFozdYBIDxfgW36Lu4cy8JE0LKA7PYk+LaWcNUd+4saRJNqbHm?= =?us-ascii?Q?q+pjmcXy8kuqkhyWhM9cjNFBIp7b9zE3Z/M0rSVZRgm/k6tLmw2nDf51DJ1Z?= =?us-ascii?Q?ILUULl110gLaQ0mE3IDesTwOGRPt/GSZLc7L86Qag723M5t5h3jTtnh+egme?= =?us-ascii?Q?tXIeSgUJNhnfXAFDC2/aFbtd+P8HkNLC+ubvur4asi4lWBpxx2bGfpSQLPAO?= =?us-ascii?Q?+csctIgSKC36foQvI3Gm+CsVk74QV5u6sUxmSx6HqSvzn2l+woSHNPUtECN3?= =?us-ascii?Q?4uIORknSkL+95csFAK8UZ/12qVDaTIpSpSiYtyKX8Un0W1S6DMQqmHDjjCZE?= =?us-ascii?Q?DCd9K9FrrHumRTxRttDf3lR8vfCnPlFYOdbi5pqy3Z0JIp2N4MocosA7GK5f?= =?us-ascii?Q?yMC1ahtnAJhhoKs4JBzth08tByLsZ7IWyFq7vazeKpwDgVc/pVi0C12hdSRD?= =?us-ascii?Q?6L/32ZM23FxP7eV8pzyYytpFC5HAiAwFQ/aERbpGxkdfn35ZjbSAjxjDvWCl?= =?us-ascii?Q?c3Vt1jKXkKF0d3W9QzZaco09Jw45p8nINefhqNPX0ztIO4D96BJmsGsWC8ZN?= =?us-ascii?Q?NZ1oNioK7mOUPBAIUYw3PgjZcHcUbLvEWaxoPm9hOnpKnZjTZdTUstkP4zAj?= =?us-ascii?Q?Nj78xCGXZSibvbxnX3ZCixN/ceFYePUo7ZN6NwrMyysMYIWZVPySB/8EidjD?= =?us-ascii?Q?w8Kweps5fmRmoVlCEmTA4eOn/Rj/M5enLm5H4JsXKl99Y6zmBoHiXUQnnCqb?= =?us-ascii?Q?4f/x6yFgiqBs4nWew1JC7lQtgp2G1Ar8DyUgDSUCWz1lw1NY9k0hrnsITqhk?= =?us-ascii?Q?FFSJmzGOmUH065QQZaFvP0LSPPCgBuw/Ublp5p5xMyrfKVVn/RSFIJTjb3Bh?= =?us-ascii?Q?kmRhO0U9aW3nIxbnX63OYR0dabcPiqiD5MOXCB1Ly4IxkcD+xVHenJbAhYbd?= =?us-ascii?Q?q6RxWoB/TLu0Qk35LqH1d4RtHBuiYwf79nzzJcoZjuGgbl21N5TLFTIRphOI?= =?us-ascii?Q?Y6KeGVtKAJzk5jsTA69SKNF1?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 78c50498-4f7b-4faa-6bf9-08d97861ea0b X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 16:00:18.7361 (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: Z3BGJqJtqrBeed28e2kSwf2P9IEJ1kEYTG7a4HJ97rjDyk12sG+2hBJpVLdYaXyx8oBAMphDQkvNmarfsLM0behd0xpdx8jTDQgJVQBaoBo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0101MB3065 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: dGl7wEkwiSJekFYIom3XwveSx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721625; bh=i9O28cex5O0GDOdgLdXb6V9t0Kc44TFaLUnxS86b0eA=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=veZhtSl8thyFEL9Jx3Miubjouq7AxPuMytwqN9wi1KrBQwHnx8SJljf0fpZ38YXHAl5 k/kht1F1NmTwDTL5E8TLDpH0OTJ3PuKJ4jMcZs3w+ahtnwm7ZlDl10EPFO7hUCQBnKCrr yUnnagYvJVyHYEw6Gqm//YzhobfhrtRpftg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721627191100002 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen Registers the Platform NotifyPhase() to prevent unexpected issues caused by the enabled PCIe controllers which have 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: Vu Nguyen --- Platform/Ampere/JadePkg/Jade.dsc | 5 + Platform/Ampere/JadePkg/Jade.fdf | 1 + Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.inf | 37 ++= ++ Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.c | 212 ++= ++++++++++++++++++ 4 files changed, 255 insertions(+) diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index b733f8430806..ce5f2c0dc4e1 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -148,6 +148,11 @@ [Components.common] Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/AcpiCommonTables.inf Platform/Ampere/JadePkg/AcpiTables/AcpiTables.inf =20 + # + # PCIe + # + Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.inf + # # VGA Aspeed # diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index 195da2d63a7a..8ddfabcdd9a8 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -298,6 +298,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 # # VGA Aspeed diff --git a/Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.= inf b/Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.inf new file mode 100644 index 000000000000..5f5316055217 --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.inf @@ -0,0 +1,37 @@ +## @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] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + Ac01PcieLib + DebugLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Protocols] + gEfiDevicePathProtocolGuid + gEfiPciHostBridgeResourceAllocationProtocolGuid + gEfiPciPlatformProtocolGuid + +[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..196f857175e9 --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.c @@ -0,0 +1,212 @@ +/** @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 + +#pragma pack(1) +typedef struct { + ACPI_HID_DEVICE_PATH AcpiDevicePath; + EFI_DEVICE_PATH_PROTOCOL EndDevicePath; +} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH; +#pragma pack () + +/** + + 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; + } + + Ac01PcieHostBridgeNotifyPhase (RootBridgeDevPath->AcpiDevicePath.UID, = 0, 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 (#80719): https://edk2.groups.io/g/devel/message/80719 Mute This Topic: https://groups.io/mt/85631188/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 Thu Apr 25 11:35:07 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+80720+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+80720+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721626448842.126538128787; Wed, 15 Sep 2021 09:00:26 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id qiV9YY1788612xUaR5Hmdhj3; Wed, 15 Sep 2021 09:00:26 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.119]) by mx.groups.io with SMTP id smtpd.web10.9928.1631721624746800119 for ; Wed, 15 Sep 2021 09:00:25 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MUsnwHnpUbQMBrz/B+zjEKGp5Ig8T4fILRQ0d2JBQiCGviH6wtW8nmUsMUGVRxsZ+54vLjZc5b4INEArzDf2GdBQAa1a6bbDgO3/2YmhDGFb+FsEGOScfXuGgAiu4uy/XIpDk1kaFuGA5OgeId5zVW5q4f+tmTaBSMFkYaLfFxA4eegoMzA7ixUllNB/X2fzYE6OfQivdPOG/iTXThER1Bc5J6kOFCwG2mvVsvCESbpFgnbWODyuuescAGwRtgt1PyWFJz+1tky5yCIEqV2FzJ4pwy2HxJxwhdSxhkfXBGJOOkB91mDBDFd/LwaC3AFpVofMCVX560lukZgwOmgAzA== 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; bh=1MI166mqz5U3Fw7T6iTnSne+rTWMtXNuD5wl9jdUWiI=; b=A6dLImEGC+BqQ9elghKkvFYiGZYfB12kwXkKDfM1jaE631Ap9KEc0PwCTsyEkpKVlF0wx+/XvPYkMrq/jOrU6NN3ZblnH5S5Ly0RPMIsOtQ7L52l5/4JhdBdn4+MKlWcGU+X5OCPXJmW9SXRsdqJETiHlBTklOI/u082VToAqZcOP6f+FSNbme5L9naSuc3x2WhpdTHAzIaipjpc3KHBeIhMscyUxDtNhZWG1WyEG7N4RDTzy71hR37/cLu3ERqTbY9wjkOXMMjgOuQj5ZDNVoJlTsY88s/2qqHJ5Ww4391Rsag/8JittYqb1ckAOCvNTvOslv0MzGQQtZEa9e71vQ== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR0101MB3065.prod.exchangelabs.com (2603:10b6:4:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15; Wed, 15 Sep 2021 16:00:22 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 16:00:22 +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] [PATCH v3 19/28] AmpereAltraPkg: Add Random Number Generator Support Date: Wed, 15 Sep 2021 22:55:18 +0700 Message-ID: <20210915155527.8176-20-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 16:00:19 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 66431842-7cb5-45f6-ac18-08d97861ec3f X-MS-TrafficTypeDiagnostic: DM5PR0101MB3065: X-MS-Exchange-Transport-Forked: True 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: O4Jzmfw3yWanVEGAm3Kfsq2jwj5RKhknp/YzDGktREnPWbNR4VhNwAVq0k17EtxUS4YICr/m+7ghJ403+ZRjnSF9Ds8dGvMNJSx82hmxbU8PlobbHssNq4USkaER+ql/LYNr8/KYqmnvxH8xLAQOHgM3XfEUGnv2q4qNrfKBrjEMJf8b13iOcDVq00di3uYNULYRZ85boAxTuas/zb6NDbuqodqdr7eTvGAUJ07b6IYmAWdrDRoJkHPRoobs3SZ3U73a6KEeXD/g321mXMqPogdq5wbSnlRg3vyf2L8FyXzKOtOkerOj2rWF63Z2cVq+NyFYrFiPB+eMm2VAyG9qQoqv/tHkVGj/I1NZJ8QFFrAksQ6PeoH9E4Rn/vQP1E7FnTEbLyKHKUd9HUUDG0gegU5+zIxmvlfg9WOV8n6QzLysK7u8u1yJeam6izwHEvQPbAxYJn3uUqLhfp9uhE5f6k0QBSyqgFOke+ckmeyDPNHst91Yp0TQgzoOsBaKObzIpuqNUHLJGCJklMc5sef9tz3p797sl+dMiMkt4gBXBiadimZqIydlXiQIu4aJ+YCpvFK1M20kMU6LAXLWdhEfJrNN+gIqm/i8HbDVceXdrciZab1s1P9MovDSoSyrF8sVb6MYnAeywa8GkuYIJ2xHxVAKMp3urym83F4qgYlpAvGBd5rGrZqIKifjSYh0Hk5YwUGTAja1xOSQsK/ynPZnjwy6wl/LpyLcwkQUQ9Iwfo7C2ZepbVcKYNPlr+5SH6T9TMEgzF2agM//iAZXaoqz1A== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ksvTGKXN1bSdB7Soo2jbXRpaNFv/yeTlElVnnv8q0KDFdH94InqTgpSFszef?= =?us-ascii?Q?f8CQczLNaFzdWqdlUh+YpaOdJYe+p1OP6THxGM6L0VKgvQD79KdqlNdgDova?= =?us-ascii?Q?8GloKBwl48s24uCw+ptPRDXAKw6LLPuSt7rc9Eg/Qqe5iOyQ/vz97dU3pSAb?= =?us-ascii?Q?v3wRIFZH7XDIckhoEG/44reLJbjbPJE00l0PJlBaQDBld3U1P+zoHB5Kg975?= =?us-ascii?Q?4k+emxpdFeiz/ZCyW5bBKV0ej2cQCkOw5o/fIPze4qLNrxyx4NELD7dHLNRF?= =?us-ascii?Q?fqXudEINs1blhi3s6HzesBFTZVzwo1caDZLt5TMhVwG0E2Y9GQxruNwl6qmc?= =?us-ascii?Q?dLJXOi30DCEfaTyif2Kn4GHx9BQKwTWp3kwdXDK5hmOPJDycEH+gygpdMaFd?= =?us-ascii?Q?M0xZm02B530o/QzPVOTCyucQLSV3v9ffJ3OzArZ1srqoF9CRjp7B3KygilkT?= =?us-ascii?Q?bAjuLRXiCm5sPzXaGwqKbSQ+LSwmHlRCQQdnZAj/QYWRcue2MDP9PxOZu9BJ?= =?us-ascii?Q?JGCcAn/UgmjzagkIiUWcQxp+v5z7K5SLW85sw342sMPHAxBsqvSOiPfzWpwz?= =?us-ascii?Q?/XHDFPhjK801WQqayFXo8igU3iZj4MfyEelQmV4nBMVM/pCqFkLMqVdl3zwb?= =?us-ascii?Q?HXgyf4/AZvTIZXf+5Ebbdnk4C7Q98FGVUHHJyt0GMtx+s2f75FVv1hE78Hmt?= =?us-ascii?Q?tMkuZVw07blsrsjntaI1zVgyRyuPLusAfhL/YUyeD+5cfmTwphG64mox1ia1?= =?us-ascii?Q?MMly7Ar5/jzE1jkrM4FkiQeMDDrQyNL3Q/Sl3QDoy4wriQQpIr4sDndLQbLn?= =?us-ascii?Q?KoUICpinJo35g88E9vn14/wCi2qxz3hPBq5SWf3k4jj36AiNhruAx8oENuor?= =?us-ascii?Q?ltXVlSlvZYfPLWWm0hy+4gxGLD4HkMTecWN/39XwDX0Yq591ulqUQAdh8kNy?= =?us-ascii?Q?TK5Q6HEYcson+FUZEXpfYv1iD09M3sJCrgn7e23tFFh8YRsI3ZJqvDnpTe1o?= =?us-ascii?Q?1YvbN0nn5xr+gAcdi05n9UfE/uglFZGYtLYLCFJrpCJnIv88zTa4oHwnnX7h?= =?us-ascii?Q?P0n+QtOzSrhzJdpuVsvEx++qu7SbPxcfMt+PpNWInK0VkRXimvzSluw/BLfF?= =?us-ascii?Q?Y8PLo+1RQxg9Z7ho5zuXoc/j6OjLnjKgWZ9u21KyJ9F269W8uTUxw/HlUtoL?= =?us-ascii?Q?7bnWpi20mLc7lpt1eX+tl+L20vODWgw/dXGJZGaVkRxwGLZOMWYlaoWqQLrM?= =?us-ascii?Q?boJ1XlszJ8dezi2Abe6nWWygveNIy7XMCNUAqMFX7Z+uBl1L0JCF7E7RVLrF?= =?us-ascii?Q?cniajHtkULwtKVQ51ITfiOIo?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 66431842-7cb5-45f6-ac18-08d97861ec3f X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 16:00:22.4010 (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: mTShGbFX1c6uM7Q63MZ4l+vxzDPwlODGaQsKD9uVZR0SSJyvGNDP/KfKBvYAtP1XYh3MNjt4tyUwkjQ4eorzC49mwh3FFsM3Dv8uE2sGGKI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0101MB3065 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: 7Fn7UGnMp34WW3j8t7Kd4z2Lx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721626; bh=WUC+S6VnA3oSuRLZ7EkajLakGE0CUUZAm76KKlXcp50=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=jR2ro7u+opbnuM+2Ssl0DuYkdr4GELuKkbkzeqwpXjheKJjuaLzgZ2hQghrbJDXBeVu pGGkQMPRdW7MyKwO3oTeBpkp2QaabMqWMc5VgxM9a7qbmOKfJQeE49TKqbWJJn42i++uS Myxl93HKhQB2l82cycsbdP86VZif218sZzk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721627393100005 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen 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: Vu Nguyen 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 655cf0258608..459d06c33c02 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -691,6 +691,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 8ddfabcdd9a8..06c8a4fa1b09 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -305,6 +305,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 (#80720): https://edk2.groups.io/g/devel/message/80720 Mute This Topic: https://groups.io/mt/85631189/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 Thu Apr 25 11:35:07 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+80721+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+80721+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721643214788.4425754298669; Wed, 15 Sep 2021 09:00:43 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id yfYuYY1788612x9KPw8ov63I; Wed, 15 Sep 2021 09:00:42 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.131]) by mx.groups.io with SMTP id smtpd.web12.10058.1631721641957507787 for ; Wed, 15 Sep 2021 09:00:42 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kUUUJx0BAf6TIsWf3Hb9HpfunhlZ7XhyZWdETnCt4kg8OKA+LCOkBhUCay936htl513FB5K224GuUBU/5DVPCL5pQVEBcFxdbey6iNRGI3krqpXKqj/9tDsLw0bLdFVgrhBAXGDzemLrDI6U5yQ+flSQkFLdnWgJm3NoGFtAYVpRyE3wJoX4Cl4ja5AjwG634DUeW9mFIYPIgPEnABxoKBNY1fV0hMmDLCqtc+OVhqe87Vt3gJ8EeDfDsyrwGu/wkv9AUWFHqKTv/7x0k+nMQEUXymWhNDRMw8XKXuHsCzodPfuRZfNjiO3a2dVUxw976ZnqhQRJuBwryyKckt040Q== 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; bh=LC02nalBk/AAH1cgWeIFzMFSbpMAbwtw8rpRBZLvXdI=; b=DZQUhESCfax227iKxTbSBXIF2bpZQIhG/awFLFF5OhN2eDiLI1Vnp0uwEyVjFzad0NDiEtComrSvHsTBKOYxjMCzXyJbTPuiNUWsTYOloRPia3JTDk+4Y4eFOynJvJHds4EnTrak+6bgumuh+jA/PhixhYwsqFz6E0gdBYJWeG77kfoQl8O1Ty/xOAZugxwIQZxiU/YuGB/UV5fDq8mmmN+LBRpq2QH99+87B3rYpJEabV2dicHSzudxcXKzpN9C/DWUQZ7jBE9juUQsWBGvnQqJkeskTzmw1u3PdTE/XCb3tdlg6a4iK6KWQZakhZ22AR44sfJV4+UntAh7T2kQNw== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR0101MB3065.prod.exchangelabs.com (2603:10b6:4:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15; Wed, 15 Sep 2021 16:00:26 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 16:00:26 +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] [PATCH v3 20/28] JadePkg: Add SMBIOS tables support Date: Wed, 15 Sep 2021 22:55:19 +0700 Message-ID: <20210915155527.8176-21-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 16:00:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a4aede19-d968-42c2-1f68-08d97861ee80 X-MS-TrafficTypeDiagnostic: DM5PR0101MB3065: X-MS-Exchange-Transport-Forked: True 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: JHnqrNxWdaWcGEmgGcEtZEWtbduBdGEK8pIr2C95T/vtZmMZ0LM8idqTG9pelmwS7OCome9tpbqROqLVVawVVLXjsftqTdoBOl+tP23jnICWLNYE9/5RodCt+M636Sshcc5nCy/18F+OXfPChTM6bpqpwBF1xDUlPDbL3Kle2FcacccCKP1yNQut4AAH3OHcefqRS74xDS0v4KcJuS4ROHd95cHJsb5reVbZflCmVHtAQYaekKDqlhM8Ww2I2hSewjLLAbPvymaf8a8i2irKY6I062DmXA1LgfQQOrOWuAa/DgSTUfBcWSRzD5lLBDEvZ3+EOXD6gCjlJUa4DcCcKRL5R3jCWPl84HkQR4fNWaL5Bno7HKYKrX26MEEmmNIa+SgSxU+fFLJxNm+p+2upsywOznJM4ZWQ3mEz4LuQ9Mi1QEIuJLCewHOWp3hZahU7Jp4foFuXJfg9dpOdceVMsMT8h1zbJS/OevdsGaLmK6laTFZry6gvGFna1d6bn35fE8L8xuA8Ph3fIwQ9YWqf50QjpP0zkDgmXXbV4X8k31kdnDqLv13oApYcYVWtjH0pKxdpWQ221s6E6mVQdEOpH2MDx7HxuYI3yFlsLmoM/Bxnutl+RkZ7VOS4dSOY47Xhp5nhskmSI5QrpueZ9wI3vkZSkkZSyYChYC1xD96JoFAZHhUKZV2GNM0FVzwJdLErumkOQbRXuFteT2VbzQ2CVztHEO95jJIjFSyA1c+Dk9vTDIWfgQEtJ4rCgtlDpRlz+x0DAbkRnieq1+1KRibsG8w7/tqqzqDERhdsOdzVHn6iPFNy9M2BVxqv5U2F9cYz X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?tUpJ/VR8juS/LeWi1fyCUStodZVf4wgaKq0ZNkDLEBr870Kh1WK05O1XXsbw?= =?us-ascii?Q?a8qAV76FSE7nrBhgSL1O/ULvgby/Iok599EuOOe06HXqh1SZY3DimkAZRO3H?= =?us-ascii?Q?JOalonJMbX1DxshRp6SaerfnPmLTSk2VhbCurNf2WjAUieO8X6D1ibbC2mx3?= =?us-ascii?Q?iO2zwrx4dpI9QZm/0pMKvuWJMgso5rUpuX0eII+ICjv/ahrNfTYzAyBF2HPx?= =?us-ascii?Q?Ih2jzorXd63sa0nkxRFlDCtxnJPyuACiVJ/665KT75Dj7nO51NjQsLmc98rW?= =?us-ascii?Q?utxvKvXKEwiDyPCT1Nr2fJF67+Lqa79GWRdxNqAeqXTlvVpB9JSWHsZbkrbr?= =?us-ascii?Q?vggGUS4EIQD4FfRrOO/4eWWfu1liU+4B4yZBZC2ceMXdtwh5dCQ3ZjML37Ha?= =?us-ascii?Q?GyJTWU/NG/TwP5YHnu0pk6xTOb/hDYwrIJpM1wmYcYDTQ5NQaCMLdVIwS0RO?= =?us-ascii?Q?lFa264tPApqDQa2yG+VOrR0HtCWyMrwpYOsYb4QIuooboKl0bI4hC46tRnTy?= =?us-ascii?Q?B6Jfrcd00Vg77EGXP5xGbh0rZaS+/fwUqYq0BBHKmRW0sGHfHFxUxp5jXOSP?= =?us-ascii?Q?3vjYOI3/Y6GFkpfO9TjF8e5GmdTGVjmNmpfvS4ZNmKuwGB4fBi3zp5q0FnlN?= =?us-ascii?Q?FOeVo8bWe2KlgXGt1Isv6tlDc9IqMelTvKmoHxOwwEd7ix/RPd5+5ouaM+XF?= =?us-ascii?Q?z8RrCBbR/uOeyqw8A5Pd76okeGB2HgE5AkbRyjyNElNbEUUK3z08WR8Efo9L?= =?us-ascii?Q?SUFs0CiZnPAFM+3if8EiOaDKz7sLoLYAWOIcZR7nwlwKCswzI118JtuVFNid?= =?us-ascii?Q?x8Z4E7AgjKCFcv2RZmkK3hqzNUbwxX4NtujsvTT2UPH1vFoql+m8nzKrAgXR?= =?us-ascii?Q?glcAwPNpangbfgkOcM0tRZ86Sr95ANaO89qQbVSsuQYTroMbPnPBBsxhdtcg?= =?us-ascii?Q?/eEAA8sm4diKfUiQvWY8qv8AWo5h26Sm2VvZhyjiMOBOMT5GJiE2CtHXXus7?= =?us-ascii?Q?M4wtlmImIzst8Kzyg8nkBnupkmXxNiw/ZPg3CsV6Do9hF1F/5OJ6KtGjkkpX?= =?us-ascii?Q?GcRAAw9bx/Fe34eslyoOyai/Y5FLbFKpyqdZzIE94CmgXIiAer22LYbvaUbV?= =?us-ascii?Q?gdWcTBDgxkWi9yl9Tw02VIHrMcC77kvb6UyBYSIDpDAbcxd9zQZz2UeKcylH?= =?us-ascii?Q?c2JAM85L/CGUjraQ0IDOy96rySr5w751aOsXfBQPYmGpKZOVsIRs/SwuvyWV?= =?us-ascii?Q?f1OthlZkFOosp8RfPL6ptEjWrQUeOVp47Jj1sSCHzRkf7oec+7a3qwHJ8rHn?= =?us-ascii?Q?NHQULoKK85gps/ldYAABrg3L?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: a4aede19-d968-42c2-1f68-08d97861ee80 X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 16:00:26.2608 (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: pAaEjR4+YlFYYT5la63Z8LuJBBPwoF0llqN8rupKKnXeNFzpT66TjziXKVBZeSU99Y6qrIJsmJt2s61Di8wq0WNYSWRYIPRsOY06lpodnCo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0101MB3065 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: KByxsscvxjUVCeeh2nUlk05bx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721642; bh=jfoYbuvICuVAP9m8D6jm3UmiRqdb7gkqwUapETUIioo=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=EgoapoDbzczsRGV9HvuJO7KpDpo0wayKTh35OsXIcWQCv1rZwerScF5gDQIsHLnl9pE aig32mujgQQEG8vio4I0kwarkvD1o9PLnct/TGqQx8834JyFwzHG22Z1p1Vp1xJkljp9r iLQmRDqzFCU7PBx8RABoTEZtFsP1JAgqYvo= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721648980100001 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: Quan Nguyen 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 | = 52 + Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.inf | = 36 + Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.c | = 705 +++++++++++++ Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | = 1049 ++++++++++++++++++++ Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.c | = 323 ++++++ 9 files changed, 2265 insertions(+) diff --git a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec b/Silicon= /Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec index 36b1249c7a08..a6c896231b3b 100644 --- a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec +++ b/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec @@ -63,11 +63,23 @@ [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 =20 + # + # 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 + # NVRam Pcds gAmpereTokenSpaceGuid.PcdNvramErased|FALSE|BOOLEAN|0xB0000009 diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index ce5f2c0dc4e1..5b40d552e2e5 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -93,6 +93,8 @@ [LibraryClasses] # BoardPcieLib|Platform/Ampere/JadePkg/Library/BoardPcieLib/BoardPcieLib.i= nf =20 + OemMiscLib|Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.inf + ##########################################################################= ###### # # Specific Platform Pcds @@ -104,12 +106,34 @@ [PcdsFeatureFlag.common] # gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE =20 +[PcdsFixedAtBuild] +!ifdef $(FIRMWARE_VER) + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"$(FIRMWARE_VER= )" +!endif + [PcdsFixedAtBuild.common] # # NVRAM # gAmpereTokenSpaceGuid.PcdNvramUuid|"$(NVRAM_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 @@ -118,6 +142,9 @@ [PcdsFixedAtBuild.common] gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0= x04 !endif =20 +[PcdsDynamicDefault.common.DEFAULT] + # SMBIOS Type 0 - BIOS Information + gAmpereTokenSpaceGuid.PcdSmbiosTables0BiosReleaseDate|"MM/DD/YYYY" =20 [PcdsPatchableInModule] # @@ -157,3 +184,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 06c8a4fa1b09..96213edb2676 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -341,4 +341,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 Platform/Ampere/AmperePlatformPkg/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..87b9123df856 --- /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] + gPlatformHobGuid + +[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..73a601b0df08 --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.i= nf @@ -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 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 + + gArmTokenSpaceGuid.PcdFdSize + +[Guids] + gPlatformHobGuid + +[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..376075fdb0af --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/SmbiosMemInfoDxe/SmbiosMemInfoDxe.c @@ -0,0 +1,705 @@ +/** @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 + +#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 (&gPlatformHobGuid); + 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..af3cf5630591 --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -0,0 +1,1049 @@ +/** @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 EDKII\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" + +// +// 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() + +//------------------------------------- +// SMBIOS Platform Common +//------------------------------------- +enum { + ADDITIONAL_STR_INDEX_1 =3D 1, + ADDITIONAL_STR_INDEX_2, + ADDITIONAL_STR_INDEX_3, + ADDITIONAL_STR_INDEX_4, + ADDITIONAL_STR_INDEX_5, + ADDITIONAL_STR_INDEX_6, + ADDITIONAL_STR_INDEX_MAX +}; + + +// 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 + 1, // 1U 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 +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; + + // + // 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 (); + + /* 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 (&gPlatformHobGuid); + 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..c6048b399b5a --- /dev/null +++ b/Platform/Ampere/JadePkg/Library/OemMiscLib/OemMiscLib.c @@ -0,0 +1,323 @@ +/** @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 + +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 (Processor= Index); + MiscProcessorData->MaxSpeed =3D (UINT16)CpuGetMaxFreq (ProcessorInde= x); + 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 IsSlaveSocketPresent (); + } + + 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 (#80721): https://edk2.groups.io/g/devel/message/80721 Mute This Topic: https://groups.io/mt/85631202/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 Thu Apr 25 11:35:07 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+80722+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+80722+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721645789445.59642743223117; Wed, 15 Sep 2021 09:00:45 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 42T8YY1788612xz1MtwemGfX; Wed, 15 Sep 2021 09:00:45 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.97]) by mx.groups.io with SMTP id smtpd.web12.10059.1631721644788694239 for ; Wed, 15 Sep 2021 09:00:44 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DB0mSD0BT67AB4LPRvt8el0L0v9eqy9tbEii1IZwn6HAiwN0nsbiBlNPFvz+5pt1FQvdrjYI9UqWFXbvOggqI/SE7wK/OvSuErLtbypqmWoRULVkiBGI2I6uc6cVJA1ahWx/PaRVNmOc75C8//KG6vVV/HxpWrfgqrc5X2EsxW0ZuMd637q0OTBer4DQ8xHGhnC6bBxk2jnsx2hqyueOqFXMOoxhyhk5jM47l1P0C1oqypHq49iWV7fZgt9goweAV8rVk6Xk4O86I9Mpd9NHbrJ73xnbgKixeNz0iqqy+0cyXR4yYLwrqnr0Tsc1B6yzdL9eQaUBf8iYcuhXpE07Fw== 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; bh=W7Qeq91xyhLWzO0sccTZ2CwCP0/aKHFt3TbsFElgsC4=; b=NpFHjSq9okrtxqYkzEd4TwDYCspi62B/iRdCF9ARWWk8QFKSvmgJu/Bu5eJNDGmhugJY6RTVDaGkOMJYGeMeP/9IN5FJm6viTa3w++u86e9ZVrmBTrNoLRFifIXxZOMBM4XfUXl9Jr871ovMstig2R6v3gfqw+XuU1wOK+R60PMIS+M8TT6ZKyOKG+qs0Y4lJVDxvQ5GP169kSfGkkEG8DOHqIKEeVu19PogFrWN6zYuw5oA90lDCbfPYKIBUQmXpsm7Gw9kfau1BeGvZmpLjRGhvDz9eZi48q2h9F0yebJwSimOvi8NorM+p1H1cGeIgzMgFIYoSV/jiI3DNynE+g== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR0101MB3065.prod.exchangelabs.com (2603:10b6:4:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15; Wed, 15 Sep 2021 16:00:30 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 16:00:29 +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] [PATCH v3 21/28] AmpereAltraPkg: Add DebugInfoPei module Date: Wed, 15 Sep 2021 22:55:20 +0700 Message-ID: <20210915155527.8176-22-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 16:00:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bc84d40c-3088-4590-ae3a-08d97861f0ab X-MS-TrafficTypeDiagnostic: DM5PR0101MB3065: X-MS-Exchange-Transport-Forked: True 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: 5/uI/BVJCzO5voHXep1XJK4wjfLHT04TqTbHKH7oWml5cut01rCwGsO9BerqGMURUUavCpaPJUzAdw3ojRPU3TQtD/nTkAQP9cNCLWzwBUqb1tNmdlz/9O3w211lsh2hdbLg6H7oAHzBlCITLpmf+lM8s2wp9aOTuJSY0J6ja7geHsiX7KQNEB04V9Kck1lANMG95k23KsrrTWe5imHvYocj2ZjOZCGT/9/izu8ZafT546rNIIjhxl5frFfTsicpKqPYwoGhl20fP/1LG4scbibnE70eOH6uJzoZBZ3cohaBOZcD2ZjJhFhMwGl4fcchh24Ns2lUoG7mXygj+ftBG4VoP6+MuqOn2kswsXjI/fdVHRAf1o3aXxZvvO83AjrsAWSlEnhjhnLWgnfX0wsHSex0TH9ixj27+zNM+gWONa8jHUWhUggKo0SUGXR/zUOLB1OmORuFOWky8EeSkTezsvdAA8i21lQ4j5cedKNRV3wGEjl8GtMvXQPeDCUGv2reOMlbu9TUAeYPDGah5DuWnfJqj+W7pg9bB86FOhhZCsuxHtFMLODNXJkc5+VgV0fRaMGwKC0DG2KwCm76L8b9WPjBKDfpMgqnF3k1KfK2yqbIEFLynXlHFl2EL0Vq//WhIEsGteHnt1u+Eck7c8HUiYGjI+ztaIiEQxMxXFEHlZtouLe9Kv4jS14zmZHIZlwjzFg7fsjkZp1UcUdOIrKxMw== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?k2sWw9t4MtsPtD1GYW4DyHyHJpZH99OOprnhnxihMc06LN1VHu9/27QWa6Ht?= =?us-ascii?Q?1qNI/Mc6WNYJXIbOsVo4KPUHae0MApQvefZJtlTH+2wJCYj7nR9u1MFsvcWc?= =?us-ascii?Q?uNQ3iyUYDc+p7vwdspEI2zSxvuIl/ZcfOn5+ODDWLteHXkUlzsNH1kOwe6hm?= =?us-ascii?Q?Qeoi9FwRhyct+hffm/QC5XnfkfAFNTx2zz1tFD6DlwML4VH6ANGMMv5zJ+aG?= =?us-ascii?Q?6vE7Pt3mwAXV4HIkGLMlcZWf4C0HZLy64uw2PDvGUdaGbjNPTqtWLCk2jXfi?= =?us-ascii?Q?yxYLbHLtQKUQ+N2vgVGs8b1+Fw/4cGLpjeII6q/GdJBX1Wp1e9VToJLZn6vK?= =?us-ascii?Q?saz6/r6Gi4Nl3+vjwuYQyg4KLdRXaES7hsbLoujVfG3j20a1ql6mm0sBp6e4?= =?us-ascii?Q?JD3nfuAkCqoVjQconE3f25ZqCsikil+gu6HMWGsbLcwy5MoMyP2OCRQ3WmiV?= =?us-ascii?Q?nm/NSnhjdp2TuoL8/NWoll9pOWtGQV46NGOq0gHnPPxZv2lKmbSUR8c94par?= =?us-ascii?Q?gycFAiDTr5D/CeE67mPLwotFZTtUgawdHrJmbTI9MLnFmlQfEhq3Z9m8U45g?= =?us-ascii?Q?72IW4JzARbp2tLDBwU/ZGv98fXfW1/uncMSDww1sb5zm7Yu0fkUQW4rRmbm5?= =?us-ascii?Q?g+wW9Bg/gx/XmwGM8OFfRlYYpH7zeudzmsrtf5/HBZjAaoaMjmiKy9tG4i70?= =?us-ascii?Q?d8JSnd5XLZPCoISqYZBrQva2uqk6JTf1LQskyqsUCK9CMGw4Ot1RdfwXolo3?= =?us-ascii?Q?k9Hyhn1bYnBCFMKMJ9CLcUwGeCAk/V7KVS5NPOQN7UAlkNtych7Q8GK6O3EO?= =?us-ascii?Q?OPQYNYdcuOnlgHM+vLYn9H7RjTmQYMIS8s1tG0jGa4uU/nkVx7q/zaG9MW5U?= =?us-ascii?Q?77up1ftsBpjSbccscuvqcVhy2Qnjp3uFPGXVzoat/lPKALJOWElbFHP6NS8n?= =?us-ascii?Q?jtyCMKMLDl6ErJaiGi4z6Yx8Dy+WYtPh45QLXGVyWAvjhQ1MPTZ6ImxAs7r+?= =?us-ascii?Q?+Udcuho5bYV1vtfb4SaVZwASW0xpdL3xh3MxC9SiJxaPjrLCOceegW+C2wJ7?= =?us-ascii?Q?0hdG4lbdfdDT25ck4VbbI3QwmMdDcjGZ+dWOMgYdaGxhwuIbxDsofWMFx9EF?= =?us-ascii?Q?8hs8RMeyWKm6z1Pjhzfeb3B1uuJm0O97Opykgh5c43BwAApWbm3bsNhO2wda?= =?us-ascii?Q?NgJsidwLYrWFbgmroHRqLO2mN4pkZvnpUE5dNWkxxgRAAdO6aSO5WbkA7agu?= =?us-ascii?Q?RoSD8IQAhHGQjqT2cMr6Z/FETCWx2IrHTbMFnANRaokqd3LeI2NKjz4Vt5pv?= =?us-ascii?Q?LUU3tr3AVmQ4RCNKF5dPjZoD?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc84d40c-3088-4590-ae3a-08d97861f0ab X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 16:00:29.8617 (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: X0GGxnBo0wSai3SBwD+a1DZvd0MHkxlxqQiZffB8jkatgVx/mN0P3X7cVe1Xtq8oicZ1L/vkUmLcBiOchFl7+DZEO3TxEW3b+i8sO6dVcmE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0101MB3065 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: 7MilqJMhqNzTQVdnagj7pVn1x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721645; bh=/8ePzNL5s0J0tZxGgloJRtk+8aVdFVnn+Q7GbiMB90o=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=qDZzjjRkzz8hkTQbs9jfinq/FL/v8QmZIlovpqt1mSdj9BJUePaTdf9aNi4kOEsYzlT 14zGN8a5HM24jxyfJDNOo49f5VfA3A0xqVXDkjkQtJW1kUUrYEv338Dfj53/YsEPBUfDk O4w0n4z9xVCd0h5Yw6dgVtkG33erDKqd8Pc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721652325100005 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: Vu Nguyen --- 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 | 210 = ++++++++++++++++++++ 4 files changed, 256 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc b/Silicon= /Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc index 459d06c33c02..aadbf6dae83e 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc @@ -543,6 +543,10 @@ [Components.common] ArmPlatformPkg/PlatformPei/PlatformPeim.inf Silicon/Ampere/AmpereAltraPkg/Drivers/ATFHobPei/ATFHobPeim.inf Silicon/Ampere/AmpereAltraPkg/Drivers/MemoryInitPeim/MemoryInitPeim.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/DebugInfoPei/DebugInfoPei.inf { + + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPor= t.inf + } Silicon/Ampere/AmpereAltraPkg/Drivers/MmCommunicationPei/MmCommunication= Pei.inf Silicon/Ampere/AmpereAltraPkg/Drivers/FlashPei/FlashPei.inf ArmPkg/Drivers/CpuPei/CpuPei.inf diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index 96213edb2676..56a54b307f04 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..1f50f811f273 --- /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] + gPlatformHobGuid + +[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..ece9295864a8 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/DebugInfoPei/DebugInfoPei.c @@ -0,0 +1,210 @@ +/** @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 + +#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 (&gPlatformHobGuid); + 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 (#80722): https://edk2.groups.io/g/devel/message/80722 Mute This Topic: https://groups.io/mt/85631205/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 Thu Apr 25 11:35:07 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+80723+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+80723+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 163172165247869.80090315776579; Wed, 15 Sep 2021 09:00:52 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id g494YY1788612x6Ux44rUTMo; Wed, 15 Sep 2021 09:00:52 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.103]) by mx.groups.io with SMTP id smtpd.web12.10066.1631721651496365630 for ; Wed, 15 Sep 2021 09:00:51 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hmW67AsXxvgb/bi5Qz32MqiLP3e4EcYxT5I9UE06n4ZKO8kx7TZmzRD+vVr+Fsnq5gTMY48v43ew5U7pImYqc3oftIYHNj9rOQriOXiUCZzCKJFq5O3FNr+mz+Bj7Cdw3e/Iw0+dSTvCIyooOKx0YfpnrP5BDjXK/NGsQ+23esqk0wciczO5flQ9NSMKPMNVpP6YxhK03bnZoCPHMhq6vMG4rKNAUiBcCzSrMg/ZZRqvXOwOcGQhFjTqVXF18ZLg4mKnltGApAnACa5Gl0RYQ2MJVRYaZwwSA3av8uDY9u/53SjpjC7IKJ9SV2HQtNZVQA9Z4uzFWE8K4VJD2cJuuw== 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; bh=VjXGG1ZbdJG6uKTZzesy2iYrOpu7T5z+s21rbfEH2ZE=; b=L+Z2hfhF2OXoDclYwWykkBZsZuzia249t9M1tQq+AMEkilhqJmZDLW9W/U9oe/QmF/pBPPRyInJHiNpqn+5yNl4I161wpMv+SsB3ypE7eG0Q2j6zK5KJSd8uNbKXqTqknPlXTImGz5cRGXw/ENOsRJsy2xviBBTCqLPAI7e5cWLUd1WG6vu4cRFe7oWpZS3LThZi7ETv7CBLamKUI7o2/4m24DCWtbmZIDmvuShfx+qMhSDdtKXA1AFc5wZvloPd5ti3pyr44sxQ/w5kNDvrFNgpvWEm5P921aq7rMTRTAywOtvE8zXrOa4XoaJf0EnBWg6Lz3b+CHg3LVo0VUOITA== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR0101MB3065.prod.exchangelabs.com (2603:10b6:4:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15; Wed, 15 Sep 2021 16:00:41 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 16:00:41 +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] [PATCH v3 22/28] AmpereAltraPkg: Add platform info screen Date: Wed, 15 Sep 2021 22:55:21 +0700 Message-ID: <20210915155527.8176-23-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 16:00:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e394b3e4-609d-474d-5378-08d97861f2cd X-MS-TrafficTypeDiagnostic: DM5PR0101MB3065: X-MS-Exchange-Transport-Forked: True 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: jjIv6NLsJ06S4MdqBLCasqze+CvVYajb2rJvPd3coYOg2Sjc4Zszg1JOIhR+P17E59cs/k0e1hMBSe/FdsLDEfdJoYSq2eBmonDAuAdbsi+igYLUdNRveF/RSUzm5URbpGlnGpSlPPK41B9qe7mxErhvmohFJCSFRnWj0BDtHvtruDAZm8IbWDqQdS8A1nAvnaIzM7xy0biFvgrgmzuy4q3eh8TwHHEmt2ojxcqoneA4aMOFyyepof40/V9HV9cFK5vvPuuGqaUO1rfTLXSUMA3YcHbpRS+sA5nYO3jlR+ksygQsZKwwJp8eCVqE2OAyAE/ZAITrDDPTOI7MYrbbenxNOQ4PU29Cq+UJwbfoAsAL76lm+aL7p9kRbDl1EltgdW7w3ImoOj45AZOUgOsv/SRbEr3hu009Iq7wr8wEtQHAWQQTYWSeIftA06ApfBesxmGA8ePbeLYXDckMOhsddznm3vdNv8pKgYCN8t9eE83mkWwAy+cYs9z4N6WVEAoVSaBiMxTAmJJPExdNiBuj3b7Sz+xU6p4nKOYTu6ua//QgDFXxD8Y8MQxcxi0YmrW/CtmEX/Eg8S5mE8h4bBBKJ1l4+os49yIapA+soQ27WSjJyeL4NaESeGc05uQsC4GYqwfYKBmBT8Va+YCYIk4sWJiiXQm5fUVzUU7ud1JVmIsZPoCOmPHJBNP13XG2yh+VmbJIgNMdqvc2drNKyyc7IuFR7PNt2f38cH66EzTHxtA= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?NbYnxZFbZQkzWhTqnFXk+JuP87VRnI2pyC7v60I7Tg3FJQYRHs51niu9E7Ry?= =?us-ascii?Q?nbjx/+R5Vp+NUEukWRrSDYX57NbPcN2eY1lT/kqvU+eQXWOOUiBWr8LNv0Mr?= =?us-ascii?Q?6cP+nN53ZhxEpEoJz7xo98vXn7hOrnwtEHrFGzD9E5cCDIEnlkTUbik3cYqW?= =?us-ascii?Q?dhT71+uieBKDjAkKOKHZmwzb38SQ+xT6ThBEHln1g6fpphno9FquHcgMYa6O?= =?us-ascii?Q?/Ux222r1LrQjpAeib708M5pjnrXo/1RtWg8yVoM2qZcFTfSx7q9KVKUILQ81?= =?us-ascii?Q?YWWFpAH2n8or8TlGOXhNZnvCZMSpBpvCdK+KZxMuxbkCo2kXPsG4osD7gsUE?= =?us-ascii?Q?RsBYEB6UCRof69ubqx/Jv+Lqn8GikI3yJMGxV95PoFcPN4rVrK1DWKdvn3dI?= =?us-ascii?Q?9VQtRniyqltKSQAgY+TbjodRi5AV47oiWjTkPhoSF4MNYMb9evUY6vvVusiA?= =?us-ascii?Q?EXuYnL+pHDIoH+Y+cIHiZOx+ShhZjpJzESBi69WjnAX33VDcSIm9NJlHGeEx?= =?us-ascii?Q?BTNMSVd99lsVtKS67W2k8Gi2td2N71BAWn24GKaRY2fTh5J/a+YWVckehxUp?= =?us-ascii?Q?23Y8h9+BNq8yl/yGR1gWIaoeZpEUDDb/8+WaZ/EbB+a64R8o+J6wppmWCZCl?= =?us-ascii?Q?M/6gUjcEZaFH/FPshqXQGWB/2Sx/w4yl5BembP8PAA8JK3HmtZ2GaHFF50wj?= =?us-ascii?Q?oCn8AHP5Y6hk7K98mAI/923+naD9cdiieJNeJUr/weNnO3XTjkKGCMVtR+Mr?= =?us-ascii?Q?NRLrYnSBfSjJaU9FwpZKrGiGM2REbfQI+Vvr9F1NSGs3kR+B/K35SaRcZTBu?= =?us-ascii?Q?A0m9iNtYjPqAgYU8b46GYWvqWt5WrZH1r+/2Z29ayN4Jqw+49Mwnala+WaE2?= =?us-ascii?Q?yQzPK6FXG2Ckdj0urNWl5E0fvhYiOcUKnOCvvKCxmKBnJqJikRAp6grWdocl?= =?us-ascii?Q?Us5ShZnvQLH/ElcWT0Bk/Vp8FfZaRRfYc+u+t2DLVyv1a7eWbHkDuppQOwIC?= =?us-ascii?Q?QlclQDjQzgiDR6cQnAGRDzr569XuvkBVSmTkub84QIZezWM3hzBof4HNg8Oh?= =?us-ascii?Q?Bcle+a3+SCCrbNs8QnoIet4JxcxPKICrob2/9BqYQeFJAlqslwnHceI7Z8YQ?= =?us-ascii?Q?y9tbmXsUBvWPvhjJMuUF53AuDU4NaKFh2CBBIdoKnRdMErtxFEJwGvBzHxrT?= =?us-ascii?Q?OQnuk0FIKnaHH9Mp+YGkNcrCFmlwBcKY60/noApLiVevTj8P8gDgvRUGqJkM?= =?us-ascii?Q?7ciS4Fmr6FQ3wuP0gVtZhW3WXhBBKUj22qIyj0NfCQN5Ue9E+NF0ri3zXTS4?= =?us-ascii?Q?YyW7qOEURL7Xf40+g8qQokCD?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: e394b3e4-609d-474d-5378-08d97861f2cd X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 16:00:33.3957 (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: z3l4KHnF5KqikVXOyTwkj6SRoaGfrw5IKwTE65Zgtvi2YaxuSEFSyyFe4S71d5oH1iqu4HhbgIy888VcXBa+aKed2w1fTeM1UXIRgaazeOY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0101MB3065 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: FkJYDDZKWmVuFOqKFVMwD8Ryx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721652; bh=6ZT4oO94fOUxhWkwyJUMigbiMf24j3qlBUzJdZ7M5v0=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=lTlUP2tSD7x8197uBZfCsg/79fCqbcOu10FjHxoYe2OXew4MLgsFAQ1hk6rezVNZ8Ti 4DGVzfYxQIWEZ6FXzlmbNf65zWENYO5a0lQYnjAOEUdwT5ySy+tMn+cGx7IbIlUSbZm0P XMRvrlW0w6An+e35wjvXIZkNHDkvMjI99fQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721658349100001 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen 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: Vu Nguyen Reviewed-by: Leif Lindholm --- Platform/Ampere/JadePkg/Jade.dsc = | 5 + Platform/Ampere/JadePkg/Jade.fdf = | 5 + 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 = | 391 ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoStrings.= uni | 56 +++ 7 files changed, 643 insertions(+) diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index 5b40d552e2e5..f723be6997e6 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -192,3 +192,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/PlatformInfoDxe/PlatformInfoDxe.inf diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index 56a54b307f04..c54b46f95ad5 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -351,4 +351,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/PlatformInfoDxe/PlatformInfoDx= e.inf + !include Platform/Ampere/AmperePlatformPkg/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..a55983dd738e --- /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 + gPlatformHobGuid + +[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..6308ed4b4f3c --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDxe= .c @@ -0,0 +1,391 @@ +/** @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 "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 (&gPlatformHobGuid); + 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 (#80723): https://edk2.groups.io/g/devel/message/80723 Mute This Topic: https://groups.io/mt/85631208/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 Thu Apr 25 11:35:07 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+80727+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+80727+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721656122552.2338921901683; Wed, 15 Sep 2021 09:00:56 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id N1zqYY1788612xwMs7mHwOxf; Wed, 15 Sep 2021 09:00:55 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.119]) by mx.groups.io with SMTP id smtpd.web09.9901.1631721654823020684 for ; Wed, 15 Sep 2021 09:00:55 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JD99Nf6FTt0GN7ZxnCxRfhpP8+IPjao0Gc9n/SRePtH1X2RxiExj0cMK045QO0xgQKx7rqHcUiyXtsDrrDzrYO2f8A/Vs1wpt6IA3oDEM/f47NWJUjRvmUBjqFKziBTs9Ls+lx4lFsuJFWSgdWz3B5RKeomDsh8+iW8wxnvt7g673ovw9T3XE/St7RSyGOuR5DMzu5hya2QvKXuh+9efZIEHR9fTB1ZNFfh7549iV0hZu5NzQj23VkHppo1oX6OeFRd0F/9hhd2zFTlMAjgRzWl+HCuU55UDNggCrvxxlFSOHK0rVk9vSEuYg3IPtPv2FpK6/rBYhzqstHjdZFwStw== 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; bh=FEl9VUcSi/6/kQwKdtJsVOUtgA0DOi/lUuJY8mysKVo=; b=XznJjA9yR283kRnxrWRvLMI76IPSxarOu2jtXYxJXvP2j0G8YnidDjV6JH/68Yg8o0DYwdpPV8kHH+gmNIV44Op70Pk/ku2/UXKjTiRFAlL8ms0s/2sAs0JcAHSKz1r5FKrQ8vSpCkAWJD7SxmvK8jR32bT7ivIONod3FS5z/A4PGEfUuxFYr0xh9I9Sr3j/8jcqxGEPOoLqtHHpEkEnAt5wuvdGXH6VCVsU9un8eSO8sQUOglo3o9ZuBT7id6/4aRFWDu/RuHMztQGn18tOCF63TIvFC6SmzOepo9tpnAdbSn3TcEOW+dKmQ/H0E823k+YuhWsAJCFXGnKWntraNA== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR0101MB3065.prod.exchangelabs.com (2603:10b6:4:33::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15; Wed, 15 Sep 2021 16:00:49 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 16:00:49 +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] [PATCH v3 23/28] AmpereAltraPkg: Add configuration screen for memory Date: Wed, 15 Sep 2021 22:55:22 +0700 Message-ID: <20210915155527.8176-24-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 16:00:33 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7128846a-a34b-4252-8819-08d97861f4ec X-MS-TrafficTypeDiagnostic: DM5PR0101MB3065: X-MS-Exchange-Transport-Forked: True 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: 8++M+hoERK1sFYNUC5jOtrSj9TQYNFlxGrDJtAkNNq/yWTsZXz0HZrKhks5SbwUQ+cxynsBr05sIwxbtEKBkiIyvEKxyp4/Ey5LQ+bo1F2O1pfJx3R9LXjd3/UVD1v3LpRhz1OsqPTNaIkDaJrsSPW6+hqfRXA4zodae9IH5mWOIB0nBUsWgy2sDPn/qpzAimxzeTZu5YDvxobHHmEE/wgd7GBqHtAC4DDvnWIVtMDGE2CsYo6MhKeAk2VNTO9toIc7DeeQf2x4ZmLfBvBx23v6p2g08Sx3yw0SJm3LBI0JZf8FyAALG6vYwveK2i4BWk1IrcCpQGB3AAHAAdP+cwvEXTZ4JRGAJXBxaP778zQpZqghF6HVCCm7MBdEZO3txVsJXWPQG8V5kZEy1D8xssIXEB+pWD5wJP2Ex7K5RBylKp85mexDKyRaDIWEaTR/z69V0A07Pud+8KtloaD40WqhyDNw3blish4SNw1pV9oQsi+ThhUizmN1no6lYNVMXO87DLQfzrZAbmVycytMFysLSpROuqs2YklD7xZFDP7WvSM3DHh0XCZgZb8QKe3FZOi8IZn5ZkUhX8m/RSetBCctFwTAEd5oyXKNuyr9s/kDPpo1+Y0t5dOEUruSKi0ANSfuZbTCYO3vJ6JUwtjASu3mM5al8NQ54eYdT51QAVbq70PswIaovGFh1BqhGakqAt2juniVv0nreD4P8mAL/RHCuZrALtOIEn83B/uCA/p+nuNLuVHsPX9/ApM6ZOJq8 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?sASj6a/3MD3/EgFTxGddoBaf0UWoxoCA5/IkwcyGc1r+tv/fJHY59QPZqZgA?= =?us-ascii?Q?1vP8Mq08cO5eJZeMmEoR0NOdeViY8mxkgb/ZjpG0KDoQTq5X1dA4FbyUHVKL?= =?us-ascii?Q?3PYxB0T0Ln3SeOZ8OXeL+tRgXV30hnPhJgW+YTTFdaN8Sfjo7w9LL0iuDZlk?= =?us-ascii?Q?w2ITisQX6CT9+uJe5MIBwWdz3jgh0rXHnfVdLmiG04cdZQnEoGRKeHmZS5vL?= =?us-ascii?Q?eZjR0HIvsHYvTo6hIKOA1Fj9i8u5aZL/qgOYZha1nlxKrelmyK0P2PIndsFC?= =?us-ascii?Q?2aJgT3wqOeO4EFHtuGS720QR0PyFbVT7pjxRsWWQp11I8smUGWC9huscD3B5?= =?us-ascii?Q?jQYfVqtVRaKTzkNgS3goQPnIDncizMrZJk2gcrDVLed/2VuyeAt4kgfxHw5O?= =?us-ascii?Q?S6sXQUHB35UBbeeZYVVUI+nwQBKz6Hzdruex7PdhcMuZ9la/sEKJJ6BG44yX?= =?us-ascii?Q?x9UavYho4qCzzZlfFkCv5DJCoMmcSJkLlYdkNJNzGVk9TCEPBT60XduImEng?= =?us-ascii?Q?b3MUiz8dVASPEpocmPTu6yo2m8EDKlrqM9acdx7Ib/KPKYA0exv1SzH0BmYS?= =?us-ascii?Q?XTipYwLypqoDjvDirD0bHjqtoAor0EWvsW0BSJmxAyE5pgJB3YlkQAKlRfpL?= =?us-ascii?Q?At2gAumg657cLUvvo4Abvt0ixUaMlubPb7KOPSvp2k7l3f3kuCKwAg00PVDF?= =?us-ascii?Q?q7clPemVqhTS/KlxUsYO0xtR/H9H16zm/VEy3TDzZzZqOTxkHAmyd84I7zip?= =?us-ascii?Q?vJ2Hd22f9hqArAVILr66lm88ORkE6/jC+MEfkHorTYFQD9gaEAApfxGk/4Pw?= =?us-ascii?Q?67usMX1QIOHpxZmgSW9rsHie0IxaBMqqtYElu6i7jMp+++NqVO9yHr2JzhP1?= =?us-ascii?Q?pihQfof8rU10pMzt0sTSaLv0KwtOngk07w/IXVeKPvj4X8YABa1LQ3Buap5m?= =?us-ascii?Q?Fop6zzMa+fohbx+vGPv/yUw82iGOVbk+OgnhAv5OPzWha3LIV/lztJzdDC8D?= =?us-ascii?Q?jxnHEC94bj29iU70lusBh+3X8fkUbuajiU3OtXukfQxoE7BVbu1f5JU7G6Zi?= =?us-ascii?Q?Vh+MKQI+jubOjDnLim3m7l5FV9T9EPOcJFNS5T09ZIR+B7+bdmcQIheqXqsR?= =?us-ascii?Q?ETZeOIG8wqJwcWaDFANm73i27cnIJK4gYP6y42LsB/8ECIGK0ju7lKUzmHfK?= =?us-ascii?Q?fHMHDddEkyHgyYNjImxZNHFdDA+RkaiTOtYHApowyxp3VaBqTihGOFvthS8b?= =?us-ascii?Q?RD0IR6vVcWcaBa1jRhtWADfWTCQV6kv5ZpikXNgeMdJgh/fnngRVPvCMORxa?= =?us-ascii?Q?KXt4dL4R5f3+/mtTdYrdGZFK?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7128846a-a34b-4252-8819-08d97861f4ec X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 16:00:37.0346 (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: AbrYQkSXTF2T8jajn+a/Bgf23ulU1rfZQjxYW1OnXhOfErpa8o1pWpxZe76lX/amUXTT9rOfxKC5o7ich3sS5Jl9Wcczfn1RvRG5+9T0wl8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0101MB3065 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: uXIHGaJayE6tBomigZ4Sdtkyx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721655; bh=ESWJZQ2PhwpNwX8lRcXJvKlOJjDj+kK0Jb1GIR0Ty5k=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=OxU+9ogZvgUdQYqZRDsKbRfVFJTLOslRNapXcQ5jkY351Pc1K2fNqojH2X+XivP90bf GFLVcC04dtV70ThT1G+qOr8Jmpzag9xyDuZYxAncwF2h3qdzRLbyHE12EvnhfrWgzJw5k R9VL0GAv8QfGm20eM8vLy/07pOHYe9MNKOQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721664605100012 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: Vu Nguyen --- 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 = | 170 +++ 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 = | 1325 ++++++++++++++++++++ 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, 2141 insertions(+) diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index f723be6997e6..5fc83745cdbc 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -197,3 +197,4 @@ [Components.common] # HII # 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 c54b46f95ad5..6fe023025034 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -355,5 +355,6 @@ [FV.FvMain] # HII # INF Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformInfoDxe/PlatformInfoDx= e.inf + INF Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoDxe.inf =20 !include Platform/Ampere/AmperePlatformPkg/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..fbb2ac9dad21 --- /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 + gPlatformHobGuid + +[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..4b4b498062c8 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreen.h @@ -0,0 +1,170 @@ +/** @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 +#include +#include +#include +#include +#include +#include +#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[]; + +enum DDR_ECC_MODE { + ECC_DISABLE =3D 0, + ECC_SECDED, + SYMBOL_ECC +}; + +enum DDR_ERROR_CTRL_MODE_DE { + ERRCTLR_DE_DISABLE =3D 0, + ERRCTLR_DE_ENABLE, +}; + +enum DDR_ERROR_CTRL_MODE_FI { + ERRCTLR_FI_DISABLE =3D 0, + ERRCTLR_FI_ENABLE, +}; + +#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..c83f489f4078 --- /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 ECC_SECDED; /* 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 ERRCTLR_DE_ENABLE; + VarStoreConfig->ErrCtrl_FI =3D ERRCTLR_FI_ENABLE; + } 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..3a1a5840db9d --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/MemInfoDxe/MemInfoScreen.c @@ -0,0 +1,1325 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#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 ECC_SECDED; + break; + + case MEM_INFO_FORM_PERFORMANCE_ERR_CTRL_DE_QUESTION_ID: + // + // ErrCtrl_DE default to be enabled + // + Value->u32 =3D ERRCTLR_DE_ENABLE; + break; + + case MEM_INFO_FORM_PERFORMANCE_ERR_CTRL_FI_QUESTION_ID: + // + // ErrCtrl_FI default to be enabled + // + Value->u32 =3D ERRCTLR_FI_ENABLE; + 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 +MemInfoMainScreen ( + PLATFORM_INFO_HOB *PlatformHob + ) +{ + MEM_INFO_SCREEN_PRIVATE_DATA *PrivateData =3D mPrivateData; + EFI_STATUS Status; + VOID *StartOpCodeHandle; + VOID *OptionsOpCodeHandle; + VOID *OptionsOpCodeHandle1; + EFI_IFR_GUID_LABEL *StartLabel; + EFI_STRING_ID StringId; + VOID *EndOpCodeHandle; + EFI_IFR_GUID_LABEL *EndLabel; + CHAR16 Str[MAX_STRING_SIZE], Str1[MAX_STRING_SIZE]; + EFI_HOB_RESOURCE_DESCRIPTOR *ResHob; + PLATFORM_DIMM_INFO *DimmInfo; + UINT64 Size; + UINTN Count; + + // + // Get Buffer Storage data from EFI variable + // + Status =3D MemInfoNvparamGet (&PrivateData->VarStoreConfig); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D EFI_SUCCESS; + + /* 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 + ); + + // + // Initialize the container for dynamic opcodes + // + StartOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (StartOpCodeHandle !=3D NULL); + + EndOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (EndOpCodeHandle !=3D NULL); + + // + // Create Option OpCode to display speed configuration + // + OptionsOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (OptionsOpCodeHandle !=3D NULL); + + // + // Create Option OpCode to display FGR mode configuration + // + OptionsOpCodeHandle1 =3D HiiAllocateOpCodeHandle (); + ASSERT (OptionsOpCodeHandle1 !=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) + ); + + 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 + ); + + 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 + ); + } + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle1, + STRING_TOKEN (STR_MEM_INFO_FGR_MODE_VALUE0), + 0, + EFI_IFR_NUMERIC_SIZE_4, + 0 + ); + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle1, + STRING_TOKEN (STR_MEM_INFO_FGR_MODE_VALUE1), + 0, + EFI_IFR_NUMERIC_SIZE_4, + 1 + ); + + HiiCreateOneOfOptionOpCode ( + OptionsOpCodeHandle1, + 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 + OptionsOpCodeHandle1, // Option Opcode = list + NULL // Default Opcode= is NULl + ); + + // + // 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 + ); + + // + // 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 + ); + } + + 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); + HiiFreeOpCodeHandle (OptionsOpCodeHandle); + + 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 (&gPlatformHobGuid); + 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 (#80727): https://edk2.groups.io/g/devel/message/80727 Mute This Topic: https://groups.io/mt/85631213/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 Thu Apr 25 11:35:07 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+80724+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+80724+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721654691510.4234306131234; Wed, 15 Sep 2021 09:00:54 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id QDL8YY1788612xVscmBW1Z5t; Wed, 15 Sep 2021 09:00:54 -0700 X-Received: from NAM02-DM3-obe.outbound.protection.outlook.com (NAM02-DM3-obe.outbound.protection.outlook.com [40.107.95.105]) by mx.groups.io with SMTP id smtpd.web09.9900.1631721653417356000 for ; Wed, 15 Sep 2021 09:00:53 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KUIzKgzoka7vRS1OAv4Bwjnzgx61nSk3d4QRoPF/mxKjlnT1JOMFrKFx0maRbwsyFnY7UdxXvHu0KeY79NwDgTo6P/KRhZICmYFmkEabL2rGYG7EZ6G/9l8UbBO1lEyk1vY7sgWfDCTpA8ExqhmxsH3tBTwoziAts8uCMyv+7iQb/363UVpFrr325hhVTqD/bOS7+A5PeMqO9SsfNhUKHf/JhZJrrWbTx6AQYvv0KT5QtmCWMQnwR0wx9B7PHd6o2lbmPSvy7qRb3o90EeM1udvwUGPFwoWbqZ9YtZv7m4UAtTIuwgHeOl1VJTVefKPC8ln28Yxnr6t6scOM51uvrg== 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; bh=aLlVog0F1V8f8ABE6ubc/C30C1HiZQ58htf83zTeA20=; b=Xg/wyCC7wgrsxrKdtK1C4G46j/WeeFEO6Gtt3etS4/dEoGp15/7S+RbOFvfbexCZk7cKnIWVlq/lfoXhcPxuTVxw8mb/vVLMFuY5ChEObfY9rUms7UIuHSMUPZbInKVC9/52DGuaG+klTfmNVjYUHBMp9NrZkb6XXeh7axMYc4ndYBEIqGJBxcaso9lQ2KCTybS2AyGgPNYWOkhph9gLpd1ogSqSi12H0ANgU5nsQIOvM7uUT5hyzOs4IvnGrO7380FB++VkB45qZ/4u+SRDNVfT6+2IYrNFUstA/i25X3aB+IIGcK5v+NP4SE8uADELPbRgiONo2q+ZCTPGRdQY0w== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR01MB2761.prod.exchangelabs.com (2603:10b6:3:fd::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Wed, 15 Sep 2021 16:00:51 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 16:00:51 +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] [PATCH v3 24/28] AmpereAltraPkg: Add configuration screen for CPU Date: Wed, 15 Sep 2021 22:55:23 +0700 Message-ID: <20210915155527.8176-25-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 16:00:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5701aded-8871-4026-1273-08d97861f71a X-MS-TrafficTypeDiagnostic: DM5PR01MB2761: X-MS-Exchange-Transport-Forked: True 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: NWO1KkJ55nrrrS3GDhsihUUMyCLI8Oh4g2KX+aBb9CPrGHVdRI9K429wuV2OBuMrcVhGC2wxMVg3/LTDL4hV1BbGVUyyaAlQ2gb30SxL6+YhH58Ubj9YDwdPBDW2jezjBaSPHcrwfwyE/26pkCVPuH4sawmnABPekgs6CG9WH8hCR0bs2szw+f5jEUZbJ1gYnqPz9NcuOYsgLJM3/ZlieDaf4+hrrC/vP2vxSKUGkUZC+90mbRiWflR4vAaUkTZMNRMZws4bGsxd72LhVDcNkva9Se61JDSc23HSS+oQSFlg8zZoR0w06Ms80N2GmvL22hBSXYnCqy08VuOCztLg1WpNfYaiPfGp72oNY7uLUYNXHJTq6gRJO7jv/eqVdF6s5gSsAgeA+jXzhEAfTmo0FsvX0+w7+t9bt1jLMqWHvb6u2Npbxock0l+jsg2pWjSRExR+TrkQdOOnVh8wzohQNrrs6c8V2AfjOysFtvcHGI6IoRUkC1LkkDrHmGfyV/gbcvsBxmulsnsp3h3Fkuw73lzuCphQkUeBPsgF1I94FEM9IaJ2dY9v8ee3yOpxWmBRvOCOasP3vAGfTSGtXJdZ4Xyc7bYV1e9BCbgX6yg9HNOrIRuWDhqTeRdrvlmBlGkjV/6sA8wkr1nB0tvOzRCL4euLV8hmQllr7NanEkIRsm13CnYx6XcNalbcpdBkBxx3rqXZGoF521c/OmRH88TGKvVZ4HFswnZRg7hoaG/RXpLCiVc9uC/uuZzP40o33TUc X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?4NJ2LGTmOFx4dx/PS7+RG2YrYpmZWfbpaNsDy+Soev1kD/WPfNtV7d6xagWU?= =?us-ascii?Q?FYN1dgytDDCfccI0uGejNdYGeRF3p7B8gJHiem2jEHi+91aMcMJmyOCEPyfZ?= =?us-ascii?Q?jTpE+mIKw3EjqZusgDAHyDnCxmMFv2ZmP32wukaU7FzxxcS1R15Tju3LkEYC?= =?us-ascii?Q?3VBABZ03koMGbocEBfjvJtmfcB/Uba/FjNkdaqJVfC8bs1B+U1Th1bgYxS/z?= =?us-ascii?Q?Etl64lvRcDRiUUkNf7TBhyouYWjEiarOJ3xJHAQIaTcYu+bjzcak0N2wbpVv?= =?us-ascii?Q?cgI9laXVmRt0QuCLWWoKP4c1wAstPvr/5d9YThsYMW55aBcNjwORqV301Lr/?= =?us-ascii?Q?1mg5X31OIIV/Pv5uaoENXgi1gActBJqLk4OXx9sqNaj2yqpJBfKfgQQLNZgV?= =?us-ascii?Q?uYWF9CorQlgF+2VTZzkRZf+EeDcJD1aiYqko/jo21/RfEKQRcA3zc9nXnSGZ?= =?us-ascii?Q?AyDGrpkRECBq32B8jIVDtk7Vxe7MuWZoes7inyHVI6PW/GsdtEr3B2ALNGbf?= =?us-ascii?Q?dUmYd5P0hc1KwnKw1xwgjzFXYjdZ5Ph4lbFpqF6frQhlg9OBTLWn74JbtQGJ?= =?us-ascii?Q?+Yhf9VPVvnk6Jfp2LRrQTGgfLNB1WVCX5P8U/1kCLUwWv5Anp8jpFyhpOu2J?= =?us-ascii?Q?Ts9YrtcsX1RHoGyvxH/ugMFWwsuyqRCG+WxNaVFsc4bJc5M7NJRTTUPcD/5u?= =?us-ascii?Q?yRYLi0jIe0ba+pLwyiZVT+k3k69lSIIibeuPpN51+ae93oYmufYVoHAtBnOD?= =?us-ascii?Q?z6ZinhEBy68lWqbqkNZ15+GS5d/VuSqqF9bH6H1XS591gUxg68NQi3aGJAXY?= =?us-ascii?Q?9ADsjVBDJX0P2MWAPOO6Qn4ciMOfMWpis4M0XqMqhDTBYTkAgPy5F+LWMhll?= =?us-ascii?Q?tIWxiBE8wzz/TT9Jw9LDZyj2A0NL0Ieps+UKxWCEjc/SuP0qbhRRbInFyE5N?= =?us-ascii?Q?IG9AvAzu2B7xdyBUsMuZCGZFBzfbp0oGwZaZOmCv0lXsEkeorF77qAgRRcIC?= =?us-ascii?Q?2BpsuOBWzft63IGgOaGd1T10ubOLf3Ao7ReBIeqPU0CeRBTpxlWCgT7TGQ9T?= =?us-ascii?Q?x20c0nJ0nANyNRQiH728KO9zwlfPhjh1SiVZQnnTUt3wi4MRW6e0tgzl+WaX?= =?us-ascii?Q?+6ia+hJH9Hv4FESWuJQG7InVn7PUpWNz8EtAikCWGTn++52hvt+UpPHLeZiZ?= =?us-ascii?Q?AusN4u0kAF8WjQdcY+Dre5n7q1XsTGg9Tj+0uxbL9rdWEpclW+k4zPREMRBH?= =?us-ascii?Q?0QGh+g3hqThhdoUhcmkScrA7qqAZwSN0NxVahRkse48Pvb392r49duAoIEUk?= =?us-ascii?Q?mK/6bLuXUyR+3lZQ6XurF55g?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5701aded-8871-4026-1273-08d97861f71a X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 16:00:40.5775 (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: n3FeF6t0YbspRb4qvt18JNHu4c/YXGsYLSbzHZezhklg2/71Oq840eNF8oDcLvHcpaGo+48JatQA/MLpvd0SQ+b1ekQdU6vOt/+vNscd2NM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR01MB2761 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: aI63Btpql3yi9yqKD50OR0Oqx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721654; bh=A2E6ZqcOG39ebBathf0Nrb708zsQLGmnAfMZLhXsgw8=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=L7qEgxQjPyNG8geJRKDkWE8hrLG+qcrya3MKwv0A3kgPPgCuiQxCmGQbnP2D/BvcGQ2 lbvuLStIlHa4ylpBH8QC51xSwLcuCwNvVoRjUDSh0hwbA8QonIcHuR252tvQ0XJRt+uim I88U30jfogCBVgrBwSwpIkvNmzs4HpnpzLM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721663223100002 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen 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: Vu Nguyen --- 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 93da9b38def5..6ea247c75e87 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -50,6 +50,9 @@ [LibraryClasses] TrngLib|Silicon/Ampere/AmpereAltraPkg/Include/Library/TrngLib.h =20 [Guids] + # GUID for the CPU HII configuration form + gCpuConfigFormSetGuid =3D { 0x43FAA144, 0xA2DF, 0x4050, { 0xA7, 0= xFD, 0xEE, 0x17, 0xC9, 0xB8, 0x88, 0x8E } } + ## NVParam MM GUID gNVParamMmGuid =3D { 0xE4AC5024, 0x29BE, 0x4ADC, { 0x93, 0= x36, 0x87, 0xB5, 0xA0, 0x76, 0x23, 0x2D } } =20 diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index 5fc83745cdbc..8ca3a729728f 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -198,3 +198,4 @@ [Components.common] # 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 6fe023025034..d9552886fbcf 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -356,5 +356,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 =20 !include Platform/Ampere/AmperePlatformPkg/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..a5cab9eb8d9a --- /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 write NVParam \n", __FUNCTION__, _= _LINE__)); + 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 access NVParam \n", __FUNCTION__= , __LINE__)); + 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 (#80724): https://edk2.groups.io/g/devel/message/80724 Mute This Topic: https://groups.io/mt/85631210/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 Thu Apr 25 11:35:07 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+80725+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+80725+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721655353467.7552915792917; Wed, 15 Sep 2021 09:00:55 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id WdALYY1788612xSeTmrvFmnk; Wed, 15 Sep 2021 09:00:54 -0700 X-Received: from NAM02-DM3-obe.outbound.protection.outlook.com (NAM02-DM3-obe.outbound.protection.outlook.com [40.107.95.105]) by mx.groups.io with SMTP id smtpd.web09.9900.1631721653417356000 for ; Wed, 15 Sep 2021 09:00:53 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a8xeK013yEq62zKVrC31BnSYviIe2s8wt3nzGIBh2d75pupRVLipEVfnoAmgiLbMYGppX6nXq7PHeoeGlRC3WDQjWWmPxalMYM+0B5DDeamgzVS84/6o0nlV16cRAdEZwHKVN5mkChm0gyh0gavAKnDHsOqLmDFoA1w/bb9ZdYnpzr36cLoiXXVoeXTCibNfjrNmKbtADPhrNltrnv7S0cl6nzU5HhE72vPy6IeBt5lV4SKUq/41Ra3rIr/mjn147Ju16Cv2zXGdp7HR7gvEd7AM5x77Y7hCDloHJPHr1rLNPfkMZXI/Zw+PVTvuvM05nhNBdzd7YYrv5S10yA7FSg== 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; bh=/StartXeHWETK3HaoLGl/eos3vLHBg2wbt+RlHq/kXA=; b=cDDlaZ2INvvck316/v+bQcvlOEiYus3CLKMIpHZPzeSwHyM5uBNDO6Ri/1wS86W8wKvnGzanBAarncaVklbeP5Pxj7rL9HToRYsbULXVO/f/1n9Y0/TdtwM8szRSkxfAVYIWjQoXCNbXVc8VXps14E38Fjl6eLgNmIYHWf1YudswWXLWLQa1tOvyVAindMLrQLp18a4daTBKU03vF9uE5vUTzEGeoScpesTorckYbS3XCaQqx/tSClIQ6MDk3Bdn5ObnJomE34f+Z9F92mloLfP53meV7csuJXke0YTzCCo0NrdyEqLvoTIYi2yPWfaZyimU5GXxoPAwA3meHAMjuw== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR01MB2761.prod.exchangelabs.com (2603:10b6:3:fd::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Wed, 15 Sep 2021 16:00:51 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 16:00:51 +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] [PATCH v3 25/28] AmpereAltraPkg: Add configuration screen for ACPI Date: Wed, 15 Sep 2021 22:55:24 +0700 Message-ID: <20210915155527.8176-26-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 16:00:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e80e238a-88d8-45db-a70d-08d97861f931 X-MS-TrafficTypeDiagnostic: DM5PR01MB2761: X-MS-Exchange-Transport-Forked: True 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: 85mTlCmuL4n41wKV5DtpfJrwhxELn/L/mswz3eCCbEi1G+2ti/2kDbpUxEgZ8M1L3YlCcwy/CFQpLJUtYlsc9m5N3iTxepLOqd5ZiwANdmQCsZUIMf+m18OhOBytA1vWMdyKvmPO/D6ZcrRqAbQ/+8KBj58RQd46BcVqRBMUnhBVLUl22rPtAUG2V2v2lEDYrP1AMhaRZz+vLhcRmhPfIhWH+DrZvPM/v1ANb8fncbWhnsC4abqph+CGXEqwVeMvL8RjaZdrCsFbtcEJvCubGDdYLtEpRH5QcCZKFObvr+8XIfON+6xA70OZfyl9vrvYlAgcFpRXjX3n0VmlsqKOrxWsBas4NMOXVZ9MJbJf7yMBOJ8CsfDIkwPivN/zcgQ48ivXhR7sJ55ZoUC6mjcw2vutKkAlZ9UI1KxbneG+u3oZLO6tmcq+ymXIH6q1gCKjnufLJe/uxEHebeNFuEElRYH7bDWqs+9xHLsRb+7dFI/TaGHtPN1gqAv91YN/+W1NNvMEM0UcW0AgPCWny06gJe1PqtmnstOrNZGw25TXupD7Mq+ZzPhjBqzBdbwq+hifymtO/yPNzoMaA6R15W9RNKV0GiocsCVOuLOC/+yo5OeaywPRsJJXsN9n/+0t5DBl4btqhhcQXsMvZdQCVrVFfKrWowNMrzxcIL3FR+uGuejqH9cITzEGWwUWr0EmPOe0B00vHsY37N3RWGzyowg/5/4VosD0Rz/qlaEfKHQ7le50lR0PCN7nK3K3YAsw7Bk6 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?tO4B3skRIl9g4r+W/2w6dGm0FLQ2Ktbqtdxl7AL/V359RMEYVocGM5NBrBcz?= =?us-ascii?Q?qTEU4HFH1dJNb1gfNZO6en2Ai6L1hb9J6sxHr6Xv1akvHEXMBqzxDUZ9UeuF?= =?us-ascii?Q?JM6MsVmeXNftPUhyCm92ePEnAx9ZczK9s1Rs31LXolZdUi4HouyueEW6rOQ6?= =?us-ascii?Q?5dZkIkQ7e8ShYa/mxzW+kT89JplaIFSS04p0b5Bcl0b5AgkY0b7xHLQf/0ph?= =?us-ascii?Q?5YbX2F1CSlfwC2z7KCbFZvO8CpDcjhwxW+Gu+urD6eRmS11TT7JC8T9JxNpP?= =?us-ascii?Q?wBXe4rCehbGbNf7z7Qm4oez0heNmMiqSG76ev4i8kdxjNytDTS4521Z+nagU?= =?us-ascii?Q?qwOcen+yiSxEeQapC8gOzaqqZh8Csum0kQYgLg67pyC5CGyj1BuP8x5L/hq6?= =?us-ascii?Q?YmxXIjGvdZ3ajmtboK5ST3ZFDTSypKV41huOUoSS5/SQOACjQU5Z059uw8DB?= =?us-ascii?Q?4CQu05BQnWgPlhDkbBIsHStyffE6SdODRYKmNR3/qhOL32YS2Z8fAKahcZHU?= =?us-ascii?Q?aNFjuK2RJB2WDKXISPdr2awYYbjGeoqp5UilBeMESYxhgSA0cJ0y65G2TdgV?= =?us-ascii?Q?grJnl1UQj8n/j0/vqO9agyS8055oFdfoj/kKuyWkwbAS/al1wX64WynriZ4Y?= =?us-ascii?Q?EiOLvDHUdimkyOzEP6XfA2sHDpPrloVBI3Rlhqd419OX2w7g+bdHrkjCoZ3u?= =?us-ascii?Q?8bZklqreFUPqSUu/f1uoxjID6B9Or+FkpDJsHHOVQaCCJQg+0PDm3CimgXuV?= =?us-ascii?Q?W9irWM9ucwh1BCAwCrefWElL6KdP0YdP/FcHAKw1savXd2I4tfo2Em1dKUp7?= =?us-ascii?Q?OkQyBBe+70P44kcyoHgJzE1ZNRtgQqvATcjt8IZVFkQa0PA37WkMCjNB0dpJ?= =?us-ascii?Q?LeZIfz/yRy/yFdaIfdrxuEpfzrhdokv1JOUjuEB3pn9bHpnZxspp2pnqfrYk?= =?us-ascii?Q?AwsNKQrJc1Yq2VwWTqgug9CbCS6CuaHNZMYFpnrZYy+4uvkiEXivYd2ysnX9?= =?us-ascii?Q?/ezvYsMR6MhYGYy2CL351uFiePlFnuG/d/SPfJPRWHeINykllwbym5KSy1Yq?= =?us-ascii?Q?U+jEVX3N73crwrQykHsaSZK0YzkaUI8F8/yYyw6XGGG4CKZDCTfdI2AD1j9h?= =?us-ascii?Q?BQ2TzN5kjqN7bBot/xg9hg9NY9tKTo0kmN2S4/ggGM8MbfMetceczTy97KUe?= =?us-ascii?Q?Lj/dl0ASP5VoTUxtD7fmqJm81MB57Okdegd3cd2dWkOUtLJMKFrn6R2X+mSF?= =?us-ascii?Q?12S8oVZCH+MXB7hqaOSYipdUNoADoN7WQKg5rIgXE+5J7FES7ojikdZjhoY5?= =?us-ascii?Q?1aJRFdEZlIib4KbfhpyPJNKR?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: e80e238a-88d8-45db-a70d-08d97861f931 X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 16:00:44.1365 (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: 0n3w68FgeORXeyi6mGcjLAzzloVkihqa2Rwbd8AL1SX4NBRDuM+5++/qO/qDhbNR+OlTBvZWxBxoenj47FF/HdvfFuiJSxa3Mryuz6msfS8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR01MB2761 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: Pd6e296Kv7z4gprBePYSS3Jux1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721654; bh=Gq1lwhr5RonS/t3HOtITBx50eKg/n1Y8ua1giq5uAvY=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=OOw680T2lc4yHMJ5I3pR1j2SRYXFdi/a/iCEmG0XeIq5EOcp87043U8pdCe8Q+lYQ0q N8Y0P0cfWxz48IexqDAX1bEPg5s3mC0nt8vB/htafguuGYokkL3BqH/8yo76s7abMXZHJ eAie18PX0AHi0gIPLEyXRwX9d08mFpTq6qk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721663908100006 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 --- 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 = | 7 +- Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.h = | 62 ++ Silicon/Ampere/AmpereAltraPkg/Include/AcpiConfigNVDataStruct.h = | 28 + Silicon/Ampere/AmpereAltraPkg/Include/Guid/AcpiConfigFormSet.h = | 19 + Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigVfr.vfr = | 69 ++ Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c = | 25 +- Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.c = | 729 ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigStrings.uni = | 27 + 13 files changed, 1026 insertions(+), 4 deletions(-) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Amp= ere/AmpereAltraPkg/AmpereAltraPkg.dec index 6ea247c75e87..196611d67280 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -53,6 +53,9 @@ [Guids] # GUID for the CPU HII configuration form gCpuConfigFormSetGuid =3D { 0x43FAA144, 0xA2DF, 0x4050, { 0xA7, 0= xFD, 0xEE, 0x17, 0xC9, 0xB8, 0x88, 0x8E } } =20 + # GUID for the ACPI HII configuration form + gAcpiConfigFormSetGuid =3D { 0x0ceb6764, 0xd415, 0x4b01, { 0xa8, 0x43, 0= xd1, 0x01, 0xbc, 0xb0, 0xd8, 0x29 } } + ## NVParam MM GUID gNVParamMmGuid =3D { 0xE4AC5024, 0x29BE, 0x4ADC, { 0x93, 0= x36, 0x87, 0xB5, 0xA0, 0x76, 0x23, 0x2D } } =20 diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index 8ca3a729728f..daac52e84ea2 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -199,3 +199,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 d9552886fbcf..1564e45c30cd 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -357,5 +357,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 Platform/Ampere/AmperePlatformPkg/FvRules.fdf.inc diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDx= e.inf b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf index 2b2a3728a406..a2b3886a0236 100644 --- a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf @@ -66,6 +66,7 @@ [Guids] gArmMpCoreInfoGuid gEfiAcpiTableGuid gEfiEventReadyToBootGuid + gAcpiConfigFormSetGuid gPlatformHobGuid =20 [Protocols] 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..075183aa9c58 --- /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 + gPlatformHobGuid + +[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 2e763422cbc6..035912a1a331 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 @@ -34,9 +36,10 @@ #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 =20 -#define CURRENT_BERT_VERSION 0x10 +#define CURRENT_BERT_VERSION 0x11 #define BERT_FLASH_OFFSET 0x91B30000ULL #define BERT_DDR_OFFSET 0x88230000ULL #define BERT_DDR_LENGTH 0x50000 @@ -53,8 +56,10 @@ typedef struct { 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; =20 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/AcpiConfigFormSet.h= b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/AcpiConfigFormSet.h new file mode 100644 index 000000000000..1779a4543769 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/AcpiConfigFormSet.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..18b44f90ddd9 --- /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 a216edac60ce..8a46e038c1a7 100644 --- a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiApei.c @@ -149,7 +149,7 @@ WrapBertErrorData ( CrashSize =3D PLAT_CRASH_ITERATOR_SIZE * GetNumberOfSupportedSockets () * GetMaximumNumberOfCores (); - CrashSize +=3D 2 * (SMPRO_CRASH_SIZE + PMPRO_CRASH_SIZE); + CrashSize +=3D 2 * (SMPRO_CRASH_SIZE + PMPRO_CRASH_SIZE + RASIP_CRASH_SI= ZE); CrashSize +=3D sizeof (WrappedError->Bed.Vendor) + sizeof (WrappedError-= >Bed.BertRev); =20 WrappedError->Ges.BlockStatus.ErrorDataEntryCount =3D 1; @@ -437,8 +437,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..d085389d2865 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.c @@ -0,0 +1,729 @@ +/** @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 "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 (&gPlatformHobGuid); + 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 (#80725): https://edk2.groups.io/g/devel/message/80725 Mute This Topic: https://groups.io/mt/85631211/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 Thu Apr 25 11:35:07 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+80726+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+80726+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721655999106.2249021298635; Wed, 15 Sep 2021 09:00:55 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id G60rYY1788612x3JLGEzZNjg; Wed, 15 Sep 2021 09:00:55 -0700 X-Received: from NAM02-DM3-obe.outbound.protection.outlook.com (NAM02-DM3-obe.outbound.protection.outlook.com [40.107.95.105]) by mx.groups.io with SMTP id smtpd.web09.9900.1631721653417356000 for ; Wed, 15 Sep 2021 09:00:54 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lv3tN/goymFuQ5LVBRtAxs9TSNfJwTeX6tJfLJ1pNISZQSsRSWjsz0LjsU9vB483vEKVtP/oiTtfmVFO7Ao5UYurua8DdIO8KIc5tseFRpx27FH0a+ywgelLjgp3GMi243/ds4/52A7kxMcSJhQ7AHRFv9hreQEWfbxhpClJu75OaS2mtRlq2fi1JdVxJsjA/p/R0ItBKv4GjPcn20H1ilCbwNQc1jCIz5vHleCrO8iSnuv6NJx2nVkf7HhQKgiNR/LJ3HXexFUR0Rp/nKLxlpMkm41li0vBOK/w2E9sNwprnACh2RofuPIN1GsefN6oD8k/4DBXLyVxpZPFW2M9mQ== 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; bh=curBmX5ixoBgY1sJF914EgFiNeoDUyx0227a3yNWBSc=; b=hZaE3L0Ay2MM2q3M3u0BT8DE8mbkMshpEjXyluJcDZhdvTi8oxBik4CzJv/qUPMWw0xltOn5JR+3ygRnTv3bDWIm1RIUlecKIqyKY3+sb/dS/t5dxBuUI+JJ4OGhd8En74mCiWx/2sy6LripG9/yjYYVCDwNxbZLGesg3sFEM+FnoGCAg1pMaT8vmxkqkLNpo+pth9jO1fl0Pu/3SbIgTa3ct1ehFR1dUVnRgGXq5sNzJEIxS8SNF8yDB6/OLsXndodQZVRKSIP4pirdAKBjiZ9SgF9BO9/F8OUj1gt3NLPFDgQHFABQlG1Fyeqq3H5kdFGmXO5l69bLpOLbmY2Axg== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR01MB2761.prod.exchangelabs.com (2603:10b6:3:fd::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Wed, 15 Sep 2021 16:00:52 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 16:00:52 +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] [PATCH v3 26/28] AmpereAltraPkg: Add configuration screen for RAS Date: Wed, 15 Sep 2021 22:55:25 +0700 Message-ID: <20210915155527.8176-27-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 16:00:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f8f9a446-cf9d-4b6f-93f8-08d97861fb70 X-MS-TrafficTypeDiagnostic: DM5PR01MB2761: X-MS-Exchange-Transport-Forked: True 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: A8Aiez4aUsLjitzZi47Qlj0wZ+CstNYquvJNRw9NGI9/PIRrw9GBJDSH7041FAy7o9mvHxy4Ux0XCxjylvzC5i9jI8J4ssAmbF3Dj/PtxAKUxVHERoAZVk5xqoENWmiHMOjkyFg/ffCbJXWORBXCaN8ixtOGZq5IE+UEIAZKaXRJc+HFlXVbu/SCy5DlA08RDHo2i6ExThsK3PjCg8GkhgPQjpWozt2xUqgYFZGaHJ+sLknqZdiIz9MRh18bb5Er+OokuaG+cmS8Keu7X5ifQYG5JxGpp6K3VBxoBbJAU9Yxxei3wirGZmncaQgwaCrWQPNUmabMf6Fpp2h8v1z3YFQsx+l0kOMnTrdHEmw/n2hj8WP8bRqlZ1tGgmxH49DQgHI8bbkHKhqC3p4+GtNKq/cSljLI6dTBmskduUbLZi5gS/A7H2i6Ms0TRwI4ifZrlkPmILLJiWkIpFzZ8tdj2jr0Yw38crUVUjhVRIk6p79x8OzF6kqo0nzPV2n0qkK7JaiZZ6HYJ9URKmnOHBAcLZV2XS2UMXEMol032OzlVZDk0WP97cLUIwYHvve/ckOFmXHR/R1UaTvaBrp5FCQrnG9Kph6hbZYMi4avxrYQ8moUQK7dopJtkq95Y9g/VZS91pD000uEBsc092OFeDZFGIK4OzhH0045pMAV/fFD+1JI+OmBgKw0NBv8ZTR6b4L9aAKwEGz/UDAfYks+90q5gjYuNs/pw+edIVwGNnrMacz23iiYbCsQr1bU4sqgqcOK X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?m/j/RnD6sGcxDv0SfHYcGkeyy2oFHfT3tQKYrnCWpL14leX1gS8WeXZ9L8k8?= =?us-ascii?Q?H32KWs3X3q71Z1g8oHFGyqoV0Glr9YcTv4e6Twp5rnOZmVAqTrXGYMVGyLrO?= =?us-ascii?Q?0CEPGS9QR2wWz3+kJQwFyjnZPvMN0CdBFz8klk5+A6+EqW8JoB+XmQwhUN8V?= =?us-ascii?Q?kwqKvS8y24PsoK5WEASbs8WQ9q5cEl7+P7UFl+zECaaThwuEW3gU0sHRHKO6?= =?us-ascii?Q?5RiMcZ1+iABdE11mY0mfADzHB7Xo420nQHRikaerwq9pU2EyeHgswXuxcZ+K?= =?us-ascii?Q?4jhl/wirf0hQgQv2hxU+HcxpGKnugTEkbCo97kD0KjlcYJb+4zmf5HHD+zAV?= =?us-ascii?Q?3WPpltg9wmqUbv651A7TiKMTk1MxA7TCUM9WcvLKjo6wBzpLn619MJ/3wHrN?= =?us-ascii?Q?DczbaoO92ewOa7KLq7qLckGXA9sD5YWTbQEO9EsjS+9zYVYVGHnnFY5/FZgQ?= =?us-ascii?Q?0z2fMvx8wXUT0Hf6OaZQGhzjZI7aJLb1VDf7n5hZxvURuB7SHgUYas/9xCWS?= =?us-ascii?Q?jsdPEY62k0iOGLl62KMV4SS6KfQNsPPNEs0DOC9YJ3fqE79PsIDqdk6xYJC+?= =?us-ascii?Q?DpN+ravIwf9FY3CXr+KHLU2rbrI5c8XxzHnj/y79yuznC6P3vWP3ikJ+GeKn?= =?us-ascii?Q?KEhm2obzHnr9/645TRJHmOfgrBH70uGpAhhRZoZqY7rOYRwOgQCQmxNxtjpG?= =?us-ascii?Q?ZkRpYTR2/I+9hCp3aGqI1ExoVYz79Z942OK3CzmqlUDHQFdMq140MA3YItc2?= =?us-ascii?Q?YkEBl8kM/dpYuKZNyVVxOeOqEXNg66TqL8y50AhjsQOeiQc9jpXorBFcgKJ1?= =?us-ascii?Q?2Jhv57NDhXlCFRf/b5dIxk0dtr74FLkoPFZc2yoVhjSu9qnp9U2mGTWEkXnP?= =?us-ascii?Q?K1da+OXa795/ZJcxfsj1NkcA15FITJ8/PL80NH4R6bNhPksSav6zcORzmW+o?= =?us-ascii?Q?7bjKaQCHlDs7zjOtvOd4myBQVkCtTsqWmuugKpuufFmdc19xzvamlJIh4xMY?= =?us-ascii?Q?XDeq60LnkXoezZuzEaFrphWLZL4605NHXUCcKANoEHzXWPIpTmIohAIxe4ya?= =?us-ascii?Q?/wlIOOja1h2vrDiZ+kOEUg+5znyHUlmip0FVUAsx0UOAxcRNfc5QOj5/LmYE?= =?us-ascii?Q?ubNDeyZ5WFcf6gSWfhyB7JuGw5tsA9uoZVw5SoIMkbjVOPCtZLhvi3T2ncpr?= =?us-ascii?Q?oNAT6CSs83wC84RdDz+igmI/Eqbpg+Gs1IewofISIei0mC9hFrWjdlBlcQki?= =?us-ascii?Q?ppKQm4X+lVPdJ+oNO0sk/6oK+ohoQaHloBK8K1lCF+hg8N75PTjGUtpj0/Ye?= =?us-ascii?Q?siSQ5z3jn1kLlOqaOmPn8eo6?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: f8f9a446-cf9d-4b6f-93f8-08d97861fb70 X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 16:00:47.9133 (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: /5vJ3tyh5cE1Lv+0o+9twgskhVqxW3F0q5z9geG18VK69+RuMQYvcyNlTg8/9lQ8FZiMefJezrRXaWtVus4Yjdjt7VdvXwk/MpVNh7LV6OY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR01MB2761 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: anN3Rdz0HwoPTytpehkpF2Qrx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721655; bh=QMUgpBP1x7ugle0MTRdIOZkkQ/5e7PddnTKT2lhPH7M=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=U2BaPrJZLs6N7kG66oOz4RmIBby2TVQeki/1qMb/gJDSK5Ni9YTfgYN9WL6t7PuySLy LZDSbUVEkxV+yy86gxvc8G4QIWZiZXRpac5UkJMwyTtInbQ5aIROJ9facO015vtUU0mgW Anw/4vQBnt0/Iyl/JHyl2A0g/mxODqiHXlU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721664408100011 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: Quan Nguyen --- 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 = | 822 ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigStrings.uni = | 38 + 8 files changed, 1120 insertions(+) diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index daac52e84ea2..b5ac2547c8f8 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -200,3 +200,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 1564e45c30cd..e0d4b049f6bf 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -358,5 +358,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 Platform/Ampere/AmperePlatformPkg/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..41554775a0b4 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDxe.c @@ -0,0 +1,822 @@ +/** @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 "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 (#80726): https://edk2.groups.io/g/devel/message/80726 Mute This Topic: https://groups.io/mt/85631212/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 Thu Apr 25 11:35:07 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+80728+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+80728+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1631721657130583.3328378809831; Wed, 15 Sep 2021 09:00:57 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id jngoYY1788612x0ZigVOjxor; Wed, 15 Sep 2021 09:00:56 -0700 X-Received: from NAM02-DM3-obe.outbound.protection.outlook.com (NAM02-DM3-obe.outbound.protection.outlook.com [40.107.95.105]) by mx.groups.io with SMTP id smtpd.web09.9900.1631721653417356000 for ; Wed, 15 Sep 2021 09:00:55 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IppQUcbYfoNMXX28p6YHQ9uzlGsEp9VVrqh7uzT7IHsN+MDPkEC4FmCci2MHACnwb/b2eOjm/vBEwGN+N4NTrMA7aSWOrU9sNkUXlPItU3fXr33pHGyaWaPJGQTEEaeJVAScI5/beLOwq2MfNPlz1+xzxmSGbZoug0SZIhAtg4grhV/RJ0zlBm3LtCEzfuS66UFtOa/ArX8zHhaBfWYtYzJb/xNfgVErZ803jeLju8oGG55XtYQrLlVYoPFacpnMpI6hO6snOIQrWB727r5d31Ho1dl/BHOfRWuCkMX6THObooRbuiPAOzjJxkAfo2AlFnjxmgrn4SPyyBm3y36C7Q== 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; bh=CgayxclrtyvNLB67u4jLuBYEB6Xfnu73JI6dd56ZSO4=; b=Zd1vEq3mwV8daNWyIDyxXLw0zOgXXSVs8g0gkGxGT9VnKPOf0Sp9dg/U7gaJ91mtQ8E+xkfYfzr8hlzfuen1pj5hmUzVKPSl08nHqvjQ2uN2bH3s5uFvloUZX9do6mp9kqC9BMY5GPzqCidwTiVZ+MAsiDZ8eZJAFxAHW87CBGyonNB8+btr5R+6ri309FeCP/grPgMk251OA0hSjrcM1Wo/h1USk3vP42/TsEd2y6+XU8RugCn0wuZFSgC544xlwgxgUHv4O4dMzLnTGjs21uHxfl4FKQns64bjDebIaKMzKjwtroRAW/0hjBp51MbowM+72IshqIbtlTOFi/DZeg== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR01MB2761.prod.exchangelabs.com (2603:10b6:3:fd::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Wed, 15 Sep 2021 16:00:52 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 16:00:52 +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] [PATCH v3 27/28] AmpereAltraPkg: Add configuration screen for Watchdog timer Date: Wed, 15 Sep 2021 22:55:26 +0700 Message-ID: <20210915155527.8176-28-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 16:00:48 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 959c3ff8-0125-4dd0-122d-08d97861fd92 X-MS-TrafficTypeDiagnostic: DM5PR01MB2761: X-MS-Exchange-Transport-Forked: True 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: i8x2b9WrtSsjA1jBm36XiiJ4JhvjeKSvErFaeC1J6+r+UkDcfhYQJN084+XKA2cnvGsccFaKUZRwa88UdBG9zFlqxFB3dj4g6MGH3rq43WjEqpiqenJsjIMez+b+JnLD3AQk+mK/85sNbj1nx9LlXhswCfXJVeqF9HEhjlTSrGym/GvYwGis4FDAPDXWRY3XL51mno7qe4u0IxBvGN8JKLeMV42RoVXCmPJlotVnJ3JWezI0DO+ZTy99/scPLgb+aihVcI1H/ACnmzzBPJ70L+Mzk+dOk2Q66n8kznGGmRHLN3vY7CXa6eskc7xoH8o8nTNH02OV4GM7HvkI99EePeJwa6tt6IzFR2klu/TCeodcq15XX0LJDfohwhT/8/Ceom3DG1bkiBvfisSH6lBfZIJADMcuUREShad6pL8o7TaNsG8cjrGCKH3ZO7Is6Udm0IE3rYxYmf02fhiig3YDgXAJwAtJtwvXXI91JZE29FLtiOmuq/REaSHqVbEH69LrSetVoiLG4AKbbHwT/9cfveHr8TQhVKKTwjRT7cBHR5HEs4ZbSTckuDOXyXHGb0iozrhdn1HxCg01lRnuhEx7zKSDitSiJvre9b4+huM/YcJEtG8ST1n1F/1YVQY02XRQ21Pt05YSXkyl7/ZIHCmmnHfC5yJMWF9+A4lGqzbi2cd/SHHa5LLeXuQCI8+OEM2p8PAyg4q8zuEdBbYLeKrJTJGw53BHSsTGVY0KnLK6QDxEFN7ZuyjQZMmnakQRk1usnNYZ5IGjgD3sXxByEs++DlEAW3I8qF7OudKUGZ7C1nE= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?rERSQ0fsrvon/57UxKV4NuamHm1SU/970HrDrfw1MbFK+YMhGar8SWlD2eT2?= =?us-ascii?Q?RC/Lle/xmI9ikofJdFWfLVcOWUKfVQLG1x2qWVacaaLxXVzVvXMlKqqQsBOr?= =?us-ascii?Q?MqlvaXKJSMHC50A3mpM1ukYGXsq+G1UjUdx2nKGNXwCa8MLuxnl6e/vxy564?= =?us-ascii?Q?AnpHB1+N9KGP5KW2e4hgGoYtE4rcjg1l57pl6hn/H0VWwev6liNM24cSDzjo?= =?us-ascii?Q?sxxDT4b5A0c6A1v7YVA8t2RVW+Ki2/RccicxIIsg1nME7w2wd37DFiKN67vO?= =?us-ascii?Q?k/dgZmFNXIOjSv1vptczfXtC74j4dAGs1fy8m5QgQ5MFm7Yv/EjHumcXN42p?= =?us-ascii?Q?yCAQLVjaUn0EcmvkpWP/oJQy7ikbWwxSb5Jotg8tnVL277zLbSfOhkXoklos?= =?us-ascii?Q?5h6DxusyFIx/vpLRoUMwavccw9EwmxMoETB7WHPUlfyRwQevUD++S1nnjSuz?= =?us-ascii?Q?4nalGNaMh90ToinJYcbIjQa9PzA9qXzv1kujbPbu4CWuv58wmgvb24Yf6hgY?= =?us-ascii?Q?x4dHUTITyc7Bm/7oJ3vyGCkZ0iWTmqneuYWhQwSkVqN66oqBjHYLwQr0TZ3I?= =?us-ascii?Q?ILY+m8r+aBTR2JHuORF0y4gnupZuCCvHStUUUWgOSxHx6TwukranNsJ8iu01?= =?us-ascii?Q?vBVyM7dSAtVuoNDIHCCrrUgxQDrzD5GkXCX+IE4LMCzc7DFPZiQK8oxtGxBl?= =?us-ascii?Q?95sIwtw506r56UgFRpeP7j72zTLUmT01u6urA1yaLAigDl2ySvPBloD9diCu?= =?us-ascii?Q?DWJNRLuWxZ9k5XpLuhlLdSWLH3wCpPcLtavhXmS7Q7WwnuQFOwO2SRIFTa4r?= =?us-ascii?Q?2V1Vi7xtCW35A5Undu6s4ODKi856z5v+awAYyLF5782c5j1doztps2wrGlx9?= =?us-ascii?Q?EADjxnVi7B9xvdM+tJELC0rR/uPKVkm6E1XlsEyO8LPeUVTAhU+VGezoSJ4N?= =?us-ascii?Q?eAACBTbreZrnvCndRS+UywyrWrLhG4lBN4Dle7swlzMhvEobamXc3VLcJRVf?= =?us-ascii?Q?nRn4xpOjXPPBlck5lxzIWjSTxBqjlz1U1L0k3D580/uQPvMy9+7NWlPG5ZyM?= =?us-ascii?Q?5aA7fwUb1qyg0Z8+2Scu9hujEuI3DyZAMs2fxF3Hq9HZykpK2rT//VZxqJT8?= =?us-ascii?Q?I/BfZ2XWxc7Dq73reSZHHq/sQIl1eKph7Tj9KZ9o7eYFE6Oaw2LpOePMZBMh?= =?us-ascii?Q?SrzUprrTtwtYQCrpFFslU5+meXvdKy+96MSG4FnNURUvY14y7hEGffo0JPc/?= =?us-ascii?Q?QrQeZXE3yrFulhPIAlUJalahT/uskRIPu+gG74EGHPf1Mj4QnmbBthGi5xRd?= =?us-ascii?Q?qv4yPYnlKKvDvAQpXoP3pq+7?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 959c3ff8-0125-4dd0-122d-08d97861fd92 X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 16:00:51.8810 (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: dUAV7+yQ93hfgzn29HPQEZrteD1ipa7VM81M7gFdlMG3ifE9HcMw1Wh7MpbBPvW0l0/QeiuV2+FDVj2A6vrdm1FHuaYY5Q6ud7utzxtVX7w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR01MB2761 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: Yxouck5YVdeAEKjojoOOauu2x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721656; bh=lrY3ELRspuF+vL4f40hHoUuxj6aqHFhZEMcV5LOUNMA=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=gvxCx01SyBSk2aYZJaS+VvYsRkoJKqQioEn0Hq5mI/XSG038/ArG//+AoX8liqpjim+ i9VcCgqvSrtVorys0gXOwYvzOWz5NMoCYAUVPixMN0RjB7CJvvwyd0uxgCv5EDzudomEC U9v+eAWy5gVMq7KEnF/4xs6MqceYnvYtP3Q= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721665568100017 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen There are secure and non-secure watchdog timers supported in the Mt. Jade system. They are used to monitor the system booting like system firmware, UEFI, and OS. The system will be reset if the timer expires. So, this patch adds the configuration screen for the watchdog timer which provides options to configure the timeout of these timers. By default, the values of these options are 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: Vu Nguyen --- 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 | 82 ++++ Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfigNVDa= taStruct.h | 27 ++ Silicon/Ampere/AmpereAltraPkg/Include/Guid/WatchdogConfigHii.h = | 19 + Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfigVfr.= vfr | 58 +++ Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfigDxe.= c | 460 ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfigStri= ngs.uni | 26 ++ 10 files changed, 727 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Amp= ere/AmpereAltraPkg/AmpereAltraPkg.dec index 196611d67280..b0e1f3ec6f2a 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -56,6 +56,9 @@ [Guids] # GUID for the ACPI HII configuration form gAcpiConfigFormSetGuid =3D { 0x0ceb6764, 0xd415, 0x4b01, { 0xa8, 0x43, 0= xd1, 0x01, 0xbc, 0xb0, 0xd8, 0x29 } } =20 + # GUID for the Watchdog HII configuration form + gWatchdogConfigFormSetGuid =3D { 0xC3F8EC6E, 0x95EE, 0x460C, { 0xA4, 0= x8D, 0xEA, 0x54, 0x2F, 0xFF, 0x01, 0x61 } } + ## NVParam MM GUID gNVParamMmGuid =3D { 0xE4AC5024, 0x29BE, 0x4ADC, { 0x93, 0= x36, 0x87, 0xB5, 0xA0, 0x76, 0x23, 0x2D } } =20 diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index b5ac2547c8f8..b752ea3e5264 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -201,3 +201,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 e0d4b049f6bf..8f3df6ccf01b 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -359,5 +359,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 Platform/Ampere/AmperePlatformPkg/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..5f47531c538e --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfi= gDxe.h @@ -0,0 +1,82 @@ +/** @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 +#include +#include +#include +#include +#include +#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..470a2821ffe7 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfi= gNVDataStruct.h @@ -0,0 +1,27 @@ +/** @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 NWDT_UEFI_DEFAULT_VALUE 300 // 5 minutes +#define SWDT_DEFAULT_VALUE 300 // 5 minutes + +#pragma pack(1) +typedef struct { + UINT32 WatchdogTimerUEFITimeout; + 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..48f2aef227f6 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfi= gVfr.vfr @@ -0,0 +1,58 @@ +/** @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.WatchdogTimerUEFITimeout, + prompt =3D STRING_TOKEN(STR_NWDT_TIMEOUT_UEFI), + help =3D STRING_TOKEN(STR_NWDT_TIMEOUT_UEFI_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 NWDT_UEFI_DEFAULT_VALUE, + endoneof; + + 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..bd7b929dccda --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfi= gDxe.c @@ -0,0 +1,460 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#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_WDT_BIOS_EXP_MINS, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status)) { + VarStoreConfig->WatchdogTimerUEFITimeout =3D NWDT_UEFI_DEFAULT_VALUE; + if (Status =3D=3D EFI_NOT_FOUND) { + SetDefault =3D TRUE; + } else { + ASSERT (FALSE); + } + } else { + VarStoreConfig->WatchdogTimerUEFITimeout =3D Value * 60; + } + + 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_WDT_BIOS_EXP_MINS, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + &Value + ); + if (EFI_ERROR (Status) + || Value !=3D (VarStoreConfig->WatchdogTimerUEFITimeout / 60)) + { + Status =3D NVParamSet ( + NV_SI_WDT_BIOS_EXP_MINS, + NV_PERM_ATF | NV_PERM_BIOS | NV_PERM_MANU | NV_PERM_BMC, + NV_PERM_BIOS | NV_PERM_MANU, + (VarStoreConfig->WatchdogTimerUEFITimeout / 60) + ); + if (EFI_ERROR (Status)) { + return Status; + } + } + + 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..1d0f820e456f --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfi= gStrings.uni @@ -0,0 +1,26 @@ +// +// 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_NWDT_TIMEOUT_OS #language en-US "OS Watchdog Time= out" +#string STR_NWDT_TIMEOUT_OS_HELP #language en-US "Timeout when boo= t OS." +#string STR_NWDT_TIMEOUT_UEFI #language en-US "UEFI Watchdog Ti= meout" +#string STR_NWDT_TIMEOUT_UEFI_HELP #language en-US "Timeout when boo= t UEFI" +#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 (#80728): https://edk2.groups.io/g/devel/message/80728 Mute This Topic: https://groups.io/mt/85631214/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 Thu Apr 25 11:35:07 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+80729+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+80729+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 163172165910141.452341274603214; Wed, 15 Sep 2021 09:00:59 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id s2A3YY1788612xNjd9ZtoC9F; Wed, 15 Sep 2021 09:00:58 -0700 X-Received: from NAM02-DM3-obe.outbound.protection.outlook.com (NAM02-DM3-obe.outbound.protection.outlook.com [40.107.95.107]) by mx.groups.io with SMTP id smtpd.web10.9944.1631721657928927201 for ; Wed, 15 Sep 2021 09:00:58 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JIM7x+vV0HiI4DWaHFWjQcC3uuCPBjIrhDawsEgctiunj1OAaxw3ogR7Tp01z+lXxWZr4q/r5iANfzMpH9V2ZZmVAnElsp2tqHkVrrefJBclYzuGnHpae3UFbkYfDxpvuItm6BL7cEKq+kqci4I9QOFr2fIoyeQuR+vADPRK1T/xl2IbvFCbtbiaKeyV3xR4bJqdgrBCAF+Ymbh8g3Tp1sn8KlnzYPsmQNQMHjRCezuq7piGDsuYMBO86oESds2Ego9q6CqKHkoiH192xfSN6/ET578Si9xaidlryG+oqhN3jU2oUX/54f+WEN5hvbaJVuZ17jim90+ldVhcmA8qNQ== 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; bh=5hVaAV4W6tsVbxHAdlbZesU42pFbYwbwTwhETiA8v7Y=; b=Id9OGka2w9hcNKbsAlBR6CvuoZbuuNQpulhuSbDIiFqSE4/VcJWueegPBd7VtJgyde8roJz4+SxYj0shn/aS7GHmD6Zjc8UW866a6ZOSEQgG7Zhk+xRHaNp2HkR0WxUwjFyFi5aOaSLqGcuyvunb3vp0vtcNMLCFFEqTfMjYw/IbTtaB7yExGPJlhQsR998GUahAfc+Q8xu1ThPqf+ZeA6zMeFWbD1hTi8430aE5sQt7onR9lePI2Txx0yPtg5QkvZUHXR1osU4ZEWalizi8qpmLzmx0kadMLfarEvXzRvi6dd/gqeHU+rZK+XZYEFO+j1JtlCSf84ZFuSQitHpLMQ== 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 DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) by DM5PR01MB2761.prod.exchangelabs.com (2603:10b6:3:fd::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Wed, 15 Sep 2021 16:00:55 +0000 X-Received: from DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3]) by DM6PR01MB5849.prod.exchangelabs.com ([fe80::8eb:704f:2ba7:9bc3%4]) with mapi id 15.20.4523.014; Wed, 15 Sep 2021 16:00:55 +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] [PATCH v3 28/28] AmpereAltraPkg: Add configuration screen for Pcie Devices Date: Wed, 15 Sep 2021 22:55:27 +0700 Message-ID: <20210915155527.8176-29-nhi@os.amperecomputing.com> In-Reply-To: <20210915155527.8176-1-nhi@os.amperecomputing.com> References: <20210915155527.8176-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) To DM6PR01MB5849.prod.exchangelabs.com (2603:10b6:5:205::20) MIME-Version: 1.0 X-Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR0302CA0012.apcprd03.prod.outlook.com (2603:1096:202::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.5 via Frontend Transport; Wed, 15 Sep 2021 16:00:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e72dbf64-18e4-45a9-51af-08d97862000c X-MS-TrafficTypeDiagnostic: DM5PR01MB2761: X-MS-Exchange-Transport-Forked: True 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: 4otFCHsgiu7A3QyOoJ8MEmWk2H0z/AiY5ek5pPXkq8AmgPrTRqEmGwOGT3+P4QYox/jZt1wblmxTxOebdGi9Z0ixzJR+j2EWm7HR/J1T1vm6FVBbaXOi9qiCwncmRuF++7EMt/H2kcgR/VztQbmVdLmGIG/XfIz/QQNZ3GFpgdHnTJPERn5gcJYM/Nkt3xCWkFKi8aKUrExVjW7SdEl5I5QrB4afJYwftH8J2LVScUZulDS7N6b9dGk6J8WGaFQwyx6eXTbltTXFtmd6Asz5in70PN+Iw0oAf1TyxyDmeTLbEC2UXuxJnNesqoj96CPnneinoOMYOV8B9fq2F7pqytZUIrVlo0FR3cVrva9h5vyptcD61hJWPEd8MrxVRn0IsZbPj5nKS5ulzqlQB7qM+uyK2LttP7PEiBfjv3kKi5TN2NyqPmBbbU1avJdwDv0qv344y3RmlHoI3wHNw7uNUB+S0g6hssT16YjEqMnF7mlGHyqlhRiRNgKfNBQA6YhYIT4R1qt0sEQHfyE0gTH99+/x4RtnzuwB6aatQPiD/w9L/hgd2LpKsXh6hEC+uciCl4SHyPeEXH3XadOveVIcpOAvSOj83YKMLgbwi8Wsgvw7z/lwIWfv0muueJqQ8ziKI070/Q1+sLyHZD1Cr5pJEX/Ro7NdmiRjFfsPancJzbOblAYgZTKV71YC6dtgrDCAFHIAi8WBOHodD26SZUMLrRAPW1TZWREEPr7HL8FtV1ABNAXitWCQt7VQuE+xe7Vf X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?uqJEjRxEwGNtDMB4T5Mc5XX+DzsK/BMC1jlQejlN00aFLgr1JV57tbhRohcY?= =?us-ascii?Q?hCQNi+xH/X1cz1NcW3jUGdR9VPvaTsL3pzyYqOOQTS4Km9z1i0sUJqbnYrNI?= =?us-ascii?Q?k862o1U2LORit13C1madbTAjZzY/Z4+UcotZObM9PxOvkmQVOKpYFX/rTKPt?= =?us-ascii?Q?meqIoXdP+LYQEij3Pb9u1pIZCebO1odj+pTATzvT0Dyuu7Fr0JrRpHfqSlYf?= =?us-ascii?Q?JqS9l8brV2cZYZVM+OVebcV0BRfepha2f/nugjJ69NOA52xB9SY+AS0moo29?= =?us-ascii?Q?bLJbhIi6ODotIzmfxmWvtkz5G+++3sC//zZOkx1SB/Pnx8FWadTHGtaK0fVu?= =?us-ascii?Q?6YOwjBNRVneWgSdLXtlxYLkVznLzO1qRNh/PI6/ixQCTvexph7OKVrPUuhYm?= =?us-ascii?Q?bmogo7M8onG89icu91ddaFTAXq/ufLRd9XgKhT8CzsVjF2UUrS1KkITUDH1P?= =?us-ascii?Q?1SddsDcpTQe32IAu0e8gcchJg7AOIThm8mPBJo9ibID3DBJxEuF1AL+121xz?= =?us-ascii?Q?8grYwvz8uDv48WVB+OJR80TKtChQdfexOGY2MJtUY4nMLyQeAnmFNHGAty3m?= =?us-ascii?Q?JO0/wxghwKxY51sAOy/KFpiPrsRHOFQEsNffmy6j/ZY7oqYuM1ZjIXNJi6fH?= =?us-ascii?Q?q/emxB02kM4Ej/EHHKoUyXOXNbQ/cKN5auCwvJjFAGRCPradYT42Lv8yi/SK?= =?us-ascii?Q?JmkInMkJuRNoDKqEUsO+AeStqG24NbwNyWpTa63JpAdIuxaAWhEnePoYdGEz?= =?us-ascii?Q?5p74QDtLEJox7KdOQFSK3M7NbMvK6oZHmFkvyGU5PfrvMC2FrG7l5QNtVui9?= =?us-ascii?Q?89Xu5dw2ikwatEN/vjCm/xp/MAwAuYjbNxX5RFy/eRvu64bD7oG7dvNpnKWa?= =?us-ascii?Q?9jpnMbY1JwL02VWnznHVLdaWKMf/ulgbMcFx9WPXwN+e1kQ0ir7rFawuIvnt?= =?us-ascii?Q?N4hY6rgJPMpa16VKE6/307zGWVwZLpJ+S68U+M6nNev+9Jq9XIn4McyU9Vwf?= =?us-ascii?Q?+aHFS093Ccog6cz8z0nhIwPzZ6NqFh99DbRWM+W8SEKNdgiCJLml4j+M++K/?= =?us-ascii?Q?nWjWVr00Pyl2eGnUXLVjBGk8ph18IsTDpunomZ/36SaYra11vToYSl7JJ2Z2?= =?us-ascii?Q?bJ8yCr5UxScgMtmAoZfXmwJTGqsh/d+hLfg6jeKS4QZZokoLwweiR/uIoDoo?= =?us-ascii?Q?Np0ZAz7RkP8KrPQuY+/Tbp1d3ejlOPACYDKdPbddSFkNck8EamShi5zBTISG?= =?us-ascii?Q?Jk3Kz82sFHZhsxqjmme+SOIp6UtJDmHsO9Q7apCkhrObBNQvdLB3Shkfwmav?= =?us-ascii?Q?K4fL1iBZsWb3Tj20TF7g9Tb5?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: e72dbf64-18e4-45a9-51af-08d97862000c X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB5849.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 16:00:55.7218 (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: braeafe9KUnfW97XmsXVyFfLk0FlOc3i06ZVuL0GTh6h5Dg1Ciq/xyvpYgWML61WHuxihQ9rf6TaPEK3IxZrw80KsyBoNSqEFQPqc8at+p0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR01MB2761 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: JoNHwvpg71fSN6eEUEqK0yDhx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631721658; bh=UBJC5rPRAQvQQ/OTA6TH5VbXkRRcWN/PVlCv3ZXIVsU=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=nWNC7qDmP7XsNfihD+Lwpx7xAdKO9uSPi3CAzNtTRSLFe04BeH9nRlzNnMsMnwkpvpF exH+Aj4h1qrrzpTIspZ3n4g2wNR0bPZe+plIfqKG1JScBQDsdNfwbCspLJNh2CcCvYrct T4de7I1dxsWDv7b2dqBZ2Cyub8bhUyTJS+Y= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631721667711100021 Content-Type: text/plain; charset="utf-8" From: Vu Nguyen This screen provide menu options to configure Max Payload and Max Read Request size for each PCIe device under Root Port. PCIe devices which attach to external switch are not supported yet. 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: Vu Nguyen --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec = | 3 + Platform/Ampere/JadePkg/Jade.dsc = | 1 + Platform/Ampere/JadePkg/Jade.fdf = | 1 + Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/Platform= PcieDeviceConfigDxe.inf | 59 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/Platform= PcieDeviceConfigDxe.h | 78 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/Platform= PcieDeviceConfigVfr.h | 56 ++ Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/Platform= PcieHelper.h | 58 ++ Silicon/Ampere/AmpereAltraPkg/Include/Guid/PlatformPcieDeviceConfigHii.h = | 19 + Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/Platform= PcieDeviceConfigVfr.vfr | 50 + Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/Platform= PcieDeviceConfigDxe.c | 1045 ++++++++++++++++++++ Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/Platform= PcieHelper.c | 191 ++++ Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/Platform= PcieDeviceConfigDxe.uni | 24 + 12 files changed, 1585 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Amp= ere/AmpereAltraPkg/AmpereAltraPkg.dec index b0e1f3ec6f2a..6ce545fda8dd 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -59,6 +59,9 @@ [Guids] # GUID for the Watchdog HII configuration form gWatchdogConfigFormSetGuid =3D { 0xC3F8EC6E, 0x95EE, 0x460C, { 0xA4, 0= x8D, 0xEA, 0x54, 0x2F, 0xFF, 0x01, 0x61 } } =20 + # GUID for the Pcie Device HII configuration form + gPlatformPcieDeviceConfigFormSetGuid =3D { 0xEC7B1D21, 0x9167, 0x4B9D, {= 0xF7, 0x94, 0xCD, 0x1A, 0xEB, 0xBC, 0xB7, 0x59 } } + ## NVParam MM GUID gNVParamMmGuid =3D { 0xE4AC5024, 0x29BE, 0x4ADC, { 0x93, 0= x36, 0x87, 0xB5, 0xA0, 0x76, 0x23, 0x2D } } =20 diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index b752ea3e5264..9db1cf316249 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -202,3 +202,4 @@ [Components.common] Silicon/Ampere/AmpereAltraPkg/Drivers/AcpiConfigDxe/AcpiConfigDxe.inf Silicon/Ampere/AmpereAltraPkg/Drivers/RasConfigDxe/RasConfigDxe.inf Silicon/Ampere/AmpereAltraPkg/Drivers/WatchdogConfigDxe/WatchdogConfigDx= e.inf + Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/Platfo= rmPcieDeviceConfigDxe.inf diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index 8f3df6ccf01b..ae444d702bbe 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -360,5 +360,6 @@ [FV.FvMain] 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 + INF Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/Pl= atformPcieDeviceConfigDxe.inf =20 !include Platform/Ampere/AmperePlatformPkg/FvRules.fdf.inc diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfig= Dxe/PlatformPcieDeviceConfigDxe.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers= /PlatformPcieDeviceConfigDxe/PlatformPcieDeviceConfigDxe.inf new file mode 100644 index 000000000000..79d7bd185b7d --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/Pla= tformPcieDeviceConfigDxe.inf @@ -0,0 +1,59 @@ +## @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 PlatformPcieDeviceConfigDxe + FILE_GUID =3D 17E9369D-0A1B-45F4-A286-B1DED6D85D33 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D PlatformPcieDeviceConfigEntryPoint + +[Sources.common] + PlatformPcieDeviceConfigDxe.c + PlatformPcieDeviceConfigDxe.h + PlatformPcieDeviceConfigDxe.uni + PlatformPcieDeviceConfigVfr.h + PlatformPcieDeviceConfigVfr.vfr + PlatformPcieHelper.c + PlatformPcieHelper.h + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + DevicePathLib + HiiLib + MemoryAllocationLib + PrintLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + UefiRuntimeServicesTableLib + +[Protocols] + gEfiPciIoProtocolGuid + gEfiDevicePathProtocolGuid ## CONSUMES + gEfiHiiConfigRoutingProtocolGuid ## CONSUMES + gEfiHiiConfigAccessProtocolGuid ## PRODUCES + gEfiDevicePathToTextProtocolGuid + +[Guids] + gEfiIfrTianoGuid + gPlatformPcieDeviceConfigFormSetGuid + gPlatformManagerFormsetGuid + gPlatformManagerEntryEventGuid + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfig= Dxe/PlatformPcieDeviceConfigDxe.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/P= latformPcieDeviceConfigDxe/PlatformPcieDeviceConfigDxe.h new file mode 100644 index 000000000000..a39257da06ba --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/Pla= tformPcieDeviceConfigDxe.h @@ -0,0 +1,78 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef PLATFORM_PCIE_DEVICE_CONFIG_H_ +#define PLATFORM_PCIE_DEVICE_CONFIG_H_ + +#include + +#include +#include +#include +#include +#include +#include + +#include "PlatformPcieDeviceConfigVfr.h" + +#define MAX_STRING_SIZE 100 + +#define PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('P', 'E', 'D', 'C') +#define PRIVATE_DATA_FROM_THIS(a) \ + CR (a, PRIVATE_DATA, ConfigAccess, 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() + +// +// 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 PlatformPcieDeviceConfigVfrBin[]; + +// +// 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 PlatformPcieDeviceConfigDxeStrings[]; + +typedef struct { + UINTN Signature; + + EFI_HANDLE DriverHandle; + EFI_HII_HANDLE HiiHandle; + VARSTORE_DATA LastVarStoreConfig; + 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; +} PRIVATE_DATA; + +#endif // PLATFORM_PCIE_DEVICE_CONFIG_H_ diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfig= Dxe/PlatformPcieDeviceConfigVfr.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/P= latformPcieDeviceConfigDxe/PlatformPcieDeviceConfigVfr.h new file mode 100644 index 000000000000..ee4469ea5a2a --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/Pla= tformPcieDeviceConfigVfr.h @@ -0,0 +1,56 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef PLATFORM_PCIE_DEVICE_CONFIG_VFR_H_ +#define PLATFORM_PCIE_DEVICE_CONFIG_VFR_H_ + +#include + +#define VARSTORE_NAME L"PlatformPcieDeviceConfigNVData" + +#define MAIN_FORM_ID 0x01 +#define DEVICE_FORM_ID 0x02 +#define VARSTORE_ID 0x03 + +#define MAIN_LABEL_UPDATE 0x21 +#define MAIN_LABEL_END 0x22 +#define DEVICE_LABEL_UPDATE 0x31 +#define DEVICE_LABEL_END 0x32 + +#define DEVICE_KEY 0x6000 +#define MPS_ONE_OF_KEY 0x7000 +#define MRR_ONE_OF_KEY 0x8000 + +#define MAX_DEVICE 40 + +#define DEFAULT_MPS 0x00 // Section 7.5.3.4 +#define DEFAULT_MRR 0x02 // Section 7.5.3.4 + +#define PCIE_ADD(Vid, Did, Seg, Bus, Dev) \ + (UINT64)(Vid) << 40 | (UINT64)(Did) << 24 | Seg << 16 | Bus << 8 |= Dev; + +#pragma pack(1) + +typedef struct { + UINT8 DEV; + UINT8 BUS; + UINT8 SEG; + UINT16 DID; + UINT16 VID; + UINT8 SlotId; +} SLOT_INFO; + +typedef struct { + UINT8 MPS[MAX_DEVICE]; + UINT8 MRR[MAX_DEVICE]; + UINT64 SlotInfo[MAX_DEVICE]; +} VARSTORE_DATA; + +#pragma pack() + +#endif /* PLATFORM_PCIE_DEVICE_CONFIG_VFR_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfig= Dxe/PlatformPcieHelper.h b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPc= ieDeviceConfigDxe/PlatformPcieHelper.h new file mode 100644 index 000000000000..56aed0379539 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/Pla= tformPcieHelper.h @@ -0,0 +1,58 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef PLATFORM_PCIE_HELPER_H_ +#define PLATFORM_PCIE_HELPER_H_ + +#define PCIE_MAX_PAYLOAD_MASK 0x07 +#define PCIE_CONTROL_MAX_PAYLOAD_OFF 5 +#define PCIE_MAX_READ_REQUEST_MASK 0x07 +#define PCIE_CONTROL_READ_REQUEST_OFF 12 + +#define PCI_EXPRESS_CAPABILITY_DEVICE_CAPABILITIES_REG 0x04 +#define PCI_EXPRESS_CAPABILITY_DEVICE_CONTROL_REG 0x08 + +#define FOR_EACH(Node, Tail, Type) \ + for (Node =3D Tail->Type; Node !=3D NULL; Node =3D Node->Type) + +struct _PCIE_NODE { + EFI_PCI_IO_PROTOCOL *PciIo; + UINT8 MaxMps; + UINT8 PcieCapOffset; + UINT16 Vid; + UINT16 Did; + UINT8 Seg; + UINT8 Bus; + UINT8 Dev; + UINT8 Fun; + struct _PCIE_NODE *Parent; + struct _PCIE_NODE *Brother; +}; + +typedef struct _PCIE_NODE PCIE_NODE; + +EFI_STATUS +WriteMps ( + PCIE_NODE *Node, + UINT8 Value + ); + +EFI_STATUS +WriteMrr ( + PCIE_NODE *Node, + UINT8 Value + ); + +EFI_STATUS +FindCapabilityPtr ( + IN EFI_PCI_IO_PROTOCOL *PciIo, + IN UINT8 CapabilityId, + OUT UINT8 *CapabilityPtr + ); + +#endif // PLATFORM_PCIE_HELPER_H_ diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Guid/PlatformPcieDeviceC= onfigHii.h b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/PlatformPcieDeviceC= onfigHii.h new file mode 100644 index 000000000000..ed592a0027ed --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/PlatformPcieDeviceConfigHi= i.h @@ -0,0 +1,19 @@ +/** @file + + Copyright (c) 2020 - 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef PLATFORM_PCIE_DEVICE_CONFIG_HII_H_ +#define PLATFORM_PCIE_DEVICE_CONFIG_HII_H_ + +#define PLATFORM_PCIE_DEVICE_CONFIG_FORMSET_GUID \ + { \ + 0xEC7B1D21, 0x9167, 0x4B9D, { 0xF7, 0x94, 0xCD, 0x1A, 0xEB, 0xBC, 0xB7= , 0x59 } \ + } + +extern EFI_GUID gPlatformPcieDeviceConfigFormSetGuid; + +#endif /* PLATFORM_PCIE_DEVICE_CONFIG_HII_H_ */ diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfig= Dxe/PlatformPcieDeviceConfigVfr.vfr b/Silicon/Ampere/AmpereAltraPkg/Drivers= /PlatformPcieDeviceConfigDxe/PlatformPcieDeviceConfigVfr.vfr new file mode 100644 index 000000000000..27ca33164e23 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/Pla= tformPcieDeviceConfigVfr.vfr @@ -0,0 +1,50 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include "PlatformPcieDeviceConfigVfr.h" + +formset + guid =3D PLATFORM_PCIE_DEVICE_CONFIG_FORMSET_GUID, + title =3D STRING_TOKEN(STR_DEVICE_CONFIG_FORM), + help =3D STRING_TOKEN(STR_DEVICE_CONFIG_HELP), + classguid =3D gPlatformManagerFormsetGuid, + + // + // Define a variable Storage + // + varstore VARSTORE_DATA, + varid =3D VARSTORE_ID, + name =3D PlatformPcieDeviceConfigNVData, + guid =3D PLATFORM_PCIE_DEVICE_CONFIG_FORMSET_GUID; + + form + formid =3D MAIN_FORM_ID, + title =3D STRING_TOKEN(STR_DEVICE_CONFIG_FORM); + + subtitle text =3D STRING_TOKEN(STR_DEVICE_CONFIG_FORM); + + label MAIN_LABEL_UPDATE; + // dynamic content here + label MAIN_LABEL_END; + + endform; + + form + formid =3D DEVICE_FORM_ID, + title =3D STRING_TOKEN(STR_DEVICE_FORM); + + subtitle text =3D STRING_TOKEN(STR_DEVICE_FORM); + + label DEVICE_LABEL_UPDATE; + // dynamic content here + label DEVICE_LABEL_END; + + endform; + +endformset; diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfig= Dxe/PlatformPcieDeviceConfigDxe.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/P= latformPcieDeviceConfigDxe/PlatformPcieDeviceConfigDxe.c new file mode 100644 index 000000000000..b06014529c7b --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/Pla= tformPcieDeviceConfigDxe.c @@ -0,0 +1,1045 @@ +/** @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 +#include +#include +#include +#include + +#include "PlatformPcieDeviceConfigDxe.h" +#include "PlatformPcieHelper.h" + +VOID *mPciProtocolNotifyRegistration; +CHAR16 *mVariableName =3D VARSTORE_NAME; +PCIE_NODE *mDeviceBuf[MAX_DEVICE] =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) + } + }, + PLATFORM_PCIE_DEVICE_CONFIG_FORMSET_GUID + }, + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { + (UINT8)(END_DEVICE_PATH_LENGTH), + (UINT8)((END_DEVICE_PATH_LENGTH) >> 8) + } + } +}; + +VOID +FlushDeviceData ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + PCIE_NODE *Node; + PRIVATE_DATA *PrivateData; + UINT8 Index; + VARSTORE_DATA *LastVarStoreConfig; + VARSTORE_DATA *VarStoreConfig; + + PrivateData =3D (PRIVATE_DATA *)Context; + LastVarStoreConfig =3D &PrivateData->LastVarStoreConfig; + VarStoreConfig =3D &PrivateData->VarStoreConfig; + + // + // If config has changed, update NVRAM + // + if (CompareMem (VarStoreConfig, LastVarStoreConfig, sizeof (VARSTORE_DAT= A)) !=3D 0) { + DEBUG ((DEBUG_INFO, "%a Update Device Config Variable\n", __FUNCTION__= )); + Status =3D gRT->SetVariable ( + mVariableName, + &gPlatformPcieDeviceConfigFormSetGuid, + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_A= CCESS, + sizeof (VARSTORE_DATA), + VarStoreConfig + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: Failed to set variable status %r", + __FUNCTION__, + Status + )); + return; + } + } + + // Iterate through the list, then write corresponding MPS MRR + for (Index =3D 0; Index < MAX_DEVICE; Index++) { + if (mDeviceBuf[Index] =3D=3D NULL) { + continue; + } + + // Write MPS value + WriteMps (mDeviceBuf[Index], VarStoreConfig->MPS[Index]); + + FOR_EACH (Node, mDeviceBuf[Index], Parent) { + WriteMps (Node, VarStoreConfig->MPS[Index]); + } + + FOR_EACH (Node, mDeviceBuf[Index], Brother) { + WriteMps (Node, VarStoreConfig->MPS[Index]); + } + + // Write MRR value + // No need to update MRR of parent node + WriteMrr (mDeviceBuf[Index], VarStoreConfig->MRR[Index]); + + FOR_EACH (Node, mDeviceBuf[Index], Brother) { + WriteMrr (Node, VarStoreConfig->MRR[Index]); + } + } + + gBS->CloseEvent (Event); +} + +EFI_STATUS +UpdateDeviceForm ( + UINT8 Index, + PRIVATE_DATA *PrivateData + ) +{ + CHAR16 Str[MAX_STRING_SIZE]; + UINT8 MaxMps; + + VOID *StartOpCodeHandle; + EFI_IFR_GUID_LABEL *StartLabel; + VOID *EndOpCodeHandle; + EFI_IFR_GUID_LABEL *EndLabel; + VOID *MpsOpCodeHandle; + VOID *MrrOpCodeHandle; + PCIE_NODE *Node; + + if (mDeviceBuf[Index] =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + MaxMps =3D mDeviceBuf[Index]->MaxMps; + FOR_EACH (Node, mDeviceBuf[Index], Parent) { + if (Node->MaxMps < MaxMps) { + MaxMps =3D Node->MaxMps; + } + } + + UnicodeSPrint ( + Str, + sizeof (Str), + L"PCIe Device 0x%04x:0x%04x", + mDeviceBuf[Index]->Vid, + mDeviceBuf[Index]->Did + ); + + HiiSetString ( + PrivateData->HiiHandle, + STRING_TOKEN (STR_DEVICE_FORM), + 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) + ); + StartLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + StartLabel->Number =3D DEVICE_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 DEVICE_LABEL_END; + + // Create Option OpCode for MPS selection + MpsOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (MpsOpCodeHandle !=3D NULL); + + switch (MaxMps) { + case 5: + HiiCreateOneOfOptionOpCode ( + MpsOpCodeHandle, + STRING_TOKEN (STR_4096), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 5 + ); + + case 4: + HiiCreateOneOfOptionOpCode ( + MpsOpCodeHandle, + STRING_TOKEN (STR_2048), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 4 + ); + + case 3: + HiiCreateOneOfOptionOpCode ( + MpsOpCodeHandle, + STRING_TOKEN (STR_1024), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 3 + ); + + case 2: + HiiCreateOneOfOptionOpCode ( + MpsOpCodeHandle, + STRING_TOKEN (STR_512), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 2 + ); + + case 1: + HiiCreateOneOfOptionOpCode ( + MpsOpCodeHandle, + STRING_TOKEN (STR_256), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 1 + ); + + case 0: + HiiCreateOneOfOptionOpCode ( + MpsOpCodeHandle, + STRING_TOKEN (STR_128), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 0 + ); + } + + // Create MPS OneOf + HiiCreateOneOfOpCode ( + StartOpCodeHandle, // Container for dynamic created opc= odes + (MPS_ONE_OF_KEY + Index), // Question ID (or call it "key") + VARSTORE_ID, // VarStore ID + Index, // Offset in Buffer Storage + STRING_TOKEN (STR_PCIE_MPS), // Question prompt text + STRING_TOKEN (STR_PCIE_MPS_HELP), // Question help text + EFI_IFR_FLAG_CALLBACK, // Question flag + EFI_IFR_NUMERIC_SIZE_1, // Data type of Question Value + MpsOpCodeHandle, // Option Opcode list + NULL // Default Opcode is NULl + ); + + // Create Option OpCode for MRR selection + MrrOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (MrrOpCodeHandle !=3D NULL); + + HiiCreateOneOfOptionOpCode ( + MrrOpCodeHandle, + STRING_TOKEN (STR_4096), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 5 + ); + + HiiCreateOneOfOptionOpCode ( + MrrOpCodeHandle, + STRING_TOKEN (STR_2048), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 4 + ); + + HiiCreateOneOfOptionOpCode ( + MrrOpCodeHandle, + STRING_TOKEN (STR_1024), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 3 + ); + + HiiCreateOneOfOptionOpCode ( + MrrOpCodeHandle, + STRING_TOKEN (STR_512), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 2 + ); + + HiiCreateOneOfOptionOpCode ( + MrrOpCodeHandle, + STRING_TOKEN (STR_256), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 1 + ); + + HiiCreateOneOfOptionOpCode ( + MrrOpCodeHandle, + STRING_TOKEN (STR_128), + 0, + EFI_IFR_NUMERIC_SIZE_1, + 0 + ); + + // Create MRR OneOf + HiiCreateOneOfOpCode ( + StartOpCodeHandle, // Container for dynamic created opc= odes + (MRR_ONE_OF_KEY + Index), // Question ID (or call it "key") + VARSTORE_ID, // VarStore ID + MAX_DEVICE + Index, // Offset in Buffer Storage + STRING_TOKEN (STR_PCIE_MRR), // Question prompt text + STRING_TOKEN (STR_PCIE_MRR_HELP), // Question help text + EFI_IFR_FLAG_CALLBACK, // Question flag + EFI_IFR_NUMERIC_SIZE_1, // Data type of Question Value + MrrOpCodeHandle, // Option Opcode list + NULL // Default Opcode is NULl + ); + + HiiUpdateForm ( + PrivateData->HiiHandle, // HII handle + &gPlatformPcieDeviceConfigFormSetGuid, // Formset GUID + DEVICE_FORM_ID, // Form ID + StartOpCodeHandle, // Label for where to insert opcodes + EndOpCodeHandle // Insert data + ); + + HiiFreeOpCodeHandle (StartOpCodeHandle); + HiiFreeOpCodeHandle (EndOpCodeHandle); + HiiFreeOpCodeHandle (MpsOpCodeHandle); + HiiFreeOpCodeHandle (MrrOpCodeHandle); + return EFI_SUCCESS; +} + +VOID +OnPciIoProtocolNotify ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_PCI_IO_PROTOCOL *PciIo; + EFI_STATUS Status; + EFI_HANDLE HandleBuffer; + PCI_TYPE00 Pci; + + UINTN BufferSize; + UINTN PciBusNumber; + UINTN PciDeviceNumber; + UINTN PciFunctionNumber; + UINTN PciSegment; + + UINT8 Idx; + UINT8 CapabilityPtr; + UINT16 TmpValue; + UINT64 SlotInfo; + + PCIE_NODE *Node; + PRIVATE_DATA *PrivateData; + STATIC PCIE_NODE *LastNode; + STATIC UINT8 Index; + STATIC UINT8 LastBus; + + VARSTORE_DATA *LastVarStoreConfig; + VARSTORE_DATA *VarStoreConfig; + + PrivateData =3D (PRIVATE_DATA *)Context; + LastVarStoreConfig =3D &PrivateData->LastVarStoreConfig; + VarStoreConfig =3D &PrivateData->VarStoreConfig; + + while (TRUE) { + BufferSize =3D sizeof (EFI_HANDLE); + Status =3D gBS->LocateHandle ( + ByRegisterNotify, + NULL, + mPciProtocolNotifyRegistration, + &BufferSize, + &HandleBuffer + ); + if (EFI_ERROR (Status)) { + break; + } + + Status =3D gBS->HandleProtocol ( + HandleBuffer, + &gEfiPciIoProtocolGuid, + (VOID **)&PciIo + ); + if (EFI_ERROR (Status)) { + break; + } + + // Get device bus location + Status =3D PciIo->GetLocation ( + PciIo, + &PciSegment, + &PciBusNumber, + &PciDeviceNumber, + &PciFunctionNumber + ); + if (EFI_ERROR (Status) || + ((PciBusNumber =3D=3D 0) && (PciDeviceNumber =3D=3D 0))) + { + // Filter out Host Bridge + DEBUG ((DEBUG_INFO, "Filter out Host Bridge %x\n", PciSegment)); + continue; + } + + DEBUG (( + DEBUG_INFO, + ">> Dev 0x%04x:0x%02x:0x%02x:0x%02x\n", + PciSegment, + PciBusNumber, + PciDeviceNumber, + PciFunctionNumber + )); + + Status =3D FindCapabilityPtr (PciIo, EFI_PCI_CAPABILITY_ID_PCIEXP, &Ca= pabilityPtr); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: PCI Express Capability not found\n", + __FUNCTION__ + )); + continue; + } + + // Get Device's max MPS support + Status =3D PciIo->Pci.Read ( + PciIo, + EfiPciIoWidthUint16, + CapabilityPtr + PCI_EXPRESS_CAPABILITY_DEVICE_CA= PABILITIES_REG, + 1, + &TmpValue + ); + if (EFI_ERROR (Status)) { + continue; + } + + // Read device's VID:PID + Status =3D PciIo->Pci.Read ( + PciIo, + EfiPciIoWidthUint32, + 0, + sizeof (Pci) / sizeof (UINT32), + &Pci + ); + if (EFI_ERROR (Status)) { + continue; + } + DEBUG (( + DEBUG_INFO, + "VendorId 0x%04x - DeviceId 0x%04x\n", + Pci.Hdr.VendorId, + Pci.Hdr.DeviceId + )); + + Node =3D AllocateZeroPool (sizeof (*Node)); + Node->MaxMps =3D TmpValue & PCIE_MAX_PAYLOAD_MASK; + Node->PcieCapOffset =3D CapabilityPtr; + Node->PciIo =3D PciIo; + Node->Seg =3D PciSegment; + Node->Bus =3D PciBusNumber; + Node->Dev =3D PciDeviceNumber; + Node->Fun =3D PciFunctionNumber; + Node->Vid =3D Pci.Hdr.VendorId; + Node->Did =3D Pci.Hdr.DeviceId; + SlotInfo =3D PCIE_ADD (Node->Vid, Node->Did, Node->Seg, Node->Bus, Nod= e->Dev); + + // Presume child devices were registered follow root port + if (PciBusNumber !=3D 0) { + if (LastBus =3D=3D 0) { + Node->Parent =3D LastNode; + mDeviceBuf[Index] =3D Node; + + VarStoreConfig->MPS[Index] =3D DEFAULT_MPS; + VarStoreConfig->MRR[Index] =3D DEFAULT_MRR; + VarStoreConfig->SlotInfo[Index] =3D SlotInfo; + + // Retrieve setting from previous variable + for (Idx =3D 0; Idx < MAX_DEVICE; Idx++) { + if (SlotInfo =3D=3D LastVarStoreConfig->SlotInfo[Idx]) { + VarStoreConfig->MPS[Index] =3D LastVarStoreConfig->MPS[Idx]; + VarStoreConfig->MRR[Index] =3D LastVarStoreConfig->MRR[Idx]; + break; + } + } + + Index++; + } else if (PciBusNumber =3D=3D LastBus) { + LastNode->Brother =3D Node; + } else { + // Ignore devices don't stay under root port + continue; + } + } + + LastBus =3D PciBusNumber; + LastNode =3D Node; + } +} + +VOID +UpdateMainForm ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + UINTN Index; + EFI_STRING_ID StrId; + CHAR16 Str[MAX_STRING_SIZE]; + VOID *StartOpCodeHandle; + EFI_IFR_GUID_LABEL *StartLabel; + VOID *EndOpCodeHandle; + EFI_IFR_GUID_LABEL *EndLabel; + PRIVATE_DATA *PrivateData; + + DEBUG ((DEBUG_INFO, "%a Entry ...\n", __FUNCTION__)); + + PrivateData =3D (PRIVATE_DATA *)Context; + + // + // 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 MAIN_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 MAIN_LABEL_END; + + for (Index =3D 0; Index < MAX_DEVICE; Index++) { + if (mDeviceBuf[Index] =3D=3D NULL) { + break; + } + DEBUG ((DEBUG_INFO, ">> Add item %d\n", Index)); + + UnicodeSPrint ( + Str, + sizeof (Str), + L"PCIe Device 0x%04x:0x%04x - %04x:%02x:%02x", + mDeviceBuf[Index]->Vid, + mDeviceBuf[Index]->Did, + mDeviceBuf[Index]->Seg, + mDeviceBuf[Index]->Bus, + mDeviceBuf[Index]->Dev + ); + + StrId =3D HiiSetString (PrivateData->HiiHandle, 0, Str, NULL); + + // + // Create a Goto OpCode to device configuration + // + HiiCreateGotoOpCode ( + StartOpCodeHandle, // Container for dynamic create= d opcodes + DEVICE_FORM_ID, // Target Form ID + StrId, // Prompt text + STRING_TOKEN (STR_DEVICE_GOTO_HELP), // Help text + EFI_IFR_FLAG_CALLBACK, // Question flag + (DEVICE_KEY + Index) // Question ID + ); + } + + HiiUpdateForm ( + PrivateData->HiiHandle, // HII handle + &gPlatformPcieDeviceConfigFormSetGuid, // Formset GUID + MAIN_FORM_ID, // Form ID + StartOpCodeHandle, // Label for where to insert opcodes + EndOpCodeHandle // Insert data + ); + + HiiFreeOpCodeHandle (StartOpCodeHandle); + HiiFreeOpCodeHandle (EndOpCodeHandle); + + gBS->CloseEvent (Event); +} + +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; + PRIVATE_DATA *PrivateData; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + EFI_STRING ConfigRequest; + EFI_STRING ConfigRequestHdr; + UINTN Size; + CHAR16 *StrPointer; + BOOLEAN AllocatedRequest; + VARSTORE_DATA *VarStoreConfig; + + 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 PRIVATE_DATA_FROM_THIS (This); + HiiConfigRouting =3D PrivateData->HiiConfigRouting; + VarStoreConfig =3D &PrivateData->VarStoreConfig; + ASSERT (VarStoreConfig !=3D NULL); + + BufferSize =3D sizeof (VARSTORE_DATA); + + 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 + // Null-terminator + // + ConfigRequestHdr =3D HiiConstructConfigHdr ( + &gPlatformPcieDeviceConfigFormSetGuid, + mVariableName, + PrivateData->DriverHandle + ); + if (ConfigRequestHdr =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + 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", + ConfigRequestHdr, + (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, &gPlatformPcieDeviceConfigFormSetGu= id, 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 *)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; + PRIVATE_DATA *PrivateData; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + VARSTORE_DATA *VarStoreConfig; + + if (Configuration =3D=3D NULL || Progress =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + PrivateData =3D PRIVATE_DATA_FROM_THIS (This); + HiiConfigRouting =3D PrivateData->HiiConfigRouting; + *Progress =3D Configuration; + VarStoreConfig =3D &PrivateData->VarStoreConfig; + ASSERT (VarStoreConfig !=3D NULL); + + // + // Check routing data in . + // Note: if only one Storage is used, then this checking could be skippe= d. + // + if (!HiiIsConfigHdrMatch ( + Configuration, + &gPlatformPcieDeviceConfigFormSetGuid, + NULL + )) + { + return EFI_NOT_FOUND; + } + + // + // 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 (VARSTORE_DATA); + Status =3D HiiConfigRouting->ConfigToBlock ( + HiiConfigRouting, + Configuration, + (UINT8 *)VarStoreConfig, + &BufferSize, + Progress + ); + + 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 + ) +{ + EFI_STATUS Status; + PRIVATE_DATA *PrivateData; + + 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 PRIVATE_DATA_FROM_THIS (This); + + switch (Action) { + case EFI_BROWSER_ACTION_CHANGING: + if ((QuestionId >=3D DEVICE_KEY) + & (QuestionId <=3D (DEVICE_KEY + MAX_DEVICE))) + { + Status =3D UpdateDeviceForm (QuestionId - DEVICE_KEY, PrivateData); + if (EFI_ERROR (Status)) { + return Status; + } + } + break; + + case EFI_BROWSER_ACTION_DEFAULT_STANDARD: + case EFI_BROWSER_ACTION_DEFAULT_MANUFACTURING: + if ((QuestionId >=3D MPS_ONE_OF_KEY) + & (QuestionId <=3D (MPS_ONE_OF_KEY + MAX_DEVICE))) + { + Value->u8 =3D DEFAULT_MPS; + } + + if ((QuestionId >=3D MRR_ONE_OF_KEY) + & (QuestionId <=3D (MRR_ONE_OF_KEY + MAX_DEVICE))) + { + Value->u8 =3D DEFAULT_MRR; + } + break; + + case EFI_BROWSER_ACTION_SUBMITTED: + break; + } + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +PlatformPcieDeviceConfigEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_HANDLE DriverHandle; + EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting; + EFI_HII_HANDLE HiiHandle; + EFI_STATUS Status; + EFI_EVENT PlatformUiEntryEvent; + EFI_EVENT FlushDeviceEvent; + EFI_EVENT PciProtocolNotifyEvent; + PRIVATE_DATA *PrivateData; + UINTN BufferSize; + + DriverHandle =3D NULL; + PrivateData =3D AllocateZeroPool (sizeof (*PrivateData)); + if (PrivateData =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + PrivateData->Signature =3D PRIVATE_DATA_SIGNATURE; + + PrivateData->ConfigAccess.ExtractConfig =3D ExtractConfig; + PrivateData->ConfigAccess.RouteConfig =3D RouteConfig; + PrivateData->ConfigAccess.Callback =3D DriverCallback; + + // + // Locate ConfigRouting protocol + // + Status =3D gBS->LocateProtocol ( + &gEfiHiiConfigRoutingProtocolGuid, + NULL, + (VOID **)&HiiConfigRouting + ); + if (EFI_ERROR (Status)) { + goto Exit; + } + PrivateData->HiiConfigRouting =3D HiiConfigRouting; + + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &DriverHandle, + &gEfiDevicePathProtocolGuid, + &mHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &PrivateData->ConfigAccess, + NULL + ); + if (EFI_ERROR (Status)) { + goto Exit; + } + + PrivateData->DriverHandle =3D DriverHandle; + + // + // Publish our HII data + // + HiiHandle =3D HiiAddPackages ( + &gPlatformPcieDeviceConfigFormSetGuid, + DriverHandle, + PlatformPcieDeviceConfigDxeStrings, + PlatformPcieDeviceConfigVfrBin, + NULL + ); + if (HiiHandle =3D=3D NULL) { + Status =3D EFI_OUT_OF_RESOURCES; + goto Exit; + } + PrivateData->HiiHandle =3D HiiHandle; + + // Event to fixup screen + Status =3D gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_CALLBACK, + UpdateMainForm, + (VOID *)PrivateData, + &gPlatformManagerEntryEventGuid, + &PlatformUiEntryEvent + ); + if (EFI_ERROR (Status)) { + goto Exit; + } + + // Event to collect PciIo + PciProtocolNotifyEvent =3D EfiCreateProtocolNotifyEvent ( + &gEfiPciIoProtocolGuid, + TPL_CALLBACK, + OnPciIoProtocolNotify, + (VOID *)PrivateData, + &mPciProtocolNotifyRegistration + ); + ASSERT (PciProtocolNotifyEvent !=3D NULL); + + // Event to flush device data + Status =3D gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_CALLBACK, + FlushDeviceData, + (VOID *)PrivateData, + &gEfiEventReadyToBootGuid, + &FlushDeviceEvent + ); + if (EFI_ERROR (Status)) { + goto Exit; + } + + // Verify varstore + BufferSize =3D sizeof (VARSTORE_DATA); + Status =3D gRT->GetVariable ( + mVariableName, + &gPlatformPcieDeviceConfigFormSetGuid, + NULL, + &BufferSize, + &PrivateData->LastVarStoreConfig + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Last config is not found\n", __FUNCTION__)); + } + + return EFI_SUCCESS; + +Exit: + FreePool (PrivateData); + return Status; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfig= Dxe/PlatformPcieHelper.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPc= ieDeviceConfigDxe/PlatformPcieHelper.c new file mode 100644 index 000000000000..6bd753ef327f --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/Pla= tformPcieHelper.c @@ -0,0 +1,191 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include + +#include "PlatformPcieDeviceConfigDxe.h" +#include "PlatformPcieHelper.h" + +EFI_STATUS +FindCapabilityPtr ( + IN EFI_PCI_IO_PROTOCOL *PciIo, + IN UINT8 CapabilityId, + OUT UINT8 *CapabilityPtr + ) +{ + EFI_STATUS Status; + UINT8 NextPtr; + UINT16 TmpValue; + + ASSERT (PciIo !=3D NULL); + + // + // Get pointer to first PCI Capability header + // + Status =3D PciIo->Pci.Read ( + PciIo, + EfiPciIoWidthUint8, + PCI_CAPBILITY_POINTER_OFFSET, + 1, + &NextPtr + ); + if (EFI_ERROR (Status)) { + goto Exit; + } + + while (TRUE) { + if (NextPtr =3D=3D 0x00) { + Status =3D EFI_NOT_FOUND; + goto Exit; + } + + // + // Retrieve PCI Capability header + // + Status =3D PciIo->Pci.Read ( + PciIo, + EfiPciIoWidthUint16, + NextPtr, + 1, + &TmpValue + ); + if (EFI_ERROR (Status)) { + goto Exit; + } + + if ((TmpValue & 0xFF) =3D=3D CapabilityId) { + *CapabilityPtr =3D NextPtr; + Status =3D EFI_SUCCESS; + goto Exit; + } + + NextPtr =3D (TmpValue >> 8) & 0xFF; + } + +Exit: + return Status; +} + +EFI_STATUS +WriteMps ( + PCIE_NODE *Node, + UINT8 Value + ) +{ + EFI_PCI_IO_PROTOCOL *PciIo; + EFI_STATUS Status; + UINT16 TmpValue; + UINT8 PcieCapOffset; + + if (Node =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + PciIo =3D Node->PciIo; + PcieCapOffset =3D Node->PcieCapOffset; + + // Get current device control reg + Status =3D PciIo->Pci.Read ( + PciIo, + EfiPciIoWidthUint16, + PcieCapOffset + PCI_EXPRESS_CAPABILITY_DEVICE_CONT= ROL_REG, + 1, + &TmpValue + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // Update value and write to device + TmpValue =3D (TmpValue & ~(PCIE_MAX_PAYLOAD_MASK << PCIE_CONTROL_MAX_PAY= LOAD_OFF)) + | Value << PCIE_CONTROL_MAX_PAYLOAD_OFF; + Status =3D PciIo->Pci.Write ( + PciIo, + EfiPciIoWidthUint16, + PcieCapOffset + PCI_EXPRESS_CAPABILITY_DEVICE_CONT= ROL_REG, + 1, + &TmpValue + ); + if (EFI_ERROR (Status)) { + return Status; + } + DEBUG (( + DEBUG_INFO, + "%a: Write MPS %d to device 0x%04x:0x%02x:0x%02x:0x%02x\n", + __FUNCTION__, + Value, + Node->Seg, + Node->Bus, + Node->Dev, + Node->Fun + )); + + return EFI_SUCCESS; +} + +EFI_STATUS +WriteMrr ( + PCIE_NODE *Node, + UINT8 Value + ) +{ + EFI_PCI_IO_PROTOCOL *PciIo; + EFI_STATUS Status; + UINT16 TmpValue; + UINT8 PcieCapOffset; + + if (Node =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + PciIo =3D Node->PciIo; + PcieCapOffset =3D Node->PcieCapOffset; + + // Get current device control reg + Status =3D PciIo->Pci.Read ( + PciIo, + EfiPciIoWidthUint16, + PcieCapOffset + PCI_EXPRESS_CAPABILITY_DEVICE_CONT= ROL_REG, + 1, + &TmpValue + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // Update value and write to device + TmpValue =3D (TmpValue & ~(PCIE_MAX_READ_REQUEST_MASK << PCIE_CONTROL_RE= AD_REQUEST_OFF)) + | Value << PCIE_CONTROL_READ_REQUEST_OFF; + Status =3D PciIo->Pci.Write ( + PciIo, + EfiPciIoWidthUint16, + PcieCapOffset + PCI_EXPRESS_CAPABILITY_DEVICE_CONT= ROL_REG, + 1, + &TmpValue + ); + if (EFI_ERROR (Status)) { + return Status; + } + DEBUG (( + DEBUG_INFO, + "%a: Write MRR %d to device 0x%04x:0x%02x:0x%02x:0x%02x\n", + __FUNCTION__, + Value, + Node->Seg, + Node->Bus, + Node->Dev, + Node->Fun + )); + + return EFI_SUCCESS; +} diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfig= Dxe/PlatformPcieDeviceConfigDxe.uni b/Silicon/Ampere/AmpereAltraPkg/Drivers= /PlatformPcieDeviceConfigDxe/PlatformPcieDeviceConfigDxe.uni new file mode 100644 index 000000000000..f6cd94ffee36 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/PlatformPcieDeviceConfigDxe/Pla= tformPcieDeviceConfigDxe.uni @@ -0,0 +1,24 @@ +=EF=BB=BF// +// Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// + +#langdef en-US "English" // English + +#string STR_DEVICE_CONFIG_FORM #language en-US "PCIE Device Configuration" +#string STR_DEVICE_CONFIG_HELP #language en-US "PCIE Device Configuration" + +#string STR_DEVICE_FORM #language en-US "PCIE Device Form" +#string STR_DEVICE_GOTO_HELP #language en-US "PCIE Device Configuration" + +#string STR_PCIE_MPS #language en-US "Max Payload Size" +#string STR_PCIE_MPS_HELP #language en-US "Max Payload Size" +#string STR_PCIE_MRR #language en-US "Max Read Request Size" +#string STR_PCIE_MRR_HELP #language en-US "Max Read Request Size" +#string STR_128 #language en-US "128 bytes" +#string STR_256 #language en-US "256 bytes" +#string STR_512 #language en-US "512 bytes" +#string STR_1024 #language en-US "1024 bytes" +#string STR_2048 #language en-US "2048 bytes" +#string STR_4096 #language en-US "4096 bytes" --=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 (#80729): https://edk2.groups.io/g/devel/message/80729 Mute This Topic: https://groups.io/mt/85631216/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-