From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 1C90B740032 for ; Thu, 23 May 2024 07:26:32 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=zeKq8fTo1WE5lnv1g0mY7kBFKbG4Kj7OXETekBImg3U=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:msip_labels:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240206; t=1716449191; v=1; b=oqdW70z5FoeReqXrFewXqBAYY6AfVDqX52DK14cKhUTvtKqFiSCDEc4AwMm1I6Z/jDpw+cPA d5OEBuCGpyy1IzkD6dqZdaYun7tCeiNqzTzzg9c8Mw5EIAVuH97Aku72AF79rrcRfxwhj2Jp23Q A1QL2eaaQBpAyf1ZOAisSVm9t3sShwP0FwEnoI6L3mGABJbV2KFL2aSJHn+nUXcdSrGQeA3u81q AItI20sOeFupu3uKa+lbaznSFew87ruUqYpEdtB2SbFTBpskz6RuT/jwJpFC/JbqFEDRiTa5jFO QdDRfZfb/YAHBJJZ6fAAkVqTwKjXSPkOhAlIr57KZ88mg== X-Received: by 127.0.0.2 with SMTP id e9CDYY7687511xoh9cDGW6qX; Thu, 23 May 2024 00:26:31 -0700 X-Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.59]) by mx.groups.io with SMTP id smtpd.web10.9869.1716449186135082892 for ; Thu, 23 May 2024 00:26:27 -0700 X-Received: from PH0PR12MB5631.namprd12.prod.outlook.com (2603:10b6:510:144::7) by MW3PR12MB4379.namprd12.prod.outlook.com (2603:10b6:303:5e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.22; Thu, 23 May 2024 07:26:11 +0000 X-Received: from PH0PR12MB5631.namprd12.prod.outlook.com ([fe80::a5fb:39c8:b58c:4c44]) by PH0PR12MB5631.namprd12.prod.outlook.com ([fe80::a5fb:39c8:b58c:4c44%7]) with mapi id 15.20.7587.035; Thu, 23 May 2024 07:26:11 +0000 From: "Xing, Eric via groups.io" To: "Chang, Abner" , "devel@edk2.groups.io" CC: "Grimes, Paul" , "Attar, AbdulLateef (Abdul Lateef)" , "Fu, Igniculus" , "Yao, Ken" , "Zhai, MingXin (Duke)" Subject: Re: [edk2-devel] [edk2-platforms][PATCH 1/3] Platform/AMD: Initial commit of cross platform/board interfaces Thread-Topic: [edk2-platforms][PATCH 1/3] Platform/AMD: Initial commit of cross platform/board interfaces Thread-Index: AQHarMeEi8ZhI9oxl0Wg1QDp7PQy07Gka0CQ Date: Thu, 23 May 2024 07:26:11 +0000 Message-ID: References: <20240523041209.1661-1-abner.chang@amd.com> In-Reply-To: <20240523041209.1661-1-abner.chang@amd.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_ActionId=8682fb07-bca0-4a97-a14a-30e5fa29eb93;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_ContentBits=0;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Enabled=true;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Method=Standard;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_Name=AMD Internal Distribution Only;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_SetDate=2024-05-23T07:25:36Z;MSIP_Label_dce362fe-1558-4fb5-9f64-8a6240d76441_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH0PR12MB5631:EE_|MW3PR12MB4379:EE_ x-ms-office365-filtering-correlation-id: ac860eef-25de-4e9e-92b8-08dc7af99ef2 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: =?us-ascii?Q?+H9+nXnqymi60OYjDFkbGx3TBnpHhPM19sxnugfEOJuDqaih4ThsguUmN8VT?= =?us-ascii?Q?LYfKHVCePehocBdkko8icGZzX0Rlx5PT42HTmSS7TaWTNezlxiO6Rm07TSFo?= =?us-ascii?Q?Ua5BOx8oUu5ps7CkZKPe5KmAOmdbGZGBcxj/DKNxVAj/LUSYHGZDOeKPrgmS?= =?us-ascii?Q?Htqo2oN2+kEzEVO60KPmuSjWVTyyqi8N9mGv7xXudJ1HdyENC2o0YOr+9JRH?= =?us-ascii?Q?TgcDDp0iEO0NkH4gfwSZYkTrfhzQmXv2sR96MbrvrkZt4MdZVHe45TcShhxO?= =?us-ascii?Q?KwFCYYCY3whXuBmZsmQwlrMyHYkoE95Oh53RnaGUQ2565Tts9+tfu/e2E0A7?= =?us-ascii?Q?qPFbw8XDnju5swvmIzuAsKyr8ezcxiCZYwsDpOdMECEMVP2l7Q8HjPDgrZbe?= =?us-ascii?Q?fzgfgAT/jg7h/PyW+yEbs0nATb034tCSRikVSLpNg72tU/QusGD+cmEXdUUl?= =?us-ascii?Q?PIKoBcfZZo2VZBBiSQXUoSImpCulC5bMqFX869i7OsWq0SX2gpKeSsjcShkp?= =?us-ascii?Q?W+Rl0laksQ3c3OTsWpV94MHD1FCefRJ/LukxwSrBeQPkczgK9VloCEqgvPXh?= =?us-ascii?Q?g6yl9C1c5Urn/XBx+ZaUoyWAEiyjTiSHnxxocKIhrgMXC3fpJqUYPo/x0ehE?= =?us-ascii?Q?Q9pUkGL2uusg4ZBb0dm5s0Ph3ldpr9ZCdgYP+e2n3TnvhFj5lnm2jM1AZvqt?= =?us-ascii?Q?NxQkTXH18CzAhoCfdxUwonfxFUSinFG0tEF7SrhcxJzHGvFYVaiIC0kgYiYo?= =?us-ascii?Q?t5nv9KBNXfhKuMJoQs/7BXGYqVPNCzi2v3el8gkn9gTUdQwbXAL/V7il+pms?= =?us-ascii?Q?y3OImj6gPFTUKwNa8lm54CEWc06Qe9mXkVR8YBsCDxgysb+nfr0GejOJruwC?= =?us-ascii?Q?8qsweQ4cWdBu995/7yqQppE9Hsvbn+3b0Mbl3/LnLqgC1AlkShl+d68W2k11?= =?us-ascii?Q?+nZB3iLoMN/ECd5n8IEh94Eca9D393/G1fY0qdoePTtRqWJM5UdV+7VSEVU9?= =?us-ascii?Q?s6D7krYc02/G/+Ypa16r2J0A//ldHggOGXgrgu/VNgb79T37hNscBoj04pOj?= =?us-ascii?Q?b+uB3H+1ErOJcNodjffan4wdGG05wlF0Kg0aEQXbiGtx34okmdpheqsW7CtY?= =?us-ascii?Q?qUzwpHJT9KMKxJoyiDiLrEVsdTTafH1JEIF27oaoG7E0sZ2YBoAck/xTg2zU?= =?us-ascii?Q?7fzOHYQ5KpoW+jYS4nEHTGuYdI2PjZ0Hr8Je7tTFjZCNUHzfGnwxvqyIvlCn?= =?us-ascii?Q?viOBSKqJsuFVMCT6rNff1IT5S6VcvOMHIMngsN80qEC5S0O+QYcrdomt0EPB?= =?us-ascii?Q?Zq9aPGt066Bopw5pTDI1RVTjLdE2ofiAQ2FS1+z4FkHODw=3D=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?VxejVV6pFlXdpSDAtXXuXL3SEJ3jK/VFXmurtlpG4sgaws4NpIxedUqiJ4lD?= =?us-ascii?Q?ntLbC+fuj1iUb/zSvjwSr3OKV4wj/iSu47VCU9UpQRiGQFCFON14/M4tLT7r?= =?us-ascii?Q?LDvRpjAbKqbbQCarxTAtd/gq1s7ZCxmjer+DXH3+Bd628b6q1GhjM4u0UCMZ?= =?us-ascii?Q?yK0X8Pc3oORekx3uC7l4QnvojrAHe2akloXjoiWh0LzaGmCAetwQCNtxV0TL?= =?us-ascii?Q?X5PWWDUo9rwYTsrXbZsS/R8IO97Kp0UeQrdJm+P0CknNZUmz7b+EUdIY72sJ?= =?us-ascii?Q?BPJ3PjfUM58oGZKzrI5y2etyFb2yx5MBZmLbIlqM9sTYIW53cI3BI+0uTLSF?= =?us-ascii?Q?127WjAeFQ8DrvaPvTG7WmdOLshM7ePFV2aQ1fKKG4OxnYRN0+zsm2yu8ieID?= =?us-ascii?Q?G3HzkwftfIv0RHqSXCvNGMPIlxCnabWxIXNbVP22mSJEhs1H+LM97fqLB3d5?= =?us-ascii?Q?40CYRpbXcdGn8iyKYGVM3Voptl6yZ418KCM8w7iDV6J/zjmwy4EXOnb/5D7V?= =?us-ascii?Q?t5G3D2XIJPgUne6tJO26by2WySrLKNhMPmrqEtm3BzAEpRQK3GMAN7cyW6q2?= =?us-ascii?Q?NujcnqL0As3HadzncDu5zc0m9wqysOJ/DuA14ju5T4wBLZ/vK3VZLZ5N2o1c?= =?us-ascii?Q?IoBKFY8f08tVFNWJSR5wtmYRv5xiCOQWvrQ/WvcAMk4QNH36hebX65DJe3Up?= =?us-ascii?Q?Fe51aRTerGfxgkzVikeqQ/8C1oifGcrsUP1SoF942zUFbHIfOvdrAixCh6XB?= =?us-ascii?Q?6qdSFd31hwh6I9lSUtFu8vZONFWraGYWUClxB5h1SekUNXBZbKJbfrOwD3ud?= =?us-ascii?Q?NluPEYHJ+UO8urQC5VXYi7IWsy4WOWeI8T3l+iQGFGjqPYRV4sWj04MA35s3?= =?us-ascii?Q?re5AdRyHhZSAQ4k/qvWmgOhU4fy+T8aojdd9Tf7vbDA6wO1wUlXP2xDKM6pD?= =?us-ascii?Q?uvszgbgx3EKdNLtC+KcbEYOxPbQ7OwpHzKvEK7Mbj7XESZa0HuAmeyoKkLQA?= =?us-ascii?Q?TbaGv5G7xuHvmqdJl/qHWtbtKPeW9or2Fhd/JxXxgSU/HSRrLeKQbrSL7g45?= =?us-ascii?Q?oHEOX75oqaXG1uv1WpJNRJKrKajjD4DzWK7iBaXMrWr9ddUSdKOZ7p0wuDUu?= =?us-ascii?Q?KCAzgoMJ066PegPcn8N3yu2VGWrlJ/FneZBiVnALwiDjC54IzbviztrJOQOG?= =?us-ascii?Q?piRCHkDlvnAE1ymfnWhR2tj21eyl5Ys6131MlchjugVhhmBOVpPV4aqDr87Q?= =?us-ascii?Q?fZqDMMaq+8sMp2NCgvSvlaelzqhUQSeIDAW05stf27UPC9Rq2Ei6yc3UNPev?= =?us-ascii?Q?ddPq52Gk3gdnoVnBSRdLO6ZqWfps9FSxE3+9H7yg8SyLmmcfIfjGDq7T/5jM?= =?us-ascii?Q?WOgY0dxluc51wRGIwz6ioc3C8oQkKCLGH7SUkyHsi82wyHSeDoF0AOwAeKn6?= =?us-ascii?Q?CtAu+pmprADeSIPNBCxi5LNj+MnSkcVigLMr2peldcrYts8UvlPp99CF/57Z?= =?us-ascii?Q?u1Wd5pWZ5LZqQBigxpgcv/+QJG3nDe7csYIgPjhAnqNluUDotiI7cOAs07z7?= =?us-ascii?Q?UuyMu97FGq7Sm7jSzjc=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR12MB5631.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac860eef-25de-4e9e-92b8-08dc7af99ef2 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 May 2024 07:26:11.1532 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: XSaQyxW1t8jdoHclyhhPBC9Joy1on8FoCBr7r1uTvhfyMlFEf1rKFGrHmwObRFW0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4379 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Thu, 23 May 2024 00:26:27 -0700 Resent-From: eric.xing@amd.com Reply-To: devel@edk2.groups.io,eric.xing@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: jKecTFlIHbMgR3ZKHEd6qCvnx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=oqdW70z5; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io [AMD Official Use Only - AMD Internal Distribution Only] Thanks Abner for the up-stream. Looks good to me. Reviewed-by: Eric Xing > -----Original Message----- > From: Chang, Abner > Sent: Thursday, May 23, 2024 12:12 PM > To: devel@edk2.groups.io > Cc: Grimes, Paul ; Attar, AbdulLateef (Abdul Lateef) > ; Fu, Igniculus ; Yao, > Ken ; Xing, Eric ; Zhai, MingXin > (Duke) > Subject: [edk2-platforms][PATCH 1/3] Platform/AMD: Initial commit of cros= s > platform/board interfaces > > From: Abner Chang > > BZ#: 4777 > > Initial commit of AMD cross platform/board generic > encapsulated software architecture. This provides > the basic definitions and protocols for the follow-up > AMD open board project. > > Cc: Paul Grimes > Cc: Abdul Lateef Attar > Cc: Igniculus Fu > Cc: Ken Yao > Cc: Eric Xing > Cc: Duke Zhai > Signed-off-by: Abner Chang > --- > .../AgesaModulePkg/AgesaCommonModulePkg.dec | 39 + > Platform/AMD/AgesaModulePkg/AgesaEdk2Pkg.dec | 18 + > .../AMD/AgesaModulePkg/AgesaModuleCcxPkg.dec | 20 + > .../AMD/AgesaModulePkg/AgesaModuleDfPkg.dec | 25 + > .../AMD/AgesaModulePkg/AgesaModuleFchPkg.dec | 62 + > .../AMD/AgesaModulePkg/AgesaModuleMemPkg.dec | 26 + > .../AMD/AgesaModulePkg/AgesaModuleNbioPkg.dec | 34 + > .../AMD/AgesaModulePkg/AgesaModulePspPkg.dec | 29 + > Platform/AMD/AgesaPkg/AgesaPkg.dec | 435 +++ > Platform/AMD/AmdCpmPkg/AmdCpmPkg.dec | 41 + > .../AgesaEdk2PlatformPkg.inc.dsc | 18 + > .../AgesaSp5RsModulePkg.inc.dsc | 48 + > .../CbsInstanceNull/CbsInstanceNull.inc.dsc | 8 + > .../Genoa/AmdCpmGenoaQuartzPkg.inc.dsc | 11 + > .../AgesaSp5RsModulePkg.dxe.inc.fdf | 11 + > .../AgesaSp5RsModulePkg.pei.inc.fdf | 9 + > .../CbsInstanceNull.dxe.inc.fdf | 7 + > .../CbsInstanceNull.pei.inc.fdf | 7 + > .../0x19/RS/External/CbsStones.dxe.inc.fdf | 8 + > .../0x19/RS/External/CbsStones.pei.inc.fdf | 8 + > .../Genoa/AmdCpmGenoaQuartzPkg.dxe.inc.fdf | 7 + > .../Processor/Genoa/AmdCpmGenoaQuartzPkg.fdf | 10 + > .../Genoa/AmdCpmGenoaQuartzPkg.pei.inc.fdf | 7 + > .../Library/AmdCalloutLib/AmdCalloutLib.inf | 29 + > .../AmdPspMboxLibV2/AmdPspMboxLibV2.inf | 30 + > .../AmdPspRomArmorLib/AmdPspRomArmorLib.inf | 27 + > .../AmdPspRomArmorLibNull.inf | 26 + > .../Library/ApcbLibV3/ApcbLibV3.inf | 37 + > .../Library/ApcbLibV3Pei/ApcbLibV3Pei.inf | 32 + > .../BaseFabricTopologyRsLib.inf | 28 + > .../CcxTscTimerLib/BaseTscTimerLib.inf | 35 + > .../Library/CcxTscTimerLib/DxeTscTimerLib.inf | 42 + > .../Library/CcxTscTimerLib/PeiTscTimerLib.inf | 37 + > .../PciHostBridgeLib.inf | 42 + > .../DxeAmlGenerationLib/AmlGenerationLib.inf | 47 + > .../Library/FchBaseLib/FchBaseLib.inf | 26 + > .../FchBaseResetSystemLib.inf | 35 + > .../Library/FchEspiCmdLib/FchEspiCmdLib.inf | 33 + > .../Library/NbioHandleLib/NbioHandleLib.inf | 24 + > .../Library/PcieConfigLib/PcieConfigLib.inf | 25 + > .../Library/SmnAccessLib/SmnAccessLib.inf | 33 + > .../Library/CommonDxe/NbioCommonDxeLib.inf | 29 + > .../Psp/ApcbDrv/ApcbV3Dxe/ApcbV3Dxe.inf | 45 + > .../Psp/ApcbDrv/ApcbV3Pei/ApcbV3Pei.inf | 33 + > .../OemAgesaCcxPlatformLibNull.inf | 27 + > .../PciExpressPciCfg2/PciExpressPciCfg2.inf | 61 + > .../PciExpressPciSegmentInfoLib.inf | 32 + > .../AmdPspFlashAccSpiNorLibSmm.inf | 45 + > .../PspRomArmorWhitelistLib.inf | 32 + > .../Addendum/Oem/OobPprDxe/OobPprDxe.inf | 42 + > .../Dxe/PspPlatformDriver/PspPlatform.inf | 32 + > .../Dxe/ServerHotplugDxe/ServerHotplugDxe.inf | 29 + > .../AmdAutoDynamicCommand.inf | 53 + > .../AmdAutoDynamicCommand/AmdAutoToolApp.inf | 50 + > .../BasePlatformHookLibAmdFchUart.inf | 33 + > Platform/AMD/AgesaModulePkg/Include/AGESA.h | 158 + > Platform/AMD/AgesaModulePkg/Include/AMD.h | 91 + > .../Include/AmdEdk2/CpuRegisters.h | 15 + > .../AgesaModulePkg/Include/AmdPspDirectory.h | 61 + > .../AgesaModulePkg/Include/CpuRegistersDef.h | 156 + > .../Include/FchRegistersCommon.h | 85 + > .../AMD/AgesaModulePkg/Include/Filecode.h | 31 + > Platform/AMD/AgesaModulePkg/Include/Gnb.h | 14 + > Platform/AMD/AgesaModulePkg/Include/GnbDxio.h | 521 ++++ > .../AgesaModulePkg/Include/GnbRegistersRS.h | 18 + > .../Include/GnbRegistersRS/IOHC.h | 22 + > .../Include/Guid/GnbPcieInfoHob.h | 31 + > .../Include/Library/AmdBaseLib.h | 16 + > .../Include/Library/AmdPspMboxLibV2.h | 43 + > .../Include/Library/BaseFabricTopologyLib.h | 22 + > .../Include/Library/FchBaseLib.h | 16 + > .../Include/Library/FchEspiCmdLib.h | 413 +++ > .../Include/Library/GnbPcieConfigLib.h | 16 + > .../Include/Library/NbioCommonLibDxe.h | 37 + > .../Include/Library/NbioHandleLib.h | 62 + > .../Include/Library/PcieConfigLib.h | 283 ++ > .../Include/Library/SmnAccessLib.h | 30 + > .../Protocol/AmdNbioPcieServicesProtocol.h | 47 + > .../Include/Protocol/AmdOemOobPprProtocol.h | 14 + > .../Include/Protocol/FabricNumaServices2.h | 155 + > .../Protocol/FabricTopologyServices2.h | 14 + > .../AMD/AgesaModulePkg/Include/SocLogicalId.h | 23 + > .../Library/DxeAmlGenerationLib/LocalAmlLib.h | 100 + > .../DxeAmlGenerationLib/LocalAmlObjects.h | 150 + > .../AMD/AgesaPkg/Include/AmdPcieComplex.h | 432 +++ > Platform/AMD/AgesaPkg/Include/AmdSoc.h | 17 + > .../Include/FabricResourceManagerCmn.h | 42 + > .../AgesaPkg/Include/Guid/AmdMemoryInfoHob.h | 96 + > .../Include/Library/AmdPspBaseLibV2.h | 51 + > .../AgesaPkg/Include/Library/AmdPspFtpmLib.h | 83 + > .../Include/Library/AmdPspRomArmorLib.h | 231 ++ > .../Include/Library/AmlGenerationLib.h | 2722 +++++++++++++++++ > .../Library/PlatformPspRomArmorWhitelistLib.h | 25 + > .../AMD/AgesaPkg/Include/Ppi/AmdPspFtpmPpi.h | 134 + > .../Include/Protocol/AmdCxlServicesProtocol.h | 183 ++ > .../Protocol/AmdPciResourcesProtocol.h | 110 + > .../Include/Protocol/AmdPspFtpmProtocol.h | 187 ++ > .../FabricResourceManagerServicesProtocol.h | 14 + > Platform/AMD/AmdCpmPkg/Include/AmdCpmBase.h | 19 + > Platform/AMD/AmdCpmPkg/Include/AmdCpmCommon.h | 78 + > Platform/AMD/AmdCpmPkg/Include/AmdCpmDefine.h | 17 + > .../AMD/AmdCpmPkg/Include/AmdCpmFunction.h | 32 + > .../AmdCpmTableProtocol/AmdCpmTableProtocol.h | 39 + > .../Library/AmdPspMboxLibV2/AmdPspMboxLibV2.c | 31 + > .../AmdPspRomArmorLib/AmdPspRomArmorLib.c | 12 + > .../AmdPspRomArmorLibNull.c | 79 + > .../Library/ApcbLibV3/ApcbLibV3.c | 12 + > .../Library/ApcbLibV3Pei/ApcbLibV3Pei.c | 14 + > .../BaseFabricTopologyRsLib.c | 37 + > .../Library/CcxTscTimerLib/BaseTscTimerLib.c | 8 + > .../Library/CcxTscTimerLib/DxeTscTimerLib.c | 35 + > .../Library/CcxTscTimerLib/PeiTscTimerLib.c | 11 + > .../Library/CcxTscTimerLib/TscTimerLibShare.c | 103 + > .../DxeAmdPciHostBridgeLib/PciHostBridgeLib.c | 95 + > .../DxeAmlGenerationLib/AmlArgObjects.c | 154 + > .../DxeAmlGenerationLib/AmlAssistFunctions.c | 151 + > .../DxeAmlGenerationLib/AmlDataObjects.c | 640 ++++ > .../AmlExpressionOpcodes.c | 1294 ++++++++ > .../DxeAmlGenerationLib/AmlLocalObjects.c | 158 + > .../DxeAmlGenerationLib/AmlNameString.c | 576 ++++ > .../DxeAmlGenerationLib/AmlNamedObject.c | 2138 +++++++++++++ > .../AmlNamespaceModifierObjects.c | 360 +++ > .../DxeAmlGenerationLib/AmlObjectsDebug.c | 144 + > .../DxeAmlGenerationLib/AmlPkgLength.c | 267 ++ > .../AmlResourceDescriptor.c | 1989 ++++++++++++ > .../DxeAmlGenerationLib/AmlStatementOpcodes.c | 515 ++++ > .../Library/DxeAmlGenerationLib/AmlTable.c | 213 ++ > .../DxeAmlGenerationLib/LocalAmlObjects.c | 364 +++ > .../Library/FchBaseLib/FchStallLib.c | 13 + > .../FchBaseResetSystemLib.c | 90 + > .../Library/FchEspiCmdLib/FchEspiCmdLib.c | 87 + > .../Library/NbioHandleLib/NbioHandleLib.c | 68 + > .../Library/PcieConfigLib/PcieConfigLib.c | 276 ++ > .../PcieConfigLib/PcieInputParserLib.c | 117 + > .../Library/SmnAccessLib/SmnAccessLib.c | 10 + > .../Nbio/Library/CommonDxe/DxeLibFunctions.c | 42 + > .../Psp/ApcbDrv/ApcbV3Dxe/ApcbV3Dxe.c | 23 + > .../Psp/ApcbDrv/ApcbV3Pei/ApcbV3Pei.c | 29 + > .../OemAgesaCcxPlatformLibNull.c | 39 + > .../PciExpressPciCfg2/PciExpressPciCfg2.c | 33 + > .../PciSegmentInfoLib.c | 30 + > .../AmdPspFlashAccSpiNorLibSmm.c | 15 + > .../PspRomArmorWhitelistLib.c | 12 + > .../Addendum/Oem/OobPprDxe/OobPprDxe.c | 36 + > .../Dxe/PspPlatformDriver/PspPlatformDriver.c | 20 + > .../Dxe/ServerHotplugDxe/ServerHotplugDxe.c | 22 + > .../AmdAutoDynamicCommand.c | 44 + > .../AmdAutoDynamicCommand/AmdAutoToolApp.c | 36 + > .../BasePlatformHookLibAmdFchUart.c | 29 + > .../FchSongshanDxe/FchSongshanI2C_I3C.asl | 9 + > .../AMD/AgesaPkg/Include/AmdUefiStackNasm.inc | 13 + > .../Library/RiscVOpensbiLib/opensbi | 2 +- > 152 files changed, 19669 insertions(+), 1 deletion(-) > create mode 100644 > Platform/AMD/AgesaModulePkg/AgesaCommonModulePkg.dec > create mode 100644 Platform/AMD/AgesaModulePkg/AgesaEdk2Pkg.dec > create mode 100755 > Platform/AMD/AgesaModulePkg/AgesaModuleCcxPkg.dec > create mode 100755 > Platform/AMD/AgesaModulePkg/AgesaModuleDfPkg.dec > create mode 100644 > Platform/AMD/AgesaModulePkg/AgesaModuleFchPkg.dec > create mode 100644 > Platform/AMD/AgesaModulePkg/AgesaModuleMemPkg.dec > create mode 100755 > Platform/AMD/AgesaModulePkg/AgesaModuleNbioPkg.dec > create mode 100644 > Platform/AMD/AgesaModulePkg/AgesaModulePspPkg.dec > create mode 100644 Platform/AMD/AgesaPkg/AgesaPkg.dec > create mode 100755 Platform/AMD/AmdCpmPkg/AmdCpmPkg.dec > create mode 100644 > Platform/AMD/AgesaModulePkg/AgesaEdk2PlatformPkg.inc.dsc > create mode 100644 > Platform/AMD/AgesaModulePkg/AgesaSp5RsModulePkg.inc.dsc > create mode 100644 > Platform/AMD/AmdCbsPkg/Library/CbsInstanceNull/CbsInstanceNull.inc.dsc > create mode 100644 > Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Processor/Genoa/Amd > CpmGenoaQuartzPkg.inc.dsc > create mode 100644 > Platform/AMD/AgesaModulePkg/AgesaSp5RsModulePkg.dxe.inc.fdf > create mode 100644 > Platform/AMD/AgesaModulePkg/AgesaSp5RsModulePkg.pei.inc.fdf > create mode 100644 > Platform/AMD/AmdCbsPkg/Library/CbsInstanceNull/CbsInstanceNull.dxe.inc.f > df > create mode 100644 > Platform/AMD/AmdCbsPkg/Library/CbsInstanceNull/CbsInstanceNull.pei.inc.f > df > create mode 100644 > Platform/AMD/AmdCbsPkg/Library/Family/0x19/RS/External/CbsStones.dxe.i > nc.fdf > create mode 100644 > Platform/AMD/AmdCbsPkg/Library/Family/0x19/RS/External/CbsStones.pei.in > c.fdf > create mode 100644 > Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Processor/Genoa/Amd > CpmGenoaQuartzPkg.dxe.inc.fdf > create mode 100644 > Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Processor/Genoa/Amd > CpmGenoaQuartzPkg.fdf > create mode 100644 > Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Processor/Genoa/Amd > CpmGenoaQuartzPkg.pei.inc.fdf > create mode 100755 > Platform/AMD/AgesaModulePkg/Library/AmdCalloutLib/AmdCalloutLib.inf > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/AmdPspMboxLibV2/AmdPspMboxLi > bV2.inf > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/AmdPspRomArmorLib/AmdPspRom > ArmorLib.inf > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/AmdPspRomArmorLibNull/AmdPspR > omArmorLibNull.inf > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/ApcbLibV3/ApcbLibV3.inf > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/ApcbLibV3Pei/ApcbLibV3Pei.inf > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/BaseFabricTopologyRsLib/BaseFabri > cTopologyRsLib.inf > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/BaseTscTimerLib.inf > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/DxeTscTimerLib.inf > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/PeiTscTimerLib.inf > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/DxeAmdPciHostBridgeLib/PciHostBri > dgeLib.inf > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlGenerati > onLib.inf > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/FchBaseLib/FchBaseLib.inf > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/FchBaseResetSystemLib/FchBaseRes > etSystemLib.inf > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/FchEspiCmdLib/FchEspiCmdLib.inf > create mode 100755 > Platform/AMD/AgesaModulePkg/Library/NbioHandleLib/NbioHandleLib.inf > create mode 100755 > Platform/AMD/AgesaModulePkg/Library/PcieConfigLib/PcieConfigLib.inf > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/SmnAccessLib/SmnAccessLib.inf > create mode 100644 > Platform/AMD/AgesaModulePkg/Nbio/Library/CommonDxe/NbioCommonDx > eLib.inf > create mode 100644 > Platform/AMD/AgesaModulePkg/Psp/ApcbDrv/ApcbV3Dxe/ApcbV3Dxe.inf > create mode 100644 > Platform/AMD/AgesaModulePkg/Psp/ApcbDrv/ApcbV3Pei/ApcbV3Pei.inf > create mode 100755 > Platform/AMD/AgesaPkg/Addendum/Ccx/OemAgesaCcxPlatformLibNull/Oem > AgesaCcxPlatformLibNull.inf > create mode 100644 > Platform/AMD/AgesaPkg/Addendum/PciSegments/PciExpressPciCfg2/PciExpr > essPciCfg2.inf > create mode 100644 > Platform/AMD/AgesaPkg/Addendum/PciSegments/PciExpressPciSegmentInfo > Lib/PciExpressPciSegmentInfoLib.inf > create mode 100644 > Platform/AMD/AgesaPkg/Addendum/Psp/AmdPspFlashAccSpiNorLibSmm/Am > dPspFlashAccSpiNorLibSmm.inf > create mode 100644 > Platform/AMD/AgesaPkg/Addendum/Psp/PspRomArmorWhitelistLib/PspRom > ArmorWhitelistLib.inf > create mode 100644 > Platform/AMD/AmdCpmPkg/Addendum/Oem/OobPprDxe/OobPprDxe.inf > create mode 100644 > Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Dxe/PspPlatformDriver > /PspPlatform.inf > create mode 100644 > Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Dxe/ServerHotplugDxe > /ServerHotplugDxe.inf > create mode 100644 > Platform/AMD/AmdCpmPkg/Library/AmdAutoDynamicCommand/AmdAutoDy > namicCommand.inf > create mode 100644 > Platform/AMD/AmdCpmPkg/Library/AmdAutoDynamicCommand/AmdAutoTo > olApp.inf > create mode 100644 > Platform/AMD/AmdCpmPkg/Library/CommonLib/BasePlatformHookLibAmdFc > hUart/BasePlatformHookLibAmdFchUart.inf > create mode 100644 Platform/AMD/AgesaModulePkg/Include/AGESA.h > create mode 100755 Platform/AMD/AgesaModulePkg/Include/AMD.h > create mode 100755 > Platform/AMD/AgesaModulePkg/Include/AmdEdk2/CpuRegisters.h > create mode 100644 > Platform/AMD/AgesaModulePkg/Include/AmdPspDirectory.h > create mode 100755 > Platform/AMD/AgesaModulePkg/Include/CpuRegistersDef.h > create mode 100644 > Platform/AMD/AgesaModulePkg/Include/FchRegistersCommon.h > create mode 100644 Platform/AMD/AgesaModulePkg/Include/Filecode.h > create mode 100755 Platform/AMD/AgesaModulePkg/Include/Gnb.h > create mode 100644 Platform/AMD/AgesaModulePkg/Include/GnbDxio.h > create mode 100644 > Platform/AMD/AgesaModulePkg/Include/GnbRegistersRS.h > create mode 100644 > Platform/AMD/AgesaModulePkg/Include/GnbRegistersRS/IOHC.h > create mode 100644 > Platform/AMD/AgesaModulePkg/Include/Guid/GnbPcieInfoHob.h > create mode 100644 > Platform/AMD/AgesaModulePkg/Include/Library/AmdBaseLib.h > create mode 100644 > Platform/AMD/AgesaModulePkg/Include/Library/AmdPspMboxLibV2.h > create mode 100644 > Platform/AMD/AgesaModulePkg/Include/Library/BaseFabricTopologyLib.h > create mode 100644 > Platform/AMD/AgesaModulePkg/Include/Library/FchBaseLib.h > create mode 100644 > Platform/AMD/AgesaModulePkg/Include/Library/FchEspiCmdLib.h > create mode 100755 > Platform/AMD/AgesaModulePkg/Include/Library/GnbPcieConfigLib.h > create mode 100644 > Platform/AMD/AgesaModulePkg/Include/Library/NbioCommonLibDxe.h > create mode 100755 > Platform/AMD/AgesaModulePkg/Include/Library/NbioHandleLib.h > create mode 100644 > Platform/AMD/AgesaModulePkg/Include/Library/PcieConfigLib.h > create mode 100644 > Platform/AMD/AgesaModulePkg/Include/Library/SmnAccessLib.h > create mode 100644 > Platform/AMD/AgesaModulePkg/Include/Protocol/AmdNbioPcieServicesProt > ocol.h > create mode 100644 > Platform/AMD/AgesaModulePkg/Include/Protocol/AmdOemOobPprProtocol. > h > create mode 100644 > Platform/AMD/AgesaModulePkg/Include/Protocol/FabricNumaServices2.h > create mode 100644 > Platform/AMD/AgesaModulePkg/Include/Protocol/FabricTopologyServices2.h > create mode 100755 > Platform/AMD/AgesaModulePkg/Include/SocLogicalId.h > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/LocalAmlLib. > h > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/LocalAmlObj > ects.h > create mode 100755 Platform/AMD/AgesaPkg/Include/AmdPcieComplex.h > create mode 100644 Platform/AMD/AgesaPkg/Include/AmdSoc.h > create mode 100644 > Platform/AMD/AgesaPkg/Include/FabricResourceManagerCmn.h > create mode 100644 > Platform/AMD/AgesaPkg/Include/Guid/AmdMemoryInfoHob.h > create mode 100644 > Platform/AMD/AgesaPkg/Include/Library/AmdPspBaseLibV2.h > create mode 100644 > Platform/AMD/AgesaPkg/Include/Library/AmdPspFtpmLib.h > create mode 100644 > Platform/AMD/AgesaPkg/Include/Library/AmdPspRomArmorLib.h > create mode 100644 > Platform/AMD/AgesaPkg/Include/Library/AmlGenerationLib.h > create mode 100644 > Platform/AMD/AgesaPkg/Include/Library/PlatformPspRomArmorWhitelistLib. > h > create mode 100644 > Platform/AMD/AgesaPkg/Include/Ppi/AmdPspFtpmPpi.h > create mode 100644 > Platform/AMD/AgesaPkg/Include/Protocol/AmdCxlServicesProtocol.h > create mode 100644 > Platform/AMD/AgesaPkg/Include/Protocol/AmdPciResourcesProtocol.h > create mode 100644 > Platform/AMD/AgesaPkg/Include/Protocol/AmdPspFtpmProtocol.h > create mode 100644 > Platform/AMD/AgesaPkg/Include/Protocol/FabricResourceManagerServicesP > rotocol.h > create mode 100644 Platform/AMD/AmdCpmPkg/Include/AmdCpmBase.h > create mode 100644 > Platform/AMD/AmdCpmPkg/Include/AmdCpmCommon.h > create mode 100644 Platform/AMD/AmdCpmPkg/Include/AmdCpmDefine.h > create mode 100644 > Platform/AMD/AmdCpmPkg/Include/AmdCpmFunction.h > create mode 100644 > Platform/AMD/AmdCpmPkg/Library/Protocol/AmdCpmTableProtocol/AmdCp > mTableProtocol.h > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/AmdPspMboxLibV2/AmdPspMboxLi > bV2.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/AmdPspRomArmorLib/AmdPspRom > ArmorLib.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/AmdPspRomArmorLibNull/AmdPspR > omArmorLibNull.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/ApcbLibV3/ApcbLibV3.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/ApcbLibV3Pei/ApcbLibV3Pei.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/BaseFabricTopologyRsLib/BaseFabri > cTopologyRsLib.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/BaseTscTimerLib.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/DxeTscTimerLib.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/PeiTscTimerLib.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/TscTimerLibShare.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/DxeAmdPciHostBridgeLib/PciHostBri > dgeLib.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlArgObjec > ts.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlAssistFun > ctions.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlDataObje > cts.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlExpressio > nOpcodes.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlLocalObj > ects.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlNameStri > ng.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlNamedO > bject.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlNamespa > ceModifierObjects.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlObjectsD > ebug.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlPkgLengt > h.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlResource > Descriptor.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlStatemen > tOpcodes.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlTable.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/LocalAmlObj > ects.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/FchBaseLib/FchStallLib.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/FchBaseResetSystemLib/FchBaseRes > etSystemLib.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/FchEspiCmdLib/FchEspiCmdLib.c > create mode 100755 > Platform/AMD/AgesaModulePkg/Library/NbioHandleLib/NbioHandleLib.c > create mode 100755 > Platform/AMD/AgesaModulePkg/Library/PcieConfigLib/PcieConfigLib.c > create mode 100755 > Platform/AMD/AgesaModulePkg/Library/PcieConfigLib/PcieInputParserLib.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Library/SmnAccessLib/SmnAccessLib.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Nbio/Library/CommonDxe/DxeLibFunctions. > c > create mode 100644 > Platform/AMD/AgesaModulePkg/Psp/ApcbDrv/ApcbV3Dxe/ApcbV3Dxe.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Psp/ApcbDrv/ApcbV3Pei/ApcbV3Pei.c > create mode 100644 > Platform/AMD/AgesaPkg/Addendum/Ccx/OemAgesaCcxPlatformLibNull/Oem > AgesaCcxPlatformLibNull.c > create mode 100644 > Platform/AMD/AgesaPkg/Addendum/PciSegments/PciExpressPciCfg2/PciExpr > essPciCfg2.c > create mode 100644 > Platform/AMD/AgesaPkg/Addendum/PciSegments/PciExpressPciSegmentInfo > Lib/PciSegmentInfoLib.c > create mode 100644 > Platform/AMD/AgesaPkg/Addendum/Psp/AmdPspFlashAccSpiNorLibSmm/Am > dPspFlashAccSpiNorLibSmm.c > create mode 100644 > Platform/AMD/AgesaPkg/Addendum/Psp/PspRomArmorWhitelistLib/PspRom > ArmorWhitelistLib.c > create mode 100644 > Platform/AMD/AmdCpmPkg/Addendum/Oem/OobPprDxe/OobPprDxe.c > create mode 100644 > Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Dxe/PspPlatformDriver > /PspPlatformDriver.c > create mode 100644 > Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Dxe/ServerHotplugDxe > /ServerHotplugDxe.c > create mode 100644 > Platform/AMD/AmdCpmPkg/Library/AmdAutoDynamicCommand/AmdAutoDy > namicCommand.c > create mode 100644 > Platform/AMD/AmdCpmPkg/Library/AmdAutoDynamicCommand/AmdAutoTo > olApp.c > create mode 100644 > Platform/AMD/AmdCpmPkg/Library/CommonLib/BasePlatformHookLibAmdFc > hUart/BasePlatformHookLibAmdFchUart.c > create mode 100644 > Platform/AMD/AgesaModulePkg/Fch/Songshan/FchSongshanDxe/FchSongsha > nI2C_I3C.asl > create mode 100644 > Platform/AMD/AgesaPkg/Include/AmdUefiStackNasm.inc > > diff --git a/Platform/AMD/AgesaModulePkg/AgesaCommonModulePkg.dec > b/Platform/AMD/AgesaModulePkg/AgesaCommonModulePkg.dec > new file mode 100644 > index 0000000000..d35a1f27b4 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/AgesaCommonModulePkg.dec > @@ -0,0 +1,39 @@ > +## @file > +# AMD Generic Encapsulated Software Architecture (AGESA) Common > Module Package DEC > +# file. > +# This file provides the minimum AMD SoC/Mircoporcessor definitions for > building > +# AMD edk2 modules. > +# > +# Copyright (C) 2016-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > +[Defines] > + DEC_SPECIFICATION =3D 0x00010005 > + PACKAGE_NAME =3D AgesaCommonPkg > + PACKAGE_GUID =3D 6CBE6566-0D3F-4E35-8358-9602354E9F09 > + PACKAGE_VERSION =3D 0.1 > + > +[Includes] > + Include > + > +[Guids] > + gEfiAmdAgesaModulePkgTokenSpaceGuid =3D {0x7788adf0, 0x9788, > 0x4a3f, {0x83, 0xfa, 0xcb, 0x51, 0x2e, 0x7c, 0xf8, 0xdd}} > + gAgesaConfigDbPointerVariableGuid =3D {0x21229d24, 0xc71d, 0x4b= c0, > {0xb6, 0x3e, 0x67, 0x2f, 0x6d, 0xbf, 0x5f, 0xf7}} > + gAmdMemoryInfoHobGuid =3D {0x1bce3d14, 0xa5fe, 0x4a= 0b, > {0x9a, 0x8d, 0x69, 0xca, 0x5d, 0x98, 0x38, 0xd3}} > + > +[Protocols] > + ## Soc Protocols > + gAmdSocLogicalIdProtocolGuid =3D {0x72f8e409, 0x0d2a, 0x4b= 91, > {0x88, 0x6f, 0xba, 0x13, 0x44, 0x9f, 0xd7, 0x78}} > + gAmdOemOobPprDxeProtocolGuid =3D {0x78031be3, 0x54a2, 0x48= 19, > {0xb5, 0xba, 0x32, 0x79, 0x04, 0xf3, 0xa8, 0x41}} > + > +[PcdsFixedAtBuild] > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdAmdMemMaxSocketSupported > V2|2|UINT8|0x00002002 # 2 by default > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdAmdMemMaxDiePerSocketV2| > 1|UINT8|0x00002003 # 1 by default > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdAmdMemMaxChannelPerDieV2 > |8|UINT8|0x00002004 # 8 by default > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdAmdMemMaxDimmPerChannel > V2|2|UINT8|0x00002005 # 2 by default > + > +[PcdsDynamic] > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdAmdS3LibTableSize|0x4000|UI > NT64|0x00027003 > + > diff --git a/Platform/AMD/AgesaModulePkg/AgesaEdk2Pkg.dec > b/Platform/AMD/AgesaModulePkg/AgesaEdk2Pkg.dec > new file mode 100644 > index 0000000000..1637068432 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/AgesaEdk2Pkg.dec > @@ -0,0 +1,18 @@ > +## @file > +# > +# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<= BR> > +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + DEC_SPECIFICATION =3D 0x00010005 > + PACKAGE_NAME =3D AgesaEdk2Pkg > + PACKAGE_GUID =3D E866104F-D458-41B1-AB26-FA5951618A8C > + PACKAGE_VERSION =3D 0.1 > + > +[Includes] > + Include/AmdEdk2 > + > + > diff --git a/Platform/AMD/AgesaModulePkg/AgesaModuleCcxPkg.dec > b/Platform/AMD/AgesaModulePkg/AgesaModuleCcxPkg.dec > new file mode 100755 > index 0000000000..b84fe5b738 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/AgesaModuleCcxPkg.dec > @@ -0,0 +1,20 @@ > +## @file > +# AMD Generic Encapsulated Software Architecture (AGESA) FCH Module > Package DEC > +# file. > +# This file provides the minimum AMD Core Complex package definitions fo= r > building AMD > +# edk2 modules. > +# > +# Copyright (C) 2016-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + DEC_SPECIFICATION =3D 0x00010005 > + PACKAGE_NAME =3D AgesaCcxPkg > + PACKAGE_GUID =3D df325429-029e-40f0-82db-0e69be7f6560 > + PACKAGE_VERSION =3D 0.1 > + > +[PcdsDynamic] > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdAmdCcxSingleBitErrLogging|FA > LSE|BOOLEAN|0x000CC029 > diff --git a/Platform/AMD/AgesaModulePkg/AgesaModuleDfPkg.dec > b/Platform/AMD/AgesaModulePkg/AgesaModuleDfPkg.dec > new file mode 100755 > index 0000000000..57db15e663 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/AgesaModuleDfPkg.dec > @@ -0,0 +1,25 @@ > +## @file > +# AMD Generic Encapsulated Software Architecture (AGESA) FCH Module > Package DEC > +# file. > +# This file provides the minimum AMD Data Fabric package definitions for > building AMD > +# edk2 modules. > +# > +# Copyright (C) 2016-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + DEC_SPECIFICATION =3D 0x00010005 > + PACKAGE_NAME =3D AgesaDfPkg > + PACKAGE_GUID =3D 81e51ee3-c347-4563-92fe-790ba953bf0f > + PACKAGE_VERSION =3D 0.1 > + > +[Guids] > + gAmdTotalNumberOfRootBridgesGuid =3D {0xfb5703f5, 0xf8a7, 0xf4= 01, > {0x18, 0xb4, 0x3f, 0x10, 0x8d, 0xeb, 0x26, 0x12}} > + gAmdResourceSizeForEachRbGuid =3D {0x542b8f2f, 0xbd52, 0x42= 33, > {0x8c, 0x3d, 0x66, 0x53, 0x0d, 0xe8, 0xa3, 0x69}} > + > +[Protocols] > + gAmdFabricNumaServices2ProtocolGuid =3D {0xa8ff2e64, 0xf319, 0x4a= f1, > {0x9e, 0xc8, 0x18, 0x89, 0x89, 0xc3, 0x1e, 0x4a}} > + > diff --git a/Platform/AMD/AgesaModulePkg/AgesaModuleFchPkg.dec > b/Platform/AMD/AgesaModulePkg/AgesaModuleFchPkg.dec > new file mode 100644 > index 0000000000..521957e809 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/AgesaModuleFchPkg.dec > @@ -0,0 +1,62 @@ > +## @file > +# AMD Generic Encapsulated Software Architecture (AGESA) FCH Module > Package DEC > +# file. > +# This file provides the minimum AMD Fusion Control Hub package > definitions for building AMD > +# edk2 modules. > +# > +# Copyright (C) 2016-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + DEC_SPECIFICATION =3D 1.5 > + PACKAGE_NAME =3D AgesaFchPkg > + PACKAGE_GUID =3D e47c8ed9-3000-4e6e-b1c6-875b365b3849 > + PACKAGE_VERSION =3D 0.1 > + > +[Includes] > + Include > + > +[Guids] > + gEfiAmdAgesaModulePkgTokenSpaceGuid =3D { 0x7788adf0, 0x9788, 0x4a3f, > { 0x83, 0xfa, 0xcb, 0x51, 0x2e, 0x7c, 0xf8, 0xdd } } > + > +[Protocols] > + gFchInitDonePolicyProtocolGuid =3D { 0xc63c0c73, 0xf612, 0x4c02, = { 0x84, > 0xa3, 0xc6, 0x40, 0xad, 0x0b, 0xa6, 0x22 } } > + > +[PcdsDynamic] > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdLegacyFree|FALSE|BOOLEAN| > 0x0003F001 > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdHpetEnable|TRUE|BOOLEAN|0 > x0003F002 > + > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdHpetMsiDis|TRUE|BOOLEAN|0 > x0003F003 > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdResetMode|0x00|UINT8|0x00 > 03F00D > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdNoneSioKbcSupport|FALSE|BO > OLEAN|0x0003F021 > + > + ### @brief This item allows the customer to change OC signal polarity = to be > active low. This is universal and applies to all OC pins. > + ### @brief Permitted Choices: (Type: Boolean)(Default: FALSE)At presen= t, > this control applies to Family17h Model 00h-2Fh. > + ### @li TRUE - OC pin is low when OC occurs. > + ### @li FALSE - OC pin is high when OC occurs. > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdXhciOcPolarityCfgLow|FALSE|B > OOLEAN|0x0003F309 > + > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdXhciUsb20OcPinSelect|0xFFFFF > FFFFFFFFFFF|UINT64|0x0003F340 > + = #Die 0 > + = #[7:0] SSP -- 2 USB 2.0 > ports on XHCI controller 0 > + = #[15:8] SSP -- 2 USB 2.0 > ports on XHCI controller 1 > + = #[23:0] MTS -- 6 USB > 2.0 ports on XHCI controller 0 > + = #Die 1 > + = #[39:32] SSP -- 2 USB > 2.0 ports on XHCI controller 0 > + = #[47:40] SSP -- 2 USB > 2.0 ports on XHCI controller 1 > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdXhciUsb31OcPinSelect|0xFFFFF > FFF|UINT32|0x0003F341 > + = #Die 0 > + = #[7:0] SSP -- 2 USB 3.1 > ports on XHCI controller 0 > + = #[15:8] SSP -- 2 USB 3.1 > ports on XHCI controller 1 > + = #[15:0] MTS -- 4 USB > 3.1 ports on XHCI controller 0 > + = #Die 1 > + = #[23:16] SSP -- 2 USB > 3.1 ports on XHCI controller 0 > + = #[31:24] SSP -- 2 USB > 3.1 ports on XHCI controller 1 > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdLpcEnable|TRUE|BOOLEAN|0x > 0003F400 > + > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdUsbRSOemConfigurationTable|{ > 0x0}|VOID*|0x0003F40A > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdXhciSsid|0x00000000|UINT32| > 0x0003FF07 > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.FchRTDeviceEnableMap|0x000000 > 00|UINT32|0x0003FF81 > diff --git a/Platform/AMD/AgesaModulePkg/AgesaModuleMemPkg.dec > b/Platform/AMD/AgesaModulePkg/AgesaModuleMemPkg.dec > new file mode 100644 > index 0000000000..721d3ea73b > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/AgesaModuleMemPkg.dec > @@ -0,0 +1,26 @@ > +## @file > +# AMD Generic Encapsulated Software Architecture (AGESA) NBIO Module > Package DEC > +# file. > +# This file provides the minimum AMD Memory package definitions for > building AMD > +# edk2 modules. > +# > +# Copyright (C) 2016-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + DEC_SPECIFICATION =3D 0x00010005 > + PACKAGE_NAME =3D AgesaMemPkg > + PACKAGE_GUID =3D 445f7303-3171-428c-ad0b-32df4474a7ad > + PACKAGE_VERSION =3D 0.1 > + > +[Includes] > + Include/ > + > +[PcdsFixedAtBuild] > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdAmdMemCfgMaxPostPackageR > epairEntries|64|UINT32|0x00029001 > + > + > + > diff --git a/Platform/AMD/AgesaModulePkg/AgesaModuleNbioPkg.dec > b/Platform/AMD/AgesaModulePkg/AgesaModuleNbioPkg.dec > new file mode 100755 > index 0000000000..0501774c9b > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/AgesaModuleNbioPkg.dec > @@ -0,0 +1,34 @@ > +## @file > +# AMD Generic Encapsulated Software Architecture (AGESA) NBIO Module > Package DEC > +# file. > +# This file provides the minimum AMD North Bridge I/O package definition= s > for building AMD > +# edk2 modules. > +# > +# Copyright (C) 2016-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + DEC_SPECIFICATION =3D 0x00010005 > + PACKAGE_NAME =3D AgesaNbioPkg > + PACKAGE_GUID =3D 1486f0fe-39ee-4856-a39f-222ff2404f26 > + PACKAGE_VERSION =3D 0.1 > + > +[Includes] > + Include > + > +[Protocols] > + gAmdNbioPcieServicesProtocolGuid =3D {0x756db75c, 0xbb9d, 0x4= 289, > {0x81, 0x3a, 0xdf, 0x21, 0x5, 0xc4, 0xf8, 0xe}} > + > +[PcdsFixedAtBuild] > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdCfgIommuMMIOAddressReserv > edEnable|FALSE|BOOLEAN|0x00021100 #///< 1: Enable Iommu MMIO > reserved from GNB driver. 0:Disable > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdCfgIoApicMMIOAddressReserv > edEnable|FALSE|BOOLEAN|0x00021101 #///< 1: Enable Ioapic MMIO > reserved from GNB driver. 0:Disable > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdCfgIoApicIdPreDefineEn|FALSE > |BOOLEAN|0x00021102 #///< TRUE: Enable assign IOAPIC ID at PEI > phase > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdCfgIoApicIdBase|0xF1|UINT8|0 > x00021103 #///< Base NBIO IOAPIC ID. ID assigned sta= rt from this > value > + > +[PcdsDynamic] > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdCfgGnbIoapicId|0|UINT8|0x00 > 04101D > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdCfgFchIoapicId|0|UINT8|0x000 > 4101E > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdSmuFeatureControlDefinesExt| > 0x0|UINT32|0x00041200 > diff --git a/Platform/AMD/AgesaModulePkg/AgesaModulePspPkg.dec > b/Platform/AMD/AgesaModulePkg/AgesaModulePspPkg.dec > new file mode 100644 > index 0000000000..41cf320c76 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/AgesaModulePspPkg.dec > @@ -0,0 +1,29 @@ > +## @file > +# AMD Generic Encapsulated Software Architecture (AGESA) NBIO Module > Package DEC > +# file. > +# This file provides the minimum AMD Platform Security Processor package > definitions > +# for building AMD edk2 modules. > +# > +# Copyright (C) 2016-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + DEC_SPECIFICATION =3D 0x00010005 > + PACKAGE_NAME =3D AgesaPspPkg > + PACKAGE_GUID =3D 5c48f900-a98c-431f-8be5-19c09c65bb05 > + PACKAGE_VERSION =3D 0.1 > + > +[Guids] > + gApSyncFlagNvVariableGuid =3D { 0xad3f6761, 0xf0a3, 0x46c8, { 0xa4, 0xc= b, > 0x19, 0xb7, 0x0f, 0xfd, 0xb3, 0x05 } } > + gAmdPspApobHobGuid =3D { 0x30b174f3, 0x7712, 0x4cca, { 0xbd, 0x1= 3, > 0xd0, 0xb8, 0xa8, 0x80, 0x19, 0x97 } } > + > +[Protocols] > + gPspFlashAccSmmCommReadyProtocolGuid =3D { 0x9f373486, 0xda76, 0x4c9f, > { 0x81, 0x55, 0x6c, 0xcd, 0xdb, 0x0b, 0x0b, 0x04 } } > + gAmdPspFtpmProtocolGuid =3D { 0xac234e04, 0xb036, 0x476c, = { 0x91, > 0x66, 0xbe, 0x47, 0x52, 0xa0, 0x95, 0x09 } } > + > +[Ppis] > + gAmdPspFtpmPpiGuid =3D { 0x91774185, 0xf72d, 0x467e, = { 0x93, > 0x39, 0xe0, 0x08, 0xdb, 0xae, 0x0e, 0x14 } } > + gAmdPspFtpmFactoryResetPpiGuid =3D { 0x9c98130a, 0x8921, 0x45eb, > { 0x86, 0xf3, 0x16, 0x04, 0x35, 0xc7, 0xc6, 0x40 } } > diff --git a/Platform/AMD/AgesaPkg/AgesaPkg.dec > b/Platform/AMD/AgesaPkg/AgesaPkg.dec > new file mode 100644 > index 0000000000..9377c64cc3 > --- /dev/null > +++ b/Platform/AMD/AgesaPkg/AgesaPkg.dec > @@ -0,0 +1,435 @@ > +## @file > +# AMD Generic Encapsulated Software Architecture (AGESA) Package DEC > +# file. > +# > +# Copyright (C) 2015-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > +[Defines] > + DEC_SPECIFICATION =3D 0x00010005 > + PACKAGE_NAME =3D AgesaPkg > + PACKAGE_GUID =3D DABFEFC6-5A79-444b-862A-1F6FE9F561FE > + PACKAGE_VERSION =3D 0.1 > + > +[Includes] > + Include > + > +[Guids] > + gEfiAmdAgesaPkgTokenSpaceGuid =3D { 0xd4d8435f, 0xfffb, 0x4acb, { 0xa0= , > 0x4d, 0xff, 0x0f, 0xad, 0x67, 0x7f, 0xe9 } } > + > +[Protocols] > + gAmdNbioCxlServicesProtocolGuid =3D {0x125CCFCE, 0x34AF, 0x422C= , > {0xB3, 0xB3, 0x71, 0x23, 0xA3, 0x1E, 0xC8, 0x61}} > + gAmdPciResourceProtocolGuid =3D {0x663d4897, 0xed94, 0x4f0f= , > {0x86, 0x64, 0xfe, 0xdc, 0x70, 0x30, 0x7f, 0x19}} > + gAmdCapsuleSmmHookProtocolGuid =3D {0x4fc43bbe, 0x1433, 0x4951= , > {0xac, 0x2d, 0x0d, 0x01, 0xfe, 0xc0, 0x0e, 0xb1}} > + gAmdFspSetupTableInitDoneGuid =3D {0xef5394c6, 0x566d, 0x440f= , > {0x9d, 0x05, 0xc0, 0xa3, 0x2c, 0xb9, 0x33, 0x58}} > + > +[Ppis] > + gAmdMemoryInfoHobPpiGuid =3D {0xba16e587, 0x1d66, 0x41b7= , > {0x9b, 0x52, 0xca, 0x4f, 0x2c, 0xad, 0x0d, 0xc8}} > + gCapsuleUpdateDetectedPpiGuid =3D {0x745dfc73, 0xc401, 0x4ced= , > {0x8d, 0x3b, 0x1a, 0x82, 0xf3, 0xda, 0xdc, 0xf8}} > + > +[PcdsFixedAtBuild] > + > + ### @brief Enable EDK-II Protocols > + ### @details This item enables support for EDKII implementation of ACP= I > Protocols when set to TRUE > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdCompliantEdkIIAcpiSdtProtocol|TRUE|B > OOLEAN|0x00020006 > + gEfiAmdAgesaPkgTokenSpaceGuid.PcdAgesaFlashNvStorageBlockSize > |0x1000|UINT32|0x00020007 > + > + ### @brief assign non volatile storage base address > + ### @details This assigns the base address to map to flash deivce. > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAgesaFlashAreaBaseAddress|0xFF0000 > 00|UINT32|0x00020017 > + > +#-----------------------------------------------------------------------= ----- > +#- FCH Fixed PCDs > +#- > +### Set Doxy_path: "PCD-FCH.h" > +#-----------------------------------------------------------------------= ----- > + > + ### @name General FCH Controls > + > + ### @brief Allows the host BIOS to specify the IO address for the ACPI= PM1 > register blocks as defined by ACPI spec. > + ### @brief Permitted Choices: (Type: Value)(Default: 0x0400) > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdFchCfgAcpiPm1EvtBlkAddr|0x400 > |UINT16|0x0002F004 > + > + ### @brief Allows the host BIOS to specify the IO address for the ACP= I > PM1Cnt register blocks as defined by ACPI spec. > + ### @brief Permitted Choices: (Type: Value)(Default: 0x0404) > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdFchCfgAcpiPm1CntBlkAddr|0x404 > |UINT16|0x0002F005 > + > + ### @brief Allows the host BIOS to specify the IO address for the ACPI= PM > Timer as defined by ACPI spec. > + ### @brief Permitted Choices: (Type: Value)(Default: 0x0408) > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdFchCfgAcpiPmTmrBlkAddr|0x408| > UINT16|0x0002F006 > + > + ### @brief Allows the host BIOS to specify the IO address for the ACPI= CPU > Control block as defined by ACPI spec. > + ### @brief Permitted Choices: (Type: Value)(Default: 0x0410) > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdFchCfgCpuControlBlkAddr|0x410| > UINT16|0x0002F007 > + > + ### @brief Allows the host BIOS to specify the IO address for the ACPI > GPE0 register block as defined by ACPI spec. > + ### @brief Permitted Choices: (Type: Value)(Default: 0x0420) > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdFchCfgAcpiGpe0BlkAddr|0x420|U > INT16|0x0002F008 > + > + ### @brief This item defines the SMI command value sent by the host BI= OS > during the S3 resume sequence, to re-initialize the > + ### FCH registers. This must be issued before the platform driver rest= ore > function is started. > + ### @brief Permitted Choices: (Type: Value)(Default: 0xD3) > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdFchOemBeforePciRestoreSwSmi|0xD3 > |UINT8|0x0002F010 > + > + ### @brief This item defines the SMI command used by the host BIOS to > signal the FCH driver that the platform driver has > + ### completed its restore function. This allows the FCH driver to perf= orm > some final FCH settings. > + ### @brief Permitted Choices: (Type: Value)(Default: 0xD4) > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdFchOemAfterPciRestoreSwSmi|0xD4|U > INT8|0x0002F011 > + > + ### @brief Allows the host BIOS to set the SMI command value used by t= he > OS to activate ACPI mode. > + ### @brief Permitted Choices: (Type: Value)(Default: 0xA0) > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdFchOemEnableAcpiSwSmi|0xA0|UINT8 > |0x0002F012 > + > + ### @brief Allows the host BIOS to set the SMI command value used by t= he > OS to turn off ACPI mode. > + ### @brief Permitted Choices: (Type: Value)(Default: 0xA1) > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdFchOemDisableAcpiSwSmi|0xA1|UINT > 8|0x0002F013 > + > + ### @brief SMI command used for releasing the SPI controller lock mode= . > All devices on the SPI bus will be writable. > + ### @brief Permitted Choices: (Type: Value)(Default: 0xAA) > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdFchOemSpiUnlockSwSmi|0xAA|UINT8| > 0x0002F014 > + > + ### @brief SMI command for setting the lock mode in the SPI controller= . > This will effectively provide a write protection to the > + ### SPI Flash ROM; however, write access to secondary SPI devices will= also > be blocked. > + ### @brief Permitted Choices: (Type: Value)(Default: 0xAB) > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdFchOemSpiLockSwSmi|0xAB|UINT8|0x > 0002F015 > +#-----------------------------------------------------------------------= ----- > +#- FCH Fixed PCDs > +#- > +### Set Doxy_path: "PCD-FCH-IRQ.h" > +#-----------------------------------------------------------------------= ----- > + > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdFchUart0Irq|0x03|UINT8|0x0002F01A > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdFchUart1Irq|0x0E|UINT8|0x0002F01B > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdFchUart2Irq|0x05|UINT8|0x0002F01C > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdFchUart3Irq|0x0F|UINT8|0x0002F01D > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdFchUart4Irq|0x10|UINT8|0x0002F01E > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdFchI2c0Irq|0x0A|UINT8|0x0002F01F > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdFchI2c1Irq|0x0B|UINT8|0x0002F020 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdFchI2c2Irq|0x04|UINT8|0x0002F021 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdFchI2c3Irq|0x06|UINT8|0x0002F022 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdFchI2c4Irq|0x16|UINT8|0x0002F023 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdFchI2c5Irq|0x17|UINT8|0x0002F024 > +#- DF Fixed PCDs > +#- > +### Set Doxy_path: "PCD-DF.h" > +#-----------------------------------------------------------------------= ----- > + > + #Fabric > + > + ### @name General DF Controls > + > + ### @brief This item informs the SMBios generation code as to how many > physical processor sockets exist in the system and > + ### therefore how many Type 4 SMBios records to produce. > + ### @brief Permitted Choices: (Type: Value)(Default: 0x01) > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdNumberOfPhysicalSocket|1|UINT8 > |0x000CC103 > +#-----------------------------------------------------------------------= ----- > +#- CCX Fixed PCDs > +#- > +### Set Doxy_path: "PCD-CCX-MTRR.h" > +#-----------------------------------------------------------------------= ----- > + > + > + ### @brief The base address of temporary page table for accessing PCIE > MMIO base address above 4G in PEI phase. > + ### @brief Permitted Choices: 0x0 - 0xFFFFFFFF (Type: Value)(Default: = 0) > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdPeiTempPageTableBaseAddress|0 > |UINT32|0x000CC11B > + > +#-----------------------------------------------------------------------= ----- > +#- CCX ACPI Fixed PCDs > +#- > +### Set Doxy_path: "PCD-CCX-ACPI.h" > +#-----------------------------------------------------------------------= ----- > + #ACPI > + # Cpu SSDT > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdAcpiCpuSsdtProcessorScopeName > 0|0x43|UINT8|0x000AC001 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdAcpiCpuSsdtProcessorScopeName > 1|0x30|UINT8|0x000AC002 > + ### @brief This element specifies whether the ACPI _PSS objects are > defined in the system bus or processor scope. > + ### @brief Permitted Choices: (Type: Boolean)(Default: FALSE) > + ### @li TRUE - The objects will be under the \_SB scope. > + ### @li FALSE - The objects will be under the \_PR scope > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdAcpiCpuSsdtProcessorScopeInSb| > FALSE|BOOLEAN|0x000AC003 > + > + ### @brief Set the OEM ID field in ACPI table outputs to this string. = The > string must conform to the ACPI rules for the OEM ID field. > + ### @brief Permitted Choices: (Type: Value)(Default: "AMD") > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdAcpiTableHeaderOemId|"AMD"|V > OID*|0x000AC004 > + > +#-----------------------------------------------------------------------= ----- > +#- CCX SMBIOS Fixed PCDs > +#- > +### Set Doxy_path: "PCD-CCX-SMBIOS.h" > +#-----------------------------------------------------------------------= ----- > + > + ### @name CCX SMBIOS Controls > + > + ### @brief When creating the SMBios table entry, use this as the label= for > the processor socket. This should match the > + ### silkscreen label on the motherboard. > + ### @brief Permitted Choices: (Type: Value)(Default: "Unknown") > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdSmbiosSocketDesignationSocket0| > "Unknown"|VOID*|0x00001001 > + > + ### @brief When creating the SMBios table entry, use this as the value= for > the 'serial number' field for each processor. > + ### @brief Permitted Choices: (Type: Value)(Default: "Unknown") > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdSmbiosSerialNumberSocket0|"Unk > nown"|VOID*|0x00001002 > + > + > + ### @brief When creating the SMBios table entry, use this as the value= for > the 'Asset Tag' field for each processor. > + ### @brief Permitted Choices: (Type: Value)(Default: "Unknown") > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdSmbiosAssetTagSocket0|"Unknow > n"|VOID*|0x00001003 > + > + ### @brief When creating the SMBios table entry, use this as the value= for > the 'Part Number' field for each processor. > + ### @brief Permitted Choices: (Type: Value)(Default: "Unknown") > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdSmbiosPartNumberSocket0|"Unkn > own"|VOID*|0x00001004 > + > + ### @brief SMBios socket 1 Label. > + ### @details When creating the SMBios table entry, use this as the lab= el > for the > + ### processor socket. This should match the silkscreen label on the > motherboard. > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdSmbiosSocketDesignationSocket1| > "Unknown"|VOID*|0x00001005 > + > + ### @brief SMBIOS socket 1 Serial Number. > + ### @details When creating the SMBios table entry, use this as the val= ue > for > + ### the 'serial number' field for the processor in socket 1. > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdSmbiosSerialNumberSocket1|"Unk > nown"|VOID*|0x00001006 > + > + ### @brief SMBios socket 1 Asset Tag. > + ### @details When creating the SMBios table entry, use this as the val= ue > for > + ### the 'Asset Tag' field for the processor in socket 1. > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdSmbiosAssetTagSocket1|"Unknow > n"|VOID*|0x00001007 > + > + ### @brief Socket 1 Part Number. > + ### @details When creating the SMBios table entry, use this as the val= ue > for > + ### the 'Part Number' field for the processor in socket 1. > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdSmbiosPartNumberSocket1|"Unkn > own"|VOID*|0x00001008 > + > +#-----------------------------------------------------------------------= ----- > +#- ACPI Fixed PCDs > +#- > +### Set Doxy_path: "PCD-ACPI.h" > +#-----------------------------------------------------------------------= ----- > + > + ### @name General ACPI Controls > + > + ### @brief PCD supporting maximum capacity for Type 16 table > + ### @details This PCD represents maximum memory capacity in KB > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdSmbiosT16MaximumCapacity|0x0 > 4000000|UINT32|0x00001009 # 4G - 0x00400000 > + = # 8G - 0x00800000 > + = # 16G - 0x01000000 > + = # 32G - 0x02000000 > + = # 64G - 0x04000000 > + = # 128G - 0x08000000 > + = # 256G - 0x10000000 > + = # 512G - 0x20000000 > +[PcdsDynamic] > +#-----------------------------------------------------------------------= ----- > +# System level Dynamic PCDs > +### Set Doxy_path: "PCD-Sys.h" > +#-----------------------------------------------------------------------= ----- > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdCStateIoBaseAddress|0x413|UINT > 16|0x000CC002 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdAcpiCpuSsdt|TRUE|BOOLEAN|0x0 > 00CC00B > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdApicMode|0xFF|UINT8|0x000CC0 > 1D > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdCpuWdtEn|TRUE|BOOLEAN|0x00 > 0CC200 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdAcpiCpuSsdtProcessorContainerIn > Sb|FALSE|BOOLEAN|0x000CC50B > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdAcpiCpuSsdtProcessorContainerNa > me|"PLTF"|VOID*|0x000CC50C > + > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdCcxCfgPFEHEnable|FALSE|BOOLEA > N|0x000CC601 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdSmbiosT4CpuMaxSpeed|0|UINT16 > |0x000CC900 > +#-----------------------------------------------------------------------= ----- > +#- DF Dynamic PCDs > +### Set Doxy_path: "PCD-DF.h" > +#-----------------------------------------------------------------------= ----- > + > + > + ### @cond (FF3||RN||BA||ZP||RMB||RPL||RS||SSP||MI3||BRH) > + ### @brief Specifies the top address to be used for MMIO space > allocations. No MMIO space will be used above this limit. Some devices ha= ve > limits on the address space they > + ### are able to access. For example a device with a 40-bit address > limitation can not use MMIO space above 1TeraByte (1T). By setting this P= CD > to 0x10000000000 (1T), MMIO > + ### space would not be allocated above 1T. The default is to use all o= f the > space above the end of physical memory. > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdMmioAbove4GLimit|0xFFFFFFFFFF > FFFFFF|UINT64|0x0003FFC2 > + ### @endcond > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdFabricResourceDefaultSizePtr|0|U > INT64|0x00DF0000 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdFchCfgSmiCmdPortAddr|0xB0|UIN > T16|0x0003FFC0 > + > + ### I2C-0 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdFchI2c0SdaHold|0x00000035|UIN > T32|0x000FC000 > + ### I2C-1 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdFchI2c1SdaHold|0x00000035|UIN > T32|0x000FC001 > + ### I2C-2 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdFchI2c2SdaHold|0x00000035|UIN > T32|0x000FC002 > + ### I2C-3 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdFchI2c3SdaHold|0x00000035|UIN > T32|0x000FC003 > + ### I2C-4 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdFchI2c4SdaHold|0x00000035|UIN > T32|0x000FC004 > + ### I2C-5 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdFchI2c5SdaHold|0x00000035|UIN > T32|0x000FC005 > + ### @} end of I2C hold times > + > +#-----------------------------------------------------------------------= ----- > +#- FCH Dynamic PCDs > +### Set Doxy_path: "PCD-FCH-UART.h" > +#-----------------------------------------------------------------------= ----- > + ### @name UART Legacy IO Assignments > + ### @{ > + ### @brief These controls allow the platform to specify the legacy IO > ranges that are to be used by the UART ports in the processor. Permitted > Choices: (Type: value)(Default: Disabled) > + ### @li 0 - Disabled > + ### @li 1 - IO range 0x02E8 - 0x02EF > + ### @li 2 - IO range 0x02F8 - 0x02FF > + ### @li 3 - IO range 0x03E8 - 0x03EF > + ### @li 4 - IO range 0x03F8 - 0x03FF > + > + > + > gEfiAmdAgesaPkgTokenSpaceGuid.FchUart0LegacyEnable|0x00|UINT8|0x000 > FC010 > + > gEfiAmdAgesaPkgTokenSpaceGuid.FchUart1LegacyEnable|0x00|UINT8|0x000 > FC011 > + > gEfiAmdAgesaPkgTokenSpaceGuid.FchUart2LegacyEnable|0x00|UINT8|0x000 > FC012 > + > gEfiAmdAgesaPkgTokenSpaceGuid.FchUart3LegacyEnable|0x00|UINT8|0x000 > FC013 > + ### @} end UART Legacy IO assignments > + > +#-----------------------------------------------------------------------= ----- > +#- FCH Dynamic PCDs > +### Set Doxy_path: "PCD-FCH-USB.h" > +#-----------------------------------------------------------------------= ----- > + > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdXhci0Enable|TRUE|BOOLEAN|0x000FC > 020 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdXhci1Enable|TRUE|BOOLEAN|0x000FC > 021 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdXhci2Enable|TRUE|BOOLEAN|0x000FC > 022 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdXhci3Enable|TRUE|BOOLEAN|0x000FC > 023 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdXhciECCDedErrRptEn|FALSE|BOOLEAN > |0x000FC024 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdSataEnable|TRUE|BOOLEAN|0x000FC0 > 30 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdSataStaggeredSpinup|FALSE|BOOLEAN > |0x000FC039 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdNvdimmEnable|FALSE|BOOLEAN|0x00 > 0A6024 > + > +#-----------------------------------------------------------------------= ----- > +#- NBIO Dynamic PCDs > +### Set Doxy_path: "PCD-NBIO-BMC.h" > +#-----------------------------------------------------------------------= ----- > + > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdEarlyBmcLinkTraining|FALSE|BOOLEAN > |0x0004F004 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdEarlyBmcLinkSocket|0xFF|UINT8|0x00 > 04F005 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdEarlyBmcLinkDie|0xFF|UINT8|0x0004F > 006 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdEarlyBmcLinkLaneNum|0|UINT8|0x000 > 4F03E > + > +#-----------------------------------------------------------------------= ----- > +#- NBIO Dynamic PCDs > +### Set Doxy_path: "PCD-NBIO.h" > +#-----------------------------------------------------------------------= ----- > + > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdCfgIommuSupport|TRUE|BOOLEAN|0x > 0004F027 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdIvInfoDmaReMap|FALSE|BOOLEAN|0x > 0004F028 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdTelemetry_VddcrVddfull_Scale_Curren > t|0x00|UINT32|0x0004F0A0 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdTelemetry_VddcrSocfull_Scale_Curren > t|0x00|UINT32|0x0004F0A2 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdEgressPoisonSeverityLo|0x4|UINT32|0 > x0004F210 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdEgressPoisonSeverityHi|0x30011|UINT > 32|0x0004F211 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdCxlProtocolErrorReporting|0|UINT > 8|0x0004F362 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdCxlComponentErrorReporting|0|U > INT8|0x0004F363 > + > +#-----------------------------------------------------------------------= ----- > +#- PSP Dynamic PCDs > +### Set Doxy_path: "PCD-PSP.h" > +#-----------------------------------------------------------------------= ----- > + ### PSP PCDs DYNAMIC > + > + ### @brief This feature selects the APCB recovery support on x86 side.= If > or when an instance of a writable APCB is determined to be invalid, the P= SP > driver will > + ### attempt a 'recovery' by copying the recovery instance of the APCB > (default values as indicated in the APCB descriptor files). Upon boot up,= the > ABL reads CMOS > + ### bytes 06/07 at index/data port of 0x72/0x73. If the CMOS flag read= s > anything else other than 0xA55A or 0x5555, the system boots in APCB > recovery mode, in which > + ### ABL consumes the recovery instances of APCB. Otherwise it boots in > normal/non-recovery mode. > + ### @brief Permitted Choices: (Type: Boolean)(Default: TRUE) > + ### @brief This feature is affected by the platform CMOS power design. > Please see Platform CMOS power . > + ### @li TRUE - the AGESA PSP driver restores the APCB instances from t= he > recovery instance, writes 0xA55A to the CMOS location and triggers a rese= t . > The next time > + ### the system powers up, ABL runs in normal/non-recovery mode. > + ### @li FALSE - the AGESA PSP driver writes 0x5555 to the CMOS locatio= n > without restoring the APCB instances or triggering a reset. In this mode = the > additional reset > + ### is avoided at the potential risk of the writeable APCB instance be= ing left > corrupted forever. > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdPspApcbRecoveryEnable|TRUE|B > OOLEAN|0x95940008 > + > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdPspAntiRollbackLateSplFuse|FALSE > |BOOLEAN|0x95940018 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdMemPostPackageRepair|TRUE|BO > OLEAN|0x00030004 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdMemBootTimePostPackageRepair| > TRUE|BOOLEAN|0x00030005 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdMemRuntimePostPackageRepair|F > ALSE|BOOLEAN|0x00030006 > +[PcdsDynamicEx] > + > +[PcdsFixedAtBuild, PcdsDynamic] > +#-----------------------------------------------------------------------= ----- > +#- System control PCDs > +### Set Doxy_path: "PCD-Sys.h" > +#-----------------------------------------------------------------------= ----- > + ### @brief Switch for Debug Print function > + ### @details Switch for Debug Print function to enable or not. > + ### @li TRUE: Enable IdsDebugPrint output > + ### @li FALSE: Disable IdsDebugPrint output > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdIdsDebugPrintEnable|FALSE|BOOL > EAN|0x00020004 > + ### @brief Specify the filter for IdsDebugPrint > + ### @details When the filter values are matched, the AmdIdsDebugPrint > can start to print debug message. > + ### Refer Library/IdsLib.h for details, and the Master token is > PcdAmdIdsDebugPrintEnable. > + ### @li 0x100401008A30042C: (GNB_TRACE | PCIE_MISC | NB_MISC | > GFX_MISC | CPU_TRACE | MEM_FLOW | MEM_STATUS | MEM_PMU | > FCH_TRACE | MAIN_FLOW| TEST_POINT | PSP_TRACE) > + ### @li 0x100401008A300408: (GNB_TRACE | PCIE_MISC | NB_MISC | > GFX_MISC | CPU_TRACE | MEM_FLOW | FCH_TRACE | MAIN_FLOW| > TEST_POINT | PSP_TRACE) > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdIdsDebugPrintFilter|0x100401030 > A300408|UINT64|0x00020005 > + ### @brief Switch for Serial port support of AGESA debug print > + ### @details Switch for Serial port support of AGESA debug print, NOTE= , > AGESA will not init the serial port, > + ### serial port should be initialized before call AGESA debug print. > + ### @li TRUE: Enable > + ### @li FALSE: Disable > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdIdsDebugPrintSerialPortEnable|FA > LSE|BOOLEAN|0x00020009 > + ### @brief The serial port used for debug output can be either 2-wire > (Rx/Tx) or 4-wire (adding DSR/CTS). Waiting for CTS on a > + ### 2-wire port would cause a hang. This control is added to check the > cable connection. > + ### @brief Permitted Choices: (Type: Boolean)(Default: FALSE) > + ### @li FALSE - Presume a 2-wire port and do not wait for CTS. > + ### @li TRUE - Wait for both DSR and CTS to be set. DSR is set if a ca= ble is > connected. CTS is set if it is ok to transmit data. > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdIdsDebugPrintSerialPortDetectCabl > eConnection|FALSE|BOOLEAN|0x0002000A > + > + ### @brief Selection of UART and UART Legacy IO Serial port for AGESA > debug print > + ### @details Selection of UART and UART Legacy IO Serial port for AGES= A > debug print and invisible in ACPI name space. > + ### @li Bit[0]: Select UART0 for AGESA debug print > + ### @li Bit[1]: Select UART1 for AGESA debug print > + ### @li Bit[2]: Select UART2 for AGESA debug print > + ### @li Bit[3]: Select UART3 for AGESA debug print > + ### @li Bit[4]: Select UART4 for AGESA debug print > + ### @li Bit[8]: Select UART0 Legacy IO for AGESA debug print > + ### @li Bit[9]: Select UART1 Legacy IO for AGESA debug print > + ### @li Bit[10]: Select UART2 Legacy IO for AGESA debug print > + ### @li Bit[11]: Select UART3 Legacy IO for AGESA debug print > + ### @li Bit[15]: Set debug print serial port to invisible in ACPI name= space > at OS runtime > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdIdsDebugPrintSerialPortSelect|0x0 > 000|UINT16|0x0002718A > + > + ### @brief Specify the IO port for serial out > + ### @details ESPI or LPC COM1: 0x3F8, COM2: 0x2F8, COM3: 0x3E8, > COM4: 0x2E8, > + ### UART0: 0xFEDC9000, UART1: 0xFEDCA000, UART2: 0xFEDCE000, > UART3: 0xFEDCF000, UART4: 0xFEDD1000. > + ### @li If it's IO port: it must < 0x10000 > + ### @li If it's Memory: it must >=3D 0x10000 > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdIdsDebugPrintSerialPort|0x3F8|UI > NT64|0x0002000B > + > + ### @brief Debug Print Emulation Auto Detect > + ### @details Auto detect emulation platform to instead of > PcdAmdIdsDebugPrintRedirectIOEnable and > + ### PcdAmdIdsDebugPrintSerialPortEnable. > + ### @li TRUE: Enable > + ### @li FALSE: Disable > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdIdsDebugPrintEmulationAutoDetec > t|FALSE|BOOLEAN|0x00020016 > + > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdCfgPlatformPPT|0|UINT32|0x0004F11 > 1 > + > +#-----------------------------------------------------------------------= ----- > +#- PSP Dynamic PCDs > +### Set Doxy_path: "PCD-PSP.h" > +#-----------------------------------------------------------------------= ----- > + ### PSP PCDs > + > + ### @brief Rom Armor selection > + ### @details Rom Armor selection > + ### @li 0: Rom Armor is disabled > + ### @li 1: Rom Armor 1 is enabled (VMR/MTS/CPK) > + ### @li 2: Rom Armor 2 is enabled (RN/CZN) > + ### @li 3: Rom Armor 3 is enabled (CGL, RMB and later) > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdPspRomArmorSelection|0|UINT8| > 0x95940054 > + > + > + > + ### @brief System TPM config Value > + ### @details System TPM config Value, SBIOS needs to set the value in = PEI > phase. > + ### @li 0x0: dTPM > + ### @li 0x1: PSP fTPM > + ### @li 0x2: HSP fTPM > + ### @li 0xFF: no TPM > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdPspSystemTpmConfig|0xFF|UINT8 > |0x95940024 > + > + ### @cond !BRH > + ### @brief TPM SMx algorithm flag > + ### @details TPM SMx algorithm flag, SBIOS needs to set the value in P= EI > phase. > + ### @li 0: SM2, SM3 or SM4 crypto algorithms not supported > + ### @li 1: SM2, SM3 or SM4 crypto algorithms supported > + > gEfiAmdAgesaPkgTokenSpaceGuid.PcdAmdPspSystemTpmAlgSmx|0|UINT8|0 > x95940025 > + ### @endcond > diff --git a/Platform/AMD/AmdCpmPkg/AmdCpmPkg.dec > b/Platform/AMD/AmdCpmPkg/AmdCpmPkg.dec > new file mode 100755 > index 0000000000..c8c474637f > --- /dev/null > +++ b/Platform/AMD/AmdCpmPkg/AmdCpmPkg.dec > @@ -0,0 +1,41 @@ > +## @file > +# AMD Common Platform Module (CPM) Module Package DEC. > +# > +# Copyright (C) 2012-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + DEC_SPECIFICATION =3D 0x00010005 > + PACKAGE_NAME =3D CpmPkg > + PACKAGE_GUID =3D ABE128BA-1061-4A53-A1B8-D07329AA7A67 > + PACKAGE_VERSION =3D 0.1 > + > +[Includes] > + Include > + Library > + > +[Guids] > + gAmdCpmPkgTokenSpaceGuid =3D {0x916e0ddd, 0x2bd2, 0x4704, {0x93= , > 0xb9, 0x59, 0x4b, 0x01, 0xa5, 0xfa, 0x9f}} > + gShellActHiiGuid =3D {0x340EBE97, 0x3C1C, 0x4272, {0x9C= , 0xCE, > 0xC1, 0xFF, 0x86, 0x6F, 0x73, 0x3C}} > + gAmdPbsSystemConfigurationGuid =3D {0xa339d746, 0xf678, 0x49b3, {0x9f= , > 0xc7, 0x54, 0xce, 0x0f, 0x9d, 0xf2, 0x26}} > + > +[Protocols] > + gAmdCpmTableProtocolGuid =3D { 0x3724cf01, 0x00c2= , 0x9762, > {0x11, 0xb3, 0x0e, 0xa8, 0xaa, 0x89, 0x72, 0x00 }} > + gAmdCpmAllPciIoProtocolsInstalledProtocolGuid =3D { 0x676D7012, 0x139B= , > 0x485A, {0x96, 0xF1, 0x98, 0x6F, 0xC4, 0x8A, 0x86, 0x4B }} > + > +[Ppis] > + gAmdCpmTablePpiGuid =3D { 0xd71cf893, 0xa8b5, 0x49d3, { 0xa2, 0x1b, > 0x31, 0xe2, 0xf5, 0xc4, 0xa7, 0x47 } } > + > +[PcdsFixedAtBuild] > + gAmdCpmPkgTokenSpaceGuid.PcdFchUartPort|2|UINT8|0x00000052 > + > + #ACPI > + > gAmdCpmPkgTokenSpaceGuid.PcdAmdAcpiHestTableHeaderOemTableId|"A > MD HEST"|VOID*|0x000AC001 > + > gAmdCpmPkgTokenSpaceGuid.PcdAmdAcpiBertTableHeaderOemTableId|"A > MD BERT"|VOID*|0x000AC002 > + > gAmdCpmPkgTokenSpaceGuid.PcdAmdAcpiEinjTableHeaderOemTableId|"AM > D EINJ"|VOID*|0x000AC003 > + > + > gAmdCpmPkgTokenSpaceGuid.UsePciXAslName|FALSE|BOOLEAN|0x120000 > 03 > + > gAmdCpmPkgTokenSpaceGuid.AcpiRestoreSwSmi|0xE3|UINT8|0x00000040 > diff --git a/Platform/AMD/AgesaModulePkg/AgesaEdk2PlatformPkg.inc.dsc > b/Platform/AMD/AgesaModulePkg/AgesaEdk2PlatformPkg.inc.dsc > new file mode 100644 > index 0000000000..37b8d15cb1 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/AgesaEdk2PlatformPkg.inc.dsc > @@ -0,0 +1,18 @@ > +## @file > +# > +# The DSC include file for edk2 package to pull in the necessary AGESA > modules > +# into build process. > +# > +# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<= BR> > +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[LibraryClasses] > + > NbioCommonDxeLib|AgesaModulePkg/Nbio/Library/CommonDxe/NbioComm > onDxeLib.inf > + > + ## Gnb Lib > + NbioHandleLib|AgesaModulePkg/Library/NbioHandleLib/NbioHandleLib.inf > + PcieConfigLib|AgesaModulePkg/Library/PcieConfigLib/PcieConfigLib.inf > + > diff --git a/Platform/AMD/AgesaModulePkg/AgesaSp5RsModulePkg.inc.dsc > b/Platform/AMD/AgesaModulePkg/AgesaSp5RsModulePkg.inc.dsc > new file mode 100644 > index 0000000000..e7e05fd2d8 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/AgesaSp5RsModulePkg.inc.dsc > @@ -0,0 +1,48 @@ > +## @file > +# The AGESA DSC file for building AMD SP5 Genoa boards. > +# > +# Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[LibraryClasses.Common.PEIM] > + > + ## APCB > + ApcbLibV3Pei|AgesaModulePkg/Library/ApcbLibV3Pei/ApcbLibV3Pei.inf > + > +[LibraryClasses.Common.DXE_DRIVER] > + > AmdPspRomArmorLib|AgesaModulePkg/Library/AmdPspRomArmorLibNull/A > mdPspRomArmorLibNull.inf > + ApcbLibV3|AgesaModulePkg/Library/ApcbLibV3/ApcbLibV3.inf > + > +[LibraryClasses.Common.DXE_SMM_DRIVER] > + > AmdPspRomArmorLib|AgesaModulePkg/Library/AmdPspRomArmorLibNull/A > mdPspRomArmorLibNull.inf > + ApcbLibV3|AgesaModulePkg/Library/ApcbLibV3/ApcbLibV3.inf > + > +[LibraryClasses] > + # > + # Agesa specific common libraries > + # > + > + ## PSP Libs > + > AmdPspMboxLibV2|AgesaModulePkg/Library/AmdPspMboxLibV2/AmdPspM > boxLibV2.inf > + > + ## DF Lib > + > BaseFabricTopologyLib|AgesaModulePkg/Library/BaseFabricTopologyRsLib/B > aseFabricTopologyRsLib.inf > + > + ## Gnb Lib > + NbioHandleLib|AgesaModulePkg/Library/NbioHandleLib/NbioHandleLib.inf > + PcieConfigLib|AgesaModulePkg/Library/PcieConfigLib/PcieConfigLib.inf > + SmnAccessLib|AgesaModulePkg/Library/SmnAccessLib/SmnAccessLib.inf > + > NbioCommonDxeLib|AgesaModulePkg/Nbio/Library/CommonDxe/NbioComm > onDxeLib.inf > + > + ## Fch Lib > + FchBaseLib|AgesaModulePkg/Library/FchBaseLib/FchBaseLib.inf > + > +[Components.IA32] > + AgesaModulePkg/Psp/ApcbDrv/ApcbV3Pei/ApcbV3Pei.inf > + > +[Components.X64] > + AgesaModulePkg/Psp/ApcbDrv/ApcbV3Dxe/ApcbV3Dxe.inf > + > diff --git > a/Platform/AMD/AmdCbsPkg/Library/CbsInstanceNull/CbsInstanceNull.inc.dsc > b/Platform/AMD/AmdCbsPkg/Library/CbsInstanceNull/CbsInstanceNull.inc.dsc > new file mode 100644 > index 0000000000..1f1e04c414 > --- /dev/null > +++ > b/Platform/AMD/AmdCbsPkg/Library/CbsInstanceNull/CbsInstanceNull.inc.dsc > @@ -0,0 +1,8 @@ > +## @file > +# > +# Copyright (C) 2012-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > diff --git > a/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Processor/Genoa/Am > dCpmGenoaQuartzPkg.inc.dsc > b/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Processor/Genoa/A > mdCpmGenoaQuartzPkg.inc.dsc > new file mode 100644 > index 0000000000..2916fecb26 > --- /dev/null > +++ > b/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Processor/Genoa/A > mdCpmGenoaQuartzPkg.inc.dsc > @@ -0,0 +1,11 @@ > +## @file > +# > +# Copyright (C) 2015-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + DEFINE AGESA_PKG_PATH =3D AgesaModulePkg > + DEFINE AGESA_PKG_DEC =3D AgesaCommonModulePkg > diff --git > a/Platform/AMD/AgesaModulePkg/AgesaSp5RsModulePkg.dxe.inc.fdf > b/Platform/AMD/AgesaModulePkg/AgesaSp5RsModulePkg.dxe.inc.fdf > new file mode 100644 > index 0000000000..9303d1fac4 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/AgesaSp5RsModulePkg.dxe.inc.fdf > @@ -0,0 +1,11 @@ > +## @file > +# The AGESA DXE FDF file for building AMD SP5 Genoa boards. > +# > +# Copyright (C) 2021-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +## APCB V3 Dxe Drivers > + INF AgesaModulePkg/Psp/ApcbDrv/ApcbV3Dxe/ApcbV3Dxe.inf > diff --git a/Platform/AMD/AgesaModulePkg/AgesaSp5RsModulePkg.pei.inc.fdf > b/Platform/AMD/AgesaModulePkg/AgesaSp5RsModulePkg.pei.inc.fdf > new file mode 100644 > index 0000000000..0ef5a2a806 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/AgesaSp5RsModulePkg.pei.inc.fdf > @@ -0,0 +1,9 @@ > +## @file > +# The AGESA PEI FDF file for building AMD SP5 Genoa boards. > +# > +# Copyright (C) 2021-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > diff --git > a/Platform/AMD/AmdCbsPkg/Library/CbsInstanceNull/CbsInstanceNull.dxe.in > c.fdf > b/Platform/AMD/AmdCbsPkg/Library/CbsInstanceNull/CbsInstanceNull.dxe.in > c.fdf > new file mode 100644 > index 0000000000..4766ad0447 > --- /dev/null > +++ > b/Platform/AMD/AmdCbsPkg/Library/CbsInstanceNull/CbsInstanceNull.dxe.in > c.fdf > @@ -0,0 +1,7 @@ > +## @file > +# > +# Copyright (C) 2015-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > diff --git > a/Platform/AMD/AmdCbsPkg/Library/CbsInstanceNull/CbsInstanceNull.pei.inc > .fdf > b/Platform/AMD/AmdCbsPkg/Library/CbsInstanceNull/CbsInstanceNull.pei.inc > .fdf > new file mode 100644 > index 0000000000..4766ad0447 > --- /dev/null > +++ > b/Platform/AMD/AmdCbsPkg/Library/CbsInstanceNull/CbsInstanceNull.pei.inc > .fdf > @@ -0,0 +1,7 @@ > +## @file > +# > +# Copyright (C) 2015-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > diff --git > a/Platform/AMD/AmdCbsPkg/Library/Family/0x19/RS/External/CbsStones.dxe > .inc.fdf > b/Platform/AMD/AmdCbsPkg/Library/Family/0x19/RS/External/CbsStones.dx > e.inc.fdf > new file mode 100644 > index 0000000000..da3afe6e59 > --- /dev/null > +++ > b/Platform/AMD/AmdCbsPkg/Library/Family/0x19/RS/External/CbsStones.dx > e.inc.fdf > @@ -0,0 +1,8 @@ > +## @file > +# > +# Copyright (C) 2015-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > diff --git > a/Platform/AMD/AmdCbsPkg/Library/Family/0x19/RS/External/CbsStones.pei. > inc.fdf > b/Platform/AMD/AmdCbsPkg/Library/Family/0x19/RS/External/CbsStones.pei > .inc.fdf > new file mode 100644 > index 0000000000..da3afe6e59 > --- /dev/null > +++ > b/Platform/AMD/AmdCbsPkg/Library/Family/0x19/RS/External/CbsStones.pei > .inc.fdf > @@ -0,0 +1,8 @@ > +## @file > +# > +# Copyright (C) 2015-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > diff --git > a/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Processor/Genoa/Am > dCpmGenoaQuartzPkg.dxe.inc.fdf > b/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Processor/Genoa/A > mdCpmGenoaQuartzPkg.dxe.inc.fdf > new file mode 100644 > index 0000000000..4766ad0447 > --- /dev/null > +++ > b/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Processor/Genoa/A > mdCpmGenoaQuartzPkg.dxe.inc.fdf > @@ -0,0 +1,7 @@ > +## @file > +# > +# Copyright (C) 2015-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > diff --git > a/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Processor/Genoa/Am > dCpmGenoaQuartzPkg.fdf > b/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Processor/Genoa/A > mdCpmGenoaQuartzPkg.fdf > new file mode 100644 > index 0000000000..b790e4ead5 > --- /dev/null > +++ > b/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Processor/Genoa/A > mdCpmGenoaQuartzPkg.fdf > @@ -0,0 +1,10 @@ > +## @file > +# > +# Platform Package Flash Description File > +# > +# Copyright (C) 2022-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > diff --git > a/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Processor/Genoa/Am > dCpmGenoaQuartzPkg.pei.inc.fdf > b/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Processor/Genoa/A > mdCpmGenoaQuartzPkg.pei.inc.fdf > new file mode 100644 > index 0000000000..4766ad0447 > --- /dev/null > +++ > b/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Processor/Genoa/A > mdCpmGenoaQuartzPkg.pei.inc.fdf > @@ -0,0 +1,7 @@ > +## @file > +# > +# Copyright (C) 2015-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > diff --git > a/Platform/AMD/AgesaModulePkg/Library/AmdCalloutLib/AmdCalloutLib.inf > b/Platform/AMD/AgesaModulePkg/Library/AmdCalloutLib/AmdCalloutLib.inf > new file mode 100755 > index 0000000000..8d3357bf56 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/AmdCalloutLib/AmdCalloutLib.inf > @@ -0,0 +1,29 @@ > +## @file > +# > +# Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D AmdCalloutLib > + FILE_GUID =3D A8FEA621-B381-4c06-9E9D-0897EF78BD7= 8 > + MODULE_TYPE =3D BASE > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D AmdCalloutLib > + > + > +[Packages] > + MdePkg/MdePkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AgesaPkg/AgesaPkg.dec > + > +[LibraryClasses] > + BaseLib > + PcdLib > + > + > + > + > diff --git > a/Platform/AMD/AgesaModulePkg/Library/AmdPspMboxLibV2/AmdPspMbox > LibV2.inf > b/Platform/AMD/AgesaModulePkg/Library/AmdPspMboxLibV2/AmdPspMbox > LibV2.inf > new file mode 100644 > index 0000000000..1594a99265 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/AmdPspMboxLibV2/AmdPspMbox > LibV2.inf > @@ -0,0 +1,30 @@ > +## @file > +# > +# Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > +[Defines] > + INF_VERSION =3D 0x00010006 > + BASE_NAME =3D AmdPspMboxLibV2 > + FILE_GUID =3D B9E57A31-CAB0-4CEE-9D50-9D43E2EEAA4= 4 > + MODULE_TYPE =3D BASE > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D AmdPspMboxLibV2 > + > +[Sources.common] > + AmdPspMboxLibV2.c > + > +[Packages] > + MdePkg/MdePkg.dec > + AgesaPkg/AgesaPkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AgesaModulePkg/AgesaModulePspPkg.dec > + > +[LibraryClasses] > + PciLib > + SmnAccessLib > + > + > + > diff --git > a/Platform/AMD/AgesaModulePkg/Library/AmdPspRomArmorLib/AmdPspRo > mArmorLib.inf > b/Platform/AMD/AgesaModulePkg/Library/AmdPspRomArmorLib/AmdPspRo > mArmorLib.inf > new file mode 100644 > index 0000000000..c685a26604 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/AmdPspRomArmorLib/AmdPspRo > mArmorLib.inf > @@ -0,0 +1,27 @@ > +## @file > +# > +# Copyright (C) 2019-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010006 > + BASE_NAME =3D AmdPspRomArmorLib > + FILE_GUID =3D 55871F80-4658-6EF3-A8AC-15B34FF8C2C= E > + MODULE_TYPE =3D DXE_SMM_DRIVER > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D AmdPspRomArmorLib > + > +[Sources.common] > + AmdPspRomArmorLib.c > + > +[Packages] > + MdePkg/MdePkg.dec > + AgesaPkg/AgesaPkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AgesaModulePkg/AgesaModulePspPkg.dec > + > + > + > diff --git > a/Platform/AMD/AgesaModulePkg/Library/AmdPspRomArmorLibNull/AmdPs > pRomArmorLibNull.inf > b/Platform/AMD/AgesaModulePkg/Library/AmdPspRomArmorLibNull/AmdPs > pRomArmorLibNull.inf > new file mode 100644 > index 0000000000..a3906dc13e > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/AmdPspRomArmorLibNull/AmdPs > pRomArmorLibNull.inf > @@ -0,0 +1,26 @@ > +## @file > +# > +# Copyright (C) 2019-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010006 > + BASE_NAME =3D AmdPspRomArmorLibNull > + FILE_GUID =3D 7351EAC0-4587-FED8-2788-BF9DA2ADCA6= E > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D AmdPspRomArmorLibNull > + > +[Sources.common] > + AmdPspRomArmorLibNull.c > + > +[Packages] > + MdePkg/MdePkg.dec > + AgesaPkg/AgesaPkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AgesaModulePkg/AgesaModulePspPkg.dec > + > + > diff --git a/Platform/AMD/AgesaModulePkg/Library/ApcbLibV3/ApcbLibV3.inf > b/Platform/AMD/AgesaModulePkg/Library/ApcbLibV3/ApcbLibV3.inf > new file mode 100644 > index 0000000000..09d5bd38ac > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Library/ApcbLibV3/ApcbLibV3.inf > @@ -0,0 +1,37 @@ > +## @file > +# > +# Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010006 > + BASE_NAME =3D ApcbLibV3 > + FILE_GUID =3D C7932467-DF16-4C7A-A32A-3E6F50213E6= 8 > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D ApcbLibV3 | DXE_DRIVER DXE_SMM_DRIV= ER > DXE_RUNTIME_DRIVER DXE_CORE SMM_CORE UEFI_DRIVER > + > +[Sources.common] > + ApcbLibV3.c > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + AgesaPkg/AgesaPkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AgesaModulePkg/AgesaModuleMemPkg.dec > + AgesaModulePkg/AgesaModulePspPkg.dec > + > +[Protocols] > + gEfiSmmBase2ProtocolGuid > + gEfiSmmReadyToLockProtocolGuid > + > +[Pcd] > + > gEfiAmdAgesaModulePkgTokenSpaceGuid.PcdAmdMemCfgMaxPostPackageR > epairEntries > + > + > + > + > diff --git > a/Platform/AMD/AgesaModulePkg/Library/ApcbLibV3Pei/ApcbLibV3Pei.inf > b/Platform/AMD/AgesaModulePkg/Library/ApcbLibV3Pei/ApcbLibV3Pei.inf > new file mode 100644 > index 0000000000..c031d00d79 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/ApcbLibV3Pei/ApcbLibV3Pei.inf > @@ -0,0 +1,32 @@ > +## @file > +# > +# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<= BR> > +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010006 > + BASE_NAME =3D ApcbLibV3Pei > + FILE_GUID =3D EEA4E007-E408-4daa-82BD-4C52E705875= 3 > + MODULE_TYPE =3D PEIM > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D ApcbLibV3Pei|PEIM > + > +[Sources.common] > + ApcbLibV3Pei.c > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + AgesaPkg/AgesaPkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AgesaModulePkg/AgesaModuleMemPkg.dec > + AgesaModulePkg/AgesaModulePspPkg.dec > + > +[LibraryClasses] > + PcdLib > + BaseMemoryLib > + PeiServicesLib > + > diff --git > a/Platform/AMD/AgesaModulePkg/Library/BaseFabricTopologyRsLib/BaseFab > ricTopologyRsLib.inf > b/Platform/AMD/AgesaModulePkg/Library/BaseFabricTopologyRsLib/BaseFab > ricTopologyRsLib.inf > new file mode 100644 > index 0000000000..38a72e26b7 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/BaseFabricTopologyRsLib/BaseFab > ricTopologyRsLib.inf > @@ -0,0 +1,28 @@ > +## @file > +# > +# For EDKII use Only > +# > +# Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D BaseFabricTopologyRsLib > + FILE_GUID =3D D0A070DD-630A-43F8-9D76-EAAABDDE5FB= 9 > + MODULE_TYPE =3D BASE > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D BaseFabricTopologyLib > + CONSTRUCTOR =3D BaseFabricTopologyLibConstructor > + > +[Sources] > + BaseFabricTopologyRsLib.c > + > +[Packages] > + MdePkg/MdePkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AgesaModulePkg/AgesaModuleDfPkg.dec > + > +[LibraryClasses] > + BaseLib > diff --git > a/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/BaseTscTimerLib.i > nf > b/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/BaseTscTimerLib.i > nf > new file mode 100644 > index 0000000000..d15d8169fe > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/BaseTscTimerLib.i > nf > @@ -0,0 +1,35 @@ > +## @file > +# Base Timer Library which uses the Time Stamp Counter in the processor= . > +# > +# Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D BaseTscTimerLib > + FILE_GUID =3D D29338B9-50FE-4e4f-B7D4-A150A2C1F4F= B > + MODULE_TYPE =3D BASE > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D TimerLib > + > +# > +# VALID_ARCHITECTURES =3D IA32 X64 > +# > + > +[Sources.common] > + TscTimerLibShare.c > + BaseTscTimerLib.c > + > +[Packages] > + MdePkg/MdePkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AgesaModulePkg/AgesaModuleCcxPkg.dec > + AgesaPkg/AgesaPkg.dec > + > +[LibraryClasses] > + PcdLib > + BaseLib > + > diff --git > a/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/DxeTscTimerLib.in > f > b/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/DxeTscTimerLib.i > nf > new file mode 100644 > index 0000000000..1e52768a01 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/DxeTscTimerLib.i > nf > @@ -0,0 +1,42 @@ > +## @file > +# Dxe Timer Library which uses the Time Stamp Counter in the processor. > +# > +# Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D DxeTscTimerLib > + FILE_GUID =3D 95ab030f-b4fd-4ee4-92a5-9e04e87634d= 9 > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D TimerLib|DXE_CORE DXE_DRIVER > DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER > SMM_CORE > + > + CONSTRUCTOR =3D DxeTscTimerLibConstructor > + > +# > +# VALID_ARCHITECTURES =3D IA32 X64 > +# > + > +[Sources.common] > + TscTimerLibShare.c > + DxeTscTimerLib.c > + > +[Packages] > + MdePkg/MdePkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AgesaModulePkg/AgesaModuleCcxPkg.dec > + AgesaPkg/AgesaPkg.dec > + > +[LibraryClasses] > + UefiBootServicesTableLib > + PcdLib > + BaseLib > + UefiLib > + DebugLib > + > + > + > diff --git > a/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/PeiTscTimerLib.inf > b/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/PeiTscTimerLib.in > f > new file mode 100644 > index 0000000000..b1eaefd282 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/PeiTscTimerLib.in > f > @@ -0,0 +1,37 @@ > +## @file > +# Pei Timer Library which uses the Time Stamp Counter in the processor. > +# > +# Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D PeiTscTimerLib > + FILE_GUID =3D 342C36C0-15DF-43b4-9EC9-FBF748BFB3D= 1 > + MODULE_TYPE =3D PEIM > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D TimerLib|PEIM PEI_CORE > + > +# > +# VALID_ARCHITECTURES =3D IA32 X64 > +# > + > +[Sources.common] > + TscTimerLibShare.c > + PeiTscTimerLib.c > + > +[Packages] > + MdePkg/MdePkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AgesaModulePkg/AgesaModuleCcxPkg.dec > + AgesaPkg/AgesaPkg.dec > + > +[LibraryClasses] > + PcdLib > + BaseLib > + HobLib > + > + > diff --git > a/Platform/AMD/AgesaModulePkg/Library/DxeAmdPciHostBridgeLib/PciHost > BridgeLib.inf > b/Platform/AMD/AgesaModulePkg/Library/DxeAmdPciHostBridgeLib/PciHost > BridgeLib.inf > new file mode 100644 > index 0000000000..f60f97905a > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/DxeAmdPciHostBridgeLib/PciHost > BridgeLib.inf > @@ -0,0 +1,42 @@ > +## @file > +# Library instance of PciHostBridgeLib library class for coreboot. > +# > +# Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D PciHostBridgeLib > + FILE_GUID =3D 74967FD7-A9A4-4B16-8B41-B26BC3230D0= A > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D PciHostBridgeLib > + > +# > +# The following information is for reference only and not required by th= e > build > +# tools. > +# > +# VALID_ARCHITECTURES =3D IA32 X64 > +# > + > +[Sources] > + PciHostBridgeLib.c > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AgesaModulePkg/AgesaModuleDfPkg.dec > + AgesaModulePkg/AgesaModuleNbioPkg.dec > + AgesaPkg/AgesaPkg.dec > + > +[LibraryClasses] > + BaseMemoryLib > + PciHostBridgeLib > + DevicePathLib > + MemoryAllocationLib > + DebugLib > + UefiBootServicesTableLib > diff --git > a/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlGenera > tionLib.inf > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlGenera > tionLib.inf > new file mode 100644 > index 0000000000..2a72fa8117 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlGenera > tionLib.inf > @@ -0,0 +1,47 @@ > +## @file > +# > +# Copyright (C) 2020-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D AmlGenerationLib > + FILE_GUID =3D 8F62C8D1-B67F-4AFB-9179-54384F1A6163 > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D AmlGenerationLib | DXE_DRIVER UEFI_D= RIVER > HOST_APPLICATION > + > +[Sources.common] > + LocalAmlObjects.h > + LocalAmlObjects.c > + LocalAmlLib.h > + AmlAssistFunctions.c > + AmlObjectsDebug.c > + AmlNameString.c > + AmlDataObjects.c > + AmlNamespaceModifierObjects.c > + AmlPkgLength.c > + AmlNamedObject.c > + AmlTable.c > + AmlStatementOpcodes.c > + AmlResourceDescriptor.c > + AmlExpressionOpcodes.c > + AmlArgObjects.c > + AmlLocalObjects.c > + > +[Packages] > + MdePkg/MdePkg.dec > + AgesaPkg/AgesaPkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + > +[LibraryClasses] > + BaseLib > + DebugLib > + BaseMemoryLib > + MemoryAllocationLib > + > +[Depex] > + TRUE > + > diff --git > a/Platform/AMD/AgesaModulePkg/Library/FchBaseLib/FchBaseLib.inf > b/Platform/AMD/AgesaModulePkg/Library/FchBaseLib/FchBaseLib.inf > new file mode 100644 > index 0000000000..e63a70e849 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Library/FchBaseLib/FchBaseLib.inf > @@ -0,0 +1,26 @@ > +## @file > +# > +# Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010006 > + BASE_NAME =3D FchBaseLib > + FILE_GUID =3D 4108287a-c864-4427-b2c3-bd0e91a83ab= d > + MODULE_TYPE =3D BASE > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D FchBaseLib > + > +[Sources.common] > + FchStallLib.c > + > +[Packages] > + AgesaModulePkg/AgesaModuleFchPkg.dec > + MdePkg/MdePkg.dec > + > +[LibraryClasses] > + PciSegmentLib > + > diff --git > a/Platform/AMD/AgesaModulePkg/Library/FchBaseResetSystemLib/FchBaseR > esetSystemLib.inf > b/Platform/AMD/AgesaModulePkg/Library/FchBaseResetSystemLib/FchBaseR > esetSystemLib.inf > new file mode 100644 > index 0000000000..e422cb69a4 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/FchBaseResetSystemLib/FchBaseR > esetSystemLib.inf > @@ -0,0 +1,35 @@ > +## @file > +# > +# Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010006 > + BASE_NAME =3D BaseResetSystemLib > + FILE_GUID =3D e669c365-2df2-4540-a343-afec4e85b19= 8 > + MODULE_TYPE =3D BASE > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D BaseResetSystemLib > + > +# > +# VALID_ARCHITECTURES =3D IA32 X64 > +# > + > +[Sources] > + FchBaseResetSystemLib.c > + > +[Packages] > + MdePkg/MdePkg.dec > + AgesaPkg/AgesaPkg.dec > + MdeModulePkg/MdeModulePkg.dec > + AgesaModulePkg/AgesaModuleFchPkg.dec > + > +[LibraryClasses] > + BaseLib > + PrintLib > + IoLib > + > + > diff --git > a/Platform/AMD/AgesaModulePkg/Library/FchEspiCmdLib/FchEspiCmdLib.inf > b/Platform/AMD/AgesaModulePkg/Library/FchEspiCmdLib/FchEspiCmdLib.inf > new file mode 100644 > index 0000000000..d7f49c40de > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/FchEspiCmdLib/FchEspiCmdLib.inf > @@ -0,0 +1,33 @@ > +## @file > +# > +# Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010006 > + BASE_NAME =3D FchEspiCmdLib > + FILE_GUID =3D 89671327-a620-43e9-93b1-d1da79a5039= 2 > + MODULE_TYPE =3D BASE > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D FchEspiCmdLib > + > +[Sources.common] > + FchEspiCmdLib.c > + > +[Packages] > + AgesaModulePkg/AgesaModuleFchPkg.dec > + MdePkg/MdePkg.dec > + > +[LibraryClasses] > + IoLib > + FchBaseLib > + > + > + > + > + > + > + > diff --git > a/Platform/AMD/AgesaModulePkg/Library/NbioHandleLib/NbioHandleLib.inf > b/Platform/AMD/AgesaModulePkg/Library/NbioHandleLib/NbioHandleLib.inf > new file mode 100755 > index 0000000000..f32bbc9ff2 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/NbioHandleLib/NbioHandleLib.inf > @@ -0,0 +1,24 @@ > +## @file > +# > +# Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D NbioHandleLib > + FILE_GUID =3D DC4639D3-DB75-486B-AC38-C84AA49601E= 3 > + MODULE_TYPE =3D BASE > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D NbioHandleLib > + > +[Sources] > + NbioHandleLib.c > + > +[Packages] > + MdePkg/MdePkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AgesaModulePkg/AgesaModuleNbioPkg.dec > + AgesaPkg/AgesaPkg.dec > + > diff --git > a/Platform/AMD/AgesaModulePkg/Library/PcieConfigLib/PcieConfigLib.inf > b/Platform/AMD/AgesaModulePkg/Library/PcieConfigLib/PcieConfigLib.inf > new file mode 100755 > index 0000000000..0d6ba605f5 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/PcieConfigLib/PcieConfigLib.inf > @@ -0,0 +1,25 @@ > +## @file > +# > +# Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D PcieConfigLib > + FILE_GUID =3D C1205AD2-FE67-4502-A0A7-FB1704A3F9A= E > + MODULE_TYPE =3D BASE > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D PcieConfigLib > + > +[Sources] > + PcieConfigLib.c > + PcieInputParserLib.c > + > +[Packages] > + MdePkg/MdePkg.dec > + AgesaPkg/AgesaPkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AgesaModulePkg/AgesaModuleNbioPkg.dec > + > diff --git > a/Platform/AMD/AgesaModulePkg/Library/SmnAccessLib/SmnAccessLib.inf > b/Platform/AMD/AgesaModulePkg/Library/SmnAccessLib/SmnAccessLib.inf > new file mode 100644 > index 0000000000..ae1dd6cd83 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/SmnAccessLib/SmnAccessLib.inf > @@ -0,0 +1,33 @@ > +## @file > +# > +# Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D SmnAccessLib > + FILE_GUID =3D 9B7FF4FA-9DB5-4fec-BF71-B13D8A14A51= E > + MODULE_TYPE =3D BASE > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D SmnAccessLib > + > +[Sources] > + SmnAccessLib.c > + > +[Packages] > + MdePkg/MdePkg.dec > + AgesaPkg/AgesaPkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AgesaModulePkg/AgesaModuleNbioPkg.dec > + > +[LibraryClasses] > + PrintLib > + BaseLib > + DebugPrintErrorLevelLib > + > + > + > + > diff --git > a/Platform/AMD/AgesaModulePkg/Nbio/Library/CommonDxe/NbioCommonD > xeLib.inf > b/Platform/AMD/AgesaModulePkg/Nbio/Library/CommonDxe/NbioCommonD > xeLib.inf > new file mode 100644 > index 0000000000..da7f5c185d > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Nbio/Library/CommonDxe/NbioCommonD > xeLib.inf > @@ -0,0 +1,29 @@ > +## @file > +# > +# Copyright (C) 2016-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D NbioCommonDxeLib > + FILE_GUID =3D 1BF93335-5D55-46D9-99D9-5D962F03982= 9 > + MODULE_TYPE =3D BASE > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D NbioCommonDxeLib > + > +[Sources] > + DxeLibFunctions.c > + > +[Packages] > + MdePkg/MdePkg.dec > + AgesaPkg/AgesaPkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AgesaModulePkg/AgesaModuleNbioPkg.dec > + > +[LibraryClasses] > + BaseLib > + > + > + > diff --git > a/Platform/AMD/AgesaModulePkg/Psp/ApcbDrv/ApcbV3Dxe/ApcbV3Dxe.inf > b/Platform/AMD/AgesaModulePkg/Psp/ApcbDrv/ApcbV3Dxe/ApcbV3Dxe.inf > new file mode 100644 > index 0000000000..54c3514020 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Psp/ApcbDrv/ApcbV3Dxe/ApcbV3Dxe.inf > @@ -0,0 +1,45 @@ > +## @file > +# > +# Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D AmdApcbDxeV3 > + FILE_GUID =3D 4D3708A0-6D9B-47D3-AD87-E80C781BC0A= 7 > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + ENTRY_POINT =3D AmdApcbV3DxeDriverEntry > + > +[Packages] > + MdePkg/MdePkg.dec > + AgesaPkg/AgesaPkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AgesaModulePkg/AgesaModulePspPkg.dec > + > +[LibraryClasses] > + BaseLib > + PcdLib > + BaseMemoryLib > + UefiBootServicesTableLib > + UefiRuntimeServicesTableLib > + UefiDriverEntryPoint > + DxeServicesTableLib > + MemoryAllocationLib > + ApcbLibV3 > + > +[Sources] > + ApcbV3Dxe.c > + > +[Protocols] > + gEfiDxeSmmReadyToLockProtocolGuid > + gEfiSmmCommunicationProtocolGuid > + > +[Depex] > + TRUE > + > + > + > diff --git > a/Platform/AMD/AgesaModulePkg/Psp/ApcbDrv/ApcbV3Pei/ApcbV3Pei.inf > b/Platform/AMD/AgesaModulePkg/Psp/ApcbDrv/ApcbV3Pei/ApcbV3Pei.inf > new file mode 100644 > index 0000000000..7f90aa6ea0 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Psp/ApcbDrv/ApcbV3Pei/ApcbV3Pei.inf > @@ -0,0 +1,33 @@ > +## @file > +# > +# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<= BR> > +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D AmdApcbPeiV3 > + FILE_GUID =3D E1B8CF4A-FE7B-4676-B4F7-50C7228282A= 4 > + MODULE_TYPE =3D PEIM > + VERSION_STRING =3D 1.0 > + ENTRY_POINT =3D AmdApcbV3PeiDriverEntry > + > +[Packages] > + MdePkg/MdePkg.dec > + AgesaPkg/AgesaPkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AgesaModulePkg/AgesaModulePspPkg.dec > + > +[LibraryClasses] > + BaseLib > + PeimEntryPoint > + ApcbLibV3Pei > + > +[sources] > + ApcbV3Pei.c > + > +[Depex] > + TRUE > + > diff --git > a/Platform/AMD/AgesaPkg/Addendum/Ccx/OemAgesaCcxPlatformLibNull/Oe > mAgesaCcxPlatformLibNull.inf > b/Platform/AMD/AgesaPkg/Addendum/Ccx/OemAgesaCcxPlatformLibNull/Oe > mAgesaCcxPlatformLibNull.inf > new file mode 100755 > index 0000000000..0f115c362e > --- /dev/null > +++ > b/Platform/AMD/AgesaPkg/Addendum/Ccx/OemAgesaCcxPlatformLibNull/Oe > mAgesaCcxPlatformLibNull.inf > @@ -0,0 +1,27 @@ > +## @file > +# > +# Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010006 > + BASE_NAME =3D OemAgesaCcxPlatformLibNull > + FILE_GUID =3D B1F58B07-0146-4804-B701-A56CB571652= 9 > + MODULE_TYPE =3D BASE > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D OemAgesaCcxPlatformLib > + > +[Sources.common] > + OemAgesaCcxPlatformLibNull.c > + > +[Packages] > + MdePkg/MdePkg.dec > + > +[Depex] > + TRUE > + > + > + > diff --git > a/Platform/AMD/AgesaPkg/Addendum/PciSegments/PciExpressPciCfg2/PciEx > pressPciCfg2.inf > b/Platform/AMD/AgesaPkg/Addendum/PciSegments/PciExpressPciCfg2/PciEx > pressPciCfg2.inf > new file mode 100644 > index 0000000000..ba551e5c14 > --- /dev/null > +++ > b/Platform/AMD/AgesaPkg/Addendum/PciSegments/PciExpressPciCfg2/PciEx > pressPciCfg2.inf > @@ -0,0 +1,61 @@ > +## @file > +# > +# Copyright (C) 2018-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D PciExpressPciCfg2 > + FILE_GUID =3D 7A6DF3DB-1C0A-45C2-8251-AFE794D7D6B= 3 > + MODULE_TYPE =3D PEIM > + VERSION_STRING =3D 1.0 > + ENTRY_POINT =3D PeimInitializePciCfg > + > +# > +# The following information is for reference only and not required by th= e > build tools. > +# > +# VALID_ARCHITECTURES =3D IA32 X64 EBC (EBC is for build only= ) > +# > + > +[Sources] > + PciExpressPciCfg2.c > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + AgesaPkg/AgesaPkg.dec > + > + > +[LibraryClasses] > + PeimEntryPoint > + BaseLib > + PcdLib > + DebugLib > + BaseMemoryLib > + MemoryAllocationLib > + HobLib > + IoLib > + > +[Ppis] > + gEfiPciCfg2PpiGuid ## PRODUCES > + > +[Pcd] > + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress > + > +[Pcd.IA32,Pcd.X64] > + gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable = ## > SOMETIMES_CONSUMES > + > gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMas > k ## CONSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask > ## CONSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard = ## > CONSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdUse5LevelPageTable = ## > SOMETIMES_CONSUMES > + > +[Pcd.IA32,Pcd.X64,Pcd.ARM,Pcd.AARCH64] > + gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## > SOMETIMES_CONSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy ## > SOMETIMES_CONSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdImageProtectionPolicy ## > SOMETIMES_CONSUMES > + > +[Depex] > + TRUE > diff --git > a/Platform/AMD/AgesaPkg/Addendum/PciSegments/PciExpressPciSegmentIn > foLib/PciExpressPciSegmentInfoLib.inf > b/Platform/AMD/AgesaPkg/Addendum/PciSegments/PciExpressPciSegmentIn > foLib/PciExpressPciSegmentInfoLib.inf > new file mode 100644 > index 0000000000..e712a80886 > --- /dev/null > +++ > b/Platform/AMD/AgesaPkg/Addendum/PciSegments/PciExpressPciSegmentIn > foLib/PciExpressPciSegmentInfoLib.inf > @@ -0,0 +1,32 @@ > +## @file > +# > +# Copyright (C) 2018-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D PciExpressPciSegmentInfoLib > + FILE_GUID =3D FA8B1082-88DF-4744-85A3-7F87A9EBF8D= C > + MODULE_TYPE =3D BASE > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D PciSegmentInfoLib > + > +# > +# The following information is for reference only and not required by th= e > build tools. > +# > +# VALID_ARCHITECTURES =3D IA32 X64 EBC > +# > + > +[Sources] > + PciSegmentInfoLib.c > + > +[Packages] > + MdePkg/MdePkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + > +[LibraryClasses] > + DebugLib > + BaseLib > diff --git > a/Platform/AMD/AgesaPkg/Addendum/Psp/AmdPspFlashAccSpiNorLibSmm/A > mdPspFlashAccSpiNorLibSmm.inf > b/Platform/AMD/AgesaPkg/Addendum/Psp/AmdPspFlashAccSpiNorLibSmm/ > AmdPspFlashAccSpiNorLibSmm.inf > new file mode 100644 > index 0000000000..f4b9d0d789 > --- /dev/null > +++ > b/Platform/AMD/AgesaPkg/Addendum/Psp/AmdPspFlashAccSpiNorLibSmm/ > AmdPspFlashAccSpiNorLibSmm.inf > @@ -0,0 +1,45 @@ > +## @file > +# > +# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<= BR> > +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010006 > + BASE_NAME =3D AmdPspFlashAccLibSmm > + FILE_GUID =3D 3BBDC3A5-A0E2-4E8A-8240-9E594920F04= 0 > + MODULE_TYPE =3D DXE_SMM_DRIVER > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D AmdPspFlashAccLib | DXE_SMM_DRIVER > + > +[Sources.common] > + AmdPspFlashAccSpiNorLibSmm.c > + > +[Packages] > + MdePkg/MdePkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AgesaModulePkg/AgesaModulePspPkg.dec > + UefiCpuPkg/UefiCpuPkg.dec > + AgesaPkg/AgesaPkg.dec > + > +[LibraryClasses] > + AmdPspBaseLibV2 > + BaseLib > + DebugLib > + SmmServicesTableLib > + UefiBootServicesTableLib > + > +[Protocols] > + gEfiSmmBase2ProtocolGuid > + gEfiSpiSmmNorFlashProtocolGuid > + > +[Pcd] > + gEfiAmdAgesaPkgTokenSpaceGuid.PcdAgesaFlashNvStorageBlockSize ## > CONSUMES > + gEfiAmdAgesaPkgTokenSpaceGuid.PcdAgesaFlashAreaBaseAddress ## > CONSUMES > + > +[Depex] > + gEfiSmmBase2ProtocolGuid AND > + gEfiSpiSmmNorFlashProtocolGuid > + > diff --git > a/Platform/AMD/AgesaPkg/Addendum/Psp/PspRomArmorWhitelistLib/PspRo > mArmorWhitelistLib.inf > b/Platform/AMD/AgesaPkg/Addendum/Psp/PspRomArmorWhitelistLib/PspRo > mArmorWhitelistLib.inf > new file mode 100644 > index 0000000000..57bb0d9e25 > --- /dev/null > +++ > b/Platform/AMD/AgesaPkg/Addendum/Psp/PspRomArmorWhitelistLib/PspRo > mArmorWhitelistLib.inf > @@ -0,0 +1,32 @@ > +## @file > +# > +# Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010006 > + BASE_NAME =3D PspRomArmorWhitelistLib > + FILE_GUID =3D B6F8507A-C96B-4036-A8C0-26BAD6AC5F3= 4 > + MODULE_TYPE =3D DXE_SMM_DRIVER > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D PlatformPspRomArmorWhitelistLib > + > +[Sources] > + PspRomArmorWhitelistLib.c > + > +[Packages] > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AgesaPkg/AgesaPkg.dec > + MdePkg/MdePkg.dec > + > +[LibraryClasses] > + BaseMemoryLib > + MemoryAllocationLib > + PcdLib > + DebugLib > + > +[Depex] > + TRUE > diff --git > a/Platform/AMD/AmdCpmPkg/Addendum/Oem/OobPprDxe/OobPprDxe.inf > b/Platform/AMD/AmdCpmPkg/Addendum/Oem/OobPprDxe/OobPprDxe.inf > new file mode 100644 > index 0000000000..64fd2913ad > --- /dev/null > +++ > b/Platform/AMD/AmdCpmPkg/Addendum/Oem/OobPprDxe/OobPprDxe.inf > @@ -0,0 +1,42 @@ > +## @file > +# > +# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<= BR> > +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D OobPprDxe > + FILE_GUID =3D F91DCAB4-3639-11EE-BE56-0242AC12000= 2 > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + ENTRY_POINT =3D OobPprEntry > + > +[Sources] > + OobPprDxe.c > + > +[Packages] > + AgesaPkg/AgesaPkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + MdePkg/MdePkg.dec > + AmdCpmPkg/AmdCpmPkg.dec > + > +[LibraryClasses] > + UefiDriverEntryPoint > + DebugLib > + PcdLib > + BaseMemoryLib > + UefiBootServicesTableLib > + UefiRuntimeServicesTableLib > + MemoryAllocationLib > + TimerLib > + > +[Protocols] > + gEfiPciIoProtocolGuid #CONSUMES > + > +[Depex] > + TRUE > + > + > + > diff --git > a/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Dxe/PspPlatformDriv > er/PspPlatform.inf > b/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Dxe/PspPlatformDriv > er/PspPlatform.inf > new file mode 100644 > index 0000000000..f4d7638c1a > --- /dev/null > +++ > b/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Dxe/PspPlatformDriv > er/PspPlatform.inf > @@ -0,0 +1,32 @@ > +## @file > +# > +# Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D PspPlatform > + FILE_GUID =3D 28374747-76FF-41B3-9740-381EFAEF13B= C > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + ENTRY_POINT =3D PspPlatformEntryPoint > + > +[Sources] > + PspPlatformDriver.c > + > +[Packages] > + MdePkg/MdePkg.dec > + AgesaPkg/AgesaPkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AgesaModulePkg/AgesaModulePspPkg.dec > + > +[LibraryClasses] > + DebugLib > + BaseLib > + UefiBootServicesTableLib > + UefiDriverEntryPoint > + > +[Depex] > + TRUE > diff --git > a/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Dxe/ServerHotplugD > xe/ServerHotplugDxe.inf > b/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Dxe/ServerHotplugD > xe/ServerHotplugDxe.inf > new file mode 100644 > index 0000000000..973ace8632 > --- /dev/null > +++ > b/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Dxe/ServerHotplugD > xe/ServerHotplugDxe.inf > @@ -0,0 +1,29 @@ > +## @file > +# > +# Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D ServerHotplugDxe > + FILE_GUID =3D FAFF8CA9-E515-44ed-B5F9-E2F6E5D902E= 3 > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + > + ENTRY_POINT =3D HotplugDescEntry > + > +[Sources] > + ServerHotplugDxe.c > + > +[Packages] > + AgesaPkg/AgesaPkg.dec > + MdePkg/MdePkg.dec > + AmdCpmPkg/AmdCpmPkg.dec > + > +[LibraryClasses] > + UefiDriverEntryPoint > + > +[Depex] > + TRUE > diff --git > a/Platform/AMD/AmdCpmPkg/Library/AmdAutoDynamicCommand/AmdAuto > DynamicCommand.inf > b/Platform/AMD/AmdCpmPkg/Library/AmdAutoDynamicCommand/AmdAuto > DynamicCommand.inf > new file mode 100644 > index 0000000000..2d9dbeb715 > --- /dev/null > +++ > b/Platform/AMD/AmdCpmPkg/Library/AmdAutoDynamicCommand/AmdAuto > DynamicCommand.inf > @@ -0,0 +1,53 @@ > +## @file > +# > +# Copyright (C) 2022-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010006 > + BASE_NAME =3D AmdAutoDynamicCommand > + FILE_GUID =3D CCD8FEC8-1E30-45BD-8632-DB83A255FAC= 3 > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.1 > + ENTRY_POINT =3D ActCommandInitialize > + UNLOAD_IMAGE =3D ActLibraryUnregisterActCommand > + UEFI_HII_RESOURCE_SECTION =3D TRUE > + > +[Sources.common] > + AmdAutoDynamicCommand.c > + > +[Packages] > + MdePkg/MdePkg.dec > + ShellPkg/ShellPkg.dec > + MdeModulePkg/MdeModulePkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AmdCpmPkg/AmdCpmPkg.dec > + > +[LibraryClasses] > + BaseLib > + UefiLib > + FileHandleLib > + HiiLib > + DebugLib > + BaseMemoryLib > + MemoryAllocationLib > + UefiRuntimeServicesTableLib > + UefiDriverEntryPoint > + UefiBootServicesTableLib > + UefiHiiServicesLib > + > +[Guids] > + gShellActHiiGuid ## SOMETIMES_CONSUMES ## HII > + gAgesaConfigDbPointerVariableGuid > + > +[Protocols] > + gEfiShellDynamicCommandProtocolGuid > + gEfiHiiPackageListProtocolGuid > + gEfiShellParametersProtocolGuid > + gEfiUnicodeCollation2ProtocolGuid > + > +[DEPEX] > + TRUE > diff --git > a/Platform/AMD/AmdCpmPkg/Library/AmdAutoDynamicCommand/AmdAuto > ToolApp.inf > b/Platform/AMD/AmdCpmPkg/Library/AmdAutoDynamicCommand/AmdAuto > ToolApp.inf > new file mode 100644 > index 0000000000..98c8755ab8 > --- /dev/null > +++ > b/Platform/AMD/AmdCpmPkg/Library/AmdAutoDynamicCommand/AmdAuto > ToolApp.inf > @@ -0,0 +1,50 @@ > +## @file > +# > +# Copyright (C) 2022-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010006 > + BASE_NAME =3D AmdAutoToolApp > + FILE_GUID =3D 470E1741-2DFE-43EF-861E-505CB3226DC= 0 > + MODULE_TYPE =3D UEFI_APPLICATION > + VERSION_STRING =3D 1.0 > + ENTRY_POINT =3D ActCommandInitialize > +# > +# This flag specifies whether HII resource section is generated into PE= image. > +# > + UEFI_HII_RESOURCE_SECTION =3D TRUE > + > +[Sources.common] > + AmdAutoToolApp.c > + > +[Packages] > + MdePkg/MdePkg.dec > + ShellPkg/ShellPkg.dec > + MdeModulePkg/MdeModulePkg.dec > + AgesaModulePkg/AgesaCommonModulePkg.dec > + AmdCpmPkg/AmdCpmPkg.dec > + > +[LibraryClasses] > + BaseLib > + BaseMemoryLib > + DebugLib > + FileHandleLib > + HiiLib > + MemoryAllocationLib > + UefiApplicationEntryPoint > + UefiBootServicesTableLib > + UefiHiiServicesLib > + UefiLib > + UefiRuntimeServicesTableLib > + > +[Protocols] > + gEfiHiiPackageListProtocolGuid ## CONSUMES > + gEfiShellParametersProtocolGuid > + gEfiUnicodeCollation2ProtocolGuid > + > +[Guids] > + > diff --git > a/Platform/AMD/AmdCpmPkg/Library/CommonLib/BasePlatformHookLibAmd > FchUart/BasePlatformHookLibAmdFchUart.inf > b/Platform/AMD/AmdCpmPkg/Library/CommonLib/BasePlatformHookLibAmd > FchUart/BasePlatformHookLibAmdFchUart.inf > new file mode 100644 > index 0000000000..9c3c0dd0a9 > --- /dev/null > +++ > b/Platform/AMD/AmdCpmPkg/Library/CommonLib/BasePlatformHookLibAmd > FchUart/BasePlatformHookLibAmdFchUart.inf > @@ -0,0 +1,33 @@ > +## @file > +# > +# Copyright (C) 2016-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D BasePlatformHookLibAmdFchUart > + FILE_GUID =3D BF2F3F3F-4BE6-4B97-850D-D5D4941D391= C > + MODULE_TYPE =3D BASE > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D PlatformHookLib > + > +[Sources] > + BasePlatformHookLibAmdFchUart.c > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + AmdCpmPkg/AmdCpmPkg.dec > + AgesaModulePkg/AgesaModuleFchPkg.dec > + > +[LibraryClasses] > + BaseLib > + PcdLib > + IoLib > + PlatformHookLib > + > + > + > diff --git a/Platform/AMD/AgesaModulePkg/Include/AGESA.h > b/Platform/AMD/AgesaModulePkg/Include/AGESA.h > new file mode 100644 > index 0000000000..3ec03aafd3 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/AGESA.h > @@ -0,0 +1,158 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef AGESA_H_ > +#define AGESA_H_ > + > +#include "AMD.h" > +#include "SocLogicalId.h" > + > +#define DESCRIPTOR_TERMINATE_LIST 0x80000000ull > +#define DESCRIPTOR_IGNORE 0x40000000ull > +#define DESCRIPTOR_INITIALIZE_LIST 0x20000000ull > + > +/// PCIe link initialization > +typedef enum { > + EndpointDetect =3D 0, ///< Detect = endpoint presence > + EndpointNotPresent ///< Endpoint = not present (or > connected). Used in case there is alternative way to determine > + ///< if device= present on board or in slot. > For example GPIO can be used to determine device presence. > +} PCIE_ENDPOINT_STATUS; > + > +/// PCIe port misc extended controls > +typedef struct { > + IN UINT8 LinkComplianceMode : 1; ///< Force p= ort into > compliance mode (device will not be trained, port output compliance patte= rn) > + IN UINT8 LinkSafeMode : 2; ///< Safe mo= de PCIe capability. > (Parameter may limit PCIe speed requested through > PCIe_PORT_DATA::LinkSpeedCapability) > + ///< 0 - p= ort can advertise maximum > supported capability > + ///< 1 - p= ort limit advertized capability and > speed to PCIe Gen1 > + IN UINT8 SbLink : 1; ///< PCIe li= nk type > + ///< 0 - Ge= neral purpose port > + ///< 1 - Po= rt connected to SB > + IN UINT8 ClkPmSupport : 1; ///< Clock P= ower Management > Support > + ///< 0 - C= lock Power Management not > configured > + ///< 1 - C= lock Power Management > configured according to PCIe device capability > + IN UINT8 CsLink : 1; ///< PCIe li= nk type > + ///< 0 - G= eneral purpose port > + ///< 1 - P= ort connected to chipset > + IN UINT8 Reserved0 : 2; ///< Unused = space > +} PCIE_PORT_MISC_CONTROL; > + > +/// The IO APIC Interrupt Mapping Info > +typedef struct { > + IN UINT8 GroupMap; ///< Group map= ping for slot or > endpoint device (connected to PCIE port) interrupts . > + ///< - IGNOR= E THIS STRUCTURE AND USE > RECOMMENDED SETTINGS > + ///< - mappe= d to Grp 0 (Interrupts 0..3 of > IO APIC redirection table) > + ///< - mappe= d to Grp 1 (Interrupts 4..7 of > IO APIC redirection table) > + ///< - mappe= d to Grp 7 (Interrupts 28..31 > of IO APIC redirection table) > + IN UINT8 Swizzle; ///< Swizzle i= nterrupt in the Group. > + ///< - ABCD > + ///< - BCDA > + ///< - CDAB > + ///< - DABC > + IN UINT8 BridgeInt; ///< IOAPIC re= direction table entry > for PCIE bridge interrupt > + ///< - Entry= 0 of IO APIC redirection table > + ///< - Entry= 1 of IO APIC redirection table > + ///< - Entry= 31 of IO APIC redirection table > +} APIC_DEVICE_INFO; > + > +/// GEN3 RxAdaptMode Configuration Structure > +typedef struct { > + IN BOOLEAN InitOffsetCancellation; ///< Initia= l Offset > Cancellation Enable > + IN UINT8 DFEControl; ///< DFE Co= ntrol > + IN UINT8 LEQControl; ///< LEQ Co= ntrol > + IN BOOLEAN DynamicOffsetCalibration; ///< Dynami= c Offset > Calibration Enable > + IN BOOLEAN FOMCalculation; ///< FOM Ca= lculation > Enable > + IN BOOLEAN PIOffsetCalibration; ///< PI Off= set Calibratino > Enable > +} RX_ADAPT_MODE; > + > +/// PCIe port configuration data > +typedef struct { > + IN UINT8 PortPresent; ///< Enable= PCIe port for > initialization. > + IN UINT8 ChannelType; ///< Channe= l type. > + ///< 0 - = "lowLoss", > + ///< 1 - = "highLoss", > + ///< 2 - = "mob0db", > + ///< 3 - = "mob3db", > + ///< 4 - = "extnd6db" > + ///< 5 - = "extnd8db" > + IN UINT8 DeviceNumber; ///< PCI De= vice number for > port. > + ///< 0 - = Native port device number > + ///< N - = Port device number (See > available configurations in BKDG > + IN UINT8 FunctionNumber; ///< Reserv= ed for future use > + IN UINT8 LinkSpeedCapability; ///< PCIe l= ink speed/ > + ///< 0 - = Maximum supported by silicon > + ///< 1 - = Gen1 > + ///< 2 - = Gen2 > + ///< 3 - = Gen3 > + IN UINT8 LinkAspm; ///< ASPM c= ontrol. (see > AgesaPcieLinkAspm for additional option to control ASPM) > + ///< 0 - = Disabled > + ///< 1 - = L0s only > + ///< 2 - = L1 only > + ///< 3 - = L0s and L1 > + IN UINT8 LinkHotplug; ///< Hotplu= g control. > + ///< 0 - = Disabled > + ///< 1 - = Basic > + ///< 2 - = Server > + ///< 3 - = Enhanced > + IN UINT8 ResetId; ///< Arbit= rary number greater > than 0 assigned by platform firmware for GPIO > + ///< ident= ification which control reset for > given port. > + ///< Each = port with unique GPIO should > have unique ResetId assigned. > + ///< All p= orts use same GPIO to control > reset should have same ResetId assigned. > + ///< see A= gesaPcieSlotResetContol. > + IN UINT16 SlotNum; ///< Physic= al Slot Number > + IN PCIE_PORT_MISC_CONTROL MiscControls; ///< Misc e= xtended > controls > + IN APIC_DEVICE_INFO ApicDeviceInfo; ///< IOAPIC= device > programming info > + IN PCIE_ENDPOINT_STATUS EndpointStatus; ///< PCIe e= ndpoint > (device connected to PCIe port) status > + IN RX_ADAPT_MODE RxAdaptMode; ///< Gen3 > RxAdaptMode configuration > +} PCIE_PORT_DATA; > + > +/// PCIe Complex descriptor > +typedef struct { > + IN UINT32 Flags; ///< Descripto= r flags > + ///< Bit31 -= last descriptor in topology > + IN UINT32 SocketId; ///< Socket Id > + IN VOID *Reserved; ///< Reserved = for future use > +} PCIE_COMPLEX_DESCRIPTOR; > + > +/// VBIOS image info > +typedef struct { > + IN AMD_CONFIG_PARAMS StdHeader; ///< Standard > configuration header > + OUT VOID *ImagePtr; ///< Pointer t= o VBIOS image > + IN PCI_ADDR GfxPciAddress; ///< PCI addre= ss of integrated > graphics controller > + IN UINT32 Flags; ///< BIT[0] - = special repost requred > +} GFX_VBIOS_IMAGE_INFO; > + > +// > +// CPU MSR Register definitions > +// > +#define SYS_CFG 0xC0010010ul ///< Refer to AMD64 Architecture > Programming manual. > +#define TOP_MEM 0xC001001Aul ///< Refer to AMD64 Architecture > Programming manual. > +#define HWCR 0xC0010015ul ///< Refer to AMD64 Architecture > Programming manual. > + > +/// > +/// VDDP_VDDR Voltage Info for Low Power DIMM > +/// > +typedef struct _VDDP_VDDR_VOLTAGE { > + IN BOOLEAN IsValid; ///< Indicates if daata is valid > + IN UINT8 Voltage; ///< VDDP VDDR Voltage Value > +} VDDP_VDDR_VOLTAGE; > + > +// CPU Build Configuration structures and definitions > + > +#define AMD_AP_MTRR_FIX64k_00000 0x00000250ul ///< Refer to > AMD64 Architecture Programming manual. > +#define AMD_AP_MTRR_FIX16k_80000 0x00000258ul ///< Refer to > AMD64 Architecture Programming manual. > +#define AMD_AP_MTRR_FIX16k_A0000 0x00000259ul ///< Refer to > AMD64 Architecture Programming manual. > +#define AMD_AP_MTRR_FIX4k_C0000 0x00000268ul ///< Refer to > AMD64 Architecture Programming manual. > +#define AMD_AP_MTRR_FIX4k_C8000 0x00000269ul ///< Refer to > AMD64 Architecture Programming manual. > +#define AMD_AP_MTRR_FIX4k_D0000 0x0000026Aul ///< Refer to > AMD64 Architecture Programming manual > +#define AMD_AP_MTRR_FIX4k_D8000 0x0000026Bul ///< Refer to > AMD64 Architecture Programming manual > +#define AMD_AP_MTRR_FIX4k_E0000 0x0000026Cul ///< Refer to > AMD64 Architecture Programming manual > +#define AMD_AP_MTRR_FIX4k_E8000 0x0000026Dul ///< Refer to > AMD64 Architecture Programming manual > +#define AMD_AP_MTRR_FIX4k_F0000 0x0000026Eul ///< Refer to > AMD64 Architecture Programming manual > +#define AMD_AP_MTRR_FIX4k_F8000 0x0000026Ful ///< Refer to > AMD64 Architecture Programming manual > + > +#endif // AGESA_H_ > diff --git a/Platform/AMD/AgesaModulePkg/Include/AMD.h > b/Platform/AMD/AgesaModulePkg/Include/AMD.h > new file mode 100755 > index 0000000000..062d9e1e1a > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/AMD.h > @@ -0,0 +1,91 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef AMD_H_ > +#define AMD_H_ > + > +/// The return status for all AGESA public services. > +/// > +/// Services return the most severe status of any logged event. Status = other > than SUCCESS, UNSUPPORTED, and BOUNDS_CHK > +/// will have log entries with more detail. > +/// > +typedef enum { > + AGESA_SUCCESS =3D 0, ///< 0 - The service completed normally= . Info > may be logged. > + AGESA_UNSUPPORTED, ///< 1 - The dispatcher or create struct= had > an unimplemented function requested. > + ///< Not logged. > + AGESA_BOUNDS_CHK, ///< 2 - A dynamic parameter was out of > range and the service was not provided. > + ///< Example, memory address not ins= talled, heap buffer > handle not found. > + ///< Not Logged. > + AGESA_SYNC_MORE_DATA, ///< 3 - More data is available from PSP > communications (used in ABL) > + AGESA_SYNC_SLAVE_ASSERT, ///< 4 - Slave is at an ASSERT (used in = ABL) > + > + // AGESA_STATUS of greater severity (the ones below this line), always= have > a log entry available. > + AGESA_ALERT, ///< 5 - An observed condition, but no l= oss of > function. See Log. > + AGESA_WARNING, ///< 6 - Possible or minor loss of funct= ion. See > Log. > + AGESA_ERROR, ///< 7 - Significant loss of function, b= oot may be > possible. See Log. > + AGESA_CRITICAL, ///< 8 - Continue boot only to notify us= er. See > Log. > + AGESA_FATAL, ///< 9 - Halt booting. See Log, however= Fatal > errors pertaining to heap problems > + ///< may not be able to reliably pro= duce log events. > + AGESA_OC_FATAL, ///< 10 - Halt booting. Critical Memory > Overclock failure. (used in ABL) > + AGESA_SKIP_ERROR, ///< 11 - Error, Skip init steps. (used i= n ABL) > + AgesaStatusMax ///< Not a status, for limit checking. > +} AGESA_STATUS; > + > +/** > + Callout method to the host environment. > + > + Callout using a dispatch with appropriate thunk layer, which is determ= ined > by the host environment. > + > + @param[in] Function The specific callout function being in= voked. > + @param[in] FcnData Function specific data item. > + @param[in,out] ConfigPtr Reference to Callout params. > +**/ > +typedef AGESA_STATUS (*CALLOUT_ENTRY) ( > + IN UINT32 Function, > + IN UINTN FcnData, > + IN OUT VOID *ConfigPtr > + ); > + > +/// AGESA Structures > + > +/// Extended PCI address format > +typedef struct { > + IN OUT UINT32 Register : 12; ///< Register offset > + IN OUT UINT32 Function : 3; ///< Function number > + IN OUT UINT32 Device : 5; ///< Device number > + IN OUT UINT32 Bus : 8; ///< Bus number > + IN OUT UINT32 Segment : 4; ///< Segment > +} EXT_PCI_ADDR; > + > +/// Union type for PCI address > +typedef union _PCI_ADDR { > + IN UINT32 AddressValue; ///< Formal address > + IN EXT_PCI_ADDR Address; ///< Extended address > +} PCI_ADDR; > + > +/// > +/// The standard header for all AGESA services. > +/// > +typedef struct { > + IN UINT32 ImageBasePtr; ///< The AGESA Image= base address. > + IN UINT32 Func; ///< The service des= ired > + IN UINT32 AltImageBasePtr; ///< Alternate Image= location > + IN CALLOUT_ENTRY CalloutPtr; ///< For Callout fro= m AGESA > + IN UINT8 HeapStatus; ///< For heap status= from boot time > slide. > + IN UINT64 HeapBasePtr; ///< Location of the= heap > + IN OUT UINT8 Reserved[7]; ///< This space is r= eserved for > future use. > +} AMD_CONFIG_PARAMS; > + > +/// CPUID data received registers format > +typedef struct { > + OUT UINT32 EAX_Reg; ///< CPUID instruction= result in EAX > + OUT UINT32 EBX_Reg; ///< CPUID instruction= result in EBX > + OUT UINT32 ECX_Reg; ///< CPUID instruction= result in ECX > + OUT UINT32 EDX_Reg; ///< CPUID instruction= result in EDX > +} CPUID_DATA; > +#endif // AMD_H_ > diff --git a/Platform/AMD/AgesaModulePkg/Include/AmdEdk2/CpuRegisters.h > b/Platform/AMD/AgesaModulePkg/Include/AmdEdk2/CpuRegisters.h > new file mode 100755 > index 0000000000..534b03d4a7 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/AmdEdk2/CpuRegisters.h > @@ -0,0 +1,15 @@ > +/** @file > + AMD CPU Register Table Related Functions. > + > + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef CPU_REGISTERS_H_ > +#define CPU_REGISTERS_H_ > + > +#include > + > +#endif > diff --git a/Platform/AMD/AgesaModulePkg/Include/AmdPspDirectory.h > b/Platform/AMD/AgesaModulePkg/Include/AmdPspDirectory.h > new file mode 100644 > index 0000000000..e086a4c9b1 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/AmdPspDirectory.h > @@ -0,0 +1,61 @@ > +/** @file > + AMD Psp Directory header file > + > + Copyright (C) 2023-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef AMD_PSP_DIR_H_ > +#define AMD_PSP_DIR_H_ > + > +#pragma pack (push, 1) > +#define PSP_DIRECTORY_HEADER_SIGNATURE 0x50535024ul ///< $PSP > +#define PSP_LV2_DIRECTORY_HEADER_SIGNATURE 0x324C5024ul ///< > $PL2 > + > +/// Enum define various enum type for PSP entry type > +enum _PSP_DIRECTORY_ENTRY_TYPE { > + PSP_REGION_A_DIR =3D 0x48, ///< PSP ent= ry points to PSP > DIR in Region A > + PSP_REGION_B_DIR =3D 0x4A, ///< PSP ent= ry points to PSP > DIR in Region B > +}; > + > +/// Define structure for PSP directory > +typedef struct { > + UINT32 Cookie; ///< "$PSP" > + UINT32 Checksum; ///< 32 bit CR= C of header items > below and the entire table > + UINT32 TotalEntries; ///< Number of= PSP Entries > + UINT32 Reserved; ///< Unused > +} PSP_DIRECTORY_HEADER; > + > +/// Define structure for 32 bits Entry type field > +typedef struct { > + UINT32 Type : 8; ///< Type of P= SP Directory entry > + UINT32 SubProgram : 8; ///< Specify t= he SubProgram > + UINT32 RomId : 2; ///< Specify t= he ROM ID > + UINT32 Reserved : 14; ///< Reserved > +} PSP_DIRECTORY_ENTRY_TYPE_FIELD; > + > +/// Define union type for 32 bits Entry type field > +typedef union { > + PSP_DIRECTORY_ENTRY_TYPE_FIELD Field; ///< Definitio= n of each > filed > + UINT32 Value; ///< Group it = as 32bits Int > +} PSP_DIRECTORY_ENTRY_TYPE; > + > +/// Structure for PSP Entry > +typedef struct { > + PSP_DIRECTORY_ENTRY_TYPE Type; ///< Type of P= SP entry; > 32 bit long > + UINT32 Size; ///< Size of P= SP Entry in bytes > + UINT64 Location; ///< Location = of PSP Entry (byte > offset from start of SPI-ROM) > +} PSP_DIRECTORY_ENTRY; > + > +/// Structure for PSP directory > +typedef struct { > + PSP_DIRECTORY_HEADER Header; ///< PSP direc= tory header > + PSP_DIRECTORY_ENTRY PspEntry[1]; ///< Array of = PSP entries > each pointing to a binary in SPI flash > + ///< The actua= l size of this array comes from > the > + ///< header > (PSP_DIRECTORY.Header.TotalEntries) > +} PSP_DIRECTORY; > + > +#pragma pack (pop) > +#endif //AMD_PSP_DIR_H_ > diff --git a/Platform/AMD/AgesaModulePkg/Include/CpuRegistersDef.h > b/Platform/AMD/AgesaModulePkg/Include/CpuRegistersDef.h > new file mode 100755 > index 0000000000..faa8d35b1b > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/CpuRegistersDef.h > @@ -0,0 +1,156 @@ > +/** @file > + AMD CPU Register Table Related Definitions. > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef CPU_REGISTERS_DEF_H_ > +#define CPU_REGISTERS_DEF_H_ > + > +#undef BIT0 > +#undef BIT1 > +#undef BIT2 > +#undef BIT3 > +#undef BIT4 > +#undef BIT5 > +#undef BIT6 > +#undef BIT7 > +#undef BIT8 > +#undef BIT9 > +#undef BIT10 > +#undef BIT10 > +#undef BIT11 > +#undef BIT12 > +#undef BIT13 > +#undef BIT14 > +#undef BIT15 > +#undef BIT16 > +#undef BIT17 > +#undef BIT18 > +#undef BIT19 > +#undef BIT20 > +#undef BIT21 > +#undef BIT22 > +#undef BIT23 > +#undef BIT24 > +#undef BIT25 > +#undef BIT26 > +#undef BIT27 > +#undef BIT28 > +#undef BIT29 > +#undef BIT30 > +#undef BIT31 > +#undef BIT32 > +#undef BIT33 > +#undef BIT34 > +#undef BIT35 > +#undef BIT36 > +#undef BIT37 > +#undef BIT38 > +#undef BIT39 > +#undef BIT40 > +#undef BIT41 > +#undef BIT42 > +#undef BIT43 > +#undef BIT44 > +#undef BIT45 > +#undef BIT46 > +#undef BIT47 > +#undef BIT48 > +#undef BIT49 > +#undef BIT40 > +#undef BIT41 > +#undef BIT42 > +#undef BIT43 > +#undef BIT44 > +#undef BIT45 > +#undef BIT46 > +#undef BIT47 > +#undef BIT48 > +#undef BIT49 > +#undef BIT50 > +#undef BIT51 > +#undef BIT52 > +#undef BIT53 > +#undef BIT54 > +#undef BIT55 > +#undef BIT56 > +#undef BIT57 > +#undef BIT58 > +#undef BIT59 > +#undef BIT60 > +#undef BIT61 > +#undef BIT62 > +#undef BIT63 > + > +#define BIT0 0x0000000000000001ull > +#define BIT1 0x0000000000000002ull > +#define BIT2 0x0000000000000004ull > +#define BIT3 0x0000000000000008ull > +#define BIT4 0x0000000000000010ull > +#define BIT5 0x0000000000000020ull > +#define BIT6 0x0000000000000040ull > +#define BIT7 0x0000000000000080ull > +#define BIT8 0x0000000000000100ull > +#define BIT9 0x0000000000000200ull > +#define BIT10 0x0000000000000400ull > +#define BIT11 0x0000000000000800ull > +#define BIT12 0x0000000000001000ull > +#define BIT13 0x0000000000002000ull > +#define BIT14 0x0000000000004000ull > +#define BIT15 0x0000000000008000ull > +#define BIT16 0x0000000000010000ull > +#define BIT17 0x0000000000020000ull > +#define BIT18 0x0000000000040000ull > +#define BIT19 0x0000000000080000ull > +#define BIT20 0x0000000000100000ull > +#define BIT21 0x0000000000200000ull > +#define BIT22 0x0000000000400000ull > +#define BIT23 0x0000000000800000ull > +#define BIT24 0x0000000001000000ull > +#define BIT25 0x0000000002000000ull > +#define BIT26 0x0000000004000000ull > +#define BIT27 0x0000000008000000ull > +#define BIT28 0x0000000010000000ull > +#define BIT29 0x0000000020000000ull > +#define BIT30 0x0000000040000000ull > +#define BIT31 0x0000000080000000ull > +#define BIT32 0x0000000100000000ull > +#define BIT33 0x0000000200000000ull > +#define BIT34 0x0000000400000000ull > +#define BIT35 0x0000000800000000ull > +#define BIT36 0x0000001000000000ull > +#define BIT37 0x0000002000000000ull > +#define BIT38 0x0000004000000000ull > +#define BIT39 0x0000008000000000ull > +#define BIT40 0x0000010000000000ull > +#define BIT41 0x0000020000000000ull > +#define BIT42 0x0000040000000000ull > +#define BIT43 0x0000080000000000ull > +#define BIT44 0x0000100000000000ull > +#define BIT45 0x0000200000000000ull > +#define BIT46 0x0000400000000000ull > +#define BIT47 0x0000800000000000ull > +#define BIT48 0x0001000000000000ull > +#define BIT49 0x0002000000000000ull > +#define BIT50 0x0004000000000000ull > +#define BIT51 0x0008000000000000ull > +#define BIT52 0x0010000000000000ull > +#define BIT53 0x0020000000000000ull > +#define BIT54 0x0040000000000000ull > +#define BIT55 0x0080000000000000ull > +#define BIT56 0x0100000000000000ull > +#define BIT57 0x0200000000000000ull > +#define BIT58 0x0400000000000000ull > +#define BIT59 0x0800000000000000ull > +#define BIT60 0x1000000000000000ull > +#define BIT61 0x2000000000000000ull > +#define BIT62 0x4000000000000000ull > +#define BIT63 0x8000000000000000ull > + > +#define MSR_MMIO_CFG_BASE 0xC0010058ul // MMIO > Configuration Base Address Register > + > +#endif // CPU_REGISTERS_DEF_H_ > diff --git a/Platform/AMD/AgesaModulePkg/Include/FchRegistersCommon.h > b/Platform/AMD/AgesaModulePkg/Include/FchRegistersCommon.h > new file mode 100644 > index 0000000000..8ede1be838 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/FchRegistersCommon.h > @@ -0,0 +1,85 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef FCH_REGISTER_COMMON_H_ > +#define FCH_REGISTER_COMMON_H_ > + > +// Misc > +#define R_FCH_ACPI_PM1_STATUS 0x00 > +#define R_FCH_ACPI_PM1_ENABLE 0x02 > +#define R_FCH_ACPI_PM_CONTROL 0x04 > + > +#define FCH_LPC_BUS 0 > +#define FCH_LPC_DEV 20 > +#define FCH_LPC_FUNC 3 > + > +#define ACPI_MMIO_BASE 0xFED80000ul > +#define SMI_BASE 0x200 // DWORD > +#define IOMUX_BASE 0xD00 // BYTE > +#define MISC_BASE 0xE00 > +#define PMIO_BASE 0x300 // DWORD > + > +// > +// FCH LPC Device 0x780E > +// Device 20 (0x14) Func 3 > +// > +#define FCH_LPC_REG48 0x48 // IO/Mem Port Decode Enable > Register 5- RW > +#define FCH_LPC_REG74 0x74 // Alternative Wide IO Range Ena= ble- > W/R > +#define FCH_LPC_REG7C 0x7C // TPM (trusted plant form modul= e) > reg- W/R > +#define FCH_LPC_REGA0 0x0A0 // SPI base address > +#define FCH_LPC_REGB8 0x0B8 > + > +// > +// FCH MMIO Base (SMI) > +// offset : 0x200 > +// > +#define FCH_SMI_REG80 0x80 // SmiStatus0 > +#define FCH_SMI_REG84 0x84 // SmiStatus1 > +#define FCH_SMI_REG88 0x88 // SmiStatus2 > +#define FCH_SMI_REG8C 0x8C // SmiStatus3 > +#define FCH_SMI_REG90 0x90 // SmiStatus4 > +#define FCH_SMI_REG98 0x98 // SmiTrig > +#define FCH_SMI_REGA0 0xA0 > +#define FCH_SMI_REGB0 0xB0 > +#define FCH_SMI_REGC4 0xC4 > + > +// > +// FCH MMIO Base (PMIO) > +// offset : 0x300 > +// > +#define FCH_PMIOA_REG60 0x60 // AcpiPm1EvtBlk > + > +// > +// > +#define FCH_MISC_REG80 0x80 > +// FCH SPI > +// > + > +#define FCH_SPI_BASE_ADDRESS 0xFEC10000 > + > +#define FCH_SPI_MMIO_REG00 0x00 > +#define FCH_SPI_FIFO_PTR_CRL 0x00100000l // > +#define FCH_SPI_BUSY 0x80000000l // > +#define FCH_SPI_MMIO_REG1D 0x1D // > +#define FCH_SPI_MMIO_REG20 0x20 > +#define FCH_SPI_MMIO_REG22 0x22 // > +#define FCH_SPI_MMIO_REG30 0x30 // > +#define FCH_SPI_R2VAL24 0x00000001l // > +#define FCH_SPI_R2VAL25 0x00000002l // > +#define FCH_SPI_R2MSK24 0x00000004l // > +#define FCH_SPI_R2MSK25 0x00000008l // > +#define FCH_SPI_MMIO_REG45_CMDCODE 0x45 // > +#define FCH_SPI_MMIO_REG47_CMDTRIGGER 0x47 // > +#define FCH_SPI_MMIO_REG48_TXBYTECOUNT 0x48 // > +#define FCH_SPI_MMIO_REG4B_RXBYTECOUNT 0x4B // > +#define FCH_SPI_MMIO_REG4C_SPISTATUS 0x4C // > +#define FCH_SPI_MMIO_REG5C_Addr32_Ctrl3 0x5C // > +#define FCH_SPI_SPIROM_PAGE_MASK 0xFF // > +#define FCH_SPI_MMIO_REG80_FIFO 0x80 // > + > +#endif /* FCH_REGISTER_COMMON_H_ */ > diff --git a/Platform/AMD/AgesaModulePkg/Include/Filecode.h > b/Platform/AMD/AgesaModulePkg/Include/Filecode.h > new file mode 100644 > index 0000000000..726479d79f > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/Filecode.h > @@ -0,0 +1,31 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > +/* $NoKeywords:$ */ > + > +/** > + * @file > + * > + * Collectively assign unique filecodes for assert and debug to each sou= rce > file. > + * > + * Publish values for decorated filenames, which can be used for > + * ASSERT and debug support using a preprocessor define like: > + * @n _#define FILECODE MY_C_FILENAME_FILECODE @n > + * This file serves as a reference for debugging to associate the code a= nd > filename. > + * > + * @xrefitem bom "File Content Label" "Release Content" > + * @e project: AGESA > + * @e sub-project: Include > + * @e _$Revision: 312538 $ @e \$Date: 2015-02-09 16:53:54 +0800 > (Mon, 09 Feb 2015) $ > + */ > + > +#ifndef _FILECODE_H_ > +#define _FILECODE_H_ > + > +#define UNASSIGNED_FILE_FILECODE (0xFFFF) > + > +#endif // _FILECODE_H_ > diff --git a/Platform/AMD/AgesaModulePkg/Include/Gnb.h > b/Platform/AMD/AgesaModulePkg/Include/Gnb.h > new file mode 100755 > index 0000000000..ddc9309d3d > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/Gnb.h > @@ -0,0 +1,14 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef GNB_H_ > +#define GNB_H_ > + > +#define PVOID UINT64 > + > +#endif // GNB_H_ > diff --git a/Platform/AMD/AgesaModulePkg/Include/GnbDxio.h > b/Platform/AMD/AgesaModulePkg/Include/GnbDxio.h > new file mode 100644 > index 0000000000..192e0d6a8b > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/GnbDxio.h > @@ -0,0 +1,521 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef GNBDXIO_H_ > +#define GNBDXIO_H_ > + > +#pragma pack (push, 1) > + > +#include > +#include > + > +#define MAX_NUMBER_OF_COMPLEXES 16 > + > +#define DESCRIPTOR_TERMINATE_GNB 0x40000000ull > +#define DESCRIPTOR_TERMINATE_TOPOLOGY 0x20000000ull > +#define DESCRIPTOR_ALLOCATED 0x10000000ull > +#define DESCRIPTOR_PLATFORM 0x08000000ull > +#define DESCRIPTOR_COMPLEX 0x04000000ull > +#define DESCRIPTOR_SILICON 0x02000000ull > +#define DESCRIPTOR_PCIE_WRAPPER 0x01000000ull > +#define DESCRIPTOR_PCIE_ENGINE 0x00800000ull > +#define DESCRIPTOR_CXL_ENGINE 0x00200000ull > + > +#define SILICON_CXL_CAPABLE 0x00008000ull > + > +#define DESCRIPTOR_ALL_WRAPPERS (DESCRIPTOR_PCIE_WRAPPER) > +#define DESCRIPTOR_ALL_ENGINES (DESCRIPTOR_PCIE_ENGINE | > DESCRIPTOR_CXL_ENGINE) > + > +#define DESCRIPTOR_ALL_TYPES (DESCRIPTOR_ALL_WRAPPERS | > DESCRIPTOR_ALL_ENGINES | DESCRIPTOR_SILICON | DESCRIPTOR_PLATFORM) > +#define PcieLibGetNextDescriptor(Descriptor) ((Descriptor =3D=3D NULL) = ? > NULL : ((Descriptor->Header.DescriptorFlags & > DESCRIPTOR_TERMINATE_LIST) !=3D 0) ? NULL : (Descriptor + 1)) > + > +typedef UINT16 PCIE_ENGINE_INIT_STATUS; > + > +/// > +/// Engine Configuration > +/// > +typedef struct { > + IN UINT8 EngineType; ///< Engine ty= pe > + ///< 0 - Ig= nore engine configuration > + ///< 1 - PC= Ie port > + IN UINT16 StartLane; ///< Start Lan= e ID (in reversed > configuration StartLane > EndLane) > + ///< Refer to = lane descriptions and > supported configurations in BKDG > + IN UINT16 EndLane; ///< End lane = ID (in reversed > configuration StartLane > EndLane) > + ///< Refer to = lane descriptions and > supported configurations in BKDG > +} PCIE_ENGINE; > + > +/// > +/// PCIe port misc extended controls > +/// > +typedef struct { > + IN UINT8 SbLink : 1; ///< PCIe li= nk type > + ///< 0 - G= eneral purpose port > + ///< 1 - P= ort connected to SB > + IN UINT8 ClkPmSupport : 1; ///< Clock P= ower Management > Support > + ///< 0 - C= lock Power Management not > configured > + ///< 1 - C= lock Power Management > configured according to PCIe device capability > + IN UINT8 CsLink : 1; ///< PCIe li= nk type > + ///< 0 - G= eneral purpose port > + ///< 1 - P= ort connected to chipset > + IN UINT8 Reserved0 : 5; ///< Unused = space > +} PORT_MISC_CONTROL; > + > +/// > +/// PCIe port configuration data > +/// > +typedef struct { > + IN UINT8 PortPresent; ///< Enable= PCIe port for > initialization. > + IN UINT8 FunctionNumber : 3; ///< Reserv= ed for future use > + IN UINT8 DeviceNumber : 5; ///< PCI De= vice number for > port. > + ///< 0 - = Native port device number > + ///< N - = Port device number (See > available configurations in BKDG > + IN UINT8 LinkSpeedCapability : 4; ///< PCIe l= ink speed/ > + ///< 0 - = Maximum supported by silicon > + ///< 1 - = Gen1 > + ///< 2 - = Gen2 > + ///< 3 - = Gen3 > + IN UINT8 LinkAspm : 4; ///< ASPM c= ontrol. (see > AgesaPcieLinkAspm for additional option to control ASPM) > + ///< 0 - = Disabled > + ///< 1 - = L0s only > + ///< 2 - = L1 only > + ///< 3 - = L0s and L1 > + IN UINT8 LinkHotplug; ///< Hotplu= g control. > + ///< 0 - = Disabled > + ///< 1 - = Basic > + ///< 2 - = Server > + ///< 3 - = Enhanced > + IN UINT16 SlotNum; ///< Physic= al Slot Number > + IN PORT_MISC_CONTROL MiscControls; ///< Misc e= xtended > controls > + IN UINT8 Reserved1; ///< Reserv= ed for future use > +} PORT_DATA; > + > +typedef struct { > + UINT8 LinkSpeed; > + UINT8 MaxPayloadSupport; > + UINT8 AspmCapability; > + UINT8 PciPmL1_1; > + UINT8 PciPmL1_2; > + UINT8 AspmL1_1; > + UINT8 AspmL1_2; > + UINT8 EsmSupport; > + UINT8 LtrSupport; > + UINT8 SurpriseDownErrorReport; > + UINT8 TenBitTagSupport; > + UINT8 AriForwarding; > + UINT8 AcsSupport; > + UINT8 AcsSourceValidation; > + UINT8 AcsTranslationBlocking; > + UINT8 AcsP2pRequestRedirect; > + UINT8 AcsP2pCompletionRedirect; > + UINT8 AcsUpstreamForwarding; > + UINT8 AcsP2pEgressControl; > + UINT8 AcsDirectTranslatedP2p; > + UINT8 LaneMargining; > + UINT8 DataLinkFeature; > + UINT8 DownstreamPortContainment; > + UINT8 AdvancedErrorReporting; > + UINT8 ECRCSupport; > + UINT8 MulticastEnable; > + UINT8 NativePCIeEnclosureManagement; > + UINT8 Capability1Address; > + UINT8 Capability1Data; > + UINT8 Capability2Address; > + UINT8 Capability2Data; > + UINT8 Capability3Address; > + UINT8 Capability3Data; > + UINT8 Capability4Address; > + UINT8 Capability4Data; > +} PORT_CAPABILITIES; > + > +/// > +/// PCIe PORT_FEATURES > +/// > +typedef struct { > + UINT8 LinkSpeedControl; > + UINT8 MaxPayloadSizeControl; > + UINT8 ESMControl; > + UINT8 LTRControl; > + UINT8 DataLinkFeatureExchangeControl; > + UINT8 TenBitTagControl; > + UINT8 ARIControl; > + UINT8 ACSControl; > + UINT8 RxLaneMarginingControl; > + UINT8 DynLanesPwrState; > + UINT8 L1PowerDown; > + UINT8 L11PowerDown; > + UINT8 L12PowerDown; > + UINT8 AutoSpdChngEn; > + UINT8 TurnOffUnusedLanes; > +} PORT_FEATURES; > + > +typedef struct { > + UINT8 SpcGen1 : 1; ///< SPC Mode 2P= 5GT > + UINT8 SpcGen2 : 1; ///< SPC Mode 5G= T > + UINT8 SpcGen3 : 2; ///< SPC Mode 8G= T > + UINT8 SpcGen4 : 2; ///< SPC Mode 16= GT > + UINT8 SpcGen5 : 2; ///< SPC Mode 32= GT > +} SPC_MODE; > + > +typedef struct { > + UINT32 DsTxPreset : 4; ///< Gen3 Downst= ream Tx Preset > + UINT32 DsRxPresetHint : 3; ///< Gen3 Downst= ream Rx > Preset Hint > + UINT32 UsTxPreset : 4; ///< Gen3 Upstre= am Tx Preset > + UINT32 UsRxPresetHint : 3; ///< Gen3 Upstre= am Rx Preset > Hint > + UINT32 LcPresetMask8Gt : 10; ///< Gen3 Preset= Mask > + UINT32 LcFapeEnable8GT : 1; ///< Gen3 FapeEn= able > + UINT32 UNUSED2 : 7; ///< Currently u= nassigned - for > alignment > +} GEN3_LANE_CNTL; > + > +typedef struct { > + UINT32 DsTxPreset : 4; ///< Gen4 Downs= tream Tx Preset > + UINT32 UsTxPreset : 4; ///< Gen4 Upstr= eam Tx Preset > + UINT32 LcPresetMask16Gt : 10; ///< Gen4 Prese= t Mask > + UINT32 LcFapeEnable16GT : 1; ///< Gen4 FapeE= nable > + UINT32 UNUSED3 : 13; ///< Currently = unassigned - for > alignment > +} GEN4_LANE_CNTL; > + > +typedef struct { > + UINT32 DsTxPreset : 4; ///< Gen5 Downst= ream Tx Preset > + UINT32 UsTxPreset : 4; ///< Gen5 Upstre= am Tx Preset > + UINT32 LcPresetMask32Gt : 10; ///< Gen5 Preset= Mask > + UINT32 LcFapeEnable32GT : 1; ///< Gen5 FapeEn= able > + UINT32 PrecodeRequest : 1; ///< Precoding R= equest > + UINT32 AdvertiseEqToHiRate : 1; ///< Advertise E= Q To High > Rate Support > + UINT32 UNUSED4 : 11; ///< Currently u= nassigned - for > alignment > +} GEN5_LANE_CNTL; > + > +typedef struct { > + UINT32 LcFapeReqPostCursor0 : 5; ///< PostCursor0 > + UINT32 LcFapeReqPreCursor0 : 4; ///< PreCursor0 > + UINT32 LcFapeReqPostCursor1 : 5; ///< PostCursor1 > + UINT32 LcFapeReqPreCursor1 : 4; ///< PreCursor1 > + UINT32 LcFapeReqPostCursor2 : 5; ///< PostCursor2 > + UINT32 LcFapeReqPreCursor2 : 4; ///< PreCursor2 > + UINT32 UNUSED6 : 5; ///< Currently u= nassigned - for > alignment > +} LC_FAPE_GROUP_0; > + > +typedef struct { > + UINT32 LcFapeReqPostCursor3 : 5; ///< PostCursor3 > + UINT32 LcFapeReqPreCursor3 : 4; ///< PreCursor3 > + UINT32 LcFapeReqPostCursor4 : 5; ///< PostCursor4 > + UINT32 LcFapeReqPreCursor4 : 4; ///< PreCursor4 > + UINT32 LcFapeReqPostCursor5 : 5; ///< PostCursor5 > + UINT32 LcFapeReqPreCursor5 : 4; ///< PreCursor5 > + UINT32 UNUSED7 : 5; ///< Currently u= nassigned - for > alignment > +} LC_FAPE_GROUP_1; > + > +typedef struct { > + UINT32 LcFapeReqPostCursor6 : 5; ///< PostCursor6 > + UINT32 LcFapeReqPreCursor6 : 4; ///< PreCursor6 > + UINT32 LcFapeReqPostCursor7 : 5; ///< PostCursor7 > + UINT32 LcFapeReqPreCursor7 : 4; ///< PreCursor7 > + UINT32 LcFapeReqPostCursor8 : 5; ///< PostCursor8 > + UINT32 LcFapeReqPreCursor8 : 4; ///< PreCursor8 > + UINT32 UNUSED8 : 5; ///< Currently u= nassigned - for > alignment > +} LC_FAPE_GROUP_2; > + > +typedef struct { > + UINT32 LcFapeReqPostCursor9 : 5; ///< PostCursor9 > + UINT32 LcFapeReqPreCursor9 : 4; ///< PreCursor9 > + UINT32 LcFapeReqPostCursor10 : 5; ///< PostCursor1= 0 > + UINT32 LcFapeReqPreCursor10 : 4; ///< PreCursor10 > + UINT32 LcFapeReqPostCursor11 : 5; ///< PostCursor1= 1 > + UINT32 LcFapeReqPreCursor11 : 4; ///< PreCursor11 > + UINT32 UNUSED9 : 5; ///< Currently u= nassigned - for > alignment > +} LC_FAPE_GROUP_3; > + > +typedef struct { > + UINT32 LcFapeReqPostCursor12 : 5; ///< PostCursor1= 2 > + UINT32 LcFapeReqPreCursor12 : 4; ///< PreCursor12 > + UINT32 LcFapeReqPostCursor13 : 5; ///< PostCursor1= 3 > + UINT32 LcFapeReqPreCursor13 : 4; ///< PreCursor13 > + UINT32 LcFapeReqPostCursor14 : 5; ///< PostCursor1= 4 > + UINT32 LcFapeReqPreCursor14 : 4; ///< PreCursor14 > + UINT32 UNUSED10 : 5; ///< Currently u= nassigned - for > alignment > +} LC_FAPE_GROUP_4; > + > +typedef struct { > + UINT32 LcFapeReqPostCursor15 : 5; ///< PostCursor1= 5 > + UINT32 LcFapeReqPreCursor15 : 4; ///< PreCursor15 > + UINT32 LcFapeReqPostCursor16 : 5; ///< PostCursor1= 6 > + UINT32 LcFapeReqPreCursor16 : 4; ///< PreCursor16 > + UINT32 LcFapeReqPostCursor17 : 5; ///< PostCursor1= 7 > + UINT32 LcFapeReqPreCursor17 : 4; ///< PreCursor17 > + UINT32 UNUSED11 : 5; ///< Currently u= nassigned - for > alignment > +} LC_FAPE_GROUP_5; > + > +typedef struct { > + UINT32 LcFapeReqPostCursor18 : 5; ///< PostCursor1= 8 > + UINT32 LcFapeReqPreCursor18 : 4; ///< PreCursor18 > + UINT32 LcFapeReqPostCursor19 : 5; ///< PostCursor1= 9 > + UINT32 LcFapeReqPreCursor19 : 4; ///< PreCursor19 > + UINT32 LcFapeReqPostCursor20 : 5; ///< PostCursor2= 0 > + UINT32 LcFapeReqPreCursor20 : 4; ///< PreCursor20 > + UINT32 UNUSED12 : 5; ///< Currently u= nassigned - for > alignment > +} LC_FAPE_GROUP_6; > + > +/// > +/// PCIe port configuration info > +/// > +typedef struct { > + PORT_DATA PortData; ///< Port data > + UINT8 StartCoreLane; ///< Start Core = Lane > + UINT8 EndCoreLane; ///< End Core la= ne > + UINT8 NativeDevNumber : 5; ///< Native PCI = device number > of the port > + UINT8 NativeFunNumber : 3; ///< Native PCI = function > number of the port > + UINT8 CoreId : 4; ///< PCIe core I= D > + UINT8 PortId : 4; ///< Port ID on = wrapper > + PCI_ADDR Address; ///< PCI address= of the port > + UINT8 PcieBridgeId : 7; ///< IOC PCIe br= idge ID > + UINT8 IsBmcLocation : 1; ///< Port Locati= on of BMC > + UINT8 LogicalBridgeId; ///< Logical Bri= dge ID > + UINT8 SlotPowerLimit; ///< Slot Power = Limit > + UINT8 MaxPayloadSize; ///< Max_Payload= _Size > + > + UINT8 TXDeEmphasis : 4; ///< TX De-empha= sis > + UINT8 TXMargin : 3; ///< TX Margin > + UINT8 UNUSED1 : 1; ///< Currently u= nassigned - for > alignment > + > + PORT_CAPABILITIES PortCapabilities; ///< Port Capabi= lities CBS > + > + SPC_MODE SpcMode; > + > + GEN3_LANE_CNTL LaneEqualizationCntl; > + GEN4_LANE_CNTL Gen4LaneEqualizationCntl; > + GEN5_LANE_CNTL Gen5LaneEqualizationCntl; > + > + UINT8 LowerSkpOsGenSup; ///< Controls > LOWER_SKP_OS_GEN_SUPPORT > + UINT8 LowerSkpOsRcvSup; ///< Controls > LOWER_SKP_OS_RCV_SUPPORT > + UINT8 SrisSkipInterval : 3; ///< Controls SR= IS SKP generation > interval > + UINT8 SrisSkpIntervalSel : 2; ///< Controls SR= IS SKIP Interval > Selection Mode > + UINT8 SrisAutodetectFactor : 2; ///< Controls th= e multiplier for > SKP ordered set interval when generated based on elasticity buffer pointe= r > slip feedback from PCS > + UINT8 UNUSED4 : 1; ///< Currently u= nassigned - for > alignment > + UINT8 SRIS_SRNS : 1; ///< SRIS SRNS > + UINT8 SRIS_LowerSKPSupport : 1; ///< SRIS Lower = SKP Support > + UINT8 CcixControl : 1; ///< Bit to enab= le/disable ESM > + UINT8 CxlControl : 1; ///< Bit to enab= le CXL Capability > + UINT8 AlwaysExpose : 1; ///< Always expo= se unused PCIE > port > + UINT8 SlotPowerLimitScale : 2; ///< Slot Power = Limit Scale > + UINT8 UNUSED5 : 1; ///< Currently u= nassigned - for > alignment > + > + UINT8 RxMarginPersistence : 1; ///< Bit to enab= le/disable Rx > Margin persistence mode > + UINT8 SetGen3FixedPreset : 1; ///< Gen3 Fixed = Preset Set > + UINT8 SetGen4FixedPreset : 1; ///< Gen4 Fixed = Preset Set > + UINT8 SetGen5FixedPreset : 1; ///< Gen5 Fixed = Preset Set > + UINT8 TxVetting : 1; ///< Gen4 Tx Vet= ting > + UINT8 RxVetting : 1; ///< Gen4 Rx Vet= ting > + UINT8 TxVettingGen5 : 1; ///< Gen5 Tx Vet= ting > + UINT8 RxVettingGen5 : 1; ///< Gen5 Rx Vet= ting > + > + UINT8 IsMasterPLL : 1; ///< IsMasterPLL > + UINT8 TargetLinkSpeed : 3; ///< Target Link= Speed > + UINT8 DlfCapDisable : 1; ///< DLF Capabil= ity 1:Disable > 0:Enable > + UINT8 DlfExchangeDisable : 1; ///< DLF Exchang= e 1:Disable > 0:Enable > + UINT8 InvertPolarity : 1; ///< Invert RX P= olarity > + UINT8 InvertPolarity2 : 1; ///< Invert TX P= olarity > + > + UINT8 EqSearchMode : 2; ///< Equalizatio= n Search Mode > + UINT8 BypassGen3EQ : 1; ///< BypassGen3E= Q > + UINT8 DisGen3EQPhase : 1; ///< Disable Gen= 3 EQ Phase2/3 > + UINT8 Gen3FixedPreset : 4; ///< Gen3 Fixed = Preset value > + > + UINT8 EqSearchModeGen4 : 2; ///< Equalizatio= n Search > Mode for Gen4 > + UINT8 BypassGen4EQ : 1; ///< Gen4 Bypass= phase3 EQ > + UINT8 DisGen4EQPhase : 1; ///< Gen4 Bypass= phase2/3 EQ > + UINT8 Gen4FixedPreset : 4; ///< Gen4 Fixed = Preset value > + UINT8 EqSearchModeGen5 : 2; ///< Equalizatio= n Search > Mode for Gen5 > + UINT8 BypassGen5EQ : 1; ///< Gen5 Bypass= phase3 EQ > + UINT8 DisGen5EQPhase : 1; ///< Gen5 Bypass= phase2/3 EQ > + UINT8 Gen5FixedPreset : 4; ///< Gen5 Fixed = Preset value > + > + UINT16 PsppPolicyDC; ///< Pspp Policy= DC > + UINT16 PsppPolicyAC; ///< Pspp Policy= AC > + UINT8 PsppDeviceType; ///< Pspp Device= Type > + > + LC_FAPE_GROUP_0 LcFapeSettingsGroup0; > + LC_FAPE_GROUP_1 LcFapeSettingsGroup1; > + LC_FAPE_GROUP_2 LcFapeSettingsGroup2; > + LC_FAPE_GROUP_3 LcFapeSettingsGroup3; > + LC_FAPE_GROUP_4 LcFapeSettingsGroup4; > + LC_FAPE_GROUP_5 LcFapeSettingsGroup5; > + LC_FAPE_GROUP_6 LcFapeSettingsGroup6; > + > + UINT8 ForceSteering : 1; ///< Steering is= forced > + UINT8 EsmUsTxPreset : 4; ///< ESM Upstrea= m Tx Preset > + UINT8 UNUSED13 : 3; ///< Currently u= nassigned - for > alignment > + > + // Used by DXE > + PORT_FEATURES PortFeatures; ///< Port Featur= es CBS > + UINT8 EsmSpeedBump; ///< Speed bump = for ESM > + UINT8 I2CMuxInfo; ///< First I2c M= ux on Bus > + UINT8 SrisEnableMode : 4; ///< 0:Disable 1= :SRIS 2:SRNS > 3:SRNS in SRIS 0xF:Auto > + UINT8 SrisAutoDetectMode : 4; ///< Controls SR= IS Autodetect > mode 0:Disable 1:Enable 0xF:Auto > + UINT8 ClkReq : 4; ///< ClkReq:[0:3= ] > + UINT8 EqPreset : 4; ///< EqPreset:[4= :7] > + UINT8 LinkAspmL1_1 : 1; ///< Enable PM L= 1 SS L1.1 > + UINT8 LinkAspmL1_2 : 1; ///< Enable PM L= 1 SS L1.2 > + UINT8 EsmControl : 1; ///< Bit to enab= le/disable ESM > + UINT8 EsmDsTxPreset : 4; ///< ESM Downstr= eam Tx Preset > + UINT8 ClkReqFilterEn : 1; ///< Controls fi= ltering of CLKREQb > signal in LC in order to avoid false L1 substate entries/exits. > +} PCIE_PORT_CONFIG; > + > +/// > +/// CXL port configuration info > +/// > +typedef struct { > + PORT_DATA PortData; ///< Port data > + UINT8 StartCoreLane; ///< Start Core = Lane > + UINT8 EndCoreLane; ///< End Core la= ne > + UINT8 NativeDevNumber : 5; ///< Native PCI = device number > of the port > + UINT8 NativeFunNumber : 3; ///< Native PCI = function > number of the port > + UINT8 CoreId : 4; ///< PCIe core I= D > + UINT8 PortId : 4; ///< Port ID on = wrapper > + PCI_ADDR Address; ///< PCI address= of the port > + UINT8 PcieBridgeId : 7; ///< IOC PCIe br= idge ID > + UINT8 UNUSED0 : 1; ///< Currently u= nassigned - for > alignment > + UINT8 LogicalBridgeId; ///< Logical Bri= dge ID > + UINT8 SlotPowerLimit; ///< Slot Power = Limit > + UINT8 MaxPayloadSize; ///< Max_Payload= _Size > + > + UINT8 CxlIndex; > + UINT8 CxlDeviceType : 2; ///< Type of CXL= device > connected > + UINT8 CxlVersion : 2; ///< Version of = CXL device > connected (1=3DCXL1.1, 2=3DCXL2.0) > + UINT8 IsCxlScanned : 1; ///< Indicates i= f the CXL device has > been scanned > + UINT8 ReportToMpioinDxe : 1; ///< Indicates i= f the CXL info > needs to be reported to MPIO in DXE > + UINT8 UNUSED1 : 2; ///< Currently u= nassigned - for > alignment > + > + UINT32 UsRcrb; ///< Upstream Po= rt RCRB address > + UINT32 DsRcrb; ///< Downstream = Port RCRB address > + UINT32 UsMemBar0; ///< Upstream po= rt MEMBAR0 > + UINT32 DsMemBar0; ///< Downstream = port MEMBAR0 > + UINT32 Mmio32Base; > + UINT32 Mmio32Size; > + UINT64 Mmio64Base; > + UINT64 Mmio64Size; > + UINT32 Mmio32Gran; > +} PCIE_CXL_CONFIG; > + > +/// > +/// Descriptor header > +/// > +typedef struct { > + UINT32 DescriptorFlags; ///< Descriptor = flags > + UINT16 Parent; ///< Offset of p= arent descriptor > + UINT16 Peer; ///< Offset of t= he peer descriptor > + UINT16 Child; ///< Offset of t= he list of child > descriptors > +} PCIE_DESCRIPTOR_HEADER; > + > +/// > +/// Engine configuration data > +/// > +typedef struct { > + PCIE_DESCRIPTOR_HEADER Header; ///< Descriptor = header > + PCIE_ENGINE EngineData; ///< Engine Data > + PCIE_ENGINE_INIT_STATUS InitStatus; ///< Initializat= ion Status > + UINT8 Scratch; ///< Scratch pad > + union { > + PCIE_PORT_CONFIG Port; ///< PCIe port c= onfiguration > data > + PCIE_CXL_CONFIG Cxl; ///< CXL Configu= ration data > + } Type; > +} PCIE_ENGINE_CONFIG; > + > +/// > +/// Wrapper configuration data > +/// > +typedef struct { > + PCIE_DESCRIPTOR_HEADER Header; ///< Descriptor = Header > + UINT8 WrapId; ///< Wrapper ID > + UINT8 CcixCoreConfig; ///< Ccix CORE C= onfiguration > + UINT8 StartPhyLane; ///< Start PHY L= ane > + UINT8 EndPhyLane; ///< End PHY Lan= e > + UINT8 StartDxioLane; ///< Start Dxio = Lane (Translated) > + UINT8 EndDxioLane; ///< End Dxio La= ne (Translated) > + struct { > + UINT8 PowerOffUnusedLanes : 1; ///< Power Off u= nused lanes > + UINT8 PowerOffUnusedPlls : 1; ///< Power Off u= nused Plls > + UINT8 ClkGating : 1; ///< TXCLK gatin= g > + UINT8 LclkGating : 1; ///< LCLK gating > + UINT8 TxclkGatingPllPowerDown : 1; ///< TXCLK clock= gating PLL > power down > + UINT8 PllOffInL1 : 1; ///< PLL off in = L1 > + UINT8 AccessEncoding : 1; ///< Reg access = encoding > + UINT8 CoreReversed : 1; ///< Indicates l= anes are reversed > in package connection > + } Features; > + UINT8 MasterPll; ///< Bitmap of m= aster PLL > + UINT32 AcsSupport : 1; ///< Acs Support > + UINT32 LtrSupport : 1; ///< LTR Support > + UINT32 AriForwarding : 1; ///< ARI Forward= ing > + UINT32 LaneMargining : 1; ///< Lane Margin= ing > + UINT32 NativePCIeEnclosureManagement : 1; ///< NPEM > + UINT32 DownstreamPortContainment : 1; ///< Downstream = port > containment > + UINT32 AdvancedErrorReporting : 1; ///< Advacned Er= ror > Reporting > + UINT32 ECRCSupport : 2; ///< ECRC Capabi= lity > + UINT32 Reserved : 23; ///< Reserved bi= ts > +} PCIE_WRAPPER_CONFIG; > + > +/// > +/// Silicon configuration data > +/// > +typedef struct { > + PCIE_DESCRIPTOR_HEADER Header; ///< Descriptor = Header > + UINT8 SocketId; ///< Socket ID > + UINT8 DieNumber; ///< Module ID > + UINT8 RBIndex; ///< Physical Ro= ot Bridge > + UINT8 InstanceId; ///< Logical Ins= tance Identifier > + PCI_ADDR Address; ///< PCI address= of GNB host bridge > + UINT16 StartLane; ///< Start Lane = of this node > + UINT16 EndLane; ///< End Lane of= this node > + UINT8 BusNumberLimit; ///< Last Bus Nu= mber assigned to > this node > + UINT8 SbPresent : 1; ///< Set to 1 if= FCH connected to > this NBIO > + UINT8 SmuPresent : 1; ///< Set to 1 if= SMU connected to > this NBIO > + UINT8 MP_Instance : 6; ///< MP Instance > + UINT8 LogicalRBIndex; ///< Logical Roo= t Bridge > + UINT8 NumEngineDesc; ///< Total numbe= r of lane > bifurcation descriptors > +} PCIE_SILICON_CONFIG; > + > +typedef PCIE_SILICON_CONFIG GNB_HANDLE; > + > +/// > +/// Complex configuration data > +/// > +typedef struct { > + PCIE_DESCRIPTOR_HEADER Header; ///< Descriptor = Header > + UINT8 NodeId; ///< Processor N= ode ID > + UINT8 Reserved; ///< For alignme= nt > +} PCIE_COMPLEX_CONFIG; > + > +/// > +/// PCIe platform configuration info > +/// > +typedef struct { > + PCIE_DESCRIPTOR_HEADER Header; ///< D= escriptor > Header > + PVOID Reserved1; ///< R= eserved > + UINT32 Reserved2; ///< R= eserved > + UINT32 PhyConfigData; ///< P= hy Configuration Data > + UINT32 Reserved3; ///< R= eserved > + UINT32 Reserved4; ///< R= eserved > + UINT32 PsppTuningParams; ///< T= uning parameters > for PSPP > + UINT32 PsppTuningParams2; ///< T= uning parameters 2 > for PSPP > + UINT8 Reserved5; ///< R= eserved > + UINT8 PsppPolicy; ///< P= SPP policy > + UINT8 Reserved6; ///< R= eserved > + UINT8 RootBridgesPerSocket; ///< N= umber of root > bridges per socket > + PCIE_COMPLEX_CONFIG ComplexList[MAX_NUMBER_OF_COMPLEXES]; > ///< Complex > +} PCIE_PLATFORM_CONFIG; > + > +/// > +/// PCIe Engine Description > +/// > +typedef struct { > + UINT32 Flags; ///< Descriptor = flags > + ///< Bit31 - l= ast descriptor on wrapper > + ///< Bit30 - D= escriptor allocated for PCIe > port > + PCIE_ENGINE EngineData; ///< Engine Data > +} PCIE_ENGINE_DESCRIPTOR; > +#pragma pack (pop) > + > +#endif // GNBDXIO_H_ > diff --git a/Platform/AMD/AgesaModulePkg/Include/GnbRegistersRS.h > b/Platform/AMD/AgesaModulePkg/Include/GnbRegistersRS.h > new file mode 100644 > index 0000000000..90f52cca7b > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/GnbRegistersRS.h > @@ -0,0 +1,18 @@ > +/** @file > + > + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef _GNBREGISTERSRS_H_ > +#define _GNBREGISTERSRS_H_ > + > +#include "GnbRegistersRS/IOHC.h" > + > +#ifndef NBIO_SPACE > +#define NBIO_SPACE(HANDLE, ADDRESS) (ADDRESS + (HANDLE->RBIndex > << 20)) > +#endif > + > +#endif /*_GNBREGISTERSRS_H_*/ > diff --git a/Platform/AMD/AgesaModulePkg/Include/GnbRegistersRS/IOHC.h > b/Platform/AMD/AgesaModulePkg/Include/GnbRegistersRS/IOHC.h > new file mode 100644 > index 0000000000..b1a95237de > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/GnbRegistersRS/IOHC.h > @@ -0,0 +1,22 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef _IOHC_H_ > +#define _IOHC_H_ > + > +// Bitfield Description : DBG MMIO enable. > +#define DBG_BASE_ADDR_LO_DBG_MMIO_EN_OFFSET 0 > + > +// Bitfield Description : Locks the DBG MMIO address range and enable un= til > the next warm reset. > +#define DBG_BASE_ADDR_LO_DBG_MMIO_LOCK_OFFSET 1 > + > +#define SMN_IOHUB0NBIO0_IOAPIC_BASE_ADDR_LO_ADDRESS > 0x13b102f0UL > +#define IOAPIC_BASE_ADDR_LO_IOAPIC_BASE_ADDR_LO_MASK 0xffffff00 > +#define SMN_IOHUB1NBIO0_IOAPIC_BASE_ADDR_LO_ADDRESS > 0x13c102f0UL > + > +#endif /* _IOHC_H_ */ > diff --git a/Platform/AMD/AgesaModulePkg/Include/Guid/GnbPcieInfoHob.h > b/Platform/AMD/AgesaModulePkg/Include/Guid/GnbPcieInfoHob.h > new file mode 100644 > index 0000000000..f5cc5e2228 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/Guid/GnbPcieInfoHob.h > @@ -0,0 +1,31 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef GNB_PCIE_HOB_INFO_H_ > +#define GNB_PCIE_HOB_INFO_H_ > + > +#define _GNB_PCIE_HOB_INFO_GUID \ > +{ \ > + 0x3eb1d90, 0xce14, 0x40d8, 0xa6, 0xba, 0x10, 0x3a, 0x8d, 0x7b, 0xd3, > 0x2d \ > +} > +extern EFI_GUID gGnbPcieHobInfoGuid; > + > +#pragma pack (push, 1) > +#define MAX_NUMBER_OF_CORES_PER_COMPLEX 3 > +#define MAX_NUMBER_OF_PORTS_PER_COMPLEX 22 > + > +/// PCIe information HOB data > +typedef struct _GNB_PCIE_INFORMATION_DATA_HOB { > + EFI_HOB_GUID_TYPE EfiHobGuidType; ///< GUID Hob type > structure > + PCIE_PLATFORM_CONFIG PciePlatformConfigHob; ///< Platform Conf= ig > Structure > + UINT32 ComplexConfigs; ///< Allocation fo= r Max Complex > Structure suported > +} GNB_PCIE_INFORMATION_DATA_HOB; > + > +#pragma pack (pop) > + > +#endif /* GNB_PCIE_HOB_INFO_H_ */ > diff --git a/Platform/AMD/AgesaModulePkg/Include/Library/AmdBaseLib.h > b/Platform/AMD/AgesaModulePkg/Include/Library/AmdBaseLib.h > new file mode 100644 > index 0000000000..dc773737b9 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/Library/AmdBaseLib.h > @@ -0,0 +1,16 @@ > +/** @file > + Contains interface to the AMD AGESA library. > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef AMD_BASE_LIB_H_ > +#define AMD_BASE_LIB_H_ > + > +#include "Uefi.h" > +#include "AMD.h" > + > +#endif // AMD_BASE_LIB_H_ > diff --git > a/Platform/AMD/AgesaModulePkg/Include/Library/AmdPspMboxLibV2.h > b/Platform/AMD/AgesaModulePkg/Include/Library/AmdPspMboxLibV2.h > new file mode 100644 > index 0000000000..9d9892aa30 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/Library/AmdPspMboxLibV2.h > @@ -0,0 +1,43 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > +/* $NoKeywords:$ */ > + > +/** > + * @file > + * > + * PSP Mailbox related functions Prototype definition > + * > + * > + * @xrefitem bom "File Content Label" "Release Content" > + * @e project: AGESA > + * @e sub-project: PSP > + * @e \$Revision: 312133 $ @e \$Date: 2015-02-03 02:47:45 +0800 (Tue, > 03 Feb 2015) $ > + */ > + > +#ifndef _PSP_MBOX_H_ > +#define _PSP_MBOX_H_ > + > +/** > + * @brief Bios send these commands to PSP to grant dTPM status and event > log > + * > + * @param[out] DesiredConfig dTPM configuration requested > + * @param[out] ConfigStatus 0 - success. non-zero failure. > + * @param[in,out] LogDataSize Size of LogData buffer > + * @param[out] LogData Point to allocated event log buf= fer > + * > + * @retval EFI_STATUS 0: Success, NonZero Error > + */ > +EFI_STATUS > +PspMboxGetDTPMData ( > + OUT UINT32 *DesiredConfig, > + OUT UINT32 *ConfigStatus, > + IN OUT UINT32 *LogDataSize, > + OUT VOID *LogData > + ); > + > +#endif //_PSP_MBOX_H_ > diff --git > a/Platform/AMD/AgesaModulePkg/Include/Library/BaseFabricTopologyLib.h > b/Platform/AMD/AgesaModulePkg/Include/Library/BaseFabricTopologyLib.h > new file mode 100644 > index 0000000000..51935f413a > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Include/Library/BaseFabricTopologyLib.h > @@ -0,0 +1,22 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef BASE_FABRIC_TOPOLOGY_LIB_H_ > +#define BASE_FABRIC_TOPOLOGY_LIB_H_ > + > +UINTN > +FabricTopologyGetNumberOfProcessorsPresent ( > + VOID > + ); > + > +UINTN > +FabricTopologyGetNumberOfRootBridgesOnSocket ( > + IN UINTN Socket > + ); > + > +#endif // BASE_FABRIC_TOPOLOGY_LIB_H_ > diff --git a/Platform/AMD/AgesaModulePkg/Include/Library/FchBaseLib.h > b/Platform/AMD/AgesaModulePkg/Include/Library/FchBaseLib.h > new file mode 100644 > index 0000000000..cae3aff9b3 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/Library/FchBaseLib.h > @@ -0,0 +1,16 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef _FCH_BASE_LIB_H_ > +#define _FCH_BASE_LIB_H_ > + > +#include > +#include > +#include > + > +#endif > diff --git a/Platform/AMD/AgesaModulePkg/Include/Library/FchEspiCmdLib.h > b/Platform/AMD/AgesaModulePkg/Include/Library/FchEspiCmdLib.h > new file mode 100644 > index 0000000000..345e39adce > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/Library/FchEspiCmdLib.h > @@ -0,0 +1,413 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef _FCH_ESPI_CMD_LIB_H_ > +#define _FCH_ESPI_CMD_LIB_H_ > + > +#include > + > +#define MAX_ESPI_RETRY 100000ul > +// > +// Cycle Type > +// > +#define CYCLE_TYPE_FLASH_READ 0 > +#define CYCLE_TYPE_FLASH_WRITE 1 > +#define CYCLE_TYPE_FLASH_ERASE 2 > +#define CYCLE_TYPE_RPMC_OP1 3 > +#define CYCLE_TYPE_RPMC_OP2 4 > + > +// RPMC OP1/OP2 Command Payload Max Length (512 Bits) > +#define RPMC_CMD_PAYLOAD_MAX_LEN 0x40 > + > +// > +// Master Registers > +// > +#define SET_CONFIGURATION 0 > +#define GET_CONFIGURATION 1 > +#define IN_BAND_RESET 2 > +#define PC_MSG_DOWN_STREAM 4 > +#define VM_DOWN_STREAM 5 > +#define OOB_DOWN_STREAM 6 > +#define FA_DOWN_STREAM 7 > + > +// ESPIx00 > +#define DNCMD_STATUS BIT3 > + > +// ESPIx2C Master Capability > +#define MASTER_FA_SUPPORT BIT0 > +#define MASTER_OOB_SUPPORT BIT1 > +#define MASTER_VW_SUPPORT BIT2 > +#define MASTER_PERIPHERAL_SUPPORT BIT3 > + > +// ESPIx68 Slave0 Configuration > +#define SLAVE_FA_ENABLE BIT0 > +#define SLAVE_OOB_ENABLE BIT1 > +#define SLAVE_VW_ENABLE BIT2 > +#define SLAVE_PC_ENABLE BIT3 > + > +/// eSPIx00 eSPI Software Specific Register 0 > +#define ESPI_DN_TXHDR_0 0x00 > +typedef union { > + struct { > + UINT32 SWCommandType : 3; > + UINT32 CommandStatus : 1; > + UINT32 PutFlashNpTranActive : 1; > + UINT32 Reserved : 3; > + UINT32 DnCmdHdata0 : 8; > + UINT32 DnCmdHdata1 : 8; > + UINT32 DnCmdHdata2 : 8; > + } Field; > + UINT32 Value; > +} ESPIx00_DN_TXHDR0; > + > +/// eSPIx04 eSPI Software Specific Register 1 > +#define ESPI_DN_TXHDR_1 0x04 > +typedef union { > + struct { > + UINT32 DnCmdHdata3 : 8; > + UINT32 DnCmdHdata4 : 8; > + UINT32 DnCmdHdata5 : 8; > + UINT32 DnCmdHdata6 : 8; > + } Field; > + UINT32 Value; > +} ESPIx04_DN_TXHDR1; > + > +#define ESPI_DN_TXHDR_2 0x08 > +typedef union { > + struct { > + UINT32 DnCmdHdata7 : 8; > + UINT32 Reserved : 24; > + } Field; > + UINT32 Value; > +} ESPIx08_DN_TXHDR2; > + > +#define ESPI_DN_TXDATA_PORT 0x0C > +typedef union { > + struct { > + UINT32 DnTxData0 : 8; > + UINT32 DnTxData1 : 8; > + UINT32 DnTxData2 : 8; > + UINT32 DnTxData3 : 8; > + } Field; > + UINT32 Value; > +} ESPIx0C_DN_TXDATA_PORT; > + > +#define ESPI_UP_RXHDR_0 0x10 > +typedef union { > + struct { > + UINT32 UpCommandType : 3; > + UINT32 UpCommandStatus : 1; > + UINT32 SlaveSel : 2; > + UINT32 Reserved : 2; > + UINT32 UpCmdHdata0 : 8; > + UINT32 UpCmdHdata1 : 8; > + UINT32 UpCmdHdata2 : 8; > + } Field; > + UINT32 Value; > +} ESPIx10_UP_RXHDR0; > + > +#define ESPI_UP_RXHDR_1 0x14 > +typedef union { > + struct { > + UINT32 UpCmdHdata3 : 8; > + UINT32 UpCmdHdata4 : 8; > + UINT32 UpCmdHdata5 : 8; > + UINT32 UpCmdHdata6 : 8; > + } Field; > + UINT32 Value; > +} ESPIx14_UP_RXHDR1; > + > +#define ESPI_UP_RXDATA_PORT 0x18 > + > +/// eSPIx2C eSPI Master Capability > +#define ESPI_MASTER_CAP 0x2C > +typedef union { > + struct { > + UINT32 FlashAccessChannelSupport : 1; > + UINT32 OOBMessageChannelSupport : 1; > + UINT32 VWChannelSupport : 1; > + UINT32 PChannelSupport : 1; > + UINT32 MasterVersion : 3; > + UINT32 FlashAccessChannelMaxPayload : 3; > + UINT32 OOBMessageChannelMaxPayload : 3; > + UINT32 OperatingMaxVWCount : 6; > + UINT32 PChannelMaxPayloadSize : 3; > + UINT32 NumberOfSlave : 3; > + UINT32 OperatingSupportFreq : 3; > + UINT32 IOMode : 2; > + UINT32 AlertMode : 1; > + UINT32 CRCCheck : 1; > + } Field; > + UINT32 Value; > +} ESPIx2C_MASTER_CAP; > + > +/// eSPIx30 eSPI Global Control 0 > +#define ESPI_GLOBAL_CTRL0 0x30 > +typedef union { > + struct { > + UINT32 WdgEn : 1; > + UINT32 WaitChkEn : 1; > + UINT32 PrClkgatEn : 1; > + UINT32 AlStopEn : 1; > + UINT32 AlIdleTimer : 3; > + UINT32 RgDbgclkGatingEn : 1; > + UINT32 WdgCnt : 16; > + UINT32 WaitCnt : 6; > + UINT32 PrRstEnPltrst : 1; > + UINT32 SafsClkGateEn : 1; > + } Field; > + UINT32 Value; > +} ESPIx30_GLOBAL_CTRL0; > + > +/// eSPIx68 eSPI Slave0 Configuration > +#define ESPI_SLAVE0_CONFIG 0x68 > +typedef union { > + struct { > + UINT32 FlashAccessChannelEnable : 1; > + UINT32 OOBMessageChannelEnable : 1; > + UINT32 VWChannelEnable : 1; > + UINT32 PChannelEnable : 1; > + UINT32 FlashSharingMode : 1; > + UINT32 FlashMaxPayloadSize : 3; > + UINT32 PutFlashNpHeaderDataEn : 1; > + UINT32 PutFlashNpHeaderEn : 1; > + UINT32 SafsDeferValidEn : 1; > + UINT32 FlashModifierEn : 1; > + UINT32 Reserved_24_12 : 13; > + UINT32 OperatingFreq : 3; > + UINT32 IOModeSelect : 2; > + UINT32 AlertMode : 1; > + UINT32 CRCCheckingEnable : 1; > + } Field; > + UINT32 Value; > +} ESPIx68_SLAVE0_CONFIG; > + > +/// eSPIx70 eSPI Slave0 Interrupt Status > +#define ESPI_SLAVE0_INT_STS 0x70 > +typedef union { > + struct { > + UINT32 BusErrInt : 1; > + UINT32 WaitTimeoutInt : 1; > + UINT32 CrcErrInt : 1; > + UINT32 Reserved_3 : 1; > + UINT32 NoRspInt : 1; > + UINT32 FatalErrInt : 1; > + UINT32 NonFatalErrInt : 1; > + UINT32 UnknownRspInt : 1; > + UINT32 UnknownCtInt : 1; > + UINT32 UnsucssCplInt : 1; > + UINT32 IllegalTagInt : 1; > + UINT32 IllegalLenInt : 1; > + UINT32 RxOobOverflowInt : 1; > + UINT32 RxMsgOverflowInt : 1; > + UINT32 RxFlashOverflowInt : 1; > + UINT32 ProtocolErrInt : 1; > + UINT32 Reserved_16 : 1; > + UINT32 UpFifoWdgTo : 1; > + UINT32 MstAbortInt : 1; > + UINT32 WdgTimeoutInt : 1; > + UINT32 Reserved_23_20 : 4; > + UINT32 RxVwGrp0Int : 1; > + UINT32 RxVwGrp1Int : 1; > + UINT32 RxVwGrp2Int : 1; > + UINT32 RxVwGrp3Int : 1; > + UINT32 DnCmdInt : 1; > + UINT32 RxMsgInt : 1; > + UINT32 RxOobInt : 1; > + UINT32 FlashReqInt : 1; > + } Field; > + UINT32 Value; > +} ESPIx70_SLAVE0_INT_STS; > + > +/// > +/// Slave Registers > +/// > +#define SLAVE_REG_ID 0x04 > +#define SLAVE_GENERAL_CAPCFG 0x08 > +#define SLAVE_PC_CAPCFG 0x10 > +#define SLAVE_VW_CAPCFG 0x20 > +#define SLAVE_OOB_CAPCFG 0x30 > +#define SLAVE_FA_CAPCFG 0x40 > +#define SLAVE_FA_CAPCFG2 0x44 > + > +/// Offset 04h: Device Identification > +typedef union { > + struct { > + UINT32 RO_VersionID : 8; > + UINT32 Reserved_31_8 : 24; > + } Field; > + UINT32 Value; > +} ESPI_SL04_DEVICE_ID; > + > +// SLAVE offset 0x08 SLAVE_GENERAL_CAPCFG > +#define SLAVE_FA_SUPPORT BIT3 > +#define SLAVE_OOB_SUPPORT BIT2 > +#define SLAVE_VW_SUPPORT BIT1 > +#define SLAVE_PERIPHERAL_SUPPORT BIT0 > +/// Offset 08h: General Capabilities and Configurations > +typedef union { > + struct { > + UINT32 RO_PCSupported : 1; > + UINT32 RO_VWSupported : 1; > + UINT32 RO_OOBMsgSupported : 1; > + UINT32 RO_FASupported : 1; > + UINT32 Reserved_7_3 : 4; > + UINT32 Reserved_11_8 : 4; > + UINT32 RO_MaxWaitStateAllowed : 4; > + UINT32 RO_MaxFreqSupported : 3; > + UINT32 RO_OpenDrainAlertSupported : 1; > + UINT32 OperatingFreq : 3; > + UINT32 OpenDrainAlertSelect : 1; > + UINT32 RO_IOModeSupported : 2; > + UINT32 IOModeSelect : 2; > + UINT32 AlertMode : 1; > + UINT32 Reserved_29 : 1; > + UINT32 ResponseModifierEn : 1; > + UINT32 CRCCheckingEn : 1; > + } Field; > + UINT32 Value; > +} ESPI_SL08_SLAVE_GENERAL_CAPCFG; > + > +/// Offset 10h: Channel 0 Capabilities and Configurations > +typedef union { > + struct { > + UINT32 PCEn : 1; > + UINT32 RO_PCReady : 1; > + UINT32 BusMasterEn : 1; > + UINT32 Reserved_3 : 1; > + UINT32 RO_PCMaxPayloadSizeSupported : 3; > + UINT32 Reserved_7 : 1; > + UINT32 PCMaxPayloadSizeSelected : 3; > + UINT32 Reserved_11 : 1; > + UINT32 PCMaxReadRequestSize : 3; > + UINT32 Reserved_31_15 : 17; > + } Field; > + UINT32 Value; > +} ESPI_SL10_SLAVE_PC_CAPCFG; > + > +/// Offset 20h: Channel 1 Capabilities and Configurations > +typedef union { > + struct { > + UINT32 VWEn : 1; > + UINT32 RO_VWReady : 1; > + UINT32 Reserved_7_2 : 6; > + UINT32 RO_MaxVWCntSupported : 6; > + UINT32 Reserved_15_14 : 2; > + UINT32 OpMaxVWCnt : 6; > + UINT32 Reserved_31_22 : 10; > + } Field; > + UINT32 Value; > +} ESPI_SL20_SLAVE_VW_CAPCFG; > + > +/// Offset 30h: Channel 2 Capabilities and Configurations > +typedef union { > + struct { > + UINT32 OOBEn : 1; > + UINT32 RO_OOBReady : 1; > + UINT32 Reserved_3_2 : 2; > + UINT32 RO_MsgChMaxPayloadSizeSupported : 3; > + UINT32 Reserved_7 : 1; > + UINT32 MsgChMaxPayloadSizeSelected : 3; > + UINT32 Reserved_31_11 : 21; > + } Field; > + UINT32 Value; > +} ESPI_SL30_SLAVE_OOB_CAPCFG; > + > +/// Offset 40h: Channel 3 Capabilities and Configurations > +typedef union { > + struct { > + UINT32 FAEn : 1; > + UINT32 RO_FAReady : 1; > + UINT32 FlashBlockEraseSize : 3; > + UINT32 RO_ChMaxPayloadSizeSupported : 3; > + UINT32 ChMaxPayloadSizeSelected : 3; > + UINT32 RO_FlashSharingMode : 1; > + UINT32 ChMaxReadReqSize : 3; > + UINT32 Reserved_15 : 1; > + UINT32 RO_FlashSharingCapabilitySupported : 2; > + UINT32 Reserved_19_18 : 2; > + UINT32 RO_RPMCCounterOn1stDevice : 4; > + UINT32 RO_RPMCOp1On1stDevice : 8; > + } Field; > + UINT32 Value; > +} ESPI_SL40_SLAVE_FA_CAPCFG; > + > +/// Offset 44h: Channel 3 Capabilities and Configurations2 > +typedef union { > + struct { > + UINT32 RO_TargetMaxReadReqSizeSupported : 3; > + UINT32 Reserved_7_3 : 5; > + UINT32 RO_TargetFlashEraseBlockSize : 8; > + UINT32 RO_TargetRPMCSupported : 6; > + UINT32 RO_NumOfRPMCdevices : 2; > + UINT32 Reserved_31_24 : 8; > + } Field; > + UINT32 Value; > +} ESPI_SL44_SLAVE_FA_CAPCFG2; > + > +// > +// eSPI Command functions > +// > +VOID > +FchEspiCmd_InBandRst ( > + IN UINT32 EspiBase > + ); > + > +UINT32 > +FchEspiCmd_GetConfiguration ( > + IN UINT32 EspiBase, > + IN UINT32 RegAddr > + ); > + > +VOID > +FchEspiCmd_SetConfiguration ( > + IN UINT32 EspiBase, > + IN UINT32 RegAddr, > + IN UINT32 Value > + ); > + > +EFI_STATUS > +FchEspiCmd_SafsFlashRead ( > + IN UINT32 EspiBase, > + IN UINT32 Address, > + IN UINT32 Length, > + OUT UINT8 *Buffer > + ); > + > +EFI_STATUS > +FchEspiCmd_SafsFlashWrite ( > + IN UINT32 EspiBase, > + IN UINT32 Address, > + IN UINT32 Length, > + IN UINT8 *Value > + ); > + > +EFI_STATUS > +FchEspiCmd_SafsFlashErase ( > + IN UINT32 EspiBase, > + IN UINT32 Address, > + IN UINT32 Length > + ); > + > +EFI_STATUS > +FchEspiCmd_SafsRpmcOp1 ( > + IN UINT32 EspiBase, > + IN UINT8 RpmcFlashDev, > + IN UINT32 Length, > + IN UINT8 *Data > + ); > + > +EFI_STATUS > +FchEspiCmd_SafsRpmcOp2 ( > + IN UINT32 EspiBase, > + IN UINT8 RpmcFlashDev, > + IN UINT32 Length, > + OUT UINT8 *Buffer > + ); > + > +#endif > diff --git > a/Platform/AMD/AgesaModulePkg/Include/Library/GnbPcieConfigLib.h > b/Platform/AMD/AgesaModulePkg/Include/Library/GnbPcieConfigLib.h > new file mode 100755 > index 0000000000..19688e2548 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/Library/GnbPcieConfigLib.h > @@ -0,0 +1,16 @@ > +/** @file > + GNB PCIe Library definition. > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef GNBPCIECONFIG_LIB_H_ > +#define GNBPCIECONFIG_LIB_H_ > + > +#include > +#include > + > +#endif // GNBPCIECONFIG_LIB_H_ > diff --git > a/Platform/AMD/AgesaModulePkg/Include/Library/NbioCommonLibDxe.h > b/Platform/AMD/AgesaModulePkg/Include/Library/NbioCommonLibDxe.h > new file mode 100644 > index 0000000000..df88274530 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Include/Library/NbioCommonLibDxe.h > @@ -0,0 +1,37 @@ > +/** @file > + Header file of AMD NBIO Common DXE library. > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef NBIOCOMMONLIBDXE_H_ > +#define NBIOCOMMONLIBDXE_H_ > + > +/** > + Function to retrieve SOC_LOGICAL_ID > + > + @param[out] LogicalId Pointer to SOC_LOGICAL_ID > + @retval EFI_UNSUPPORTED > + > +**/ > +EFI_STATUS > +PcieGetLogicalId ( > + OUT SOC_LOGICAL_ID *LogicalId > + ); > + > +/** > + Function to retrieve PCIE_PLATFORM_CONFIG > + > + @param[out] Pcie Pointer to PCIE_PLATFORM_CONFIG Pointer > + @retval EFI_UNSUPPORTED > + > +**/ > +EFI_STATUS > +PcieGetPcieDxe ( > + OUT PCIE_PLATFORM_CONFIG **Pcie > + ); > + > +#endif // NBIOCOMMONLIBDXE_H_ > diff --git a/Platform/AMD/AgesaModulePkg/Include/Library/NbioHandleLib.h > b/Platform/AMD/AgesaModulePkg/Include/Library/NbioHandleLib.h > new file mode 100755 > index 0000000000..4fec578a9f > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/Library/NbioHandleLib.h > @@ -0,0 +1,62 @@ > +/** @file > + GNB function to GetHostPciAddress and GetHandle. > + Contain code that create/locate and rebase configuration data area. > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef NBIOHANDLELIB_LIB_H_ > +#define NBIOHANDLELIB_LIB_H_ > + > +#include > + > +/** > + Get GNB handle > + > + @param[in] Pcie Pointer to global PCIe configuration > + > +**/ > +GNB_HANDLE * > +NbioGetHandle ( > + IN PCIE_PLATFORM_CONFIG *Pcie > + ); > + > +/** > + Get GNB handle of alternate host bridge (e.g. MI200) > + > + @param[in] Pcie Pointer to global PCIe configuration > +**/ > +GNB_HANDLE * > +NbioGetAltHandle ( > + IN PCIE_PLATFORM_CONFIG *Pcie > + ); > + > +/** > + Get GNB handle of next socket > + > + @param[in] NbioHandle Pointer to current GnbHandle > +**/ > +GNB_HANDLE * > +NbioGetNextSocket ( > + IN GNB_HANDLE *NbioHandle > + ); > + > +/** > + Get PCI_ADDR of GNB > + > + @param[in] Handle Pointer to GNB_HANDLE > +**/ > +PCI_ADDR > +NbioGetHostPciAddress ( > + IN GNB_HANDLE *Handle > + ); > + > +#define GnbGetNextHandle(Descriptor) (GNB_HANDLE *) > PcieConfigGetNextTopologyDescriptor (Descriptor, > DESCRIPTOR_TERMINATE_TOPOLOGY) > +#define GnbGetSocketId(Handle) (Handle !=3D NULL ? (Handle)->Sock= etId : > 0) > +#define GnbGetDieNumber(Handle) (Handle !=3D NULL ? (Handle)- > >DieNumber : 0) > +#define GnbGetRBIndex(Handle) (Handle !=3D NULL ? (Handle)->RBIn= dex : > 0) > + > +#endif // NBIOHANDLELIB_LIB_H_ > diff --git a/Platform/AMD/AgesaModulePkg/Include/Library/PcieConfigLib.h > b/Platform/AMD/AgesaModulePkg/Include/Library/PcieConfigLib.h > new file mode 100644 > index 0000000000..9f53746814 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/Library/PcieConfigLib.h > @@ -0,0 +1,283 @@ > +/** @file > + Helper functions to access PCIe configuration data area. > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef PCIECONFIGLIB_LIB_H_ > +#define PCIECONFIGLIB_LIB_H_ > + > +typedef VOID (*PCIE_RUN_ON_ENGINE_CALLBACK) ( > + IN PCIE_ENGINE_CONFIG *Engine, > + IN OUT VOID *Buffer, > + IN PCIE_PLATFORM_CONFIG *Pcie > + ); > + > +typedef AGESA_STATUS (*PCIE_RUN_ON_WRAPPER_CALLBACK) ( > + IN PCIE_WRAPPER_CONFIG *Wrapper, > + IN OUT VOID *Buffer, > + IN PCIE_PLATFORM_CONFIG *Pcie > + ); > + > +typedef VOID (*PCIE_RUN_ON_ENGINE_CALLBACK2) ( > + IN PCIE_ENGINE_CONFIG *Engine, > + IN OUT VOID *Buffer, > + IN PCIE_WRAPPER_CONFIG *Wrapper > + ); > + > +typedef VOID (*PCIE_RUN_ON_WRAPPER_CALLBACK2) ( > + IN PCIE_WRAPPER_CONFIG *Wrapper, > + IN OUT VOID *Buffer, > + IN GNB_HANDLE *GnbHandle > + ); > + > +typedef AGESA_STATUS (*PCIE_RUN_ON_DESCRIPTOR_CALLBACK) ( > + IN PCIE_DESCRIPTOR_HEADER *Descriptor, > + IN OUT VOID *Buffer, > + IN PCIE_PLATFORM_CONFIG *Pcie > + ); > + > +/** > + Check Port Status > + > + @param[in] Engine Pointer to engine config descriptor > + @param[in] PortStatus Check if status asserted for port > + @retval TRUE if status asserted > +**/ > +BOOLEAN > +PcieConfigCheckPortStatus ( > + IN PCIE_ENGINE_CONFIG *Engine, > + IN UINT32 PortStatus > + ); > + > +/** > + Set/Reset port status > + > + @param[in] Engine Pointer to engine config descriptor > + @param[in] SetStatus SetStatus > + @param[in] ResetStatus ResetStatus > + > +**/ > +UINT16 > +PcieConfigUpdatePortStatus ( > + IN PCIE_ENGINE_CONFIG *Engine, > + IN PCIE_ENGINE_INIT_STATUS SetStatus, > + IN PCIE_ENGINE_INIT_STATUS ResetStatus > + ); > + > +/** > + Execute callback on all engine in topology > + > + @param[in] DescriptorFlags Engine flags. > + @param[in] Callback Pointer to callback function > + @param[in, out] Buffer Pointer to buffer to pass information= to > callback > + @param[in] Pcie Pointer to global PCIe configuration > +**/ > +VOID > +PcieConfigRunProcForAllEngines ( > + IN UINT32 DescriptorFlags, > + IN PCIE_RUN_ON_ENGINE_CALLBACK Callback, > + IN OUT VOID *Buffer, > + IN PCIE_PLATFORM_CONFIG *Pcie > + ); > + > +/** > + Execute callback on all engine in wrapper > + > + @param[in] DescriptorFlags Engine flags. > + @param[in] Callback Pointer to callback function > + @param[in, out] Buffer Pointer to buffer to pass information= to > callback > + @param[in] Pcie Pointer to global PCIe configuration > +**/ > +VOID > +PcieConfigRunProcForAllEnginesInWrapper ( > + IN UINT32 DescriptorFlags, > + IN PCIE_RUN_ON_ENGINE_CALLBACK2 Callback, > + IN OUT VOID *Buffer, > + IN PCIE_WRAPPER_CONFIG *Wrapper > + ); > + > +/** > + Execute callback on all wrappers in topology > + > + @param[in] DescriptorFlags Wrapper Flags > + @param[in] Callback Pointer to callback function > + @param[in, out] Buffer Pointer to buffer to pass informati= on to > callback > + @param[in] Pcie Pointer to global PCIe configuratio= n > +**/ > +AGESA_STATUS > +PcieConfigRunProcForAllWrappers ( > + IN UINT32 DescriptorFlags, > + IN PCIE_RUN_ON_WRAPPER_CALLBACK Callback, > + IN OUT VOID *Buffer, > + IN PCIE_PLATFORM_CONFIG *Pcie > + ); > + > +/** > + Execute callback on all wrappers in NBIO > + > + > + @param[in] DescriptorFlags Wrapper Flags > + @param[in] Callback Pointer to callback function > + @param[in, out] Buffer Pointer to buffer to pass informati= on to > callback > + @param[in] Pcie Pointer to global PCIe configuratio= n > +**/ > +VOID > +PcieConfigRunProcForAllWrappersInNbio ( > + IN UINT32 DescriptorFlags, > + IN PCIE_RUN_ON_WRAPPER_CALLBACK2 Callback, > + IN OUT VOID *Buffer, > + IN GNB_HANDLE *GnbHandle > + ); > + > +/** > + Execute callback on all descriptor of specific type > + > + @param[in] InDescriptorFlags Include descriptor flags > + @param[in] OutDescriptorFlags Exclude descriptor flags > + @param[in] TerminationFlags Termination flags > + @param[in] Callback Pointer to callback function > + @param[in, out] Buffer Pointer to buffer to pass inform= ation to > callback > + @param[in] Pcie Pointer to global PCIe configura= tion > +**/ > +AGESA_STATUS > +PcieConfigRunProcForAllDescriptors ( > + IN UINT32 InDescriptorFlags, > + IN UINT32 OutDescriptorFlags, > + IN UINT32 TerminationFlags, > + IN PCIE_RUN_ON_DESCRIPTOR_CALLBACK Callback, > + IN OUT VOID *Buffer, > + IN PCIE_PLATFORM_CONFIG *Pcie > + ); > + > +/** > + Get parent descriptor of specific type > + > + @param[in] Type Descriptor type > + @param[in] Descriptor Pointer to buffer to pass information= to > callback > +**/ > +PCIE_DESCRIPTOR_HEADER * > +PcieConfigGetParent ( > + IN UINT32 Type, > + IN PCIE_DESCRIPTOR_HEADER *Descriptor > + ); > + > +/** > + Get child descriptor of specific type > + > + @param[in] Type Descriptor type > + @param[in] Descriptor Pointer to buffer to pass information= to > callback > +**/ > +PCIE_DESCRIPTOR_HEADER * > +PcieConfigGetChild ( > + IN UINT32 Type, > + IN PCIE_DESCRIPTOR_HEADER *Descriptor > + ); > + > +/** > + Get peer descriptor of specific type > + > + @param[in] Type Descriptor type > + @param[in] Descriptor Pointer to buffer to pass information= to > callback > +**/ > +PCIE_DESCRIPTOR_HEADER * > +PcieConfigGetPeer ( > + IN UINT32 Type, > + IN PCIE_DESCRIPTOR_HEADER *Descriptor > + ); > + > +/** > + Check is engine is active or potentially active > + > + @param[in] Engine Pointer to engine descriptor > + @retval TRUE - engine active > + @retval FALSE - engine not active > +**/ > +BOOLEAN > +PcieConfigIsActivePcieEngine ( > + IN PCIE_ENGINE_CONFIG *Engine > + ); > + > +/** > + Locate SB engine on wrapper > + > + @param[in] Wrapper Pointer to wrapper config descriptor > + @retval SB engine pointer or NULL > +**/ > +PCIE_ENGINE_CONFIG * > +PcieConfigLocateSbEngine ( > + IN PCIE_WRAPPER_CONFIG *Wrapper > + ); > + > +/** > + Helper function to dump configuration to debug out > + > + @param[in] Pcie Pointer to global PCIe configuration > +**/ > +VOID > +PcieConfigDebugDump ( > + IN PCIE_PLATFORM_CONFIG *Pcie > + ); > + > +/** > + Helper function to dump wrapper configuration > + > + @param[in] WrapperList Wrapper Configuration > +**/ > +VOID > +PcieConfigWrapperDebugDump ( > + IN PCIE_WRAPPER_CONFIG *WrapperList > + ); > + > +/** > + Helper function to dump engine configuration > + > + @param[in] EngineList Engine Configuration > +**/ > +VOID > +PcieConfigEngineDebugDump ( > + IN PCIE_ENGINE_CONFIG *EngineList > + ); > + > +/** > + Helper function to dump input configuration to debug out > + > + @param[in] ComplexDescriptor Pointer to user defined complex > descriptor > +**/ > +VOID > +PcieUserConfigConfigDump ( > + IN PCIE_COMPLEX_DESCRIPTOR *ComplexDescriptor > + ); > + > +/** > + Helper function to dump input configuration to user engine descriptor > + > + @param[in] EngineDescriptor Pointer to engine descriptor > +**/ > +VOID > +PcieUserDescriptorConfigDump ( > + IN PCIE_ENGINE_DESCRIPTOR *EngineDescriptor > + ); > + > +#define PcieConfigGetParentWrapper(Descriptor) > ((PCIE_WRAPPER_CONFIG *) PcieConfigGetParent > (DESCRIPTOR_ALL_WRAPPERS, &((Descriptor)->Header))) > +#define PcieConfigGetParentSilicon(Descriptor) > ((PCIE_SILICON_CONFIG *) PcieConfigGetParent (DESCRIPTOR_SILICON, > &((Descriptor)->Header))) > +#define PcieConfigGetParentComplex(Descriptor) > ((PCIE_COMPLEX_CONFIG *) PcieConfigGetParent (DESCRIPTOR_COMPLEX, > &((Descriptor)->Header))) > +#define PcieConfigGetPlatform(Descriptor) > ((PCIE_PLATFORM_CONFIG *) PcieConfigGetParent (DESCRIPTOR_PLATFORM, > &((Descriptor)->Header))) > +#define PcieConfigGetChildWrapper(Descriptor) > ((PCIE_WRAPPER_CONFIG *) PcieConfigGetChild > (DESCRIPTOR_ALL_WRAPPERS, &((Descriptor)->Header))) > +#define PcieConfigGetChildEngine(Descriptor) > ((PCIE_ENGINE_CONFIG *) PcieConfigGetChild (DESCRIPTOR_ALL_ENGINES, > &((Descriptor)->Header))) > +#define PcieConfigGetChildSilicon(Descriptor) > ((PCIE_SILICON_CONFIG *) PcieConfigGetChild (DESCRIPTOR_SILICON, > &((Descriptor)->Header))) > +#define PcieConfigGetNextDescriptor(Descriptor) > ((((Descriptor->Header.DescriptorFlags & DESCRIPTOR_TERMINATE_LIST) !=3D > 0) ? NULL : ((Descriptor + 1)))) > +#define PcieConfigIsPcieEngine(Descriptor) = ((Descriptor !=3D > NULL) ? ((Descriptor->Header.DescriptorFlags & DESCRIPTOR_PCIE_ENGINE) != =3D > 0) : FALSE) > +#define PcieConfigIsSbPcieEngine(Engine) = ((Engine !=3D > NULL) ? ((BOOLEAN) (Engine->Type.Port.PortData.MiscControls.SbLink)) : > FALSE) > +#define PcieConfigIsEngineAllocated(Descriptor) > ((Descriptor !=3D NULL) ? ((Descriptor->Header.DescriptorFlags & > DESCRIPTOR_ALLOCATED) !=3D 0) : FALSE) > +#define PcieConfigSetDescriptorFlags(Descriptor, SetDescriptorFlags) = if > (Descriptor !=3D NULL) (Descriptor)->Header.DescriptorFlags |=3D > SetDescriptorFlags > +#define PcieConfigResetDescriptorFlags(Descriptor, ResetDescriptorFlags)= if > (Descriptor !=3D NULL) ((PCIE_DESCRIPTOR_HEADER *) Descriptor)- > >DescriptorFlags &=3D (~(ResetDescriptorFlags)) > +#define PcieInputParsetGetNextDescriptor(Descriptor) > ((Descriptor =3D=3D NULL) ? NULL : ((Descriptor->Flags & > DESCRIPTOR_TERMINATE_LIST) !=3D 0) ? NULL : (Descriptor + 1)) > +#define PcieConfigGetNextTopologyDescriptor(Descriptor, Termination) > ((Descriptor =3D=3D NULL) ? NULL : ((((PCIE_DESCRIPTOR_HEADER *) Descript= or)- > >DescriptorFlags & Termination) !=3D 0) ? NULL : ((UINT8 *) Descriptor + > ((PCIE_DESCRIPTOR_HEADER *) Descriptor)->Peer)) > +#define GnbGetNextHandle(Descriptor) = (GNB_HANDLE > *) PcieConfigGetNextTopologyDescriptor (Descriptor, > DESCRIPTOR_TERMINATE_TOPOLOGY) > +#define PcieConfigGetNextDataDescriptor(Descriptor) > ((Descriptor->Flags & DESCRIPTOR_TERMINATE_LIST) !=3D 0 ? NULL : (Descrip= tor > + 1)) > + > +#endif // PCIECONFIGLIB_LIB_H_ > diff --git a/Platform/AMD/AgesaModulePkg/Include/Library/SmnAccessLib.h > b/Platform/AMD/AgesaModulePkg/Include/Library/SmnAccessLib.h > new file mode 100644 > index 0000000000..f0c6d1ccbb > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/Library/SmnAccessLib.h > @@ -0,0 +1,30 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef _SMNACCESSLIB_H_ > +#define _SMNACCESSLIB_H_ > + > +VOID > +SmnRegisterReadS ( > + IN UINT32 SegmentNumber, > + IN UINT32 BusNumber, > + IN UINT32 Address, > + OUT VOID *Value > + ); > + > +VOID > +SmnRegisterRMWS ( > + IN UINT32 SegmentNumber, > + IN UINT32 BusNumber, > + IN UINT32 Address, > + IN UINT32 AndMask, > + IN UINT32 OrValue, > + IN UINT32 Flags > + ); > + > +#endif > diff --git > a/Platform/AMD/AgesaModulePkg/Include/Protocol/AmdNbioPcieServicesPr > otocol.h > b/Platform/AMD/AgesaModulePkg/Include/Protocol/AmdNbioPcieServicesPr > otocol.h > new file mode 100644 > index 0000000000..0e08e64b24 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Include/Protocol/AmdNbioPcieServicesPr > otocol.h > @@ -0,0 +1,47 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef NBIO_PCIE_SERVICES_PROTOCOL_H_ > +#define NBIO_PCIE_SERVICES_PROTOCOL_H_ > + > +// Current PROTOCOL revision > +#define AMD_NBIO_PCIE_SERVICES_REVISION 0x00 > + > +/// > +/// Forward declaration for the NBIO_PCIE_SERVICES_PROTOCOL > +/// > +typedef struct _DXE_AMD_NBIO_PCIE_SERVICES_PROTOCOL > DXE_AMD_NBIO_PCIE_SERVICES_PROTOCOL; > + > +// > +// Protocol Definitions > +// > + > +/** > + Returns the NBIO debug options configuration structure > + This > + A pointer to the DXE_AMD_NBIO_SMU_SERVICES_PROTOCOL instance. > + DebugOptions > + A pointer to a pointer to store the address of the PCIe topology str= ucture > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *AMD_NBIO_PCIE_GET_TOPOLOGY_STRUCT)( > + IN DXE_AMD_NBIO_PCIE_SERVICES_PROTOCOL *This, > + OUT UINT32 **DebugOptions > + ); > + > +/// > +/// The Dxe of PCIE Services > +/// > +struct _DXE_AMD_NBIO_PCIE_SERVICES_PROTOCOL { > + AMD_NBIO_PCIE_GET_TOPOLOGY_STRUCT PcieGetTopology; ///< > +}; > + > +extern EFI_GUID gAmdNbioPcieServicesProtocolGuid; > + > +#endif /* NBIO_PCIE_SERVICES_PROTOCOL_H */ > diff --git > a/Platform/AMD/AgesaModulePkg/Include/Protocol/AmdOemOobPprProtoc > ol.h > b/Platform/AMD/AgesaModulePkg/Include/Protocol/AmdOemOobPprProtoc > ol.h > new file mode 100644 > index 0000000000..10d3b730a6 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Include/Protocol/AmdOemOobPprProtoc > ol.h > @@ -0,0 +1,14 @@ > +/** @file > + > + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef _AMD_OEM_OOB_PPR_PROTOCOL_H_ > +#define _AMD_OEM_OOB_PPR_PROTOCOL_H_ > + > +extern EFI_GUID gAmdOemOobPprDxeProtocolGuid; > + > +#endif > diff --git > a/Platform/AMD/AgesaModulePkg/Include/Protocol/FabricNumaServices2.h > b/Platform/AMD/AgesaModulePkg/Include/Protocol/FabricNumaServices2.h > new file mode 100644 > index 0000000000..a15995188b > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Include/Protocol/FabricNumaServices2.h > @@ -0,0 +1,155 @@ > +/** @file > + > + Copyright (C) 2018-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef FABRIC_NUMA_SERVICES2_H_ > +#define FABRIC_NUMA_SERVICES2_H_ > +#include "AMD.h" > + > +#pragma pack (push, 1) > + > +#define MAX_PXM_VALUES_PER_QUADRANT 16 > + > +/// Domain type > +typedef enum { > + NumaDram, > + NumaSLink, > + NumaCxl, > + MaxNumaDomainType2 > +} DOMAIN_TYPE2; > + > +/// Reported Domain Info > +typedef struct { > + DOMAIN_TYPE2 Type; ///< Type > + UINT32 SocketMap; ///< Bitmap indicating physical socket= location > + UINT32 PhysicalDomain; ///< Physical domain number > +} DOMAIN_INFO2; > + > +/// Physical Dram Info > +typedef struct { > + UINT32 NormalizedCsMap; ///< Bitmap of CSs compris= ing this > physical domain > + UINT32 SharingEntityCount; ///< Number of virtual dom= ains > sharing this physical domain > + UINT32 SharingEntityMap; ///< Bitmap of reported do= mains that > share this physical domain > + UINT32 Reserved; ///< Reserved > +} PHYS_DOMAIN_INFO; > + > +/// Proximity Domain Info > +typedef struct { > + UINTN Count; ///< Entries in Domain a= rray > + UINTN Domain[MAX_PXM_VALUES_PER_QUADRANT]; ///< Domains in > Quadrant > +} PXM_DOMAIN_INFO; > + > +/// > +/// Forward declaration for the FABRIC_NUMA_SERVICES2_PROTOCOL > +/// > +typedef struct _FABRIC_NUMA_SERVICES2_PROTOCOL > FABRIC_NUMA_SERVICES2_PROTOCOL; > + > +/** > + * @brief Get the numa domain information. > + * > + * @details Get the numa domain information. > + * > + * @param[in] This A pointer to the > FABRIC_NUMA_SERVICES2_PROTOCOL instance. > + * @param[out] NumberOfDomainsInSystem Number of unique NUMA > domains > + * @param[out] DomainInfo An array with information abo= ut each > domain > + * @param[out] CcxAsNumaDomain TRUE: each core complex is it= s > own domain > + * FALSE: physical mapping is em= ployed > + * @retval EFI_STATUS 0: Success, NonZero: Standard= EFI Error. > + */ > +typedef > +EFI_STATUS > +(EFIAPI *FABRIC_NUMA_SERVICES2_GET_DOMAIN_INFO)( > + IN FABRIC_NUMA_SERVICES2_PROTOCOL *This, > + OUT UINT32 *NumberOfDomainsInSystem, > + OUT DOMAIN_INFO2 **DomainInfo, > + OUT BOOLEAN *CcxAsNumaDomain > + ); > + > +/** > + * @brief Translates a core's physical location to the appropriate NUMA > domain. > + * > + * @details Translates a core's physical location to the appropriate NUM= A > domain. > + * > + * @param[in] This A pointer to the > FABRIC_NUMA_SERVICES2_PROTOCOL instance. > + * @param[in] Socket Zero based socket that the core is att= ached to > + * @param[in] Die DF die on socket that the core is atta= ched to > + * @param[in] Ccd Logical CCD the core is on > + * @param[in] Ccx Logical core complex > + * @param[out] Domain Domain the core belongs to > + * @retval EFI_STATUS 0: Success, NonZero: Standard EFI Erro= r. > + */ > +typedef > +EFI_STATUS > +(EFIAPI *FABRIC_NUMA_SERVICES2_DOMAIN_XLAT)( > + IN FABRIC_NUMA_SERVICES2_PROTOCOL *This, > + IN UINTN Socket, > + IN UINTN Die, > + IN UINTN Ccd, > + IN UINTN Ccx, > + OUT UINT32 *Domain > + ); > + > +/** > + * @brief Get physical numa domain information. > + * > + * @details Get physical numa domain information. > + * > + * @param[in] This A pointer to the > FABRIC_NUMA_SERVICES2_PROTOCOL instance. > + * @param[out] NumberOfPhysDomainsInSystem Number of valid domains > in the system > + * @param[out] PhysDomainInfo An array with information = about > each physical domain > + * @param[out] PhysNodesPerSocket Actual NPS as determined b= y > ABL (not including SLink) > + * @param[out] NumberOfSystemSLinkDomains Number of domains > describing SLink connected memory > + * @retval EFI_STATUS 0: Success, NonZero: Stand= ard EFI Error. > + */ > +typedef > +EFI_STATUS > +(EFIAPI *FABRIC_NUMA_SERVICES2_GET_PHYSICAL_DOMAIN_INFO)( > + IN FABRIC_NUMA_SERVICES2_PROTOCOL *This, > + OUT UINT32 *NumberOfPhysDomainsInSystem, > + OUT PHYS_DOMAIN_INFO **PhysDomainInfo, > + OUT UINT32 *PhysNodesPerSocket, > + OUT UINT32 *NumberOfSystemSLinkDomains > + ); > + > +/** > + * @brief Get the proximity domain information about a PCIe root-port > bridge > + * > + * @details Get the proximity domain information about a PCIe root-port > bridge > + * > + * @param[in] This A pointer to the > FABRIC_NUMA_SERVICES2_PROTOCOL instance. > + * @param[in] RootPortBDF BDF for root-port bridge i= n PCI_ADDR > format. > + * @param[out] PxmDomainInfo Pointer to a structure ret= urning > associated NUMA node(s). > + * @retval EFI_STATUS 0: Success, NonZero: Stand= ard EFI Error. > + */ > +typedef > +EFI_STATUS > +(EFIAPI *FABRIC_NUMA_SERVICES2_GET_PROXIMITY_DOMAIN_INFO)( > + IN FABRIC_NUMA_SERVICES2_PROTOCOL *This, > + IN PCI_ADDR RootPortBDF, > + OUT PXM_DOMAIN_INFO *PxmDomainInfo > + ); > + > +/// > +/// When installed, the Fabric NUMA Services 2 Protocol produces a > collection of > +/// services that return various information associated with non-uniform > memory > +/// architecture. > +/// > +struct _FABRIC_NUMA_SERVICES2_PROTOCOL { > + UINTN Revision; = ///< Revision Number > + FABRIC_NUMA_SERVICES2_GET_DOMAIN_INFO GetDomainInfo; > ///< Get Domain Info > + FABRIC_NUMA_SERVICES2_DOMAIN_XLAT DomainXlat; = ///< > Domain Translation > + FABRIC_NUMA_SERVICES2_GET_PHYSICAL_DOMAIN_INFO > GetPhysDomainInfo; ///< Get Physical Domain Info > + FABRIC_NUMA_SERVICES2_GET_PROXIMITY_DOMAIN_INFO > GetPxmDomainInfo; ///< Get Proximity Domain Info > +}; > + > +/// > +/// Guid declaration for the FABRIC_NUMA_SERVICES2_PROTOCOL. > +/// > +extern EFI_GUID gAmdFabricNumaServices2ProtocolGuid; > + > +#pragma pack (pop) > +#endif // _FABRIC_NUMA_SERVICES2_H_ > diff --git > a/Platform/AMD/AgesaModulePkg/Include/Protocol/FabricTopologyServices > 2.h > b/Platform/AMD/AgesaModulePkg/Include/Protocol/FabricTopologyServices > 2.h > new file mode 100644 > index 0000000000..485240c0fb > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Include/Protocol/FabricTopologyServices > 2.h > @@ -0,0 +1,14 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef FABRIC_TOPOLOGY_SERVICES2_H_ > +#define FABRIC_TOPOLOGY_SERVICES2_H_ > + > +#include > + > +#endif // FABRIC_TOPOLOGY_SERVICES2_H_ > diff --git a/Platform/AMD/AgesaModulePkg/Include/SocLogicalId.h > b/Platform/AMD/AgesaModulePkg/Include/SocLogicalId.h > new file mode 100755 > index 0000000000..44093e4097 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Include/SocLogicalId.h > @@ -0,0 +1,23 @@ > +/** @file > + SoC Logical ID Definitions. > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef SOC_LOGICAL_ID_H_ > +#define SOC_LOGICAL_ID_H_ > +#pragma pack (push, 1) > + > +/// > +/// SOC logical ID structure > +/// > +typedef struct _SOC_LOGICAL_ID { > + IN OUT UINT32 Family; ///< Indicates logical ID Family > + IN OUT UINT16 Revision; ///< Indicates logical ID Revision > +} SOC_LOGICAL_ID; > + > +#pragma pack (pop) > +#endif // SOC_LOGICAL_ID_H_ > diff --git > a/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/LocalAmlLi > b.h > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/LocalAmlLi > b.h > new file mode 100644 > index 0000000000..a60ae20d33 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/LocalAmlLi > b.h > @@ -0,0 +1,100 @@ > +/** @file > + > + Copyright (C) 2020-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef _INTERNAL_AML_LIB_H_ > +#define _INTERNAL_AML_LIB_H_ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "LocalAmlObjects.h" > + > +// EDK2 open source MdePkg/Include/IndustryStandard/AcpiAml.h does not > have > +// these and should. > +#define AML_DIGIT_CHAR_0 0x30 > +#define AML_DIGIT_CHAR_9 0x39 > + > +// The max string size for a QWord is 8 bytes =3D 16 characters plus NUL= L > Terminator > +#define MAX_AML_DATA_INTEGER_SIZE 17 > + > +// Defines similar to ctype.h functions isalpha() and isdigit() > +#define IS_ASCII_UPPER_ALPHA(c) ( ((c) >=3D AML_NAME_CHAR_A) && ((c) > <=3D AML_NAME_CHAR_Z) ) > +#define IS_ASCII_HEX_DIGIT(c) ( (((c) >=3D AML_DIGIT_CHAR_0) && ((c) = <=3D > AML_DIGIT_CHAR_9)) ||\ > + (((c) >=3D AML_NAME_CHAR_A) && ((c) <= =3D > AML_NAME_CHAR_F)) ) > + > +// Swap bytes of upper and lower WORDs within a DWORD > +#define Swap4Bytes(val) \ > + ( (((val) >> 8) & 0x000000FF) | (((val) << 8) & 0x0000FF00) | \ > + (((val) >> 8) & 0x00FF0000) | (((val) << 8) & 0xFF000000) ) > + > +/* > + Calculates the optimized integer value used by AmlDataInteger and othe= rs > + > + Not a public function so no doxygen comment identifiers. > + > + @param[in] Integer - Integer value to encode > + @param[out] ReturnData - Allocated DataBuffer with encoded inte= ger > + @param[out] ReturnDataSize - Size of ReturnData > + > + @return EFI_SUCCESS - Successful completion > + @return EFI_OUT_OF_RESOURCES - Failed to allocate ReturnDataBuff= er > +*/ > +EFI_STATUS > +EFIAPI > +InternalAmlDataIntegerBuffer ( > + IN UINT64 Integer, > + OUT VOID **ReturnData, > + OUT UINTN *ReturnDataSize > + ); > + > +/** > + Creates a Package Length encoding and places it in the return buffer, > + PkgLengthEncoding. Similar to AmlPkgLength but the PkgLength does not > + include the length of its own encoding. > + > + @param[in] DataSize - The size of data to be encoded as a pkglength > + @param[out] PkgLengthEncoding - Return buffer containing the AML > encoding > + @param[out] ReturnDataLength - Size of the return buffer > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > + **/ > +EFI_STATUS > +EFIAPI > +InternalAmlBitPkgLength ( > + IN UINT32 DataSize, > + OUT UINT8 **PkgLengthEncoding, > + OUT UINTN *ReturnDataLength > + ); > + > +/** > + Creates a NameSeg AML object and inserts it into the List > + > + NameSeg :=3D > + > + NameSegs shorter than 4 characters are filled with trailing underscore= s > + > + @param[in] Name - Field NameSeg > + @param[in,out] ListHead - Linked list has NameSeg after call > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +InternalAmlNameSeg ( > + IN CHAR8 *Name, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +#endif > diff --git > a/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/LocalAmlO > bjects.h > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/LocalAmlO > bjects.h > new file mode 100644 > index 0000000000..b19b6fe867 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/LocalAmlO > bjects.h > @@ -0,0 +1,150 @@ > +/** @file > + > + Copyright (C) 2020-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef _INTERNAL_AML_OBJECTS_H_ > +#define _INTERNAL_AML_OBJECTS_H_ > + > +// #include "LocalAmlLib.h" > + > +/** > + Free Object->Data > + > + Frees Object->Data, Nulls pointer, zeros size and marks > + Object->Completed =3D FALSE > + > + @param [in] Object - Pointer to Object to have Data freed > + > + @return EFI_SUCCESS - Object Freed > + @return - Object free failed > +**/ > +EFI_STATUS > +EFIAPI > +InternalFreeAmlObjectData ( > + IN AML_OBJECT_INSTANCE *Object > + ); > + > +/** > + Free an Object > + > + Removes Object from it's linked list. > + Frees Object->Data > + Frees Object > + > + @param [in] Object - Pointer to Object to be freed > + @param [in,out] ListHead - Head of AML Object linked list > + > + @return EFI_SUCCESS - Object Freed > + @return - Object free failed > +**/ > +EFI_STATUS > +EFIAPI > +InternalFreeAmlObject ( > + IN AML_OBJECT_INSTANCE **Object, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a new AML_OBJECT_INSTANCE. Object->Data will be NULL and > + Object->DataSize will be 0 > + > + Allocates AML_OBJECT_INSTANCE which must be freed by caller > + > + @param [out] ReturnObject - Pointer to an Object > + > + @return EFI_SUCCESS - Object created and appended to linked = list > + @return - Object creation failed, Object =3D NUL= L > +**/ > +EFI_STATUS > +EFIAPI > +InternalNewAmlObjectNoData ( > + OUT AML_OBJECT_INSTANCE **ReturnObject > + ); > + > +/** > + Inserts a new AML_OBJECT_INSTANCE at the end of the linked list. Obje= ct- > >Data > + will be NULL and Object->DataSize will be 0 > + > + Allocates AML_OBJECT_INSTANCE which must be freed by caller > + > + @param [out] ReturnObject - Pointer to an Object > + @param [in,out] ListHead - Head of AML Object linked list > + > + @return EFI_SUCCESS - Object created and appended to linked = list > + @return - Object creation failed, Object =3D NUL= L > +**/ > +EFI_STATUS > +EFIAPI > +InternalAppendNewAmlObjectNoData ( > + OUT AML_OBJECT_INSTANCE **ReturnObject, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Inserts a new AML_OBJECT_INSTANCE at the end of the linked list. Usin= g a > + string Identifier for comparison purposes > + > + Allocates AML_OBJECT_INSTANCE which must be freed by caller > + > + @param [out] ReturnObject - Pointer to an Object > + @param [in] Identifier - String Identifier to create object wit= h > + @param [in,out] ListHead - Head of AML Object linked list > + > + @return EFI_SUCCESS - Object created and appended to linked = list > + @return - Object creation failed, Object =3D NUL= L > +**/ > +EFI_STATUS > +EFIAPI > +InternalAppendNewAmlObject ( > + OUT AML_OBJECT_INSTANCE **ReturnObject, > + IN CHAR8 *Identifier, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Finds AML_OBJECT_INSTANCE given a string Identifier looking backwards = in > the > + AML_OBJECT_INSTANCE linked list > + > + @param [out] ReturnObject - Pointer to an Object > + @param [in] Identifier - String Identifier to create object wit= h > + @param [in] ListHead - Head of AML Object linked list > + > + @return EFI_SUCCESS - Object located and returned > + @return - Object creation failed, Object =3D NUL= L > +**/ > +EFI_STATUS > +EFIAPI > +InternalAmlLocateObjectByIdentifier ( > + OUT AML_OBJECT_INSTANCE **ReturnObject, > + IN CHAR8 *Identifier, > + IN LIST_ENTRY *ListHead > + ); > + > +/** > + Finds all children of the Link and appends them into a single ObjectDa= ta > + buffer of ObjectDataSize > + > + Allocates AML_OBJECT_INSTANCE and Data which must be freed by caller > + > + @param [out] ReturnObject - Pointer to an Object pointer > + @param [out] ChildCount - Count of Child Objects collapsed > + @param [in] Link - Linked List Object entry to collect ch= ildren > + @param [in,out] ListHead - Head of Object Linked List > + > + @return EFI_SUCCESS - ChildObject created and returned > + @return - Object creation failed, Object =3D NUL= L > +**/ > +EFI_STATUS > +EFIAPI > +InternalAmlCollapseAndReleaseChildren ( > + OUT AML_OBJECT_INSTANCE **ReturnObject, > + OUT UINTN *ChildCount, > + IN LIST_ENTRY *Link, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +#endif // _INTERNAL_AML_OBJECTS_H_ > diff --git a/Platform/AMD/AgesaPkg/Include/AmdPcieComplex.h > b/Platform/AMD/AgesaPkg/Include/AmdPcieComplex.h > new file mode 100755 > index 0000000000..3a628ed0b2 > --- /dev/null > +++ b/Platform/AMD/AgesaPkg/Include/AmdPcieComplex.h > @@ -0,0 +1,432 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef AMD_PCIE_COMPLEX_H_ > +#define AMD_PCIE_COMPLEX_H_ > + > +// > +// GNB PCIe configuration info > +// > +#define DESCRIPTOR_TERMINATE_LIST 0x80000000ull > +#define DESCRIPTOR_IGNORE 0x40000000ull > + > +// > +// Port parameter count > +// > +#define PCIE_PORT_PARAMETER_COUNT 64 > + > +/// > +/// PCIe link initialization > +/// DXIO endpoint status > +/// > +typedef enum { > + DxioEndpointDetect =3D 0, ///< Dete= ct endpoint presence > + DxioEndpointNotPresent ///< Endpoi= nt not present (or > connected). Used in case there is alternative way to determine > + ///< if dev= ice present on board or in slot. > For example GPIO can be used to determine device presence. > +} DXIO_ENDPOINT_STATUS; > + > +#pragma pack(push,1) > +typedef struct { > + UINT16 ParamType; ///< This identifies a = specific port > parameter to set. > + UINT16 ParamValue; ///< Specifies the valu= e to be assigned > to port parameter. > +} PORT_PARAM; > + > +typedef struct { > + PORT_PARAM PhyParam[PCIE_PORT_PARAMETER_COUNT]; ///< > PHY port parameter > +} PORT_PARAMS; > + > +/// > +/// Ancillary data struct with table size and address > +/// > +typedef struct { > + IN UINT32 Count; ///< Total count in= this Ancillary data > table > + IN UINT32 Ovrd; ///< Ancillary data= table address point > to ANC_DATA_PARAM[] > +} ANC_DATA; > + > +typedef struct { > + UINT16 ParamType; ///< This identifies a specific P= HY parameter > + UINT16 ParamValue; ///< This specifies the value to = be assigned > to indicated PHY parameter > +} DXIO_PHY_PARAM; > + > +typedef struct { > + DXIO_PHY_PARAM PhyParam[44]; ///< physical parameter > +} PHY_DATA; > + > +/// > +/// PCIe specific data structures > +/// PCIe port misc extended controls > +/// > +typedef struct { > + UINT8 LinkComplianceMode : 1; ///< Force port = into > compliance mode (device will not be trained, port output compliance patte= rn) > + UINT8 LinkSafeMode : 1; ///< Safe mode P= CIe capability. > (Parameter may limit PCIe speed requested through > DXIO_PORT_DATA::LinkSpeedCapability) > + ///< 0 - port = can advertize muximum > supported capability > + ///< 1 - port = limit advertized capability and > speed to PCIe Gen1 > + UINT8 SbLink : 1; ///< PCIe link t= ype > + ///< 0 - Gener= al purpose port > + ///< 1 - Port = connected to SB > + UINT8 ClkPmSupport : 1; ///< Clock Power= Management > Support > + ///< 0 - Clock= Power Management not > configured > + ///< 1 - Clock= Power Management > configured according to PCIe device capability > + UINT8 ChannelType : 3; ///< Channel Typ= e > + ///< 0 - Chann= el Type Not Specified > + ///< - Channe= l Type Short Trace > + ///< 2 - Chann= el Type Long Trace > + UINT8 TurnOffUnusedLanes : 1; ///< Turn Off Un= used Lanes > + ///< 0 - Turn = on > + ///< 1 - Turn = off > +} DXIO_PORT_MISC_CONTROL; > + > +/// > +/// The IO APIC Interrupt Mapping Info > +/// > +typedef struct { > + UINT8 GroupMap; ///< Group mapping f= or slot or > endpoint device (connected to PCIE port) interrupts . > + ///< 0 - IGNORE TH= IS STRUCTURE AND USE > RECOMMENDED SETTINGS > + ///< 1 - mapped to= Grp 0 (Interrupts 0..3 of IO > APIC redirection table) > + ///< 2 - mapped to= Grp 1 (Interrupts 4..7 of IO > APIC redirection table) > + ///< ... > + ///< 8 - mapped t= o Grp 7 (Interrupts 28..31 of > IO APIC redirection table) > + UINT8 Swizzle; ///< Swizzle interru= pt in the Group. > + ///< 0 - ABCD > + ///< 1 - BCDA > + ///< 2 - CDAB > + ///< 3 - DABC > + UINT8 BridgeInt; ///< IOAPIC redirect= ion table entry for > PCIE bridge interrupt > + ///< 0 - Entry 0 = of IO APIC redirection table > + ///< 1 - Entry 1 = of IO APIC redirection table > + ///< ... > + ///< 31 - Entry 31= of IO APIC redirection table > +} DXIO_APIC_DEVICE_INFO; > +/// > +/// PCIe port configuration data > +/// > +typedef struct { > + UINT8 PortPresent : 1; ///< Enable PCIe p= ort for > initialization. > + UINT8 Reserved1 : 2; ///< Reserved > + UINT8 DeviceNumber : 5; ///< PCI Device nu= mber for port. > + ///< 0 - Native = port device number > + ///< N - Port de= vice number (See available > configurations in BKDG > + UINT8 FunctionNumber : 3; ///< Reserved for = future use > + UINT8 LinkSpeedCapability : 3; ///< PCIe link spe= ed/ > + ///< 0 - Maximum= supported by silicon > + ///< 1 - Gen1 > + ///< 2 - Gen2 > + ///< 3 - Gen3 > + ///< 4 - Gen4 > + ///< 5 - Gen5 > + UINT8 AutoSpdChng : 2; ///< Upstread Auto= Speed Change > Allowed/ > + ///< 0 - Use def= ault implementation (Disabled > for Gen1, Enabled for Gen2/3) > + ///< 1 - Always = Disabled > + ///< 2 - Always = Enabled > + ///< 3 - Reserve= d > + UINT8 EqPreset : 4; ///< Gen3 Equaliza= tion Preset */ > + UINT8 LinkAspm : 2; ///< ASPM control.= (see > AgesaPcieLinkAspm for additional option to control ASPM) > + ///< 0 - Disable= d > + ///< 1 - L0s onl= y > + ///< 2 - L1 only > + ///< 3 - L0s and= L1 > + UINT8 LinkAspmL1_1 : 1; ///< ASPM control.= (see > AgesaPcieLinkAspm for additional option to control ASPM) > + ///< 0 - Disable= d > + ///< 1 - Enabled > + UINT8 LinkAspmL1_2 : 1; ///< ASPM control.= (see > AgesaPcieLinkAspm for additional option to control ASPM) > + ///< 0 - Disable= d > + ///< 1 - Enabled > + UINT8 ClkReq : 4; ///< ASPM Reserved= Field > + ///< 0 - NONE > + ///< 1 - CLKREQ0= signal > + ///< 2 - CLKREQ1= signal > + ///< 3 - CLKREQ2= signal > + ///< 4 - CLKREQ3= signal > + ///< 5 - CLKREQG= signal > + UINT8 LinkHotplug : 4; ///< Hotplug contr= ol. > + ///< 0 - Disable= d > + ///< 1 - Basic > + ///< 2 - Server > + ///< 3 - Enhance= d > + UINT8 SlotPowerLimit; ///< PCIe slot pow= er limit. > + UINT8 SlotPowerLimitScale : 2; ///< PCIe slot pow= er limit Scale. > + ///< 00b =3D 1.0= x > + ///< 01b =3D 0.1= x > + ///< 10b =3D 0.0= 1x > + ///< 11b =3D 0.0= 01x > + UINT8 IsMasterPLL : 1; ///< IsMasterPLL > + UINT8 Gen4Features : 5; ///< Unused bits > + ///< BIT0(DLF_Ex= change) 1 - Disable, 0 - > Enable > + ///< IT1(DLF_Cap= ability) 1 - Disable, 0 - Enable > + UINT16 SlotNum : 13; ///< PHYSICAL_SLOT= _NUM > + UINT16 CsLink : 3; ///< Reserved > + DXIO_PORT_MISC_CONTROL MiscControls; ///< Misc extended > controls > + DXIO_APIC_DEVICE_INFO ApicDeviceInfo; ///< IOAPIC device > programming info > + DXIO_ENDPOINT_STATUS EndpointStatus; ///< PCIe endpoint > (device connected to PCIe port) status > + UINT8 EsmSpeedBump; ///< Speed bump fo= r ESM > + UINT8 EsmControl : 1; ///< Enhanced spee= d mode control > + UINT8 CcixControl : 1; ///< Ccix/Cxl cont= rol > + UINT8 TxVetting : 1; ///< Tx Vetting > + UINT8 RxVetting : 1; ///< Rx Vetting > + UINT8 InvertPolarity : 1; ///< Invert RX Pol= arity > + UINT8 InvertPolarity2 : 1; ///< Invert TX Pol= arity > + UINT8 NtbHotplug : 1; ///< NTB Hotplug f= lag > + ///< 0b =3D Disa= bled > + ///< 1b =3D Enab= led > + UINT8 Reserved2 : 1; ///< Reserved > + UINT8 SetGen3FixedPreset : 1; ///< Gen3 Fixed Pr= eset Set > + UINT8 SetGen4FixedPreset : 1; ///< Gen4 Fixed Pr= eset Set > + UINT8 SetGen5FixedPreset : 1; ///< Gen5 Fixed Pr= eset Set > + UINT8 Reserved3 : 5; ///< Reserved > + UINT8 Gen3FixedPreset : 4; ///< Gen3 Fixed Pr= eset > + UINT8 Gen4FixedPreset : 4; ///< Gen4 Fixed Pr= eset > + UINT8 Gen5FixedPreset : 4; ///< Gen5 Fixed Pr= eset > + UINT8 Reserved4 : 4; ///< Reserved > + UINT16 PsppPolicyDC; ///< Pspp DC contr= ol > + UINT16 PsppPolicyAC; ///< PSPP AC contr= ol > + UINT8 PsppDeviceType; ///< Pspp Device T= ype > + UINT8 DisGen3EQPhase : 1; ///< Gen3 Bypass p= hase2/3 EQ > + UINT8 DisGen4EQPhase : 1; ///< Gen4 Bypass p= hase2/3 EQ > + UINT8 TXDeEmphasisOride : 1; ///< Override Gen2= DXIO > deemphasis default > + UINT8 TXDeEmphasis : 2; ///< Gen2 DXIO dee= mphasis > setting > + UINT8 Reserved5 : 3; ///< Reserved > + struct { > + UINT16 DsTxPreset : 4; ///< Gen3 Downstre= am Tx Preset > + UINT16 DsRxPresetHint : 3; ///< Gen3 Downstre= am Rx Preset > Hint > + UINT16 UsTxPreset : 4; ///< Gen3 Upstream= Tx Preset > + UINT16 UsRxPresetHint : 3; ///< Gen3 Upstream= Rx Preset > Hint > + UINT16 Reserved1 : 2; ///< Unused bits > + UINT8 SetDsTxPreset : 1; ///< Gen3 Set Down= stream Tx > Preset > + UINT8 SetDsRxPresetHint : 1; ///< Gen3 Set Down= stream Rx > Preset Hint > + UINT8 SetUsTxPreset : 1; ///< Gen3 Set Upst= ream Tx Preset > + UINT8 SetUsRxPresetHint : 1; ///< Gen3 Set Upst= ream Rx > Preset Hint > + UINT8 Reserved2 : 4; ///< Unused bits > + } LaneEqualizationCntl; ///< Lane equaliza= tion control > structure used for Gen3 values > + struct { > + UINT8 DsTxPreset : 4; ///< Gen4 Downstre= am Tx Preset > + UINT8 UsTxPreset : 4; ///< Gen4 Upstream= Tx Preset > + UINT8 SetDsTxPreset : 1; ///< Gen4 Set Down= stream Tx > Preset > + UINT8 SetUsTxPreset : 1; ///< Gen4 Set Upst= ream Tx Preset > + UINT8 Reserved1 : 6; ///< Unused bits > + } Gen4LaneEqualizationCntl; ///< Lane e= qualization control > structure used for Gen4 values > + struct { > + UINT8 DsTxPreset : 4; ///< Gen5 Downstre= am Tx Preset > + UINT8 UsTxPreset : 4; ///< Gen5 Upstream= Tx Preset > + UINT8 SetDsTxPreset : 1; ///< Gen5 Set Down= stream Tx > Preset > + UINT8 SetUsTxPreset : 1; ///< Gen5 Set Upst= ream Tx Preset > + UINT8 Reserved1 : 6; ///< Unused bits > + } Gen5LaneEqualizationCntl; ///< Lane equaliza= tion control > structure used for Gen5 values > + struct { > + UINT32 PresetMask8Gt : 10; ///< Preset Mask 8= GT. > + UINT32 PresetMask16Gt : 10; ///< Preset Mask 1= 6GT. > + UINT32 PresetMask32Gt : 10; ///< Preset Mask 3= 2GT. > + UINT32 Reserved1 : 2; ///< Unused bits > + UINT8 SetPresetMask8Gt : 1; ///< Preset Mask 8= GT Set > + UINT8 SetPresetMask16Gt : 1; ///< Preset Mask 1= 6GT Set > + UINT8 SetPresetMask32Gt : 1; ///< Preset Mask 3= 2GT Set > + UINT8 Reserved2 : 5; ///< Unused bits > + } PresetMaskCntl; ///< Preset Mask con= trol structure > used for Gen3/Gen4/Gen5 values > + UINT8 TargetLinkSpeed : 3; ///< Target Link Spe= ed > + UINT8 BypassGen3EQ : 1; ///< Bypass Gen3 equ= alization > + UINT8 BypassGen4EQ : 1; ///< Bypass Gen4 equ= alization > + UINT8 SrisSkipInterval : 3; ///< Controls SRIS S= KP generation > interval > + UINT8 SrisEnableMode : 4; ///< 0:Disable 1:Ena= ble 0xF:Auto > + UINT8 SrisAutoDetectMode : 4; ///< Controls SRIS A= utodetect > mode 0:Disable 1:Enable 0xF:Auto > + UINT8 LowerSkpOsGenSup; ///< Controls > LOWER_SKP_OS_GEN_SUPPORT > + UINT8 LowerSkpOsRcvSup; ///< Controls > LOWER_SKP_OS_RCV_SUPPORT > + UINT8 SrisSkpIntervalSel : 2; ///< Controls SRIS S= KIP Interval > Selection Mode > + UINT8 SrisAutodetectFactor : 2; ///< Controls the mu= ltiplier for > SKP ordered set interval when generated based on elasticity buffer pointe= r > slip feedback from PCS > + UINT8 IsBmcLocation : 1; ///< IsBmcLocation > + UINT8 SetEsmControl : 1; ///< Set ESM Control > + UINT8 SetEsmSpeedBump : 1; ///< Set Speed bump = for ESM > + UINT8 Reserved6 : 1; ///< Unused bits > + UINT8 I2CMuxInfo : 6; ///< Legacy I2c swit= ch > + UINT8 AlwaysExpose : 1; ///< Always expose u= nused PCIE > port > + UINT8 Reserved7 : 1; ///< Unused bits > + UINT16 NpemEnable : 12; ///< Controls NPEM E= nable > + UINT16 Reserved8 : 4; ///< Unused bits > + UINT16 NpemCapability : 12; ///< Controls NPEM C= apability > + UINT8 SwingMode : 3; ///< PCIe Swing Mode > + UINT16 Reserved9 : 1; ///< Unused bits > + UINT16 MpioAncDataIdx; ///< Reserved for in= ternal use only > + UINT8 Reserved10; ///< Reserved bits > +} DXIO_PORT_DATA; > + > +/// > +/// EtherNet specific data structures > +/// > +typedef struct { > + UINT32 PortNum : 8; ///< Port Number > + UINT32 PlatConf : 4; ///< Platform Config > + ///< 0 =3D Reserved > + ///< 1 =3D 10G/1G Bac= kPlane > + ///< 2 =3D 2.5G BackP= lane > + ///< 3=3D Soldered do= wn 1000Base-T > + ///< 4 =3D Soldered d= own 1000Base-X > + ///< 5 =3D Soldered d= own NBase-T > + ///< 6 =3D Soldered d= own 10GBase-T > + ///< 7 =3D Soldered d= own 10GBase-r > + ///< 8 =3D SFP+ Conne= ctor > + UINT32 Reserved1 : 4; ///< Unused 12-15 > + UINT32 MdioId : 5; ///< MDIO ID when MDIO = Side band is > used > + UINT32 Reserved2 : 2; ///< Unused 21-22 > + UINT32 SuppSpeed : 4; ///< Supported Speeds b= y Platform > + ///< 1 =3D 100M Suppo= rted > + ///< 2 =3D 1G Support= ed > + ///< 4 =3D 2.5G Suppo= rted > + ///< 8 =3D 10G Suppor= ted > + UINT32 Reserved3 : 1; ///< Unused 27 > + UINT32 ConnType : 3; ///< Supported Speeds b= y Platform > + ///< 0 =3D Port not U= sed > + ///< 1 =3D SFP+ Conne= ction I2C interface > + ///< 2 =3D MDIO PHY > + ///< 4 =3D Backplane = Connection > + UINT32 Reserved4 : 1; ///< Unused 31 > +} ETH_PORT_PROPERTY0; > + > +typedef struct { > + UINT32 MdioReset : 2; ///< MDIO Reset Type > + ///< 0 =3D None > + ///< 1 =3D I2C GPIO > + ///< 2 =3D Integrated= GPIO > + ///< 3 =3D Reserved > + UINT32 Reserved1 : 2; ///< Unused 2-3 > + UINT32 MdioGpioResetNum : 2; ///< Integrated GPIO nu= mber for > reset > + UINT32 Reserved2 : 2; ///< Unused 6-7 > + UINT32 SfpGpioAdd : 3; ///< Lower I2C address = of GPIO > Expander PCA9535 > + UINT32 Reserved3 : 1; ///< Unused 11 > + UINT32 TxFault : 4; ///< TX FAULT > + UINT32 Rs : 4; ///< RS Signal > + UINT32 ModAbs : 4; ///< MOD_ABS signal > + UINT32 RxLoss : 4; ///< Rx_LOS signal > + UINT32 SfpGpioMask : 4; ///< SFP+ sideband sign= als that are > not supported by platform > +} ETH_PORT_PROPERTY3; > + > +typedef struct { > + UINT32 SfpMux : 3; ///< Lower address of M= ux PCA 9545 > + UINT32 Reserved1 : 1; ///< Unused 3 > + UINT32 SfpBusSeg : 3; ///< SFP BUS Segment. D= ownstream > channels of PCA9545 > + UINT32 Reserved2 : 1; ///< Unused 7 > + UINT32 SfpMuxUpAdd : 5; ///< Upper address of M= ux PCA > 9545 > + UINT32 Reserved3 : 3; ///< Unused 13-15 > + UINT32 RedriverAddress : 7; ///< Address of ReDrive= r > + UINT32 RedriverInterface : 1; ///< ReDriver Interface= Descriptor > + UINT32 RedriverLane : 3; ///< ReDriver Lane numb= er > + UINT32 Reserved4 : 1; ///< Unused 27 > + UINT32 RedriverModel : 3; ///< ReDriver Model > + UINT32 RedriverPresent : 1; ///< Redriver Present > +} ETH_PORT_PROPERTY4; > + > +typedef struct { > + UINT32 TxEqPre : 6; ///< TX EQ PRE > + UINT32 Reserved1 : 2; ///< Unused 7-6 > + UINT32 TxEqMain : 6; ///< TX EQ MAIN > + UINT32 Reserved2 : 2; ///< Unused 15-14 > + UINT32 TxEqPost : 6; ///< TX EQ POST > + UINT32 Reserved3 : 10; ///< Unused 31-23 > +} ETH_PORT_TXEQ; > +/// Ethernet PCIe port configuration data > +/// > +typedef struct { > + ETH_PORT_PROPERTY0 EthPortProp0; ///< > XGBE_PORT_PROPERTY_0 > + ETH_PORT_PROPERTY3 EthPortProp3; ///< > XGBE_PORT_PROPERTY_3 > + ETH_PORT_PROPERTY4 EthPortProp4; ///< > XGBE_PORT_PROPERTY_4 > + UINT32 PadMux0; ///< PadMux0 Setting (8= bits) > + UINT32 PadMux1; ///< PadMux1 Setting (8= bits) > + UINT32 MacAddressLo; ///< Lower 32 bits of M= AC Address > + UINT32 MacAddressHi; ///< Upper 32 bits of M= AC Address > + ETH_PORT_TXEQ EthPortTxEq; ///< TX EQ Settings > +} ETHERNET_PORT_DATA; > + > +/// > +/// High level data structures for passing topology from platform to AGE= SA > +/// > +typedef struct { > + UINT8 EngineType; ///< Engine type > + ///< 0 - Ignore engi= ne configuration > + ///< 1 - PCIe port > + UINT8 HotPluggable : 1; ///< HotPluggable > + ///< 0 - Link is NOT = Hot-Switchable > + ///< 1 - Link IS Hot-= Switchable > + UINT8 Reserved1 : 7; ///< Unused field, leav= e as 0 > + UINT8 StartLane; ///< Start Lane ID (in = reversed > configuration StartLane > EndLane) > + ///< Refer to lane desc= riptions and supported > configurations in BKDG > + UINT8 EndLane; ///< End lane ID (in re= versed > configuration StartLane > EndLane) > + ///< Refer to lane desc= riptions and supported > configurations in BKDG > + UINT8 GpioGroupId; ///< Unique identifier = for the GPIO or > GPIO group associated with > + ///< this engine. GPIO= s are used for hotplug > notification and link > + ///< type (e.g SATA Exp= ress or PCIe) > + UINT8 DxioStartLane; ///< Internal coding of= start lane > + UINT8 DxioEndLane; ///< Internal coding of= end lane > + UINT8 SearchDepth; ///< SearchDepth only u= ses 1 bit - > always initialize to 0 will be updated dynamically > +} DXIO_ENGINE_DATA; > + > +/// > +/// PCIe port descriptor > +/// > +typedef struct { > + UINT32 Flags; ///< Descriptor flags > + ///< Bit31 - last des= criptor in complex > + DXIO_ENGINE_DATA EngineData; ///< Engine data > + DXIO_PORT_DATA Port; ///< PCIe port specific= configuration > info > + ETHERNET_PORT_DATA EtherNet; ///< Ancillary data for= EtherNet > + PHY_DATA Phy; ///< Ancillary data for= PHY programming > customization > + PORT_PARAMS PortParams; ///< Extensible port pa= rameter list > for simplified topology structure > + ANC_DATA AncData; ///< Ancillary data ove= rride > +} DXIO_PORT_DESCRIPTOR; > + > +#pragma pack(pop) > + > +/// > +/// > +/// PCIe Complex descriptor > +/// > +typedef struct { > + UINT32 Flags; ///< Descriptor flags > + ///< Bit31 - last des= criptor in topology > + UINT32 SocketId; ///< Socket Id > + DXIO_PORT_DESCRIPTOR *PciePortList; ///< Pointer to array o= f PCIe > port descriptors or NULL (Last element of array must be terminated with > DESCRIPTOR_TERMINATE_LIST). > + VOID *Reserved2; ///< Reserved for futur= e use > + UINT8 BmcLinkLocation; ///< Identifies the soc= ket/die location > of a BMC link (Used by AGESA, input not required) > + UINT8 BmcLinkLaneNum; ///< Identifies the soc= ket/die > location of a BMC Lane number > + UINT8 Reserved3[2]; ///< Reserved for futur= e > +} DXIO_COMPLEX_DESCRIPTOR; > + > +/// > +/// Engine descriptor type > +/// > +typedef enum { > + DxioUnusedEngine =3D 0, ///< Unused = descriptor Excluded > from configuration > + DxioPcieEngine =3D 1, ///< PCIe po= rt > + DxioUSBEngine =3D 2, ///< USB por= t > + ///< __Depreca= ted__ > + DxioSATAEngine =3D 3, ///< SATA > + DxioUSB_OVER_PCIE =3D 4, ///< USB4 PC= Ie (internal use > only) > + DxioUBMHFCEngine =3D 5, ///< New for= Genoa UBM HFC > Connector for auto-discovery > + DxioOCP3Engine =3D 6, ///< New for= Genoa OCP3 > Bifurcatable Connector > + DxioUdot3Engine =3D 7, ///< New for= Genoa U.3 > Multiprotocol Connector > + DxioDPEngine =3D 8, ///< Digital= Display __For APU > display connector list__ > + DxioEthernetEngine =3D 0x10, ///< Etherne= t (GBe, XGBe) > + ///< __Depreca= ted__ > + DxioGOPEngine =3D 0x20, ///< GOP > + ///< __Depreca= ted__ > + DxioNTBDevice =3D 0x60, ///< For NBI= F NTB Enable > (internal use only) > + DxioHDaudioEngine, ///< For NBIF = HDaudtio Enable > (internal use only) > + DxioACPEngine, ///< For NBIF = ACP Enable (internal > use only) > + DxioMP2Engine, ///< For NBIF = MP2 Enable (internal > use only) > + DxioMaxPcieEngine ///< Max engin= e type for > boundary check. > +} DXIO_ENGINE_TYPE; > + > +/// > +/// PCIe link speeds > +/// > +typedef enum { > + DxioGenMaxSupported, ///< Maximum s= upported > + DxioGen1 =3D 1, ///< Gen1 > + DxioGen2, ///< Gen2 > + DxioGen3, ///< Gen3 > + DxioGen4, ///< Gen4 > + DxioGen5, ///< Gen5 > + MaxDxioGen ///< Max Gen f= or boundary check > +} DXIO_LINK_SPEEDS; > +#endif // AMD_PCIE_COMPLEX_H_ > diff --git a/Platform/AMD/AgesaPkg/Include/AmdSoc.h > b/Platform/AMD/AgesaPkg/Include/AmdSoc.h > new file mode 100644 > index 0000000000..d62f260235 > --- /dev/null > +++ b/Platform/AMD/AgesaPkg/Include/AmdSoc.h > @@ -0,0 +1,17 @@ > +/** @file > + > + Copyright (C) 2015-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef _AMD_SOC_H_ > +#define _AMD_SOC_H_ > + > +#define F1A_BRH_A0_RAW_ID 0x00B00F00ul > +#define F1A_BRH_B0_RAW_ID 0x00B00F10ul > +#define F1A_BRH_B1_RAW_ID 0x00B00F11ul > +#define F1A_BRHD_A0_RAW_ID 0x00B10F00ul > +#define F1A_BRHD_B0_RAW_ID 0x00B10F10ul > +#endif // _AMD_SOC_H_ > diff --git a/Platform/AMD/AgesaPkg/Include/FabricResourceManagerCmn.h > b/Platform/AMD/AgesaPkg/Include/FabricResourceManagerCmn.h > new file mode 100644 > index 0000000000..2291f7dc83 > --- /dev/null > +++ b/Platform/AMD/AgesaPkg/Include/FabricResourceManagerCmn.h > @@ -0,0 +1,42 @@ > +/** @file > + Fabric resource manager common definition > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef FABRIC_RESOURCE_MANAGER_CMN_H_ > +#define FABRIC_RESOURCE_MANAGER_CMN_H_ > +#pragma pack (push, 1) > + > +#define MAX_SOCKETS_SUPPORTED 2 ///< Max number of socke= ts > in system. > +#define MAX_RBS_PER_SOCKET 20 ///< Max number of root > bridges per socket. > + > +/** > + * @brief DF address aperture structure. > + * @details This contains information used to define an MMIO region. > + */ > +typedef struct _FABRIC_ADDR_APERTURE { > + UINT64 Base; ///< Aperture base Address. > + UINT64 Size; ///< Aperture size. > + UINT64 Alignment; ///< Alignment bit map. 0xFFFFF = means 1MB > align. > +} FABRIC_ADDR_APERTURE; > + > +/** > + * @brief DF Resource for each RootBridge structure. > + * @details This contains information used to define the MMIO region fo= r > each RootBridge. > + */ > +typedef struct _FABRIC_RESOURCE_FOR_EACH_RB { > + FABRIC_ADDR_APERTURE > NonPrefetchableMmioSizeAbove4G[MAX_SOCKETS_SUPPORTED][MAX_RBS_ > PER_SOCKET]; ///< Nonprefetchable MMIO resource(s) above 4G. @see > FABRIC_ADDR_APERTURE > + FABRIC_ADDR_APERTURE > PrefetchableMmioSizeAbove4G[MAX_SOCKETS_SUPPORTED][MAX_RBS_PER > _SOCKET]; ///< Prefetchable MMIO resource(s) above 4G. @see > FABRIC_ADDR_APERTURE > + FABRIC_ADDR_APERTURE > NonPrefetchableMmioSizeBelow4G[MAX_SOCKETS_SUPPORTED][MAX_RBS_ > PER_SOCKET]; ///< Nonprefetchable MMIO resource(s) below 4G. @see > FABRIC_ADDR_APERTURE > + FABRIC_ADDR_APERTURE > PrefetchableMmioSizeBelow4G[MAX_SOCKETS_SUPPORTED][MAX_RBS_PER_ > SOCKET]; ///< Prefetchable MMIO resource(s) below 4G. @see > FABRIC_ADDR_APERTURE > + FABRIC_ADDR_APERTURE > PrimaryRbSecondNonPrefetchableMmioSizeBelow4G; = ///< > Primary RootBridge's second nonprefetchable MMIO size below 4G. @see > FABRIC_ADDR_APERTURE > + FABRIC_ADDR_APERTURE > PrimaryRbSecondPrefetchableMmioSizeBelow4G; = ///< > Primary RootBridge's second prefetchable MMIO size below 4G. @see > FABRIC_ADDR_APERTURE > + FABRIC_ADDR_APERTURE > IO[MAX_SOCKETS_SUPPORTED][MAX_RBS_PER_SOCKET]; > ///< IO resource(s) @see FABRIC_ADDR_APERTURE > + UINT16 > PciBusNumber[MAX_SOCKETS_SUPPORTED][MAX_RBS_PER_SOCKET]; > ///< PCI bus number(s). > +} FABRIC_RESOURCE_FOR_EACH_RB; > +#pragma pack (pop) > +#endif // FABRIC_RESOURCE_MANAGER_CMN_H_ > diff --git a/Platform/AMD/AgesaPkg/Include/Guid/AmdMemoryInfoHob.h > b/Platform/AMD/AgesaPkg/Include/Guid/AmdMemoryInfoHob.h > new file mode 100644 > index 0000000000..9e58f299b4 > --- /dev/null > +++ b/Platform/AMD/AgesaPkg/Include/Guid/AmdMemoryInfoHob.h > @@ -0,0 +1,96 @@ > +/** @file > + AMD Memory Info Hob Definition > + > + Copyright (C) 2023-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef AMD_MEMORY_INFO_HOB_H_ > +#define AMD_MEMORY_INFO_HOB_H_ > + > +/** > + * @brief 128 bit Buffer containing UID Unique Identifier value for Memo= ry > Info HOB. > + * EFI_GUID defined in UefiBaseType.h > + */ > +extern EFI_GUID gAmdMemoryInfoHobGuid; > + > +#pragma pack (push, 1) > + > +/** > + * @brief Memory descriptor structure for each memory range > + */ > +typedef struct { > + UINT64 Base; ///< Base addr= ess of memory rang > + UINT64 Size; ///< Size of m= emory rang > + UINT32 Attribute; ///< Attribute= of memory rang > + UINT32 Reserved; ///< For align= ment purpose > +} AMD_MEMORY_RANGE_DESCRIPTOR; > + > +/** > + * @brief Memory attribute in the memory range descriptor =3D AVAILABLE > + */ > +#define AMD_MEMORY_ATTRIBUTE_AVAILABLE 0x1 > + > +/** > + * @brief Memory attribute in the memory range descriptor =3D UMA > + */ > +#define AMD_MEMORY_ATTRIBUTE_UMA 0x2 > + > +/** > + * @brief Memory attribute in the memory range descriptor =3D MMIO > + */ > +#define AMD_MEMORY_ATTRIBUTE_MMIO 0x3 > + > +/** > + * @brief Memory attribute in the memory range descriptor =3D RESERVED > + */ > +#define AMD_MEMORY_ATTRIBUTE_RESERVED 0x4 > + > +/** > + * @brief Memory attribute in the memory range descriptor =3D GPUMEM > + */ > +#define AMD_MEMORY_ATTRIBUTE_GPUMEM 0x5 > + > +/** > + * @brief Memory attribute in the memory range descriptor =3D GPU_SP > + */ > +#define AMD_MEMORY_ATTRIBUTE_GPU_SP 0x6 > + > +/** > + * @brief Memory attribute in the memory range descriptor =3D > GPU_RESERVED > + */ > +#define AMD_MEMORY_ATTRIBUTE_GPU_RESERVED 0x7 > + > +/** > + * @brief Memory attribute in the memory range descriptor =3D > GPU_RESERVED_TMR > + */ > +#define AMD_MEMORY_ATTRIBUTE_GPU_RESERVED_TMR 0x8 > + > +/** > + * @brief Memory attribute in the memory range descriptor =3D > RESERVED_SMUFEATURES > + */ > +#define AMD_MEMORY_ATTRIBUTE_Reserved_SmuFeatures 0x9 > + > +/// Memory info HOB structure > +typedef struct { > + UINT32 Version; ///< Version o= f HOB structure > + BOOLEAN AmdMemoryVddioValid; ///< This fiel= d > determines if Vddio is valid > + UINT16 AmdMemoryVddio; ///< Vddio Vol= tage > + BOOLEAN AmdMemoryVddpVddrValid; ///< This fiel= d > determines if VddpVddr is valid > + UINT8 AmdMemoryVddpVddr; ///< VddpVddr = voltage > + BOOLEAN AmdMemoryFrequencyValid; ///< Memory > Frequency Valid > + UINT32 AmdMemoryFrequency; ///< Memory Fr= quency > + UINT32 AmdMemoryDdrMaxRate; ///< Memory > DdrMaxRate > + UINT32 NumberOfDescriptor; ///< Number of= memory > range descriptor > + AMD_MEMORY_RANGE_DESCRIPTOR Ranges[1]; ///< Memory > ranges array > +} AMD_MEMORY_INFO_HOB; > + > +#pragma pack (pop) > + > +/** > + * @brief Macro that defines the Memory Info HOB version > + */ > +#define AMD_MEMORY_INFO_HOB_VERISION 0x00000110ul // Ver: > 00.00.01.10 > + > +#endif // AMD_MEMORY_INFO_HOB_H_ > diff --git a/Platform/AMD/AgesaPkg/Include/Library/AmdPspBaseLibV2.h > b/Platform/AMD/AgesaPkg/Include/Library/AmdPspBaseLibV2.h > new file mode 100644 > index 0000000000..d144a4ad20 > --- /dev/null > +++ b/Platform/AMD/AgesaPkg/Include/Library/AmdPspBaseLibV2.h > @@ -0,0 +1,51 @@ > +/** @file > + AMD Psp Base Lib > + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef AMD_PSP_BASELIB_V2_H_ > +#define AMD_PSP_BASELIB_V2_H_ > + > +#include > + > +#define MAX_IMAGE_SLOT_COUNT 32 > + > +#define ALIGNMENT_4K BASE_4KB > +#define ALIGN_CHECK(addr, alignment) ((((UINTN)(addr)) & ((alignment) -= 1)) > =3D=3D 0) > +#define ALIGN_4K_CHECK(addr) ALIGN_CHECK((addr), ALIGNMENT_4K) > + > +#define IS_VALID_ADDR32(addr) (((UINT32)(addr) !=3D 0) && > (UINT32)(addr) !=3D 0xFFFFFFFF) > + > +#pragma pack (push, 1) > + > +#define FIRMWARE_TABLE_SIGNATURE 0x55AA55AAul > + > +/// Define the structure OEM signature table > +typedef struct _FIRMWARE_ENTRY_TABLEV2 { > + UINT32 Signature; ///< 0x00 Signature should be 0x55AA55AA= ul > + UINT32 ImcRomBase; ///< 0x04 Base Address for Imc Firmware > + UINT32 GecRomBase; ///< 0x08 Base Address for Gmc Firmware > + UINT32 XHCRomBase; ///< 0x0C Base Address for XHCI Firmware > + UINT32 LegacyPspDirBase; ///< 0x10 Base Address of PSP directory > + UINT32 PspDirBase; ///< 0x14 Base Address for PSP directory > + UINT32 Reserved1; ///< 0x18 Base Address for Reserved BIOS > directory > + UINT32 Reserved2; ///< 0x1C Base Address for Reserved BIOS > directory > + UINT32 Reserved3; ///< 0x20 Base Address for Reserved BIOS > directory > + UINT32 Config; ///< 0x24 reserved for EFS Configuration > + UINT32 NewBiosDirBase; ///< 0x28 Generic Base address for all > program > + UINT32 PspDirBackupBase; ///< 0x2C Backup PSP directory address f= or > all programs > +} FIRMWARE_ENTRY_TABLEV2; > + > +/// It also used as structure to store ISH generic information across pr= ograms > +typedef struct { > + UINT32 Priority; > + UINT32 UpdateRetries; > + UINT32 GlitchRetries; > + UINT32 ImageSlotAddr; > +} IMAGE_SLOT_HEADER; > + > +#pragma pack (pop) > + > +#endif // AMD_LIB_H_ > diff --git a/Platform/AMD/AgesaPkg/Include/Library/AmdPspFtpmLib.h > b/Platform/AMD/AgesaPkg/Include/Library/AmdPspFtpmLib.h > new file mode 100644 > index 0000000000..23c90b65c2 > --- /dev/null > +++ b/Platform/AMD/AgesaPkg/Include/Library/AmdPspFtpmLib.h > @@ -0,0 +1,83 @@ > +/** @file > + AMD Psp Ftpm Library header file > + > + Copyright (C) 2023-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef PSP_FTPM_LIB_H_ > +#define PSP_FTPM_LIB_H_ > +#include > + > +/* SYSTEM_TPM_CONFIG_VAL > + * Value range for APCB_TOKEN_UID_PSP_SYSTEM_TPM_CONFIG > + */ > +typedef enum { > + SYSTEM_TPM_CONFIG_DTPM =3D 0x00, ///< dTPM > + SYSTEM_TPM_CONFIG_PSP_FTPM =3D 0x01, ///< PSP FTPM > + SYSTEM_TPM_CONFIG_HSP_FTPM =3D 0x02, ///< HSP FTPM > + SYSTEM_TPM_CONFIG_NONE =3D 0xFF, ///< None of TPM > +} SYSTEM_TPM_CONFIG_VAL; > + > +#pragma pack (push, 1) > +/// Define TPM_2_CONTROL_AREA > +typedef struct { > + // Interface Identifier > + volatile UINT64 InterfaceIdentifier; ///< Interface Identif= ier > + // TPM2 Control Area Extension > + volatile UINT32 Clear; ///< Clear > + volatile UINT32 RemainingBytes; ///< RemainingBytes > + volatile UINT32 StatusReserved; ///< StatusReserved > + volatile UINT32 StatusError; ///< StatusError > + volatile UINT32 StatusCancel; ///< StatusCancel > + volatile UINT32 StatusStart; ///< StatusStart > + UINT64 InterruptControl; ///< InterruptControl > + UINT32 CommandSize; ///< CommandSize > + EFI_PHYSICAL_ADDRESS CommandAddress; ///< CommandAddress > + UINT32 ResponseSize; ///< ResponseSize > + EFI_PHYSICAL_ADDRESS ResponseAddress; ///< ResponseAddress > + // Memory Absent command/response buffer > + volatile UINT32 CmdRespHWBuffer; ///< Cmd/Rsp HW Buffer > +} TPM2_CONTROL_AREA; > + > +#pragma pack (pop) > + > +/** > + GET TPM related Info > + > + @param[in,out] FtpmStatus Used to hold more detail info (= Unused > Currently) > + > + @return EFI_SUCCESS Ftpm function supported > + @return EFI_UNSUPPORTED Ftpm function unsupported > + > +**/ > +EFI_STATUS > +FtpmGetInfo ( > + IN OUT UINTN *FtpmStatus > + ); > + > +/** > + Execute a TPM command > + > + @param[in] CommandBuffer Point to the TPM command buff= er > + @param[in] CommandSize Size of the TPM command buffe= r > + @param[in, out] ResponseBuffer Point to the TPM respons= e buffer > + @param[in, out] ResponseSize Size of the TPM response= buffer > + > + @return EFI_SUCCESS Command executed successfully > + @return EFI_UNSUPPORTED Device unsupported > + @return EFI_TIMEOUT Command fail due the time out > + @return EFI_DEVICE_ERROR Command fail due the error st= atus set > + @return EFI_BUFFER_TOO_SMALL Response buffer too small to = hold > the response > + > +**/ > +EFI_STATUS > +FtpmExecuteCommand ( > + IN VOID *CommandBuffer, > + IN UINT32 CommandSize, > + IN OUT VOID *ResponseBuffer, > + IN OUT UINT32 *ResponseSize > + ); > + > +#endif //PSP_FTPM_LIB_H_ > diff --git a/Platform/AMD/AgesaPkg/Include/Library/AmdPspRomArmorLib.h > b/Platform/AMD/AgesaPkg/Include/Library/AmdPspRomArmorLib.h > new file mode 100644 > index 0000000000..4ad4020f95 > --- /dev/null > +++ b/Platform/AMD/AgesaPkg/Include/Library/AmdPspRomArmorLib.h > @@ -0,0 +1,231 @@ > +/** @file > + > + Copyright (C) 2019-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef _PSP_ROM_ARMOR_LIB_H_ > +#define _PSP_ROM_ARMOR_LIB_H_ > + > +#include "Uefi.h" > + > +#define PSP_MAX_SPI_CMD_SUPPORT (4) ///< Max number of SP= I > command support > +#define PSP_MAX_SPI_DATA_BUFFER_SIZE (72) ///< Max SPI Command > Data Buffer Size > +#define PSP_MAX_WHITE_LIST_CMD_NUM (32) ///< Max White list > allowed command array number support > +#define PSP_MAX_WHITE_LIST_REGION_NUM (16) ///< Max White list > allowed region array number support > + > +#define SPI_CHIP_SELECT_ALL (0) ///< Allowed on all c= hip selects > +#define SPI_CHIP_SELECT_1 (1) ///< Chip Select 1 > +#define SPI_CHIP_SELECT_2 (2) ///< Chip Select 2 > + > +#define SPI_COMMAND_FREQUENCY_66_66MHZ (0) ///< 0=3D66.66MHz > +#define SPI_COMMAND_FREQUENCY_33_33MHZ (1) ///< 1=3D33.33MHz > +#define SPI_COMMAND_FREQUENCY_22_22MHZ (2) ///< 2=3D22.22MHz > +#define SPI_COMMAND_FREQUENCY_16_66MHZ (3) ///< 3=3D16.66MHz > +#define SPI_COMMAND_FREQUENCY_100MHZ (4) ///< 4=3D100MHz > +#define SPI_COMMAND_FREQUENCY_800KHZ (5) ///< 5=3D800KHz > + > +#define SPI_COMMAND_NOT_PROCEDDED (0) ///< 0 =3D Command no= t > examined/processed > +#define SPI_COMMAND_COMPLETED (1) ///< 1 =3D Command > completed successfully > +#define SPI_COMMAND_EXECUTION_ERROR (2) ///< 2 =3D Execution > Error (i.e. timeout) > +#define SPI_COMMAND_NOT_ALLOWED (3) ///< 3 =3D Command no= t > allowed by Whitelist > +#define SPI_COMMAND_MALFORMED (4) ///< 4 =3D Command > malformed > + > +#pragma pack (push, 1) > + > +typedef struct { > + UINT8 ChipSelect; ///< 1 =3D CS1, 2 =3D CS2, all other values i= llegal > + > + UINT8 Frequency; ///< 0=3D66.66MHz, 1=3D33.33MHz, 2=3D22.22MHz= , > + ///< 3=3D16.66MHz, 4=3D100Mhz, 5=3D800KHz, al= l others illegal > + > + UINT8 BytesToTx; ///< Bytes to Transmit, valid range is 0-72. = Does not > include the > + ///< SPI Opcode byte, but does include the ad= dress, dummy > bytes, and > + ///< data. > + > + UINT8 BytesToRx; ///< Bytes to Receive from device, BytesToTx = + > BytesToRx <=3D 72 > + > + UINT8 OpCode; ///< The SPI Command OpCode (the first byte s= ent by > the SPI controller) > + > + UINT8 Reserved[3]; ///< Reserved for future expansion > + > + UINT8 Buffer[PSP_MAX_SPI_DATA_BUFFER_SIZE]; ///< The remaining > 0-72 bytes sent/received by the SPI controller. > + ///< > + ///< The SPI Contro= ller will > + ///< 1. Assert th= e ChipSelect > + ///< 2. Send the = one byte OpCode > + ///< 3. Send Buff= er[0] to Buffer[BytesToTx-1] > to the SPI device > + ///< 4. Read Byte= sToRx bytes from the device > into Buffer[BytesToTx] to > + ///< Buffer[By= tesToTx+BytesToRx-1] > + ///< 5. Deassert = the ChipSelect line > + ///< > + ///< SPI ROM Comman= ds that include a target > address send the address > + ///< immediately af= ter the OpCode (i.e. > Buffer[0..2] or Buffer[0..3] > + ///< depending if 2= 4 or 32bit addresses are > associated with the OpCode). > + ///< See the SPI RO= M Device's datasheet for > full details on your > + ///< devices comman= ds and formats. > +} SPI_COMMAND; ///< The struct of = Spi Command > + > +typedef union { > + struct { > + ///< SPI_COMMUNICATION_RESULT > + UINT16 Command0Result : 4; ///< Result[ 3: 0] The resul= t of > Command[0] > + UINT16 Command1Result : 4; ///< Result[ 7: 4] The resul= t of > Command[1] > + UINT16 Command2Result : 4; ///< Result[11: 8] The resul= t of > Command[2] > + UINT16 Command3Result : 4; ///< Result[15:12] The resul= t of > Command[3] > + } Field; ///< the struct type of Comm= and0 ~ Command4 > + UINT16 Value; ///< 16 bit value of Command= 0 ~ Command4 > +} SPI_COMMUNICATION_RESULT; ///< The union struct type o= f Spi > Communication Result > + > +typedef struct { > + UINT8 ReadyToRun; ///< Set to FALSE by x86 while= the buffer is > being constructed. Set to > + ///< TRUE by x86 as the last s= tep in building the > communication buffer, > + ///< just before x86 rings the= PSP doorbell. > + ///< > + ///< Set to FALSE by PSP after= the PSP copies the > buffer from DRAM to > + ///< private SRAM. > + > + UINT8 CommandCount; ///< Number of commands to e= xecute, > Valid Values 1-4 > + > + SPI_COMMUNICATION_RESULT SpiCommunicationResult; ///< Set to zero > by x86 when the buffer is built. Atomically set to a > + ///< non-zero valu= e by the PSP to indicate the > PSP has finished > + ///< processing th= e requests in the > communication buffer. The specific > + ///< value written= by the PSP provides per > command results > + ///< > + ///< Result values= with special meaning: > + ///< 0x0000 =3D (w= ritten by x86) PSP has not > finished handling the request > + ///< 0x1000 =3D PS= P determined the request is > malformed (invalid > + ///< Comm= andCount, chipselect, > BytesToRx/Tx, etc) > + ///< 0x2000, 0x300= 0, 0x4000, ... , 0xF000 =3D > Reserved for future errors > + ///< > + ///< Generic Resul= t values: > + ///< SpiCommunic= ationResult[ 3: 0] The > result of Command[0] > + ///< SpiCommunic= ationResult[ 7: 4] The > result of Command[1] > + ///< SpiCommunic= ationResult[11: 8] The > result of Command[2] > + ///< SpiCommunic= ationResult[15:12] The > result of Command[3] > + ///< 0 =3D Co= mmand not examined/processed > + ///< 1 =3D Co= mmand completed successfully > + ///< 2 =3D Ex= ecution Error (i.e. timeout) > + ///< 3 =3D Co= mmand not allowed by Whitelist > + ///< 4 =3D Co= mmand malformed > + ///< 5-15 =3D= reserved for future use > + ///< > + ///< Examples of G= eneric Results: > + ///< 0x0000 - PS= P has not finished the > request > + ///< 0x0001 - PS= P ran Command0 > successfully, and is now idle > + ///< 0x0111 - PS= P ran Command0/1/2 > successfully and is now idle > + ///< 0x0031 - PS= P ran Command0, but > Command1 was blocked by whitelist > + > + SPI_COMMAND SpiCommand[PSP_MAX_SPI_CMD_SUPPORT]; ///< Spi > command array > +} SPI_COMMUNICATION_BUFFER; ///< The struct ty= pe of Spi > Communication Buffer > + > +typedef struct { > + UINT8 ChipSelect; ///< 0=3D Allowed on all chip selects, 1=3D C= S1, 2=3D CS2, all > else invalid > + > + UINT8 Frequency; ///< The allowed frequency for the command > + ///< 0=3D66.66MHz, 1=3D33.33MHz, 2=3D22.22MHz= , > + ///< 3=3D16.66MHz, 4=3D100Mhz, 5=3D800KHz, al= l others illegal > + > + UINT8 OpCode; ///< The allowed commands opcode > + > + UINT8 MinTx; ///< The minimum range of allowed transmit by= te > counts for this command > + ///< (does not include opcode) > + UINT8 MaxTx; ///< The maximum range of allowed transmit by= te > counts for this command > + ///< (does not include opcode) > + > + UINT8 MinRx; ///< The minimum range of allowed Rx byte cou= nts > + UINT8 MaxRx; ///< The maximum range of allowed Rx byte cou= nts > + > + UINT8 AddrChkMethod; ///< 0=3DNo address verification performed > + ///< 1=3DTreat Buffer[0-2] as a 24-bit addres= s, and verify the > entire > + ///< ImpactZone of the command falls within= one of the > allowed regions > + ///< 2=3DTreat Buffer[0-3] as a 32-bit addres= s, and verify the > entire > + ///< ImpactZone of the command falls within= one of the > allowed regions > + > + UINT32 ImpactSize; ///< The Impact Zone is the naturally aligned= power > of two sized block > + ///< of addresses that may be impacted by a g= iven SPI > Command. For > + ///< example, a sector erase command targeted= at an address > within a > + ///< 64K block will impact every byte within = that 64K block. > Likewise > + ///< a page program SPI command (i.e. write) = may impact > many bytes > + ///< within the targeted 256/512 byte page du= e to page > wrap-around, but > + ///< no bytes outside the page. The ImapctSiz= e field specifies > the power > + ///< of two size of the ImpactZone for this c= ommand. If > VerifyAddress is > + ///< zero (no checking) this field must also = be zero, otherwise > this > + ///< field must be a power of two between 256= and 64MB > (256, 512, ..., > + ///< 67108864). NOTE: When setting this field= , carefully > examine your > + ///< device's datasheet. > + ///< > +} WHITE_LIST_ALLOWED_COMMAND; ///< The struct type of White List > Allowed Command > + > +typedef struct { > + // 8 bytes > + UINT32 StartAddress; ///< LSB must be 0x00, bit31 identifies a > chipselect: 0=3DCS1, 1=3DCS2 > + UINT32 EndAddress; ///< LSB must be 0xFF, StartAddress must b= e less > than EndAddress > +} WHITE_LIST_ALLOWED_REGION; ///< The struct type of White List Allowed > Region > + > +typedef struct { > + UINT8 AllowedCmdCount; = ///< Allow > Command Count > + UINT8 AllowedRegionCount; = ///< Allow > Region Count > + WHITE_LIST_ALLOWED_COMMAND > WhitelistAllowedCommands[PSP_MAX_WHITE_LIST_CMD_NUM]; ///< White > List Allowed Command Table > + WHITE_LIST_ALLOWED_REGION > WhitelistAllowedRegions[PSP_MAX_WHITE_LIST_REGION_NUM]; ///< White > List Allowed Region Table > +} SPI_WHITE_LIST; ///< The struct type of Spi White List > + > +#pragma pack (pop) > + > +/** > + * @brief Request secures the SPI Controller > + * > + * @param[in,out] SpiCommunicationBuffer Spi Communication Structure > Buffer pointer > + * > + * @retval EFI_SUCCESS Initial success > + * @retval Others Error happens during initialize > + */ > +EFI_STATUS > +EFIAPI > +PspEnterSmmOnlyMode ( > + IN OUT SPI_COMMUNICATION_BUFFER *SpiCommunicationBuffer > + ); > + > +/** > + * @brief Loads the whitelist into the PSP. > + * > + * @param[in] SpiWhitelist SPI white list structure buffer pointer. > + * > + * @retval EFI_SUCCESS Initial success > + * @retval Others Error happens during initialize > + */ > +EFI_STATUS > +EFIAPI > +PspEnforceWhitelist ( > + IN SPI_WHITE_LIST *SpiWhitelist > + ); > + > +/** > + * @brief Request execute SPI command provide in TSEG comm buffer. > + * > + * @retval EFI_SUCCESS Initial success > + * @retval Others Error happens during initialize > + */ > +EFI_STATUS > +EFIAPI > +PspExecuteSpiCommand ( > + VOID > + ); > + > +/** > + * @brief Request PSP firmware switch SPI controller chip select. > + * > + * @param[in] Chipset SPI controller chip select, 0=3D Allowed on al= l chip > selects, 1=3D CS1, 2=3D CS2, all else invalid > + * > + * @retval EFI_SUCCESS Initial success > + * @retval Others Error happens during initialize > + */ > +EFI_STATUS > +EFIAPI > +PspSwitchChipSelect ( > + IN UINT8 ChipSelect > + ); > + > +#endif //_PSP_ROM_ARMOR_LIB_H_ > diff --git a/Platform/AMD/AgesaPkg/Include/Library/AmlGenerationLib.h > b/Platform/AMD/AgesaPkg/Include/Library/AmlGenerationLib.h > new file mode 100644 > index 0000000000..0189910bd1 > --- /dev/null > +++ b/Platform/AMD/AgesaPkg/Include/Library/AmlGenerationLib.h > @@ -0,0 +1,2722 @@ > +/** @file > + > + Copyright (C) 2019-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef AML_LIB_H_ > +#define AML_LIB_H_ > + > +#include > +#include > + > +typedef enum { > + AmlStart, > + AmlClose, > + AmlInvalid > +} AML_FUNCTION_PHASE; > + > +#define AML_OBJECT_INSTANCE_SIGNATURE SIGNATURE_32 ('a', 'm', 'l', 'o') > + > +// > +// Device Status Bitmap (Section 6.3.7 ACPI version 6.3) > +// Bit [0] - Set if the device is present. > +// Bit [1] - Set if the device is enabled and decoding its resources. > +// Bit [2] - Set if the device should be shown in the UI. > +// Bit [3] - Set if the device is functioning properly (cleared if de= vice > +// failed its diagnostics). > +// Bit [4] - Set if the battery is present. > +// Bits [31:5] - Reserved (must be cleared). > +// > +#define DEVICE_PRESENT_BIT 0x0001 > +#define DEVICE_ENABLED_BIT 0x0002 > +#define DEVICE_IN_UI_BIT 0x0004 > +#define DEVICE_HEALTH_BIT 0x0008 > +#define DEVICE_BATTERY_BIT 0x0010 // Control Method Battery Devi= ce > Only > + > +typedef enum { > + UnknownObj, > + IntObj, > + StrObj, > + BuffObj, > + PkgObj, > + FieldUnitObj, > + DeviceObj, > + EventObj, > + MethodObj, > + MutexObj, > + OpRegionObj, > + PowerResObj, > + ProcessorObj, > + ThermalZoneObj, > + BuffFieldObj, > + DDBHandlObj, > + InvalidObj > +} OBJECT_TYPE_KEYWORD; > + > +typedef struct { > + UINT32 Signature; > + BOOLEAN Completed; > + UINTN DataSize; > + UINT8 *Data; > + LIST_ENTRY Link; > +} AML_OBJECT_INSTANCE; > + > +// > ************************************************************ > *************** > +// AML defines to be consistent with already existing > +// MdePkg/Include/IndustryStandard/Acpi*.h defines. > +// *** These could be upstreamed at some point. > +// > ************************************************************ > *************** > +// Limits of (DWord|Word|QWord)Space ResourceType > +#define EFI_ACPI_SPACE_RESOURCE_TYPE_MIN 0xC0 > +#define EFI_ACPI_SPACE_RESOURCE_TYPE_MAX 0xFF > + > +// General Flags: Flags that are common to all resource types > +// Bits[7:4] Reserved(must be 0) > +// Bit[3] Max Address Fixed, _MAF: > +// 1 The specified maximum address is fixed > +// 0 The specified maximum address is not fixed and can be changed > +#define EFI_ACPI_GENERAL_FLAG_MAX_IS_FIXED (1 << 3) > +#define EFI_ACPI_GENERAL_FLAG_MAX_IS_NOT_FIXED (0 << 3) > +#define EFI_ACPI_GENERAL_FLAG_MASK_MAF > EFI_ACPI_GENERAL_FLAG_MAX_IS_FIXED > +// Bit[2] Min Address Fixed, _MIF: > +// 1 The specified minimum address is fixed > +// 0 The specified minimum address is not fixed and can be changed > +#define EFI_ACPI_GENERAL_FLAG_MIN_IS_FIXED (1 << 2) > +#define EFI_ACPI_GENERAL_FLAG_MIN_IS_NOT_FIXED (0 << 2) > +#define EFI_ACPI_GENERAL_FLAG_MASK_MIF > EFI_ACPI_GENERAL_FLAG_MIN_IS_FIXED > +// Bit[1] Decode Type, _DEC: > +// 1 This bridge subtractively decodes this address(top level bridge= s only) > +// 0 This bridge positively decodes this address > +#define EFI_ACPI_GENERAL_FLAG_DECODE_SUBTRACTIVE (1 << 1) > +#define EFI_ACPI_GENERAL_FLAG_DECODE_POSITIVE (0 << 1) > +#define EFI_ACPI_GENERAL_FLAG_MASK_DEC > EFI_ACPI_GENERAL_FLAG_DECODE_SUBTRACTIVE > +// Bit[0] Consumer / Producer: > +// 1 This device consumes this resource > +// 0 This device produces and consumes this resource > +#define EFI_ACPI_GENERAL_FLAG_RESOURCE_CONSUMER (1 << 0) > +#define EFI_ACPI_GENERAL_FLAG_RESOURCE_PRODUCER (0 << 0) > +#define EFI_ACPI_GENERAL_FLAG_MASK_USAGE > EFI_ACPI_GENERAL_FLAG_RESOURCE_CONSUMER > + > +// Memory Resource Flag (Resource Type =3D 0) DefinitionsBits > +// Memory Resource Flag Masks > +// Bits[7:6] Reserved(must be 0) > +// Bit[5] Memory to I/O Translation, _TTP: > +// 0 TypeStatic > +// 1 Type Translation > +#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_MASK_TTP (1 << 5) > +// Bit[4:3] Memory Attributes, _MTP: > +// 0 AddressRangeMemory > +// 1 AddressRangeReserved > +// 2 AddressRangeACPI > +// 3 AddressRangeNVS > +#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_MASK_MTP (3 << 3) > +// Bit[2:1] Memory Attributes, _MEM: > +// 0 The memory is non-cacheable > +// 1 The memory is cacheable > +// 2 The memory is cacheable and supports write-combining > +// 3 The memory is cacheable and prefetchable > +#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_MASK_MEM (3 << 1) > +// Bit[0] Write Status, _RW: > +// 0 This memory range is read-only > +// 1 This memory is read-write > +#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_MASK_RW (1 << 0) > + > +// I/O Resource Flag (Resource Type =3D 1) DefinitionsBits > +// I/O Resource Flags > +// Bit [7:6] Reserved (must be 0) > +// Bit [5] Sparse Translation, _TRS. This bit is only meaningful if Bi= t [4] is set. > +// 1 SparseTranslation: The primary-side memory address of any speci= fic > I/O port > +// within the secondary-side range can be found using the followin= g > function. > +// address =3D (((port & 0xFFFc) << 10) || (port & 0xFFF)) + _TRA = In the > address > +// used to access the I/O port, bits[11:2] must be identical to bi= ts[21:12], > +// this gives four bytes of I/O ports on each 4 KB page. > +// 0 DenseTranslation: The primary-side memory address of any specif= ic > I/O port > +// within the secondary-side range can be found using the followin= g > function. > +// address =3D port + _TRA > +#define EFI_ACPI_IO_RESOURCE_SPECIFIC_FLAG_SPARSE_TRANSLATION (1 > << 5) > +#define EFI_ACPI_IO_RESOURCE_SPECIFIC_FLAG_DENSE_TRANSLATION (0 > << 5) > +// Bit [4] I/O to Memory Translation, _TTP > +// 1 TypeTranslation: This resource, which is I/O on the secondary s= ide of > the > +// bridge, is memory on the primary side of the bridge. > +// 0 TypeStatic: This resource, which is I/O on the secondary side o= f the > +// bridge, is also I/O on the primary side of the bridge. > +#define EFI_ACPI_IO_RESOURCE_SPECIFIC_FLAG_TYPE_TRANSLATION (1 << > 4) > +#define EFI_ACPI_IO_RESOURCE_SPECIFIC_FLAG_TYPE_STATIC (0 << 4) > +// Bit [3:2] Reserved (must be 0) > +// Bit [1:0] _RNG > +// 3 Memory window covers the entire range > +// 2 ISARangesOnly. This flag is for bridges on systems with multipl= e > bridges. > +// Setting this bit means the memory window specified in this desc= riptor > is > +// limited to the ISA I/O addresses that fall within the specified= window. > The > +// ISA I/O ranges are: n000-n0FF, n400-n4FF, n800-n8FF, nC00-nCFF.= This > bit can > +// only be set for bridges entirely configured throughACPI namespa= ce. > +// 1 NonISARangesOnly. This flag is for bridges on systems with mult= iple > +// bridges. Setting this bit means the memory window specified in = this > +// descriptor is limited to the non-ISA I/O addresses that fall wi= thin the > +// specified window. The non-ISA I/O ranges are: n100-n3FF, n500-n= 7FF, > +// n900-nBFF, nD00-nFFF. This bit can only be set for bridges enti= rely > +// configured through ACPI namespace. > +// 0 Reserved > +#define EFI_ACPI_IO_RESOURCE_SPECIFIC_FLAG_TYPE_RANGE_ENTIRE > (3 << 0) > +#define EFI_ACPI_IO_RESOURCE_SPECIFIC_FLAG_TYPE_RANGE_ISA_ONLY > (2 << 0) > +#define > EFI_ACPI_IO_RESOURCE_SPECIFIC_FLAG_TYPE_RANGE_NON_ISA_ONLY (1 << > 0) > + > +#define AML_OBJECT_INSTANCE_FROM_LINK(a) BASE_CR (a, > AML_OBJECT_INSTANCE, Link) > + > +// Method Serialize Flag Values > +typedef enum { > + NotSerialized, > + Serialized, > + FlagInvalid > +} METHOD_SERIALIZE_FLAG; > +// AccessField Access Attrib Flags. > +// Ref ACPI spec 6.3 > +#define EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_NORMAL > 0x00 > +#define EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_QUICK > 0x02 > +#define EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_SEND_RECEIVE > 0x04 > +#define EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_BYTE 0x= 06 > +#define EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_WORD > 0x08 > +#define EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_BLOCK > 0x0A > +#define EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_BYTES 0x= 0B > +#define EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_PROCESS_CALL > 0x0C > +#define > EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_BLOCK_PROCESS_CALL > 0x0D > +#define EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_RAW_BYTES > 0x0E > +#define > EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_RAW_PROCESS_BYTES > 0X0F > + > +// AccessField access types > +typedef enum { > + AnyAcc, > + ByteAcc, > + WordAcc, > + DWordAcc, > + QWordAcc, > + BufferAcc, > +} EFI_ACPI_FIELD_ACCESS_TYPE_KEYWORDS; > + > +// Field lock rules > +typedef enum { > + NoLock, > + Lock > +} EFI_ACPI_FIELD_LOCK_RULE_KEYWORDS; > + > +// Field update rules > +typedef enum { > + Preserve, > + WriteAsOnes, > + WriteAsZeros > +} EFI_ACPI_FIELD_UPDATE_RULE_KEYWORDS; > + > +// Field access attributes. for AttribBytes, AttribRawBytes and > AttribRawProcessBytes > +// the ExtendedAccessField definition is used, as this is what iASL comp= iles > into, rather > +// than the AccessField that is specified in the ACPI spec. > +typedef enum { > + AttribNormal =3D > EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_NORMAL, > + AttribQuick =3D EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_Q= UICK, > + AttribSendReceive =3D > EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_SEND_RECEIVE, > + AttribByte =3D EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_B= YTE, > + AttribWord =3D > EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_WORD, > + AttribBlock =3D EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_B= LOCK, > + AttribBytes =3D EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_B= YTES, > + AttribProcessCall =3D > EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_PROCESS_CALL, > + AttribBlockProcessCall =3D > EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_BLOCK_PROCESS_CALL, > + AttribRawBytes =3D > EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_RAW_BYTES, > + AttribRawProcessBytes =3D > EFI_ACPI_FIELD_FLAGS_ACCESS_ATTRIB_ATTRIB_RAW_PROCESS_BYTES > +} EFI_ACPI_FIELD_ACCESS_ATTRIBUTE_KEYWORDS; > + > +// > +// Resource Type Specific Flags > +// Ref ACPI specification 6.4.3.5.5 > +// > +// > +// DMA Information > +// Ref ACPI specification 6.4.2.2 > +// > +// DmaType values > +typedef enum { > + Compatibility =3D EFI_ACPI_DMA_SPEED_TYPE_COMPATIBILITY, > + TypeA =3D EFI_ACPI_DMA_SPEED_TYPE_A, > + TypeB =3D EFI_ACPI_DMA_SPEED_TYPE_B, > + TypeF =3D EFI_ACPI_DMA_SPEED_TYPE_F > +} EFI_ACPI_DMA_SPEED_TYPE_KEYWORDS; > + > +// IsBusMaster values > +typedef enum { > + NotBusMaster =3D 0, > + BusMaster =3D EFI_ACPI_DMA_BUS_MASTER > +} EFI_ACPI_DMA_BUS_MASTER_KEYWORDS; > + > +// DmaTransferSize values > +typedef enum { > + Transfer8 =3D EFI_ACPI_DMA_TRANSFER_TYPE_8_BIT, > + Transfer8_16 =3D EFI_ACPI_DMA_TRANSFER_TYPE_8_BIT_AND_16_BIT, > + Transfer16 =3D EFI_ACPI_DMA_TRANSFER_TYPE_16_BIT > +} EFI_ACPI_DMA_TRANSFER_TYPE_KEYWORDS; > + > +// > +// Interrupt Resource Descriptor Information > +// Ref ACPI specification 6.4.2.1 > +// > +// IRQ Information - Wake Capability > +// > +#define EFI_ACPI_IRQ_WAKE_CAPABLE_MASK 0x20 > +#define EFI_ACPI_IRQ_NOT_WAKE_CAPABLE 0x0 > +#define EFI_ACPI_IRQ_WAKE_CAPABLE 0x20 > + > +typedef enum { > + NotWakeCapable =3D EFI_ACPI_IRQ_NOT_WAKE_CAPABLE, > + WakeCapable =3D EFI_ACPI_IRQ_WAKE_CAPABLE > +} EFI_ACPI_IRQ_WAKE_CAPABILITY_KEYWORDS; > + > +// > +// IRQ Information - Interrupt Sharing > +// > +#define EFI_ACPI_IRQ_EXCLUSIVE 0x0 > + > +typedef enum { > + Exclusive =3D EFI_ACPI_IRQ_EXCLUSIVE, > + Shared =3D EFI_ACPI_IRQ_SHARABLE, > + ExclusiveAndWake =3D EFI_ACPI_IRQ_WAKE_CAPABLE | > EFI_ACPI_IRQ_EXCLUSIVE, > + SharedAndWake =3D EFI_ACPI_IRQ_WAKE_CAPABLE | > EFI_ACPI_IRQ_SHARABLE > +} EFI_ACPI_IRQ_INTERRUPT_SHARING_KEYWORDS; > + > +// > +// IRQ Information - Interrupt Polarity > +// > +typedef enum { > + ActiveHigh =3D EFI_ACPI_IRQ_HIGH_TRUE, > + ActiveLow =3D EFI_ACPI_IRQ_LOW_FALSE > +} EFI_ACPI_IRQ_INTERRUPT_POLARITY_KEYWORDS; > + > +// > +// IRQ Information - Interrupt Mode > +// > +#define EFI_ACPI_IRQ_MODE_MASK 0x1 > +typedef enum { > + LevelTriggered =3D EFI_ACPI_IRQ_LEVEL_TRIGGERED, > + EdgeTriggered =3D EFI_ACPI_IRQ_EDGE_TRIGGERED > +} EFI_ACPI_IRQ_INTERRUPT_MODE_KEYWORDS; > + > +// IO Port Descriptor Information > +// Ref ACPI specification 6.4.2.5 > +// > +typedef enum { > + Decode16 =3D EFI_ACPI_IO_DECODE_16_BIT, > + Decode10 =3D EFI_ACPI_IO_DECODE_10_BIT > +} EFI_ACPI_IO_PORT_DESCRIPTOR_INFORMATION; > + > +// > +// Memory Resource Information > +// Ref ACPI specification 6.4.3.5 > +// > +// Consumer/Producer Bit[0] > +typedef enum { > + ResourceProducer =3D EFI_ACPI_GENERAL_FLAG_RESOURCE_PRODUCER, > + ResourceConsumer =3D EFI_ACPI_GENERAL_FLAG_RESOURCE_CONSUMER > +} RESOURCE_USAGE_FLAG; > + > +// Decode Type (_DEC) Bit[1] > +typedef enum { > + PosDecode =3D EFI_ACPI_GENERAL_FLAG_DECODE_POSITIVE, > + SubDecode =3D EFI_ACPI_GENERAL_FLAG_DECODE_SUBTRACTIVE > +} MEM_DECODE_FLAG; > + > +// Min Address Fixed (_MIF) Bit[2] > +typedef enum { > + MinNotFixed =3D EFI_ACPI_GENERAL_FLAG_MIN_IS_NOT_FIXED, > + MinFixed =3D EFI_ACPI_GENERAL_FLAG_MIN_IS_FIXED > +} MIN_FIXED_FLAG; > + > +// Max Address Fixed (_MAF) Bit[3] > +typedef enum { > + MaxNotFixed =3D EFI_ACPI_GENERAL_FLAG_MAX_IS_NOT_FIXED, > + MaxFixed =3D EFI_ACPI_GENERAL_FLAG_MAX_IS_FIXED > +} MAX_FIXED_FLAG; > + > +// Memory Attributes (_MEM) Bits[2:1] > +typedef enum { > + NonCacheable =3D > EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_NON_CACHEABLE, > + Cacheable =3D EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE, > + WriteCombining =3D > EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_WRITE_COMBINI > NG, > + Prefetchable =3D > EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE > +} CACHEABLE_FLAG; > + > +// Write Status (_RW) Bit[0] > +typedef enum { > + ReadOnly =3D EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_READ_ONLY, > + ReadWrite =3D EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_READ_WRITE > +} READ_WRITE_FLAG; > + > +// Memory Attributes (_MTP) Bits[4:3] > +typedef enum { > + AddressRangeMemory =3D > EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_MEMORY, > + AddressRangeReserved =3D > EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_RESERVED, > + AddressRangeACPI =3D > EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_ACPI, > + AddressRangeNVS =3D > EFI_APCI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_NVS > +} MEMORY_RANGE_TYPE; > + > +// Memory to IO Translation (_TTP) Bit[5] > +// Note: IO and Memory Resources use different bits for this. > +// Value must be handled at function level when implemented. > +typedef enum { > + TypeStatic =3D 0, > + TypeTranslation =3D 1 > +} MEMORY_TRANSLATION_TYPE; > + > +// Memory Window Attributes (_RNG) Bits[1:0] > +typedef enum { > + Reserved =3D 0, > + NonISAOnly =3D > EFI_ACPI_IO_RESOURCE_SPECIFIC_FLAG_TYPE_RANGE_NON_ISA_ONLY, > + ISAOnly =3D > EFI_ACPI_IO_RESOURCE_SPECIFIC_FLAG_TYPE_RANGE_ISA_ONLY, > + EntireRange =3D > EFI_ACPI_IO_RESOURCE_SPECIFIC_FLAG_TYPE_RANGE_ENTIRE, > + ISARangeMax > +} IO_ISA_RANGES; > + > +// Generic Address Space Address IDs > +typedef enum { > + SystemMemory =3D EFI_ACPI_6_4_SYSTEM_MEMORY, > + SystemIO =3D EFI_ACPI_6_4_SYSTEM_IO, > + PCI_Config =3D EFI_ACPI_6_4_PCI_CONFIGURATION_SPACE, > + EmbeddedControl =3D EFI_ACPI_6_4_EMBEDDED_CONTROLLER, > + SMBus =3D EFI_ACPI_6_4_SMBUS, > + SystemCMOS =3D EFI_ACPI_6_4_SYSTEM_CMOS, > + PciBarTarget =3D EFI_ACPI_6_4_PCI_BAR_TARGET, > + IPMI =3D EFI_ACPI_6_4_IPMI, > + GeneralPurposeIO =3D EFI_ACPI_6_4_GENERAL_PURPOSE_IO, > + GenericSerialBus =3D EFI_ACPI_6_4_GENERIC_SERIAL_BUS, > + PCC =3D EFI_ACPI_6_4_PLATFORM_COMMUNICATION_CHANNEL, > + PlatformCommChannel =3D > EFI_ACPI_6_4_PLATFORM_COMMUNICATION_CHANNEL, > + FFixedHW =3D EFI_ACPI_6_4_FUNCTIONAL_FIXED_HARDWARE > +} GENERIC_ADDRESS_SPACE_ID; > + > +typedef enum { > + UndefinedSize =3D EFI_ACPI_6_4_UNDEFINED, > + ByteSize =3D EFI_ACPI_6_4_BYTE, > + WordSize =3D EFI_ACPI_6_4_WORD, > + DWordSize =3D EFI_ACPI_6_4_DWORD, > + QWordSize =3D EFI_ACPI_6_4_QWORD > +} ACPI_DATA_SIZE; > + > +typedef ACPI_DATA_SIZE GENERIC_ADDRESS_ACCESS_SIZE; > + > +// > ************************************************************ > *************** > +// AML Objects > +// > ************************************************************ > *************** > + > +// ---------------------------------------------------------------------= ------ > +// Table and Table Header Encoding > +// ---------------------------------------------------------------------= ------ > + > +/** > + Creates an AML Encoded Table > + Object must be created between AmlStart and AmlClose Phase > + > + DefBlockHeader :=3D TableSignature TableLength SpecCompliance CheckSu= m > OemID > + OemTableID OemRevision CreatorID CreatorRevision > + > + TableSignature :=3D DWordData // As defined in section 5.2.3. > + TableLength :=3D DWordData // Length of the table in bytes in= cluding > the > + // block header > + SpecCompliance :=3D ByteData // The revision of the structure. > + CheckSum :=3D ByteData // Byte checksum of the entire tab= le. > + OemID :=3D ByteData(6) // OEM ID of up to 6 characters. > + // If the OEM ID is shorter than 6 > + // characters, it can be terminated = with a > + // NULL character. > + OemTableID :=3D ByteData(8) // OEM Table ID of up to 8 charact= ers. > + // If the OEM Table ID is shorter th= an > + // 8 characters, it can be terminate= d with > + // a NULL character. > + OemRevision :=3D DWordData // OEM Table Revision. > + CreatorID :=3D DWordData // Vendor ID of the ASL compiler. > + CreatorRevision :=3D DWordData // Revision of the ASL compiler. > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] TableNameString - Table Name > + @param[in] ComplianceRev - Compliance Revision > + @param[in] OemId - OEM ID > + @param[in] OemTableId - OEM ID of table > + @param[in] OemRevision - OEM Revision number > + @param[in] CreatorId - Vendor ID of the ASL compiler > + @param[in] CreatorRevision - Vendor Revision of the ASL compiler > + @param[in,out] ListHead - Linked list has completed String Obj= ect after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlDefinitionBlock ( > + IN AML_FUNCTION_PHASE Phase, > + IN CHAR8 *TableNameString, > + IN UINT8 ComplianceRev, > + IN CHAR8 *OemId, > + IN CHAR8 *OemTableId, > + IN UINT32 OemRevision, > + IN CHAR8 *CreatorId, > + IN UINT32 CreatorRevision, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +// ---------------------------------------------------------------------= ------ > +// Name Objects Encoding > +// ---------------------------------------------------------------------= ------ > + > +/** > + Creates a Namestring AML Object and inserts it into the linked list > + > + Completes NameString in one call as "one phase" > + LeadNameChar :=3D 'A'-'Z' | '_' > + DigitChar :=3D '0'-'9' > + NameChar :=3D DigitChar | LeadNameChar > + RootChar :=3D '\' > + ParentPrefixChar :=3D '^' > + > + 'A'-'Z' :=3D 0x41 - 0x5A > + '_' :=3D 0x5F > + '0'-'9' :=3D 0x30 - 0x39 > + '\' :=3D 0x5C > + '^' :=3D 0x5E > + > + NameSeg :=3D > + // Notice that NameSegs shorter than 4 characters = are filled with > + // trailing underscores ('_'s). > + NameString :=3D | > + PrefixPath :=3D Nothing | <'^' PrefixPath> > + NamePath :=3D NameSeg | DualNamePath | MultiNamePath | NullNa= me > + > + DualNamePath :=3D DualNamePrefix NameSeg NameSeg > + DualNamePrefix :=3D 0x2E > + MultiNamePath :=3D MultiNamePrefix SegCount NameSeg(SegCount) > + MultiNamePrefix :=3D 0x2F > + > + SegCount :=3D ByteData > + > + Note:SegCount can be from 1 to 255. For example: MultiNamePrefix(35) i= s > + encoded as 0x2f 0x23 and followed by 35 NameSegs. So, the total > encoding > + length will be 1 + 1 + 35*4 =3D 142. Notice that: DualNamePrefix N= ameSeg > + NameSeg has a smaller encoding than the encoding of: > MultiNamePrefix(2) > + NameSeg NameSeg > + > + SimpleName :=3D NameString | ArgObj | LocalObj > + SuperName :=3D SimpleName | DebugObj | Type6Opcode > + NullName :=3D 0x00 > + Target :=3D SuperName | NullName > + > + @param[in] String - Null Terminated NameString Representation > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > + **/ > +EFI_STATUS > +EFIAPI > +AmlOPNameString ( > + IN CHAR8 *String, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +// ---------------------------------------------------------------------= ------ > +// Data Objects Encoding > +// ---------------------------------------------------------------------= ------ > + > +/** > + Creates an optimized integer object > + > + ComputationalData :=3D ByteConst | WordConst | DWordConst | > QWordConst | String | > + ConstObj | RevisionOp | DefBuffer > + DataObject :=3D ComputationalData | DefPackage | DefVarPackage > + DataRefObject :=3D DataObject | ObjectReference | DDBHandle > + ByteConst :=3D BytePrefix ByteData > + BytePrefix :=3D 0x0A > + WordConst :=3D WordPrefix WordData > + WordPrefix :=3D 0x0B > + DWordConst :=3D DWordPrefix DWordData > + DWordPrefix :=3D 0x0C > + QWordConst :=3D QWordPrefix QWordData > + QWordPrefix :=3D 0x0E > + ConstObj :=3D ZeroOp | OneOp | OnesOp > + ByteData :=3D 0x00 - 0xFF > + WordData :=3D ByteData[0:7] ByteData[8:15] > + // 0x0000-0xFFFF > + DWordData :=3D WordData[0:15] WordData[16:31] > + // 0x00000000-0xFFFFFFFF > + QWordData :=3D DWordData[0:31] DWordData[32:63] > + // 0x0000000000000000-0xFFFFFFFFFFFFFFFF > + ZeroOp :=3D 0x00 > + OneOp :=3D 0x01 > + OnesOp :=3D 0xFF > + > + @param[in] Phase - Example: AmlStart, AmlClose > + @param[in] Integer - Number to be optimized and encoded > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPDataInteger ( > + IN UINT64 Integer, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a ByteData integer object for use in Buffer objects. Does not > + include opcode. > + > + ByteData :=3D 0x00 - 0xFF > + > + @param[in] Integer - Number to be placed in object > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPByteData ( > + IN UINT8 Integer, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a WordData integer object for use in Buffer objects. Does not > + include opcode. > + > + WordData :=3D 0x0000 - 0xFFFF > + > + @param[in] Integer - Number to be placed in object > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPWordData ( > + IN UINT16 Integer, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a DWordData integer object for use in Buffer objects. Does no= t > + include opcode. > + > + DWordData :=3D 0x00000000 - 0xFFFFFFFF > + > + @param[in] Integer - Number to be placed in object > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPDWordData ( > + IN UINT32 Integer, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a QWordData integer object for use in Buffer objects. Does no= t > + include opcode. > + > + QWordData :=3D 0x00000000_00000000 - 0xFFFFFFFF_FFFFFFFF > + > + @param[in] Integer - Number to be placed in object > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPQWordData ( > + IN UINT64 Integer, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a data string object > + > + ComputationalData :=3D String > + > + String :=3D StringPrefix AsciiCharList NullChar > + StringPrefix :=3D 0x0D > + AsciiCharList :=3D Nothing | > + AsciiChar :=3D 0x01 - 0x7F > + NullChar :=3D 0x00 > + > + @param[in] String - String to be encoded > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPDataString ( > + IN CHAR8 *String, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a data buffer AML object from an array > + > + This will take the passed in buffer and generate an AML Object from th= at > + buffer > + > + @param[in] Buffer - Buffer to be placed in AML Object > + @param[in] BufferSize - Size of Buffer to be copied into Object > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPDataBufferFromArray ( > + IN VOID *Buffer, > + IN UINTN BufferSize, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +// ---------------------------------------------------------------------= ------ > +// Package Length Encoding > +// ---------------------------------------------------------------------= ------ > + > +/** > + Creates a Package Length AML Object and inserts it into the linked lis= t > + > + PkgLength :=3D PkgLeadByte | > + | > + | > + > + > + PkgLeadByte :=3D > + > + > + > + Note: The high 2 bits of the first byte reveal how many follow bytes a= re in > + the PkgLength. If the PkgLength has only one byte, bit 0 through 5 are= used > + to encode the package length (in other words, values 0-63). If the pac= kage > + length value is more than 63, more than one byte must be used for the > encoding > + in which case bit 4 and 5 of the PkgLeadByte are reserved and must be = zero. > + > + If the multiple bytes encoding is used, bits 0-3 of the PkgLeadByte be= come > + the least significant 4 bits of the resulting package length value. Th= e next > + ByteData will become the next least significant 8 bits of the resultin= g value > + and so on, up to 3 ByteData bytes. Thus, the maximum package length is > 2**28. > + > + @param[in] Phase - Example: AmlStart, AmlClose > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > +**/ > +EFI_STATUS > +EFIAPI > +AmlPkgLength ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +// ---------------------------------------------------------------------= ------ > +// Term Objects Encoding > +// ---------------------------------------------------------------------= ------ > + > +// ---------------------------------------------------------------------= ------ > +// Namespace Modifier Objects Encoding > +// ---------------------------------------------------------------------= ------ > + > +/** > + Creates a Scope (ObjectName, Object) > + > + Object must be created between AmlStart and AmlClose Phase > + > + DefScope :=3D ScopeOp PkgLength NameString TermList > + ScopeOp :=3D 0x10 > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] String - Location > + @param[in,out] ListHead - Linked list has completed String Object af= ter > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlScope ( > + IN AML_FUNCTION_PHASE Phase, > + IN CHAR8 *String, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a Name (ObjectName, Object) > + > + Object must be created between AmlStart and AmlClose Phase > + > + DefName :=3D NameOp NameString DataRefObject > + NameOp :=3D 0x08 > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] Name - Named Object name > + @param[in,out] ListHead - Linked list has completed Name Object afte= r > AmlClose > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlName ( > + IN AML_FUNCTION_PHASE Phase, > + IN CHAR8 *String, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates an Alias (SourceObject, AliasObject) > + > + DefAlias :=3D AliasOp NameString NameString > + AliasOp :=3D 0x06 > + > + @param[in] SourceName - Any named Source Object NameString > + @param[in] AliasName - Alias Object NameString > + @param[in,out] ListHead - Linked list has completed the Alias Objec= t > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPAlias ( > + IN CHAR8 *SourceName, > + IN CHAR8 *AliasName, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +// ---------------------------------------------------------------------= ------ > +// Named Objects Encoding > +// ---------------------------------------------------------------------= ------ > + > +/** > + Creates a Device (ObjectName, Object) > + > + Object must be created between AmlStart and AmlClose Phase > + > + DefName :=3D DeviceOp PkgLength NameString TermList > + NameOp :=3D ExtOpPrefix 0x82 > + ExtOpPrefix :=3D 0x5B > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] Name - Named Object name > + @param[in,out] ListHead - Linked list has completed Name Object afte= r > AmlClose > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlDevice ( > + IN AML_FUNCTION_PHASE Phase, > + IN CHAR8 *String, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a NamedField or a ReservedField, depending on the > + parameters. > + > + To create a NamedField item pass in the NameSeg and Bitlength > + as in ASL. To create a ReservedField pass "" as the Name. > + Must be used inside a Field or IndexField TermList. > + > + NamedField :=3D NameSeg PkgLength > + ReservedField :=3D 0x00 PkgLength > + > + @param[in] Name - Field NameSeg > + @param[in] BitLength - Length of field item in bits > + @param[in,out] ListHead - Linked list has completed FieldUnitIte= m > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPFieldUnit ( > + IN CHAR8 *Name, > + IN UINT32 BitLength, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a Field > + > + Field (RegionName, AccessType, LockRule, UpdateRule) {FieldUnitList} > + > + FieldUnitList must be created between AmlStart and AmlClose Phase > + > + DefField :=3D FieldOp PkgLength NameString FieldFlags FieldList > + FieldOp :=3D ExtOpPrefix 0x81 > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] Name - Field NameString > + @param[in] AccessType - Access Type for field > + @param[in] LockRule - Lock rule for field > + @param[in] UpdateRule - Update rule for field > + @param[in,out] ListHead - Linked list has completed Field Object= after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlField ( > + IN AML_FUNCTION_PHASE Phase, > + IN CHAR8 *Name, > + IN EFI_ACPI_FIELD_ACCESS_TYPE_KEYWORDS AccessType, > + IN EFI_ACPI_FIELD_LOCK_RULE_KEYWORDS LockRule, > + IN EFI_ACPI_FIELD_UPDATE_RULE_KEYWORDS UpdateRule, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a BankField > + > + BankField (RegionName, BankName, BankValue, AccessType, LockRule, > UpdateRule) {FieldUnitList} > + FieldUnitList must be added between AmlStart and AmlClose phase > + > + DefBankField :=3D BankFieldOp PkgLength NameString NameString BankVal= ue > FieldFlags FieldList > + BankFieldOp :=3D ExtOpPrefix 0x87 > + BankValue :=3D TermArg =3D> Integer > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] RegionName - Name of host Operation Region > + @param[in] BankName - Name of bank selection register > + @param[in] BankValue - Bank Selection ID > + @param[in] AccessType - Access Type as in Field > + @param[in] LockRule - Lock rule as in Field > + @param[in] UpdateRule - Update rule as in Field > + @param[in,out] ListHead - Linked list has completed BankField Ob= ject > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlBankField ( > + IN AML_FUNCTION_PHASE Phase, > + IN CHAR8 *RegionName, > + IN CHAR8 *BankName, > + IN UINT64 BankValue, > + IN EFI_ACPI_FIELD_ACCESS_TYPE_KEYWORDS AccessType, > + IN EFI_ACPI_FIELD_LOCK_RULE_KEYWORDS LockRule, > + IN EFI_ACPI_FIELD_UPDATE_RULE_KEYWORDS UpdateRule, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates an IndexField > + > + IndexField (IndexName, DataName, AccessType, LockRule, UpdateRule) > {FieldUnitList} > + > + FieldUnitList must be added between AmlStart and AmlClose phase > + > + DefIndexField :=3D IndexFieldOp PkgLength NameString NameString FieldF= lags > FieldList > + IndexFieldOp :=3D ExtOpPrefix 0x86 > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] IndexName - Name of Index FieldUnit > + @param[in] DataName - Name of Data FieldUnit > + @param[in] AccessType - Access Type for the FieldUnit > + @param[in] LockRule - Lock rule for the FieldUnit > + @param[in] UpdateRule - Update rule for the FieldUnit > + @param[in,out] ListHead - Linked list has completed IndexField O= bject > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlIndexField ( > + IN AML_FUNCTION_PHASE Phase, > + IN CHAR8 *IndexName, > + IN CHAR8 *DataName, > + IN EFI_ACPI_FIELD_ACCESS_TYPE_KEYWORDS AccessType, > + IN EFI_ACPI_FIELD_LOCK_RULE_KEYWORDS LockRule, > + IN EFI_ACPI_FIELD_UPDATE_RULE_KEYWORDS UpdateRule, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Offset (ByteOffset) > + > + Creates a ReservedField if the passed ByteOffset is larger than > + the previous bit length value optionally specified by an AmlOPFieldLis= tItem, > + or another Offset call. All offsets are defined starting from zero, ba= sed at > + the starting address of the parent Operation Region. > + > + ReservedField :=3D 0x00 PkgLength > + > + @param[in] ByteLength -Byte offset of the next defined field w= ithin > + the parent Operation Region > + @param[in,out] ListHead - Linked list has completed Offset objec= t > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPOffset ( > + IN UINT32 ByteOffset, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + OperationRegion (RegionName, RegionSpace, Offset, Length) > + > + DefOpRegion :=3D OpRegionOp NameString RegionSpace RegionOffset > RegionLen > + OpRegionOp :=3D ExtOpPrefix 0x80 > + RegionSpace :=3D > + ByteData // 0x00 SystemMemory > + // 0x01 SystemIO > + // 0x02 PCI_Config > + // 0x03 EmbeddedControl > + // 0x04 SMBus > + // 0x05 System CMOS > + // 0x06 PciBarTarget > + // 0x07 IPMI > + // 0x08 GeneralPurposeIO > + // 0x09 GenericSerialBus > + // 0x0A PCC > + // 0x80-0xFF: OEM Defined > + RegionOffset :=3D TermArg =3D> Integer > + RegionLen :=3D TermArg =3D> Integer > + > + @param[in] RegionName - Name for the Operation Region > + @param[in] RegionSpace - Region Space type > + @param[in] Offset - Offset within the selected RegionSpace = at which > the > + region starts (byte-granular) > + @param[in] Length - Length of the region in bytes. > + @param[in,out] ListHead - Linked list head > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPOperationRegion ( > + IN CHAR8 *RegionName, > + IN GENERIC_ADDRESS_SPACE_ID RegionSpace, > + IN UINT64 Offset, > + IN UINT64 Length, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates an AccessAs Field Unit > + > + AccessAs (AccessType, AccessAttribute) > + AccessAs (AccessType, AccessAttribute (AccessLength)) > + > + AccessField :=3D 0x01 AccessType AccessAttrib > + AccessType :=3D ByteData // Bits 0:3 - Same as AccessType bits of Fie= ldFlags. > + // Bits 4:5 - Reserved > + // Bits 7:6 - 0 =3D AccessAttrib =3D Normal Ac= cess Attributes > + // 1 =3D AccessAttrib =3D AttribBytes (x) > + // 2 =3D AccessAttrib =3D AttribRawBytes (x) > + // 3 =3D AccessAttrib =3D AttribRawProcessByte= s (x) > + // > + // x' is encoded as bits 0:7 of the AccessAttr= ib byte. > + > + AccessAttrib :=3D ByteData // If AccessType is BufferAcc for the SMB = or > + // GPIO OpRegions, AccessAttrib can be one o= f > + // the following values: > + // 0x02 AttribQuick > + // 0x04 AttribSendReceive > + // 0x06 AttribByte > + // 0x08 AttribWord > + // 0x0A AttribBlock > + // 0x0C AttribProcessCall > + // 0x0D AttribBlockProcessCall > + > + @param[in] AccessType - Access type for field member > + @param[in] AccessAttribute - Access attribute for field member > + @param[in] AccessLength - Only used if AccessAttribute is At= tribBytes, > + AttribRawBytes, or AttribRawProces= sBytes. > + Specifies the access length for th= e field member > + Otherwise, ignored. > + @param[in,out] ListHead - Linked list that has completed Acc= essAs > Object > + after AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPAccessAs ( > + IN EFI_ACPI_FIELD_ACCESS_TYPE_KEYWORDS AccessType, > + IN EFI_ACPI_FIELD_ACCESS_ATTRIBUTE_KEYWORDS AccessAttribute, > + IN UINT8 AccessLength, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates an External Object > + > + External (ObjectName, ObjectType, ReturnType, ParameterTypes) > + > + Note: ReturnType is not used for AML encoding and is therefore not pas= sed > in > + to this function. > + ParameterTypes is only used if the ObjectType is a MethodObj. It > + specifies MethodObj's argument types in a list. For the purpose= s of > + this library, we are passing in the the number of input paramete= rs for > + that MethodObj. > + > + DefExternal :=3D ExternalOp NameString ObjectType ArgumentCount > + ExternalOp :=3D 0x15 > + ObjectType :=3D ByteData > + ArgumentCount :=3D ByteData (0 - 7) > + > + @param[in] Name - Object name > + @param[in] ObjectType - Type of object declared > + @param[in] NumArgs - Only used if ObjectType is MethodObj. > + Specifies the number of input parameters= for > + that MethodObj since AML does not store > + ArgTypes here. > + Otherwise, ignored. > + @param[in,out] ListHead - Linked list that has completed External = Object > + after AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPExternal ( > + IN CHAR8 *Name, > + IN UINT8 ObjectType, > + IN UINT8 NumArgs, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a CreateField AML Object and inserts it into the linked list > + > + Syntax: > + CreateField ( SourceBuffer, BitIndex, NumBits, FieldName ) > + > + DefCreateField :=3D CreateFieldOp SourceBuff BitIndex NumBits NameStri= ng > + CreateFieldOp :=3D ExtOpPrefix 0x13 > + ExtOpPrefix :=3D 0x5B > + SourceBuff :=3D TermArg =3D> Buffer > + BitIndex :=3D TermArg =3D> Integer > + NumBits :=3D TermArg -> Integer > + > + @param[in] SourceBuffer, - Buffer to house the new buffer field= object > + @param[in] BitIndex, - Starting bit index place the new buf= fer > + @param[in] NumBits, - Number of bits to reserve > + @param[in] FieldName, - The new buffer field object to be cr= eated in > SourceBuffer > + @param[in,out] ListHead - Linked list has completed CreateFiel= d object > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPCreateField ( > + IN CHAR8 *SourceBuffer, > + IN UINT64 BitIndex, > + IN UINT64 NumBits, > + IN CHAR8 *FieldName, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a CreateBitField AML Object and inserts it into the linked lis= t > + > + Syntax: > + CreateBitField (SourceBuffer, BitIndex, BitFieldName) > + > + DefCreateBitField :=3D CreateBitFieldOp SourceBuff BitIndex NameStri= ng > + CreateBitFieldOp :=3D 0x8D > + SourceBuff :=3D TermArg =3D> Buffer > + BitIndex :=3D TermArg =3D> Integer > + > + @param[in] SourceBuffer, - Buffer to insert the new buffer bit = field > object > + @param[in] BitIndex, - Starting bit index to place the new = buffer > + @param[in] BitFieldName, - Name of the BitField > + @param[in,out] ListHead - Linked list has completed CreateBitF= ield > object > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPCreateBitField ( > + IN CHAR8 *SourceBuffer, > + IN UINT64 BitIndex, > + IN CHAR8 *BitFieldName, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a CreateByteField AML Object and inserts it into the linked li= st > + > + Syntax: > + CreateByteField ( SourceBuffer, ByteIndex, ByteFieldName ) > + > + DefCreateByteField :=3D CreateByteFieldOp SourceBuff ByteIndex > NameString > + CreateByteFieldOp :=3D 0x8C > + SourceBuff :=3D TermArg =3D> Buffer > + ByteIndex :=3D TermArg =3D> Integer > + > + @param[in] SourceBuffer, - Buffer to insert the new buffer byte= field > object > + @param[in] ByteIndex, - Starting byte index to place the new= buffer > + @param[in] ByteFieldName, - Name of the ByteField > + @param[in,out] ListHead - Linked list has completed CreateByte= Field > object > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPCreateByteField ( > + IN CHAR8 *SourceBuffer, > + IN UINT64 ByteIndex, > + IN CHAR8 *ByteFieldName, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a CreateDWordField AML Object and inserts it into the linked l= ist > + > + Syntax: > + CreateDWordField ( SourceBuffer, ByteIndex, DWordFieldName ) > + > + DefCreateDWordField :=3D CreateDWordFieldOp SourceBuff ByteIndex > NameString > + CreateDWordFieldOp :=3D 0x8A > + SourceBuff :=3D TermArg =3D> Buffer > + ByteIndex :=3D TermArg =3D> Integer > + > + @param[in] SourceBuffer, - Buffer to insert the new buffer DW= ord > field object > + @param[in] ByteIndex, - Starting byte index to place the n= ew buffer > + @param[in] DWordFieldName, - Name of the DWordField > + @param[in,out] ListHead - Linked list has completed > CreateDWordField object > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPCreateDWordField ( > + IN CHAR8 *SourceBuffer, > + IN UINT64 ByteIndex, > + IN CHAR8 *DWordFieldName, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a CreateQWordField AML Object and inserts it into the linked l= ist > + > + Syntax: > + CreateQWordField ( SourceBuffer, ByteIndex, QWordFieldName ) > + > + DefCreateQWordField :=3D CreateQWordFieldOp SourceBuff ByteIndex > NameString > + CreateQWordFieldOp :=3D 0x8F > + SourceBuff :=3D TermArg =3D> Buffer > + ByteIndex :=3D TermArg =3D> Integer > + > + @param[in] SourceBuffer, - Buffer to insert the new buffer QW= ord > field object > + @param[in] ByteIndex, - Starting byte index to place the n= ew buffer > + @param[in] QWordFieldName, - Name of the QWordField > + @param[in,out] ListHead - Linked list has completed > CreateQWordField object > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPCreateQWordField ( > + IN CHAR8 *SourceBuffer, > + IN UINT64 ByteIndex, > + IN CHAR8 *QWordFieldName, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a CreateWordField AML Object and inserts it into the linked li= st > + > + Syntax: > + CreateWordField ( SourceBuffer, ByteIndex, WordFieldName ) > + > + DefCreateWordField :=3D CreateWordFieldOp SourceBuff ByteIndex > NameString > + CreateWordFieldOp :=3D 0x8B > + SourceBuff :=3D TermArg =3D> Buffer > + ByteIndex :=3D TermArg =3D> Integer > + > + @param[in] SourceBuffer, - Buffer to house the new buffer word = field > object > + @param[in] ByteIndex, - Starting byte index to place the new= buffer > + @param[in] WordFieldName, - Name of the WordField > + @param[in,out] ListHead - Linked list has completed CreateWord= Field > object > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPCreateWordField ( > + IN CHAR8 *SourceBuffer, > + IN UINT64 ByteIndex, > + IN CHAR8 *WordFieldName, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a Method > + > + Method (MethodName, NumArgs, SerializeRule, SyncLevel, ReturnType, > + ParameterTypes) {TermList} > + > + TermList must be created between AmlStart and AmlClose Phase > + > + Note: ReturnType and ParameterTypes are not used for AML encoding > + and are therefore not passed in to this function. > + > + DefMethod :=3D MethodOp PkgLength NameString MethodFlags TermList > + MethodOp :=3D 0x14 > + MethodFlags :=3D ByteData // bit 0-2: ArgCount (0-7) > + // bit 3: SerializeFlag > + // 0 NotSerialized > + // 1 Serialized > + // bit 4-7: SyncLevel (0x00-0x0f) > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] Name - Method name > + @param[in] NumArgs - Number of arguments passed in to metho= d > + @param[in] SerializeRule - Flag indicating whether method is seri= alized > + or not > + @param[in] SyncLevel - synchronization level for the method (= 0 - 15), > + use zero for default sync level. > + @param[in,out] ListHead - Linked list has completed String Objec= t after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlMethod ( > + IN AML_FUNCTION_PHASE Phase, > + IN CHAR8 *Name, > + IN UINT8 NumArgs, > + IN METHOD_SERIALIZE_FLAG SerializeRule, > + IN UINT8 SyncLevel, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +// ---------------------------------------------------------------------= ------ > +// Type 1 Opcodes Encoding > +// ---------------------------------------------------------------------= ------ > + > +/** > + Creates an Else object > + > + TermList must be created between AmlStart and AmlClose Phase > + > + Since ElseIf (...) is created with Else {( If (){})}. ElseIf will not= be > + supported and must be created with Else and If. > + > + DefElse :=3D Nothing | > + ElseOp :=3D 0xA1 > + > + EXAMPLE: > + AmlIf (AmlStart, ListHead); > + { > + { // Predicate > + AmlOpDataInteger (1, ListHead); > + } // Predicate > + { // TermList > + ... > + } // TermList > + } > + AmlIf (AmlClose, ListHead); > + AmlElse (AmlStart, ListHead); > + { > + AmlIf (AmlStart, ListHead); > + { > + {} // Predicate > + {} // Termlist > + } > + AmlIf (AmlClose, ListHead); > + AmlElse (AmlStart, ListHead); > + {} // TermList > + AmlElse (AmlClose, ListHead); > + } > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed AmlElse Object a= fter > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlElse ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a If object > + > + Predicate and TermList must be created between AmlStart and AmlClose > Phase > + > + Since ElseIf (...) is created with Else {( If (){})}. ElseIf will not= be > + supported and must be created with Else and If. > + > + DefIfElse :=3D IfOp PkgLength Predicate TermList DefElse > + IfOp :=3D 0xA0 > + Predicate :=3D TermArg =3D> Integer > + > + EXAMPLE: > + AmlIf (AmlStart, ListHead); > + { > + { // Predicate > + AmlOpDataInteger (1, ListHead); > + } // Predicate > + { // TermList > + ... > + } // TermList > + } > + AmlIf (AmlClose, ListHead); > + AmlElse (AmlStart, ListHead); > + { > + AmlIf (AmlStart, ListHead); > + { > + {} // Predicate > + {} // Termlist > + } > + AmlIf (AmlClose, ListHead); > + AmlElse (AmlStart, ListHead); > + {} // TermList > + AmlElse (AmlClose, ListHead); > + } > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed AmlIf Object aft= er > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlIf ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a Notify object > + > + DefNotify :=3D NotifyOp NotifyObject NotifyValue > + NotifyOp :=3D 0x86 > + NotifyObject :=3D SuperName =3D> ThermalZone | Processor | Device > + NotifyValue :=3D TermArg =3D> Integer > + > + @param[in] NotifyObject - String of Namestring to a device > + @param[in] NotifyValue - Integer Notify value > + @param[in,out] ListHead - Linked list updated with Notify object > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPNotify ( > + IN CHAR8 *NotifyObject, > + IN UINT64 NotifyValue, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a Return object > + > + Object must be created between AmlStart and AmlClose Phase > + > + DefReturn :=3D ReturnOp ArgObject > + ReturnOp :=3D 0xA4 > + ArgObject :=3D TermArg =3D> DataRefObject > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Head of linked list of Objects > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlReturn ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +// ---------------------------------------------------------------------= ------ > +// Type 2 Opcodes Encoding > +// ---------------------------------------------------------------------= ------ > + > +/** > + Creates a Buffer (BufferSize) {Initializer} =3D> Buffer Object > + > + Initializers must be created between AmlStart and AmlClose Phase > + > + DefBuffer :=3D BufferOp PkgLength BufferSize ByteList > + BufferOp :=3D 0x11 > + BufferSize :=3D TermArg =3D> Integer > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] BufferSize - Requested BufferSize, Encoded value will= be > + MAX (BufferSize OR Child->DataSize) > + @param[in,out] ListHead - Linked list has completed Buffer Object = after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlBuffer ( > + IN AML_FUNCTION_PHASE Phase, > + IN UINTN BufferSize, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a LEqual (Source1, Source2) =3D> Boolean > + > + Source1 and Source2 operands must be created between AmlStart and > AmlClose Phase > + > + DefLEqual :=3D LequalOp Operand Operand > + LequalOp :=3D 0x93 > + Operand :=3D TermArg =3D> Integer > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed LEqual Object = after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlLEqual ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a Package (NumElements) {PackageList} =3D> Package > + > + Initializers must be created between AmlStart and AmlClose Phase > + > + DefPackage :=3D PackageOp PkgLength NumElements > PackageElementList > + PackageOp :=3D 0x12 > + DefVarPackage :=3D VarPackageOp PkgLength VarNumElements > PackageElementList > + VarPackageOp :=3D 0x13 > + NumElements :=3D ByteData > + VarNumElements :=3D TermArg =3D> Integer > + PackageElementList :=3D Nothing | > + PackageElement :=3D DataRefObject | NameString > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] NumElements - Number of elements in the package > + @param[in,out] ListHead - Linked list has completed Package Object= after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlPackage ( > + IN AML_FUNCTION_PHASE Phase, > + IN UINTN NumElements, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +// ---------------------------------------------------------------------= ------ > +// Resource Descriptor Objects Encoding > +// ---------------------------------------------------------------------= ------ > + > +/** > + ResourceTemplate (Resource To Buffer Conversion Macro) > + > + Syntax: > + ResourceTemplate () {ResourceMacroList} =3D> Buffer > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed ResourceTemplate > Object > + after AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlResourceTemplate ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + 19.6.32 DMA (DMA Resource Descriptor Macro) > + > + This function only requires a single call and therefore no Phases > + Syntax > + DMA (DmaType, IsBusMaster, DmaTransferSize, DescriptorName) > {DmaChannelList} =3D> Buffer (BitMask) > + > + Generates: 6.4.2.2 DMA Descriptor > + > + @param[in] DmaType - DMA channel speed supported > + @param[in] IsBusMaster - Logical device bus master status > + @param[in] DmaTransferSize - DMA transfer type preference (8-bit,= 16- > bit, both) > + @param[in] DmaChannelList - DMA channel mask bits [7:0] (channel= s 0 - > 7), _DMA > + Bit [0] is channel 0, etc. > + // DescriptorName - Optional - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed DWordIO buffer > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPDma ( > + IN EFI_ACPI_DMA_SPEED_TYPE_KEYWORDS DmaType, > + IN EFI_ACPI_DMA_BUS_MASTER_KEYWORDS IsBusMaster, > + IN EFI_ACPI_DMA_TRANSFER_TYPE_KEYWORDS DmaTransferSize, > + IN UINT8 DmaChannelList, > + // DescriptorName - NOT IMPLE= MENTED > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + 19.6.33 DWordIO (DWord IO Resource Descriptor Macro) > + > + This function only requires a single call and therefore no Phases > + Syntax > + DWordIO (ResourceUsage, IsMinFixed, IsMaxFixed, Decode, ISARanges, > + AddressGranularity, AddressMinimum, AddressMaximum, > + AddressTranslation, RangeLength, ResourceSourceIndex, > + ResourceSource, DescriptorName, TranslationType, > + TranslationDensity) > + > + defines for pass in parameters can be found in: > + MdePkg/Include/IndustryStandard/Acpi10.h > + > + @param[in] ResourceUsage, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] Decode, > + @param[in] ISARanges, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + TranslationType - NOT IMPLEMENTED > + TranslationDensity - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed DWordIO buffer > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPDWordIO ( > + IN UINT8 ResourceUsage, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 Decode, > + IN UINT8 ISARanges, > + IN UINT32 AddressGranularity, > + IN UINT32 AddressMinimum, > + IN UINT32 AddressMaximum, > + IN UINT32 AddressTranslation, > + IN UINT32 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + // TranslationType - NOT IMPLEMENTED > + // TranslationDensity - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + 19.6.34 DWordMemory (DWord Memory Resource Descriptor Macro) > + > + This function only requires a single call and therefore no Phases > + Syntax > + DWordMemory (ResourceUsage, Decode, IsMinFixed, IsMaxFixed, > Cacheable, > + ReadAndWrite, AddressGranularity, AddressMinimum, > AddressMaximum, > + AddressTranslation, RangeLength, ResourceSourceIndex, > + ResourceSource, DescriptorName, MemoryRangeType, > TranslationType) > + > + defines for pass in parameters can be found in: > + MdePkg/Include/IndustryStandard/Acpi10.h > + > + @param[in] ResourceUsage, > + @param[in] Decode, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] Cacheable, > + @param[in] ReadAndWrite, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + MemoryRangeType - NOT IMPLEMENTED > + TranslationType - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed DWordMemory > buffer > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPDWordMemory ( > + IN UINT8 ResourceUsage, > + IN UINT8 Decode, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 Cacheable, > + IN UINT8 ReadAndWrite, > + IN UINT32 AddressGranularity, > + IN UINT32 AddressMinimum, > + IN UINT32 AddressMaximum, > + IN UINT32 AddressTranslation, > + IN UINT32 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + // MemoryRangeType - NOT IMPLEMENTED > + // TranslationType - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + AmlDWordSpace () > + > + 19.6.35 DWordSpace (DWord Space Resource Descriptor Macro) > + > + This function only requires a single call and therefore no Phases > + Syntax > + DWordSpace (ResourceType, ResourceUsage, Decode, IsMinFixed, > IsMaxFixed, > + TypeSpecificFlags, AddressGranularity, AddressMinimum, > + AddressMaximum, AddressTranslation, RangeLength, > + ResourceSourceIndex, ResourceSource, DescriptorName) > + > + Generates: > + 6.4.3.5.2 DWord Address Space Descriptor > + Type 1, Large Item Value 0x7 > + > + @param[in] ResourceType > + @param[in] ResourceUsage, > + @param[in] Decode, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] TypeSpecificFlags, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed DWordSpace buffe= r > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPDWordSpace ( > + IN UINT8 ResourceType, > + IN UINT8 ResourceUsage, > + IN UINT8 Decode, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 TypeSpecificFlags, > + IN UINT32 AddressGranularity, > + IN UINT32 AddressMinimum, > + IN UINT32 AddressMaximum, > + IN UINT32 AddressTranslation, > + IN UINT32 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + 19.6.36 EISAID (EISA ID String To Integer Conversion Macro) > + > + Syntax: > + EISAID (EisaIdString) =3D> DWordConst > + > + Arguments: > + The EisaIdString must be a String object of the form "UUUNNNN", wher= e > "U" > + is an uppercase letter and "N" is a hexadecimal digit. No asterisks = or other > + characters are allowed in the string. > + > + Description: > + Converts EisaIdString, a 7-character text string argument, into its > + corresponding 4-byte numeric EISA ID encoding. It can be used when > declaring > + IDs for devices that have EISA IDs. > + > + Encoded EISA ID Definition - 32-bits > + bits[15:0] - three character compressed ASCII EISA ID. * > + bits[31:16] - binary number > + * Compressed ASCII is 5 bits per character 0b00001 =3D 'A' 0b11010= =3D 'Z' > + > + Example: > + EISAID ("PNP0C09") // This is a valid invocation of the macro. > + > + @param[in] String - EISA ID string. > + @param[in,out] ListHead - Head of Linked List of all AML Objects > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPEisaId ( > + IN CHAR8 *String, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + 19.6.82 Memory32Fixed (Memory Resource Descriptor Macro) > + > + Syntax: > + Memory32Fixed (ReadAndWrite, AddressBase, RangeLength, > DescriptorName) > + > + Arguments: > + ReadAndWrite: Specifies whether or not the memory region is read-onl= y > (ReadOnly) > + or read/write (ReadWrite). If nothing is specified, then ReadWrite i= s > assumed. > + The 1-bit field DescriptorName._RW is automatically created to refer= to > this > + portion of the resource descriptor, where '1' is ReadWrite and '0' i= s > ReadOnly. > + > + AddressBase: Evaluates to a 32-bit integer that specifies the base a= ddress > + of the memory range. The 32-bit field DescriptorName. _BAS is > automatically > + created to refer to this portion of the resource descriptor. RangeL= ength > + evaluates to a 32-bit integer that specifies the total number of byt= es > decoded > + in the memory range. The 32-bit field DescriptorName. _LEN is > automatically > + created to refer to this portion of the resource descriptor. > + > + DescriptorName: Is an optional argument that specifies a name for an > integer > + constant that will be created in the current scope that contains the= offset > + of this resource descriptor within the current resource template buf= fer. > The > + predefined descriptor field names may be appended to this name to > access > + individual fields within the descriptor via the Buffer Field operato= rs. > + > + Description: > + The Memory32Fixed macro evaluates to a buffer which contains a 32-bi= t > memory > + descriptor, which describes a fixed range of memory addresses. The > format of > + the fixed 32-bit memory descriptor can be found in 32-Bit Fixed Memo= ry > Range > + Descriptor. The macro is designed to be used inside of a > ResourceTemplate. > + > + Generates: > + 6.4.3.4 32-Bit Fixed Memory Range Descriptor > + Type 1, Large Item Value 0x6 > + This memory range descriptor describes a device's memory resources > within a > + 32-bit address space. > + > + @param[in] ReadAndWrite, > + @param[in] AddressBase, > + @param[in] RangeLength, > + DescriptorName - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed memory resource > descriptor > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPMemory32Fixed ( > + IN READ_WRITE_FLAG ReadAndWrite, > + IN UINT32 AddressBase, > + IN UINT32 RangeLength, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + 19.6.64 IO (IO Resource Descriptor Macro) > + > + Syntax: > + IO (Decode, AddressMin, AddressMax, AddressAlignment, RangeLength, > DescriptorName) =3D> Buffer > + > + Arguments: > + Decode: > + Describes whether the I/O range uses 10-bit decode (Decode10) or 1= 6- > bit > + decode (Decode16). The field DescriptorName. _DEC is automaticall= y > created > + to refer to this portion of the resource descriptor, where '1' is = Decode16 > + and '0' is Decode10. > + > + AddressMin: > + Evaluates to a 16-bit integer that specifies the minimum acceptabl= e > starting > + address for the I/O range. It must be an even multiple of > AddressAlignment. > + The field DescriptorName._MIN is automatically created to refer to= this > + portion of the resource descriptor. > + > + AddressMax: > + Evaluates to a 16-bit integer that specifies the maximum acceptabl= e > starting > + address for the I/O range. It must be an even multiple of > AddressAlignment. > + The field DescriptorName._MAX is automatically created to refer to= this > + portion of the resource descriptor. > + > + AddressAlignment: > + Evaluates to an 8-bit integer that specifies the alignment granula= rity > + for the I/O address assigned. The field DescriptorName. _ALN is > automatically > + created to refer to this portion of the resource descriptor. > + > + RangeLength: > + Evaluates to an 8-bit integer that specifies the number of bytes i= n the > + I/O range. The field DescriptorName. _LEN is automatically created= to > refer > + to this portion of the resource descriptor. > + > + DescriptorName: > + An optional argument that specifies a name for an integer constant= that > + will be created in the current scope that contains the offset of t= his > + resource descriptor within the current resource template buffer. T= he > + predefined descriptor field names may be appended to this name to > access > + individual fields within the descriptor via the Buffer Field opera= tors. > + > + Description: > + The IO macro evaluates to a buffer which contains an IO resource > descriptor. > + The format of the IO descriptor can be found in the ACPI Specificati= on > section > + "I/O Port Descriptor". The macro is designed to be used inside of a > ResourceTemplate. > + > + Generates: > + 6.4.2.5 I/O Port Descriptor > + Type 0, Small Item Name 0x8, Length =3D 7 > + > + @param[in] Decode, > + @param[in] AddressMin, > + @param[in] AddressMax, > + @param[in] AddressAlignment, > + @param[in] RangeLength, > + DescriptorName - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed IO buffer > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPIO ( > + IN EFI_ACPI_IO_PORT_DESCRIPTOR_INFORMATION Decode, > + IN UINT16 AddressMin, > + IN UINT16 AddressMax, > + IN UINT8 AddressAlignment, > + IN UINT8 RangeLength, > + // DescriptorName - NOT = IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/* > + 19.6.114 Register (Generic Register Resource Descriptor Macro) > + > + This function only requires a single call and therefore no Phases > + Syntax > + Register (AddressSpaceKeyword, RegisterBitWidth, RegisterBitOffset, > + RegisterAddress, AccessSize, DescriptorName) > + > + Generates: > + 6.4.3.7 Generic Register Descriptor > + Type 1, Large Item Value 0x2 > + The generic register descriptor describes the location of a fixed widt= h > + register within any of the ACPI-defined address spaces. See Generic > Register > + Descriptor for details. > + > + > + @param[in] AddressSpaceKeyword, > + @param[in] RegisterBitWidth, > + @param[in] RegisterBitOffset, > + @param[in] RegisterAddress, > + @param[in] AccessSize, > + DescriptorName - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed QWordSpace buffe= r > + > + @retval EFI_SUCCESS > + @retval Error status > +*/ > +EFI_STATUS > +EFIAPI > +AmlOPRegister ( > + IN GENERIC_ADDRESS_SPACE_ID AddressSpaceKeyword, > + IN UINT8 RegisterBitWidth, > + IN UINT8 RegisterBitOffset, > + IN UINT64 RegisterAddress, > + IN UINT8 AccessSize, > + // DescriptorName - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + 19.6.109 QWordIO (QWord IO Resource Descriptor Macro) > + > + This function only requires a single call and therefore no Phases > + Syntax > + QWordIO (ResourceUsage, IsMinFixed, IsMaxFixed, Decode, ISARanges, > + AddressGranularity, AddressMinimum, AddressMaximum, > + AddressTranslation, RangeLength, ResourceSourceIndex, > + ResourceSource, DescriptorName, TranslationType, > + TranslationDensity) > + > + defines for pass in parameters can be found in: > + MdePkg/Include/IndustryStandard/Acpi10.h > + > + @param[in] ResourceUsage, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] Decode, > + @param[in] ISARanges, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + TranslationType - NOT IMPLEMENTED > + TranslationDensity - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed QWordIO buffer > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPQWordIO ( > + IN UINT8 ResourceUsage, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 Decode, > + IN UINT8 ISARanges, > + IN UINT64 AddressGranularity, > + IN UINT64 AddressMinimum, > + IN UINT64 AddressMaximum, > + IN UINT64 AddressTranslation, > + IN UINT64 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + // TranslationType - NOT IMPLEMENTED > + // TranslationDensity - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + 19.6.110 QWordMemory (QWord Memory Resource Descriptor Macro) > + > + This function only requires a single call and therefore no Phases > + Syntax > + QWordMemory (ResourceUsage, Decode, IsMinFixed, IsMaxFixed, > Cacheable, > + ReadAndWrite, AddressGranularity, AddressMinimum, > AddressMaximum, > + AddressTranslation, RangeLength, ResourceSourceIndex, > + ResourceSource, DescriptorName, MemoryRangeType, > TranslationType) > + > + defines for pass in parameters can be found in: > + MdePkg/Include/IndustryStandard/Acpi10.h > + > + @param[in] ResourceUsage, > + @param[in] Decode, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] Cacheable, > + @param[in] ReadAndWrite, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + MemoryRangeType - NOT IMPLEMENTED > + TranslationType - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed QWordMemory > buffer > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPQWordMemory ( > + IN UINT8 ResourceUsage, > + IN UINT8 Decode, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 Cacheable, > + IN UINT8 ReadAndWrite, > + IN UINT64 AddressGranularity, > + IN UINT64 AddressMinimum, > + IN UINT64 AddressMaximum, > + IN UINT64 AddressTranslation, > + IN UINT64 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + // MemoryRangeType - NOT IMPLEMENTED > + // TranslationType - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + AmlQWordSpace () > + > + 19.6.111 QWordSpace (QWord Space Resource Descriptor Macro) > + > + This function only requires a single call and therefore no Phases > + Syntax > + QWordSpace (ResourceType, ResourceUsage, Decode, IsMinFixed, > IsMaxFixed, > + TypeSpecificFlags, AddressGranularity, AddressMinimum, > + AddressMaximum, AddressTranslation, RangeLength, > + ResourceSourceIndex, ResourceSource, DescriptorName) > + > + Generates: > + 6.4.3.5.1 QWord Address Space Descriptor > + Type 1, Large Item Value 0xA > + The QWORD address space descriptor is used to report resource usage in= a > + 64-bit address space (like memory and I/O). > + > + @param[in] ResourceType > + @param[in] ResourceUsage, > + @param[in] Decode, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] TypeSpecificFlags, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed QWordSpace buffe= r > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPQWordSpace ( > + IN UINT8 ResourceType, > + IN UINT8 ResourceUsage, > + IN UINT8 Decode, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 TypeSpecificFlags, > + IN UINT64 AddressGranularity, > + IN UINT64 AddressMinimum, > + IN UINT64 AddressMaximum, > + IN UINT64 AddressTranslation, > + IN UINT64 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + 19.6.65 IRQ (Interrupt Resource Descriptor Macro) > + > + Syntax: > + IRQ (EdgeLevel, ActiveLevel, Shared, DescriptorName) {InterruptList}= =3D> > Buffer > + > + Arguments: > + EdgeLevel: > + Describes whether the interrupt is edge triggered (Edge) or level > triggered > + (Level). The field DescriptorName. _HE is automatically created to= refer > to > + this portion of the resource descriptor, where '1' is Edge and Act= iveHigh > + and '0' is Level and ActiveLow. > + > + ActiveLevel: > + Describes whether the interrupt is active-high (ActiveHigh) or act= ive-low > + (ActiveLow). The field DescriptorName. _LL is automatically create= d to > refer > + to this portion of the resource descriptor, where '1' is Edge and > ActiveHigh > + and '0' is Level and ActiveLow. > + > + Shared: > + Describes whether the interrupt can be shared with other devices > (Shared) or > + not (Exclusive), and whether it is capable of waking the system fr= om a > + low-power idle or system sleep state (SharedAndWake or > ExclusiveAndWake). > + The field DescriptorName. _SHR is automatically created to refer t= o this > portion > + of the resource descriptor, where '1' is Shared and '0' is Exclusi= ve. If > nothing > + is specified, then Exclusive is assumed. > + > + InterruptList: > + IRQ mask bits [15:0] > + Bit[0] represents IRQ0, bit[1] is IRQ1, etc. > + > + DescriptorName: > + Is an optional argument that specifies a name for an integer const= ant that > + will be created in the current scope that contains the offset of t= his > resource > + descriptor within the current resource template buffer. The predef= ined > + descriptor field names may be appended to this name to access > individual > + fields within the descriptor via the Buffer Field operators. > + > + Description: > + The IRQ macro evaluates to a buffer that contains an IRQ resource > descriptor. > + The format of the IRQ descriptor can be found in "IRQ Descriptor".= The > macro > + produces the three-byte form of the descriptor. The macro is desig= ned to > be > + used inside of a ResourceTemplate. > + > + Generates: 6.4.2.1 IRQ Descriptor > + > + @param[in] EdgeLevel - trigger level supported > + @param[in] ActiveLevel - interrupt polarity > + @param[in] Shared - interrupt exclusivity > + @param[in] InterruptList - IRQ mask bits[7:0], _INT > + Bit [0] represents IRQ0, > + bit[1] is IRQ1, and so on. > + IRQ mask bits[15:8], _INT > + Bit [0] represents IRQ8, > + bit[1] is IRQ9, and so on. > + // DescriptorName - Optional - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed IRQ buffer > + > + @retval EFI_SUCCESS > + @retval Error status > + > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPIRQ ( > + IN EFI_ACPI_IRQ_INTERRUPT_MODE_KEYWORDS EdgeLevel, > + IN EFI_ACPI_IRQ_INTERRUPT_POLARITY_KEYWORDS ActiveLevel, > + IN EFI_ACPI_IRQ_INTERRUPT_SHARING_KEYWORDS Shared, > + IN UINT16 InterruptList, > + // DescriptorName - NOT= IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + 19.6.150 WordBusNumber (Word Bus Number Resource Descriptor Macro) > + > + This function only requires a single call and therefore no Phases > + Syntax > + WordBusNumber (ResourceUsage, IsMinFixed, IsMaxFixed, Decode, > + AddressGranularity, AddressMinimum, AddressMaximum, > + AddressTranslation, RangeLength, ResourceSourceIndex, > + ResourceSource, DescriptorName) > + > + defines for pass in parameters can be found in: > + MdePkg/Include/IndustryStandard/Acpi10.h > + > + @param[in] ResourceUsage, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] Decode, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed WordBusNumber > + Descriptor > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPWordBusNumber ( > + IN UINT8 ResourceUsage, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 Decode, > + IN UINT16 AddressGranularity, > + IN UINT16 AddressMinimum, > + IN UINT16 AddressMaximum, > + IN UINT16 AddressTranslation, > + IN UINT16 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + 19.6.151 WordIO (Word IO Resource Descriptor Macro) > + > + This function only requires a single call and therefore no Phases > + Syntax > + WordIO (ResourceUsage, IsMinFixed, IsMaxFixed, Decode, ISARanges, > + AddressGranularity, AddressMinimum, AddressMaximum, > + AddressTranslation, RangeLength, ResourceSourceIndex, > + ResourceSource, DescriptorName, TranslationType, TranslationDe= nsity) > + > + defines for pass in parameters can be found in: > + MdePkg/Include/IndustryStandard/Acpi10.h > + > + @param[in] ResourceUsage, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] Decode, > + @param[in] ISARanges, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + TranslationType - NOT IMPLEMENTED > + TranslationDensity - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed WordIO Descripto= r > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPWordIO ( > + IN UINT8 ResourceUsage, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 Decode, > + IN UINT8 ISARanges, > + IN UINT16 AddressGranularity, > + IN UINT16 AddressMinimum, > + IN UINT16 AddressMaximum, > + IN UINT16 AddressTranslation, > + IN UINT16 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + // TranslationType - NOT IMPLEMENTED > + // TranslationDensity - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + 19.6.152 WordSpace (Word Space Resource Descriptor Macro) ) > + Syntax > + WordSpace (ResourceType, ResourceUsage, Decode, IsMinFixed, > IsMaxFixed, > + TypeSpecificFlags, AddressGranularity, AddressMinimum, > + AddressMaximum, AddressTranslation, RangeLength, > + ResourceSourceIndex, ResourceSource, DescriptorName) > + > + Generates: > + 6.4.3.5.3 Word Address Space Descriptor > + Type 1, Large Item Value 0x8 > + > + @param[in] ResourceType > + @param[in] ResourceUsage, > + @param[in] Decode, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] TypeSpecificFlags, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed WordSpace > Descriptor > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPWordSpace ( > + IN UINT8 ResourceType, > + IN UINT8 ResourceUsage, > + IN UINT8 Decode, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 TypeSpecificFlags, > + IN UINT16 AddressGranularity, > + IN UINT16 AddressMinimum, > + IN UINT16 AddressMaximum, > + IN UINT16 AddressTranslation, > + IN UINT16 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ); > + > +// ---------------------------------------------------------------------= ------ > +// Expression Opcodes Encoding > +// ---------------------------------------------------------------------= ------ > + > +/** > + Creates a Store expression > + > + Syntax: > + Store (Source, Destination) =3D> DataRefObject Destination =3D Source = =3D> > DataRefObject > + > + Store expression must be created between AmlStart and AmlClose Phase. > + > + DefStore :=3D StoreOp TermArg SuperName > + StoreOp :=3D 0x70 > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed String Obj= ect after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlStore ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +// ---------------------------------------------------------------------= ------ > +// Miscellaneous Objects Encoding > +// ---------------------------------------------------------------------= ------ > + > +/** > + Creates an ArgN Opcode object > + > + Arg Objects Encoding > + ArgObj :=3D Arg0Op | Arg1Op | Arg2Op | Arg3Op | Arg4Op |Arg5Op | > Arg6Op > + Arg0Op :=3D 0x68 > + Arg1Op :=3D 0x69 > + Arg2Op :=3D 0x6A > + Arg3Op :=3D 0x6B > + Arg4Op :=3D 0x6C > + Arg5Op :=3D 0x6D > + Arg6Op :=3D 0x6E > + > + @param[in] ArgN - Argument Number to be encoded > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > +**/ > +EFI_STATUS > +EFIAPI > +AmlOpArgN ( > + IN UINT8 ArgN, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates an LocalN Opcode object > + > + Local Objects Encoding > + LocalObj :=3D Local0Op | Local1Op | Local2Op | Local3Op | Local4Op | > Local5Op | Local6Op | Local7Op > + Local0Op :=3D 0x60 > + Local1Op :=3D 0x61 > + Local2Op :=3D 0x62 > + Local3Op :=3D 0x63 > + Local4Op :=3D 0x64 > + Local5Op :=3D 0x65 > + Local6Op :=3D 0x66 > + Local7Op :=3D 0x67 > + > + @param[in] LocalN - Argument Number to be encoded > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPLocalN ( > + IN UINT8 LocalN, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a Shift Left expression > + > + Syntax: > + ShiftLeft (Source, ShiftCount, Reult) =3D> Integer > + Result =3D Source << ShiftCount =3D> Integer > + Result <<=3D ShiftCount =3D> Integer > + > + Shift expression must be created between AmlStart and AmlClose Phase. > + > + DefShiftLeft :=3D ShiftLeftOp Operand ShiftCount Target > + ShiftLeftOp :=3D 0x79 > + ShiftCount :=3D TermArg =3D> Integer > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed String Obj= ect after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlShiftLeft ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a Shift Right expression > + > + Syntax: > + ShiftRight (Source, ShiftCount, Reult) =3D> Integer > + Result =3D Source >> ShiftCount =3D> Integer > + Result >>=3D ShiftCount =3D> Integer > + > + Shift expression must be created between AmlStart and AmlClose Phase. > + > + DefShiftRight :=3D ShiftRightOp Operand ShiftCount Target > + ShiftRightOp :=3D 0x7A > + ShiftCount :=3D TermArg =3D> Integer > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed String Obj= ect after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlShiftRight ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a FindSetLeftBit AML Object > + > + Syntax: > + FindSetLeftBit (Source, Result) =3D> Integer > + > + FindSetLeftBit expression must be created between > + AmlStart and AmlClose Phase. > + > + DefFindSetLeftBit :=3D FindSetLeftBitOp Operand Target > + FindSetLeftBitOp :=3D 0x81 > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed String Obj= ect after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > + > +EFI_STATUS > +EFIAPI > +AmlFindSetLeftBit ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a FindSetRightBit AML Object > + > + Syntax: > + FindSetRightBit (Source, Result) =3D> Integer > + > + FindSetRightBit expression must be created between > + AmlStart and AmlClose Phase. > + > + DefFindSetRightBit :=3D FindSetRightBit Operand Target > + FindSetRightBit :=3D 0x82 > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed String Obj= ect after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlFindSetRightBit ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Creates a Decrement expression > + > + Syntax: > + Decrement (Minuend) =3D> Integer > + Minuend-- =3D> Integer > + > + Creates object to decrement Minuend. > + > + DefDecrement :=3D DecrementOp SuperName > + DecrementOp :=3D 0x76 > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed String Obj= ect after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlDecrement ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ); > + > +// > ************************************************************ > *************** > +// AML Assistance Functions > +// > ************************************************************ > *************** > + > +/** > + Free all the children AML_OBJECT_INSTANCE(s) of ListHead. > + Will not free ListHead nor an Object containing ListHead. > + > + @param[in,out] ListHead - Head of linked list of Objects > + > + @retval EFI_SUCCESS > +**/ > +EFI_STATUS > +EFIAPI > +AmlFreeObjectList ( > + IN OUT LIST_ENTRY *ListHead > + ); > + > +/** > + Validate that ACPI table is completed and return Table and Size > + > + @param[in,out] ListHead - Head of linked list of Objects > + @param[out] Table - Completed ACPI Table > + @param[out] TableSize - Completed ACPI Table size > + > + @retval EFI_SUCCESS > + EFI_INVALID_PARAMETER > + EFI_DEVICE_ERROR > +**/ > +EFI_STATUS > +EFIAPI > +AmlGetCompletedTable ( > + IN OUT LIST_ENTRY *ListHead, > + OUT VOID **Table, > + OUT UINTN *TableSize > + ); > + > +/** > + Initialize Table List to work with AmlGenerationLib > + > + Allocates a LIST_ENTRY linked list item and initializes it. Use > + AmlReleaseTableList to free resulting table and LIST_ENTRY. > + > + @param[in,out] ListHead - Head of linked list of Objects > + > + @retval EFI_SUCCESS > + EFI_INVALID_PARAMETER > + EFI_OUT_OF_RESOURCES > +**/ > +EFI_STATUS > +EFIAPI > +AmlInitializeTableList ( > + IN OUT LIST_ENTRY **ListHead > + ); > + > +/** > + Release table List > + > + Releases all elements. Use to free built table and LIST_ENTRY allocat= ed by > + AmlInitializeTableList. > + > + @param[in,out] ListHead - Head of linked list of Objects > + > + @retval EFI_SUCCESS > + EFI_INVALID_PARAMETER > +**/ > +EFI_STATUS > +EFIAPI > +AmlReleaseTableList ( > + IN OUT LIST_ENTRY **ListHead > + ); > + > +// > ************************************************************ > *************** > +// AML Debug Functions > +// > ************************************************************ > *************** > + > +/** > + DEBUG print a (VOID *)buffer in an array of HEX bytes > + > + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F > + 0000 54 48 49 53 20 49 53 20 41 20 53 41 4D 50 4C 45 THIS IS A SAMPLE > + 0010 5F 42 55 46 46 45 52 01 02 5E 5C 30 31 _BUFFER..^\01 > + Completed=3D(TRUE|FALSE) > + > + @param[in] Buffer - Buffer containing buffer > + @param[in] BufferSize - Number of bytes to print > +**/ > +EFI_STATUS > +EFIAPI > +AmlDebugPrintBuffer ( > + IN VOID *Buffer, > + IN UINTN BufferSize > + ); > + > +/** > + DEBUG print a buffer in an array of HEX bytes > + > + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F > + 0000 54 48 49 53 20 49 53 20 41 20 53 41 4D 50 4C 45 THIS.IS.A.SAMPLE > + 0010 5F 42 55 46 46 45 52 01 02 5E 5C 30 31 _BUFFER..^\01 > + Completed=3D(TRUE|FALSE) > + > + @param[in] Object - AML_OBJECT_INSTANCE > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlDebugPrintObject ( > + IN AML_OBJECT_INSTANCE *Object > + ); > + > +/** > + DEBUG print a linked list of AML buffer Objects in an array of HEX byt= es > + > + @param[in] ListHead - Head of AML_OBJECT_INSTANCE Linked List > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlDebugPrintLinkedObjects ( > + IN LIST_ENTRY *ListHead > + ); > + > +#endif // AML_LIB_H_ > diff --git > a/Platform/AMD/AgesaPkg/Include/Library/PlatformPspRomArmorWhitelistLi > b.h > b/Platform/AMD/AgesaPkg/Include/Library/PlatformPspRomArmorWhitelistLi > b.h > new file mode 100644 > index 0000000000..d48ca1a90a > --- /dev/null > +++ > b/Platform/AMD/AgesaPkg/Include/Library/PlatformPspRomArmorWhitelistLi > b.h > @@ -0,0 +1,25 @@ > +/** @file > + Platform ROM Armor Whitelist table > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > + > +/* > + * Return allocated and filled AMD PSP ROM Armor White list Table > + * > + * > + * @param[in] PlatformSpiWhitelist Pointer to white list table > + * > + * @return EFI_SUCCESS > + * @return EFI_OUT_OF_RESOURCES Buffer to return couldn't be > allocated > + */ > +EFI_STATUS > +EFIAPI > +GetPspRomArmorWhitelist ( > + IN SPI_WHITE_LIST **PlatformSpiWhitelist > + ); > diff --git a/Platform/AMD/AgesaPkg/Include/Ppi/AmdPspFtpmPpi.h > b/Platform/AMD/AgesaPkg/Include/Ppi/AmdPspFtpmPpi.h > new file mode 100644 > index 0000000000..6c854651cc > --- /dev/null > +++ b/Platform/AMD/AgesaPkg/Include/Ppi/AmdPspFtpmPpi.h > @@ -0,0 +1,134 @@ > +/** @file > + AMD Psp Ftpm Ppi Header > + > + Copyright (C) 2023-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef PSP_FTPM_PPI_H_ > +#define PSP_FTPM_PPI_H_ > +#include > + > +typedef struct _PSP_FTPM_PPI PSP_FTPM_PPI; > + > +/** > + Define function prototype: Execute a TPM command > + > + @param[in] This Point to PSP_FTPM_PPI itse= lf > + @param[in] CommandBuffer Point to the TPM command b= uffer > + @param[in] CommandSize Size of the TPM command bu= ffer > + @param[in,out] ResponseBuffer Point to the TPM response = buffer > + @param[in,out] ResponseSize Size of the TPM response b= uffer > + > + @return EFI_SUCCESS Command executed successfu= lly > + @return EFI_UNSUPPORTED Device unsupported > + @return EFI_TIMEOUT Command fail due the time = out > + @return EFI_DEVICE_ERROR Command fail due the error= status > set > + @return EFI_BUFFER_TOO_SMALL Response buffer too small = to > hold the response > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *FTPM_EXECUTE)( > + IN PSP_FTPM_PPI *This, > + IN VOID *CommandBuffer, > + IN UINTN CommandSize, > + IN OUT VOID *ResponseBuffer, > + IN OUT UINTN *ResponseSize > + ); > + > +/** > + Define function prototype: GET TPM related Info > + > + @param[in] This Point to PSP_FTPM_PPI itself > + @param[in,out] FtpmStatus Used to hold more detail inf= o (Unused > Currently) > + > + @return EFI_SUCCESS Ftpm function supported > + @return EFI_UNSUPPORTED Ftpm function unsupported > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *FTPM_CHECK_STATUS)( > + IN PSP_FTPM_PPI *This, > + IN OUT UINTN *FtpmStatus > + ); > + > +/** > + Define function prototype: Send a TPM command > + > + @param[in] This Point to PSP_FTPM_PPI itself > + @param[in] CommandBuffer Point to the TPM command buff= er > + @param[in] CommandSize Size of the TPM command buffe= r > + > + @return EFI_SUCCESS Command executed successfully > + @return EFI_UNSUPPORTED Device unsupported > + @return EFI_TIMEOUT Command fail due the time out > + @return EFI_DEVICE_ERROR Command fail due the error st= atus set > + @return EFI_BUFFER_TOO_SMALL Response buffer too small to = hold > the response > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *FTPM_SEND_COMMAND)( > + IN PSP_FTPM_PPI *This, > + IN VOID *CommandBuffer, > + IN UINTN CommandSize > + ); > + > +/** > + Define function prototype: Get a TPM command's response > + > + @param[in] This Point to PSP_FTPM_PPI itse= lf > + @param[in,out] ResponseBuffer Point to the TPM response = buffer > + @param[in,out] ResponseSize Size of the TPM response b= uffer > + > + @return EFI_SUCCESS Command executed successfu= lly > + @return EFI_UNSUPPORTED Device unsupported > + @return EFI_TIMEOUT Command fail due the time = out > + @return EFI_DEVICE_ERROR Command fail due the error= status > set > + @return EFI_BUFFER_TOO_SMALL Response buffer too small = to > hold the response > + **/ > +typedef > +EFI_STATUS > +(EFIAPI *FTPM_GET_RESPONSE)( > + IN PSP_FTPM_PPI *This, > + IN OUT VOID *ResponseBuffer, > + IN OUT UINTN *ResponseSize > + ); > + > +/** > + Define function prototype: Get TCG Logs. > + > + This function only implemented on Pluton-fTPM > + > + @param[in] This Point to PSP_FTPM_PPI itself > + @param[in,out] ResponseBuffer Point to the TPM response bu= ffer > + @param[in,out] ResponseSize Size of the TPM response buf= fer > + > + @retval EFI_STATUS 0: Success, Non-Zero Error > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *FTPM_GET_TCG_LOGS)( > + IN PSP_FTPM_PPI *This, > + IN OUT VOID *ResponseBuffer, > + IN OUT UINTN *ResponseSize > + ); > + > +/** > + PSP_FTPM_PPI prototype > + > + Defines PSP_FTPM_PPI. This PPI is used to get Ftpm info. > + Send TPM command, Get TPM command's response, Execute TPM > command(Include send & get response) > +**/ > +typedef struct _PSP_FTPM_PPI { > + FTPM_EXECUTE Execute; ///< Execute T= PM command, > include send & get response > + FTPM_CHECK_STATUS CheckStatus; ///< Check TPM= Status > + FTPM_SEND_COMMAND SendCommand; ///< Send TPM > command > + FTPM_GET_RESPONSE GetResponse; ///< Get Last = TPM > command response > + FTPM_GET_TCG_LOGS GetTcgLogs; ///< Get TCG L= ogs > +} PSP_FTPM_PPI; > + > +extern EFI_GUID gAmdPspFtpmPpiGuid; > +extern EFI_GUID gAmdPspFtpmFactoryResetPpiGuid; > + > +#endif > diff --git > a/Platform/AMD/AgesaPkg/Include/Protocol/AmdCxlServicesProtocol.h > b/Platform/AMD/AgesaPkg/Include/Protocol/AmdCxlServicesProtocol.h > new file mode 100644 > index 0000000000..715cbbcf78 > --- /dev/null > +++ b/Platform/AMD/AgesaPkg/Include/Protocol/AmdCxlServicesProtocol.h > @@ -0,0 +1,183 @@ > +/** @file > + CXL Configuration Services Protocol prototype definition > + > + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef NBIO_CXL_SERVICES_PROTOCOL_H_ > +#define NBIO_CXL_SERVICES_PROTOCOL_H_ > + > +#include "AMD.h" > +#include > +#include > + > +#define AMD_NBIO_CXL_SERVICES_REVISION 0x00 > + > +/// Forward declaration for the AMD_NBIO_CXL_SERVICES_PROTOCOL > +typedef struct _AMD_NBIO_CXL_SERVICES_PROTOCOL > AMD_NBIO_CXL_SERVICES_PROTOCOL; > + > +extern EFI_GUID gAmdNbioCxlServicesProtocolGuid; ///< CXL servi= ces > protocol calling > + > +#pragma pack (push, 1) > +/// Port Information Structure > +typedef struct _AMD_CXL_PORT_INFO_STRUCT { > + PCI_ADDR EndPointBDF; ///< Bus/Device/Function of Root= Port in > PCI_ADDR format > + UINT8 LogicalNbioInstance; ///< Logical Instance ID of NBIO > + UINT8 PhysicalNbioInstance; ///< Physical Instance ID of NBI= O where > this port is located > + UINT8 SocketID; ///< Socket ID for this port > + UINT32 UsRcrb; ///< Upstream Port RCRB address > + UINT32 DsRcrb; ///< Downstream Port RCRB addres= s > + UINT32 UsMemBar0; ///< Upstream port MEMBAR0 > + UINT32 DsMemBar0; ///< Downstream port MEMBAR0 > + UINT8 PortId; ///< Physical port location > + UINT8 PortWidth; ///< Lane width of the port > + UINT32 CxlPortAddress; ///< CXL root port address (CXL = 2.0 root > port or CXL 1.1 RCiEP) > + BOOLEAN IsSwitch; ///< CXL Switch flag > +} AMD_CXL_PORT_INFO_STRUCT; > + > +/// Port MMIO32 Resources Information Structure > +typedef struct _AMD_CXL_RESOURCES_INFO_STRUCT { > + UINT32 > Mmio32Base[MAX_SOCKETS_SUPPORTED][MAX_RBS_PER_SOCKET]; > + UINT32 > Mmio32Size[MAX_SOCKETS_SUPPORTED][MAX_RBS_PER_SOCKET]; > + UINT32 Mmio32Gran; > +} AMD_CXL_RESOURCES_INFO_STRUCT; > +#pragma pack (pop) > + > +// Protocol Definitions > + > +/** > + This function gets information about a specific PCIe root port. > + > + This > + A pointer to the AMD_NBIO_CXL_SERVICES_PROTOCOL instance. > + EndpointBDF > + Bus/Device/Function of Endpoint in PCI_ADDR format. > + PortInformation > + A pointer to an information structure to be populated by this functi= on to > + identify the location of the CXL port. > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *AMD_CXL_GET_ROOT_PORT_INFORMATION)( > + IN AMD_NBIO_CXL_SERVICES_PROTOCOL *This, ///< ptr > + IN UINTN PortIndex, ///< port in= dex > + OUT AMD_CXL_PORT_INFO_STRUCT *PortInformation ///< port > information ptr > + ); > + > +/** > + This function configures a specific PCIe root port for CXL capabilitie= s. > + > + This > + A pointer to the AMD_NBIO_CXL_SERVICES_PROTOCOL instance. > + EndpointBDF > + Bus/Device/Function of Endpoint in PCI_ADDR format. > + PortConfiguration > + A pointer to a configuration structure that contains the information > necessary > + to configurare the CXL port. > + PortInformation OPTIONAL (can be NULL) > + A pointer to an information structure to be populated by this functi= on to > + identify the location of the CXL port. > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *AMD_CXL_CONFIGURE_ROOT_PORT)( > + IN AMD_NBIO_CXL_SERVICES_PROTOCOL *This, ///< this ptr > + IN PCI_ADDR EndpointBDF ///< end pt bdf > + ); > + > +/** > + This function configures a specific PCIe root port for CXL presence > + > + This > + A pointer to the AMD_NBIO_CXL_SERVICES_PROTOCOL instance. > + EndpointBDF > + Bus/Device/Function of Endpoint in PCI_ADDR format. > + PortConfiguration > + A pointer to a configuration structure that contains the information > necessary > + to configurare the CXL port such as Socket id,rbindex,port id,segmen= t,bus > base,limit or presence. > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *AMD_CXL_RESOURCES_AVAILABLE)( > + ///< cxl por= t presence info > + IN AMD_NBIO_CXL_SERVICES_PROTOCOL *This, ///< > + IN OUT FABRIC_RESOURCE_FOR_EACH_RB *ResourceForEachRb ///< > + ); > + > +typedef > +EFI_STATUS > +(EFIAPI *AMD_CXL_GET_PORT_RB_LOCATION)( > + ///< get port rb locati= on > + IN AMD_NBIO_CXL_SERVICES_PROTOCOL *This, ///< > + IN UINT8 Segment, ///< > + IN UINT8 BusBase, ///< > + OUT UINT8 *SocketId, ///< > + OUT UINT8 *RbIndex ///< > + ); > + > +/** > + This function gets the CXL MMIO32 values to be used by the fabric > resource manager > + > + This > + A pointer to the AMD_NBIO_CXL_SERVICES_PROTOCOL instance. > + CxlMmio32ResourceForEachRb > + A pointer to the structure that will hold the MMIO32 base and size v= alues > for each root bridge > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *AMD_CXL_RESOURCES_INFORMATION)( > + ///< cxl po= rt presence info > + IN AMD_NBIO_CXL_SERVICES_PROTOCOL *This, ///< > + IN OUT AMD_CXL_RESOURCES_INFO_STRUCT *CxlMmio32Resources ///< > + ); > + > +/** > + * @brief > + * > + */ > +typedef > +EFI_STATUS > +(EFIAPI *AMD_CXL_REPORT_TO_MPIO)( > + IN AMD_NBIO_CXL_SERVICES_PROTOCOL *This //= /< ptr to > protocol > + ); > + > +/** > + * @brief > + * > + */ > +typedef > +EFI_STATUS > +(EFIAPI *AMD_CXL_FIND_2P0_DEVICES)( > + IN AMD_NBIO_CXL_SERVICES_PROTOCOL *This, ///<= ptr to > protocol > + IN UINTN PortIndex ///<= port index > + ); > + > +/** > + * @brief > + * > + */ > +typedef > +VOID > +(EFIAPI *AMD_CXL_ENABLE_SCM_PMEM)( > + IN AMD_NBIO_CXL_SERVICES_PROTOCOL *This, ///<= ptr to > protocol > + IN PCI_ADDR CxlPciAddress ///<= PCI address > + ); > + > +/// The Protocol Definition for CXL Services > +struct _AMD_NBIO_CXL_SERVICES_PROTOCOL { > + UINT32 Revision; = ///< revision > + UINTN CxlCount; = ///< CXL count > + AMD_CXL_GET_ROOT_PORT_INFORMATION CxlGetRootPortInformation; > ///< CXL root port information > + AMD_CXL_CONFIGURE_ROOT_PORT CxlConfigureRootPort; = ///< > configuring the root port > + AMD_CXL_GET_PORT_RB_LOCATION GetCxlPortRBLocation; = ///< > CXL port RB location > + AMD_CXL_RESOURCES_AVAILABLE GetCxlAvailableResources; > ///< Get resources allocated for CXL RCiEP > + AMD_CXL_RESOURCES_INFORMATION GetCxlMmio32Resources; > ///< Get CXL MMIO resources for CXL RCiEP > + AMD_CXL_REPORT_TO_MPIO CxlReportToMpio; = ///< > Sends the CXL info to MPIO > + AMD_CXL_FIND_2P0_DEVICES CxlFind2p0Devices; = ///< Finds > CXL 2.0 devices after PCIe enumeration > + AMD_CXL_ENABLE_SCM_PMEM > CxlEnableScmForPersistentMemory; ///< Notifies SMU that CXL persistent > memory is present > +}; > + > +#endif /* NBIO_CXL_SERVICES_PROTOCOL_H */ > diff --git > a/Platform/AMD/AgesaPkg/Include/Protocol/AmdPciResourcesProtocol.h > b/Platform/AMD/AgesaPkg/Include/Protocol/AmdPciResourcesProtocol.h > new file mode 100644 > index 0000000000..7bcff65dc9 > --- /dev/null > +++ > b/Platform/AMD/AgesaPkg/Include/Protocol/AmdPciResourcesProtocol.h > @@ -0,0 +1,110 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef AMD_PCI_RESOURCES_PROTOCOL_H_ > +#define AMD_PCI_RESOURCES_PROTOCOL_H_ > + > +typedef struct { > + UINTN Index; > + UINT8 SocketId; > + UINTN Segment; > + UINTN BaseBusNumber; > +} PCI_ROOT_BRIDGE_OBJECT; > + > +typedef struct { > + UINTN Index; > + BOOLEAN Enabled; > + UINT8 PortPresent; > + UINTN Device; > + UINTN Function; > + UINTN SlotNum; > + // Interrupts are relative to IOAPIC 0->n > + UINTN BridgeInterrupt; // Redirection table entry for m= apped > bridge interrupt > + UINTN EndpointInterruptArray[4]; // Redirection table entries for > mapped INT A/B/C/D > +} PCI_ROOT_PORT_OBJECT; > + > +typedef enum { > + IOMMU =3D 0, > + IOAPIC > +} FIXED_RESOURCE_TYPE; > + > +typedef struct { > + UINTN Index; > + FIXED_RESOURCE_TYPE ResourceType; > + UINTN Address; > + UINTN Limit; > +} FIXED_RESOURCES_OBJECT; > + > +/// Forward declaration for the AMD_PCI_RESOURCES_PROTOCOL. > +typedef struct _AMD_PCI_RESOURCES_PROTOCOL > AMD_PCI_RESOURCES_PROTOCOL; > + > +/** > + * @brief System information through EFI call > + * @details > + */ > +typedef > +EFI_STATUS > +(EFIAPI *AMD_PCI_RESOURCES_GET_NUMBER_OF_ROOTBRIDGES)( > + IN AMD_PCI_RESOURCES_PROTOCOL *This, > + OUT UINTN *NumberOfRootBridges > + ); > + > +typedef > +EFI_STATUS > +(EFIAPI *AMD_PCI_RESOURCES_GET_ROOT_BRIDGE_INFO)( > + IN AMD_PCI_RESOURCES_PROTOCOL *This, > + IN UINTN RootBridgeIndex, > + OUT PCI_ROOT_BRIDGE_OBJECT **RootBridgeInfo > + ); > + > +typedef > +EFI_STATUS > +(EFIAPI *AMD_PCI_RESOURCES_GET_NUMBER_OF_ROOTPORTS)( > + IN AMD_PCI_RESOURCES_PROTOCOL *This, > + IN UINTN RootBridgeIndex, > + OUT UINTN *NumberOfRootPorts > + ); > + > +typedef > +EFI_STATUS > +(EFIAPI *AMD_PCI_RESOURCES_GET_ROOT_PORT_INFO)( > + IN AMD_PCI_RESOURCES_PROTOCOL *This, > + IN UINTN RootBridgeIndex, > + IN UINTN RootPortIndex, > + OUT PCI_ROOT_PORT_OBJECT **RootPortInfo > + ); > + > +typedef > +EFI_STATUS > +(EFIAPI *AMD_PCI_RESOURCES_GET_NUMBER_OF_FIXEDRESOURCES)( > + IN AMD_PCI_RESOURCES_PROTOCOL *This, > + IN UINTN RootBridgeIndex, > + OUT UINTN *NumberOfFixedResources > + ); > + > +typedef > +EFI_STATUS > +(EFIAPI *AMD_PCI_RESOURCES_GET_FIXED_RESOURCE_INFO)( > + IN AMD_PCI_RESOURCES_PROTOCOL *This, > + IN UINTN RootBridgeIndex, > + IN UINTN FixedResourceIndex, > + OUT FIXED_RESOURCES_OBJECT **FixedResourceInfo > + ); > + > +struct _AMD_PCI_RESOURCES_PROTOCOL { > + AMD_PCI_RESOURCES_GET_NUMBER_OF_ROOTBRIDGES > AmdPciResourcesGetNumberOfRootBridges; > + AMD_PCI_RESOURCES_GET_ROOT_BRIDGE_INFO > AmdPciResourcesGetRootBridgeInfo; > + AMD_PCI_RESOURCES_GET_NUMBER_OF_ROOTPORTS > AmdPciResourcesGetNumberOfRootPorts; > + AMD_PCI_RESOURCES_GET_ROOT_PORT_INFO > AmdPciResourcesGetRootPortInfo; > + AMD_PCI_RESOURCES_GET_NUMBER_OF_FIXEDRESOURCES > AmdPciResourcesGetNumberOfFixedResources; > + AMD_PCI_RESOURCES_GET_FIXED_RESOURCE_INFO > AmdPciResourcesGetFixedResourceInfo; > +}; > + > +extern EFI_GUID gAmdPciResourceProtocolGuid; ///< Guid for calli= ng > + > +#endif // AMD_PCI_RESOURCES_PROTOCOL_H_ > diff --git a/Platform/AMD/AgesaPkg/Include/Protocol/AmdPspFtpmProtocol.h > b/Platform/AMD/AgesaPkg/Include/Protocol/AmdPspFtpmProtocol.h > new file mode 100644 > index 0000000000..ebc7812b18 > --- /dev/null > +++ b/Platform/AMD/AgesaPkg/Include/Protocol/AmdPspFtpmProtocol.h > @@ -0,0 +1,187 @@ > +/** @file > + AMD Psp Ftpm Protocol Header > + > + Copyright (C) 2023-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef FTPM_PROTOCOL_H_ > +#define FTPM_PROTOCOL_H_ > + > +#include > +// > +// GUID definition > +// > +extern EFI_GUID gAmdPspFtpmProtocolGuid; > + > +/** > + structure definition for HSP mailbox > + > +**/ > +typedef struct { > + // C2H_TPM_L0 > + UINT64 TPM_L0_Address; /// Mailbox address > + UINT64 TPM_L0_C2H_MSG_Address; /// Doorbell address= CPU- > >HSP > + UINT64 TPM_L0_H2C_MSG_Address; /// Doorbell address= HSP- > >CPU > + > + // C2H_HSP_L0(VLT0) > + UINT64 VLT0_Address; /// Mailbox address > + UINT64 VLT0_C2H_MSG_Address; /// Doorbell address= CPU- > >HSP > + UINT64 VLT0_H2C_MSG_Address; /// Doorbell address= HSP- > >CPU > + > + // C2H_HSP_L1(VLT1) > + UINT64 VLT1_Address; /// Mailbox address > + UINT64 VLT1_C2H_MSG_Address; /// Doorbell address= CPU- > >HSP > + UINT64 VLT1_HSC_MSG_Address; /// Doorbell address= HSP- > >CPU > + > + // Interrupt Information > + UINT8 Gsi[4]; /// Gsi[0] is for HS= P Channel 0 TPM > + /// Gsi[1] is for HS= P Channel 1 VTL0 > + /// Gsi[2] is for HS= P Channel 2 VTL1 > + /// Gsi[3] is reserv= ed > +} HSP_MAILBOX_ADDRESS, *PHSP_MAILBOX_ADDRESS; > + > +typedef union { > + HSP_MAILBOX_ADDRESS HSP_info; > +} FTPM_INFO; > + > +typedef struct _PSP_FTPM_PROTOCOL PSP_FTPM_PROTOCOL; > + > +/** > + Define function prototype: Execute a TPM command > + > + @param[in] This Point to PSP_FTPM_PROTOCOL itself > + @param[in] CommandBuffer Point to the TPM command= buffer > + @param[in] CommandSize Size of the TPM command = buffer > + @param[in, out] ResponseBuffer Point to the TPM respons= e buffer > + @param[in, out] ResponseSize Size of the TPM response= buffer > + > + @return EFI_SUCCESS Command executed successfully > + @return EFI_UNSUPPORTED Device unsupported > + @return EFI_TIMEOUT Command fail due the time out > + @return EFI_DEVICE_ERROR Command fail due the error st= atus set > + @return EFI_BUFFER_TOO_SMALL Response buffer too small to = hold > the response > + > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *FTPM_EXECUTE)( > + IN PSP_FTPM_PROTOCOL *This, > + IN VOID *CommandBuffer, > + IN UINT32 CommandSize, > + IN OUT VOID *ResponseBuffer, > + IN OUT UINT32 *ResponseSize > + ); > + > +/** > + Define function prototype: GET TPM related Information > + > + @param[in] This Point to PSP_FTPM_PROTOCOL itse= lf > + @param[in,out] FtpmStatus Used to hold more detail info (= Unused > Currently) > + > + @return EFI_SUCCESS Ftpm function supported > + @return EFI_UNSUPPORTED Ftpm function unsupported > + > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *FTPM_CHECK_STATUS)( > + IN PSP_FTPM_PROTOCOL *This, > + IN OUT UINTN *FtpmStatus > + ); > + > +/** > + Define function prototype: Send a TPM command > + > + @param[in] This Point to PSP_FTPM_PROTOCOL it= self > + @param[in] CommandBuffer Point to the TPM command buff= er > + @param[in] CommandSize Size of the TPM command buffe= r > + > + @return EFI_SUCCESS Command executed successfully > + @return EFI_UNSUPPORTED Device unsupported > + @return EFI_TIMEOUT Command fail due the time out > + @return EFI_DEVICE_ERROR Command fail due the error st= atus set > + @return EFI_BUFFER_TOO_SMALL Response buffer too small to = hold > the response > + > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *FTPM_SEND_COMMAND)( > + IN PSP_FTPM_PROTOCOL *This, > + IN VOID *CommandBuffer, > + IN UINT32 CommandSize > + ); > + > +/** > + Define function prototype: Get a TPM command's response > + > + @param[in] This Point to PSP_FTPM_PROTOC= OL itself > + @param[in, out] ResponseBuffer Point to the TPM respons= e buffer > + @param[in, out] ResponseSize Size of the TPM response= buffer > + > + @return EFI_SUCCESS Command executed successfully > + @return EFI_UNSUPPORTED Device unsupported > + @return EFI_TIMEOUT Command fail due the time out > + @return EFI_DEVICE_ERROR Command fail due the error st= atus set > + @return EFI_BUFFER_TOO_SMALL Response buffer too small to = hold > the response > + > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *FTPM_GET_RESPONSE)( > + IN PSP_FTPM_PROTOCOL *This, > + IN OUT VOID *ResponseBuffer, > + IN OUT UINT32 *ResponseSize > + ); > + > +/** > + Define function prototype: Get TCG Logs > + This function only implemented on Pluton-fTPM > + > + @param[in] This Point to PSP_FTPM_PROTOC= OL itself > + @param[in, out] ResponseBuffer Point to the TPM respons= e buffer > + @param[in, out] ResponseSize Size of the TPM response= buffer > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *FTPM_GET_TCG_LOGS)( > + IN PSP_FTPM_PROTOCOL *This, > + IN OUT VOID *ResponseBuffer, > + IN OUT UINTN *ResponseSize > + ); > + > +/** > + Function prototype for GetHspfTPMInfo. Return Pluton mailbox base > address to SBIOS. > + SBIOS should call this procedure after PCI Enumeration Complete. > + > + @param[in] This Point to PSP_FTPM_PROTOCOL itself > + @param[in,out] FtpmInfo Point to Pluton mailbox base address > + > + @return EFI_SUCCESS - Success > + @return EFI_INVALID_PARAMETER - Input parameter is invalid > + @return EFI_NOT_READY - Pluton-fTPM device BAR0 MMIO is= not > ready. > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *FTPM_GET_TPM_INFO)( > + IN PSP_FTPM_PROTOCOL *This, > + IN OUT VOID *FtpmInfo > + ); > + > +/** > + PSP_FTPM_PROTOCOL prototype > + > + Defines PSP_FTPM_PROTOCOL. This protocol is used to get Ftpm info > + Send TPM command, Get TPM command's response, Execute TPM > command(Include send & get response) > +**/ > +typedef struct _PSP_FTPM_PROTOCOL { > + FTPM_EXECUTE Execute; ///< Execute TPM com= mand, > include send & get response > + FTPM_CHECK_STATUS CheckStatus; ///< Check TPM Statu= s > + FTPM_SEND_COMMAND SendCommand; ///< Send TPM > command > + FTPM_GET_RESPONSE GetResponse; ///< Get Last TPM co= mmand > response > + FTPM_GET_TCG_LOGS GetTcgLogs; ///< Get TCG Logs > + FTPM_GET_TPM_INFO GetInfo; ///< Get TPM info > +} PSP_FTPM_PROTOCOL; > + > +#endif //FTPM_PROTOCOL_H_ > diff --git > a/Platform/AMD/AgesaPkg/Include/Protocol/FabricResourceManagerService > sProtocol.h > b/Platform/AMD/AgesaPkg/Include/Protocol/FabricResourceManagerService > sProtocol.h > new file mode 100644 > index 0000000000..7f57facf88 > --- /dev/null > +++ > b/Platform/AMD/AgesaPkg/Include/Protocol/FabricResourceManagerService > sProtocol.h > @@ -0,0 +1,14 @@ > +/** @file > + Fabric MMIO map manager Protocol prototype definition > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef FABRIC_RESOURCE_MANAGER_SERVICES_PROTOCOL_H_ > +#define FABRIC_RESOURCE_MANAGER_SERVICES_PROTOCOL_H_ > +#include > + > +#endif // FABRIC_RESOURCE_MANAGER_SERVICES_PROTOCOL_H_ > diff --git a/Platform/AMD/AmdCpmPkg/Include/AmdCpmBase.h > b/Platform/AMD/AmdCpmPkg/Include/AmdCpmBase.h > new file mode 100644 > index 0000000000..a7fef5a35c > --- /dev/null > +++ b/Platform/AMD/AmdCpmPkg/Include/AmdCpmBase.h > @@ -0,0 +1,19 @@ > +/** @file > + AMD CPM Base Definitions. > + > + Copyright (C) 2014-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef AMD_CPM_BASE_H_ > +#define AMD_CPM_BASE_H_ > + > +#include > +#include > +#include > +#include > +#include > + > +#endif // AMD_CPM_BASE_H_ > diff --git a/Platform/AMD/AmdCpmPkg/Include/AmdCpmCommon.h > b/Platform/AMD/AmdCpmPkg/Include/AmdCpmCommon.h > new file mode 100644 > index 0000000000..af192fcf03 > --- /dev/null > +++ b/Platform/AMD/AmdCpmPkg/Include/AmdCpmCommon.h > @@ -0,0 +1,78 @@ > +/** @file > + AMD CPM Common Definitions. > + > + Copyright (C) 2012-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef AMD_CPM_COMMON_H_ > +#define AMD_CPM_COMMON_H_ > + > +#pragma pack(push) > + > +#include > +#include > +#include > +#include > + > +/// The signatures of CPM table > + > +typedef enum { > + CPM_SIGNATURE_DXIO_TOPOLOGY =3D SIGNATURE_32 ('$', 'A', = '2', > '6'), ///< The signature of Socket 0 AMD_CPM_DXIO_TOPOLOGY_TABLE > + CPM_SIGNATURE_DXIO_TOPOLOGY_S1 =3D SIGNATURE_32 ('$', 'A', = '2', > '7') ///< The signature of Socket 1 AMD_CPM_DXIO_TOPOLOGY_TABLE > +} AMD_CPM_TABLE_SIGNATURE; > + > +/// CPM table header > +typedef struct { > + UINT32 TableSignature; ///< Signa= ture of CPM table > + UINT16 TableSize; ///< Table= size > + UINT8 FormatRevision; ///< Revis= ion of table format > + UINT8 ContentRevision; ///< Revis= ion of table content > + UINT32 PlatformMask; ///< The m= ask of platform table > supports > + UINT32 Attribute; ///< Table= attribute > +} AMD_CPM_TABLE_COMMON_HEADER; > + > +/// Table pointer > +typedef union { > + VOID *Pointer; ///< Table= pointer > + UINT64 Raw; ///< Table= pointer value > +} AMD_CPM_POINTER; > + > +/// DXIO Topology Table > +typedef struct { > + AMD_CPM_TABLE_COMMON_HEADER Header; = ///< > Table header > + UINT32 SocketId; = ///< Socket Id > + DXIO_PORT_DESCRIPTOR Port[AMD_DXIO_PORT_DESCRIPTOR_SIZE]; > ///< DXIO Port Descriptor List > +} AMD_CPM_DXIO_TOPOLOGY_TABLE; > + > +/// AMD CPM Main Table > +typedef struct { > + AMD_CPM_TABLE_COMMON_HEADER Header; ///< T= able > header > + UINT8 PlatformName[32]; ///< P= latform name > + UINT8 BiosType; ///< B= IOS type > + UINT16 CurrentPlatformId; ///< C= urrent Platform Id > + UINT32 PcieMemIoBaseAddr; ///< > PcieMemIoBaseAddr > + UINT32 AcpiMemIoBaseAddr; ///< > AcpiMemIoBaseAddr > + AMD_CPM_POINTER Service; ///< R= eserved for > internal use > + AMD_CPM_POINTER TableInRomList; ///< R= eserved for > internal use > + AMD_CPM_POINTER TableInRamList; ///< R= eserved for > internal use > + AMD_CPM_POINTER TableInHobList; ///< R= eserved for > internal use > + AMD_CPM_POINTER HobTablePtr; ///< R= eserved for > internal use > + > + UINT8 ExtClkGen; ///< E= xternal ClkGen Config. > 0x00~0x7F > + UINT8 UnusedGppClkOffEn; ///< C= onfig to turn off > unused GPP clock > + UINT8 LpcUartEn; ///< L= pcUartEn > + UINT64 AltAcpiMemIoBaseAddr; ///< A= lternate > AcpiMemIoBaseAddr for Slave FCH > +} AMD_CPM_MAIN_TABLE; > + > +/// Structure for Chip Id > +typedef struct { > + UINT8 Cpu; ///< CPU/A= PU Chip Id > + UINT8 Sb; ///< SB Ch= ip Id > + UINT8 Reserved[6]; > +} AMD_CPM_CHIP_ID; > +#pragma pack (pop) > + > +#endif //AMD_CPM_COMMON_H_ > diff --git a/Platform/AMD/AmdCpmPkg/Include/AmdCpmDefine.h > b/Platform/AMD/AmdCpmPkg/Include/AmdCpmDefine.h > new file mode 100644 > index 0000000000..4fc3f97a80 > --- /dev/null > +++ b/Platform/AMD/AmdCpmPkg/Include/AmdCpmDefine.h > @@ -0,0 +1,17 @@ > +/** @file > + AMD CPM Common Definitions. > + > + Copyright (C) 2012-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef AMD_CPM_DEFINE_H_ > +#define AMD_CPM_DEFINE_H_ > + > +#ifndef AMD_DXIO_PORT_DESCRIPTOR_SIZE > +#define AMD_DXIO_PORT_DESCRIPTOR_SIZE 0x30 > +#endif > + > +#endif // AMD_CPM_DEFINE_H_ > diff --git a/Platform/AMD/AmdCpmPkg/Include/AmdCpmFunction.h > b/Platform/AMD/AmdCpmPkg/Include/AmdCpmFunction.h > new file mode 100644 > index 0000000000..7dce238135 > --- /dev/null > +++ b/Platform/AMD/AmdCpmPkg/Include/AmdCpmFunction.h > @@ -0,0 +1,32 @@ > +/** @file > + AMD CPM Common Functions. > + > + Copyright (C) 2012-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef AMD_CPM_FUNCTION_H_ > +#define AMD_CPM_FUNCTION_H_ > + > +typedef VOID *(EFIAPI *AMD_CPM_GETTABLEPTR_FN)( > + IN VOID *This, > + IN UINT32 TableId > + ); > + > +typedef AGESA_STATUS (EFIAPI *AMD_CPM_GETPOSTEDVBIOSIMAGE_FN)( > + IN GFX_VBIOS_IMAGE_INFO *VbiosImageInfo > + ); > + > +/// Common Functions for CPM Drivers > +typedef struct _AMD_CPM_COMMON_FUNCTION { > + AMD_CPM_GETTABLEPTR_FN GetTablePtr2; ///< Get CPM= Table > Pointer. The table can be re-writable > +} AMD_CPM_COMMON_FUNCTION; > + > +/// CPM Public Functions for platform DXE Driver to use > +typedef struct _AMD_CPM_DXE_PUBLIC_FUNCTION { > + AMD_CPM_GETPOSTEDVBIOSIMAGE_FN GetPostedVbiosImage; ///< > Get posted VBIOS image > +} AMD_CPM_DXE_PUBLIC_FUNCTION; > + > +#endif //AMD_CPM_FUNCTION_H_ > diff --git > a/Platform/AMD/AmdCpmPkg/Library/Protocol/AmdCpmTableProtocol/Amd > CpmTableProtocol.h > b/Platform/AMD/AmdCpmPkg/Library/Protocol/AmdCpmTableProtocol/Amd > CpmTableProtocol.h > new file mode 100644 > index 0000000000..4a90aa3d8b > --- /dev/null > +++ > b/Platform/AMD/AmdCpmPkg/Library/Protocol/AmdCpmTableProtocol/Amd > CpmTableProtocol.h > @@ -0,0 +1,39 @@ > +/** @file > + AMD CPM Table Protocol. > + > + Copyright (C) 2012-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef AMD_CPM_TABLE_PROTOCOL_H_ > +#define AMD_CPM_TABLE_PROTOCOL_H_ > + > +#include > + > +// > +// GUID definition > +// > +#define AMD_CPM_TABLE_PROTOCOL_GUID \ > + { 0x3724cf01, 0x00c2, 0x9762, 0x11, 0xb3, 0x0e, 0xa8, 0xaa, 0x89, 0x72= , > 0x00 } > + > +#define AMD_CPM_TABLE_SMM_PROTOCOL_GUID \ > + { 0xaf6efacf, 0x7a13, 0x45a3, 0xb1, 0xa5, 0xaa, 0xfc, 0x06, 0x1c, 0x4b= , > 0x79 } > + > +extern EFI_GUID gAmdCpmTableProtocolGuid; > +extern EFI_GUID gAmdCpmTableSmmProtocolGuid; > + > +/// DXE Protocol Structure > +typedef struct _AMD_CPM_TABLE_PROTOCOL { > + UINTN Revision; ///< P= rotocol Revision > + AMD_CPM_MAIN_TABLE *MainTablePtr; ///< P= ointer to > CPM Main Table > + AMD_CPM_CHIP_ID ChipId; ///< I= d of SB Chip > + AMD_CPM_COMMON_FUNCTION CommonFunction; ///< > Private Common Functions > + AMD_CPM_DXE_PUBLIC_FUNCTION DxePublicFunction; ///< > Public Function of Protocol > +} AMD_CPM_TABLE_PROTOCOL; > + > +// Current Protocol Revision > +#define AMD_CPM_TABLE_PROTOCOL_REV 0x00 > + > +#endif // AMD_CPM_TABLE_PROTOCOL_H_ > diff --git > a/Platform/AMD/AgesaModulePkg/Library/AmdPspMboxLibV2/AmdPspMbox > LibV2.c > b/Platform/AMD/AgesaModulePkg/Library/AmdPspMboxLibV2/AmdPspMbox > LibV2.c > new file mode 100644 > index 0000000000..fa83888e95 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/AmdPspMboxLibV2/AmdPspMbox > LibV2.c > @@ -0,0 +1,31 @@ > +/** @file > + PSP Mailbox related functions > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > + > +/** > + * @brief Bios send these commands to PSP to grant dTPM status and event > log > + * > + * @param[out] DesiredConfig dTPM configuration requested > + * @param[out] ConfigStatus 0 - success. non-zero failure. > + * @param[in,out] LogDataSize Size of LogData buffer > + * @param[out] LogData Point to allocated event log buf= fer > + * > + * @retval EFI_STATUS 0: Success, NonZero Error > + */ > +EFI_STATUS > +PspMboxGetDTPMData ( > + OUT UINT32 *DesiredConfig, > + OUT UINT32 *ConfigStatus, > + IN OUT UINT32 *LogDataSize, > + OUT VOID *LogData > + ) > +{ > + return EFI_SUCCESS; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/AmdPspRomArmorLib/AmdPspRo > mArmorLib.c > b/Platform/AMD/AgesaModulePkg/Library/AmdPspRomArmorLib/AmdPspRo > mArmorLib.c > new file mode 100644 > index 0000000000..0e9baad955 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/AmdPspRomArmorLib/AmdPspRo > mArmorLib.c > @@ -0,0 +1,12 @@ > +/** @file > + > + Copyright (C) 2019-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > +#include > diff --git > a/Platform/AMD/AgesaModulePkg/Library/AmdPspRomArmorLibNull/AmdPs > pRomArmorLibNull.c > b/Platform/AMD/AgesaModulePkg/Library/AmdPspRomArmorLibNull/AmdPs > pRomArmorLibNull.c > new file mode 100644 > index 0000000000..a04bc1f992 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/AmdPspRomArmorLibNull/AmdPs > pRomArmorLibNull.c > @@ -0,0 +1,79 @@ > +/** @file > + > + Copyright (C) 2019-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > + > +/** > + * Request secures the SPI Controller > + * > + * @param[in, out] SpiCommunicationBuffer SPI Communication Structur= e > Buffer pointer > + * > + * @retval EFI_SUCCESS Initial success > + * @retval Others Error happens during initialize > + */ > +EFI_STATUS > +EFIAPI > +PspEnterSmmOnlyMode ( > + IN SPI_COMMUNICATION_BUFFER *SpiCommunicationBuffer > + ) > +{ > + return EFI_UNSUPPORTED; > +} > + > +/** > + * Loads the whitelist into the PSP. > + * > + * @param[in] SpiWhitelist SPI White List structure b= uffer pointer. > + * > + * @retval EFI_SUCCESS Initial success > + * @retval Others Error happens during initialize > + */ > +EFI_STATUS > +EFIAPI > +PspEnforceWhitelist ( > + IN SPI_WHITE_LIST *SpiWhitelist > + ) > +{ > + return EFI_UNSUPPORTED; > +} > + > +/** > + * Request execute SPI command provide in TSEG comm buffer. > + * > + * @param[in] NONE > + * > + * @retval EFI_SUCCESS Initial success > + * @retval Others Error happens during initialize > + */ > +EFI_STATUS > +EFIAPI > +PspExecuteSpiCommand ( > + VOID > + ) > +{ > + return EFI_UNSUPPORTED; > +} > + > +/** > + * Request PSP firmware switch SPI controller chip select. > + * > + * > + * @param[in] Chipset SPI controller chip select= , 0=3D Allowed on > all chip selects, 1=3D CS1, 2=3D CS2, all else invalid > + * > + * @retval EFI_SUCCESS Initial success > + * @retval Others Error happens during initialize > + */ > +EFI_STATUS > +EFIAPI > +PspSwitchChipSelect ( > + IN UINT8 ChipSelect > + ) > +{ > + return EFI_UNSUPPORTED; > +} > diff --git a/Platform/AMD/AgesaModulePkg/Library/ApcbLibV3/ApcbLibV3.c > b/Platform/AMD/AgesaModulePkg/Library/ApcbLibV3/ApcbLibV3.c > new file mode 100644 > index 0000000000..fce82d75b0 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Library/ApcbLibV3/ApcbLibV3.c > @@ -0,0 +1,12 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > +#include > +#include > +#include > +#include > +#include > diff --git > a/Platform/AMD/AgesaModulePkg/Library/ApcbLibV3Pei/ApcbLibV3Pei.c > b/Platform/AMD/AgesaModulePkg/Library/ApcbLibV3Pei/ApcbLibV3Pei.c > new file mode 100644 > index 0000000000..f8b9eb0bcf > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/ApcbLibV3Pei/ApcbLibV3Pei.c > @@ -0,0 +1,14 @@ > +/** @file > + > + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > +#include > +#include > +#include > diff --git > a/Platform/AMD/AgesaModulePkg/Library/BaseFabricTopologyRsLib/BaseFab > ricTopologyRsLib.c > b/Platform/AMD/AgesaModulePkg/Library/BaseFabricTopologyRsLib/BaseFab > ricTopologyRsLib.c > new file mode 100644 > index 0000000000..cff678d76b > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/BaseFabricTopologyRsLib/BaseFab > ricTopologyRsLib.c > @@ -0,0 +1,37 @@ > +** @file > + Fabric Topology Base Lib implementation > + > + Copyright (C) 2020-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > + > +UINTN > +FabricTopologyGetNumberOfProcessorsPresent ( > + VOID > + ) > +{ > + return 0; > +} > + > +UINTN > +FabricTopologyGetNumberOfRootBridgesOnSocket ( > + IN UINTN Socket > + ) > +{ > + return 0; > +} > + > +RETURN_STATUS > +EFIAPI > +BaseFabricTopologyLibConstructor ( > + VOID > + ) > +{ > + return EFI_SUCCESS; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/BaseTscTimerLib.c > b/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/BaseTscTimerLib. > c > new file mode 100644 > index 0000000000..f72cbe7dff > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/BaseTscTimerLib. > c > @@ -0,0 +1,8 @@ > +/** @file > + A Base Timer Library implementation which uses the Time Stamp Counter = in > the processor. > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > diff --git > a/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/DxeTscTimerLib.c > b/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/DxeTscTimerLib.c > new file mode 100644 > index 0000000000..a155978a5d > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/DxeTscTimerLib.c > @@ -0,0 +1,35 @@ > +/** @file > + A Dxe Timer Library implementation which uses the Time Stamp Counter i= n > the processor. > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > +#include > + > +/** The constructor function determines the actual TSC frequency. > + > + First, Get TSC frequency from system configuration table with TSC > frequency GUID, > + if the table is not found, install it. > + This function will always return EFI_SUCCESS. > + > + @param ImageHandle The firmware allocated handle for the EFI im= age. > + @param SystemTable A pointer to the EFI System Table. > + > + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. > + > +**/ > +EFI_STATUS > +EFIAPI > +DxeTscTimerLibConstructor ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + return EFI_SUCCESS; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/PeiTscTimerLib.c > b/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/PeiTscTimerLib.c > new file mode 100644 > index 0000000000..f70aa3de0e > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/PeiTscTimerLib.c > @@ -0,0 +1,11 @@ > +/** @file > + A Pei Timer Library implementation which uses the Time Stamp Counter i= n > the processor. > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > diff --git > a/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/TscTimerLibShare. > c > b/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/TscTimerLibShare > .c > new file mode 100644 > index 0000000000..7d14d62e60 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/CcxTscTimerLib/TscTimerLibShare > .c > @@ -0,0 +1,103 @@ > +/** @file > + The Timer Library implementation which uses the Time Stamp Counter in > the processor. > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +/** Stalls the CPU for at least the specified number of MicroSeconds. > + > + @param[in] MicroSeconds The minimum number of microseconds to > delay. > + > + @return The value of MicroSeconds input. > + > +**/ > +UINTN > +EFIAPI > +MicroSecondDelay ( > + IN UINTN MicroSeconds > + ) > +{ > + return 0; > +} > + > +/** Stalls the CPU for at least the specified number of NanoSeconds. > + > + @param[in] NanoSeconds The minimum number of nanoseconds to delay. > + > + @return The value of NanoSeconds input. > + > +**/ > +UINTN > +EFIAPI > +NanoSecondDelay ( > + IN UINTN NanoSeconds > + ) > +{ > + return 0; > +} > + > +/** Retrieves the current value of the 64-bit free running Time-Stamp > counter. > + > + The properties of the counter can be retrieved by the > + GetPerformanceCounterProperties() function. > + > + @return The current value of the free running performance counter. > + > +**/ > +UINT64 > +EFIAPI > +GetPerformanceCounter ( > + VOID > + ) > +{ > + return 0; > +} > + > +/** Retrieves the 64-bit frequency in Hz and the range of performance > counter > + values. > + > + If StartValue is not NULL, then the value that the performance counter > starts > + with, 0x0, is returned in StartValue. If EndValue is not NULL, then th= e value > + that the performance counter end with, 0xFFFFFFFFFFFFFFFF, is returned= in > + EndValue. > + > + The 64-bit frequency of the performance counter, in Hz, is always retu= rned. > + > + @param[out] StartValue Pointer to where the performance counter's > starting value is saved, or NULL. > + @param[out] EndValue Pointer to where the performance counter's > ending value is saved, or NULL. > + > + @return The frequency in Hz. > + > +**/ > +UINT64 > +EFIAPI > +GetPerformanceCounterProperties ( > + OUT UINT64 *StartValue, OPTIONAL > + OUT UINT64 *EndValue OPTIONAL > + ) > +{ > + return 0; > +} > + > +/** > + Converts elapsed ticks of performance counter to time in nanoseconds. > + > + This function converts the elapsed ticks of running performance counte= r to > + time value in unit of nanoseconds. > + > + @param Ticks The number of elapsed ticks of running performance > counter. > + > + @return The elapsed time in nanoseconds. > + > +**/ > +UINT64 > +EFIAPI > +GetTimeInNanoSecond ( > + IN UINT64 Ticks > + ) > +{ > + return 0; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/DxeAmdPciHostBridgeLib/PciHost > BridgeLib.c > b/Platform/AMD/AgesaModulePkg/Library/DxeAmdPciHostBridgeLib/PciHost > BridgeLib.c > new file mode 100644 > index 0000000000..44e23df62f > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/DxeAmdPciHostBridgeLib/PciHost > BridgeLib.c > @@ -0,0 +1,95 @@ > +/** @file > + AMD instance of the PCI Host Bridge Library. > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +/** > + Sort all root bridges in bus ascending order and set DevicePath UIDs > + continuous and ascending from zero > + > + @param[in,out] RootBridgeList Array of root bridges. > + @param[in] Count Count of root bridges in RootBridgeLis= t > + > + @return All the root bridge instances in an array are sorted in bus or= der. > + DevicePath UID updated to continuous and ascending numbers sta= rting > + with 0. > +**/ > +VOID > +EFIAPI > +PciHostBridgeSortRootBridges ( > + IN PCI_ROOT_BRIDGE *RootBridgeList, > + IN UINTN Count > + ) > +{ > +} > + > +/** > + 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 > + ) > +{ > + return (PCI_ROOT_BRIDGE *)NULL; > +} > + > +/** > + Free the root bridge instances array returned from > PciHostBridgeGetRootBridges(). > + > + @param Bridges The root bridge instances array. > + @param Count The count of the array. > +**/ > +VOID > +EFIAPI > +PciHostBridgeFreeRootBridges ( > + PCI_ROOT_BRIDGE *Bridges, > + UINTN Count > + ) > +{ > +} > + > +/** > + 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 re= sources > + for all the root bridges. The resource for eac= h root > + bridge is terminated with END descriptor and a= n > + additional END is appended indicating the end = of the > + entire resources. The resource descriptor fiel= d > + values follow the description in > + EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOC= OL > + .SubmitResources(). > +**/ > +VOID > +EFIAPI > +PciHostBridgeResourceConflict ( > + EFI_HANDLE HostBridgeHandle, > + VOID *Configuration > + ) > +{ > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlArgObj > ects.c > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlArgObj > ects.c > new file mode 100644 > index 0000000000..318f8e5ad7 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlArgObj > ects.c > @@ -0,0 +1,154 @@ > +/** @file > + > + Copyright (C) 2021-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "LocalAmlLib.h" > +#include > + > +#define FILECODE > LIBRARY_DXEAMLGENERATIONLIB_AMLARGOBJECTS_FILECODE > + > +/* > + Fill the DataBuffer with correct Arg Opcode based on provided argument > number > + Valid Argument numbers are 0, 1, 2, 3, 4, 5 and 6. > + AML supports max 7 argument, i.e., Arg1, Arg2 ... Arg6. > + > + @param[in] ArgN - Argument Number > + @param[out] ReturnData - Allocated DataBuffer with encoded inte= ger > + @param[out] ReturnDataSize - Size of ReturnData > + > + @return EFI_SUCCESS - Successful completion > + @return EFI_OUT_OF_RESOURCES - Failed to allocate ReturnDataBuf= fer > + @return EFI_INVALID_PARAMETER - Invalid ArgN provided. > +*/ > +EFI_STATUS > +EFIAPI > +InternalAmlArgBuffer ( > + IN OUT UINT8 ArgN, > + OUT VOID **ReturnData, > + OUT UINTN *ReturnDataSize > + ) > +{ > + UINT8 *Data; > + UINTN DataSize; > + > + Data =3D AllocateZeroPool (sizeof (UINT8)); > + if (Data =3D=3D NULL) { > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: Failed to create Data Buffer.\n", > + __func__ > + )); > + return EFI_OUT_OF_RESOURCES; > + } > + > + DataSize =3D 1; > + switch (ArgN) { > + case 0: > + Data[0] =3D AML_ARG0; > + break; > + case 1: > + Data[0] =3D AML_ARG1; > + break; > + case 2: > + Data[0] =3D AML_ARG2; > + break; > + case 3: > + Data[0] =3D AML_ARG3; > + break; > + case 4: > + Data[0] =3D AML_ARG4; > + break; > + case 5: > + Data[0] =3D AML_ARG5; > + break; > + case 6: > + Data[0] =3D AML_ARG6; > + break; > + default: > + FreePool (Data); > + return EFI_INVALID_PARAMETER; > + } > + > + *ReturnData =3D (VOID *)Data; > + *ReturnDataSize =3D DataSize; > + > + return EFI_SUCCESS; > +} > + > +/** > + Creates an ArgN Opcode object > + > + Arg Objects Encoding > + ArgObj :=3D Arg0Op | Arg1Op | Arg2Op | Arg3Op | Arg4Op | Arg5Op | > Arg6Op > + Arg0Op :=3D 0x68 > + Arg1Op :=3D 0x69 > + Arg2Op :=3D 0x6A > + Arg3Op :=3D 0x6B > + Arg4Op :=3D 0x6C > + Arg5Op :=3D 0x6D > + Arg6Op :=3D 0x6E > + > + @param[in] ArgN - Argument Number to be encoded > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > +**/ > +EFI_STATUS > +EFIAPI > +AmlOpArgN ( > + IN UINT8 ArgN, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + > + if (ListHead =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: Start %a object\n", > + __func__, > + "ARGN_OPCODE" > + )); > + goto Done; > + } > + > + Status =3D InternalAmlArgBuffer ( > + ArgN, > + (VOID **)&(Object->Data), > + &(Object->DataSize) > + ); > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: ACPI Argument 0x%X object\n", > + __func__, > + ArgN > + )); > + goto Done; > + } > + > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlAssistF > unctions.c > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlAssistF > unctions.c > new file mode 100644 > index 0000000000..371537c9aa > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlAssistF > unctions.c > @@ -0,0 +1,151 @@ > +/** @file > + > + Copyright (C) 2020-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "LocalAmlLib.h" > +#include > + > +#define FILECODE > LIBRARY_DXEAMLGENERATIONLIB_AMLASSISTFUNCTIONS_FILECODE > + > +/** > + Free all the children AML_OBJECT_INSTANCE(s) of ListHead. > + Will not free ListHead nor an Object containing ListHead. > + > + @param[in,out] ListHead - Head of linked list of Objects > + > + @retval EFI_SUCCESS > +**/ > +EFI_STATUS > +EFIAPI > +AmlFreeObjectList ( > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + LIST_ENTRY *Node; > + AML_OBJECT_INSTANCE *Object; > + > + Node =3D GetNextNode (ListHead, ListHead); > + while (Node !=3D ListHead) { > + Object =3D AML_OBJECT_INSTANCE_FROM_LINK (Node); > + // Get next node before freeing current Object > + Node =3D GetNextNode (ListHead, Node); > + // Free Object > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return EFI_SUCCESS; > +} > + > +/** > + Validate that ACPI table is completed and return Table and Size > + > + @param[in,out] ListHead - Head of linked list of Objects > + @param[out] Table - Completed ACPI Table > + @param[out] TableSize - Completed ACPI Table size > + > + @retval EFI_SUCCESS > + EFI_INVALID_PARAMETER > + EFI_DEVICE_ERROR > +**/ > +EFI_STATUS > +EFIAPI > +AmlGetCompletedTable ( > + IN OUT LIST_ENTRY *ListHead, > + OUT VOID **Table, > + OUT UINTN *TableSize > + ) > +{ > + LIST_ENTRY *Node; > + AML_OBJECT_INSTANCE *Object; > + > + if (ListHead =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: ListHead cannot be NULL\n", > __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + *Table =3D NULL; > + *TableSize =3D 0; > + Node =3D GetFirstNode (ListHead); > + if (!IsNodeAtEnd (ListHead, Node)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Multiple nodes remain, Likely > missed an 'AmlClose' call\n", __func__)); > + return EFI_DEVICE_ERROR; > + } else { > + Object =3D AML_OBJECT_INSTANCE_FROM_LINK (Node); > + if (!Object->Completed) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Final node not completed: Likely > missed an 'AmlCLose' call\n", __func__)); > + return EFI_DEVICE_ERROR; > + } > + > + *Table =3D Object->Data; > + *TableSize =3D Object->DataSize; > + } > + > + return EFI_SUCCESS; > +} > + > +/** > + Initialize Table List to work with AmlGenerationLib > + > + Allocates a LIST_ENTRY linked list item and initializes it. Use > + AmlReleaseTableList to free resulting table and LIST_ENTRY. > + > + @param[in,out] ListHead - Head of linked list of Objects > + > + @retval EFI_SUCCESS > + EFI_INVALID_PARAMETER > + EFI_OUT_OF_RESOURCES > +**/ > +EFI_STATUS > +EFIAPI > +AmlInitializeTableList ( > + IN OUT LIST_ENTRY **ListHead > + ) > +{ > + if (ListHead =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: ListHead =3D NULL\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + *ListHead =3D AllocatePool (sizeof (LIST_ENTRY)); > + if (*ListHead =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Unable to allocate Table List Head\= n", > __func__)); > + return EFI_OUT_OF_RESOURCES; > + } > + > + InitializeListHead (*ListHead); > + > + return EFI_SUCCESS; > +} > + > +/** > + Release table List > + > + Releases all elements. Use to free built table and LIST_ENTRY allocat= ed by > + AmlInitializeTableList. > + > + @param[in,out] ListHead - Head of linked list of Objects > + > + @retval EFI_SUCCESS > + EFI_INVALID_PARAMETER > +**/ > +EFI_STATUS > +EFIAPI > +AmlReleaseTableList ( > + IN OUT LIST_ENTRY **ListHead > + ) > +{ > + if (*ListHead =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: NULL ListHead passed in\n", > __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + AmlFreeObjectList (*ListHead); > + FreePool (*ListHead); > + *ListHead =3D NULL; > + > + return EFI_SUCCESS; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlDataOb > jects.c > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlDataOb > jects.c > new file mode 100644 > index 0000000000..b7d4f4c9d7 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlDataOb > jects.c > @@ -0,0 +1,640 @@ > +/** @file > + > + Copyright (C) 2020-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "LocalAmlLib.h" > +#include > + > +#define FILECODE > LIBRARY_DXEAMLGENERATIONLIB_AMLDATAOBJECTS_FILECODE > + > +/* > + Creates an allocated buffer with sized data and no Op Code > + > + ByteData :=3D 0x00 - 0xFF > + WordData :=3D ByteData[0:7] ByteData[8:15] // 0x0000-0xFFFF > + DWordData :=3D WordData[0:15] WordData[16:31] // 0x00000000- > 0xFFFFFFFF > + QWordData :=3D DWordData[0:31] DWordData[32:63] // > 0x0000000000000000- 0xFFFFFFFFFFFFFFFF > + > + Forces max integer size UINT64 > + > + Caller is responsible for freeing returned buffer. > + > + @param[in] Integer - Integer value to encode > + @param[in] IntegerSize - Size of integer in bytes > + @param[out] ReturnData - Allocated DataBuffer with encoded inte= ger > + @param[out] ReturnDataSize - Size of ReturnData > + > + @return EFI_SUCCESS - Successful completion > + @return EFI_OUT_OF_RESOURCES - Failed to allocate ReturnDataBuff= er > +*/ > +EFI_STATUS > +EFIAPI > +InternalAmlSizedDataBuffer ( > + IN UINT64 Integer, > + IN UINTN IntegerSize, > + OUT VOID **ReturnData > + ) > +{ > + UINT8 *Data; > + > + if ((IntegerSize !=3D sizeof (UINT8)) && > + (IntegerSize !=3D sizeof (UINT16)) && > + (IntegerSize !=3D sizeof (UINT32)) && > + (IntegerSize !=3D sizeof (UINT64))) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Incorrect integer size=3D%d > requested.\n", __func__, IntegerSize)); > + return EFI_INVALID_PARAMETER; > + } > + > + if ((IntegerSize < sizeof (UINT64)) && (Integer >=3D LShiftU64 (1, Int= egerSize * > 8))) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Integer is larger than requestd > size.\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + // Max Data Size is 64 bit. Plus one Opcode byte > + Data =3D AllocateZeroPool (sizeof (UINT64)); > + if (Data =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Integer Space Alloc Failed\n", > __func__)); > + return EFI_OUT_OF_RESOURCES; > + } > + > + // Already established we only have supported sizes above > + switch (IntegerSize) { > + case sizeof (UINT8): > + *(UINT8 *)Data =3D (UINT8)Integer; > + break; > + case sizeof (UINT16): > + *(UINT16 *)Data =3D (UINT16)Integer; > + break; > + case sizeof (UINT32): > + *(UINT32 *)Data =3D (UINT32)Integer; > + break; > + case sizeof (UINT64): > + *(UINT64 *)Data =3D (UINT64)Integer; > + break; > + } > + > + *ReturnData =3D (VOID *)Data; > + return EFI_SUCCESS; > +} > + > +/* > + Calculates the optimized integer value used by AmlOPDataInteger and > others > + > + Forces max integer size UINT64 > + > + @param[in] Integer - Integer value to encode > + @param[out] ReturnData - Allocated DataBuffer with encoded inte= ger > + @param[out] ReturnDataSize - Size of ReturnData > + > + @return EFI_SUCCESS - Successful completion > + @return EFI_OUT_OF_RESOURCES - Failed to allocate ReturnDataBuff= er > +*/ > +EFI_STATUS > +EFIAPI > +InternalAmlDataIntegerBuffer ( > + IN UINT64 Integer, > + OUT VOID **ReturnData, > + OUT UINTN *ReturnDataSize > + ) > +{ > + UINT8 *IntegerData; > + UINTN IntegerDataSize; > + UINT8 *Data =3D NULL; > + UINTN DataSize; > + > + // Max Data Size is 64 bit. Plus one Opcode byte > + IntegerData =3D AllocateZeroPool (sizeof (UINT64) + 1); > + if (IntegerData =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Integer Space Alloc Failed\n", > __func__)); > + return EFI_OUT_OF_RESOURCES; > + } > + > + if (Integer =3D=3D 0) { > + // ZeroOp > + IntegerDataSize =3D 1; > + IntegerData[0] =3D AML_ZERO_OP; > + } else if (Integer =3D=3D 1) { > + // OneOp > + IntegerDataSize =3D 1; > + IntegerData[0] =3D AML_ONE_OP; > + } else if (Integer =3D=3D (UINT64) ~0x0) { > + // OnesOp > + IntegerDataSize =3D 1; > + IntegerData[0] =3D AML_ONES_OP; > + } else { > + if (Integer >=3D 0x100000000) { > + // QWordConst > + IntegerDataSize =3D sizeof (UINT64) + 1; > + IntegerData[0] =3D AML_QWORD_PREFIX; > + } else if (Integer >=3D 0x10000) { > + // DWordConst > + IntegerDataSize =3D sizeof (UINT32) + 1; > + IntegerData[0] =3D AML_DWORD_PREFIX; > + } else if (Integer >=3D 0x100) { > + // WordConst > + IntegerDataSize =3D sizeof (UINT16) + 1; > + IntegerData[0] =3D AML_WORD_PREFIX; > + } else { > + // ByteConst > + IntegerDataSize =3D sizeof (UINT8) + 1; > + IntegerData[0] =3D AML_BYTE_PREFIX; > + } > + > + DataSize =3D IntegerDataSize - 1; > + InternalAmlSizedDataBuffer (Integer, DataSize, (VOID **)&Data); > + if (Data =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Integer Data Space Alloc Failed\n= ", > __func__)); > + FreePool (IntegerData); > + return EFI_OUT_OF_RESOURCES; > + } > + > + CopyMem (&IntegerData[1], Data, DataSize); > + FreePool (Data); > + } > + > + // Reallocate the pool so size is exact > + *ReturnData =3D (VOID *)IntegerData; > + *ReturnDataSize =3D IntegerDataSize; > + > + return EFI_SUCCESS; > +} > + > +/** > + Creates an optimized integer object > + > + Forces max integer size UINT64 > + > + ComputationalData :=3D ByteConst | WordConst | DWordConst | > QWordConst | String | > + ConstObj | RevisionOp | DefBuffer > + DataObject :=3D ComputationalData | DefPackage | DefVarPackage > + DataRefObject :=3D DataObject | ObjectReference | DDBHandle > + ByteConst :=3D BytePrefix ByteData > + BytePrefix :=3D 0x0A > + WordConst :=3D WordPrefix WordData > + WordPrefix :=3D 0x0B > + DWordConst :=3D DWordPrefix DWordData > + DWordPrefix :=3D 0x0C > + QWordConst :=3D QWordPrefix QWordData > + QWordPrefix :=3D 0x0E > + ConstObj :=3D ZeroOp | OneOp | OnesOp > + ByteData :=3D 0x00 - 0xFF > + WordData :=3D ByteData[0:7] ByteData[8:15] > + // 0x0000-0xFFFF > + DWordData :=3D WordData[0:15] WordData[16:31] > + // 0x00000000-0xFFFFFFFF > + QWordData :=3D DWordData[0:31] DWordData[32:63] > + // 0x0000000000000000-0xFFFFFFFFFFFFFFFF > + ZeroOp :=3D 0x00 > + OneOp :=3D 0x01 > + OnesOp :=3D 0xFF > + > + @param[in] Integer - Number to be optimized and encoded > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPDataInteger ( > + IN UINT64 Integer, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + > + if (ListHead =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start %a object\n", __func__, > "DATA_INTEGER")); > + goto Done; > + } > + > + Status =3D InternalAmlDataIntegerBuffer ( > + Integer, > + (VOID **)&(Object->Data), > + &(Object->DataSize) > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: ACPI Integer 0x%X object\n", > __func__, Integer)); > + goto Done; > + } > + > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates an Sized Data integer object for use in Buffer objects. Does = not > + include opcode. > + > + ByteData :=3D 0x00 - 0xFF > + WordData :=3D ByteData[0:7] ByteData[8:15] > + // 0x0000-0xFFFF > + DWordData :=3D WordData[0:15] WordData[16:31] > + // 0x00000000-0xFFFFFFFF > + QWordData :=3D DWordData[0:31] DWordData[32:63] > + // 0x0000000000000000-0xFFFFFFFFFFFFFFFF > + > + @param[in] Integer - Number to be optimized and encoded > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > +**/ > +EFI_STATUS > +EFIAPI > +InternalAmlOPSizedData ( > + IN UINT64 Integer, > + IN UINTN IntegerSize, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + > + if (ListHead =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start %a object\n", __func__, > "SIZED_DATA_INTEGER")); > + goto Done; > + } > + > + Object->DataSize =3D IntegerSize; > + Status =3D InternalAmlSizedDataBuffer ( > + Integer, > + Object->DataSize, > + (VOID **)&(Object->Data) > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: ACPI Integer 0x%X object\n", > __func__, Integer)); > + goto Done; > + } > + > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates a ByteData integer object for use in Buffer objects. Does not > + include opcode. > + > + ByteData :=3D 0x00 - 0xFF > + > + @param[in] Integer - Number to be placed in object > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPByteData ( > + IN UINT8 Integer, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + return InternalAmlOPSizedData (Integer, sizeof (UINT8), ListHead); > +} > + > +/** > + Creates a WordData integer object for use in Buffer objects. Does not > + include opcode. > + > + WordData :=3D 0x0000 - 0xFFFF > + > + @param[in] Integer - Number to be placed in object > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPWordData ( > + IN UINT16 Integer, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + return InternalAmlOPSizedData (Integer, sizeof (UINT16), ListHead); > +} > + > +/** > + Creates a DWordData integer object for use in Buffer objects. Does no= t > + include opcode. > + > + DWordData :=3D 0x00000000 - 0xFFFFFFFF > + > + @param[in] Integer - Number to be placed in object > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPDWordData ( > + IN UINT32 Integer, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + return InternalAmlOPSizedData (Integer, sizeof (UINT32), ListHead); > +} > + > +/** > + Creates a QWordData integer object for use in Buffer objects. Does no= t > + include opcode. > + > + QWordData :=3D 0x00000000_00000000 - 0xFFFFFFFF_FFFFFFFF > + > + @param[in] Integer - Number to be placed in object > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPQWordData ( > + IN UINT64 Integer, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + return InternalAmlOPSizedData (Integer, sizeof (UINT64), ListHead); > +} > + > +/** > + Creates a data string object > + > + ComputationalData :=3D String > + > + String :=3D StringPrefix AsciiCharList NullChar > + StringPrefix :=3D 0x0D > + AsciiCharList :=3D Nothing | > + AsciiChar :=3D 0x01 - 0x7F > + NullChar :=3D 0x00 > + > + @param[in] String - String to be encoded > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPDataString ( > + IN CHAR8 *String, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + UINT8 *Data; > + UINTN DataSize; > + UINTN Index; > + > + if ((String =3D=3D NULL) || (ListHead =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + > + // Validate all characters > + DataSize =3D AsciiStrLen (String); > + for (Index =3D 0; Index < DataSize; Index++) { > + if (String[Index] < 0x01) { > + Status =3D EFI_INVALID_PARAMETER; > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: Invalid character String[%d] : %a\n", > + __func__, > + Index, > + String > + )); > + return Status; > + } > + } > + > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start %a object\n", __func__, > String)); > + goto Done; > + } > + > + // AML_STRING_PREFIX + String + NULL Terminator > + DataSize +=3D 2; > + Data =3D AllocatePool (DataSize); > + if (Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: String Space Allocation %a\n", > + __func__, > + String > + )); > + goto Done; > + } > + > + Data[0] =3D AML_STRING_PREFIX; > + CopyMem (&Data[1], String, DataSize - 1); > + > + // DataString Complete, Put into Object > + Object->Data =3D Data; > + Object->DataSize =3D DataSize; > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates a data buffer AML object from an array > + > + This will take the passed in buffer and generate an AML Object from th= at > + buffer > + > + @param[in] Buffer - Buffer to be placed in AML Object > + @param[in] BufferSize - Size of Buffer to be copied into Object > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPDataBufferFromArray ( > + IN VOID *Buffer, > + IN UINTN BufferSize, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + > + if ((Buffer =3D=3D NULL) || (BufferSize =3D=3D 0) || (ListHead =3D=3D = NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Object =3D NULL; > + > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start Data Buffer object\n", > __func__)); > + goto Done; > + } > + > + Object->Data =3D AllocatePool (BufferSize); > + Object->DataSize =3D BufferSize; > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Data Buffer allocate failed\n", > __func__)); > + goto Done; > + } > + > + CopyMem (Object->Data, Buffer, BufferSize); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + 19.6.36 EISAID (EISA ID String To Integer Conversion Macro) > + > + Syntax: > + EISAID (EisaIdString) =3D> DWordConst > + > + Arguments: > + The EisaIdString must be a String object of the form "UUUNNNN", wher= e > "U" > + is an uppercase letter and "N" is a hexadecimal digit. No asterisks = or other > + characters are allowed in the string. > + > + Description: > + Converts EisaIdString, a 7-character text string argument, into its > + corresponding 4-byte numeric EISA ID encoding. It can be used when > declaring > + IDs for devices that have EISA IDs. > + > + Encoded EISA ID Definition - 32-bits > + bits[15:0] - three character compressed ASCII EISA ID. * > + bits[31:16] - binary number > + * Compressed ASCII is 5 bits per character 0b00001 =3D 'A' 0b11010= =3D 'Z' > + > + > + Example: > + EISAID ("PNP0C09") // This is a valid invocation of the macro. > + > + @param[in] String - EISA ID string. > + @param[in,out] ListHead - Head of Linked List of all AML Objects > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPEisaId ( > + IN CHAR8 *String, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + UINT32 EncodedEisaId; > + UINT8 i; > + > + EncodedEisaId =3D 0; > + > + if ((String =3D=3D NULL) || (ListHead =3D=3D NULL)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Invalid parameter, inputs cannot = =3D=3D > NULL.\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + if (AsciiStrLen (String) !=3D 0x7) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Invalid length for 'String' > parameter.\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + // > + // Verify String is formatted as "UUUNNNN". > + // > + for (i =3D 0; i <=3D 0x6; i++) { > + // > + // If first 3 characters are not uppercase alpha or last 4 character= s are not > hexadecimal > + // > + if (((i <=3D 0x2) && (!IS_ASCII_UPPER_ALPHA (String[i]))) || > + ((i >=3D 0x3) && (!IS_ASCII_HEX_DIGIT (String[i])))) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Invalid EISA ID string format!\n"= , > __func__)); > + DEBUG ((DEBUG_ERROR, " Input String must be formatted as > 'UUUNNNN'.\n")); > + return EFI_INVALID_PARAMETER; > + } > + } > + > + // > + // Convert string to 4-byte EISA ID encoding. > + // Ex: 'PNP0A03' encodes to '0x30AD041' > + // > + EncodedEisaId =3D ((((String[0] - AML_NAME_CHAR_A + 1) & 0x1f) << 10) > + + (((String[1] - AML_NAME_CHAR_A + 1) & 0x1f) << 5) > + + (((String[2] - AML_NAME_CHAR_A + 1) & 0x1f) << 0) > + + (UINT32)(AsciiStrHexToUint64 (&String[3]) << 16)); > + > + // > + // Swap bytes of upper and lower WORD to format EISA ID with proper > endian-ness. > + // > + EncodedEisaId =3D Swap4Bytes (EncodedEisaId); > + > + // > + // Insert DWordPrefix into list. > + // Note: EncodedEisaId will always be 32-bits, resulting in DWordCon= st. > + // > + Status =3D AmlOPDataInteger (EncodedEisaId, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Unable to create ACPI DWordConst > from Encoded EISA ID.\n", __func__)); > + return Status; > + } > + > + return Status; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlExpress > ionOpcodes.c > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlExpres > sionOpcodes.c > new file mode 100644 > index 0000000000..e8ea9d8e84 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlExpres > sionOpcodes.c > @@ -0,0 +1,1294 @@ > +/** @file > + > + Copyright (C) 2020-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "LocalAmlLib.h" > +#include > + > +#define FILECODE > LIBRARY_DXEAMLGENERATIONLIB_AMLEXPRESSIONOPCODES_FILECODE > + > +// ---------------------------------------------------------------------= ------- > +// Expression Opcodes Encoding > +// ---------------------------------------------------------------------= ------- > +// ExpressionOpcode :=3D DefAcquire | DefAdd | DefAnd | DefBuffer | > DefConcat | > +// DefConcatRes | DefCondRefOf | DefCopyObject | DefDecrement | > +// DefDerefOf | DefDivide | DefFindSetLeftBit | DefFindSetRightBit | > +// DefFromBCD | DefIncrement | DefIndex | DefLAnd | DefLEqual | > +// DefLGreater | DefLGreaterEqual | DefLLess | DefLLessEqual | DefMi= d | > +// DefLNot | DefLNotEqual | DefLoadTable | DefLOr | DefMatch | DefMo= d > | > +// DefMultiply | DefNAnd | DefNOr | DefNot | DefObjectType | DefOr | > +// DefPackage | DefVarPackage | DefRefOf | DefShiftLeft | DefShiftRi= ght | > +// DefSizeOf | DefStore | DefSubtract | DefTimer | DefToBCD | > DefToBuffer | > +// DefToDecimalString | DefToHexString | DefToInteger | DefToString = | > +// DefWait | DefXOr | MethodInvocation > +// ---------------------------------------------------------------------= ------- > + > +/** > + Creates a Buffer (BufferSize) {Initializer} =3D> Buffer Object > + > + Initializers must be created between AmlStart and AmlClose Phase > + > + DefBuffer :=3D BufferOp PkgLength BufferSize ByteList > + BufferOp :=3D 0x11 > + BufferSize :=3D TermArg =3D> Integer > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] BufferSize - Requested BufferSize, Encoded value will= be > + MAX (BufferSize OR Child->DataSize) > + @param[in,out] ListHead - Linked list has completed Buffer Object = after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlBuffer ( > + IN AML_FUNCTION_PHASE Phase, > + IN UINTN BufferSize, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + UINTN InternalBufferSize; > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + if ((Phase >=3D AmlInvalid) || (ListHead =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + // iASL compiler 20200110 only keeps lower 32 bits of size. We'll err= or if > + // someone requests something >=3D 4GB size. Have a message with this= to > be > + // very specific > + if (BufferSize >=3D SIZE_4GB) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: BufferSize=3D0x%X >=3D 4GB\n", > __func__, BufferSize)); > + return EFI_INVALID_PARAMETER; > + } > + > + switch (Phase) { > + case AmlStart: > + // Start the Buffer Object > + Status =3D InternalAppendNewAmlObject (&Object, "BUFFER", ListHead= ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start BUFFER object\n", > __func__)); > + goto Done; > + } > + > + // Start required PkgLength > + Status =3D AmlPkgLength (AmlStart, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Buffer PkgLength object\n", > __func__)); > + goto Done; > + } > + > + // Start BufferSize > + Status =3D InternalAppendNewAmlObject (&Object, "BUFFERSIZE", List= Head); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start BUFFERSIZE object\n", > __func__)); > + goto Done; > + } > + > + // ByteList is too complicated and must be added outside > + break; > + > + case AmlClose: > + // ByteList items should be closed already > + > + // Close BufferSize > + Status =3D InternalAmlLocateObjectByIdentifier ( > + &Object, > + "BUFFERSIZE", > + ListHead > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Fail locate BufferSize object\n= ", > __func__)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: collect BufferSize children\n", > __func__)); > + goto Done; > + } > + > + // Set BufferSize Object to correct value and size. > + // BufferSize should be from zero (no Child Data) to MAX of reques= ted > + // BufferSize or size required for ChildObject->Data. > + InternalBufferSize =3D MAX (BufferSize, ChildObject->DataSize); > + // iASL compiler 20200110 only keeps lower 32 bits of size. We'll= error if > + // someone requests something >=3D 4GB size. > + if (InternalBufferSize >=3D SIZE_4GB) { > + Status =3D EFI_BAD_BUFFER_SIZE; > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: BufferSize 0x%X >=3D 4GB\n", > + __func__, > + InternalBufferSize > + )); > + goto Done; > + } > + > + Status =3D InternalAmlDataIntegerBuffer ( > + InternalBufferSize, > + (VOID **)&Object->Data, > + &Object->DataSize > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: calc BufferSize\n", __func__)); > + goto Done; > + } > + > + if ((ChildObject->DataSize !=3D 0) && (ChildObject->Data !=3D NULL= )) { > + // Make room for ChildObject->Data > + Object->Data =3D ReallocatePool ( > + Object->DataSize, > + Object->DataSize + > + ChildObject->DataSize, > + Object->Data > + ); > + if (Object->Data =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: to reallocate BufferSize\n", > __func__)); > + Status =3D EFI_OUT_OF_RESOURCES; > + goto Done; > + } > + > + CopyMem ( > + &Object->Data[Object->DataSize], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + Object->DataSize +=3D ChildObject->DataSize; > + } > + > + // Free Child Object since it has been consumed > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + // Close required PkgLength before finishing Object > + Status =3D AmlPkgLength (AmlClose, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: close PkgLength object\n", > __func__)); > + goto Done; > + } > + > + // Complete Buffer object with all data > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, "BUFFER", > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: locate Buffer object\n", > __func__)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + > + // Buffer must have at least PkgLength BufferSize > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: No Buffer Data\n", __func__)); > + goto Done; > + } > + > + // BufferOp is one byte > + Object->DataSize =3D ChildObject->DataSize + 1; > + Object->Data =3D AllocatePool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Buffer allocate failed\n", > __func__)); > + Status =3D EFI_OUT_OF_RESOURCES; > + goto Done; > + } > + > + Object->Data[0] =3D AML_BUFFER_OP; > + CopyMem ( > + &Object->Data[1], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + // Free Child Object since it has been consumed > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&ChildObject, ListHead); > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates a LEqual (Source1, Source2) =3D> Boolean > + > + Source1 and Source2 operands must be created between AmlStart and > AmlClose Phase > + > + DefLEqual :=3D LequalOp Operand Operand > + LequalOp :=3D 0x93 > + Operand :=3D TermArg =3D> Integer > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed LEqual Object = after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlLEqual ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + if ((Phase >=3D AmlInvalid) || (ListHead =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + switch (Phase) { > + case AmlStart: > + // Start the LEqual Object > + Status =3D InternalAppendNewAmlObject (&Object, "LEQUAL", ListHead= ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start LEQUAL object\n", > __func__)); > + goto Done; > + } > + > + // Operands are too complicated and must be added outside > + break; > + > + case AmlClose: > + > + // Close LEqual > + Status =3D InternalAmlLocateObjectByIdentifier ( > + &Object, > + "LEQUAL", > + ListHead > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Fail locate LEqual object\n", > __func__)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + > + // LEqual must have at least two operands > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: No LEqual Args\n", __func__)); > + goto Done; > + } > + > + // LequalOp is one byte > + Object->DataSize =3D ChildObject->DataSize + 1; > + Object->Data =3D AllocatePool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Buffer allocate failed\n", > __func__)); > + Status =3D EFI_OUT_OF_RESOURCES; > + goto Done; > + } > + > + Object->Data[0] =3D AML_LEQUAL_OP; > + CopyMem ( > + &Object->Data[1], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + // Free Child Object since it has been consumed > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&ChildObject, ListHead); > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/* > + Creates (NumElements) section of a Package: {PackageList} =3D> Package > + > + Initializers must be created between AmlStart and AmlClose Phase > + Internal only function no public reference or documentation needed. > + > + NumElements :=3D ByteData > + VarNumElements :=3D TermArg =3D> Integer > + PackageElementList :=3D Nothing | > + PackageElement :=3D DataRefObject | NameString > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] NumElements - Number of elements in the package. If 0, > size > + is calculated from the PackageList. > + @param[in,out] ListHead - Linked list has completed Package Object= after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +*/ > +EFI_STATUS > +EFIAPI > +InternalAmlNumElements ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT UINTN *NumElements, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + ChildCount =3D 0; > + > + if ((Phase >=3D AmlInvalid) || (ListHead =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + switch (Phase) { > + case AmlStart: > + // Start Number of Elements Object > + Status =3D InternalAppendNewAmlObject (&Object, "NUM_ELEMENTS", > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start NUM_ELEMENTS object\n", > __func__)); > + goto Done; > + } > + > + // PackageList is too complicated and must be added outside > + break; > + > + case AmlClose: > + // PackageList items should be closed already > + > + // Close Number of Elements Object > + Status =3D InternalAmlLocateObjectByIdentifier ( > + &Object, > + "NUM_ELEMENTS", > + ListHead > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Fail locate NUM_ELEMENTS > object\n", __func__)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: collect NUM_ELEMENTS > children\n", __func__)); > + goto Done; > + } > + > + // We do not have to change anything for NumElements >=3D Child Co= unt > + if (*NumElements =3D=3D 0) { > + *NumElements =3D ChildCount; > + } else if (*NumElements < ChildCount) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: NumElements < ChildCount.\n", > __func__)); > + Status =3D EFI_INVALID_PARAMETER; > + goto Done; > + } > + > + if (*NumElements <=3D MAX_UINT8) { > + Object->DataSize =3D 1; > + Object->Data =3D AllocateZeroPool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: NumElements allocate failed\n= ", > __func__)); > + Status =3D EFI_OUT_OF_RESOURCES; > + goto Done; > + } > + > + Object->Data[0] =3D (UINT8)*NumElements; > + } else { > + Status =3D InternalAmlDataIntegerBuffer ( > + *NumElements, > + (VOID **)&Object->Data, > + &Object->DataSize > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: calc NumElements\n", > __func__)); > + goto Done; > + } > + } > + > + if ((ChildObject->DataSize !=3D 0) && (ChildObject->Data !=3D NULL= )) { > + // Make room for ChildObject->Data > + Object->Data =3D ReallocatePool ( > + Object->DataSize, > + Object->DataSize + > + ChildObject->DataSize, > + Object->Data > + ); > + if (Object->Data =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: to reallocate NumElements\n", > __func__)); > + Status =3D EFI_OUT_OF_RESOURCES; > + goto Done; > + } > + > + CopyMem ( > + &Object->Data[Object->DataSize], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + Object->DataSize +=3D ChildObject->DataSize; > + } > + > + // Free Child Object since it has been consumed > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&ChildObject, ListHead); > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates a Package (NumElements) {PackageList} =3D> Package > + > + Initializers must be created between AmlStart and AmlClose Phase > + > + DefPackage :=3D PackageOp PkgLength NumElements > PackageElementList > + PackageOp :=3D 0x12 > + DefVarPackage :=3D VarPackageOp PkgLength VarNumElements > PackageElementList > + VarPackageOp :=3D 0x13 > + NumElements :=3D ByteData > + VarNumElements :=3D TermArg =3D> Integer > + PackageElementList :=3D Nothing | > + PackageElement :=3D DataRefObject | NameString > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] NumElements - Number of elements in the package. If 0,= size > + is calculated from the PackageList. > + @param[in,out] ListHead - Linked list has completed Package Object= after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlPackage ( > + IN AML_FUNCTION_PHASE Phase, > + IN UINTN NumElements, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + UINT8 OpCode; > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + if ((Phase >=3D AmlInvalid) || (ListHead =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + switch (Phase) { > + case AmlStart: > + // Start the Package Object > + Status =3D InternalAppendNewAmlObject (&Object, "PACKAGE", ListHea= d); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start PACKAGE object\n", > __func__)); > + goto Done; > + } > + > + // Start required PkgLength > + Status =3D AmlPkgLength (AmlStart, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Package PkgLength object\n", > __func__)); > + goto Done; > + } > + > + // Start Number of Elements Object > + Status =3D InternalAmlNumElements (AmlStart, &NumElements, ListHea= d); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start NUM_ELEMENTS object\n", > __func__)); > + goto Done; > + } > + > + // PackageList is too complicated and must be added outside > + break; > + > + case AmlClose: > + // PackageList items should be closed already > + > + // Close Number of Elements Object > + Status =3D InternalAmlNumElements (AmlClose, &NumElements, ListHea= d); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Close NUM_ELEMENTS object\n", > __func__)); > + goto Done; > + } > + > + if (NumElements <=3D MAX_UINT8) { > + OpCode =3D AML_PACKAGE_OP; > + } else { > + OpCode =3D AML_VAR_PACKAGE_OP; > + } > + > + // Close required PkgLength before finishing Object > + Status =3D AmlPkgLength (AmlClose, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: close PkgLength object\n", > __func__)); > + goto Done; > + } > + > + // Complete Package object with all data > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, "PACKAGE"= , > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: locate PACKAGE object\n", > __func__)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + // Package must have at least PkgLength NumElements > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: No Package Data\n", __func__)); > + goto Done; > + } > + > + // PackageOp and VarPackageOp are both one byte > + Object->DataSize =3D ChildObject->DataSize + 1; > + Object->Data =3D AllocatePool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Package allocate failed\n", > __func__)); > + Status =3D EFI_OUT_OF_RESOURCES; > + goto Done; > + } > + > + Object->Data[0] =3D OpCode; > + CopyMem ( > + &Object->Data[1], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + // Free Child Object since it has been consumed > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&ChildObject, ListHead); > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates a Store expression > + > + Syntax: > + Store (Source, Destination) =3D> DataRefObject Destination =3D Source = =3D> > DataRefObject > + > + Store expression must be created between AmlStart and AmlClose Phase. > + > + DefStore :=3D StoreOp TermArg SuperName > + StoreOp :=3D 0x70 > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed String Obj= ect after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlStore ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + > + if ((Phase >=3D AmlInvalid) || (ListHead =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + switch (Phase) { > + case AmlStart: > + // Start Store expression > + Status =3D InternalAppendNewAmlObject (&Object, "STORE", ListHead)= ; > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Cannot append STORE object\n", > __func__)); > + goto Done; > + } > + > + // TermArg and SuperName are outside the scope of this object. Th= ey > must be > + // defined as part of a multi-tier call - in between AmlStore(AmlS= tart,..) > and > + // AmlStore(AmlClose,...) - when creating the Store expression. > + break; > + > + case AmlClose: > + // TermArg and SuperName must have been created and closed by now. > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, "STORE", > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: locating STORE Object\n", > __func__)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Store() has no child data.\n", > __func__)); > + goto Done; > + } > + > + Object->Data =3D AllocateZeroPool (ChildObject->DataSize + 1); > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for > Store()\n", __func__)); > + goto Done; > + } > + > + // Store Op is one byte > + Object->DataSize =3D ChildObject->DataSize + 1; > + > + // Fill out Store object > + Object->Data[0] =3D AML_STORE_OP; > + CopyMem ( > + &Object->Data[1], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + InternalFreeAmlObject (&ChildObject, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates a Shift Left or Right expression > + > + Syntax: > + ShiftLeft (Source, ShiftCount, Reult) =3D> Integer > + Result =3D Source << ShiftCount =3D> Integer > + Result <<=3D ShiftCount =3D> Integer > + > + ShiftRight (Source, ShiftCount, Reult) =3D> Integer > + Result =3D Source >> ShiftCount =3D> Integer > + Result >>=3D ShiftCount =3D> Integer > + > + Shift expression must be created between AmlStart and AmlClose Phase. > + > + DefShiftLeft :=3D ShiftOp Operand ShiftCount Target > + ShiftOp :=3D 0x79 or 0x7A > + ShiftCount :=3D TermArg =3D> Integer > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] ShiftOp - Specifies whether to shift left or s= hift > + right. > + @param[in,out] ListHead - Linked list has completed String Obj= ect after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +InternalAmlShift ( > + IN AML_FUNCTION_PHASE Phase, > + IN UINT8 ShiftOp, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + if ((Phase >=3D AmlInvalid) || (ListHead =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + switch (Phase) { > + case AmlStart: > + // Start Store expression > + Status =3D InternalAppendNewAmlObject (&Object, "SHIFT", ListHead)= ; > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Cannot append SHIFT object\n", > __func__)); > + goto Done; > + } > + > + // Operand, ShiftCount, and Target are outside the scope of this o= bject. > They must be > + // defined as part of a multi-tier call - in between AmlShift(AmlS= tart,..) and > + // AmlShift(AmlClose,...) - when creating the Shift expression. > + > + break; > + > + case AmlClose: > + // Operand, ShiftCount, and Target must have been created and clos= ed > by now. > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, "SHIFT", = ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: locating SHIFT Object\n", > __func__)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Store() has no child data.\n", > __func__)); > + goto Done; > + } > + > + Object->Data =3D AllocateZeroPool (ChildObject->DataSize + 1); > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for > Store()\n", __func__)); > + goto Done; > + } > + > + // Store Op is one byte > + Object->DataSize =3D ChildObject->DataSize + 1; > + > + // Fill out Store object > + Object->Data[0] =3D ShiftOp; > + CopyMem ( > + &Object->Data[1], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + InternalFreeAmlObject (&ChildObject, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates a Shift Left expression > + > + Syntax: > + ShiftLeft (Source, ShiftCount, Result) =3D> Integer > + Result =3D Source << ShiftCount =3D> Integer > + Result <<=3D ShiftCount =3D> Integer > + > + Shift expression must be created between AmlStart and AmlClose Phase. > + > + DefShiftLeft :=3D ShiftLeftOp Operand ShiftCount Target > + ShiftLeftOp :=3D 0x79 > + ShiftCount :=3D TermArg =3D> Integer > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed String Obj= ect after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlShiftLeft ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + > + Status =3D InternalAmlShift (Phase, AML_SHIFT_LEFT_OP, ListHead); > + return Status; > +} > + > +/** > + Creates a Shift Right expression > + > + Syntax: > + ShiftRight (Source, ShiftCount, Reult) =3D> Integer > + Result =3D Source >> ShiftCount =3D> Integer > + Result >>=3D ShiftCount =3D> Integer > + > + Shift expression must be created between AmlStart and AmlClose Phase. > + > + DefShiftRight :=3D ShiftRightOp Operand ShiftCount Target > + ShiftRightOp :=3D 0x7A > + ShiftCount :=3D TermArg =3D> Integer > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed String Obj= ect after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlShiftRight ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + > + Status =3D InternalAmlShift (Phase, AML_SHIFT_RIGHT_OP, ListHead); > + return Status; > +} > + > +/** > + Creates a Find First Set Bit AML object for > + both right and left searches. > + > + Syntax: > + FindSetLeftBit (Source, Result) =3D> Integer > + > + FindSetRightBit (Source, Result) =3D> Integer > + > + Bit Fields must be created between AmlStart and AmlClose Phase. > + > + DefFindSetLeftBit :=3D FindSetLeftBitOp Operand Target > + FindSetLeftBitOp :=3D 0x81 > + > + DefFindSetRightBit :=3D FindSetRightBitOp Operand Target > + FindSetRightBitOp :=3D 0x82 > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] FindSetOp - Specifies whether to search left or = search > + right. > + @param[in,out] ListHead - Linked list has completed String Obj= ect after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +InternalAmlFindSetBit ( > + IN AML_FUNCTION_PHASE Phase, > + IN UINT8 FindSetOp, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + if ((Phase >=3D AmlInvalid) || (ListHead =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + switch (Phase) { > + case AmlStart: > + // Start Store expression > + Status =3D InternalAppendNewAmlObject (&Object, "FINDSET", ListHea= d); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Cannot append FIND_SET > object\n", __func__)); > + goto Done; > + } > + > + // Source and Result are outside the scope of this object. They m= ust be > + // defined as part of a multi-tier call - in between AmlFindSet(Am= lStart,..) > and > + // AmlFindSet(AmlClose,...) - when creating the FindSetBit express= ion. > + > + break; > + > + case AmlClose: > + // Source and Result must have been created and closed by now. > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, "FINDSET"= , > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: locating FIND_SET Object\n", > __func__)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Store() has no child data.\n", > __func__)); > + goto Done; > + } > + > + Object->Data =3D AllocateZeroPool (ChildObject->DataSize + 1); > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for > Store()\n", __func__)); > + goto Done; > + } > + > + // Store Op is one byte > + Object->DataSize =3D ChildObject->DataSize + 1; > + > + // Fill out Store object > + Object->Data[0] =3D FindSetOp; > + CopyMem ( > + &Object->Data[1], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + InternalFreeAmlObject (&ChildObject, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates a FindSetLeftBit AML Object > + > + Syntax: > + FindSetLeftBit (Source, Result) =3D> Integer > + > + FindSetLeftBit expression must be created between > + AmlStart and AmlClose Phase. > + > + DefFindSetLeftBit :=3D FindSetLeftBitOp Operand Target > + FindSetLeftBitOp :=3D 0x81 > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed String Obj= ect after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlFindSetLeftBit ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + > + Status =3D InternalAmlFindSetBit (Phase, AML_FIND_SET_LEFT_BIT_OP, > ListHead); > + return Status; > +} > + > +/** > + Creates a FindSetRightBit AML Object > + > + Syntax: > + FindSetRightBit (Source, Result) =3D> Integer > + > + FindSetRightBit expression must be created between > + AmlStart and AmlClose Phase. > + > + DefFindSetRightBit :=3D FindSetRightBit Operand Target > + FindSetRightBit :=3D 0x82 > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed String Obj= ect after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlFindSetRightBit ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + > + Status =3D InternalAmlFindSetBit (Phase, AML_FIND_SET_RIGHT_BIT_OP, > ListHead); > + return Status; > +} > + > +/** > + Creates a Decrement expression > + > + Syntax: > + Decrement (Minuend) =3D> Integer > + Minuend-- =3D> Integer > + > + Creates object to decrement Minuend. > + > + DefDecrement :=3D DecrementOp SuperName > + DecrementOp :=3D 0x76 > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed String Obj= ect after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlDecrement ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + if ((Phase >=3D AmlInvalid) || (ListHead =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + switch (Phase) { > + case AmlStart: > + // Start decrement expression > + Status =3D InternalAppendNewAmlObject (&Object, "DECREMENT", > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Cannot append DECREMENT > object\n", __func__)); > + goto Done; > + } > + > + // Minuend is outside the scope of this object. It must be > + // defined as part of a multi-tier call - in between > AmlDecrement(AmlStart,..) and > + // AmlDecrement(AmlClose,...) - when creating the Decrement > expression. > + > + break; > + > + case AmlClose: > + // Minuend must created and closed by now. > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, "DECREMEN= T", > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: locating DECREMENT Object\n", > __func__)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Store() has no child data.\n", > __func__)); > + goto Done; > + } > + > + Object->Data =3D AllocateZeroPool (ChildObject->DataSize + 1); > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for > Store()\n", __func__)); > + goto Done; > + } > + > + // Decrement Op is one byte > + Object->DataSize =3D ChildObject->DataSize + 1; > + > + // Fill out Decrement object > + Object->Data[0] =3D AML_DECREMENT_OP; > + CopyMem ( > + &Object->Data[1], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + InternalFreeAmlObject (&ChildObject, ListHead); > + } > + > + return Status; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlLocalO > bjects.c > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlLocalO > bjects.c > new file mode 100644 > index 0000000000..21deb200e3 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlLocalO > bjects.c > @@ -0,0 +1,158 @@ > +/** @file > + > + Copyright (C) 2022-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "LocalAmlLib.h" > +#include > + > +#define FILECODE > LIBRARY_DXEAMLGENERATIONLIB_AMLLOCALOBJECTS_FILECODE > + > +/** > + Fill the DataBuffer with correct Local Opcode based on provided argume= nt > number > + Valid Argument numbers are 0, 1, 2, 3, 4, 5 and 6. > + AML supports max 7 Local variables, i.e., Local1, Local2 ... Local6. > + > + @param[in] LocalN - Local variable Number > + @param[out] ReturnData - Allocated DataBuffer with encoded inte= ger > + @param[out] ReturnDataSize - Size of ReturnData > + > + @return EFI_SUCCESS - Successful completion > + @return EFI_OUT_OF_RESOURCES - Failed to allocate ReturnDataBuf= fer > + @return EFI_INVALID_PARAMETER - Invalid LocalN provided. > +**/ > +EFI_STATUS > +EFIAPI > +InternalAmlLocalBuffer ( > + IN OUT UINT8 LocalN, > + OUT VOID **ReturnData, > + OUT UINTN *ReturnDataSize > + ) > +{ > + UINT8 *Data; > + UINTN DataSize; > + > + Data =3D AllocateZeroPool (sizeof (UINT8)); > + if (Data =3D=3D NULL) { > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: Failed to create Data Buffer.\n", > + __func__ > + )); > + return EFI_OUT_OF_RESOURCES; > + } > + > + DataSize =3D 1; > + switch (LocalN) { > + case 0: > + Data[0] =3D AML_LOCAL0; > + break; > + case 1: > + Data[0] =3D AML_LOCAL1; > + break; > + case 2: > + Data[0] =3D AML_LOCAL2; > + break; > + case 3: > + Data[0] =3D AML_LOCAL3; > + break; > + case 4: > + Data[0] =3D AML_LOCAL4; > + break; > + case 5: > + Data[0] =3D AML_LOCAL5; > + break; > + case 6: > + Data[0] =3D AML_LOCAL6; > + break; > + case 7: > + Data[0] =3D AML_LOCAL7; > + break; > + default: > + FreePool (Data); > + return EFI_INVALID_PARAMETER; > + } > + > + *ReturnData =3D (VOID *)Data; > + *ReturnDataSize =3D DataSize; > + > + return EFI_SUCCESS; > +} > + > +/** > + Creates an LocalN Opcode object > + > + Local Objects Encoding > + LocalObj :=3D Local0Op | Local1Op | Local2Op | Local3Op | Local4Op | > Local5Op | Local6Op | Local7Op > + Local0Op :=3D 0x60 > + Local1Op :=3D 0x61 > + Local2Op :=3D 0x62 > + Local3Op :=3D 0x63 > + Local4Op :=3D 0x64 > + Local5Op :=3D 0x65 > + Local6Op :=3D 0x66 > + Local7Op :=3D 0x67 > + > + @param[in] LocalN - Argument Number to be encoded > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPLocalN ( > + IN UINT8 LocalN, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + > + if (ListHead =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: Start %a object\n", > + __func__, > + "LOCALN_OPCODE" > + )); > + goto Done; > + } > + > + Status =3D InternalAmlLocalBuffer ( > + LocalN, > + (VOID **)&(Object->Data), > + &(Object->DataSize) > + ); > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: ACPI Argument 0x%X object\n", > + __func__, > + LocalN > + )); > + goto Done; > + } > + > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlNameSt > ring.c > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlNameS > tring.c > new file mode 100644 > index 0000000000..0502547a01 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlNameS > tring.c > @@ -0,0 +1,576 @@ > +/** @file > + > + Copyright (C) 2020-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "LocalAmlLib.h" > +#include > + > +#define FILECODE > LIBRARY_DXEAMLGENERATIONLIB_AMLNAMESTRING_FILECODE > + > +#define MAX_NAME_SEG_COUNT 255 > + > +/* > + Is character a RootChar > + > + @param[in] TestChar - Character to check > + > + @return TRUE - Character is a RootChar > + @return FALSE - Character is not a RootChar > + */ > +BOOLEAN > +InternalIsRootChar ( > + IN CHAR8 TestChar > + ) > +{ > + if (TestChar =3D=3D AML_ROOT_CHAR) { > + return TRUE; > + } > + > + return FALSE; > +} > + > +/* > + Is character a ParentPrefixChar > + > + @param[in] TestChar - Character to check > + > + @return TRUE - Character is a ParentPrefixChar > + @return FALSE - Character is not a ParentPrefixChar > + */ > +BOOLEAN > +InternalIsParentPrefixChar ( > + IN CHAR8 TestChar > + ) > +{ > + if (TestChar =3D=3D AML_PARENT_PREFIX_CHAR) { > + return TRUE; > + } > + > + return FALSE; > +} > + > +/* > + Is character a LeadNameChar =3D '_', 'A' - 'Z' > + > + @param[in] TestChar - Character to check > + > + @return TRUE - Character is a LeadNameChar > + @return FALSE - Character is not a LeadNameChar > + */ > +BOOLEAN > +InternalIsLeadNameChar ( > + IN CHAR8 TestChar > + ) > +{ > + if ( // Allowed LeadNameChars '_', 'A'-'Z' > + (TestChar =3D=3D AML_NAME_CHAR__) || > + ((TestChar >=3D AML_NAME_CHAR_A) && > + (TestChar <=3D AML_NAME_CHAR_Z)) > + ) > + { > + return TRUE; > + } > + > + return FALSE; > +} > + > +/* > + Is character a DigitChar =3D '0' - '9' > + > + @param[in] TestChar - Character to check > + > + @return TRUE - Character is a DigitChar > + @return FALSE - Character is not a DigitChar > + */ > +BOOLEAN > +InternalIsDigitChar ( > + IN CHAR8 TestChar > + ) > +{ > + if ( // Allowed DigitChars '0'-'9' > + (TestChar >=3D AML_DIGIT_CHAR_0) && > + (TestChar <=3D AML_DIGIT_CHAR_9) > + ) > + { > + return TRUE; > + } > + > + return FALSE; > +} > + > +/* > + Is character a NameChar =3D LeadNameChar | DigitChar > + > + @param[in] TestChar - Character to check > + > + @return TRUE - Character is a NameChar > + @return FALSE - Character is not a NameChar > + */ > +BOOLEAN > +InternalIsNameChar ( > + IN CHAR8 TestChar > + ) > +{ > + if ( // Allowed LeadNameChar and DigitChars > + InternalIsDigitChar (TestChar) || > + InternalIsLeadNameChar (TestChar) > + ) > + { > + return TRUE; > + } > + > + return FALSE; > +} > + > +/* > + Is character a NameSeg separator > + > + @param[in] TestChar - Character to check > + > + @return TRUE - Character is a NameChar > + @return FALSE - Character is not a NameChar > + */ > +BOOLEAN > +InternalIsNameSegSeparator ( > + IN CHAR8 TestChar > + ) > +{ > + if (TestChar =3D=3D '.') { > + return TRUE; > + } > + > + return FALSE; > +} > + > +/** > + Creates a NameSeg AML object and inserts it into the List > + > + NameSeg :=3D > + > + NameSegs shorter than 4 characters are filled with trailing underscore= s > + > + @param[in] Name - NameSeg > + @param[in,out] ListHead - Linked list has NameSeg after call > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +InternalAmlNameSeg ( > + IN CHAR8 *Name, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + AML_OBJECT_INSTANCE *Object; > + UINT8 *NameSeg; > + UINTN NameLen; > + EFI_STATUS Status; > + > + if (Name =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + NameLen =3D AsciiStrLen (Name); > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + NameSeg =3D NULL; > + // parameter validation > + if ((NameLen =3D=3D 0) || (NameLen > 4)) { > + return EFI_INVALID_PARAMETER; > + } > + > + if (!InternalIsLeadNameChar (Name[0])) { > + return EFI_INVALID_PARAMETER; > + } > + > + for (UINT8 i =3D 1; NameLen > 1 && i < NameLen; i++) { > + if (!InternalIsNameChar (Name[i])) { > + return EFI_INVALID_PARAMETER; > + } > + } > + > + NameSeg =3D AllocateZeroPool (4); > + if (NameSeg =3D=3D NULL) { > + return EFI_OUT_OF_RESOURCES; > + } > + > + CopyMem (NameSeg, Name, NameLen); > + > + if (NameLen < 4) { > + SetMem (&NameSeg[NameLen], 4 - NameLen, '_'); > + } > + > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (Object !=3D NULL) { > + if (!EFI_ERROR (Status)) { > + Object->Data =3D NameSeg; > + Object->DataSize =3D 4; > + Object->Completed =3D TRUE; > + } else { > + InternalFreeAmlObject (&Object, ListHead); > + FreePool (NameSeg); > + } > + } > + > + return Status; > +} > + > +/** > + Creates a Namestring AML Object and inserts it into the linked list > + > + LeadNameChar :=3D 'A'-'Z' | '_' > + DigitChar :=3D '0'-'9' > + NameChar :=3D DigitChar | LeadNameChar > + RootChar :=3D '\' > + ParentPrefixChar :=3D '^' > + > + 'A'-'Z' :=3D 0x41 - 0x5A > + '_' :=3D 0x5F > + '0'-'9' :=3D 0x30 - 0x39 > + '\' :=3D 0x5C > + '^' :=3D 0x5E > + > + NameSeg :=3D > + // Notice that NameSegs shorter than 4 characters = are filled with > + // trailing underscores ('_'s). > + NameString :=3D | > + PrefixPath :=3D Nothing | <'^' PrefixPath> > + NamePath :=3D NameSeg | DualNamePath | MultiNamePath | NullNa= me > + > + DualNamePath :=3D DualNamePrefix NameSeg NameSeg > + DualNamePrefix :=3D 0x2E > + MultiNamePath :=3D MultiNamePrefix SegCount NameSeg(SegCount) > + MultiNamePrefix :=3D 0x2F > + > + SegCount :=3D ByteData > + > + Note:SegCount can be from 1 to 255. For example: MultiNamePrefix(35) i= s > + encoded as 0x2f 0x23 and followed by 35 NameSegs. So, the total > encoding > + length will be 1 + 1 + 35*4 =3D 142. Notice that: DualNamePrefix N= ameSeg > + NameSeg has a smaller encoding than the encoding of: > MultiNamePrefix(2) > + NameSeg NameSeg > + > + SimpleName :=3D NameString | ArgObj | LocalObj > + SuperName :=3D SimpleName | DebugObj | Type6Opcode > + NullName :=3D 0x00 > + Target :=3D SuperName | NullName > + > + @param[in] String - Null Terminated NameString Representation > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > + **/ > +EFI_STATUS > +EFIAPI > +AmlOPNameString ( > + IN CHAR8 *String, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + CHAR8 *NameString; > + CHAR8 *NameStringPrefix; > + UINTN NameStringBufferSize; > + UINTN NameStringSize; > + UINTN NameStringPrefixSize; > + UINTN NameSegCount; > + UINTN StringIndex; > + UINTN StringLength; > + UINTN NameSegIndex; > + BOOLEAN FoundRootChar; > + BOOLEAN FoundParentPrefixChar; > + BOOLEAN FoundParenthesisOpenChar; > + BOOLEAN FoundParenthesisCloseChar; > + > + if ((String =3D=3D NULL) || (ListHead =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + NameString =3D NULL; > + FoundRootChar =3D FALSE; > + FoundParentPrefixChar =3D FALSE; > + NameStringBufferSize =3D 0; > + FoundParenthesisOpenChar =3D FALSE; > + FoundParenthesisCloseChar =3D FALSE; > + > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start NameString %a object\n", > __func__, String)); > + goto Done; > + } > + > + // Create a buffer to fit NameSeg [4] * max NameSegCount [255] > + NameStringBufferSize =3D 4 * MAX_NAME_SEG_COUNT; > + NameString =3D AllocateZeroPool (NameStringBufferSize); > + // Create arbitrarily large RootChar\ParentPrefixChar buffer > + NameStringPrefix =3D AllocateZeroPool (NameStringBufferSize); > + > + // Calculate length of required space > + StringLength =3D AsciiStrLen (String); > + NameStringSize =3D 0; > + NameStringPrefixSize =3D 0; > + NameSegIndex =3D 0; > + NameSegCount =3D 0; > + for (StringIndex =3D 0; StringIndex < StringLength; StringIndex++) { > + if (NameStringPrefixSize >=3D NameStringBufferSize) { > + Status =3D EFI_INVALID_PARAMETER; > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: Exceeded ParentPrefixChar support at offset=3D%d of > String=3D%a\n", > + __func__, > + StringIndex, > + String > + )); > + goto Done; > + } > + > + if (InternalIsRootChar (String[StringIndex])) { > + if (NameSegCount !=3D 0) { > + Status =3D EFI_INVALID_PARAMETER; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: RootChar at offset=3D%d of > String=3D%a\n", __func__, StringIndex, String)); > + goto Done; > + } > + > + if (FoundRootChar) { > + Status =3D EFI_INVALID_PARAMETER; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: NameString=3D%a contains more > than 1 RootChar.\n", __func__, String)); > + goto Done; > + } > + > + if (FoundParentPrefixChar) { > + Status =3D EFI_INVALID_PARAMETER; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: NameString=3D%a contains RootCh= ar > and ParentPrefixChar.\n", __func__, String)); > + goto Done; > + } > + > + // RootChar; increment NameStringSize > + NameStringPrefix[NameStringPrefixSize] =3D String[StringIndex]; > + NameStringPrefixSize++; > + FoundRootChar =3D TRUE; > + } else if (InternalIsParentPrefixChar (String[StringIndex])) { > + if (NameSegCount !=3D 0) { > + Status =3D EFI_INVALID_PARAMETER; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: ParentPrefixChar at offset=3D%d= of > String=3D%a\n", __func__, StringIndex, String)); > + goto Done; > + } > + > + if (FoundRootChar) { > + Status =3D EFI_INVALID_PARAMETER; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: NameString=3D%a contains RootCh= ar > and ParentPrefixChar.\n", __func__, String)); > + goto Done; > + } > + > + // ParentPrefixChar; increment NameStringSize > + NameStringPrefix[NameStringPrefixSize] =3D String[StringIndex]; > + NameStringPrefixSize++; > + FoundParentPrefixChar =3D TRUE; > + } else if (!InternalIsNameChar (String[StringIndex])) { > + if (InternalIsNameSegSeparator (String[StringIndex])) { > + if (NameSegIndex =3D=3D 0) { > + Status =3D EFI_INVALID_PARAMETER; > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: Invalid NameSeg separator at offset=3D%d of Stri= ng=3D%a\n", > + __func__, > + StringIndex, > + String > + )); > + goto Done; > + } else { > + NameSegIndex =3D 0; > + } > + } else if (String[StringIndex] =3D=3D '(') { > + if (FoundParenthesisOpenChar) { > + Status =3D EFI_INVALID_PARAMETER; > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: Invalid Parenthesis at offset=3D%d of String=3D%= a\n", > + __func__, > + StringIndex, > + String > + )); > + goto Done; > + } > + > + FoundParenthesisOpenChar =3D TRUE; > + } else if (String[StringIndex] =3D=3D ')') { > + if (FoundParenthesisCloseChar) { > + Status =3D EFI_INVALID_PARAMETER; > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: Invalid Parenthesis at offset=3D%d of String=3D%= a\n", > + __func__, > + StringIndex, > + String > + )); > + goto Done; > + } else if (!FoundParenthesisOpenChar) { > + Status =3D EFI_INVALID_PARAMETER; > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: No Open Parenthesis before offset=3D%d of String= =3D%a\n", > + __func__, > + StringIndex, > + String > + )); > + goto Done; > + } > + > + FoundParenthesisCloseChar =3D TRUE; > + } else { > + Status =3D EFI_INVALID_PARAMETER; > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: Unsupported character at offset=3D%d of String=3D%= a\n", > + __func__, > + StringIndex, > + String > + )); > + goto Done; > + } > + } else { > + // Must be NameChar > + if (FoundParenthesisOpenChar || FoundParenthesisCloseChar) { > + Status =3D EFI_INVALID_PARAMETER; > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: NameChar after Parenthesis at offset=3D%d of Strin= g=3D%a\n", > + __func__, > + StringIndex, > + String > + )); > + goto Done; > + } else if ((NameSegIndex =3D=3D 0) && InternalIsDigitChar (String[= StringIndex])) > { > + Status =3D EFI_INVALID_PARAMETER; > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: must be LeadNameChar at offset=3D%d of String=3D%a= '\n", > + __func__, > + StringIndex, > + String > + )); > + goto Done; > + } > + > + if (NameSegIndex >=3D 4) { > + Status =3D EFI_INVALID_PARAMETER; > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: NameSeg > 4 characters at offset=3D%d of String=3D= %a'\n", > + __func__, > + StringIndex, > + String > + )); > + goto Done; > + } else { > + if (NameSegIndex =3D=3D 0) { > + NameSegCount++; > + if (NameSegCount > MAX_NAME_SEG_COUNT) { > + Status =3D EFI_INVALID_PARAMETER; > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: Max NameSegCount=3D%d reached at offset=3D%d o= f > String=3D%a'\n", > + __func__, > + MAX_NAME_SEG_COUNT, > + StringIndex, > + String > + )); > + goto Done; > + } > + } > + > + NameString[NameStringSize] =3D String[StringIndex]; > + NameStringSize++; > + NameSegIndex++; > + if ((StringIndex + 1 >=3D StringLength) || > + !InternalIsNameChar (String[StringIndex + 1])) > + { > + // Extend in progress NameSeg with '_'s > + if (NameSegIndex < 4) { > + SetMem (&NameString[NameStringSize], 4 - NameSegIndex, '_'); > + NameStringSize +=3D 4 - NameSegIndex; > + } > + } > + } > + } > + } > + > + // Create AML Record with NameString contents from above > + // Copy in RootChar or ParentPrefixChar(s) > + if (NameStringPrefixSize !=3D 0) { > + Object->Data =3D ReallocatePool ( > + Object->DataSize, > + NameStringPrefixSize, > + Object->Data > + ); > + CopyMem ( > + &Object->Data[Object->DataSize], > + NameStringPrefix, > + NameStringPrefixSize > + ); > + Object->DataSize +=3D NameStringPrefixSize; > + FreePool (NameStringPrefix); > + } > + > + // Set up for Dual/MultiName Prefix > + if (NameSegCount > MAX_NAME_SEG_COUNT) { > + Status =3D EFI_INVALID_PARAMETER; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Exceeded MaxNameSegCount in > NameString=3D%a\n", __func__, String)); > + goto Done; > + } else if (NameSegCount =3D=3D 0) { > + Status =3D EFI_INVALID_PARAMETER; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Must be at least one NameSeg in > NameString=3D%a\n", __func__, String)); > + goto Done; > + } else if (NameSegCount =3D=3D 1) { > + // Single NameSeg > + Object->Data =3D ReallocatePool ( > + Object->DataSize, > + Object->DataSize + NameStringSize, > + Object->Data > + ); > + } else if (NameSegCount =3D=3D 2) { > + Object->Data =3D ReallocatePool ( > + Object->DataSize, > + Object->DataSize + NameStringSize + 1, > + Object->Data > + ); > + Object->Data[Object->DataSize] =3D AML_DUAL_NAME_PREFIX; > + Object->DataSize +=3D 1; > + } else { > + Object->Data =3D ReallocatePool ( > + Object->DataSize, > + Object->DataSize + NameStringSize + 2, > + Object->Data > + ); > + Object->Data[Object->DataSize] =3D AML_MULTI_NAME_PREFIX; > + Object->Data[Object->DataSize + 1] =3D NameSegCount & 0xFF; > + Object->DataSize +=3D 2; > + } > + > + // Copy NameString data over. From above must be at least one NameSeg > + CopyMem (&Object->Data[Object->DataSize], NameString, NameStringSize); > + Object->DataSize +=3D NameStringSize; > + FreePool (NameString); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + if (NameString !=3D NULL) { > + FreePool (NameString); > + } > + } > + > + return Status; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlNamed > Object.c > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlNamed > Object.c > new file mode 100644 > index 0000000000..37ae9319be > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlNamed > Object.c > @@ -0,0 +1,2138 @@ > +/** @file > + > + Copyright (C) 2020-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "LocalAmlLib.h" > +#include > + > +#define FILECODE > LIBRARY_DXEAMLGENERATIONLIB_AMLNAMEDOBJECT_FILECODE > + > +#define METHOD_ARGS_MAX 7 > +#define MAX_SYNC_LEVEL 0x0F > +#define GENERIC_FIELD_IDENTIFIER "FIELD" > + > +/** > + Creates a Device (ObjectName, Object) > + > + Object must be created between AmlStart and AmlClose Phase > + > + DefName :=3D DeviceOp PkgLength NameString TermList > + NameOp :=3D ExtOpPrefix 0x82 > + ExtOpPrefix :=3D 0x5B > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] String - Object name > + @param[in,out] ListHead - Linked list has completed String Object af= ter > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlDevice ( > + IN AML_FUNCTION_PHASE Phase, > + IN CHAR8 *String, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + > + if ((Phase >=3D AmlInvalid) || (String =3D=3D NULL) || (ListHead =3D= =3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + switch (Phase) { > + case AmlStart: > + Status =3D InternalAppendNewAmlObject (&Object, String, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start Device for %a object\n", > __func__, String)); > + goto Done; > + } > + > + // Start required PkgLength > + Status =3D AmlPkgLength (AmlStart, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start PkgLength for %a object\n= ", > __func__, String)); > + goto Done; > + } > + > + // Insert required NameString > + Status =3D AmlOPNameString (String, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Insert NameString for %a > object\n", __func__, String)); > + goto Done; > + } > + > + // TermList is too complicated and must be added outside > + break; > + > + case AmlClose: > + // TermList should be closed already > + > + // Close required PkgLength before finishing Object > + Status =3D AmlPkgLength (AmlClose, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Close PkgLength for %a object\n= ", > __func__, String)); > + goto Done; > + } > + > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, String, L= istHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Locate %a object\n", __func__, > String)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a child data collection.\n", > __func__, String)); > + goto Done; > + } > + > + // Device Op is two bytes > + Object->DataSize =3D ChildObject->DataSize + 2; > + Object->Data =3D AllocatePool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for %a\n"= , > __func__, String)); > + goto Done; > + } > + > + Object->Data[0] =3D AML_EXT_OP; > + Object->Data[1] =3D AML_EXT_DEVICE_OP; > + CopyMem ( > + &Object->Data[2], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + InternalFreeAmlObject (&ChildObject, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates an AccessField > + > + AccessField :=3D 0x01 AccessType AccessAttrib > + > + @param[in] AccessType - Access type for field member > + @param[in] AccessAttribute - Access attribute for field member > + @param[in,out] ListHead - Linked list containing AML objects > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +InternalAmlAccessField ( > + IN EFI_ACPI_FIELD_ACCESS_TYPE_KEYWORDS AccessType, > + IN EFI_ACPI_FIELD_ACCESS_ATTRIBUTE_KEYWORDS AccessAttribute, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + > + // Start new AML object > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start ACCESSFIELD object\n", > __func__)); > + goto Done; > + } > + > + Object->Data =3D AllocateZeroPool (3); > + // AML_ACCESSFIELD_OP + AccessType + AccessAttrib > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for > ACCESSFIELD\n", __func__)); > + goto Done; > + } > + > + Object->Data[0] =3D AML_FIELD_ACCESS_OP; > + Object->Data[1] =3D (UINT8)AccessType; > + Object->Data[2] =3D (UINT8)AccessAttribute; > + Object->DataSize =3D 3; > + > + Object->Completed =3D TRUE; > + Status =3D EFI_SUCCESS; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates an ExtendedAccessField > + > + ExtendedAccessField :=3D 0x03 AccessType ExtendedAccessAttrib > AccessLength > + > + @param[in] AccessType - Access type for field member > + @param[in] AccessAttribute - Access attribute for field member > + @param[in] AccessLength - Specifies the access length for th= e field > member > + @param[in,out] ListHead - Linked list containing AML objects > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +InternalAmlExtendedAccessField ( > + IN EFI_ACPI_FIELD_ACCESS_TYPE_KEYWORDS AccessType, > + IN EFI_ACPI_FIELD_ACCESS_ATTRIBUTE_KEYWORDS AccessAttribute, > + IN UINT8 AccessLength, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + > + // Start new AML object > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start EXTENDEDACCESSFIELD > object\n", __func__)); > + goto Done; > + } > + > + Object->Data =3D AllocateZeroPool (4); > + // AML_EXTACCESSFIELD_OP + AccessType + AccessAttrib + AccessLength > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for > EXTENDEDACCESSFIELD\n", __func__)); > + goto Done; > + } > + > + Object->Data[0] =3D AML_FIELD_EXT_ACCESS_OP; > + Object->Data[1] =3D (UINT8)AccessType; > + Object->Data[2] =3D (UINT8)AccessAttribute; > + Object->Data[3] =3D AccessLength; > + Object->DataSize =3D 4; > + > + Object->Completed =3D TRUE; > + Status =3D EFI_SUCCESS; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates an AccessAs Field Unit > + > + AccessAs (AccessType, AccessAttribute) > + AccessAs (AccessType, AccessAttribute (AccessLength)) > + > + AccessField :=3D 0x01 AccessType AccessAttrib > + AccessType :=3D ByteData // Bits 0:3 - Same as AccessType bits of Fie= ldFlags. > + // Bits 4:5 - Reserved > + // Bits 7:6 - 0 =3D AccessAttrib =3D Normal Ac= cess Attributes > + // 1 =3D AccessAttrib =3D AttribBytes (x) > + // 2 =3D AccessAttrib =3D AttribRawBytes (x) > + // 3 =3D AccessAttrib =3D AttribRawProcessByte= s (x) > + > + // x' is encoded as bits 0:7 of the AccessAttr= ib byte. > + The description of bits 7:6 is incorrect and i= f AttribBytes, > + AttribRawBytes, or AttribRawProcessBytes are u= sed here, an > + ExtendedAccessField is used with the following= definitions > + ExtendedAccessField :=3D 0x03 AccessType ExtendedAccessAttrib > AccessLength > + ExtendedAccessAttrib :=3D ByteData // 0x0B AttribBytes > + // 0x0E AttribRawBytes > + // 0x0F AttribRawProcess > + > + AccessAttrib :=3D ByteData // If AccessType is BufferAcc for the SMB = or > + // GPIO OpRegions, AccessAttrib can be one o= f > + // the following values: > + // 0x02 AttribQuick > + // 0x04 AttribSendReceive > + // 0x06 AttribByte > + // 0x08 AttribWord > + // 0x0A AttribBlock > + // 0x0C AttribProcessCall > + // 0x0D AttribBlockProcessCall > + > + @param[in] AccessType - Access type for field member > + @param[in] AccessAttribute - Access attribute for field member > + @param[in] AccessLength - Only used if AccessAttribute is At= tribBytes, > + AttribRawBytes, or AttribRawProces= sBytes. > + Specifies the access length for th= e field member > + Otherwise, ignored. > + @param[in,out] ListHead - Linked list containing AML objects > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPAccessAs ( > + IN EFI_ACPI_FIELD_ACCESS_TYPE_KEYWORDS AccessType, > + IN EFI_ACPI_FIELD_ACCESS_ATTRIBUTE_KEYWORDS AccessAttribute, > + IN UINT8 AccessLength, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + > + // AcessType parameter check > + if (AccessType > BufferAcc) { > + return EFI_INVALID_PARAMETER; > + } > + > + // AccessAttrib parameter checking > + if ((AccessAttribute >=3D AttribNormal) && (AccessAttribute <=3D Attri= bBlock)) { > + if ((AccessAttribute & 1) =3D=3D 1) { > + return EFI_INVALID_PARAMETER; > + } > + } else if (AccessAttribute > AttribRawProcessBytes) { > + return EFI_INVALID_PARAMETER; > + } > + > + // if AccessAttrib requires a length parameter, then an > ExtendedAccessField is used > + switch (AccessAttribute) { > + case AttribBytes: > + case AttribRawBytes: > + case AttribRawProcessBytes: > + Status =3D InternalAmlExtendedAccessField (AccessType, AccessAttri= bute, > AccessLength, ListHead); > + break; > + default: > + Status =3D InternalAmlAccessField (AccessType, AccessAttribute, Li= stHead); > + break; > + } > + > + return Status; > +} > + > +/** > + Creates an External Object > + > + External (ObjectName, ObjectType, ReturnType, ParameterTypes) > + > + Note: ReturnType is not used for AML encoding and is therefore not pas= sed > in > + to this function. > + ParameterTypes is only used if the ObjectType is a MethodObj. It > + specifies MethodObj's argument types in a list. For the purpose= s of > + this library, we are passing in the the number of input paramete= rs for > + that MethodObj. > + > + DefExternal :=3D ExternalOp NameString ObjectType ArgumentCount > + ExternalOp :=3D 0x15 > + ObjectType :=3D ByteData > + ArgumentCount :=3D ByteData (0 - 7) > + > + @param[in] Name - Object name > + @param[in] ObjectType - Type of object declared > + @param[in] NumArgs - Only used if ObjectType is MethodObj. > + Specifies the number of input parameters= for > + that MethodObj. > + Otherwise, ignored. > + @param[in,out] ListHead - Linked list that has completed External = Object > + after AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPExternal ( > + IN CHAR8 *Name, > + IN UINT8 ObjectType, > + IN UINT8 NumArgs, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + > + if ((Name =3D=3D NULL) || > + (NumArgs > METHOD_ARGS_MAX) || > + (ObjectType >=3D InvalidObj) || > + (ListHead =3D=3D NULL)) > + { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + // Start EXTERNAL object > + Status =3D InternalAppendNewAmlObject (&Object, "EXTERNAL", ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start %a object\n", __func__, > Name)); > + goto Done; > + } > + > + // Insert required NameString > + Status =3D AmlOPNameString (Name, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start %a NameString object\n", > __func__, Name)); > + goto Done; > + } > + > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, "EXTERNAL", > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Locate %a object\n", __func__, > Name)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a has no child data.\n", __func__, > Name)); > + goto Done; > + } > + > + Object->Data =3D AllocateZeroPool (ChildObject->DataSize + 3); > + // AML_EXTERNAL_OP + Name + ObjectType + ArgumentCount > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for %a\n", > __func__, Name)); > + goto Done; > + } > + > + Object->DataSize =3D 0; > + Object->Data[0] =3D AML_EXTERNAL_OP; > + Object->DataSize++; > + CopyMem ( > + &Object->Data[Object->DataSize], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + Object->DataSize +=3D ChildObject->DataSize; > + Object->Data[Object->DataSize] =3D ObjectType; > + Object->DataSize++; > + Object->Data[Object->DataSize] =3D NumArgs; > + Object->DataSize++; > + > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + Status =3D EFI_SUCCESS; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&ChildObject, ListHead); > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + Locates the AML object that holds the cumulative offset term. > + This is the node directly after the node designated by > + GENERIC_FIELD_IDENTIFIER in Object->Data. > + > + @param[out] ReturnObject - Object that contains the offset term > + @param[in,out] ListHead - Linked list that contains the > GENERIC_FIELD_IDENTIFIER > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +InternalAmlLocateOffsetTerm ( > + OUT AML_OBJECT_INSTANCE **ReturnObject, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + LIST_ENTRY *Node; > + AML_OBJECT_INSTANCE *Object; > + UINTN IdentifierSize; > + CHAR8 *Identifier; > + > + if (ListHead =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + Object =3D NULL; > + *ReturnObject =3D NULL; > + Identifier =3D GENERIC_FIELD_IDENTIFIER; > + IdentifierSize =3D AsciiStrLen (Identifier) + 1; > + // Look Backwards and find Node for this Object > + Node =3D ListHead; > + do { > + Node =3D GetPreviousNode (ListHead, Node); > + Object =3D AML_OBJECT_INSTANCE_FROM_LINK (Node); > + if ((Object->DataSize !=3D 0) && > + (Object->DataSize =3D=3D IdentifierSize) && > + (CompareMem ( > + Object->Data, > + Identifier, > + MAX (Object->DataSize, IdentifierSize) > + ) =3D=3D 0)) > + { > + break; > + } > + } while (Node !=3D ListHead); > + > + // Check to make sure FIELD is found, otherwise error > + if ((Object->DataSize =3D=3D 0) || > + (Object->DataSize !=3D IdentifierSize) || > + CompareMem ( > + Object->Data, > + Identifier, > + (MAX (Object->DataSize, IdentifierSize) !=3D 0) > + )) > + { > + return EFI_DEVICE_ERROR; > + } > + > + // Have found FIELD > + Node =3D GetNextNode (ListHead, Node); > + Object =3D AML_OBJECT_INSTANCE_FROM_LINK (Node); > + *ReturnObject =3D Object; > + return EFI_SUCCESS; > +} > + > +/** > + Offset (ByteOffset) > + > + Creates a ReservedField if the passed ByteOffset is larger than > + the previous bit length value optionally specified by an AmlOPFieldLis= tItem, > + or another Offset call. All offsets are defined starting from zero, ba= sed at > + the starting address of the parent Operation Region. > + > + ReservedField :=3D 0x00 PkgLength > + > + @param[in] ByteLength -Byte offset of the next defined field w= ithin > + the parent Operation Region > + @param[in,out] ListHead - Linked list has completed Offset objec= t > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPOffset ( > + IN UINT32 ByteOffset, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *OffsetObject; > + UINT8 *PkgLength; > + UINTN DataLength; > + EFI_STATUS Status; > + UINT64 InternalOffsetData; > + UINT64 BitCount; > + > + if (ListHead =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + InternalOffsetData =3D 0; > + BitCount =3D LShiftU64 (ByteOffset, 3); > + Object =3D NULL; > + OffsetObject =3D NULL; > + PkgLength =3D NULL; > + > + // Find and read internal offset data > + Status =3D InternalAmlLocateOffsetTerm (&OffsetObject, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Locating internal offset term\n", > __func__)); > + goto Done; > + } > + > + InternalOffsetData =3D *(UINT64 *)OffsetObject->Data; > + > + if (InternalOffsetData > BitCount) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Invalid backwards offset\n", > __func__)); > + Status =3D EFI_INVALID_PARAMETER; > + goto Done; > + } else if (InternalOffsetData =3D=3D BitCount) { > + // Do not need to append any reserved fields > + Status =3D EFI_SUCCESS; > + goto Done; > + } > + > + // update internal offset value to new offset > + *(UINT64 *)OffsetObject->Data =3D BitCount; > + > + // take difference to find how many bits to reserve > + BitCount =3D BitCount - InternalOffsetData; > + > + // Create new object for the offset data, add pkglength encoding > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: appending new AML object\n", > __func__)); > + goto Done; > + } > + > + Status =3D InternalAmlBitPkgLength ((UINT32)BitCount, &PkgLength, > &DataLength); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: internal AML PkgLength\n", > __func__)); > + goto Done; > + } > + > + Object->DataSize =3D DataLength + 1; // add one for Reserved Field Ind= icator > + Object->Data =3D AllocateZeroPool (Object->DataSize); > + > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for Offset\n"= , > __func__)); > + goto Done; > + } > + > + Object->Data[0] =3D 0; > + CopyMem (&Object->Data[1], PkgLength, DataLength); // read internal > offset data > + Object->Completed =3D TRUE; > + FreePool (PkgLength); > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + InternalFreeAmlObject (&OffsetObject, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates a NamedField or a ReservedField, depending on the > + parameters. > + > + To create a NamedField item pass in the NameSeg and Bitlength > + as in ASL. To create a ReservedField pass "" as the Name. > + Must be used inside a Field or IndexField TermList. > + > + NamedField :=3D NameSeg PkgLength > + ReservedField :=3D 0x00 PkgLength > + > + @param[in] Name - Field NameSeg > + @param[in] BitLength - Length of field item in bits > + @param[in,out] ListHead - Linked list has completed FieldUnitIte= m > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPFieldUnit ( > + IN CHAR8 *Name, > + IN UINT32 BitLength, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *OffsetObject; > + EFI_STATUS Status; > + > + if ((ListHead =3D=3D NULL) || (Name =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + OffsetObject =3D NULL; > + > + if (AsciiStrLen (Name) =3D=3D 0) { > + if (BitLength > 0) { > + // Prepend a 0 to the list > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Unable to append AML object.\n"= , > __func__)); > + goto Done; > + } > + > + Object->Data =3D AllocateZeroPool (1); > + Object->DataSize =3D 1; > + Object->Completed =3D TRUE; > + } else { > + Status =3D EFI_SUCCESS; > + goto Done; > + } > + } else { > + // add NameSeg to List > + Status =3D InternalAmlNameSeg (Name, ListHead); > + } > + > + if (EFI_ERROR (Status)) { > + goto Done; > + } > + > + // Locate and update internal Offset term > + Status =3D InternalAmlLocateOffsetTerm (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Locating offset term for %a > object\n", __func__, Name)); > + goto Done; > + } > + > + *(UINT64 *)Object->Data +=3D BitLength; // write > + > + // Add BitLength as a PkgLength term > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Appending BitLength for %a > object\n", __func__, Name)); > + goto Done; > + } > + > + Status =3D InternalAmlBitPkgLength (BitLength, &Object->Data, &Object- > >DataSize); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Appending BitLength for %a > object\n", __func__, Name)); > + goto Done; > + } > + > + Object->Completed =3D TRUE; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + InternalFreeAmlObject (&OffsetObject, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates a Field > + > + Field (RegionName, AccessType, LockRule, UpdateRule) {FieldUnitList} > + > + FieldUnitList must be added between AmlStart and AmlClose phase > + > + DefField :=3D FieldOp PkgLength NameString FieldFlags FieldList > + FieldOp :=3D ExtOpPrefix 0x81 > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] Name - Field NameString > + @param[in] AccessType - Access Type for field > + @param[in] LockRule - Lock rule for field > + @param[in] UpdateRule - Update rule for field > + @param[in,out] ListHead - Linked list has completed Field Object= after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlField ( > + IN AML_FUNCTION_PHASE Phase, > + IN CHAR8 *Name, > + IN EFI_ACPI_FIELD_ACCESS_TYPE_KEYWORDS AccessType, > + IN EFI_ACPI_FIELD_LOCK_RULE_KEYWORDS LockRule, > + IN EFI_ACPI_FIELD_UPDATE_RULE_KEYWORDS UpdateRule, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINT8 FieldFlags; > + UINTN ChildCount; > + > + if ((ListHead =3D=3D NULL) || (Name =3D=3D NULL) || (AsciiStrLen (Name= ) =3D=3D 0)) { > + return EFI_INVALID_PARAMETER; > + } > + > + // parameter validation > + if ((Phase > AmlClose) || (AccessType > BufferAcc) || (LockRule > Lock= ) || > (UpdateRule > WriteAsZeros)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + switch (Phase) { > + case AmlStart: > + Status =3D InternalAppendNewAmlObject (&Object, > GENERIC_FIELD_IDENTIFIER, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start Field for %a object\n", > __func__, Name)); > + goto Done; > + } > + > + // Insert internal offset counter > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Unable to append AML object.\n"= , > __func__)); > + goto Done; > + } > + > + Object->DataSize =3D sizeof (UINT64); > + Object->Data =3D AllocateZeroPool (Object->DataSize); > + Object->Completed =3D TRUE; > + if (EFI_ERROR (Status) || (Object->Data =3D=3D NULL)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start Field internal offset %a > object\n", __func__, Name)); > + goto Done; > + } > + > + // Start required PkgLength > + Status =3D AmlPkgLength (AmlStart, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start PkgLength for %a object\n= ", > __func__, Name)); > + goto Done; > + } > + > + // Insert required NameString > + Status =3D AmlOPNameString (Name, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start NameString for %a object\= n", > __func__, Name)); > + goto Done; > + } > + > + // Add Field Flags > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start FIELD_FLAGS for %a > object\n", __func__, Name)); > + goto Done; > + } > + > + // Field Flags is one byte > + Object->DataSize =3D 1; > + Object->Data =3D AllocatePool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for %a\n"= , > __func__, Name)); > + goto Done; > + } > + > + FieldFlags =3D (UINT8)((UpdateRule << 5) | (LockRule << 4) | Acces= sType); > + > + Object->Data[0] =3D FieldFlags; > + Object->Completed =3D TRUE; > + > + // TermList is too complicated and must be added outside > + break; > + > + case AmlClose: > + > + // Required NameString completed in one phase call > + > + // Close required PkgLength before finishing Object > + Status =3D AmlPkgLength (AmlClose, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Close PkgLength for %a object\n= ", > __func__, Name)); > + goto Done; > + } > + > + // Remove internal offset counter > + Status =3D InternalAmlLocateOffsetTerm (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Locating internal offset term%a= \n", > __func__, Name)); > + goto Done; > + } > + > + Status =3D InternalFreeAmlObject (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: removing offset term%a\n", > __func__, Name)); > + goto Done; > + } > + > + // remove original field identifier data > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, > GENERIC_FIELD_IDENTIFIER, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Locate %a object\n", __func__, > Name)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a child data collection.\n", > __func__, Name)); > + goto Done; > + } > + > + // Field Op is two bytes > + Object->DataSize =3D ChildObject->DataSize + 2; > + Object->Data =3D AllocatePool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for %a\n"= , > __func__, Name)); > + goto Done; > + } > + > + Object->Data[0] =3D AML_EXT_OP; > + Object->Data[1] =3D AML_EXT_FIELD_OP; > + CopyMem ( > + &Object->Data[2], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&ChildObject, ListHead); > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates a BankField > + > + BankField (RegionName, BankName, BankValue, AccessType, LockRule, > UpdateRule) {FieldUnitList} > + FieldUnitList must be added between AmlStart and AmlClose phase > + > + DefBankField :=3D BankFieldOp PkgLength NameString NameString BankVal= ue > FieldFlags FieldList > + BankFieldOp :=3D ExtOpPrefix 0x87 > + BankValue :=3D TermArg =3D> Integer > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] RegionName - Name of host Operation Region > + @param[in] BankName - Name of bank selection register > + @param[in] BankValue - Bank Selection ID > + @param[in] AccessType - Access Type as in Field > + @param[in] LockRule - Lock rule as in Field > + @param[in] UpdateRule - Update rule as in Field > + @param[in,out] ListHead - Linked list has completed BankField Ob= ject > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlBankField ( > + IN AML_FUNCTION_PHASE Phase, > + IN CHAR8 *RegionName, > + IN CHAR8 *BankName, > + IN UINT64 BankValue, > + IN EFI_ACPI_FIELD_ACCESS_TYPE_KEYWORDS AccessType, > + IN EFI_ACPI_FIELD_LOCK_RULE_KEYWORDS LockRule, > + IN EFI_ACPI_FIELD_UPDATE_RULE_KEYWORDS UpdateRule, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINT8 FieldFlags; > + UINTN ChildCount; > + > + if ((ListHead =3D=3D NULL) || (RegionName =3D=3D NULL) || (AsciiStrLen > (RegionName) =3D=3D 0) || > + (BankName =3D=3D NULL) || (AsciiStrLen (BankName) =3D=3D 0)) > + { > + return EFI_INVALID_PARAMETER; > + } > + > + // parameter validation > + if ((Phase > AmlClose) || (AccessType > BufferAcc) || (LockRule > Lock= ) || > (UpdateRule > WriteAsZeros)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + switch (Phase) { > + case AmlStart: > + Status =3D InternalAppendNewAmlObject (&Object, > GENERIC_FIELD_IDENTIFIER, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start BankField for %a object\n= ", > __func__, BankName)); > + goto Done; > + } > + > + // Insert internal offset counter > + Status =3D InternalAppendNewAmlObjectNoData (&Object, L= istHead); > + Object->DataSize =3D sizeof (UINT64); > + Object->Data =3D AllocateZeroPool (Object->DataSize); > + Object->Completed =3D TRUE; > + if (EFI_ERROR (Status) || (Object->Data =3D=3D NULL)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start BankField internal offset= %a > object\n", __func__, BankName)); > + goto Done; > + } > + > + // Start required PkgLength > + Status =3D AmlPkgLength (AmlStart, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start PkgLength for %a object\n= ", > __func__, BankName)); > + goto Done; > + } > + > + // Insert required Region NameString > + Status =3D AmlOPNameString (RegionName, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start NameString for %a object\= n", > __func__, RegionName)); > + goto Done; > + } > + > + // Insert required Bank NameString > + Status =3D AmlOPNameString (BankName, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start NameString for %a object\= n", > __func__, BankName)); > + goto Done; > + } > + > + // Insert required BankValue integer > + Status =3D AmlOPDataInteger (BankValue, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Adding BankValue Integer for %a > object\n", __func__, BankName)); > + goto Done; > + } > + > + // Add Field Flags > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start FIELD_FLAGS for %a > object\n", __func__, BankName)); > + goto Done; > + } > + > + // Field Flags is one byte > + Object->DataSize =3D 1; > + Object->Data =3D AllocatePool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for %a\n"= , > __func__, BankName)); > + goto Done; > + } > + > + FieldFlags =3D (UINT8)((UpdateRule << 5) | (LockRule << 4) | Acces= sType); > + > + Object->Data[0] =3D FieldFlags; > + Object->Completed =3D TRUE; > + > + // TermList is too complicated and must be added outside > + break; > + > + case AmlClose: > + > + // Required NameStrings completed in one phase call > + > + // Close required PkgLength before finishing Object > + Status =3D AmlPkgLength (AmlClose, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Close PkgLength for %a object\n= ", > __func__, BankName)); > + goto Done; > + } > + > + // Remove internal offset counter > + Status =3D InternalAmlLocateOffsetTerm (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Locating internal offset term%a= \n", > __func__, BankName)); > + goto Done; > + } > + > + Status =3D InternalFreeAmlObject (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: removing offset term%a\n", > __func__, BankName)); > + goto Done; > + } > + > + // remove original field identifier data > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, > GENERIC_FIELD_IDENTIFIER, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Locate %a object\n", __func__, > BankName)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a child data collection.\n", > __func__, BankName)); > + goto Done; > + } > + > + // Field Op is two bytes > + Object->DataSize =3D ChildObject->DataSize + 2; > + Object->Data =3D AllocatePool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for %a\n"= , > __func__, BankName)); > + goto Done; > + } > + > + Object->Data[0] =3D AML_EXT_OP; > + Object->Data[1] =3D AML_EXT_BANK_FIELD_OP; > + CopyMem ( > + &Object->Data[2], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&ChildObject, ListHead); > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates an IndexField > + > + IndexField (IndexName, DataName, AccessType, LockRule, UpdateRule) > {FieldUnitList} > + > + FieldUnitList must be added between AmlStart and AmlClose phase > + > + DefIndexField :=3D IndexFieldOp PkgLength NameString NameString FieldF= lags > FieldList > + IndexFieldOp :=3D ExtOpPrefix 0x86 > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] IndexName - Name of Index FieldUnit > + @param[in] DataName - Name of Data FieldUnit > + @param[in] AccessType - Access Type for the FieldUnit > + @param[in] LockRule - Lock rule for the FieldUnit > + @param[in] UpdateRule - Update rule for the FieldUnit > + @param[in,out] ListHead - Linked list has completed IndexField O= bject > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlIndexField ( > + IN AML_FUNCTION_PHASE Phase, > + IN CHAR8 *IndexName, > + IN CHAR8 *DataName, > + IN EFI_ACPI_FIELD_ACCESS_TYPE_KEYWORDS AccessType, > + IN EFI_ACPI_FIELD_LOCK_RULE_KEYWORDS LockRule, > + IN EFI_ACPI_FIELD_UPDATE_RULE_KEYWORDS UpdateRule, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINT8 FieldFlags; > + UINTN ChildCount; > + > + if ((ListHead =3D=3D NULL) || (IndexName =3D=3D NULL) || (AsciiStrLen = (IndexName) > =3D=3D 0) || > + (DataName =3D=3D NULL) || (AsciiStrLen (DataName) =3D=3D 0)) > + { > + return EFI_INVALID_PARAMETER; > + } > + > + // parameter validation > + if ((Phase > AmlClose) || (AccessType > BufferAcc) || (LockRule > Lock= ) || > (UpdateRule > WriteAsZeros)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + switch (Phase) { > + case AmlStart: > + Status =3D InternalAppendNewAmlObject (&Object, > GENERIC_FIELD_IDENTIFIER, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start IndexField for %a object\= n", > __func__, IndexName)); > + goto Done; > + } > + > + // Insert internal offset counter > + Status =3D InternalAppendNewAmlObjectNoData (&Object, L= istHead); > + Object->DataSize =3D sizeof (UINT64); > + Object->Data =3D AllocateZeroPool (Object->DataSize); > + Object->Completed =3D TRUE; > + if (EFI_ERROR (Status) || (Object->Data =3D=3D NULL)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start IndexField internal offse= t %a > object\n", __func__, IndexName)); > + goto Done; > + } > + > + // Start required PkgLength > + Status =3D AmlPkgLength (AmlStart, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start PkgLength for %a object\n= ", > __func__, IndexName)); > + goto Done; > + } > + > + // Insert required Index NameString > + Status =3D AmlOPNameString (IndexName, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start NameString for %a object\= n", > __func__, IndexName)); > + goto Done; > + } > + > + // Insert required Data NameString > + Status =3D AmlOPNameString (DataName, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start NameString for %a object\= n", > __func__, DataName)); > + goto Done; > + } > + > + // Add Field Flags > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start FIELD_FLAGS for %a > object\n", __func__, IndexName)); > + goto Done; > + } > + > + // Field Flags is one byte > + Object->DataSize =3D 1; > + Object->Data =3D AllocatePool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for %a\n"= , > __func__, IndexName)); > + goto Done; > + } > + > + FieldFlags =3D (UINT8)((UpdateRule << 5) | (LockRule << 4) | Acces= sType); > + > + Object->Data[0] =3D FieldFlags; > + Object->Completed =3D TRUE; > + > + // TermList is too complicated and must be added outside > + break; > + > + case AmlClose: > + > + // Required NameString completed in one phase call > + > + // Close required PkgLength before finishing Object > + Status =3D AmlPkgLength (AmlClose, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Close PkgLength for %a object\n= ", > __func__, IndexName)); > + goto Done; > + } > + > + // Remove internal offset counter > + Status =3D InternalAmlLocateOffsetTerm (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Locating internal offset term%a= \n", > __func__, IndexName)); > + goto Done; > + } > + > + Status =3D InternalFreeAmlObject (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: removing offset term%a\n", > __func__, IndexName)); > + goto Done; > + } > + > + // remove original field identifier data > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, > GENERIC_FIELD_IDENTIFIER, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Locate %a object\n", __func__, > IndexName)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a child data collection.\n", > __func__, IndexName)); > + goto Done; > + } > + > + // Field Op is two bytes > + Object->DataSize =3D ChildObject->DataSize + 2; > + Object->Data =3D AllocatePool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for %a\n"= , > __func__, IndexName)); > + goto Done; > + } > + > + Object->Data[0] =3D AML_EXT_OP; > + Object->Data[1] =3D AML_EXT_INDEX_FIELD_OP; > + CopyMem ( > + &Object->Data[2], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&ChildObject, ListHead); > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + OperationRegion (RegionName, RegionSpace, Offset, Length) > + > + DefOpRegion :=3D OpRegionOp NameString RegionSpace RegionOffset > RegionLen > + OpRegionOp :=3D ExtOpPrefix 0x80 > + RegionSpace :=3D > + ByteData // 0x00 SystemMemory > + // 0x01 SystemIO > + // 0x02 PCI_Config > + // 0x03 EmbeddedControl > + // 0x04 SMBus > + // 0x05 System CMOS > + // 0x06 PciBarTarget > + // 0x07 IPMI > + // 0x08 GeneralPurposeIO > + // 0x09 GenericSerialBus > + // 0x0A PCC > + // 0x80-0xFF: OEM Defined > + RegionOffset :=3D TermArg =3D> Integer > + RegionLen :=3D TermArg =3D> Integer > + > + @param[in] RegionName - Name for the Operation Region > + @param[in] RegionSpace - Region Space type > + @param[in] Offset - Offset within the selected RegionSpace = at which > the > + region starts (byte-granular) > + @param[in] Length - Length of the region in bytes. > + @param[in,out] ListHead - Linked list head > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPOperationRegion ( > + IN CHAR8 *RegionName, > + IN GENERIC_ADDRESS_SPACE_ID RegionSpace, > + IN UINT64 Offset, > + IN UINT64 Length, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + EFI_STATUS Status; > + > + // Input parameter validation > + if ((RegionName =3D=3D NULL) || (AsciiStrLen (RegionName) =3D=3D 0) ||= (ListHead > =3D=3D NULL) || > + ((RegionSpace > PCC) && (RegionSpace < 0x80)) || (RegionSpace > 0x= FF)) > + { > + return EFI_INVALID_PARAMETER; > + } > + > + Object =3D NULL; > + ChildObject =3D NULL; > + Status =3D EFI_DEVICE_ERROR; > + > + Status =3D InternalAppendNewAmlObject (&Object, "OPREGION", ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start OpRegion for %a object\n", > __func__, RegionName)); > + goto Done; > + } > + > + Status =3D AmlOPNameString (RegionName, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Name String for %a object\n", > __func__, RegionName)); > + goto Done; > + } > + > + Status =3D AmlOPByteData ((UINT8)RegionSpace, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Region space byte data for %a > object\n", __func__, RegionName)); > + goto Done; > + } > + > + Status =3D AmlOPDataInteger (Offset, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Offset data integer for %a object\n= ", > __func__, RegionName)); > + goto Done; > + } > + > + Status =3D AmlOPDataInteger (Length, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Length data integer for %a object\n= ", > __func__, RegionName)); > + goto Done; > + } > + > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, "OPREGION", > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Locate %a object\n", __func__, > RegionName)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a child data collection.\n", > __func__, RegionName)); > + goto Done; > + } > + > + // OpRegion Opcode is two bytes > + Object->DataSize =3D ChildObject->DataSize + 2; > + Object->Data =3D AllocatePool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for %a\n", > __func__, RegionName)); > + goto Done; > + } > + > + Object->Data[0] =3D AML_EXT_OP; > + Object->Data[1] =3D AML_EXT_REGION_OP; > + CopyMem ( > + &Object->Data[2], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + InternalFreeAmlObject (&ChildObject, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates a CreateField AML Object and inserts it into the linked list > + > + Syntax: > + CreateField ( SourceBuffer, BitIndex, NumBits, FieldName ) > + > + DefCreateField :=3D CreateFieldOp SourceBuff BitIndex NumBits NameStri= ng > + CreateFieldOp :=3D ExtOpPrefix 0x13 > + ExtOpPrefix :=3D 0x5B > + SourceBuff :=3D TermArg =3D> Buffer > + BitIndex :=3D TermArg =3D> Integer > + NumBits :=3D TermArg -> Integer > + > + @param[in] SourceBuffer, - Buffer to house the new buffer field= object > + @param[in] BitIndex, - Starting bit index place the new buf= fer > + @param[in] NumBits, - Number of bits to reserve > + @param[in] FieldName, - The new buffer field object to be cr= eated in > SourceBuffer > + @param[in,out] ListHead - Linked list has completed CreateFiel= d object > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPCreateField ( > + IN CHAR8 *SourceBuffer, > + IN UINT64 BitIndex, > + IN UINT64 NumBits, > + IN CHAR8 *FieldName, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + > + ChildObject =3D NULL; > + Object =3D NULL; > + > + if ((SourceBuffer =3D=3D NULL) || (FieldName =3D=3D NULL) || (ListHead= =3D=3D NULL) || > + (AsciiStrLen (SourceBuffer) =3D=3D 0) || (AsciiStrLen (FieldName) = =3D=3D 0)) > + { > + return EFI_INVALID_PARAMETER; > + } > + > + ChildObject =3D NULL; > + Status =3D InternalAppendNewAmlObject (&Object, "CreateField", > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: CreateField for %a object\n", > __func__, FieldName)); > + goto Done; > + } > + > + Status =3D AmlOPNameString (SourceBuffer, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: NameString for %a object\n", > __func__, FieldName)); > + goto Done; > + } > + > + Status =3D AmlOPDataInteger (BitIndex, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: BitIndex for %a object\n", __func__= , > FieldName)); > + goto Done; > + } > + > + Status =3D AmlOPDataInteger (NumBits, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: NumBits for %a object\n", __func__, > FieldName)); > + goto Done; > + } > + > + Status =3D AmlOPNameString (FieldName, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: FieldName for %a object\n", > __func__, FieldName)); > + goto Done; > + } > + > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, "CreateField"= , > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Locate %a object\n", __func__, > FieldName)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a child data collection.\n", > __func__, FieldName)); > + goto Done; > + } > + > + // CreateFieldOp is two bytes > + Object->DataSize =3D ChildObject->DataSize + 2; > + Object->Data =3D AllocatePool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for %a\n", > __func__, FieldName)); > + goto Done; > + } > + > + Object->Data[0] =3D AML_EXT_OP; > + Object->Data[1] =3D AML_EXT_CREATE_FIELD_OP; > + CopyMem ( > + &Object->Data[2], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&ChildObject, ListHead); > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + Internal function used to create a > CreateBit|Byte|Word|DWord|QWordField objects > + and insert them into the linked list > + > + @param[in] SourceBuffer, - Buffer to insert the new buffer fi= xed field > object > + @param[in] Index, - Starting index to place the new bu= ffer > + @param[in] FixedFieldName, - Name of the FixedField > + @param[in] OpCode, - AML opcode for the Create_Field en= coding > + @param[in,out] ListHead - Linked list has completed CreateFi= xedField > object > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +InternalAmlCreateFixedField ( > + IN CHAR8 *SourceBuffer, > + IN UINT64 Index, > + IN CHAR8 *FixedFieldName, > + IN UINT8 OpCode, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + > + ChildObject =3D NULL; > + > + if ((SourceBuffer =3D=3D NULL) || (FixedFieldName =3D=3D NULL) || (Lis= tHead =3D=3D > NULL) || > + (AsciiStrLen (SourceBuffer) =3D=3D 0) || (AsciiStrLen (FixedFieldN= ame) =3D=3D 0)) > + { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D InternalAppendNewAmlObject (&Object, "CreateFixedField", > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: CreateField for %a object\n", > __func__, FixedFieldName)); > + goto Done; > + } > + > + // Check if Localx Buffer > + if (AsciiStrnCmp (SourceBuffer, "Local", 5) =3D=3D 0) { > + if ((SourceBuffer[5] >=3D '0') && (SourceBuffer[5] <=3D '9')) { > + Status =3D AmlOPLocalN ((UINT8)AsciiStrDecimalToUintn > (&SourceBuffer[5]), ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: LocalN for %a object\n", __func= __, > FixedFieldName)); > + goto Done; > + } > + } > + > + // Check if Argx Buffer > + } else if (AsciiStrnCmp (SourceBuffer, "Arg", 3) =3D=3D 0) { > + if ((SourceBuffer[3] >=3D '0') && (SourceBuffer[3] <=3D '9')) { > + Status =3D AmlOpArgN ((UINT8)AsciiStrDecimalToUintn (&SourceBuffer= [3]), > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: ArgN for %a object\n", __func__= , > FixedFieldName)); > + goto Done; > + } > + } > + } else { > + Status =3D AmlOPNameString (SourceBuffer, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: NameString for %a object\n", > __func__, FixedFieldName)); > + goto Done; > + } > + } > + > + Status =3D AmlOPDataInteger (Index, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Index for %a object\n", __func__, > FixedFieldName)); > + goto Done; > + } > + > + Status =3D AmlOPNameString (FixedFieldName, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: FieldName for %a object\n", > __func__, FixedFieldName)); > + goto Done; > + } > + > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, "CreateFixedF= ield", > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Locate %a object\n", __func__, > FixedFieldName)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a child data collection.\n", > __func__, FixedFieldName)); > + goto Done; > + } > + > + // CreateWordFieldOp is one byte > + Object->DataSize =3D ChildObject->DataSize + 1; > + Object->Data =3D AllocatePool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for %a\n", > __func__, FixedFieldName)); > + goto Done; > + } > + > + Object->Data[0] =3D OpCode; > + CopyMem ( > + &Object->Data[1], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&ChildObject, ListHead); > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates a CreateBitField AML Object and inserts it into the linked lis= t > + > + Syntax: > + CreateBitField (SourceBuffer, BitIndex, BitFieldName) > + > + DefCreateBitField :=3D CreateBitFieldOp SourceBuff BitIndex NameStri= ng > + CreateBitFieldOp :=3D 0x8D > + SourceBuff :=3D TermArg =3D> Buffer > + BitIndex :=3D TermArg =3D> Integer > + > + @param[in] SourceBuffer, - Buffer to insert the new buffer bit = field > object > + @param[in] BitIndex, - Starting bit index to place the new = buffer > + @param[in] BitFieldName, - Name of the BitField > + @param[in,out] ListHead - Linked list has completed CreateBitF= ield > object > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPCreateBitField ( > + IN CHAR8 *SourceBuffer, > + IN UINT64 BitIndex, > + IN CHAR8 *BitFieldName, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + > + Status =3D InternalAmlCreateFixedField (SourceBuffer, BitIndex, BitFie= ldName, > AML_CREATE_BIT_FIELD_OP, ListHead); > + return Status; > +} > + > +/** > + Creates a CreateByteField AML Object and inserts it into the linked li= st > + > + Syntax: > + CreateByteField ( SourceBuffer, ByteIndex, ByteFieldName ) > + > + DefCreateByteField :=3D CreateByteFieldOp SourceBuff ByteIndex > NameString > + CreateByteFieldOp :=3D 0x8C > + SourceBuff :=3D TermArg =3D> Buffer > + ByteIndex :=3D TermArg =3D> Integer > + > + @param[in] SourceBuffer, - Buffer to insert the new buffer byte= field > object > + @param[in] ByteIndex, - Starting byte index to place the new= buffer > + @param[in] ByteFieldName, - Name of the ByteField > + @param[in,out] ListHead - Linked list has completed CreateByte= Field > object > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPCreateByteField ( > + IN CHAR8 *SourceBuffer, > + IN UINT64 ByteIndex, > + IN CHAR8 *ByteFieldName, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + > + Status =3D InternalAmlCreateFixedField (SourceBuffer, ByteIndex, > ByteFieldName, AML_CREATE_BYTE_FIELD_OP, ListHead); > + return Status; > +} > + > +/** > + Creates a CreateDWordField AML Object and inserts it into the linked l= ist > + > + Syntax: > + CreateDWordField ( SourceBuffer, ByteIndex, DWordFieldName ) > + > + DefCreateDWordField :=3D CreateDWordFieldOp SourceBuff ByteIndex > NameString > + CreateDWordFieldOp :=3D 0x8A > + SourceBuff :=3D TermArg =3D> Buffer > + ByteIndex :=3D TermArg =3D> Integer > + > + @param[in] SourceBuffer, - Buffer to insert the new buffer DW= ord > field object > + @param[in] ByteIndex, - Starting byte index to place the n= ew buffer > + @param[in] DWordFieldName, - Name of the DWordField > + @param[in,out] ListHead - Linked list has completed > CreateDWordField object > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPCreateDWordField ( > + IN CHAR8 *SourceBuffer, > + IN UINT64 ByteIndex, > + IN CHAR8 *DWordFieldName, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + > + Status =3D InternalAmlCreateFixedField (SourceBuffer, ByteIndex, > DWordFieldName, AML_CREATE_DWORD_FIELD_OP, ListHead); > + return Status; > +} > + > +/** > + Creates a CreateQWordField AML Object and inserts it into the linked l= ist > + > + Syntax: > + CreateQWordField ( SourceBuffer, ByteIndex, QWordFieldName ) > + > + DefCreateQWordField :=3D CreateQWordFieldOp SourceBuff ByteIndex > NameString > + CreateQWordFieldOp :=3D 0x8F > + SourceBuff :=3D TermArg =3D> Buffer > + ByteIndex :=3D TermArg =3D> Integer > + > + @param[in] SourceBuffer, - Buffer to insert the new buffer QW= ord > field object > + @param[in] ByteIndex, - Starting byte index to place the n= ew buffer > + @param[in] QWordFieldName, - Name of the QWordField > + @param[in,out] ListHead - Linked list has completed > CreateQWordField object > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPCreateQWordField ( > + IN CHAR8 *SourceBuffer, > + IN UINT64 ByteIndex, > + IN CHAR8 *QWordFieldName, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + > + Status =3D InternalAmlCreateFixedField (SourceBuffer, ByteIndex, > QWordFieldName, AML_CREATE_QWORD_FIELD_OP, ListHead); > + return Status; > +} > + > +/** > + Creates a CreateWordField AML Object and inserts it into the linked li= st > + > + Syntax: > + CreateWordField ( SourceBuffer, ByteIndex, WordFieldName ) > + > + DefCreateWordField :=3D CreateWordFieldOp SourceBuff ByteIndex > NameString > + CreateWordFieldOp :=3D 0x8B > + SourceBuff :=3D TermArg =3D> Buffer > + ByteIndex :=3D TermArg =3D> Integer > + > + @param[in] SourceBuffer, - Buffer to house the new buffer word = field > object > + @param[in] ByteIndex, - Starting byte index to place the new= buffer > + @param[in] WordFieldName, - Name of the WordField > + @param[in,out] ListHead - Linked list has completed CreateWord= Field > object > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPCreateWordField ( > + IN CHAR8 *SourceBuffer, > + IN UINT64 ByteIndex, > + IN CHAR8 *WordFieldName, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + > + Status =3D InternalAmlCreateFixedField (SourceBuffer, ByteIndex, > WordFieldName, AML_CREATE_WORD_FIELD_OP, ListHead); > + return Status; > +} > + > +/** > + Creates a Method > + > + Method (MethodName, NumArgs, SerializeRule, SyncLevel, ReturnType, > + ParameterTypes) {TermList} > + > + TermList must be created between AmlStart and AmlClose Phase > + > + Note: ReturnType and ParameterTypes are not used for AML encoding > + and are therefore not passed in to this function. > + > + DefMethod :=3D MethodOp PkgLength NameString MethodFlags TermList > + MethodOp :=3D 0x14 > + MethodFlags :=3D ByteData // bit 0-2: ArgCount (0-7) > + // bit 3: SerializeFlag > + // 0 NotSerialized > + // 1 Serialized > + // bit 4-7: SyncLevel (0x00-0x0f) > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] Name - Method name > + @param[in] NumArgs - Number of arguments passed in to metho= d > + @param[in] SerializeRule - Flag indicating whether method is seri= alized > + or not > + @param[in] SyncLevel - synchronization level for the method (= 0 - 15), > + use zero for default sync level. > + @param[in,out] ListHead - Linked list has completed String Objec= t after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlMethod ( > + IN AML_FUNCTION_PHASE Phase, > + IN CHAR8 *Name, > + IN UINT8 NumArgs, > + IN METHOD_SERIALIZE_FLAG SerializeRule, > + IN UINT8 SyncLevel, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINT8 MethodFlags; > + UINTN ChildCount; > + > + if ((Phase >=3D AmlInvalid) || > + (Name =3D=3D NULL) || > + (NumArgs > METHOD_ARGS_MAX) || > + (SyncLevel > MAX_SYNC_LEVEL) || > + (SerializeRule >=3D FlagInvalid) || > + (ListHead =3D=3D NULL)) > + { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + switch (Phase) { > + case AmlStart: > + Status =3D InternalAppendNewAmlObject (&Object, "Method", ListHead= ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start Method for %a object\n", > __func__, Name)); > + goto Done; > + } > + > + // Start required PkgLength > + Status =3D AmlPkgLength (AmlStart, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start PkgLength for %a object\n= ", > __func__, Name)); > + goto Done; > + } > + > + // Insert required NameString > + Status =3D AmlOPNameString (Name, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start NameString for %a object\= n", > __func__, Name)); > + goto Done; > + } > + > + // Add Method Flags > + Status =3D InternalAppendNewAmlObject (&Object, "METHOD_FLAGS", > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start METHOD_FLAGS for %a > object\n", __func__, Name)); > + goto Done; > + } > + > + // TermList is too complicated and must be added outside > + break; > + > + case AmlClose: > + // TermList should be closed already > + // Add Method Flags > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, > "METHOD_FLAGS", ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: locate METHOD_FLAGS for %a > object\n", __func__, Name)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a METHOD_FLAGS child data > collection.\n", __func__, Name)); > + goto Done; > + } > + > + // Method Flags is one byte > + Object->DataSize =3D ChildObject->DataSize + 1; > + Object->Data =3D AllocatePool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for %a\n"= , > __func__, Name)); > + goto Done; > + } > + > + MethodFlags =3D NumArgs & 0x07; > + if (SerializeRule) { > + MethodFlags |=3D BIT3; > + } > + > + MethodFlags |=3D (SyncLevel & 0x0F) << 4; > + Object->Data[0] =3D MethodFlags; > + CopyMem ( > + &Object->Data[1], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + // Required NameString completed in one phase call > + > + // Close required PkgLength before finishing Object > + Status =3D AmlPkgLength (AmlClose, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Close PkgLength for %a object\n= ", > __func__, Name)); > + goto Done; > + } > + > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, "Method", > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Locate %a object\n", __func__, > Name)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a child data collection.\n", > __func__, Name)); > + goto Done; > + } > + > + // Method Op is one byte > + Object->DataSize =3D ChildObject->DataSize + 1; > + Object->Data =3D AllocatePool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for %a\n"= , > __func__, Name)); > + goto Done; > + } > + > + Object->Data[0] =3D AML_METHOD_OP; > + CopyMem ( > + &Object->Data[1], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&ChildObject, ListHead); > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlNames > paceModifierObjects.c > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlNames > paceModifierObjects.c > new file mode 100644 > index 0000000000..afe51cdcf2 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlNames > paceModifierObjects.c > @@ -0,0 +1,360 @@ > +/** @file > + > + Copyright (C) 2020-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "LocalAmlLib.h" > +#include > + > +#define FILECODE > LIBRARY_DXEAMLGENERATIONLIB_AMLNAMESPACEMODIFIEROBJECTS_FILEC > ODE > + > +/** > + Creates a Scope (ObjectName, Object) > + > + Object must be created between AmlStart and AmlClose Phase > + > + DefScope :=3D ScopeOp PkgLength NameString TermList > + ScopeOp :=3D 0x10 > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] String - Location > + @param[in,out] ListHead - Linked list has completed String Object af= ter > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlScope ( > + IN AML_FUNCTION_PHASE Phase, > + IN CHAR8 *String, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + > + if ((Phase >=3D AmlInvalid) || (String =3D=3D NULL) || (ListHead =3D= =3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + switch (Phase) { > + case AmlStart: > + Status =3D InternalAppendNewAmlObject (&Object, String, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start %a object\n", __func__, > String)); > + goto Done; > + } > + > + // Start required PkgLength > + Status =3D AmlPkgLength (AmlStart, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start PkgLength for %a object\n= ", > __func__, String)); > + goto Done; > + } > + > + // Insert required NameString > + Status =3D AmlOPNameString (String, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Insert NameString for %a > object\n", __func__, String)); > + goto Done; > + } > + > + // TermList is too complicated and must be added outside > + break; > + > + case AmlClose: > + // TermList should be closed already > + > + // Close required PkgLength before finishing Object > + Status =3D AmlPkgLength (AmlClose, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Close PkgLength for %a object\n= ", > __func__, String)); > + goto Done; > + } > + > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, String, L= istHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Locate %a object\n", __func__, > String)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a has no child data.\n", __fun= c__, > String)); > + goto Done; > + } > + > + // Scope Op is one byte > + Object->DataSize =3D ChildObject->DataSize + 1; > + Object->Data =3D AllocatePool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for %a\n"= , > __func__, String)); > + goto Done; > + } > + > + Object->Data[0] =3D AML_SCOPE_OP; > + CopyMem (&Object->Data[1], ChildObject->Data, ChildObject->DataSiz= e); > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + InternalFreeAmlObject (&ChildObject, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates a Name (ObjectName, Object) > + > + Object must be created between AmlStart and AmlClose Phase > + > + DefName :=3D NameOp NameString ChildObjectData > + NameOp :=3D 0x08 > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] String - Object name > + @param[in,out] ListHead - Linked list has completed String Object af= ter > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlName ( > + IN AML_FUNCTION_PHASE Phase, > + IN CHAR8 *String, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + > + if ((Phase >=3D AmlInvalid) || (String =3D=3D NULL) || (ListHead =3D= =3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + switch (Phase) { > + case AmlStart: > + Status =3D InternalAppendNewAmlObject (&Object, String, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start %a object\n", __func__, > String)); > + goto Done; > + } > + > + // Insert required NameString > + Status =3D AmlOPNameString (String, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start NameString for %a object\= n", > __func__, String)); > + goto Done; > + } > + > + break; > + case AmlClose: > + // DataRefObject should be closed already > + > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, String, L= istHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Locate %a object\n", __func__, > String)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a has no child data.\n", __fun= c__, > String)); > + goto Done; > + } > + > + Object->Data =3D AllocatePool (ChildObject->DataSize + 1); > + // Name Op is one byte > + Object->DataSize =3D ChildObject->DataSize + 1; > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for %a\n"= , > __func__, String)); > + goto Done; > + } > + > + Object->Data[0] =3D AML_NAME_OP; > + CopyMem ( > + &Object->Data[1], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + InternalFreeAmlObject (&ChildObject, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates an Alias (SourceObject, AliasObject) > + > + DefAlias :=3D AliasOp NameString NameString > + AliasOp :=3D 0x06 > + > + @param[in] SourceName - Any named Source Object NameString > + @param[in] AliasName - Alias Object NameString > + @param[in,out] ListHead - Linked list has completed the Alias Objec= t > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPAlias ( > + IN CHAR8 *SourceName, > + IN CHAR8 *AliasName, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + > + if ((SourceName =3D=3D NULL) || (AliasName =3D=3D NULL) || (ListHead = =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + // Start ALIAS object > + Status =3D InternalAppendNewAmlObject (&Object, "ALIAS", ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Cannot append ALIAS object\n", > __func__)); > + goto Done; > + } > + > + // Insert required Object (to be aliased) NameString > + Status =3D AmlOPNameString (SourceName, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Cannot create NameString: %a \n", > __func__, SourceName)); > + goto Done; > + } > + > + // Insert required Alias NameString > + Status =3D AmlOPNameString (AliasName, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Cannot create NameString: %a \n", > __func__, AliasName)); > + goto Done; > + } > + > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, "ALIAS", List= Head); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Cannot locate ALIAS object\n", > __func__)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a has no child data.\n", __func__, > SourceName)); > + goto Done; > + } > + > + Object->Data =3D AllocateZeroPool (ChildObject->DataSize + 1); > + // Alias Op is one byte > + Object->DataSize =3D ChildObject->DataSize + 1; > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for %a\n", > __func__, SourceName)); > + goto Done; > + } > + > + Object->Data[0] =3D AML_ALIAS_OP; > + CopyMem ( > + &Object->Data[1], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + Status =3D EFI_SUCCESS; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + InternalFreeAmlObject (&ChildObject, ListHead); > + } > + > + return Status; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlObjects > Debug.c > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlObject > sDebug.c > new file mode 100644 > index 0000000000..279bfc782d > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlObject > sDebug.c > @@ -0,0 +1,144 @@ > +/** @file > + > + Copyright (C) 2020-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "LocalAmlLib.h" > +#include > + > +#define FILECODE > LIBRARY_DXEAMLGENERATIONLIB_AMLOBJECTSDEBUG_FILECODE > + > +/** > + DEBUG print a (VOID *)buffer in an array of HEX bytes > + > + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F > + 0000 54 48 49 53 20 49 53 20 41 20 53 41 4D 50 4C 45 THIS IS A SAMPLE > + 0010 5F 42 55 46 46 45 52 01 02 5E 5C 30 31 _BUFFER..^\01 > + > + @param[in] Buffer - Buffer containing buffer > + @param[in] BufferSize - Number of bytes to print > + > + @retval EFI_SUCCESS > +**/ > +EFI_STATUS > +EFIAPI > +AmlDebugPrintBuffer ( > + IN VOID *Buffer, > + IN UINTN BufferSize > + ) > +{ > + UINTN Column; > + UINTN Index; > + UINTN NumberOfColumns; > + UINT8 *Data; > + > + Data =3D Buffer; > + NumberOfColumns =3D 16; > + // Header > + DEBUG ((DEBUG_VERBOSE, " 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0= D > 0E 0F\n")); > + for (Index =3D 0; Index < BufferSize;) { > + // Row Counter > + DEBUG ((DEBUG_VERBOSE, "%4X ", Index)); > + > + // Hex ouput > + for (Column =3D 0; Column < NumberOfColumns; Column++) { > + if (Index + Column < BufferSize) { > + DEBUG ((DEBUG_VERBOSE, " %02X", Data[Index + Column])); > + } else { > + DEBUG ((DEBUG_VERBOSE, " ")); > + } > + } > + > + DEBUG ((DEBUG_VERBOSE, " ")); > + // Ascii ouput > + for (Column =3D 0; Column < NumberOfColumns; Column++) { > + if (Index + Column < BufferSize) { > + // Only print ACPI acceptable characters > + if (((Data[Index + Column] >=3D 0x30) && // '0' - '9' > + (Data[Index + Column] <=3D 0x39)) || > + ((Data[Index + Column] >=3D 0x41) && // 'A' - 'Z' > + (Data[Index + Column] <=3D 0x5A)) || > + (Data[Index + Column] =3D=3D 0x5C) || // '\' > + (Data[Index + Column] =3D=3D 0x5F) || // '_' > + (Data[Index + Column] =3D=3D 0x5E) // '^' > + ) > + { > + DEBUG ((DEBUG_VERBOSE, "%c", Data[Index + Column])); > + } else { > + DEBUG ((DEBUG_VERBOSE, ".")); > + } > + } > + } > + > + Index +=3D NumberOfColumns; > + DEBUG ((DEBUG_VERBOSE, "\n")); > + } > + > + return EFI_SUCCESS; > +} > + > +/** > + DEBUG print an AML Object including an array of HEX bytes for the data > + > + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F > + 0000 54 48 49 53 20 49 53 20 41 20 53 41 4D 50 4C 45 THIS IS A SAMPLE > + 0010 5F 42 55 46 46 45 52 01 02 5E 5C 30 31 _BUFFER..^\01 > + Completed=3D(TRUE|FALSE) > + > + @param[in] Object - AML_OBJECT_INSTANCE > + > + @retval EFI_SUCCESS, EFI_INVALID_PARAMETER > +**/ > +EFI_STATUS > +EFIAPI > +AmlDebugPrintObject ( > + IN AML_OBJECT_INSTANCE *Object > + ) > +{ > + if ((Object =3D=3D NULL) || (Object->Signature !=3D > AML_OBJECT_INSTANCE_SIGNATURE)) { > + return EFI_INVALID_PARAMETER; > + } > + > + DEBUG (( > + DEBUG_VERBOSE, > + "Object=3D0x%X, Size=3D0x%d\n", > + (UINTN)Object, > + Object->DataSize > + )); > + AmlDebugPrintBuffer (Object->Data, Object->DataSize); > + DEBUG ((DEBUG_VERBOSE, "Completed=3D%a\n", Object->Completed ? > "TRUE" : "FALSE")); > + DEBUG ((DEBUG_VERBOSE, "\n")); > + return EFI_SUCCESS; > +} > + > +/** > + DEBUG print a linked list of AML buffer Objects in an array of HEX byt= es > + > + @param[in] ListHead - Head of AML_OBJECT_INSTANCE Linked List > +**/ > +EFI_STATUS > +EFIAPI > +AmlDebugPrintLinkedObjects ( > + IN LIST_ENTRY *ListHead > + ) > +{ > + LIST_ENTRY *Node; > + AML_OBJECT_INSTANCE *Object; > + > + if (ListHead =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + DEBUG ((DEBUG_VERBOSE, "Printing AML_OBJECT_INSTANCE Linked > List\n")); > + Node =3D GetNextNode (ListHead, ListHead); > + while (Node !=3D ListHead) { > + Object =3D AML_OBJECT_INSTANCE_FROM_LINK (Node); > + AmlDebugPrintObject (Object); > + Node =3D GetNextNode (ListHead, Node); > + } > + > + return EFI_SUCCESS; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlPkgLen > gth.c > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlPkgLen > gth.c > new file mode 100644 > index 0000000000..85d184b759 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlPkgLen > gth.c > @@ -0,0 +1,267 @@ > +/** @file > + > + Copyright (C) 2020-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "LocalAmlLib.h" > +#include > + > +#define FILECODE > LIBRARY_DXEAMLGENERATIONLIB_AMLPKGLENGTH_FILECODE > + > +#define MAX_ONE_BYTE_PKG_LENGTH 63 > +#define ONE_BYTE_PKG_LENGTH_ENCODING 0x00 > +#define ONE_BYTE_NIBBLE_MASK 0x3F > + > +#define MAX_TWO_BYTE_PKG_LENGTH 4095 > +#define TWO_BYTE_PKG_LENGTH_ENCODING 0x40 > +#define PKG_LENGTH_NIBBLE_MASK 0x0F > + > +#define MAX_THREE_BYTE_PKG_LENGTH 1048575 > +#define THREE_BYTE_PKG_LENGTH_ENCODING 0x80 > + > +#define MAX_FOUR_BYTE_PKG_LENGTH 268435455 > +#define FOUR_BYTE_PKG_LENGTH_ENCODING 0xC0 > + > +/** > + Creates a Package Length encoding and places it in the return buffer, > + PkgLengthEncoding. Similar to AmlPkgLength but the PkgLength does not > + include the length of its own encoding. > + > + @param[in] DataSize - The size of data to be encoded as a pkglength > + @param[out] PkgLengthEncoding - Return buffer containing the AML > encoding > + @param[out] ReturnDataLength - Size of the return buffer > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > + **/ > +EFI_STATUS > +EFIAPI > +InternalAmlBitPkgLength ( > + IN UINT32 DataSize, > + OUT UINT8 **PkgLengthEncoding, > + OUT UINTN *ReturnDataLength > + ) > +{ > + UINTN DataLength; > + UINT8 PkgLeadByte; > + UINTN PkgLengthRemainder; > + EFI_STATUS Status; > + > + Status =3D EFI_INVALID_PARAMETER; > + DataLength =3D 0; > + // Calculate Length of PkgLength Data and fill out least > + // significant nibble > + if ((DataSize + 1) <=3D MAX_ONE_BYTE_PKG_LENGTH) { > + DataLength =3D 1; > + PkgLeadByte =3D ONE_BYTE_PKG_LENGTH_ENCODING; > + PkgLeadByte |=3D ((DataSize) & ONE_BYTE_NIBBLE_MASK); > + } else { > + if ((DataSize + 2) <=3D MAX_TWO_BYTE_PKG_LENGTH) { > + DataLength =3D 2; > + PkgLeadByte =3D TWO_BYTE_PKG_LENGTH_ENCODING; > + } else if ((DataSize + 3) <=3D MAX_THREE_BYTE_PKG_LENGTH) { > + DataLength =3D 3; > + PkgLeadByte =3D THREE_BYTE_PKG_LENGTH_ENCODING; > + } else if ((DataSize + 4) <=3D MAX_FOUR_BYTE_PKG_LENGTH) { > + DataLength =3D 4; > + PkgLeadByte =3D FOUR_BYTE_PKG_LENGTH_ENCODING; > + } else { > + Status =3D EFI_INVALID_PARAMETER; > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: PkgLength data size > 0x%X\n", > + __func__, > + MAX_FOUR_BYTE_PKG_LENGTH - 4 > + )); > + goto Done; > + } > + > + PkgLeadByte |=3D ((DataSize) & PKG_LENGTH_NIBBLE_MASK); > + } > + > + // Allocate new data buffer > + // DataSize =3D DataLength + DataSize; > + *PkgLengthEncoding =3D AllocatePool (DataLength); > + if (*PkgLengthEncoding =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocation failed > Object=3DPkgLength\n", __func__)); > + goto Done; > + } > + > + // Populate PkgLeadByte > + *PkgLengthEncoding[0] =3D PkgLeadByte; > + > + // Populate remainder of PkgLength bytes > + PkgLengthRemainder =3D (DataSize) >> 4; > + if (PkgLengthRemainder !=3D 0) { > + CopyMem (&PkgLengthEncoding[0][1], &PkgLengthRemainder, > DataLength - 1); > + } > + > + *ReturnDataLength =3D DataLength; > + > +Done: > + return Status; > +} > + > +/** > + Creates a Package Length AML Object and inserts it into the linked lis= t > + > + PkgLength :=3D PkgLeadByte | > + | > + | > + > + > + PkgLeadByte :=3D > + > + > + > + Note: The high 2 bits of the first byte reveal how many follow bytes a= re in > + the PkgLength. If the PkgLength has only one byte, bit 0 through 5 are= used > + to encode the package length (in other words, values 0-63). If the pac= kage > + length value is more than 63, more than one byte must be used for the > encoding > + in which case bit 4 and 5 of the PkgLeadByte are reserved and must be = zero. > + > + If the multiple bytes encoding is used, bits 0-3 of the PkgLeadByte be= come > + the least significant 4 bits of the resulting package length value. Th= e next > + ByteData will become the next least significant 8 bits of the resultin= g value > + and so on, up to 3 ByteData bytes. Thus, the maximum package length is > 2**28. > + > + @param[in] Phase - Example: AmlStart, AmlClose > + @param[in,out] ListHead - Head of Linked List of all AML Objects > + > + @return EFI_SUCCESS - Success > + @return all others - Fail > + **/ > +EFI_STATUS > +EFIAPI > +AmlPkgLength ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + UINTN DataLength; > + UINT8 PkgLeadByte; > + UINTN PkgLengthRemainder; > + > + if ((Phase >=3D AmlInvalid) || (ListHead =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + switch (Phase) { > + case AmlStart: > + Status =3D InternalAppendNewAmlObject (&Object, "LENGTH", ListHead= ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start Length object\n", __func_= _)); > + goto Done; > + } > + > + break; > + case AmlClose: > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, "LENGTH", > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: locate Length object\n", > __func__)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a has no child data.\n", __fun= c__, > "Length")); > + goto Done; > + } > + > + DataLength =3D 0; > + // Calculate Length of PkgLength Data and fill out least > + // significant nibble > + if ((ChildObject->DataSize + 1) <=3D MAX_ONE_BYTE_PKG_LENGTH) { > + DataLength =3D 1; > + PkgLeadByte =3D ONE_BYTE_PKG_LENGTH_ENCODING; > + PkgLeadByte |=3D ((ChildObject->DataSize + DataLength) & > ONE_BYTE_NIBBLE_MASK); > + } else { > + if ((ChildObject->DataSize + 2) <=3D MAX_TWO_BYTE_PKG_LENGTH) { > + DataLength =3D 2; > + PkgLeadByte =3D TWO_BYTE_PKG_LENGTH_ENCODING; > + } else if ((ChildObject->DataSize + 3) <=3D MAX_THREE_BYTE_PKG_L= ENGTH) > { > + DataLength =3D 3; > + PkgLeadByte =3D THREE_BYTE_PKG_LENGTH_ENCODING; > + } else if ((ChildObject->DataSize + 4) <=3D MAX_FOUR_BYTE_PKG_LE= NGTH) > { > + DataLength =3D 4; > + PkgLeadByte =3D FOUR_BYTE_PKG_LENGTH_ENCODING; > + } else { > + Status =3D EFI_DEVICE_ERROR; > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: PkgLength data size > 0x%X\n", > + __func__, > + MAX_FOUR_BYTE_PKG_LENGTH - 4 > + )); > + goto Done; > + } > + > + PkgLeadByte |=3D ((ChildObject->DataSize + DataLength) & > PKG_LENGTH_NIBBLE_MASK); > + } > + > + // Allocate new data buffer > + Object->DataSize =3D DataLength + ChildObject->DataSize; > + Object->Data =3D AllocatePool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocation failed > Object=3DPkgLength\n", __func__)); > + goto Done; > + } > + > + // Populate PkgLeadByte > + Object->Data[0] =3D PkgLeadByte; > + > + // Populate remainder of PkgLength bytes > + PkgLengthRemainder =3D (ChildObject->DataSize + DataLength) >> 4; > + if (PkgLengthRemainder !=3D 0) { > + CopyMem (&Object->Data[1], &PkgLengthRemainder, DataLength - 1); > + } > + > + CopyMem ( > + &Object->Data[DataLength], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + InternalFreeAmlObject (&ChildObject, ListHead); > + } > + > + return Status; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlResour > ceDescriptor.c > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlResour > ceDescriptor.c > new file mode 100644 > index 0000000000..4ef746327b > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlResour > ceDescriptor.c > @@ -0,0 +1,1989 @@ > +/** @file > + > + Copyright (C) 2020-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "LocalAmlLib.h" > +#include > + > +#define FILECODE > LIBRARY_DXEAMLGENERATIONLIB_AMLRESOURCEDESCRIPTOR_FILECODE > + > +/** > + ResourceTemplate (Resource To Buffer Conversion Macro) > + > + Syntax: > + ResourceTemplate () {ResourceMacroList} =3D> Buffer > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed ResourceTemplate > Object > + after AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlResourceTemplate ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + EFI_ACPI_END_TAG_DESCRIPTOR *EndTag; > + > + if ((Phase >=3D AmlInvalid) || (ListHead =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + switch (Phase) { > + case AmlStart: > + Status =3D AmlBuffer (AmlStart, 0, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start %a object\n", __func__, > "ResourceTemplate")); > + goto Done; > + } > + > + // Start EndTag object to be completed in Close > + // ACPI 6.3: 6.4.2.9 End Tag: ...The End Tag is automatically gene= rated by > + // the ASL compiler at the end of the ResourceTemplate statement. > + Status =3D InternalAppendNewAmlObject (&Object, "END_TAG", ListHea= d); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start %a object\n", __func__, > "END_TAG")); > + goto Done; > + } > + > + // ResourceMacroList is too complicated and must be added outside > + break; > + case AmlClose: > + // ResourceMacroList should be closed already > + > + // Locate and complete End Tag > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, "END_TAG"= , > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Locate %a object\n", __func__, > "END_TAG")); > + goto Done; > + } > + > + // Release Object->Data Identifier > + InternalFreeAmlObjectData (Object); > + > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: collecting Child data\n", > __func__)); > + goto Done; > + } > + > + Object->DataSize =3D ChildObject->DataSize + sizeof > (EFI_ACPI_END_TAG_DESCRIPTOR); > + Object->Data =3D AllocateZeroPool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: EndTag Alloc Failed\n", __func_= _)); > + Status =3D EFI_OUT_OF_RESOURCES; > + goto Done; > + } > + > + // ChildObject Data goes before End Tag > + if ((ChildObject->Data !=3D NULL) && (ChildObject->DataSize > 0)) = { > + CopyMem (Object->Data, ChildObject->Data, ChildObject->DataSize)= ; > + } > + > + EndTag =3D (EFI_ACPI_END_TAG_DESCRIPTOR *)&Object- > >Data[ChildObject->DataSize]; > + EndTag->Desc =3D ACPI_END_TAG_DESCRIPTOR; > + // Spec says the byte is a checksum, but I have never seen a value= other > + // than zero in the field compiled from ASL. > + // EndTag->Checksum already =3D 0; > + > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + > + Status =3D AmlBuffer (AmlClose, 0, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Close %a object\n", __func__, > "ResourceTemplate")); > + goto Done; > + } > + > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + InternalAmlAddressSpaceCheck > + > + Checks Address space parameters for Word, DWord, or QWord size > Address space > + Descriptor. Size will be constrained by the Resource Descriptor input > + parameters being of the correct size. > + > + @param[in] IsMinFixed > + @param[in] IsMaxFixed > + @param[in] AddressGranularity > + @param[in] AddressMinimum > + @param[in] AddressMaximum > + @param[in] RangeLength > + > +**/ > +EFI_STATUS > +EFIAPI > +InternalAmlAddressSpaceCheck ( > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT64 AddressGranularity, > + IN UINT64 AddressMinimum, > + IN UINT64 AddressMaximum, > + IN UINT64 RangeLength > + ) > +{ > + // Max must be greater than Min > + if (AddressMaximum < AddressMinimum) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: AddressMinimum greater than > AddressMaximum\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + // Address Granularity must be (2^n)-1 > + if (((AddressGranularity + 1) & AddressGranularity) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: AddressGranularity must be (a > power of 2)-1\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + if (RangeLength =3D=3D 0) { > + // LEN _MIF _MAF Definition > + // 0 0 0 > + // 0 0 1 > + // 0 1 0 > + // Variable size, variable location resource descriptor for= _PRS. > + // If _MIF is set, _MIN must be a multiple of (_GRA+1). If = _MAF > + // is set, _MAX must be (a multiple of (_GRA+1))-1. > + // OS can pick the resource range that satisfies following = conditions: > + // If _MIF is not set, start address is a multiple of (_GRA= +1) > + // and greater or equal to _MIN. Otherwise, start address= is _MIN. > + // If _MAF is not set, end address is (a multiple of (_GRA+= 1))-1 > + // and less or equal to _MAX. Otherwise, end address is _= MAX. > + // 0 1 1 (Invalid combination) > + if ((IsMinFixed =3D=3D EFI_ACPI_GENERAL_FLAG_MIN_IS_FIXED) && > + (IsMaxFixed =3D=3D EFI_ACPI_GENERAL_FLAG_MAX_IS_FIXED)) > + { > + // 0 1 1 (Invalid combination) > + DEBUG ((DEBUG_ERROR, "%a: ERROR: IsMinFixed and IsMaxFixed cannot > both be set\n", __func__)); > + DEBUG ((DEBUG_ERROR, "%a: When RangeLength=3D0x%lX\n", > __func__, RangeLength)); > + return EFI_INVALID_PARAMETER; > + } else if (IsMaxFixed =3D=3D EFI_ACPI_GENERAL_FLAG_MAX_IS_FIXED) { > + // 0 0 1 > + if ((AddressMaximum & AddressGranularity) !=3D AddressGranularity)= { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: (AddressMaximum=3D0x%lX + 1) is > not a multiple of\n", __func__, AddressMaximum)); > + DEBUG ((DEBUG_ERROR, "%a: (AddressGranularity=3D0x%lX + 1= )\n", > __func__, AddressGranularity)); > + DEBUG ((DEBUG_ERROR, "%a: When IsMaxFixed =3D 1\n", __fun= c__)); > + return EFI_INVALID_PARAMETER; > + } > + > + if (AddressMaximum =3D=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: AddressMaximum can not be 0\n", > __func__)); > + DEBUG ((DEBUG_ERROR, "%a: When IsMaxFixed =3D 1\n", __fun= c__)); > + return EFI_INVALID_PARAMETER; > + } > + } else if (IsMinFixed =3D=3D EFI_ACPI_GENERAL_FLAG_MIN_IS_FIXED) { > + // 0 1 0 > + if ((AddressMinimum & AddressGranularity) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: AddressMinimum=3D0x%lX is not a > multiple of\n", __func__, AddressMinimum)); > + DEBUG ((DEBUG_ERROR, "%a: (AddressGranularity=3D0x%lX + 1= )\n", > __func__, AddressGranularity)); > + DEBUG ((DEBUG_ERROR, "%a: When IsMinFixed =3D 1\n", __fun= c__)); > + return EFI_INVALID_PARAMETER; > + } > + } else if ((IsMinFixed =3D=3D EFI_ACPI_GENERAL_FLAG_MIN_IS_NOT_FIXED= ) > && > + (IsMaxFixed =3D=3D EFI_ACPI_GENERAL_FLAG_MAX_IS_NOT_FIXED= ) && > + (AddressMinimum =3D=3D 0) && > + (AddressMaximum =3D=3D 0) && > + (AddressGranularity =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Maximum, Minimum, Granularity all > 0\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + } else { > + // LEN _MIF _MAF Definition > + // >0 0 0 Fixed size, variable location resource descriptor = for _PRS. > + // _LEN must be a multiple of (_GRA+1). > + // OS can pick the resource range that satisfies foll= owing > conditions: > + // Start address is a multiple of (_GRA+1) and greate= r or equal to > _MIN. > + // End address is (start address+_LEN-1) and less or = equal to > _MAX. > + // >0 0 1 (Invalid combination) > + // >0 1 0 (Invalid combination) > + // >0 1 1 Fixed size, fixed location resource descriptor. > + // _GRA must be 0 and _LEN must be (_MAX - _MIN +1). > + if ((IsMinFixed =3D=3D EFI_ACPI_GENERAL_FLAG_MIN_IS_NOT_FIXED) && > + (IsMaxFixed =3D=3D EFI_ACPI_GENERAL_FLAG_MAX_IS_NOT_FIXED)) > + { > + // >0 0 0 > + if ((RangeLength & AddressGranularity) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: RangeLength=3D0x%lX is not a > multiple of\n", __func__, RangeLength)); > + DEBUG ((DEBUG_ERROR, "%a: (AddressGranularity=3D0x%lX + 1= )\n", > __func__, AddressGranularity)); > + DEBUG ((DEBUG_ERROR, "%a: When IsMinFixed =3D 0, IsMaxFix= ed =3D > 0\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } else if (RangeLength > (AddressMaximum - AddressMinimum + 1)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: RangeLength=3D0x%lX > > (AddrRangeMax=3D0x%lX - AddrRangeMin=3D0x%lX + 1)\n", __func__, > RangeLength, AddressMaximum, AddressMinimum)); > + DEBUG ((DEBUG_ERROR, "%a: IsMinFixed =3D 0, IsMaxFixed = =3D 0\n", > __func__, RangeLength)); > + return EFI_INVALID_PARAMETER; > + } > + } else if ((IsMinFixed =3D=3D EFI_ACPI_GENERAL_FLAG_MIN_IS_FIXED) && > + (IsMaxFixed =3D=3D EFI_ACPI_GENERAL_FLAG_MAX_IS_FIXED)) > + { > + // >0 1 1 > + if (AddressGranularity !=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: AddressGranularity=3D0x%lX !=3D= 0\n", > __func__, AddressGranularity)); > + DEBUG ((DEBUG_ERROR, "%a: When RangeLength=3D0x%lX > 0, > IsMinFixed =3D 1, and IsMaxFixed =3D 1\n", __func__, RangeLength)); > + return EFI_INVALID_PARAMETER; > + } else if (RangeLength !=3D (AddressMaximum - AddressMinimum + 1))= { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: RangeLength=3D0x%lX !=3D > (AddrRangeMax=3D0x%lX - AddrRangeMin=3D0x%lX + 1)\n", __func__, > RangeLength, AddressMaximum, AddressMinimum)); > + DEBUG ((DEBUG_ERROR, "%a: IsMinFixed =3D 1, IsMaxFixed = =3D 1\n", > __func__, RangeLength)); > + return EFI_INVALID_PARAMETER; > + } > + } else { > + // >0 0 1 (Invalid combination) > + // >0 1 0 (Invalid combination) > + DEBUG ((DEBUG_ERROR, "%a: ERROR: When RangeLength=3D0x%lX > 0,\n", > __func__, RangeLength)); > + DEBUG ((DEBUG_ERROR, "%a: IsMinFixed and IsMaxFixed must bo= th > be either 1 or 0\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + } > + > + return EFI_SUCCESS; > +} > + > +/* > + Internal function to create DWord Address Space Descriptors > + > + This function only requires a single call and therefore no Phases > + Generates: > + 6.4.3.5.2 DWord Address Space Descriptor > + Type 1, Large Item Value 0x7 > + The DWORD address space descriptor is used to report resource usage in= a > + 32-bit address space (like memory and I/O). > + > + @param[in] ResourceType > + @param[in] ResourceUsage, > + @param[in] Decode, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] TypeSpecificFlags, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed DWordSpace buffe= r > + > + @retval EFI_SUCCESS > + @retval Error status > +*/ > +EFI_STATUS > +EFIAPI > +InternalAmlOPDWordAddressSpace ( > + IN UINT8 ResourceType, > + IN UINT8 ResourceUsage, > + IN UINT8 Decode, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 TypeSpecificFlags, > + IN UINT32 AddressGranularity, > + IN UINT32 AddressMinimum, > + IN UINT32 AddressMaximum, > + IN UINT32 AddressTranslation, > + IN UINT32 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + EFI_ACPI_DWORD_ADDRESS_SPACE_DESCRIPTOR *Descriptor; > + > + // Vaidate General Flags Input > + if ((ResourceUsage & ~EFI_ACPI_GENERAL_FLAG_MASK_USAGE) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Dword Invalid ResourceUsage > Parameter\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + if ((Decode & ~EFI_ACPI_GENERAL_FLAG_MASK_DEC) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Dword Invalid Decode Parameter\n", > __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + if ((IsMinFixed & ~EFI_ACPI_GENERAL_FLAG_MASK_MIF) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Dword Invalid IsMinFixed > Parameter\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + if ((IsMaxFixed & ~EFI_ACPI_GENERAL_FLAG_MASK_MAF) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Dword Invalid IsMaxFixed > Parameter\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D InternalAmlAddressSpaceCheck ( > + IsMinFixed, > + IsMaxFixed, > + AddressGranularity, > + AddressMinimum, > + AddressMaximum, > + RangeLength > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: DWord Address Space Check > FAILED\n", __func__)); > + return Status; > + } > + > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start %a object\n", __func__, > "DWORD_ADDRESS")); > + goto Done; > + } > + > + Object->DataSize =3D sizeof > (EFI_ACPI_DWORD_ADDRESS_SPACE_DESCRIPTOR); > + Object->Data =3D AllocateZeroPool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a Alloc Failed\n", __func__, > "DWORD_ADDRESS")); > + Status =3D EFI_OUT_OF_RESOURCES; > + goto Done; > + } > + > + Descriptor =3D (EFI_ACPI_DWORD_ADDRESS_SPACE_DESCR= IPTOR > *)Object->Data; > + Descriptor->Header.Header.Byte =3D > ACPI_DWORD_ADDRESS_SPACE_DESCRIPTOR; > + Descriptor->Header.Length =3D sizeof > (EFI_ACPI_DWORD_ADDRESS_SPACE_DESCRIPTOR) - > + sizeof (ACPI_LARGE_RESOURCE_HEADER); > + Descriptor->ResType =3D ResourceType; > + Descriptor->GenFlag =3D IsMinFixed | IsMaxFixed | Decode= ; > + Descriptor->SpecificFlag =3D TypeSpecificFlags; > + Descriptor->AddrSpaceGranularity =3D AddressGranularity; > + Descriptor->AddrRangeMin =3D AddressMinimum; > + Descriptor->AddrRangeMax =3D AddressMaximum; > + Descriptor->AddrTranslationOffset =3D AddressTranslation; > + Descriptor->AddrLen =3D RangeLength; > + Object->Completed =3D TRUE; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + 19.6.32 DMA (DMA Resource Descriptor Macro) > + > + This function only requires a single call and therefore no Phases > + Syntax > + DMA (DmaType, IsBusMaster, DmaTransferSize, DescriptorName) > {DmaChannelList} =3D> Buffer (BitMask) > + > + Generates: 6.4.2.2 DMA Descriptor > + > + @param[in] DmaType - DMA channel speed supported > + @param[in] IsBusMaster - Logical device bus master status > + @param[in] DmaTransferSize - DMA transfer type preference (8-bit,= 16- > bit, both) > + @param[in] DmaChannelList - DMA channel mask bits [7:0] (channel= s 0 - > 7), _DMA > + Bit [0] is channel 0, etc. > + // DescriptorName - Optional - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed DWordIO buffer > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPDma ( > + IN EFI_ACPI_DMA_SPEED_TYPE_KEYWORDS DmaType, > + IN EFI_ACPI_DMA_BUS_MASTER_KEYWORDS IsBusMaster, > + IN EFI_ACPI_DMA_TRANSFER_TYPE_KEYWORDS DmaTransferSize, > + IN UINT8 DmaChannelList, > + // DescriptorName - NOT IMPLE= MENTED > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + EFI_ACPI_DMA_DESCRIPTOR *Descriptor; > + > + if ((DmaType & (UINT8) ~EFI_ACPI_DMA_SPEED_TYPE_MASK) !=3D 0) { > + // Invalid DmaType value > + DEBUG ((DEBUG_ERROR, "%a: ERROR: DmaType '%x' is not valid.\n", > __func__, DmaType)); > + return EFI_INVALID_PARAMETER; > + } > + > + if ((IsBusMaster & ~EFI_ACPI_DMA_BUS_MASTER_MASK) !=3D 0) { > + // Invalid IsBusMaster value > + DEBUG ((DEBUG_ERROR, "%a: ERROR: IsBusMaster '%x' is not valid.\n", > __func__, DmaType)); > + return EFI_INVALID_PARAMETER; > + } > + > + if (((DmaTransferSize & ~EFI_ACPI_DMA_TRANSFER_TYPE_MASK) !=3D 0) || > + (DmaTransferSize =3D=3D 0x3)) > + { > + // Invalid DmaTransferSize value > + DEBUG ((DEBUG_ERROR, "%a: ERROR: DmaTransferSize '%x' is not valid.\= n", > __func__, DmaType)); > + return EFI_INVALID_PARAMETER; > + } > + > + if (ListHead =3D=3D NULL) { > + // Invalid > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Invalid parameter, ListHead cannot > =3D=3D NULL.\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a cannot create %a object.", > __func__, "DMA_RESOURCE")); > + goto Done; > + } > + > + Object->DataSize =3D sizeof (EFI_ACPI_DMA_DESCRIPTOR); > + Object->Data =3D AllocateZeroPool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a Alloc Failed\n", __func__, > "DMA_RESOURCE")); > + Status =3D EFI_OUT_OF_RESOURCES; > + goto Done; > + } > + > + Descriptor =3D (EFI_ACPI_DMA_DESCRIPTOR *)Object->Data; > + Descriptor->Header.Byte =3D ACPI_DMA_DESCRIPTOR; > + Descriptor->ChannelMask =3D DmaChannelList; > + // > + // Descriptor->Information bit mask: > + // Bit [7] Reserved (must be 0) > + // Bits [6:5] DMA channel speed supported, _TYP > + // 00 Indicates compatibility mode > + // 01 Indicates Type A DMA as described in the EISA > + // 10 Indicates Type B DMA > + // 11 Indicates Type F > + // Bits [4:3] Ignored > + // Bit [2] Logical device bus master status, _BM > + // 0 Logical device is not a bus master > + // 1 Logical device is a bus master > + // Bits [1:0] DMA transfer type preference, _SIZ > + // 00 8-bit only > + // 01 8- and 16-bit > + // 10 16-bit only > + Descriptor->Information =3D (UINT8)(DmaType + > + IsBusMaster + > + DmaTransferSize); > + Object->Completed =3D TRUE; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + 19.6.35 DWordSpace (DWord Space Resource Descriptor Macro) > + > + This function only requires a single call and therefore no Phases > + Syntax > + DWordSpace (ResourceType, ResourceUsage, Decode, IsMinFixed, > IsMaxFixed, > + TypeSpecificFlags, AddressGranularity, AddressMinimum, > + AddressMaximum, AddressTranslation, RangeLength, > + ResourceSourceIndex, ResourceSource, DescriptorName) > + > + Generates: > + 6.4.3.5.2 DWord Address Space Descriptor > + Type 1, Large Item Value 0x7 > + > + @param[in] ResourceType > + @param[in] ResourceUsage, > + @param[in] Decode, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] TypeSpecificFlags, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed DWordSpace buffe= r > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPDWordSpace ( > + IN UINT8 ResourceType, > + IN UINT8 ResourceUsage, > + IN UINT8 Decode, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 TypeSpecificFlags, > + IN UINT32 AddressGranularity, > + IN UINT32 AddressMinimum, > + IN UINT32 AddressMaximum, > + IN UINT32 AddressTranslation, > + IN UINT32 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + > + // UINT8 ResourceType cannot be > 0xFF, so no need to check top end. > + if (ResourceType < EFI_ACPI_SPACE_RESOURCE_TYPE_MIN) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Invalid ResourceType\n", __func__))= ; > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D InternalAmlOPDWordAddressSpace ( > + ResourceType, > + ResourceUsage, > + Decode, > + IsMinFixed, > + IsMaxFixed, > + TypeSpecificFlags, > + AddressGranularity, > + AddressMinimum, > + AddressMaximum, > + AddressTranslation, > + RangeLength, > + ListHead > + ); > + return Status; > +} > + > +/** > + 19.6.33 DWordIO (DWord IO Resource Descriptor Macro) > + > + This function only requires a single call and therefore no Phases > + Syntax > + DWordIO (ResourceUsage, IsMinFixed, IsMaxFixed, Decode, ISARanges, > + AddressGranularity, AddressMinimum, AddressMaximum, > + AddressTranslation, RangeLength, ResourceSourceIndex, > + ResourceSource, DescriptorName, TranslationType, > + TranslationDensity) > + > + defines for pass in parameters can be found in: > + MdePkg/Include/IndustryStandard/Acpi10.h > + > + @param[in] ResourceUsage, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] Decode, > + @param[in] ISARanges, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + TranslationType - NOT IMPLEMENTED > + TranslationDensity - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed DWordIO buffer > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPDWordIO ( > + IN UINT8 ResourceUsage, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 Decode, > + IN UINT8 ISARanges, > + IN UINT32 AddressGranularity, > + IN UINT32 AddressMinimum, > + IN UINT32 AddressMaximum, > + IN UINT32 AddressTranslation, > + IN UINT32 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + // TranslationType - NOT IMPLEMENTED > + // TranslationDensity - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + > + if (ISARanges =3D=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: ISARanges =3D 0 =3D Reserved\n", > __func__)); > + return EFI_INVALID_PARAMETER; > + } else if (ISARanges > 3) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: ISARanges > 3 are Invalid\n", > __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D InternalAmlOPDWordAddressSpace ( > + ACPI_ADDRESS_SPACE_TYPE_IO, > + ResourceUsage, > + Decode, > + IsMinFixed, > + IsMaxFixed, > + (ISARanges), > + AddressGranularity, > + AddressMinimum, > + AddressMaximum, > + AddressTranslation, > + RangeLength, > + ListHead > + ); > + return Status; > +} > + > +/** > + 19.6.34 DWordMemory (DWord Memory Resource Descriptor Macro) > + > + This function only requires a single call and therefore no Phases > + Syntax > + DWordMemory (ResourceUsage, Decode, IsMinFixed, IsMaxFixed, > Cacheable, > + ReadAndWrite, AddressGranularity, AddressMinimum, > AddressMaximum, > + AddressTranslation, RangeLength, ResourceSourceIndex, > + ResourceSource, DescriptorName, MemoryRangeType, > TranslationType) > + > + defines for pass in parameters can be found in: > + MdePkg/Include/IndustryStandard/Acpi10.h > + > + @param[in] ResourceUsage, > + @param[in] Decode, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] Cacheable, > + @param[in] ReadAndWrite, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + MemoryRangeType - NOT IMPLEMENTED > + TranslationType - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed DWordMemory > buffer > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPDWordMemory ( > + IN UINT8 ResourceUsage, > + IN UINT8 Decode, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 Cacheable, > + IN UINT8 ReadAndWrite, > + IN UINT32 AddressGranularity, > + IN UINT32 AddressMinimum, > + IN UINT32 AddressMaximum, > + IN UINT32 AddressTranslation, > + IN UINT32 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + // MemoryRangeType - NOT IMPLEMENTED > + // TranslationType - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + > + // Validate Type Specific Parameters > + if ((Cacheable & ~EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_MASK_MEM) !=3D > 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Invalid Cacheable Parameter > 0x%X\n", __func__, (Cacheable & > ~EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_MASK_MEM))); > + return EFI_INVALID_PARAMETER; > + } > + > + if ((ReadAndWrite & > ~EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_MASK_RW) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Invalid ReadAndWrite Parameter\n", > __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D InternalAmlOPDWordAddressSpace ( > + ACPI_ADDRESS_SPACE_TYPE_MEM, > + ResourceUsage, > + Decode, > + IsMinFixed, > + IsMaxFixed, > + (Cacheable | ReadAndWrite), > + AddressGranularity, > + AddressMinimum, > + AddressMaximum, > + AddressTranslation, > + RangeLength, > + ListHead > + ); > + return Status; > +} > + > +/* > + Internal function to create QWord Address Space Descriptors > + > + This function only requires a single call and therefore no Phases > + Generates: > + 6.4.3.5.1 QWord Address Space Descriptor > + Type 1, Large Item Value 0xA > + The QWORD address space descriptor is used to report resource usage in= a > + 64-bit address space (like memory and I/O). > + > + @param[in] ResourceType > + @param[in] ResourceUsage, > + @param[in] Decode, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] TypeSpecificFlags, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed QWordSpace buffe= r > + > + @retval EFI_SUCCESS > + @retval Error status > +*/ > +EFI_STATUS > +EFIAPI > +InternalAmlOPQWordAddressSpace ( > + IN UINT8 ResourceType, > + IN UINT8 ResourceUsage, > + IN UINT8 Decode, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 TypeSpecificFlags, > + IN UINT64 AddressGranularity, > + IN UINT64 AddressMinimum, > + IN UINT64 AddressMaximum, > + IN UINT64 AddressTranslation, > + IN UINT64 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR *Descriptor; > + > + // Vaidate General Flags Input > + if ((ResourceUsage & ~EFI_ACPI_GENERAL_FLAG_MASK_USAGE) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Qword Invalid ResourceUsage > Parameter\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + if ((Decode & ~EFI_ACPI_GENERAL_FLAG_MASK_DEC) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Qword Invalid Decode Parameter\n", > __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + if ((IsMinFixed & ~EFI_ACPI_GENERAL_FLAG_MASK_MIF) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Qword Invalid IsMinFixed > Parameter\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + if ((IsMaxFixed & ~EFI_ACPI_GENERAL_FLAG_MASK_MAF) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Qword Invalid IsMaxFixed > Parameter\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D InternalAmlAddressSpaceCheck ( > + IsMinFixed, > + IsMaxFixed, > + AddressGranularity, > + AddressMinimum, > + AddressMaximum, > + RangeLength > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: QWord Address Space Check > FAILED\n", __func__)); > + return Status; > + } > + > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start %a object\n", __func__, > "QWORD_ADDRESS")); > + goto Done; > + } > + > + Object->DataSize =3D sizeof > (EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR); > + Object->Data =3D AllocateZeroPool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a Alloc Failed\n", __func__, > "QWORD_ADDRESS")); > + Status =3D EFI_OUT_OF_RESOURCES; > + goto Done; > + } > + > + Descriptor =3D (EFI_ACPI_QWORD_ADDRESS_SPACE_DESCR= IPTOR > *)Object->Data; > + Descriptor->Header.Header.Byte =3D > ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR; > + Descriptor->Header.Length =3D sizeof > (EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR) - > + sizeof (ACPI_LARGE_RESOURCE_HEADER); > + Descriptor->ResType =3D ResourceType; > + Descriptor->GenFlag =3D IsMinFixed | IsMaxFixed | Decode= ; > + Descriptor->SpecificFlag =3D TypeSpecificFlags; > + Descriptor->AddrSpaceGranularity =3D AddressGranularity; > + Descriptor->AddrRangeMin =3D AddressMinimum; > + Descriptor->AddrRangeMax =3D AddressMaximum; > + Descriptor->AddrTranslationOffset =3D AddressTranslation; > + Descriptor->AddrLen =3D RangeLength; > + Object->Completed =3D TRUE; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + 19.6.65 IRQ (Interrupt Resource Descriptor Macro) > + > + Syntax: > + IRQ (EdgeLevel, ActiveLevel, Shared, DescriptorName) {InterruptList}= =3D> > Buffer > + > + Arguments: > + EdgeLevel: > + Describes whether the interrupt is edge triggered (Edge) or level > triggered > + (Level). The field DescriptorName. _HE is automatically created to= refer > to > + this portion of the resource descriptor, where '1' is Edge and Act= iveHigh > + and '0' is Level and ActiveLow. > + > + ActiveLevel: > + Describes whether the interrupt is active-high (ActiveHigh) or act= ive-low > + (ActiveLow). The field DescriptorName. _LL is automatically create= d to > refer > + to this portion of the resource descriptor, where '1' is Edge and > ActiveHigh > + and '0' is Level and ActiveLow. > + > + Shared: > + Describes whether the interrupt can be shared with other devices > (Shared) or > + not (Exclusive), and whether it is capable of waking the system fr= om a > + low-power idle or system sleep state (SharedAndWake or > ExclusiveAndWake). > + The field DescriptorName. _SHR is automatically created to refer t= o this > portion > + of the resource descriptor, where '1' is Shared and '0' is Exclusi= ve. If > nothing > + is specified, then Exclusive is assumed. > + > + InterruptList: > + IRQ mask bits [15:0] > + Bit[0] represents IRQ0, bit[1] is IRQ1, etc. > + > + DescriptorName: > + Is an optional argument that specifies a name for an integer const= ant that > + will be created in the current scope that contains the offset of t= his > resource > + descriptor within the current resource template buffer. The predef= ined > + descriptor field names may be appended to this name to access > individual > + fields within the descriptor via the Buffer Field operators. > + > + Description: > + The IRQ macro evaluates to a buffer that contains an IRQ resource > descriptor. > + The format of the IRQ descriptor can be found in "IRQ Descriptor".= The > macro > + produces the three-byte form of the descriptor. The macro is desig= ned to > be > + used inside of a ResourceTemplate. > + > + Generates: 6.4.2.1 IRQ Descriptor > + > + @param[in] EdgeLevel - trigger level supported > + @param[in] ActiveLevel - interrupt polarity > + @param[in] Shared - interrupt exclusivity > + @param[in] InterruptList - IRQ mask bits[7:0], _INT > + Bit [0] represents IRQ0, > + bit[1] is IRQ1, and so on. > + IRQ mask bits[15:8], _INT > + Bit [0] represents IRQ8, > + bit[1] is IRQ9, and so on. > + // DescriptorName - Optional - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed IRQ buffer > + > + @retval EFI_SUCCESS > + @retval Error status > + > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPIRQ ( > + IN EFI_ACPI_IRQ_INTERRUPT_MODE_KEYWORDS EdgeLevel, > + IN EFI_ACPI_IRQ_INTERRUPT_POLARITY_KEYWORDS ActiveLevel, > + IN EFI_ACPI_IRQ_INTERRUPT_SHARING_KEYWORDS Shared, > + IN UINT16 InterruptList, > + // DescriptorName - NOT= IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + EFI_ACPI_IRQ_DESCRIPTOR *Descriptor; > + > + if ((EdgeLevel & (UINT8) ~EFI_ACPI_IRQ_MODE_MASK) !=3D 0) { > + // Invalid Decode value > + DEBUG ((DEBUG_ERROR, "%a: ERROR: EdgeLevel '%x' is not valid.\n", > __func__, EdgeLevel)); > + return EFI_INVALID_PARAMETER; > + } > + > + if ((ActiveLevel & (UINT8) ~EFI_ACPI_IRQ_POLARITY_MASK) !=3D 0) { > + // Invalid Decode value > + DEBUG ((DEBUG_ERROR, "%a: ERROR: ActiveLevel '%x' is not valid.\n", > __func__, ActiveLevel)); > + return EFI_INVALID_PARAMETER; > + } > + > + if ((Shared & (UINT8) ~(EFI_ACPI_IRQ_WAKE_CAPABLE_MASK | > EFI_ACPI_IRQ_SHARABLE_MASK)) !=3D 0) { > + // Invalid Decode value > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Shared '%x' is not valid.\n", > __func__, Shared)); > + return EFI_INVALID_PARAMETER; > + } > + > + if (ListHead =3D=3D NULL) { > + // Invalid > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Invalid parameter, ListHead cannot > =3D=3D NULL.\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Cannot create %a object.", __func__= , > "IRQ_RESOURCE")); > + goto Done; > + } > + > + Object->DataSize =3D sizeof (EFI_ACPI_IRQ_DESCRIPTOR); > + Object->Data =3D AllocateZeroPool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Alloc for %a failed\n", __func__, > "IRQ_RESOURCE")); > + Status =3D EFI_OUT_OF_RESOURCES; > + goto Done; > + } > + > + Descriptor =3D (EFI_ACPI_IRQ_DESCRIPTOR *)Object->Data; > + Descriptor->Header.Byte =3D ACPI_IRQ_DESCRIPTOR; > + Descriptor->Mask =3D InterruptList; > + // > + // Ref 6.4.2.1 IRQ Descriptor - IRQ Information > + // Descriptor->Information bit mask: > + // IRQ Information. Each bit, when set, indicates this device is capa= ble of > + // driving a certain type of interrupt. (Optional-if not included th= en assume > + // edge sensitive, high true interrupts.) These bits can be used both= for > + // reporting and setting IRQ resources. > + // Note: This descriptor is meant for describing interrupts that are > connected > + // to PIC-compatible interrupt controllers, which can only be progr= ammed > + // for Active-High-Edge-Triggered or Active-Low-LevelTriggered > interrupts. > + // Any other combination is invalid. The Extended Interrupt Descrip= tor > can > + // be used to describe other combinations. > + // > + // Bit [7:6] Reserved (must be 0) > + // Bit [5] Wake Capability, _WKC > + // 0x0 =3D Not Wake Capable: This interrupt is not capable of waking= the > system. > + // 0x1 =3D Wake Capable: This interrupt is capable of waking the sys= tem > from a > + // low-power idle state or a system sleep state. > + // Bit [4] Interrupt Sharing, _SHR > + // 0x0 =3D Exclusive: This interrupt is not shared with other device= s. > + // 0x1 =3D Shared: This interrupt is shared with other devices. > + // Bit [3] Interrupt Polarity, _LL > + // 0 Active-High - This interrupt is sampled when the signal is high= , or true > + // 1 Active-Low - This interrupt is sampled when the signal is low, = or false. > + // Bit [2:1] Ignored > + // Bit [0] Interrupt Mode, _HE > + // 0 Level-Triggered - Interrupt is triggered in response to signal = in a low > state. > + // 1 Edge-Triggered - Interrupt is triggered in response to a change= in > signal state from > + // low to high. > + // > + Descriptor->Information =3D (UINT8)((EFI_ACPI_IRQ_WAKE_CAPABLE_MASK > | > + EFI_ACPI_IRQ_SHARABLE_MASK | > + EFI_ACPI_IRQ_POLARITY_MASK | > + EFI_ACPI_IRQ_MODE_MASK) & > + (Shared | > + ActiveLevel | > + EdgeLevel)); > + Object->Completed =3D TRUE; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + 19.6.64 IO (IO Resource Descriptor Macro) > + > + Syntax: > + IO (Decode, AddressMin, AddressMax, AddressAlignment, RangeLength, > DescriptorName) =3D> Buffer > + > + Arguments: > + Decode: > + Describes whether the I/O range uses 10-bit decode (Decode10) or 1= 6- > bit > + decode (Decode16). The field DescriptorName. _DEC is automaticall= y > created > + to refer to this portion of the resource descriptor, where '1' is = Decode16 > + and '0' is Decode10. > + > + AddressMin: > + Evaluates to a 16-bit integer that specifies the minimum acceptabl= e > starting > + address for the I/O range. It must be an even multiple of > AddressAlignment. > + The field DescriptorName._MIN is automatically created to refer to= this > + portion of the resource descriptor. > + > + AddressMax: > + Evaluates to a 16-bit integer that specifies the maximum acceptabl= e > starting > + address for the I/O range. It must be an even multiple of > AddressAlignment. > + The field DescriptorName._MAX is automatically created to refer to= this > + portion of the resource descriptor. > + > + AddressAlignment: > + Evaluates to an 8-bit integer that specifies the alignment granula= rity > + for the I/O address assigned. The field DescriptorName. _ALN is > automatically > + created to refer to this portion of the resource descriptor. > + > + RangeLength: > + Evaluates to an 8-bit integer that specifies the number of bytes i= n the > + I/O range. The field DescriptorName. _LEN is automatically created= to > refer > + to this portion of the resource descriptor. > + > + DescriptorName: > + An optional argument that specifies a name for an integer constant= that > + will be created in the current scope that contains the offset of t= his > + resource descriptor within the current resource template buffer. T= he > + predefined descriptor field names may be appended to this name to > access > + individual fields within the descriptor via the Buffer Field opera= tors. > + > + Description: > + The IO macro evaluates to a buffer which contains an IO resource > descriptor. > + The format of the IO descriptor can be found in the ACPI Specificati= on > section > + "I/O Port Descriptor". The macro is designed to be used inside of a > ResourceTemplate. > + > + Generates: > + 6.4.2.5 I/O Port Descriptor > + Type 0, Small Item Name 0x8, Length =3D 7 > + > + @param[in] Decode, > + @param[in] AddressMin, > + @param[in] AddressMax, > + @param[in] AddressAlignment, > + @param[in] RangeLength, > + DescriptorName - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed IO buffer > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPIO ( > + IN EFI_ACPI_IO_PORT_DESCRIPTOR_INFORMATION Decode, > + IN UINT16 AddressMin, > + IN UINT16 AddressMax, > + IN UINT8 AddressAlignment, > + IN UINT8 RangeLength, > + // DescriptorName - NOT = IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + EFI_ACPI_IO_PORT_DESCRIPTOR *Descriptor; > + UINT64 Remainder; > + > + if ((Decode & (UINT8) ~EFI_ACPI_IO_DECODE_MASK) !=3D 0) { > + // Invalid Decode value > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Decode '%x' is not valid.\n", > __func__, Decode)); > + return EFI_INVALID_PARAMETER; > + } > + > + if (ListHead =3D=3D NULL) { > + // Invalid > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Invalid parameter, ListHead cannot > =3D=3D NULL.\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + if (AddressAlignment !=3D 0) { > + DivU64x64Remainder (AddressMin, AddressAlignment, &Remainder); > + if (Remainder !=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: (AddressMin=3D0x%X) is not a > multiple of\n", __func__, AddressMin)); > + DEBUG ((DEBUG_ERROR, "%a: (AddressAlignment)=3D0x%X\n", > __func__, AddressAlignment)); > + return EFI_INVALID_PARAMETER; > + } > + > + DivU64x64Remainder (AddressMax, AddressAlignment, &Remainder); > + if (Remainder !=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: (AddressMax=3D0x%X) is not a > multiple of\n", __func__, AddressMax)); > + DEBUG ((DEBUG_ERROR, "%a: (AddressAlignment)=3D0x%X\n", > __func__, AddressAlignment)); > + return EFI_INVALID_PARAMETER; > + } > + } > + > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a cannot create %a object.", > __func__, "IO_RESOURCE")); > + goto Done; > + } > + > + Object->DataSize =3D sizeof (EFI_ACPI_IO_PORT_DESCRIPTOR); > + Object->Data =3D AllocateZeroPool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a Alloc Failed\n", __func__, > "IO_RESOURCE")); > + Status =3D EFI_OUT_OF_RESOURCES; > + goto Done; > + } > + > + Descriptor =3D (EFI_ACPI_IO_PORT_DESCRIPTOR *)Object->Data; > + > + /* > + * According to ACPI spec for > + * ACPI_IO_PORT_DESCRIPTOR =3D 0x47 contains the informaion about > + * Name, Type and Length, hence no need to calculate the length. > + * Below is description from ACPI spec > + * Byte 0 I/O Port Descriptor Value =3D 0x47 (01000111B) - Type =3D 0,= Small > item name =3D > + * 0x8, Length =3D 7 > + */ > + Descriptor->Header.Byte =3D ACPI_IO_PORT_DESCRIPTOR; > + // > + // Descriptor->Information bit mask: > + // Bit [7:1] Reserved, must be 0 > + // Bit [0] (_DEC) > + // 1 The logical device decodes 16-bit addresses > + // 0 The logical device decodes 10-bit addresses > + Descriptor->Information =3D (UINT8)(EFI_ACPI_IO_DECODE_MASK & > Decode); > + Descriptor->BaseAddressMin =3D AddressMin; > + Descriptor->BaseAddressMax =3D AddressMax; > + Descriptor->Alignment =3D AddressAlignment; > + Descriptor->Length =3D RangeLength; > + Object->Completed =3D TRUE; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/* > + 19.6.114 Register (Generic Register Resource Descriptor Macro) > + > + This function only requires a single call and therefore no Phases > + Syntax > + Register (AddressSpaceKeyword, RegisterBitWidth, RegisterBitOffset, > + RegisterAddress, AccessSize, DescriptorName) > + > + Generates: > + 6.4.3.7 Generic Register Descriptor > + Type 1, Large Item Value 0x2 > + The generic register descriptor describes the location of a fixed widt= h > + register within any of the ACPI-defined address spaces. See Generic > Register > + Descriptor for details. > + > + > + @param[in] AddressSpaceKeyword, > + @param[in] RegisterBitWidth, > + @param[in] RegisterBitOffset, > + @param[in] RegisterAddress, > + @param[in] AccessSize, > + DescriptorName - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed QWordSpace buffe= r > + > + @retval EFI_SUCCESS > + @retval Error status > +*/ > +EFI_STATUS > +EFIAPI > +AmlOPRegister ( > + IN GENERIC_ADDRESS_SPACE_ID AddressSpaceKeyword, > + IN UINT8 RegisterBitWidth, > + IN UINT8 RegisterBitOffset, > + IN UINT64 RegisterAddress, > + IN UINT8 AccessSize, > + // DescriptorName - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR *Descriptor; > + > + if ((AddressSpaceKeyword < EFI_ACPI_6_4_SYSTEM_MEMORY) || > + (AddressSpaceKeyword > > EFI_ACPI_6_4_FUNCTIONAL_FIXED_HARDWARE)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Invalid > AddressSpaceKeyword=3D0x%02X\n", __func__, AddressSpaceKeyword)); > + return EFI_INVALID_PARAMETER; > + } > + > + if ((AddressSpaceKeyword > > EFI_ACPI_6_4_PLATFORM_COMMUNICATION_CHANNEL) && > + (AddressSpaceKeyword < > EFI_ACPI_6_4_FUNCTIONAL_FIXED_HARDWARE)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Invalid > AddressSpaceKeyword=3D0x%02X\n", __func__, AddressSpaceKeyword)); > + return EFI_INVALID_PARAMETER; > + } > + > + if (AccessSize > EFI_ACPI_6_4_QWORD) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Invalid AccessSize=3D0x%02X\n", > __func__, AccessSize)); > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a cannot create %a object.", > __func__, "IO_RESOURCE")); > + goto Done; > + } > + > + Object->DataSize =3D sizeof (EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR); > + Object->Data =3D AllocateZeroPool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a Alloc Failed\n", __func__, > "IO_RESOURCE")); > + Status =3D EFI_OUT_OF_RESOURCES; > + goto Done; > + } > + > + Descriptor =3D (EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR *)Object->Data; > + > + Descriptor->Header.Header.Byte =3D ACPI_GENERIC_REGISTER_DESCRIPTOR; > + Descriptor->Header.Length =3D sizeof > (EFI_ACPI_GENERIC_REGISTER_DESCRIPTOR) - > + sizeof (ACPI_LARGE_RESOURCE_HEADER); > + Descriptor->AddressSpaceId =3D AddressSpaceKeyword; > + Descriptor->RegisterBitWidth =3D RegisterBitWidth; > + Descriptor->RegisterBitOffset =3D RegisterBitOffset; > + Descriptor->AddressSize =3D AccessSize; > + Descriptor->RegisterAddress =3D RegisterAddress; > + Object->Completed =3D TRUE; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/* > + 19.6.111 QWordSpace (QWord Space Resource Descriptor Macro) > + > + This function only requires a single call and therefore no Phases > + Syntax > + QWordSpace (ResourceType, ResourceUsage, Decode, IsMinFixed, > IsMaxFixed, > + TypeSpecificFlags, AddressGranularity, AddressMinimum, > + AddressMaximum, AddressTranslation, RangeLength, > + ResourceSourceIndex, ResourceSource, DescriptorName) > + > + Generates: > + 6.4.3.5.1 QWord Address Space Descriptor > + Type 1, Large Item Value 0xA > + The QWORD address space descriptor is used to report resource usage in= a > + 64-bit address space (like memory and I/O). > + > + > + @param[in] ResourceType > + @param[in] ResourceUsage, > + @param[in] Decode, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] TypeSpecificFlags, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed QWordSpace buffe= r > + > + @retval EFI_SUCCESS > + @retval Error status > +*/ > +EFI_STATUS > +EFIAPI > +AmlOPQWordSpace ( > + IN UINT8 ResourceType, > + IN UINT8 ResourceUsage, > + IN UINT8 Decode, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 TypeSpecificFlags, > + IN UINT64 AddressGranularity, > + IN UINT64 AddressMinimum, > + IN UINT64 AddressMaximum, > + IN UINT64 AddressTranslation, > + IN UINT64 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + > + // UINT8 ResourceType cannot be > 0xFF, so no need to check top end. > + if (ResourceType < EFI_ACPI_SPACE_RESOURCE_TYPE_MIN) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Invalid ResourceType\n", __func__))= ; > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D InternalAmlOPQWordAddressSpace ( > + ResourceType, > + ResourceUsage, > + Decode, > + IsMinFixed, > + IsMaxFixed, > + TypeSpecificFlags, > + AddressGranularity, > + AddressMinimum, > + AddressMaximum, > + AddressTranslation, > + RangeLength, > + ListHead > + ); > + return Status; > +} > + > +/** > + 19.6.82 Memory32Fixed (Memory Resource Descriptor Macro) > + > + Syntax: > + Memory32Fixed (ReadAndWrite, AddressBase, RangeLength, > DescriptorName) > + > + Arguments: > + ReadAndWrite: Specifies whether or not the memory region is read-onl= y > (ReadOnly) > + or read/write (ReadWrite). If nothing is specified, then ReadWrite i= s > assumed. > + The 1-bit field DescriptorName._RW is automatically created to refer= to > this > + portion of the resource descriptor, where '1' is ReadWrite and '0' i= s > ReadOnly. > + > + AddressBase: Evaluates to a 32-bit integer that specifies the base a= ddress > + of the memory range. The 32-bit field DescriptorName. _BAS is > automatically > + created to refer to this portion of the resource descriptor. > + > + RangeLength: Evaluates to a 32-bit integer that specifies the total = number > of > + bytes decoded in the memory range. The 32-bit field DescriptorName. > _LEN is > + automatically created to refer to this portion of the resource descr= iptor. > + > + DescriptorName: Is an optional argument that specifies a name for an > integer > + constant that will be created in the current scope that contains the= offset > + of this resource descriptor within the current resource template buf= fer. > The > + predefined descriptor field names may be appended to this name to > access > + individual fields within the descriptor via the Buffer Field operato= rs. > + > + Description: > + The Memory32Fixed macro evaluates to a buffer which contains a 32-bi= t > memory > + descriptor, which describes a fixed range of memory addresses. The > format of > + the fixed 32-bit memory descriptor can be found in 32-Bit Fixed Memo= ry > Range > + Descriptor. The macro is designed to be used inside of a > ResourceTemplate. > + > + Generates: > + 6.4.3.4 32-Bit Fixed Memory Range Descriptor > + Type 1, Large Item Value 0x6 > + This memory range descriptor describes a device's memory resources > within a > + 32-bit address space. > + > + @param[in] ReadAndWrite, > + @param[in] AddressBase, > + @param[in] RangeLength, > + DescriptorName - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed memory resource > descriptor > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPMemory32Fixed ( > + IN READ_WRITE_FLAG ReadAndWrite, > + IN UINT32 AddressBase, > + IN UINT32 RangeLength, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + EFI_ACPI_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR *Descriptor; > + > + if ((ReadAndWrite & (UINT8) > ~EFI_ACPI_MEMORY_WRITE_STATUS_MASK) !=3D 0) { > + // Invalid ReadAndWrite value > + DEBUG ((DEBUG_ERROR, "%a: ERROR: ReadAndWrite '%x' is not valid.\n", > __func__, ReadAndWrite)); > + return EFI_INVALID_PARAMETER; > + } > + > + if (ListHead =3D=3D NULL) { > + // Invalid > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Invalid parameter, ListHead cannot > =3D=3D NULL.\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a cannot create %a object.", > __func__, "MEMORY_32_FIXED_RESOURCE")); > + goto Done; > + } > + > + Object->DataSize =3D sizeof > (EFI_ACPI_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR); > + Object->Data =3D AllocateZeroPool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a Alloc Failed\n", __func__, > "MEMORY_32_FIXED_RESOURCE")); > + Status =3D EFI_OUT_OF_RESOURCES; > + goto Done; > + } > + > + Descriptor =3D > (EFI_ACPI_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR *)Object->Data; > + Descriptor->Header.Header.Byte =3D > ACPI_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR; > + Descriptor->Header.Length =3D sizeof > (EFI_ACPI_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR) - > + sizeof (ACPI_LARGE_RESOURCE_HEADER); > + Descriptor->Information =3D ReadAndWrite; > + Descriptor->BaseAddress =3D AddressBase; > + Descriptor->Length =3D RangeLength; > + Object->Completed =3D TRUE; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + 19.6.109 QWordIO (QWord IO Resource Descriptor Macro) > + > + This function only requires a single call and therefore no Phases > + Syntax > + QWordIO (ResourceUsage, IsMinFixed, IsMaxFixed, Decode, ISARanges, > + AddressGranularity, AddressMinimum, AddressMaximum, > + AddressTranslation, RangeLength, ResourceSourceIndex, > + ResourceSource, DescriptorName, TranslationType, > + TranslationDensity) > + > + defines for pass in parameters can be found in: > + MdePkg/Include/IndustryStandard/Acpi10.h > + > + @param[in] ResourceUsage, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] Decode, > + @param[in] ISARanges, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + TranslationType - NOT IMPLEMENTED > + TranslationDensity - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed QWordIO buffer > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPQWordIO ( > + IN UINT8 ResourceUsage, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 Decode, > + IN UINT8 ISARanges, > + IN UINT64 AddressGranularity, > + IN UINT64 AddressMinimum, > + IN UINT64 AddressMaximum, > + IN UINT64 AddressTranslation, > + IN UINT64 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + // TranslationType - NOT IMPLEMENTED > + // TranslationDensity - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + > + if (ISARanges =3D=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: ISARanges =3D 0 =3D Reserved\n", > __func__)); > + return EFI_INVALID_PARAMETER; > + } else if (ISARanges > 3) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: ISARanges > 3 is Invalid\n", > __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D InternalAmlOPQWordAddressSpace ( > + ACPI_ADDRESS_SPACE_TYPE_IO, > + ResourceUsage, > + Decode, > + IsMinFixed, > + IsMaxFixed, > + (ISARanges), > + AddressGranularity, > + AddressMinimum, > + AddressMaximum, > + AddressTranslation, > + RangeLength, > + ListHead > + ); > + return Status; > +} > + > +/** > + 19.6.110 QWordMemory (QWord Memory Resource Descriptor Macro) > + > + This function only requires a single call and therefore no Phases > + Syntax > + QWordMemory (ResourceUsage, Decode, IsMinFixed, IsMaxFixed, > Cacheable, > + ReadAndWrite, AddressGranularity, AddressMinimum, > AddressMaximum, > + AddressTranslation, RangeLength, ResourceSourceIndex, > + ResourceSource, DescriptorName, MemoryRangeType, > TranslationType) > + > + defines for pass in parameters can be found in: > + MdePkg/Include/IndustryStandard/Acpi10.h > + > + @param[in] ResourceUsage, > + @param[in] Decode, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] Cacheable, > + @param[in] ReadAndWrite, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + MemoryRangeType - NOT IMPLEMENTED > + TranslationType - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed QWordMemory > buffer > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPQWordMemory ( > + IN UINT8 ResourceUsage, > + IN UINT8 Decode, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 Cacheable, > + IN UINT8 ReadAndWrite, > + IN UINT64 AddressGranularity, > + IN UINT64 AddressMinimum, > + IN UINT64 AddressMaximum, > + IN UINT64 AddressTranslation, > + IN UINT64 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + // MemoryRangeType - NOT IMPLEMENTED > + // TranslationType - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + > + // Validate Type Specific Parameters > + if ((Cacheable & ~EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_MASK_MEM) !=3D > 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Invalid Cacheable Parameter > 0x%X\n", __func__, (Cacheable & > ~EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_MASK_MEM))); > + return EFI_INVALID_PARAMETER; > + } > + > + if ((ReadAndWrite & > ~EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_MASK_RW) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Invalid ReadAndWrite Parameter\n", > __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D InternalAmlOPQWordAddressSpace ( > + ACPI_ADDRESS_SPACE_TYPE_MEM, > + ResourceUsage, > + Decode, > + IsMinFixed, > + IsMaxFixed, > + (Cacheable | ReadAndWrite), > + AddressGranularity, > + AddressMinimum, > + AddressMaximum, > + AddressTranslation, > + RangeLength, > + ListHead > + ); > + return Status; > +} > + > +/* > + Internal function to create DWord Address Space Descriptors > + > + This function only requires a single call and therefore no Phases > + Generates: > + 6.4.3.5.3 Word Address Space Descriptor > + Type 1, Large Item Value 0x8 > + The WORD address space descriptor is used to report resource usage in = a > + 16-bit address space (like memory and I/O, Bus Number). > + > + @param[in] ResourceType > + @param[in] ResourceUsage, > + @param[in] Decode, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] TypeSpecificFlags, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed WordSpace > Descriptor > + > + @retval EFI_SUCCESS > + @retval Error status > +*/ > +EFI_STATUS > +EFIAPI > +InternalAmlOPWordAddressSpace ( > + IN UINT8 ResourceType, > + IN UINT8 ResourceUsage, > + IN UINT8 Decode, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 TypeSpecificFlags, > + IN UINT16 AddressGranularity, > + IN UINT16 AddressMinimum, > + IN UINT16 AddressMaximum, > + IN UINT16 AddressTranslation, > + IN UINT16 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + EFI_ACPI_WORD_ADDRESS_SPACE_DESCRIPTOR *Descriptor; > + > + // Vaidate General Flags Input > + if ((ResourceUsage & ~EFI_ACPI_GENERAL_FLAG_MASK_USAGE) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Word Invalid ResourceUsage > Parameter\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + if ((Decode & ~EFI_ACPI_GENERAL_FLAG_MASK_DEC) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Word Invalid Decode Parameter\n", > __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + if ((IsMinFixed & ~EFI_ACPI_GENERAL_FLAG_MASK_MIF) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Word Invalid IsMinFixed > Parameter\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + if ((IsMaxFixed & ~EFI_ACPI_GENERAL_FLAG_MASK_MAF) !=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Word Invalid IsMaxFixed > Parameter\n", __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D InternalAmlAddressSpaceCheck ( > + IsMinFixed, > + IsMaxFixed, > + AddressGranularity, > + AddressMinimum, > + AddressMaximum, > + RangeLength > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Word Address Space Check > FAILED\n", __func__)); > + return Status; > + } > + > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Start %a object\n", __func__, > "WORD_ADDRESS")); > + goto Done; > + } > + > + Object->DataSize =3D sizeof (EFI_ACPI_WORD_ADDRESS_SPACE_DESCRIPTOR); > + Object->Data =3D AllocateZeroPool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a Alloc Failed\n", __func__, > "DWORD_ADDRESS")); > + Status =3D EFI_OUT_OF_RESOURCES; > + goto Done; > + } > + > + Descriptor =3D (EFI_ACPI_WORD_ADDRESS_SPACE_DESCRI= PTOR > *)Object->Data; > + Descriptor->Header.Header.Byte =3D > ACPI_WORD_ADDRESS_SPACE_DESCRIPTOR; > + Descriptor->Header.Length =3D sizeof > (EFI_ACPI_WORD_ADDRESS_SPACE_DESCRIPTOR) - > + sizeof (ACPI_LARGE_RESOURCE_HEADER); > + Descriptor->ResType =3D ResourceType; > + Descriptor->GenFlag =3D IsMinFixed | IsMaxFixed | Decode= ; > + Descriptor->SpecificFlag =3D TypeSpecificFlags; > + Descriptor->AddrSpaceGranularity =3D AddressGranularity; > + Descriptor->AddrRangeMin =3D AddressMinimum; > + Descriptor->AddrRangeMax =3D AddressMaximum; > + Descriptor->AddrTranslationOffset =3D AddressTranslation; > + Descriptor->AddrLen =3D RangeLength; > + Object->Completed =3D TRUE; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + } > + > + return Status; > +} > + > +/** > + 19.6.152 WordSpace (Word Space Resource Descriptor Macro) ) > + > + This function only requires a single call and therefore no Phases > + Syntax > + WordSpace (ResourceType, ResourceUsage, Decode, IsMinFixed, > IsMaxFixed, > + TypeSpecificFlags, AddressGranularity, AddressMinimum, > + AddressMaximum, AddressTranslation, RangeLength, > + ResourceSourceIndex, ResourceSource, DescriptorName) > + > + Generates: > + 6.4.3.5.3 Word Address Space Descriptor > + Type 1, Large Item Value 0x8 > + > + @param[in] ResourceType > + @param[in] ResourceUsage, > + @param[in] Decode, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] TypeSpecificFlags, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed WordSpace > Descriptor > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPWordSpace ( > + IN UINT8 ResourceType, > + IN UINT8 ResourceUsage, > + IN UINT8 Decode, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 TypeSpecificFlags, > + IN UINT16 AddressGranularity, > + IN UINT16 AddressMinimum, > + IN UINT16 AddressMaximum, > + IN UINT16 AddressTranslation, > + IN UINT16 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + > + // UINT8 ResourceType cannot be > 0xFF, so no need to check top end. > + if (ResourceType < EFI_ACPI_SPACE_RESOURCE_TYPE_MIN) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Invalid ResourceType\n", __func__))= ; > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D InternalAmlOPWordAddressSpace ( > + ResourceType, > + ResourceUsage, > + Decode, > + IsMinFixed, > + IsMaxFixed, > + TypeSpecificFlags, > + AddressGranularity, > + AddressMinimum, > + AddressMaximum, > + AddressTranslation, > + RangeLength, > + ListHead > + ); > + return Status; > +} > + > +/** > + 19.6.150 WordBusNumber (Word Bus Number Resource Descriptor Macro) > + > + This function only requires a single call and therefore no Phases > + Syntax > + WordBusNumber (ResourceUsage, IsMinFixed, IsMaxFixed, Decode, > + AddressGranularity, AddressMinimum, AddressMaximum, > + AddressTranslation, RangeLength, ResourceSourceIndex, > + ResourceSource, DescriptorName) > + > + defines for pass in parameters can be found in: > + MdePkg/Include/IndustryStandard/Acpi10.h > + > + @param[in] ResourceUsage, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] Decode, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed WordBusNumber > + Descriptor > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPWordBusNumber ( > + IN UINT8 ResourceUsage, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 Decode, > + IN UINT16 AddressGranularity, > + IN UINT16 AddressMinimum, > + IN UINT16 AddressMaximum, > + IN UINT16 AddressTranslation, > + IN UINT16 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + > + Status =3D InternalAmlOPWordAddressSpace ( > + ACPI_ADDRESS_SPACE_TYPE_BUS, > + ResourceUsage, > + Decode, > + IsMinFixed, > + IsMaxFixed, > + 0, > + AddressGranularity, > + AddressMinimum, > + AddressMaximum, > + AddressTranslation, > + RangeLength, > + ListHead > + ); > + return Status; > +} > + > +/** > + 19.6.151 WordIO (Word IO Resource Descriptor Macro) > + > + This function only requires a single call and therefore no Phases > + Syntax > + WordIO (ResourceUsage, IsMinFixed, IsMaxFixed, Decode, ISARanges, > + AddressGranularity, AddressMinimum, AddressMaximum, > + AddressTranslation, RangeLength, ResourceSourceIndex, > + ResourceSource, DescriptorName, TranslationType, TranslationDe= nsity) > + > + defines for pass in parameters can be found in: > + MdePkg/Include/IndustryStandard/Acpi10.h > + > + @param[in] ResourceUsage, > + @param[in] IsMinFixed, > + @param[in] IsMaxFixed, > + @param[in] Decode, > + @param[in] ISARanges, > + @param[in] AddressGranularity, > + @param[in] AddressMinimum, > + @param[in] AddressMaximum, > + @param[in] AddressTranslation, > + @param[in] RangeLength, > + ResourceSourceIndex - NOT IMPLEMENTED > + ResourceSource - NOT IMPLEMENTED > + DescriptorName - NOT IMPLEMENTED > + TranslationType - NOT IMPLEMENTED > + TranslationDensity - NOT IMPLEMENTED > + @param[in,out] ListHead - Linked list has completed WordIO Descripto= r > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPWordIO ( > + IN UINT8 ResourceUsage, > + IN UINT8 IsMinFixed, > + IN UINT8 IsMaxFixed, > + IN UINT8 Decode, > + IN UINT8 ISARanges, > + IN UINT16 AddressGranularity, > + IN UINT16 AddressMinimum, > + IN UINT16 AddressMaximum, > + IN UINT16 AddressTranslation, > + IN UINT16 RangeLength, > + // ResourceSourceIndex - NOT IMPLEMENTED > + // ResourceSource - NOT IMPLEMENTED > + // DescriptorName - NOT IMPLEMENTED > + // TranslationType - NOT IMPLEMENTED > + // TranslationDensity - NOT IMPLEMENTED > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + > + if (ISARanges =3D=3D 0) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: ISARanges =3D 0 =3D Reserved\n", > __func__)); > + return EFI_INVALID_PARAMETER; > + } else if (ISARanges > 3) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: ISARanges > 3 is Invalid\n", > __func__)); > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D InternalAmlOPWordAddressSpace ( > + ACPI_ADDRESS_SPACE_TYPE_IO, > + ResourceUsage, > + Decode, > + IsMinFixed, > + IsMaxFixed, > + (ISARanges), > + AddressGranularity, > + AddressMinimum, > + AddressMaximum, > + AddressTranslation, > + RangeLength, > + ListHead > + ); > + return Status; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlStatem > entOpcodes.c > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlStatem > entOpcodes.c > new file mode 100644 > index 0000000000..03201d0109 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlStatem > entOpcodes.c > @@ -0,0 +1,515 @@ > +/** @file > + > + Copyright (C) 2020-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "LocalAmlLib.h" > +#include > + > +#define FILECODE > LIBRARY_DXEAMLGENERATIONLIB_AMLSTATEMENTOPCODES_FILECODE > + > +/** > + Creates an Else object > + > + TermList must be created between AmlStart and AmlClose Phase > + > + Since ElseIf (...) is created with Else {( If (){})}. ElseIf will not= be > + supported and must be created with Else and If. > + > + DefElse :=3D Nothing | > + ElseOp :=3D 0xA1 > + > + EXAMPLE: > + AmlIf (AmlStart, ListHead); > + { > + { // Predicate > + AmlOpDataInteger (1, ListHead); > + } // Predicate > + { // TermList > + ... > + } // TermList > + } > + AmlIf (AmlClose, ListHead); > + AmlElse (AmlStart, ListHead); > + { > + AmlIf (AmlStart, ListHead); > + { > + {} // Predicate > + {} // Termlist > + } > + AmlIf (AmlClose, ListHead); > + AmlElse (AmlStart, ListHead); > + {} // TermList > + AmlElse (AmlClose, ListHead); > + } > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed AmlElse Object a= fter > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlElse ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + > + if ((Phase >=3D AmlInvalid) || (ListHead =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + switch (Phase) { > + case AmlStart: > + Status =3D InternalAppendNewAmlObject (&Object, "Else", ListHead); > + > + // Start required PkgLength > + Status =3D AmlPkgLength (AmlStart, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: If PkgLength object\n", __func_= _)); > + goto Done; > + } > + > + // DataRefObject is outside the scope of this object > + break; > + case AmlClose: > + // Close required PkgLength before finishing Object > + Status =3D AmlPkgLength (AmlClose, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: close PkgLength object\n", > __func__)); > + goto Done; > + } > + > + // DataRefObject should be closed already > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, "Else", L= istHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: locating Return Object\n", > __func__)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: collecting Child data\n", > __func__)); > + goto Done; > + } > + > + // Handle Return with no arguments > + if ((ChildObject->Data =3D=3D NULL) || (ChildObject->DataSize =3D= =3D 0)) { > + Status =3D EFI_DEVICE_ERROR; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: If must have at least a > Predicate\n", __func__)); > + goto Done; > + } > + > + // Allocate buffer for Return object > + Object->Data =3D AllocatePool (ChildObject->DataSize + 1); > + Object->DataSize =3D ChildObject->DataSize + 1; > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object=3DReturn\n", > __func__)); > + goto Done; > + } > + > + // Fill out Return object > + Object->Data[0] =3D AML_ELSE_OP; > + CopyMem ( > + &Object->Data[1], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + InternalFreeAmlObject (&ChildObject, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates a If object > + > + Predicate and TermList must be created between AmlStart and AmlClose > Phase > + > + Since ElseIf (...) is created with Else {( If (){})}. ElseIf will not= be > + supported and must be created with Else and If. > + > + DefIfElse :=3D IfOp PkgLength Predicate TermList DefElse > + IfOp :=3D 0xA0 > + Predicate :=3D TermArg =3D> Integer > + > + EXAMPLE: > + AmlIf (AmlStart, ListHead); > + { > + { // Predicate > + AmlOpDataInteger (1, ListHead); > + } // Predicate > + { // TermList > + ... > + } // TermList > + } > + AmlIf (AmlClose, ListHead); > + AmlElse (AmlStart, ListHead); > + { > + AmlIf (AmlStart, ListHead); > + { > + {} // Predicate > + {} // Termlist > + } > + AmlIf (AmlClose, ListHead); > + AmlElse (AmlStart, ListHead); > + {} // TermList > + AmlElse (AmlClose, ListHead); > + } > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed AmlIf Object aft= er > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlIf ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + > + if ((Phase >=3D AmlInvalid) || (ListHead =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + switch (Phase) { > + case AmlStart: > + Status =3D InternalAppendNewAmlObject (&Object, "If", ListHead); > + > + // Start required PkgLength > + Status =3D AmlPkgLength (AmlStart, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: If PkgLength object\n", __func_= _)); > + goto Done; > + } > + > + // DataRefObject is outside the scope of this object > + break; > + case AmlClose: > + // Close required PkgLength before finishing Object > + Status =3D AmlPkgLength (AmlClose, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: close PkgLength object\n", > __func__)); > + goto Done; > + } > + > + // DataRefObject should be closed already > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, "If", Lis= tHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: locating Return Object\n", > __func__)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: collecting Child data\n", > __func__)); > + goto Done; > + } > + > + // Handle Return with no arguments > + if ((ChildObject->Data =3D=3D NULL) || (ChildObject->DataSize =3D= =3D 0)) { > + Status =3D EFI_DEVICE_ERROR; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: If must have at least a > Predicate\n", __func__)); > + goto Done; > + } > + > + // Allocate buffer for Return object > + Object->Data =3D AllocatePool (ChildObject->DataSize + 1); > + Object->DataSize =3D ChildObject->DataSize + 1; > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object=3DReturn\n", > __func__)); > + goto Done; > + } > + > + // Fill out Return object > + Object->Data[0] =3D AML_IF_OP; > + CopyMem ( > + &Object->Data[1], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + InternalFreeAmlObject (&ChildObject, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates a Notify object > + > + DefNotify :=3D NotifyOp NotifyObject NotifyValue > + NotifyOp :=3D 0x86 > + NotifyObject :=3D SuperName =3D> ThermalZone | Processor | Device > + NotifyValue :=3D TermArg =3D> Integer > + > + @param[in] NotifyObject - String of Namestring to a device > + @param[in] NotifyValue - Integer Notify value > + @param[in,out] ListHead - Linked list updated with Notify object > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlOPNotify ( > + IN CHAR8 *NotifyObject, > + IN UINT64 NotifyValue, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + Status =3D InternalAppendNewAmlObject (&Object, NotifyObject, ListHead= ); > + Status =3D AmlOPNameString (NotifyObject, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Failed creating NotifyObject > NameString\n", __func__)); > + goto Done; > + } > + > + Status =3D AmlOPDataInteger (NotifyValue, ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Failed creating NotifyValue > Integer\n", __func__)); > + goto Done; > + } > + > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, NotifyObject, > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: locating Return Object\n", > __func__)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: collecting Child data\n", __func__)= ); > + goto Done; > + } > + > + // Allocate buffer for Return object > + Object->Data =3D AllocatePool (ChildObject->DataSize + 1); > + Object->DataSize =3D ChildObject->DataSize + 1; > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object=3DReturn\n", > __func__)); > + goto Done; > + } > + > + // Fill out Return object > + Object->Data[0] =3D AML_NOTIFY_OP; > + CopyMem ( > + &Object->Data[1], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + Status =3D EFI_SUCCESS; > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + InternalFreeAmlObject (&ChildObject, ListHead); > + } > + > + return Status; > +} > + > +/** > + Creates a Return object > + > + Object must be created between AmlStart and AmlClose Phase > + > + DefReturn :=3D ReturnOp ArgObject > + ReturnOp :=3D 0xA4 > + ArgObject :=3D TermArg =3D> DataRefObject > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in,out] ListHead - Linked list has completed String Object af= ter > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlReturn ( > + IN AML_FUNCTION_PHASE Phase, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + > + if ((Phase >=3D AmlInvalid) || (ListHead =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + switch (Phase) { > + case AmlStart: > + Status =3D InternalAppendNewAmlObject (&Object, "Return", ListHead= ); > + // DataRefObject is outside the scope of this object > + break; > + case AmlClose: > + // DataRefObject should be closed already > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, "Return", > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: locating Return Object\n", > __func__)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: collecting Child data\n", > __func__)); > + goto Done; > + } > + > + // Handle Return with no arguments > + if ((ChildObject->Data =3D=3D NULL) || (ChildObject->DataSize =3D= =3D 0)) { > + // Return without arguments is treated like Return(0) > + // Zeroed byte =3D ZeroOp > + ChildObject->Data =3D AllocateZeroPool (sizeof (UINT8)); > + if (ChildObject->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Zero Child for Retur= n\n", > __func__)); > + goto Done; > + } > + > + ChildObject->DataSize =3D 1; > + } > + > + // Allocate buffer for Return object > + Object->Data =3D AllocatePool (ChildObject->DataSize + 1); > + Object->DataSize =3D ChildObject->DataSize + 1; > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object=3DReturn\n", > __func__)); > + goto Done; > + } > + > + // Fill out Return object > + Object->Data[0] =3D AML_RETURN_OP; > + CopyMem ( > + &Object->Data[1], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + InternalFreeAmlObject (&ChildObject, ListHead); > + } > + > + return Status; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlTable.c > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlTable.c > new file mode 100644 > index 0000000000..c9a4399764 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/AmlTable.c > @@ -0,0 +1,213 @@ > +/** @file > + > + Copyright (C) 2020-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "LocalAmlLib.h" > +#include > + > +#define FILECODE LIBRARY_DXEAMLGENERATIONLIB_AMLTABLE_FILECODE > + > +// String Length Constants > +#define OEM_ID_LENGTH 6 > +#define OEM_TABLE_ID_LENGTH 8 > +#define SIGNATURE_LENGTH 4 > +#define CREATOR_ID_LENGTH 4 > + > +/** > + Creates an AML Encoded Table > + Object must be created between AmlStart and AmlClose Phase > + > + DefBlockHeader :=3D TableSignature TableLength SpecCompliance CheckSu= m > OemID > + OemTableID OemRevision CreatorID CreatorRevision > + > + TableSignature :=3D DWordData // As defined in section 5.2.3. > + TableLength :=3D DWordData // Length of the table in bytes in= cluding > the > + // block header > + SpecCompliance :=3D ByteData // The revision of the structure. > + CheckSum :=3D ByteData // Byte checksum of the entire tab= le. > + OemID :=3D ByteData(6) // OEM ID of up to 6 characters. > + // If the OEM ID is shorter than 6 > + // characters, it can be terminated = with a > + // NULL character. > + OemTableID :=3D ByteData(8) // OEM Table ID of up to 8 charact= ers. > + // If the OEM Table ID is shorter th= an > + // 8 characters, it can be terminate= d with > + // a NULL character. > + OemRevision :=3D DWordData // OEM Table Revision. > + CreatorID :=3D DWordData // Vendor ID of the ASL compiler. > + CreatorRevision :=3D DWordData // Revision of the ASL compiler. > + > + @param[in] Phase - Either AmlStart or AmlClose > + @param[in] TableNameString - Table Name > + @param[in] ComplianceRev - Compliance Revision > + @param[in] OemId - OEM ID > + @param[in] OemTableId - OEM ID of table > + @param[in] OemRevision - OEM Revision number > + @param[in] CreatorId - Vendor ID of the ASL compiler > + @param[in] CreatorRevision - Vendor Revision of the ASL compiler > + @param[in,out] ListHead - Linked list has completed String Obj= ect after > + AmlClose. > + > + @retval EFI_SUCCESS > + @retval Error status > +**/ > +EFI_STATUS > +EFIAPI > +AmlDefinitionBlock ( > + IN AML_FUNCTION_PHASE Phase, > + IN CHAR8 *TableNameString, > + IN UINT8 ComplianceRev, > + IN CHAR8 *OemId, > + IN CHAR8 *OemTableId, > + IN UINT32 OemRevision, > + IN CHAR8 *CreatorId, > + IN UINT32 CreatorRevision, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINTN ChildCount; > + > + if ((Phase >=3D AmlInvalid) || > + (ListHead =3D=3D NULL) || > + (TableNameString =3D=3D NULL) || > + (OemId =3D=3D NULL) || > + (OemTableId =3D=3D NULL) || > + (CreatorId =3D=3D NULL) || > + (AsciiStrLen (TableNameString) !=3D SIGNATURE_LENGTH) || > + (AsciiStrLen (OemId) > OEM_ID_LENGTH) || > + (AsciiStrLen (OemTableId) > OEM_TABLE_ID_LENGTH) || > + (AsciiStrLen (CreatorId) !=3D CREATOR_ID_LENGTH)) > + { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D EFI_DEVICE_ERROR; > + Object =3D NULL; > + ChildObject =3D NULL; > + > + switch (Phase) { > + case AmlStart: > + Status =3D InternalAppendNewAmlObject (&Object, TableNameString, > ListHead); > + // TermList is too complicated and must be added outside > + break; > + > + case AmlClose: > + // TermList should be closed already > + Status =3D InternalAmlLocateObjectByIdentifier (&Object, TableName= String, > ListHead); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: locate %a object\n", __func__, > TableNameString)); > + goto Done; > + } > + > + // Get rid of original Identifier data > + InternalFreeAmlObjectData (Object); > + > + // Collect child data and delete children > + Status =3D InternalAmlCollapseAndReleaseChildren ( > + &ChildObject, > + &ChildCount, > + &Object->Link, > + ListHead > + ); > + if (EFI_ERROR (Status) || > + (ChildObject->Data =3D=3D NULL) || > + (ChildObject->DataSize =3D=3D 0)) > + { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: %a has no child data.\n", __fun= c__, > TableNameString)); > + goto Done; > + } > + > + Object->DataSize =3D ChildObject->DataSize + sizeof > (EFI_ACPI_DESCRIPTION_HEADER); > + Object->Data =3D AllocateZeroPool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocate Object->Data for %a\n"= , > __func__, TableNameString)); > + goto Done; > + } > + > + // Fill table header with data > + // Signature > + CopyMem ( > + &Object->Data[OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, > Signature)], > + TableNameString, > + AsciiStrLen (TableNameString) > + ); > + > + // Table Length > + CopyMem ( > + &Object->Data[OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, Length)], > + (UINT32 *)&Object->DataSize, > + sizeof (UINT32) > + ); > + > + // ACPI Table Version > + Object->Data[OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, Revision)] = =3D > ComplianceRev; > + > + // OEM ID > + CopyMem ( > + &Object->Data[OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, OemId)], > + OemId, > + AsciiStrLen (OemId) > + ); > + > + // OEM Table ID > + CopyMem ( > + &Object->Data[OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, > OemTableId)], > + OemTableId, > + AsciiStrLen (OemTableId) > + ); > + > + // OEM Table Version > + CopyMem ( > + &Object->Data[OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, > OemRevision)], > + (UINT8 *)&OemRevision, > + sizeof (UINT32) > + ); > + > + // Creator ID > + CopyMem ( > + &Object->Data[OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, > CreatorId)], > + CreatorId, > + AsciiStrLen (CreatorId) > + ); > + > + // Creator Version > + CopyMem ( > + &Object->Data[OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, > CreatorRevision)], > + (UINT8 *)&CreatorRevision, > + sizeof (UINT32) > + ); > + > + // Copy rest of data into Object > + CopyMem ( > + &Object->Data[sizeof (EFI_ACPI_DESCRIPTION_HEADER)], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + > + // Checksum Set on Table Install > + InternalFreeAmlObject (&ChildObject, ListHead); > + Object->Completed =3D TRUE; > + Status =3D EFI_SUCCESS; > + break; > + > + default: > + Status =3D EFI_DEVICE_ERROR; > + break; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + InternalFreeAmlObject (&ChildObject, ListHead); > + } > + > + return Status; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/LocalAmlO > bjects.c > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/LocalAmlO > bjects.c > new file mode 100644 > index 0000000000..b1ad9b7037 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/DxeAmlGenerationLib/LocalAmlO > bjects.c > @@ -0,0 +1,364 @@ > +/** @file > + > + Copyright (C) 2020-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "LocalAmlLib.h" > +#include > + > +#define FILECODE > LIBRARY_DXEAMLGENERATIONLIB_LOCALAMLOBJECTS_FILECODE > + > +/** > + Free Object->Data > + > + Frees Object->Data, Nulls pointer, zeros size and marks > + Object->Completed =3D FALSE > + > + @param [in] Object - Pointer to Object to have Data freed > + > + @return EFI_SUCCESS - Object Freed > + @return - Object free failed > +**/ > +EFI_STATUS > +EFIAPI > +InternalFreeAmlObjectData ( > + IN AML_OBJECT_INSTANCE *Object > + ) > +{ > + if (Object =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + if (Object->Data !=3D NULL) { > + FreePool (Object->Data); > + Object->Data =3D NULL; > + Object->DataSize =3D 0; > + Object->Completed =3D FALSE; > + } > + > + return EFI_SUCCESS; > +} > + > +/** > + Free an Object > + > + Removes Object from it's linked list. > + Frees Object->Data > + Frees Object > + > + @param [in] Object - Pointer to Object to be freed > + @param [in,out] ListHead - Head of AML Object linked list > + > + @return EFI_SUCCESS - Object Freed > + @return - Object free failed > +**/ > +EFI_STATUS > +EFIAPI > +InternalFreeAmlObject ( > + IN AML_OBJECT_INSTANCE **FreeObject, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + AML_OBJECT_INSTANCE *Object; > + > + if ((FreeObject =3D=3D NULL) || (ListHead =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Object =3D *FreeObject; > + if (Object !=3D NULL) { > + InternalFreeAmlObjectData (Object); > + if (IsNodeInList (ListHead, &Object->Link)) { > + RemoveEntryList (&Object->Link); > + } > + > + FreePool (Object); > + } > + > + *FreeObject =3D NULL; > + return EFI_SUCCESS; > +} > + > +/** > + Creates a new AML_OBJECT_INSTANCE. Object->Data will be NULL and > + Object->DataSize will be 0 > + > + Allocates AML_OBJECT_INSTANCE which must be freed by caller > + > + @param [out] ReturnObject - Pointer to an Object > + > + @return EFI_SUCCESS - Object created and appended to linked = list > + @return - Object creation failed, Object =3D NUL= L > +**/ > +EFI_STATUS > +EFIAPI > +InternalNewAmlObjectNoData ( > + OUT AML_OBJECT_INSTANCE **ReturnObject > + ) > +{ > + AML_OBJECT_INSTANCE *Object; > + > + if (ReturnObject =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + *ReturnObject =3D NULL; > + > + // Allocate AML Object > + Object =3D AllocateZeroPool (sizeof (AML_OBJECT_INSTANCE)); > + if (Object =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Allocate Object Failed\n", > __func__)); > + return EFI_OUT_OF_RESOURCES; > + } > + > + Object->DataSize =3D 0; > + Object->Data =3D NULL; > + Object->Signature =3D AML_OBJECT_INSTANCE_SIGNATURE; > + > + *ReturnObject =3D Object; > + return EFI_SUCCESS; > +} > + > +/** > + Inserts a new AML_OBJECT_INSTANCE at the end of the linked list. Obje= ct- > >Data > + will be NULL and Object->DataSize will be 0 > + > + Allocates AML_OBJECT_INSTANCE which must be freed by caller > + > + @param [out] ReturnObject - Pointer to an Object > + @param [in,out] ListHead - Head of AML Object linked list > + > + @return EFI_SUCCESS - Object created and appended to linked = list > + @return - Object creation failed, Object =3D NUL= L > +**/ > +EFI_STATUS > +EFIAPI > +InternalAppendNewAmlObjectNoData ( > + OUT AML_OBJECT_INSTANCE **ReturnObject, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + > + if ((ListHead =3D=3D NULL) || (ReturnObject =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D InternalNewAmlObjectNoData (&Object); > + if (!EFI_ERROR (Status)) { > + InsertTailList (ListHead, &Object->Link); > + *ReturnObject =3D Object; > + } > + > + return Status; > +} > + > +/** > + Inserts a new AML_OBJECT_INSTANCE at the end of the linked list. Usin= g a > + string Identifier for comparison purposes > + > + Allocates AML_OBJECT_INSTANCE which must be freed by caller > + > + @param [out] ReturnObject - Pointer to an Object > + @param [in] Identifier - String Identifier to create object wit= h > + @param [in,out] ListHead - Head of AML Object linked list > + > + @return EFI_SUCCESS - Object created and appended to linked = list > + @return - Object creation failed, Object =3D NUL= L > +**/ > +EFI_STATUS > +EFIAPI > +InternalAppendNewAmlObject ( > + OUT AML_OBJECT_INSTANCE **ReturnObject, > + IN CHAR8 *Identifier, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_INSTANCE *Object; > + > + if ((Identifier =3D=3D NULL) || (ListHead =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Object =3D NULL; > + > + Status =3D InternalAppendNewAmlObjectNoData (&Object, ListHead); > + if (EFI_ERROR (Status)) { > + return EFI_OUT_OF_RESOURCES; > + } > + > + // Allocate Identifier Data + NULL termination > + Object->DataSize =3D AsciiStrLen (Identifier) + 1; > + Object->Data =3D AllocatePool (Object->DataSize); > + if (Object->Data =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: Allocate Data Identifier=3D%a\n", > __func__, Identifier)); > + InternalFreeAmlObject (&Object, ListHead); > + return EFI_OUT_OF_RESOURCES; > + } > + > + CopyMem (Object->Data, Identifier, Object->DataSize); > + > + *ReturnObject =3D Object; > + return EFI_SUCCESS; > +} > + > +/** > + Finds AML_OBJECT_INSTANCE given a string Identifier looking backwards = in > the > + AML_OBJECT_INSTANCE linked list > + > + @param [out] ReturnObject - Pointer to an Object > + @param [in] Identifier - String Identifier to create object wit= h > + @param [in] ListHead - Head of AML Object linked list > + > + @return EFI_SUCCESS - Object located and returned > + @return - Object creation failed, Object =3D NUL= L > +**/ > +EFI_STATUS > +EFIAPI > +InternalAmlLocateObjectByIdentifier ( > + OUT AML_OBJECT_INSTANCE **ReturnObject, > + IN CHAR8 *Identifier, > + IN LIST_ENTRY *ListHead > + ) > +{ > + LIST_ENTRY *Node; > + AML_OBJECT_INSTANCE *Object; > + UINTN IdentifierSize; > + > + if ((Identifier =3D=3D NULL) || (ListHead =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + Object =3D NULL; > + *ReturnObject =3D NULL; > + > + IdentifierSize =3D AsciiStrLen (Identifier) + 1; > + // Look Backwards and find Node for this Object > + Node =3D ListHead; > + do { > + Node =3D GetPreviousNode (ListHead, Node); > + Object =3D AML_OBJECT_INSTANCE_FROM_LINK (Node); > + > + if (Object->Completed) { > + // Object to be found cannot be completed yet > + continue; > + } else { > + if ((Object->DataSize !=3D 0) && > + (Object->DataSize =3D=3D IdentifierSize) && > + (CompareMem ( > + Object->Data, > + Identifier, > + MAX (Object->DataSize, IdentifierSize) > + ) =3D=3D 0)) > + { > + *ReturnObject =3D Object; > + return EFI_SUCCESS; > + } else { > + DEBUG (( > + DEBUG_ERROR, > + "%a: ERROR: First incomplete Object is not %a.\n", > + __func__, > + Identifier > + )); > + // Object looking for should be the first uncompleted Object. > + return EFI_NOT_FOUND; > + } > + } > + } while (Node !=3D ListHead); > + > + *ReturnObject =3D NULL; > + return EFI_NOT_FOUND; > +} > + > +/** > + Finds all children of the Link and appends them into a single ObjectDa= ta > + buffer of ObjectDataSize > + > + Allocates AML_OBJECT_INSTANCE and Data which must be freed by caller > + > + @param [out] ReturnObject - Pointer to an Object pointer > + @param [out] ChildCount - Count of Child Objects collapsed > + @param [in] Link - Linked List Object entry to collect ch= ildren > + @param [in,out] ListHead - Head of Object Linked List > + > + @return EFI_SUCCESS - ChildObject created and returned > + @return - Object creation failed, Object =3D NUL= L > +**/ > +EFI_STATUS > +EFIAPI > +InternalAmlCollapseAndReleaseChildren ( > + OUT AML_OBJECT_INSTANCE **ReturnObject, > + OUT UINTN *ChildCount, > + IN LIST_ENTRY *Link, > + IN OUT LIST_ENTRY *ListHead > + ) > +{ > + EFI_STATUS Status; > + LIST_ENTRY *Node; > + AML_OBJECT_INSTANCE *Object; > + AML_OBJECT_INSTANCE *ChildObject; > + UINT8 *TempBuffer; > + > + Status =3D EFI_SUCCESS; > + if ((ReturnObject =3D=3D NULL) || > + (ChildCount =3D=3D NULL) || > + (Link =3D=3D NULL) || > + (ListHead =3D=3D NULL)) > + { > + return EFI_INVALID_PARAMETER; > + } > + > + *ChildCount =3D 0; > + > + Status =3D InternalNewAmlObjectNoData (&Object); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: ERROR: allocating Object Data\n", > __func__)); > + goto Done; > + } > + > + // Get first Child Node > + Node =3D GetNextNode (ListHead, Link); > + while (Node !=3D ListHead) { > + ChildObject =3D AML_OBJECT_INSTANCE_FROM_LINK (Node); > + // Expand data buffer to fit existing data + new data > + TempBuffer =3D ReallocatePool ( > + Object->DataSize, > + Object->DataSize + ChildObject->DataSize, > + Object->Data > + ); > + if (TempBuffer =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + FreePool (Object->Data); > + Object->Data =3D NULL; > + DEBUG ((DEBUG_ERROR, "%a: ERROR: reallocating Object Data\n", > __func__)); > + goto Done; > + } > + > + Object->Data =3D TempBuffer; > + // Copy new data at end of buffer > + CopyMem ( > + &Object->Data[Object->DataSize], > + ChildObject->Data, > + ChildObject->DataSize > + ); > + Object->DataSize +=3D ChildObject->DataSize; > + // Get Next ChildObject Node, then free ChildObject from list > + Node =3D GetNextNode (ListHead, Node); > + InternalFreeAmlObject (&ChildObject, ListHead); > + *ChildCount =3D *ChildCount + 1; > + } > + > +Done: > + if (EFI_ERROR (Status)) { > + InternalFreeAmlObject (&Object, ListHead); > + Object =3D NULL; > + } > + > + *ReturnObject =3D Object; > + return Status; > +} > diff --git a/Platform/AMD/AgesaModulePkg/Library/FchBaseLib/FchStallLib.c > b/Platform/AMD/AgesaModulePkg/Library/FchBaseLib/FchStallLib.c > new file mode 100644 > index 0000000000..2f4f676adb > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Library/FchBaseLib/FchStallLib.c > @@ -0,0 +1,13 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +/*----------------------------------------------------------------------= ------------------ > + * M O D U L E S U S E D > + *----------------------------------------------------------------------= ------------------ > + */ > +#include > diff --git > a/Platform/AMD/AgesaModulePkg/Library/FchBaseResetSystemLib/FchBaseR > esetSystemLib.c > b/Platform/AMD/AgesaModulePkg/Library/FchBaseResetSystemLib/FchBaseR > esetSystemLib.c > new file mode 100644 > index 0000000000..60305ee4a6 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/FchBaseResetSystemLib/FchBaseR > esetSystemLib.c > @@ -0,0 +1,90 @@ > +/** @file > + Library to support reset library, inheritted from Agesa Cf9Reset modul= e. > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > +#include > + > +/** > + This function causes a system-wide reset (cold reset), in which > + all circuitry within the system returns to its initial state. This typ= e of reset > + is asynchronous to system operation and operates without regard to > + cycle boundaries. > + > + If this function returns, it means that the system does not support co= ld reset. > +**/ > +VOID > +EFIAPI > +ResetCold ( > + VOID > + ) > +{ > +} > + > +/** > + This function causes a system-wide initialization (warm reset), in whi= ch all > processors > + are set to their initial state. Pending cycles are not corrupted. > + > + If this function returns, it means that the system does not support wa= rm > reset. > +**/ > +VOID > +EFIAPI > +ResetWarm ( > + VOID > + ) > +{ > +} > + > +/** > + This function causes the system to enter a power state equivalent > + to the ACPI G2/S5 or G3 states. > + > + If this function returns, it means that the system does not support sh= utdown > reset. > +**/ > +VOID > +EFIAPI > +ResetShutdown ( > + VOID > + ) > +{ > +} > + > +/** > + This function causes the system to enter S3 and then wake up immediate= ly. > + > + If this function returns, it means that the system does not support S3 > feature. > +**/ > +VOID > +EFIAPI > +EnterS3WithImmediateWake ( > + VOID > + ) > +{ > +} > + > +/** > + This function causes a systemwide reset. The exact type of the reset i= s > + defined by the EFI_GUID that follows the Null-terminated Unicode strin= g > passed > + into ResetData. If the platform does not recognize the EFI_GUID in > ResetData > + the platform must pick a supported reset type to perform.The platform = may > + optionally log the parameters from any non-normal reset that occurs. > + > + @param[in] DataSize The size, in bytes, of ResetData. > + @param[in] ResetData The data buffer starts with a Null-terminated s= tring, > + followed by the EFI_GUID. > +**/ > +VOID > +EFIAPI > +ResetPlatformSpecific ( > + IN UINTN DataSize, > + IN VOID *ResetData > + ) > +{ > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/FchEspiCmdLib/FchEspiCmdLib.c > b/Platform/AMD/AgesaModulePkg/Library/FchEspiCmdLib/FchEspiCmdLib.c > new file mode 100644 > index 0000000000..d10e676668 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/FchEspiCmdLib/FchEspiCmdLib.c > @@ -0,0 +1,87 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > +#include > +#include > +/*----------------------------------------------------------------------= ------------------*/ > + > +/** > + * @param[in] EspiBase Espi MMIO base > + * @param[in] RegAddr Slave register address > + * > + * @retval Register Value > + */ > +UINT32 > +FchEspiCmd_GetConfiguration ( > + IN UINT32 EspiBase, > + IN UINT32 RegAddr > + ) > +{ > + return 0; > +} > + > +/*----------------------------------------------------------------------= ------------------*/ > + > +/** > + * > + * @param[in] EspiBase Espi MMIO base > + * @param[in] Address Address to read > + * @param[in] Length Length in byte to read > + * @param[in] Buffer Pointer to the data read to > + * > + */ > +EFI_STATUS > +FchEspiCmd_SafsFlashRead ( > + IN UINT32 EspiBase, > + IN UINT32 Address, > + IN UINT32 Length, > + OUT UINT8 *Buffer > + ) > +{ > + return EFI_SUCCESS; > +} > + > +/*----------------------------------------------------------------------= ------------------*/ > + > +/** > + * > + * @param[in] EspiBase Espi MMIO base > + * @param[in] Address Address to write > + * @param[in] Length Length in byte to write > + * @param[in] Value Pointer to the data to write > + * > + */ > +EFI_STATUS > +FchEspiCmd_SafsFlashWrite ( > + IN UINT32 EspiBase, > + IN UINT32 Address, > + IN UINT32 Length, > + IN UINT8 *Value > + ) > +{ > + return EFI_SUCCESS; > +} > + > +/*----------------------------------------------------------------------= ------------------*/ > + > +/** > + * > + * @param[in] EspiBase Espi MMIO base > + * @param[in] Address Address to erase > + * @param[in] Length Block Size to erase > + * > + * > + */ > +EFI_STATUS > +FchEspiCmd_SafsFlashErase ( > + IN UINT32 EspiBase, > + IN UINT32 Address, > + IN UINT32 Length > + ) > +{ > + return EFI_SUCCESS; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/NbioHandleLib/NbioHandleLib.c > b/Platform/AMD/AgesaModulePkg/Library/NbioHandleLib/NbioHandleLib.c > new file mode 100755 > index 0000000000..9044d3d497 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/NbioHandleLib/NbioHandleLib.c > @@ -0,0 +1,68 @@ > +/** @file > + GNB function to create/locate PCIe configuration data area, Contain co= de > + that create/locate/manages GNB/PCIe configuration > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > +#include > +#include > +#include > + > +/** > + Get GNB handle > + > + @param[in] Pcie Pointer to global PCIe configuration > + > +**/ > +GNB_HANDLE * > +NbioGetHandle ( > + IN PCIE_PLATFORM_CONFIG *Pcie > + ) > +{ > + return NULL; > +} > + > +/** > + Get GNB handle of alternate host bridge (e.g. MI200) > + > + @param[in] Pcie Pointer to global PCIe configuration > +**/ > +GNB_HANDLE * > +NbioGetAltHandle ( > + IN PCIE_PLATFORM_CONFIG *Pcie > + ) > +{ > + return NULL; > +} > + > +/** > + Get GNB handle of next socket > + > + @param[in] NbioHandle Pointer to current GnbHandle > +**/ > +GNB_HANDLE * > +NbioGetNextSocket ( > + IN GNB_HANDLE *NbioHandle > + ) > +{ > + return NULL; > +} > + > +/** > + Get PCI_ADDR of GNB > + > + @param[in] Handle Pointer to GNB_HANDLE > +**/ > +PCI_ADDR > +NbioGetHostPciAddress ( > + IN GNB_HANDLE *Handle > + ) > +{ > + PCI_ADDR PciAddr; > + > + PciAddr.AddressValue =3D 0; > + return PciAddr; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/PcieConfigLib/PcieConfigLib.c > b/Platform/AMD/AgesaModulePkg/Library/PcieConfigLib/PcieConfigLib.c > new file mode 100755 > index 0000000000..d5fbe98d22 > --- /dev/null > +++ b/Platform/AMD/AgesaModulePkg/Library/PcieConfigLib/PcieConfigLib.c > @@ -0,0 +1,276 @@ > +/** @file > + GNB function to create/locate PCIe configuration data area > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > +#include > +#include > +#include > + > +/** > + Check Port Status > + > + @param[in] Engine Pointer to engine config descriptor > + @param[in] PortStatus Check if status asserted for port > + @retval TRUE if status asserted > +**/ > +BOOLEAN > +PcieConfigCheckPortStatus ( > + IN PCIE_ENGINE_CONFIG *Engine, > + IN UINT32 PortStatus > + ) > +{ > + return FALSE; > +} > + > +/** > + Set/Reset port status > + > + @param[in] Engine Pointer to engine config descriptor > + @param[in] SetStatus SetStatus > + @param[in] ResetStatus ResetStatus > + > +**/ > +UINT16 > +PcieConfigUpdatePortStatus ( > + IN PCIE_ENGINE_CONFIG *Engine, > + IN PCIE_ENGINE_INIT_STATUS SetStatus, > + IN PCIE_ENGINE_INIT_STATUS ResetStatus > + ) > +{ > + return 0; > +} > + > +/** > + Execute callback on all descriptor of specific type > + > + @param[in] InDescriptorFlags Include descriptor flags > + @param[in] OutDescriptorFlags Exclude descriptor flags > + @param[in] TerminationFlags Termination flags > + @param[in] Callback Pointer to callback function > + @param[in, out] Buffer Pointer to buffer to pass inform= ation to > callback > + @param[in] Pcie Pointer to global PCIe configura= tion > +**/ > +AGESA_STATUS > +PcieConfigRunProcForAllDescriptors ( > + IN UINT32 InDescriptorFlags, > + IN UINT32 OutDescriptorFlags, > + IN UINT32 TerminationFlags, > + IN PCIE_RUN_ON_DESCRIPTOR_CALLBACK Callback, > + IN OUT VOID *Buffer, > + IN PCIE_PLATFORM_CONFIG *Pcie > + ) > +{ > + return AGESA_UNSUPPORTED; > +} > + > +/** > + Execute callback on all wrappers in topology > + > + @param[in] DescriptorFlags Wrapper Flags > + @param[in] Callback Pointer to callback function > + @param[in, out] Buffer Pointer to buffer to pass informati= on to > callback > + @param[in] Pcie Pointer to global PCIe configuratio= n > +**/ > +AGESA_STATUS > +PcieConfigRunProcForAllWrappers ( > + IN UINT32 DescriptorFlags, > + IN PCIE_RUN_ON_WRAPPER_CALLBACK Callback, > + IN OUT VOID *Buffer, > + IN PCIE_PLATFORM_CONFIG *Pcie > + ) > +{ > + return AGESA_UNSUPPORTED; > +} > + > +/** > + Execute callback on all wrappers in NBIO > + > + > + @param[in] DescriptorFlags Wrapper Flags > + @param[in] Callback Pointer to callback function > + @param[in, out] Buffer Pointer to buffer to pass informati= on to > callback > + @param[in] Pcie Pointer to global PCIe configuratio= n > +**/ > +VOID > +PcieConfigRunProcForAllWrappersInNbio ( > + IN UINT32 DescriptorFlags, > + IN PCIE_RUN_ON_WRAPPER_CALLBACK2 Callback, > + IN OUT VOID *Buffer, > + IN GNB_HANDLE *GnbHandle > + ) > +{ > +} > + > +/** > + Execute callback on all engine in topology > + > + @param[in] DescriptorFlags Engine flags. > + @param[in] Callback Pointer to callback function > + @param[in, out] Buffer Pointer to buffer to pass information= to > callback > + @param[in] Pcie Pointer to global PCIe configuration > +**/ > +VOID > +PcieConfigRunProcForAllEngines ( > + IN UINT32 DescriptorFlags, > + IN PCIE_RUN_ON_ENGINE_CALLBACK Callback, > + IN OUT VOID *Buffer, > + IN PCIE_PLATFORM_CONFIG *Pcie > + ) > +{ > +} > + > +/** > + Execute callback on all engine in wrapper > + > + @param[in] DescriptorFlags Engine flags. > + @param[in] Callback Pointer to callback function > + @param[in, out] Buffer Pointer to buffer to pass information= to > callback > + @param[in] Pcie Pointer to global PCIe configuration > +**/ > +VOID > +PcieConfigRunProcForAllEnginesInWrapper ( > + IN UINT32 DescriptorFlags, > + IN PCIE_RUN_ON_ENGINE_CALLBACK2 Callback, > + IN OUT VOID *Buffer, > + IN PCIE_WRAPPER_CONFIG *Wrapper > + ) > +{ > +} > + > +/** > + Get parent descriptor of specific type > + > + @param[in] Type Descriptor type > + @param[in] Descriptor Pointer to buffer to pass information= to > callback > +**/ > +PCIE_DESCRIPTOR_HEADER * > +PcieConfigGetParent ( > + IN UINT32 Type, > + IN PCIE_DESCRIPTOR_HEADER *Descriptor > + ) > +{ > + return NULL; > +} > + > +/** > + Get child descriptor of specific type > + > + @param[in] Type Descriptor type > + @param[in] Descriptor Pointer to buffer to pass information= to > callback > +**/ > +PCIE_DESCRIPTOR_HEADER * > +PcieConfigGetChild ( > + IN UINT32 Type, > + IN PCIE_DESCRIPTOR_HEADER *Descriptor > + ) > +{ > + return NULL; > +} > + > +/** > + Get peer descriptor of specific type > + > + @param[in] Type Descriptor type > + @param[in] Descriptor Pointer to buffer to pass information= to > callback > +**/ > +PCIE_DESCRIPTOR_HEADER * > +PcieConfigGetPeer ( > + IN UINT32 Type, > + IN PCIE_DESCRIPTOR_HEADER *Descriptor > + ) > +{ > + return NULL; > +} > + > +/** > + Check is engine is active or potentially active > + > + @param[in] Engine Pointer to engine descriptor > + @retval TRUE - engine active > + @retval FALSE - engine not active > +**/ > +BOOLEAN > +PcieConfigIsActivePcieEngine ( > + IN PCIE_ENGINE_CONFIG *Engine > + ) > +{ > + return FALSE; > +} > + > +/** > + Locate SB engine on wrapper > + > + @param[in] Wrapper Pointer to wrapper config descriptor > + @retval SB engine pointer or NULL > +**/ > +PCIE_ENGINE_CONFIG * > +PcieConfigLocateSbEngine ( > + IN PCIE_WRAPPER_CONFIG *Wrapper > + ) > +{ > + return NULL; > +} > + > +/** > + Helper function to dump engine configuration > + > + @param[in] EngineList Engine Configuration > +**/ > +VOID > +PcieConfigEngineDebugDump ( > + IN PCIE_ENGINE_CONFIG *EngineList > + ) > +{ > +} > + > +/** > + Helper function to dump wrapper configuration > + > + @param[in] WrapperList Wrapper Configuration > +**/ > +VOID > +PcieConfigWrapperDebugDump ( > + IN PCIE_WRAPPER_CONFIG *WrapperList > + ) > +{ > +} > + > +/** > + Helper function to dump configuration to debug out > + > + @param[in] Pcie Pointer to global PCIe configuration > +**/ > +VOID > +PcieConfigDebugDump ( > + IN PCIE_PLATFORM_CONFIG *Pcie > + ) > +{ > +} > + > +/** > + Helper function to dump input configuration to user engine descriptor > + > + @param[in] EngineDescriptor Pointer to engine descriptor > +**/ > +VOID > +PcieUserDescriptorConfigDump ( > + IN PCIE_ENGINE_DESCRIPTOR *EngineDescriptor > + ) > +{ > +} > + > +/** > + Helper function to dump input configuration to debug out > + > + @param[in] ComplexDescriptor Pointer to user defined complex > descriptor > +**/ > +VOID > +PcieUserConfigConfigDump ( > + IN PCIE_COMPLEX_DESCRIPTOR *ComplexDescriptor > + ) > +{ > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/PcieConfigLib/PcieInputParserLib. > c > b/Platform/AMD/AgesaModulePkg/Library/PcieConfigLib/PcieInputParserLib. > c > new file mode 100755 > index 0000000000..5c6be22ee4 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/PcieConfigLib/PcieInputParserLib. > c > @@ -0,0 +1,117 @@ > +/** @file > + Procedure to parse PCIe input configuration data > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > + > +/** > + Get number of complexes in platform topology configuration > + > + @param[in] ComplexList First complex configuration in complex > configuration array > + @retval Number of Complexes > + > +**/ > +UINTN > +PcieInputParserGetNumberOfComplexes ( > + IN PCIE_COMPLEX_DESCRIPTOR *ComplexList > + ) > +{ > + return 0; > +} > + > +/** > + Get number of PCIe engines in given complex > + > + @param[in] Complex Complex configuration > + @retval Number of Engines > +**/ > +UINTN > +PcieInputParserGetLengthOfPcieEnginesList ( > + IN PCIE_COMPLEX_DESCRIPTOR *Complex > + ) > +{ > + return 0; > +} > + > +/** > + Get number of DDI engines in given complex > + > + @param[in] Complex Complex configuration > + @retval Number of Engines > +**/ > +UINTN > +PcieInputParserGetLengthOfDdiEnginesList ( > + IN PCIE_COMPLEX_DESCRIPTOR *Complex > + ) > +{ > + return 0; > +} > + > +/** > + Get number of engines in given complex > + > + > + > + @param[in] Complex Complex configuration header > + @retval Number of Engines > +**/ > +UINTN > +PcieInputParserGetNumberOfEngines ( > + IN PCIE_COMPLEX_DESCRIPTOR *Complex > + ) > +{ > + return 0; > +} > + > +/** > + Get Complex descriptor by index from given Platform configuration > + > + @param[in] ComplexList Platform topology configuration > + @param[in] Index Complex descriptor Index > + @retval Pointer to Complex Descriptor > +**/ > +PCIE_COMPLEX_DESCRIPTOR * > +PcieInputParserGetComplexDescriptor ( > + IN PCIE_COMPLEX_DESCRIPTOR *ComplexList, > + IN UINTN Index > + ) > +{ > + return NULL; > +} > + > +/** > + Get Complex descriptor by index from given Platform configuration > + > + @param[in] ComplexList Platform topology configuration > + @param[in] SocketId Socket Id > + @retval Pointer to Complex Descriptor > +**/ > +PCIE_COMPLEX_DESCRIPTOR * > +PcieInputParserGetComplexDescriptorOfSocket ( > + IN PCIE_COMPLEX_DESCRIPTOR *ComplexList, > + IN UINT32 SocketId > + ) > +{ > + return NULL; > +} > + > +/** > + Get Engine descriptor from given complex by index > + > + @param[in] Complex Complex descriptor > + @param[in] Index Engine descriptor index > + @retval Pointer to Engine Descriptor > +**/ > +PCIE_ENGINE_DESCRIPTOR * > +PcieInputParserGetEngineDescriptor ( > + IN PCIE_COMPLEX_DESCRIPTOR *Complex, > + IN UINTN Index > + ) > +{ > + return NULL; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Library/SmnAccessLib/SmnAccessLib.c > b/Platform/AMD/AgesaModulePkg/Library/SmnAccessLib/SmnAccessLib.c > new file mode 100644 > index 0000000000..e6be32b071 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Library/SmnAccessLib/SmnAccessLib.c > @@ -0,0 +1,10 @@ > +/** @file > + SMN Register Access Methods > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > diff --git > a/Platform/AMD/AgesaModulePkg/Nbio/Library/CommonDxe/DxeLibFunctio > ns.c > b/Platform/AMD/AgesaModulePkg/Nbio/Library/CommonDxe/DxeLibFunctio > ns.c > new file mode 100644 > index 0000000000..1dc13900c7 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Nbio/Library/CommonDxe/DxeLibFunctio > ns.c > @@ -0,0 +1,42 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > +#include > +#include > +#include > +#include > +#include > + > +/** > + Function to retrieve SOC_LOGICAL_ID > + > + @param[out] LogicalId Pointer to SOC_LOGICAL_ID > + @retval EFI_UNSUPPORTED > + > +**/ > +EFI_STATUS > +PcieGetLogicalId ( > + OUT SOC_LOGICAL_ID *LogicalId > + ) > +{ > + return EFI_UNSUPPORTED; > +} > + > +/** > + Function to retrieve PCIE_PLATFORM_CONFIG > + > + @param[out] Pcie Pointer to PCIE_PLATFORM_CONFIG Pointer > + @retval EFI_UNSUPPORTED > + > +**/ > +EFI_STATUS > +PcieGetPcieDxe ( > + OUT PCIE_PLATFORM_CONFIG **Pcie > + ) > +{ > + return EFI_UNSUPPORTED; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Psp/ApcbDrv/ApcbV3Dxe/ApcbV3Dxe.c > b/Platform/AMD/AgesaModulePkg/Psp/ApcbDrv/ApcbV3Dxe/ApcbV3Dxe.c > new file mode 100644 > index 0000000000..fbd3ddcf37 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Psp/ApcbDrv/ApcbV3Dxe/ApcbV3Dxe.c > @@ -0,0 +1,23 @@ > +/** @file > + APCB DXE Driver > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > +#include > + > +EFI_STATUS > +EFIAPI > +AmdApcbV3DxeDriverEntry ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + return EFI_SUCCESS; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Psp/ApcbDrv/ApcbV3Pei/ApcbV3Pei.c > b/Platform/AMD/AgesaModulePkg/Psp/ApcbDrv/ApcbV3Pei/ApcbV3Pei.c > new file mode 100644 > index 0000000000..23d1a8fee0 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Psp/ApcbDrv/ApcbV3Pei/ApcbV3Pei.c > @@ -0,0 +1,29 @@ > +/** @file > + > + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > + > +/** > + * @brief Amd Apcb V3 Pei Driver Entry > + * > + * @param[in] FileHandle File Handie > + * @param[in] PeiServices Pei Services > + * > + * @retval EFI_SUCCESS Set APCB value successfully > + * Non-EFI_SUCCESS Function Error > + * > + **/ > +EFI_STATUS > +EFIAPI > +AmdApcbV3PeiDriverEntry ( > + IN EFI_PEI_FILE_HANDLE FileHandle, > + IN CONST EFI_PEI_SERVICES **PeiServices > + ) > +{ > + return EFI_SUCCESS; > +} > diff --git > a/Platform/AMD/AgesaPkg/Addendum/Ccx/OemAgesaCcxPlatformLibNull/Oe > mAgesaCcxPlatformLibNull.c > b/Platform/AMD/AgesaPkg/Addendum/Ccx/OemAgesaCcxPlatformLibNull/Oe > mAgesaCcxPlatformLibNull.c > new file mode 100644 > index 0000000000..74b129931b > --- /dev/null > +++ > b/Platform/AMD/AgesaPkg/Addendum/Ccx/OemAgesaCcxPlatformLibNull/Oe > mAgesaCcxPlatformLibNull.c > @@ -0,0 +1,39 @@ > +/** @file > + Required OEM hooks for CCX initialization > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > + > +/** > + Hook to store the vector that all APs should jump to out of reset to a= non- > volatile, > + shared location. > + > + @param[in] ApInitAddress Address of the code that AP should ju= mp to > + @param[in,out] ContentToRestore The current value in the non-volatile > storage > + > +**/ > +VOID > +SaveApInitVector ( > + IN UINT32 ApInitAddress, > + IN OUT UINT32 *ContentToRestore > + ) > +{ > +} > + > +/** > + Hook to restore the initial content of the non-volatile storage locati= on. > + > + @param[in] ContentToRestore The value to restore > + > +**/ > +VOID > +RestoreContentVector ( > + IN UINT32 ContentToRestore > + ) > +{ > +} > diff --git > a/Platform/AMD/AgesaPkg/Addendum/PciSegments/PciExpressPciCfg2/PciEx > pressPciCfg2.c > b/Platform/AMD/AgesaPkg/Addendum/PciSegments/PciExpressPciCfg2/PciEx > pressPciCfg2.c > new file mode 100644 > index 0000000000..54ce202cb1 > --- /dev/null > +++ > b/Platform/AMD/AgesaPkg/Addendum/PciSegments/PciExpressPciCfg2/PciEx > pressPciCfg2.c > @@ -0,0 +1,33 @@ > +/** @file > + > + Copyright (C) 2018-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +/** > + Module's entry function. > + This routine will install EFI_PEI_PCI_CFG2_PPI. > + > + @param FileHandle Handle of the file being invoked. > + @param PeiServices Describes the list of possible PEI Services. > + > + @return Whether success to install service. > +**/ > +EFI_STATUS > +EFIAPI > +PeimInitializePciCfg ( > + IN EFI_PEI_FILE_HANDLE FileHandle, > + IN CONST EFI_PEI_SERVICES **PeiServices > + ) > +{ > + return EFI_SUCCESS; > +} > diff --git > a/Platform/AMD/AgesaPkg/Addendum/PciSegments/PciExpressPciSegmentIn > foLib/PciSegmentInfoLib.c > b/Platform/AMD/AgesaPkg/Addendum/PciSegments/PciExpressPciSegmentIn > foLib/PciSegmentInfoLib.c > new file mode 100644 > index 0000000000..643174d7b9 > --- /dev/null > +++ > b/Platform/AMD/AgesaPkg/Addendum/PciSegments/PciExpressPciSegmentIn > foLib/PciSegmentInfoLib.c > @@ -0,0 +1,30 @@ > +/** @file > + > + Copyright (C) 2018-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > +#include > + > +/** > + Return an array of PCI_SEGMENT_INFO holding the segment information. > + > + Note: The returned array/buffer is owned by callee. > + > + @param Count Return the count of segments. > + > + @retval A callee owned array holding the segment information. > +**/ > +PCI_SEGMENT_INFO * > +EFIAPI > +GetPciSegmentInfo ( > + UINTN *Count > + ) > +{ > + return (PCI_SEGMENT_INFO *)NULL; > +} > diff --git > a/Platform/AMD/AgesaPkg/Addendum/Psp/AmdPspFlashAccSpiNorLibSmm/A > mdPspFlashAccSpiNorLibSmm.c > b/Platform/AMD/AgesaPkg/Addendum/Psp/AmdPspFlashAccSpiNorLibSmm/ > AmdPspFlashAccSpiNorLibSmm.c > new file mode 100644 > index 0000000000..d83bb6c2d8 > --- /dev/null > +++ > b/Platform/AMD/AgesaPkg/Addendum/Psp/AmdPspFlashAccSpiNorLibSmm/ > AmdPspFlashAccSpiNorLibSmm.c > @@ -0,0 +1,15 @@ > +/** @file > + > + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > diff --git > a/Platform/AMD/AgesaPkg/Addendum/Psp/PspRomArmorWhitelistLib/PspRo > mArmorWhitelistLib.c > b/Platform/AMD/AgesaPkg/Addendum/Psp/PspRomArmorWhitelistLib/PspRo > mArmorWhitelistLib.c > new file mode 100644 > index 0000000000..a264eb9294 > --- /dev/null > +++ > b/Platform/AMD/AgesaPkg/Addendum/Psp/PspRomArmorWhitelistLib/PspRo > mArmorWhitelistLib.c > @@ -0,0 +1,12 @@ > +/** @file > + Platform ROM Armor Whitelist table > + > + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > +#include > +#include > +#include > +#include > diff --git > a/Platform/AMD/AmdCpmPkg/Addendum/Oem/OobPprDxe/OobPprDxe.c > b/Platform/AMD/AmdCpmPkg/Addendum/Oem/OobPprDxe/OobPprDxe.c > new file mode 100644 > index 0000000000..e379538e3a > --- /dev/null > +++ > b/Platform/AMD/AmdCpmPkg/Addendum/Oem/OobPprDxe/OobPprDxe.c > @@ -0,0 +1,36 @@ > +/** @file > + OEM OOB PPR DXE Driver. > + > + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +/** > +* This function installs a protocol used by platform BIOS to provide the > hotplug descriptor. > +* > +* @param[in] ImageHandle Image handler > +* @param[in] SystemTable Pointer to the system table > +* > +* @retval EFI_SUCCESS The thread was successfully launched. > +* > +**/ > +EFI_STATUS > +EFIAPI > +OobPprEntry ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + return EFI_SUCCESS; > +} > diff --git > a/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Dxe/PspPlatformDriv > er/PspPlatformDriver.c > b/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Dxe/PspPlatformDriv > er/PspPlatformDriver.c > new file mode 100644 > index 0000000000..5242e6261a > --- /dev/null > +++ > b/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Dxe/PspPlatformDriv > er/PspPlatformDriver.c > @@ -0,0 +1,20 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > +#include > +#include > +#include > + > +EFI_STATUS > +EFIAPI > +PspPlatformEntryPoint ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + return EFI_SUCCESS; > +} > diff --git > a/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Dxe/ServerHotplugD > xe/ServerHotplugDxe.c > b/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Dxe/ServerHotplugD > xe/ServerHotplugDxe.c > new file mode 100644 > index 0000000000..530bd9d4b6 > --- /dev/null > +++ > b/Platform/AMD/AmdCpmPkg/Addendum/Oem/Quartz/Dxe/ServerHotplugD > xe/ServerHotplugDxe.c > @@ -0,0 +1,22 @@ > +/** @file > + > + Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > +#include > +#include > +#include > +#include > +#include > + > +EFI_STATUS > +EFIAPI > +HotplugDescEntry ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + return EFI_SUCCESS; > +} > diff --git > a/Platform/AMD/AmdCpmPkg/Library/AmdAutoDynamicCommand/AmdAuto > DynamicCommand.c > b/Platform/AMD/AmdCpmPkg/Library/AmdAutoDynamicCommand/AmdAuto > DynamicCommand.c > new file mode 100644 > index 0000000000..fbc372586b > --- /dev/null > +++ > b/Platform/AMD/AmdCpmPkg/Library/AmdAutoDynamicCommand/AmdAuto > DynamicCommand.c > @@ -0,0 +1,44 @@ > +/** @file > + > + Copyright (C) 2022-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +/** > + Entry point of Act Dynamic Command. > + > + Produce the DynamicCommand protocol to handle "act" command. > + > + @param ImageHandle The image handle of the process. > + @param SystemTable The EFI System Table pointer. > + > + @retval EFI_SUCCESS Act command is executed sucessfully. > + @retval EFI_ABORTED HII package was failed to initialize. > + @retval others Other errors when executing act command. > +**/ > +EFI_STATUS > +EFIAPI > +ActCommandInitialize ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + return EFI_SUCCESS; > +} > + > +/** > + Destructor for the library. free any resources. > + > + @param ImageHandle The image handle of the process. > + @param SystemTable The EFI System Table pointer. > +**/ > +EFI_STATUS > +EFIAPI > +ActLibraryUnregisterActCommand ( > + IN EFI_HANDLE ImageHandle > + ) > +{ > + return EFI_SUCCESS; > +} > diff --git > a/Platform/AMD/AmdCpmPkg/Library/AmdAutoDynamicCommand/AmdAuto > ToolApp.c > b/Platform/AMD/AmdCpmPkg/Library/AmdAutoDynamicCommand/AmdAuto > ToolApp.c > new file mode 100644 > index 0000000000..0a5f4a7e81 > --- /dev/null > +++ > b/Platform/AMD/AmdCpmPkg/Library/AmdAutoDynamicCommand/AmdAuto > ToolApp.c > @@ -0,0 +1,36 @@ > +/** @file > + String token ID of help message text. > + Shell supports to find help message in the resource section of an > + application image if * .MAN file is not found. > + This global variable is added to make build tool recognizes > + that the help string is consumed by user and then build tool will > + add the string into the resource section. > + Thus the application can use '-?' option to show help message in Shell= . > + > + Copyright (C) 2022-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +/** > + Entry point of Act Dynamic Command. > + > + Produce the DynamicCommand protocol to handle "act" command. > + > + @param ImageHandle The image handle of the process. > + @param SystemTable The EFI System Table pointer. > + > + @retval EFI_SUCCESS Act command is executed sucessfully. > + @retval EFI_ABORTED HII package was failed to initialize. > + @retval others Other errors when executing act command. > +**/ > +EFI_STATUS > +EFIAPI > +ActCommandInitialize ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + return EFI_SUCCESS; > +} > diff --git > a/Platform/AMD/AmdCpmPkg/Library/CommonLib/BasePlatformHookLibAmd > FchUart/BasePlatformHookLibAmdFchUart.c > b/Platform/AMD/AmdCpmPkg/Library/CommonLib/BasePlatformHookLibAmd > FchUart/BasePlatformHookLibAmdFchUart.c > new file mode 100644 > index 0000000000..47eb700f8f > --- /dev/null > +++ > b/Platform/AMD/AmdCpmPkg/Library/CommonLib/BasePlatformHookLibAmd > FchUart/BasePlatformHookLibAmdFchUart.c > @@ -0,0 +1,29 @@ > +/** @file > + > + Copyright (C) 2016-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > + > +/** > + Performs platform specific initialization required for the CPU to acce= ss > + the hardware associated with a SerialPortLib instance. This function = does > + not intiailzie the serial port hardware itself. Instead, it initializ= es > + hardware devices that are required for the CPU to access the serial po= rt > + hardware. This function may be called more than once. > + > + @retval RETURN_SUCCESS The platform specific initialization succ= eeded. > + @retval RETURN_DEVICE_ERROR The platform specific initialization coul= d > not be completed. > + > +**/ > +RETURN_STATUS > +EFIAPI > +PlatformHookSerialPortInitialize ( > + VOID > + ) > +{ > + return RETURN_SUCCESS; > +} > diff --git > a/Platform/AMD/AgesaModulePkg/Fch/Songshan/FchSongshanDxe/FchSongs > hanI2C_I3C.asl > b/Platform/AMD/AgesaModulePkg/Fch/Songshan/FchSongshanDxe/FchSongs > hanI2C_I3C.asl > new file mode 100644 > index 0000000000..72b9a87639 > --- /dev/null > +++ > b/Platform/AMD/AgesaModulePkg/Fch/Songshan/FchSongshanDxe/FchSongs > hanI2C_I3C.asl > @@ -0,0 +1,9 @@ > +/** @file > + > + Copyright (C) 2022-2024 Advanced Micro Devices, Inc. All rights > reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > + > diff --git a/Platform/AMD/AgesaPkg/Include/AmdUefiStackNasm.inc > b/Platform/AMD/AgesaPkg/Include/AmdUefiStackNasm.inc > new file mode 100644 > index 0000000000..2dfb3190d4 > --- /dev/null > +++ b/Platform/AMD/AgesaPkg/Include/AmdUefiStackNasm.inc > @@ -0,0 +1,13 @@ > +; @file > +; > +; AMD Generic Encapsulated Software Architecture > +; Code to setup temporary memory access for stack usage. This code > +; is to be used on memory present systems that do not need CAR. > +; > +; Copyright (C) 2008-2024 Advanced Micro Devices, Inc. All rights > reserved.
> +; > +; SPDX-License-Identifier: BSD-2-Clause-Patent > +; > +%macro AMD_ENABLE_UEFI_STACK2 2-3 > + > +%endmacro > diff --git a/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi > b/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi > index a731c7e369..937caee083 160000 > --- a/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi > +++ b/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/opensbi > @@ -1 +1 @@ > -Subproject commit a731c7e36988c3308e1978ecde491f2f6182d490 > +Subproject commit 937caee0833115f69d697ca190001ba0aa5c7368 > -- > 2.37.1.windows.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 (#119132): https://edk2.groups.io/g/devel/message/119132 Mute This Topic: https://groups.io/mt/106257082/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-