MdeModulePkg/PciBusDxe: reference gFullEnumeration in one file

The patch is just a code cleanup with no functionality impact.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
(cherry picked from commit 2632981783)
This commit is contained in:
Ruiyu Ni
2018-01-22 14:16:10 +08:00
parent 15bb108d5f
commit 1bfcdd264a
3 changed files with 38 additions and 42 deletions

View File

@@ -8,7 +8,7 @@
PCI Root Bridges. So it means platform needs install PCI Root Bridge IO protocol for each PCI Root Bridges. So it means platform needs install PCI Root Bridge IO protocol for each
PCI Root Bus and install PCI Host Bridge Resource Allocation Protocol. PCI Root Bus and install PCI Host Bridge Resource Allocation Protocol.
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -242,6 +242,7 @@ PciBusDriverBindingStart (
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath; EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
// //
// Check RemainingDevicePath validation // Check RemainingDevicePath validation
@@ -321,12 +322,34 @@ PciBusDriverBindingStart (
ParentDevicePath ParentDevicePath
); );
Status = EFI_SUCCESS;
// //
// Enumerate the entire host bridge // Enumerate the entire host bridge
// After enumeration, a database that records all the device information will be created // After enumeration, a database that records all the device information will be created
// //
// //
Status = PciEnumerator (Controller); if (gFullEnumeration) {
//
// Get the rootbridge Io protocol to find the host bridge handle
//
Status = gBS->OpenProtocol (
Controller,
&gEfiPciRootBridgeIoProtocolGuid,
(VOID **) &PciRootBridgeIo,
gPciBusDriverBinding.DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (!EFI_ERROR (Status)) {
Status = PciEnumerator (Controller, PciRootBridgeIo->ParentHandle);
}
} else {
//
// If PCI bus has already done the full enumeration, never do it again
//
Status = PciEnumeratorLight (Controller);
}
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
@@ -337,6 +360,7 @@ PciBusDriverBindingStart (
// //
StartPciDevices (Controller); StartPciDevices (Controller);
gFullEnumeration = FALSE;
return EFI_SUCCESS; return EFI_SUCCESS;
} }

View File

@@ -1,7 +1,7 @@
/** @file /** @file
PCI eunmeration implementation on entire PCI bus system for PCI Bus module. PCI eunmeration implementation on entire PCI bus system for PCI Bus module.
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR> (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
@@ -20,6 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
in a given platform. in a given platform.
@param Controller Parent controller handle. @param Controller Parent controller handle.
@param HostBridgeHandle Host bridge handle.
@retval EFI_SUCCESS PCI enumeration finished successfully. @retval EFI_SUCCESS PCI enumeration finished successfully.
@retval other Some error occurred when enumerating the pci bus system. @retval other Some error occurred when enumerating the pci bus system.
@@ -27,41 +28,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
EFI_STATUS EFI_STATUS
PciEnumerator ( PciEnumerator (
IN EFI_HANDLE Controller IN EFI_HANDLE Controller,
IN EFI_HANDLE HostBridgeHandle
) )
{ {
EFI_HANDLE HostBridgeHandle;
EFI_STATUS Status; EFI_STATUS Status;
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc; EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
//
// If PCI bus has already done the full enumeration, never do it again
//
if (!gFullEnumeration) {
return PciEnumeratorLight (Controller);
}
//
// Get the rootbridge Io protocol to find the host bridge handle
//
Status = gBS->OpenProtocol (
Controller,
&gEfiPciRootBridgeIoProtocolGuid,
(VOID **) &PciRootBridgeIo,
gPciBusDriverBinding.DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Get the host bridge handle
//
HostBridgeHandle = PciRootBridgeIo->ParentHandle;
// //
// Get the pci host bridge resource allocation protocol // Get the pci host bridge resource allocation protocol
@@ -132,8 +104,6 @@ PciEnumerator (
return Status; return Status;
} }
gFullEnumeration = FALSE;
Status = gBS->InstallProtocolInterface ( Status = gBS->InstallProtocolInterface (
&HostBridgeHandle, &HostBridgeHandle,
&gEfiPciEnumerationCompleteProtocolGuid, &gEfiPciEnumerationCompleteProtocolGuid,

View File

@@ -1,7 +1,7 @@
/** @file /** @file
PCI bus enumeration logic function declaration for PCI bus module. PCI bus enumeration logic function declaration for PCI bus module.
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@@ -22,6 +22,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
in a given platform. in a given platform.
@param Controller Parent controller handle. @param Controller Parent controller handle.
@param HostBridgeHandle Host bridge handle.
@retval EFI_SUCCESS PCI enumeration finished successfully. @retval EFI_SUCCESS PCI enumeration finished successfully.
@retval other Some error occurred when enumerating the pci bus system. @retval other Some error occurred when enumerating the pci bus system.
@@ -29,7 +30,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
EFI_STATUS EFI_STATUS
PciEnumerator ( PciEnumerator (
IN EFI_HANDLE Controller IN EFI_HANDLE Controller,
IN EFI_HANDLE HostBridgeHandle
); );
/** /**