From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.53]) by mx.groups.io with SMTP id smtpd.web11.50868.1685370957580287422 for ; Mon, 29 May 2023 07:35:57 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=RS9+gPEh; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.220.53, mailfrom: abdullateef.attar@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jm2lJr0xeem7Qmlwd5p9QK79rE19fYNLX+aHD0jrIlbdmzjXQjlyPFNnxMdlmME1NzNNTsAYighFhfrKaktzZ3D8IZmzamHqRYdvlx/IpHO4CAaAHoE8sJ6G+hb8L6+zmTgciVcczcpGMVF+vBeB2wayiW4CmQJLXunEuYe7T0OrSpwFca05ql5ZwENno7mPmCEDhFjVxWymSqVBySwxFNF790V56bc2sEYMu6Aq4aQ1X/bJXHcnfhiH0Y0rVE88dLtYA6GHCrmgRv3Dy0Ul0Hwqp4CLGmEQ6XDYQWQnLZTczZA/f3Df4k51EEmoSVub6aegod4IJA2gD8iwYjElAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aHJ1RGUuszg0Sy3DfZWJkK3pA/Q51B1BAA97/182tyk=; b=hPKNdCRFqWesXyNOXbNZljrwSoqLJ2RsbR7eCSwxh4fDICIqfuwrpiUUC1o55A1YtNwUno+nrXxBCMsTK9yEMrqUHkcUAHoTjIPVnGyIGlm1ol11XS2DEbad9bRHWfBN5OfLrh+M6XLjLC8k+oLQd6gubyIDyVu9JvAD6JY10ELMTBnRumtW/ieA68DzabgTc2yN3QTcm8EnfYRAxpT1EYs54nRRS0FBMtB6RbvJanIK7vGmXreuwaiEkIxuGuiSSq7/fD7FyZIBRHKROXSR45/1MQLEAVPlUDO9ohDRJqP2M2Hbx0Ym0b9sViOnWrfWzD33+ska30bGRDSdfDgVrg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aHJ1RGUuszg0Sy3DfZWJkK3pA/Q51B1BAA97/182tyk=; b=RS9+gPEhh0bbf22xtBvOwNuq7U64SioF03aZU4KXdo1uJ6g7pVR9qGSb3jDStT3PSbGsunD7f5p0C1iX6UK84xjT/aoeryl473lWrGAauuIefTZCwRilRRb10Uy/bAb9QS/40fjIhtT51xV6tRpPlfdYyt44MIGZJhwpkcCwkR4= Received: from IA1PR12MB6458.namprd12.prod.outlook.com (2603:10b6:208:3aa::22) by BL1PR12MB5947.namprd12.prod.outlook.com (2603:10b6:208:39a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.23; Mon, 29 May 2023 14:35:55 +0000 Received: from IA1PR12MB6458.namprd12.prod.outlook.com ([fe80::e99b:2936:87a4:e038]) by IA1PR12MB6458.namprd12.prod.outlook.com ([fe80::e99b:2936:87a4:e038%4]) with mapi id 15.20.6433.022; Mon, 29 May 2023 14:35:54 +0000 From: "Attar, AbdulLateef (Abdul Lateef)" To: "Chang, Abner" , "devel@edk2.groups.io" Subject: Re: [PATCH v2 1/2] AMD/AmdMinBoardPkg: Implements PCI hotplug init protocol Thread-Topic: [PATCH v2 1/2] AMD/AmdMinBoardPkg: Implements PCI hotplug init protocol Thread-Index: AQHZjI/f+OdT/d7WjEadOUXXRXrgBK9ry/mAgAWQe3A= Date: Mon, 29 May 2023 14:35:54 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=3612b655-adb3-4fa7-8636-7c726197e78b;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2023-05-26T01:34:33Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: IA1PR12MB6458:EE_|BL1PR12MB5947:EE_ x-ms-office365-filtering-correlation-id: 5db7a6ec-3b38-49fb-3554-08db6052027b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 32pmelRSZSnPe6zqjCKpDCffgZ54Soawi7C+Ynz1Q16gbE3BN2dr75I4yX2bgGE5HZPGsE4M+bwepapkTU/tjmI6n6PwPEo7Eio7AsrIJXlljRXAAu1wEsiCS9cPy8dUo8/W3RkqAEUmEylIi9vmWyd+5UlSNEFY6fzAUuk6v8/Inu22JQs4Di/ghAgGAdmlBWW6Aol+/66Og+lGpqu4ORubVM8j1oYMsyeYwZMTWLBYTX/9zkLsKSS6j2hcT04gtU5S1rIZRHIoqnx23AdHQmpFXDd4w9F8iUngkwLRQGYvZbPzFghNStmevGK9EEzVYC3JK2OX7eMuWb7IAjuvpdgwyQYE8HPH8MbCVv8XXtYsn+qeNaaG80PxeFrVHj1cAWNcVY1k0tJZMke6BrYbNvv5tRzNw3nB4/K4n5k5ow9W03M+iqaoJ3Q/aAfTYOKk8pYBbYEkYKyjfbNQGZ9UDraGgs5VjlhRJ0W5sqBqbqYv/2N4n69pr4EJrUJ0/T4IE/2XTaZauGn2BtrujW7MBcryqSdCbYVg68MzWnUhTjM21q9GJV1MYJRHOPaic7iTYZdO5xb3bs+TJIzuwmLV5CY9Oq2fBAqyQtPv+na6bfVOFOnGZbnrbbI+QgciP4W1t2svuZaVEvO+p8xJKy6SwQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA1PR12MB6458.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(39860400002)(346002)(366004)(396003)(376002)(451199021)(71200400001)(478600001)(110136005)(5660300002)(8936002)(8676002)(52536014)(30864003)(38070700005)(2906002)(86362001)(33656002)(66476007)(66556008)(66946007)(66446008)(76116006)(64756008)(122000001)(316002)(55016003)(38100700002)(41300700001)(186003)(6506007)(9686003)(53546011)(83380400001)(7696005)(579004)(44824005);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?MMvFVWffGyBPRSSDY9u9rgT3FzbkPdWZlBzf0lfUujTaz21n9NMhvFSDfmYQ?= =?us-ascii?Q?ro9GCIxGXRZtUJ1bgFwW/8yF+3sfB0fx1pg7zCbEiHjlTgRQJHoGWo/HmJBU?= =?us-ascii?Q?qgVfxA7yc6TRYjCz91XvtrFsileWVBvC1cuhkvWHPBLWKpmX2ca3EZzln54I?= =?us-ascii?Q?KRYn5H2AEEug4ww+glJiTjlCVzEK4Q2HcpijAJULvuqr2Hng/BHg7KQ7Sl0J?= =?us-ascii?Q?wXLA+7ZGvhG6w2/s3mM79oTbjGJ+8KHALODWcB2HmaTib+XfIINYLw716fM5?= =?us-ascii?Q?jGv1cNtsTxsrRzElGT/FmvmK3PWqCS7hl0dYNy5gTce8yErk/r7xSkoYaa+l?= =?us-ascii?Q?RLUn1x3PvGraRI5uIN2k1UqvMB56rF4g0U/kdRJXE75xiXo84PMiNYd7l9OS?= =?us-ascii?Q?IIZAZc58qBxtUkg0hi1yVmVWW9/ex65vZOTE1DiBTFCTe++intWiSMm2VOGd?= =?us-ascii?Q?24qB9WjPhYa2E5iKXi1xCoBn8rMIczob/+NGX7x9eCM0DFTZqQjH59QmsU2F?= =?us-ascii?Q?SLPn1F+Y6p7mwD2F2OQLRb0dAFzAIqRRisAxltLAwW3F5j+3KyMSQ7/26WYS?= =?us-ascii?Q?kcx69n1Rx3DSdGhXmAamBPKrvbjfW2+4f/byUzOUEsScoaxGzOODDCzQRCv3?= =?us-ascii?Q?TAjH1E1A9y/K9roOSgrR3x6j/S2RUDGLUajp74F6hd3IoeQ2Co8IYmOEuxwx?= =?us-ascii?Q?TPe2MaeuUeah2cUaGxdyQM0ddazCpaUHyBSlvXBVRQoo2TOb+bPN1rOTPSNb?= =?us-ascii?Q?fK4qjAEd+iunVKBASaGYt2O7HwsDYerKpD7p0WBEGo1WuRaWg+vVUv18yPRI?= =?us-ascii?Q?u4HsotPIL1Qb74eCpwQoxnezzraD8MS8ZGjJ4C4SqU/qq9NaqDdwbPQ8Y7Qq?= =?us-ascii?Q?C8xwhWSVGsTb4g3Wz9F+KMgPBQodeiOMpAR0a4UVIy8QWoUh30Jw+25mE/nO?= =?us-ascii?Q?82eFXHk1nTDZGVF8XyuaHNo76AgjQpt0Rp3rdVhEns7Ka/ihkkrbDGbN+cwJ?= =?us-ascii?Q?2TSxMf6WaduNscceyedrP8HPaCw4XbBN1JEYMaLfEOk0TOfdFAejIcvjnghe?= =?us-ascii?Q?RIs2/+9sZcwGV66p9yygQkIA91Oej/Qg65PbKmdGLTHJrS97NaWIcNF7nb/W?= =?us-ascii?Q?29/LapK6ugyLK84OuTyOedz3Uk1hbPdnWMcnEFjVsc9d8oeREeoF32mEE7bt?= =?us-ascii?Q?HQEwQxPlXNVYqdZkc4ko0w9aLLmog8v+AYCCoRJQnDXVi1+AwDzke0UdiumL?= =?us-ascii?Q?8zPvvSGaXdKh7alGmdbDh36HfApredD0StOQDJq80+XwrRIcNlYfIfmwGVY3?= =?us-ascii?Q?FexolG7joDtFcYmrFhapv5MK31r0CyBrm2U1y8GWNYzlxseInHVeNfqha3AV?= =?us-ascii?Q?yghc3iGbq7PmZK+g3CyWMc8W/9tEsdQqOSlv0gznuMwIjT0EgoCap008O+7d?= =?us-ascii?Q?xUsqFj59nZT61Dt0Ly6aVEBI5i7MCjfsg279UELrY8tJ93o6Gtd57sKHm8FW?= =?us-ascii?Q?tAqPU36pa6ObFwujALGIMgEXCZSJ7VRM+OLIiN4LkLFvP6hA7g4MOQlEkA?= =?us-ascii?Q?=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: IA1PR12MB6458.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5db7a6ec-3b38-49fb-3554-08db6052027b X-MS-Exchange-CrossTenant-originalarrivaltime: 29 May 2023 14:35:54.7687 (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: kmS7QMRe3mTBNWKM3eCdzZPVWr+raej1O1BBdL2kXP/BRwxlhGLZTT6GpRmJjvL+LssYOotfn1x7WuzjAxYZiA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5947 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only - General] Hi Abner, Yes, its same patch series with V2 version. Thanks AbduL -----Original Message----- From: Chang, Abner Sent: Friday, May 26, 2023 7:07 AM To: Attar, AbdulLateef (Abdul Lateef) ; devel@ed= k2.groups.io Cc: Attar, AbdulLateef (Abdul Lateef) Subject: RE: [PATCH v2 1/2] AMD/AmdMinBoardPkg: Implements PCI hotplug init= protocol [AMD Official Use Only - General] Hi Abdul, Is this a duplicate patch? There was a patch you sent: [edk2-devel] [PATCH 1/1] AMD/AmdMinBoardPkg: I= mplements PCI hotplug init protocol, they both create PciHotPlug.c and PciH= otPlug.inf. Thanks Abner > -----Original Message----- > From: Abdul Lateef Attar > Sent: Monday, May 22, 2023 5:29 PM > To: devel@edk2.groups.io > Cc: Attar, AbdulLateef (Abdul Lateef) ; > Chang, Abner > Subject: [PATCH v2 1/2] AMD/AmdMinBoardPkg: Implements PCI hotplug > init protocol > > From: Abdul Lateef Attar > > Implements PCI hotplug init protocol. > Adds resources padding based on PCD values. > > Cc: Abner Chang > > Signed-off-by: Abdul Lateef Attar > --- > .../AMD/AmdMinBoardPkg/AmdMinBoardPkg.dec | 16 + > .../AMD/AmdMinBoardPkg/AmdMinBoardPkg.dsc | 14 +- > .../PciHotPlug/PciHotPlugInit.inf | 39 +++ > .../PciHotPlug/PciHotPlugInit.c | 331 ++++++++++++++++++ > 4 files changed, 399 insertions(+), 1 deletion(-) create mode 100755 > Platform/AMD/AmdMinBoardPkg/PciHotPlug/PciHotPlugInit.inf > create mode 100755 > Platform/AMD/AmdMinBoardPkg/PciHotPlug/PciHotPlugInit.c > > diff --git a/Platform/AMD/AmdMinBoardPkg/AmdMinBoardPkg.dec > b/Platform/AMD/AmdMinBoardPkg/AmdMinBoardPkg.dec > index e37b02c4cf5a..65ba08545021 100644 > --- a/Platform/AMD/AmdMinBoardPkg/AmdMinBoardPkg.dec > +++ b/Platform/AMD/AmdMinBoardPkg/AmdMinBoardPkg.dec > @@ -17,3 +17,19 @@ [Defines] > PACKAGE_GUID =3D 44F9D761-9ECB-43DD-A5AC-177E5048701= B > PACKAGE_VERSION =3D 0.1 > > +[Guids] > + gAmdMinBoardPkgTokenSpaceGuid =3D {0xd4d23d79, 0x73bf, 0x460a, > {0xa1, 0xc7, 0x85, 0xa3, 0xca, 0x71, 0xb9, 0x4c}} > + > +[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] > + # > + # PCI HotPlug Resource Padding > + # > + # PCI bus padding, number of bus to reserve, default 2 bus > + > gAmdMinBoardPkgTokenSpaceGuid.PcdPciHotPlugResourcePadBus|2|UINT8 > |0x10000003 > + # IO Resource padding in bytes, default 4KB > + > gAmdMinBoardPkgTokenSpaceGuid.PcdPciHotPlugResourcePadIo|0x000010 > 00|UINT32|0x10000000 > + # Non-PreFetch Memory padding in bytes, default 1MB > + > gAmdMinBoardPkgTokenSpaceGuid.PcdPciHotPlugResourcePadMem|0x0010 > 0000|UINT32|0x10000002 > + # PreFetch Memory padding in bytes, default 2MB > + > gAmdMinBoardPkgTokenSpaceGuid.PcdPciHotPlugResourcePadPMem|0x002 > 00000|UINT32|0x10000001 > + > diff --git a/Platform/AMD/AmdMinBoardPkg/AmdMinBoardPkg.dsc > b/Platform/AMD/AmdMinBoardPkg/AmdMinBoardPkg.dsc > index 273cd74f7842..1a8407250c56 100644 > --- a/Platform/AMD/AmdMinBoardPkg/AmdMinBoardPkg.dsc > +++ b/Platform/AMD/AmdMinBoardPkg/AmdMinBoardPkg.dsc > @@ -9,7 +9,7 @@ > > [Defines] > DSC_SPECIFICATION =3D 1.30 > - PLATFORM_GUID =3D 88F8A9AE-2FA0-4D58-A6F9-05F635C05F4E > + PLATFORM_GUID =3D 939B559B-269B-4B8F-9637-44DF6575C1E2 > PLATFORM_NAME =3D AmdMinBoardPkg > PLATFORM_VERSION =3D 0.1 > OUTPUT_DIRECTORY =3D Build/$(PLATFORM_NAME) > @@ -25,6 +25,16 @@ [Packages] > [LibraryClasses] > > SpcrDeviceLib|AmdMinBoardPkg/Library/SpcrDeviceLib/SpcrDeviceLib.inf > > +[LibraryClasses.common] > + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf > + > BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRe > pStr.inf > + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf > + > MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemor > yAllocationLib.inf > + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf > + > RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterL > RegisterFilterLib|ibNull.inf > + > UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiB > UefiBootServicesTableLib|oo > tServicesTableLib.inf > + > UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEnt > UefiDriverEntryPoint|ryP > oint.inf > + > [LibraryClasses.common.PEIM] > > SetCacheMtrrLib|AmdMinBoardPkg/Library/SetCacheMtrrLib/SetCacheMtrrLi > b.inf > > @@ -34,3 +44,5 @@ [Components] > [Components.IA32] > AmdMinBoardPkg/Library/SetCacheMtrrLib/SetCacheMtrrLib.inf > > +[Components.X64] > + AmdMinBoardPkg/PciHotPlug/PciHotPlugInit.inf > diff --git a/Platform/AMD/AmdMinBoardPkg/PciHotPlug/PciHotPlugInit.inf > b/Platform/AMD/AmdMinBoardPkg/PciHotPlug/PciHotPlugInit.inf > new file mode 100755 > index 000000000000..44564df38718 > --- /dev/null > +++ b/Platform/AMD/AmdMinBoardPkg/PciHotPlug/PciHotPlugInit.inf > @@ -0,0 +1,39 @@ > +## @file > +# This driver implements EFI_PCI_HOT_PLUG_INIT_PROTOCOL. > +# Adds resource padding information, for PCIe hotplug purposes. > +# > +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved > +# SPDX-License-Identifier: BSD-2-Clause-Patent ## > + > +[Defines] > + INF_VERSION =3D 1.29 > + BASE_NAME =3D PciHotPlugInit > + FILE_GUID =3D 85F78A6D-6438-4BCC-B796-759A48D00C7= 2 > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 0.1 > + ENTRY_POINT =3D PciHotPlugInitialize > + > +[Sources] > + PciHotPlugInit.c > + > +[Packages] > + AmdMinBoardPkg/AmdMinBoardPkg.dec > + MdeModulePkg/MdeModulePkg.dec > + MdePkg/MdePkg.dec > + > +[LibraryClasses] > + MemoryAllocationLib > + UefiBootServicesTableLib > + UefiDriverEntryPoint > + > +[Protocols] > + gEfiPciHotPlugInitProtocolGuid > + > +[Pcd] > + gAmdMinBoardPkgTokenSpaceGuid.PcdPciHotPlugResourcePadBus > + gAmdMinBoardPkgTokenSpaceGuid.PcdPciHotPlugResourcePadIo > + gAmdMinBoardPkgTokenSpaceGuid.PcdPciHotPlugResourcePadMem > + gAmdMinBoardPkgTokenSpaceGuid.PcdPciHotPlugResourcePadPMem > + > +[Depex] > + TRUE > diff --git a/Platform/AMD/AmdMinBoardPkg/PciHotPlug/PciHotPlugInit.c > b/Platform/AMD/AmdMinBoardPkg/PciHotPlug/PciHotPlugInit.c > new file mode 100755 > index 000000000000..a26ca16741b8 > --- /dev/null > +++ b/Platform/AMD/AmdMinBoardPkg/PciHotPlug/PciHotPlugInit.c > @@ -0,0 +1,331 @@ > +/** @file > + This file declares EFI PCI Hot Plug Init Protocol. > + > + This protocol provides the necessary functionality to initialize > + the Hot Plug Controllers (HPCs) and the buses that they control. > + This protocol also > provides > + information regarding resource padding. > + > + @par Note: > + This source has the reference of OVMF PciHotPluginit.c and Intel > + platform > PciHotPlug.c. > + > + This protocol is required only on platforms that support one or > + more PCI > Hot > + Plug* slots or CardBus sockets. > + > + The EFI_PCI_HOT_PLUG_INIT_PROTOCOL provides a mechanism for the PCI > bus enumerator > + to properly initialize the HPCs and CardBus sockets that require initi= alization. > + The HPC initialization takes place before the PCI enumeration > + process is > complete. > + There cannot be more than one instance of this protocol in a > + system. This > protocol > + is installed on its own separate handle. > + > + Because the system may include multiple HPCs, one instance of this > + protocol should represent all of them. The protocol functions use > + the device path of the HPC to identify the HPC. When the PCI bus > + enumerator finds a root HPC, > it > + will call EFI_PCI_HOT_PLUG_INIT_PROTOCOL.InitializeRootHpc(). If > InitializeRootHpc() > + is unable to initialize a root HPC, the PCI enumerator will ignore > + that root > HPC > + and continue the enumeration process. If the HPC is not > + initialized, the > devices > + that it controls may not be initialized, and no resource padding > + will be > provided. > + > + From the standpoint of the PCI bus enumerator, HPCs are divided > + into the > following > + two classes: > + > + - Root HPC: > + These HPCs must be initialized by calling InitializeRootHpc() du= ring the > + enumeration process. These HPCs will also require resource paddi= ng. The > + platform code must have a priori knowledge of these devices > + and must > know > + how to initialize them. There may not be any way to access their= PCI > + configuration space before the PCI enumerator programs all > + the > upstream > + bridges and thus enables the path to these devices. The PCI > + bus > enumerator > + is responsible for determining the PCI bus address of the HPC be= fore it > + calls InitializeRootHpc(). > + - Nonroot HPC: > + These HPCs will not need explicit initialization during > + enumeration > process. > + These HPCs will require resource padding. The platform code > + does not > have > + to have a priori knowledge of these devices. > + > + Copyright (c) 2007 - 2018, Intel Corporation. All rights > + reserved.
Copyright (C) 2016, Red Hat, Inc.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > + @par Revision Reference: > + This Protocol is defined in UEFI Platform Initialization > + Specification 1.2 Volume 5: Standards > + > +**/ > + > +#include > +#include > +#include > +#include #include > + > + > +// > +// The protocol interface this driver produces. > +// > +STATIC EFI_PCI_HOT_PLUG_INIT_PROTOCOL mPciHotPlugInit; > + > +/** > + Returns a list of root Hot Plug Controllers (HPCs) that require > +initialization > + during the boot process. > + > + This procedure returns a list of root HPCs. The PCI bus driver must > + initialize these controllers during the boot process. The PCI bus > + driver may or may > not be > + able to detect these HPCs. If the platform includes a > + PCI-to-CardBus bridge, > it > + can be included in this list if it requires initialization. The > + HpcList must be self consistent. An HPC cannot control any of its > + parent buses. Only one HPC > can > + control a PCI bus. Because this list includes only root HPCs, no > + HPC in the list can be a child of another HPC. This policy must be enf= orced by the > + EFI_PCI_HOT_PLUG_INIT_PROTOCOL. The PCI bus driver may not check for > such > + invalid conditions. The callee allocates the buffer HpcList > + > + @param[in] This Pointer to the EFI_PCI_HOT_PLUG_INIT_PROTOCOL > instance. > + @param[out] HpcCount The number of root HPCs that were returned. > + @param[out] HpcList The list of root HPCs. HpcCount defines the num= ber > of > + elements in this list. > + > + @retval EFI_SUCCESS HpcList was returned. > + @retval EFI_INVALID_PARAMETER HpcCount is NULL or HpcList is NULL. > + > +**/ > +EFI_STATUS > +EFIAPI > +GetRootHpcList ( > + IN EFI_PCI_HOT_PLUG_INIT_PROTOCOL *This, > + OUT UINTN *HpcCount, > + OUT EFI_HPC_LOCATION **HpcList > + ) > +{ > + if ((HpcCount =3D=3D NULL) || (HpcList =3D=3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + // > + // Platform BIOS not doing any extra/special HPC initialization // > + Hence returning the HpcCount as zero and HpcList as NULL // > + *HpcCount =3D 0; *HpcList =3D NULL; > + > + return EFI_SUCCESS; > +} > + > +/** > + Initializes one root Hot Plug Controller (HPC). This process may > +causes > + initialization of its subordinate buses. > + > + This function initializes the specified HPC. At the end of > + initialization, the hot-plug slots or sockets (controlled by this > + HPC) are powered and are connected to the bus. All the necessary > + registers in the HPC are set up. For a Standard (PCI) Hot Plug > + Controller (SHPC), the registers that must be set up are defined in > + the PCI Standard Hot Plug Controller and Subsystem Specification. > + > + @param[in] This Pointer to the EFI_PCI_HOT_PLUG_INIT_PROTO= COL > instance. > + @param[in] HpcDevicePath The device path to the HPC that is being > initialized. > + @param[in] HpcPciAddress The address of the HPC function on the PCI > bus. > + @param[in] Event The event that should be signaled when the= HPC > + initialization is complete. Set to NULL i= f the > + caller wants to wait until the entire init= ialization > + process is complete. > + @param[out] HpcState The state of the HPC hardware. The state i= s > + EFI_HPC_STATE_INITIALIZED or EFI_HPC_STATE= _ENABLED. > + > + @retval EFI_UNSUPPORTED This instance of > EFI_PCI_HOT_PLUG_INIT_PROTOCOL > + does not support the specified HPC. > + @retval EFI_INVALID_PARAMETER HpcState is NULL. > + > +**/ > +EFI_STATUS > +EFIAPI > +InitializeRootHpc ( > + IN EFI_PCI_HOT_PLUG_INIT_PROTOCOL *This, > + IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath, > + IN UINT64 HpcPciAddress, > + IN EFI_EVENT Event, OPTIONAL > + OUT EFI_HPC_STATE *HpcState > + ) > +{ > + if (HpcState =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + // > + // HPC is initialized by respective platform PI modules. > + // Hence no extra initialization required. > + // > + return EFI_UNSUPPORTED; > +} > + > +/** > + Returns the resource padding that is required by the PCI bus that > +is > controlled > + by the specified Hot Plug Controller (HPC). > + > + This function returns the resource padding that is required by the > + PCI bus > that > + is controlled by the specified HPC. This member function is called > + for all the root HPCs and nonroot HPCs that are detected by the PCI bu= s enumerator. > This > + function will be called before PCI resource allocation is > + completed. This > function > + must be called after all the root HPCs, with the possible exception > + of a PCI-to-CardBus bridge, have completed initialization. > + > + @param[in] This Pointer to the EFI_PCI_HOT_PLUG_INIT_PROTO= COL > instance. > + @param[in] HpcDevicePath The device path to the HPC. > + @param[in] HpcPciAddress The address of the HPC function on the PCI > bus. > + @param[in] HpcState The state of the HPC hardware. > + @param[out] Padding The amount of resource padding that is req= uired > by the > + PCI bus under the control of the specified= HPC. > + @param[out] Attributes Describes how padding is accounted for. Th= e > padding > + is returned in the form of ACPI 2.0 resour= ce descriptors. > + > + @retval EFI_SUCCESS The resource padding was successfully > returned. > + @retval EFI_INVALID_PARAMETER HpcState or Padding or Attributes is > NULL. > + @retval EFI_OUT_OF_RESOURCES ACPI 2.0 resource descriptors for > Padding > + cannot be allocated due to insufficien= t resources. > + > +**/ > +EFI_STATUS > +EFIAPI > +GetResourcePadding ( > + IN EFI_PCI_HOT_PLUG_INIT_PROTOCOL *This, > + IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath, > + IN UINT64 HpcPciAddress, > + OUT EFI_HPC_STATE *HpcState, > + OUT VOID **Padding, > + OUT EFI_HPC_PADDING_ATTRIBUTES *Attributes > + ) > +{ > + EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *PaddingResource; > + > + if ((HpcState =3D=3D NULL) || (Padding =3D=3D NULL) || (Attributes =3D= =3D NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + // > + // Need total 5 resources > + // 1 - IO resource > + // 2 - Mem resource > + // 3 - PMem resource > + // 4 - Bus resource > + // 5 - end tag resource > + PaddingResource =3D AllocateZeroPool (4 * sizeof > (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) + sizeof > (EFI_ACPI_END_TAG_DESCRIPTOR)); > + if (PaddingResource =3D=3D NULL) { > + return EFI_OUT_OF_RESOURCES; > + } > + > + *Padding =3D (VOID *)PaddingResource; > + > + // > + // Padding for bus > + // > + *Attributes =3D EfiPaddingPciBus; > + > + PaddingResource->Desc =3D ACPI_ADDRESS_SPACE_DESCRIPTOR; > + PaddingResource->Len =3D (UINT16)( > + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRI= PTOR) - > + OFFSET_OF ( > + EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR, > + ResType > + ) > + ); > + PaddingResource->ResType =3D ACPI_ADDRESS_SPACE_TYPE_BUS; > + PaddingResource->GenFlag =3D 0x0; > + PaddingResource->SpecificFlag =3D 0; > + PaddingResource->AddrRangeMin =3D 0; > + PaddingResource->AddrRangeMax =3D 0; > + PaddingResource->AddrLen =3D PcdGet8 (PcdPciHotPlugResourcePadBus= ); > + > + // > + // Padding for non-prefetchable memory // PaddingResource++; > + PaddingResource->Desc =3D ACPI_ADDRESS_SPACE_DESCRIPTOR; > + PaddingResource->Len =3D (UINT16)( > + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRI= PTOR) - > + OFFSET_OF ( > + EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR, > + ResType > + ) > + ); > + PaddingResource->ResType =3D ACPI_ADDRESS_SPACE_TYPE_MEM; > + PaddingResource->GenFlag =3D 0x0; > + PaddingResource->AddrSpaceGranularity =3D 32; > + PaddingResource->SpecificFlag =3D > EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_NON_CACHEABLE; > + PaddingResource->AddrRangeMin =3D 0; > + PaddingResource->AddrLen =3D (UINT64)PcdGet32 > (PcdPciHotPlugResourcePadMem); > + PaddingResource->AddrRangeMax =3D PaddingResource->AddrLen - 1= ; > + > + // > + // Padding for prefetchable memory > + // > + PaddingResource++; > + PaddingResource->Desc =3D ACPI_ADDRESS_SPACE_DESCRIPTOR; > + PaddingResource->Len =3D (UINT16)( > + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRI= PTOR) - > + OFFSET_OF ( > + EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR, > + ResType > + ) > + ); > + PaddingResource->ResType =3D ACPI_ADDRESS_SPACE_TYPE_MEM; > + PaddingResource->GenFlag =3D 0x0; > + PaddingResource->AddrSpaceGranularity =3D 32; > + PaddingResource->SpecificFlag =3D > EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE; > + PaddingResource->AddrLen =3D (UINT64)PcdGet32 > (PcdPciHotPlugResourcePadPMem); > + PaddingResource->AddrRangeMax =3D PaddingResource->AddrLen - 1= ; > + > + // > + // Padding for I/O > + // > + PaddingResource++; > + PaddingResource->Desc =3D ACPI_ADDRESS_SPACE_DESCRIPTOR; > + PaddingResource->Len =3D (UINT16)( > + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRI= PTOR) - > + OFFSET_OF ( > + EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR, > + ResType > + ) > + ); > + PaddingResource->ResType =3D ACPI_ADDRESS_SPACE_TYPE_IO; > + PaddingResource->GenFlag =3D 0x0; > + PaddingResource->SpecificFlag =3D 0; > + PaddingResource->AddrRangeMin =3D 0; > + PaddingResource->AddrLen =3D (UINT64)PcdGet32 > (PcdPciHotPlugResourcePadIo); > + PaddingResource->AddrRangeMax =3D PaddingResource->AddrLen - 1; > + > + // > + // Terminate the entries. > + // > + PaddingResource++; > + ((EFI_ACPI_END_TAG_DESCRIPTOR *)PaddingResource)->Desc =3D > ACPI_END_TAG_DESCRIPTOR; > + ((EFI_ACPI_END_TAG_DESCRIPTOR *)PaddingResource)->Checksum =3D 0x0; > + > + *HpcState =3D EFI_HPC_STATE_INITIALIZED | EFI_HPC_STATE_ENABLED; > + > + return EFI_SUCCESS; > +} > + > +/** > + Entry point for this driver. > + > + @param[in] ImageHandle Image handle of this driver. > + @param[in] SystemTable Pointer to SystemTable. > + > + @retval EFI_SUCCESS Driver has loaded successfully. > + @return Error codes from lower level functions. > + > +**/ > +EFI_STATUS > +EFIAPI > +PciHotPlugInitialize ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + mPciHotPlugInit.GetRootHpcList =3D GetRootHpcList; > + mPciHotPlugInit.InitializeRootHpc =3D InitializeRootHpc; > + mPciHotPlugInit.GetResourcePadding =3D GetResourcePadding; > + return gBS->InstallMultipleProtocolInterfaces ( > + &ImageHandle, > + &gEfiPciHotPlugInitProtocolGuid, > + &mPciHotPlugInit, > + NULL > + ); > +} > -- > 2.25.1