30EFI_HANDLE gPciHostBrigeHandles[PCI_MAX_HOST_BRIDGE_NUM];
32UINTN gPciHostBridgeNumber = 0;
33BOOLEAN gFullEnumeration =
TRUE;
34UINT64 gAllOne = 0xFFFFFFFFFFFFFFFFULL;
82 &gPciBusDriverBinding,
84 &gPciBusComponentName,
85 &gPciBusComponentName2
94 Status =
gBS->InstallProtocolInterface (
96 &gEfiPciHotPlugRequestProtocolGuid,
135 if (RemainingDevicePath !=
NULL) {
145 Node.DevPath = RemainingDevicePath;
150 return EFI_UNSUPPORTED;
158 Status =
gBS->OpenProtocol (
160 &gEfiPciRootBridgeIoProtocolGuid,
161 (VOID **)&PciRootBridgeIo,
162 This->DriverBindingHandle,
164 EFI_OPEN_PROTOCOL_BY_DRIVER
166 if (Status == EFI_ALREADY_STARTED) {
170 if (EFI_ERROR (Status)) {
179 &gEfiPciRootBridgeIoProtocolGuid,
180 This->DriverBindingHandle,
187 Status =
gBS->OpenProtocol (
189 &gEfiDevicePathProtocolGuid,
190 (VOID **)&ParentDevicePath,
191 This->DriverBindingHandle,
193 EFI_OPEN_PROTOCOL_BY_DRIVER
195 if (Status == EFI_ALREADY_STARTED) {
199 if (EFI_ERROR (Status)) {
208 &gEfiDevicePathProtocolGuid,
209 This->DriverBindingHandle,
245 PciRootBridgeIo =
NULL;
250 if (RemainingDevicePath !=
NULL) {
260 gBS->LocateProtocol (
261 &gEfiIncompatiblePciDeviceSupportProtocolGuid,
263 (VOID **)&gIncompatiblePciDeviceSupport
270 gPciPlatformProtocol =
NULL;
271 gBS->LocateProtocol (
272 &gEfiPciPlatformProtocolGuid,
274 (VOID **)&gPciPlatformProtocol
280 if (gPciPlatformProtocol ==
NULL) {
281 gPciOverrideProtocol =
NULL;
282 gBS->LocateProtocol (
283 &gEfiPciOverrideProtocolGuid,
285 (VOID **)&gPciOverrideProtocol
289 if (mIoMmuProtocol ==
NULL) {
290 gBS->LocateProtocol (
293 (VOID **)&mIoMmuProtocol
297 if (mDeviceSecurityProtocol ==
NULL) {
298 gBS->LocateProtocol (
301 (VOID **)&mDeviceSecurityProtocol
305 if (
PcdGetBool (PcdPciDisableBusEnumeration)) {
306 gFullEnumeration =
FALSE;
314 Status =
gBS->OpenProtocol (
316 &gEfiDevicePathProtocolGuid,
317 (VOID **)&ParentDevicePath,
318 This->DriverBindingHandle,
320 EFI_OPEN_PROTOCOL_GET_PROTOCOL
339 if (gFullEnumeration) {
343 Status =
gBS->OpenProtocol (
345 &gEfiPciRootBridgeIoProtocolGuid,
346 (VOID **)&PciRootBridgeIo,
349 EFI_OPEN_PROTOCOL_GET_PROTOCOL
352 if (!EFI_ERROR (Status)) {
353 Status =
PciEnumerator (Controller, PciRootBridgeIo->ParentHandle);
362 if (EFI_ERROR (Status)) {
371 if (gFullEnumeration) {
372 gFullEnumeration =
FALSE;
374 Status =
gBS->InstallProtocolInterface (
376 &gEfiPciEnumerationCompleteProtocolGuid,
411 BOOLEAN AllChildrenStopped;
413 if (NumberOfChildren == 0) {
419 &gEfiDevicePathProtocolGuid,
420 This->DriverBindingHandle,
425 &gEfiPciRootBridgeIoProtocolGuid,
426 This->DriverBindingHandle,
441 AllChildrenStopped =
TRUE;
443 for (Index = 0; Index < NumberOfChildren; Index++) {
449 if (EFI_ERROR (Status)) {
450 AllChildrenStopped =
FALSE;
454 if (!AllChildrenStopped) {
455 return EFI_DEVICE_ERROR;
#define HARDWARE_DEVICE_PATH
UINTN EFIAPI DevicePathNodeLength(IN CONST VOID *Node)
BOOLEAN EFIAPI IsDevicePathEnd(IN CONST VOID *Node)
EFI_GUID gEdkiiDeviceSecurityProtocolGuid
#define GLOBAL_REMOVE_IF_UNREFERENCED
#define ASSERT_EFI_ERROR(StatusParameter)
#define REPORT_STATUS_CODE_WITH_DEVICE_PATH(Type, Value, DevicePathParameter)
#define PcdGetBool(TokenName)
#define FeaturePcdGet(TokenName)
EFI_STATUS EFIAPI PciBusDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS EFIAPI PciBusDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS EFIAPI PciBusEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI PciBusDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
EFI_STATUS DeRegisterPciDevice(IN EFI_HANDLE Controller, IN EFI_HANDLE Handle)
EFI_STATUS DestroyRootBridgeByHandle(IN EFI_HANDLE Controller)
VOID InitializePciDevicePool(VOID)
EFI_STATUS StartPciDevices(IN EFI_HANDLE Controller)
EFI_STATUS EFIAPI PciHotPlugRequestNotify(IN EFI_PCI_HOTPLUG_REQUEST_PROTOCOL *This, IN EFI_PCI_HOTPLUG_OPERATION Operation, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL, IN OUT UINT8 *NumberOfChildren, IN OUT EFI_HANDLE *ChildHandleBuffer)
BOOLEAN SearchHostBridgeHandle(IN EFI_HANDLE RootBridgeHandle)
EFI_STATUS PciEnumerator(IN EFI_HANDLE Controller, IN EFI_HANDLE HostBridgeHandle)
EFI_STATUS PciEnumeratorLight(IN EFI_HANDLE Controller)
#define EFI_PROGRESS_CODE
EFI_GUID gEdkiiIoMmuProtocolGuid
EFI_STATUS EFIAPI EfiLibInstallDriverBindingComponentName2(IN CONST EFI_HANDLE ImageHandle, IN CONST EFI_SYSTEM_TABLE *SystemTable, IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, IN EFI_HANDLE DriverBindingHandle, IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL, IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL)
EFI_HANDLE DriverBindingHandle