ReactOS 0.4.17-dev-769-g1500a35
enum.c File Reference
#include <pci.h>
#include <debug.h>
Include dependency graph for enum.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

BOOLEAN NTAPI PciComputeNewCurrentSettings (IN PPCI_PDO_EXTENSION PdoExtension, IN PCM_RESOURCE_LIST ResourceList)
 
VOID NTAPI PcipUpdateHardware (IN PVOID Context, IN PVOID Context2)
 
VOID NTAPI PciUpdateHardware (IN PPCI_PDO_EXTENSION PdoExtension, IN PPCI_COMMON_HEADER PciData)
 
PIO_RESOURCE_REQUIREMENTS_LIST NTAPI PciAllocateIoRequirementsList (IN ULONG Count, IN ULONG BusNumber, IN ULONG SlotNumber)
 
PCM_RESOURCE_LIST NTAPI PciAllocateCmResourceList (IN ULONG Count, IN ULONG BusNumber)
 
NTSTATUS NTAPI PciQueryResources (IN PPCI_PDO_EXTENSION PdoExtension, OUT PCM_RESOURCE_LIST *Buffer)
 
NTSTATUS NTAPI PciQueryTargetDeviceRelations (IN PPCI_PDO_EXTENSION PdoExtension, IN OUT PDEVICE_RELATIONS *pDeviceRelations)
 
NTSTATUS NTAPI PciQueryEjectionRelations (IN PPCI_PDO_EXTENSION PdoExtension, IN OUT PDEVICE_RELATIONS *pDeviceRelations)
 
NTSTATUS NTAPI PciBuildRequirementsList (IN PPCI_PDO_EXTENSION PdoExtension, IN PPCI_COMMON_HEADER PciData, OUT PIO_RESOURCE_REQUIREMENTS_LIST *Buffer)
 
NTSTATUS NTAPI PciQueryRequirements (IN PPCI_PDO_EXTENSION PdoExtension, IN OUT PIO_RESOURCE_REQUIREMENTS_LIST *RequirementsList)
 
BOOLEAN NTAPI PciConfigureIdeController (IN PPCI_PDO_EXTENSION PdoExtension, IN PPCI_COMMON_HEADER PciData, IN BOOLEAN Initial)
 
VOID NTAPI PciApplyHacks (IN PPCI_FDO_EXTENSION DeviceExtension, IN PPCI_COMMON_HEADER PciData, IN PCI_SLOT_NUMBER SlotNumber, IN ULONG OperationType, PPCI_PDO_EXTENSION PdoExtension)
 
BOOLEAN NTAPI PcipIsSameDevice (IN PPCI_PDO_EXTENSION DeviceExtension, IN PPCI_COMMON_HEADER PciData)
 
BOOLEAN NTAPI PciSkipThisFunction (IN PPCI_COMMON_HEADER PciData, IN PCI_SLOT_NUMBER Slot, IN UCHAR OperationType, IN ULONGLONG HackFlags)
 
VOID NTAPI PciGetEnhancedCapabilities (IN PPCI_PDO_EXTENSION PdoExtension, IN PPCI_COMMON_HEADER PciData)
 
VOID NTAPI PciWriteLimitsAndRestoreCurrent (IN PVOID Reserved, IN PVOID Context2)
 
NTSTATUS NTAPI PcipGetFunctionLimits (IN PPCI_CONFIGURATOR_CONTEXT Context)
 
NTSTATUS NTAPI PciGetFunctionLimits (IN PPCI_PDO_EXTENSION PdoExtension, IN PPCI_COMMON_HEADER Current, IN ULONGLONG HackFlags)
 
