diff options
author | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-06-25 13:47:45 +0000 |
---|---|---|
committer | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-06-25 13:47:45 +0000 |
commit | 8e8227d1a3d7361dcc3b3080509903c7b96b57f4 (patch) | |
tree | c6a6124e5bc10c4c748c7d568759fb73bf492bd2 /IntelFrameworkModulePkg/Bus | |
parent | 745ed9b412dc18d9e189e754a2303ceb7a76fe5f (diff) | |
download | edk2-platforms-8e8227d1a3d7361dcc3b3080509903c7b96b57f4.tar.xz |
Code scrub for PCI Bus module and PciIncompatibleDeviceSupportLib module.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8662 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg/Bus')
29 files changed, 3359 insertions, 3909 deletions
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/ComponentName.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/ComponentName.c index 634952ad1b..47eba5fdbe 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/ComponentName.c +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/ComponentName.c @@ -1,13 +1,14 @@ /** @file
+ EFI Component Name functions implementation for PCI Bus module.
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/ComponentName.h b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/ComponentName.h index 28ca7e0e5f..ee30e86725 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/ComponentName.h +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/ComponentName.h @@ -1,13 +1,14 @@ /** @file
+ EFI Component Name functions declaration for PCI Bus module.
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.c index 2feab943e2..7af1b10f7e 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.c +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.c @@ -1,14 +1,21 @@ /** @file
Driver Binding functions for PCI Bus module.
-
-Copyright (c) 2006 - 2009, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+ Single PCI bus driver instance will manager all PCI Root Bridges in one EFI based firmware,
+ since all PCI Root Bridges' resources need to be managed together.
+ Supported() function will try to get PCI Root Bridge IO Protocol.
+ Start() function will get PCI Host Bridge Resource Allocation Protocol to manage all
+ 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.
+
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
@@ -51,7 +58,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_PCI_HOTPLUG_REQUEST_PROTOCOL mPciHotPlugReques @param[in] SystemTable A pointer to the EFI System Table.
@retval EFI_SUCCESS The entry point is executed successfully.
- @retval other Some error occurs when executing this entry point.
+ @retval other Some error occurred when executing this entry point.
**/
EFI_STATUS
@@ -63,7 +70,7 @@ PciBusEntryPoint ( {
EFI_STATUS Status;
EFI_HANDLE Handle;
-
+
//
// Initializes PCI devices pool
//
@@ -83,7 +90,7 @@ PciBusEntryPoint ( ASSERT_EFI_ERROR (Status);
if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
- //
+ //
// If Hot Plug is supported, install EFI PCI Hot Plug Request protocol.
//
Handle = NULL;
@@ -159,6 +166,9 @@ PciBusDriverBindingSupported ( Controller
);
+ //
+ // Check if Pci Root Bridge IO protocol is installed by platform
+ //
Status = gBS->OpenProtocol (
Controller,
&gEfiPciRootBridgeIoProtocolGuid,
@@ -238,7 +248,7 @@ PciBusDriverBindingStart ( if (EFI_ERROR (Status)) {
return Status;
}
-
+
//
// Start all the devices under the entire host bridge.
//
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.h b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.h index 9a0051e442..a587d9ee97 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.h +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.h @@ -99,6 +99,26 @@ struct _PCI_BAR { UINT8 Offset;
};
+//
+// defined in PCI Card Specification, 8.0
+//
+#define PCI_CARD_MEMORY_BASE_0 0x1C
+#define PCI_CARD_MEMORY_LIMIT_0 0x20
+#define PCI_CARD_MEMORY_BASE_1 0x24
+#define PCI_CARD_MEMORY_LIMIT_1 0x28
+#define PCI_CARD_IO_BASE_0_LOWER 0x2C
+#define PCI_CARD_IO_BASE_0_UPPER 0x2E
+#define PCI_CARD_IO_LIMIT_0_LOWER 0x30
+#define PCI_CARD_IO_LIMIT_0_UPPER 0x32
+#define PCI_CARD_IO_BASE_1_LOWER 0x34
+#define PCI_CARD_IO_BASE_1_UPPER 0x36
+#define PCI_CARD_IO_LIMIT_1_LOWER 0x38
+#define PCI_CARD_IO_LIMIT_1_UPPER 0x3A
+#define PCI_CARD_BRIDGE_CONTROL 0x3E
+
+#define PCI_CARD_PREFETCHABLE_MEMORY_0_ENABLE BIT8
+#define PCI_CARD_PREFETCHABLE_MEMORY_1_ENABLE BIT9
+
#define PPB_BAR_0 0
#define PPB_BAR_1 1
#define PPB_IO_RANGE 2
@@ -261,7 +281,7 @@ extern UINT64 gAllZero; extern EFI_PCI_PLATFORM_PROTOCOL *gPciPlatformProtocol;
-/**
+/**
Macro that checks whether device is a GFX device.
@param _p Specified device.
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf index 3cdab7e8d6..14fb83e6c4 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf @@ -89,8 +89,8 @@ [Protocols]
gEfiPciHotPlugRequestProtocolGuid ## BY_START
gEfiPciIoProtocolGuid ## BY_START
- gEfiDevicePathProtocolGuid ## BY_START
- gEfiBusSpecificDriverOverrideProtocolGuid ## CONSUMED
+ gEfiDevicePathProtocolGuid ## BY_START
+ gEfiBusSpecificDriverOverrideProtocolGuid ## BY_START
gEfiLoadedImageProtocolGuid ## CONSUMED
gEfiDecompressProtocolGuid ## CONSUMED
gEfiPciHotPlugInitProtocolGuid ## CONSUMED
@@ -106,4 +106,10 @@ [Pcd.common]
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPciIncompatibleDeviceSupportMask
-
+# [Event]
+# ##
+# # Notify event set by CreateEventForHpc () for PCI Hot Plug controller.
+# #
+# EVT_NOTIFY_SIGNAL ## PRODUCES
+#
+#
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciCommand.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciCommand.c index 31bdd8d234..ab9d3a0025 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciCommand.c +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciCommand.c @@ -1,31 +1,30 @@ /** @file
- This module implement Pci register operation interface for
- Pci device.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+ PCI command register operations supporting functions implementation for PCI Bus module.
-**/
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
#include "PciBus.h"
/**
Operate the PCI register via PciIo function interface.
-
- @param PciIoDevice Pointer to instance of PCI_IO_DEVICE
- @param Command Operator command
+
+ @param PciIoDevice Pointer to instance of PCI_IO_DEVICE.
+ @param Command Operator command.
@param Offset The address within the PCI configuration space for the PCI controller.
- @param Operation Type of Operation
- @param PtrCommand Return buffer holding old PCI command, if operation is not EFI_SET_REGISTER
-
- @return status of PciIo operation
+ @param Operation Type of Operation.
+ @param PtrCommand Return buffer holding old PCI command, if operation is not EFI_SET_REGISTER.
+
+ @return Status of PciIo operation.
+
**/
EFI_STATUS
PciOperateRegister (
@@ -76,19 +75,19 @@ PciOperateRegister ( }
/**
- check the cpability of this device supports
-
- @param PciIoDevice Pointer to instance of PCI_IO_DEVICE
-
- @retval TRUE Support
- @retval FALSE Not support.
+ Check the cpability supporting by given device.
+
+ @param PciIoDevice Pointer to instance of PCI_IO_DEVICE.
+
+ @retval TRUE Cpability supportted.
+ @retval FALSE Cpability not supportted.
+
**/
BOOLEAN
PciCapabilitySupport (
IN PCI_IO_DEVICE *PciIoDevice
)
{
-
if ((PciIoDevice->Pci.Hdr.Status & EFI_PCI_STATUS_CAPABILITY) != 0) {
return TRUE;
}
@@ -97,16 +96,17 @@ PciCapabilitySupport ( }
/**
- Locate cap reg.
-
- @param PciIoDevice - A pointer to the PCI_IO_DEVICE.
- @param CapId - The cap ID.
- @param Offset - A pointer to the offset.
- @param NextRegBlock - A pointer to the next block.
-
- @retval EFI_UNSUPPORTED Pci device does not support
+ Locate capability register block per capability ID.
+
+ @param PciIoDevice A pointer to the PCI_IO_DEVICE.
+ @param CapId The capability ID.
+ @param Offset A pointer to the offset returned.
+ @param NextRegBlock A pointer to the next block returned.
+
+ @retval EFI_SUCCESS Successfuly located capability register block.
+ @retval EFI_UNSUPPORTED Pci device does not support capability.
@retval EFI_NOT_FOUND Pci device support but can not find register block.
- @retval EFI_SUCCESS Success to locate capability register block
+
**/
EFI_STATUS
LocateCapabilityRegBlock (
@@ -135,32 +135,32 @@ LocateCapabilityRegBlock ( if (IS_CARDBUS_BRIDGE (&PciIoDevice->Pci)) {
PciIoRead (
- &PciIoDevice->PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_CARDBUS_BRIDGE_CAPABILITY_PTR,
- 1,
- &CapabilityPtr
- );
+ &PciIoDevice->PciIo,
+ EfiPciIoWidthUint8,
+ EFI_PCI_CARDBUS_BRIDGE_CAPABILITY_PTR,
+ 1,
+ &CapabilityPtr
+ );
} else {
PciIoRead (
- &PciIoDevice->PciIo,
- EfiPciIoWidthUint8,
- PCI_CAPBILITY_POINTER_OFFSET,
- 1,
- &CapabilityPtr
- );
+ &PciIoDevice->PciIo,
+ EfiPciIoWidthUint8,
+ PCI_CAPBILITY_POINTER_OFFSET,
+ 1,
+ &CapabilityPtr
+ );
}
}
while ((CapabilityPtr >= 0x40) && ((CapabilityPtr & 0x03) == 0x00)) {
PciIoRead (
- &PciIoDevice->PciIo,
- EfiPciIoWidthUint16,
- CapabilityPtr,
- 1,
- &CapabilityEntry
- );
+ &PciIoDevice->PciIo,
+ EfiPciIoWidthUint16,
+ CapabilityPtr,
+ 1,
+ &CapabilityEntry
+ );
CapabilityID = (UINT8) CapabilityEntry;
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciCommand.h b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciCommand.h index 73c8c2cb77..7019b5ea19 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciCommand.h +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciCommand.h @@ -1,13 +1,14 @@ /** @file
+ PCI command register operations supporting functions declaration for PCI Bus module.
-Copyright (c) 2006 - 2009, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
@@ -32,7 +33,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. //
// The PCI Bridge Control register bits owned by PCI Bus driver.
-//
+//
// They should be cleared at the beginning. The other registers
// are owned by chipset, we should not touch them.
//
@@ -45,7 +46,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. //
// The PCCard Bridge Control register bits owned by PCI Bus driver.
-//
+//
// They should be cleared at the beginning. The other registers
// are owned by chipset, we should not touch them.
//
@@ -63,14 +64,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. /**
Operate the PCI register via PciIo function interface.
-
- @param PciIoDevice Pointer to instance of PCI_IO_DEVICE
- @param Command Operator command
+
+ @param PciIoDevice Pointer to instance of PCI_IO_DEVICE.
+ @param Command Operator command.
@param Offset The address within the PCI configuration space for the PCI controller.
- @param Operation Type of Operation
- @param PtrCommand Return buffer holding old PCI command, if operation is not EFI_SET_REGISTER
-
- @return status of PciIo operation
+ @param Operation Type of Operation.
+ @param PtrCommand Return buffer holding old PCI command, if operation is not EFI_SET_REGISTER.
+
+ @return Status of PciIo operation.
+
**/
EFI_STATUS
PciOperateRegister (
@@ -82,12 +84,13 @@ PciOperateRegister ( );
/**
- check the cpability of this device supports
-
- @param PciIoDevice Pointer to instance of PCI_IO_DEVICE
-
- @retval TRUE Support
- @retval FALSE Not support.
+ Check the cpability supporting by given device.
+
+ @param PciIoDevice Pointer to instance of PCI_IO_DEVICE.
+
+ @retval TRUE Cpability supportted.
+ @retval FALSE Cpability not supportted.
+
**/
BOOLEAN
PciCapabilitySupport (
@@ -95,16 +98,17 @@ PciCapabilitySupport ( );
/**
- Locate cap reg.
-
- @param PciIoDevice - A pointer to the PCI_IO_DEVICE.
- @param CapId - The cap ID.
- @param Offset - A pointer to the offset.
- @param NextRegBlock - A pointer to the next block.
-
- @retval EFI_UNSUPPORTED Pci device does not support
+ Locate capability register block per capability ID.
+
+ @param PciIoDevice A pointer to the PCI_IO_DEVICE.
+ @param CapId The capability ID.
+ @param Offset A pointer to the offset returned.
+ @param NextRegBlock A pointer to the next block returned.
+
+ @retval EFI_SUCCESS Successfuly located capability register block.
+ @retval EFI_UNSUPPORTED Pci device does not support capability.
@retval EFI_NOT_FOUND Pci device support but can not find register block.
- @retval EFI_SUCCESS Success to locate capability register block
+
**/
EFI_STATUS
LocateCapabilityRegBlock (
@@ -114,99 +118,99 @@ LocateCapabilityRegBlock ( OUT UINT8 *NextRegBlock OPTIONAL
);
-/**
+/**
Macro that reads command register.
@param a[in] Pointer to instance of PCI_IO_DEVICE.
@param b[out] Pointer to the 16-bit value read from command register.
-
+
@return status of PciIo operation
**/
#define PCI_READ_COMMAND_REGISTER(a,b) \
PciOperateRegister (a, 0, PCI_COMMAND_OFFSET, EFI_GET_REGISTER, b)
-/**
+/**
Macro that writes command register.
@param a[in] Pointer to instance of PCI_IO_DEVICE.
@param b[in] The 16-bit value written into command register.
-
+
@return status of PciIo operation
**/
#define PCI_SET_COMMAND_REGISTER(a,b) \
PciOperateRegister (a, b, PCI_COMMAND_OFFSET, EFI_SET_REGISTER, NULL)
-/**
+/**
Macro that enables command register.
@param a[in] Pointer to instance of PCI_IO_DEVICE.
@param b[in] The enabled value written into command register.
-
+
@return status of PciIo operation
-**/
+**/
#define PCI_ENABLE_COMMAND_REGISTER(a,b) \
PciOperateRegister (a, b, PCI_COMMAND_OFFSET, EFI_ENABLE_REGISTER, NULL)
-/**
+/**
Macro that disalbes command register.
@param a[in] Pointer to instance of PCI_IO_DEVICE.
@param b[in] The disabled value written into command register.
-
+
@return status of PciIo operation
-**/
+**/
#define PCI_DISABLE_COMMAND_REGISTER(a,b) \
PciOperateRegister (a, b, PCI_COMMAND_OFFSET, EFI_DISABLE_REGISTER, NULL)
-/**
+/**
Macro that reads PCI bridge control register.
@param a[in] Pointer to instance of PCI_IO_DEVICE.
@param b[out] The 16-bit value read from control register.
-
+
@return status of PciIo operation
**/
#define PCI_READ_BRIDGE_CONTROL_REGISTER(a,b) \
PciOperateRegister (a, 0, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_GET_REGISTER, b)
-/**
+/**
Macro that writes PCI bridge control register.
@param a[in] Pointer to instance of PCI_IO_DEVICE.
@param b[in] The 16-bit value written into control register.
-
+
@return status of PciIo operation
-**/
+**/
#define PCI_SET_BRIDGE_CONTROL_REGISTER(a,b) \
PciOperateRegister (a, b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_SET_REGISTER, NULL)
-/**
+/**
Macro that enables PCI bridge control register.
@param a[in] Pointer to instance of PCI_IO_DEVICE.
@param b[in] The enabled value written into command register.
-
+
@return status of PciIo operation
**/
#define PCI_ENABLE_BRIDGE_CONTROL_REGISTER(a,b) \
PciOperateRegister (a, b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_ENABLE_REGISTER, NULL)
-/**
+/**
Macro that disalbes PCI bridge control register.
@param a[in] Pointer to instance of PCI_IO_DEVICE.
@param b[in] The disabled value written into command register.
-
+
@return status of PciIo operation
-**/
+**/
#define PCI_DISABLE_BRIDGE_CONTROL_REGISTER(a,b) \
PciOperateRegister (a, b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_DISABLE_REGISTER, NULL)
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c index 4872e2206e..71a5cb3810 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c @@ -1,14 +1,14 @@ /** @file
Supporting functions implementaion for PCI devices management.
-Copyright (c) 2006 - 2009, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
@@ -66,9 +66,9 @@ InsertPciDevice ( /**
Destroy root bridge and remove it from deivce tree.
-
+
@param RootBridge The bridge want to be removed.
-
+
**/
VOID
DestroyRootBridge (
@@ -187,10 +187,10 @@ DestroyRootBridgeByHandle ( }
/**
- This function registers the PCI IO device.
+ This function registers the PCI IO device.
- It creates a handle for this PCI IO device (if the handle does not exist), attaches
- appropriate protocols onto the handle, does necessary initialization, and sets up
+ It creates a handle for this PCI IO device (if the handle does not exist), attaches
+ appropriate protocols onto the handle, does necessary initialization, and sets up
parent/child relationship with its bus controller.
@param Controller An EFI handle for the PCI bus controller.
@@ -198,7 +198,7 @@ DestroyRootBridgeByHandle ( @param Handle A pointer to hold the returned EFI handle for the PCI IO device.
@retval EFI_SUCCESS The PCI device is successfully registered.
- @retval Others An error occurred when registering the PCI device.
+ @retval other An error occurred when registering the PCI device.
**/
EFI_STATUS
@@ -244,7 +244,7 @@ RegisterPciDevice ( if (!EFI_ERROR (Status)) {
PciIoDevice->IsPciExp = TRUE;
}
-
+
//
// Force Interrupt line to "Unknown" or "No Connection"
//
@@ -330,7 +330,7 @@ RegisterPciDevice ( if (PciIoDevice->BusOverride) {
//
- // Install BusSpecificDriverOverride Protocol
+ // Install Bus Specific Driver Override Protocol
//
Status = gBS->InstallMultipleProtocolInterfaces (
&PciIoDevice->Handle,
@@ -437,7 +437,7 @@ RemoveAllPciDeviceOnBridge ( @param Handle PCI device handle.
@retval EFI_SUCCESS The PCI device is successfully de-registered.
- @retval Others An error occurred when de-registering the PCI device.
+ @retval other An error occurred when de-registering the PCI device.
**/
EFI_STATUS
@@ -503,7 +503,8 @@ DeRegisterPciDevice ( );
//
- // Un-install the device path protocol and pci io protocol
+ // Un-install the Device Path protocol and PCI I/O protocol
+ // and Bus Specific Driver Override protocol if needed.
//
if (PciIoDevice->BusOverride) {
Status = gBS->UninstallMultipleProtocolInterfaces (
@@ -595,8 +596,8 @@ DeRegisterPciDevice ( @retval EFI_NOT_READY Device is not allocated.
@retval EFI_UNSUPPORTED Device only support PCI-PCI bridge.
- @retval EFI_NOT_FOUND Can not find the specific device
- @retval EFI_SUCCESS Success to start Pci device on bridge
+ @retval EFI_NOT_FOUND Can not find the specific device.
+ @retval EFI_SUCCESS Success to start Pci device on bridge.
**/
EFI_STATUS
@@ -625,7 +626,7 @@ StartPciDevicesOnBridge ( Node.DevPath = RemainingDevicePath;
- if (Node.Pci->Device != PciIoDevice->DeviceNumber ||
+ if (Node.Pci->Device != PciIoDevice->DeviceNumber ||
Node.Pci->Function != PciIoDevice->FunctionNumber) {
CurrentLink = CurrentLink->ForwardLink;
continue;
@@ -637,7 +638,7 @@ StartPciDevicesOnBridge ( if (!PciIoDevice->Allocated) {
return EFI_NOT_READY;
}
-
+
//
// Check if the current node has been registered before
// If it is not, register it
@@ -655,7 +656,7 @@ StartPciDevicesOnBridge ( ChildHandleBuffer[*NumberOfChildren] = PciIoDevice->Handle;
(*NumberOfChildren)++;
}
-
+
//
// Get the next device path
//
@@ -752,18 +753,21 @@ StartPciDevicesOnBridge ( }
/**
- Start to manage all the PCI devices it found previously under
+ Start to manage all the PCI devices it found previously under
the entire host bridge.
@param Controller The root bridge handle.
+ @retval EFI_NOT_READY Device is not allocated.
+ @retval EFI_SUCCESS Success to start Pci device on host bridge.
+
**/
EFI_STATUS
StartPciDevices (
IN EFI_HANDLE Controller
)
-
{
+ EFI_STATUS Status;
PCI_IO_DEVICE *RootBridge;
EFI_HANDLE ThisHostBridge;
LIST_ENTRY *CurrentLink;
@@ -781,13 +785,16 @@ StartPciDevices ( // Locate the right root bridge to start
//
if (RootBridge->PciRootBridgeIo->ParentHandle == ThisHostBridge) {
- StartPciDevicesOnBridge (
- RootBridge->Handle,
- RootBridge,
- NULL,
- NULL,
- NULL
- );
+ Status = StartPciDevicesOnBridge (
+ RootBridge->Handle,
+ RootBridge,
+ NULL,
+ NULL,
+ NULL
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
}
CurrentLink = CurrentLink->ForwardLink;
@@ -913,10 +920,10 @@ GetRootBridgeByHandle ( /**
Judege whether Pci device existed.
-
+
@param Bridge Parent bridege instance.
@param PciIoDevice Device instance.
-
+
@retval TRUE Pci device existed.
@retval FALSE Pci device did not exist.
@@ -955,9 +962,9 @@ PciDeviceExisted ( /**
Get the active VGA device on the same segment.
-
+
@param VgaDevice PCI IO instance for the VGA device.
-
+
@return The active VGA device on the same segment.
**/
@@ -992,9 +999,9 @@ ActiveVGADeviceOnTheSameSegment ( /**
Get the active VGA device on the root bridge.
-
+
@param RootBridge PCI IO instance for the root bridge.
-
+
@return The active VGA device.
**/
@@ -1042,10 +1049,10 @@ ActiveVGADeviceOnTheRootBridge ( @param RootBridge Root bridege Io instance.
@param RemainingDevicePath Given searching device path.
@param PciAddress Buffer holding searched result.
-
+
@retval EFI_SUCCESS PCI address was stored in PciAddress
@retval EFI_NOT_FOUND Can not find the specific device path.
-
+
**/
EFI_STATUS
GetHpcPciAddressFromRootBridge (
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.h b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.h index afe1edddc6..d80088a246 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.h +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.h @@ -1,14 +1,14 @@ /** @file
Supporting functions declaration for PCI devices management.
-Copyright (c) 2006 - 2009, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
@@ -51,9 +51,9 @@ InsertPciDevice ( /**
Destroy root bridge and remove it from deivce tree.
-
+
@param RootBridge The bridge want to be removed.
-
+
**/
VOID
DestroyRootBridge (
@@ -91,10 +91,10 @@ DestroyRootBridgeByHandle ( );
/**
- This function registers the PCI IO device.
+ This function registers the PCI IO device.
- It creates a handle for this PCI IO device (if the handle does not exist), attaches
- appropriate protocols onto the handle, does necessary initialization, and sets up
+ It creates a handle for this PCI IO device (if the handle does not exist), attaches
+ appropriate protocols onto the handle, does necessary initialization, and sets up
parent/child relationship with its bus controller.
@param Controller An EFI handle for the PCI bus controller.
@@ -102,7 +102,7 @@ DestroyRootBridgeByHandle ( @param Handle A pointer to hold the returned EFI handle for the PCI IO device.
@retval EFI_SUCCESS The PCI device is successfully registered.
- @retval Others An error occurred when registering the PCI device.
+ @retval other An error occurred when registering the PCI device.
**/
EFI_STATUS
@@ -136,7 +136,7 @@ RemoveAllPciDeviceOnBridge ( @param Handle PCI device handle.
@retval EFI_SUCCESS The PCI device is successfully de-registered.
- @retval Others An error occurred when de-registering the PCI device.
+ @retval other An error occurred when de-registering the PCI device.
**/
EFI_STATUS
@@ -148,7 +148,7 @@ DeRegisterPciDevice ( /**
Start to manage the PCI device on specified the root bridge or PCI-PCI Bridge
- @param Controller An efi handle.
+ @param Controller The root bridge handle.
@param RootBridge A pointer to the PCI_IO_DEVICE.
@param RemainingDevicePath A pointer to the EFI_DEVICE_PATH_PROTOCOL.
@param NumberOfChildren Children number.
@@ -156,8 +156,8 @@ DeRegisterPciDevice ( @retval EFI_NOT_READY Device is not allocated.
@retval EFI_UNSUPPORTED Device only support PCI-PCI bridge.
- @retval EFI_NOT_FOUND Can not find the specific device
- @retval EFI_SUCCESS Success to start Pci device on bridge
+ @retval EFI_NOT_FOUND Can not find the specific device.
+ @retval EFI_SUCCESS Success to start Pci device on bridge.
**/
EFI_STATUS
@@ -170,10 +170,13 @@ StartPciDevicesOnBridge ( );
/**
- Start to manage all the PCI devices it found previously under
+ Start to manage all the PCI devices it found previously under
the entire host bridge.
- @param Controller - root bridge handle.
+ @param Controller The root bridge handle.
+
+ @retval EFI_NOT_READY Device is not allocated.
+ @retval EFI_SUCCESS Success to start Pci device on host bridge.
**/
EFI_STATUS
@@ -212,10 +215,10 @@ GetRootBridgeByHandle ( /**
Judege whether Pci device existed.
-
+
@param Bridge Parent bridege instance.
@param PciIoDevice Device instance.
-
+
@retval TRUE Pci device existed.
@retval FALSE Pci device did not exist.
@@ -228,9 +231,9 @@ PciDeviceExisted ( /**
Get the active VGA device on the same segment.
-
+
@param VgaDevice PCI IO instance for the VGA device.
-
+
@return The active VGA device on the same segment.
**/
@@ -241,9 +244,9 @@ ActiveVGADeviceOnTheSameSegment ( /**
Get the active VGA device on the root bridge.
-
+
@param RootBridge PCI IO instance for the root bridge.
-
+
@return The active VGA device.
**/
@@ -258,10 +261,10 @@ ActiveVGADeviceOnTheRootBridge ( @param RootBridge Root bridege Io instance.
@param RemainingDevicePath Given searching device path.
@param PciAddress Buffer holding searched result.
-
+
@retval EFI_SUCCESS PCI address was stored in PciAddress.
@retval EFI_NOT_FOUND Can not find the specific device path.
-
+
**/
EFI_STATUS
GetHpcPciAddressFromRootBridge (
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDriverOverride.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDriverOverride.c index d8faf8f7e4..119866b3c1 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDriverOverride.c +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDriverOverride.c @@ -1,41 +1,49 @@ /** @file
+ Functions implementation for Bus Specific Driver Override protoocl.
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
-**/
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
#include "PciBus.h"
/**
Initializes a PCI Driver Override Instance.
- @param PciIoDevice Device instance.
+ @param PciIoDevice PCI Device instance.
**/
VOID
InitializePciDriverOverrideInstance (
- PCI_IO_DEVICE *PciIoDevice
+ IN OUT PCI_IO_DEVICE *PciIoDevice
)
{
PciIoDevice->PciDriverOverride.GetDriver = GetDriver;
}
+
/**
- Get a overriding driver image.
- @param This Pointer to instance of EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL.
- @param DriverImageHandle Override driver image.
-
- @retval EFI_SUCCESS Success to get driver image handle.
- @retval EFI_NOT_FOUND can not find override driver image.
- @retval EFI_INVALID_PARAMETER Invalid parameter.
+ Uses a bus specific algorithm to retrieve a driver image handle for a controller.
+
+ @param This A pointer to the EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL instance.
+ @param DriverImageHandle On input, a pointer to the previous driver image handle returned
+ by GetDriver(). On output, a pointer to the next driver
+ image handle. Passing in a NULL, will return the first driver
+ image handle.
+
+ @retval EFI_SUCCESS A bus specific override driver is returned in DriverImageHandle.
+ @retval EFI_NOT_FOUND The end of the list of override drivers was reached.
+ A bus specific override driver is not returned in DriverImageHandle.
+ @retval EFI_INVALID_PARAMETER DriverImageHandle is not a handle that was returned on a
+ previous call to GetDriver().
+
**/
EFI_STATUS
EFIAPI
@@ -84,13 +92,15 @@ GetDriver ( }
/**
- Add an overriding driver image
-
+ Add an overriding driver image.
+
@param PciIoDevice Instance of PciIo device.
@param DriverImageHandle new added driver image.
-
- @retval EFI_OUT_OF_RESOURCES no memory resource for new driver instance.
- @retval EFI_SUCCESS Success add driver.
+
+ @retval EFI_SUCCESS Successfully added driver.
+ @retval EFI_OUT_OF_RESOURCES No memory resource for new driver instance.
+ @retval other Some error occurred when locating gEfiLoadedImageProtocolGuid.
+
**/
EFI_STATUS
AddDriver (
@@ -124,16 +134,9 @@ AddDriver ( ImageContext.ImageRead = PeCoffLoaderImageReadFromMemory;
//
- // Get information about the image
+ // Get information about the image
//
- Status = PeCoffLoaderGetImageInfo (&ImageContext);
- if (EFI_ERROR (Status)) {
- return EFI_SUCCESS;
- }
-
- if (ImageContext.Machine != EFI_IMAGE_MACHINE_EBC) {
- return EFI_SUCCESS;
- }
+ PeCoffLoaderGetImageInfo (&ImageContext);
return EFI_SUCCESS;
}
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDriverOverride.h b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDriverOverride.h index 4c402b2a47..d28fb7f846 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDriverOverride.h +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDriverOverride.h @@ -1,13 +1,14 @@ /** @file
+ Functions declaration for Bus Specific Driver Override protoocl.
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
@@ -17,6 +18,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define DRIVER_OVERRIDE_SIGNATURE SIGNATURE_32 ('d', 'r', 'o', 'v')
+//
+// PCI driver override driver image list
+//
typedef struct {
UINT32 Signature;
LIST_ENTRY Link;
@@ -30,22 +34,24 @@ typedef struct { /**
Initializes a PCI Driver Override Instance.
- @param PciIoDevice Device instance.
+ @param PciIoDevice PCI Device instance.
**/
VOID
InitializePciDriverOverrideInstance (
- PCI_IO_DEVICE *PciIoDevice
+ IN OUT PCI_IO_DEVICE *PciIoDevice
);
/**
Add an overriding driver image.
-
+
@param PciIoDevice Instance of PciIo device.
@param DriverImageHandle new added driver image.
-
- @retval EFI_OUT_OF_RESOURCES no memory resource for new driver instance.
- @retval EFI_SUCCESS Success add driver.
+
+ @retval EFI_SUCCESS Successfully added driver.
+ @retval EFI_OUT_OF_RESOURCES No memory resource for new driver instance.
+ @retval other Some error occurred when locating gEfiLoadedImageProtocolGuid.
+
**/
EFI_STATUS
AddDriver (
@@ -55,13 +61,20 @@ AddDriver ( /**
- Get a overriding driver image.
- @param This Pointer to instance of EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL.
- @param DriverImageHandle Override driver image.
-
- @retval EFI_SUCCESS Success to get driver image handle.
- @retval EFI_NOT_FOUND can not find override driver image.
- @retval EFI_INVALID_PARAMETER Invalid parameter.
+ Uses a bus specific algorithm to retrieve a driver image handle for a controller.
+
+ @param This A pointer to the EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL instance.
+ @param DriverImageHandle On input, a pointer to the previous driver image handle returned
+ by GetDriver(). On output, a pointer to the next driver
+ image handle. Passing in a NULL, will return the first driver
+ image handle.
+
+ @retval EFI_SUCCESS A bus specific override driver is returned in DriverImageHandle.
+ @retval EFI_NOT_FOUND The end of the list of override drivers was reached.
+ A bus specific override driver is not returned in DriverImageHandle.
+ @retval EFI_INVALID_PARAMETER DriverImageHandle is not a handle that was returned on a
+ previous call to GetDriver().
+
**/
EFI_STATUS
EFIAPI
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c index 0939244c10..8ee4b65106 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c @@ -1,28 +1,28 @@ /** @file
+ PCI eunmeration implementation on entire PCI bus system for PCI Bus module.
-Copyright (c) 2006 - 2009, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
-**/
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
#include "PciBus.h"
-#include "PciEnumerator.h"
-#include "PciOptionRomSupport.h"
/**
This routine is used to enumerate entire pci bus system
in a given platform.
@param Controller Parent controller handle.
-
- @return Status of enumerating.
+
+ @retval EFI_SUCCESS PCI enumeration finished successfully.
+ @retval other Some error occurred when enumerating the pci bus system.
+
**/
EFI_STATUS
PciEnumerator (
@@ -125,14 +125,14 @@ PciEnumerator ( }
/**
- Enumerate PCI root bridge
-
+ Enumerate PCI root bridge.
+
@param PciResAlloc Pointer to protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
@param RootBridgeDev Instance of root bridge device.
-
- @retval EFI_SUCCESS Success to enumerate root bridge.
- @retval Others Fail to enumerate root bridge.
-
+
+ @retval EFI_SUCCESS Successfully enumerated root bridge.
+ @retval other Failed to enumerate root bridge.
+
**/
EFI_STATUS
PciRootBridgeEnumerator (
@@ -190,7 +190,7 @@ PciRootBridgeEnumerator ( // Reset all assigned PCI bus number
//
ResetAllPpbBusNumber (
- RootBridgeDev,
+ RootBridgeDev,
StartBusNumber
);
@@ -222,9 +222,9 @@ PciRootBridgeEnumerator ( RootBridgeHandle,
Configuration
);
-
+
FreePool (Configuration);
-
+
if (EFI_ERROR (Status)) {
return Status;
}
@@ -233,15 +233,15 @@ PciRootBridgeEnumerator ( }
/**
- This routine is used to process option rom on a certain root bridge
-
- @param Bridge Given parent's root bridge
- @param RomBase Base address of ROM driver loaded from
- @param MaxLength Max rom size
-
- @retval EFI_SUCCESS Success to process option rom image.
+ This routine is used to process all PCI devices' Option Rom
+ on a certain root bridge.
+
+ @param Bridge Given parent's root bridge.
+ @param RomBase Base address of ROM driver loaded from.
+ @param MaxLength Maximum rom size.
+
**/
-EFI_STATUS
+VOID
ProcessOptionRom (
IN PCI_IO_DEVICE *Bridge,
IN UINT64 RomBase,
@@ -275,18 +275,18 @@ ProcessOptionRom ( CurrentLink = CurrentLink->ForwardLink;
}
-
- return EFI_SUCCESS;
}
/**
This routine is used to assign bus number to the given PCI bus system
-
- @param Bridge Parent root bridge instance.
- @param StartBusNumber Number of beginning.
- @param SubBusNumber the number of sub bus.
-
- @retval EFI_SUCCESS Success to assign bus number.
+
+ @param Bridge Parent root bridge instance.
+ @param StartBusNumber Number of beginning.
+ @param SubBusNumber The number of sub bus.
+
+ @retval EFI_SUCCESS Successfully assigned bus number.
+ @retval EFI_DEVICE_ERROR Failed to assign bus number.
+
**/
EFI_STATUS
PciAssignBusNumber (
@@ -321,7 +321,6 @@ PciAssignBusNumber ( //
// Check to see whether a pci device is present
//
-
Status = PciDevicePresent (
PciRootBridgeIo,
&Pci,
@@ -392,7 +391,6 @@ PciAssignBusNumber ( //
// Set the current maximum bus number under the PPB
//
-
Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);
Status = PciRootBridgeIoWrite (
@@ -411,7 +409,6 @@ PciAssignBusNumber ( //
// Skip sub functions, this is not a multi function device
//
-
Func = PCI_MAX_FUNC;
}
}
@@ -426,9 +423,10 @@ PciAssignBusNumber ( @param PciResAlloc Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
@param RootBridgeDev Root bridge instance
-
- @retval EFI_SUCCESS Success to get root bridge's attribute
- @retval Others Fail to get attribute
+
+ @retval EFI_SUCCESS Successfully got root bridge's attribute.
+ @retval other Failed to get attribute.
+
**/
EFI_STATUS
DetermineRootBridgeAttributes (
@@ -460,7 +458,6 @@ DetermineRootBridgeAttributes ( // Here is the point where PCI bus driver calls HOST bridge allocation protocol
// Currently we hardcoded for ea815
//
-
if ((Attributes & EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM) != 0) {
RootBridgeDev->Decodes |= EFI_BRIDGE_PMEM_MEM_COMBINE_SUPPORTED;
}
@@ -477,10 +474,12 @@ DetermineRootBridgeAttributes ( }
/**
- Get Max Option Rom size on this bridge
-
- @param Bridge Bridge device instance.
- @return Max size of option rom.
+ Get Max Option Rom size on specified bridge.
+
+ @param Bridge Given bridge device instance.
+
+ @return Max size of option rom needed.
+
**/
UINT64
GetMaxOptionRomSize (
@@ -538,12 +537,13 @@ GetMaxOptionRomSize ( /**
Process attributes of devices on this host bridge
-
+
@param PciResAlloc Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
-
+
+ @retval EFI_SUCCESS Successfully process attribute.
@retval EFI_NOT_FOUND Can not find the specific root bridge device.
- @retval EFI_SUCCESS Success Process attribute.
- @retval Others Can not determine the root bridge device's attribute.
+ @retval other Failed to determine the root bridge device's attribute.
+
**/
EFI_STATUS
PciHostBridgeDeviceAttribute (
@@ -581,18 +581,17 @@ PciHostBridgeDeviceAttribute ( }
/**
- Get resource allocation status from the ACPI pointer
-
- @param AcpiConfig Point to Acpi configuration table
- @param IoResStatus Return the status of I/O resource
- @param Mem32ResStatus Return the status of 32-bit Memory resource
- @param PMem32ResStatus Return the status of 32-bit PMemory resource
- @param Mem64ResStatus Return the status of 64-bit Memory resource
- @param PMem64ResStatus Return the status of 64-bit PMemory resource
-
- @retval EFI_SUCCESS Success to get resource allocation status from ACPI configuration table.
+ Get resource allocation status from the ACPI resource descriptor.
+
+ @param AcpiConfig Point to Acpi configuration table.
+ @param IoResStatus Return the status of I/O resource.
+ @param Mem32ResStatus Return the status of 32-bit Memory resource.
+ @param PMem32ResStatus Return the status of 32-bit Prefetchable Memory resource.
+ @param Mem64ResStatus Return the status of 64-bit Memory resource.
+ @param PMem64ResStatus Return the status of 64-bit Prefetchable Memory resource.
+
**/
-EFI_STATUS
+VOID
GetResourceAllocationStatus (
VOID *AcpiConfig,
OUT UINT64 *IoResStatus,
@@ -602,7 +601,6 @@ GetResourceAllocationStatus ( OUT UINT64 *PMem64ResStatus
)
{
-
UINT8 *Temp;
UINT64 ResStatus;
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *ACPIAddressDesc;
@@ -659,17 +657,16 @@ GetResourceAllocationStatus ( Temp += sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR);
}
-
- return EFI_SUCCESS;
}
/**
- Remove a PCI device from device pool and mark its bar
-
+ Remove a PCI device from device pool and mark its bar.
+
@param PciDevice Instance of Pci device.
-
- @retval EFI_SUCCESS Success Operation.
- @retval EFI_ABORTED Pci device is a root bridge.
+
+ @retval EFI_SUCCESS Successfully remove the PCI device.
+ @retval EFI_ABORTED Pci device is a root bridge or a PCI-PCI bridge.
+
**/
EFI_STATUS
RejectPciDevice (
@@ -683,7 +680,7 @@ RejectPciDevice ( //
// Remove the padding resource from a bridge
//
- if ( IS_PCI_BRIDGE(&PciDevice->Pci) &&
+ if ( IS_PCI_BRIDGE(&PciDevice->Pci) &&
PciDevice->ResourcePaddingDescriptors != NULL ) {
FreePool (PciDevice->ResourcePaddingDescriptors);
PciDevice->ResourcePaddingDescriptors = NULL;
@@ -736,10 +733,12 @@ RejectPciDevice ( /**
Determine whethter a PCI device can be rejected.
-
- @param PciResNode Pointer to Pci resource node instance.
-
- @return whethter a PCI device can be rejected.
+
+ @param PciResNode Pointer to Pci resource node instance.
+
+ @retval TRUE The PCI device can be rejected.
+ @retval TRUE The PCI device cannot be rejected.
+
**/
BOOLEAN
IsRejectiveDevice (
@@ -782,12 +781,13 @@ IsRejectiveDevice ( }
/**
- Compare two resource node and get the larger resource consumer
-
+ Compare two resource nodes and get the larger resource consumer.
+
@param PciResNode1 resource node 1 want to be compared
@param PciResNode2 resource node 2 want to be compared
-
- @return Larger resource consumer.
+
+ @return Larger resource node.
+
**/
PCI_RESOURCE_NODE *
GetLargerConsumerDevice (
@@ -814,16 +814,16 @@ GetLargerConsumerDevice ( }
return PciResNode2;
-
}
/**
Get the max resource consumer in the host resource pool.
-
+
@param ResPool Pointer to resource pool node.
-
- @return the max resource consumer in the host resource pool.
+
+ @return The max resource consumer in the host resource pool.
+
**/
PCI_RESOURCE_NODE *
GetMaxResourceConsumerDevice (
@@ -864,17 +864,21 @@ GetMaxResourceConsumerDevice ( /**
Adjust host bridge allocation so as to reduce resource requirement
-
+
@param IoPool Pointer to instance of I/O resource Node.
@param Mem32Pool Pointer to instance of 32-bit memory resource Node.
- @param PMem32Pool Pointer to instance of 32-bit Pmemory resource node.
+ @param PMem32Pool Pointer to instance of 32-bit Prefetchable memory resource node.
@param Mem64Pool Pointer to instance of 64-bit memory resource node.
- @param PMem64Pool Pointer to instance of 64-bit Pmemory resource node.
+ @param PMem64Pool Pointer to instance of 64-bit Prefetchable memory resource node.
@param IoResStatus Status of I/O resource Node.
@param Mem32ResStatus Status of 32-bit memory resource Node.
- @param PMem32ResStatus Status of 32-bit Pmemory resource node.
+ @param PMem32ResStatus Status of 32-bit Prefetchable memory resource node.
@param Mem64ResStatus Status of 64-bit memory resource node.
- @param PMem64ResStatus Status of 64-bit Pmemory resource node.
+ @param PMem64ResStatus Status of 64-bit Prefetchable memory resource node.
+
+ @retval EFI_SUCCESS Successfully adjusted resoruce on host bridge.
+ @retval EFI_ABORTED Host bridge hasn't this resource type or no resource be adjusted.
+
**/
EFI_STATUS
PciHostBridgeAdjustAllocation (
@@ -927,7 +931,7 @@ PciHostBridgeAdjustAllocation ( if (ResStatus[ResType] == EFI_RESOURCE_NOT_SATISFIED) {
//
- // Hostbridge hasn't this resource type
+ // Host bridge hasn't this resource type
//
return EFI_ABORTED;
}
@@ -998,7 +1002,7 @@ PciHostBridgeAdjustAllocation ( /**
Summary requests for all resource type, and contruct ACPI resource
requestor instance.
-
+
@param Bridge detecting bridge
@param IoNode Pointer to instance of I/O resource Node
@param Mem32Node Pointer to instance of 32-bit memory resource Node
@@ -1006,6 +1010,10 @@ PciHostBridgeAdjustAllocation ( @param Mem64Node Pointer to instance of 64-bit memory resource node
@param PMem64Node Pointer to instance of 64-bit Pmemory resource node
@param Config Output buffer holding new constructed APCI resource requestor
+
+ @retval EFI_SUCCESS Successfully constructed ACPI resource.
+ @retval EFI_OUT_OF_RESOURCES No memory availabe.
+
**/
EFI_STATUS
ConstructAcpiResourceRequestor (
@@ -1235,18 +1243,16 @@ ConstructAcpiResourceRequestor ( /**
Get resource base from an acpi configuration descriptor.
-
- @param Config an acpi configuration descriptor.
- @param IoBase output of I/O resource base address.
- @param Mem32Base output of 32-bit memory base address.
- @param PMem32Base output of 32-bit pmemory base address.
- @param Mem64Base output of 64-bit memory base address.
- @param PMem64Base output of 64-bit pmemory base address.
-
- @return EFI_SUCCESS Get resource base address successfully.
+
+ @param Config An acpi configuration descriptor.
+ @param IoBase Output of I/O resource base address.
+ @param Mem32Base Output of 32-bit memory base address.
+ @param PMem32Base Output of 32-bit prefetchable memory base address.
+ @param Mem64Base Output of 64-bit memory base address.
+ @param PMem64Base Output of 64-bit prefetchable memory base address.
**/
-EFI_STATUS
+VOID
GetResourceBase (
IN VOID *Config,
OUT UINT64 *IoBase,
@@ -1325,18 +1331,17 @@ GetResourceBase ( //
Temp += sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR);
}
-
- return EFI_SUCCESS;
}
/**
Enumerate pci bridge, allocate resource and determine attribute
- for devices on this bridge
-
- @param BridgeDev Pointer to instance of bridge device.
-
- @retval EFI_SUCCESS Success operation.
- @retval Others Fail to enumerate.
+ for devices on this bridge.
+
+ @param BridgeDev Pointer to instance of bridge device.
+
+ @retval EFI_SUCCESS Successfully enumerated PCI bridge.
+ @retval other Failed to enumerate.
+
**/
EFI_STATUS
PciBridgeEnumerator (
@@ -1390,12 +1395,13 @@ PciBridgeEnumerator ( }
/**
- Allocate all kinds of resource for bridge
-
- @param Bridge Pointer to bridge instance.
-
- @retval EFI_SUCCESS Success operation.
- @retval Others Fail to allocate resource for bridge.
+ Allocate all kinds of resource for PCI bridge.
+
+ @param Bridge Pointer to bridge instance.
+
+ @retval EFI_SUCCESS Successfully allocated resource for PCI bridge.
+ @retval other Failed to allocate resource for bridge.
+
**/
EFI_STATUS
PciBridgeResourceAllocator (
@@ -1415,13 +1421,13 @@ PciBridgeResourceAllocator ( EFI_STATUS Status;
IoBridge = CreateResourceNode (
- Bridge,
- 0,
- 0xFFF,
- 0,
- PciBarTypeIo16,
- PciResUsageTypical
- );
+ Bridge,
+ 0,
+ 0xFFF,
+ 0,
+ PciBarTypeIo16,
+ PciResUsageTypical
+ );
Mem32Bridge = CreateResourceNode (
Bridge,
@@ -1433,13 +1439,13 @@ PciBridgeResourceAllocator ( );
PMem32Bridge = CreateResourceNode (
- Bridge,
- 0,
- 0xFFFFF,
- 0,
- PciBarTypePMem32,
- PciResUsageTypical
- );
+ Bridge,
+ 0,
+ 0xFFFFF,
+ 0,
+ PciBarTypePMem32,
+ PciResUsageTypical
+ );
Mem64Bridge = CreateResourceNode (
Bridge,
@@ -1451,38 +1457,34 @@ PciBridgeResourceAllocator ( );
PMem64Bridge = CreateResourceNode (
- Bridge,
- 0,
- 0xFFFFF,
- 0,
- PciBarTypePMem64,
- PciResUsageTypical
- );
+ Bridge,
+ 0,
+ 0xFFFFF,
+ 0,
+ PciBarTypePMem64,
+ PciResUsageTypical
+ );
//
// Create resourcemap by going through all the devices subject to this root bridge
//
- Status = CreateResourceMap (
- Bridge,
- IoBridge,
- Mem32Bridge,
- PMem32Bridge,
- Mem64Bridge,
- PMem64Bridge
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
+ CreateResourceMap (
+ Bridge,
+ IoBridge,
+ Mem32Bridge,
+ PMem32Bridge,
+ Mem64Bridge,
+ PMem64Bridge
+ );
Status = GetResourceBaseFromBridge (
- Bridge,
- &IoBase,
- &Mem32Base,
- &PMem32Base,
- &Mem64Base,
- &PMem64Base
- );
+ Bridge,
+ &IoBase,
+ &Mem32Base,
+ &PMem32Base,
+ &Mem64Base,
+ &PMem64Base
+ );
if (EFI_ERROR (Status)) {
return Status;
@@ -1544,16 +1546,18 @@ PciBridgeResourceAllocator ( }
/**
- Get resource base address for a pci bridge device
-
- @param Bridge Given Pci driver instance.
- @param IoBase output for base address of I/O type resource.
- @param Mem32Base output for base address of 32-bit memory type resource.
- @param PMem32Base output for base address of 32-bit Pmemory type resource.
- @param Mem64Base output for base address of 64-bit memory type resource.
- @param PMem64Base output for base address of 64-bit Pmemory type resource.
-
- @retval EFI_SUCCESS Succes to get resource base address.
+ Get resource base address for a pci bridge device.
+
+ @param Bridge Given Pci driver instance.
+ @param IoBase Output for base address of I/O type resource.
+ @param Mem32Base Output for base address of 32-bit memory type resource.
+ @param PMem32Base Ooutput for base address of 32-bit Pmemory type resource.
+ @param Mem64Base Output for base address of 64-bit memory type resource.
+ @param PMem64Base Output for base address of 64-bit Pmemory type resource.
+
+ @retval EFI_SUCCESS Successfully got resource base address.
+ @retval EFI_OUT_OF_RESOURCES PCI bridge is not available.
+
**/
EFI_STATUS
GetResourceBaseFromBridge (
@@ -1631,53 +1635,55 @@ GetResourceBaseFromBridge ( }
/**
- These are the notifications from the PCI bus driver that it is about to enter a certain
+ These are the notifications from the PCI bus driver that it is about to enter a certain
phase of the PCI enumeration process.
This member function can be used to notify the host bridge driver to perform specific actions,
including any chipset-specific initialization, so that the chipset is ready to enter the next phase.
Eight notification points are defined at this time. See belows:
- EfiPciHostBridgeBeginEnumeration - Resets the host bridge PCI apertures and internal data
+ EfiPciHostBridgeBeginEnumeration Resets the host bridge PCI apertures and internal data
structures. The PCI enumerator should issue this notification
before starting a fresh enumeration process. Enumeration cannot
be restarted after sending any other notification such as
EfiPciHostBridgeBeginBusAllocation.
- EfiPciHostBridgeBeginBusAllocation - The bus allocation phase is about to begin. No specific action is
+ EfiPciHostBridgeBeginBusAllocation The bus allocation phase is about to begin. No specific action is
required here. This notification can be used to perform any
chipset-specific programming.
- EfiPciHostBridgeEndBusAllocation - The bus allocation and bus programming phase is complete. No
+ EfiPciHostBridgeEndBusAllocation The bus allocation and bus programming phase is complete. No
specific action is required here. This notification can be used to
perform any chipset-specific programming.
- EfiPciHostBridgeBeginResourceAllocation - The resource allocation phase is about to begin. No specific
- action is required here. This notification can be used to perform
- any chipset-specific programming.
- EfiPciHostBridgeAllocateResources - Allocates resources per previously submitted requests for all the PCI
+ EfiPciHostBridgeBeginResourceAllocation
+ The resource allocation phase is about to begin. No specific
+ action is required here. This notification can be used to perform
+ any chipset-specific programming.
+ EfiPciHostBridgeAllocateResources Allocates resources per previously submitted requests for all the PCI
root bridges. These resource settings are returned on the next call to
GetProposedResources(). Before calling NotifyPhase() with a Phase of
- EfiPciHostBridgeAllocateResource, the PCI bus enumerator is responsible for gathering I/O and memory requests for
+ EfiPciHostBridgeAllocateResource, the PCI bus enumerator is responsible
+ for gathering I/O and memory requests for
all the PCI root bridges and submitting these requests using
SubmitResources(). This function pads the resource amount
to suit the root bridge hardware, takes care of dependencies between
the PCI root bridges, and calls the Global Coherency Domain (GCD)
with the allocation request. In the case of padding, the allocated range
could be bigger than what was requested.
- EfiPciHostBridgeSetResources - Programs the host bridge hardware to decode previously allocated
+ EfiPciHostBridgeSetResources Programs the host bridge hardware to decode previously allocated
resources (proposed resources) for all the PCI root bridges. After the
hardware is programmed, reassigning resources will not be supported.
The bus settings are not affected.
- EfiPciHostBridgeFreeResources - Deallocates resources that were previously allocated for all the PCI
+ EfiPciHostBridgeFreeResources Deallocates resources that were previously allocated for all the PCI
root bridges and resets the I/O and memory apertures to their initial
state. The bus settings are not affected. If the request to allocate
resources fails, the PCI enumerator can use this notification to
deallocate previous resources, adjust the requests, and retry
allocation.
- EfiPciHostBridgeEndResourceAllocation- The resource allocation phase is completed. No specific action is
+ EfiPciHostBridgeEndResourceAllocation The resource allocation phase is completed. No specific action is
required here. This notification can be used to perform any chipsetspecific
programming.
-
+
@param[in] PciResAlloc The instance pointer of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
@param[in] Phase The phase during enumeration
-
+
@retval EFI_NOT_READY This phase cannot be entered at this time. For example, this error
is valid for a Phase of EfiPciHostBridgeAllocateResources if
SubmitResources() has not been called for one or more
@@ -1759,27 +1765,27 @@ NotifyPhase ( }
/**
- Provides the hooks from the PCI bus driver to every PCI controller (device/function) at various
- stages of the PCI enumeration process that allow the host bridge driver to preinitialize individual
- PCI controllers before enumeration.
-
- This function is called during the PCI enumeration process. No specific action is expected from this
- member function. It allows the host bridge driver to preinitialize individual PCI controllers before
- enumeration.
-
- @param Bridge Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance.
- @param Bus The bus number of the pci device.
- @param Device The device number of the pci device.
- @param Func The function number of the pci device.
- @param Phase The phase of the PCI device enumeration.
-
- @retval EFI_SUCCESS The requested parameters were returned.
- @retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
- @retval EFI_INVALID_PARAMETER Phase is not a valid phase that is defined in
- EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE.
- @retval EFI_DEVICE_ERROR Programming failed due to a hardware error. The PCI enumerator should
- not enumerate this device, including its child devices if it is a PCI-to-PCI
- bridge.
+ Provides the hooks from the PCI bus driver to every PCI controller (device/function) at various
+ stages of the PCI enumeration process that allow the host bridge driver to preinitialize individual
+ PCI controllers before enumeration.
+
+ This function is called during the PCI enumeration process. No specific action is expected from this
+ member function. It allows the host bridge driver to preinitialize individual PCI controllers before
+ enumeration.
+
+ @param Bridge Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance.
+ @param Bus The bus number of the pci device.
+ @param Device The device number of the pci device.
+ @param Func The function number of the pci device.
+ @param Phase The phase of the PCI device enumeration.
+
+ @retval EFI_SUCCESS The requested parameters were returned.
+ @retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
+ @retval EFI_INVALID_PARAMETER Phase is not a valid phase that is defined in
+ EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE.
+ @retval EFI_DEVICE_ERROR Programming failed due to a hardware error. The PCI enumerator should
+ not enumerate this device, including its child devices if it is a PCI-to-PCI
+ bridge.
**/
EFI_STATUS
@@ -1872,17 +1878,27 @@ PreprocessController ( }
/**
- Hot plug request notify.
-
- @param This - A pointer to the hot plug request protocol.
- @param Operation - The operation.
- @param Controller - A pointer to the controller.
- @param RemainingDevicePath - A pointer to the device path.
- @param NumberOfChildren - A the number of child handle in the ChildHandleBuffer.
- @param ChildHandleBuffer - A pointer to the array contain the child handle.
-
- @retval EFI_NOT_FOUND Can not find bridge according to controller handle.
- @retval EFI_SUCCESS Success operating.
+ This function allows the PCI bus driver to be notified to act as requested when a hot-plug event has
+ happened on the hot-plug controller. Currently, the operations include add operation and remove operation..
+
+ @param This A pointer to the hot plug request protocol.
+ @param Operation The operation the PCI bus driver is requested to make.
+ @param Controller The handle of the hot-plug controller.
+ @param RemainingDevicePath The remaining device path for the PCI-like hot-plug device.
+ @param NumberOfChildren The number of child handles.
+ For a add operation, it is an output parameter.
+ For a remove operation, it?¡¥s an input parameter.
+ @param ChildHandleBuffer The buffer which contains the child handles.
+
+ @retval EFI_INVALID_PARAMETER Operation is not a legal value.
+ Controller is NULL or not a valid handle.
+ NumberOfChildren is NULL.
+ ChildHandleBuffer is NULL while Operation is add.
+ @retval EFI_OUT_OF_RESOURCES There are no enough resources to start the devices.
+ @retval EFI_NOT_FOUND Can not find bridge according to controller handle.
+ @retval EFI_SUCCESS The handles for the specified device have been created or destroyed
+ as requested, and for an add operation, the new handles are
+ returned in ChildHandleBuffer.
**/
EFI_STATUS
EFIAPI
@@ -1986,11 +2002,12 @@ PciHotPlugRequestNotify ( /**
Search hostbridge according to given handle
-
- @param RootBridgeHandle - Host bridge handle.
- @return TRUE Found.
- @return FALSE Not found.
+ @param RootBridgeHandle Host bridge handle.
+
+ @retval TRUE Found host bridge handle.
+ @retval FALSE Not found hot bridge handle.
+
**/
BOOLEAN
SearchHostBridgeHandle (
@@ -2029,9 +2046,14 @@ SearchHostBridgeHandle ( }
/**
- Add host bridge handle to global variable for enumating.
-
- @param HostBridgeHandle host bridge handle.
+ Add host bridge handle to global variable for enumerating.
+
+ @param HostBridgeHandle Host bridge handle.
+
+ @retval EFI_SUCCESS Successfully added host bridge.
+ @retval EFI_ABORTED Host bridge is NULL, or given host bridge
+ has been in host bridge list.
+
**/
EFI_STATUS
AddHostBridgeEnumerator (
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.h b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.h index 2c0eec7d34..4a20054d51 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.h +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.h @@ -1,17 +1,16 @@ /** @file
- Header file declares all logic function for PCI bus enumeration.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+ PCI bus enumeration logic function declaration for PCI bus module.
-**/
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
#ifndef _EFI_PCI_ENUMERATOR_H_
#define _EFI_PCI_ENUMERATOR_H_
@@ -20,11 +19,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. /**
This routine is used to enumerate entire pci bus system
- in a given platform
+ in a given platform.
@param Controller Parent controller handle.
-
- @return Status of enumerating.
+
+ @retval EFI_SUCCESS PCI enumeration finished successfully.
+ @retval other Some error occurred when enumerating the pci bus system.
+
**/
EFI_STATUS
PciEnumerator (
@@ -32,14 +33,14 @@ PciEnumerator ( );
/**
- Enumerate PCI root bridge
-
- @param PciResAlloc Pointer to protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
+ Enumerate PCI root bridge.
+
+ @param PciResAlloc Pointer to protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
@param RootBridgeDev Instance of root bridge device.
-
- @retval EFI_SUCCESS Success to enumerate root bridge.
- @retval Others Fail to enumerate root bridge.
-
+
+ @retval EFI_SUCCESS Successfully enumerated root bridge.
+ @retval other Failed to enumerate root bridge.
+
**/
EFI_STATUS
PciRootBridgeEnumerator (
@@ -48,15 +49,15 @@ PciRootBridgeEnumerator ( );
/**
- This routine is used to process option rom on a certain root bridge
-
+ This routine is used to process all PCI devices' Option Rom
+ on a certain root bridge.
+
@param Bridge Given parent's root bridge.
@param RomBase Base address of ROM driver loaded from.
- @param MaxLength Max rom size.
-
- @retval EFI_SUCCESS Success to process option rom image.
+ @param MaxLength Maximum rom size.
+
**/
-EFI_STATUS
+VOID
ProcessOptionRom (
IN PCI_IO_DEVICE *Bridge,
IN UINT64 RomBase,
@@ -65,12 +66,14 @@ ProcessOptionRom ( /**
This routine is used to assign bus number to the given PCI bus system
-
- @param Bridge Parent root bridge instance.
- @param StartBusNumber Number of beginning.
- @param SubBusNumber the number of sub bus.
-
- @retval EFI_SUCCESS Success to assign bus number.
+
+ @param Bridge Parent root bridge instance.
+ @param StartBusNumber Number of beginning.
+ @param SubBusNumber The number of sub bus.
+
+ @retval EFI_SUCCESS Successfully assigned bus number.
+ @retval EFI_DEVICE_ERROR Failed to assign bus number.
+
**/
EFI_STATUS
PciAssignBusNumber (
@@ -83,11 +86,12 @@ PciAssignBusNumber ( This routine is used to determine the root bridge attribute by interfacing
the host bridge resource allocation protocol.
- @param PciResAlloc Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
- @param RootBridgeDev Root bridge instance.
-
- @retval EFI_SUCCESS Success to get root bridge's attribute.
- @retval Others Fail to get attribute.
+ @param PciResAlloc Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
+ @param RootBridgeDev Root bridge instance
+
+ @retval EFI_SUCCESS Successfully got root bridge's attribute.
+ @retval other Failed to get attribute.
+
**/
EFI_STATUS
DetermineRootBridgeAttributes (
@@ -96,10 +100,12 @@ DetermineRootBridgeAttributes ( );
/**
- Get Max Option Rom size on this bridge
-
- @param Bridge Bridge device instance.
- @return Max size of option rom.
+ Get Max Option Rom size on specified bridge.
+
+ @param Bridge Given bridge device instance.
+
+ @return Max size of option rom needed.
+
**/
UINT64
GetMaxOptionRomSize (
@@ -108,12 +114,13 @@ GetMaxOptionRomSize ( /**
Process attributes of devices on this host bridge
-
- @param PciResAlloc Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
-
+
+ @param PciResAlloc Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
+
+ @retval EFI_SUCCESS Successfully process attribute.
@retval EFI_NOT_FOUND Can not find the specific root bridge device.
- @retval EFI_SUCCESS Success Process attribute.
- @retval Others Can not determine the root bridge device's attribute.
+ @retval other Failed to determine the root bridge device's attribute.
+
**/
EFI_STATUS
PciHostBridgeDeviceAttribute (
@@ -121,18 +128,17 @@ PciHostBridgeDeviceAttribute ( );
/**
- Get resource allocation status from the ACPI pointer
+ Get resource allocation status from the ACPI resource descriptor.
@param AcpiConfig Point to Acpi configuration table.
@param IoResStatus Return the status of I/O resource.
@param Mem32ResStatus Return the status of 32-bit Memory resource.
- @param PMem32ResStatus Return the status of 32-bit PMemory resource.
+ @param PMem32ResStatus Return the status of 32-bit Prefetchable Memory resource.
@param Mem64ResStatus Return the status of 64-bit Memory resource.
- @param PMem64ResStatus Return the status of 64-bit PMemory resource.
-
- @retval EFI_SUCCESS Success to get resource allocation status from ACPI configuration table.
+ @param PMem64ResStatus Return the status of 64-bit Prefetchable Memory resource.
+
**/
-EFI_STATUS
+VOID
GetResourceAllocationStatus (
VOID *AcpiConfig,
OUT UINT64 *IoResStatus,
@@ -143,12 +149,13 @@ GetResourceAllocationStatus ( );
/**
- Remove a PCI device from device pool and mark its bar
-
+ Remove a PCI device from device pool and mark its bar.
+
@param PciDevice Instance of Pci device.
-
- @retval EFI_SUCCESS Success Operation.
- @retval EFI_ABORTED Pci device is a root bridge.
+
+ @retval EFI_SUCCESS Successfully remove the PCI device.
+ @retval EFI_ABORTED Pci device is a root bridge or a PCI-PCI bridge.
+
**/
EFI_STATUS
RejectPciDevice (
@@ -156,11 +163,13 @@ RejectPciDevice ( );
/**
- Determine whethter a PCI device can be rejected
-
- @param PciResNode Pointer to Pci resource node instance.
-
- @return whethter a PCI device can be rejected.
+ Determine whethter a PCI device can be rejected.
+
+ @param PciResNode Pointer to Pci resource node instance.
+
+ @retval TRUE The PCI device can be rejected.
+ @retval TRUE The PCI device cannot be rejected.
+
**/
BOOLEAN
IsRejectiveDevice (
@@ -168,12 +177,13 @@ IsRejectiveDevice ( );
/**
- Compare two resource node and get the larger resource consumer
-
- @param PciResNode1 resource node 1 want to be compared.
- @param PciResNode2 resource node 2 want to be compared.
-
- @return Larger resource consumer.
+ Compare two resource nodes and get the larger resource consumer.
+
+ @param PciResNode1 resource node 1 want to be compared
+ @param PciResNode2 resource node 2 want to be compared
+
+ @return Larger resource node.
+
**/
PCI_RESOURCE_NODE *
GetLargerConsumerDevice (
@@ -182,11 +192,12 @@ GetLargerConsumerDevice ( );
/**
- Get the max resource consumer in the host resource pool
-
+ Get the max resource consumer in the host resource pool.
+
@param ResPool Pointer to resource pool node.
-
- @return the max resource consumer in the host resource pool.
+
+ @return The max resource consumer in the host resource pool.
+
**/
PCI_RESOURCE_NODE *
GetMaxResourceConsumerDevice (
@@ -195,17 +206,21 @@ GetMaxResourceConsumerDevice ( /**
Adjust host bridge allocation so as to reduce resource requirement
-
+
@param IoPool Pointer to instance of I/O resource Node.
@param Mem32Pool Pointer to instance of 32-bit memory resource Node.
- @param PMem32Pool Pointer to instance of 32-bit Pmemory resource node.
+ @param PMem32Pool Pointer to instance of 32-bit Prefetchable memory resource node.
@param Mem64Pool Pointer to instance of 64-bit memory resource node.
- @param PMem64Pool Pointer to instance of 64-bit Pmemory resource node.
+ @param PMem64Pool Pointer to instance of 64-bit Prefetchable memory resource node.
@param IoResStatus Status of I/O resource Node.
@param Mem32ResStatus Status of 32-bit memory resource Node.
- @param PMem32ResStatus Status of 32-bit Pmemory resource node.
+ @param PMem32ResStatus Status of 32-bit Prefetchable memory resource node.
@param Mem64ResStatus Status of 64-bit memory resource node.
- @param PMem64ResStatus Status of 64-bit Pmemory resource node.
+ @param PMem64ResStatus Status of 64-bit Prefetchable memory resource node.
+
+ @retval EFI_SUCCESS Successfully adjusted resoruce on host bridge.
+ @retval EFI_ABORTED Host bridge hasn't this resource type or no resource be adjusted.
+
**/
EFI_STATUS
PciHostBridgeAdjustAllocation (
@@ -224,14 +239,18 @@ PciHostBridgeAdjustAllocation ( /**
Summary requests for all resource type, and contruct ACPI resource
requestor instance.
-
- @param Bridge detecting bridge.
- @param IoNode Pointer to instance of I/O resource Node.
- @param Mem32Node Pointer to instance of 32-bit memory resource Node.
- @param PMem32Node Pointer to instance of 32-bit Pmemory resource node.
- @param Mem64Node Pointer to instance of 64-bit memory resource node.
- @param PMem64Node Pointer to instance of 64-bit Pmemory resource node.
- @param Config Output buffer holding new constructed APCI resource requestor.
+
+ @param Bridge detecting bridge
+ @param IoNode Pointer to instance of I/O resource Node
+ @param Mem32Node Pointer to instance of 32-bit memory resource Node
+ @param PMem32Node Pointer to instance of 32-bit Pmemory resource node
+ @param Mem64Node Pointer to instance of 64-bit memory resource node
+ @param PMem64Node Pointer to instance of 64-bit Pmemory resource node
+ @param Config Output buffer holding new constructed APCI resource requestor
+
+ @retval EFI_SUCCESS Successfully constructed ACPI resource.
+ @retval EFI_OUT_OF_RESOURCES No memory availabe.
+
**/
EFI_STATUS
ConstructAcpiResourceRequestor (
@@ -246,18 +265,16 @@ ConstructAcpiResourceRequestor ( /**
Get resource base from an acpi configuration descriptor.
-
- @param Config an acpi configuration descriptor.
- @param IoBase output of I/O resource base address.
- @param Mem32Base output of 32-bit memory base address.
- @param PMem32Base output of 32-bit pmemory base address.
- @param Mem64Base output of 64-bit memory base address.
- @param PMem64Base output of 64-bit pmemory base address.
-
- @return EFI_SUCCESS Get resource base address successfully.
+
+ @param Config An acpi configuration descriptor.
+ @param IoBase Output of I/O resource base address.
+ @param Mem32Base Output of 32-bit memory base address.
+ @param PMem32Base Output of 32-bit prefetchable memory base address.
+ @param Mem64Base Output of 64-bit memory base address.
+ @param PMem64Base Output of 64-bit prefetchable memory base address.
**/
-EFI_STATUS
+VOID
GetResourceBase (
IN VOID *Config,
OUT UINT64 *IoBase,
@@ -269,12 +286,13 @@ GetResourceBase ( /**
Enumerate pci bridge, allocate resource and determine attribute
- for devices on this bridge
-
- @param BridgeDev Pointer to instance of bridge device.
-
- @retval EFI_SUCCESS Success operation.
- @retval Others Fail to enumerate.
+ for devices on this bridge.
+
+ @param BridgeDev Pointer to instance of bridge device.
+
+ @retval EFI_SUCCESS Successfully enumerated PCI bridge.
+ @retval other Failed to enumerate.
+
**/
EFI_STATUS
PciBridgeEnumerator (
@@ -282,12 +300,13 @@ PciBridgeEnumerator ( );
/**
- Allocate all kinds of resource for bridge
-
- @param Bridge Pointer to bridge instance.
-
- @retval EFI_SUCCESS Success operation.
- @retval Others Fail to allocate resource for bridge.
+ Allocate all kinds of resource for PCI bridge.
+
+ @param Bridge Pointer to bridge instance.
+
+ @retval EFI_SUCCESS Successfully allocated resource for PCI bridge.
+ @retval other Failed to allocate resource for bridge.
+
**/
EFI_STATUS
PciBridgeResourceAllocator (
@@ -295,16 +314,18 @@ PciBridgeResourceAllocator ( );
/**
- Get resource base address for a pci bridge device
-
- @param Bridge Given Pci driver instance.
- @param IoBase output for base address of I/O type resource.
- @param Mem32Base output for base address of 32-bit memory type resource.
- @param PMem32Base output for base address of 32-bit Pmemory type resource.
- @param Mem64Base output for base address of 64-bit memory type resource.
- @param PMem64Base output for base address of 64-bit Pmemory type resource.
-
- @retval EFI_SUCCESS Succes to get resource base address.
+ Get resource base address for a pci bridge device.
+
+ @param Bridge Given Pci driver instance.
+ @param IoBase Output for base address of I/O type resource.
+ @param Mem32Base Output for base address of 32-bit memory type resource.
+ @param PMem32Base Ooutput for base address of 32-bit Pmemory type resource.
+ @param Mem64Base Output for base address of 64-bit memory type resource.
+ @param PMem64Base Output for base address of 64-bit Pmemory type resource.
+
+ @retval EFI_SUCCESS Successfully got resource base address.
+ @retval EFI_OUT_OF_RESOURCES PCI bridge is not available.
+
**/
EFI_STATUS
GetResourceBaseFromBridge (
@@ -318,9 +339,9 @@ GetResourceBaseFromBridge ( /**
Process Option Rom on this host bridge
-
+
@param PciResAlloc Pointer to instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
-
+
@retval EFI_NOT_FOUND Can not find the root bridge instance.
@retval EFI_SUCCESS Success process.
**/
@@ -330,53 +351,55 @@ PciHostBridgeP2CProcess ( );
/**
- These are the notifications from the PCI bus driver that it is about to enter a certain
+ These are the notifications from the PCI bus driver that it is about to enter a certain
phase of the PCI enumeration process.
This member function can be used to notify the host bridge driver to perform specific actions,
including any chipset-specific initialization, so that the chipset is ready to enter the next phase.
Eight notification points are defined at this time. See belows:
- EfiPciHostBridgeBeginEnumeration - Resets the host bridge PCI apertures and internal data
+ EfiPciHostBridgeBeginEnumeration Resets the host bridge PCI apertures and internal data
structures. The PCI enumerator should issue this notification
before starting a fresh enumeration process. Enumeration cannot
be restarted after sending any other notification such as
EfiPciHostBridgeBeginBusAllocation.
- EfiPciHostBridgeBeginBusAllocation - The bus allocation phase is about to begin. No specific action is
+ EfiPciHostBridgeBeginBusAllocation The bus allocation phase is about to begin. No specific action is
required here. This notification can be used to perform any
chipset-specific programming.
- EfiPciHostBridgeEndBusAllocation - The bus allocation and bus programming phase is complete. No
+ EfiPciHostBridgeEndBusAllocation The bus allocation and bus programming phase is complete. No
specific action is required here. This notification can be used to
perform any chipset-specific programming.
- EfiPciHostBridgeBeginResourceAllocation - The resource allocation phase is about to begin. No specific
- action is required here. This notification can be used to perform
- any chipset-specific programming.
- EfiPciHostBridgeAllocateResources - Allocates resources per previously submitted requests for all the PCI
+ EfiPciHostBridgeBeginResourceAllocation
+ The resource allocation phase is about to begin. No specific
+ action is required here. This notification can be used to perform
+ any chipset-specific programming.
+ EfiPciHostBridgeAllocateResources Allocates resources per previously submitted requests for all the PCI
root bridges. These resource settings are returned on the next call to
GetProposedResources(). Before calling NotifyPhase() with a Phase of
- EfiPciHostBridgeAllocateResource, the PCI bus enumerator is responsible for gathering I/O and memory requests for
+ EfiPciHostBridgeAllocateResource, the PCI bus enumerator is responsible
+ for gathering I/O and memory requests for
all the PCI root bridges and submitting these requests using
SubmitResources(). This function pads the resource amount
to suit the root bridge hardware, takes care of dependencies between
the PCI root bridges, and calls the Global Coherency Domain (GCD)
with the allocation request. In the case of padding, the allocated range
could be bigger than what was requested.
- EfiPciHostBridgeSetResources - Programs the host bridge hardware to decode previously allocated
+ EfiPciHostBridgeSetResources Programs the host bridge hardware to decode previously allocated
resources (proposed resources) for all the PCI root bridges. After the
hardware is programmed, reassigning resources will not be supported.
The bus settings are not affected.
- EfiPciHostBridgeFreeResources - Deallocates resources that were previously allocated for all the PCI
+ EfiPciHostBridgeFreeResources Deallocates resources that were previously allocated for all the PCI
root bridges and resets the I/O and memory apertures to their initial
state. The bus settings are not affected. If the request to allocate
resources fails, the PCI enumerator can use this notification to
deallocate previous resources, adjust the requests, and retry
allocation.
- EfiPciHostBridgeEndResourceAllocation- The resource allocation phase is completed. No specific action is
+ EfiPciHostBridgeEndResourceAllocation The resource allocation phase is completed. No specific action is
required here. This notification can be used to perform any chipsetspecific
programming.
-
+
@param[in] PciResAlloc The instance pointer of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
@param[in] Phase The phase during enumeration
-
+
@retval EFI_NOT_READY This phase cannot be entered at this time. For example, this error
is valid for a Phase of EfiPciHostBridgeAllocateResources if
SubmitResources() has not been called for one or more
@@ -398,25 +421,25 @@ NotifyPhase ( );
/**
- Provides the hooks from the PCI bus driver to every PCI controller (device/function) at various
- stages of the PCI enumeration process that allow the host bridge driver to preinitialize individual
- PCI controllers before enumeration.
-
- This function is called during the PCI enumeration process. No specific action is expected from this
- member function. It allows the host bridge driver to preinitialize individual PCI controllers before
- enumeration.
-
- @param Bridge Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance.
- @param Bus The bus number of the pci device.
- @param Device The device number of the pci device.
- @param Func The function number of the pci device.
- @param Phase The phase of the PCI device enumeration.
-
- @retval EFI_SUCCESS The requested parameters were returned.
- @retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
- @retval EFI_INVALID_PARAMETER Phase is not a valid phase that is defined in
- EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE.
- @retval EFI_DEVICE_ERROR Programming failed due to a hardware error. The PCI enumerator should
+ Provides the hooks from the PCI bus driver to every PCI controller (device/function) at various
+ stages of the PCI enumeration process that allow the host bridge driver to preinitialize individual
+ PCI controllers before enumeration.
+
+ This function is called during the PCI enumeration process. No specific action is expected from this
+ member function. It allows the host bridge driver to preinitialize individual PCI controllers before
+ enumeration.
+
+ @param Bridge Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance.
+ @param Bus The bus number of the pci device.
+ @param Device The device number of the pci device.
+ @param Func The function number of the pci device.
+ @param Phase The phase of the PCI device enumeration.
+
+ @retval EFI_SUCCESS The requested parameters were returned.
+ @retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
+ @retval EFI_INVALID_PARAMETER Phase is not a valid phase that is defined in
+ EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE.
+ @retval EFI_DEVICE_ERROR Programming failed due to a hardware error. The PCI enumerator should
not enumerate this device, including its child devices if it is a PCI-to-PCI
bridge.
@@ -431,17 +454,27 @@ PreprocessController ( );
/**
- Hot plug request notify.
-
- @param This - A pointer to the hot plug request protocol.
- @param Operation - The operation.
- @param Controller - A pointer to the controller.
- @param RemainingDevicePath - A pointer to the device path.
- @param NumberOfChildren - A the number of child handle in the ChildHandleBuffer.
- @param ChildHandleBuffer - A pointer to the array contain the child handle.
-
- @retval EFI_NOT_FOUND Can not find bridge according to controller handle.
- @retval EFI_SUCCESS Success operating.
+ This function allows the PCI bus driver to be notified to act as requested when a hot-plug event has
+ happened on the hot-plug controller. Currently, the operations include add operation and remove operation..
+
+ @param This A pointer to the hot plug request protocol.
+ @param Operation The operation the PCI bus driver is requested to make.
+ @param Controller The handle of the hot-plug controller.
+ @param RemainingDevicePath The remaining device path for the PCI-like hot-plug device.
+ @param NumberOfChildren The number of child handles.
+ For a add operation, it is an output parameter.
+ For a remove operation, it?¡¥s an input parameter.
+ @param ChildHandleBuffer The buffer which contains the child handles.
+
+ @retval EFI_INVALID_PARAMETER Operation is not a legal value.
+ Controller is NULL or not a valid handle.
+ NumberOfChildren is NULL.
+ ChildHandleBuffer is NULL while Operation is add.
+ @retval EFI_OUT_OF_RESOURCES There are no enough resources to start the devices.
+ @retval EFI_NOT_FOUND Can not find bridge according to controller handle.
+ @retval EFI_SUCCESS The handles for the specified device have been created or destroyed
+ as requested, and for an add operation, the new handles are
+ returned in ChildHandleBuffer.
**/
EFI_STATUS
EFIAPI
@@ -456,11 +489,12 @@ PciHotPlugRequestNotify ( /**
Search hostbridge according to given handle
-
- @param RootBridgeHandle - Host bridge handle.
- @return TRUE Found.
- @return FALSE Not found.
+ @param RootBridgeHandle Host bridge handle.
+
+ @retval TRUE Found host bridge handle.
+ @retval FALSE Not found hot bridge handle.
+
**/
BOOLEAN
SearchHostBridgeHandle (
@@ -468,9 +502,14 @@ SearchHostBridgeHandle ( );
/**
- Add host bridge handle to global variable for enumating.
-
- @param HostBridgeHandle host bridge handle.
+ Add host bridge handle to global variable for enumerating.
+
+ @param HostBridgeHandle Host bridge handle.
+
+ @retval EFI_SUCCESS Successfully added host bridge.
+ @retval EFI_ABORTED Host bridge is NULL, or given host bridge
+ has been in host bridge list.
+
**/
EFI_STATUS
AddHostBridgeEnumerator (
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index ea848d4f83..445d1cbbbc 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c @@ -1,4 +1,5 @@ /** @file
+ PCI emumeration support functions implementation for PCI Bus module.
Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
@@ -11,31 +12,28 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/
-
#include "PciBus.h"
-#include "PciEnumeratorSupport.h"
-#include "PciCommand.h"
-#include "PciIo.h"
/**
This routine is used to check whether the pci device is present.
-
+
@param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- @param Pci Output buffer for PCI device structure.
+ @param Pci Output buffer for PCI device configuration space.
@param Bus PCI bus NO.
@param Device PCI device NO.
@param Func PCI Func NO.
-
- @retval EFI_NOT_FOUND device not present.
- @retval EFI_SUCCESS device is found.
+
+ @retval EFI_NOT_FOUND PCI device not present.
+ @retval EFI_SUCCESS PCI device is found.
+
**/
EFI_STATUS
PciDevicePresent (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
- PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
+ OUT PCI_TYPE00 *Pci,
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Func
)
{
UINT64 Address;
@@ -47,31 +45,29 @@ PciDevicePresent ( Address = EFI_PCI_ADDRESS (Bus, Device, Func, 0);
//
- // Read the Vendor Id register
+ // Read the Vendor ID register
//
Status = PciRootBridgeIoRead (
- PciRootBridgeIo,
- NULL,
- EfiPciWidthUint32,
- Address,
- 1,
- Pci
- );
+ PciRootBridgeIo,
+ NULL,
+ EfiPciWidthUint32,
+ Address,
+ 1,
+ Pci
+ );
if (!EFI_ERROR (Status) && (Pci->Hdr).VendorId != 0xffff) {
-
//
// Read the entire config header for the device
//
-
Status = PciRootBridgeIoRead (
- PciRootBridgeIo,
- NULL,
- EfiPciWidthUint32,
- Address,
- sizeof (PCI_TYPE00) / sizeof (UINT32),
- Pci
- );
+ PciRootBridgeIo,
+ NULL,
+ EfiPciWidthUint32,
+ Address,
+ sizeof (PCI_TYPE00) / sizeof (UINT32),
+ Pci
+ );
return EFI_SUCCESS;
}
@@ -80,17 +76,22 @@ PciDevicePresent ( }
/**
- Collect all the resource information under this root bridge
+ Collect all the resource information under this root bridge.
+
A database that records all the information about pci device subject to this
root bridge will then be created.
-
+
@param Bridge Parent bridge instance.
- @param StartBusNumber Bus number of begining.
+ @param StartBusNumber Bus number of begining.
+
+ @retval EFI_SUCCESS PCI device is found.
+ @retval other Some error occurred when reading PCI bridge information.
+
**/
EFI_STATUS
PciPciDeviceInfoCollector (
IN PCI_IO_DEVICE *Bridge,
- UINT8 StartBusNumber
+ IN UINT8 StartBusNumber
)
{
EFI_STATUS Status;
@@ -111,15 +112,13 @@ PciPciDeviceInfoCollector ( //
// Check to see whether PCI device is present
//
-
Status = PciDevicePresent (
- Bridge->PciRootBridgeIo,
- &Pci,
- (UINT8) StartBusNumber,
- (UINT8) Device,
- (UINT8) Func
- );
-
+ Bridge->PciRootBridgeIo,
+ &Pci,
+ (UINT8) StartBusNumber,
+ (UINT8) Device,
+ (UINT8) Func
+ );
if (!EFI_ERROR (Status)) {
//
@@ -131,19 +130,18 @@ PciPciDeviceInfoCollector ( // Collect all the information about the PCI device discovered
//
Status = PciSearchDevice (
- Bridge,
- &Pci,
- (UINT8) StartBusNumber,
- Device,
- Func,
- &PciIoDevice
- );
+ Bridge,
+ &Pci,
+ (UINT8) StartBusNumber,
+ Device,
+ Func,
+ &PciIoDevice
+ );
//
// Recursively scan PCI busses on the other side of PCI-PCI bridges
//
//
-
if (!EFI_ERROR (Status) && (IS_PCI_BRIDGE (&Pci) || IS_CARDBUS_BRIDGE (&Pci))) {
//
@@ -151,7 +149,7 @@ PciPciDeviceInfoCollector ( //
PciIo = &(PciIoDevice->PciIo);
- Status = PciIoRead (PciIo, EfiPciIoWidthUint8, 0x19, 1, &SecBus);
+ Status = PciIoRead (PciIo, EfiPciIoWidthUint8, PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET, 1, &SecBus);
if (EFI_ERROR (Status)) {
return Status;
@@ -166,9 +164,9 @@ PciPciDeviceInfoCollector ( // Deep enumerate the next level bus
//
Status = PciPciDeviceInfoCollector (
- PciIoDevice,
- (UINT8) (SecBus)
- );
+ PciIoDevice,
+ (UINT8) (SecBus)
+ );
}
@@ -188,14 +186,18 @@ PciPciDeviceInfoCollector ( }
/**
- Seach required device and get PCI device info block
-
+ Seach required device and create PCI device instance.
+
@param Bridge Parent bridge instance.
- @param Pci Output of PCI device info block.
+ @param Pci Input PCI device information block.
@param Bus PCI bus NO.
@param Device PCI device NO.
@param Func PCI func NO.
- @param PciDevice output of searched PCI device instance.
+ @param PciDevice Output of searched PCI device instance.
+
+ @retval EFI_SUCCESS Successfully created PCI device instance.
+ @retval EFI_OUT_OF_RESOURCES Cannot get PCI device information.
+
**/
EFI_STATUS
PciSearchDevice (
@@ -305,23 +307,24 @@ PciSearchDevice ( }
/**
- Create PCI private data for PCI device
-
- @param Bridge Parent bridge instance.
- @param Pci PCI bar block
- @param Bus PCI device Bus NO.
- @param Device PCI device DeviceNO.
- @param Func PCI device's func NO.
-
- @return new PCI device's private date structure.
+ Create PCI device instance for PCI device.
+
+ @param Bridge Parent bridge instance.
+ @param Pci Input PCI device information block.
+ @param Bus PCI device Bus NO.
+ @param Device PCI device Device NO.
+ @param Func PCI device's func NO.
+
+ @return Created PCI device instance.
+
**/
PCI_IO_DEVICE *
GatherDeviceInfo (
IN PCI_IO_DEVICE *Bridge,
IN PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Func
)
{
UINTN Offset;
@@ -370,23 +373,24 @@ GatherDeviceInfo ( }
/**
- Create private data for bridge device's PPB.
-
- @param Bridge Parent bridge
- @param Pci Pci device block
- @param Bus Bridge device's bus NO.
- @param Device Bridge device's device NO.
- @param Func Bridge device's func NO.
-
- @return bridge device instance.
+ Create PCI device instance for PCI-PCI bridge.
+
+ @param Bridge Parent bridge instance.
+ @param Pci Input PCI device information block.
+ @param Bus PCI device Bus NO.
+ @param Device PCI device Device NO.
+ @param Func PCI device's func NO.
+
+ @return Created PCI device instance.
+
**/
PCI_IO_DEVICE *
GatherPpbInfo (
IN PCI_IO_DEVICE *Bridge,
IN PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Func
)
{
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
@@ -463,7 +467,7 @@ GatherPpbInfo ( );
//
- // test if it supports 64 memory or not
+ // Test if it supports 64 memory or not
//
if (!EFI_ERROR (Status)) {
@@ -492,24 +496,26 @@ GatherPpbInfo ( return PciIoDevice;
}
+
/**
- Create private data for hotplug bridge device
-
- @param Bridge Parent bridge instance
- @param Pci PCI bar block
- @param Bus hotplug bridge device's bus NO.
- @param Device hotplug bridge device's device NO.
- @param Func hotplug bridge device's Func NO.
-
- @return hotplug bridge device instance.
+ Create PCI device instance for PCI Card bridge device.
+
+ @param Bridge Parent bridge instance.
+ @param Pci Input PCI device information block.
+ @param Bus PCI device Bus NO.
+ @param Device PCI device Device NO.
+ @param Func PCI device's func NO.
+
+ @return Created PCI device instance.
+
**/
PCI_IO_DEVICE *
GatherP2CInfo (
IN PCI_IO_DEVICE *Bridge,
IN PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Func
)
{
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
@@ -543,8 +549,8 @@ GatherP2CInfo ( // Initalize the bridge control register
//
PCI_DISABLE_BRIDGE_CONTROL_REGISTER (PciIoDevice, EFI_PCCARD_BRIDGE_CONTROL_BITS_OWNED);
-
}
+
//
// P2C only has one bar that is in 0x10
//
@@ -562,12 +568,13 @@ GatherP2CInfo ( }
/**
- Create device path for pci deivce
-
+ Create device path for pci deivce.
+
@param ParentDevicePath Parent bridge's path.
@param PciIoDevice Pci device instance.
-
- @return device path protocol instance for specific pci device.
+
+ @return Device path protocol instance for specific pci device.
+
**/
EFI_DEVICE_PATH_PROTOCOL *
CreatePciDevicePath (
@@ -593,25 +600,24 @@ CreatePciDevicePath ( }
/**
- Check the bar is existed or not.
+ Check whether the bar is existed or not.
- @param PciIoDevice - A pointer to the PCI_IO_DEVICE.
- @param Offset - The offset.
- @param BarLengthValue - The bar length value.
- @param OriginalBarValue - The original bar value.
+ @param PciIoDevice A pointer to the PCI_IO_DEVICE.
+ @param Offset The offset.
+ @param BarLengthValue The bar length value returned.
+ @param OriginalBarValue The original bar value returned.
- @retval EFI_NOT_FOUND - The bar don't exist.
- @retval EFI_SUCCESS - The bar exist.
+ @retval EFI_NOT_FOUND The bar doesn't exist.
+ @retval EFI_SUCCESS The bar exist.
**/
EFI_STATUS
BarExisted (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN UINTN Offset,
- OUT UINT32 *BarLengthValue,
- OUT UINT32 *OriginalBarValue
+ IN PCI_IO_DEVICE *PciIoDevice,
+ IN UINTN Offset,
+ OUT UINT32 *BarLengthValue,
+ OUT UINT32 *OriginalBarValue
)
-
{
EFI_PCI_IO_PROTOCOL *PciIo;
UINT32 OriginalValue;
@@ -623,7 +629,6 @@ BarExisted ( //
// Preserve the original value
//
-
PciIoRead (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &OriginalValue);
//
@@ -660,23 +665,24 @@ BarExisted ( }
/**
- Test whether the device can support attributes
-
- @param PciIoDevice Pci device instance.
- @param Command Command register value.
- @param BridgeControl Bridge control value for PPB or P2C.
- @param OldCommand Old command register offset.
- @param OldBridgeControl Old Bridge control value for PPB or P2C.
-
- @return EFI_SUCCESS.
+ Test whether the device can support given attributes.
+
+ @param PciIoDevice Pci device instance.
+ @param Command Input command register value, and
+ returned supported register value.
+ @param BridgeControl Inout bridge control value for PPB or P2C, and
+ returned supported bridge control value.
+ @param OldCommand Returned and stored old command register offset.
+ @param OldBridgeControl Returned and stored old Bridge control value for PPB or P2C.
+
**/
-EFI_STATUS
+VOID
PciTestSupportedAttribute (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN UINT16 *Command,
- IN UINT16 *BridgeControl,
- IN UINT16 *OldCommand,
- IN UINT16 *OldBridgeControl
+ IN PCI_IO_DEVICE *PciIoDevice,
+ IN OUT UINT16 *Command,
+ IN OUT UINT16 *BridgeControl,
+ OUT UINT16 *OldCommand,
+ OUT UINT16 *OldBridgeControl
)
{
EFI_TPL OldTpl;
@@ -733,20 +739,18 @@ PciTestSupportedAttribute ( *OldBridgeControl = 0;
*BridgeControl = 0;
}
-
- return EFI_SUCCESS;
}
/**
- Set the supported or current attributes of a PCI device
-
- @param PciIoDevice - Structure pointer for PCI device.
- @param Command - Command register value.
- @param BridgeControl - Bridge control value for PPB or P2C.
- @param Option - Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.
-
+ Set the supported or current attributes of a PCI device.
+
+ @param PciIoDevice Structure pointer for PCI device.
+ @param Command Command register value.
+ @param BridgeControl Bridge control value for PPB or P2C.
+ @param Option Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.
+
**/
-EFI_STATUS
+VOID
PciSetDeviceAttribute (
IN PCI_IO_DEVICE *PciIoDevice,
IN UINT16 Command,
@@ -830,15 +834,17 @@ PciSetDeviceAttribute ( } else {
PciIoDevice->Attributes = Attributes;
}
-
- return EFI_SUCCESS;
}
/**
Determine if the device can support Fast Back to Back attribute.
-
+
@param PciIoDevice Pci device instance.
@param StatusIndex Status register value.
+
+ @retval EFI_SUCCESS This device support Fast Back to Back attribute.
+ @retval EFI_UNSUPPORTED This device doesn't support Fast Back to Back attribute.
+
**/
EFI_STATUS
GetFastBackToBackSupport (
@@ -867,7 +873,6 @@ GetFastBackToBackSupport ( } else {
return EFI_UNSUPPORTED;
}
-
}
/**
@@ -875,10 +880,9 @@ GetFastBackToBackSupport ( It can only be used after the first full Option ROM process.
@param PciIoDevice Pci device instance.
-
- @retval EFI_SUCCESS Success Operation.
+
**/
-EFI_STATUS
+VOID
ProcessOptionRomLight (
IN PCI_IO_DEVICE *PciIoDevice
)
@@ -907,15 +911,13 @@ ProcessOptionRomLight ( CurrentLink = CurrentLink->ForwardLink;
}
-
- return EFI_SUCCESS;
}
/**
- Determine the related attributes of all devices under a Root Bridge
-
- @param PciIoDevice PCI device instance.
-
+ Determine the related attributes of all devices under a Root Bridge.
+
+ @param PciIoDevice PCI device instance.
+
**/
EFI_STATUS
DetermineDeviceAttribute (
@@ -927,11 +929,6 @@ DetermineDeviceAttribute ( UINT16 OldCommand;
UINT16 OldBridgeControl;
BOOLEAN FastB2BSupport;
-
- /*
- UINT8 IdePI;
- EFI_PCI_IO_PROTOCOL *PciIo;
- */
PCI_IO_DEVICE *Temp;
LIST_ENTRY *CurrentLink;
EFI_STATUS Status;
@@ -982,38 +979,6 @@ DetermineDeviceAttribute ( // Enable other supported attributes but not defined in PCI_IO_PROTOCOL
//
PCI_ENABLE_COMMAND_REGISTER (PciIoDevice, EFI_PCI_COMMAND_MEMORY_WRITE_AND_INVALIDATE);
-
- //
- // Enable IDE native mode
- //
- /*
- if (IS_PCI_IDE(&PciIoDevice->Pci)) {
-
- PciIo = &PciIoDevice->PciIo;
-
- PciIoRead (
- PciIo,
- EfiPciIoWidthUint8,
- 0x09,
- 1,
- &IdePI
- );
-
- //
- // Set native mode if it can be supported
- //
- IdePI |= (((IdePI & 0x0F) >> 1) & 0x05);
-
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint8,
- 0x09,
- 1,
- &IdePI
- );
-
- }
- */
}
FastB2BSupport = TRUE;
@@ -1082,10 +1047,14 @@ DetermineDeviceAttribute ( }
/**
- This routine is used to update the bar information for those incompatible PCI device
-
+ This routine is used to update the bar information for those incompatible PCI device.
+
@param PciIoDevice Pci device instance.
- @return EFI_UNSUPPORTED failed to update Pci Info.
+
+ @retval EFI_SUCCESS Successfully updated bar information.
+ @retval EFI_UNSUPPORTED Given PCI device doesn't belong to incompatible PCI device list.
+ @retval other Failed to check incompatibility device.
+
**/
EFI_STATUS
UpdatePciInfo (
@@ -1227,21 +1196,21 @@ UpdatePciInfo ( if (Configuration != NULL) {
FreePool (Configuration);
}
- return Status;
+ return EFI_SUCCESS;
}
/**
- This routine will update the alignment with the new alignment
-
- @param Alignment old alignment.
- @param NewAlignment new alignment.
-
+ This routine will update the alignment with the new alignment.
+
+ @param Alignment Old alignment.
+ @param NewAlignment New alignment.
+
**/
VOID
SetNewAlign (
- IN UINT64 *Alignment,
- IN UINT64 NewAlignment
+ IN UINT64 *Alignment,
+ IN UINT64 NewAlignment
)
{
UINT64 OldAlignment;
@@ -1302,13 +1271,14 @@ SetNewAlign ( }
/**
- Parse PCI bar bit.
-
+ Parse PCI bar information and fill them into PCI device instance.
+
@param PciIoDevice Pci device instance.
- @param Offset bar offset.
- @param BarIndex bar index.
-
- @return next bar offset.
+ @param Offset Bar offset.
+ @param BarIndex Bar index.
+
+ @return Next bar offset.
+
**/
UINTN
PciParseBar (
@@ -1490,13 +1460,15 @@ PciParseBar ( /**
This routine is used to initialize the bar of a PCI device.
- It can be called typically when a device is going to be rejected.
@param PciIoDevice Pci device instance.
+
+ @note It can be called typically when a device is going to be rejected.
+
**/
-EFI_STATUS
+VOID
InitializePciDevice (
- IN PCI_IO_DEVICE *PciIoDevice
+ IN PCI_IO_DEVICE *PciIoDevice
)
{
EFI_PCI_IO_PROTOCOL *PciIo;
@@ -1512,18 +1484,17 @@ InitializePciDevice ( for (Offset = 0x10; Offset <= 0x24; Offset += sizeof (UINT32)) {
PciIoWrite (PciIo, EfiPciIoWidthUint32, Offset, 1, &gAllOne);
}
-
- return EFI_SUCCESS;
}
/**
- Init PPB for bridge device
-
- @param PciIoDevice Pci device instance.
+ This routine is used to initialize the bar of a PCI-PCI Bridge device.
+
+ @param PciIoDevice PCI-PCI bridge device instance.
+
**/
-EFI_STATUS
+VOID
InitializePpb (
- IN PCI_IO_DEVICE *PciIoDevice
+ IN PCI_IO_DEVICE *PciIoDevice
)
{
EFI_PCI_IO_PROTOCOL *PciIo;
@@ -1557,18 +1528,17 @@ InitializePpb ( // Force Interrupt line to zero for cards that come up randomly
//
PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero);
-
- return EFI_SUCCESS;
}
/**
- Init private data for Hotplug bridge device
-
- @param PciIoDevice hotplug bridge device.
+ This routine is used to initialize the bar of a PCI Card Bridge device.
+
+ @param PciIoDevice PCI Card bridge device.
+
**/
-EFI_STATUS
+VOID
InitializeP2C (
- IN PCI_IO_DEVICE *PciIoDevice
+ IN PCI_IO_DEVICE *PciIoDevice
)
{
EFI_PCI_IO_PROTOCOL *PciIo;
@@ -1596,28 +1566,28 @@ InitializeP2C ( // Force Interrupt line to zero for cards that come up randomly
//
PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero);
- return EFI_SUCCESS;
}
/**
Create and initiliaze general PCI I/O device instance for
PCI device/bridge device/hotplug bridge device.
-
+
@param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- @param Pci Pci bar block.
- @param Bus device Bus NO.
- @param Device device device NO.
- @param Func device func NO.
-
- @return instance of PCI device.
+ @param Pci Input Pci information block.
+ @param Bus Device Bus NO.
+ @param Device Device device NO.
+ @param Func Device func NO.
+
+ @return Instance of PCI device. NULL means no instance created.
+
**/
PCI_IO_DEVICE *
CreatePciIoDevice (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
IN PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Func
)
{
PCI_IO_DEVICE *PciIoDevice;
@@ -1659,7 +1629,6 @@ CreatePciIoDevice ( InitializePciDriverOverrideInstance (PciIoDevice);
InitializePciLoadFile2 (PciIoDevice);
-
//
// Initialize the reserved resource list
//
@@ -1680,12 +1649,15 @@ CreatePciIoDevice ( /**
This routine is used to enumerate entire pci bus system
- in a given platform
+ in a given platform.
+
It is only called on the second start on the same Root Bridge.
- @param Controller Parent bridge handler.
-
- @return status of operation.
+ @param Controller Parent bridge handler.
+
+ @retval EFI_SUCCESS PCI enumeration finished successfully.
+ @retval other Some error occurred when enumerating the pci bus system.
+
**/
EFI_STATUS
PciEnumeratorLight (
@@ -1745,7 +1717,7 @@ PciEnumeratorLight ( }
//
- // Record the root bridge io protocol
+ // Record the root bridgeio protocol
//
RootBridgeDev->PciRootBridgeIo = PciRootBridgeIo;
@@ -1790,15 +1762,16 @@ PciEnumeratorLight ( }
/**
- Get bus range.
-
+ Get bus range from PCI resource descriptor list.
+
@param Descriptors A pointer to the address space descriptor.
- @param MinBus The min bus.
- @param MaxBus The max bus.
- @param BusRange The bus range.
-
- @retval EFI_SUCCESS Success operation.
- @retval EFI_NOT_FOUND can not find the specific bus.
+ @param MinBus The min bus returned.
+ @param MaxBus The max bus returned.
+ @param BusRange The bus range returned.
+
+ @retval EFI_SUCCESS Successfully got bus range.
+ @retval EFI_NOT_FOUND Can not find the specific bus.
+
**/
EFI_STATUS
PciGetBusRange (
@@ -1808,7 +1781,6 @@ PciGetBusRange ( OUT UINT16 *BusRange
)
{
-
while ((*Descriptors)->Desc != ACPI_END_TAG_DESCRIPTOR) {
if ((*Descriptors)->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS) {
if (MinBus != NULL) {
@@ -1838,7 +1810,8 @@ PciGetBusRange ( @param RootBridgeDev Pci device instance.
@retval EFI_SUCCESS This device started.
-
+ @retval other Failed to get PCI Root Bridge I/O protocol.
+
**/
EFI_STATUS
StartManagingRootBridge (
@@ -1852,8 +1825,8 @@ StartManagingRootBridge ( //
// Get the root bridge handle
//
- RootBridgeHandle = RootBridgeDev->Handle;
- PciRootBridgeIo = NULL;
+ RootBridgeHandle = RootBridgeDev->Handle;
+ PciRootBridgeIo = NULL;
//
// Get the pci root bridge io protocol
@@ -1881,13 +1854,13 @@ StartManagingRootBridge ( }
/**
- This routine can be used to check whether a PCI device should be rejected when light enumeration
+ This routine can be used to check whether a PCI device should be rejected when light enumeration.
@param PciIoDevice Pci device instance.
@retval TRUE This device should be rejected.
@retval FALSE This device shouldn't be rejected.
-
+
**/
BOOLEAN
IsPciDeviceRejected (
@@ -1945,7 +1918,6 @@ IsPciDeviceRejected ( //
// IO Bar
//
-
Mask = 0xFFFFFFFC;
TestValue = TestValue & Mask;
if ((TestValue != 0) && (TestValue == (OldValue & Mask))) {
@@ -1957,7 +1929,6 @@ IsPciDeviceRejected ( //
// Mem Bar
//
-
Mask = 0xFFFFFFF0;
TestValue = TestValue & Mask;
@@ -1972,7 +1943,6 @@ IsPciDeviceRejected ( //
// Test its high 32-Bit BAR
//
-
Status = BarExisted (PciIoDevice, BarOffset, &TestValue, &OldValue);
if (TestValue == OldValue) {
return TRUE;
@@ -1995,12 +1965,13 @@ IsPciDeviceRejected ( }
/**
- Reset and all bus number from specific bridge.
-
+ Reset all bus number from specific bridge.
+
@param Bridge Parent specific bridge.
- @param StartBusNumber start bus number.
+ @param StartBusNumber Start bus number.
+
**/
-EFI_STATUS
+VOID
ResetAllPpbBusNumber (
IN PCI_IO_DEVICE *Bridge,
IN UINT8 StartBusNumber
@@ -2071,7 +2042,5 @@ ResetAllPpbBusNumber ( }
}
}
-
- return EFI_SUCCESS;
}
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.h b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.h index 1900990a15..3bbd5431ad 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.h +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.h @@ -1,64 +1,74 @@ /** @file
+ PCI emumeration support functions declaration for PCI Bus module.
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
-**/
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
#ifndef _EFI_PCI_ENUMERATOR_SUPPORT_H_
#define _EFI_PCI_ENUMERATOR_SUPPORT_H_
/**
This routine is used to check whether the pci device is present.
-
- @param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
- @param Pci Output buffer for PCI device structure
- @param Bus PCI bus NO
- @param Device PCI device NO
- @param Func PCI Func NO
-
- @retval EFI_NOT_FOUND device not present
- @retval EFI_SUCCESS device is found.
+
+ @param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
+ @param Pci Output buffer for PCI device configuration space.
+ @param Bus PCI bus NO.
+ @param Device PCI device NO.
+ @param Func PCI Func NO.
+
+ @retval EFI_NOT_FOUND PCI device not present.
+ @retval EFI_SUCCESS PCI device is found.
+
**/
EFI_STATUS
PciDevicePresent (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
- PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
+ OUT PCI_TYPE00 *Pci,
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Func
);
/**
- Collect all the resource information under this root bridge
+ Collect all the resource information under this root bridge.
+
A database that records all the information about pci device subject to this
root bridge will then be created.
-
- @param Bridge Parent bridge instance
- @param StartBusNumber Bus number of begining
+
+ @param Bridge Parent bridge instance.
+ @param StartBusNumber Bus number of begining.
+
+ @retval EFI_SUCCESS PCI device is found.
+ @retval other Some error occurred when reading PCI bridge information.
+
**/
EFI_STATUS
PciPciDeviceInfoCollector (
IN PCI_IO_DEVICE *Bridge,
- UINT8 StartBusNumber
+ IN UINT8 StartBusNumber
);
/**
- Seach required device and get PCI device info block
-
- @param Bridge Parent bridge instance
- @param Pci Output of PCI device info block
+ Seach required device and create PCI device instance.
+
+ @param Bridge Parent bridge instance.
+ @param Pci Input PCI device information block.
@param Bus PCI bus NO.
@param Device PCI device NO.
@param Func PCI func NO.
- @param PciDevice output of searched PCI device instance
+ @param PciDevice Output of searched PCI device instance.
+
+ @retval EFI_SUCCESS Successfully created PCI device instance.
+ @retval EFI_OUT_OF_RESOURCES Cannot get PCI device information.
+
**/
EFI_STATUS
PciSearchDevice (
@@ -71,129 +81,134 @@ PciSearchDevice ( );
/**
- Create PCI private data for PCI device
-
- @param Bridge Parent bridge instance
- @param Pci PCI bar block
- @param Bus PCI device Bus NO.
- @param Device PCI device DeviceNO.
- @param Func PCI device's func NO.
-
- @return new PCI device's private date structure.
+ Create PCI device instance for PCI device.
+
+ @param Bridge Parent bridge instance.
+ @param Pci Input PCI device information block.
+ @param Bus PCI device Bus NO.
+ @param Device PCI device Device NO.
+ @param Func PCI device's func NO.
+
+ @return Created PCI device instance.
+
**/
-PCI_IO_DEVICE *
+PCI_IO_DEVICE *
GatherDeviceInfo (
IN PCI_IO_DEVICE *Bridge,
IN PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Func
);
/**
- Create private data for bridge device's PPB.
-
- @param Bridge Parent bridge
- @param Pci Pci device block
- @param Bus Bridge device's bus NO.
- @param Device Bridge device's device NO.
- @param Func Bridge device's func NO.
-
- @return bridge device instance.
+ Create PCI device instance for PCI-PCI bridge.
+
+ @param Bridge Parent bridge instance.
+ @param Pci Input PCI device information block.
+ @param Bus PCI device Bus NO.
+ @param Device PCI device Device NO.
+ @param Func PCI device's func NO.
+
+ @return Created PCI device instance.
+
**/
-PCI_IO_DEVICE *
+PCI_IO_DEVICE *
GatherPpbInfo (
IN PCI_IO_DEVICE *Bridge,
IN PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Func
);
/**
- Create private data for hotplug bridge device
-
- @param Bridge Parent bridge instance
- @param Pci PCI bar block
- @param Bus hotplug bridge device's bus NO.
- @param Device hotplug bridge device's device NO.
- @param Func hotplug bridge device's Func NO.
-
- @return hotplug bridge device instance
+ Create PCI device instance for PCI Card bridge device.
+
+ @param Bridge Parent bridge instance.
+ @param Pci Input PCI device information block.
+ @param Bus PCI device Bus NO.
+ @param Device PCI device Device NO.
+ @param Func PCI device's func NO.
+
+ @return Created PCI device instance.
+
**/
-PCI_IO_DEVICE *
+PCI_IO_DEVICE *
GatherP2CInfo (
IN PCI_IO_DEVICE *Bridge,
IN PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Func
);
/**
- Create device path for pci deivce
-
+ Create device path for pci deivce.
+
@param ParentDevicePath Parent bridge's path.
@param PciIoDevice Pci device instance.
-
+
@return device path protocol instance for specific pci device.
+
**/
-EFI_DEVICE_PATH_PROTOCOL *
+EFI_DEVICE_PATH_PROTOCOL *
CreatePciDevicePath (
IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
IN PCI_IO_DEVICE *PciIoDevice
);
/**
- Check the bar is existed or not.
+ Check whether the bar is existed or not.
- @param PciIoDevice - A pointer to the PCI_IO_DEVICE.
- @param Offset - The offset.
- @param BarLengthValue - The bar length value.
- @param OriginalBarValue - The original bar value.
+ @param PciIoDevice A pointer to the PCI_IO_DEVICE.
+ @param Offset The offset.
+ @param BarLengthValue The bar length value returned.
+ @param OriginalBarValue The original bar value returned.
- @retval EFI_NOT_FOUND - The bar don't exist.
- @retval EFI_SUCCESS - The bar exist.
+ @retval EFI_NOT_FOUND The bar doesn't exist.
+ @retval EFI_SUCCESS The bar exist.
**/
EFI_STATUS
BarExisted (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN UINTN Offset,
- OUT UINT32 *BarLengthValue,
- OUT UINT32 *OriginalBarValue
+ IN PCI_IO_DEVICE *PciIoDevice,
+ IN UINTN Offset,
+ OUT UINT32 *BarLengthValue,
+ OUT UINT32 *OriginalBarValue
);
/**
- Test whether the device can support attributes
-
- @param PciIoDevice Pci device instance
- @param Command Command register value.
- @param BridgeControl Bridge control value for PPB or P2C.
- @param OldCommand Old command register offset
- @param OldBridgeControl Old Bridge control value for PPB or P2C.
-
- @return EFI_SUCCESS.
+ Test whether the device can support given attributes.
+
+ @param PciIoDevice Pci device instance.
+ @param Command Input command register value, and
+ returned supported register value.
+ @param BridgeControl Inout bridge control value for PPB or P2C, and
+ returned supported bridge control value.
+ @param OldCommand Returned and stored old command register offset.
+ @param OldBridgeControl Returned and stored old Bridge control value for PPB or P2C.
+
**/
-EFI_STATUS
+VOID
PciTestSupportedAttribute (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN UINT16 *Command,
- IN UINT16 *BridgeControl,
- IN UINT16 *OldCommand,
- IN UINT16 *OldBridgeControl
+ IN PCI_IO_DEVICE *PciIoDevice,
+ IN OUT UINT16 *Command,
+ IN OUT UINT16 *BridgeControl,
+ OUT UINT16 *OldCommand,
+ OUT UINT16 *OldBridgeControl
);
/**
- Set the supported or current attributes of a PCI device
-
- @param PciIoDevice - Structure pointer for PCI device.
- @param Command - Command register value.
- @param BridgeControl - Bridge control value for PPB or P2C.
- @param Option - Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.
-
+ Set the supported or current attributes of a PCI device.
+
+ @param PciIoDevice Structure pointer for PCI device.
+ @param Command Command register value.
+ @param BridgeControl Bridge control value for PPB or P2C.
+ @param Option Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.
+
**/
-EFI_STATUS
+VOID
PciSetDeviceAttribute (
IN PCI_IO_DEVICE *PciIoDevice,
IN UINT16 Command,
@@ -202,10 +217,14 @@ PciSetDeviceAttribute ( );
/**
- Determine if the device can support Fast Back to Back attribute
-
+ Determine if the device can support Fast Back to Back attribute.
+
@param PciIoDevice Pci device instance.
@param StatusIndex Status register value.
+
+ @retval EFI_SUCCESS This device support Fast Back to Back attribute.
+ @retval EFI_UNSUPPORTED This device doesn't support Fast Back to Back attribute.
+
**/
EFI_STATUS
GetFastBackToBackSupport (
@@ -214,10 +233,10 @@ GetFastBackToBackSupport ( );
/**
- Determine the related attributes of all devices under a Root Bridge
-
- @param PciIoDevice PCI device instance.
-
+ Determine the related attributes of all devices under a Root Bridge.
+
+ @param PciIoDevice PCI device instance.
+
**/
EFI_STATUS
DetermineDeviceAttribute (
@@ -225,10 +244,14 @@ DetermineDeviceAttribute ( );
/**
- This routine is used to update the bar information for those incompatible PCI device
-
+ This routine is used to update the bar information for those incompatible PCI device.
+
@param PciIoDevice Pci device instance.
- @return EFI_UNSUPPORTED failed to update Pci Info.
+
+ @retval EFI_SUCCESS Successfully updated bar information.
+ @retval EFI_UNSUPPORTED Given PCI device doesn't belong to incompatible PCI device list.
+ @retval other Failed to check incompatibility device.
+
**/
EFI_STATUS
UpdatePciInfo (
@@ -236,26 +259,27 @@ UpdatePciInfo ( );
/**
- This routine will update the alignment with the new alignment
-
- @param Alignment old alignment.
- @param NewAlignment new alignment.
-
+ This routine will update the alignment with the new alignment.
+
+ @param Alignment Old alignment.
+ @param NewAlignment New alignment.
+
**/
VOID
SetNewAlign (
- IN UINT64 *Alignment,
- IN UINT64 NewAlignment
+ IN UINT64 *Alignment,
+ IN UINT64 NewAlignment
);
/**
- Parse PCI bar bit.
-
+ Parse PCI bar information and fill them into PCI device instance.
+
@param PciIoDevice Pci device instance.
- @param Offset bar offset.
- @param BarIndex bar index.
-
- @return next bar offset.
+ @param Offset Bar offset.
+ @param BarIndex Bar index.
+
+ @return Next bar offset.
+
**/
UINTN
PciParseBar (
@@ -265,65 +289,73 @@ PciParseBar ( );
/**
- This routine is used to initialize the bar of a PCI device
- It can be called typically when a device is going to be rejected.
+ This routine is used to initialize the bar of a PCI device.
@param PciIoDevice Pci device instance.
+
+ @note It can be called typically when a device is going to be rejected.
+
**/
-EFI_STATUS
+VOID
InitializePciDevice (
- IN PCI_IO_DEVICE *PciIoDevice
+ IN PCI_IO_DEVICE *PciIoDevice
);
/**
- Init PPB for bridge device
-
- @param PciIoDevice Pci device instance.
+ This routine is used to initialize the bar of a PCI-PCI Bridge device.
+
+ @param PciIoDevice PCI-PCI bridge device instance.
+
**/
-EFI_STATUS
+VOID
InitializePpb (
- IN PCI_IO_DEVICE *PciIoDevice
+ IN PCI_IO_DEVICE *PciIoDevice
);
/**
- Init private data for Hotplug bridge device
-
- @param PciIoDevice hotplug bridge device.
+ This routine is used to initialize the bar of a PCI Card Bridge device.
+
+ @param PciIoDevice PCI Card bridge device.
+
**/
-EFI_STATUS
+VOID
InitializeP2C (
- IN PCI_IO_DEVICE *PciIoDevice
+ IN PCI_IO_DEVICE *PciIoDevice
);
/**
Create and initiliaze general PCI I/O device instance for
PCI device/bridge device/hotplug bridge device.
-
+
@param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- @param Pci Pci bar block
- @param Bus device Bus NO.
- @param Device device device NO.
- @param Func device func NO.
-
- @return instance of PCI device.
+ @param Pci Input Pci information block.
+ @param Bus Device Bus NO.
+ @param Device Device device NO.
+ @param Func Device func NO.
+
+ @return Instance of PCI device. NULL means no instance created.
+
**/
-PCI_IO_DEVICE *
+PCI_IO_DEVICE *
CreatePciIoDevice (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
IN PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func
+ IN UINT8 Bus,
+ IN UINT8 Device,
+ IN UINT8 Func
);
/**
This routine is used to enumerate entire pci bus system
- in a given platform
+ in a given platform.
+
It is only called on the second start on the same Root Bridge.
- @param Controller Parent bridge handler.
-
- @return status of operation.
+ @param Controller Parent bridge handler.
+
+ @retval EFI_SUCCESS PCI enumeration finished successfully.
+ @retval other Some error occurred when enumerating the pci bus system.
+
**/
EFI_STATUS
PciEnumeratorLight (
@@ -331,15 +363,16 @@ PciEnumeratorLight ( );
/**
- Get bus range.
-
+ Get bus range from PCI resource descriptor list.
+
@param Descriptors A pointer to the address space descriptor.
- @param MinBus The min bus.
- @param MaxBus The max bus.
- @param BusRange The bus range.
-
- @retval EFI_SUCCESS Success operation.
- @retval EFI_NOT_FOUND can not find the specific bus.
+ @param MinBus The min bus returned.
+ @param MaxBus The max bus returned.
+ @param BusRange The bus range returned.
+
+ @retval EFI_SUCCESS Successfully got bus range.
+ @retval EFI_NOT_FOUND Can not find the specific bus.
+
**/
EFI_STATUS
PciGetBusRange (
@@ -355,7 +388,8 @@ PciGetBusRange ( @param RootBridgeDev Pci device instance.
@retval EFI_SUCCESS This device started.
-
+ @retval other Failed to get PCI Root Bridge I/O protocol.
+
**/
EFI_STATUS
StartManagingRootBridge (
@@ -363,17 +397,30 @@ StartManagingRootBridge ( );
/**
- This routine can be used to check whether a PCI device should be rejected when light enumeration
+ This routine can be used to check whether a PCI device should be rejected when light enumeration.
@param PciIoDevice Pci device instance.
@retval TRUE This device should be rejected.
@retval FALSE This device shouldn't be rejected.
-
+
**/
BOOLEAN
IsPciDeviceRejected (
IN PCI_IO_DEVICE *PciIoDevice
);
+/**
+ Reset all bus number from specific bridge.
+
+ @param Bridge Parent specific bridge.
+ @param StartBusNumber Start bus number.
+
+**/
+VOID
+ResetAllPpbBusNumber (
+ IN PCI_IO_DEVICE *Bridge,
+ IN UINT8 StartBusNumber
+ );
+
#endif
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciHotPlugSupport.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciHotPlugSupport.c index 95d8167953..cb5d82f2e3 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciHotPlugSupport.c +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciHotPlugSupport.c @@ -1,31 +1,31 @@ /** @file
- This module provide support function for hot plug device.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+ PCI Hot Plug support functions implementation for PCI Bus module..
-**/
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
#include "PciBus.h"
-#include "PciHotPlugSupport.h"
-EFI_PCI_HOT_PLUG_INIT_PROTOCOL *gPciHotPlugInit;
-EFI_HPC_LOCATION *gPciRootHpcPool;
-UINTN gPciRootHpcCount;
-ROOT_HPC_DATA *gPciRootHpcData;
+EFI_PCI_HOT_PLUG_INIT_PROTOCOL *gPciHotPlugInit = NULL;
+EFI_HPC_LOCATION *gPciRootHpcPool = NULL;
+UINTN gPciRootHpcCount = 0;
+ROOT_HPC_DATA *gPciRootHpcData = NULL;
+
/**
- Init HPC private data.
-
- @param Event event object
- @param Context HPC private data.
+ Event notification function to set Hot Plug controller status.
+
+ @param Event The event that invoke this function.
+ @param Context The calling context, pointer to ROOT_HPC_DATA.
+
**/
VOID
EFIAPI
@@ -34,21 +34,21 @@ PciHPCInitialized ( IN VOID *Context
)
{
- ROOT_HPC_DATA *HpcData;
+ ROOT_HPC_DATA *HpcData;
HpcData = (ROOT_HPC_DATA *) Context;
HpcData->Initialized = TRUE;
-
}
/**
- Compare two device path
-
- @param DevicePath1 the first device path want to be compared.
- @param DevicePath2 the first device path want to be compared.
-
- @retval TRUE equal.
- @retval FALSE different.
+ Compare two device pathes to check if they are exactly same.
+
+ @param DevicePath1 A pointer to the first device path data structure.
+ @param DevicePath2 A pointer to the second device path data structure.
+
+ @retval TRUE They are same.
+ @retval FALSE They are not same.
+
**/
BOOLEAN
EfiCompareDevicePath (
@@ -74,8 +74,17 @@ EfiCompareDevicePath ( }
/**
- Init hot plug support and root hot plug private data.
-
+ Check hot plug support and initialize root hot plug private data.
+
+ If Hot Plug is supported by the platform, call PCI Hot Plug Init protocol
+ to get PCI Hot Plug controller's information and constructor the root hot plug
+ private data structure.
+
+ @retval EFI_SUCCESS They are same.
+ @retval EFI_UNSUPPORTED No PCI Hot Plug controler on the platform.
+ @retval EFI_OUT_OF_RESOURCES No memory to constructor root hot plug private
+ data structure.
+
**/
EFI_STATUS
InitializeHotPlugSupport (
@@ -92,13 +101,8 @@ InitializeHotPlugSupport ( // hot plug controller supported on the platform
// the PCI Bus driver is running on. HotPlug Support
// is an optional feature, so absence of the protocol
- // won't incur the penalty
+ // won't incur the penalty.
//
- gPciHotPlugInit = NULL;
- gPciRootHpcPool = NULL;
- gPciRootHpcCount = 0;
- gPciRootHpcData = NULL;
-
Status = gBS->LocateProtocol (
&gEfiPciHotPlugInitProtocolGuid,
NULL,
@@ -129,18 +133,20 @@ InitializeHotPlugSupport ( }
/**
- Test whether device path is for root pci hot plug bus
-
- @param HpbDevicePath tested device path.
- @param HpIndex Return the index of root hot plug in global array.
-
- @retval TRUE device path is for root pci hot plug.
- @retval FALSE device path is not for root pci hot plug.
+ Test whether device path is for root pci hot plug bus.
+
+ @param HpbDevicePath A pointer to device path data structure to be tested.
+ @param HpIndex If HpIndex is not NULL, return the index of root hot
+ plug in global array when TRUE is retuned.
+
+ @retval TRUE The device path is for root pci hot plug bus.
+ @retval FALSE The device path is not for root pci hot plug bus.
+
**/
BOOLEAN
IsRootPciHotPlugBus (
- IN EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath,
- OUT UINTN *HpIndex
+ IN EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath,
+ OUT UINTN *HpIndex OPTIONAL
)
{
UINTN Index;
@@ -161,13 +167,15 @@ IsRootPciHotPlugBus ( }
/**
- Test whether device path is for root pci hot plug controller
-
- @param HpcDevicePath tested device path.
- @param HpIndex Return the index of root hot plug in global array.
-
- @retval TRUE device path is for root pci hot plug controller.
- @retval FALSE device path is not for root pci hot plug controller.
+ Test whether device path is for root pci hot plug controller.
+
+ @param HpbDevicePath A pointer to device path data structure to be tested.
+ @param HpIndex If HpIndex is not NULL, return the index of root hot
+ plug in global array when TRUE is retuned.
+
+ @retval TRUE The device path is for root pci hot plug controller.
+ @retval FALSE The device path is not for root pci hot plug controller.
+
**/
BOOLEAN
IsRootPciHotPlugController (
@@ -193,23 +201,24 @@ IsRootPciHotPlugController ( }
/**
- Wrapper for creating event object for HPC
-
- @param HpIndex index of hot plug device in global array.
- @param Event event object.
-
- @return status of create event invoken.
+ Creating event object for PCI Hot Plug controller.
+
+ @param HpIndex Index of hot plug device in global array.
+ @param Event The retuned event that invoke this function.
+
+ @return Status of create event invoken.
+
**/
EFI_STATUS
CreateEventForHpc (
- IN UINTN HpIndex,
+ IN UINTN HpIndex,
OUT EFI_EVENT *Event
)
{
EFI_STATUS Status;
Status = gBS->CreateEvent (
- EVT_NOTIFY_SIGNAL,
+ EVT_NOTIFY_SIGNAL,
TPL_CALLBACK,
PciHPCInitialized,
gPciRootHpcData + HpIndex,
@@ -224,9 +233,13 @@ CreateEventForHpc ( }
/**
- Wait for all root HPC initialized.
-
- @param TimeoutInMicroSeconds microseconds to wait for all root hpc's initialization.
+ Wait for all root PCI Hot Plug controller finished initializing.
+
+ @param TimeoutInMicroSeconds Microseconds to wait for all root HPCs' initialization.
+
+ @retval EFI_SUCCESS All HPCs initialization finished.
+ @retval EFI_TIMEOUT Not ALL HPCs initialization finished in Microseconds.
+
**/
EFI_STATUS
AllRootHPCInitialized (
@@ -237,8 +250,8 @@ AllRootHPCInitialized ( UINTN Index;
Delay = (UINT32) ((TimeoutInMicroSeconds / 30) + 1);
- do {
+ do {
for (Index = 0; Index < gPciRootHpcCount; Index++) {
if (!gPciRootHpcData[Index].Initialized) {
@@ -251,7 +264,7 @@ AllRootHPCInitialized ( }
//
- // Stall for 30 us
+ // Stall for 30 microseconds..
//
gBS->Stall (30);
@@ -263,16 +276,17 @@ AllRootHPCInitialized ( }
/**
- Check HPC capability register block
-
- @param PciIoDevice PCI device instance.
-
- @retval EFI_SUCCESS PCI device is HPC.
- @retval EFI_NOT_FOUND PCI device is not HPC.
+ Check whether PCI-PCI bridge has PCI Hot Plug capability register block.
+
+ @param PciIoDevice A Pointer to the PCI-PCI bridge.
+
+ @retval TRUE PCI device is HPC.
+ @retval FALSE PCI device is not HPC.
+
**/
-EFI_STATUS
+BOOLEAN
IsSHPC (
- PCI_IO_DEVICE *PciIoDevice
+ IN PCI_IO_DEVICE *PciIoDevice
)
{
@@ -280,7 +294,7 @@ IsSHPC ( UINT8 Offset;
if (PciIoDevice == NULL) {
- return EFI_NOT_FOUND;
+ return FALSE;
}
Offset = 0;
@@ -292,42 +306,26 @@ IsSHPC ( );
//
- // If the PPB has the hot plug controller build-in,
+ // If the PCI-PCI bridge has the hot plug controller build-in,
// then return TRUE;
//
if (!EFI_ERROR (Status)) {
- return EFI_SUCCESS;
+ return TRUE;
}
- return EFI_NOT_FOUND;
+ return FALSE;
}
/**
- Get resource padding for hot plug bus
-
- @param PciIoDevice PCI device instance
-
- @retval EFI_SUCCESS success get padding and set it into PCI device instance
- @retval EFI_NOT_FOUND PCI device is not a hot plug bus.
-**/
-EFI_STATUS
-GetResourcePaddingForHpb (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/**
-
-Routine Description:
-
-Arguments:
+ Get resource padding if the specified PCI bridge is a hot plug bus.
-Returns:
-
- None
+ @param PciIoDevice PCI bridge instance.
**/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
+VOID
+GetResourcePaddingForHpb (
+ IN PCI_IO_DEVICE *PciIoDevice
+ )
{
EFI_STATUS Status;
EFI_HPC_STATE State;
@@ -335,9 +333,10 @@ Returns: EFI_HPC_PADDING_ATTRIBUTES Attributes;
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
- Status = IsPciHotPlugBus (PciIoDevice);
-
- if (!EFI_ERROR (Status)) {
+ if (IsPciHotPlugBus (PciIoDevice)) {
+ //
+ // If PCI-PCI bridge device is PCI Hot Plug bus.
+ //
PciAddress = EFI_PCI_ADDRESS (PciIoDevice->BusNumber, PciIoDevice->DeviceNumber, PciIoDevice->FunctionNumber, 0);
Status = gPciHotPlugInit->GetResourcePadding (
gPciHotPlugInit,
@@ -349,7 +348,7 @@ Returns: );
if (EFI_ERROR (Status)) {
- return Status;
+ return;
}
if ((State & EFI_HPC_STATE_ENABLED) != 0 && (State & EFI_HPC_STATE_INITIALIZED) != 0) {
@@ -357,47 +356,39 @@ Returns: PciIoDevice->PaddingAttributes = Attributes;
}
- return EFI_SUCCESS;
+ return;
}
-
- return EFI_NOT_FOUND;
}
/**
Test whether PCI device is hot plug bus.
-
+
@param PciIoDevice PCI device instance.
-
- @retval EFI_SUCCESS PCI device is hot plug bus.
- @retval EFI_NOT_FOUND PCI device is not hot plug bus.
+
+ @retval TRUE PCI device is a hot plug bus.
+ @retval FALSE PCI device is not a hot plug bus.
+
**/
-EFI_STATUS
+BOOLEAN
IsPciHotPlugBus (
PCI_IO_DEVICE *PciIoDevice
)
{
- BOOLEAN Result;
- EFI_STATUS Status;
-
- Status = IsSHPC (PciIoDevice);
-
- //
- // If the PPB has the hot plug controller build-in,
- // then return TRUE;
- //
- if (!EFI_ERROR (Status)) {
- return EFI_SUCCESS;
+ if (IsSHPC (PciIoDevice)) {
+ //
+ // If the PPB has the hot plug controller build-in,
+ // then return TRUE;
+ //
+ return TRUE;
}
//
// Otherwise, see if it is a Root HPC
//
- Result = IsRootPciHotPlugBus (PciIoDevice->DevicePath, NULL);
-
- if (Result) {
- return EFI_SUCCESS;
+ if(IsRootPciHotPlugBus (PciIoDevice->DevicePath, NULL)) {
+ return TRUE;
}
- return EFI_NOT_FOUND;
+ return FALSE;
}
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciHotPlugSupport.h b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciHotPlugSupport.h index 26dcee2943..ee6df6595a 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciHotPlugSupport.h +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciHotPlugSupport.h @@ -1,42 +1,47 @@ /** @file
+ PCI Hot Plug support functions declaration for PCI Bus module.
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
-**/
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
#ifndef _EFI_PCI_HOT_PLUG_SUPPORT_H_
#define _EFI_PCI_HOT_PLUG_SUPPORT_H_
-
//
-// stall 1 second
+// stall 1 second, its unit is 100ns
//
-#define STALL_1_SECOND 1000000
+#define STALL_1_SECOND 1000000
+//
+// PCI Hot Plug controller private data
+//
typedef struct {
EFI_EVENT Event;
BOOLEAN Initialized;
VOID *Padding;
} ROOT_HPC_DATA;
+//
+// Reference of some global variabes
+//
extern EFI_PCI_HOT_PLUG_INIT_PROTOCOL *gPciHotPlugInit;
extern EFI_HPC_LOCATION *gPciRootHpcPool;
-extern UINTN gPciRootHpcCount;
extern ROOT_HPC_DATA *gPciRootHpcData;
/**
- Init HPC private data.
-
- @param Event event object
- @param Context HPC private data.
+ Event notification function to set Hot Plug controller status.
+
+ @param Event The event that invoke this function.
+ @param Context The calling context, pointer to ROOT_HPC_DATA.
+
**/
VOID
EFIAPI
@@ -46,13 +51,14 @@ PciHPCInitialized ( );
/**
- Compare two device path
-
- @param DevicePath1 the first device path want to be compared.
- @param DevicePath2 the first device path want to be compared.
-
- @retval TRUE equal.
- @retval FALSE different.
+ Compare two device pathes to check if they are exactly same.
+
+ @param DevicePath1 A pointer to the first device path data structure.
+ @param DevicePath2 A pointer to the second device path data structure.
+
+ @retval TRUE They are same.
+ @retval FALSE They are not same.
+
**/
BOOLEAN
EfiCompareDevicePath (
@@ -61,8 +67,17 @@ EfiCompareDevicePath ( );
/**
- Init hot plug support and root hot plug private data.
-
+ Check hot plug support and initialize root hot plug private data.
+
+ If Hot Plug is supported by the platform, call PCI Hot Plug Init protocol
+ to get PCI Hot Plug controller's information and constructor the root hot plug
+ private data structure.
+
+ @retval EFI_SUCCESS They are same.
+ @retval EFI_UNSUPPORTED No PCI Hot Plug controler on the platform.
+ @retval EFI_OUT_OF_RESOURCES No memory to constructor root hot plug private
+ data structure.
+
**/
EFI_STATUS
InitializeHotPlugSupport (
@@ -71,40 +86,45 @@ InitializeHotPlugSupport ( /**
Test whether PCI device is hot plug bus.
-
+
@param PciIoDevice PCI device instance.
-
- @retval EFI_SUCCESS PCI device is hot plug bus.
- @retval EFI_NOT_FOUND PCI device is not hot plug bus.
+
+ @retval TRUE PCI device is a hot plug bus.
+ @retval FALSE PCI device is not a hot plug bus.
+
**/
-EFI_STATUS
+BOOLEAN
IsPciHotPlugBus (
PCI_IO_DEVICE *PciIoDevice
);
/**
- Test whether device path is for root pci hot plug bus
-
- @param HpbDevicePath tested device path
- @param HpIndex Return the index of root hot plug in global array.
-
- @retval TRUE device path is for root pci hot plug
- @retval FALSE device path is not for root pci hot plug
+ Test whether device path is for root pci hot plug bus.
+
+ @param HpbDevicePath A pointer to device path data structure to be tested.
+ @param HpIndex If HpIndex is not NULL, return the index of root hot
+ plug in global array when TRUE is retuned.
+
+ @retval TRUE The device path is for root pci hot plug bus.
+ @retval FALSE The device path is not for root pci hot plug bus.
+
**/
BOOLEAN
IsRootPciHotPlugBus (
- IN EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath,
- OUT UINTN *HpIndex
+ IN EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath,
+ OUT UINTN *HpIndex OPTIONAL
);
/**
- Test whether device path is for root pci hot plug controller
-
- @param HpcDevicePath tested device path.
- @param HpIndex Return the index of root hot plug in global array.
-
- @retval TRUE device path is for root pci hot plug controller.
- @retval FALSE device path is not for root pci hot plug controller.
+ Test whether device path is for root pci hot plug controller.
+
+ @param HpbDevicePath A pointer to device path data structure to be tested.
+ @param HpIndex If HpIndex is not NULL, return the index of root hot
+ plug in global array when TRUE is retuned.
+
+ @retval TRUE The device path is for root pci hot plug controller.
+ @retval FALSE The device path is not for root pci hot plug controller.
+
**/
BOOLEAN
IsRootPciHotPlugController (
@@ -113,23 +133,28 @@ IsRootPciHotPlugController ( );
/**
- Wrapper for creating event object for HPC
-
- @param HpIndex index of hot plug device in global array.
- @param Event event object.
-
- @return status of create event invoken.
+ Creating event object for PCI Hot Plug controller.
+
+ @param HpIndex Index of hot plug device in global array.
+ @param Event The retuned event that invoke this function.
+
+ @return Status of create event invoken.
+
**/
EFI_STATUS
CreateEventForHpc (
- IN UINTN HpIndex,
+ IN UINTN HpIndex,
OUT EFI_EVENT *Event
);
/**
- Wait for all root HPC initialized.
-
- @param TimeoutInMicroSeconds microseconds to wait for all root hpc's initialization.
+ Wait for all root PCI Hot Plug controller finished initializing.
+
+ @param TimeoutInMicroSeconds Microseconds to wait for all root HPCs' initialization.
+
+ @retval EFI_SUCCESS All HPCs initialization finished.
+ @retval EFI_TIMEOUT Not ALL HPCs initialization finished in Microseconds.
+
**/
EFI_STATUS
AllRootHPCInitialized (
@@ -137,29 +162,28 @@ AllRootHPCInitialized ( );
/**
- Check HPC capability register block
-
- @param PciIoDevice PCI device instance.
-
- @retval EFI_SUCCESS PCI device is HPC.
- @retval EFI_NOT_FOUND PCI device is not HPC.
+ Check whether PCI-PCI bridge has PCI Hot Plug capability register block.
+
+ @param PciIoDevice A Pointer to the PCI-PCI bridge.
+
+ @retval TRUE PCI device is HPC.
+ @retval FALSE PCI device is not HPC.
+
**/
-EFI_STATUS
+BOOLEAN
IsSHPC (
- PCI_IO_DEVICE *PciIoDevice
+ IN PCI_IO_DEVICE *PciIoDevice
);
/**
- Get resource padding for hot plug bus
-
- @param PciIoDevice PCI device instance.
-
- @retval EFI_SUCCESS success get padding and set it into PCI device instance.
- @retval EFI_NOT_FOUND PCI device is not a hot plug bus.
+ Get resource padding if the specified PCI bridge is a hot plug bus.
+
+ @param PciIoDevice PCI bridge instance.
+
**/
-EFI_STATUS
+VOID
GetResourcePaddingForHpb (
- IN PCI_IO_DEVICE *PciIoDevice
+ IN PCI_IO_DEVICE *PciIoDevice
);
#endif
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.c index 3cf7318faa..5bf7ba99da 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.c +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.c @@ -1,17 +1,16 @@ /** @file
- Implements all interfaces for EFI_PCI_IO_PROTOCOL.
-
-Copyright (c) 2006 - 2008, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+ EFI PCI IO protocol functions implementation for PCI Bus module.
-**/
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
#include "PciBus.h"
@@ -48,28 +47,11 @@ EFI_PCI_IO_PROTOCOL mPciIoInterface = { };
/**
- report a error Status code of PCI bus driver controller.
-
- @param PciIoDevice Pci device instance.
- @param Code status code.
+ Report a error Status code of PCI bus driver controller.
-**/
-EFI_STATUS
-ReportErrorStatusCode (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN EFI_STATUS_CODE_VALUE Code
- );
-
-//
-// PCI I/O Support Function Prototypes
-//
-//
-
-/**
- report a error Status code of PCI bus driver controller.
-
@param PciIoDevice Pci device instance.
- @param Code status code.
+ @param Code Status code value.
+
**/
EFI_STATUS
ReportErrorStatusCode (
@@ -86,40 +68,41 @@ ReportErrorStatusCode ( /**
Initializes a PCI I/O Instance.
-
- @param PciIoDevice Pci device instance.
-
+
+ @param PciIoDevice Pci device instance.
+
**/
VOID
InitializePciIoInstance (
- PCI_IO_DEVICE *PciIoDevice
+ IN PCI_IO_DEVICE *PciIoDevice
)
{
CopyMem (&PciIoDevice->PciIo, &mPciIoInterface, sizeof (EFI_PCI_IO_PROTOCOL));
}
/**
- Verifies access to a PCI Base Address Register (BAR)
-
- @param PciIoDevice Pci device instance
+ Verifies access to a PCI Base Address Register (BAR).
+
+ @param PciIoDevice Pci device instance.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
- base address for the memory or I/O operation to perform.
- @param Type Operation type could be memory or I/O
+ base address for the memory or I/O operation to perform.
+ @param Type Operation type could be memory or I/O.
@param Width Signifies the width of the memory or I/O operations.
@param Count The number of memory or I/O operations to perform.
@param Offset The offset within the PCI configuration space for the PCI controller.
-
+
@retval EFI_INVALID_PARAMETER Invalid Width/BarIndex or Bar type.
- @retval EFI_SUCCESS Success Operation.
+ @retval EFI_SUCCESS Successfully verified.
+
**/
EFI_STATUS
PciIoVerifyBarAccess (
- PCI_IO_DEVICE *PciIoDevice,
- UINT8 BarIndex,
- PCI_BAR_TYPE Type,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINTN Count,
- UINT64 *Offset
+ IN PCI_IO_DEVICE *PciIoDevice,
+ IN UINT8 BarIndex,
+ IN PCI_BAR_TYPE Type,
+ IN IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
+ IN IN UINTN Count,
+ IN UINT64 *Offset
)
{
if (Width < 0 || Width >= EfiPciIoWidthMaximum) {
@@ -161,20 +144,21 @@ PciIoVerifyBarAccess ( }
/**
- Verifies access to a PCI Config Header
-
- @param PciIoDevice Pci device instance
+ Verifies access to a PCI Configuration Header.
+
+ @param PciIoDevice Pci device instance.
@param Width Signifies the width of the memory or I/O operations.
@param Count The number of memory or I/O operations to perform.
@param Offset The offset within the PCI configuration space for the PCI controller.
@retval EFI_INVALID_PARAMETER Invalid Width
- @retval EFI_UNSUPPORTED Offset overflow
- @retval EFI_SUCCESS Success operation
+ @retval EFI_UNSUPPORTED Offset overflowed.
+ @retval EFI_SUCCESS Successfully verified.
+
**/
EFI_STATUS
PciIoVerifyConfigAccess (
- PCI_IO_DEVICE *PciIoDevice,
+ IN PCI_IO_DEVICE *PciIoDevice,
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
IN UINTN Count,
IN UINT64 *Offset
@@ -212,23 +196,26 @@ PciIoVerifyConfigAccess ( }
/**
- Reads from the I/O space of a PCI Root Bridge. Returns when either the polling exit criteria is
+ Reads from the memory space of a PCI controller. Returns either when the polling exit criteria is
satisfied or after a defined duration.
-
- @param This Pointer to protocol instance of EFI_PCI_IO_PROTOCOL
- @param Width Signifies the width of the memory or I/O operations.
- @param BarIndex The BAR index of the standard PCI Configuration header to use as the
- base address for the memory or I/O operation to perform.
- @param Offset The offset within the PCI configuration space for the PCI controller.
- @param Mask Mask used for the polling criteria.
- @param Value The comparison value used for the polling exit criteria.
- @param Delay The number of 100 ns units to poll.
- @param Result Pointer to the last value read from the memory location.
-
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
+ @param Width Signifies the width of the memory or I/O operations.
+ @param BarIndex The BAR index of the standard PCI Configuration header to use as the
+ base address for the memory operation to perform.
+ @param Offset The offset within the selected BAR to start the memory operation.
+ @param Mask Mask used for the polling criteria.
+ @param Value The comparison value used for the polling exit criteria.
+ @param Delay The number of 100 ns units to poll.
+ @param Result Pointer to the last value read from the memory location.
+
@retval EFI_SUCCESS The last data returned from the access matched the poll exit criteria.
+ @retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
+ @retval EFI_UNSUPPORTED Offset is not valid for the BarIndex of this PCI controller.
@retval EFI_TIMEOUT Delay expired before a match occurred.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
+
**/
EFI_STATUS
EFIAPI
@@ -262,14 +249,14 @@ PciIoPollMem ( }
Status = PciIoDevice->PciRootBridgeIo->PollMem (
- PciIoDevice->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Offset,
- Mask,
- Value,
- Delay,
- Result
- );
+ PciIoDevice->PciRootBridgeIo,
+ (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
+ Offset,
+ Mask,
+ Value,
+ Delay,
+ Result
+ );
if (EFI_ERROR (Status)) {
ReportErrorStatusCode (PciIoDevice, EFI_IO_BUS_PCI | EFI_IOB_EC_CONTROLLER_ERROR);
@@ -278,25 +265,27 @@ PciIoPollMem ( return Status;
}
-/**
- Reads from the I/O space of a PCI Root Bridge. Returns when either the polling exit criteria is
+/**
+ Reads from the memory space of a PCI controller. Returns either when the polling exit criteria is
satisfied or after a defined duration.
-
- @param This A pointer to the EFI_PCI_IO_PROTOCOL.
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory or I/O operations.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
- base address for the memory or I/O operation to perform.
- @param Offset The offset within the selected BAR to start the memory or I/O operation.
+ base address for the memory operation to perform.
+ @param Offset The offset within the selected BAR to start the memory operation.
@param Mask Mask used for the polling criteria.
@param Value The comparison value used for the polling exit criteria.
@param Delay The number of 100 ns units to poll.
@param Result Pointer to the last value read from the memory location.
-
+
@retval EFI_SUCCESS The last data returned from the access matched the poll exit criteria.
+ @retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
+ @retval EFI_UNSUPPORTED Offset is not valid for the BarIndex of this PCI controller.
@retval EFI_TIMEOUT Delay expired before a match occurred.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-
+
**/
EFI_STATUS
EFIAPI
@@ -326,14 +315,14 @@ PciIoPollIo ( }
Status = PciIoDevice->PciRootBridgeIo->PollIo (
- PciIoDevice->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Offset,
- Mask,
- Value,
- Delay,
- Result
- );
+ PciIoDevice->PciRootBridgeIo,
+ (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
+ Offset,
+ Mask,
+ Value,
+ Delay,
+ Result
+ );
if (EFI_ERROR (Status)) {
ReportErrorStatusCode (PciIoDevice, EFI_IO_BUS_PCI | EFI_IOB_EC_CONTROLLER_ERROR);
@@ -342,25 +331,25 @@ PciIoPollIo ( return Status;
}
-/**
+/**
Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.
-
+
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory or I/O operations.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
- base address for the memory or I/O operation to perform.
- @param Offset The offset within the selected BAR to start the memory or I/O operation.
+ base address for the memory or I/O operation to perform.
+ @param Offset The offset within the selected BAR to start the memory or I/O operation.
@param Count The number of memory or I/O operations to perform.
@param Buffer For read operations, the destination buffer to store the results. For write
- operations, the source buffer to write data from.
-
+ operations, the source buffer to write data from.
+
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
- valid for the PCI BAR specified by BarIndex.
+ valid for the PCI BAR specified by BarIndex.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-
+
**/
EFI_STATUS
EFIAPI
@@ -406,25 +395,25 @@ PciIoMemRead ( return Status;
}
-/**
+/**
Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.
-
+
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory or I/O operations.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
- base address for the memory or I/O operation to perform.
- @param Offset The offset within the selected BAR to start the memory or I/O operation.
+ base address for the memory or I/O operation to perform.
+ @param Offset The offset within the selected BAR to start the memory or I/O operation.
@param Count The number of memory or I/O operations to perform.
@param Buffer For read operations, the destination buffer to store the results. For write
- operations, the source buffer to write data from.
-
+ operations, the source buffer to write data from.
+
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
- valid for the PCI BAR specified by BarIndex.
+ valid for the PCI BAR specified by BarIndex.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-
+
**/
EFI_STATUS
EFIAPI
@@ -470,25 +459,25 @@ PciIoMemWrite ( return Status;
}
-/**
+/**
Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.
-
+
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory or I/O operations.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
- base address for the memory or I/O operation to perform.
- @param Offset The offset within the selected BAR to start the memory or I/O operation.
+ base address for the memory or I/O operation to perform.
+ @param Offset The offset within the selected BAR to start the memory or I/O operation.
@param Count The number of memory or I/O operations to perform.
@param Buffer For read operations, the destination buffer to store the results. For write
- operations, the source buffer to write data from.
-
+ operations, the source buffer to write data from.
+
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
- valid for the PCI BAR specified by BarIndex.
+ valid for the PCI BAR specified by BarIndex.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-
+
**/
EFI_STATUS
EFIAPI
@@ -534,25 +523,25 @@ PciIoIoRead ( return Status;
}
-/**
+/**
Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.
-
+
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory or I/O operations.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
- base address for the memory or I/O operation to perform.
- @param Offset The offset within the selected BAR to start the memory or I/O operation.
+ base address for the memory or I/O operation to perform.
+ @param Offset The offset within the selected BAR to start the memory or I/O operation.
@param Count The number of memory or I/O operations to perform.
@param Buffer For read operations, the destination buffer to store the results. For write
- operations, the source buffer to write data from.
-
+ operations, the source buffer to write data from.
+
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
- valid for the PCI BAR specified by BarIndex.
+ valid for the PCI BAR specified by BarIndex.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-
+
**/
EFI_STATUS
EFIAPI
@@ -598,23 +587,23 @@ PciIoIoWrite ( return Status;
}
-/**
+/**
Enable a PCI driver to access PCI controller registers in PCI configuration space.
-
- @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory operations.
@param Offset The offset within the PCI configuration space for the PCI controller.
@param Count The number of PCI configuration operations to perform.
@param Buffer For read operations, the destination buffer to store the results. For write
operations, the source buffer to write data from.
-
-
+
+
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
valid for the PCI configuration header of the PCI controller.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
- @retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
-
+ @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
+
**/
EFI_STATUS
EFIAPI
@@ -653,23 +642,23 @@ PciIoConfigRead ( return Status;
}
-/**
+/**
Enable a PCI driver to access PCI controller registers in PCI configuration space.
-
- @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory operations.
@param Offset The offset within the PCI configuration space for the PCI controller.
@param Count The number of PCI configuration operations to perform.
@param Buffer For read operations, the destination buffer to store the results. For write
operations, the source buffer to write data from.
-
-
+
+
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
valid for the PCI configuration header of the PCI controller.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
- @retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
-
+ @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
+
**/
EFI_STATUS
EFIAPI
@@ -708,33 +697,33 @@ PciIoConfigWrite ( return Status;
}
-/**
+/**
Enables a PCI driver to copy one region of PCI memory space to another region of PCI
memory space.
-
+
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory operations.
@param DestBarIndex The BAR index in the standard PCI Configuration header to use as the
- base address for the memory operation to perform.
+ base address for the memory operation to perform.
@param DestOffset The destination offset within the BAR specified by DestBarIndex to
- start the memory writes for the copy operation.
+ start the memory writes for the copy operation.
@param SrcBarIndex The BAR index in the standard PCI Configuration header to use as the
- base address for the memory operation to perform.
+ base address for the memory operation to perform.
@param SrcOffset The source offset within the BAR specified by SrcBarIndex to start
- the memory reads for the copy operation.
+ the memory reads for the copy operation.
@param Count The number of memory operations to perform. Bytes moved is Width
- size * Count, starting at DestOffset and SrcOffset.
-
+ size * Count, starting at DestOffset and SrcOffset.
+
@retval EFI_SUCCESS The data was copied from one memory region to another memory region.
@retval EFI_UNSUPPORTED DestBarIndex not valid for this PCI controller.
@retval EFI_UNSUPPORTED SrcBarIndex not valid for this PCI controller.
@retval EFI_UNSUPPORTED The address range specified by DestOffset, Width, and Count
- is not valid for the PCI BAR specified by DestBarIndex.
+ is not valid for the PCI BAR specified by DestBarIndex.
@retval EFI_UNSUPPORTED The address range specified by SrcOffset, Width, and Count is
- not valid for the PCI BAR specified by SrcBarIndex.
+ not valid for the PCI BAR specified by SrcBarIndex.
@retval EFI_INVALID_PARAMETER Width is invalid.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
-
+
**/
EFI_STATUS
EFIAPI
@@ -793,24 +782,24 @@ PciIoCopyMem ( return Status;
}
-/**
- Provides the PCI controller-Cspecific addresses needed to access system memory.
-
+/**
+ Provides the PCI controller-specific addresses needed to access system memory.
+
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Operation Indicates if the bus master is going to read or write to system memory.
@param HostAddress The system memory address to map to the PCI controller.
@param NumberOfBytes On input the number of bytes to map. On output the number of bytes
- that were mapped.
+ that were mapped.
@param DeviceAddress The resulting map address for the bus master PCI controller to use to
- access the hosts HostAddress.
+ access the hosts HostAddress.
@param Mapping A resulting value to pass to Unmap().
-
+
@retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.
- @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer.
+ @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_DEVICE_ERROR The system hardware could not map the requested address.
-
+
**/
EFI_STATUS
EFIAPI
@@ -856,15 +845,15 @@ PciIoMap ( return Status;
}
-/**
+/**
Completes the Map() operation and releases any corresponding resources.
-
- @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Mapping The mapping value returned from Map().
-
+
@retval EFI_SUCCESS The range was unmapped.
@retval EFI_DEVICE_ERROR The data was not committed to the target system memory.
-
+
**/
EFI_STATUS
EFIAPI
@@ -890,25 +879,25 @@ PciIoUnmap ( return Status;
}
-/**
+/**
Allocates pages that are suitable for an EfiPciIoOperationBusMasterCommonBuffer
- mapping.
-
+ mapping.
+
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Type This parameter is not used and must be ignored.
@param MemoryType The type of memory to allocate, EfiBootServicesData or
- EfiRuntimeServicesData.
- @param Pages The number of pages to allocate.
+ EfiRuntimeServicesData.
+ @param Pages The number of pages to allocate.
@param HostAddress A pointer to store the base system memory address of the
- allocated range.
+ allocated range.
@param Attributes The requested bit mask of attributes for the allocated range.
-
+
@retval EFI_SUCCESS The requested memory pages were allocated.
@retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are
- MEMORY_WRITE_COMBINE and MEMORY_CACHED.
+ MEMORY_WRITE_COMBINE and MEMORY_CACHED.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
- @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
-
+ @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
+
**/
EFI_STATUS
EFIAPI
@@ -951,17 +940,17 @@ PciIoAllocateBuffer ( return Status;
}
-/**
+/**
Frees memory that was allocated with AllocateBuffer().
-
- @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
- @param Pages The number of pages to free.
- @param HostAddress The base system memory address of the allocated range.
-
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
+ @param Pages The number of pages to free.
+ @param HostAddress The base system memory address of the allocated range.
+
@retval EFI_SUCCESS The requested memory pages were freed.
@retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages
was not allocated with AllocateBuffer().
-
+
**/
EFI_STATUS
EFIAPI
@@ -989,16 +978,16 @@ PciIoFreeBuffer ( return Status;
}
-/**
+/**
Flushes all PCI posted write transactions from a PCI host bridge to system memory.
-
- @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
-
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
+
@retval EFI_SUCCESS The PCI posted write transactions were flushed from the PCI host
- bridge to system memory.
+ bridge to system memory.
@retval EFI_DEVICE_ERROR The PCI posted write transactions were not flushed from the PCI
- host bridge due to a hardware error.
-
+ host bridge due to a hardware error.
+
**/
EFI_STATUS
EFIAPI
@@ -1021,18 +1010,18 @@ PciIoFlush ( return Status;
}
-/**
+/**
Retrieves this PCI controller's current PCI bus number, device number, and function number.
-
- @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param SegmentNumber The PCI controller's current PCI segment number.
@param BusNumber The PCI controller's current PCI bus number.
@param DeviceNumber The PCI controller's current PCI device number.
@param FunctionNumber The PCI controller's current PCI function number.
-
- @retval EFI_SUCCESS The PCI controller location was returned.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-
+
+ @retval EFI_SUCCESS The PCI controller location was returned.
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
+
**/
EFI_STATUS
EFIAPI
@@ -1062,19 +1051,21 @@ PciIoGetLocation ( /**
Check BAR type for PCI resource.
-
- @param PciIoDevice PCI device instance
+
+ @param PciIoDevice PCI device instance.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
- base address for the memory or I/O operation to perform.
- @param BarType Memory or I/O
-
- @return whether Pci device's bar type is same with input BarType.
+ base address for the memory or I/O operation to perform.
+ @param BarType Memory or I/O.
+
+ @retval TRUE Pci device's bar type is same with input BarType.
+ @retval TRUE Pci device's bar type is not same with input BarType.
+
**/
BOOLEAN
CheckBarType (
- IN PCI_IO_DEVICE *PciIoDevice,
- UINT8 BarIndex,
- PCI_BAR_TYPE BarType
+ IN PCI_IO_DEVICE *PciIoDevice,
+ IN UINT8 BarIndex,
+ IN PCI_BAR_TYPE BarType
)
{
switch (BarType) {
@@ -1106,14 +1097,15 @@ CheckBarType ( }
/**
- Set/Disable new attributes to a Root Bridge
-
- @param PciIoDevice Pci device instance
- @param Attributes New attribute want to be set
- @param Operation Set or Disable
-
- @retval EFI_UNSUPPORTED If root bridge does not support change attribute
- @retval EFI_SUCCESS Success operation.
+ Set/Disable new attributes to a Root Bridge.
+
+ @param PciIoDevice Pci device instance.
+ @param Attributes New attribute want to be set.
+ @param Operation Set or Disable.
+
+ @retval EFI_UNSUPPORTED If root bridge does not support change attribute.
+ @retval EFI_SUCCESS Successfully set new attributs.
+
**/
EFI_STATUS
ModifyRootBridgeAttributes (
@@ -1138,7 +1130,7 @@ ModifyRootBridgeAttributes ( if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED;
}
-
+
//
// Record the new attribute of the Root Bridge
//
@@ -1147,7 +1139,7 @@ ModifyRootBridgeAttributes ( } else {
NewPciRootBridgeAttributes = PciRootBridgeAttributes & (~Attributes);
}
-
+
//
// Call the PCI Root Bridge to attempt to modify the attributes
//
@@ -1166,28 +1158,29 @@ ModifyRootBridgeAttributes ( return EFI_UNSUPPORTED;
}
}
-
+
//
// Also update the attributes for this Root Bridge structure
//
PciIoDevice->Attributes = NewPciRootBridgeAttributes;
- return EFI_SUCCESS;
+ return EFI_SUCCESS;
}
/**
- Check whether this device can be enable/disable to snoop
-
- @param PciIoDevice Pci device instance
- @param Operation Enable/Disable
-
- @retval EFI_UNSUPPORTED Pci device is not GFX device or not support snoop
+ Check whether this device can be enable/disable to snoop.
+
+ @param PciIoDevice Pci device instance.
+ @param Operation Enable/Disable.
+
+ @retval EFI_UNSUPPORTED Pci device is not GFX device or not support snoop.
@retval EFI_SUCCESS Snoop can be supported.
+
**/
EFI_STATUS
SupportPaletteSnoopAttributes (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation
+ IN PCI_IO_DEVICE *PciIoDevice,
+ IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation
)
{
PCI_IO_DEVICE *Temp;
@@ -1212,7 +1205,7 @@ SupportPaletteSnoopAttributes ( //
return EFI_SUCCESS;
}
-
+
//
// Check these two agents are on the same path
//
@@ -1251,13 +1244,13 @@ SupportPaletteSnoopAttributes ( return EFI_SUCCESS;
}
-
+
//
// If they are on the same path but on the different bus
// The first agent is set to snoop, the second one set to
// decode
//
-
+
if (Temp->BusNumber < PciIoDevice->BusNumber) {
//
// GFX should be set to decode
@@ -1285,24 +1278,24 @@ SupportPaletteSnoopAttributes ( return EFI_SUCCESS;
}
-/**
+/**
Performs an operation on the attributes that this PCI controller supports. The operations include
- getting the set of supported attributes, retrieving the current attributes, setting the current
- attributes, enabling attributes, and disabling attributes.
-
- @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
+ getting the set of supported attributes, retrieving the current attributes, setting the current
+ attributes, enabling attributes, and disabling attributes.
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Operation The operation to perform on the attributes for this PCI controller.
@param Attributes The mask of attributes that are used for Set, Enable, and Disable
- operations.
+ operations.
@param Result A pointer to the result mask of attributes that are returned for the Get
- and Supported operations.
-
+ and Supported operations.
+
@retval EFI_SUCCESS The operation on the PCI controller's attributes was completed.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
- @retval EFI_UNSUPPORTED one or more of the bits set in
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
+ @retval EFI_UNSUPPORTED one or more of the bits set in
Attributes are not supported by this PCI controller or one of
its parent bridges when Operation is Set, Enable or Disable.
-
+
**/
EFI_STATUS
EFIAPI
@@ -1400,7 +1393,7 @@ PciIoAttributes ( if (Supports != Attributes) {
return EFI_UNSUPPORTED;
}
-
+
//
// For Root Bridge, just call RootBridgeIo to set attributes;
//
@@ -1472,7 +1465,7 @@ PciIoAttributes ( }
}
}
-
+
//
// Do with the attributes on GFX
//
@@ -1485,7 +1478,7 @@ PciIoAttributes ( Status = SupportPaletteSnoopAttributes (PciIoDevice, Operation);
if (EFI_ERROR (Status)) {
-
+
//
// Enable operation is forbidden, so mask the bit in attributes
// so as to keep consistent with the actual Status
@@ -1521,7 +1514,7 @@ PciIoAttributes ( // The upstream bridge should be also set to revelant attribute
// expect for IO, Mem and BusMaster
//
- UpStreamAttributes = Attributes &
+ UpStreamAttributes = Attributes &
(~(EFI_PCI_IO_ATTRIBUTE_IO |
EFI_PCI_IO_ATTRIBUTE_MEMORY |
EFI_PCI_IO_ATTRIBUTE_BUS_MASTER
@@ -1550,7 +1543,7 @@ PciIoAttributes ( NULL
);
} else {
-
+
//
// Disable relevant attributes to command register and bridge control register
//
@@ -1571,27 +1564,27 @@ PciIoAttributes ( return Status;
}
-/**
+/**
Gets the attributes that this PCI controller supports setting on a BAR using
SetBarAttributes(), and retrieves the list of resource descriptors for a BAR.
-
- @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
base address for resource range. The legal range for this field is 0..5.
@param Supports A pointer to the mask of attributes that this PCI controller supports
- setting for this BAR with SetBarAttributes().
+ setting for this BAR with SetBarAttributes().
@param Resources A pointer to the ACPI 2.0 resource descriptors that describe the current
- configuration of this BAR of the PCI controller.
-
- @retval EFI_SUCCESS If Supports is not NULL, then the attributes that the PCI
- controller supports are returned in Supports. If Resources
+ configuration of this BAR of the PCI controller.
+
+ @retval EFI_SUCCESS If Supports is not NULL, then the attributes that the PCI
+ controller supports are returned in Supports. If Resources
is not NULL, then the ACPI 2.0 resource descriptors that the PCI
- controller is currently using are returned in Resources.
+ controller is currently using are returned in Resources.
@retval EFI_INVALID_PARAMETER Both Supports and Attributes are NULL.
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
@retval EFI_OUT_OF_RESOURCES There are not enough resources available to allocate
- Resources.
-
+ Resources.
+
**/
EFI_STATUS
EFIAPI
@@ -1722,7 +1715,7 @@ PciIoGetBarAttributes ( Ptr = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) ((UINT8 *) Ptr + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR));
}
-
+
//
// put the checksum
//
@@ -1736,29 +1729,29 @@ PciIoGetBarAttributes ( return EFI_SUCCESS;
}
-/**
+/**
Sets the attributes for a range of a BAR on a PCI controller.
-
- @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Attributes The mask of attributes to set for the resource range specified by
- BarIndex, Offset, and Length.
+ BarIndex, Offset, and Length.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
base address for resource range. The legal range for this field is 0..5.
@param Offset A pointer to the BAR relative base address of the resource range to be
- modified by the attributes specified by Attributes.
+ modified by the attributes specified by Attributes.
@param Length A pointer to the length of the resource range to be modified by the
- attributes specified by Attributes.
-
- @retval EFI_SUCCESS The set of attributes specified by Attributes for the resource
- range specified by BarIndex, Offset, and Length were
+ attributes specified by Attributes.
+
+ @retval EFI_SUCCESS The set of attributes specified by Attributes for the resource
+ range specified by BarIndex, Offset, and Length were
set on the PCI controller, and the actual resource range is returned
- in Offset and Length.
+ in Offset and Length.
@retval EFI_INVALID_PARAMETER Offset or Length is NULL.
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the attributes on the
- resource range specified by BarIndex, Offset, and
- Length.
-
+ resource range specified by BarIndex, Offset, and
+ Length.
+
**/
EFI_STATUS
EFIAPI
@@ -1818,24 +1811,24 @@ PciIoSetBarAttributes ( /**
Program parent bridge's attribute recurrently.
-
+
@param PciIoDevice Child Pci device instance
@param Operation The operation to perform on the attributes for this PCI controller.
@param Attributes The mask of attributes that are used for Set, Enable, and Disable
operations.
-
+
@retval EFI_SUCCESS The operation on the PCI controller's attributes was completed.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
- @retval EFI_UNSUPPORTED one or more of the bits set in
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
+ @retval EFI_UNSUPPORTED one or more of the bits set in
Attributes are not supported by this PCI controller or one of
its parent bridges when Operation is Set, Enable or Disable.
-
+
**/
EFI_STATUS
UpStreamBridgesAttributes (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
- IN UINT64 Attributes
+ IN PCI_IO_DEVICE *PciIoDevice,
+ IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
+ IN UINT64 Attributes
)
{
PCI_IO_DEVICE *Parent;
@@ -1859,12 +1852,14 @@ UpStreamBridgesAttributes ( }
/**
- Test whether two Pci device has same parent bridge.
-
- @param PciDevice1 the frist pci device for testing
- @param PciDevice2 the second pci device for testing
-
- @return whether two Pci device has same parent bridge.
+ Test whether two Pci devices has same parent bridge.
+
+ @param PciDevice1 The first pci device for testing.
+ @param PciDevice2 The second pci device for testing.
+
+ @retval TRUE Two Pci device has the same parent bridge.
+ @retval FALSE Two Pci device has not the same parent bridge.
+
**/
BOOLEAN
PciDevicesOnTheSamePath (
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.h b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.h index 6143675b78..fbfd2b4ff9 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.h +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.h @@ -1,94 +1,98 @@ /** @file
- Header file of EFI PCI IO protocol.
+ EFI PCI IO protocol functions declaration for PCI Bus module.
-Copyright (c) 2006 - 2009, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
-**/
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
#ifndef _EFI_PCI_IO_PROTOCOL_H_
#define _EFI_PCI_IO_PROTOCOL_H_
/**
Initializes a PCI I/O Instance.
-
- @param PciIoDevice Pci device instance.
-
+
+ @param PciIoDevice Pci device instance.
+
**/
VOID
InitializePciIoInstance (
- PCI_IO_DEVICE *PciIoDevice
+ IN PCI_IO_DEVICE *PciIoDevice
);
/**
- Verifies access to a PCI Base Address Register (BAR)
-
- @param PciIoDevice Pci device instance
+ Verifies access to a PCI Base Address Register (BAR).
+
+ @param PciIoDevice Pci device instance.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
- base address for the memory or I/O operation to perform.
- @param Type Operation type could be memory or I/O
+ base address for the memory or I/O operation to perform.
+ @param Type Operation type could be memory or I/O.
@param Width Signifies the width of the memory or I/O operations.
@param Count The number of memory or I/O operations to perform.
@param Offset The offset within the PCI configuration space for the PCI controller.
-
+
@retval EFI_INVALID_PARAMETER Invalid Width/BarIndex or Bar type.
- @retval EFI_SUCCESS Success Operation.
+ @retval EFI_SUCCESS Successfully verified.
+
**/
EFI_STATUS
PciIoVerifyBarAccess (
- PCI_IO_DEVICE *PciIoDevice,
- UINT8 BarIndex,
- PCI_BAR_TYPE Type,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINTN Count,
- UINT64 *Offset
+ IN PCI_IO_DEVICE *PciIoDevice,
+ IN UINT8 BarIndex,
+ IN PCI_BAR_TYPE Type,
+ IN IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
+ IN IN UINTN Count,
+ IN UINT64 *Offset
);
/**
- Verifies access to a PCI Config Header
-
- @param PciIoDevice Pci device instance
+ Verifies access to a PCI Configuration Header.
+
+ @param PciIoDevice Pci device instance.
@param Width Signifies the width of the memory or I/O operations.
@param Count The number of memory or I/O operations to perform.
@param Offset The offset within the PCI configuration space for the PCI controller.
- @retval EFI_INVALID_PARAMETER Invalid Width.
- @retval EFI_UNSUPPORTED Offset overflow.
- @retval EFI_SUCCESS Success operation.
+ @retval EFI_INVALID_PARAMETER Invalid Width
+ @retval EFI_UNSUPPORTED Offset overflowed.
+ @retval EFI_SUCCESS Successfully verified.
+
**/
EFI_STATUS
PciIoVerifyConfigAccess (
- PCI_IO_DEVICE *PciIoDevice,
+ IN PCI_IO_DEVICE *PciIoDevice,
IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
IN UINTN Count,
IN UINT64 *Offset
);
/**
- Reads from the I/O space of a PCI Root Bridge. Returns when either the polling exit criteria is
+ Reads from the memory space of a PCI controller. Returns either when the polling exit criteria is
satisfied or after a defined duration.
-
- @param This Pointer to protocol instance of EFI_PCI_IO_PROTOCOL
- @param Width Signifies the width of the memory or I/O operations.
- @param BarIndex The BAR index of the standard PCI Configuration header to use as the
- base address for the memory or I/O operation to perform.
- @param Offset The offset within the PCI configuration space for the PCI controller.
- @param Mask Mask used for the polling criteria.
- @param Value The comparison value used for the polling exit criteria.
- @param Delay The number of 100 ns units to poll.
- @param Result Pointer to the last value read from the memory location.
-
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
+ @param Width Signifies the width of the memory or I/O operations.
+ @param BarIndex The BAR index of the standard PCI Configuration header to use as the
+ base address for the memory operation to perform.
+ @param Offset The offset within the selected BAR to start the memory operation.
+ @param Mask Mask used for the polling criteria.
+ @param Value The comparison value used for the polling exit criteria.
+ @param Delay The number of 100 ns units to poll.
+ @param Result Pointer to the last value read from the memory location.
+
@retval EFI_SUCCESS The last data returned from the access matched the poll exit criteria.
+ @retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
+ @retval EFI_UNSUPPORTED Offset is not valid for the BarIndex of this PCI controller.
@retval EFI_TIMEOUT Delay expired before a match occurred.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
+
**/
EFI_STATUS
EFIAPI
@@ -103,25 +107,27 @@ PciIoPollMem ( OUT UINT64 *Result
);
-/**
- Reads from the I/O space of a PCI Root Bridge. Returns when either the polling exit criteria is
+/**
+ Reads from the memory space of a PCI controller. Returns either when the polling exit criteria is
satisfied or after a defined duration.
-
- @param This A pointer to the EFI_PCI_IO_PROTOCOL.
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory or I/O operations.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
- base address for the memory or I/O operation to perform.
- @param Offset The offset within the selected BAR to start the memory or I/O operation.
+ base address for the memory operation to perform.
+ @param Offset The offset within the selected BAR to start the memory operation.
@param Mask Mask used for the polling criteria.
@param Value The comparison value used for the polling exit criteria.
@param Delay The number of 100 ns units to poll.
@param Result Pointer to the last value read from the memory location.
-
+
@retval EFI_SUCCESS The last data returned from the access matched the poll exit criteria.
+ @retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
+ @retval EFI_UNSUPPORTED Offset is not valid for the BarIndex of this PCI controller.
@retval EFI_TIMEOUT Delay expired before a match occurred.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-
+
**/
EFI_STATUS
EFIAPI
@@ -136,25 +142,25 @@ PciIoPollIo ( OUT UINT64 *Result
);
-/**
+/**
Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.
-
+
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory or I/O operations.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
- base address for the memory or I/O operation to perform.
- @param Offset The offset within the selected BAR to start the memory or I/O operation.
+ base address for the memory or I/O operation to perform.
+ @param Offset The offset within the selected BAR to start the memory or I/O operation.
@param Count The number of memory or I/O operations to perform.
@param Buffer For read operations, the destination buffer to store the results. For write
- operations, the source buffer to write data from.
-
+ operations, the source buffer to write data from.
+
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
- valid for the PCI BAR specified by BarIndex.
+ valid for the PCI BAR specified by BarIndex.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-
+
**/
EFI_STATUS
EFIAPI
@@ -167,25 +173,25 @@ PciIoMemRead ( IN OUT VOID *Buffer
);
-/**
+/**
Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.
-
+
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory or I/O operations.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
- base address for the memory or I/O operation to perform.
- @param Offset The offset within the selected BAR to start the memory or I/O operation.
+ base address for the memory or I/O operation to perform.
+ @param Offset The offset within the selected BAR to start the memory or I/O operation.
@param Count The number of memory or I/O operations to perform.
@param Buffer For read operations, the destination buffer to store the results. For write
- operations, the source buffer to write data from.
-
+ operations, the source buffer to write data from.
+
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
- valid for the PCI BAR specified by BarIndex.
+ valid for the PCI BAR specified by BarIndex.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-
+
**/
EFI_STATUS
EFIAPI
@@ -198,25 +204,25 @@ PciIoMemWrite ( IN OUT VOID *Buffer
);
-/**
+/**
Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.
-
+
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory or I/O operations.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
- base address for the memory or I/O operation to perform.
- @param Offset The offset within the selected BAR to start the memory or I/O operation.
+ base address for the memory or I/O operation to perform.
+ @param Offset The offset within the selected BAR to start the memory or I/O operation.
@param Count The number of memory or I/O operations to perform.
@param Buffer For read operations, the destination buffer to store the results. For write
- operations, the source buffer to write data from.
-
+ operations, the source buffer to write data from.
+
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
- valid for the PCI BAR specified by BarIndex.
+ valid for the PCI BAR specified by BarIndex.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-
+
**/
EFI_STATUS
EFIAPI
@@ -229,25 +235,25 @@ PciIoIoRead ( IN OUT VOID *Buffer
);
-/**
+/**
Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.
-
+
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory or I/O operations.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
- base address for the memory or I/O operation to perform.
- @param Offset The offset within the selected BAR to start the memory or I/O operation.
+ base address for the memory or I/O operation to perform.
+ @param Offset The offset within the selected BAR to start the memory or I/O operation.
@param Count The number of memory or I/O operations to perform.
@param Buffer For read operations, the destination buffer to store the results. For write
- operations, the source buffer to write data from.
-
+ operations, the source buffer to write data from.
+
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
- valid for the PCI BAR specified by BarIndex.
+ valid for the PCI BAR specified by BarIndex.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-
+
**/
EFI_STATUS
EFIAPI
@@ -260,23 +266,23 @@ PciIoIoWrite ( IN OUT VOID *Buffer
);
-/**
+/**
Enable a PCI driver to access PCI controller registers in PCI configuration space.
-
- @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory operations.
@param Offset The offset within the PCI configuration space for the PCI controller.
@param Count The number of PCI configuration operations to perform.
@param Buffer For read operations, the destination buffer to store the results. For write
operations, the source buffer to write data from.
-
-
+
+
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
valid for the PCI configuration header of the PCI controller.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
- @retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
-
+ @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
+
**/
EFI_STATUS
EFIAPI
@@ -288,23 +294,23 @@ PciIoConfigRead ( IN OUT VOID *Buffer
);
-/**
+/**
Enable a PCI driver to access PCI controller registers in PCI configuration space.
-
- @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory operations.
@param Offset The offset within the PCI configuration space for the PCI controller.
@param Count The number of PCI configuration operations to perform.
@param Buffer For read operations, the destination buffer to store the results. For write
operations, the source buffer to write data from.
-
-
+
+
@retval EFI_SUCCESS The data was read from or written to the PCI controller.
@retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
valid for the PCI configuration header of the PCI controller.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
- @retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
-
+ @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
+
**/
EFI_STATUS
EFIAPI
@@ -316,33 +322,33 @@ PciIoConfigWrite ( IN OUT VOID *Buffer
);
-/**
+/**
Enables a PCI driver to copy one region of PCI memory space to another region of PCI
memory space.
-
+
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Width Signifies the width of the memory operations.
@param DestBarIndex The BAR index in the standard PCI Configuration header to use as the
- base address for the memory operation to perform.
+ base address for the memory operation to perform.
@param DestOffset The destination offset within the BAR specified by DestBarIndex to
- start the memory writes for the copy operation.
+ start the memory writes for the copy operation.
@param SrcBarIndex The BAR index in the standard PCI Configuration header to use as the
- base address for the memory operation to perform.
+ base address for the memory operation to perform.
@param SrcOffset The source offset within the BAR specified by SrcBarIndex to start
- the memory reads for the copy operation.
+ the memory reads for the copy operation.
@param Count The number of memory operations to perform. Bytes moved is Width
- size * Count, starting at DestOffset and SrcOffset.
-
+ size * Count, starting at DestOffset and SrcOffset.
+
@retval EFI_SUCCESS The data was copied from one memory region to another memory region.
@retval EFI_UNSUPPORTED DestBarIndex not valid for this PCI controller.
@retval EFI_UNSUPPORTED SrcBarIndex not valid for this PCI controller.
@retval EFI_UNSUPPORTED The address range specified by DestOffset, Width, and Count
- is not valid for the PCI BAR specified by DestBarIndex.
+ is not valid for the PCI BAR specified by DestBarIndex.
@retval EFI_UNSUPPORTED The address range specified by SrcOffset, Width, and Count is
- not valid for the PCI BAR specified by SrcBarIndex.
+ not valid for the PCI BAR specified by SrcBarIndex.
@retval EFI_INVALID_PARAMETER Width is invalid.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
-
+
**/
EFI_STATUS
EFIAPI
@@ -356,24 +362,24 @@ PciIoCopyMem ( IN UINTN Count
);
-/**
- Provides the PCI controller-Cspecific addresses needed to access system memory.
-
+/**
+ Provides the PCI controller-specific addresses needed to access system memory.
+
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Operation Indicates if the bus master is going to read or write to system memory.
@param HostAddress The system memory address to map to the PCI controller.
@param NumberOfBytes On input the number of bytes to map. On output the number of bytes
- that were mapped.
+ that were mapped.
@param DeviceAddress The resulting map address for the bus master PCI controller to use to
- access the hosts HostAddress.
+ access the hosts HostAddress.
@param Mapping A resulting value to pass to Unmap().
-
+
@retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.
- @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer.
+ @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval EFI_DEVICE_ERROR The system hardware could not map the requested address.
-
+
**/
EFI_STATUS
EFIAPI
@@ -386,15 +392,15 @@ PciIoMap ( OUT VOID **Mapping
);
-/**
+/**
Completes the Map() operation and releases any corresponding resources.
-
- @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Mapping The mapping value returned from Map().
-
+
@retval EFI_SUCCESS The range was unmapped.
@retval EFI_DEVICE_ERROR The data was not committed to the target system memory.
-
+
**/
EFI_STATUS
EFIAPI
@@ -403,25 +409,25 @@ PciIoUnmap ( IN VOID *Mapping
);
-/**
+/**
Allocates pages that are suitable for an EfiPciIoOperationBusMasterCommonBuffer
- mapping.
-
+ mapping.
+
@param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Type This parameter is not used and must be ignored.
@param MemoryType The type of memory to allocate, EfiBootServicesData or
- EfiRuntimeServicesData.
- @param Pages The number of pages to allocate.
+ EfiRuntimeServicesData.
+ @param Pages The number of pages to allocate.
@param HostAddress A pointer to store the base system memory address of the
- allocated range.
+ allocated range.
@param Attributes The requested bit mask of attributes for the allocated range.
-
+
@retval EFI_SUCCESS The requested memory pages were allocated.
@retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are
- MEMORY_WRITE_COMBINE and MEMORY_CACHED.
+ MEMORY_WRITE_COMBINE and MEMORY_CACHED.
@retval EFI_INVALID_PARAMETER One or more parameters are invalid.
- @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
-
+ @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
+
**/
EFI_STATUS
EFIAPI
@@ -434,17 +440,17 @@ PciIoAllocateBuffer ( IN UINT64 Attributes
);
-/**
+/**
Frees memory that was allocated with AllocateBuffer().
-
- @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
- @param Pages The number of pages to free.
- @param HostAddress The base system memory address of the allocated range.
-
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
+ @param Pages The number of pages to free.
+ @param HostAddress The base system memory address of the allocated range.
+
@retval EFI_SUCCESS The requested memory pages were freed.
@retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages
was not allocated with AllocateBuffer().
-
+
**/
EFI_STATUS
EFIAPI
@@ -454,16 +460,16 @@ PciIoFreeBuffer ( IN VOID *HostAddress
);
-/**
+/**
Flushes all PCI posted write transactions from a PCI host bridge to system memory.
-
- @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
-
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
+
@retval EFI_SUCCESS The PCI posted write transactions were flushed from the PCI host
- bridge to system memory.
+ bridge to system memory.
@retval EFI_DEVICE_ERROR The PCI posted write transactions were not flushed from the PCI
- host bridge due to a hardware error.
-
+ host bridge due to a hardware error.
+
**/
EFI_STATUS
EFIAPI
@@ -471,18 +477,18 @@ PciIoFlush ( IN EFI_PCI_IO_PROTOCOL *This
);
-/**
+/**
Retrieves this PCI controller's current PCI bus number, device number, and function number.
-
- @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param SegmentNumber The PCI controller's current PCI segment number.
@param BusNumber The PCI controller's current PCI bus number.
@param DeviceNumber The PCI controller's current PCI device number.
@param FunctionNumber The PCI controller's current PCI function number.
-
- @retval EFI_SUCCESS The PCI controller location was returned.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
-
+
+ @retval EFI_SUCCESS The PCI controller location was returned.
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
+
**/
EFI_STATUS
EFIAPI
@@ -496,30 +502,33 @@ PciIoGetLocation ( /**
Check BAR type for PCI resource.
-
- @param PciIoDevice PCI device instance
+
+ @param PciIoDevice PCI device instance.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
- base address for the memory or I/O operation to perform.
- @param BarType Memory or I/O
-
- @return whether Pci device's bar type is same with input BarType.
+ base address for the memory or I/O operation to perform.
+ @param BarType Memory or I/O.
+
+ @retval TRUE Pci device's bar type is same with input BarType.
+ @retval TRUE Pci device's bar type is not same with input BarType.
+
**/
BOOLEAN
CheckBarType (
- IN PCI_IO_DEVICE *PciIoDevice,
- UINT8 BarIndex,
- PCI_BAR_TYPE BarType
+ IN PCI_IO_DEVICE *PciIoDevice,
+ IN UINT8 BarIndex,
+ IN PCI_BAR_TYPE BarType
);
/**
- Set/Disable new attributes to a Root Bridge
-
- @param PciIoDevice Pci device instance
- @param Attributes New attribute want to be set
- @param Operation Set or Disable
-
- @retval EFI_UNSUPPORTED If root bridge does not support change attribute
- @retval EFI_SUCCESS Success operation.
+ Set/Disable new attributes to a Root Bridge.
+
+ @param PciIoDevice Pci device instance.
+ @param Attributes New attribute want to be set.
+ @param Operation Set or Disable.
+
+ @retval EFI_UNSUPPORTED If root bridge does not support change attribute.
+ @retval EFI_SUCCESS Successfully set new attributs.
+
**/
EFI_STATUS
ModifyRootBridgeAttributes (
@@ -529,38 +538,39 @@ ModifyRootBridgeAttributes ( );
/**
- Check whether this device can be enable/disable to snoop
-
- @param PciIoDevice Pci device instance
- @param Operation Enable/Disable
-
- @retval EFI_UNSUPPORTED Pci device is not GFX device or not support snoop
+ Check whether this device can be enable/disable to snoop.
+
+ @param PciIoDevice Pci device instance.
+ @param Operation Enable/Disable.
+
+ @retval EFI_UNSUPPORTED Pci device is not GFX device or not support snoop.
@retval EFI_SUCCESS Snoop can be supported.
+
**/
EFI_STATUS
SupportPaletteSnoopAttributes (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation
+ IN PCI_IO_DEVICE *PciIoDevice,
+ IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation
);
-/**
+/**
Performs an operation on the attributes that this PCI controller supports. The operations include
- getting the set of supported attributes, retrieving the current attributes, setting the current
- attributes, enabling attributes, and disabling attributes.
-
- @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
+ getting the set of supported attributes, retrieving the current attributes, setting the current
+ attributes, enabling attributes, and disabling attributes.
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Operation The operation to perform on the attributes for this PCI controller.
@param Attributes The mask of attributes that are used for Set, Enable, and Disable
- operations.
+ operations.
@param Result A pointer to the result mask of attributes that are returned for the Get
- and Supported operations.
-
+ and Supported operations.
+
@retval EFI_SUCCESS The operation on the PCI controller's attributes was completed.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
- @retval EFI_UNSUPPORTED one or more of the bits set in
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
+ @retval EFI_UNSUPPORTED one or more of the bits set in
Attributes are not supported by this PCI controller or one of
its parent bridges when Operation is Set, Enable or Disable.
-
+
**/
EFI_STATUS
EFIAPI
@@ -571,27 +581,27 @@ PciIoAttributes ( OUT UINT64 *Result OPTIONAL
);
-/**
+/**
Gets the attributes that this PCI controller supports setting on a BAR using
SetBarAttributes(), and retrieves the list of resource descriptors for a BAR.
-
- @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
base address for resource range. The legal range for this field is 0..5.
@param Supports A pointer to the mask of attributes that this PCI controller supports
- setting for this BAR with SetBarAttributes().
+ setting for this BAR with SetBarAttributes().
@param Resources A pointer to the ACPI 2.0 resource descriptors that describe the current
- configuration of this BAR of the PCI controller.
-
- @retval EFI_SUCCESS If Supports is not NULL, then the attributes that the PCI
- controller supports are returned in Supports. If Resources
+ configuration of this BAR of the PCI controller.
+
+ @retval EFI_SUCCESS If Supports is not NULL, then the attributes that the PCI
+ controller supports are returned in Supports. If Resources
is not NULL, then the ACPI 2.0 resource descriptors that the PCI
- controller is currently using are returned in Resources.
+ controller is currently using are returned in Resources.
@retval EFI_INVALID_PARAMETER Both Supports and Attributes are NULL.
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
@retval EFI_OUT_OF_RESOURCES There are not enough resources available to allocate
- Resources.
-
+ Resources.
+
**/
EFI_STATUS
EFIAPI
@@ -602,29 +612,29 @@ PciIoGetBarAttributes ( OUT VOID **Resources OPTIONAL
);
-/**
+/**
Sets the attributes for a range of a BAR on a PCI controller.
-
- @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
+
+ @param This A pointer to the EFI_PCI_IO_PROTOCOL instance.
@param Attributes The mask of attributes to set for the resource range specified by
- BarIndex, Offset, and Length.
+ BarIndex, Offset, and Length.
@param BarIndex The BAR index of the standard PCI Configuration header to use as the
base address for resource range. The legal range for this field is 0..5.
@param Offset A pointer to the BAR relative base address of the resource range to be
- modified by the attributes specified by Attributes.
+ modified by the attributes specified by Attributes.
@param Length A pointer to the length of the resource range to be modified by the
- attributes specified by Attributes.
-
- @retval EFI_SUCCESS The set of attributes specified by Attributes for the resource
- range specified by BarIndex, Offset, and Length were
+ attributes specified by Attributes.
+
+ @retval EFI_SUCCESS The set of attributes specified by Attributes for the resource
+ range specified by BarIndex, Offset, and Length were
set on the PCI controller, and the actual resource range is returned
- in Offset and Length.
+ in Offset and Length.
@retval EFI_INVALID_PARAMETER Offset or Length is NULL.
@retval EFI_UNSUPPORTED BarIndex not valid for this PCI controller.
@retval EFI_OUT_OF_RESOURCES There are not enough resources to set the attributes on the
- resource range specified by BarIndex, Offset, and
- Length.
-
+ resource range specified by BarIndex, Offset, and
+ Length.
+
**/
EFI_STATUS
EFIAPI
@@ -638,33 +648,35 @@ PciIoSetBarAttributes ( /**
Program parent bridge's attribute recurrently.
-
+
@param PciIoDevice Child Pci device instance
@param Operation The operation to perform on the attributes for this PCI controller.
@param Attributes The mask of attributes that are used for Set, Enable, and Disable
operations.
-
+
@retval EFI_SUCCESS The operation on the PCI controller's attributes was completed.
- @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
- @retval EFI_UNSUPPORTED one or more of the bits set in
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
+ @retval EFI_UNSUPPORTED one or more of the bits set in
Attributes are not supported by this PCI controller or one of
its parent bridges when Operation is Set, Enable or Disable.
-
+
**/
EFI_STATUS
UpStreamBridgesAttributes (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
- IN UINT64 Attributes
+ IN PCI_IO_DEVICE *PciIoDevice,
+ IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
+ IN UINT64 Attributes
);
/**
- Test whether two Pci device has same parent bridge.
-
- @param PciDevice1 the frist pci device for testing
- @param PciDevice2 the second pci device for testing
-
- @return whether two Pci device has same parent bridge.
+ Test whether two Pci devices has same parent bridge.
+
+ @param PciDevice1 The first pci device for testing.
+ @param PciDevice2 The second pci device for testing.
+
+ @retval TRUE Two Pci device has the same parent bridge.
+ @retval FALSE Two Pci device has not the same parent bridge.
+
**/
BOOLEAN
PciDevicesOnTheSamePath (
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciLib.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciLib.c index de9ecefa7b..87425a078b 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciLib.c +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciLib.c @@ -1,10 +1,7 @@ /** @file
+ Internal library implementation for PCI Bus module.
- PCI Bus Driver Lib file
- It abstracts some functions that can be different
- between light PCI bus driver and full PCI bus driver
-
-Copyright (c) 2006 - 2008, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
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
@@ -19,9 +16,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. /**
- Retrieve the BAR information via PciIo interface.
-
- @param PciIoDevice Pci device instance.
+ Retrieve the PCI Card device BAR information via PciIo interface.
+
+ @param PciIoDevice PCI Card device instance.
+
**/
VOID
GetBackPcCardBar (
@@ -38,12 +36,11 @@ GetBackPcCardBar ( // Read PciBar information from the bar register
//
if (!gFullEnumeration) {
-
Address = 0;
PciIoRead (
&(PciIoDevice->PciIo),
EfiPciIoWidthUint32,
- 0x1c,
+ PCI_CARD_MEMORY_BASE_0,
1,
&Address
);
@@ -56,7 +53,7 @@ GetBackPcCardBar ( PciIoRead (
&(PciIoDevice->PciIo),
EfiPciIoWidthUint32,
- 0x20,
+ PCI_CARD_MEMORY_BASE_1,
1,
&Address
);
@@ -68,7 +65,7 @@ GetBackPcCardBar ( PciIoRead (
&(PciIoDevice->PciIo),
EfiPciIoWidthUint32,
- 0x2c,
+ PCI_CARD_IO_BASE_0_LOWER,
1,
&Address
);
@@ -80,7 +77,7 @@ GetBackPcCardBar ( PciIoRead (
&(PciIoDevice->PciIo),
EfiPciIoWidthUint32,
- 0x34,
+ PCI_CARD_IO_BASE_1_LOWER,
1,
&Address
);
@@ -90,7 +87,7 @@ GetBackPcCardBar ( }
- if (gPciHotPlugInit != NULL) {
+ if (gPciHotPlugInit != NULL && FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
GetResourcePaddingForHpb (PciIoDevice);
}
}
@@ -98,16 +95,15 @@ GetBackPcCardBar ( /**
Remove rejected pci device from specific root bridge
handle.
-
- @param RootBridgeHandle specific parent root bridge handle.
+
+ @param RootBridgeHandle Specific parent root bridge handle.
@param Bridge Bridge device instance.
-
- @retval EFI_SUCCESS Success operation.
+
**/
-EFI_STATUS
+VOID
RemoveRejectedPciDevices (
- EFI_HANDLE RootBridgeHandle,
- IN PCI_IO_DEVICE *Bridge
+ IN EFI_HANDLE RootBridgeHandle,
+ IN PCI_IO_DEVICE *Bridge
)
{
PCI_IO_DEVICE *Temp;
@@ -115,7 +111,7 @@ RemoveRejectedPciDevices ( LIST_ENTRY *LastLink;
if (!FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
- return EFI_SUCCESS;
+ return;
}
CurrentLink = Bridge->ChildList.ForwardLink;
@@ -155,430 +151,52 @@ RemoveRejectedPciDevices ( CurrentLink = CurrentLink->ForwardLink;
}
-
- return EFI_SUCCESS;
-}
-
-/**
- Wrapper function for allocating resource for pci host bridge.
-
- @param PciResAlloc Point to protocol instance EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
-
-**/
-EFI_STATUS
-PciHostBridgeResourceAllocator (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
- )
-{
- if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
- return PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport (
- PciResAlloc
- );
- } else {
- return PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (
- PciResAlloc
- );
- }
}
/**
- Submits the I/O and memory resource requirements for the specified PCI Root Bridge.
+ Submits the I/O and memory resource requirements for the specified PCI Host Bridge.
@param PciResAlloc Point to protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
- @retval EFI_SUCCESS Success.
-**/
-EFI_STATUS
-PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
- )
-{
- PCI_IO_DEVICE *RootBridgeDev;
- EFI_HANDLE RootBridgeHandle;
- VOID *AcpiConfig;
- EFI_STATUS Status;
- UINT64 IoBase;
- UINT64 Mem32Base;
- UINT64 PMem32Base;
- UINT64 Mem64Base;
- UINT64 PMem64Base;
- UINT64 MaxOptionRomSize;
- PCI_RESOURCE_NODE *IoBridge;
- PCI_RESOURCE_NODE *Mem32Bridge;
- PCI_RESOURCE_NODE *PMem32Bridge;
- PCI_RESOURCE_NODE *Mem64Bridge;
- PCI_RESOURCE_NODE *PMem64Bridge;
- PCI_RESOURCE_NODE IoPool;
- PCI_RESOURCE_NODE Mem32Pool;
- PCI_RESOURCE_NODE PMem32Pool;
- PCI_RESOURCE_NODE Mem64Pool;
- PCI_RESOURCE_NODE PMem64Pool;
- EFI_DEVICE_HANDLE_EXTENDED_DATA_PAYLOAD ExtendedData;
-
- //
- // Initialize resource pool
- //
-
- InitializeResourcePool (&IoPool, PciBarTypeIo16);
- InitializeResourcePool (&Mem32Pool, PciBarTypeMem32);
- InitializeResourcePool (&PMem32Pool, PciBarTypePMem32);
- InitializeResourcePool (&Mem64Pool, PciBarTypeMem64);
- InitializeResourcePool (&PMem64Pool, PciBarTypePMem64);
-
- RootBridgeDev = NULL;
- RootBridgeHandle = 0;
-
- while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
- //
- // Get RootBridg Device by handle
- //
- RootBridgeDev = GetRootBridgeByHandle (RootBridgeHandle);
-
- if (RootBridgeDev == NULL) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Get host bridge handle for status report
- //
- ExtendedData.Handle = RootBridgeDev->PciRootBridgeIo->ParentHandle;
-
- //
- // Create the entire system resource map from the information collected by
- // enumerator. Several resource tree was created
- //
-
- IoBridge = CreateResourceNode (
- RootBridgeDev,
- 0,
- 0xFFF,
- 0,
- PciBarTypeIo16,
- PciResUsageTypical
- );
-
- Mem32Bridge = CreateResourceNode (
- RootBridgeDev,
- 0,
- 0xFFFFF,
- 0,
- PciBarTypeMem32,
- PciResUsageTypical
- );
-
- PMem32Bridge = CreateResourceNode (
- RootBridgeDev,
- 0,
- 0xFFFFF,
- 0,
- PciBarTypePMem32,
- PciResUsageTypical
- );
-
- Mem64Bridge = CreateResourceNode (
- RootBridgeDev,
- 0,
- 0xFFFFF,
- 0,
- PciBarTypeMem64,
- PciResUsageTypical
- );
-
- PMem64Bridge = CreateResourceNode (
- RootBridgeDev,
- 0,
- 0xFFFFF,
- 0,
- PciBarTypePMem64,
- PciResUsageTypical
- );
-
- //
- // Create resourcemap by going through all the devices subject to this root bridge
- //
- Status = CreateResourceMap (
- RootBridgeDev,
- IoBridge,
- Mem32Bridge,
- PMem32Bridge,
- Mem64Bridge,
- PMem64Bridge
- );
-
- //
- // Get the max ROM size that the root bridge can process
- //
- RootBridgeDev->RomSize = Mem32Bridge->Length;
-
- //
- // Get Max Option Rom size for current root bridge
- //
- MaxOptionRomSize = GetMaxOptionRomSize (RootBridgeDev);
-
- //
- // Enlarger the mem32 resource to accomdate the option rom
- // if the mem32 resource is not enough to hold the rom
- //
- if (MaxOptionRomSize > Mem32Bridge->Length) {
-
- Mem32Bridge->Length = MaxOptionRomSize;
- RootBridgeDev->RomSize = MaxOptionRomSize;
-
- //
- // Alignment should be adjusted as well
- //
- if (Mem32Bridge->Alignment < MaxOptionRomSize - 1) {
- Mem32Bridge->Alignment = MaxOptionRomSize - 1;
- }
- }
-
- //
- // Based on the all the resource tree, contruct ACPI resource node to
- // submit the resource aperture to pci host bridge protocol
- //
- Status = ConstructAcpiResourceRequestor (
- RootBridgeDev,
- IoBridge,
- Mem32Bridge,
- PMem32Bridge,
- Mem64Bridge,
- PMem64Bridge,
- &AcpiConfig
- );
-
- //
- // Insert these resource nodes into the database
- //
- InsertResourceNode (&IoPool, IoBridge);
- InsertResourceNode (&Mem32Pool, Mem32Bridge);
- InsertResourceNode (&PMem32Pool, PMem32Bridge);
- InsertResourceNode (&Mem64Pool, Mem64Bridge);
- InsertResourceNode (&PMem64Pool, PMem64Bridge);
-
- if (Status == EFI_SUCCESS) {
- //
- // Submit the resource requirement
- //
- Status = PciResAlloc->SubmitResources (
- PciResAlloc,
- RootBridgeDev->Handle,
- AcpiConfig
- );
- }
- //
- // Free acpi resource node
- //
- if (AcpiConfig != NULL) {
- FreePool (AcpiConfig);
- }
-
- if (EFI_ERROR (Status)) {
- //
- // Destroy all the resource tree
- //
- DestroyResourceTree (&IoPool);
- DestroyResourceTree (&Mem32Pool);
- DestroyResourceTree (&PMem32Pool);
- DestroyResourceTree (&Mem64Pool);
- DestroyResourceTree (&PMem64Pool);
- return Status;
- }
- }
- //
- // End while
- //
+ @retval EFI_SUCCESS Successfully finished resource allocation.
+ @retval EFI_NOT_FOUND Cannot get root bridge instance.
+ @retval EFI_OUT_OF_RESOURCES Platform failed to program the resources if no hot plug supported.
+ @retval other Some error occurred when allocating resources for the PCI Host Bridge.
- //
- // Notify pci bus driver starts to program the resource
- //
- Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeAllocateResources);
+ @note Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.
- if (EFI_ERROR (Status)) {
- //
- // Allocation failed, then return
- //
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Raise the EFI_IOB_PCI_RES_ALLOC status code
- //
- REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
- EFI_PROGRESS_CODE,
- EFI_IO_BUS_PCI | EFI_IOB_PCI_PC_RES_ALLOC,
- (VOID *) &ExtendedData,
- sizeof (ExtendedData)
- );
-
- //
- // Notify pci bus driver starts to program the resource
- //
- NotifyPhase (PciResAlloc, EfiPciHostBridgeSetResources);
-
- RootBridgeDev = NULL;
-
- RootBridgeHandle = 0;
-
- while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
- //
- // Get RootBridg Device by handle
- //
- RootBridgeDev = GetRootBridgeByHandle (RootBridgeHandle);
-
- if (RootBridgeDev == NULL) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Get acpi resource node for all the resource types
- //
- AcpiConfig = NULL;
- Status = PciResAlloc->GetProposedResources (
- PciResAlloc,
- RootBridgeDev->Handle,
- &AcpiConfig
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get the resource base by interpreting acpi resource node
- //
- //
- GetResourceBase (
- AcpiConfig,
- &IoBase,
- &Mem32Base,
- &PMem32Base,
- &Mem64Base,
- &PMem64Base
- );
-
- //
- // Process option rom for this root bridge
- //
- Status = ProcessOptionRom (RootBridgeDev, Mem32Base, RootBridgeDev->RomSize);
-
- //
- // Create the entire system resource map from the information collected by
- // enumerator. Several resource tree was created
- //
- Status = GetResourceMap (
- RootBridgeDev,
- &IoBridge,
- &Mem32Bridge,
- &PMem32Bridge,
- &Mem64Bridge,
- &PMem64Bridge,
- &IoPool,
- &Mem32Pool,
- &PMem32Pool,
- &Mem64Pool,
- &PMem64Pool
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Program IO resources
- //
- ProgramResource (
- IoBase,
- IoBridge
- );
-
- //
- // Program Mem32 resources
- //
- ProgramResource (
- Mem32Base,
- Mem32Bridge
- );
-
- //
- // Program PMem32 resources
- //
- ProgramResource (
- PMem32Base,
- PMem32Bridge
- );
-
- //
- // Program Mem64 resources
- //
- ProgramResource (
- Mem64Base,
- Mem64Bridge
- );
-
- //
- // Program PMem64 resources
- //
- ProgramResource (
- PMem64Base,
- PMem64Bridge
- );
-
- FreePool (AcpiConfig);
- }
-
- //
- // Destroy all the resource tree
- //
- DestroyResourceTree (&IoPool);
- DestroyResourceTree (&Mem32Pool);
- DestroyResourceTree (&PMem32Pool);
- DestroyResourceTree (&Mem64Pool);
- DestroyResourceTree (&PMem64Pool);
-
- //
- // Notify the resource allocation phase is to end
- //
- NotifyPhase (PciResAlloc, EfiPciHostBridgeEndResourceAllocation);
-
- return EFI_SUCCESS;
-}
-
-/**
- Submits the I/O and memory resource requirements for the specified PCI Root Bridge.
-
- @param PciResAlloc Point to protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
-
- @retval EFI_SUCCESS Success.
**/
EFI_STATUS
-PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport (
+PciHostBridgeResourceAllocator (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
)
{
- PCI_IO_DEVICE *RootBridgeDev;
- EFI_HANDLE RootBridgeHandle;
- VOID *AcpiConfig;
- EFI_STATUS Status;
- UINT64 IoBase;
- UINT64 Mem32Base;
- UINT64 PMem32Base;
- UINT64 Mem64Base;
- UINT64 PMem64Base;
- UINT64 IoResStatus;
- UINT64 Mem32ResStatus;
- UINT64 PMem32ResStatus;
- UINT64 Mem64ResStatus;
- UINT64 PMem64ResStatus;
- UINT64 MaxOptionRomSize;
- PCI_RESOURCE_NODE *IoBridge;
- PCI_RESOURCE_NODE *Mem32Bridge;
- PCI_RESOURCE_NODE *PMem32Bridge;
- PCI_RESOURCE_NODE *Mem64Bridge;
- PCI_RESOURCE_NODE *PMem64Bridge;
- PCI_RESOURCE_NODE IoPool;
- PCI_RESOURCE_NODE Mem32Pool;
- PCI_RESOURCE_NODE PMem32Pool;
- PCI_RESOURCE_NODE Mem64Pool;
- PCI_RESOURCE_NODE PMem64Pool;
- BOOLEAN ReAllocate;
+ PCI_IO_DEVICE *RootBridgeDev;
+ EFI_HANDLE RootBridgeHandle;
+ VOID *AcpiConfig;
+ EFI_STATUS Status;
+ UINT64 IoBase;
+ UINT64 Mem32Base;
+ UINT64 PMem32Base;
+ UINT64 Mem64Base;
+ UINT64 PMem64Base;
+ UINT64 IoResStatus;
+ UINT64 Mem32ResStatus;
+ UINT64 PMem32ResStatus;
+ UINT64 Mem64ResStatus;
+ UINT64 PMem64ResStatus;
+ UINT64 MaxOptionRomSize;
+ PCI_RESOURCE_NODE *IoBridge;
+ PCI_RESOURCE_NODE *Mem32Bridge;
+ PCI_RESOURCE_NODE *PMem32Bridge;
+ PCI_RESOURCE_NODE *Mem64Bridge;
+ PCI_RESOURCE_NODE *PMem64Bridge;
+ PCI_RESOURCE_NODE IoPool;
+ PCI_RESOURCE_NODE Mem32Pool;
+ PCI_RESOURCE_NODE PMem32Pool;
+ PCI_RESOURCE_NODE Mem64Pool;
+ PCI_RESOURCE_NODE PMem64Pool;
+ BOOLEAN ReAllocate;
EFI_DEVICE_HANDLE_EXTENDED_DATA_PAYLOAD HandleExtendedData;
EFI_RESOURCE_ALLOC_FAILURE_ERROR_DATA_PAYLOAD AllocFailExtendedData;
@@ -588,10 +206,9 @@ PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport ( ReAllocate = FALSE;
//
- // It will try several times if the resource allocation fails
+ // It may try several times if the resource allocation fails
//
while (TRUE) {
-
//
// Initialize resource pool
//
@@ -605,9 +222,8 @@ PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport ( RootBridgeHandle = 0;
while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
-
//
- // Get RootBridg Device by handle
+ // Get Root Bridge Device by handle
//
RootBridgeDev = GetRootBridgeByHandle (RootBridgeHandle);
@@ -668,14 +284,14 @@ PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport ( //
// Create resourcemap by going through all the devices subject to this root bridge
//
- Status = CreateResourceMap (
- RootBridgeDev,
- IoBridge,
- Mem32Bridge,
- PMem32Bridge,
- Mem64Bridge,
- PMem64Bridge
- );
+ CreateResourceMap (
+ RootBridgeDev,
+ IoBridge,
+ Mem32Bridge,
+ PMem32Bridge,
+ Mem64Bridge,
+ PMem64Bridge
+ );
//
// Get the max ROM size that the root bridge can process
@@ -762,127 +378,150 @@ PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport ( return Status;
}
}
-
//
- // Notify pci bus driver starts to program the resource
+ // End while
//
+ //
+ // Notify platform to start to program the resource
+ //
Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeAllocateResources);
-
- if (!EFI_ERROR (Status)) {
+ if (!FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
//
- // Allocation succeed, then continue the following
+ // If Hot Plug is not supported
//
- break;
- }
-
- //
- // If the resource allocation is unsuccessful, free resources on bridge
- //
-
- RootBridgeDev = NULL;
- RootBridgeHandle = 0;
+ if (EFI_ERROR (Status)) {
+ //
+ // Allocation failed, then return
+ //
+ return EFI_OUT_OF_RESOURCES;
+ }
+ //
+ // Allocation succeed.
+ // Get host bridge handle for status report, and then skip the main while
+ //
+ HandleExtendedData.Handle = RootBridgeDev->PciRootBridgeIo->ParentHandle;
- IoResStatus = EFI_RESOURCE_SATISFIED;
- Mem32ResStatus = EFI_RESOURCE_SATISFIED;
- PMem32ResStatus = EFI_RESOURCE_SATISFIED;
- Mem64ResStatus = EFI_RESOURCE_SATISFIED;
- PMem64ResStatus = EFI_RESOURCE_SATISFIED;
+ break;
- while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
+ } else {
//
- // Get RootBridg Device by handle
+ // If Hot Plug is supported
//
- RootBridgeDev = GetRootBridgeByHandle (RootBridgeHandle);
- if (RootBridgeDev == NULL) {
- return EFI_NOT_FOUND;
+ if (!EFI_ERROR (Status)) {
+ //
+ // Allocation succeed, then continue the following
+ //
+ break;
}
//
- // Get host bridge handle for status report
+ // If the resource allocation is unsuccessful, free resources on bridge
//
- HandleExtendedData.Handle = RootBridgeDev->PciRootBridgeIo->ParentHandle;
- //
- // Get acpi resource node for all the resource types
- //
- AcpiConfig = NULL;
+ RootBridgeDev = NULL;
+ RootBridgeHandle = 0;
- Status = PciResAlloc->GetProposedResources (
- PciResAlloc,
- RootBridgeDev->Handle,
- &AcpiConfig
- );
+ IoResStatus = EFI_RESOURCE_SATISFIED;
+ Mem32ResStatus = EFI_RESOURCE_SATISFIED;
+ PMem32ResStatus = EFI_RESOURCE_SATISFIED;
+ Mem64ResStatus = EFI_RESOURCE_SATISFIED;
+ PMem64ResStatus = EFI_RESOURCE_SATISFIED;
- if (EFI_ERROR (Status)) {
- return Status;
- }
+ while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
+ //
+ // Get RootBridg Device by handle
+ //
+ RootBridgeDev = GetRootBridgeByHandle (RootBridgeHandle);
+ if (RootBridgeDev == NULL) {
+ return EFI_NOT_FOUND;
+ }
- if (AcpiConfig != NULL) {
//
- // Adjust resource allocation policy for each RB
+ // Get host bridge handle for status report
//
- GetResourceAllocationStatus (
- AcpiConfig,
- &IoResStatus,
- &Mem32ResStatus,
- &PMem32ResStatus,
- &Mem64ResStatus,
- &PMem64ResStatus
- );
- FreePool (AcpiConfig);
- }
- }
- //
- // End while
- //
+ HandleExtendedData.Handle = RootBridgeDev->PciRootBridgeIo->ParentHandle;
- //
- // Raise the EFI_IOB_EC_RESOURCE_CONFLICT status code
- //
- //
- // It is very difficult to follow the spec here
- // Device path , Bar index can not be get here
- //
- ZeroMem (&AllocFailExtendedData, sizeof (AllocFailExtendedData));
+ //
+ // Get acpi resource node for all the resource types
+ //
+ AcpiConfig = NULL;
- REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
- EFI_PROGRESS_CODE,
- EFI_IO_BUS_PCI | EFI_IOB_EC_RESOURCE_CONFLICT,
- (VOID *) &AllocFailExtendedData,
- sizeof (AllocFailExtendedData)
- );
+ Status = PciResAlloc->GetProposedResources (
+ PciResAlloc,
+ RootBridgeDev->Handle,
+ &AcpiConfig
+ );
- Status = PciHostBridgeAdjustAllocation (
- &IoPool,
- &Mem32Pool,
- &PMem32Pool,
- &Mem64Pool,
- &PMem64Pool,
- IoResStatus,
- Mem32ResStatus,
- PMem32ResStatus,
- Mem64ResStatus,
- PMem64ResStatus
- );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
- //
- // Destroy all the resource tree
- //
- DestroyResourceTree (&IoPool);
- DestroyResourceTree (&Mem32Pool);
- DestroyResourceTree (&PMem32Pool);
- DestroyResourceTree (&Mem64Pool);
- DestroyResourceTree (&PMem64Pool);
+ if (AcpiConfig != NULL) {
+ //
+ // Adjust resource allocation policy for each RB
+ //
+ GetResourceAllocationStatus (
+ AcpiConfig,
+ &IoResStatus,
+ &Mem32ResStatus,
+ &PMem32ResStatus,
+ &Mem64ResStatus,
+ &PMem64ResStatus
+ );
+ FreePool (AcpiConfig);
+ }
+ }
+ //
+ // End while
+ //
- NotifyPhase (PciResAlloc, EfiPciHostBridgeFreeResources);
+ //
+ // Raise the EFI_IOB_EC_RESOURCE_CONFLICT status code
+ //
+ //
+ // It is very difficult to follow the spec here
+ // Device path , Bar index can not be get here
+ //
+ ZeroMem (&AllocFailExtendedData, sizeof (AllocFailExtendedData));
- if (EFI_ERROR (Status)) {
- return Status;
- }
+ REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
+ EFI_PROGRESS_CODE,
+ EFI_IO_BUS_PCI | EFI_IOB_EC_RESOURCE_CONFLICT,
+ (VOID *) &AllocFailExtendedData,
+ sizeof (AllocFailExtendedData)
+ );
+
+ Status = PciHostBridgeAdjustAllocation (
+ &IoPool,
+ &Mem32Pool,
+ &PMem32Pool,
+ &Mem64Pool,
+ &PMem64Pool,
+ IoResStatus,
+ Mem32ResStatus,
+ PMem32ResStatus,
+ Mem64ResStatus,
+ PMem64ResStatus
+ );
+
+ //
+ // Destroy all the resource tree
+ //
+ DestroyResourceTree (&IoPool);
+ DestroyResourceTree (&Mem32Pool);
+ DestroyResourceTree (&PMem32Pool);
+ DestroyResourceTree (&Mem64Pool);
+ DestroyResourceTree (&PMem64Pool);
+
+ NotifyPhase (PciResAlloc, EfiPciHostBridgeFreeResources);
- ReAllocate = TRUE;
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ ReAllocate = TRUE;
+ }
}
//
// End main while
@@ -908,7 +547,6 @@ PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport ( RootBridgeHandle = 0;
while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
-
//
// Get RootBridg Device by handle
//
@@ -948,29 +586,25 @@ PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport ( //
// Process option rom for this root bridge
//
- Status = ProcessOptionRom (RootBridgeDev, Mem32Base, RootBridgeDev->RomSize);
+ ProcessOptionRom (RootBridgeDev, Mem32Base, RootBridgeDev->RomSize);
//
// Create the entire system resource map from the information collected by
// enumerator. Several resource tree was created
//
- Status = GetResourceMap (
- RootBridgeDev,
- &IoBridge,
- &Mem32Bridge,
- &PMem32Bridge,
- &Mem64Bridge,
- &PMem64Bridge,
- &IoPool,
- &Mem32Pool,
- &PMem32Pool,
- &Mem64Pool,
- &PMem64Pool
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
+ GetResourceMap (
+ RootBridgeDev,
+ &IoBridge,
+ &Mem32Bridge,
+ &PMem32Bridge,
+ &Mem64Bridge,
+ &PMem64Bridge,
+ &IoPool,
+ &Mem32Pool,
+ &PMem32Pool,
+ &Mem64Pool,
+ &PMem64Pool
+ );
//
// Program IO resources
@@ -1033,234 +667,21 @@ PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport ( }
/**
- Wapper function of scanning pci bus and assign bus number to the given PCI bus system
- Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.
-
- @param Bridge Bridge device instance.
- @param StartBusNumber start point.
- @param SubBusNumber Point to sub bus number.
- @param PaddedBusRange Customized bus number.
-
- @retval EFI_SUCCESS Success.
- @retval EFI_DEVICE_ERROR Fail to scan bus.
-**/
-EFI_STATUS
-PciScanBus (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT8 StartBusNumber,
- OUT UINT8 *SubBusNumber,
- OUT UINT8 *PaddedBusRange
- )
-{
- if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
- return PciScanBus_WithHotPlugDeviceSupport (
- Bridge,
- StartBusNumber,
- SubBusNumber,
- PaddedBusRange
- );
- } else {
- return PciScanBus_WithoutHotPlugDeviceSupport (
- Bridge,
- StartBusNumber,
- SubBusNumber,
- PaddedBusRange
- );
- }
-}
+ Scan pci bus and assign bus number to the given PCI bus system.
-/**
- Wapper function of scanning pci bus and assign bus number to the given PCI bus system
- Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.
-
- @param Bridge Bridge device instance.
- @param StartBusNumber start point.
- @param SubBusNumber Point to sub bus number.
- @param PaddedBusRange Customized bus number.
-
- @retval EFI_SUCCESS Success.
- @retval EFI_DEVICE_ERROR Fail to scan bus.
-**/
-EFI_STATUS
-PciScanBus_WithoutHotPlugDeviceSupport (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT8 StartBusNumber,
- OUT UINT8 *SubBusNumber,
- OUT UINT8 *PaddedBusRange
- )
-{
- EFI_STATUS Status;
- PCI_TYPE00 Pci;
- UINT8 Device;
- UINT8 Func;
- UINT64 Address;
- UINTN SecondBus;
- UINT16 Register;
- PCI_IO_DEVICE *PciDevice;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
-
- PciRootBridgeIo = Bridge->PciRootBridgeIo;
- SecondBus = 0;
- Register = 0;
-
- for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {
- for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {
+ @param Bridge Bridge device instance.
+ @param StartBusNumber start point.
+ @param SubBusNumber Point to sub bus number.
+ @param PaddedBusRange Customized bus number.
- //
- // Check to see whether a pci device is present
- //
- Status = PciDevicePresent (
- PciRootBridgeIo,
- &Pci,
- StartBusNumber,
- Device,
- Func
- );
+ @retval EFI_SUCCESS Successfully scanned and assigned bus number.
+ @retval other Some error occurred when scanning pci bus.
- if (!EFI_ERROR (Status)) {
- DEBUG((EFI_D_ERROR, "Found DEV(%02d,%02d,%02d)\n", StartBusNumber, Device, Func));
-
- if (IS_PCI_BRIDGE (&Pci) ||
- IS_CARDBUS_BRIDGE (&Pci)) {
+ @note Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.
- //
- // Get the bridge information
- //
- Status = PciSearchDevice (
- Bridge,
- &Pci,
- StartBusNumber,
- Device,
- Func,
- &PciDevice
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Add feature to support customized secondary bus number
- //
- if (*SubBusNumber == 0) {
- *SubBusNumber = *PaddedBusRange;
- *PaddedBusRange = 0;
- }
-
- (*SubBusNumber)++;
-
- SecondBus = (*SubBusNumber);
-
- Register = (UINT16) ((SecondBus << 8) | (UINT16) StartBusNumber);
-
- Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x18);
-
- Status = PciRootBridgeIoWrite (
- PciRootBridgeIo,
- &Pci,
- EfiPciWidthUint16,
- Address,
- 1,
- &Register
- );
-
- //
- // Initialize SubBusNumber to SecondBus
- //
- Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);
- Status = PciRootBridgeIoWrite (
- PciRootBridgeIo,
- &Pci,
- EfiPciWidthUint8,
- Address,
- 1,
- SubBusNumber
- );
- //
- // If it is PPB, resursively search down this bridge
- //
- if (IS_PCI_BRIDGE (&Pci)) {
- //
- // Temporarily initialize SubBusNumber to maximum bus number to ensure the
- // PCI configuration transaction to go through any PPB
- //
- Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);
- Register = 0xFF;
- Status = PciRootBridgeIoWrite (
- PciRootBridgeIo,
- &Pci,
- EfiPciWidthUint8,
- Address,
- 1,
- &Register
- );
-
- PreprocessController (
- PciDevice,
- PciDevice->BusNumber,
- PciDevice->DeviceNumber,
- PciDevice->FunctionNumber,
- EfiPciBeforeChildBusEnumeration
- );
-
- DEBUG((EFI_D_ERROR, "Scan PPB(%02d,%02d,%02d)\n", PciDevice->BusNumber, PciDevice->DeviceNumber,PciDevice->FunctionNumber ));
- Status = PciScanBus (
- PciDevice,
- (UINT8) (SecondBus),
- SubBusNumber,
- PaddedBusRange
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
- }
-
- //
- // Set the current maximum bus number under the PPB
- //
-
- Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);
-
- Status = PciRootBridgeIoWrite (
- PciRootBridgeIo,
- &Pci,
- EfiPciWidthUint8,
- Address,
- 1,
- SubBusNumber
- );
-
- }
- }
- if (Func == 0 && !IS_PCI_MULTI_FUNC (&Pci)) {
-
- //
- // Skip sub functions, this is not a multi function device
- //
-
- Func = PCI_MAX_FUNC;
- }
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Wapper function of scanning pci bus and assign bus number to the given PCI bus system
- Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.
-
- @param Bridge Bridge device instance.
- @param StartBusNumber start point.
- @param SubBusNumber Point to sub bus number.
- @param PaddedBusRange Customized bus number.
-
- @retval EFI_SUCCESS Success.
- @retval EFI_DEVICE_ERROR Fail to scan bus.
**/
EFI_STATUS
-PciScanBus_WithHotPlugDeviceSupport (
+PciScanBus (
IN PCI_IO_DEVICE *Bridge,
IN UINT8 StartBusNumber,
OUT UINT8 *SubBusNumber,
@@ -1291,6 +712,9 @@ PciScanBus_WithHotPlugDeviceSupport ( State = 0;
Attributes = (EFI_HPC_PADDING_ATTRIBUTES) 0;
BusRange = 0;
+ BusPadding = FALSE;
+ PciDevice = NULL;
+ PciAddress = 0;
for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {
for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {
@@ -1319,67 +743,69 @@ PciScanBus_WithHotPlugDeviceSupport ( DEBUG((EFI_D_ERROR, "Found DEV(%02d,%02d,%02d)\n", StartBusNumber, Device, Func ));
- //
- // Get the PCI device information
- //
- Status = PciSearchDevice (
- Bridge,
- &Pci,
- StartBusNumber,
- Device,
- Func,
- &PciDevice
- );
+ if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
+ //
+ // Get the PCI device information
+ //
+ Status = PciSearchDevice (
+ Bridge,
+ &Pci,
+ StartBusNumber,
+ Device,
+ Func,
+ &PciDevice
+ );
- ASSERT (!EFI_ERROR (Status));
+ ASSERT (!EFI_ERROR (Status));
- PciAddress = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0);
+ PciAddress = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0);
- if (!IS_PCI_BRIDGE (&Pci)) {
- //
- // PCI bridges will be called later
- // Here just need for PCI device or PCI to cardbus controller
- // EfiPciBeforeChildBusEnumeration for PCI Device Node
- //
- PreprocessController (
- PciDevice,
- PciDevice->BusNumber,
- PciDevice->DeviceNumber,
- PciDevice->FunctionNumber,
- EfiPciBeforeChildBusEnumeration
- );
- }
+ if (!IS_PCI_BRIDGE (&Pci)) {
+ //
+ // PCI bridges will be called later
+ // Here just need for PCI device or PCI to cardbus controller
+ // EfiPciBeforeChildBusEnumeration for PCI Device Node
+ //
+ PreprocessController (
+ PciDevice,
+ PciDevice->BusNumber,
+ PciDevice->DeviceNumber,
+ PciDevice->FunctionNumber,
+ EfiPciBeforeChildBusEnumeration
+ );
+ }
- //
- // For Pci Hotplug controller devcie only
- //
- if (gPciHotPlugInit != NULL) {
//
- // Check if it is a Hotplug PCI controller
+ // For Pci Hotplug controller devcie only
//
- if (IsRootPciHotPlugController (PciDevice->DevicePath, &HpIndex)) {
+ if (gPciHotPlugInit != NULL) {
+ //
+ // Check if it is a Hotplug PCI controller
+ //
+ if (IsRootPciHotPlugController (PciDevice->DevicePath, &HpIndex)) {
- if (!gPciRootHpcData[HpIndex].Initialized) {
+ if (!gPciRootHpcData[HpIndex].Initialized) {
- Status = CreateEventForHpc (HpIndex, &Event);
+ Status = CreateEventForHpc (HpIndex, &Event);
- ASSERT (!EFI_ERROR (Status));
+ ASSERT (!EFI_ERROR (Status));
- Status = gPciHotPlugInit->InitializeRootHpc (
- gPciHotPlugInit,
- gPciRootHpcPool[HpIndex].HpcDevicePath,
- PciAddress,
- Event,
- &State
- );
+ Status = gPciHotPlugInit->InitializeRootHpc (
+ gPciHotPlugInit,
+ gPciRootHpcPool[HpIndex].HpcDevicePath,
+ PciAddress,
+ Event,
+ &State
+ );
- PreprocessController (
- PciDevice,
- PciDevice->BusNumber,
- PciDevice->DeviceNumber,
- PciDevice->FunctionNumber,
- EfiPciBeforeChildBusEnumeration
- );
+ PreprocessController (
+ PciDevice,
+ PciDevice->BusNumber,
+ PciDevice->DeviceNumber,
+ PciDevice->FunctionNumber,
+ EfiPciBeforeChildBusEnumeration
+ );
+ }
}
}
}
@@ -1387,44 +813,66 @@ PciScanBus_WithHotPlugDeviceSupport ( if (IS_PCI_BRIDGE (&Pci) || IS_CARDBUS_BRIDGE (&Pci)) {
//
// For PPB
- // Get the bridge information
//
- BusPadding = FALSE;
- if (gPciHotPlugInit != NULL) {
+ if (!FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
+ //
+ // If Hot Plug is not supported,
+ // get the bridge information
+ //
+ Status = PciSearchDevice (
+ Bridge,
+ &Pci,
+ StartBusNumber,
+ Device,
+ Func,
+ &PciDevice
+ );
- if (IsRootPciHotPlugBus (PciDevice->DevicePath, &HpIndex)) {
-
- //
- // If it is initialized, get the padded bus range
- //
- Status = gPciHotPlugInit->GetResourcePadding (
- gPciHotPlugInit,
- gPciRootHpcPool[HpIndex].HpbDevicePath,
- PciAddress,
- &State,
- (VOID **) &Descriptors,
- &Attributes
- );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ } else {
+ //
+ // If Hot Plug is supported,
+ // Get the bridge information
+ //
+ BusPadding = FALSE;
+ if (gPciHotPlugInit != NULL) {
+
+ if (IsRootPciHotPlugBus (PciDevice->DevicePath, &HpIndex)) {
+
+ //
+ // If it is initialized, get the padded bus range
+ //
+ Status = gPciHotPlugInit->GetResourcePadding (
+ gPciHotPlugInit,
+ gPciRootHpcPool[HpIndex].HpbDevicePath,
+ PciAddress,
+ &State,
+ (VOID **) &Descriptors,
+ &Attributes
+ );
- if (EFI_ERROR (Status)) {
- return Status;
- }
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
- BusRange = 0;
- Status = PciGetBusRange (
- &Descriptors,
- NULL,
- NULL,
- &BusRange
- );
+ BusRange = 0;
+ Status = PciGetBusRange (
+ &Descriptors,
+ NULL,
+ NULL,
+ &BusRange
+ );
- FreePool (Descriptors);
+ FreePool (Descriptors);
- if (EFI_ERROR (Status)) {
- return Status;
- }
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
- BusPadding = TRUE;
+ BusPadding = TRUE;
+ }
}
}
@@ -1440,7 +888,7 @@ PciScanBus_WithHotPlugDeviceSupport ( SecondBus = *SubBusNumber;
Register = (UINT16) ((SecondBus << 8) | (UINT16) StartBusNumber);
- Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x18);
+ Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET);
Status = PciRootBridgeIoWrite (
PciRootBridgeIo,
@@ -1458,10 +906,11 @@ PciScanBus_WithHotPlugDeviceSupport ( if (IS_PCI_BRIDGE (&Pci)) {
//
- // Initialize SubBusNumber to Maximum bus number
+ // Temporarily initialize SubBusNumber to maximum bus number to ensure the
+ // PCI configuration transaction to go through any PPB
//
Register = 0xFF;
- Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);
+ Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, PCI_BRIDGE_SUBORDINATE_BUS_REGISTER_OFFSET);
Status = PciRootBridgeIoWrite (
PciRootBridgeIo,
&Pci,
@@ -1482,20 +931,19 @@ PciScanBus_WithHotPlugDeviceSupport ( EfiPciBeforeChildBusEnumeration
);
- DEBUG((EFI_D_ERROR, "Scan PPB(%02d,%02d,%02d)\n", PciDevice->BusNumber, PciDevice->DeviceNumber,PciDevice->FunctionNumber ));
+ DEBUG((EFI_D_ERROR, "Scan PPB(%02d,%02d,%02d)\n", PciDevice->BusNumber, PciDevice->DeviceNumber,PciDevice->FunctionNumber));
Status = PciScanBus (
PciDevice,
(UINT8) (SecondBus),
SubBusNumber,
PaddedBusRange
);
-
if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
+ return Status;
}
}
- if (BusPadding) {
+ if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport) && BusPadding) {
//
// Ensure the device is enabled and initialized
//
@@ -1511,7 +959,7 @@ PciScanBus_WithHotPlugDeviceSupport ( //
// Set the current maximum bus number under the PPB
//
- Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);
+ Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, PCI_BRIDGE_SUBORDINATE_BUS_REGISTER_OFFSET);
Status = PciRootBridgeIoWrite (
PciRootBridgeIo,
@@ -1528,9 +976,9 @@ PciScanBus_WithHotPlugDeviceSupport ( //
// Skip sub functions, this is not a multi function device
//
+
Func = PCI_MAX_FUNC;
}
-
}
}
@@ -1538,11 +986,13 @@ PciScanBus_WithHotPlugDeviceSupport ( }
/**
- Process Option Rom on this host bridge.
-
- @param Bridge Pci bridge device instance.
-
- @retval EFI_SUCCESS Success.
+ Process Option Rom on the specified root bridge.
+
+ @param Bridge Pci root bridge device instance.
+
+ @retval EFI_SUCCESS Success process.
+ @retval other Some error occurred when processing Option Rom on the root bridge.
+
**/
EFI_STATUS
PciRootBridgeP2CProcess (
@@ -1563,7 +1013,7 @@ PciRootBridgeP2CProcess ( if (IS_CARDBUS_BRIDGE (&Temp->Pci)) {
- if (gPciHotPlugInit != NULL && Temp->Allocated) {
+ if (gPciHotPlugInit != NULL && Temp->Allocated && FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
//
// Raise the EFI_IOB_PCI_HPC_INIT status code
@@ -1608,12 +1058,14 @@ PciRootBridgeP2CProcess ( }
/**
- Process Option Rom on this host bridge.
-
- @param PciResAlloc Pointer to instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
-
- @retval EFI_NOT_FOUND Can not find the root bridge instance.
+ Process Option Rom on the specified host bridge.
+
+ @param PciResAlloc Pointer to instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
+
@retval EFI_SUCCESS Success process.
+ @retval EFI_NOT_FOUND Can not find the root bridge instance.
+ @retval other Some error occurred when processing Option Rom on the host bridge.
+
**/
EFI_STATUS
PciHostBridgeP2CProcess (
@@ -1642,7 +1094,6 @@ PciHostBridgeP2CProcess ( }
Status = PciRootBridgeP2CProcess (RootBridgeDev);
-
if (EFI_ERROR (Status)) {
return Status;
}
@@ -1656,10 +1107,11 @@ PciHostBridgeP2CProcess ( This function is used to enumerate the entire host bridge
in a given platform.
- @param PciResAlloc A pointer to the resource allocate protocol.
+ @param PciResAlloc A pointer to the PCI Host Resource Allocation protocol.
- @retval EFI_OUT_OF_RESOURCES no enough resource.
- @retval EFI_SUCCESS Success.
+ @retval EFI_SUCCESS Successfully enumerated the host bridge.
+ @retval EFI_OUT_OF_RESOURCES No enough memory available.
+ @retval other Some error occurred when enumerating the host bridge.
**/
EFI_STATUS
@@ -1678,7 +1130,9 @@ PciHostBridgeEnumerator ( LIST_ENTRY RootBridgeList;
LIST_ENTRY *Link;
- InitializeHotPlugSupport ();
+ if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
+ InitializeHotPlugSupport ();
+ }
InitializeListHead (&RootBridgeList);
@@ -1704,13 +1158,12 @@ PciHostBridgeEnumerator ( //
// Enumerate all the buses under this root bridge
//
-
Status = PciRootBridgeEnumerator (
PciResAlloc,
RootBridgeDev
);
- if (gPciHotPlugInit != NULL) {
+ if (gPciHotPlugInit != NULL && FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
InsertTailList (&RootBridgeList, &(RootBridgeDev->Link));
} else {
DestroyRootBridge (RootBridgeDev);
@@ -1725,92 +1178,87 @@ PciHostBridgeEnumerator ( //
NotifyPhase (PciResAlloc, EfiPciHostBridgeEndBusAllocation);
- if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
-
- if (gPciHotPlugInit != NULL) {
+ if (gPciHotPlugInit != NULL && FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
+ //
+ // Reset all assigned PCI bus number in all PPB
+ //
+ RootBridgeHandle = NULL;
+ Link = GetFirstNode (&RootBridgeList);
+ while ((PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) &&
+ (!IsNull (&RootBridgeList, Link))) {
+ RootBridgeDev = PCI_IO_DEVICE_FROM_LINK (Link);
//
- // Reset all assigned PCI bus number in all PPB
+ // Get the Bus information
//
- RootBridgeHandle = NULL;
- Link = GetFirstNode (&RootBridgeList);
- while ((PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) &&
- (!IsNull (&RootBridgeList, Link))) {
- RootBridgeDev = PCI_IO_DEVICE_FROM_LINK (Link);
- //
- // Get the Bus information
- //
- Status = PciResAlloc->StartBusEnumeration (
- PciResAlloc,
- RootBridgeHandle,
- (VOID **) &Configuration
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get the bus number to start with
- //
- StartBusNumber = (UINT8) (Configuration->AddrRangeMin);
-
- ResetAllPpbBusNumber (
- RootBridgeDev,
- StartBusNumber
- );
-
- FreePool (Configuration);
- Link = GetNextNode (&RootBridgeList, Link);
- DestroyRootBridge (RootBridgeDev);
- }
-
- //
- // Wait for all HPC initialized
- //
- Status = AllRootHPCInitialized (STALL_1_SECOND * 15);
-
+ Status = PciResAlloc->StartBusEnumeration (
+ PciResAlloc,
+ RootBridgeHandle,
+ (VOID **) &Configuration
+ );
if (EFI_ERROR (Status)) {
return Status;
}
//
- // Notify the bus allocation phase is about to start for the 2nd time
+ // Get the bus number to start with
//
- NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginBusAllocation);
+ StartBusNumber = (UINT8) (Configuration->AddrRangeMin);
- DEBUG((EFI_D_ERROR, "PCI Bus Second Scanning\n"));
- RootBridgeHandle = NULL;
- while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
+ ResetAllPpbBusNumber (
+ RootBridgeDev,
+ StartBusNumber
+ );
- //
- // if a root bridge instance is found, create root bridge device for it
- //
+ FreePool (Configuration);
+ Link = GetNextNode (&RootBridgeList, Link);
+ DestroyRootBridge (RootBridgeDev);
+ }
- RootBridgeDev = CreateRootBridge (RootBridgeHandle);
+ //
+ // Wait for all HPC initialized
+ //
+ Status = AllRootHPCInitialized (STALL_1_SECOND * 15);
- if (RootBridgeDev == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
- //
- // Enumerate all the buses under this root bridge
- //
+ //
+ // Notify the bus allocation phase is about to start for the 2nd time
+ //
+ NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginBusAllocation);
- Status = PciRootBridgeEnumerator (
- PciResAlloc,
- RootBridgeDev
- );
+ DEBUG((EFI_D_ERROR, "PCI Bus Second Scanning\n"));
+ RootBridgeHandle = NULL;
+ while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
- DestroyRootBridge (RootBridgeDev);
- if (EFI_ERROR (Status)) {
- return Status;
- }
+ //
+ // if a root bridge instance is found, create root bridge device for it
+ //
+ RootBridgeDev = CreateRootBridge (RootBridgeHandle);
+
+ if (RootBridgeDev == NULL) {
+ return EFI_OUT_OF_RESOURCES;
}
//
- // Notify the bus allocation phase is to end for the 2nd time
+ // Enumerate all the buses under this root bridge
//
- NotifyPhase (PciResAlloc, EfiPciHostBridgeEndBusAllocation);
+ Status = PciRootBridgeEnumerator (
+ PciResAlloc,
+ RootBridgeDev
+ );
+
+ DestroyRootBridge (RootBridgeDev);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
}
+
+ //
+ // Notify the bus allocation phase is to end for the 2nd time
+ //
+ NotifyPhase (PciResAlloc, EfiPciHostBridgeEndBusAllocation);
}
//
@@ -1824,7 +1272,6 @@ PciHostBridgeEnumerator ( //
// if a root bridge instance is found, create root bridge device for it
//
-
RootBridgeDev = CreateRootBridge (RootBridgeHandle);
if (RootBridgeDev == NULL) {
@@ -1890,18 +1337,18 @@ PciHostBridgeEnumerator ( This function check the incompatiblilites on PCI device. Return the register
value.
- @param PciRootBridgeIo A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- @param PciIo A pointer to EFI_PCI_PROTOCOL.
- @param PciDeviceInfo A pointer to EFI_PCI_DEVICE_INFO.
+ @param PciRootBridgeIo PCI root bridge io protocol instance.
+ @param PciIo PCI IO protocol instance.
+ @param PciDeviceInfo PCI device information.
@param Width Signifies the width of the memory operations.
@param Address The address within the PCI configuration space for the PCI controller.
@param Buffer For read operations, the destination buffer to store the results. For
write operations, the source buffer to write data from.
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
+ @retval EFI_UNSUPPORTED Width is invalid for this PCI root bridge.
+ @retval other Some error occurred when reading PCI device configuration space
+ or checking incompatibility.
**/
EFI_STATUS
@@ -1923,16 +1370,17 @@ ReadConfigData ( UINT8 *Pointer;
ASSERT ((PciRootBridgeIo == NULL) ^ (PciIo == NULL));
+ ASSERT (Buffer != NULL);
- if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_ACCESS_WIDTH_SUPPORT) {
+ if ((PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_ACCESS_WIDTH_SUPPORT) != 0) {
//
- // check access compatibility at first time
+ // Check access compatibility at first time
//
Status = PciRegisterAccessCheck (PciDeviceInfo, PCI_REGISTER_READ, Address & 0xff, Width, &PciRegisterAccessData);
if (Status == EFI_SUCCESS) {
//
- // there exist incompatibility on this operation
+ // There exists incompatibility on this operation
//
AccessWidth = Width;
@@ -1946,7 +1394,7 @@ ReadConfigData ( Stride = 0;
Pointer = (UINT8 *) &TempBuffer;
- while (1) {
+ while (TRUE) {
if (PciRootBridgeIo != NULL) {
Status = PciRootBridgeIo->Pci.Read (
@@ -1974,7 +1422,7 @@ ReadConfigData ( AccessAddress += Stride;
if (AccessAddress >= (Address + LShiftU64 (1ULL, (UINTN)Width))) {
//
- // if all datas have been read, exist
+ // If all datas have been read, exit
//
break;
}
@@ -1983,15 +1431,13 @@ ReadConfigData ( if ((AccessAddress & 0xff) < PciRegisterAccessData->EndOffset) {
//
- // if current offset doesn't reach the end
+ // If current offset doesn't reach the end
//
continue;
}
- FreePool (PciRegisterAccessData);
-
//
- // continue checking access incompatibility
+ // Continue checking access incompatibility
//
Status = PciRegisterAccessCheck (PciDeviceInfo, PCI_REGISTER_READ, AccessAddress & 0xff, AccessWidth, &PciRegisterAccessData);
if (Status == EFI_SUCCESS) {
@@ -2001,8 +1447,6 @@ ReadConfigData ( }
}
- FreePool (PciRegisterAccessData);
-
switch (Width) {
case EfiPciWidthUint8:
* (UINT8 *) Buffer = (UINT8) TempBuffer;
@@ -2059,6 +1503,8 @@ ReadConfigData ( @param Buffer Store the register data.
@retval EFI_SUCCESS The data has been updated.
+ @retval EFI_UNSUPPORTED Width is invalid for this PCI root bridge.
+ @retval other Some error occurred when checking incompatibility.
**/
EFI_STATUS
@@ -2076,11 +1522,12 @@ UpdateConfigData ( UINT32 OrValue;
UINT32 TempValue;
+ ASSERT (Buffer != NULL);
+
//
- // check register value incompatibility
+ // Check register value incompatibility
//
Status = PciRegisterUpdateCheck (PciDeviceInfo, AccessType, Address & 0xff, &PciRegisterData);
-
if (Status == EFI_SUCCESS) {
AndValue = ((UINT32) PciRegisterData->AndValue) >> (((UINT8) Address & 0x3) * 8);
@@ -2109,8 +1556,6 @@ UpdateConfigData ( default:
return EFI_UNSUPPORTED;
}
-
- FreePool (PciRegisterData);
}
return Status;
@@ -2122,18 +1567,17 @@ UpdateConfigData ( This function check the incompatiblilites on PCI device, and write date
into register.
- @param PciRootBridgeIo A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- @param PciIo A pointer to EFI_PCI_PROTOCOL.
- @param PciDeviceInfo A pointer to EFI_PCI_DEVICE_INFO.
+ @param PciRootBridgeIo PCI root bridge io instance.
+ @param PciIo PCI IO protocol instance.
+ @param PciDeviceInfo PCI device information.
@param Width Signifies the width of the memory operations.
@param Address The address within the PCI configuration space for the PCI controller.
@param Buffer For read operations, the destination buffer to store the results. For
write operations, the source buffer to write data from.
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
+ @retval other Some error occurred when writing PCI device information
+ or checking incompatibility.
**/
EFI_STATUS
@@ -2156,16 +1600,17 @@ WriteConfigData ( UINTN Shift;
ASSERT ((PciRootBridgeIo == NULL) ^ (PciIo == NULL));
+ ASSERT (Buffer != NULL);
- if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_ACCESS_WIDTH_SUPPORT) {
+ if ((PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_ACCESS_WIDTH_SUPPORT) != 0) {
//
- // check access compatibility at first time
+ // Check access compatibility at first time
//
Status = PciRegisterAccessCheck (PciDeviceInfo, PCI_REGISTER_WRITE, Address & 0xff, Width, &PciRegisterAccessData);
if (Status == EFI_SUCCESS) {
//
- // there exist incompatibility on this operation
+ // There exists incompatibility on this operation
//
AccessWidth = Width;
@@ -2179,11 +1624,11 @@ WriteConfigData ( Pointer = (UINT8 *) &Buffer;
Data = * (UINT64 *) Buffer;
- while (1) {
+ while (TRUE) {
if (AccessWidth > Width) {
//
- // if actual access width is larger than orignal one, additional data need to be read back firstly
+ // If actual access width is larger than orignal one, additional data need to be read back firstly
//
Status = ReadConfigData (PciRootBridgeIo, PciIo, PciDeviceInfo, AccessWidth, AccessAddress, &Data);
if (Status != EFI_SUCCESS) {
@@ -2191,7 +1636,7 @@ WriteConfigData ( }
//
- // check data read incompatibility
+ // Check data read incompatibility
//
UpdateConfigData (PciDeviceInfo, PCI_REGISTER_READ, AccessWidth, AccessAddress & 0xff, &Data);
@@ -2207,7 +1652,7 @@ WriteConfigData ( }
//
- // check data write incompatibility
+ // Check data write incompatibility
//
UpdateConfigData (PciDeviceInfo, PCI_REGISTER_WRITE, AccessWidth, MultU64x32 (AccessAddress, 0xff), &Data);
}
@@ -2240,7 +1685,7 @@ WriteConfigData ( AccessAddress += Stride;
if (AccessAddress >= (Address + LShiftU64 (1ULL, (UINTN)Width))) {
//
- // if all datas have been written, exist
+ // If all datas have been written, exit
//
break;
}
@@ -2249,15 +1694,13 @@ WriteConfigData ( if ((AccessAddress & 0xff) < PciRegisterAccessData->EndOffset) {
//
- // if current offset doesn't reach the end
+ // If current offset doesn't reach the end
//
continue;
}
- FreePool (PciRegisterAccessData);
-
//
- // continue checking access incompatibility
+ // Continue checking access incompatibility
//
Status = PciRegisterAccessCheck (PciDeviceInfo, PCI_REGISTER_WRITE, AccessAddress & 0xff, AccessWidth, &PciRegisterAccessData);
if (Status == EFI_SUCCESS) {
@@ -2267,8 +1710,6 @@ WriteConfigData ( }
};
- FreePool (PciRegisterAccessData);
-
return Status;
}
@@ -2303,11 +1744,13 @@ WriteConfigData ( @param PciRootBridgeIo A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
@param PciIo A pointer to EFI_PCI_PROTOCOL.
- @param Pci A pointer to PCI_TYPE00.
+ @param Pci PCI device configuration space.
@param Address The address within the PCI configuration space for the PCI controller.
@param PciDeviceInfo A pointer to EFI_PCI_DEVICE_INFO.
@retval EFI_SUCCESS Pci device device information has been abstracted.
+ @retval EFI_NOT_FOUND Cannot found the specified PCI device.
+ @retval other Some error occurred when reading PCI device information.
**/
EFI_STATUS
@@ -2325,19 +1768,20 @@ GetPciDeviceDeviceInfo ( PCI_IO_DEVICE *PciIoDevice;
ASSERT ((PciRootBridgeIo == NULL) ^ (PciIo == NULL));
+ ASSERT (PciDeviceInfo != NULL);
if (PciIo != NULL) {
PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (PciIo);
//
- // get pointer to PCI_TYPE00 from PciIoDevice
+ // Get pointer to PCI_TYPE00 from PciIoDevice
//
Pci = &PciIoDevice->Pci;
}
if (Pci == NULL) {
//
- // while PCI_TYPE00 hasn't been gotten, read PCI device device information directly
+ // While PCI_TYPE00 hasn't been gotten, read PCI device device information directly
//
PciAddress = Address & 0xffffffffffffff00ULL;
Status = PciRootBridgeIo->Pci.Read (
@@ -2410,10 +1854,9 @@ GetPciDeviceDeviceInfo ( @param Buffer For read operations, the destination buffer to store the results. For
write operations, the source buffer to write data from.
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
+ @retval EFI_UNSUPPORTED Buffer is NULL.
+ @retval other Some error occurred when reading PCI configuration space.
**/
EFI_STATUS
@@ -2425,13 +1868,16 @@ PciIncompatibilityCheckRead ( IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
-)
+ )
{
EFI_STATUS Status;
EFI_PCI_DEVICE_INFO PciDeviceInfo;
UINT32 Stride;
ASSERT ((PciRootBridgeIo == NULL) ^ (PciIo == NULL));
+ if (Buffer == NULL) {
+ return EFI_UNSUPPORTED;
+ }
//
// get PCI device device information
@@ -2457,7 +1903,7 @@ PciIncompatibilityCheckRead ( //
// update the data read from configuration register
//
- if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_REGISTER_UPDATE_SUPPORT) {
+ if ((PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_REGISTER_UPDATE_SUPPORT) != 0) {
UpdateConfigData (&PciDeviceInfo, PCI_REGISTER_READ, Width, Address & 0xff, Buffer);
}
}
@@ -2477,10 +1923,11 @@ PciIncompatibilityCheckRead ( @param Buffer For read operations, the destination buffer to store the results. For
write operations, the source buffer to write data from.
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
+ @retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
+ valid for the PCI configuration header of the PCI controller.
+ Buffer is NULL.
+ @retval other Some error occurred when writing PCI configuration space.
**/
EFI_STATUS
@@ -2492,7 +1939,7 @@ PciIncompatibilityCheckWrite ( IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
-)
+ )
{
EFI_STATUS Status;
EFI_PCI_DEVICE_INFO PciDeviceInfo;
@@ -2500,9 +1947,12 @@ PciIncompatibilityCheckWrite ( UINT64 Data;
ASSERT ((PciRootBridgeIo == NULL) ^ (PciIo == NULL));
+ if (Buffer == NULL) {
+ return EFI_UNSUPPORTED;
+ }
//
- // get PCI device device information
+ // Get PCI device device information
//
Status = GetPciDeviceDeviceInfo (PciRootBridgeIo, PciIo, Pci, Address, &PciDeviceInfo);
if (Status != EFI_SUCCESS) {
@@ -2532,14 +1982,14 @@ PciIncompatibilityCheckWrite ( }
//
- // update the data writen into configuration register
+ // Update the data writen into configuration register
//
- if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_REGISTER_UPDATE_SUPPORT) {
+ if ((PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_REGISTER_UPDATE_SUPPORT) != 0) {
UpdateConfigData (&PciDeviceInfo, PCI_REGISTER_WRITE, Width, Address & 0xff, &Data);
}
//
- // write configuration register
+ // Write configuration register
//
Status = WriteConfigData (PciRootBridgeIo, PciIo, &PciDeviceInfo, Width, Address, &Data);
@@ -2562,10 +2012,9 @@ PciIncompatibilityCheckWrite ( @param Buffer For read operations, the destination buffer to store the results. For
write operations, the source buffer to write data from.
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
+ @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
**/
EFI_STATUS
@@ -2578,27 +2027,34 @@ PciRootBridgeIoRead ( IN OUT VOID *Buffer
)
{
- if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_READ_SUPPORT) {
+ EFI_STATUS Status;
+
+ if ((PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_READ_SUPPORT) != 0) {
//
- // if PCI incompatibility check enabled
+ // If PCI incompatibility check enabled
//
- return PciIncompatibilityCheckRead (
- PciRootBridgeIo,
- NULL,
- Pci,
- (UINTN) Width,
- Address,
- Count,
- Buffer
- );
+ Status = PciIncompatibilityCheckRead (
+ PciRootBridgeIo,
+ NULL,
+ Pci,
+ (UINTN) Width,
+ Address,
+ Count,
+ Buffer
+ );
+ if (Status == EFI_UNSUPPORTED) {
+ return EFI_INVALID_PARAMETER;
+ } else {
+ return Status;
+ }
} else {
return PciRootBridgeIo->Pci.Read (
- PciRootBridgeIo,
- Width,
- Address,
- Count,
- Buffer
- );
+ PciRootBridgeIo,
+ Width,
+ Address,
+ Count,
+ Buffer
+ );
}
}
@@ -2613,10 +2069,9 @@ PciRootBridgeIoRead ( @param Buffer For read operations, the destination buffer to store the results. For
write operations, the source buffer to write data from.
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
+ @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
**/
EFI_STATUS
@@ -2629,28 +2084,35 @@ PciRootBridgeIoWrite ( IN OUT VOID *Buffer
)
{
- if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_WRITE_SUPPORT) {
+ EFI_STATUS Status;
+
+ if ((PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_WRITE_SUPPORT) != 0) {
//
- // if PCI incompatibility check enabled
+ // If PCI incompatibility check enabled
//
- return PciIncompatibilityCheckWrite (
- PciRootBridgeIo,
- NULL,
- Pci,
- Width,
- Address,
- Count,
- Buffer
- );
+ Status = PciIncompatibilityCheckWrite (
+ PciRootBridgeIo,
+ NULL,
+ Pci,
+ Width,
+ Address,
+ Count,
+ Buffer
+ );
+ if (Status == EFI_UNSUPPORTED) {
+ return EFI_INVALID_PARAMETER;
+ } else {
+ return Status;
+ }
} else {
return PciRootBridgeIo->Pci.Write (
- PciRootBridgeIo,
- Width,
- Address,
- Count,
- Buffer
- );
+ PciRootBridgeIo,
+ Width,
+ Address,
+ Count,
+ Buffer
+ );
}
}
@@ -2664,10 +2126,11 @@ PciRootBridgeIoWrite ( @param Buffer For read operations, the destination buffer to store the results. For
write operations, the source buffer to write data from.
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_SUCCESS The data was read from or written to the PCI controller.
+ @retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
+ valid for the PCI configuration header of the PCI controller.
+ @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
**/
EFI_STATUS
@@ -2679,44 +2142,47 @@ PciIoRead ( IN OUT VOID *Buffer
)
{
- if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_READ_SUPPORT) {
+ if ((PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_READ_SUPPORT) != 0) {
//
- // if PCI incompatibility check enabled
+ // If PCI incompatibility check enabled
//
return PciIncompatibilityCheckRead (
- NULL,
- PciIo,
- NULL,
- (UINTN) Width,
- Address,
- Count,
- Buffer
- );
+ NULL,
+ PciIo,
+ NULL,
+ (UINTN) Width,
+ Address,
+ Count,
+ Buffer
+ );
} else {
return PciIo->Pci.Read (
- PciIo,
- Width,
- Address,
- Count,
- Buffer
- );
+ PciIo,
+ Width,
+ Address,
+ Count,
+ Buffer
+ );
}
}
/**
Write PCI configuration space through EFI_PCI_IO_PROTOCOL.
- @param PciIo A pointer to the EFI_PCI_O_PROTOCOL.
- @param Width Signifies the width of the memory operations.
- @param Address The address within the PCI configuration space for the PCI controller.
- @param Count The number of unit to be read.
- @param Buffer For read operations, the destination buffer to store the results. For
- write operations, the source buffer to write data from.
+ If PCI incompatibility check is enabled, do incompatibility check.
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @param PciIo A pointer to the EFI_PCI_IO_PROTOCOL instance.
+ @param Width Signifies the width of the memory operations.
+ @param Offset The offset within the PCI configuration space for the PCI controller.
+ @param Count The number of PCI configuration operations to perform.
+ @param Buffer For read operations, the destination buffer to store the results. For write
+ operations, the source buffer to write data from.
+
+ @retval EFI_SUCCESS The data was read from or written to the PCI controller.
+ @retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
+ valid for the PCI configuration header of the PCI controller.
+ @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
**/
EFI_STATUS
@@ -2728,29 +2194,28 @@ PciIoWrite ( IN OUT VOID *Buffer
)
{
- if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_WRITE_SUPPORT) {
-
+ if ((PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_WRITE_SUPPORT) != 0) {
//
- // if PCI incompatibility check enabled
+ // If PCI incompatibility check enabled
//
return PciIncompatibilityCheckWrite (
- NULL,
- PciIo,
- NULL,
- Width,
- Address,
- Count,
- Buffer
- );
+ NULL,
+ PciIo,
+ NULL,
+ Width,
+ Address,
+ Count,
+ Buffer
+ );
} else {
return PciIo->Pci.Write (
- PciIo,
- Width,
- Address,
- Count,
- Buffer
- );
+ PciIo,
+ Width,
+ Address,
+ Count,
+ Buffer
+ );
}
}
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciLib.h b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciLib.h index 5eeedb222a..c758315d1a 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciLib.h +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciLib.h @@ -1,6 +1,7 @@ /** @file
+ Internal library declaration for PCI Bus module.
-Copyright (c) 2006 - 2007, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
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
@@ -9,18 +10,6 @@ http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-Module Name:
-
- PciLib.h
-
-Abstract:
-
- PCI Bus Driver Lib header file.
- Please use PCD feature flag PcdPciBusHotplugDeviceSupport to enable
- support hot plug.
-
-Revision History
-
**/
#ifndef _EFI_PCI_LIB_H_
@@ -51,9 +40,10 @@ typedef struct { /**
- Retrieve the BAR information via PciIo interface.
-
- @param PciIoDevice Pci device instance.
+ Retrieve the PCI Card device BAR information via PciIo interface.
+
+ @param PciIoDevice PCI Card device instance.
+
**/
VOID
GetBackPcCardBar (
@@ -63,23 +53,29 @@ GetBackPcCardBar ( /**
Remove rejected pci device from specific root bridge
handle.
-
- @param RootBridgeHandle specific parent root bridge handle.
+
+ @param RootBridgeHandle Specific parent root bridge handle.
@param Bridge Bridge device instance.
-
- @retval EFI_SUCCESS Success operation.
+
**/
-EFI_STATUS
+VOID
RemoveRejectedPciDevices (
- EFI_HANDLE RootBridgeHandle,
- IN PCI_IO_DEVICE *Bridge
+ IN EFI_HANDLE RootBridgeHandle,
+ IN PCI_IO_DEVICE *Bridge
);
/**
- Wrapper function for allocating resource for pci host bridge.
-
- @param PciResAlloc Point to protocol instance EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
-
+ Submits the I/O and memory resource requirements for the specified PCI Host Bridge.
+
+ @param PciResAlloc Point to protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
+
+ @retval EFI_SUCCESS Successfully finished resource allocation.
+ @retval EFI_NOT_FOUND Cannot get root bridge instance.
+ @retval EFI_OUT_OF_RESOURCES Platform failed to program the resources if no hot plug supported.
+ @retval other Some error occurred when allocating resources for the PCI Host Bridge.
+
+ @note Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.
+
**/
EFI_STATUS
PciHostBridgeResourceAllocator (
@@ -87,38 +83,18 @@ PciHostBridgeResourceAllocator ( );
/**
- Wrapper function for allocating resource for pci host bridge without hotplug device support.
-
- @param PciResAlloc Point to protocol instance EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
-
-**/
-EFI_STATUS
-PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
- );
+ Scan pci bus and assign bus number to the given PCI bus system.
-/**
- Wrapper function for allocating resource for pci host bridge with hotplug device support.
-
- @param PciResAlloc Point to protocol instance EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
-
-**/
-EFI_STATUS
-PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
- );
+ @param Bridge Bridge device instance.
+ @param StartBusNumber start point.
+ @param SubBusNumber Point to sub bus number.
+ @param PaddedBusRange Customized bus number.
+
+ @retval EFI_SUCCESS Successfully scanned and assigned bus number.
+ @retval other Some error occurred when scanning pci bus.
+
+ @note Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.
-/**
- Wapper function of scanning pci bus and assign bus number to the given PCI bus system
- Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.
-
- @param Bridge Bridge device instance.
- @param StartBusNumber start point.
- @param SubBusNumber Point to sub bus number.
- @param PaddedBusRange Customized bus number.
-
- @retval EFI_SUCCESS Success.
- @retval EFI_DEVICE_ERROR Fail to scan bus.
**/
EFI_STATUS
PciScanBus (
@@ -129,51 +105,13 @@ PciScanBus ( );
/**
- Wapper function of scanning pci bus and assign bus number to the given PCI bus system
- Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.
-
- @param Bridge Bridge device instance.
- @param StartBusNumber start point.
- @param SubBusNumber Point to sub bus number.
- @param PaddedBusRange Customized bus number.
-
- @retval EFI_SUCCESS Success.
- @retval EFI_DEVICE_ERROR Fail to scan bus.
-**/
-EFI_STATUS
-PciScanBus_WithHotPlugDeviceSupport (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT8 StartBusNumber,
- OUT UINT8 *SubBusNumber,
- OUT UINT8 *PaddedBusRange
- );
+ Process Option Rom on the specified root bridge.
-/**
- Wapper function of scanning pci bus and assign bus number to the given PCI bus system
- Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.
-
- @param Bridge Bridge device instance.
- @param StartBusNumber start point.
- @param SubBusNumber Point to sub bus number.
- @param PaddedBusRange Customized bus number.
-
- @retval EFI_SUCCESS Success.
- @retval EFI_DEVICE_ERROR Fail to scan bus.
-**/
-EFI_STATUS
-PciScanBus_WithoutHotPlugDeviceSupport (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT8 StartBusNumber,
- OUT UINT8 *SubBusNumber,
- OUT UINT8 *PaddedBusRange
- );
+ @param Bridge Pci root bridge device instance.
+
+ @retval EFI_SUCCESS Success process.
+ @retval other Some error occurred when processing Option Rom on the root bridge.
-/**
- Process Option Rom on this host bridge.
-
- @param Bridge Pci bridge device instance.
-
- @retval EFI_SUCCESS Success.
**/
EFI_STATUS
PciRootBridgeP2CProcess (
@@ -181,12 +119,14 @@ PciRootBridgeP2CProcess ( );
/**
- Process Option Rom on this host bridge.
-
- @param PciResAlloc Pointer to instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
-
- @retval EFI_NOT_FOUND Can not find the root bridge instance.
+ Process Option Rom on the specified host bridge.
+
+ @param PciResAlloc Pointer to instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
+
@retval EFI_SUCCESS Success process.
+ @retval EFI_NOT_FOUND Can not find the root bridge instance.
+ @retval other Some error occurred when processing Option Rom on the host bridge.
+
**/
EFI_STATUS
PciHostBridgeP2CProcess (
@@ -197,10 +137,11 @@ PciHostBridgeP2CProcess ( This function is used to enumerate the entire host bridge
in a given platform.
- @param PciResAlloc A pointer to the resource allocate protocol.
+ @param PciResAlloc A pointer to the PCI Host Resource Allocation protocol.
- @retval EFI_OUT_OF_RESOURCES no enough resource.
- @retval EFI_SUCCESS Success.
+ @retval EFI_SUCCESS Successfully enumerated the host bridge.
+ @retval EFI_OUT_OF_RESOURCES No enough memory available.
+ @retval other Some error occurred when enumerating the host bridge.
**/
EFI_STATUS
@@ -218,10 +159,11 @@ PciHostBridgeEnumerator ( @param Buffer For read operations, the destination buffer to store the results. For
write operations, the source buffer to write data from.
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_SUCCESS The data was read from or written to the PCI controller.
+ @retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
+ valid for the PCI configuration header of the PCI controller.
+ @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
**/
EFI_STATUS
@@ -236,17 +178,20 @@ PciIoRead ( /**
Write PCI configuration space through EFI_PCI_IO_PROTOCOL.
- @param PciIo A pointer to the EFI_PCI_O_PROTOCOL.
- @param Width Signifies the width of the memory operations.
- @param Address The address within the PCI configuration space for the PCI controller.
- @param Count The number of unit to be write.
- @param Buffer For read operations, the destination buffer to store the results. For
- write operations, the source buffer to write data from.
+ If PCI incompatibility check is enabled, do incompatibility check.
+
+ @param PciIo A pointer to the EFI_PCI_IO_PROTOCOL instance.
+ @param Width Signifies the width of the memory operations.
+ @param Offset The offset within the PCI configuration space for the PCI controller.
+ @param Count The number of PCI configuration operations to perform.
+ @param Buffer For read operations, the destination buffer to store the results. For write
+ operations, the source buffer to write data from.
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_SUCCESS The data was read from or written to the PCI controller.
+ @retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not
+ valid for the PCI configuration header of the PCI controller.
+ @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
**/
EFI_STATUS
@@ -265,14 +210,13 @@ PciIoWrite ( @param Pci A pointer to PCI_TYPE00.
@param Width Signifies the width of the memory operations.
@param Address The address within the PCI configuration space for the PCI controller.
- @param Count The number of unit to be write.
+ @param Count The number of unit to be read.
@param Buffer For read operations, the destination buffer to store the results. For
write operations, the source buffer to write data from.
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
+ @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
**/
EFI_STATUS
@@ -296,16 +240,15 @@ PciRootBridgeIoWrite ( @param Buffer For read operations, the destination buffer to store the results. For
write operations, the source buffer to write data from.
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
+ @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
+ @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
**/
EFI_STATUS
PciRootBridgeIoRead (
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
- IN PCI_TYPE00 *Pci, OPTIONAL
+ IN PCI_TYPE00 *Pci, OPTIONAL
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
IN UINT64 Address,
IN UINTN Count,
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c index 788bbe52ee..9365847eb5 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c @@ -1,4 +1,5 @@ /** @file
+ PCI Rom supporting funtions implementation for PCI Bus module.
Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
@@ -12,24 +13,24 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/
#include "PciBus.h"
-#include "PciResourceSupport.h"
-
-#include <IndustryStandard/Pci23.h>
/**
Load the EFI Image from Option ROM
-
- @param PciIoDevice PCI IO Device
+
+ @param PciIoDevice PCI IO device instance.
@param FilePath The file path of the EFI Image
- @param BufferSize On input the size of Buffer in bytes. On output with a return
- code of EFI_SUCCESS, the amount of data transferred to Buffer.
- On output with a return code of EFI_BUFFER_TOO_SMALL,
- the size of Buffer required to retrieve the requested file.
- @param Buffer The memory buffer to transfer the file to. If Buffer is NULL,
+ @param BufferSize On input the size of Buffer in bytes. On output with a return
+ code of EFI_SUCCESS, the amount of data transferred to Buffer.
+ On output with a return code of EFI_BUFFER_TOO_SMALL,
+ the size of Buffer required to retrieve the requested file.
+ @param Buffer The memory buffer to transfer the file to. If Buffer is NULL,
then no the size of the requested file is returned in BufferSize.
- @retval EFI_SUCCESS The file was loaded.
- @retval EFI_UNSUPPORTED BootPolicy is TRUE.
+ @retval EFI_SUCCESS The file was loaded.
+ @retval EFI_INVALID_PARAMETER FilePath is not a valid device path, or
+ BufferSize is NULL.
+ @retval EFI_NOT_FOUND Not found PCI Option Rom on PCI device.
+ @retval EFI_DEVICE_ERROR Failed to decompress PCI Option Rom image.
@retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory entry.
BufferSize has been updated with the size needed to complete the request.
**/
@@ -65,7 +66,7 @@ LocalLoadFile2 ( ) {
return EFI_INVALID_PARAMETER;
}
-
+
EfiRomHeader = (EFI_PCI_EXPANSION_ROM_HEADER *) (
(UINT8 *) PciIoDevice->PciIo.RomImage + EfiOpRomImageNode->StartingOffset
);
@@ -73,11 +74,11 @@ LocalLoadFile2 ( return EFI_NOT_FOUND;
}
-
+
Pcir = (PCI_DATA_STRUCTURE *) ((UINT8 *) EfiRomHeader + EfiRomHeader->PcirOffset);
-
- if ((Pcir->CodeType == PCI_CODE_TYPE_EFI_IMAGE) &&
+
+ if ((Pcir->CodeType == PCI_CODE_TYPE_EFI_IMAGE) &&
(EfiRomHeader->EfiSignature == EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE) &&
((EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) ||
(EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER)) &&
@@ -118,19 +119,19 @@ LocalLoadFile2 ( );
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
- }
-
+ }
+
if (Buffer == NULL || *BufferSize < DestinationSize) {
*BufferSize = DestinationSize;
return EFI_BUFFER_TOO_SMALL;
- }
+ }
*BufferSize = DestinationSize;
Scratch = AllocatePool (ScratchSize);
if (Scratch == NULL) {
return EFI_DEVICE_ERROR;
}
-
+
Status = Decompress->Decompress (
Decompress,
ImageBuffer,
@@ -141,7 +142,7 @@ LocalLoadFile2 ( ScratchSize
);
FreePool (Scratch);
-
+
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}
@@ -154,13 +155,13 @@ LocalLoadFile2 ( /**
Initialize a PCI LoadFile2 instance.
-
+
@param PciIoDevice PCI IO Device.
**/
VOID
InitializePciLoadFile2 (
- PCI_IO_DEVICE *PciIoDevice
+ IN PCI_IO_DEVICE *PciIoDevice
)
{
PciIoDevice->LoadFile2.LoadFile = LoadFile2;
@@ -168,22 +169,26 @@ InitializePciLoadFile2 ( /**
Causes the driver to load a specified file.
-
+
@param This Indicates a pointer to the calling context.
@param FilePath The device specific path of the file to load.
@param BootPolicy Should always be FALSE.
- @param BufferSize On input the size of Buffer in bytes. On output with a return
- code of EFI_SUCCESS, the amount of data transferred to Buffer.
- On output with a return code of EFI_BUFFER_TOO_SMALL,
- the size of Buffer required to retrieve the requested file.
- @param Buffer The memory buffer to transfer the file to. If Buffer is NULL,
- then no the size of the requested file is returned in BufferSize.
-
- @retval EFI_SUCCESS The file was loaded.
+ @param BufferSize On input the size of Buffer in bytes. On output with a return
+ code of EFI_SUCCESS, the amount of data transferred to Buffer.
+ On output with a return code of EFI_BUFFER_TOO_SMALL,
+ the size of Buffer required to retrieve the requested file.
+ @param Buffer The memory buffer to transfer the file to. If Buffer is NULL,
+ then no the size of the requested file is returned in BufferSize.
+
+ @retval EFI_SUCCESS The file was loaded.
@retval EFI_UNSUPPORTED BootPolicy is TRUE.
+ @retval EFI_INVALID_PARAMETER FilePath is not a valid device path, or
+ BufferSize is NULL.
+ @retval EFI_NOT_FOUND Not found PCI Option Rom on PCI device.
+ @retval EFI_DEVICE_ERROR Failed to decompress PCI Option Rom image.
@retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory entry.
BufferSize has been updated with the size needed to complete the request.
-
+
**/
EFI_STATUS
EFIAPI
@@ -210,31 +215,14 @@ LoadFile2 ( );
}
-
-//
-// Module global for a template of the PCI option ROM Image Device Path Node
-//
-MEMMAP_DEVICE_PATH mPciOptionRomImageDevicePathNodeTemplate = {
- {
- HARDWARE_DEVICE_PATH,
- HW_MEMMAP_DP,
- {
- (UINT8) (sizeof (MEMMAP_DEVICE_PATH)),
- (UINT8) ((sizeof (MEMMAP_DEVICE_PATH)) >> 8)
- }
- },
- EfiMemoryMappedIO,
- 0,
- 0
-};
-
/**
Get Pci device's oprom infor bits.
-
- @param PciIoDevice Pci device instance
- @retval EFI_NOT_FOUND Pci device has not oprom
- @retval EFI_SUCCESS Pci device has oprom
+ @param PciIoDevice Pci device instance.
+
+ @retval EFI_NOT_FOUND Pci device has not Option Rom.
+ @retval EFI_SUCCESS Pci device has Option Rom.
+
**/
EFI_STATUS
GetOpRomInfo (
@@ -257,7 +245,7 @@ GetOpRomInfo ( PciRootBridgeIo = PciIoDevice->PciRootBridgeIo;
//
- // offset is 0x30 if is not ppb
+ // Offset is 0x30 if is not ppb
//
//
@@ -267,7 +255,7 @@ GetOpRomInfo ( if (IS_PCI_BRIDGE (&PciIoDevice->Pci)) {
//
- // if is ppb
+ // If is ppb
//
//
@@ -276,7 +264,7 @@ GetOpRomInfo ( RomBarIndex = PCI_BRIDGE_ROMBAR;
}
//
- // the bit0 is 0 to prevent the enabling of the Rom address decoder
+ // The bit0 is 0 to prevent the enabling of the Rom address decoder
//
AllOnes = 0xfffffffe;
Address = EFI_PCI_ADDRESS (Bus, Device, Function, RomBarIndex);
@@ -290,11 +278,11 @@ GetOpRomInfo ( &AllOnes
);
if (EFI_ERROR (Status)) {
- return Status;
+ return EFI_NOT_FOUND;
}
//
- // read back
+ // Read back
//
Status = PciRootBridgeIoRead (
PciRootBridgeIo,
@@ -305,7 +293,7 @@ GetOpRomInfo ( &AllOnes
);
if (EFI_ERROR (Status)) {
- return Status;
+ return EFI_NOT_FOUND;
}
//
// Bits [1, 10] are reserved
@@ -320,21 +308,20 @@ GetOpRomInfo ( }
/**
-
Check if the RomImage contains EFI Images.
- @param RomImage The ROM address of Image for check.
+ @param RomImage The ROM address of Image for check.
@param RomSize Size of ROM for check.
@retval TRUE ROM contain EFI Image.
@retval FALSE ROM not contain EFI Image.
-
+
**/
BOOLEAN
ContainEfiImage (
IN VOID *RomImage,
IN UINT64 RomSize
- )
+ )
{
PCI_EXPANSION_ROM_HEADER *RomHeader;
PCI_DATA_STRUCTURE *RomPcir;
@@ -342,7 +329,7 @@ ContainEfiImage ( FirstCheck = TRUE;
RomHeader = RomImage;
-
+
while ((UINT8 *) RomHeader < (UINT8 *) RomImage + RomSize) {
if (RomHeader->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) {
if (FirstCheck) {
@@ -355,7 +342,7 @@ ContainEfiImage ( FirstCheck = FALSE;
RomPcir = (PCI_DATA_STRUCTURE *) ((UINT8 *) RomHeader + RomHeader->PcirOffset);
-
+
if (RomPcir->CodeType == PCI_CODE_TYPE_EFI_IMAGE) {
return TRUE;
}
@@ -368,13 +355,14 @@ ContainEfiImage ( /**
- Load option rom image for specified PCI device
-
- @param PciDevice Pci device instance
- @param RomBase Base address of oprom.
-
- @retval EFI_OUT_OF_RESOURCES not enough memory to hold image
- @retval EFI_SUCESS Success
+ Load Option Rom image for specified PCI device.
+
+ @param PciDevice Pci device instance.
+ @param RomBase Base address of Option Rom.
+
+ @retval EFI_OUT_OF_RESOURCES No enough memory to hold image.
+ @retval EFI_SUCESS Successfully loaded Option Rom.
+
**/
EFI_STATUS
LoadOpRomImage (
@@ -543,17 +531,16 @@ LoadOpRomImage ( }
/**
- enable/disable oprom decode
-
- @param PciDevice pci device instance
+ Enable/Disable Option Rom decode.
+
+ @param PciDevice Pci device instance.
@param RomBarIndex The BAR index of the standard PCI Configuration header to use as the
base address for resource range. The legal range for this field is 0..5.
- @param RomBar Base address of rom
+ @param RomBar Base address of Option Rom.
@param Enable Flag for enable/disable decode.
-
- @retval EFI_SUCCESS Success
+
**/
-EFI_STATUS
+VOID
RomDecode (
IN PCI_IO_DEVICE *PciDevice,
IN UINT8 RomBarIndex,
@@ -622,41 +609,41 @@ RomDecode ( );
}
-
- return EFI_SUCCESS;
-
}
/**
- Process the oprom image.
-
- @param PciDevice Pci device instance
+ Load and start the Option Rom image.
+
+ @param PciDevice Pci device instance.
+
+ @retval EFI_SUCCESS Successfully loaded and started PCI Option Rom image.
+ @retval EFI_NOT_FOUND Failed to process PCI Option Rom image.
+
**/
EFI_STATUS
ProcessOpRomImage (
- PCI_IO_DEVICE *PciDevice
+ IN PCI_IO_DEVICE *PciDevice
)
{
- UINT8 Indicator;
- UINT32 ImageSize;
- VOID *RomBar;
- UINT8 *RomBarOffset;
- EFI_HANDLE ImageHandle;
- EFI_STATUS Status;
- EFI_STATUS RetStatus;
- BOOLEAN FirstCheck;
- EFI_PCI_EXPANSION_ROM_HEADER *EfiRomHeader;
- PCI_DATA_STRUCTURE *Pcir;
- EFI_DEVICE_PATH_PROTOCOL *PciOptionRomImageDevicePath;
-
- MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH EfiOpRomImageNode;
- VOID *Buffer;
- UINTN BufferSize;
+ UINT8 Indicator;
+ UINT32 ImageSize;
+ VOID *RomBar;
+ UINT8 *RomBarOffset;
+ EFI_HANDLE ImageHandle;
+ EFI_STATUS Status;
+ EFI_STATUS RetStatus;
+ BOOLEAN FirstCheck;
+ EFI_PCI_EXPANSION_ROM_HEADER *EfiRomHeader;
+ PCI_DATA_STRUCTURE *Pcir;
+ EFI_DEVICE_PATH_PROTOCOL *PciOptionRomImageDevicePath;
+ MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH EfiOpRomImageNode;
+ VOID *Buffer;
+ UINTN BufferSize;
Indicator = 0;
//
- // Get the Address of the Rom image
+ // Get the Address of the Option Rom image
//
RomBar = PciDevice->PciIo.RomImage;
RomBarOffset = (UINT8 *) RomBar;
@@ -694,7 +681,6 @@ ProcessOpRomImage ( //
// load image and start image
//
-
BufferSize = 0;
Buffer = NULL;
Status = EFI_SUCCESS;
@@ -749,6 +735,5 @@ ProcessOpRomImage ( } while (((Indicator & 0x80) == 0x00) && ((UINTN) (RomBarOffset - (UINT8 *) RomBar) < PciDevice->RomSize));
return RetStatus;
-
}
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.h b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.h index 60b7adcb85..2190aa369d 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.h +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.h @@ -1,50 +1,54 @@ /** @file
+ PCI Rom supporting funtions declaration for PCI Bus module.
-Copyright (c) 2006 - 2009, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
-#ifndef _EFI_PCI_OP_ROM_SUPPORT_H_
-#define _EFI_PCI_OP_ROM_SUPPORT_H_
+#ifndef _EFI_PCI_OPTION_ROM_SUPPORT_H_
+#define _EFI_PCI_OPTION_ROM_SUPPORT_H_
-#include <Protocol/LoadFile2.h>
/**
Initialize a PCI LoadFile2 instance.
-
+
@param PciIoDevice PCI IO Device.
**/
VOID
InitializePciLoadFile2 (
- PCI_IO_DEVICE *PciIoDevice
+ IN PCI_IO_DEVICE *PciIoDevice
);
/**
Causes the driver to load a specified file.
-
+
@param This Indicates a pointer to the calling context.
@param FilePath The device specific path of the file to load.
@param BootPolicy Should always be FALSE.
- @param BufferSize On input the size of Buffer in bytes. On output with a return
- code of EFI_SUCCESS, the amount of data transferred to Buffer.
- On output with a return code of EFI_BUFFER_TOO_SMALL,
- the size of Buffer required to retrieve the requested file.
- @param Buffer The memory buffer to transfer the file to. If Buffer is NULL,
+ @param BufferSize On input the size of Buffer in bytes. On output with a return
+ code of EFI_SUCCESS, the amount of data transferred to Buffer.
+ On output with a return code of EFI_BUFFER_TOO_SMALL,
+ the size of Buffer required to retrieve the requested file.
+ @param Buffer The memory buffer to transfer the file to. If Buffer is NULL,
then no the size of the requested file is returned in BufferSize.
- @retval EFI_SUCCESS The file was loaded.
+ @retval EFI_SUCCESS The file was loaded.
@retval EFI_UNSUPPORTED BootPolicy is TRUE.
+ @retval EFI_INVALID_PARAMETER FilePath is not a valid device path, or
+ BufferSize is NULL.
+ @retval EFI_NOT_FOUND Not found PCI Option Rom on PCI device.
+ @retval EFI_DEVICE_ERROR Failed to decompress PCI Option Rom image.
@retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory entry.
BufferSize has been updated with the size needed to complete the request.
-
+
**/
EFI_STATUS
EFIAPI
@@ -57,30 +61,30 @@ LoadFile2 ( );
/**
-
Check if the RomImage contains EFI Images.
- @param RomImage The ROM address of Image for check.
+ @param RomImage The ROM address of Image for check.
@param RomSize Size of ROM for check.
@retval TRUE ROM contain EFI Image.
@retval FALSE ROM not contain EFI Image.
-
+
**/
BOOLEAN
ContainEfiImage (
IN VOID *RomImage,
IN UINT64 RomSize
- );
+ );
/**
Get Pci device's oprom infor bits.
-
- @param PciIoDevice Pci device instance
- @retval EFI_NOT_FOUND Pci device has not oprom
- @retval EFI_SUCCESS Pci device has oprom
+ @param PciIoDevice Pci device instance.
+
+ @retval EFI_NOT_FOUND Pci device has not Option Rom.
+ @retval EFI_SUCCESS Pci device has Option Rom.
+
**/
EFI_STATUS
GetOpRomInfo (
@@ -88,13 +92,14 @@ GetOpRomInfo ( );
/**
- Load option rom image for specified PCI device
-
- @param PciDevice Pci device instance
- @param RomBase Base address of oprom.
-
- @retval EFI_OUT_OF_RESOURCES not enough memory to hold image
- @retval EFI_SUCESS Success
+ Load Option Rom image for specified PCI device.
+
+ @param PciDevice Pci device instance.
+ @param RomBase Base address of Option Rom.
+
+ @retval EFI_OUT_OF_RESOURCES No enough memory to hold image.
+ @retval EFI_SUCESS Successfully loaded Option Rom.
+
**/
EFI_STATUS
LoadOpRomImage (
@@ -103,17 +108,16 @@ LoadOpRomImage ( );
/**
- enable/disable oprom decode
-
- @param PciDevice pci device instance
+ Enable/Disable Option Rom decode.
+
+ @param PciDevice Pci device instance.
@param RomBarIndex The BAR index of the standard PCI Configuration header to use as the
base address for resource range. The legal range for this field is 0..5.
- @param RomBar Base address of rom
+ @param RomBar Base address of Option Rom.
@param Enable Flag for enable/disable decode.
-
- @retval EFI_SUCCESS Success
+
**/
-EFI_STATUS
+VOID
RomDecode (
IN PCI_IO_DEVICE *PciDevice,
IN UINT8 RomBarIndex,
@@ -122,13 +126,17 @@ RomDecode ( );
/**
- Process the oprom image.
-
- @param PciDevice Pci device instance
+ Load and start the Option Rom image.
+
+ @param PciDevice Pci device instance.
+
+ @retval EFI_SUCCESS Successfully loaded and started PCI Option Rom image.
+ @retval EFI_NOT_FOUND Failed to process PCI Option Rom image.
+
**/
EFI_STATUS
ProcessOpRomImage (
- PCI_IO_DEVICE *PciDevice
+ IN PCI_IO_DEVICE *PciDevice
);
#endif
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciPowerManagement.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciPowerManagement.c index 5ebbaf910c..d7321800fb 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciPowerManagement.c +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciPowerManagement.c @@ -1,13 +1,14 @@ /** @file
+ Power management support fucntions implementation for PCI Bus module.
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
@@ -18,10 +19,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. put the device to D0 state if the device supports
PCI Power Management.
- @param PciIoDevice Pci device instance
+ @param PciIoDevice PCI device instance.
+
+ @retval EFI_UNSUPPORTED PCI Device does not support power management.
+ @retval EFI_SUCCESS Turned off PWE successfully.
- @retval EFI_UNSUPPORTED Device do not support power management
- @retval EFI_SUCCESS Success
**/
EFI_STATUS
ResetPowerManagementFeature (
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciPowerManagement.h b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciPowerManagement.h index 9697a57050..88462709e3 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciPowerManagement.h +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciPowerManagement.h @@ -1,13 +1,14 @@ /** @file
+ Power management support fucntions delaration for PCI Bus module.
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
@@ -19,10 +20,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. put the device to D0 state if the device supports
PCI Power Management.
- @param PciIoDevice Pci device instance
+ @param PciIoDevice PCI device instance.
+
+ @retval EFI_UNSUPPORTED PCI Device does not support power management.
+ @retval EFI_SUCCESS Turned off PWE successfully.
- @retval EFI_UNSUPPORTED Device do not support power management
- @retval EFI_SUCCESS Success
**/
EFI_STATUS
ResetPowerManagementFeature (
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c index da0cfa0cae..755abf80a9 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c @@ -1,4 +1,5 @@ /** @file
+ PCI resouces support functions implemntation for PCI Bus module.
Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
@@ -12,18 +13,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/
#include "PciBus.h"
-#include "PciResourceSupport.h"
-#include "PciCommand.h"
/**
- The function is used to skip VGA range
-
- @param Start address including VGA range
- @param Length length of VGA range.
-
- @retval EFI_SUCCESS success.
+ The function is used to skip VGA range.
+
+ @param Start Returned start address including VGA range.
+ @param Length The length of VGA range.
+
**/
-EFI_STATUS
+VOID
SkipVGAAperture (
OUT UINT64 *Start,
IN UINT64 Length
@@ -34,6 +32,7 @@ SkipVGAAperture ( UINT64 StartOffset;
UINT64 LimitOffset;
+ ASSERT (Start != NULL);
//
// For legacy VGA, bit 10 to bit 15 is not decoded
//
@@ -45,19 +44,16 @@ SkipVGAAperture ( if (LimitOffset >= VGABASE1) {
*Start = *Start - StartOffset + VGALIMIT2 + 1;
}
-
- return EFI_SUCCESS;
}
/**
This function is used to skip ISA aliasing aperture.
-
- @param Start address including ISA aliasing aperture.
- @param Length length of ISA aliasing aperture.
-
- @retval EFI_SUCCESS success.
+
+ @param Start Returned start address including ISA aliasing aperture.
+ @param Length The length of ISA aliasing aperture.
+
**/
-EFI_STATUS
+VOID
SkipIsaAliasAperture (
OUT UINT64 *Start,
IN UINT64 Length
@@ -69,6 +65,8 @@ SkipIsaAliasAperture ( UINT64 StartOffset;
UINT64 LimitOffset;
+ ASSERT (Start != NULL);
+
//
// For legacy ISA, bit 10 to bit 15 is not decoded
//
@@ -81,8 +79,6 @@ SkipIsaAliasAperture ( if (LimitOffset >= ISABASE) {
*Start = *Start - StartOffset + ISALIMIT + 1;
}
-
- return EFI_SUCCESS;
}
/**
@@ -91,13 +87,12 @@ SkipIsaAliasAperture ( @param Bridge PCI resource node for bridge.
@param ResNode Resource node want to be inserted.
-
- @retval EFI_SUCCESS Success.
+
**/
-EFI_STATUS
+VOID
InsertResourceNode (
- PCI_RESOURCE_NODE *Bridge,
- PCI_RESOURCE_NODE *ResNode
+ IN PCI_RESOURCE_NODE *Bridge,
+ IN PCI_RESOURCE_NODE *ResNode
)
{
LIST_ENTRY *CurrentLink;
@@ -128,35 +123,31 @@ InsertResourceNode ( CurrentLink = ResNode->Link.ForwardLink;
}
-
- return EFI_SUCCESS;
}
/**
+ This routine is used to merge two different resource trees in need of
+ resoure degradation.
-Routine Description:
-
- This routine is used to merge two different resource tree in need of
- resoure degradation. For example, if a upstream PPB doesn't support,
+ For example, if an upstream PPB doesn't support,
prefetchable memory decoding, the PCI bus driver will choose to call this function
to merge prefectchable memory resource list into normal memory list.
If the TypeMerge is TRUE, Res resource type is changed to the type of destination resource
type.
+ If Dst is NULL or Res is NULL, ASSERT ().
@param Dst Point to destination resource tree.
@param Res Point to source resource tree.
- @param TypeMerge If the TypeMerge is TRUE, Res resource type is changed to the type of
+ @param TypeMerge If the TypeMerge is TRUE, Res resource type is changed to the type of
destination resource type.
-
-
- @retval EFI_SUCCESS Success.
+
**/
-EFI_STATUS
+VOID
MergeResourceTree (
- PCI_RESOURCE_NODE *Dst,
- PCI_RESOURCE_NODE *Res,
- BOOLEAN TypeMerge
+ IN PCI_RESOURCE_NODE *Dst,
+ IN PCI_RESOURCE_NODE *Res,
+ IN BOOLEAN TypeMerge
)
{
@@ -177,23 +168,19 @@ MergeResourceTree ( RemoveEntryList (CurrentLink);
InsertResourceNode (Dst, Temp);
-
}
-
- return EFI_SUCCESS;
}
/**
This function is used to calculate the IO16 aperture
for a bridge.
- @param Bridge PCI resource node for bridge.
-
- @retval EFI_SUCCESS Success.
+ @param Bridge PCI resource node for bridge.
+
**/
-EFI_STATUS
+VOID
CalculateApertureIo16 (
- IN PCI_RESOURCE_NODE *Bridge
+ IN PCI_RESOURCE_NODE *Bridge
)
{
EFI_STATUS Status;
@@ -204,7 +191,6 @@ CalculateApertureIo16 ( BOOLEAN IsaEnable;
BOOLEAN VGAEnable;
EFI_PCI_PLATFORM_POLICY PciPolicy;
-
//
// Always assume there is ISA device and VGA device on the platform
@@ -222,10 +208,10 @@ CalculateApertureIo16 ( &PciPolicy
);
if (!EFI_ERROR (Status)) {
- if (PciPolicy & EFI_RESERVE_ISA_IO_ALIAS) {
+ if ((PciPolicy & EFI_RESERVE_ISA_IO_ALIAS) != 0) {
IsaEnable = TRUE;
}
- if (PciPolicy & EFI_RESERVE_VGA_IO_ALIAS) {
+ if ((PciPolicy & EFI_RESERVE_VGA_IO_ALIAS) != 0) {
VGAEnable = TRUE;
}
}
@@ -234,7 +220,7 @@ CalculateApertureIo16 ( Aperture = 0;
if (Bridge == NULL) {
- return EFI_SUCCESS;
+ return ;
}
CurrentLink = Bridge->ChildList.ForwardLink;
@@ -262,7 +248,6 @@ CalculateApertureIo16 ( // If both of them are enabled, then the IO resource would
// become too limited to meet the requirement of most of devices.
//
-
if (IsaEnable || VGAEnable) {
if (!IS_PCI_BRIDGE (&(Node->PciDev->Pci)) && !IS_CARDBUS_BRIDGE (&(Node->PciDev->Pci))) {
//
@@ -272,7 +257,7 @@ CalculateApertureIo16 ( if (IsaEnable) {
SkipIsaAliasAperture (
&Aperture,
- Node->Length
+ Node->Length
);
Offset = Aperture & (Node->Alignment);
if (Offset != 0) {
@@ -323,21 +308,18 @@ CalculateApertureIo16 ( Bridge->Alignment = Node->Alignment;
}
}
-
- return EFI_SUCCESS;
}
/**
This function is used to calculate the resource aperture
for a given bridge device.
- @param Bridge Give bridge device.
-
- @retval EFI_SUCCESS Success.
+ @param Bridge PCI resouce node for given bridge device.
+
**/
-EFI_STATUS
+VOID
CalculateResourceAperture (
- IN PCI_RESOURCE_NODE *Bridge
+ IN PCI_RESOURCE_NODE *Bridge
)
{
UINT64 Aperture;
@@ -349,11 +331,13 @@ CalculateResourceAperture ( Aperture = 0;
if (Bridge == NULL) {
- return EFI_SUCCESS;
+ return ;
}
if (Bridge->ResType == PciBarTypeIo16) {
- return CalculateApertureIo16 (Bridge);
+
+ CalculateApertureIo16 (Bridge);
+ return ;
}
CurrentLink = Bridge->ChildList.ForwardLink;
@@ -368,7 +352,7 @@ CalculateResourceAperture ( //
// Apply padding resource if available
//
-
+
Offset = Aperture & (Node->Alignment);
if (Offset != 0) {
@@ -391,7 +375,7 @@ CalculateResourceAperture ( //
// Consider the aperture alignment
//
-
+
CurrentLink = CurrentLink->ForwardLink;
}
@@ -412,7 +396,7 @@ CalculateResourceAperture ( if (Bridge->Length < Aperture) {
Bridge->Length = Aperture;
}
-
+
//
// At last, adjust the bridge's alignment to the first child's alignment
// if the bridge has at least one child
@@ -424,30 +408,27 @@ CalculateResourceAperture ( Bridge->Alignment = Node->Alignment;
}
}
-
- return EFI_SUCCESS;
}
/**
Get IO/Memory resource infor for given PCI device.
-
+
@param PciDev Pci device instance.
@param IoNode Resource info node for IO .
@param Mem32Node Resource info node for 32-bit memory.
- @param PMem32Node Resource info node for 32-bit PMemory.
+ @param PMem32Node Resource info node for 32-bit Prefetchable Memory.
@param Mem64Node Resource info node for 64-bit memory.
- @param PMem64Node Resource info node for 64-bit PMemory.
-
- @retval EFI_SUCCESS Success.
+ @param PMem64Node Resource info node for 64-bit Prefetchable Memory.
+
**/
-EFI_STATUS
+VOID
GetResourceFromDevice (
- PCI_IO_DEVICE *PciDev,
- PCI_RESOURCE_NODE *IoNode,
- PCI_RESOURCE_NODE *Mem32Node,
- PCI_RESOURCE_NODE *PMem32Node,
- PCI_RESOURCE_NODE *Mem64Node,
- PCI_RESOURCE_NODE *PMem64Node
+ IN PCI_IO_DEVICE *PciDev,
+ IN PCI_RESOURCE_NODE *IoNode,
+ IN PCI_RESOURCE_NODE *Mem32Node,
+ IN PCI_RESOURCE_NODE *PMem32Node,
+ IN PCI_RESOURCE_NODE *Mem64Node,
+ IN PCI_RESOURCE_NODE *PMem64Node
)
{
@@ -571,8 +552,6 @@ GetResourceFromDevice ( if (!ResourceRequested) {
PciDev->Allocated = TRUE;
}
-
- return EFI_SUCCESS;
}
/**
@@ -584,6 +563,10 @@ GetResourceFromDevice ( @param Bar Bar index.
@param ResType Type of resource: IO/Memory.
@param ResUsage Resource usage.
+
+ @return PCI resource node created for given PCI device.
+ NULL means PCI resource node is not created.
+
**/
PCI_RESOURCE_NODE *
CreateResourceNode (
@@ -616,23 +599,23 @@ CreateResourceNode ( Node->Reserved = FALSE;
Node->ResourceUsage = ResUsage;
InitializeListHead (&Node->ChildList);
+
return Node;
}
/**
- This routine is used to extract resource request from
+ This function is used to extract resource request from
device node list.
@param Bridge Pci device instance.
@param IoNode Resource info node for IO.
@param Mem32Node Resource info node for 32-bit memory.
- @param PMem32Node Resource info node for 32-bit PMemory.
+ @param PMem32Node Resource info node for 32-bit Prefetchable Memory.
@param Mem64Node Resource info node for 64-bit memory.
- @param PMem64Node Resource info node for 64-bit PMemory.
+ @param PMem64Node Resource info node for 64-bit Prefetchable Memory.
- @retval EFI_SUCCESS Success.
**/
-EFI_STATUS
+VOID
CreateResourceMap (
IN PCI_IO_DEVICE *Bridge,
IN PCI_RESOURCE_NODE *IoNode,
@@ -678,16 +661,17 @@ CreateResourceMap ( // Note: For PPB, memory aperture is aligned with 1MB and IO aperture
// is aligned with 4KB
// This device is typically a bridge device like PPB and P2C
+ // Note: 0x1000 aligned
//
IoBridge = CreateResourceNode (
- Temp,
- 0,
- 0xFFF,
- PPB_IO_RANGE,
- PciBarTypeIo16,
- PciResUsageTypical
- ); //0x1000 aligned
-
+ Temp,
+ 0,
+ 0xFFF,
+ PPB_IO_RANGE,
+ PciBarTypeIo16,
+ PciResUsageTypical
+ );
+
Mem32Bridge = CreateResourceNode (
Temp,
0,
@@ -698,13 +682,13 @@ CreateResourceMap ( );
PMem32Bridge = CreateResourceNode (
- Temp,
- 0,
- 0xFFFFF,
- PPB_PMEM32_RANGE,
- PciBarTypePMem32,
- PciResUsageTypical
- );
+ Temp,
+ 0,
+ 0xFFFFF,
+ PPB_PMEM32_RANGE,
+ PciBarTypePMem32,
+ PciResUsageTypical
+ );
Mem64Bridge = CreateResourceNode (
Temp,
@@ -716,13 +700,13 @@ CreateResourceMap ( );
PMem64Bridge = CreateResourceNode (
- Temp,
- 0,
- 0xFFFFF,
- PPB_PMEM64_RANGE,
- PciBarTypePMem64,
- PciResUsageTypical
- );
+ Temp,
+ 0,
+ 0xFFFFF,
+ PPB_PMEM64_RANGE,
+ PciBarTypePMem64,
+ PciResUsageTypical
+ );
//
// Recursively create resouce map on this bridge
@@ -861,9 +845,6 @@ CreateResourceMap ( CalculateResourceAperture (Mem64Node);
CalculateResourceAperture (PMem64Node);
CalculateResourceAperture (IoNode);
-
- return EFI_SUCCESS;
-
}
/**
@@ -872,20 +853,19 @@ CreateResourceMap ( @param PciDev Pci device instance.
@param IoNode Resource info node for IO.
@param Mem32Node Resource info node for 32-bit memory.
- @param PMem32Node Resource info node for 32-bit PMemory.
+ @param PMem32Node Resource info node for 32-bit Prefetchable Memory.
@param Mem64Node Resource info node for 64-bit memory.
- @param PMem64Node Resource info node for 64-bit PMemory.
+ @param PMem64Node Resource info node for 64-bit Prefetchable Memory.
- @retval EFI_SUCCESS Success.
**/
-EFI_STATUS
+VOID
ResourcePaddingPolicy (
- PCI_IO_DEVICE *PciDev,
- PCI_RESOURCE_NODE *IoNode,
- PCI_RESOURCE_NODE *Mem32Node,
- PCI_RESOURCE_NODE *PMem32Node,
- PCI_RESOURCE_NODE *Mem64Node,
- PCI_RESOURCE_NODE *PMem64Node
+ IN PCI_IO_DEVICE *PciDev,
+ IN PCI_RESOURCE_NODE *IoNode,
+ IN PCI_RESOURCE_NODE *Mem32Node,
+ IN PCI_RESOURCE_NODE *PMem32Node,
+ IN PCI_RESOURCE_NODE *Mem64Node,
+ IN PCI_RESOURCE_NODE *PMem64Node
)
{
//
@@ -901,27 +881,23 @@ ResourcePaddingPolicy ( PMem64Node
);
}
-
- return EFI_SUCCESS;
-
}
/**
- This function is used to degrade resource if the upstream bridge
- doesn't support certain resource. Degradation path is
+ This function is used to degrade resource if the upstream bridge
+ doesn't support certain resource. Degradation path is
PMEM64 -> MEM64 -> MEM32
PMEM64 -> PMEM32 -> MEM32
IO32 -> IO16.
@param Bridge Pci device instance.
@param Mem32Node Resource info node for 32-bit memory.
- @param PMem32Node Resource info node for 32-bit PMemory.
+ @param PMem32Node Resource info node for 32-bit Prefetchable Memory.
@param Mem64Node Resource info node for 64-bit memory.
- @param PMem64Node Resource info node for 64-bit PMemory.
+ @param PMem64Node Resource info node for 64-bit Prefetchable Memory.
- @retval EFI_SUCCESS Success.
**/
-EFI_STATUS
+VOID
DegradeResource (
IN PCI_IO_DEVICE *Bridge,
IN PCI_RESOURCE_NODE *Mem32Node,
@@ -937,7 +913,7 @@ DegradeResource ( //
// For RootBridge, PPB , P2C, go recursively to traverse all its children
// to find if this bridge and downstream has OptionRom.
- //
+ //
HasOprom = FALSE;
CurrentLink = Bridge->ChildList.ForwardLink;
while (CurrentLink != NULL && CurrentLink != &Bridge->ChildList) {
@@ -946,9 +922,9 @@ DegradeResource ( if (Temp->RomSize != 0) {
HasOprom = TRUE;
break;
- }
+ }
CurrentLink = CurrentLink->ForwardLink;
- }
+ }
//
// If bridge doesn't support Prefetchable
@@ -964,7 +940,7 @@ DegradeResource ( //
// if no PMem32 request and no OptionRom request, still keep PMem64. Otherwise degrade to PMem32
//
- if ((PMem32Node != NULL && (PMem32Node->Length != 0 && Bridge->Parent != NULL)) || HasOprom) {
+ if ((PMem32Node != NULL && (PMem32Node->Length != 0 && Bridge->Parent != NULL)) || HasOprom) {
//
// Fixed the issue that there is no resource for 64-bit (above 4G)
//
@@ -1018,19 +994,17 @@ DegradeResource ( FALSE
);
}
-
- return EFI_SUCCESS;
}
/**
- Test whether bridge device support decode resource
-
+ Test whether bridge device support decode resource.
+
@param Bridge Bridge device instance.
@param Decode Decode type according to resource type.
-
- @return TRUE bridge device support decode resource.
- @return FALSE bridge device don't support decode resource.
-
+
+ @return TRUE The bridge device support decode resource.
+ @return FALSE The bridge device don't support decode resource.
+
**/
BOOLEAN
BridgeSupportResourceDecode (
@@ -1038,7 +1012,6 @@ BridgeSupportResourceDecode ( IN UINT32 Decode
)
{
-
if (((Bridge->Decodes) & Decode) != 0) {
return TRUE;
}
@@ -1047,14 +1020,16 @@ BridgeSupportResourceDecode ( }
/**
- This function is used to program the resource allocated
- for each resource node.
-
-
- @param Base Base address of resource.
- @param Bridge Bridge device instance.
-
- @retval EFI_SUCCESS Success.
+ This function is used to program the resource allocated
+ for each resource node under specified bridge.
+
+ @param Base Base address of resource to be progammed.
+ @param Bridge PCI resource node for the bridge device.
+
+ @retval EFI_SUCCESS Successfully to program all resouces
+ on given PCI bridge device.
+ @retval EFI_OUT_OF_RESOURCES Base is all one.
+
**/
EFI_STATUS
ProgramResource (
@@ -1079,13 +1054,21 @@ ProgramResource ( if (!IS_PCI_BRIDGE (&(Node->PciDev->Pci))) {
if (IS_CARDBUS_BRIDGE (&(Node->PciDev->Pci))) {
+ //
+ // Program the PCI Card Bus device
+ //
ProgramP2C (Base, Node);
} else {
+ //
+ // Program the PCI device BAR
+ //
ProgramBar (Base, Node);
}
} else {
+ //
+ // Program the PCI devices under this bridge
+ //
Status = ProgramResource (Base + Node->Offset, Node);
-
if (EFI_ERROR (Status)) {
return Status;
}
@@ -1100,14 +1083,13 @@ ProgramResource ( }
/**
- Program Bar register.
-
- @param Base Base address for resource.
+ Program Bar register for PCI device.
+
+ @param Base Base address for PCI device resource to be progammed.
@param Node Point to resoure node structure.
-
- @retval EFI_SUCCESS Success.
+
**/
-EFI_STATUS
+VOID
ProgramBar (
IN UINT64 Base,
IN PCI_RESOURCE_NODE *Node
@@ -1180,19 +1162,16 @@ ProgramBar ( default:
break;
}
-
- return EFI_SUCCESS;
}
/**
- Program PPB apperture.
-
+ Program PCI-PCI bridge apperture.
+
@param Base Base address for resource.
@param Node Point to resoure node structure.
-
- @retval EFI_SUCCESS Success.
+
**/
-EFI_STATUS
+VOID
ProgramPpbApperture (
IN UINT64 Base,
IN PCI_RESOURCE_NODE *Node
@@ -1204,14 +1183,14 @@ ProgramPpbApperture ( Address = 0;
//
- // if no device south of this PPB, return anyway
+ // If no device resource of this PPB, return anyway
// Apperture is set default in the initialization code
//
if (Node->Length == 0 || Node->ResourceUsage == PciResUsagePadding) {
//
// For padding resource node, just ignore when programming
//
- return EFI_SUCCESS;
+ return ;
}
PciIo = &(Node->PciDev->PciIo);
@@ -1354,20 +1333,17 @@ ProgramPpbApperture ( default:
break;
}
-
- return EFI_SUCCESS;
}
/**
- Program parent bridge for oprom.
-
+ Program parent bridge for Option Rom.
+
@param PciDevice Pci deivce instance.
- @param OptionRomBase Base address for oprom.
- @param Enable Enable/Disable.
-
- @retval EFI_SUCCESS Success.
+ @param OptionRomBase Base address for Optiona Rom.
+ @param Enable Enable or disable PCI memory.
+
**/
-EFI_STATUS
+VOID
ProgrameUpstreamBridgeForRom (
IN PCI_IO_DEVICE *PciDevice,
IN UINT32 OptionRomBase,
@@ -1394,7 +1370,7 @@ ProgrameUpstreamBridgeForRom ( Node.Offset = 0;
//
- // Program PPB to only open a single <= 16<MB apperture
+ // Program PPB to only open a single <= 16MB apperture
//
if (Enable) {
ProgramPpbApperture (OptionRomBase, &Node);
@@ -1406,20 +1382,20 @@ ProgrameUpstreamBridgeForRom ( Parent = Parent->Parent;
}
-
- return EFI_SUCCESS;
}
/**
Test whether resource exists for a bridge.
-
+
@param Bridge Point to resource node for a bridge.
-
- @return whether resource exists.
+
+ @retval TRUE There is resource on the given bridge.
+ @retval FALSE There isn't resource on the given bridge.
+
**/
BOOLEAN
ResourceRequestExisted (
- IN PCI_RESOURCE_NODE *Bridge
+ IN PCI_RESOURCE_NODE *Bridge
)
{
if (Bridge != NULL) {
@@ -1433,28 +1409,28 @@ ResourceRequestExisted ( /**
Initialize resource pool structure.
-
- @param ResourcePool Point to resource pool structure.
+
+ @param ResourcePool Point to resource pool structure. This pool
+ is reset to all zero when returned.
@param ResourceType Type of resource.
+
**/
-EFI_STATUS
+VOID
InitializeResourcePool (
- PCI_RESOURCE_NODE *ResourcePool,
- PCI_BAR_TYPE ResourceType
+ IN OUT PCI_RESOURCE_NODE *ResourcePool,
+ IN PCI_BAR_TYPE ResourceType
)
{
-
ZeroMem (ResourcePool, sizeof (PCI_RESOURCE_NODE));
ResourcePool->ResType = ResourceType;
ResourcePool->Signature = PCI_RESOURCE_SIGNATURE;
InitializeListHead (&ResourcePool->ChildList);
-
- return EFI_SUCCESS;
}
+
/**
Get all resource information for given Pci device.
-
+
@param PciDev Pci device instance.
@param IoBridge Io resource node.
@param Mem32Bridge 32-bit memory node.
@@ -1463,25 +1439,24 @@ InitializeResourcePool ( @param PMem64Bridge 64-bit PMemory node.
@param IoPool Link list header for Io resource.
@param Mem32Pool Link list header for 32-bit memory.
- @param PMem32Pool Link list header for 32-bit Pmemory.
+ @param PMem32Pool Link list header for 32-bit Prefetchable memory.
@param Mem64Pool Link list header for 64-bit memory.
- @param PMem64Pool Link list header for 64-bit Pmemory.
-
- @retval EFI_SUCCESS Success.
+ @param PMem64Pool Link list header for 64-bit Prefetchable memory.
+
**/
-EFI_STATUS
+VOID
GetResourceMap (
- PCI_IO_DEVICE *PciDev,
- PCI_RESOURCE_NODE **IoBridge,
- PCI_RESOURCE_NODE **Mem32Bridge,
- PCI_RESOURCE_NODE **PMem32Bridge,
- PCI_RESOURCE_NODE **Mem64Bridge,
- PCI_RESOURCE_NODE **PMem64Bridge,
- PCI_RESOURCE_NODE *IoPool,
- PCI_RESOURCE_NODE *Mem32Pool,
- PCI_RESOURCE_NODE *PMem32Pool,
- PCI_RESOURCE_NODE *Mem64Pool,
- PCI_RESOURCE_NODE *PMem64Pool
+ IN PCI_IO_DEVICE *PciDev,
+ IN PCI_RESOURCE_NODE **IoBridge,
+ IN PCI_RESOURCE_NODE **Mem32Bridge,
+ IN PCI_RESOURCE_NODE **PMem32Bridge,
+ IN PCI_RESOURCE_NODE **Mem64Bridge,
+ IN PCI_RESOURCE_NODE **PMem64Bridge,
+ IN PCI_RESOURCE_NODE *IoPool,
+ IN PCI_RESOURCE_NODE *Mem32Pool,
+ IN PCI_RESOURCE_NODE *PMem32Pool,
+ IN PCI_RESOURCE_NODE *Mem64Pool,
+ IN PCI_RESOURCE_NODE *PMem64Pool
)
{
@@ -1567,18 +1542,15 @@ GetResourceMap ( CurrentLink = CurrentLink->ForwardLink;
}
-
- return EFI_SUCCESS;
}
/**
Destory given resource tree.
-
- @param Bridge root node of resource tree.
-
- @retval EFI_SUCCESS Success.
+
+ @param Bridge PCI resource root node of resource tree.
+
**/
-EFI_STATUS
+VOID
DestroyResourceTree (
IN PCI_RESOURCE_NODE *Bridge
)
@@ -1591,6 +1563,7 @@ DestroyResourceTree ( CurrentLink = Bridge->ChildList.ForwardLink;
Temp = RESOURCE_NODE_FROM_LINK (CurrentLink);
+ ASSERT (Temp);
RemoveEntryList (CurrentLink);
@@ -1598,65 +1571,29 @@ DestroyResourceTree ( DestroyResourceTree (Temp);
}
- gBS->FreePool (Temp);
+ FreePool (Temp);
}
-
- return EFI_SUCCESS;
-}
-
-/**
- Record the reserved resource and insert to reserved list.
-
- @param Base Base address of reserved resourse.
- @param Length Length of reserved resource.
- @param ResType Resource type.
- @param Bridge Pci device instance.
-**/
-EFI_STATUS
-RecordReservedResource (
- IN UINT64 Base,
- IN UINT64 Length,
- IN PCI_BAR_TYPE ResType,
- IN PCI_IO_DEVICE *Bridge
- )
-{
- PCI_RESERVED_RESOURCE_LIST *ReservedNode;
-
- ReservedNode = AllocatePool (sizeof (PCI_RESERVED_RESOURCE_LIST));
- if (ReservedNode == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- ReservedNode->Signature = RESERVED_RESOURCE_SIGNATURE;
- ReservedNode->Node.Base = Base;
- ReservedNode->Node.Length = Length;
- ReservedNode->Node.ResType = ResType;
-
- InsertTailList (&Bridge->ReservedResourceList, &(ReservedNode->Link));
-
- return EFI_SUCCESS;
}
/**
Insert resource padding for P2C.
-
+
@param PciDev Pci device instance.
- @param IoNode Resource info node for IO.
+ @param IoNode Resource info node for IO.
@param Mem32Node Resource info node for 32-bit memory.
- @param PMem32Node Resource info node for 32-bit PMemory.
+ @param PMem32Node Resource info node for 32-bit Prefetchable Memory.
@param Mem64Node Resource info node for 64-bit memory.
- @param PMem64Node Resource info node for 64-bit PMemory.
-
- @retval EFI_SUCCESS Success.
+ @param PMem64Node Resource info node for 64-bit Prefetchable Memory.
+
**/
-EFI_STATUS
+VOID
ResourcePaddingForCardBusBridge (
- PCI_IO_DEVICE *PciDev,
- PCI_RESOURCE_NODE *IoNode,
- PCI_RESOURCE_NODE *Mem32Node,
- PCI_RESOURCE_NODE *PMem32Node,
- PCI_RESOURCE_NODE *Mem64Node,
- PCI_RESOURCE_NODE *PMem64Node
+ IN PCI_IO_DEVICE *PciDev,
+ IN PCI_RESOURCE_NODE *IoNode,
+ IN PCI_RESOURCE_NODE *Mem32Node,
+ IN PCI_RESOURCE_NODE *PMem32Node,
+ IN PCI_RESOURCE_NODE *Mem64Node,
+ IN PCI_RESOURCE_NODE *PMem64Node
)
{
PCI_RESOURCE_NODE *Node;
@@ -1668,13 +1605,13 @@ ResourcePaddingForCardBusBridge ( // Bar 1 denodes memory range 0
//
Node = CreateResourceNode (
- PciDev,
- 0x2000000,
- 0x1ffffff,
- 1,
- PciBarTypeMem32,
- PciResUsagePadding
- );
+ PciDev,
+ 0x2000000,
+ 0x1ffffff,
+ 1,
+ PciBarTypeMem32,
+ PciResUsagePadding
+ );
InsertResourceNode (
Mem32Node,
@@ -1686,13 +1623,13 @@ ResourcePaddingForCardBusBridge ( // Bar 2 denodes memory range1
//
Node = CreateResourceNode (
- PciDev,
- 0x2000000,
- 0x1ffffff,
- 2,
- PciBarTypePMem32,
- PciResUsagePadding
- );
+ PciDev,
+ 0x2000000,
+ 0x1ffffff,
+ 2,
+ PciBarTypePMem32,
+ PciResUsagePadding
+ );
InsertResourceNode (
PMem32Node,
@@ -1704,13 +1641,13 @@ ResourcePaddingForCardBusBridge ( // Bar 3 denodes io range 0
//
Node = CreateResourceNode (
- PciDev,
- 0x100,
- 0xff,
- 3,
- PciBarTypeIo16,
- PciResUsagePadding
- );
+ PciDev,
+ 0x100,
+ 0xff,
+ 3,
+ PciBarTypeIo16,
+ PciResUsagePadding
+ );
InsertResourceNode (
IoNode,
@@ -1722,31 +1659,28 @@ ResourcePaddingForCardBusBridge ( // Bar 4 denodes io range 0
//
Node = CreateResourceNode (
- PciDev,
- 0x100,
- 0xff,
- 4,
- PciBarTypeIo16,
- PciResUsagePadding
- );
+ PciDev,
+ 0x100,
+ 0xff,
+ 4,
+ PciBarTypeIo16,
+ PciResUsagePadding
+ );
InsertResourceNode (
IoNode,
Node
);
-
- return EFI_SUCCESS;
}
/**
- Program P2C register for given resource node
-
- @param Base Base address of P2C device
+ Program PCI Card device register for given resource node.
+
+ @param Base Base address of PCI Card device to be programmed.
@param Node Given resource node.
-
- @retval EFI_SUCCESS Success
+
**/
-EFI_STATUS
+VOID
ProgramP2C (
IN UINT64 Base,
IN PCI_RESOURCE_NODE *Node
@@ -1774,12 +1708,12 @@ ProgramP2C ( case P2C_BAR_0:
PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- (Node->PciDev->PciBar[Node->Bar]).Offset,
- 1,
- &Address
- );
+ PciIo,
+ EfiPciIoWidthUint32,
+ (Node->PciDev->PciBar[Node->Bar]).Offset,
+ 1,
+ &Address
+ );
Node->PciDev->PciBar[Node->Bar].BaseAddress = Address;
Node->PciDev->PciBar[Node->Bar].Length = Node->Length;
@@ -1787,65 +1721,63 @@ ProgramP2C ( case P2C_MEM_1:
PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- 0x1c,
- 1,
- &Address
- );
+ PciIo,
+ EfiPciIoWidthUint32,
+ PCI_CARD_MEMORY_BASE_0,
+ 1,
+ &Address
+ );
TempAddress = Address + Node->Length - 1;
PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- 0x20,
- 1,
- &TempAddress
- );
+ PciIo,
+ EfiPciIoWidthUint32,
+ PCI_CARD_MEMORY_LIMIT_0,
+ 1,
+ &TempAddress
+ );
if (Node->ResType == PciBarTypeMem32) {
-
//
// Set non-prefetchable bit
//
PciIoRead (
- PciIo,
- EfiPciIoWidthUint16,
- 0x3e,
- 1,
- &BridgeControl
- );
-
- BridgeControl &= 0xfeff;
+ PciIo,
+ EfiPciIoWidthUint16,
+ PCI_CARD_BRIDGE_CONTROL,
+ 1,
+ &BridgeControl
+ );
+
+ BridgeControl &= (UINT16) ~PCI_CARD_PREFETCHABLE_MEMORY_0_ENABLE;
PciIoWrite (
- PciIo,
- EfiPciIoWidthUint16,
- 0x3e,
- 1,
- &BridgeControl
- );
+ PciIo,
+ EfiPciIoWidthUint16,
+ PCI_CARD_BRIDGE_CONTROL,
+ 1,
+ &BridgeControl
+ );
} else {
-
//
// Set pre-fetchable bit
//
PciIoRead (
- PciIo,
- EfiPciIoWidthUint16,
- 0x3e,
- 1,
- &BridgeControl
- );
-
- BridgeControl |= 0x0100;
+ PciIo,
+ EfiPciIoWidthUint16,
+ PCI_CARD_BRIDGE_CONTROL,
+ 1,
+ &BridgeControl
+ );
+
+ BridgeControl |= PCI_CARD_PREFETCHABLE_MEMORY_0_ENABLE;
PciIoWrite (
- PciIo,
- EfiPciIoWidthUint16,
- 0x3e,
- 1,
- &BridgeControl
- );
+ PciIo,
+ EfiPciIoWidthUint16,
+ PCI_CARD_BRIDGE_CONTROL,
+ 1,
+ &BridgeControl
+ );
}
Node->PciDev->PciBar[Node->Bar].BaseAddress = Address;
@@ -1856,22 +1788,22 @@ ProgramP2C ( case P2C_MEM_2:
PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- 0x24,
- 1,
- &Address
- );
+ PciIo,
+ EfiPciIoWidthUint32,
+ PCI_CARD_MEMORY_BASE_1,
+ 1,
+ &Address
+ );
TempAddress = Address + Node->Length - 1;
PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- 0x28,
- 1,
- &TempAddress
- );
+ PciIo,
+ EfiPciIoWidthUint32,
+ PCI_CARD_MEMORY_LIMIT_1,
+ 1,
+ &TempAddress
+ );
if (Node->ResType == PciBarTypeMem32) {
@@ -1879,42 +1811,43 @@ ProgramP2C ( // Set non-prefetchable bit
//
PciIoRead (
- PciIo,
- EfiPciIoWidthUint16,
- 0x3e,
- 1,
- &BridgeControl
- );
-
- BridgeControl &= 0xfdff;
+ PciIo,
+ EfiPciIoWidthUint16,
+ PCI_CARD_BRIDGE_CONTROL,
+ 1,
+ &BridgeControl
+ );
+
+ BridgeControl &= (UINT16) ~(PCI_CARD_PREFETCHABLE_MEMORY_1_ENABLE);
PciIoWrite (
- PciIo,
- EfiPciIoWidthUint16,
- 0x3e,
- 1,
- &BridgeControl
- );
+ PciIo,
+ EfiPciIoWidthUint16,
+ PCI_CARD_BRIDGE_CONTROL,
+ 1,
+ &BridgeControl
+ );
+
} else {
//
// Set pre-fetchable bit
//
PciIoRead (
- PciIo,
- EfiPciIoWidthUint16,
- 0x3e,
- 1,
- &BridgeControl
- );
-
- BridgeControl |= 0x0200;
+ PciIo,
+ EfiPciIoWidthUint16,
+ PCI_CARD_BRIDGE_CONTROL,
+ 1,
+ &BridgeControl
+ );
+
+ BridgeControl |= PCI_CARD_PREFETCHABLE_MEMORY_1_ENABLE;
PciIoWrite (
- PciIo,
- EfiPciIoWidthUint16,
- 0x3e,
- 1,
- &BridgeControl
- );
+ PciIo,
+ EfiPciIoWidthUint16,
+ PCI_CARD_BRIDGE_CONTROL,
+ 1,
+ &BridgeControl
+ );
}
Node->PciDev->PciBar[Node->Bar].BaseAddress = Address;
@@ -1924,20 +1857,21 @@ ProgramP2C ( case P2C_IO_1:
PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- 0x2c,
- 1,
- &Address
- );
+ PciIo,
+ EfiPciIoWidthUint32,
+ PCI_CARD_IO_BASE_0_LOWER,
+ 1,
+ &Address
+ );
+
TempAddress = Address + Node->Length - 1;
PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- 0x30,
- 1,
- &TempAddress
- );
+ PciIo,
+ EfiPciIoWidthUint32,
+ PCI_CARD_IO_LIMIT_0_LOWER,
+ 1,
+ &TempAddress
+ );
Node->PciDev->PciBar[Node->Bar].BaseAddress = Address;
Node->PciDev->PciBar[Node->Bar].Length = Node->Length;
@@ -1947,21 +1881,21 @@ ProgramP2C ( case P2C_IO_2:
PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- 0x34,
- 1,
- &Address
- );
+ PciIo,
+ EfiPciIoWidthUint32,
+ PCI_CARD_IO_BASE_1_LOWER,
+ 1,
+ &Address
+ );
TempAddress = Address + Node->Length - 1;
PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- 0x38,
- 1,
- &TempAddress
- );
+ PciIo,
+ EfiPciIoWidthUint32,
+ PCI_CARD_IO_LIMIT_1_LOWER,
+ 1,
+ &TempAddress
+ );
Node->PciDev->PciBar[Node->Bar].BaseAddress = Address;
Node->PciDev->PciBar[Node->Bar].Length = Node->Length;
@@ -1971,31 +1905,27 @@ ProgramP2C ( default:
break;
}
-
- return EFI_SUCCESS;
}
/**
Create padding resource node.
-
+
@param PciDev Pci device instance.
- @param IoNode Resource info node for IO.
+ @param IoNode Resource info node for IO.
@param Mem32Node Resource info node for 32-bit memory.
- @param PMem32Node Resource info node for 32-bit PMemory.
+ @param PMem32Node Resource info node for 32-bit Prefetchable Memory.
@param Mem64Node Resource info node for 64-bit memory.
- @param PMem64Node Resource info node for 64-bit PMemory.
-
- @retval EFI_SUCCESS Success.
+ @param PMem64Node Resource info node for 64-bit Prefetchable Memory.
**/
-EFI_STATUS
+VOID
ApplyResourcePadding (
- PCI_IO_DEVICE *PciDev,
- PCI_RESOURCE_NODE *IoNode,
- PCI_RESOURCE_NODE *Mem32Node,
- PCI_RESOURCE_NODE *PMem32Node,
- PCI_RESOURCE_NODE *Mem64Node,
- PCI_RESOURCE_NODE *PMem64Node
+ IN PCI_IO_DEVICE *PciDev,
+ IN PCI_RESOURCE_NODE *IoNode,
+ IN PCI_RESOURCE_NODE *Mem32Node,
+ IN PCI_RESOURCE_NODE *PMem32Node,
+ IN PCI_RESOURCE_NODE *Mem64Node,
+ IN PCI_RESOURCE_NODE *PMem64Node
)
{
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr;
@@ -2131,23 +2061,22 @@ ApplyResourcePadding ( Ptr++;
}
-
- return EFI_SUCCESS;
}
/**
- Get padding resource for PPB.
- Light PCI bus driver woundn't support hotplug root device
- So no need to pad resource for them.
+ Get padding resource for PCI-PCI bridge.
+
+ @param PciIoDevice PCI-PCI bridge device instance.
- @param PciIoDevice Pci device instance.
+ @note Feature flag PcdPciBusHotplugDeviceSupport determines
+ whether need to pad resource for them.
**/
VOID
GetResourcePaddingPpb (
IN PCI_IO_DEVICE *PciIoDevice
)
{
- if (gPciHotPlugInit != NULL) {
+ if (gPciHotPlugInit != NULL && FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
if (PciIoDevice->ResourcePaddingDescriptors == NULL) {
GetResourcePaddingForHpb (PciIoDevice);
}
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.h b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.h index 9b25dbd101..3724dcd1f3 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.h +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.h @@ -1,39 +1,20 @@ /** @file
+ PCI resouces support functions declaration for PCI Bus module.
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _EFI_PCI_RESOURCE_SUPPORT_H_
#define _EFI_PCI_RESOURCE_SUPPORT_H_
-#define RESERVED_RESOURCE_SIGNATURE SIGNATURE_32 ('r', 's', 'v', 'd')
-
-typedef struct {
- UINT64 Base;
- UINT64 Length;
- PCI_BAR_TYPE ResType;
-} PCI_RESERVED_RESOURCE_NODE;
-
-typedef struct {
- UINT32 Signature;
- LIST_ENTRY Link;
- PCI_RESERVED_RESOURCE_NODE Node;
-} PCI_RESERVED_RESOURCE_LIST;
-
-#define RESOURCED_LIST_FROM_NODE(a) \
- CR (a, PCI_RESERVED_RESOURCE_LIST, Node, RESERVED_RESOURCE_SIGNATURE)
-
-#define RESOURCED_LIST_FROM_LINK(a) \
- CR (a, PCI_RESERVED_RESOURCE_LIST, Link, RESERVED_RESOURCE_SIGNATURE)
-
typedef enum {
PciResUsageTypical = 0,
PciResUsagePadding,
@@ -60,14 +41,13 @@ typedef struct { CR (a, PCI_RESOURCE_NODE, Link, PCI_RESOURCE_SIGNATURE)
/**
- The function is used to skip VGA range
-
- @param Start address including VGA range
- @param Length length of VGA range.
-
- @retval EFI_SUCCESS success.
+ The function is used to skip VGA range.
+
+ @param Start Returned start address including VGA range.
+ @param Length The length of VGA range.
+
**/
-EFI_STATUS
+VOID
SkipVGAAperture (
OUT UINT64 *Start,
IN UINT64 Length
@@ -75,13 +55,12 @@ SkipVGAAperture ( /**
This function is used to skip ISA aliasing aperture.
-
- @param Start address including ISA aliasing aperture.
- @param Length length of ISA aliasing aperture.
-
- @retval EFI_SUCCESS success.
+
+ @param Start Returned start address including ISA aliasing aperture.
+ @param Length The length of ISA aliasing aperture.
+
**/
-EFI_STATUS
+VOID
SkipIsaAliasAperture (
OUT UINT64 *Start,
IN UINT64 Length
@@ -93,88 +72,82 @@ SkipIsaAliasAperture ( @param Bridge PCI resource node for bridge.
@param ResNode Resource node want to be inserted.
-
- @retval EFI_SUCCESS Success.
+
**/
-EFI_STATUS
+VOID
InsertResourceNode (
- PCI_RESOURCE_NODE *Bridge,
- PCI_RESOURCE_NODE *ResNode
+ IN PCI_RESOURCE_NODE *Bridge,
+ IN PCI_RESOURCE_NODE *ResNode
);
/**
+ This routine is used to merge two different resource trees in need of
+ resoure degradation.
-Routine Description:
-
- This routine is used to merge two different resource tree in need of
- resoure degradation. For example, if a upstream PPB doesn't support,
+ For example, if an upstream PPB doesn't support,
prefetchable memory decoding, the PCI bus driver will choose to call this function
to merge prefectchable memory resource list into normal memory list.
If the TypeMerge is TRUE, Res resource type is changed to the type of destination resource
type.
+ If Dst is NULL or Res is NULL, ASSERT ().
@param Dst Point to destination resource tree.
@param Res Point to source resource tree.
- @param TypeMerge If the TypeMerge is TRUE, Res resource type is changed to the type of
+ @param TypeMerge If the TypeMerge is TRUE, Res resource type is changed to the type of
destination resource type.
-
-
- @retval EFI_SUCCESS Success
+
**/
-EFI_STATUS
+VOID
MergeResourceTree (
- PCI_RESOURCE_NODE *Dst,
- PCI_RESOURCE_NODE *Res,
- BOOLEAN TypeMerge
+ IN PCI_RESOURCE_NODE *Dst,
+ IN PCI_RESOURCE_NODE *Res,
+ IN BOOLEAN TypeMerge
);
/**
This function is used to calculate the IO16 aperture
for a bridge.
- @param Bridge PCI resource node for bridge.
-
- @retval EFI_SUCCESS Success.
+ @param Bridge PCI resource node for bridge.
+
**/
-EFI_STATUS
+VOID
CalculateApertureIo16 (
- IN PCI_RESOURCE_NODE *Bridge
+ IN PCI_RESOURCE_NODE *Bridge
);
/**
This function is used to calculate the resource aperture
for a given bridge device.
- @param Bridge Give bridge device.
-
- @retval EFI_SUCCESS Success.
+ @param Bridge PCI resouce node for given bridge device.
+
**/
-EFI_STATUS
+VOID
CalculateResourceAperture (
- IN PCI_RESOURCE_NODE *Bridge
+ IN PCI_RESOURCE_NODE *Bridge
);
/**
Get IO/Memory resource infor for given PCI device.
-
+
@param PciDev Pci device instance.
@param IoNode Resource info node for IO .
@param Mem32Node Resource info node for 32-bit memory.
- @param PMem32Node Resource info node for 32-bit PMemory.
+ @param PMem32Node Resource info node for 32-bit Prefetchable Memory.
@param Mem64Node Resource info node for 64-bit memory.
- @param PMem64Node Resource info node for 64-bit PMemory.
-
- @retval EFI_SUCCESS Success.
+ @param PMem64Node Resource info node for 64-bit Prefetchable Memory.
+
**/
-EFI_STATUS
+VOID
GetResourceFromDevice (
- PCI_IO_DEVICE *PciDev,
- PCI_RESOURCE_NODE *IoNode,
- PCI_RESOURCE_NODE *Mem32Node,
- PCI_RESOURCE_NODE *PMem32Node,
- PCI_RESOURCE_NODE *Mem64Node,
- PCI_RESOURCE_NODE *PMem64Node
+ IN PCI_IO_DEVICE *PciDev,
+ IN PCI_RESOURCE_NODE *IoNode,
+ IN PCI_RESOURCE_NODE *Mem32Node,
+ IN PCI_RESOURCE_NODE *PMem32Node,
+ IN PCI_RESOURCE_NODE *Mem64Node,
+ IN PCI_RESOURCE_NODE *PMem64Node
);
/**
@@ -186,6 +159,10 @@ GetResourceFromDevice ( @param Bar Bar index.
@param ResType Type of resource: IO/Memory.
@param ResUsage Resource usage.
+
+ @return PCI resource node created for given PCI device.
+ NULL means PCI resource node is not created.
+
**/
PCI_RESOURCE_NODE *
CreateResourceNode (
@@ -198,19 +175,18 @@ CreateResourceNode ( );
/**
- This routine is used to extract resource request from
+ This function is used to extract resource request from
device node list.
@param Bridge Pci device instance.
@param IoNode Resource info node for IO.
@param Mem32Node Resource info node for 32-bit memory.
- @param PMem32Node Resource info node for 32-bit PMemory.
+ @param PMem32Node Resource info node for 32-bit Prefetchable Memory.
@param Mem64Node Resource info node for 64-bit memory.
- @param PMem64Node Resource info node for 64-bit PMemory.
+ @param PMem64Node Resource info node for 64-bit Prefetchable Memory.
- @retval EFI_SUCCESS Success.
**/
-EFI_STATUS
+VOID
CreateResourceMap (
IN PCI_IO_DEVICE *Bridge,
IN PCI_RESOURCE_NODE *IoNode,
@@ -224,40 +200,38 @@ CreateResourceMap ( This function is used to do the resource padding for a specific platform.
@param PciDev Pci device instance.
- @param IoNode Resource info node for IO.
+ @param IoNode Resource info node for IO.
@param Mem32Node Resource info node for 32-bit memory.
- @param PMem32Node Resource info node for 32-bit PMemory.
+ @param PMem32Node Resource info node for 32-bit Prefetchable Memory.
@param Mem64Node Resource info node for 64-bit memory.
- @param PMem64Node Resource info node for 64-bit PMemory.
+ @param PMem64Node Resource info node for 64-bit Prefetchable Memory.
- @retval EFI_SUCCESS Success.
**/
-EFI_STATUS
+VOID
ResourcePaddingPolicy (
- PCI_IO_DEVICE *PciDev,
- PCI_RESOURCE_NODE *IoNode,
- PCI_RESOURCE_NODE *Mem32Node,
- PCI_RESOURCE_NODE *PMem32Node,
- PCI_RESOURCE_NODE *Mem64Node,
- PCI_RESOURCE_NODE *PMem64Node
+ IN PCI_IO_DEVICE *PciDev,
+ IN PCI_RESOURCE_NODE *IoNode,
+ IN PCI_RESOURCE_NODE *Mem32Node,
+ IN PCI_RESOURCE_NODE *PMem32Node,
+ IN PCI_RESOURCE_NODE *Mem64Node,
+ IN PCI_RESOURCE_NODE *PMem64Node
);
/**
- This function is used to degrade resource if the upstream bridge
- doesn't support certain resource. Degradation path is
+ This function is used to degrade resource if the upstream bridge
+ doesn't support certain resource. Degradation path is
PMEM64 -> MEM64 -> MEM32
PMEM64 -> PMEM32 -> MEM32
- IO32 -> IO16
+ IO32 -> IO16.
@param Bridge Pci device instance.
@param Mem32Node Resource info node for 32-bit memory.
- @param PMem32Node Resource info node for 32-bit PMemory.
+ @param PMem32Node Resource info node for 32-bit Prefetchable Memory.
@param Mem64Node Resource info node for 64-bit memory.
- @param PMem64Node Resource info node for 64-bit PMemory.
+ @param PMem64Node Resource info node for 64-bit Prefetchable Memory.
- @retval EFI_SUCCESS Success.
**/
-EFI_STATUS
+VOID
DegradeResource (
IN PCI_IO_DEVICE *Bridge,
IN PCI_RESOURCE_NODE *Mem32Node,
@@ -268,12 +242,13 @@ DegradeResource ( /**
Test whether bridge device support decode resource.
-
+
@param Bridge Bridge device instance.
@param Decode Decode type according to resource type.
-
- @return whether bridge device support decode resource.
-
+
+ @return TRUE The bridge device support decode resource.
+ @return FALSE The bridge device don't support decode resource.
+
**/
BOOLEAN
BridgeSupportResourceDecode (
@@ -282,14 +257,16 @@ BridgeSupportResourceDecode ( );
/**
- This function is used to program the resource allocated
- for each resource node.
-
-
- @param Base Base address of resource.
- @param Bridge Bridge device instance.
-
- @retval EFI_SUCCESS Success.
+ This function is used to program the resource allocated
+ for each resource node under specified bridge.
+
+ @param Base Base address of resource to be progammed.
+ @param Bridge PCI resource node for the bridge device.
+
+ @retval EFI_SUCCESS Successfully to program all resouces
+ on given PCI bridge device.
+ @retval EFI_OUT_OF_RESOURCES Base is all one.
+
**/
EFI_STATUS
ProgramResource (
@@ -298,43 +275,40 @@ ProgramResource ( );
/**
- Program Bar register.
-
- @param Base Base address for resource.
+ Program Bar register for PCI device.
+
+ @param Base Base address for PCI device resource to be progammed.
@param Node Point to resoure node structure.
-
- @retval EFI_SUCCESS Success.
+
**/
-EFI_STATUS
+VOID
ProgramBar (
IN UINT64 Base,
IN PCI_RESOURCE_NODE *Node
);
/**
- Program PPB apperture.
-
+ Program PCI-PCI bridge apperture.
+
@param Base Base address for resource.
@param Node Point to resoure node structure.
-
- @retval EFI_SUCCESS Success.
+
**/
-EFI_STATUS
+VOID
ProgramPpbApperture (
IN UINT64 Base,
IN PCI_RESOURCE_NODE *Node
);
/**
- Program parent bridge for oprom.
-
+ Program parent bridge for Option Rom.
+
@param PciDevice Pci deivce instance.
- @param OptionRomBase Base address for oprom.
- @param Enable Enable/Disable.
-
- @retval EFI_SUCCESS Success.
+ @param OptionRomBase Base address for Optiona Rom.
+ @param Enable Enable or disable PCI memory.
+
**/
-EFI_STATUS
+VOID
ProgrameUpstreamBridgeForRom (
IN PCI_IO_DEVICE *PciDevice,
IN UINT32 OptionRomBase,
@@ -343,31 +317,35 @@ ProgrameUpstreamBridgeForRom ( /**
Test whether resource exists for a bridge.
-
+
@param Bridge Point to resource node for a bridge.
-
- @return whether resource exists.
+
+ @retval TRUE There is resource on the given bridge.
+ @retval FALSE There isn't resource on the given bridge.
+
**/
BOOLEAN
ResourceRequestExisted (
- IN PCI_RESOURCE_NODE *Bridge
+ IN PCI_RESOURCE_NODE *Bridge
);
/**
Initialize resource pool structure.
-
- @param ResourcePool Point to resource pool structure.
+
+ @param ResourcePool Point to resource pool structure. This pool
+ is reset to all zero when returned.
@param ResourceType Type of resource.
+
**/
-EFI_STATUS
+VOID
InitializeResourcePool (
- PCI_RESOURCE_NODE *ResourcePool,
- PCI_BAR_TYPE ResourceType
+ IN OUT PCI_RESOURCE_NODE *ResourcePool,
+ IN PCI_BAR_TYPE ResourceType
);
/**
Get all resource information for given Pci device.
-
+
@param PciDev Pci device instance.
@param IoBridge Io resource node.
@param Mem32Bridge 32-bit memory node.
@@ -376,86 +354,66 @@ InitializeResourcePool ( @param PMem64Bridge 64-bit PMemory node.
@param IoPool Link list header for Io resource.
@param Mem32Pool Link list header for 32-bit memory.
- @param PMem32Pool Link list header for 32-bit Pmemory.
+ @param PMem32Pool Link list header for 32-bit Prefetchable memory.
@param Mem64Pool Link list header for 64-bit memory.
- @param PMem64Pool Link list header for 64-bit Pmemory.
-
- @retval EFI_SUCCESS Success.
+ @param PMem64Pool Link list header for 64-bit Prefetchable memory.
+
**/
-EFI_STATUS
+VOID
GetResourceMap (
- PCI_IO_DEVICE *PciDev,
- PCI_RESOURCE_NODE **IoBridge,
- PCI_RESOURCE_NODE **Mem32Bridge,
- PCI_RESOURCE_NODE **PMem32Bridge,
- PCI_RESOURCE_NODE **Mem64Bridge,
- PCI_RESOURCE_NODE **PMem64Bridge,
- PCI_RESOURCE_NODE *IoPool,
- PCI_RESOURCE_NODE *Mem32Pool,
- PCI_RESOURCE_NODE *PMem32Pool,
- PCI_RESOURCE_NODE *Mem64Pool,
- PCI_RESOURCE_NODE *PMem64Pool
+ IN PCI_IO_DEVICE *PciDev,
+ IN PCI_RESOURCE_NODE **IoBridge,
+ IN PCI_RESOURCE_NODE **Mem32Bridge,
+ IN PCI_RESOURCE_NODE **PMem32Bridge,
+ IN PCI_RESOURCE_NODE **Mem64Bridge,
+ IN PCI_RESOURCE_NODE **PMem64Bridge,
+ IN PCI_RESOURCE_NODE *IoPool,
+ IN PCI_RESOURCE_NODE *Mem32Pool,
+ IN PCI_RESOURCE_NODE *PMem32Pool,
+ IN PCI_RESOURCE_NODE *Mem64Pool,
+ IN PCI_RESOURCE_NODE *PMem64Pool
);
/**
Destory given resource tree.
-
- @param Bridge root node of resource tree.
-
- @retval EFI_SUCCESS Success.
+
+ @param Bridge PCI resource root node of resource tree.
+
**/
-EFI_STATUS
+VOID
DestroyResourceTree (
IN PCI_RESOURCE_NODE *Bridge
);
/**
- Record the reserved resource and insert to reserved list.
-
- @param Base Base address of reserved resourse.
- @param Length Length of reserved resource.
- @param ResType Resource type.
- @param Bridge Pci device instance.
-**/
-EFI_STATUS
-RecordReservedResource (
- IN UINT64 Base,
- IN UINT64 Length,
- IN PCI_BAR_TYPE ResType,
- IN PCI_IO_DEVICE *Bridge
- );
-
-/**
Insert resource padding for P2C.
-
+
@param PciDev Pci device instance.
- @param IoNode Resource info node for IO.
+ @param IoNode Resource info node for IO.
@param Mem32Node Resource info node for 32-bit memory.
- @param PMem32Node Resource info node for 32-bit PMemory.
+ @param PMem32Node Resource info node for 32-bit Prefetchable Memory.
@param Mem64Node Resource info node for 64-bit memory.
- @param PMem64Node Resource info node for 64-bit PMemory.
-
- @retval EFI_SUCCESS Success.
+ @param PMem64Node Resource info node for 64-bit Prefetchable Memory.
+
**/
-EFI_STATUS
+VOID
ResourcePaddingForCardBusBridge (
- PCI_IO_DEVICE *PciDev,
- PCI_RESOURCE_NODE *IoNode,
- PCI_RESOURCE_NODE *Mem32Node,
- PCI_RESOURCE_NODE *PMem32Node,
- PCI_RESOURCE_NODE *Mem64Node,
- PCI_RESOURCE_NODE *PMem64Node
+ IN PCI_IO_DEVICE *PciDev,
+ IN PCI_RESOURCE_NODE *IoNode,
+ IN PCI_RESOURCE_NODE *Mem32Node,
+ IN PCI_RESOURCE_NODE *PMem32Node,
+ IN PCI_RESOURCE_NODE *Mem64Node,
+ IN PCI_RESOURCE_NODE *PMem64Node
);
/**
- Program P2C register for given resource node.
-
- @param Base Base address of P2C device.
+ Program PCI Card device register for given resource node.
+
+ @param Base Base address of PCI Card device to be programmed.
@param Node Given resource node.
-
- @retval EFI_SUCCESS Success.
+
**/
-EFI_STATUS
+VOID
ProgramP2C (
IN UINT64 Base,
IN PCI_RESOURCE_NODE *Node
@@ -463,49 +421,36 @@ ProgramP2C ( /**
Create padding resource node.
-
+
@param PciDev Pci device instance.
- @param IoNode Resource info node for IO.
+ @param IoNode Resource info node for IO.
@param Mem32Node Resource info node for 32-bit memory.
- @param PMem32Node Resource info node for 32-bit PMemory.
+ @param PMem32Node Resource info node for 32-bit Prefetchable Memory.
@param Mem64Node Resource info node for 64-bit memory.
- @param PMem64Node Resource info node for 64-bit PMemory.
-
- @retval EFI_SUCCESS Success
+ @param PMem64Node Resource info node for 64-bit Prefetchable Memory.
**/
-EFI_STATUS
+VOID
ApplyResourcePadding (
- PCI_IO_DEVICE *PciDev,
- PCI_RESOURCE_NODE *IoNode,
- PCI_RESOURCE_NODE *Mem32Node,
- PCI_RESOURCE_NODE *PMem32Node,
- PCI_RESOURCE_NODE *Mem64Node,
- PCI_RESOURCE_NODE *PMem64Node
+ IN PCI_IO_DEVICE *PciDev,
+ IN PCI_RESOURCE_NODE *IoNode,
+ IN PCI_RESOURCE_NODE *Mem32Node,
+ IN PCI_RESOURCE_NODE *PMem32Node,
+ IN PCI_RESOURCE_NODE *Mem64Node,
+ IN PCI_RESOURCE_NODE *PMem64Node
);
/**
- Get padding resource for PPB
- Light PCI bus driver woundn't support hotplug root device
- So no need to pad resource for them.
+ Get padding resource for PCI-PCI bridge.
+
+ @param PciIoDevice PCI-PCI bridge device instance.
- @param PciIoDevice Pci device instance.
+ @note Feature flag PcdPciBusHotplugDeviceSupport determines
+ whether need to pad resource for them.
**/
VOID
GetResourcePaddingPpb (
IN PCI_IO_DEVICE *PciIoDevice
);
-/**
- Reset and all bus number from specific bridge.
-
- @param Bridge Parent specific bridge.
- @param StartBusNumber start bus number.
-**/
-EFI_STATUS
-ResetAllPpbBusNumber (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT8 StartBusNumber
- );
-
#endif
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciRomTable.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciRomTable.c index 1a7fef7dfb..9addcf920a 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciRomTable.c +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciRomTable.c @@ -1,20 +1,22 @@ /** @file
- Option Rom Support for PCI Bus Driver
+ Set up ROM Table for PCI Bus module.
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "PciBus.h"
-#include "PciRomTable.h"
+//
+// PCI ROM image information
+//
typedef struct {
EFI_HANDLE ImageHandle;
UINTN Seg;
@@ -31,7 +33,7 @@ EFI_PCI_ROM_IMAGE_MAPPING *mRomImageTable = NULL; /**
Add the Rom Image to internal database for later PCI light enumeration.
-
+
@param ImageHandle Option Rom image handle.
@param Seg Segment of PCI space.
@param Bus Bus NO of PCI space.
@@ -39,16 +41,17 @@ EFI_PCI_ROM_IMAGE_MAPPING *mRomImageTable = NULL; @param Func Func NO of PCI space.
@param RomAddress Base address of OptionRom.
@param RomLength Length of rom image.
+
**/
VOID
PciRomAddImageMapping (
- IN EFI_HANDLE ImageHandle,
- IN UINTN Seg,
- IN UINT8 Bus,
- IN UINT8 Dev,
- IN UINT8 Func,
- IN UINT64 RomAddress,
- IN UINT64 RomLength
+ IN EFI_HANDLE ImageHandle,
+ IN UINTN Seg,
+ IN UINT8 Bus,
+ IN UINT8 Dev,
+ IN UINT8 Func,
+ IN UINT64 RomAddress,
+ IN UINT64 RomLength
)
{
EFI_PCI_ROM_IMAGE_MAPPING *TempMapping;
@@ -84,16 +87,16 @@ PciRomAddImageMapping ( /**
Get Option rom driver's mapping for PCI device.
-
+
@param PciIoDevice Device instance.
@retval TRUE Found Image mapping.
- @retval FALSE
+ @retval FALSE Cannot found image mapping.
**/
BOOLEAN
PciRomGetImageMapping (
- PCI_IO_DEVICE *PciIoDevice
+ IN PCI_IO_DEVICE *PciIoDevice
)
{
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciRomTable.h b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciRomTable.h index dc3d8fd64d..e1b41a7c86 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciRomTable.h +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciRomTable.h @@ -1,14 +1,14 @@ /** @file
- Option Rom Support for PCI Bus Driver
+ Set up ROM Table for PCI Bus module.
-Copyright (c) 2006 - 2009, Intel Corporation
-All rights reserved. This program and the accompanying materials
-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
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+Copyright (c) 2006 - 2009, Intel Corporation
+All rights reserved. This program and the accompanying materials
+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
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
@@ -17,7 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. /**
Add the Rom Image to internal database for later PCI light enumeration.
-
+
@param ImageHandle Option Rom image handle.
@param Seg Segment of PCI space.
@param Bus Bus NO of PCI space.
@@ -25,30 +25,31 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @param Func Func NO of PCI space.
@param RomAddress Base address of OptionRom.
@param RomLength Length of rom image.
+
**/
VOID
PciRomAddImageMapping (
- IN EFI_HANDLE ImageHandle,
- IN UINTN Seg,
- IN UINT8 Bus,
- IN UINT8 Dev,
- IN UINT8 Func,
- IN UINT64 RomAddress,
- IN UINT64 RomLength
+ IN EFI_HANDLE ImageHandle,
+ IN UINTN Seg,
+ IN UINT8 Bus,
+ IN UINT8 Dev,
+ IN UINT8 Func,
+ IN UINT64 RomAddress,
+ IN UINT64 RomLength
);
/**
Get Option rom driver's mapping for PCI device.
-
+
@param PciIoDevice Device instance.
@retval TRUE Found Image mapping.
- @retval FALSE
+ @retval FALSE Cannot found image mapping.
**/
BOOLEAN
PciRomGetImageMapping (
- PCI_IO_DEVICE *PciIoDevice
+ IN PCI_IO_DEVICE *PciIoDevice
);
#endif
|