TianoCore EDK2 master
Loading...
Searching...
No Matches
PciDeviceSupport.c File Reference
#include "PciBus.h"

Go to the source code of this file.

Functions

VOID InitializePciDevicePool (VOID)
 
VOID InsertRootBridge (IN PCI_IO_DEVICE *RootBridge)
 
VOID InsertPciDevice (IN PCI_IO_DEVICE *Bridge, IN PCI_IO_DEVICE *PciDeviceNode)
 
VOID DestroyRootBridge (IN PCI_IO_DEVICE *RootBridge)
 
VOID FreePciDevice (IN PCI_IO_DEVICE *PciIoDevice)
 
VOID DestroyPciDeviceTree (IN PCI_IO_DEVICE *Bridge)
 
EFI_STATUS DestroyRootBridgeByHandle (IN EFI_HANDLE Controller)
 
EFI_STATUS RegisterPciDevice (IN EFI_HANDLE Controller, IN PCI_IO_DEVICE *PciIoDevice, OUT EFI_HANDLE *Handle OPTIONAL)
 
VOID RemoveAllPciDeviceOnBridge (EFI_HANDLE RootBridgeHandle, PCI_IO_DEVICE *Bridge)
 
EFI_STATUS DeRegisterPciDevice (IN EFI_HANDLE Controller, IN EFI_HANDLE Handle)
 
EFI_STATUS StartPciDevicesOnBridge (IN EFI_HANDLE Controller, IN PCI_IO_DEVICE *RootBridge, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath, IN OUT UINT8 *NumberOfChildren, IN OUT EFI_HANDLE *ChildHandleBuffer)
 
EFI_STATUS StartPciDevices (IN EFI_HANDLE Controller)
 
PCI_IO_DEVICECreateRootBridge (IN EFI_HANDLE RootBridgeHandle)
 
PCI_IO_DEVICEGetRootBridgeByHandle (EFI_HANDLE RootBridgeHandle)
 
BOOLEAN PciDeviceExisted (IN PCI_IO_DEVICE *Bridge, IN PCI_IO_DEVICE *PciIoDevice)
 
PCI_IO_DEVICELocateVgaDeviceOnHostBridge (IN EFI_HANDLE HostBridgeHandle)
 
PCI_IO_DEVICELocateVgaDevice (IN PCI_IO_DEVICE *Bridge)
 

Variables

LIST_ENTRY mPciDevicePool
 

Detailed Description

Supporting functions implementation for PCI devices management.

Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
(C) Copyright 2018 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file PciDeviceSupport.c.

Function Documentation

◆ CreateRootBridge()

PCI_IO_DEVICE * CreateRootBridge ( IN EFI_HANDLE  RootBridgeHandle)

Create root bridge device.

Parameters
RootBridgeHandleSpecified root bridge handle.
Returns
The crated root bridge device instance, NULL means no root bridge device instance created.

Definition at line 811 of file PciDeviceSupport.c.

◆ DeRegisterPciDevice()

EFI_STATUS DeRegisterPciDevice ( IN EFI_HANDLE  Controller,
IN EFI_HANDLE  Handle 
)

This function is used to de-register the PCI IO device.

That includes un-installing PciIo protocol from the specified PCI device handle.

Parameters
ControllerAn EFI handle for the PCI bus controller.
HandlePCI device handle.
Return values
EFI_SUCCESSThe PCI device is successfully de-registered.
otherAn error occurred when de-registering the PCI device.

Definition at line 448 of file PciDeviceSupport.c.

◆ DestroyPciDeviceTree()

VOID DestroyPciDeviceTree ( IN PCI_IO_DEVICE Bridge)

Destroy all the pci device node under the bridge. Bridge itself is not included.

Parameters
BridgeA pointer to the PCI_IO_DEVICE.

Definition at line 118 of file PciDeviceSupport.c.

◆ DestroyRootBridge()

VOID DestroyRootBridge ( IN PCI_IO_DEVICE RootBridge)

Destroy root bridge and remove it from device tree.

Parameters
RootBridgeThe bridge want to be removed.

Definition at line 69 of file PciDeviceSupport.c.

◆ DestroyRootBridgeByHandle()

EFI_STATUS DestroyRootBridgeByHandle ( IN EFI_HANDLE  Controller)

Destroy all device nodes under the root bridge specified by Controller.

The root bridge itself is also included.

Parameters
ControllerRoot bridge handle.
Return values
EFI_SUCCESSDestroy all device nodes successfully.
EFI_NOT_FOUNDCannot find any PCI device under specified root bridge.

Definition at line 157 of file PciDeviceSupport.c.

◆ FreePciDevice()

VOID FreePciDevice ( IN PCI_IO_DEVICE PciIoDevice)

Destroy a pci device node.

All direct or indirect allocated resource for this node will be freed.

Parameters
PciIoDeviceA pointer to the PCI_IO_DEVICE to be destroyed.

Definition at line 87 of file PciDeviceSupport.c.

◆ GetRootBridgeByHandle()

PCI_IO_DEVICE * GetRootBridgeByHandle ( EFI_HANDLE  RootBridgeHandle)

