From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (NAM12-DM6-obe.outbound.protection.outlook.com [40.107.243.110]) by mx.groups.io with SMTP id smtpd.web10.4668.1634883625862480034 for ; Thu, 21 Oct 2021 23:20:26 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@os.amperecomputing.com header.s=selector2 header.b=JzGvZjD+; spf=pass (domain: os.amperecomputing.com, ip: 40.107.243.110, mailfrom: nhi@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZxGu0B33mzctlg0TtNwiYqf9bGX/+hceKWwTWAneKc4+NEkozmtrKXCrlbDk32UANA6RS7ASTuFhB9LI/epIK7y0PRnQEvTiwGj6l0y4bu5DViZQemiRyPgOZDlHb0ri28rf75ZsqawPauo3xBlShpS7e8r1p/Rexoh8CLc6CyFK4FPSDsi9eI9V7z2Ep5wQApoebeJ/liaOsORtbcFf2706dFKiPWD4W3MwRzwAN0dae879x008EWMjtUzccL1WYq+YqDb1a4EXMRbvQuiM72W7wMLddPdR0jqeLD/mXcUlIWNXbr6hrHIV9Rf+VQqnevUzEmxn5hy58oCOu5lETw== 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=YUNLBSkLqIq3rdbLnAD38Vd8lxJA6e8P8HUUqsiWRTQ=; b=ZE8hVwzt9TzHLg8TRYlP1sjclsUOUvZdCNmCFSLrX/OUEQVV6jBU8WDd47BWeYNEdh0gvSNRYfl8l70p5A8+xOGPSfRJexJUwpVAmGW7BGG3stnX2wt7G5h12AXACsMXMvPNcwVEArbGdoRt5WqC1AUbbdAdxkKpjDTTJw66ZHW8O1mlgbxSkzAgwEQhmxtVPwsCipDNcoaCRu3GZHQBQt1NZJwFJNNxpVyy882EdXwDBlo/2hQRw5C3iPaXZjgP7Aj6cPpiq+FfnuPcR9H/DU9jrm7HUGfeUfz9tgSdEQgz0bK0Ym6jnf81iKCH11LGRx+WGXKDa/65rYZXg1y+Ng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YUNLBSkLqIq3rdbLnAD38Vd8lxJA6e8P8HUUqsiWRTQ=; b=JzGvZjD+Ofnavm4yPOcIwHMjAnkroe2lIMip6aRSeiSeocWN4eMw0aqr6+SSyyh+VH/CLqHqSl9uTHCrvTcp1wN3gOJbFDyORc02JwFeQ+rP2o3ucSKJaoL4xYF5fFY5VUOZjM+Qu2+a3ZmTTJf7UDGqNO9manES631k6HSroq0= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=os.amperecomputing.com; Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB6325.prod.exchangelabs.com (2603:10b6:510:1e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18; Fri, 22 Oct 2021 06:20:24 +0000 Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4628.016; Fri, 22 Oct 2021 06:20:24 +0000 From: "Nhi Pham" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-platforms][PATCH v4 18/31] JadePkg: Add PciPlatformDxe driver Date: Fri, 22 Oct 2021 13:17:56 +0700 Message-ID: <20211022061809.31087-19-nhi@os.amperecomputing.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211022061809.31087-1-nhi@os.amperecomputing.com> References: <20211022061809.31087-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR02CA0168.apcprd02.prod.outlook.com (2603:1096:201:1f::28) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) Return-Path: nhi@os.amperecomputing.com MIME-Version: 1.0 Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR02CA0168.apcprd02.prod.outlook.com (2603:1096:201:1f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16 via Frontend Transport; Fri, 22 Oct 2021 06:20:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0baa55d5-d2cb-4698-d8c1-08d995240853 X-MS-TrafficTypeDiagnostic: PH0PR01MB6325: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xvlCyrvXgbvUBIMrAm08WbifZF5lJwncdKc7n4y6L8j55poj3+uFf/PgHb+etfOIYAebLYGiiXL8eoNmm6Ydc7TIe9CpfTItD88pXk+NuuoMruEeGPrPMvc3eQnOCsgxz7hm8ofgswhGJlTsPbCXnVtuOTyVKG0OR93pHNim+gqFLc3MSWC5wKH7auLRpjK+utxU7sUh60unPOeVJbkBrZnsBg4y9ApmWr+FIFLYqIo1DQnLeTXXK1zPNm0k39Hp3pc/0Hzg/IBH7nBBMxjfNByQ0uuDsvZCYMruzp4X0edT0NqRGFtTtNZvEntEawknIGC/66imeE27Pty7EiLEnSzYw1NJ6KSANcep0A07ZqduhPVlfgEoW8iJmqEswfQi6lmEFaxZbIOoPS96LI7TGj2ttiLZCSPvG/eJLHdI4E5nQ5o7D8xNBIybaA2hyxYX+SQv2NgTXppIAi227bk5049g0tVO3DFW9sBX0OUKDmmj3wXd4G705g7Uwk9C1yuauWGVUAV5MigbNWrEYt6Z7NGPJimUShYNnWCE5cLtkz2OBAqe6rfQaNAzG0LJEjWSiJMxbH2r1CH0j1ET2bX8pud7NksBl/IO295iTe8O8yUibWu+qP8IokhvXAx5SgzlE+QjfKUOrEalUqzo2eBTd77GqyPs+APtziWN5OUnJFLvrYuMHkFu6R43Fsj7vAMn0jhrVUBWnEFxAg2HLMy7np+3JucM3HJVDOogDLcyRPE= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR01MB7287.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6506007)(5660300002)(6666004)(8936002)(19627235002)(38100700002)(38350700002)(6486002)(186003)(26005)(508600001)(1076003)(316002)(8676002)(54906003)(6916009)(66476007)(66556008)(6512007)(66946007)(83380400001)(86362001)(956004)(4326008)(30864003)(2616005)(52116002)(2906002)(44824005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?KJGV+ju4I1JLNJ9p+Q42xfxEhqC5aLf3rX7tmF97o1hVtteZY2jQIpiCILZD?= =?us-ascii?Q?11BS0ewjsItqD8Bru2X+xVWg647pZWNZvVk86LsZH5fEZXRm8OGZvjHs33j2?= =?us-ascii?Q?94PRXMaSYx4wctxYN+IjqvteQjHR4A1sKibGC6UkQlguS3EuYPDqVVZqka4A?= =?us-ascii?Q?UV+u1eFAurfXxuhDVOUwUnuSgLnlEGu2hWMYa+EMRqeOVi7RRF4U19JDHSUX?= =?us-ascii?Q?g1HNFbgEj4m/XdKPeeIhAOtfI8wXAnB6mIfwiwufINUBPx4aPStV5c/LtFjH?= =?us-ascii?Q?+O0Osm6J1mnX/O0OPWFvZIvl06c4z1gv2zfyHnz/BGOo6VeWJqM/288RVo/y?= =?us-ascii?Q?x+LkwQMNRZoN1Y3rMz9Dsn2SX85/BFSTFk3pUC+rzr4ENAZzayIF3ACTMxP+?= =?us-ascii?Q?aS8CMEDrkwA1P90niyPYjLX58olDuGPFgguV766sFqc4RBjccvaDJ0X//i0P?= =?us-ascii?Q?Vg0O/AgBi/QgbaPe2pldobvxOndnOwGJ74lgZQu4jA8QXIUTKFXDJASmaSjZ?= =?us-ascii?Q?oJdzLoBBmFzZpG9O7QrzDJkMwofgwTPQUkQxgvYBqKHN9efrGAvTdUF/jdp1?= =?us-ascii?Q?FlJV7fQdnXPxAl9OTVBWvp6Ox5CGPuWSRq+nGyGIikdW2nJXetOPtezNq4a1?= =?us-ascii?Q?s+t2kSqvKzXhIxMuhrZACbDTKaSpDDvJejgbbtzL6BdAq7UowDydHK/X3YDv?= =?us-ascii?Q?DPndSEEFJY94aNDUo+oPO5CtYl4WWmb9yqORPNIgXevP3Hzi7WkpOBgOD1/0?= =?us-ascii?Q?84kqHhcTjvNT9ziXcJVmrAaq32kuniq614Zs/HWc9Sjgkr0+XQODXEVpoXp6?= =?us-ascii?Q?R+BxApqJvYpQhH1sB9Qiic48ZhUaj3ygubhgG0V+OuZzqQuudO3mfTe/sJiu?= =?us-ascii?Q?cIM0HbT8OleGlI6ABDuAkiaSimTcl4WQ03pEDhPGgqHXx66DlTNcLKi6oo5B?= =?us-ascii?Q?qSQQvAV6Vw3HnMPxDV1PUfOG9fYJAvPN8pvm1kCcCTSWLbbqGQD/7NZf+52I?= =?us-ascii?Q?+57C+MB3tZasuRsYVC+hFQzmZAFTDbPw3wMOmuQhGf98hlVSRycumO+dpD71?= =?us-ascii?Q?LDcgwadHhU1AftByYzbWf/ylf7oIB1YBkb6ywrzmHoKfBLQOWAdE2YYFUvDS?= =?us-ascii?Q?Ptaopleiid1jHFlR/XeY2N3R63o96hx0Tev7LbG78b8oXOSg4lw3+4ciPQiM?= =?us-ascii?Q?HB/pmWDJAP3A9AWKhyRr9CbsRE3qKjE+qRmrV5ClNU5FD46E6lXfca4+nfZu?= =?us-ascii?Q?lWOsiwY4I0B6LH4neQsUXoGGiER4D1jpcXGh03yeboz+ZxYj/GTmAFojIz5p?= =?us-ascii?Q?ep3K53Ee4Z7Uu5VUfRIoozKQT8hXuf5IzTwPlZDi/aDhPx+/7hPqiBDMa3Be?= =?us-ascii?Q?2EHYuTi3OCPEi+DkzU1UpRZwg+5YVr7+VMrwr8v/YiE+6EWPHi0F2R/HcALS?= =?us-ascii?Q?Ktq9i5iKeUmFJikrULzM00W07akPdreR2Azip7XUvffr5K3WvX2nvw=3D=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0baa55d5-d2cb-4698-d8c1-08d995240853 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2021 06:20:24.5239 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nhi@amperemail.onmicrosoft.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6325 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Vu Nguyen Registers the Platform NotifyPhase() to prevent unexpected issues caused by the enabled PCIe controllers with unstable link. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham Reviewed-by: Leif Lindholm --- Platform/Ampere/JadePkg/Jade.dsc | 5 + Platform/Ampere/JadePkg/Jade.fdf | 1 + Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.inf | 41 ++= ++ Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.c | 258 ++= ++++++++++++++++++ 4 files changed, 305 insertions(+) diff --git a/Platform/Ampere/JadePkg/Jade.dsc b/Platform/Ampere/JadePkg/Jad= e.dsc index 9315c1c71cc7..ffba757a6130 100644 --- a/Platform/Ampere/JadePkg/Jade.dsc +++ b/Platform/Ampere/JadePkg/Jade.dsc @@ -129,3 +129,8 @@ [Components.common] Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf Silicon/Ampere/AmpereAltraPkg/AcpiCommonTables/AcpiCommonTables.inf Platform/Ampere/JadePkg/AcpiTables/AcpiTables.inf + + # + # PCIe + # + Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.inf diff --git a/Platform/Ampere/JadePkg/Jade.fdf b/Platform/Ampere/JadePkg/Jad= e.fdf index 00184f105e6f..19e7cf16697e 100644 --- a/Platform/Ampere/JadePkg/Jade.fdf +++ b/Platform/Ampere/JadePkg/Jade.fdf @@ -299,6 +299,7 @@ [FV.FvMain] # INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf + INF Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.inf =20 # # UEFI application (Shell Embedded Boot Loader) diff --git a/Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.= inf b/Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.inf new file mode 100644 index 000000000000..ddf6eeb759eb --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.inf @@ -0,0 +1,41 @@ +## @file +# +# Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D PciPlatformDxe + FILE_GUID =3D 73276F3D-DCBC-49B2-9890-7564F917501D + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D PciPlatformDriverEntry + +[Sources] + PciPlatformDxe.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec + +[LibraryClasses] + Ac01PcieLib + DebugLib + HobLib + TimerLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Protocols] + gEfiDevicePathProtocolGuid + gEfiPciHostBridgeResourceAllocationProtocolGuid + gEfiPciPlatformProtocolGuid + +[Guids] + gRootComplexInfoHobGuid + +[Depex] + TRUE diff --git a/Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.= c b/Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.c new file mode 100644 index 000000000000..865dfb891a24 --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/PciPlatformDxe/PciPlatformDxe.c @@ -0,0 +1,258 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#pragma pack(1) +typedef struct { + ACPI_HID_DEVICE_PATH AcpiDevicePath; + EFI_DEVICE_PATH_PROTOCOL EndDevicePath; +} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH; +#pragma pack () + +/** + Callback funciton for EndEnumeration notification from PCI stack. + + @param[in] RootBridgeIndex Index to identify of PCIE Root bridge. + @param[in] Phase The phase of enumeration as informed f= rom PCI stack. +**/ +VOID +NotifyPhaseCallBack ( + IN UINTN RootBridgeIndex, + IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase + ) +{ + AC01_ROOT_COMPLEX *RootComplexList; + VOID *Hob; + + Hob =3D GetFirstGuidHob (&gRootComplexInfoHobGuid); + if (Hob =3D=3D NULL) { + return; + } + + RootComplexList =3D (AC01_ROOT_COMPLEX *)GET_GUID_HOB_DATA (Hob); + + switch (Phase) { + case EfiPciHostBridgeEndEnumeration: + Ac01PcieCoreEndEnumeration (&RootComplexList[RootBridgeIndex]); + break; + + case EfiPciHostBridgeBeginEnumeration: + // 100ms that help fixing completion timeout issue + MicroSecondDelay (100000); + break; + + case EfiPciHostBridgeBeginBusAllocation: + case EfiPciHostBridgeEndBusAllocation: + case EfiPciHostBridgeBeginResourceAllocation: + case EfiPciHostBridgeAllocateResources: + case EfiPciHostBridgeSetResources: + case EfiPciHostBridgeFreeResources: + case EfiPciHostBridgeEndResourceAllocation: + case EfiMaxPciHostBridgeEnumerationPhase: + break; + } +} + +/** + + Perform initialization by the phase indicated. + + @param This Pointer to the EFI_PCI_PLATFORM_PROTO= COL instance. + @param HostBridge The associated PCI host bridge handle= . + @param Phase The phase of the PCI controller enume= ration. + @param ChipsetPhase Defines the execution phase of the PC= I chipset driver. + + @retval EFI_SUCCESS Must return with success. + +**/ +EFI_STATUS +EFIAPI +PhaseNotify ( + IN EFI_PCI_PLATFORM_PROTOCOL *This, + IN EFI_HANDLE HostBridge, + IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase, + IN EFI_PCI_CHIPSET_EXECUTION_PHASE ChipsetPhase + ) +{ + EFI_PCI_ROOT_BRIDGE_DEVICE_PATH *RootBridgeDevPath; + EFI_HANDLE RootBridgeHandle =3D N= ULL; + EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *ResAlloc =3D NULL; + EFI_STATUS Status; + + if (ChipsetPhase !=3D ChipsetExit) { + return EFI_SUCCESS; + } + + // + // Get HostBridgeInstance from HostBridge handle. + // + Status =3D gBS->HandleProtocol ( + HostBridge, + &gEfiPciHostBridgeResourceAllocationProtocolGuid, + (VOID **)&ResAlloc + ); + + while (TRUE) { + Status =3D ResAlloc->GetNextRootBridge (ResAlloc, &RootBridgeHandle); + if (EFI_ERROR (Status)) { + break; + } + + Status =3D gBS->HandleProtocol ( + RootBridgeHandle, + &gEfiDevicePathProtocolGuid, + (VOID **)&RootBridgeDevPath + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a %d: Failed to locate RootBridge DevicePath\= n", __FUNCTION__, __LINE__)); + break; + } + + NotifyPhaseCallBack (RootBridgeDevPath->AcpiDevicePath.UID, Phase); + } + + return EFI_SUCCESS; +} + +/** + + The PlatformPrepController() function can be used to notify the platform= driver so that + it can perform platform-specific actions. No specific actions are requir= ed. + Several notification points are defined at this time. More synchronizati= on points may be + added as required in the future. The PCI bus driver calls the platform d= river twice for + every PCI controller-once before the PCI Host Bridge Resource Allocation= Protocol driver + is notified, and once after the PCI Host Bridge Resource Allocation Prot= ocol driver has + been notified. + This member function may not perform any error checking on the input par= ameters. It also + does not return any error codes. If this member function detects any err= or condition, it + needs to handle those errors on its own because there is no way to surfa= ce any errors to + the caller. + + @param This Pointer to the EFI_PCI_PLATFORM_PROTOC= OL instance. + @param HostBridge The associated PCI host bridge handle. + @param RootBridge The associated PCI root bridge handle. + @param PciAddress The address of the PCI device on the P= CI bus. + @param Phase The phase of the PCI controller enumer= ation. + @param ChipsetPhase Defines the execution phase of the PCI= chipset driver. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_UNSUPPORTED Not supported. + +**/ +EFI_STATUS +EFIAPI +PlatformPrepController ( + IN EFI_PCI_PLATFORM_PROTOCOL *This, + IN EFI_HANDLE HostBridge, + IN EFI_HANDLE RootBridge, + IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress, + IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase, + IN EFI_PCI_CHIPSET_EXECUTION_PHASE ChipsetPhase + ) +{ + return EFI_UNSUPPORTED; +} + +/** + Set the PciPolicy as EFI_RESERVE_ISA_IO_NO_ALIAS | EFI_RESERVE_VGA_IO_NO= _ALIAS. + + @param This The pointer to the Protocol itself. + @param PciPolicy The returned Policy. + + @retval EFI_UNSUPPORTED Function not supported. + @retval EFI_INVALID_PARAMETER Invalid PciPolicy value. + +**/ +EFI_STATUS +EFIAPI +GetPlatformPolicy ( + IN CONST EFI_PCI_PLATFORM_PROTOCOL *This, + OUT EFI_PCI_PLATFORM_POLICY *PciPolicy + ) +{ + return EFI_UNSUPPORTED; +} + +/** + + Return a PCI ROM image for the onboard device represented by PciHandle. + + @param This Protocol instance pointer. + @param PciHandle PCI device to return the ROM image fo= r. + @param RomImage PCI Rom Image for onboard device. + @param RomSize Size of RomImage in bytes. + + @retval EFI_SUCCESS RomImage is valid. + @retval EFI_NOT_FOUND No RomImage. + +**/ +EFI_STATUS +EFIAPI +GetPciRom ( + IN CONST EFI_PCI_PLATFORM_PROTOCOL *This, + IN EFI_HANDLE PciHandle, + OUT VOID **RomImage, + OUT UINTN *RomSize + ) +{ + return EFI_NOT_FOUND; +} + +// +// Interface defintion of PCI Platform protocol. +// +EFI_PCI_PLATFORM_PROTOCOL mPciPlatformProtocol =3D { + .PlatformNotify =3D PhaseNotify, + .PlatformPrepController =3D PlatformPrepController, + .GetPlatformPolicy =3D GetPlatformPolicy, + .GetPciRom =3D GetPciRom +}; + +/** + + The Entry point of the Pci Platform Driver. + + @param ImageHandle Handle to the image. + @param SystemTable Handle to System Table. + + @retval EFI_STATUS Status of the function calling. + +**/ +EFI_STATUS +PciPlatformDriverEntry ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_HANDLE PciPlatformHandle; + + // + // Install on a new handle + // + PciPlatformHandle =3D NULL; + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &PciPlatformHandle, + &gEfiPciPlatformProtocolGuid, + &mPciPlatformProtocol, + NULL + ); + + return Status; +} --=20 2.17.1