/** @file\r
Supporting functions implementaion for PCI devices management.\r
\r
-Copyright (c) 2006 - 2009, Intel Corporation \r
-All rights reserved. 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
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+Copyright (c) 2006 - 2009, Intel Corporation\r
+All rights reserved. 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
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
**/\r
\r
\r
/**\r
Destroy root bridge and remove it from deivce tree.\r
- \r
+\r
@param RootBridge The bridge want to be removed.\r
- \r
+\r
**/\r
VOID\r
DestroyRootBridge (\r
}\r
\r
/**\r
- This function registers the PCI IO device. \r
+ This function registers the PCI IO device.\r
\r
- It creates a handle for this PCI IO device (if the handle does not exist), attaches \r
- appropriate protocols onto the handle, does necessary initialization, and sets up \r
+ It creates a handle for this PCI IO device (if the handle does not exist), attaches\r
+ appropriate protocols onto the handle, does necessary initialization, and sets up\r
parent/child relationship with its bus controller.\r
\r
@param Controller An EFI handle for the PCI bus controller.\r
@param Handle A pointer to hold the returned EFI handle for the PCI IO device.\r
\r
@retval EFI_SUCCESS The PCI device is successfully registered.\r
- @retval Others An error occurred when registering the PCI device.\r
+ @retval other An error occurred when registering the PCI device.\r
\r
**/\r
EFI_STATUS\r
if (!EFI_ERROR (Status)) {\r
PciIoDevice->IsPciExp = TRUE;\r
}\r
- \r
+\r
//\r
// Force Interrupt line to "Unknown" or "No Connection"\r
//\r
PciIo = &(PciIoDevice->PciIo);\r
Data8 = PCI_INT_LINE_UNKNOWN;\r
- PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &Data8);\r
+ PciIo->Pci.Write (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &Data8);\r
\r
//\r
// Process OpRom\r
\r
if (PciIoDevice->BusOverride) {\r
//\r
- // Install BusSpecificDriverOverride Protocol\r
+ // Install Bus Specific Driver Override Protocol\r
//\r
Status = gBS->InstallMultipleProtocolInterfaces (\r
&PciIoDevice->Handle,\r
@param Handle PCI device handle.\r
\r
@retval EFI_SUCCESS The PCI device is successfully de-registered.\r
- @retval Others An error occurred when de-registering the PCI device.\r
+ @retval other An error occurred when de-registering the PCI device.\r
\r
**/\r
EFI_STATUS\r
);\r
\r
//\r
- // Un-install the device path protocol and pci io protocol\r
+ // Un-install the Device Path protocol and PCI I/O protocol\r
+ // and Bus Specific Driver Override protocol if needed.\r
//\r
if (PciIoDevice->BusOverride) {\r
Status = gBS->UninstallMultipleProtocolInterfaces (\r
\r
@retval EFI_NOT_READY Device is not allocated.\r
@retval EFI_UNSUPPORTED Device only support PCI-PCI bridge.\r
- @retval EFI_NOT_FOUND Can not find the specific device\r
- @retval EFI_SUCCESS Success to start Pci device on bridge\r
+ @retval EFI_NOT_FOUND Can not find the specific device.\r
+ @retval EFI_SUCCESS Success to start Pci device on bridge.\r
\r
**/\r
EFI_STATUS\r
\r
Node.DevPath = RemainingDevicePath;\r
\r
- if (Node.Pci->Device != PciIoDevice->DeviceNumber || \r
+ if (Node.Pci->Device != PciIoDevice->DeviceNumber ||\r
Node.Pci->Function != PciIoDevice->FunctionNumber) {\r
CurrentLink = CurrentLink->ForwardLink;\r
continue;\r
if (!PciIoDevice->Allocated) {\r
return EFI_NOT_READY;\r
}\r
- \r
+\r
//\r
// Check if the current node has been registered before\r
// If it is not, register it\r
ChildHandleBuffer[*NumberOfChildren] = PciIoDevice->Handle;\r
(*NumberOfChildren)++;\r
}\r
- \r
+\r
//\r
// Get the next device path\r
//\r
}\r
\r
/**\r
- Start to manage all the PCI devices it found previously under \r
+ Start to manage all the PCI devices it found previously under\r
the entire host bridge.\r
\r
@param Controller The root bridge handle.\r
\r
+ @retval EFI_NOT_READY Device is not allocated.\r
+ @retval EFI_SUCCESS Success to start Pci device on host bridge.\r
+\r
**/\r
EFI_STATUS\r
StartPciDevices (\r
IN EFI_HANDLE Controller\r
)\r
-\r
{\r
+ EFI_STATUS Status;\r
PCI_IO_DEVICE *RootBridge;\r
EFI_HANDLE ThisHostBridge;\r
LIST_ENTRY *CurrentLink;\r
// Locate the right root bridge to start\r
//\r
if (RootBridge->PciRootBridgeIo->ParentHandle == ThisHostBridge) {\r
- StartPciDevicesOnBridge (\r
- RootBridge->Handle,\r
- RootBridge,\r
- NULL,\r
- NULL,\r
- NULL\r
- );\r
+ Status = StartPciDevicesOnBridge (\r
+ RootBridge->Handle,\r
+ RootBridge,\r
+ NULL,\r
+ NULL,\r
+ NULL\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
}\r
\r
CurrentLink = CurrentLink->ForwardLink;\r
\r
/**\r
Judege whether Pci device existed.\r
- \r
+\r
@param Bridge Parent bridege instance.\r
@param PciIoDevice Device instance.\r
- \r
+\r
@retval TRUE Pci device existed.\r
@retval FALSE Pci device did not exist.\r
\r
\r
/**\r
Get the active VGA device on the same segment.\r
- \r
+\r
@param VgaDevice PCI IO instance for the VGA device.\r
- \r
+\r
@return The active VGA device on the same segment.\r
\r
**/\r
\r
/**\r
Get the active VGA device on the root bridge.\r
- \r
+\r
@param RootBridge PCI IO instance for the root bridge.\r
- \r
+\r
@return The active VGA device.\r
\r
**/\r
@param RootBridge Root bridege Io instance.\r
@param RemainingDevicePath Given searching device path.\r
@param PciAddress Buffer holding searched result.\r
- \r
+\r
@retval EFI_SUCCESS PCI address was stored in PciAddress\r
@retval EFI_NOT_FOUND Can not find the specific device path.\r
- \r
+\r
**/\r
EFI_STATUS\r
GetHpcPciAddressFromRootBridge (\r