14 #define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
15 #define TAG_PCI TAG('P', 'C', 'I', '0')
17 typedef struct _PCI_DEVICE
19 // Entry on device list
21 // Physical Device Object of device
26 PCI_SLOT_NUMBER SlotNumber
;
27 // PCI configuration data
28 PCI_COMMON_CONFIG PciConfig
;
29 // Flag used during enumeration to locate removed devices
30 BOOLEAN RemovePending
;
31 } PCI_DEVICE
, *PPCI_DEVICE
;
43 typedef struct _COMMON_DEVICE_EXTENSION
45 // Pointer to device object, this device extension is associated with
46 PDEVICE_OBJECT DeviceObject
;
47 // Wether this device extension is for an FDO or PDO
49 // Wether the device is removed
51 // Current device power state for the device
52 DEVICE_POWER_STATE DevicePowerState
;
53 } COMMON_DEVICE_EXTENSION
, *PCOMMON_DEVICE_EXTENSION
;
55 /* Physical Device Object device extension for a child device */
56 typedef struct _PDO_DEVICE_EXTENSION
59 COMMON_DEVICE_EXTENSION Common
;
60 // Functional device object
62 // Pointer to PCI Device informations
63 PPCI_DEVICE PciDevice
;
65 UNICODE_STRING DeviceID
;
67 UNICODE_STRING InstanceID
;
69 UNICODE_STRING HardwareIDs
;
71 UNICODE_STRING CompatibleIDs
;
72 // Textual description of device
73 UNICODE_STRING DeviceDescription
;
74 // Textual description of device location
75 UNICODE_STRING DeviceLocation
;
76 // Number of interfaces references
78 } PDO_DEVICE_EXTENSION
, *PPDO_DEVICE_EXTENSION
;
80 /* Functional Device Object device extension for the PCI driver device object */
81 typedef struct _FDO_DEVICE_EXTENSION
84 COMMON_DEVICE_EXTENSION Common
;
85 // Entry on device list
87 // PCI bus number serviced by this FDO
89 // Current state of the driver
90 PCI_DEVICE_STATE State
;
91 // Namespace device list
92 LIST_ENTRY DeviceListHead
;
93 // Number of (not removed) devices in device list
94 ULONG DeviceListCount
;
95 // Lock for namespace device list
96 KSPIN_LOCK DeviceListLock
;
97 // Lower device object
99 } FDO_DEVICE_EXTENSION
, *PFDO_DEVICE_EXTENSION
;
102 /* Driver extension associated with PCI driver */
103 typedef struct _PCI_DRIVER_EXTENSION
106 LIST_ENTRY BusListHead
;
107 // Lock for namespace bus list
108 KSPIN_LOCK BusListLock
;
109 } PCI_DRIVER_EXTENSION
, *PPCI_DRIVER_EXTENSION
;
112 /* We need a global variable to get the driver extension,
113 * because at least InterfacePciDevicePresent has no
114 * other way to get it... */
115 extern PPCI_DRIVER_EXTENSION DriverExtension
;
121 PDEVICE_OBJECT DeviceObject
,
126 PDEVICE_OBJECT DeviceObject
,
132 PciCreateDeviceIDString(
133 PUNICODE_STRING DeviceID
,
137 PciCreateInstanceIDString(
138 PUNICODE_STRING InstanceID
,
142 PciCreateHardwareIDsString(
143 PUNICODE_STRING HardwareIDs
,
147 PciCreateCompatibleIDsString(
148 PUNICODE_STRING HardwareIDs
,
152 PciCreateDeviceDescriptionString(
153 PUNICODE_STRING DeviceDescription
,
157 PciCreateDeviceLocationString(
158 PUNICODE_STRING DeviceLocation
,
162 PciDuplicateUnicodeString(
164 IN PCUNICODE_STRING SourceString
,
165 OUT PUNICODE_STRING DestinationString
);
171 PDEVICE_OBJECT DeviceObject
,
176 PDEVICE_OBJECT DeviceObject
,
182 IN PDRIVER_OBJECT DriverObject
,
183 IN PUNICODE_STRING RegistryPath
);