VOID NTAPI PciProcessBus (IN PPCI_FDO_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI PciScanBus (IN PPCI_FDO_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI PciQueryDeviceRelations (IN PPCI_FDO_EXTENSION DeviceExtension, IN OUT PDEVICE_RELATIONS *pDeviceRelations)
 
NTSTATUS NTAPI PciSetResources (IN PPCI_PDO_EXTENSION PdoExtension, IN BOOLEAN DoReset, IN BOOLEAN SomethingSomethingDarkSide)
 

Variables

PIO_RESOURCE_REQUIREMENTS_LIST PciZeroIoResourceRequirements
 
PCI_CONFIGURATOR PciConfigurators []
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file enum.c.

Function Documentation

◆ PciAllocateCmResourceList()

PCM_RESOURCE_LIST NTAPI PciAllocateCmResourceList ( IN ULONG  Count,
IN ULONG  BusNumber 
)

Definition at line 338 of file enum.c.

340{
341 SIZE_T Size;
343
344 /* Calculate the final size of the list, including each descriptor */
345 Size = sizeof(CM_RESOURCE_LIST);
346 if (Count > 1) Size = sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) * (Count - 1) +
347 sizeof(CM_RESOURCE_LIST);
348
349 /* Allocate the list */
351 if (!ResourceList) return NULL;
352
353 /* Initialize it */
355 ResourceList->Count = 1;
356 ResourceList->List[0].BusNumber = BusNumber;
357 ResourceList->List[0].InterfaceType = PCIBus;
358 ResourceList->List[0].PartialResourceList.Version = 1;
359 ResourceList->List[0].PartialResourceList.Revision = 1;
360 ResourceList->List[0].PartialResourceList.Count = Count;
361
362 /* Return it */
363 return ResourceList;
364}
#define NULL
Definition: types.h:112
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
int Count
Definition: noreturn.cpp:7
_In_ ULONG BusNumber
Definition: pciidex.h:65
struct _CM_RESOURCE_LIST CM_RESOURCE_LIST
@ PCIBus
Definition: restypes.h:126
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR CM_PARTIAL_RESOURCE_DESCRIPTOR
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309

Referenced by PciQueryResources().

◆ PciAllocateIoRequirementsList()

PIO_RESOURCE_REQUIREMENTS_LIST NTAPI PciAllocateIoRequirementsList ( IN ULONG  Count,
IN ULONG  BusNumber,
IN ULONG  SlotNumber 
)

Definition at line 305 of file enum.c.

308{
309 SIZE_T Size;
311
312 /* Calculate the final size of the list, including each descriptor */
314 if (Count > 1) Size = sizeof(IO_RESOURCE_DESCRIPTOR) * (Count - 1) +
316
317 /* Allocate the list */
319 if (!RequirementsList) return NULL;
320
321 /* Initialize it */
323 RequirementsList->AlternativeLists = 1;
324 RequirementsList->BusNumber = BusNumber;
325 RequirementsList->SlotNumber = SlotNumber;
326 RequirementsList->InterfaceType = PCIBus;
327 RequirementsList->ListSize = Size;
328 RequirementsList->List[0].Count = Count;
329 RequirementsList->List[0].Version = 1;
330 RequirementsList->List[0].Revision = 1;
331
332 /* Return it */
333 return RequirementsList;
334}
struct _IO_RESOURCE_DESCRIPTOR IO_RESOURCE_DESCRIPTOR
_In_ WDFIORESREQLIST RequirementsList
Definition: wdfresource.h:65
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
Definition: wdfresource.h:68
struct _IO_RESOURCE_REQUIREMENTS_LIST IO_RESOURCE_REQUIREMENTS_LIST

Referenced by PciBuildRequirementsList().

◆ PciApplyHacks()

VOID NTAPI PciApplyHacks ( IN PPCI_FDO_EXTENSION  DeviceExtension,
IN PPCI_COMMON_HEADER  PciData,
IN PCI_SLOT_NUMBER  SlotNumber,
IN ULONG  OperationType,
PPCI_PDO_EXTENSION  PdoExtension 
)

Definition at line 879 of file enum.c.

884{
885 ULONG LegacyBaseAddress;
887 UCHAR RegValue;
888
890
891 /* Check what kind of hack operation this is */
892 switch (OperationType)
893 {
894 /*
895 * This is mostly concerned with fixing up incorrect class data that can
896 * exist on certain PCI hardware before the 2.0 spec was ratified.
897 */
899
900 /* Note that the i82375 PCI/EISA and the i82378 PCI/ISA bridges that
901 * are present on certain DEC/NT Alpha machines are pre-PCI 2.0 devices
902 * and appear as non-classified, so their correct class/subclass data
903 * is written here instead.
904 */
905 if ((PciData->VendorID == 0x8086) &&
906 ((PciData->DeviceID == 0x482) || (PciData->DeviceID == 0x484)))
907 {
908 /* Note that 0x482 is the i82375 (EISA), 0x484 is the i82378 (ISA) */
909 PciData->SubClass = PciData->DeviceID == 0x482 ?
911 PciData->BaseClass = PCI_CLASS_BRIDGE_DEV;
912
913 /*
914 * Because the software is modifying the actual header data from
915 * the BIOS, this flag tells the driver to ignore failures when
916 * comparing the original BIOS data with the PCI data.
917 */
918 if (PdoExtension) PdoExtension->ExpectedWritebackFailure = TRUE;
919 }
920
921 /* Note that in this case, an immediate return is issued */
922 return;
923
924 /*
925 * This is concerned with setting up interrupts correctly for native IDE
926 * mode, but will also handle broken VGA decoding on older bridges as
927 * well as a PAE-specific hack for certain Compaq Hot-Plug Controllers.
928 */
930
931 /* There should always be a PDO extension passed in */
933
934 /*
935 * On the OPTi Viper-M IDE controller, Linux doesn't support IDE-DMA
936 * and FreeBSD bug reports indicate that the system crashes when the
937 * feature is enabled (so it's disabled on that OS as well). In the
938 * NT PCI Bus Driver, it seems Microsoft too, completely disables
939 * Native IDE functionality on this controller, so it would seem OPTi
940 * simply frelled up this controller.
941 */
942 if ((PciData->VendorID == 0x1045) && (PciData->DeviceID != 0xC621))
943 {
944 /* Disable native mode */
945 PciData->ProgIf &= ~5;
946 PciData->u.type0.InterruptPin = 0;
947
948 /*
949 * Because the software is modifying the actual header data from
950 * the BIOS, this flag tells the driver to ignore failures when
951 * comparing the original BIOS data with the PCI data.
952 */
953 PdoExtension->ExpectedWritebackFailure = TRUE;
954 }
955 else if ((PciData->BaseClass == PCI_CLASS_MASS_STORAGE_CTLR) &&
956 (PciData->SubClass == PCI_SUBCLASS_MSC_IDE_CTLR))
957 {
958 /* For other IDE controllers, start out in compatible mode */
959 PdoExtension->BIOSAllowsIDESwitchToNativeMode = FALSE;
960
961 /*
962 * Registry must have enabled native mode (typically as a result
963 * of an INF file directive part of the IDE controller's driver)
964 * and the system must not be booted in Safe Mode. If that checks
965 * out, then evaluate the ACPI NATA method to see if the platform
966 * supports this. See the section "BIOS and Platform Prerequisites
967 * for Switching a Native-Mode-Capable Controller" in the Storage
968 * section of the Windows Driver Kit for more details:
969 *
970 * 5. For each ATA controller enumerated, the PCI bus driver checks
971 * the Programming Interface register of the IDE controller to
972 * see if it supports switching both channels to native mode.
973 * 6. The PCI bus driver checks whether the BIOS/platform supports
974 * switching the controller by checking the NATA method described
975 * earlier in this article.
976 *
977 * If an ATA controller does not indicate that it is native
978 * mode-capable, or if the BIOS NATA control method is missing
979 * or does not list that device, the PCI bus driver does not
980 * switch the controller and it is assigned legacy resources.
981 *
982 * If both the controller and the BIOS indicate that the controller
983 * can be switched, the process of switching the controller begins
984 * with the next step.
985 */
987 !(InitSafeBootMode) &&
989 {
990 /* The platform supports it, remember that */
991 PdoExtension->BIOSAllowsIDESwitchToNativeMode = TRUE;
992
993 /*
994 * Now switch the controller into native mode if both channels
995 * support native IDE mode. See "How Windows Switches an ATA
996 * Controller to Native Mode" in the Storage section of the
997 * Windows Driver Kit for more details.
998 */
999 PdoExtension->IDEInNativeMode =
1001 }
1002
1003 /* Is native mode enabled after all? */
1004 if ((PciData->ProgIf & 5) != 5)
1005 {
1006 /* Compatible mode, so force ISA-style IRQ14 and IRQ 15 */
1007 PciData->u.type0.InterruptPin = 0;
1008 }
1009 }
1010
1011 /* Is this a PCI device with legacy VGA card decodes on the root bus? */
1012 if ((PdoExtension->HackFlags & PCI_HACK_VIDEO_LEGACY_DECODE) &&
1013 (PCI_IS_ROOT_FDO(DeviceExtension)) &&
1014 !(DeviceExtension->BrokenVideoHackApplied))
1015 {
1016 /* Tell the arbiter to apply a hack for these older devices */
1017 ario_ApplyBrokenVideoHack(DeviceExtension);
1018 }
1019
1020 /* Is this a Compaq PCI Hotplug Controller (r17) on a PAE system ? */
1021 if ((PciData->VendorID == 0xE11) &&
1022 (PciData->DeviceID == 0xA0F7) &&
1023 (PciData->RevisionID == 17) &&
1025 {
1026 /* Turn off the decodes immediately */
1027 PciData->Command &= ~(PCI_ENABLE_IO_SPACE |
1031 &PciData->Command,
1033 sizeof(USHORT));
1034
1035 /* Do not EVER turn them on again, this will blow up the system */
1036 PdoExtension->CommandEnables &= ~(PCI_ENABLE_IO_SPACE |
1040 }
1041 break;
1042
1043 /*
1044 * This is called whenever resources are changed and hardware needs to be
1045 * updated. It is concerned with two highly specific erratas on an IBM
1046 * hot-plug docking bridge used on the Thinkpad 600 Series and on Intel's
1047 * ICH PCI Bridges.
1048 */
1050
1051 /* There should always be a PDO extension passed in */
1053
1054 /* Is this an IBM 20H2999 PCI Docking Bridge, used on Thinkpads? */
1055 if ((PdoExtension->VendorId == 0x1014) &&
1056 (PdoExtension->DeviceId == 0x95))
1057 {
1058 /* Read the current command */
1060 &Command,
1062 sizeof(USHORT));
1063
1064 /* Turn off the decodes */
1066
1067 /* Apply the required IBM workaround */
1068 PciReadDeviceConfig(PdoExtension, &RegValue, 0xE0, sizeof(UCHAR));
1069 RegValue &= ~2;
1070 RegValue |= 1;
1071 PciWriteDeviceConfig(PdoExtension, &RegValue, 0xE0, sizeof(UCHAR));
1072
1073 /* Restore the command to its original value */
1075 &Command,
1077 sizeof(USHORT));
1078
1079 }
1080
1081 /*
1082 * Check for Intel ICH PCI-to-PCI (i82801) bridges (used on the i810,
1083 * i820, i840, i845 Chipsets) that have subtractive decode enabled,
1084 * and whose hack flags do not specify that this support is broken.
1085 */
1086 if ((PdoExtension->HeaderType == PCI_BRIDGE_TYPE) &&
1087 (PdoExtension->Dependent.type1.SubtractiveDecode) &&
1088 ((PdoExtension->VendorId == 0x8086) &&
1089 ((PdoExtension->DeviceId == 0x2418) ||
1090 (PdoExtension->DeviceId == 0x2428) ||
1091 (PdoExtension->DeviceId == 0x244E) ||
1092 (PdoExtension->DeviceId == 0x2448))) &&
1094 {
1095 /*
1096 * The positive decode window shouldn't be used, these values are
1097 * normally all read-only or initialized to 0 by the BIOS, but
1098 * it appears Intel doesn't do this, so the PCI Bus Driver will
1099 * do it in software instead. Note that this is used to prevent
1100 * certain non-compliant PCI devices from breaking down due to the
1101 * fact that these ICH bridges have a known "quirk" (which Intel
1102 * documents as a known "erratum", although it's not not really
1103 * an ICH bug since the PCI specification does allow for it) in
1104 * that they will sometimes send non-zero addresses during special
1105 * cycles (ie: non-zero data during the address phase). These
1106 * broken PCI cards will mistakenly attempt to claim the special
1107 * cycle and corrupt their I/O and RAM ranges. Again, in Intel's
1108 * defense, the PCI specification only requires stable data, not
1109 * necessarily zero data, during the address phase.
1110 */
1111 PciData->u.type1.MemoryBase = 0xFFFF;
1112 PciData->u.type1.PrefetchBase = 0xFFFF;
1113 PciData->u.type1.IOBase = 0xFF;
1114 PciData->u.type1.IOLimit = 0;
1115 PciData->u.type1.MemoryLimit = 0;
1116 PciData->u.type1.PrefetchLimit = 0;
1117 PciData->u.type1.PrefetchBaseUpper32 = 0;
1118 PciData->u.type1.PrefetchLimitUpper32 = 0;
1119 PciData->u.type1.IOBaseUpper16 = 0;
1120 PciData->u.type1.IOLimitUpper16 = 0;
1121 }
1122 break;
1123
1124 default:
1125 return;
1126 }
1127
1128 /* Finally, also check if this is this a CardBUS device? */
1130 {
1131 /*
1132 * At offset 44h the LegacyBaseAddress is stored, which is cleared by
1133 * ACPI-aware versions of Windows, to disable legacy-mode I/O access to
1134 * CardBus controllers. For more information, see "Supporting CardBus
1135 * Controllers under ACPI" in the "CardBus Controllers and Windows"
1136 * Whitepaper on WHDC.
1137 */
1138 LegacyBaseAddress = 0;
1140 &LegacyBaseAddress,
1141 sizeof(PCI_COMMON_HEADER) + sizeof(ULONG),
1142 sizeof(ULONG));
1143 }
1144}
VOID NTAPI ario_ApplyBrokenVideoHack(IN PPCI_FDO_EXTENSION FdoExtension)
Definition: ar_memio.c:104
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOLEAN NTAPI PciConfigureIdeController(IN PPCI_PDO_EXTENSION PdoExtension, IN PPCI_COMMON_HEADER PciData, IN BOOLEAN Initial)
Definition: enum.c:739
BOOLEAN PciEnableNativeModeATA
Definition: init.c:24
NTSYSAPI BOOLEAN InitSafeBootMode
Definition: init.c:71
VOID NTAPI PciWriteDeviceConfig(IN PPCI_PDO_EXTENSION DeviceExtension, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: config.c:121
BOOLEAN NTAPI PciIsSlotPresentInParentMethod(IN PPCI_PDO_EXTENSION PdoExtension, IN ULONG Method)
Definition: utils.c:1094
#define PCI_HACK_FIXUP_BEFORE_UPDATE
Definition: pci.h:72
#define PCI_IS_ROOT_FDO(x)
Definition: pci.h:32
VOID NTAPI PciDecodeEnable(IN PPCI_PDO_EXTENSION PdoExtension, IN BOOLEAN Enable, OUT PUSHORT Command)
Definition: utils.c:1267
#define PCI_HACK_FIXUP_AFTER_CONFIGURATION
Definition: pci.h:71
#define PCI_HACK_FIXUP_BEFORE_CONFIGURATION
Definition: pci.h:70
VOID NTAPI PciReadDeviceConfig(IN PPCI_PDO_EXTENSION DeviceExtension, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: config.c:137
@ PdoExtension
Definition: precomp.h:49
#define ASSERT(a)
Definition: mode.c:44
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
BOOLEAN NTAPI ExIsProcessorFeaturePresent(IN ULONG ProcessorFeature)
Definition: sysinfo.c:363
unsigned short USHORT
Definition: pedump.c:61
#define PCI_HACK_PRESERVE_COMMAND
Definition: pci.h:24
#define PCI_HACK_VIDEO_LEGACY_DECODE
Definition: pci.h:42
#define PCI_HACK_BROKEN_SUBTRACTIVE_DECODE
Definition: pci.h:49
Definition: shell.h:41
unsigned char UCHAR
Definition: typedefs.h:53
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
uint32_t ULONG
Definition: typedefs.h:59
#define PCI_ENABLE_BUS_MASTER
Definition: iotypes.h:3620
#define PCI_SUBCLASS_BR_EISA
Definition: iotypes.h:4166
#define PCI_ENABLE_IO_SPACE
Definition: iotypes.h:3618
#define PCI_CLASS_MASS_STORAGE_CTLR
Definition: iotypes.h:4106
#define PCI_CONFIGURATION_TYPE(PciData)
Definition: iotypes.h:3611
#define PCI_SUBCLASS_MSC_IDE_CTLR
Definition: iotypes.h:4131
#define PCI_ENABLE_MEMORY_SPACE
Definition: iotypes.h:3619
#define PCI_BRIDGE_TYPE
Definition: iotypes.h:3608
#define PCI_SUBCLASS_BR_ISA
Definition: iotypes.h:4165
#define PCI_CLASS_BRIDGE_DEV
Definition: iotypes.h:4111
#define PCI_CARDBUS_BRIDGE_TYPE
Definition: iotypes.h:3609
#define PF_PAE_ENABLED
Definition: ketypes.h:185

Referenced by PciScanBus(), and PciSetResources().

◆ PciBuildRequirementsList()

NTSTATUS NTAPI PciBuildRequirementsList ( IN PPCI_PDO_EXTENSION  PdoExtension,
IN PPCI_COMMON_HEADER  PciData,
OUT PIO_RESOURCE_REQUIREMENTS_LIST Buffer 
)

Definition at line 565 of file enum.c.

568{
572 ULONG Count, i;
573 BOOLEAN HaveInterrupt;
574
575 PAGED_CODE();
576
577 /* Count the BAR limits that resource discovery found for this function */
578 Count = 0;
579 if (PdoExtension->Resources)
580 {
581 for (i = 0; i < (PCI_TYPE0_ADDRESSES + 1); i++)
582 {
583 if (PdoExtension->Resources->Limit[i].Type != CmResourceTypeNull)
584 Count++;
585 }
586 }
587
588 /* A device with an interrupt pin also needs a line routed to it */
589 HaveInterrupt = (PdoExtension->InterruptPin) &&
591 if (HaveInterrupt)
592 Count++;
593
594 /* And a bridge with legacy decodes enabled needs those ranges locked down */
595 Count += PdoExtension->AdditionalResourceCount;
596
597 /* Check if the function turned out to need nothing after all */
598 if (!Count)
599 {
600 /* There aren't, so use the zero descriptor */
602
603 /* Does it actually exist yet? */
605 {
606 /* Allocate it, and use it for future use */
610 }
611
613 DPRINT1("PCI - build resource reqs - early out, 0 resources\n");
614 return STATUS_SUCCESS;
615 }
616
618 PdoExtension->ParentFdoExtension->BaseBus,
619 PdoExtension->Slot.u.AsULONG);
620 if (!RequirementsList)
622
623 Descriptor = RequirementsList->List[0].Descriptors;
624
625 /* Emit one descriptor per BAR that decoded something during discovery */
626 if (PdoExtension->Resources)
627 {
628 Limit = PdoExtension->Resources->Limit;
629 for (i = 0; i < (PCI_TYPE0_ADDRESSES + 1); i++)
630 {
631 /* Skip the BARs this function does not implement */
633 continue;
634
635 /* A BAR decodes for one function only, so it cannot be shared */
636 *Descriptor = Limit[i];
637 Descriptor->ShareDisposition = CmResourceShareDeviceExclusive;
638 Descriptor++;
639 }
640 }
641
642 if (HaveInterrupt)
643 {
645 Descriptor->ShareDisposition = CmResourceShareShared;
647 Descriptor->u.Interrupt.MinimumVector = 0;
648 Descriptor->u.Interrupt.MaximumVector = MAXULONG;
649 Descriptor++;
650 }
651
652 /* And finally any extra ranges this kind of function decodes on the side */
653 if (PdoExtension->AdditionalResourceCount)
654 {
655 RtlZeroMemory(&Context, sizeof(Context));
656 Context.PdoExtension = PdoExtension;
657 Context.Current = PciData;
658 PciConfigurators[PdoExtension->HeaderType].
659 GetAdditionalResourceDescriptors(&Context, PciData, Descriptor);
660 }
661
663 return STATUS_SUCCESS;
664}
#define PAGED_CODE()
Type
Definition: Type.h:7
unsigned char BOOLEAN
Definition: actypes.h:127
#define DPRINT1
Definition: precomp.h:8
Definition: bufpool.h:45
PIO_RESOURCE_REQUIREMENTS_LIST PciZeroIoResourceRequirements
Definition: enum.c:18
PIO_RESOURCE_REQUIREMENTS_LIST NTAPI PciAllocateIoRequirementsList(IN ULONG Count, IN ULONG BusNumber, IN ULONG SlotNumber)
Definition: enum.c:305
PCI_CONFIGURATOR PciConfigurators[]
Definition: enum.c:20
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define CmResourceTypeNull
Definition: restypes.h:103
#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE
Definition: restypes.h:116
#define CmResourceTypeInterrupt
Definition: restypes.h:105
#define PCI_HACK_NO_ENUM_AT_ALL
Definition: pci.h:13
#define STATUS_SUCCESS
Definition: shellext.h:65
_In_ PVOID Context
Definition: storport.h:2269
#define MAXULONG
Definition: typedefs.h:251
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
@ CmResourceShareDeviceExclusive
Definition: cmtypes.h:241
@ CmResourceShareShared
Definition: cmtypes.h:243
#define PCI_TYPE0_ADDRESSES
Definition: iotypes.h:3502
_In_ LONG _In_ LONG Limit
Definition: kefuncs.h:304

Referenced by PciAssignSlotResources(), and PciQueryRequirements().

◆ PciComputeNewCurrentSettings()

BOOLEAN NTAPI PciComputeNewCurrentSettings ( IN PPCI_PDO_EXTENSION  PdoExtension,
IN PCM_RESOURCE_LIST  ResourceList 
)

Definition at line 55 of file enum.c.

57{
58 PCM_PARTIAL_RESOURCE_DESCRIPTOR Partial, InterruptResource;
59 PCM_PARTIAL_RESOURCE_DESCRIPTOR CurrentDescriptor;
60 CM_PARTIAL_RESOURCE_DESCRIPTOR ResourceArray[7];
61 ULONG BarIndex;
63 BOOLEAN RangeChange;
64 ULONG DrainPartial;
65 ULONG i, j;
66 PPCI_FUNCTION_RESOURCES PciResources;
67 PAGED_CODE();
68
69 /* Make sure we have either no resources, or at least one */
70 ASSERT((ResourceList == NULL) || (ResourceList->Count == 1));
71
72 /* Initialize no partial, interrupt descriptor, or range change */
73 Partial = NULL;
74 InterruptResource = NULL;
75 RangeChange = FALSE;
76 BarIndex = 0;
77
78 /* The limits say which BARs this function implements, so the walk below
79 * can tell which BAR each assigned descriptor belongs to */
80 PciResources = PdoExtension->Resources;
81
82 /* Check if there's not actually any resources */
83 if (!(ResourceList) || !(ResourceList->Count))
84 {
85 /* Then just return the hardware update state */
86 return PdoExtension->UpdateHardware;
87 }
88
89 /* Print the new specified resource list */
91
92 /* Clear the temporary resource array */
93 for (i = 0; i < 7; i++) ResourceArray[i].Type = CmResourceTypeNull;
94
95 /* Loop the full resource descriptor */
96 FullList = ResourceList->List;
97 for (i = 0; i < ResourceList->Count; i++)
98 {
99 /* Initialize loop variables */
100 DrainPartial = 0;
101
102 /* Loop the partial descriptors */
103 Partial = FullList->PartialResourceList.PartialDescriptors;
104 for (j = 0; j < FullList->PartialResourceList.Count; j++)
105 {
106 /* Check if we were supposed to drain a partial due to device data */
107 if (DrainPartial)
108 {
109 DrainPartial--;
110 Partial = CmiGetNextPartialDescriptor(Partial);
111 continue;
112 }
113
114 /* Check what kind of descriptor this was */
115 switch (Partial->Type)
116 {
117 /* Base BAR resources */
120 {
121 /*
122 * Skip legacy/shared resources (e.g., VGA ports 0x3B0-0x3DF, memory 0xA0000).
123 * should not be placed in the ResourceArray.
124 */
126 {
127 break;
128 }
129
130 /*
131 * The assigned descriptors come back in the order the
132 * requirements list asked for them, so walking the limits
133 * in that same order says which BAR this one satisfies.
134 */
135 if (PciResources)
136 {
137 while ((BarIndex < RTL_NUMBER_OF(ResourceArray)) &&
138 (PciResources->Limit[BarIndex].Type == CmResourceTypeNull))
139 {
140 BarIndex++;
141 }
142
143 if (BarIndex < RTL_NUMBER_OF(ResourceArray))
144 ResourceArray[BarIndex++] = *Partial;
145 }
146 break;
147 }
148 /* Interrupt resource */
150
151 /* Make sure it's a compatible (and the only) PCI interrupt */
152 ASSERT(InterruptResource == NULL);
153 ASSERT(Partial->u.Interrupt.Level == Partial->u.Interrupt.Vector);
154 InterruptResource = Partial;
155
156 /* Only 255 interrupts on x86/x64 hardware */
157 if (Partial->u.Interrupt.Level < 256)
158 {
159 /* Use the passed interrupt line */
160 PdoExtension->AdjustedInterruptLine = Partial->u.Interrupt.Level;
161 }
162 else
163 {
164 /* Invalid vector, so ignore it */
165 PdoExtension->AdjustedInterruptLine = 0;
166 }
167
168 break;
169
170 /* Check for specific device data */
172
173 /* Check what kind of data this was */
174 switch (Partial->u.DevicePrivate.Data[0])
175 {
176 /* Not used in the driver yet */
177 case 1:
179 break;
180
181 /* Not used in the driver yet */
182 case 2:
184 break;
185
186 /* A drain request */
187 case 3:
188 DrainPartial = Partial->u.DevicePrivate.Data[1];
189 break;
190 }
191 break;
192 }
193
194 /* Move to the next descriptor */
195 Partial = CmiGetNextPartialDescriptor(Partial);
196 }
197
198 /* We should be starting a new list now */
199 FullList = (PVOID)Partial;
200 }
201
202 /* A function with no discovered resources has nothing to update */
203 if (!PciResources) return FALSE;
204
205 /* Loop all the PCI function resources */
206 for (i = 0; i < RTL_NUMBER_OF(ResourceArray); i++)
207 {
208 /* Get the current function resource descriptor, and the new one */
209 CurrentDescriptor = &PciResources->Current[i];
210 Partial = &ResourceArray[i];
211
212 /* Check if this new descriptor is different than the old one */
213 if ((Partial->Type != CurrentDescriptor->Type) ||
214 ((Partial->Type != CmResourceTypeNull) &&
215 ((Partial->u.Generic.Start.QuadPart !=
216 CurrentDescriptor->u.Generic.Start.QuadPart) ||
217 (Partial->u.Generic.Length != CurrentDescriptor->u.Generic.Length))))
218 {
219 /* Record a change */
220 RangeChange = TRUE;
221
222 /* Was there a range before? */
223 if (CurrentDescriptor->Type != CmResourceTypeNull)
224 {
225 /* Print it */
226 DbgPrint(" Old range-\n");
227 PciDebugPrintPartialResource(CurrentDescriptor);
228 }
229 else
230 {
231 /* There was no range */
232 DbgPrint(" Previously unset range\n");
233 }
234
235 /* Print new one */
236 DbgPrint(" changed to\n");
238
239 /* Update to new range */
240 CurrentDescriptor->Type = Partial->Type;
241 CurrentDescriptor->u.Generic.Start = Partial->u.Generic.Start;
242 CurrentDescriptor->u.Generic.Length = Partial->u.Generic.Length;
243 }
244 }
245
246 /* Either the hardware was updated, or a resource range changed */
247 return ((RangeChange) || (PdoExtension->UpdateHardware));
248}
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
FORCEINLINE PCM_PARTIAL_RESOURCE_DESCRIPTOR CmiGetNextPartialDescriptor(_In_ const CM_PARTIAL_RESOURCE_DESCRIPTOR *PartialDescriptor)
Definition: cmreslist.h:31
VOID NTAPI PciDebugPrintPartialResource(IN PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialResource)
Definition: debug.c:348
VOID NTAPI PciDebugPrintCmResList(IN PCM_RESOURCE_LIST PartialList)
Definition: debug.c:364
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define DbgPrint
Definition: hal.h:12
#define CmResourceTypeMemory
Definition: restypes.h:106
#define CmResourceTypeDevicePrivate
Definition: restypes.h:112
#define CmResourceTypePort
Definition: restypes.h:104
CM_PARTIAL_RESOURCE_LIST PartialResourceList
Definition: restypes.h:144
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@398::@405 DevicePrivate
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@398 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@398::@399 Generic
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@398::@401 Interrupt
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: restypes.h:100
IO_RESOURCE_DESCRIPTOR Limit[7]
Definition: pci.h:237
CM_PARTIAL_RESOURCE_DESCRIPTOR Current[7]
Definition: pci.h:238
void * PVOID
Definition: typedefs.h:50
@ CmResourceShareDriverExclusive
Definition: cmtypes.h:242

Referenced by PciAssignSlotResources(), and PciPdoIrpStartDevice().

◆ PciConfigureIdeController()

BOOLEAN NTAPI PciConfigureIdeController ( IN PPCI_PDO_EXTENSION  PdoExtension,
IN PPCI_COMMON_HEADER  PciData,
IN BOOLEAN  Initial 
)

Definition at line 739 of file enum.c.

742{
743 UCHAR MasterMode, SlaveMode, MasterFixed, SlaveFixed, ProgIf, NewProgIf;
744 BOOLEAN Switched;
746
747 /* Assume it won't work */
748 Switched = FALSE;
749
750 /* Get master and slave current settings, and programmability flag */
751 ProgIf = PciData->ProgIf;
752 MasterMode = (ProgIf & 1) == 1;
753 MasterFixed = (ProgIf & 2) == 0;
754 SlaveMode = (ProgIf & 4) == 4;
755 SlaveFixed = (ProgIf & 8) == 0;
756
757 /*
758 * [..] In order for Windows XP SP1 and Windows Server 2003 to switch an ATA
759 * ATA controller from compatible mode to native mode, the following must be
760 * true:
761 *
762 * - The controller must indicate in its programming interface that both channels
763 * can be switched to native mode. Windows XP SP1 and Windows Server 2003 do
764 * not support switching only one IDE channel to native mode. See the PCI IDE
765 * Controller Specification Revision 1.0 for details.
766 */
767 if ((MasterMode != SlaveMode) || (MasterFixed != SlaveFixed))
768 {
769 /* Windows does not support this configuration, fail */
770 DPRINT1("PCI: Warning unsupported IDE controller configuration for VEN_%04x&DEV_%04x!",
771 PdoExtension->VendorId,
772 PdoExtension->DeviceId);
773 return Switched;
774 }
775
776 /* Check if the controller is already in native mode */
777 if ((MasterMode) && (SlaveMode))
778 {
779 /* Check if I/O decodes should be disabled */
780 if ((Initial) || (PdoExtension->IoSpaceUnderNativeIdeControl))
781 {
782 /* Read the current command */
784 &Command,
786 sizeof(USHORT));
787
788 /* Disable I/O space decode */
789 Command &= ~PCI_ENABLE_IO_SPACE;
790
791 /* Update new command in PCI IDE controller */
793 &Command,
795 sizeof(USHORT));
796
797 /* Save updated command value */
798 PciData->Command = Command;
799 }
800
801 /* The controller is now in native mode */
802 Switched = TRUE;
803 }
804 else if (!(MasterFixed) &&
805 !(SlaveFixed) &&
806 (PdoExtension->BIOSAllowsIDESwitchToNativeMode) &&
808 {
809 /* Turn off decodes */
811
812 /* Update the current command */
814 &PciData->Command,
816 sizeof(USHORT));
817
818 /* Enable native mode */
819 ProgIf = PciData->ProgIf | 5;
821 &ProgIf,
823 sizeof(UCHAR));
824
825 /* Verify the setting "stuck" */
827 &NewProgIf,
829 sizeof(UCHAR));
830 if (NewProgIf == ProgIf)
831 {
832 /* Update the header and PDO data with the new programming mode */
833 PciData->ProgIf = ProgIf;
834 PdoExtension->ProgIf = NewProgIf;
835
836 /* Clear the first four BARs to reset current BAR settings */
837 PciData->u.type0.BaseAddresses[0] = 0;
838 PciData->u.type0.BaseAddresses[1] = 0;
839 PciData->u.type0.BaseAddresses[2] = 0;
840 PciData->u.type0.BaseAddresses[3] = 0;
842 PciData->u.type0.BaseAddresses,
844 u.type0.BaseAddresses),
845 4 * sizeof(ULONG));
846
847 /* Re-read the BARs to have the latest data for native mode IDE */
849 PciData->u.type0.BaseAddresses,
851 u.type0.BaseAddresses),
852 4 * sizeof(ULONG));
853
854 /* Re-read the interrupt pin used for native mode IDE */
856 &PciData->u.type0.InterruptPin,
858 u.type0.InterruptPin),
859 sizeof(UCHAR));
860
861 /* The IDE Controller is now in native mode */
862 Switched = TRUE;
863 }
864 else
865 {
866 /* Settings did not work, fail */
867 DPRINT1("PCI: Warning failed switch to native mode for IDE controller VEN_%04x&DEV_%04x!",
868 PciData->VendorID,
869 PciData->DeviceID);
870 }
871 }
872
873 /* Return whether or not native mode was enabled on the IDE controller */
874 return Switched;
875}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define PCI_HACK_DISABLE_IDE_NATIVE_MODE
Definition: pci.h:45

