13UINTN gPciRootHpcCount = 0;
33 HpcData->Initialized =
TRUE;
62 if (
CompareMem (DevicePath1, DevicePath2, Size1) != 0) {
99 Status =
gBS->LocateProtocol (
100 &gEfiPciHotPlugInitProtocolGuid,
102 (VOID **)&gPciHotPlugInit
105 if (EFI_ERROR (Status)) {
106 return EFI_UNSUPPORTED;
115 if (!EFI_ERROR (Status)) {
116 gPciRootHpcPool = HpcList;
117 gPciRootHpcCount = HpcCount;
119 if (gPciRootHpcData ==
NULL) {
120 return EFI_OUT_OF_RESOURCES;
146 for (Index = 0; Index < gPciRootHpcCount; Index++) {
148 if (HpIndex !=
NULL) {
178 for (Index = 0; Index < gPciRootHpcCount; Index++) {
180 if (HpIndex !=
NULL) {
208 Status =
gBS->CreateEvent (
212 gPciRootHpcData + HpIndex,
213 &((gPciRootHpcData + HpIndex)->Event)
216 if (!EFI_ERROR (Status)) {
217 *Event = (gPciRootHpcData + HpIndex)->Event;
240 Delay = (UINT32)((TimeoutInMicroSeconds / 30) + 1);
243 for (Index = 0; Index < gPciRootHpcCount; Index++) {
244 if (gPciRootHpcData[Index].Found && !gPciRootHpcData[Index].Initialized) {
249 if (Index == gPciRootHpcCount) {
281 if (PciIoDevice ==
NULL) {
288 EFI_PCI_CAPABILITY_ID_SHPC,
297 if (!EFI_ERROR (Status)) {
330 if (PciIoDevice ==
NULL) {
337 if (!PciIoDevice->IsPciExp) {
341 Offset = PciIoDevice->PciExpressCapabilityOffset +
343 Status = PciIoDevice->PciIo.Pci.Read (
350 if (EFI_ERROR (Status)) {
357 switch (Capability.Bits.DevicePortType) {
358 case PCIE_DEVICE_PORT_TYPE_ROOT_PORT:
359 case PCIE_DEVICE_PORT_TYPE_DOWNSTREAM_PORT:
365 if (!Capability.Bits.SlotImplemented) {
372 Offset = PciIoDevice->PciExpressCapabilityOffset +
374 Status = PciIoDevice->PciIo.Pci.Read (
381 if (EFI_ERROR (Status)) {
388 if (SlotCapability.Bits.HotPlugCapable) {
416 PciAddress = EFI_PCI_ADDRESS (PciIoDevice->BusNumber, PciIoDevice->DeviceNumber, PciIoDevice->FunctionNumber, 0);
419 PciIoDevice->DevicePath,
422 (VOID **)&Descriptors,
426 if (EFI_ERROR (Status)) {
431 PciIoDevice->ResourcePaddingDescriptors = Descriptors;
432 PciIoDevice->PaddingAttributes = Attributes;
453 if (
IsSHPC (PciIoDevice)) {
PACKED struct @89 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
UINTN EFIAPI GetDevicePathSize(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
#define OFFSET_OF(TYPE, Field)
EFI_STATUS LocateCapabilityRegBlock(IN PCI_IO_DEVICE *PciIoDevice, IN UINT8 CapId, IN OUT UINT8 *Offset, OUT UINT8 *NextRegBlock OPTIONAL)
#define EFI_HPC_STATE_ENABLED
EFI_HPC_PADDING_ATTRIBUTES
#define EFI_HPC_STATE_INITIALIZED
EFI_STATUS CreateEventForHpc(IN UINTN HpIndex, OUT EFI_EVENT *Event)
BOOLEAN SupportsPcieHotplug(IN PCI_IO_DEVICE *PciIoDevice)
BOOLEAN IsRootPciHotPlugController(IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath, OUT UINTN *HpIndex)
BOOLEAN IsRootPciHotPlugBus(IN EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath, OUT UINTN *HpIndex OPTIONAL)
VOID GetResourcePaddingForHpb(IN PCI_IO_DEVICE *PciIoDevice)
BOOLEAN EfiCompareDevicePath(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2)
BOOLEAN IsSHPC(IN PCI_IO_DEVICE *PciIoDevice)
BOOLEAN IsPciHotPlugBus(PCI_IO_DEVICE *PciIoDevice)
VOID EFIAPI PciHPCInitialized(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS AllRootHPCInitialized(IN UINTN TimeoutInMicroSeconds)
EFI_STATUS InitializeHotPlugSupport(VOID)
EFI_GET_ROOT_HPC_LIST GetRootHpcList
EFI_GET_HOT_PLUG_PADDING GetResourcePadding