TianoCore EDK2 master
Loading...
Searching...
No Matches
PciEnumeratorSupport.h File Reference

Go to the source code of this file.

Functions

EFI_STATUS PciDevicePresent (IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo, OUT PCI_TYPE00 *Pci, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Func)
 
EFI_STATUS PciPciDeviceInfoCollector (IN PCI_IO_DEVICE *Bridge, IN UINT8 StartBusNumber)
 
EFI_STATUS PciSearchDevice (IN PCI_IO_DEVICE *Bridge, IN PCI_TYPE00 *Pci, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Func, OUT PCI_IO_DEVICE **PciDevice)
 
PCI_IO_DEVICEGatherDeviceInfo (IN PCI_IO_DEVICE *Bridge, IN PCI_TYPE00 *Pci, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Func)
 
PCI_IO_DEVICEGatherPpbInfo (IN PCI_IO_DEVICE *Bridge, IN PCI_TYPE00 *Pci, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Func)
 
PCI_IO_DEVICEGatherP2CInfo (IN PCI_IO_DEVICE *Bridge, IN PCI_TYPE00 *Pci, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Func)
 
EFI_DEVICE_PATH_PROTOCOLCreatePciDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath, IN PCI_IO_DEVICE *PciIoDevice)
 
EFI_STATUS VfBarExisted (IN PCI_IO_DEVICE *PciIoDevice, IN UINTN Offset, OUT UINT32 *BarLengthValue, OUT UINT32 *OriginalBarValue)
 
EFI_STATUS BarExisted (IN PCI_IO_DEVICE *PciIoDevice, IN UINTN Offset, OUT UINT32 *BarLengthValue, OUT UINT32 *OriginalBarValue)
 
VOID PciTestSupportedAttribute (IN PCI_IO_DEVICE *PciIoDevice, IN OUT UINT16 *Command, IN OUT UINT16 *BridgeControl, OUT UINT16 *OldCommand, OUT UINT16 *OldBridgeControl)
 
VOID PciSetDeviceAttribute (IN PCI_IO_DEVICE *PciIoDevice, IN UINT16 Command, IN UINT16 BridgeControl, IN UINTN Option)
 
EFI_STATUS GetFastBackToBackSupport (IN PCI_IO_DEVICE *PciIoDevice, IN UINT8 StatusIndex)
 
EFI_STATUS DetermineDeviceAttribute (IN PCI_IO_DEVICE *PciIoDevice)
 
EFI_STATUS UpdatePciInfo (IN OUT PCI_IO_DEVICE *PciIoDevice, OUT BOOLEAN *IgnoreOptionRom)
 
VOID SetNewAlign (IN OUT UINT64 *Alignment, IN UINT64 NewAlignment)
 
UINTN PciParseBar (IN PCI_IO_DEVICE *PciIoDevice, IN UINTN Offset, IN UINTN BarIndex)
 
UINTN PciIovParseVfBar (IN PCI_IO_DEVICE *PciIoDevice, IN UINTN Offset, IN UINTN BarIndex)
 
VOID InitializePciDevice (IN PCI_IO_DEVICE *PciIoDevice)
 
VOID InitializePpb (IN PCI_IO_DEVICE *PciIoDevice)
 
VOID InitializeP2C (IN PCI_IO_DEVICE *PciIoDevice)
 
PCI_IO_DEVICECreatePciIoDevice (IN PCI_IO_DEVICE *Bridge, IN PCI_TYPE00 *Pci, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Func)
 
EFI_STATUS PciEnumeratorLight (IN EFI_HANDLE Controller)
 
EFI_STATUS PciGetBusRange (IN EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors, OUT UINT16 *MinBus, OUT UINT16 *MaxBus, OUT UINT16 *BusRange)
 
EFI_STATUS StartManagingRootBridge (IN PCI_IO_DEVICE *RootBridgeDev)
 
BOOLEAN IsPciDeviceRejected (IN PCI_IO_DEVICE *PciIoDevice)
 
VOID ResetAllPpbBusNumber (IN PCI_IO_DEVICE *Bridge, IN UINT8 StartBusNumber)
 
VOID DumpPpbPaddingResource (IN PCI_IO_DEVICE *PciIoDevice, IN PCI_BAR_TYPE ResourceType)
 
VOID DumpPciBars (IN PCI_IO_DEVICE *PciIoDevice)
 

Detailed Description

PCI enumeration support functions declaration for PCI Bus module.

Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file PciEnumeratorSupport.h.

Function Documentation

◆ BarExisted()

EFI_STATUS BarExisted ( IN PCI_IO_DEVICE PciIoDevice,
IN UINTN  Offset,
OUT UINT32 *  BarLengthValue,
OUT UINT32 *  OriginalBarValue 
)

Check whether the bar is existed or not.