Referenced by PciApplyHacks(), and PciSetResources().

◆ PciGetEnhancedCapabilities()

VOID NTAPI PciGetEnhancedCapabilities ( IN PPCI_PDO_EXTENSION  PdoExtension,
IN PPCI_COMMON_HEADER  PciData 
)

Definition at line 1256 of file enum.c.

1258{
1259 ULONG HeaderType, CapPtr, TargetAgpCapabilityId;
1260 DEVICE_POWER_STATE WakeLevel;
1261 PCI_CAPABILITIES_HEADER AgpCapability;
1263 PAGED_CODE();
1264
1265 /* Assume no known wake level */
1266 PdoExtension->PowerState.DeviceWakeLevel = PowerDeviceUnspecified;
1267
1268 /* Make sure the device has capabilities */
1269 if (!(PciData->Status & PCI_STATUS_CAPABILITIES_LIST))
1270 {
1271 /* If it doesn't, there will be no power management */
1272 PdoExtension->CapabilitiesPtr = 0;
1273 PdoExtension->HackFlags |= PCI_HACK_NO_PM_CAPS;
1274 }
1275 else
1276 {
1277 /* There's capabilities, need to figure out where to get the offset */
1278 HeaderType = PCI_CONFIGURATION_TYPE(PciData);
1279 if (HeaderType == PCI_CARDBUS_BRIDGE_TYPE)
1280 {
1281 /* Use the bridge's header */
1282 CapPtr = PciData->u.type2.CapabilitiesPtr;
1283 }
1284 else
1285 {
1286 /* Use the device header */
1287 ASSERT(HeaderType <= PCI_CARDBUS_BRIDGE_TYPE);
1288 CapPtr = PciData->u.type0.CapabilitiesPtr;
1289 }
1290
1291 /* Skip garbage capabilities pointer */
1292 if (((CapPtr & 0x3) != 0) || (CapPtr < PCI_COMMON_HDR_LENGTH))
1293 {
1294 /* Report no extended capabilities */
1295 PdoExtension->CapabilitiesPtr = 0;
1296 PdoExtension->HackFlags |= PCI_HACK_NO_PM_CAPS;
1297 }
1298 else
1299 {
1300 DPRINT1("Device has capabilities at: %lx\n", CapPtr);
1301 PdoExtension->CapabilitiesPtr = CapPtr;
1302
1303 /* Check for PCI-to-PCI Bridges and AGP bridges */
1304 if ((PdoExtension->BaseClass == PCI_CLASS_BRIDGE_DEV) &&
1305 ((PdoExtension->SubClass == PCI_SUBCLASS_BR_HOST) ||
1307 {
1308 /* Query either the raw AGP capabilitity, or the Target AGP one */
1309 TargetAgpCapabilityId = (PdoExtension->SubClass ==
1314 PdoExtension->CapabilitiesPtr,
1315 TargetAgpCapabilityId,
1316 &AgpCapability,
1317 sizeof(PCI_CAPABILITIES_HEADER)))
1318 {
1319 /* AGP target ID was found, store it */
1320 DPRINT1("AGP ID: %lx\n", TargetAgpCapabilityId);
1321 PdoExtension->TargetAgpCapabilityId = TargetAgpCapabilityId;
1322 }
1323 }
1324
1325 /* Check for devices that are known not to have proper power management */
1326 if (!(PdoExtension->HackFlags & PCI_HACK_NO_PM_CAPS))
1327 {
1328 /* Query if this device supports power management */
1330 PdoExtension->CapabilitiesPtr,
1332 &PowerCapabilities.Header,
1333 sizeof(PCI_PM_CAPABILITY)))
1334 {
1335 /* No power management, so act as if it had the hackflag set */
1336 DPRINT1("No PM caps, disabling PM\n");
1337 PdoExtension->HackFlags |= PCI_HACK_NO_PM_CAPS;
1338 }
1339 else
1340 {
1341 /* Otherwise, pick the highest wake level that is supported */
1342 WakeLevel = PowerDeviceUnspecified;
1343 if (PowerCapabilities.PMC.Capabilities.Support.PMED0)
1344 WakeLevel = PowerDeviceD0;
1345 if (PowerCapabilities.PMC.Capabilities.Support.PMED1)
1346 WakeLevel = PowerDeviceD1;
1347 if (PowerCapabilities.PMC.Capabilities.Support.PMED2)
1348 WakeLevel = PowerDeviceD2;
1349 if (PowerCapabilities.PMC.Capabilities.Support.PMED3Hot)
1350 WakeLevel = PowerDeviceD3;
1351 if (PowerCapabilities.PMC.Capabilities.Support.PMED3Cold)
1352 WakeLevel = PowerDeviceD3;
1353 PdoExtension->PowerState.DeviceWakeLevel = WakeLevel;
1354
1355 /* Convert the PCI power state to the NT power state */
1356 PdoExtension->PowerState.CurrentDeviceState =
1357 PowerCapabilities.PMCSR.ControlStatus.PowerState + 1;
1358
1359 /* Save all the power capabilities */
1360 PdoExtension->PowerCapabilities = PowerCapabilities.PMC.Capabilities;
1361 DPRINT1("PM Caps Found! Wake Level: %d Power State: %d\n",
1362 WakeLevel, PdoExtension->PowerState.CurrentDeviceState);
1363 }
1364 }
1365 }
1366 }
1367
1368 /* At the very end of all this, does this device not have power management? */
1369 if (PdoExtension->HackFlags & PCI_HACK_NO_PM_CAPS)
1370 {
1371 /* Then guess the current state based on whether the decodes are on */
1372 PdoExtension->PowerState.CurrentDeviceState =
1373 PciData->Command & (PCI_ENABLE_IO_SPACE |
1377 DPRINT1("PM is off, so assumed device is: %d based on enables\n",
1378 PdoExtension->PowerState.CurrentDeviceState);
1379 }
1380}
UCHAR NTAPI PciReadDeviceCapability(IN PPCI_PDO_EXTENSION DeviceExtension, IN UCHAR Offset, IN ULONG CapabilityId, OUT PPCI_CAPABILITIES_HEADER Buffer, IN ULONG Length)
Definition: utils.c:886
@ PowerDeviceD1
Definition: ntpoapi.h:50
@ PowerDeviceUnspecified
Definition: ntpoapi.h:48
@ PowerDeviceD0
Definition: ntpoapi.h:49
@ PowerDeviceD2
Definition: ntpoapi.h:51
@ PowerDeviceD3
Definition: ntpoapi.h:52
enum _DEVICE_POWER_STATE DEVICE_POWER_STATE
#define PCI_HACK_NO_PM_CAPS
Definition: pci.h:39
_In_ WDFDEVICE _In_ PWDF_DEVICE_POWER_CAPABILITIES PowerCapabilities
Definition: wdfdevice.h:3892
#define PCI_CAPABILITY_ID_AGP
Definition: iotypes.h:3650
#define PCI_SUBCLASS_BR_HOST
Definition: iotypes.h:4164
#define PCI_SUBCLASS_BR_PCI_TO_PCI
Definition: iotypes.h:4168
#define PCI_COMMON_HDR_LENGTH
Definition: iotypes.h:3596
#define PCI_STATUS_CAPABILITIES_LIST
Definition: iotypes.h:3632
#define PCI_CAPABILITY_ID_POWER_MANAGEMENT
Definition: iotypes.h:3649
#define PCI_CAPABILITY_ID_AGP_TARGET
Definition: iotypes.h:3662

