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

Go to the source code of this file.

Functions

VOID EFIAPI PciHPCInitialized (IN EFI_EVENT Event, IN VOID *Context)
 
BOOLEAN EfiCompareDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2)
 
EFI_STATUS InitializeHotPlugSupport (VOID)
 
BOOLEAN IsRootPciHotPlugBus (IN EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath, OUT UINTN *HpIndex OPTIONAL)
 
BOOLEAN IsRootPciHotPlugController (IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath, OUT UINTN *HpIndex)
 
EFI_STATUS CreateEventForHpc (IN UINTN HpIndex, OUT EFI_EVENT *Event)
 
EFI_STATUS AllRootHPCInitialized (IN UINTN TimeoutInMicroSeconds)
 
BOOLEAN IsSHPC (IN PCI_IO_DEVICE *PciIoDevice)
 
BOOLEAN SupportsPcieHotplug (IN PCI_IO_DEVICE *PciIoDevice)
 
VOID GetResourcePaddingForHpb (IN PCI_IO_DEVICE *PciIoDevice)
 
BOOLEAN IsPciHotPlugBus (PCI_IO_DEVICE *PciIoDevice)
 

Variables

EFI_PCI_HOT_PLUG_INIT_PROTOCOLgPciHotPlugInit = NULL
 
EFI_HPC_LOCATIONgPciRootHpcPool = NULL
 
UINTN gPciRootHpcCount = 0
 
ROOT_HPC_DATAgPciRootHpcData = NULL
 

Detailed Description

PCI Hot Plug support functions implementation for PCI Bus module..

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

Definition in file PciHotPlugSupport.c.

Function Documentation

◆ AllRootHPCInitialized()

EFI_STATUS AllRootHPCInitialized ( IN UINTN  TimeoutInMicroSeconds)

Wait for all root PCI Hot Plug controller finished initializing.

Parameters
TimeoutInMicroSecondsMicroseconds to wait for all root HPCs' initialization.
Return values
EFI_SUCCESSAll HPCs initialization finished.
EFI_TIMEOUTNot ALL HPCs initialization finished in Microseconds.

Definition at line 233 of file PciHotPlugSupport.c.

◆ CreateEventForHpc()

EFI_STATUS CreateEventForHpc ( IN UINTN  HpIndex,
OUT EFI_EVENT Event 
)

Creating event object for PCI Hot Plug controller.

Parameters
HpIndexIndex of hot plug device in global array.
EventThe returned event that invoke this function.
Returns
Status of create event.

Definition at line 201 of file PciHotPlugSupport.c.

◆ EfiCompareDevicePath()

BOOLEAN EfiCompareDevicePath ( IN EFI_DEVICE_PATH_PROTOCOL DevicePath1,
IN EFI_DEVICE_PATH_PROTOCOL DevicePath2 
)

Compare two device paths to check if they are exactly same.

Parameters
DevicePath1A pointer to the first device path data structure.
DevicePath2A pointer to the second device path data structure.
Return values
TRUEThey are same.
FALSEThey are not same.

Definition at line 47 of file PciHotPlugSupport.c.

◆ GetResourcePaddingForHpb()

VOID GetResourcePaddingForHpb ( IN PCI_IO_DEVICE PciIoDevice)

Get resource padding if the specified PCI bridge is a hot plug bus.

Parameters
PciIoDevicePCI bridge instance.

Definition at line 402 of file PciHotPlugSupport.c.

◆ InitializeHotPlugSupport()

EFI_STATUS InitializeHotPlugSupport ( VOID  )

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.

Return values
EFI_SUCCESSThey are same.
EFI_UNSUPPORTEDNo PCI Hot Plug controller on the platform.
EFI_OUT_OF_RESOURCESNo memory to constructor root hot plug private data structure.

Definition at line 83 of file PciHotPlugSupport.c.

◆ IsPciHotPlugBus()

BOOLEAN IsPciHotPlugBus ( PCI_IO_DEVICE PciIoDevice)

Test whether PCI device is hot plug bus.

Parameters
PciIoDevicePCI device instance.
Return values
TRUEPCI device is a hot plug bus.
FALSEPCI device is not a hot plug bus.

Definition at line 449 of file PciHotPlugSupport.c.

◆ IsRootPciHotPlugBus()

BOOLEAN IsRootPciHotPlugBus ( IN EFI_DEVICE_PATH_PROTOCOL HpbDevicePath,
OUT UINTN *HpIndex  OPTIONAL 
)

Test whether device path is for root pci hot plug bus.

Parameters
HpbDevicePathA pointer to device path data structure to be tested.
HpIndexIf HpIndex is not NULL, return the index of root hot plug in global array when TRUE is returned.
Return values
TRUEThe device path is for root pci hot plug bus.
FALSEThe device path is not for root pci hot plug bus.

Definition at line 139 of file PciHotPlugSupport.c.

◆ IsRootPciHotPlugController()

BOOLEAN IsRootPciHotPlugController ( IN EFI_DEVICE_PATH_PROTOCOL HpcDevicePath,
OUT UINTN HpIndex 
)

Test whether device path is for root pci hot plug controller.

Parameters
HpcDevicePathA pointer to device path data structure to be tested.
HpIndexIf HpIndex is not NULL, return the index of root hot plug in global array when TRUE is returned.
Return values
TRUEThe device path is for root pci hot plug controller.
FALSEThe device path is not for root pci hot plug controller.

Definition at line 171 of file PciHotPlugSupport.c.

◆ IsSHPC()

BOOLEAN IsSHPC ( IN PCI_IO_DEVICE PciIoDevice)

Check whether PCI-PCI bridge has PCI Hot Plug capability register block.

Parameters
PciIoDeviceA Pointer to the PCI-PCI bridge.
Return values
TRUEPCI device is HPC.
FALSEPCI device is not HPC.

Definition at line 274 of file PciHotPlugSupport.c.

◆ PciHPCInitialized()

VOID EFIAPI PciHPCInitialized ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Event notification function to set Hot Plug controller status.

Parameters
EventThe event that invoke this function.
ContextThe calling context, pointer to ROOT_HPC_DATA.

Definition at line 25 of file PciHotPlugSupport.c.

◆ SupportsPcieHotplug()

BOOLEAN SupportsPcieHotplug ( IN PCI_IO_DEVICE PciIoDevice)

Check whether PciIoDevice supports PCIe hotplug.

This is equivalent to the following condition:

  • the device is either a PCIe switch downstream port or a root port,
  • and the device has the SlotImplemented bit set in its PCIe capability register,
  • and the device has the HotPlugCapable bit set in its slot capabilities register.
Parameters
[in]PciIoDeviceThe device being checked.
Return values
TRUEPciIoDevice is a PCIe port that accepts a hot-plugged device.
FALSEOtherwise.

Definition at line 321 of file PciHotPlugSupport.c.

Variable Documentation

◆ gPciHotPlugInit

Definition at line 11 of file PciHotPlugSupport.c.

◆ gPciRootHpcCount

UINTN gPciRootHpcCount = 0

Definition at line 13 of file PciHotPlugSupport.c.

◆ gPciRootHpcData

ROOT_HPC_DATA* gPciRootHpcData = NULL

Definition at line 14 of file PciHotPlugSupport.c.

◆ gPciRootHpcPool

EFI_HPC_LOCATION* gPciRootHpcPool = NULL

Definition at line 12 of file PciHotPlugSupport.c.