Parameters
PciIoDeviceA pointer to the PCI_IO_DEVICE.
OffsetThe offset.
BarLengthValueThe bar length value returned.
OriginalBarValueThe original bar value returned.
Return values
EFI_NOT_FOUNDThe bar doesn't exist.
EFI_SUCCESSThe bar exist.

Definition at line 859 of file PciEnumeratorSupport.c.

◆ CreatePciDevicePath()

EFI_DEVICE_PATH_PROTOCOL * CreatePciDevicePath ( IN EFI_DEVICE_PATH_PROTOCOL ParentDevicePath,
IN PCI_IO_DEVICE PciIoDevice 
)

Create device path for pci device.

Parameters
ParentDevicePathParent bridge's path.
PciIoDevicePci device instance.
Returns
Device path protocol instance for specific pci device.

Definition at line 751 of file PciEnumeratorSupport.c.

◆ CreatePciIoDevice()

PCI_IO_DEVICE * CreatePciIoDevice ( IN PCI_IO_DEVICE Bridge,
IN PCI_TYPE00 Pci,
IN UINT8  Bus,
IN UINT8  Device,
IN UINT8  Func 
)

Create and initialize general PCI I/O device instance for PCI device/bridge device/hotplug bridge device.

Parameters
BridgeParent bridge instance.
PciInput Pci information block.
BusDevice Bus NO.
DeviceDevice device NO.
FuncDevice func NO.
Returns
Instance of PCI device. NULL means no instance created.

Definition at line 2171 of file PciEnumeratorSupport.c.

◆ DetermineDeviceAttribute()

EFI_STATUS DetermineDeviceAttribute ( IN PCI_IO_DEVICE PciIoDevice)

Determine the related attributes of all devices under a Root Bridge.

Parameters
PciIoDevicePCI device instance.

Definition at line 1179 of file PciEnumeratorSupport.c.

◆ DumpPciBars()

VOID DumpPciBars ( IN PCI_IO_DEVICE PciIoDevice)

Dump the PCI BAR information.

Parameters
PciIoDevicePCI IO instance.

Definition at line 406 of file PciEnumeratorSupport.c.

◆ DumpPpbPaddingResource()

VOID DumpPpbPaddingResource ( IN PCI_IO_DEVICE PciIoDevice,
IN PCI_BAR_TYPE  ResourceType 
)

Dump the PPB padding resource information.

Parameters
PciIoDevicePCI IO instance.
ResourceTypeThe desired resource type to dump. PciBarTypeUnknown means to dump all types of resources.

Definition at line 334 of file PciEnumeratorSupport.c.

◆ GatherDeviceInfo()

PCI_IO_DEVICE * GatherDeviceInfo ( IN PCI_IO_DEVICE Bridge,
IN PCI_TYPE00 Pci,
IN UINT8  Bus,
IN UINT8  Device,
IN UINT8  Func 
)

Create PCI device instance for PCI device.

Parameters
BridgeParent bridge instance.
PciInput PCI device information block.
BusPCI device Bus NO.
DevicePCI device Device NO.
FuncPCI device's func NO.
Returns
Created PCI device instance.

Definition at line 460 of file PciEnumeratorSupport.c.

◆ GatherP2CInfo()

PCI_IO_DEVICE * GatherP2CInfo ( IN PCI_IO_DEVICE Bridge,
IN PCI_TYPE00 Pci,
IN UINT8  Bus,
IN UINT8  Device,
IN UINT8  Func 
)

Create PCI device instance for PCI Card bridge device.

Parameters
BridgeParent bridge instance.
PciInput PCI device information block.
BusPCI device Bus NO.
DevicePCI device Device NO.
FuncPCI device's func NO.
Returns
Created PCI device instance.

Definition at line 690 of file PciEnumeratorSupport.c.

◆ GatherPpbInfo()

PCI_IO_DEVICE * GatherPpbInfo ( IN PCI_IO_DEVICE Bridge,
IN PCI_TYPE00 Pci,
IN UINT8  Bus,
IN UINT8  Device,
IN UINT8  Func 
)

Create PCI device instance for PCI-PCI bridge.

Parameters
BridgeParent bridge instance.
PciInput PCI device information block.
BusPCI device Bus NO.
DevicePCI device Device NO.
FuncPCI device's func NO.
Returns
Created PCI device instance.

Definition at line 530 of file PciEnumeratorSupport.c.

◆ GetFastBackToBackSupport()

EFI_STATUS GetFastBackToBackSupport ( IN PCI_IO_DEVICE PciIoDevice,
IN UINT8  StatusIndex 
)

Determine if the device can support Fast Back to Back attribute.