Get root bridge device instance by specific root bridge handle.

Parameters
RootBridgeHandleGiven root bridge handle.
Returns
The root bridge device instance, NULL means no root bridge device instance found.

Definition at line 894 of file PciDeviceSupport.c.

◆ InitializePciDevicePool()

VOID InitializePciDevicePool ( VOID  )

Initialize the PCI devices pool.

Definition at line 23 of file PciDeviceSupport.c.

◆ InsertPciDevice()

VOID InsertPciDevice ( IN PCI_IO_DEVICE Bridge,
IN PCI_IO_DEVICE PciDeviceNode 
)

This function is used to insert a PCI device node under a bridge.

Parameters
BridgeThe PCI bridge.
PciDeviceNodeThe PCI device needs inserting.

Definition at line 53 of file PciDeviceSupport.c.

◆ InsertRootBridge()

VOID InsertRootBridge ( IN PCI_IO_DEVICE RootBridge)

Insert a root bridge into PCI device pool.

Parameters
RootBridgeA pointer to the PCI_IO_DEVICE.

Definition at line 37 of file PciDeviceSupport.c.

◆ LocateVgaDevice()

PCI_IO_DEVICE * LocateVgaDevice ( IN PCI_IO_DEVICE Bridge)

Locate the active VGA device under the bridge.

Parameters
BridgePCI IO instance for the bridge.
Returns
The active VGA device.

Definition at line 999 of file PciDeviceSupport.c.

◆ LocateVgaDeviceOnHostBridge()

PCI_IO_DEVICE * LocateVgaDeviceOnHostBridge ( IN EFI_HANDLE  HostBridgeHandle)

Get the active VGA device on the specified Host Bridge.

Parameters
HostBridgeHandleHost Bridge handle.
Returns
The active VGA device on the specified Host Bridge.

Definition at line 964 of file PciDeviceSupport.c.

◆ PciDeviceExisted()

BOOLEAN PciDeviceExisted ( IN PCI_IO_DEVICE Bridge,
IN PCI_IO_DEVICE PciIoDevice 
)

Judge whether Pci device existed.

Parameters
BridgeParent bridge instance.
PciIoDeviceDevice instance.
Return values
TRUEPci device existed.
FALSEPci device did not exist.

Definition at line 926 of file PciDeviceSupport.c.

◆ RegisterPciDevice()

EFI_STATUS RegisterPciDevice ( IN EFI_HANDLE  Controller,
IN PCI_IO_DEVICE PciIoDevice,
OUT EFI_HANDLE *Handle  OPTIONAL 
)

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 parent/child relationship with its bus controller.

Parameters
ControllerAn EFI handle for the PCI bus controller.
PciIoDeviceA PCI_IO_DEVICE pointer to the PCI IO device to be registered.
HandleA pointer to hold the returned EFI handle for the PCI IO device.
Return values
EFI_SUCCESSThe PCI device is successfully registered.
otherAn error occurred when registering the PCI device.

Definition at line 201 of file PciDeviceSupport.c.

◆ RemoveAllPciDeviceOnBridge()

VOID RemoveAllPciDeviceOnBridge ( EFI_HANDLE  RootBridgeHandle,
PCI_IO_DEVICE Bridge 
)

This function is used to remove the whole PCI devices on the specified bridge from the root bridge.

Parameters
RootBridgeHandleThe root bridge device handle.
BridgeThe bridge device to be removed.

Definition at line 401 of file PciDeviceSupport.c.

◆ StartPciDevices()

EFI_STATUS StartPciDevices ( IN EFI_HANDLE  Controller)

Start to manage all the PCI devices it found previously under the entire host bridge.

Parameters
ControllerThe root bridge handle.
Return values
EFI_NOT_READYDevice is not allocated.
EFI_SUCCESSSuccess to start Pci device on host bridge.

Definition at line 766 of file PciDeviceSupport.c.

◆ StartPciDevicesOnBridge()

EFI_STATUS StartPciDevicesOnBridge ( IN EFI_HANDLE  Controller,
IN PCI_IO_DEVICE RootBridge,
IN EFI_DEVICE_PATH_PROTOCOL RemainingDevicePath,
IN OUT UINT8 *  NumberOfChildren,
IN OUT EFI_HANDLE ChildHandleBuffer 
)

Start to manage the PCI device on the specified root bridge or PCI-PCI Bridge.

Parameters
ControllerThe root bridge handle.
RootBridgeA pointer to the PCI_IO_DEVICE.
RemainingDevicePathA pointer to the EFI_DEVICE_PATH_PROTOCOL.
NumberOfChildrenChildren number.
ChildHandleBufferA pointer to the child handle buffer.
Return values
EFI_NOT_READYDevice is not allocated.
EFI_UNSUPPORTEDDevice only support PCI-PCI bridge.
EFI_NOT_FOUNDCan not find the specific device.
EFI_SUCCESSSuccess to start Pci devices on bridge.

Definition at line 606 of file PciDeviceSupport.c.

Variable Documentation

◆ mPciDevicePool

LIST_ENTRY mPciDevicePool

Definition at line 16 of file PciDeviceSupport.c.