Referenced by PciScanBus().

◆ PciGetFunctionLimits()

NTSTATUS NTAPI PciGetFunctionLimits ( IN PPCI_PDO_EXTENSION  PdoExtension,
IN PPCI_COMMON_HEADER  Current,
IN ULONGLONG  HackFlags 
)

Definition at line 1568 of file enum.c.

1571{
1573 PPCI_COMMON_HEADER PciData;
1575 PAGED_CODE();
1576
1577 /* Do the hackflags indicate this device should be skipped? */
1578 if (PciSkipThisFunction(Current,
1579 PdoExtension->Slot,
1581 HackFlags))
1582 {
1583 /* Do not process its resources */
1584 return STATUS_SUCCESS;
1585 }
1586
1587 /* Allocate a buffer to hold two PCI configuration headers */
1588 PciData = ExAllocatePoolWithTag(0, 2 * PCI_COMMON_HDR_LENGTH, 'BicP');
1589 if (!PciData) return STATUS_INSUFFICIENT_RESOURCES;
1590
1591 /* Set up the context for the resource enumeration, and do it */
1592 Context.Current = Current;
1593 Context.PciData = PciData;
1594 Context.PdoExtension = PdoExtension;
1596
1597 /* Enumeration is completed, free the PCI headers and return the status */
1598 ExFreePoolWithTag(PciData, 0);
1599 return Status;
1600}
LONG NTSTATUS
Definition: precomp.h:26
_In_ ULONG_PTR HackFlags
Definition: cdrom.h:983
BOOLEAN NTAPI PciSkipThisFunction(IN PPCI_COMMON_HEADER PciData, IN PCI_SLOT_NUMBER Slot, IN UCHAR OperationType, IN ULONGLONG HackFlags)
Definition: enum.c:1182
NTSTATUS NTAPI PcipGetFunctionLimits(IN PPCI_CONFIGURATOR_CONTEXT Context)
Definition: enum.c:1427
#define PCI_SKIP_RESOURCE_ENUMERATION
Definition: pci.h:65
Status
Definition: gdiplustypes.h:24
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109

Referenced by PciScanBus().

◆ PcipGetFunctionLimits()

NTSTATUS NTAPI PcipGetFunctionLimits ( IN PPCI_CONFIGURATOR_CONTEXT  Context)

Definition at line 1427 of file enum.c.

1428{
1429 PPCI_CONFIGURATOR Configurator;
1430 PPCI_COMMON_HEADER PciData, Current;
1432 PCI_IPI_CONTEXT IpiContext;
1433 PIO_RESOURCE_DESCRIPTOR IoDescriptor;
1434 ULONG Offset;
1435 PAGED_CODE();
1436
1437 /* Grab all parameters from the context */
1438 PdoExtension = Context->PdoExtension;
1439 Current = Context->Current;
1440 PciData = Context->PciData;
1441
1442 /* Save the current PCI Command and Status word */
1443 Context->Status = Current->Status;
1444 Context->Command = Current->Command;
1445
1446 /* Now that they're saved, clear the status, and disable all decodes */
1447 Current->Status = 0;
1448 Current->Command &= ~(PCI_ENABLE_IO_SPACE |
1451
1452 /* Make a copy of the current PCI configuration header (with decodes off) */
1453 RtlCopyMemory(PciData, Current, PCI_COMMON_HDR_LENGTH);
1454
1455 /* Locate the correct resource configurator for this type of device */
1456 Configurator = &PciConfigurators[PdoExtension->HeaderType];
1457 Context->Configurator = Configurator;
1458
1459 /* Initialize it, which will typically setup the BARs for limit discovery */
1460 Configurator->Initialize(Context);
1461
1462 /* Check for critical devices and PCI Debugging devices */
1463 if ((PdoExtension->HackFlags & PCI_HACK_CRITICAL_DEVICE) ||
1464 (PdoExtension->OnDebugPath))
1465 {
1466 /* Specifically check for a PCI Debugging device */
1467 if (PdoExtension->OnDebugPath)
1468 {
1469 /* Was it enabled for bus mastering? */
1470 if (Context->Command & PCI_ENABLE_BUS_MASTER)
1471 {
1472 /* This decode needs to be re-enabled so debugging can work */
1473 PciData->Command |= PCI_ENABLE_BUS_MASTER;
1474 Current->Command |= PCI_ENABLE_BUS_MASTER;
1475 }
1476
1477 /* Disable the debugger while the discovery is happening */
1479 }
1480
1481 /* For these devices, an IPI must be sent to force high-IRQL discovery */
1482 IpiContext.Barrier = 1;
1483 IpiContext.RunCount = 1;
1484 IpiContext.DeviceExtension = PdoExtension;
1486 IpiContext.Context = Context;
1488
1489 /* Re-enable the debugger if this was a PCI Debugging Device */
1490 if (PdoExtension->OnDebugPath) KdEnableDebugger();
1491 }
1492 else
1493 {
1494 /* Otherwise, it's safe to do this in-line at low IRQL */
1496 }
1497
1498 /*
1499 * Check if it's valid to compare the headers to see if limit discovery mode
1500 * has properly exited (the expected case is that the PCI header would now
1501 * be equal to what it was before). In some cases, it is known that this will
1502 * fail, because during PciApplyHacks (among other places), software hacks
1503 * had to be applied to the header, which the hardware-side will not see, and
1504 * thus the headers would appear "different".
1505 */
1506 if (!PdoExtension->ExpectedWritebackFailure)
1507 {
1508 /* Read the current PCI header now, after discovery has completed */
1510
1511 /* Check if the current header at entry, is equal to the header now */
1512 Offset = RtlCompareMemory(PciData + 1, Current, PCI_COMMON_HDR_LENGTH);
1514 {
1515 /* It's not, which means configuration somehow changed, dump this */
1516 DPRINT1("PCI - CFG space write verify failed at offset 0x%x\n", Offset);
1517 PciDebugDumpCommonConfig(PciData + 1);
1518 DPRINT1("----------\n");
1519 PciDebugDumpCommonConfig(Current);
1520 }
1521 }
1522
1523 /* This PDO should not already have resources, since this is only done once */
1524 ASSERT(PdoExtension->Resources == NULL);
1525
1526 /* Allocate the structure that will hold the discovered resources and limits */
1528 sizeof(PCI_FUNCTION_RESOURCES),
1529 'BicP');
1530 if (!PdoExtension->Resources) return STATUS_INSUFFICIENT_RESOURCES;
1531
1532 /* Clear it out for now */
1534
1535 /* Now call the configurator, which will first store the limits... */
1536 Configurator->SaveLimits(Context);
1537
1538 /* ...and then store the current resources being used */
1539 Configurator->SaveCurrentSettings(Context);
1540
1541 /* Loop all the limit descriptors backwards */
1542 IoDescriptor = &PdoExtension->Resources->Limit[PCI_TYPE0_ADDRESSES + 1];
1543 while (TRUE)
1544 {
1545 /* Keep going until a non-null descriptor is found */
1546 IoDescriptor--;
1547 if (IoDescriptor->Type != CmResourceTypeNull) break;
1548
1549 /* This is a null descriptor, have all of them been scanned now? */
1550 if (IoDescriptor == &PdoExtension->Resources->Limit[0])
1551 {
1552 /* This means the descriptor is NULL, which means discovery failed */
1553 DPRINT1("PCI Resources fail!\n");
1554
1555 /* No resources will be assigned for the device */
1556 ExFreePoolWithTag(PdoExtension->Resources, 0);
1557 PdoExtension->Resources = NULL;
1558 break;
1559 }
1560 }
1561
1562 /* Return success here, even if the device has no assigned resources */
1563 return STATUS_SUCCESS;
1564}
VOID NTAPI PciDebugDumpCommonConfig(IN PPCI_COMMON_HEADER PciData)
Definition: debug.c:207
VOID NTAPI PciWriteLimitsAndRestoreCurrent(IN PVOID Reserved, IN PVOID Context2)
Definition: enum.c:1384
KIPI_BROADCAST_WORKER PciExecuteCriticalSystemRoutine
Definition: pci.h:1133
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
#define NonPagedPool
Definition: env_spec_w32.h:307
NTSTATUS NTAPI KdDisableDebugger(VOID)
Definition: kdapi.c:2169
NTSTATUS NTAPI KdEnableDebugger(VOID)
Definition: kdapi.c:2158
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
ULONG_PTR NTAPI KeIpiGenericCall(_In_ PKIPI_BROADCAST_WORKER Function, _In_ ULONG_PTR Argument)
Definition: ipi.c:44
#define PCI_HACK_CRITICAL_DEVICE
Definition: pci.h:47
PCI_CONFIGURATOR_SAVE_LIMITS SaveLimits
Definition: pci.h:479
PCI_CONFIGURATOR_INITIALIZE Initialize
Definition: pci.h:477
PCI_CONFIGURATOR_SAVE_CURRENT_SETTINGS SaveCurrentSettings
Definition: pci.h:480
LONG RunCount
Definition: pci.h:513
ULONG Barrier
Definition: pci.h:514
PVOID Context
Definition: pci.h:517
PCI_IPI_FUNCTION Function
Definition: pci.h:516
PVOID DeviceExtension
Definition: pci.h:515
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG_PTR
Definition: typedefs.h:65

Referenced by PciGetFunctionLimits().

◆ PcipIsSameDevice()

BOOLEAN NTAPI PcipIsSameDevice ( IN PPCI_PDO_EXTENSION  DeviceExtension,
IN PPCI_COMMON_HEADER  PciData 
)

Definition at line 1148 of file enum.c.