Parameters
PciIoDevicePci device instance.
StatusIndexStatus register value.
Return values
EFI_SUCCESSThis device support Fast Back to Back attribute.
EFI_UNSUPPORTEDThis device doesn't support Fast Back to Back attribute.

Definition at line 1112 of file PciEnumeratorSupport.c.

◆ InitializeP2C()

VOID InitializeP2C ( IN PCI_IO_DEVICE PciIoDevice)

This routine is used to initialize the bar of a PCI Card Bridge device.

Parameters
PciIoDevicePCI Card bridge device.

Definition at line 2044 of file PciEnumeratorSupport.c.

◆ InitializePciDevice()

VOID InitializePciDevice ( IN PCI_IO_DEVICE PciIoDevice)

This routine is used to initialize the bar of a PCI device.

Parameters
PciIoDevicePci device instance.
Note
It can be called typically when a device is going to be rejected.

Definition at line 1974 of file PciEnumeratorSupport.c.

◆ InitializePpb()

VOID InitializePpb ( IN PCI_IO_DEVICE PciIoDevice)

This routine is used to initialize the bar of a PCI-PCI Bridge device.

Parameters
PciIoDevicePCI-PCI bridge device instance.

Definition at line 2000 of file PciEnumeratorSupport.c.

◆ IsPciDeviceRejected()

BOOLEAN IsPciDeviceRejected ( IN PCI_IO_DEVICE PciIoDevice)

This routine can be used to check whether a PCI device should be rejected when light enumeration.

Parameters
PciIoDevicePci device instance.
Return values
TRUEThis device should be rejected.
FALSEThis device shouldn't be rejected.

Definition at line 2718 of file PciEnumeratorSupport.c.

◆ PciDevicePresent()

EFI_STATUS PciDevicePresent ( IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL PciRootBridgeIo,
OUT PCI_TYPE00 Pci,
IN UINT8  Bus,
IN UINT8  Device,
IN UINT8  Func 
)

This routine is used to check whether the pci device is present.

Parameters
PciRootBridgeIoPointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
PciOutput buffer for PCI device configuration space.
BusPCI bus NO.
DevicePCI device NO.
FuncPCI Func NO.
Return values
EFI_NOT_FOUNDPCI device not present.
EFI_SUCCESSPCI device is found.

Definition at line 35 of file PciEnumeratorSupport.c.

◆ PciEnumeratorLight()

EFI_STATUS PciEnumeratorLight ( IN EFI_HANDLE  Controller)

This routine is used to enumerate entire pci bus system in a given platform.

It is only called on the second start on the same Root Bridge.

Parameters
ControllerParent bridge handler.
Return values
EFI_SUCCESSPCI enumeration finished successfully.
otherSome error occurred when enumerating the pci bus system.

Definition at line 2520 of file PciEnumeratorSupport.c.

◆ PciGetBusRange()

EFI_STATUS PciGetBusRange ( IN EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **  Descriptors,
OUT UINT16 *  MinBus,
OUT UINT16 *  MaxBus,
OUT UINT16 *  BusRange 
)

Get bus range from PCI resource descriptor list.

Parameters
DescriptorsA pointer to the address space descriptor.
MinBusThe min bus returned.
MaxBusThe max bus returned.
BusRangeThe bus range returned.
Return values
EFI_SUCCESSSuccessfully got bus range.
EFI_NOT_FOUNDCan not find the specific bus.

Definition at line 2630 of file PciEnumeratorSupport.c.

◆ PciIovParseVfBar()

UINTN PciIovParseVfBar ( IN PCI_IO_DEVICE PciIoDevice,
IN UINTN  Offset,
IN UINTN  BarIndex 
)

Parse PCI IOV VF bar information and fill them into PCI device instance.

Parameters
PciIoDevicePci device instance.
OffsetBar offset.
BarIndexBar index.
Returns
Next bar offset.

Definition at line 1574 of file PciEnumeratorSupport.c.

◆ PciParseBar()

UINTN PciParseBar ( IN PCI_IO_DEVICE PciIoDevice,
IN UINTN  Offset,
IN UINTN  BarIndex 
)

Parse PCI bar information and fill them into PCI device instance.

Parameters
PciIoDevicePci device instance.
OffsetBar offset.
BarIndexBar index.
Returns
Next bar offset.

Definition at line 1764 of file PciEnumeratorSupport.c.

◆ PciPciDeviceInfoCollector()

EFI_STATUS PciPciDeviceInfoCollector ( IN PCI_IO_DEVICE Bridge,
IN UINT8  StartBusNumber 
)

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.

Parameters
BridgeParent bridge instance.
StartBusNumberBus number of beginning.
Return values
EFI_SUCCESSPCI device is found.
otherSome error occurred when reading PCI bridge information.

Definition at line 94 of file PciEnumeratorSupport.c.

◆ PciSearchDevice()

