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
This commit is contained in:
vanjeff 2009-06-25 13:47:45 +00:00
parent 745ed9b412
commit 8e8227d1a3
33 changed files with 3495 additions and 4074 deletions

View File

@ -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.
**/

View File

@ -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.
**/

View File

@ -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.
//

View File

@ -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.

View File

@ -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
#
#

View File

@ -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;

View File

@ -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)

View File

@ -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 (

View File

@ -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 (

View File

@ -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;
}

View File

@ -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

View File

@ -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
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.
@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.
**/
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.
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.
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.
@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 (

View File

@ -1,18 +1,17 @@
/** @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.
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.
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
@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 (

View File

@ -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;
}

View File

@ -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

View File

@ -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.
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
)
/**
Routine Description:
Arguments:
Returns:
None
**/
// 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
{
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;
}

View File

@ -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, its unit is 100ns
//
#define STALL_1_SECOND 1000000
//
// stall 1 second
// PCI Hot Plug controller private data
//
#define STALL_1_SECOND 1000000
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

File diff suppressed because it is too large Load Diff

View File

@ -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 (

File diff suppressed because it is too large Load Diff

View File

@ -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.
@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
@ -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,

View File

@ -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.
@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
@ -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;
}

View File

@ -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

View File

@ -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 (

View File

@ -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 (

View File

@ -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.
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.
@param Base Base address of resource.
@param Bridge Bridge device instance.
@retval EFI_SUCCESS Success.
**/
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 device instance.
@param PciIoDevice PCI-PCI bridge 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

View File

@ -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;

View File

@ -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

View File

@ -1,15 +1,15 @@
/** @file
PCI Incompatible device support Libary. Platform can implement an
PCI Incompatible device support Libary. Platform can implement an
instance to support the incompatible PCI devices.
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.
**/
@ -65,20 +65,23 @@ typedef struct {
} EFI_PCI_RESOUCE_DESCRIPTOR;
/**
Checks the incompatible device list for ACPI resource update and return
Check the incompatible device list for ACPI resource update and return
the configuration.
This function searches the incompatible device list according to request
information. If the PCI device belongs to the devices list, corresponding
configuration informtion will be returned, in the meantime return EFI_SUCCESS.
@param PciDeviceInfo A pointer to PCI device information.
@param Configuration Returned information.
@param PciDeviceInfo A pointer to PCI device information.
@param Configuration Returned information.
@retval EFI_SUCCESS If check incompatible device successfully.
@retval EFI_ABORTED No any resource type.
@retval EFI_OUT_OF_RESOURCES No memory available.
@retval EFI_UNSUPPORTED Invalid Tag encounted.
@retval EFI_SUCCESS The incompatible device is supported.
@retval EFI_UNSUPPORTED The incompatible device is not supported.
**/
RETURN_STATUS
EFI_STATUS
EFIAPI
PciResourceUpdateCheck (
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
@ -86,7 +89,7 @@ PciResourceUpdateCheck (
);
/**
Checks the incompatible device list and return configuration register mask values.
Check the incompatible device list and return configuraton register mask values.
This function searches the incompatible device list according to request
information. If the PCI device belongs to the devices list, corresponding
@ -97,10 +100,11 @@ PciResourceUpdateCheck (
@param Offset The address within the PCI configuration space.
@param Configuration Returned information.
@retval EFI_SUCCESS The incompatible device is supported.
@retval EFI_UNSUPPORTED The incompatible device is not supported.
@retval EFI_SUCCESS If check incompatible device successfully.
@retval EFI_UNSUPPORTED Failed to check incompatibility device.
**/
RETURN_STATUS
EFI_STATUS
EFIAPI
PciRegisterUpdateCheck (
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
@ -110,7 +114,7 @@ PciRegisterUpdateCheck (
);
/**
Checks the incompatible device list for access width incompatibility and
Check the incompatible device list for access width incompatibility and
return the configuration
This function searches the incompatible device list for access width
@ -124,10 +128,11 @@ PciRegisterUpdateCheck (
@param AccessWidth Access width needs to check incompatibility.
@param Configuration Returned information.
@retval EFI_SUCCESS The incompatible device is supported.
@retval EFI_UNSUPPORTED The incompatible device is not supported.
@retval EFI_SUCCESS If check incompatible device successfully.
@retval EFI_UNSUPPORTED Failed to check incompatibility device.
**/
RETURN_STATUS
EFI_STATUS
EFIAPI
PciRegisterAccessCheck (
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,

View File

@ -1,7 +1,7 @@
/** @file
The incompatible PCI device list
The incompatible PCI device list template.
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
@ -19,7 +19,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
#include <IndustryStandard/Pci22.h>
#include <IndustryStandard/Pci.h>
#include <IndustryStandard/Acpi.h>
@ -51,11 +51,10 @@ typedef struct {
EFI_PCI_REGISTER_VALUE_DATA PciRegisterValueData;
} EFI_PCI_REGISTER_VALUE_DESCRIPTOR;
//
// the incompatible PCI devices list for ACPI resource
//
GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForResource[] = {
GLOBAL_REMOVE_IF_UNREFERENCED UINT64 gIncompatiblePciDeviceListForResource[] = {
//
// DEVICE_INF_TAG,
// PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),
@ -63,76 +62,37 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForResource[] = {
// ResType, GFlag , SFlag, Granularity, RangeMin,
// RangeMax, Offset, AddrLen
//
//
// Device Adaptec 9004
// Sample Device 1
//
DEVICE_INF_TAG,
PCI_DEVICE_ID(0x9004, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
DEVICE_RES_TAG,
PCI_BAR_TYPE_IO,
PCI_ACPI_UNUSED,
PCI_ACPI_UNUSED,
PCI_ACPI_UNUSED,
PCI_ACPI_UNUSED,
PCI_BAR_EVEN_ALIGN,
PCI_BAR_ALL,
PCI_BAR_NOCHANGE,
//DEVICE_INF_TAG,
//PCI_DEVICE_ID(0xXXXX, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
//DEVICE_RES_TAG,
//PCI_BAR_TYPE_IO,
//PCI_ACPI_UNUSED,
//PCI_ACPI_UNUSED,
//PCI_ACPI_UNUSED,
//PCI_ACPI_UNUSED,
//PCI_BAR_EVEN_ALIGN,
//PCI_BAR_ALL,
//PCI_BAR_NOCHANGE,
//
// Device Adaptec 9005
// Sample Device 2
//
DEVICE_INF_TAG,
PCI_DEVICE_ID(0x9005, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
DEVICE_RES_TAG,
PCI_BAR_TYPE_IO,
PCI_ACPI_UNUSED,
PCI_ACPI_UNUSED,
PCI_ACPI_UNUSED,
PCI_ACPI_UNUSED,
PCI_BAR_EVEN_ALIGN,
PCI_BAR_ALL,
PCI_BAR_NOCHANGE,
//
// Device QLogic 1007
//
DEVICE_INF_TAG,
PCI_DEVICE_ID(0x1077, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
DEVICE_RES_TAG,
PCI_BAR_TYPE_IO,
PCI_ACPI_UNUSED,
PCI_ACPI_UNUSED,
PCI_ACPI_UNUSED,
PCI_ACPI_UNUSED,
PCI_BAR_EVEN_ALIGN,
PCI_BAR_ALL,
PCI_BAR_NOCHANGE,
//
// Device Agilent 103C
//
DEVICE_INF_TAG,
PCI_DEVICE_ID(0x103C, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
DEVICE_RES_TAG,
PCI_BAR_TYPE_IO,
PCI_ACPI_UNUSED,
PCI_ACPI_UNUSED,
PCI_ACPI_UNUSED,
PCI_ACPI_UNUSED,
PCI_BAR_EVEN_ALIGN,
PCI_BAR_ALL,
PCI_BAR_NOCHANGE,
//
// Device Agilent 15BC
//
DEVICE_INF_TAG,
PCI_DEVICE_ID(0x15BC, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
DEVICE_RES_TAG,
PCI_BAR_TYPE_IO,
PCI_ACPI_UNUSED,
PCI_ACPI_UNUSED,
PCI_ACPI_UNUSED,
PCI_ACPI_UNUSED,
PCI_BAR_EVEN_ALIGN,
PCI_BAR_ALL,
PCI_BAR_NOCHANGE,
//DEVICE_INF_TAG,
//PCI_DEVICE_ID(0xXXXX, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
//DEVICE_RES_TAG,
//PCI_BAR_TYPE_IO,
//PCI_ACPI_UNUSED,
//PCI_ACPI_UNUSED,
//PCI_ACPI_UNUSED,
//PCI_ACPI_UNUSED,
//PCI_BAR_EVEN_ALIGN,
//PCI_BAR_ALL,
//PCI_BAR_NOCHANGE,
//
// The end of the list
//
@ -142,7 +102,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForResource[] = {
//
// the incompatible PCI devices list for the values of configuration registers
//
GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForRegister[] = {
GLOBAL_REMOVE_IF_UNREFERENCED UINT64 gIncompatiblePciDeviceListForRegister[] = {
//
// DEVICE_INF_TAG,
// PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),
@ -151,26 +111,26 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForRegister[] = {
// AND_VALUE, OR_VALUE
//
// Device Lava 0x1407, DeviceId 0x0110
// Sample Device 1
//
DEVICE_INF_TAG,
PCI_DEVICE_ID(0x1407, 0x0110, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
DEVICE_RES_TAG,
PCI_REGISTER_READ,
PCI_CAPBILITY_POINTER_OFFSET,
0xffffff00,
VALUE_NOCARE,
//DEVICE_INF_TAG,
//PCI_DEVICE_ID(0xXXXX, 0xXXXX, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
//DEVICE_RES_TAG,
//PCI_REGISTER_READ,
//PCI_CAPBILITY_POINTER_OFFSET,
//0xffffff00,
//VALUE_NOCARE,
//
// Device Lava 0x1407, DeviceId 0x0111
// Sample Device 2
//
DEVICE_INF_TAG,
PCI_DEVICE_ID(0x1407, 0x0111, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
DEVICE_RES_TAG,
PCI_REGISTER_READ,
PCI_CAPBILITY_POINTER_OFFSET,
0xffffff00,
VALUE_NOCARE,
//DEVICE_INF_TAG,
//PCI_DEVICE_ID(0xXXXX, 0xXXXX, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
//DEVICE_RES_TAG,
//PCI_REGISTER_READ,
//PCI_CAPBILITY_POINTER_OFFSET,
//0xffffff00,
//VALUE_NOCARE,
//
// The end of the list
@ -181,7 +141,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForRegister[] = {
//
// the incompatible PCI devices list for the access width of configuration registers
//
GLOBAL_REMOVE_IF_UNREFERENCED UINT64 DeviceListForAccessWidth[] = {
GLOBAL_REMOVE_IF_UNREFERENCED UINT64 gDeviceListForAccessWidth[] = {
//
// DEVICE_INF_TAG,
// PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),

View File

@ -1,26 +1,32 @@
/** @file
The implementation of PCI incompatible device support libary.
The template of PCI incompatible device support libary.
Copyright (c) 2006 - 2007, 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 "IncompatiblePciDeviceList.h"
EFI_PCI_REGISTER_ACCESS_DATA mPciRegisterAccessData = {0, 0, 0};
EFI_PCI_REGISTER_VALUE_DATA mPciRegisterValueData = {0, 0};
/**
Check whether two PCI devices matched
Check whether two PCI devices matched.
@param PciDeviceInfo A pointer to EFI_PCI_DEVICE_INFO.
@param Header A pointer to EFI_PCI_DEVICE_INFO.
@param PciDeviceInfo A pointer to EFI_PCI_DEVICE_INFO.
@param Header A pointer to EFI_PCI_DEVICE_INFO.
@retval EFI_SUCCESS Two PCI devices matched.
@retval EFI_UNSUPPORTED Two PCI devices don't match.
@retval returns EFI_SUCCESS if two PCI device matched.
**/
EFI_STATUS
DeviceCheck (
@ -67,19 +73,22 @@ DeviceCheck (
/**
Check the incompatible device list for ACPI resource update and return
the configuration
the configuration.
This function searches the incompatible device list according to request
information. If the PCI device belongs to the devices list, corresponding
configuration informtion will be returned, in the meantime return EFI_SUCCESS.
@param PciDeviceInfo A pointer to PCI device information.
@param Configuration Returned information.
@param PciDeviceInfo A pointer to PCI device information.
@param Configuration Returned information.
@retval EFI_SUCCESS If check incompatible device successfully.
@retval EFI_ABORTED No any resource type.
@retval EFI_OUT_OF_RESOURCES No memory available.
@retval EFI_UNSUPPORTED Invalid Tag encounted.
@retval returns EFI_SUCCESS if check incompatible device ok.
Otherwise return EFI_UNSUPPORTED.
**/
RETURN_STATUS
EFI_STATUS
EFIAPI
PciResourceUpdateCheck (
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
@ -103,7 +112,7 @@ PciResourceUpdateCheck (
//
* (VOID **) Configuration = NULL;
ListPtr = IncompatiblePciDeviceListForResource;
ListPtr = gIncompatiblePciDeviceListForResource;
while (*ListPtr != LIST_END_TAG) {
Tag = *ListPtr;
@ -136,7 +145,7 @@ PciResourceUpdateCheck (
AcpiPtr = AllocateZeroPool (
sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) * Index + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR)
);
);
if (AcpiPtr == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@ -204,10 +213,11 @@ PciResourceUpdateCheck (
@param Offset The address within the PCI configuration space.
@param Configuration Returned information.
@retval returns EFI_SUCCESS if check incompatible device ok.
Otherwise return EFI_UNSUPPORTED.
@retval EFI_SUCCESS If check incompatible device successfully.
@retval EFI_UNSUPPORTED Failed to check incompatibility device.
**/
RETURN_STATUS
EFI_STATUS
EFIAPI
PciRegisterUpdateCheck (
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
@ -224,7 +234,7 @@ PciRegisterUpdateCheck (
ASSERT (PciDeviceInfo != NULL);
ListPtr = IncompatiblePciDeviceListForRegister;
ListPtr = gIncompatiblePciDeviceListForRegister;
//
// Initialize the return value to NULL
@ -257,10 +267,8 @@ PciRegisterUpdateCheck (
if (((EFI_PCI_REGISTER_VALUE_DESCRIPTOR *)ListPtr)->AccessType == AccessType) {
Dsc = (EFI_PCI_REGISTER_VALUE_DATA *) (ListPtr + 2);
RegisterPtr = AllocateZeroPool (sizeof (EFI_PCI_REGISTER_VALUE_DATA));
if (RegisterPtr == NULL) {
return EFI_SUCCESS;
}
RegisterPtr = &mPciRegisterValueData;
RegisterPtr->AndValue = Dsc->AndValue;
RegisterPtr->OrValue = Dsc->OrValue;
@ -304,10 +312,11 @@ PciRegisterUpdateCheck (
@param AccessWidth Access width needs to check incompatibility.
@param Configuration Returned information.
@retval returns EFI_SUCCESS if check incompatible device ok.
Otherwise return EFI_UNSUPPORTED.
@retval EFI_SUCCESS If check incompatible device successfully.
@retval EFI_UNSUPPORTED Failed to check incompatibility device.
**/
RETURN_STATUS
EFI_STATUS
EFIAPI
PciRegisterAccessCheck (
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
@ -325,7 +334,7 @@ PciRegisterAccessCheck (
ASSERT (PciDeviceInfo != NULL);
ListPtr = DeviceListForAccessWidth;
ListPtr = gDeviceListForAccessWidth;
//
// Initialize the return value to NULL
@ -361,10 +370,7 @@ PciRegisterAccessCheck (
if((Dsc->StartOffset <= Offset) && (Dsc->EndOffset > Offset)) {
RegisterPtr = AllocateZeroPool (sizeof (EFI_PCI_REGISTER_ACCESS_DATA));
if (RegisterPtr == NULL) {
return EFI_OUT_OF_RESOURCES;
}
RegisterPtr = &mPciRegisterAccessData;
RegisterPtr->StartOffset = Dsc->StartOffset;
RegisterPtr->EndOffset = Dsc->EndOffset;

View File

@ -1,7 +1,7 @@
#/** @file
# PCI Incompatible device support Library
# PCI Incompatible device support Library template.
#
# Check PCI incompatible devices and set necessary configuration
# Check PCI incompatible devices and set necessary configuration.
# Copyright (c) 2007 - 2009, Intel Corporation.
#
# All rights reserved. This program and the accompanying materials