1150{
1151 BOOLEAN IdMatch, RevMatch, SubsysMatch;
1152 ULONGLONG HackFlags = DeviceExtension->HackFlags;
1153
1154 /* Check if the IDs match */
1155 IdMatch = (PciData->VendorID == DeviceExtension->VendorId) &&
1156 (PciData->DeviceID == DeviceExtension->DeviceId);
1157 if (!IdMatch) return FALSE;
1158
1159 /* If the device has a valid revision, check if it matches */
1161 (PciData->RevisionID == DeviceExtension->RevisionId);
1162 if (!RevMatch) return FALSE;
1163
1164 /* For multifunction devices, this is enough to assume they're the same */
1165 if (PCI_MULTIFUNCTION_DEVICE(PciData)) return TRUE;
1166
1167 /* For bridge devices, there's also nothing else that can be checked */
1168 if (DeviceExtension->BaseClass == PCI_CLASS_BRIDGE_DEV) return TRUE;
1169
1170 /* Devices, on the other hand, have subsystem data that can be compared */
1171 SubsysMatch = (HackFlags & (PCI_HACK_NO_SUBSYSTEM |
1173 ((DeviceExtension->SubsystemVendorId ==
1174 PciData->u.type0.SubVendorID) &&
1175 (DeviceExtension->SubsystemId ==
1176 PciData->u.type0.SubSystemID));
1177 return SubsysMatch;
1178}
#define PCI_HACK_NO_REVISION_AFTER_D3
Definition: pci.h:50
#define PCI_HACK_NO_SUBSYSTEM_AFTER_D3
Definition: pci.h:41
#define PCI_HACK_NO_SUBSYSTEM
Definition: pci.h:32
uint64_t ULONGLONG
Definition: typedefs.h:67
#define PCI_MULTIFUNCTION_DEVICE(PciData)
Definition: iotypes.h:3614

Referenced by PciScanBus(), and PciSetResources().

◆ PciProcessBus()

VOID NTAPI PciProcessBus ( IN PPCI_FDO_EXTENSION  DeviceExtension)

Definition at line 1604 of file enum.c.

1605{
1608 PAGED_CODE();
1609
1610 /* Get the PDO Extension */
1611 PhysicalDeviceObject = DeviceExtension->PhysicalDeviceObject;
1613
1614 /* Cheeck if this is the root bus */
1615 if (!PCI_IS_ROOT_FDO(DeviceExtension))
1616 {
1617 /* Not really handling this year */
1619
1620 /* Check for PCI bridges with the ISA bit set, or required */
1621 if ((PdoExtension) &&
1623 ((PdoExtension->Dependent.type1.IsaBitRequired) ||
1624 (PdoExtension->Dependent.type1.IsaBitSet)))
1625 {
1626 /* We'll need to do some legacy support */
1628 }
1629 }
1630 else
1631 {
1632 /* Scan all of the root bus' children bridges */
1633 for (PdoExtension = DeviceExtension->ChildBridgePdoList;
1635 PdoExtension = PdoExtension->NextBridge)
1636 {
1637 /* Find any that have the VGA decode bit on */
1638 if (PdoExtension->Dependent.type1.VgaBitSet)
1639 {
1640 /* Again, some more legacy support we'll have to do */
1642 }
1643 }
1644 }
1645
1646 /* Check for ACPI systems where the OS assigns bus numbers */
1648 {
1649 /* Not yet supported */
1651 }
1652}
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1157
BOOLEAN PciAssignBusNumbers
Definition: config.c:18
struct _PCI_PDO_EXTENSION * PPCI_PDO_EXTENSION
PCI_DEVICE_TYPES NTAPI PciClassifyDeviceType(IN PPCI_PDO_EXTENSION PdoExtension)
Definition: utils.c:1051
@ PciTypePciBridge
Definition: pci.h:119
if(dx< 0)
Definition: linetemp.h:194
PVOID DeviceExtension
Definition: env_spec_w32.h:418

Referenced by PciScanBus().

◆ PcipUpdateHardware()

VOID NTAPI PcipUpdateHardware ( IN PVOID  Context,
IN PVOID  Context2 
)

Definition at line 252 of file enum.c.

254{
257
258 /* Check if we're allowed to disable decodes */
259 PciData->Command = PdoExtension->CommandEnables;
260 if (!(PdoExtension->HackFlags & PCI_HACK_PRESERVE_COMMAND))
261 {
262 /* Disable all decodes */
263 PciData->Command &= ~(PCI_ENABLE_IO_SPACE |
267 }
268
269 /* Update the device configuration */
270 PciData->Status = 0;
272
273 /* Turn decodes back on */
274 PciDecodeEnable(PdoExtension, TRUE, &PdoExtension->CommandEnables);
275}
_In_ PNET_PNP_EVENT _In_ PTDI_PNP_CONTEXT _In_ PTDI_PNP_CONTEXT Context2
Definition: tdikrnl.h:1096
#define PCI_ENABLE_WRITE_AND_INVALIDATE
Definition: iotypes.h:3622

Referenced by PciUpdateHardware().

◆ PciQueryDeviceRelations()

NTSTATUS NTAPI PciQueryDeviceRelations ( IN PPCI_FDO_EXTENSION  DeviceExtension,
IN OUT PDEVICE_RELATIONS pDeviceRelations 
)

Definition at line 2119 of file enum.c.

2121{
2124 ULONG PdoCount = 0;
2125 PDEVICE_RELATIONS DeviceRelations, NewRelations;
2126 SIZE_T Size;
2127 PDEVICE_OBJECT DeviceObject, *ObjectArray;
2128 PAGED_CODE();
2129
2130 /* Make sure the FDO is started */
2131 ASSERT(DeviceExtension->DeviceState == PciStarted);
2132
2133 /* Synchronize while we enumerate the bus */
2135 if (!NT_SUCCESS(Status)) return Status;
2136
2137 /* Scan all children PDO */
2138 for (PdoExtension = DeviceExtension->ChildPdoList;
2140 PdoExtension = PdoExtension->Next)
2141 {
2142 /* Invalidate them */
2143 PdoExtension->NotPresent = TRUE;
2144 }
2145
2146 /* Scan the PCI Bus */
2147 Status = PciScanBus(DeviceExtension);
2149
2150 /* Enumerate all children PDO again */
2151 for (PdoExtension = DeviceExtension->ChildPdoList;
2153 PdoExtension = PdoExtension->Next)
2154 {
2155 /* Check for PDOs that are still invalidated */
2156 if (PdoExtension->NotPresent)
2157 {
2158 /* This means this PDO existed before, but not anymore */
2159 PdoExtension->ReportedMissing = TRUE;
2160 DPRINT1("PCI - Old device (pdox) %p not found on rescan.\n",
2161 PdoExtension);
2162 }
2163 else
2164 {
2165 /* Increase count of detected PDOs */
2166 PdoCount++;
2167 }
2168 }
2169
2170 /* Read the current relations and add the newly discovered relations */
2171 DeviceRelations = *pDeviceRelations;
2172 Size = FIELD_OFFSET(DEVICE_RELATIONS, Objects) +
2173 PdoCount * sizeof(PDEVICE_OBJECT);
2174 if (DeviceRelations) Size += sizeof(PDEVICE_OBJECT) * DeviceRelations->Count;
2175
2176 /* Allocate the device relations */
2177 NewRelations = (PDEVICE_RELATIONS)ExAllocatePoolWithTag(0, Size, 'BicP');
2178 if (!NewRelations)
2179 {
2180 /* Out of space, cancel the operation */
2183 }
2184
2185 /* Check if there were any older relations */
2186 NewRelations->Count = 0;
2187 if (DeviceRelations)
2188 {
2189 /* Copy the old relations into the new buffer, then free the old one */
2190 RtlCopyMemory(NewRelations,
2191 DeviceRelations,
2192 FIELD_OFFSET(DEVICE_RELATIONS, Objects) +
2193 DeviceRelations->Count * sizeof(PDEVICE_OBJECT));
2194 ExFreePoolWithTag(DeviceRelations, 0);
2195 }
2196
2197 /* Print out that we're ready to dump relations */
2198 DPRINT1("PCI QueryDeviceRelations/BusRelations FDOx %p (bus 0x%02x)\n",
2199 DeviceExtension,
2200 DeviceExtension->BaseBus);
2201
2202 /* Loop the current PDO children and the device relation object array */
2203 PdoExtension = DeviceExtension->ChildPdoList;
2204 ObjectArray = &NewRelations->Objects[NewRelations->Count];
2205 while (PdoExtension)
2206 {
2207 /* Dump this relation */
2208 DPRINT1(" QDR PDO %p (x %p)%s\n",
2209 PdoExtension->PhysicalDeviceObject,
2211 PdoExtension->NotPresent ?
2212 "<Omitted, device flaged not present>" : "");
2213
2214 /* Is this PDO present? */
2215 if (!PdoExtension->NotPresent)
2216 {
2217 /* Reference it and add it to the array */
2218 DeviceObject = PdoExtension->PhysicalDeviceObject;
2220 *ObjectArray++ = DeviceObject;
2221 }
2222
2223 /* Go to the next PDO */
2224 PdoExtension = PdoExtension->Next;
2225 }
2226
2227 /* Terminate dumping the relations */
2228 DPRINT1(" QDR Total PDO count = %u (%u already in list)\n",
2229 NewRelations->Count + PdoCount,
2230 NewRelations->Count);
2231
2232 /* Return the final count and the new buffer */
2233 NewRelations->Count += PdoCount;
2234 *pDeviceRelations = NewRelations;
2235 return STATUS_SUCCESS;
2236}
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
NTSTATUS NTAPI PciScanBus(IN PPCI_FDO_EXTENSION DeviceExtension)
Definition: enum.c:1656
@ PciStarted
Definition: pci.h:130
@ PciSynchronizedOperation
Definition: pci.h:134
NTSTATUS NTAPI PciCancelStateTransition(IN PPCI_FDO_EXTENSION DeviceExtension, IN PCI_STATE NewState)
Definition: state.c:145
NTSTATUS NTAPI PciBeginStateTransition(IN PPCI_FDO_EXTENSION DeviceExtension, IN PCI_STATE NewState)
Definition: state.c:97
struct _DEVICE_OBJECT * PDEVICE_OBJECT
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2165
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
#define ObReferenceObject
Definition: obfuncs.h:204

Referenced by PciFdoIrpQueryDeviceRelations().

◆ PciQueryEjectionRelations()

NTSTATUS NTAPI PciQueryEjectionRelations ( IN PPCI_PDO_EXTENSION  PdoExtension,
IN OUT PDEVICE_RELATIONS pDeviceRelations 
)

Definition at line 552 of file enum.c.

554{
556 UNREFERENCED_PARAMETER(pDeviceRelations);
557
558 /* Not yet implemented */
561}
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42

Referenced by PciPdoIrpQueryDeviceRelations().

◆ PciQueryRequirements()

NTSTATUS NTAPI PciQueryRequirements ( IN PPCI_PDO_EXTENSION  PdoExtension,
IN OUT PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList 
)

Definition at line 668 of file enum.c.

670{
672 PCI_COMMON_HEADER PciHeader;
673 PAGED_CODE();
674
675 /* Check if the PDO has any resources, or at least an interrupt pin */
676 if ((PdoExtension->Resources) || (PdoExtension->InterruptPin))
677 {
678 /* Read the current PCI header */
680
681 /* Use it to build a list of requirements */
683 if (!NT_SUCCESS(Status)) return Status;
684
685 /* Is this a Compaq PCI Hotplug Controller (r17) on a PAE system ? */
686 if ((PciHeader.VendorID == 0xE11) &&
687 (PciHeader.DeviceID == 0xA0F7) &&
688 (PciHeader.RevisionID == 17) &&
690 {
691 /* Have not tested this on eVb's machine yet */
693 }
694
695 /* Check if the requirements are actually the zero list */
697 {
698 /* A simple NULL will suffice for the PnP Manager */
700 DPRINT1("Returning NULL requirements list\n");
701 }
702 else
703 {
704 /* Otherwise, print out the requirements list */
706 }
707 }
708 else
709 {
710 /* There aren't any resources, so simply return NULL */
711 DPRINT1("PciQueryRequirements returning NULL requirements list\n");
713 }
714
715 /* This call always succeeds (but maybe with no requirements) */
716 return STATUS_SUCCESS;
717}
VOID NTAPI PciDebugPrintIoResReqList(IN PIO_RESOURCE_REQUIREMENTS_LIST Requirements)
Definition: debug.c:302
NTSTATUS NTAPI PciBuildRequirementsList(IN PPCI_PDO_EXTENSION PdoExtension, IN PPCI_COMMON_HEADER PciData, OUT PIO_RESOURCE_REQUIREMENTS_LIST *Buffer)
Definition: enum.c:565

Referenced by PciPdoIrpQueryResourceRequirements().

◆ PciQueryResources()

NTSTATUS NTAPI PciQueryResources ( IN PPCI_PDO_EXTENSION  PdoExtension,
OUT PCM_RESOURCE_LIST Buffer 
)

Definition at line 368 of file enum.c.

370{
371 PPCI_FUNCTION_RESOURCES PciResources;
372 BOOLEAN HaveVga, HaveMemSpace, HaveIoSpace;
373 USHORT BridgeControl, PciCommand;
374 ULONG Count, i;
375 PCM_PARTIAL_RESOURCE_DESCRIPTOR Partial, Resource, LastResource;
377 UCHAR InterruptLine;
378 PAGED_CODE();
379
380 /* Assume failure */
381 Count = 0;
382 HaveVga = FALSE;
383 *Buffer = NULL;
384
385 /* Make sure there's some resources to query */
386 PciResources = PdoExtension->Resources;
387 if (!PciResources) return STATUS_SUCCESS;
388
389 /* Read the decodes */
391 &PciCommand,
393 sizeof(USHORT));
394
395 /* Check which ones are turned on */
396 HaveIoSpace = PciCommand & PCI_ENABLE_IO_SPACE;
397 HaveMemSpace = PciCommand & PCI_ENABLE_MEMORY_SPACE;
398
399 /* Loop maximum possible descriptors */
400 for (i = 0; i < 7; i++)
401 {
402 /* Check if the decode for this descriptor is actually turned on */
403 Partial = &PciResources->Current[i];
404 if (((HaveMemSpace) && (Partial->Type == CmResourceTypeMemory)) ||
405 ((HaveIoSpace) && (Partial->Type == CmResourceTypePort)))
406 {
407 /* One more fully active descriptor */
408 Count++;
409 }
410 }
411
412 /* If there's an interrupt pin associated, check at least one decode is on */
413 if ((PdoExtension->InterruptPin) && ((HaveMemSpace) || (HaveIoSpace)))
414 {
415 /* Read the interrupt line for the pin, add a descriptor if it's valid */
416 InterruptLine = PdoExtension->AdjustedInterruptLine;
417 if ((InterruptLine) && (InterruptLine != -1)) Count++;
418 }
419
420 /* Check for PCI bridge */
421 if (PdoExtension->HeaderType == PCI_BRIDGE_TYPE)
422 {
423 /* Read bridge settings, check if VGA is present */
425 &BridgeControl,
426 FIELD_OFFSET(PCI_COMMON_HEADER, u.type1.BridgeControl),
427 sizeof(USHORT));
428 if (BridgeControl & PCI_ENABLE_BRIDGE_VGA)
429 {
430 /* Remember for later */
431 HaveVga = TRUE;
432
433 /* One memory descriptor for 0xA0000, plus the two I/O port ranges */
434 if (HaveMemSpace) Count++;
435 if (HaveIoSpace) Count += 2;
436 }
437 }
438
439 /* If there's no descriptors in use, there's no resources, so return */
440 if (!Count) return STATUS_SUCCESS;
441
442 /* Allocate a resource list to hold the resources */
444 PdoExtension->ParentFdoExtension->BaseBus);
446
447 /* This is where the descriptors will be copied into */
448 Resource = ResourceList->List[0].PartialResourceList.PartialDescriptors;
449 LastResource = Resource + Count + 1;
450
451 /* Loop maximum possible descriptors */
452 for (i = 0; i < 7; i++)
453 {
454 /* Check if the decode for this descriptor is actually turned on */
455 Partial = &PciResources->Current[i];
456 if (((HaveMemSpace) && (Partial->Type == CmResourceTypeMemory)) ||
457 ((HaveIoSpace) && (Partial->Type == CmResourceTypePort)))
458 {
459 /* Copy the descriptor into the resource list */
460 *Resource++ = *Partial;
461 }
462 }
463
464 /* Check if earlier the code detected this was a PCI bridge with VGA on it */
465 if (HaveVga)
466 {
467 /* Are the memory decodes enabled? */
468 if (HaveMemSpace)
469 {
470 /* Build a memory descriptor for a 128KB framebuffer at 0xA0000 */
472 Resource->u.Generic.Start.HighPart = 0;
474 Resource->u.Generic.Start.LowPart = 0xA0000;
475 Resource->u.Generic.Length = 0x20000;
476 Resource++;
477 }
478
479 /* Are the I/O decodes enabled? */
480 if (HaveIoSpace)
481 {
482 /* Build an I/O descriptor for the graphic ports at 0x3B0 */
485 Resource->u.Port.Start.QuadPart = 0x3B0u;
486 Resource->u.Port.Length = 0xC;
487 Resource++;
488
489 /* Build an I/O descriptor for the graphic ports at 0x3C0 */
492 Resource->u.Port.Start.QuadPart = 0x3C0u;
493 Resource->u.Port.Length = 0x20;
494 Resource++;
495 }
496 }
497
498 /* If there's an interrupt pin associated, check at least one decode is on */
499 if ((PdoExtension->InterruptPin) && ((HaveMemSpace) || (HaveIoSpace)))
500 {
501 /* Read the interrupt line for the pin, check if it's valid */
502 InterruptLine = PdoExtension->AdjustedInterruptLine;
503 if ((InterruptLine) && (InterruptLine != -1))
504 {
505 /* Make sure there's still space */
506 ASSERT(Resource < LastResource);
507
508 /* Add the interrupt descriptor */
511 Resource->ShareDisposition = CmResourceShareShared;
512 Resource->u.Interrupt.Affinity = -1;
513 Resource->u.Interrupt.Level = InterruptLine;
514 Resource->u.Interrupt.Vector = InterruptLine;
515 }
516 }
517
518 /* Return the resource list */
520 return STATUS_SUCCESS;
521}
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:843
PCM_RESOURCE_LIST NTAPI PciAllocateCmResourceList(IN ULONG Count, IN ULONG BusNumber)
Definition: enum.c:338
#define CM_RESOURCE_PORT_POSITIVE_DECODE
Definition: cmtypes.h:113
#define CM_RESOURCE_MEMORY_READ_WRITE
Definition: cmtypes.h:121
#define CM_RESOURCE_PORT_10_BIT_DECODE
Definition: cmtypes.h:110
#define PCI_ENABLE_BRIDGE_VGA
Definition: pci.h:62

Referenced by PciPdoIrpQueryResources().

◆ PciQueryTargetDeviceRelations()

NTSTATUS NTAPI PciQueryTargetDeviceRelations ( IN PPCI_PDO_EXTENSION  PdoExtension,
IN OUT PDEVICE_RELATIONS pDeviceRelations 
)

Definition at line 525 of file enum.c.

527{
528 PDEVICE_RELATIONS DeviceRelations;
529 PAGED_CODE();
530
531 /* If there were existing relations, free them */
532 if (*pDeviceRelations) ExFreePoolWithTag(*pDeviceRelations, 0);
533
534 /* Allocate a new structure for the relations */
535 DeviceRelations = ExAllocatePoolWithTag(NonPagedPool,
536 sizeof(DEVICE_RELATIONS),
537 'BicP');
538 if (!DeviceRelations) return STATUS_INSUFFICIENT_RESOURCES;
539
540 /* Only one relation: the PDO */
541 DeviceRelations->Count = 1;
542 DeviceRelations->Objects[0] = PdoExtension->PhysicalDeviceObject;
543 ObReferenceObject(DeviceRelations->Objects[0]);
544
545 /* Return the new relations */
546 *pDeviceRelations = DeviceRelations;
547 return STATUS_SUCCESS;
548}

Referenced by PciPdoIrpQueryDeviceRelations().

◆ PciScanBus()

NTSTATUS NTAPI PciScanBus ( IN PPCI_FDO_EXTENSION  DeviceExtension)

Definition at line 1656 of file enum.c.

1657{
1658 ULONG MaxDevice = PCI_MAX_DEVICES;
1659 BOOLEAN ProcessFlag = FALSE;
1660 ULONG i, j, k, Size;
1661 USHORT CapOffset, TempOffset;
1665 UCHAR BiosBuffer[PCI_COMMON_HDR_LENGTH];
1666 PPCI_COMMON_HEADER PciData = (PVOID)Buffer;
1667 PPCI_COMMON_HEADER BiosData = (PVOID)BiosBuffer;
1669 PCHAR Name;
1671 PPCI_PDO_EXTENSION PdoExtension, NewExtension;
1672 PPCI_PDO_EXTENSION* BridgeExtension;
1673 PWCHAR DescriptionText;
1674 USHORT SubVendorId, SubSystemId;
1675 PCI_CAPABILITIES_HEADER CapHeader, PcixCapHeader;
1676 UCHAR SecondaryBus;
1677 DPRINT1("PCI Scan Bus: FDO Extension @ 0x%p, Base Bus = 0x%x\n",
1678 DeviceExtension, DeviceExtension->BaseBus);
1679
1680 /* Is this the root FDO? */
1681 if (!PCI_IS_ROOT_FDO(DeviceExtension))
1682 {
1683 /* Get the PDO for the child bus */
1684 PdoExtension = DeviceExtension->PhysicalDeviceObject->DeviceExtension;
1686
1687 /* Check for hack which only allows bus to have one child device */
1688 if (PdoExtension->HackFlags & PCI_HACK_ONE_CHILD) MaxDevice = 1;
1689
1690 /* Check if the secondary bus number has changed */
1692 &SecondaryBus,
1693 FIELD_OFFSET(PCI_COMMON_HEADER, u.type1.SecondaryBus),
1694 sizeof(UCHAR));
1695 if (SecondaryBus != PdoExtension->Dependent.type1.SecondaryBus)
1696 {
1697 UNIMPLEMENTED_DBGBREAK("PCI: Bus numbers have been changed! Restoring originals.\n");
1698 }
1699 }
1700
1701 /* Loop every device on the bus */
1702 PciSlot.u.bits.Reserved = 0;
1703 i = DeviceExtension->BaseBus;
1704 for (j = 0; j < MaxDevice; j++)
1705 {
1706 /* Loop every function of each device */
1707 PciSlot.u.bits.DeviceNumber = j;
1708 for (k = 0; k < PCI_MAX_FUNCTION; k++)
1709 {
1710 /* Build the final slot structure */
1711 PciSlot.u.bits.FunctionNumber = k;
1712
1713 /* Read the vendor for this slot */
1714 PciReadSlotConfig(DeviceExtension,
1715 PciSlot,
1716 PciData,
1717 0,
1718 sizeof(USHORT));
1719
1720 /* Skip invalid device */
1721 if (PciData->VendorID == PCI_INVALID_VENDORID) continue;
1722
1723 /* Now read the whole header */
1724 PciReadSlotConfig(DeviceExtension,
1725 PciSlot,
1726 &PciData->DeviceID,
1727 sizeof(USHORT),
1728 PCI_COMMON_HDR_LENGTH - sizeof(USHORT));
1729
1730 /* Apply any hacks before even analyzing the configuration header */
1731 PciApplyHacks(DeviceExtension,
1732 PciData,
1733 PciSlot,
1735 NULL);
1736
1737 /* Dump device that was found */
1738 DPRINT1("Scan Found Device 0x%x (b=0x%x, d=0x%x, f=0x%x)\n",
1740 i,
1741 j,
1742 k);
1743
1744 /* Dump the device's header */
1745 PciDebugDumpCommonConfig(PciData);
1746
1747 /* Find description for this device for the debugger's sake */
1748 DescriptionText = PciGetDeviceDescriptionMessage(PciData->BaseClass,
1749 PciData->SubClass);
1750 DPRINT1("Device Description \"%S\".\n",
1751 DescriptionText ? DescriptionText : L"(NULL)");
1752 if (DescriptionText) ExFreePoolWithTag(DescriptionText, 0);
1753
1754 /* Check if there is an ACPI Watchdog Table */
1755 if (WdTable)
1756 {
1757 /* Check if this PCI device is the ACPI Watchdog Device... */
1759 }
1760
1761 /* Check for non-simple devices */
1762 if ((PCI_MULTIFUNCTION_DEVICE(PciData)) ||
1763 (PciData->BaseClass == PCI_CLASS_BRIDGE_DEV))
1764 {
1765 /* No subsystem data defined for these kinds of bridges */
1766 SubVendorId = 0;
1767 SubSystemId = 0;
1768 }
1769 else
1770 {
1771 /* Read the subsystem information from the PCI header */
1772 SubVendorId = PciData->u.type0.SubVendorID;
1773 SubSystemId = PciData->u.type0.SubSystemID;
1774 }
1775
1776 /* Get any hack flags for this device */
1777 HackFlags = PciGetHackFlags(PciData->VendorID,
1778 PciData->DeviceID,
1779 SubVendorId,
1780 SubSystemId,
1781 PciData->RevisionID);
1782
1783 /* Check if this device is considered critical by the OS */
1784 if (PciIsCriticalDeviceClass(PciData->BaseClass, PciData->SubClass))
1785 {
1786 /* Check if normally the decodes would be disabled */
1788 {
1789 /* Because this device is critical, don't disable them */
1790 DPRINT1("Not allowing PM Because device is critical\n");
1792 }
1793 }
1794
1795 /* PCI bridges with a VGA card are also considered critical */
1796 if ((PciData->BaseClass == PCI_CLASS_BRIDGE_DEV) &&
1797 (PciData->SubClass == PCI_SUBCLASS_BR_PCI_TO_PCI) &&
1798 (PciData->u.type1.BridgeControl & PCI_ENABLE_BRIDGE_VGA) &&
1800 {
1801 /* Do not disable their decodes either */
1802 DPRINT1("Not allowing PM because device is VGA\n");
1804 }
1805
1806 /* Check if the device should be skipped for whatever reason */
1807 if (PciSkipThisFunction(PciData,
1808 PciSlot,
1810 HackFlags))
1811 {
1812 /* Skip this device */
1813 continue;
1814 }
1815
1816 /* Check if a PDO has already been created for this device */
1817 PdoExtension = PciFindPdoByFunction(DeviceExtension,
1819 PciData);
1820 if (PdoExtension)
1821 {
1822 /* Rescan scenarios are not yet implemented */
1824 }
1825
1826 /* Bus processing will need to happen */
1827 ProcessFlag = TRUE;
1828
1829 /* Create the PDO for this device */
1830 Status = PciPdoCreate(DeviceExtension, PciSlot, &DeviceObject);
1832 NewExtension = (PPCI_PDO_EXTENSION)DeviceObject->DeviceExtension;
1833
1834 /* Check for broken devices with wrong/no class codes */
1836 {
1837 /* Setup a default one */
1838 PciData->BaseClass = PCI_CLASS_BASE_SYSTEM_DEV;
1839 PciData->SubClass = PCI_SUBCLASS_SYS_OTHER;
1840
1841 /* Device will behave erratically when reading back data */
1842 NewExtension->ExpectedWritebackFailure = TRUE;
1843 }
1844
1845 /* Clone all the information from the header */
1846 NewExtension->VendorId = PciData->VendorID;
1847 NewExtension->DeviceId = PciData->DeviceID;
1848 NewExtension->RevisionId = PciData->RevisionID;
1849 NewExtension->ProgIf = PciData->ProgIf;
1850 NewExtension->SubClass = PciData->SubClass;
1851 NewExtension->BaseClass = PciData->BaseClass;
1852 NewExtension->HeaderType = PCI_CONFIGURATION_TYPE(PciData);
1853
1854 /* Check for modern bridge types, which are managed by the driver */
1855 if ((NewExtension->BaseClass == PCI_CLASS_BRIDGE_DEV) &&
1856 ((NewExtension->SubClass == PCI_SUBCLASS_BR_PCI_TO_PCI) ||
1857 (NewExtension->SubClass == PCI_SUBCLASS_BR_CARDBUS)))
1858 {
1859 /* Acquire this device's lock */
1861 KeWaitForSingleObject(&DeviceExtension->ChildListLock,
1862 Executive,
1863 KernelMode,
1864 FALSE,
1865 NULL);
1866
1867 /* Scan the bridge list until the first free entry */
1868 for (BridgeExtension = &DeviceExtension->ChildBridgePdoList;
1869 *BridgeExtension;
1870 BridgeExtension = &(*BridgeExtension)->NextBridge);
1871
1872 /* Add this PDO as a bridge */
1873 *BridgeExtension = NewExtension;
1874 ASSERT(NewExtension->NextBridge == NULL);
1875
1876 /* Release this device's lock */
1877 KeSetEvent(&DeviceExtension->ChildListLock,
1879 FALSE);
1881 }
1882
1883 /* Get the PCI BIOS configuration saved in the registry */
1884 Status = PciGetBiosConfig(NewExtension, BiosData);
1885 if (NT_SUCCESS(Status))
1886 {
1887 /* This path has not yet been fully tested by eVb */
1888 DPRINT1("Have BIOS configuration!\n");
1890
1891 /* Check if the PCI BIOS configuration has changed */
1892 if (!PcipIsSameDevice(NewExtension, BiosData))
1893 {
1894 /* This is considered failure, and new data will be saved */
1896 }
1897 else
1898 {
1899 /* Data is still correct, check for interrupt line change */
1900 if (BiosData->u.type0.InterruptLine !=
1901 PciData->u.type0.InterruptLine)
1902 {
1903 /* Update the current BIOS with the saved interrupt line */
1904 PciWriteDeviceConfig(NewExtension,
1905 &BiosData->u.type0.InterruptLine,
1907 u.type0.InterruptLine),
1908 sizeof(UCHAR));
1909 }
1910
1911 /* Save the BIOS interrupt line and the initial command */
1912 NewExtension->RawInterruptLine = BiosData->u.type0.InterruptLine;
1913 NewExtension->InitialCommand = BiosData->Command;
1914 }
1915 }
1916
1917 /* Check if no saved data was present or if it was a mismatch */
1918 if (!NT_SUCCESS(Status))
1919 {
1920 /* Save the new data */
1921 Status = PciSaveBiosConfig(NewExtension, PciData);
1923
1924 /* Save the interrupt line and command from the device */
1925 NewExtension->RawInterruptLine = PciData->u.type0.InterruptLine;
1926 NewExtension->InitialCommand = PciData->Command;
1927 }
1928
1929 /* Save original command from the device and hack flags */
1930 NewExtension->CommandEnables = PciData->Command;
1931 NewExtension->HackFlags = HackFlags;
1932
1933 /* Get power, AGP, and other capability data */
1934 PciGetEnhancedCapabilities(NewExtension, PciData);
1935
1936 /* Now configure the BARs */
1937 Status = PciGetFunctionLimits(NewExtension, PciData, HackFlags);
1938
1939 /* Power up the device */
1941
1942 /* Apply any device hacks required for enumeration */
1943 PciApplyHacks(DeviceExtension,
1944 PciData,
1945 PciSlot,
1947 NewExtension);
1948
1949 /* Save interrupt pin */
1950 NewExtension->InterruptPin = PciData->u.type0.InterruptPin;
1951
1952 /*
1953 * Use either this device's actual IRQ line or, if it's connected on
1954 * a master bus whose IRQ line is actually connected to the host, use
1955 * the HAL to query the bus' IRQ line and store that as the adjusted
1956 * interrupt line instead
1957 */
1958 NewExtension->AdjustedInterruptLine = PciGetAdjustedInterruptLine(NewExtension);
1959
1960 /* Check if this device is used for PCI debugger cards */
1961 NewExtension->OnDebugPath = PciIsDeviceOnDebugPath(NewExtension);
1962
1963 /* Check for devices with invalid/bogus subsystem data */
1965 {
1966 /* Set the subsystem information to zero instead */
1967 NewExtension->SubsystemVendorId = 0;
1968 NewExtension->SubsystemId = 0;
1969 }
1970
1971 /* Scan all capabilities */
1972 CapOffset = NewExtension->CapabilitiesPtr;
1973 while (CapOffset)
1974 {
1975 /* Read this header */
1976 TempOffset = PciReadDeviceCapability(NewExtension,
1977 CapOffset,
1978 0,
1979 &CapHeader,
1980 sizeof(PCI_CAPABILITIES_HEADER));
1981 if (TempOffset != CapOffset)
1982 {
1983 /* This is a strange issue that shouldn't happen normally */
1984 DPRINT1("PCI - Failed to read PCI capability at offset 0x%02x\n",
1985 CapOffset);
1986 ASSERT(TempOffset == CapOffset);
1987 }
1988
1989 /* Check for capabilities that this driver cares about */
1990 switch (CapHeader.CapabilityID)
1991 {
1992 /* Power management capability is heavily used by the bus */
1994
1995 /* Dump the capability */
1996 Name = "POWER";
1997 Size = sizeof(PCI_PM_CAPABILITY);
1998 break;
1999
2000 /* AGP capability is required for AGP bus functionality */
2002
2003 /* Dump the capability */
2004 Name = "AGP";
2005 Size = sizeof(PCI_AGP_CAPABILITY);
2006 break;
2007
2008 /* This driver doesn't really use anything other than that */
2009 default:
2010
2011 /* Windows prints this, we could do a translation later */
2012 Name = "UNKNOWN CAPABILITY";
2013 Size = 0;
2014 break;
2015 }
2016
2017 /* Check if this is a capability that should be dumped */
2018 if (Size)
2019 {
2020 /* Read the whole capability data */
2021 TempOffset = PciReadDeviceCapability(NewExtension,
2022 CapOffset,
2023 CapHeader.CapabilityID,
2024 &CapHeader,
2025 Size);
2026
2027 if (TempOffset != CapOffset)
2028 {
2029 /* Again, a strange issue that shouldn't be seen */
2030 DPRINT1("- Failed to read capability data. ***\n");
2031 ASSERT(TempOffset == CapOffset);
2032 }
2033 }
2034
2035 /* Dump this capability */
2036 DPRINT1("CAP @%02x ID %02x (%s)\n",
2037 CapOffset, CapHeader.CapabilityID, Name);
2038 for (i = 0; i < Size; i += 2)
2039 DPRINT1(" %04x\n", *(PUSHORT)((ULONG_PTR)&CapHeader + i));
2040 DPRINT1("\n");
2041
2042 /* Check the next capability */
2043 CapOffset = CapHeader.Next;
2044 }
2045
2046 /* Check for IDE controllers */
2047 if ((NewExtension->BaseClass == PCI_CLASS_MASS_STORAGE_CTLR) &&
2048 (NewExtension->SubClass == PCI_SUBCLASS_MSC_IDE_CTLR))
2049 {
2050 /* Do not allow them to power down completely */
2051 NewExtension->DisablePowerDown = TRUE;
2052 }
2053
2054 /*
2055 * Check if this is a legacy bridge. Note that the i82375 PCI/EISA
2056 * bridge that is present on certain NT Alpha machines appears as
2057 * non-classified so detect it manually by scanning for its VID/PID.
2058 */
2059 if (((NewExtension->BaseClass == PCI_CLASS_BRIDGE_DEV) &&
2060 ((NewExtension->SubClass == PCI_SUBCLASS_BR_ISA) ||
2061 (NewExtension->SubClass == PCI_SUBCLASS_BR_EISA) ||
2062 (NewExtension->SubClass == PCI_SUBCLASS_BR_MCA))) ||
2063 ((NewExtension->VendorId == 0x8086) &&
2064 (NewExtension->DeviceId == 0x482)))
2065 {
2066 /* Do not allow these legacy bridges to be powered down */
2067 NewExtension->DisablePowerDown = TRUE;
2068 }
2069
2070 /* Check if the BIOS did not configure a cache line size */
2071 if (!PciData->CacheLineSize)
2072 {
2073 /* Check if the device is disabled */
2074 if (!(NewExtension->CommandEnables & (PCI_ENABLE_IO_SPACE |
2077 {
2078 /* Check if this is a PCI-X device*/
2079 TempOffset = PciReadDeviceCapability(NewExtension,
2080 NewExtension->CapabilitiesPtr,
2082 &PcixCapHeader,
2083 sizeof(PCI_CAPABILITIES_HEADER));
2084
2085 /*
2086 * A device with default cache line size and latency timer
2087 * settings is considered to be unconfigured. Note that on
2088 * PCI-X, the reset value of the latency timer field in the
2089 * header is 64, not 0, hence why the check for PCI-X caps
2090 * was required, and the value used here below.
2091 */
2092 if (!(PciData->LatencyTimer) ||
2093 ((TempOffset) && (PciData->LatencyTimer == 64)))
2094 {
2095 /* Keep track of the fact that it needs configuration */
2096 DPRINT1("PCI - ScanBus, PDOx %p found unconfigured\n",
2097 NewExtension);
2098 NewExtension->NeedsHotPlugConfiguration = TRUE;
2099 }
2100 }
2101 }
2102
2103 /* Save latency and cache size information */
2104 NewExtension->SavedLatencyTimer = PciData->LatencyTimer;
2105 NewExtension->SavedCacheLineSize = PciData->CacheLineSize;
2106
2107 /* The PDO is now ready to go */
2108 DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
2109 }
2110 }
2111
2112 /* Enumeration completed, do a final pass now that all devices are found */
2113 if (ProcessFlag) PciProcessBus(DeviceExtension);
2114 return STATUS_SUCCESS;
2115}
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
LPWSTR Name
Definition: desk.c:124
#define L(x)
Definition: resources.c:13
VOID NTAPI PciGetEnhancedCapabilities(IN PPCI_PDO_EXTENSION PdoExtension, IN PPCI_COMMON_HEADER PciData)
Definition: enum.c:1256
VOID NTAPI PciProcessBus(IN PPCI_FDO_EXTENSION DeviceExtension)
Definition: enum.c:1604
BOOLEAN NTAPI PcipIsSameDevice(IN PPCI_PDO_EXTENSION DeviceExtension, IN PPCI_COMMON_HEADER PciData)
Definition: enum.c:1148
VOID NTAPI PciApplyHacks(IN PPCI_FDO_EXTENSION DeviceExtension, IN PPCI_COMMON_HEADER PciData, IN PCI_SLOT_NUMBER SlotNumber, IN ULONG OperationType, PPCI_PDO_EXTENSION PdoExtension)
Definition: enum.c:879
NTSTATUS NTAPI PciGetFunctionLimits(IN PPCI_PDO_EXTENSION PdoExtension, IN PPCI_COMMON_HEADER Current, IN ULONGLONG HackFlags)
Definition: enum.c:1568
PWATCHDOG_TABLE WdTable
Definition: init.c:27
VOID NTAPI PciReadSlotConfig(IN PPCI_FDO_EXTENSION DeviceExtension, IN PCI_SLOT_NUMBER Slot, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: config.c:153
NTSTATUS NTAPI PciPdoCreate(IN PPCI_FDO_EXTENSION DeviceExtension, IN PCI_SLOT_NUMBER Slot, OUT PDEVICE_OBJECT *PdoDeviceObject)
Definition: pdo.c:542
PWCHAR NTAPI PciGetDeviceDescriptionMessage(IN UCHAR BaseClass, IN UCHAR SubClass)
Definition: id.c:88
NTSTATUS NTAPI PciGetBiosConfig(IN PPCI_PDO_EXTENSION DeviceExtension, OUT PPCI_COMMON_HEADER PciData)
Definition: utils.c:768
PPCI_PDO_EXTENSION NTAPI PciFindPdoByFunction(IN PPCI_FDO_EXTENSION DeviceExtension, IN ULONG FunctionNumber, IN PPCI_COMMON_HEADER PciData)
Definition: utils.c:695
BOOLEAN NTAPI PciIsDeviceOnDebugPath(IN PPCI_PDO_EXTENSION DeviceExtension)
Definition: utils.c:751
BOOLEAN NTAPI PciIsCriticalDeviceClass(IN UCHAR BaseClass, IN UCHAR SubClass)
Definition: utils.c:672
NTSTATUS NTAPI PciSetPowerManagedDevicePowerState(IN PPCI_PDO_EXTENSION DeviceExtension, IN DEVICE_POWER_STATE DeviceState, IN BOOLEAN IrpSet)
Definition: power.c:121
ULONGLONG NTAPI PciGetHackFlags(IN USHORT VendorId, IN USHORT DeviceId, IN USHORT SubVendorId, IN USHORT SubSystemId, IN UCHAR RevisionId)
Definition: utils.c:604
NTSTATUS NTAPI PciSaveBiosConfig(IN PPCI_PDO_EXTENSION DeviceExtension, OUT PPCI_COMMON_HEADER PciData)
UCHAR NTAPI PciGetAdjustedInterruptLine(IN PPCI_PDO_EXTENSION PdoExtension)
Definition: config.c:24
#define PCI_SKIP_DEVICE_ENUMERATION
Definition: pci.h:64
#define ASSERT_PDO(x)
Definition: pci.h:38
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
int k
Definition: mpi.c:3369
#define KernelMode
Definition: asm.h:38
_In_ ULONG _In_ PCI_SLOT_NUMBER PciSlot
Definition: pciidex.h:66
#define PCI_HACK_ONE_CHILD
Definition: pci.h:23
#define PCI_HACK_DONT_DISABLE_DECODES
Definition: pci.h:40
#define PCI_HACK_FAKE_CLASS_CODE
Definition: pci.h:43
BOOLEAN ProgIf
Definition: pci.h:284
BOOLEAN BaseClass
Definition: pci.h:286
ULONGLONG HackFlags
Definition: pci.h:311
BOOLEAN AdjustedInterruptLine
Definition: pci.h:288
BOOLEAN InterruptPin
Definition: pci.h:289
BOOLEAN RawInterruptLine
Definition: pci.h:290
USHORT SubsystemVendorId
Definition: pci.h:281
USHORT SubsystemId
Definition: pci.h:282
USHORT CommandEnables
Definition: pci.h:319
BOOLEAN SavedCacheLineSize
Definition: pci.h:293
BOOLEAN SavedLatencyTimer
Definition: pci.h:292
USHORT DeviceId
Definition: pci.h:280
struct _PCI_PDO_EXTENSION * NextBridge
Definition: pci.h:314
BOOLEAN HeaderType
Definition: pci.h:294
USHORT InitialCommand
Definition: pci.h:320
BOOLEAN NeedsHotPlugConfiguration
Definition: pci.h:303
BOOLEAN SubClass
Definition: pci.h:285
BOOLEAN CapabilitiesPtr
Definition: pci.h:291
USHORT VendorId
Definition: pci.h:279
BOOLEAN OnDebugPath
Definition: pci.h:307
BOOLEAN DisablePowerDown
Definition: pci.h:302
BOOLEAN ExpectedWritebackFailure
Definition: pci.h:297
BOOLEAN RevisionId
Definition: pci.h:283
struct _PCI_SLOT_NUMBER::@4639::@4640 bits
union _PCI_SLOT_NUMBER::@4639 u
PBIOS_DATA BiosData
Definition: bios.c:42
int64_t LONGLONG
Definition: typedefs.h:68
uint16_t * PUSHORT
Definition: typedefs.h:56
uint16_t * PWCHAR
Definition: typedefs.h:56
char * PCHAR
Definition: typedefs.h:51
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define PCI_INVALID_VENDORID
Definition: iotypes.h:3603
#define PCI_CAPABILITY_ID_PCIX
Definition: iotypes.h:3655
#define IO_NO_INCREMENT
Definition: iotypes.h:598
struct _PCI_AGP_CAPABILITY PCI_AGP_CAPABILITY
#define PCI_SUBCLASS_SYS_OTHER
Definition: iotypes.h:4187
#define PCI_SUBCLASS_BR_MCA
Definition: iotypes.h:4167
#define PCI_MAX_FUNCTION
Definition: iotypes.h:3601
struct _PCI_PM_CAPABILITY PCI_PM_CAPABILITY
#define PCI_SUBCLASS_BR_CARDBUS
Definition: iotypes.h:4171
#define PCI_CLASS_BASE_SYSTEM_DEV
Definition: iotypes.h:4113
#define PCI_MAX_DEVICES
Definition: iotypes.h:3600
@ Executive
Definition: ketypes.h:467

Referenced by PciQueryDeviceRelations().

◆ PciSetResources()

NTSTATUS NTAPI PciSetResources ( IN PPCI_PDO_EXTENSION  PdoExtension,
IN BOOLEAN  DoReset,
IN BOOLEAN  SomethingSomethingDarkSide 
)

Definition at line 2240 of file enum.c.

2243{
2245 UCHAR NewCacheLineSize, NewLatencyTimer;
2246 PCI_COMMON_HEADER PciData;
2248 PPCI_CONFIGURATOR Configurator;
2249
2250 UNREFERENCED_PARAMETER(SomethingSomethingDarkSide);
2251
2252 /* Get the FDO and read the configuration data */
2253 FdoExtension = PdoExtension->ParentFdoExtension;
2255
2256 /* Make sure this is still the same device */
2257 if (!PcipIsSameDevice(PdoExtension, &PciData))
2258 {
2259 /* Fail */
2260 ASSERTMSG("PCI Set resources - not same device.\n", FALSE);
2262 }
2263
2264 /* Nothing to set for a host bridge */
2265 if ((PdoExtension->BaseClass == PCI_CLASS_BRIDGE_DEV) &&
2266 (PdoExtension->SubClass == PCI_SUBCLASS_BR_HOST))
2267 {
2268 /* Fake success */
2269 return STATUS_SUCCESS;
2270 }
2271
2272 /* Check if an IDE controller is being reset */
2273 if ((DoReset) &&
2274 (PdoExtension->BaseClass == PCI_CLASS_MASS_STORAGE_CTLR) &&
2276 {
2277 /* Turn off native mode */
2279 ASSERT(Native == PdoExtension->IDEInNativeMode);
2280 }
2281
2282 /* Check for update of a hotplug device, or first configuration of one */
2283 if ((PdoExtension->NeedsHotPlugConfiguration) &&
2284 (FdoExtension->HotPlugParameters.Acquired))
2285 {
2286 /* Don't have hotplug devices to test with yet, QEMU 0.14 should */
2288 }
2289
2290 /* Locate the correct resource configurator for this type of device */
2291 Configurator = &PciConfigurators[PdoExtension->HeaderType];
2292
2293 /* Apply the settings change */
2294 Configurator->ChangeResourceSettings(PdoExtension, &PciData);
2295
2296 /* Assume no update needed */
2297 PdoExtension->UpdateHardware = FALSE;
2298
2299 /* Check if a reset is needed */
2300 if (DoReset)
2301 {
2302 /* Reset resources */
2303 Configurator->ResetDevice(PdoExtension, &PciData);
2304 PciData.u.type0.InterruptLine = PdoExtension->RawInterruptLine;
2305 }
2306
2307 /* Check if the latency timer changed */
2308 NewLatencyTimer = PdoExtension->SavedLatencyTimer;
2309 if (PciData.LatencyTimer != NewLatencyTimer)
2310 {
2311 /* Debug notification */
2312 DPRINT1("PCI (pdox %p) changing latency from %02x to %02x.\n",
2314 PciData.LatencyTimer,
2315 NewLatencyTimer);
2316 }
2317
2318 /* Check if the cache line changed */
2319 NewCacheLineSize = PdoExtension->SavedCacheLineSize;
2320 if (PciData.CacheLineSize != NewCacheLineSize)
2321 {
2322 /* Debug notification */
2323 DPRINT1("PCI (pdox %p) changing cache line size from %02x to %02x.\n",
2325 PciData.CacheLineSize,
2326 NewCacheLineSize);
2327 }
2328
2329 /* Inherit data from PDO extension */
2330 PciData.LatencyTimer = PdoExtension->SavedLatencyTimer;
2331 PciData.CacheLineSize = PdoExtension->SavedCacheLineSize;
2332 PciData.u.type0.InterruptLine = PdoExtension->RawInterruptLine;
2333
2334 /* Apply any resource hacks required */
2336 &PciData,
2337 PdoExtension->Slot,
2339 PdoExtension);
2340
2341 /* Check if I/O space was disabled by administrator or driver */
2342 if (PdoExtension->IoSpaceNotRequired)
2343 {
2344 /* Don't turn on the decode */
2345 PdoExtension->CommandEnables &= ~PCI_ENABLE_IO_SPACE;
2346 }
2347
2348 /* Update the device with the new settings */
2350
2351 /* Update complete */
2352 PdoExtension->RawInterruptLine = PciData.u.type0.InterruptLine;
2353 PdoExtension->NeedsHotPlugConfiguration = FALSE;
2354 return STATUS_SUCCESS;
2355}
VOID NTAPI PciUpdateHardware(IN PPCI_PDO_EXTENSION PdoExtension, IN PPCI_COMMON_HEADER PciData)
Definition: enum.c:279
@ FdoExtension
Definition: precomp.h:48
unsigned int Native
Definition: fpcontrol.c:84
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
#define STATUS_DEVICE_DOES_NOT_EXIST
Definition: ntstatus.h:522
PCI_CONFIGURATOR_CHANGE_RESOURCE_SETTINGS ChangeResourceSettings
Definition: pci.h:481
PCI_CONFIGURATOR_RESET_DEVICE ResetDevice
Definition: pci.h:483

Referenced by PciAssignSlotResources(), and PciPdoIrpStartDevice().

◆ PciSkipThisFunction()

BOOLEAN NTAPI PciSkipThisFunction ( IN PPCI_COMMON_HEADER  PciData,
IN PCI_SLOT_NUMBER  Slot,
IN UCHAR  OperationType,
IN ULONGLONG  HackFlags 
)

Definition at line 1182 of file enum.c.

1186{
1187 do
1188 {
1189 /* Check if this is device enumeration */
1190 if (OperationType == PCI_SKIP_DEVICE_ENUMERATION)
1191 {
1192 /* Check if there's a hackflag saying not to enumerate this device */
1194
1195 /* Check if this is the high end of a double decker device */
1197 (Slot.u.bits.DeviceNumber >= 16))
1198 {
1199 /* It belongs to the same device, so skip it */
1200 DPRINT1(" Device (Ven %04x Dev %04x (d=0x%x, f=0x%x)) is a ghost.\n",
1201 PciData->VendorID,
1202 PciData->DeviceID,
1203 Slot.u.bits.DeviceNumber,
1204 Slot.u.bits.FunctionNumber);
1205 break;
1206 }
1207 }
1208 else if (OperationType == PCI_SKIP_RESOURCE_ENUMERATION)
1209 {
1210 /* Resource enumeration, check for a hackflag saying not to do it */
1212 }
1213 else
1214 {
1215 /* Logic error in the driver */
1216 ASSERTMSG("PCI Skip Function - Operation type unknown.\n", FALSE);
1217 }
1218
1219 /* Check for legacy bridges during resource enumeration */
1220 if ((PciData->BaseClass == PCI_CLASS_BRIDGE_DEV) &&
1221 (PciData->SubClass <= PCI_SUBCLASS_BR_MCA) &&
1222 (OperationType == PCI_SKIP_RESOURCE_ENUMERATION))
1223 {
1224 /* Their resources are not enumerated, only PCI and Cardbus/PCMCIA */
1225 break;
1226 }
1227 else if (PciData->BaseClass == PCI_CLASS_NOT_DEFINED)
1228 {
1229 /* Undefined base class (usually a PCI BIOS/ROM bug) */
1230 DPRINT1(" Vendor %04x, Device %04x has class code of PCI_CLASS_NOT_DEFINED\n",
1231 PciData->VendorID,
1232 PciData->DeviceID);
1233
1234 /*
1235 * The Alder has an Intel Extended Express System Support Controller
1236 * which presents apparently spurious BARs. When the PCI resource
1237 * code tries to reassign these BARs, the second IO-APIC gets
1238 * disabled (with disastrous consequences). The first BAR is the
1239 * actual IO-APIC, the remaining five bars seem to be spurious
1240 * resources, so ignore this device completely.
1241 */
1242 if ((PciData->VendorID == 0x8086) && (PciData->DeviceID == 8)) break;
1243 }
1244
1245 /* Other normal PCI cards and bridges are enumerated */
1247 } while (FALSE);
1248
1249 /* Hit one of the known bugs/hackflags, or this is a new kind of PCI unit */
1250 DPRINT1(" Device skipped (not enumerated).\n");
1251 return TRUE;
1252}
#define PCI_HACK_ENUM_NO_RESOURCE
Definition: pci.h:14
#define PCI_HACK_DOUBLE_DECKER
Definition: pci.h:22
#define PCI_CLASS_NOT_DEFINED
Definition: iotypes.h:4123

Referenced by PciGetFunctionLimits(), and PciScanBus().

◆ PciUpdateHardware()

VOID NTAPI PciUpdateHardware ( IN PPCI_PDO_EXTENSION  PdoExtension,
IN PPCI_COMMON_HEADER  PciData 
)

Definition at line 279 of file enum.c.

281{
283
284 /* Check for critical devices and PCI Debugging devices */
285 if ((PdoExtension->HackFlags & PCI_HACK_CRITICAL_DEVICE) ||
286 (PdoExtension->OnDebugPath))
287 {
288 /* Build the context and send an IPI */
289 Context.RunCount = 1;
290 Context.Barrier = 1;
291 Context.Context = PciData;
292 Context.Function = PcipUpdateHardware;
293 Context.DeviceExtension = PdoExtension;
295 }
296 else
297 {
298 /* Just to the update inline */
300 }
301}
VOID NTAPI PcipUpdateHardware(IN PVOID Context, IN PVOID Context2)
Definition: enum.c:252

Referenced by PciSetResources().

◆ PciWriteLimitsAndRestoreCurrent()

VOID NTAPI PciWriteLimitsAndRestoreCurrent ( IN PVOID  Reserved,
IN PVOID  Context2 
)

Definition at line 1384 of file enum.c.

1386{
1388 PPCI_COMMON_HEADER PciData, Current;
1390
1392
1393 /* Grab all parameters from the context */
1394 PdoExtension = Context->PdoExtension;
1395 Current = Context->Current;
1396 PciData = Context->PciData;
1397
1398 /* Write the limit discovery header */
1400
1401 /* Now read what the device indicated the limits are */
1403
1404 /* Then write back the original configuration header */
1406
1407 /* Copy back the original command that was saved in the context */
1408 Current->Command = Context->Command;
1409 if (Context->Command)
1410 {
1411 /* Program it back into the device */
1413 &Context->Command,
1415 sizeof(USHORT));
1416 }
1417
1418 /* Copy back the original status that was saved as well */
1419 Current->Status = Context->Status;
1420
1421 /* Call the configurator to restore any other data that might've changed */
1422 Context->Configurator->RestoreCurrent(Context);
1423}
_Reserved_ PVOID Reserved
Definition: winddi.h:3974

Referenced by PcipGetFunctionLimits().

Variable Documentation

◆ PciConfigurators

PCI_CONFIGURATOR PciConfigurators[]
Initial value:
=
{
{
},
{
},
{
}
}
VOID NTAPI Cardbus_SaveCurrentSettings(IN PPCI_CONFIGURATOR_CONTEXT Context)
Definition: cardbus.c:35
VOID NTAPI Cardbus_MassageHeaderForLimitsDetermination(IN PPCI_CONFIGURATOR_CONTEXT Context)
Definition: cardbus.c:51
VOID NTAPI Cardbus_RestoreCurrent(IN PPCI_CONFIGURATOR_CONTEXT Context)
Definition: cardbus.c:59
VOID NTAPI Cardbus_ChangeResourceSettings(IN PPCI_PDO_EXTENSION PdoExtension, IN PPCI_COMMON_HEADER PciData)
Definition: cardbus.c:89
VOID NTAPI Cardbus_SaveLimits(IN PPCI_CONFIGURATOR_CONTEXT Context)
Definition: cardbus.c:43
VOID NTAPI Cardbus_ResetDevice(IN PPCI_PDO_EXTENSION PdoExtension, IN PPCI_COMMON_HEADER PciData)
Definition: cardbus.c:79
VOID NTAPI Cardbus_GetAdditionalResourceDescriptors(IN PPCI_CONFIGURATOR_CONTEXT Context, IN PPCI_COMMON_HEADER PciData, IN PIO_RESOURCE_DESCRIPTOR IoDescriptor)
Definition: cardbus.c:67
VOID NTAPI Device_GetAdditionalResourceDescriptors(IN PPCI_CONFIGURATOR_CONTEXT Context, IN PPCI_COMMON_HEADER PciData, IN PIO_RESOURCE_DESCRIPTOR IoDescriptor)
Definition: device.c:259
VOID NTAPI Device_ChangeResourceSettings(IN PPCI_PDO_EXTENSION PdoExtension, IN PPCI_COMMON_HEADER PciData)
Definition: device.c:283
VOID NTAPI Device_SaveLimits(IN PPCI_CONFIGURATOR_CONTEXT Context)
Definition: device.c:118
VOID NTAPI Device_MassageHeaderForLimitsDetermination(IN PPCI_CONFIGURATOR_CONTEXT Context)
Definition: device.c:218
VOID NTAPI Device_SaveCurrentSettings(IN PPCI_CONFIGURATOR_CONTEXT Context)
Definition: device.c:20
VOID NTAPI Device_ResetDevice(IN PPCI_PDO_EXTENSION PdoExtension, IN PPCI_COMMON_HEADER PciData)
Definition: device.c:272
VOID NTAPI Device_RestoreCurrent(IN PPCI_CONFIGURATOR_CONTEXT Context)
Definition: device.c:250
VOID NTAPI PPBridge_SaveCurrentSettings(IN PPCI_CONFIGURATOR_CONTEXT Context)
Definition: ppbridge.c:225
VOID NTAPI PPBridge_GetAdditionalResourceDescriptors(IN PPCI_CONFIGURATOR_CONTEXT Context, IN PPCI_COMMON_HEADER PciData, IN PIO_RESOURCE_DESCRIPTOR IoDescriptor)
Definition: ppbridge.c:628
VOID NTAPI PPBridge_RestoreCurrent(IN PPCI_CONFIGURATOR_CONTEXT Context)
Definition: ppbridge.c:620
VOID NTAPI PPBridge_MassageHeaderForLimitsDetermination(IN PPCI_CONFIGURATOR_CONTEXT Context)
Definition: ppbridge.c:582
VOID NTAPI PPBridge_ChangeResourceSettings(IN PPCI_PDO_EXTENSION PdoExtension, IN PPCI_COMMON_HEADER PciData)
Definition: ppbridge.c:683
VOID NTAPI PPBridge_SaveLimits(IN PPCI_CONFIGURATOR_CONTEXT Context)
Definition: ppbridge.c:465
VOID NTAPI PPBridge_ResetDevice(IN PPCI_PDO_EXTENSION PdoExtension, IN PPCI_COMMON_HEADER PciData)
Definition: ppbridge.c:673

Definition at line 20 of file enum.c.

Referenced by PciBuildRequirementsList(), PcipGetFunctionLimits(), and PciSetResources().

◆ PciZeroIoResourceRequirements

PIO_RESOURCE_REQUIREMENTS_LIST PciZeroIoResourceRequirements

Definition at line 18 of file enum.c.

Referenced by PciBuildRequirementsList(), and PciQueryRequirements().