EFI_STATUS PciSearchDevice ( IN PCI_IO_DEVICE Bridge,
IN PCI_TYPE00 Pci,
IN UINT8  Bus,
IN UINT8  Device,
IN UINT8  Func,
OUT PCI_IO_DEVICE **  PciDevice 
)

Search required device and create PCI device instance.

Parameters
BridgeParent bridge instance.
PciInput PCI device information block.
BusPCI bus NO.
DevicePCI device NO.
FuncPCI func NO.
PciDeviceOutput of searched PCI device instance.
Return values
EFI_SUCCESSSuccessfully created PCI device instance.
EFI_OUT_OF_RESOURCESCannot get PCI device information.

Definition at line 214 of file PciEnumeratorSupport.c.

◆ PciSetDeviceAttribute()

VOID PciSetDeviceAttribute ( IN PCI_IO_DEVICE PciIoDevice,
IN UINT16  Command,
IN UINT16  BridgeControl,
IN UINTN  Option 
)

Set the supported or current attributes of a PCI device.

Parameters
PciIoDeviceStructure pointer for PCI device.
CommandCommand register value.
BridgeControlBridge control value for PPB or P2C.
OptionMake a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.

Definition at line 999 of file PciEnumeratorSupport.c.

◆ PciTestSupportedAttribute()

VOID PciTestSupportedAttribute ( IN PCI_IO_DEVICE PciIoDevice,
IN OUT UINT16 *  Command,
IN OUT UINT16 *  BridgeControl,
OUT UINT16 *  OldCommand,
OUT UINT16 *  OldBridgeControl 
)

Test whether the device can support given attributes.

Parameters
PciIoDevicePci device instance.
CommandInput command register value, and returned supported register value.
BridgeControlInput bridge control value for PPB or P2C, and returned supported bridge control value.
OldCommandReturned and stored old command register offset.
OldBridgeControlReturned and stored old Bridge control value for PPB or P2C.

Definition at line 924 of file PciEnumeratorSupport.c.

◆ ResetAllPpbBusNumber()

VOID ResetAllPpbBusNumber ( IN PCI_IO_DEVICE Bridge,
IN UINT8  StartBusNumber 
)

Reset all bus number from specific bridge.

Parameters
BridgeParent specific bridge.
StartBusNumberStart bus number.

Definition at line 2819 of file PciEnumeratorSupport.c.

◆ SetNewAlign()

VOID SetNewAlign ( IN OUT UINT64 *  Alignment,
IN UINT64  NewAlignment 
)

This routine will update the alignment with the new alignment.

Parameters
AlignmentInput Old alignment. Output updated alignment.
NewAlignmentNew alignment.

This routine will update the alignment with the new alignment. Compare with OLD_ALIGN/EVEN_ALIGN/SQUAD_ALIGN/DQUAD_ALIGN is to keep backward compatibility.

Parameters
AlignmentInput Old alignment. Output updated alignment.
NewAlignmentNew alignment.

Definition at line 1499 of file PciEnumeratorSupport.c.

◆ StartManagingRootBridge()

EFI_STATUS StartManagingRootBridge ( IN PCI_IO_DEVICE RootBridgeDev)

This routine can be used to start the root bridge.

Parameters
RootBridgeDevPci device instance.
Return values
EFI_SUCCESSThis device started.
otherFailed to get PCI Root Bridge I/O protocol.

Definition at line 2670 of file PciEnumeratorSupport.c.

◆ UpdatePciInfo()

EFI_STATUS UpdatePciInfo ( IN OUT PCI_IO_DEVICE PciIoDevice,
OUT BOOLEAN *  IgnoreOptionRom 
)

This routine is used to update the bar information for those incompatible PCI device.

Parameters
PciIoDeviceInput Pci device instance. Output Pci device instance with updated Bar information.
IgnoreOptionRomOutput If the option rom of incompatible device need to be ignored.
Return values
EFI_SUCCESSSuccessfully updated bar information.
EFI_UNSUPPORTEDGiven PCI device doesn't belong to incompatible PCI device list.

Definition at line 1325 of file PciEnumeratorSupport.c.

◆ VfBarExisted()

EFI_STATUS VfBarExisted ( IN PCI_IO_DEVICE PciIoDevice,
IN UINTN  Offset,
OUT UINT32 *  BarLengthValue,
OUT UINT32 *  OriginalBarValue 
)

Check whether the PCI IOV VF bar is existed or not.

Parameters
PciIoDeviceA pointer to the PCI_IO_DEVICE.
OffsetThe offset.
BarLengthValueThe bar length value returned.
OriginalBarValueThe original bar value returned.
Return values
EFI_NOT_FOUNDThe bar doesn't exist.
EFI_SUCCESSThe bar exist.

Definition at line 785 of file PciEnumeratorSupport.c.