/** @file\r
PCI eunmeration implementation on entire PCI bus system for PCI Bus module.\r
\r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
IN EFI_HANDLE Controller\r
)\r
{\r
- EFI_HANDLE Handle;\r
EFI_HANDLE HostBridgeHandle;\r
EFI_STATUS Status;\r
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc;\r
//\r
// Notify the pci bus enumeration is about to begin\r
//\r
- NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginEnumeration);\r
+ Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginEnumeration);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
\r
//\r
// Start the bus allocation phase\r
//\r
// Notify the pci bus enumeration is about to complete\r
//\r
- NotifyPhase (PciResAlloc, EfiPciHostBridgeEndEnumeration);\r
+ Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeEndEnumeration);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
\r
//\r
// Process P2C\r
\r
gFullEnumeration = FALSE;\r
\r
- Handle = NULL;\r
Status = gBS->InstallProtocolInterface (\r
- &Handle,\r
+ &HostBridgeHandle,\r
&gEfiPciEnumerationCompleteProtocolGuid,\r
EFI_NATIVE_INTERFACE,\r
NULL\r
Func\r
);\r
\r
+ if (EFI_ERROR (Status) && Func == 0) {\r
+ //\r
+ // go to next device if there is no Function 0\r
+ //\r
+ break;\r
+ }\r
+\r
if (!EFI_ERROR (Status) &&\r
(IS_PCI_BRIDGE (&Pci) || IS_CARDBUS_BRIDGE (&Pci))) {\r
\r
if (Temp == PciDevice) {\r
InitializePciDevice (Temp);\r
RemoveEntryList (CurrentLink);\r
- FreePciDevice (Temp);\r
return EFI_SUCCESS;\r
}\r
\r
//\r
Status = RejectPciDevice (PciResNode->PciDev);\r
if (Status == EFI_SUCCESS) {\r
+ DEBUG ((\r
+ EFI_D_ERROR,\r
+ "PciBus: [%02x|%02x|%02x] was rejected due to resource confliction.\n",\r
+ PciResNode->PciDev->BusNumber, PciResNode->PciDev->DeviceNumber, PciResNode->PciDev->FunctionNumber\r
+ ));\r
\r
//\r
// Raise the EFI_IOB_EC_RESOURCE_CONFLICT status code\r
//\r
// If there is no resource request\r
//\r
- Configuration = AllocateZeroPool (sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR));\r
+ Configuration = AllocateZeroPool (sizeof (EFI_ACPI_END_TAG_DESCRIPTOR));\r
if (Configuration == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
- Ptr = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) (Configuration);\r
- Ptr->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR;\r
-\r
- PtrEnd = (EFI_ACPI_END_TAG_DESCRIPTOR *) (Ptr + 1);\r
+ PtrEnd = (EFI_ACPI_END_TAG_DESCRIPTOR *) (Configuration);\r
PtrEnd->Desc = ACPI_END_TAG_DESCRIPTOR;\r
PtrEnd->Checksum = 0;\r
}\r
);\r
}\r
\r
- return EFI_SUCCESS;\r
+ return Status;\r
}\r
\r
/**\r
RootBridgeHandle = Temp->Handle;\r
\r
if (Operation == EfiPciHotPlugRequestAdd) {\r
+ //\r
+ // Report Status Code to indicate hot plug happens\r
+ //\r
+ REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+ EFI_PROGRESS_CODE,\r
+ (EFI_IO_BUS_PCI | EFI_IOB_PC_HOTPLUG),\r
+ Temp->DevicePath\r
+ );\r
\r
if (NumberOfChildren != NULL) {\r
*NumberOfChildren = 0;\r