13extern CHAR16 *mBarTypeStr[];
16#define OLD_ALIGN 0xFFFFFFFFFFFFFFFFULL
17#define EVEN_ALIGN 0xFFFFFFFFFFFFFFFEULL
18#define SQUAD_ALIGN 0xFFFFFFFFFFFFFFFDULL
19#define DQUAD_ALIGN 0xFFFFFFFFFFFFFFFCULL
49 Address = EFI_PCI_ADDRESS (Bus, Device, Func, 0);
54 Status = PciRootBridgeIo->Pci.Read (
62 if (!EFI_ERROR (Status) && ((Pci->Hdr).VendorId != 0xffff)) {
66 Status = PciRootBridgeIo->Pci.Read (
96 IN UINT8 StartBusNumber
110 for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {
111 for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {
116 Bridge->PciRootBridgeIo,
118 (UINT8)StartBusNumber,
123 if (EFI_ERROR (Status) && (Func == 0)) {
130 if (!EFI_ERROR (Status)) {
142 (UINT8)StartBusNumber,
156 PciIo = &(PciIoDevice->PciIo);
158 Status = PciIo->Pci.
Read (PciIo, EfiPciIoWidthUint8, PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET, 1, &SecBus);
160 if (EFI_ERROR (Status)) {
168 if (SecBus <= StartBusNumber) {
224 BOOLEAN IgnoreOptionRom;
227 IgnoreOptionRom =
FALSE;
231 "PciBus: Discovered %s @ [%02x|%02x|%02x] [VID = 0x%x, DID = 0x%0x]\n",
251 if ((PciIoDevice !=
NULL) && gFullEnumeration) {
281 if ((PciIoDevice !=
NULL) && gFullEnumeration) {
286 if (PciIoDevice ==
NULL) {
287 return EFI_OUT_OF_RESOURCES;
295 if (PciIoDevice->DevicePath ==
NULL) {
296 return EFI_OUT_OF_RESOURCES;
302 if (gFullEnumeration) {
319 if (PciDevice !=
NULL) {
320 *PciDevice = PciIoDevice;
336 IN PCI_BAR_TYPE ResourceType
342 if (PciIoDevice->ResourcePaddingDescriptors ==
NULL) {
346 if ((ResourceType == PciBarTypeIo16) || (ResourceType == PciBarTypeIo32)) {
347 ResourceType = PciBarTypeIo;
350 for (Descriptor = PciIoDevice->ResourcePaddingDescriptors; Descriptor->Desc != ACPI_END_TAG_DESCRIPTOR; Descriptor++) {
351 Type = PciBarTypeUnknown;
352 if ((Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR) && (Descriptor->ResType == ACPI_ADDRESS_SPACE_TYPE_IO)) {
354 }
else if ((Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR) && (Descriptor->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM)) {
355 if (Descriptor->AddrSpaceGranularity == 32) {
359 if (Descriptor->SpecificFlag == EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE) {
360 Type = PciBarTypePMem32;
366 if (Descriptor->SpecificFlag == 0) {
367 Type = PciBarTypeMem32;
371 if (Descriptor->AddrSpaceGranularity == 64) {
375 if (Descriptor->SpecificFlag == EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE) {
376 Type = PciBarTypePMem64;
382 if (Descriptor->SpecificFlag == 0) {
383 Type = PciBarTypeMem64;
388 if ((Type != PciBarTypeUnknown) && ((ResourceType == PciBarTypeUnknown) || (ResourceType == Type))) {
391 " Padding: Type = %s; Alignment = 0x%lx;\tLength = 0x%lx\n",
393 Descriptor->AddrRangeMax,
412 for (Index = 0; Index < PCI_MAX_BAR; Index++) {
413 if (PciIoDevice->PciBar[Index].BarType == PciBarTypeUnknown) {
419 " BAR[%d]: Type = %s; Alignment = 0x%lx;\tLength = 0x%lx;\tOffset = 0x%02x\n",
421 mBarTypeStr[
MIN (PciIoDevice->PciBar[Index].BarType, PciBarTypeMaxType)],
422 PciIoDevice->PciBar[Index].Alignment,
423 PciIoDevice->PciBar[Index].Length,
424 PciIoDevice->PciBar[Index].Offset
428 for (Index = 0; Index < PCI_MAX_BAR; Index++) {
429 if ((PciIoDevice->VfPciBar[Index].BarType == PciBarTypeUnknown) && (PciIoDevice->VfPciBar[Index].Length == 0)) {
435 " VFBAR[%d]: Type = %s; Alignment = 0x%lx;\tLength = 0x%lx;\tOffset = 0x%02x\n",
437 mBarTypeStr[
MIN (PciIoDevice->VfPciBar[Index].BarType, PciBarTypeMaxType)],
438 PciIoDevice->VfPciBar[Index].Alignment,
439 PciIoDevice->VfPciBar[Index].Length,
440 PciIoDevice->VfPciBar[Index].Offset
444 DEBUG ((DEBUG_INFO,
"\n"));
480 if (PciIoDevice ==
NULL) {
487 if (gFullEnumeration) {
494 for (Offset = 0x10, BarIndex = 0; Offset <= 0x24 && BarIndex < PCI_MAX_BAR; BarIndex++) {
495 Offset =
PciParseBar (PciIoDevice, Offset, BarIndex);
501 if (
PcdGetBool (PcdSrIovSupport) && (PciIoDevice->SrIovCapabilityOffset != 0)) {
502 for (Offset = PciIoDevice->SrIovCapabilityOffset + EFI_PCIE_CAPABILITY_ID_SRIOV_BAR0, BarIndex = 0;
503 Offset <= PciIoDevice->SrIovCapabilityOffset + EFI_PCIE_CAPABILITY_ID_SRIOV_BAR5;
506 ASSERT (BarIndex < PCI_MAX_BAR);
543 UINT32 PMemBaseLimit;
544 UINT16 PrefetchableMemoryBase;
545 UINT16 PrefetchableMemoryLimit;
555 if (PciIoDevice ==
NULL) {
559 if (gFullEnumeration) {
571 if (
PciParseBar (PciIoDevice, 0x10, PPB_BAR_0) == 0x14) {
578 PciIo = &PciIoDevice->PciIo;
583 PciIo->Pci.
Read (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &Temp);
584 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &gAllOne);
585 PciIo->Pci.
Read (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &Value);
586 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &Temp);
589 if ((Value & 0x01) != 0) {
590 PciIoDevice->Decodes |= EFI_BRIDGE_IO32_DECODE_SUPPORTED;
592 PciIoDevice->Decodes |= EFI_BRIDGE_IO16_DECODE_SUPPORTED;
601 PciIoDevice->BridgeIoAlignment = 0xFFF;
608 Value = (UINT8)(Temp ^ (BIT3 | BIT2 | BIT1));
609 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &Value);
610 PciIo->Pci.
Read (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &Value);
611 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &Temp);
612 Value = (UINT8)((Value ^ Temp) & (BIT3 | BIT2 | BIT1));
615 PciIoDevice->BridgeIoAlignment = 0x7FF;
618 PciIoDevice->BridgeIoAlignment = 0x3FF;
620 case BIT3 | BIT2 | BIT1:
621 PciIoDevice->BridgeIoAlignment = 0x1FF;
641 PrefetchableMemoryBase = (UINT16)(PMemBaseLimit & 0xffff);
642 PrefetchableMemoryLimit = (UINT16)(PMemBaseLimit >> 16);
643 if (!EFI_ERROR (Status) &&
644 ((PrefetchableMemoryBase & 0x000f) == 0x0001) &&
645 ((PrefetchableMemoryLimit & 0x000f) == 0x0001))
654 if (!EFI_ERROR (Status)) {
655 PciIoDevice->Decodes |= EFI_BRIDGE_PMEM32_DECODE_SUPPORTED;
656 PciIoDevice->Decodes |= EFI_BRIDGE_PMEM64_DECODE_SUPPORTED;
658 PciIoDevice->Decodes |= EFI_BRIDGE_PMEM32_DECODE_SUPPORTED;
665 PciIoDevice->Decodes |= EFI_BRIDGE_MEM32_DECODE_SUPPORTED;
708 if (PciIoDevice ==
NULL) {
712 if (gFullEnumeration) {
730 PciIoDevice->Decodes = EFI_BRIDGE_MEM32_DECODE_SUPPORTED |
731 EFI_BRIDGE_PMEM32_DECODE_SUPPORTED |
732 EFI_BRIDGE_IO32_DECODE_SUPPORTED;
765 PciNode.
Device = PciIoDevice->DeviceNumber;
766 PciNode.
Function = PciIoDevice->FunctionNumber;
769 return PciIoDevice->DevicePath;
788 OUT UINT32 *BarLengthValue,
789 OUT UINT32 *OriginalBarValue
793 UINT32 OriginalValue;
800 ASSERT (PciIoDevice->SrIovCapabilityOffset != 0);
801 if (PciIoDevice->SrIovCapabilityOffset == 0) {
802 return EFI_NOT_FOUND;
805 PciIo = &PciIoDevice->PciIo;
811 PciIo->Pci.
Read (PciIo, EfiPciIoWidthUint32, (UINT32)Offset, 1, &OriginalValue);
816 OldTpl =
gBS->RaiseTPL (TPL_HIGH_LEVEL);
818 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint32, (UINT32)Offset, 1, &gAllOne);
819 PciIo->Pci.
Read (PciIo, EfiPciIoWidthUint32, (UINT32)Offset, 1, &Value);
824 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint32, (UINT32)Offset, 1, &OriginalValue);
829 gBS->RestoreTPL (OldTpl);
831 if (BarLengthValue !=
NULL) {
832 *BarLengthValue = Value;
835 if (OriginalBarValue !=
NULL) {
836 *OriginalBarValue = OriginalValue;
840 return EFI_NOT_FOUND;
862 OUT UINT32 *BarLengthValue,
863 OUT UINT32 *OriginalBarValue
867 UINT32 OriginalValue;
871 PciIo = &PciIoDevice->PciIo;
876 PciIo->Pci.
Read (PciIo, EfiPciIoWidthUint32, (UINT8)Offset, 1, &OriginalValue);
881 OldTpl =
gBS->RaiseTPL (TPL_HIGH_LEVEL);
883 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint32, (UINT8)Offset, 1, &gAllOne);
884 PciIo->Pci.
Read (PciIo, EfiPciIoWidthUint32, (UINT8)Offset, 1, &Value);
889 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint32, (UINT8)Offset, 1, &OriginalValue);
894 gBS->RestoreTPL (OldTpl);
896 if (BarLengthValue !=
NULL) {
897 *BarLengthValue = Value;
900 if (OriginalBarValue !=
NULL) {
901 *OriginalBarValue = OriginalValue;
905 return EFI_NOT_FOUND;
926 IN OUT UINT16 *Command,
927 IN OUT UINT16 *BridgeControl,
928 OUT UINT16 *OldCommand,
929 OUT UINT16 *OldBridgeControl
943 OldTpl =
gBS->RaiseTPL (TPL_HIGH_LEVEL);
944 CommandValue = *Command | *OldCommand;
949 *Command = *Command & CommandValue;
958 gBS->RestoreTPL (OldTpl);
969 OldTpl =
gBS->RaiseTPL (TPL_HIGH_LEVEL);
982 gBS->RestoreTPL (OldTpl);
984 *OldBridgeControl = 0;
1002 IN UINT16 BridgeControl,
1041 if (Option == EFI_SET_SUPPORTS) {
1062 if (mReserveVgaAliases) {
1082 PciIoDevice->Supports = Attributes;
1083 PciIoDevice->Supports &= ((PciIoDevice->Parent->Supports) | \
1093 if (!PciIoDevice->EmbeddedRom) {
1097 PciIoDevice->Attributes = Attributes;
1114 IN UINT8 StatusIndex
1119 UINT32 StatusRegister;
1124 PciIo = &PciIoDevice->PciIo;
1125 Status = PciIo->Pci.
Read (PciIo, EfiPciIoWidthUint16, StatusIndex, 1, &StatusRegister);
1126 if (EFI_ERROR (Status)) {
1127 return EFI_UNSUPPORTED;
1136 return EFI_UNSUPPORTED;
1158 CurrentLink = PciIoDevice->ChildList.ForwardLink;
1159 while (CurrentLink !=
NULL && CurrentLink != &PciIoDevice->ChildList) {
1160 Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
1168 CurrentLink = CurrentLink->ForwardLink;
1184 UINT16 BridgeControl;
1186 UINT16 OldBridgeControl;
1187 BOOLEAN FastB2BSupport;
1196 if (PciIoDevice->Parent ==
NULL) {
1197 Status = PciIoDevice->PciRootBridgeIo->GetAttributes (
1198 PciIoDevice->PciRootBridgeIo,
1199 &PciIoDevice->Supports,
1200 &PciIoDevice->Attributes
1202 if (EFI_ERROR (Status)) {
1243 if (!PciIoDevice->IsPciExp) {
1248 FastB2BSupport =
TRUE;
1254 FastB2BSupport =
FALSE;
1260 CurrentLink = PciIoDevice->ChildList.ForwardLink;
1261 while (CurrentLink !=
NULL && CurrentLink != &PciIoDevice->ChildList) {
1262 Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
1264 if (EFI_ERROR (Status)) {
1272 if (FastB2BSupport && EFI_ERROR (Status)) {
1273 FastB2BSupport =
FALSE;
1276 CurrentLink = CurrentLink->ForwardLink;
1286 if (EFI_ERROR (Status) || (!FastB2BSupport)) {
1287 FastB2BSupport =
FALSE;
1294 CurrentLink = PciIoDevice->ChildList.ForwardLink;
1295 while (CurrentLink !=
NULL && CurrentLink != &PciIoDevice->ChildList) {
1296 Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
1297 if (FastB2BSupport) {
1303 CurrentLink = CurrentLink->ForwardLink;
1327 OUT BOOLEAN *IgnoreOptionRom
1333 VOID *Configuration;
1336 Configuration =
NULL;
1339 if (gIncompatiblePciDeviceSupport ==
NULL) {
1344 Status =
gBS->LocateProtocol (
1345 &gEfiIncompatiblePciDeviceSupportProtocolGuid,
1347 (VOID **)&gIncompatiblePciDeviceSupport
1356 Status = gIncompatiblePciDeviceSupport->
CheckDevice (
1357 gIncompatiblePciDeviceSupport,
1358 PciIoDevice->Pci.Hdr.VendorId,
1359 PciIoDevice->Pci.Hdr.DeviceId,
1360 PciIoDevice->Pci.Hdr.RevisionID,
1361 PciIoDevice->Pci.Device.SubsystemVendorID,
1362 PciIoDevice->Pci.Device.SubsystemID,
1367 if (EFI_ERROR (Status) || (Configuration ==
NULL)) {
1368 return EFI_UNSUPPORTED;
1376 while (Ptr->Desc != ACPI_END_TAG_DESCRIPTOR) {
1377 if (Ptr->Desc != ACPI_ADDRESS_SPACE_DESCRIPTOR) {
1389 if (((Ptr->AddrTranslationOffset == PCI_MAX_BAR) && (Ptr->SpecificFlag == 0))) {
1390 *IgnoreOptionRom =
TRUE;
1395 for (BarIndex = 0; BarIndex < PCI_MAX_BAR; BarIndex++) {
1396 if ((Ptr->AddrTranslationOffset != MAX_UINT64) &&
1397 (Ptr->AddrTranslationOffset != MAX_UINT8) &&
1398 (Ptr->AddrTranslationOffset != BarIndex)
1410 switch (Ptr->ResType) {
1411 case ACPI_ADDRESS_SPACE_TYPE_MEM:
1416 if (
CheckBarType (PciIoDevice, (UINT8)BarIndex, PciBarTypeMem)) {
1427 if (PciIoDevice->PciBar[BarIndex].BarType == PciBarTypeMem64) {
1428 switch (Ptr->AddrSpaceGranularity) {
1430 PciIoDevice->PciBar[BarIndex].BarType = PciBarTypeMem32;
1432 PciIoDevice->PciBar[BarIndex].BarTypeFixed =
TRUE;
1439 if (PciIoDevice->PciBar[BarIndex].BarType == PciBarTypePMem64) {
1440 switch (Ptr->AddrSpaceGranularity) {
1442 PciIoDevice->PciBar[BarIndex].BarType = PciBarTypePMem32;
1444 PciIoDevice->PciBar[BarIndex].BarTypeFixed =
TRUE;
1454 case ACPI_ADDRESS_SPACE_TYPE_IO:
1459 if (
CheckBarType (PciIoDevice, (UINT8)BarIndex, PciBarTypeIo)) {
1470 SetNewAlign (&(PciIoDevice->PciBar[BarIndex].Alignment), Ptr->AddrRangeMax);
1475 if (Ptr->AddrLen != 0) {
1476 PciIoDevice->PciBar[BarIndex].Length = Ptr->AddrLen;
1500 IN OUT UINT64 *Alignment,
1501 IN UINT64 NewAlignment
1504 UINT64 OldAlignment;
1511 if ((NewAlignment == 0) || (NewAlignment == OLD_ALIGN)) {
1518 if ((NewAlignment != EVEN_ALIGN) &&
1519 (NewAlignment != SQUAD_ALIGN) &&
1520 (NewAlignment != DQUAD_ALIGN))
1522 *Alignment = NewAlignment;
1526 OldAlignment = (*Alignment) + 1;
1532 while ((OldAlignment & 0x0F) == 0x00) {
1533 OldAlignment =
RShiftU64 (OldAlignment, 4);
1540 if (NewAlignment == EVEN_ALIGN) {
1541 if ((OldAlignment & 0x01) != 0) {
1542 OldAlignment = OldAlignment + 2 - (OldAlignment & 0x01);
1544 }
else if (NewAlignment == SQUAD_ALIGN) {
1545 if ((OldAlignment & 0x03) != 0) {
1546 OldAlignment = OldAlignment + 4 - (OldAlignment & 0x03);
1548 }
else if (NewAlignment == DQUAD_ALIGN) {
1549 if ((OldAlignment & 0x07) != 0) {
1550 OldAlignment = OldAlignment + 8 - (OldAlignment & 0x07);
1557 NewAlignment =
LShiftU64 (OldAlignment, ShiftBit) - 1;
1558 *Alignment = NewAlignment;
1581 UINT32 OriginalValue;
1588 ASSERT (PciIoDevice->SrIovCapabilityOffset != 0);
1589 if (PciIoDevice->SrIovCapabilityOffset == 0) {
1603 if (EFI_ERROR (Status)) {
1604 PciIoDevice->VfPciBar[BarIndex].BaseAddress = 0;
1605 PciIoDevice->VfPciBar[BarIndex].Length = 0;
1606 PciIoDevice->VfPciBar[BarIndex].Alignment = 0;
1611 PciIoDevice->VfPciBar[BarIndex].Offset = (UINT16)Offset;
1615 PciIoDevice->VfPciBar[BarIndex].Offset = (UINT16)Offset;
1616 if ((Value & 0x01) != 0) {
1625 PciIoDevice->VfPciBar[BarIndex].BaseAddress = OriginalValue & Mask;
1627 switch (Value & 0x07) {
1632 if ((Value & 0x08) != 0) {
1633 PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypePMem32;
1635 PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeMem32;
1638 PciIoDevice->VfPciBar[BarIndex].Length = (~(Value & Mask)) + 1;
1639 PciIoDevice->VfPciBar[BarIndex].Alignment = PciIoDevice->VfPciBar[BarIndex].Length - 1;
1644 PciIoDevice->VfPciBar[BarIndex].Length =
MultU64x32 (PciIoDevice->VfPciBar[BarIndex].Length, PciIoDevice->InitialVFs);
1648 if (PciIoDevice->VfPciBar[BarIndex].Alignment < PciIoDevice->SystemPageSize - 1) {
1649 PciIoDevice->VfPciBar[BarIndex].Alignment = PciIoDevice->SystemPageSize - 1;
1658 if ((Value & 0x08) != 0) {
1659 PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypePMem64;
1661 PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeMem64;
1671 PciIoDevice->VfPciBar[BarIndex].Length = Value & Mask;
1672 PciIoDevice->VfPciBar[BarIndex].Alignment = PciIoDevice->VfPciBar[BarIndex].Length - 1;
1674 if (PciIoDevice->VfPciBar[BarIndex].Alignment < PciIoDevice->SystemPageSize - 1) {
1675 PciIoDevice->VfPciBar[BarIndex].Alignment = PciIoDevice->SystemPageSize - 1;
1690 if (EFI_ERROR (Status)) {
1691 PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;
1703 PciIoDevice->VfPciBar[BarIndex].BaseAddress |=
LShiftU64 ((UINT64)OriginalValue, 32);
1705 PciIoDevice->VfPciBar[BarIndex].Length = PciIoDevice->VfPciBar[BarIndex].Length |
LShiftU64 ((UINT64)Value, 32);
1706 PciIoDevice->VfPciBar[BarIndex].Length = (~(PciIoDevice->VfPciBar[BarIndex].Length)) + 1;
1707 PciIoDevice->VfPciBar[BarIndex].Alignment = PciIoDevice->VfPciBar[BarIndex].Length - 1;
1712 PciIoDevice->VfPciBar[BarIndex].Length =
MultU64x32 (PciIoDevice->VfPciBar[BarIndex].Length, PciIoDevice->InitialVFs);
1716 if (PciIoDevice->VfPciBar[BarIndex].Alignment < PciIoDevice->SystemPageSize - 1) {
1717 PciIoDevice->VfPciBar[BarIndex].Alignment = PciIoDevice->SystemPageSize - 1;
1726 PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;
1727 PciIoDevice->VfPciBar[BarIndex].Length = (~(Value & Mask)) + 1;
1728 PciIoDevice->VfPciBar[BarIndex].Alignment = PciIoDevice->VfPciBar[BarIndex].Length - 1;
1730 if (PciIoDevice->VfPciBar[BarIndex].Alignment < PciIoDevice->SystemPageSize - 1) {
1731 PciIoDevice->VfPciBar[BarIndex].Alignment = PciIoDevice->SystemPageSize - 1;
1741 if (PciIoDevice->VfPciBar[BarIndex].Length == 0) {
1742 PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeUnknown;
1743 PciIoDevice->VfPciBar[BarIndex].BaseAddress = 0;
1744 PciIoDevice->VfPciBar[BarIndex].Alignment = 0;
1771 UINT32 OriginalValue;
1785 if (EFI_ERROR (Status)) {
1786 PciIoDevice->PciBar[BarIndex].BaseAddress = 0;
1787 PciIoDevice->PciBar[BarIndex].Length = 0;
1788 PciIoDevice->PciBar[BarIndex].Alignment = 0;
1793 PciIoDevice->PciBar[BarIndex].Offset = (UINT8)Offset;
1797 PciIoDevice->PciBar[BarIndex].BarTypeFixed =
FALSE;
1798 PciIoDevice->PciBar[BarIndex].Offset = (UINT8)Offset;
1799 if ((Value & 0x01) != 0) {
1805 if ((Value & 0xFFFF0000) != 0) {
1809 PciIoDevice->PciBar[BarIndex].BarType = PciBarTypeIo32;
1810 PciIoDevice->PciBar[BarIndex].Length = ((~(Value & Mask)) + 1);
1811 PciIoDevice->PciBar[BarIndex].Alignment = PciIoDevice->PciBar[BarIndex].Length - 1;
1816 PciIoDevice->PciBar[BarIndex].BarType = PciBarTypeIo16;
1817 PciIoDevice->PciBar[BarIndex].Length = 0x0000FFFF & ((~(Value & Mask)) + 1);
1818 PciIoDevice->PciBar[BarIndex].Alignment = PciIoDevice->PciBar[BarIndex].Length - 1;
1825 if (PciIoDevice->PciBar[BarIndex].Length == 0) {
1826 PciIoDevice->PciBar[BarIndex].BarType = (PCI_BAR_TYPE)0;
1829 PciIoDevice->PciBar[BarIndex].BaseAddress = OriginalValue & Mask;
1833 PciIoDevice->PciBar[BarIndex].BaseAddress = OriginalValue & Mask;
1835 switch (Value & 0x07) {
1840 if ((Value & 0x08) != 0) {
1841 PciIoDevice->PciBar[BarIndex].BarType = PciBarTypePMem32;
1843 PciIoDevice->PciBar[BarIndex].BarType = PciBarTypeMem32;
1846 PciIoDevice->PciBar[BarIndex].Length = (~(Value & Mask)) + 1;
1847 if (PciIoDevice->PciBar[BarIndex].Length < (SIZE_4KB)) {
1851 PciIoDevice->PciBar[BarIndex].Alignment = (SIZE_4KB - 1);
1853 PciIoDevice->PciBar[BarIndex].Alignment = PciIoDevice->PciBar[BarIndex].Length - 1;
1862 if ((Value & 0x08) != 0) {
1863 PciIoDevice->PciBar[BarIndex].BarType = PciBarTypePMem64;
1865 PciIoDevice->PciBar[BarIndex].BarType = PciBarTypeMem64;
1875 PciIoDevice->PciBar[BarIndex].Length = Value & Mask;
1876 PciIoDevice->PciBar[BarIndex].Alignment = PciIoDevice->PciBar[BarIndex].Length - 1;
1890 if (EFI_ERROR (Status)) {
1894 if (PciIoDevice->PciBar[BarIndex].Length == 0) {
1898 PciIoDevice->PciBar[BarIndex].BarType = PciBarTypeUnknown;
1907 DEBUG ((DEBUG_INFO,
"[PciBus]BAR probing for upper 32bit of MEM64 BAR returns 0, change to 0xFFFFFFFF.\n"));
1916 PciIoDevice->PciBar[BarIndex].BaseAddress |=
LShiftU64 ((UINT64)OriginalValue, 32);
1918 PciIoDevice->PciBar[BarIndex].Length = PciIoDevice->PciBar[BarIndex].Length |
LShiftU64 ((UINT64)Value, 32);
1919 PciIoDevice->PciBar[BarIndex].Length = (~(PciIoDevice->PciBar[BarIndex].Length)) + 1;
1920 if (PciIoDevice->PciBar[BarIndex].Length < (SIZE_4KB)) {
1924 PciIoDevice->PciBar[BarIndex].Alignment = (SIZE_4KB - 1);
1926 PciIoDevice->PciBar[BarIndex].Alignment = PciIoDevice->PciBar[BarIndex].Length - 1;
1935 PciIoDevice->PciBar[BarIndex].BarType = PciBarTypeUnknown;
1936 PciIoDevice->PciBar[BarIndex].Length = (~(Value & Mask)) + 1;
1937 if (PciIoDevice->PciBar[BarIndex].Length < (SIZE_4KB)) {
1941 PciIoDevice->PciBar[BarIndex].Alignment = (SIZE_4KB - 1);
1943 PciIoDevice->PciBar[BarIndex].Alignment = PciIoDevice->PciBar[BarIndex].Length - 1;
1953 if (PciIoDevice->PciBar[BarIndex].Length == 0) {
1954 PciIoDevice->PciBar[BarIndex].BarType = PciBarTypeUnknown;
1955 PciIoDevice->PciBar[BarIndex].BaseAddress = 0;
1956 PciIoDevice->PciBar[BarIndex].Alignment = 0;
1981 PciIo = &(PciIoDevice->PciIo);
1988 for (Offset = 0x10; Offset <= 0x24; Offset +=
sizeof (UINT32)) {
1989 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint32, Offset, 1, &gAllOne);
2006 PciIo = &(PciIoDevice->PciIo);
2013 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &gAllOne);
2014 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint8, 0x1D, 1, &gAllZero);
2016 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint16, 0x20, 1, &gAllOne);
2017 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint16, 0x22, 1, &gAllZero);
2019 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint16, 0x24, 1, &gAllOne);
2020 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint16, 0x26, 1, &gAllZero);
2022 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint32, 0x28, 1, &gAllOne);
2023 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint32, 0x2C, 1, &gAllZero);
2028 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint16, 0x30, 1, &gAllOne);
2029 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint16, 0x32, 1, &gAllZero);
2034 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero);
2050 PciIo = &(PciIoDevice->PciIo);
2057 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint32, 0x1c, 1, &gAllOne);
2058 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint32, 0x20, 1, &gAllZero);
2060 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint32, 0x24, 1, &gAllOne);
2061 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint32, 0x28, 1, &gAllZero);
2063 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint32, 0x2c, 1, &gAllOne);
2064 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint32, 0x30, 1, &gAllZero);
2066 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint32, 0x34, 1, &gAllOne);
2067 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint32, 0x38, 1, &gAllZero);
2072 PciIo->Pci.
Write (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero);
2092 if (mDeviceSecurityProtocol !=
NULL) {
2096 DeviceIdentifier.
Version = EDKII_DEVICE_IDENTIFIER_REVISION;
2099 Status =
gBS->InstallMultipleProtocolInterfaces (
2101 &gEfiDevicePathProtocolGuid,
2102 PciIoDevice->DevicePath,
2104 &PciIoDevice->PciIo,
2107 if (EFI_ERROR (Status)) {
2114 Status = mDeviceSecurityProtocol->DeviceAuthenticate (mDeviceSecurityProtocol, &DeviceIdentifier);
2119 gBS->UninstallMultipleProtocolInterfaces (
2121 &gEfiDevicePathProtocolGuid,
2122 PciIoDevice->DevicePath,
2124 &PciIoDevice->PciIo,
2150 if (PciIoDevice->Parent ==
NULL) {
2184 if (PciIoDevice ==
NULL) {
2188 PciIoDevice->Signature = PCI_IO_DEVICE_SIGNATURE;
2189 PciIoDevice->Handle =
NULL;
2190 PciIoDevice->PciRootBridgeIo = Bridge->PciRootBridgeIo;
2191 PciIoDevice->DevicePath =
NULL;
2192 PciIoDevice->BusNumber = Bus;
2193 PciIoDevice->DeviceNumber = Device;
2194 PciIoDevice->FunctionNumber = Func;
2195 PciIoDevice->Decodes = 0;
2197 if (gFullEnumeration) {
2198 PciIoDevice->Allocated =
FALSE;
2200 PciIoDevice->Allocated =
TRUE;
2203 PciIoDevice->Registered =
FALSE;
2204 PciIoDevice->Attributes = 0;
2205 PciIoDevice->Supports = 0;
2206 PciIoDevice->BusOverride =
FALSE;
2207 PciIoDevice->AllOpRomProcessed =
FALSE;
2209 PciIoDevice->IsPciExp =
FALSE;
2219 PciIo = &PciIoDevice->PciIo;
2232 PciIoDevice->PciExpressCapabilityOffset = 0;
2236 &PciIoDevice->PciExpressCapabilityOffset,
2239 if (!EFI_ERROR (Status)) {
2240 PciIoDevice->IsPciExp =
TRUE;
2250 if (EFI_ERROR (Status)) {
2251 if (PciIoDevice->DevicePath !=
NULL) {
2252 FreePool (PciIoDevice->DevicePath);
2268 EFI_PCIE_CAPABILITY_ID_ARI,
2269 &PciIoDevice->AriCapabilityOffset,
2272 if (!EFI_ERROR (Status)) {
2283 ParentPciIo = &Bridge->PciIo;
2284 ParentPciIo->Pci.
Read (
2286 EfiPciIoWidthUint32,
2287 Bridge->PciExpressCapabilityOffset + EFI_PCIE_CAPABILITY_DEVICE_CAPABILITIES_2_OFFSET,
2291 if ((Data32 & EFI_PCIE_CAPABILITY_DEVICE_CAPABILITIES_2_ARI_FORWARDING) != 0) {
2292 PciIoDevice->IsAriEnabled =
TRUE;
2296 ParentPciIo->Pci.
Read (
2298 EfiPciIoWidthUint32,
2299 Bridge->PciExpressCapabilityOffset + EFI_PCIE_CAPABILITY_DEVICE_CONTROL_2_OFFSET,
2303 if ((Data32 & EFI_PCIE_CAPABILITY_DEVICE_CONTROL_2_ARI_FORWARDING) == 0) {
2304 Data32 |= EFI_PCIE_CAPABILITY_DEVICE_CONTROL_2_ARI_FORWARDING;
2305 ParentPciIo->Pci.
Write (
2307 EfiPciIoWidthUint32,
2308 Bridge->PciExpressCapabilityOffset + EFI_PCIE_CAPABILITY_DEVICE_CONTROL_2_OFFSET,
2314 " ARI: forwarding enabled for PPB[%02x:%02x:%02x]\n",
2316 Bridge->DeviceNumber,
2317 Bridge->FunctionNumber
2322 DEBUG ((DEBUG_INFO,
" ARI: CapOffset = 0x%x\n", PciIoDevice->AriCapabilityOffset));
2333 EFI_PCIE_CAPABILITY_ID_SRIOV,
2334 &PciIoDevice->SrIovCapabilityOffset,
2337 if (!EFI_ERROR (Status)) {
2338 UINT32 SupportedPageSize;
2340 UINT16 FirstVFOffset;
2348 if (
PcdGetBool (PcdAriSupport) && (PciIoDevice->AriCapabilityOffset != 0)) {
2351 EfiPciIoWidthUint16,
2352 PciIoDevice->SrIovCapabilityOffset + EFI_PCIE_CAPABILITY_ID_SRIOV_CONTROL,
2356 Data16 |= EFI_PCIE_CAPABILITY_ID_SRIOV_CONTROL_ARI_HIERARCHY;
2359 EfiPciIoWidthUint16,
2360 PciIoDevice->SrIovCapabilityOffset + EFI_PCIE_CAPABILITY_ID_SRIOV_CONTROL,
2372 EfiPciIoWidthUint32,
2373 PciIoDevice->SrIovCapabilityOffset + EFI_PCIE_CAPABILITY_ID_SRIOV_SUPPORTED_PAGE_SIZE,
2377 PciIoDevice->SystemPageSize = (
PcdGet32 (PcdSrIovSystemPageSize) & SupportedPageSize);
2378 ASSERT (PciIoDevice->SystemPageSize != 0);
2382 EfiPciIoWidthUint32,
2383 PciIoDevice->SrIovCapabilityOffset + EFI_PCIE_CAPABILITY_ID_SRIOV_SYSTEM_PAGE_SIZE,
2385 &PciIoDevice->SystemPageSize
2390 PciIoDevice->SystemPageSize <<= 12;
2401 EfiPciIoWidthUint16,
2402 PciIoDevice->SrIovCapabilityOffset + EFI_PCIE_CAPABILITY_ID_SRIOV_FIRSTVF,
2408 EfiPciIoWidthUint16,
2409 PciIoDevice->SrIovCapabilityOffset + EFI_PCIE_CAPABILITY_ID_SRIOV_INITIALVFS,
2411 &PciIoDevice->InitialVFs
2415 EfiPciIoWidthUint16,
2416 PciIoDevice->SrIovCapabilityOffset + EFI_PCIE_CAPABILITY_ID_SRIOV_VFSTRIDE,
2423 if (PciIoDevice->InitialVFs == 0) {
2424 PciIoDevice->ReservedBusNum = 0;
2426 PFRid = EFI_PCI_RID (Bus, Device, Func);
2427 LastVF = PFRid + FirstVFOffset + (PciIoDevice->InitialVFs - 1) * VFStride;
2432 PciIoDevice->ReservedBusNum = (UINT16)(EFI_PCI_BUS_OF_RID (LastVF) - Bus);
2437 " SR-IOV: SupportedPageSize = 0x%x; SystemPageSize = 0x%x; FirstVFOffset = 0x%x;\n",
2439 PciIoDevice->SystemPageSize >> 12,
2444 " InitialVFs = 0x%x; ReservedBusNum = 0x%x; CapOffset = 0x%x\n",
2445 PciIoDevice->InitialVFs,
2446 PciIoDevice->ReservedBusNum,
2447 PciIoDevice->SrIovCapabilityOffset
2455 EFI_PCIE_CAPABILITY_ID_MRIOV,
2456 &PciIoDevice->MrIovCapabilityOffset,
2459 if (!EFI_ERROR (Status)) {
2460 DEBUG ((DEBUG_INFO,
" MR-IOV: CapOffset = 0x%x\n", PciIoDevice->MrIovCapabilityOffset));
2464 PciIoDevice->ResizableBarOffset = 0;
2465 if (
PcdGetBool (PcdPcieResizableBarSupport)) {
2468 PCI_EXPRESS_EXTENDED_CAPABILITY_RESIZABLE_BAR_ID,
2469 &PciIoDevice->ResizableBarOffset,
2472 if (!EFI_ERROR (Status)) {
2482 &ResizableBarControl
2484 PciIoDevice->ResizableBarNumber = ResizableBarControl.Bits.ResizableBarNumber;
2532 MaxBus = PCI_MAX_BUS;
2545 Status =
gBS->OpenProtocol (
2547 &gEfiPciRootBridgeIoProtocolGuid,
2548 (VOID **)&PciRootBridgeIo,
2551 EFI_OPEN_PROTOCOL_BY_DRIVER
2553 if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
2557 Status = PciRootBridgeIo->Configuration (PciRootBridgeIo, (VOID **)&Descriptors);
2559 if (EFI_ERROR (Status)) {
2569 if (RootBridgeDev ==
NULL) {
2577 RootBridgeDev->PciRootBridgeIo = PciRootBridgeIo;
2584 if (!EFI_ERROR (Status)) {
2634 OUT UINT16 *BusRange
2637 while ((*Descriptors)->Desc != ACPI_END_TAG_DESCRIPTOR) {
2638 if ((*Descriptors)->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS) {
2639 if (MinBus !=
NULL) {
2640 *MinBus = (UINT16)(*Descriptors)->AddrRangeMin;
2643 if (MaxBus !=
NULL) {
2644 *MaxBus = (UINT16)(*Descriptors)->AddrRangeMax;
2647 if (BusRange !=
NULL) {
2648 *BusRange = (UINT16)(*Descriptors)->AddrLen;
2657 return EFI_NOT_FOUND;
2681 RootBridgeHandle = RootBridgeDev->Handle;
2682 PciRootBridgeIo =
NULL;
2687 Status =
gBS->OpenProtocol (
2689 &gEfiPciRootBridgeIoProtocolGuid,
2690 (VOID **)&PciRootBridgeIo,
2693 EFI_OPEN_PROTOCOL_BY_DRIVER
2696 if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
2703 RootBridgeDev->PciRootBridgeIo = PciRootBridgeIo;
2739 for (BarOffset = 0x1C; BarOffset <= 0x38; BarOffset += 2 *
sizeof (UINT32)) {
2740 Mask = (BarOffset < 0x2C) ? 0xFFFFF000 : 0xFFFFFFFC;
2741 Status =
BarExisted (PciIoDevice, BarOffset, &TestValue, &OldValue);
2742 if (EFI_ERROR (Status)) {
2746 TestValue = TestValue & Mask;
2747 if ((TestValue != 0) && (TestValue == (OldValue & Mask))) {
2758 for (BarOffset = 0x14; BarOffset <= 0x24; BarOffset +=
sizeof (UINT32)) {
2762 Status =
BarExisted (PciIoDevice, BarOffset, &TestValue, &OldValue);
2763 if (EFI_ERROR (Status)) {
2767 if ((TestValue & 0x01) != 0) {
2772 TestValue = TestValue & Mask;
2773 if ((TestValue != 0) && (TestValue == (OldValue & Mask))) {
2781 TestValue = TestValue & Mask;
2783 if ((TestValue & 0x07) == 0x04) {
2787 BarOffset +=
sizeof (UINT32);
2788 if ((TestValue != 0) && (TestValue == (OldValue & Mask))) {
2792 Status =
BarExisted (PciIoDevice, BarOffset, &TestValue, &OldValue);
2793 if (TestValue == OldValue) {
2801 if ((TestValue != 0) && (TestValue == (OldValue & Mask))) {
2821 IN UINT8 StartBusNumber
2833 PciRootBridgeIo = Bridge->PciRootBridgeIo;
2835 for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {
2836 for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {
2848 if (EFI_ERROR (Status) && (Func == 0)) {
2857 Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x18);
2858 Status = PciRootBridgeIo->Pci.
Read (
2865 SecondaryBus = (UINT8)(
Register >> 8);
2867 if (SecondaryBus != 0) {
2875 Status = PciRootBridgeIo->Pci.
Write (
2888 Func = PCI_MAX_FUNC;
PACKED struct @89 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
UINT64 EFIAPI RShiftU64(IN UINT64 Operand, IN UINTN Count)
UINT64 EFIAPI MultU64x32(IN UINT64 Multiplicand, IN UINT32 Multiplier)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
UINT64 EFIAPI LShiftU64(IN UINT64 Operand, IN UINTN Count)
INTN EFIAPI HighBitSet32(IN UINT32 Operand)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
#define HARDWARE_DEVICE_PATH
UINT16 EFIAPI SetDevicePathNodeLength(IN OUT VOID *Node, IN UINTN Length)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI AppendDevicePathNode(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL, IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL)
EFI_GUID gEdkiiDeviceIdentifierTypePciGuid
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID RemoveRejectedPciDevices(IN EFI_HANDLE RootBridgeHandle, IN PCI_IO_DEVICE *Bridge)
VOID GetBackPcCardBar(IN PCI_IO_DEVICE *PciIoDevice)
EFI_STATUS PciProgramResizableBar(IN PCI_IO_DEVICE *PciIoDevice, IN PCI_RESIZABLE_BAR_OPERATION ResizableBarOp)
#define DEBUG(Expression)
#define DEBUG_CODE(Expression)
#define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE
Map a memory range so writes are combined.
#define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY
MEM cycles 0xA0000-0xBFFFF (24 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO
I/O cycles 0x1F0-0x1F7, 0x3F6, 0x3F7 (10 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16
I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (16 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE
Clear for an add-in PCI Device.
#define EFI_PCI_IO_ATTRIBUTE_ISA_IO
I/O cycles 0x0100-0x03FF or greater (10 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE
Clear for PCI controllers that can not genrate a DAC.
#define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16
I/O cycles 0x0100-0x03FF or greater (16 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16
I/O cycles 0x3C6, 0x3C8, 0x3C9 (16 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM
Clear for a physical PCI Option ROM accessed through ROM BAR.
#define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED
Map a memory range so all r/w accesses are cached.
#define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO
I/O cycles 0x170-0x177, 0x376, 0x377 (10 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER
Enable the DMA bit in the PCI Config Header.
#define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO
I/O cycles 0x0000-0x00FF (10 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO
I/O cycles 0x3C6, 0x3C8, 0x3C9 (10 bit decode)
#define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE
Disable a memory range.
#define EFI_PCI_IO_ATTRIBUTE_MEMORY
Enable the Memory decode bit in the PCI Config Header.
#define EFI_PCI_IO_ATTRIBUTE_IO
Enable the I/O decode bit in the PCI Config Header.
#define EFI_PCI_IO_ATTRIBUTE_VGA_IO
I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (10 bit decode)
#define PcdGet32(TokenName)
#define PcdGetBool(TokenName)
#define FeaturePcdGet(TokenName)
#define EFI_PCI_BRIDGE_CONTROL_VGA_16
0x0010
#define IS_PCI_BRIDGE(_p)
#define EFI_PCI_COMMAND_MEMORY_WRITE_AND_INVALIDATE
0x0010
#define EFI_PCI_BRIDGE_CONTROL_VGA
0x0008
#define EFI_PCI_COMMAND_MEMORY_SPACE
0x0002
#define EFI_PCI_COMMAND_IO_SPACE
0x0001
#define EFI_PCI_COMMAND_BUS_MASTER
0x0004
#define EFI_PCI_COMMAND_FAST_BACK_TO_BACK
0x0200
#define EFI_PCI_FAST_BACK_TO_BACK_CAPABLE
0x0080
#define IS_PCI_MULTI_FUNC(_p)
#define IS_CARDBUS_BRIDGE(_p)
#define EFI_PCI_BRIDGE_CONTROL_FAST_BACK_TO_BACK
0x0080
#define EFI_PCI_BRIDGE_CONTROL_ISA
0x0004
#define EFI_PCI_COMMAND_VGA_PALETTE_SNOOP
0x0020
#define EFI_PCI_CAPABILITY_ID_PCIEXP
EFI_STATUS LocatePciExpressCapabilityRegBlock(IN PCI_IO_DEVICE *PciIoDevice, IN UINT16 CapId, IN OUT UINT32 *Offset, OUT UINT32 *NextRegBlock OPTIONAL)
EFI_STATUS LocateCapabilityRegBlock(IN PCI_IO_DEVICE *PciIoDevice, IN UINT8 CapId, IN OUT UINT8 *Offset, OUT UINT8 *NextRegBlock OPTIONAL)
#define PCI_SET_BRIDGE_CONTROL_REGISTER(a, b)
#define PCI_READ_COMMAND_REGISTER(a, b)
#define PCI_ENABLE_BRIDGE_CONTROL_REGISTER(a, b)
#define PCI_SET_COMMAND_REGISTER(a, b)
#define PCI_DISABLE_COMMAND_REGISTER(a, b)
#define PCI_DISABLE_BRIDGE_CONTROL_REGISTER(a, b)
#define PCI_ENABLE_COMMAND_REGISTER(a, b)
#define PCI_READ_BRIDGE_CONTROL_REGISTER(a, b)
PCI_IO_DEVICE * CreateRootBridge(IN EFI_HANDLE RootBridgeHandle)
VOID DestroyRootBridge(IN PCI_IO_DEVICE *RootBridge)
VOID InsertRootBridge(IN PCI_IO_DEVICE *RootBridge)
PCI_IO_DEVICE * GetRootBridgeByHandle(EFI_HANDLE RootBridgeHandle)
VOID InsertPciDevice(IN PCI_IO_DEVICE *Bridge, IN PCI_IO_DEVICE *PciDeviceNode)
VOID InitializePciDriverOverrideInstance(IN OUT PCI_IO_DEVICE *PciIoDevice)
EFI_STATUS PreprocessController(IN PCI_IO_DEVICE *Bridge, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Func, IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase)
EFI_STATUS PciPciDeviceInfoCollector(IN PCI_IO_DEVICE *Bridge, IN UINT8 StartBusNumber)
EFI_STATUS StartManagingRootBridge(IN PCI_IO_DEVICE *RootBridgeDev)
VOID DumpPpbPaddingResource(IN PCI_IO_DEVICE *PciIoDevice, IN PCI_BAR_TYPE ResourceType)
PCI_IO_DEVICE * GatherP2CInfo(IN PCI_IO_DEVICE *Bridge, IN PCI_TYPE00 *Pci, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Func)
EFI_STATUS PciDevicePresent(IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo, OUT PCI_TYPE00 *Pci, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Func)
VOID InitializeP2C(IN PCI_IO_DEVICE *PciIoDevice)
PCI_IO_DEVICE * GatherPpbInfo(IN PCI_IO_DEVICE *Bridge, IN PCI_TYPE00 *Pci, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Func)
UINTN PciIovParseVfBar(IN PCI_IO_DEVICE *PciIoDevice, IN UINTN Offset, IN UINTN BarIndex)
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)
EFI_STATUS DetermineDeviceAttribute(IN PCI_IO_DEVICE *PciIoDevice)
BOOLEAN IsRootBridge(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 DumpPciBars(IN PCI_IO_DEVICE *PciIoDevice)
VOID InitializePciDevice(IN PCI_IO_DEVICE *PciIoDevice)
VOID ResetAllPpbBusNumber(IN PCI_IO_DEVICE *Bridge, IN UINT8 StartBusNumber)
UINTN PciParseBar(IN PCI_IO_DEVICE *PciIoDevice, IN UINTN Offset, IN UINTN BarIndex)
PCI_IO_DEVICE * GatherDeviceInfo(IN PCI_IO_DEVICE *Bridge, IN PCI_TYPE00 *Pci, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Func)
EFI_STATUS UpdatePciInfo(IN OUT PCI_IO_DEVICE *PciIoDevice, OUT BOOLEAN *IgnoreOptionRom)
EFI_DEVICE_PATH_PROTOCOL * CreatePciDevicePath(IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath, IN PCI_IO_DEVICE *PciIoDevice)
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)
PCI_IO_DEVICE * CreatePciIoDevice(IN PCI_IO_DEVICE *Bridge, IN PCI_TYPE00 *Pci, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Func)
VOID SetNewAlign(IN OUT UINT64 *Alignment, IN UINT64 NewAlignment)
VOID InitializePpb(IN PCI_IO_DEVICE *PciIoDevice)
EFI_STATUS PciEnumeratorLight(IN EFI_HANDLE Controller)
VOID ProcessOptionRomLight(IN PCI_IO_DEVICE *PciIoDevice)
BOOLEAN IsPciDeviceRejected(IN PCI_IO_DEVICE *PciIoDevice)
EFI_STATUS AuthenticatePciDevice(IN PCI_IO_DEVICE *PciIoDevice)
VOID PciTestSupportedAttribute(IN PCI_IO_DEVICE *PciIoDevice, IN OUT UINT16 *Command, IN OUT UINT16 *BridgeControl, OUT UINT16 *OldCommand, OUT UINT16 *OldBridgeControl)
EFI_STATUS PciGetBusRange(IN EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors, OUT UINT16 *MinBus, OUT UINT16 *MaxBus, OUT UINT16 *BusRange)
@ EfiPciBeforeResourceCollection
BOOLEAN CheckBarType(IN PCI_IO_DEVICE *PciIoDevice, IN UINT8 BarIndex, IN PCI_BAR_TYPE BarType)
VOID InitializePciIoInstance(IN PCI_IO_DEVICE *PciIoDevice)
EFI_STATUS GetOpRomInfo(IN OUT PCI_IO_DEVICE *PciIoDevice)
VOID InitializePciLoadFile2(IN PCI_IO_DEVICE *PciIoDevice)
EFI_STATUS ResetPowerManagementFeature(IN PCI_IO_DEVICE *PciIoDevice)
VOID GetResourcePaddingPpb(IN PCI_IO_DEVICE *PciIoDevice)
BOOLEAN PciRomGetImageMapping(IN PCI_IO_DEVICE *PciIoDevice)
EFI_STATUS EFIAPI Register(IN EFI_PEI_RSC_HANDLER_CALLBACK Callback)
EFI_HANDLE DriverBindingHandle
EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_CHECK_DEVICE CheckDevice
EFI_PCI_IO_PROTOCOL_CONFIG Read
EFI_PCI_IO_PROTOCOL_CONFIG Write
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM Write
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM Read