xref: /reactos/drivers/bus/pcix/pci.h (revision b82bf8ce)
1c2c66affSColin Finck /*
2c2c66affSColin Finck  * PROJECT:         ReactOS PCI Bus Driver
3c2c66affSColin Finck  * LICENSE:         BSD - See COPYING.ARM in the top level directory
4c2c66affSColin Finck  * FILE:            drivers/bus/pci/pci.h
5c2c66affSColin Finck  * PURPOSE:         Main Header File
6c2c66affSColin Finck  * PROGRAMMERS:     ReactOS Portable Systems Group
7c2c66affSColin Finck  */
8c2c66affSColin Finck 
9c2c66affSColin Finck #ifndef _PCIX_PCH_
10c2c66affSColin Finck #define _PCIX_PCH_
11c2c66affSColin Finck 
12c2c66affSColin Finck #include <ntifs.h>
13c2c66affSColin Finck #include <wdmguid.h>
14c2c66affSColin Finck #include <wchar.h>
15c2c66affSColin Finck #include <acpiioct.h>
16c2c66affSColin Finck #include <drivers/pci/pci.h>
17c2c66affSColin Finck #include <drivers/acpi/acpi.h>
18c2c66affSColin Finck #include <ndk/halfuncs.h>
19c2c66affSColin Finck #include <ndk/rtlfuncs.h>
20c2c66affSColin Finck #include <ndk/vffuncs.h>
21ef2323a1SVadim Galyant #include <arbiter.h>
22*b82bf8ceSTimo Kreuzer #include <cmreslist.h>
23c2c66affSColin Finck 
24c2c66affSColin Finck //
25c2c66affSColin Finck // Tag used in all pool allocations (Pci Bus)
26c2c66affSColin Finck //
27c2c66affSColin Finck #define PCI_POOL_TAG    'BicP'
28c2c66affSColin Finck 
29c2c66affSColin Finck //
30c2c66affSColin Finck // Checks if the specified FDO is the FDO for the Root PCI Bus
31c2c66affSColin Finck //
32c2c66affSColin Finck #define PCI_IS_ROOT_FDO(x)                  ((x)->BusRootFdoExtension == x)
33c2c66affSColin Finck 
34c2c66affSColin Finck //
35c2c66affSColin Finck // Assertions to make sure we are dealing with the right kind of extension
36c2c66affSColin Finck //
37c2c66affSColin Finck #define ASSERT_FDO(x)                       ASSERT((x)->ExtensionType == PciFdoExtensionType);
38c2c66affSColin Finck #define ASSERT_PDO(x)                       ASSERT((x)->ExtensionType == PciPdoExtensionType);
39c2c66affSColin Finck 
40c2c66affSColin Finck //
41c2c66affSColin Finck // PCI Hack Entry Name Lengths
42c2c66affSColin Finck //
43c2c66affSColin Finck #define PCI_HACK_ENTRY_SIZE                 sizeof(L"VVVVdddd") - sizeof(UNICODE_NULL)
44c2c66affSColin Finck #define PCI_HACK_ENTRY_REV_SIZE             sizeof(L"VVVVddddRR") - sizeof(UNICODE_NULL)
45c2c66affSColin Finck #define PCI_HACK_ENTRY_SUBSYS_SIZE          sizeof(L"VVVVddddssssIIII") - sizeof(UNICODE_NULL)
46c2c66affSColin Finck #define PCI_HACK_ENTRY_FULL_SIZE            sizeof(L"VVVVddddssssIIIIRR") - sizeof(UNICODE_NULL)
47c2c66affSColin Finck 
48c2c66affSColin Finck //
49c2c66affSColin Finck // PCI Hack Entry Flags
50c2c66affSColin Finck //
51c2c66affSColin Finck #define PCI_HACK_HAS_REVISION_INFO          0x01
52c2c66affSColin Finck #define PCI_HACK_HAS_SUBSYSTEM_INFO         0x02
53c2c66affSColin Finck 
54c2c66affSColin Finck //
55c2c66affSColin Finck // PCI Interface Flags
56c2c66affSColin Finck //
57c2c66affSColin Finck #define PCI_INTERFACE_PDO                   0x01
58c2c66affSColin Finck #define PCI_INTERFACE_FDO                   0x02
59c2c66affSColin Finck #define PCI_INTERFACE_ROOT                  0x04
60c2c66affSColin Finck 
61c2c66affSColin Finck //
62c2c66affSColin Finck // PCI Skip Function Flags
63c2c66affSColin Finck //
64c2c66affSColin Finck #define PCI_SKIP_DEVICE_ENUMERATION         0x01
65c2c66affSColin Finck #define PCI_SKIP_RESOURCE_ENUMERATION       0x02
66c2c66affSColin Finck 
67c2c66affSColin Finck //
68c2c66affSColin Finck // PCI Apply Hack Flags
69c2c66affSColin Finck //
70c2c66affSColin Finck #define PCI_HACK_FIXUP_BEFORE_CONFIGURATION 0x00
71c2c66affSColin Finck #define PCI_HACK_FIXUP_AFTER_CONFIGURATION  0x01
72c2c66affSColin Finck #define PCI_HACK_FIXUP_BEFORE_UPDATE        0x03
73c2c66affSColin Finck 
74c2c66affSColin Finck //
75c2c66affSColin Finck // PCI Debugging Device Support
76c2c66affSColin Finck //
77c2c66affSColin Finck #define MAX_DEBUGGING_DEVICES_SUPPORTED     0x04
78c2c66affSColin Finck 
79c2c66affSColin Finck //
80c2c66affSColin Finck // PCI Driver Verifier Failures
81c2c66affSColin Finck //
82c2c66affSColin Finck #define PCI_VERIFIER_CODES                  0x04
83c2c66affSColin Finck 
84c2c66affSColin Finck //
85c2c66affSColin Finck // PCI ID Buffer ANSI Strings
86c2c66affSColin Finck //
87c2c66affSColin Finck #define MAX_ANSI_STRINGS                    0x08
88c2c66affSColin Finck 
89c2c66affSColin Finck //
90c2c66affSColin Finck // Device Extension, Interface, Translator and Arbiter Signatures
91c2c66affSColin Finck //
92c2c66affSColin Finck typedef enum _PCI_SIGNATURE
93c2c66affSColin Finck {
94c2c66affSColin Finck     PciPdoExtensionType = 'icP0',
95c2c66affSColin Finck     PciFdoExtensionType = 'icP1',
96c2c66affSColin Finck     PciArb_Io = 'icP2',
97c2c66affSColin Finck     PciArb_Memory = 'icP3',
98c2c66affSColin Finck     PciArb_Interrupt = 'icP4',
99c2c66affSColin Finck     PciArb_BusNumber = 'icP5',
100c2c66affSColin Finck     PciTrans_Interrupt = 'icP6',
101c2c66affSColin Finck     PciInterface_BusHandler = 'icP7',
102c2c66affSColin Finck     PciInterface_IntRouteHandler = 'icP8',
103c2c66affSColin Finck     PciInterface_PciCb = 'icP9',
104c2c66affSColin Finck     PciInterface_LegacyDeviceDetection = 'icP:',
105c2c66affSColin Finck     PciInterface_PmeHandler = 'icP;',
106c2c66affSColin Finck     PciInterface_DevicePresent = 'icP<',
107c2c66affSColin Finck     PciInterface_NativeIde = 'icP=',
108c2c66affSColin Finck     PciInterface_AgpTarget = 'icP>',
109c2c66affSColin Finck     PciInterface_Location  = 'icP?'
110c2c66affSColin Finck } PCI_SIGNATURE, *PPCI_SIGNATURE;
111c2c66affSColin Finck 
112c2c66affSColin Finck //
113c2c66affSColin Finck // Driver-handled PCI Device Types
114c2c66affSColin Finck //
115c2c66affSColin Finck typedef enum _PCI_DEVICE_TYPES
116c2c66affSColin Finck {
117c2c66affSColin Finck     PciTypeInvalid,
118c2c66affSColin Finck     PciTypeHostBridge,
119c2c66affSColin Finck     PciTypePciBridge,
120c2c66affSColin Finck     PciTypeCardbusBridge,
121c2c66affSColin Finck     PciTypeDevice
122c2c66affSColin Finck } PCI_DEVICE_TYPES;
123c2c66affSColin Finck 
124c2c66affSColin Finck //
125c2c66affSColin Finck // Device Extension Logic States
126c2c66affSColin Finck //
127c2c66affSColin Finck typedef enum _PCI_STATE
128c2c66affSColin Finck {
129c2c66affSColin Finck     PciNotStarted,
130c2c66affSColin Finck     PciStarted,
131c2c66affSColin Finck     PciDeleted,
132c2c66affSColin Finck     PciStopped,
133c2c66affSColin Finck     PciSurpriseRemoved,
134c2c66affSColin Finck     PciSynchronizedOperation,
135c2c66affSColin Finck     PciMaxObjectState
136c2c66affSColin Finck } PCI_STATE;
137c2c66affSColin Finck 
138c2c66affSColin Finck //
139c2c66affSColin Finck // IRP Dispatch Logic Style
140c2c66affSColin Finck //
141c2c66affSColin Finck typedef enum _PCI_DISPATCH_STYLE
142c2c66affSColin Finck {
143c2c66affSColin Finck     IRP_COMPLETE,
144c2c66affSColin Finck     IRP_DOWNWARD,
145c2c66affSColin Finck     IRP_UPWARD,
146c2c66affSColin Finck     IRP_DISPATCH,
147c2c66affSColin Finck } PCI_DISPATCH_STYLE;
148c2c66affSColin Finck 
149c2c66affSColin Finck //
150c2c66affSColin Finck // PCI Hack Entry Information
151c2c66affSColin Finck //
152c2c66affSColin Finck typedef struct _PCI_HACK_ENTRY
153c2c66affSColin Finck {
154c2c66affSColin Finck     USHORT VendorID;
155c2c66affSColin Finck     USHORT DeviceID;
156c2c66affSColin Finck     USHORT SubVendorID;
157c2c66affSColin Finck     USHORT SubSystemID;
158c2c66affSColin Finck     ULONGLONG HackFlags;
159c2c66affSColin Finck     USHORT RevisionID;
160c2c66affSColin Finck     UCHAR Flags;
161c2c66affSColin Finck } PCI_HACK_ENTRY, *PPCI_HACK_ENTRY;
162c2c66affSColin Finck 
163c2c66affSColin Finck //
164c2c66affSColin Finck // Power State Information for Device Extension
165c2c66affSColin Finck //
166c2c66affSColin Finck typedef struct _PCI_POWER_STATE
167c2c66affSColin Finck {
168c2c66affSColin Finck     SYSTEM_POWER_STATE CurrentSystemState;
169c2c66affSColin Finck     DEVICE_POWER_STATE CurrentDeviceState;
170c2c66affSColin Finck     SYSTEM_POWER_STATE SystemWakeLevel;
171c2c66affSColin Finck     DEVICE_POWER_STATE DeviceWakeLevel;
172c2c66affSColin Finck     DEVICE_POWER_STATE SystemStateMapping[7];
173c2c66affSColin Finck     PIRP WaitWakeIrp;
174c2c66affSColin Finck     PVOID SavedCancelRoutine;
175c2c66affSColin Finck     LONG Paging;
176c2c66affSColin Finck     LONG Hibernate;
177c2c66affSColin Finck     LONG CrashDump;
178c2c66affSColin Finck } PCI_POWER_STATE, *PPCI_POWER_STATE;
179c2c66affSColin Finck 
180c2c66affSColin Finck //
181c2c66affSColin Finck // Internal PCI Lock Structure
182c2c66affSColin Finck //
183c2c66affSColin Finck typedef struct _PCI_LOCK
184c2c66affSColin Finck {
185c2c66affSColin Finck     LONG Atom;
186c2c66affSColin Finck     BOOLEAN OldIrql;
187c2c66affSColin Finck } PCI_LOCK, *PPCI_LOCK;
188c2c66affSColin Finck 
189c2c66affSColin Finck //
190c2c66affSColin Finck // Device Extension for a Bus FDO
191c2c66affSColin Finck //
192c2c66affSColin Finck typedef struct _PCI_FDO_EXTENSION
193c2c66affSColin Finck {
194c2c66affSColin Finck     SINGLE_LIST_ENTRY List;
195c2c66affSColin Finck     ULONG ExtensionType;
196c2c66affSColin Finck     struct _PCI_MJ_DISPATCH_TABLE *IrpDispatchTable;
197c2c66affSColin Finck     BOOLEAN DeviceState;
198c2c66affSColin Finck     BOOLEAN TentativeNextState;
199c2c66affSColin Finck     KEVENT SecondaryExtLock;
200c2c66affSColin Finck     PDEVICE_OBJECT PhysicalDeviceObject;
201c2c66affSColin Finck     PDEVICE_OBJECT FunctionalDeviceObject;
202c2c66affSColin Finck     PDEVICE_OBJECT AttachedDeviceObject;
203c2c66affSColin Finck     KEVENT ChildListLock;
204c2c66affSColin Finck     struct _PCI_PDO_EXTENSION *ChildPdoList;
205c2c66affSColin Finck     struct _PCI_FDO_EXTENSION *BusRootFdoExtension;
206c2c66affSColin Finck     struct _PCI_FDO_EXTENSION *ParentFdoExtension;
207c2c66affSColin Finck     struct _PCI_PDO_EXTENSION *ChildBridgePdoList;
208c2c66affSColin Finck     PPCI_BUS_INTERFACE_STANDARD PciBusInterface;
209c2c66affSColin Finck     BOOLEAN MaxSubordinateBus;
210c2c66affSColin Finck     BUS_HANDLER *BusHandler;
211c2c66affSColin Finck     BOOLEAN BaseBus;
212c2c66affSColin Finck     BOOLEAN Fake;
213c2c66affSColin Finck     BOOLEAN ChildDelete;
214c2c66affSColin Finck     BOOLEAN Scanned;
215c2c66affSColin Finck     BOOLEAN ArbitersInitialized;
216c2c66affSColin Finck     BOOLEAN BrokenVideoHackApplied;
217c2c66affSColin Finck     BOOLEAN Hibernated;
218c2c66affSColin Finck     PCI_POWER_STATE PowerState;
219c2c66affSColin Finck     SINGLE_LIST_ENTRY SecondaryExtension;
220c2c66affSColin Finck     LONG ChildWaitWakeCount;
221c2c66affSColin Finck     PPCI_COMMON_CONFIG PreservedConfig;
222c2c66affSColin Finck     PCI_LOCK Lock;
223c2c66affSColin Finck     struct
224c2c66affSColin Finck     {
225c2c66affSColin Finck         BOOLEAN Acquired;
226c2c66affSColin Finck         BOOLEAN CacheLineSize;
227c2c66affSColin Finck         BOOLEAN LatencyTimer;
228c2c66affSColin Finck         BOOLEAN EnablePERR;
229c2c66affSColin Finck         BOOLEAN EnableSERR;
230c2c66affSColin Finck     } HotPlugParameters;
231c2c66affSColin Finck     LONG BusHackFlags;
232c2c66affSColin Finck } PCI_FDO_EXTENSION, *PPCI_FDO_EXTENSION;
233c2c66affSColin Finck 
234c2c66affSColin Finck typedef struct _PCI_FUNCTION_RESOURCES
235c2c66affSColin Finck {
236c2c66affSColin Finck     IO_RESOURCE_DESCRIPTOR Limit[7];
237c2c66affSColin Finck     CM_PARTIAL_RESOURCE_DESCRIPTOR Current[7];
238c2c66affSColin Finck } PCI_FUNCTION_RESOURCES, *PPCI_FUNCTION_RESOURCES;
239c2c66affSColin Finck 
240c2c66affSColin Finck typedef union _PCI_HEADER_TYPE_DEPENDENT
241c2c66affSColin Finck {
242c2c66affSColin Finck     struct
243c2c66affSColin Finck     {
244c2c66affSColin Finck         UCHAR Spare[4];
245c2c66affSColin Finck     } type0;
246c2c66affSColin Finck     struct
247c2c66affSColin Finck     {
248c2c66affSColin Finck         UCHAR PrimaryBus;
249c2c66affSColin Finck         UCHAR SecondaryBus;
250c2c66affSColin Finck         UCHAR SubordinateBus;
251c2c66affSColin Finck         UCHAR SubtractiveDecode:1;
252c2c66affSColin Finck         UCHAR IsaBitSet:1;
253c2c66affSColin Finck         UCHAR VgaBitSet:1;
254c2c66affSColin Finck         UCHAR WeChangedBusNumbers:1;
255c2c66affSColin Finck         UCHAR IsaBitRequired:1;
256c2c66affSColin Finck     } type1;
257c2c66affSColin Finck     struct
258c2c66affSColin Finck     {
259c2c66affSColin Finck         UCHAR Spare[4];
260c2c66affSColin Finck     } type2;
261c2c66affSColin Finck } PCI_HEADER_TYPE_DEPENDENT, *PPCI_HEADER_TYPE_DEPENDENT;
262c2c66affSColin Finck 
263c2c66affSColin Finck typedef struct _PCI_PDO_EXTENSION
264c2c66affSColin Finck {
265c2c66affSColin Finck     PVOID Next;
266c2c66affSColin Finck     ULONG ExtensionType;
267c2c66affSColin Finck     struct _PCI_MJ_DISPATCH_TABLE *IrpDispatchTable;
268c2c66affSColin Finck     BOOLEAN DeviceState;
269c2c66affSColin Finck     BOOLEAN TentativeNextState;
270c2c66affSColin Finck 
271c2c66affSColin Finck     KEVENT SecondaryExtLock;
272c2c66affSColin Finck     PCI_SLOT_NUMBER Slot;
273c2c66affSColin Finck     PDEVICE_OBJECT PhysicalDeviceObject;
274c2c66affSColin Finck     PPCI_FDO_EXTENSION ParentFdoExtension;
275c2c66affSColin Finck     SINGLE_LIST_ENTRY SecondaryExtension;
276c2c66affSColin Finck     LONG BusInterfaceReferenceCount;
277c2c66affSColin Finck     LONG AgpInterfaceReferenceCount;
278c2c66affSColin Finck     USHORT VendorId;
279c2c66affSColin Finck     USHORT DeviceId;
280c2c66affSColin Finck     USHORT SubsystemVendorId;
281c2c66affSColin Finck     USHORT SubsystemId;
282c2c66affSColin Finck     BOOLEAN RevisionId;
283c2c66affSColin Finck     BOOLEAN ProgIf;
284c2c66affSColin Finck     BOOLEAN SubClass;
285c2c66affSColin Finck     BOOLEAN BaseClass;
286c2c66affSColin Finck     BOOLEAN AdditionalResourceCount;
287c2c66affSColin Finck     BOOLEAN AdjustedInterruptLine;
288c2c66affSColin Finck     BOOLEAN InterruptPin;
289c2c66affSColin Finck     BOOLEAN RawInterruptLine;
290c2c66affSColin Finck     BOOLEAN CapabilitiesPtr;
291c2c66affSColin Finck     BOOLEAN SavedLatencyTimer;
292c2c66affSColin Finck     BOOLEAN SavedCacheLineSize;
293c2c66affSColin Finck     BOOLEAN HeaderType;
294c2c66affSColin Finck     BOOLEAN NotPresent;
295c2c66affSColin Finck     BOOLEAN ReportedMissing;
296c2c66affSColin Finck     BOOLEAN ExpectedWritebackFailure;
297c2c66affSColin Finck     BOOLEAN NoTouchPmeEnable;
298c2c66affSColin Finck     BOOLEAN LegacyDriver;
299c2c66affSColin Finck     BOOLEAN UpdateHardware;
300c2c66affSColin Finck     BOOLEAN MovedDevice;
301c2c66affSColin Finck     BOOLEAN DisablePowerDown;
302c2c66affSColin Finck     BOOLEAN NeedsHotPlugConfiguration;
303c2c66affSColin Finck     BOOLEAN IDEInNativeMode;
304c2c66affSColin Finck     BOOLEAN BIOSAllowsIDESwitchToNativeMode;
305c2c66affSColin Finck     BOOLEAN IoSpaceUnderNativeIdeControl;
306c2c66affSColin Finck     BOOLEAN OnDebugPath;
307c2c66affSColin Finck     BOOLEAN IoSpaceNotRequired;
308c2c66affSColin Finck     PCI_POWER_STATE PowerState;
309c2c66affSColin Finck     PCI_HEADER_TYPE_DEPENDENT Dependent;
310c2c66affSColin Finck     ULONGLONG HackFlags;
311c2c66affSColin Finck     PCI_FUNCTION_RESOURCES *Resources;
312c2c66affSColin Finck     PCI_FDO_EXTENSION *BridgeFdoExtension;
313c2c66affSColin Finck     struct _PCI_PDO_EXTENSION *NextBridge;
314c2c66affSColin Finck     struct _PCI_PDO_EXTENSION *NextHashEntry;
315c2c66affSColin Finck     PCI_LOCK Lock;
316c2c66affSColin Finck     PCI_PMC PowerCapabilities;
317c2c66affSColin Finck     BOOLEAN TargetAgpCapabilityId;
318c2c66affSColin Finck     USHORT CommandEnables;
319c2c66affSColin Finck     USHORT InitialCommand;
320c2c66affSColin Finck } PCI_PDO_EXTENSION, *PPCI_PDO_EXTENSION;
321c2c66affSColin Finck 
322c2c66affSColin Finck //
323c2c66affSColin Finck // IRP Dispatch Function Type
324c2c66affSColin Finck //
325c2c66affSColin Finck typedef NTSTATUS (NTAPI *PCI_DISPATCH_FUNCTION)(
326c2c66affSColin Finck     IN PIRP Irp,
327c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
328c2c66affSColin Finck     IN PVOID DeviceExtension
329c2c66affSColin Finck );
330c2c66affSColin Finck 
331c2c66affSColin Finck //
332c2c66affSColin Finck // IRP Dispatch Minor Table
333c2c66affSColin Finck //
334c2c66affSColin Finck typedef struct _PCI_MN_DISPATCH_TABLE
335c2c66affSColin Finck {
336c2c66affSColin Finck     PCI_DISPATCH_STYLE DispatchStyle;
337c2c66affSColin Finck     PCI_DISPATCH_FUNCTION DispatchFunction;
338c2c66affSColin Finck } PCI_MN_DISPATCH_TABLE, *PPCI_MN_DISPATCH_TABLE;
339c2c66affSColin Finck 
340c2c66affSColin Finck //
341c2c66affSColin Finck // IRP Dispatch Major Table
342c2c66affSColin Finck //
343c2c66affSColin Finck typedef struct _PCI_MJ_DISPATCH_TABLE
344c2c66affSColin Finck {
345c2c66affSColin Finck     ULONG PnpIrpMaximumMinorFunction;
346c2c66affSColin Finck     PPCI_MN_DISPATCH_TABLE PnpIrpDispatchTable;
347c2c66affSColin Finck     ULONG PowerIrpMaximumMinorFunction;
348c2c66affSColin Finck     PPCI_MN_DISPATCH_TABLE PowerIrpDispatchTable;
349c2c66affSColin Finck     PCI_DISPATCH_STYLE SystemControlIrpDispatchStyle;
350c2c66affSColin Finck     PCI_DISPATCH_FUNCTION SystemControlIrpDispatchFunction;
351c2c66affSColin Finck     PCI_DISPATCH_STYLE OtherIrpDispatchStyle;
352c2c66affSColin Finck     PCI_DISPATCH_FUNCTION OtherIrpDispatchFunction;
353c2c66affSColin Finck } PCI_MJ_DISPATCH_TABLE, *PPCI_MJ_DISPATCH_TABLE;
354c2c66affSColin Finck 
355c2c66affSColin Finck //
356c2c66affSColin Finck // Generic PCI Interface Constructor and Initializer
357c2c66affSColin Finck //
358c2c66affSColin Finck struct _PCI_INTERFACE;
359c2c66affSColin Finck typedef NTSTATUS (NTAPI *PCI_INTERFACE_CONSTRUCTOR)(
360c2c66affSColin Finck     IN PVOID DeviceExtension,
361c2c66affSColin Finck     IN PVOID Instance,
362c2c66affSColin Finck     IN PVOID InterfaceData,
363c2c66affSColin Finck     IN USHORT Version,
364c2c66affSColin Finck     IN USHORT Size,
365c2c66affSColin Finck     IN PINTERFACE Interface
366c2c66affSColin Finck );
367c2c66affSColin Finck 
368c2c66affSColin Finck typedef NTSTATUS (NTAPI *PCI_INTERFACE_INITIALIZER)(
369c2c66affSColin Finck     IN PVOID Instance
370c2c66affSColin Finck );
371c2c66affSColin Finck 
372c2c66affSColin Finck //
373c2c66affSColin Finck // Generic PCI Interface (Interface, Translator, Arbiter)
374c2c66affSColin Finck //
375c2c66affSColin Finck typedef struct _PCI_INTERFACE
376c2c66affSColin Finck {
377c2c66affSColin Finck     CONST GUID *InterfaceType;
378c2c66affSColin Finck     USHORT MinSize;
379c2c66affSColin Finck     USHORT MinVersion;
380c2c66affSColin Finck     USHORT MaxVersion;
381c2c66affSColin Finck     USHORT Flags;
382c2c66affSColin Finck     LONG ReferenceCount;
383c2c66affSColin Finck     PCI_SIGNATURE Signature;
384c2c66affSColin Finck     PCI_INTERFACE_CONSTRUCTOR Constructor;
385c2c66affSColin Finck     PCI_INTERFACE_INITIALIZER Initializer;
386c2c66affSColin Finck } PCI_INTERFACE, *PPCI_INTERFACE;
387c2c66affSColin Finck 
388c2c66affSColin Finck //
389c2c66affSColin Finck // Generic Secondary Extension Instance Header (Interface, Translator, Arbiter)
390c2c66affSColin Finck //
391c2c66affSColin Finck typedef struct PCI_SECONDARY_EXTENSION
392c2c66affSColin Finck {
393c2c66affSColin Finck     SINGLE_LIST_ENTRY List;
394c2c66affSColin Finck     PCI_SIGNATURE ExtensionType;
395c2c66affSColin Finck     PVOID Destructor;
396c2c66affSColin Finck } PCI_SECONDARY_EXTENSION, *PPCI_SECONDARY_EXTENSION;
397c2c66affSColin Finck 
398c2c66affSColin Finck //
399c2c66affSColin Finck // PCI Arbiter Instance
400c2c66affSColin Finck //
401c2c66affSColin Finck typedef struct PCI_ARBITER_INSTANCE
402c2c66affSColin Finck {
403c2c66affSColin Finck     PCI_SECONDARY_EXTENSION Header;
404c2c66affSColin Finck     PPCI_INTERFACE Interface;
405c2c66affSColin Finck     PPCI_FDO_EXTENSION BusFdoExtension;
406c2c66affSColin Finck     WCHAR InstanceName[24];
407ef2323a1SVadim Galyant     ARBITER_INSTANCE CommonInstance;
408c2c66affSColin Finck } PCI_ARBITER_INSTANCE, *PPCI_ARBITER_INSTANCE;
409c2c66affSColin Finck 
410c2c66affSColin Finck //
411c2c66affSColin Finck // PCI Verifier Data
412c2c66affSColin Finck //
413c2c66affSColin Finck typedef struct _PCI_VERIFIER_DATA
414c2c66affSColin Finck {
415c2c66affSColin Finck     ULONG FailureCode;
416c2c66affSColin Finck     VF_FAILURE_CLASS FailureClass;
417c2c66affSColin Finck     ULONG AssertionControl;
418c2c66affSColin Finck     PCHAR DebuggerMessageText;
419c2c66affSColin Finck } PCI_VERIFIER_DATA, *PPCI_VERIFIER_DATA;
420c2c66affSColin Finck 
421c2c66affSColin Finck //
422c2c66affSColin Finck // PCI ID Buffer Descriptor
423c2c66affSColin Finck //
424c2c66affSColin Finck typedef struct _PCI_ID_BUFFER
425c2c66affSColin Finck {
426c2c66affSColin Finck     ULONG Count;
427c2c66affSColin Finck     ANSI_STRING Strings[MAX_ANSI_STRINGS];
428c2c66affSColin Finck     ULONG StringSize[MAX_ANSI_STRINGS];
429c2c66affSColin Finck     ULONG TotalLength;
430c2c66affSColin Finck     PCHAR CharBuffer;
431c2c66affSColin Finck     CHAR BufferData[256];
432c2c66affSColin Finck } PCI_ID_BUFFER, *PPCI_ID_BUFFER;
433c2c66affSColin Finck 
434c2c66affSColin Finck //
435c2c66affSColin Finck // PCI Configuration Callbacks
436c2c66affSColin Finck //
437c2c66affSColin Finck struct _PCI_CONFIGURATOR_CONTEXT;
438c2c66affSColin Finck 
439c2c66affSColin Finck typedef VOID (NTAPI *PCI_CONFIGURATOR_INITIALIZE)(
440c2c66affSColin Finck     IN struct _PCI_CONFIGURATOR_CONTEXT* Context
441c2c66affSColin Finck );
442c2c66affSColin Finck 
443c2c66affSColin Finck typedef VOID (NTAPI *PCI_CONFIGURATOR_RESTORE_CURRENT)(
444c2c66affSColin Finck     IN struct _PCI_CONFIGURATOR_CONTEXT* Context
445c2c66affSColin Finck );
446c2c66affSColin Finck 
447c2c66affSColin Finck typedef VOID (NTAPI *PCI_CONFIGURATOR_SAVE_LIMITS)(
448c2c66affSColin Finck     IN struct _PCI_CONFIGURATOR_CONTEXT* Context
449c2c66affSColin Finck );
450c2c66affSColin Finck 
451c2c66affSColin Finck typedef VOID (NTAPI *PCI_CONFIGURATOR_SAVE_CURRENT_SETTINGS)(
452c2c66affSColin Finck     IN struct _PCI_CONFIGURATOR_CONTEXT* Context
453c2c66affSColin Finck );
454c2c66affSColin Finck 
455c2c66affSColin Finck typedef VOID (NTAPI *PCI_CONFIGURATOR_CHANGE_RESOURCE_SETTINGS)(
456c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
457c2c66affSColin Finck     IN PPCI_COMMON_HEADER PciData
458c2c66affSColin Finck );
459c2c66affSColin Finck 
460c2c66affSColin Finck typedef VOID (NTAPI *PCI_CONFIGURATOR_GET_ADDITIONAL_RESOURCE_DESCRIPTORS)(
461c2c66affSColin Finck     IN struct _PCI_CONFIGURATOR_CONTEXT* Context,
462c2c66affSColin Finck     IN PPCI_COMMON_HEADER PciData,
463c2c66affSColin Finck     IN PIO_RESOURCE_DESCRIPTOR IoDescriptor
464c2c66affSColin Finck );
465c2c66affSColin Finck 
466c2c66affSColin Finck typedef VOID (NTAPI *PCI_CONFIGURATOR_RESET_DEVICE)(
467c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
468c2c66affSColin Finck     IN PPCI_COMMON_HEADER PciData
469c2c66affSColin Finck );
470c2c66affSColin Finck 
471c2c66affSColin Finck //
472c2c66affSColin Finck // PCI Configurator
473c2c66affSColin Finck //
474c2c66affSColin Finck typedef struct _PCI_CONFIGURATOR
475c2c66affSColin Finck {
476c2c66affSColin Finck     PCI_CONFIGURATOR_INITIALIZE Initialize;
477c2c66affSColin Finck     PCI_CONFIGURATOR_RESTORE_CURRENT RestoreCurrent;
478c2c66affSColin Finck     PCI_CONFIGURATOR_SAVE_LIMITS SaveLimits;
479c2c66affSColin Finck     PCI_CONFIGURATOR_SAVE_CURRENT_SETTINGS SaveCurrentSettings;
480c2c66affSColin Finck     PCI_CONFIGURATOR_CHANGE_RESOURCE_SETTINGS ChangeResourceSettings;
481c2c66affSColin Finck     PCI_CONFIGURATOR_GET_ADDITIONAL_RESOURCE_DESCRIPTORS GetAdditionalResourceDescriptors;
482c2c66affSColin Finck     PCI_CONFIGURATOR_RESET_DEVICE ResetDevice;
483c2c66affSColin Finck } PCI_CONFIGURATOR, *PPCI_CONFIGURATOR;
484c2c66affSColin Finck 
485c2c66affSColin Finck //
486c2c66affSColin Finck // PCI Configurator Context
487c2c66affSColin Finck //
488c2c66affSColin Finck typedef struct _PCI_CONFIGURATOR_CONTEXT
489c2c66affSColin Finck {
490c2c66affSColin Finck     PPCI_PDO_EXTENSION PdoExtension;
491c2c66affSColin Finck     PPCI_COMMON_HEADER Current;
492c2c66affSColin Finck     PPCI_COMMON_HEADER PciData;
493c2c66affSColin Finck     PPCI_CONFIGURATOR Configurator;
494c2c66affSColin Finck     USHORT SecondaryStatus;
495c2c66affSColin Finck     USHORT Status;
496c2c66affSColin Finck     USHORT Command;
497c2c66affSColin Finck } PCI_CONFIGURATOR_CONTEXT, *PPCI_CONFIGURATOR_CONTEXT;
498c2c66affSColin Finck 
499c2c66affSColin Finck //
500c2c66affSColin Finck // PCI IPI Function
501c2c66affSColin Finck //
502c2c66affSColin Finck typedef VOID (NTAPI *PCI_IPI_FUNCTION)(
503c2c66affSColin Finck     IN PVOID Reserved,
504c2c66affSColin Finck     IN PVOID Context
505c2c66affSColin Finck );
506c2c66affSColin Finck 
507c2c66affSColin Finck //
508c2c66affSColin Finck // PCI IPI Context
509c2c66affSColin Finck //
510c2c66affSColin Finck typedef struct _PCI_IPI_CONTEXT
511c2c66affSColin Finck {
512c2c66affSColin Finck     LONG RunCount;
513c2c66affSColin Finck     ULONG Barrier;
514c2c66affSColin Finck     PVOID DeviceExtension;
515c2c66affSColin Finck     PCI_IPI_FUNCTION Function;
516c2c66affSColin Finck     PVOID Context;
517c2c66affSColin Finck } PCI_IPI_CONTEXT, *PPCI_IPI_CONTEXT;
518c2c66affSColin Finck 
519c2c66affSColin Finck //
520c2c66affSColin Finck // PCI Legacy Device Location Cache
521c2c66affSColin Finck //
522c2c66affSColin Finck typedef struct _PCI_LEGACY_DEVICE
523c2c66affSColin Finck {
524c2c66affSColin Finck     struct _PCI_LEGACY_DEVICE *Next;
525c2c66affSColin Finck     PDEVICE_OBJECT DeviceObject;
526c2c66affSColin Finck     ULONG BusNumber;
527c2c66affSColin Finck     ULONG SlotNumber;
528c2c66affSColin Finck     UCHAR InterruptLine;
529c2c66affSColin Finck     UCHAR InterruptPin;
530c2c66affSColin Finck     UCHAR BaseClass;
531c2c66affSColin Finck     UCHAR SubClass;
532c2c66affSColin Finck     PDEVICE_OBJECT PhysicalDeviceObject;
533c2c66affSColin Finck     ROUTING_TOKEN RoutingToken;
534c2c66affSColin Finck     PPCI_PDO_EXTENSION PdoExtension;
535c2c66affSColin Finck } PCI_LEGACY_DEVICE, *PPCI_LEGACY_DEVICE;
536c2c66affSColin Finck 
537c2c66affSColin Finck //
538c2c66affSColin Finck // IRP Dispatch Routines
539c2c66affSColin Finck //
540c2c66affSColin Finck 
541c2c66affSColin Finck DRIVER_DISPATCH PciDispatchIrp;
542c2c66affSColin Finck 
543c2c66affSColin Finck NTSTATUS
544c2c66affSColin Finck NTAPI
545c2c66affSColin Finck PciDispatchIrp(
546c2c66affSColin Finck     IN PDEVICE_OBJECT DeviceObject,
547c2c66affSColin Finck     IN PIRP Irp
548c2c66affSColin Finck );
549c2c66affSColin Finck 
550c2c66affSColin Finck NTSTATUS
551c2c66affSColin Finck NTAPI
552c2c66affSColin Finck PciIrpNotSupported(
553c2c66affSColin Finck     IN PIRP Irp,
554c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
555c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension
556c2c66affSColin Finck );
557c2c66affSColin Finck 
558c2c66affSColin Finck NTSTATUS
559c2c66affSColin Finck NTAPI
560c2c66affSColin Finck PciPassIrpFromFdoToPdo(
561c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension,
562c2c66affSColin Finck     IN PIRP Irp
563c2c66affSColin Finck );
564c2c66affSColin Finck 
565c2c66affSColin Finck NTSTATUS
566c2c66affSColin Finck NTAPI
567c2c66affSColin Finck PciCallDownIrpStack(
568c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension,
569c2c66affSColin Finck     IN PIRP Irp
570c2c66affSColin Finck );
571c2c66affSColin Finck 
572c2c66affSColin Finck NTSTATUS
573c2c66affSColin Finck NTAPI
574c2c66affSColin Finck PciIrpInvalidDeviceRequest(
575c2c66affSColin Finck     IN PIRP Irp,
576c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
577c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension
578c2c66affSColin Finck );
579c2c66affSColin Finck 
580c2c66affSColin Finck //
581c2c66affSColin Finck // Power Routines
582c2c66affSColin Finck //
583c2c66affSColin Finck NTSTATUS
584c2c66affSColin Finck NTAPI
585c2c66affSColin Finck PciFdoWaitWake(
586c2c66affSColin Finck     IN PIRP Irp,
587c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
588c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension
589c2c66affSColin Finck );
590c2c66affSColin Finck 
591c2c66affSColin Finck NTSTATUS
592c2c66affSColin Finck NTAPI
593c2c66affSColin Finck PciFdoSetPowerState(
594c2c66affSColin Finck     IN PIRP Irp,
595c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
596c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension
597c2c66affSColin Finck );
598c2c66affSColin Finck 
599c2c66affSColin Finck NTSTATUS
600c2c66affSColin Finck NTAPI
601c2c66affSColin Finck PciFdoIrpQueryPower(
602c2c66affSColin Finck     IN PIRP Irp,
603c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
604c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension
605c2c66affSColin Finck );
606c2c66affSColin Finck 
607c2c66affSColin Finck NTSTATUS
608c2c66affSColin Finck NTAPI
609c2c66affSColin Finck PciSetPowerManagedDevicePowerState(
610c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension,
611c2c66affSColin Finck     IN DEVICE_POWER_STATE DeviceState,
612c2c66affSColin Finck     IN BOOLEAN IrpSet
613c2c66affSColin Finck );
614c2c66affSColin Finck 
615c2c66affSColin Finck //
616c2c66affSColin Finck // Bus FDO Routines
617c2c66affSColin Finck //
618c2c66affSColin Finck 
619c2c66affSColin Finck DRIVER_ADD_DEVICE PciAddDevice;
620c2c66affSColin Finck 
621c2c66affSColin Finck NTSTATUS
622c2c66affSColin Finck NTAPI
623c2c66affSColin Finck PciAddDevice(
624c2c66affSColin Finck     IN PDRIVER_OBJECT DriverObject,
625c2c66affSColin Finck     IN PDEVICE_OBJECT PhysicalDeviceObject
626c2c66affSColin Finck );
627c2c66affSColin Finck 
628c2c66affSColin Finck NTSTATUS
629c2c66affSColin Finck NTAPI
630c2c66affSColin Finck PciFdoIrpStartDevice(
631c2c66affSColin Finck     IN PIRP Irp,
632c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
633c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension
634c2c66affSColin Finck );
635c2c66affSColin Finck 
636c2c66affSColin Finck NTSTATUS
637c2c66affSColin Finck NTAPI
638c2c66affSColin Finck PciFdoIrpQueryRemoveDevice(
639c2c66affSColin Finck     IN PIRP Irp,
640c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
641c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension
642c2c66affSColin Finck );
643c2c66affSColin Finck 
644c2c66affSColin Finck NTSTATUS
645c2c66affSColin Finck NTAPI
646c2c66affSColin Finck PciFdoIrpRemoveDevice(
647c2c66affSColin Finck     IN PIRP Irp,
648c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
649c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension
650c2c66affSColin Finck );
651c2c66affSColin Finck 
652c2c66affSColin Finck NTSTATUS
653c2c66affSColin Finck NTAPI
654c2c66affSColin Finck PciFdoIrpCancelRemoveDevice(
655c2c66affSColin Finck     IN PIRP Irp,
656c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
657c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension
658c2c66affSColin Finck );
659c2c66affSColin Finck 
660c2c66affSColin Finck NTSTATUS
661c2c66affSColin Finck NTAPI
662c2c66affSColin Finck PciFdoIrpStopDevice(
663c2c66affSColin Finck     IN PIRP Irp,
664c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
665c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension
666c2c66affSColin Finck );
667c2c66affSColin Finck 
668c2c66affSColin Finck NTSTATUS
669c2c66affSColin Finck NTAPI
670c2c66affSColin Finck PciFdoIrpQueryStopDevice(
671c2c66affSColin Finck     IN PIRP Irp,
672c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
673c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension
674c2c66affSColin Finck );
675c2c66affSColin Finck 
676c2c66affSColin Finck NTSTATUS
677c2c66affSColin Finck NTAPI
678c2c66affSColin Finck PciFdoIrpCancelStopDevice(
679c2c66affSColin Finck     IN PIRP Irp,
680c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
681c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension
682c2c66affSColin Finck );
683c2c66affSColin Finck 
684c2c66affSColin Finck NTSTATUS
685c2c66affSColin Finck NTAPI
686c2c66affSColin Finck PciFdoIrpQueryDeviceRelations(
687c2c66affSColin Finck     IN PIRP Irp,
688c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
689c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension
690c2c66affSColin Finck );
691c2c66affSColin Finck 
692c2c66affSColin Finck NTSTATUS
693c2c66affSColin Finck NTAPI
694c2c66affSColin Finck PciFdoIrpQueryInterface(
695c2c66affSColin Finck     IN PIRP Irp,
696c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
697c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension
698c2c66affSColin Finck );
699c2c66affSColin Finck 
700c2c66affSColin Finck NTSTATUS
701c2c66affSColin Finck NTAPI
702c2c66affSColin Finck PciFdoIrpQueryCapabilities(
703c2c66affSColin Finck     IN PIRP Irp,
704c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
705c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension
706c2c66affSColin Finck );
707c2c66affSColin Finck 
708c2c66affSColin Finck NTSTATUS
709c2c66affSColin Finck NTAPI
710c2c66affSColin Finck PciFdoIrpDeviceUsageNotification(
711c2c66affSColin Finck     IN PIRP Irp,
712c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
713c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension
714c2c66affSColin Finck );
715c2c66affSColin Finck 
716c2c66affSColin Finck NTSTATUS
717c2c66affSColin Finck NTAPI
718c2c66affSColin Finck PciFdoIrpSurpriseRemoval(
719c2c66affSColin Finck     IN PIRP Irp,
720c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
721c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension
722c2c66affSColin Finck );
723c2c66affSColin Finck 
724c2c66affSColin Finck NTSTATUS
725c2c66affSColin Finck NTAPI
726c2c66affSColin Finck PciFdoIrpQueryLegacyBusInformation(
727c2c66affSColin Finck     IN PIRP Irp,
728c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
729c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension
730c2c66affSColin Finck );
731c2c66affSColin Finck 
732c2c66affSColin Finck //
733c2c66affSColin Finck // Device PDO Routines
734c2c66affSColin Finck //
735c2c66affSColin Finck NTSTATUS
736c2c66affSColin Finck NTAPI
737c2c66affSColin Finck PciPdoCreate(
738c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension,
739c2c66affSColin Finck     IN PCI_SLOT_NUMBER Slot,
740c2c66affSColin Finck     OUT PDEVICE_OBJECT *PdoDeviceObject
741c2c66affSColin Finck );
742c2c66affSColin Finck 
743c2c66affSColin Finck NTSTATUS
744c2c66affSColin Finck NTAPI
745c2c66affSColin Finck PciPdoWaitWake(
746c2c66affSColin Finck     IN PIRP Irp,
747c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
748c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
749c2c66affSColin Finck );
750c2c66affSColin Finck 
751c2c66affSColin Finck NTSTATUS
752c2c66affSColin Finck NTAPI
753c2c66affSColin Finck PciPdoSetPowerState(
754c2c66affSColin Finck     IN PIRP Irp,
755c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
756c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
757c2c66affSColin Finck );
758c2c66affSColin Finck 
759c2c66affSColin Finck NTSTATUS
760c2c66affSColin Finck NTAPI
761c2c66affSColin Finck PciPdoIrpQueryPower(
762c2c66affSColin Finck     IN PIRP Irp,
763c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
764c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
765c2c66affSColin Finck );
766c2c66affSColin Finck 
767c2c66affSColin Finck NTSTATUS
768c2c66affSColin Finck NTAPI
769c2c66affSColin Finck PciPdoIrpStartDevice(
770c2c66affSColin Finck     IN PIRP Irp,
771c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
772c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
773c2c66affSColin Finck );
774c2c66affSColin Finck 
775c2c66affSColin Finck NTSTATUS
776c2c66affSColin Finck NTAPI
777c2c66affSColin Finck PciPdoIrpQueryRemoveDevice(
778c2c66affSColin Finck     IN PIRP Irp,
779c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
780c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
781c2c66affSColin Finck );
782c2c66affSColin Finck 
783c2c66affSColin Finck NTSTATUS
784c2c66affSColin Finck NTAPI
785c2c66affSColin Finck PciPdoIrpRemoveDevice(
786c2c66affSColin Finck     IN PIRP Irp,
787c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
788c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
789c2c66affSColin Finck );
790c2c66affSColin Finck 
791c2c66affSColin Finck NTSTATUS
792c2c66affSColin Finck NTAPI
793c2c66affSColin Finck PciPdoIrpCancelRemoveDevice(
794c2c66affSColin Finck     IN PIRP Irp,
795c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
796c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
797c2c66affSColin Finck );
798c2c66affSColin Finck 
799c2c66affSColin Finck NTSTATUS
800c2c66affSColin Finck NTAPI
801c2c66affSColin Finck PciPdoIrpStopDevice(
802c2c66affSColin Finck     IN PIRP Irp,
803c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
804c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
805c2c66affSColin Finck );
806c2c66affSColin Finck 
807c2c66affSColin Finck NTSTATUS
808c2c66affSColin Finck NTAPI
809c2c66affSColin Finck PciPdoIrpQueryStopDevice(
810c2c66affSColin Finck     IN PIRP Irp,
811c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
812c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
813c2c66affSColin Finck );
814c2c66affSColin Finck 
815c2c66affSColin Finck NTSTATUS
816c2c66affSColin Finck NTAPI
817c2c66affSColin Finck PciPdoIrpCancelStopDevice(
818c2c66affSColin Finck     IN PIRP Irp,
819c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
820c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
821c2c66affSColin Finck );
822c2c66affSColin Finck 
823c2c66affSColin Finck NTSTATUS
824c2c66affSColin Finck NTAPI
825c2c66affSColin Finck PciPdoIrpQueryDeviceRelations(
826c2c66affSColin Finck     IN PIRP Irp,
827c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
828c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
829c2c66affSColin Finck );
830c2c66affSColin Finck 
831c2c66affSColin Finck NTSTATUS
832c2c66affSColin Finck NTAPI
833c2c66affSColin Finck PciPdoIrpQueryInterface(
834c2c66affSColin Finck     IN PIRP Irp,
835c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
836c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
837c2c66affSColin Finck );
838c2c66affSColin Finck 
839c2c66affSColin Finck NTSTATUS
840c2c66affSColin Finck NTAPI
841c2c66affSColin Finck PciPdoIrpQueryCapabilities(
842c2c66affSColin Finck     IN PIRP Irp,
843c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
844c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
845c2c66affSColin Finck );
846c2c66affSColin Finck 
847c2c66affSColin Finck NTSTATUS
848c2c66affSColin Finck NTAPI
849c2c66affSColin Finck PciPdoIrpQueryResources(
850c2c66affSColin Finck     IN PIRP Irp,
851c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
852c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
853c2c66affSColin Finck );
854c2c66affSColin Finck 
855c2c66affSColin Finck NTSTATUS
856c2c66affSColin Finck NTAPI
857c2c66affSColin Finck PciPdoIrpQueryResourceRequirements(
858c2c66affSColin Finck     IN PIRP Irp,
859c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
860c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
861c2c66affSColin Finck );
862c2c66affSColin Finck 
863c2c66affSColin Finck NTSTATUS
864c2c66affSColin Finck NTAPI
865c2c66affSColin Finck PciPdoIrpQueryDeviceText(
866c2c66affSColin Finck     IN PIRP Irp,
867c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
868c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
869c2c66affSColin Finck );
870c2c66affSColin Finck 
871c2c66affSColin Finck NTSTATUS
872c2c66affSColin Finck NTAPI
873c2c66affSColin Finck PciPdoIrpReadConfig(
874c2c66affSColin Finck     IN PIRP Irp,
875c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
876c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
877c2c66affSColin Finck );
878c2c66affSColin Finck 
879c2c66affSColin Finck NTSTATUS
880c2c66affSColin Finck NTAPI
881c2c66affSColin Finck PciPdoIrpWriteConfig(
882c2c66affSColin Finck     IN PIRP Irp,
883c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
884c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
885c2c66affSColin Finck );
886c2c66affSColin Finck 
887c2c66affSColin Finck NTSTATUS
888c2c66affSColin Finck NTAPI
889c2c66affSColin Finck PciPdoIrpQueryId(
890c2c66affSColin Finck     IN PIRP Irp,
891c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
892c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
893c2c66affSColin Finck );
894c2c66affSColin Finck 
895c2c66affSColin Finck NTSTATUS
896c2c66affSColin Finck NTAPI
897c2c66affSColin Finck PciPdoIrpQueryDeviceState(
898c2c66affSColin Finck     IN PIRP Irp,
899c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
900c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
901c2c66affSColin Finck );
902c2c66affSColin Finck 
903c2c66affSColin Finck NTSTATUS
904c2c66affSColin Finck NTAPI
905c2c66affSColin Finck PciPdoIrpQueryBusInformation(
906c2c66affSColin Finck     IN PIRP Irp,
907c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
908c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
909c2c66affSColin Finck );
910c2c66affSColin Finck 
911c2c66affSColin Finck NTSTATUS
912c2c66affSColin Finck NTAPI
913c2c66affSColin Finck PciPdoIrpDeviceUsageNotification(
914c2c66affSColin Finck     IN PIRP Irp,
915c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
916c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
917c2c66affSColin Finck );
918c2c66affSColin Finck 
919c2c66affSColin Finck NTSTATUS
920c2c66affSColin Finck NTAPI
921c2c66affSColin Finck PciPdoIrpSurpriseRemoval(
922c2c66affSColin Finck     IN PIRP Irp,
923c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
924c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
925c2c66affSColin Finck );
926c2c66affSColin Finck 
927c2c66affSColin Finck NTSTATUS
928c2c66affSColin Finck NTAPI
929c2c66affSColin Finck PciPdoIrpQueryLegacyBusInformation(
930c2c66affSColin Finck     IN PIRP Irp,
931c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
932c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
933c2c66affSColin Finck );
934c2c66affSColin Finck 
935c2c66affSColin Finck 
936c2c66affSColin Finck //
937c2c66affSColin Finck // HAL Callback/Hook Routines
938c2c66affSColin Finck //
939c2c66affSColin Finck VOID
940c2c66affSColin Finck NTAPI
941c2c66affSColin Finck PciHookHal(
942c2c66affSColin Finck     VOID
943c2c66affSColin Finck );
944c2c66affSColin Finck 
945c2c66affSColin Finck //
946c2c66affSColin Finck // PCI Verifier Routines
947c2c66affSColin Finck //
948c2c66affSColin Finck VOID
949c2c66affSColin Finck NTAPI
950c2c66affSColin Finck PciVerifierInit(
951c2c66affSColin Finck     IN PDRIVER_OBJECT DriverObject
952c2c66affSColin Finck );
953c2c66affSColin Finck 
954c2c66affSColin Finck PPCI_VERIFIER_DATA
955c2c66affSColin Finck NTAPI
956c2c66affSColin Finck PciVerifierRetrieveFailureData(
957c2c66affSColin Finck     IN ULONG FailureCode
958c2c66affSColin Finck );
959c2c66affSColin Finck 
960c2c66affSColin Finck //
961c2c66affSColin Finck // Utility Routines
962c2c66affSColin Finck //
963c2c66affSColin Finck BOOLEAN
964c2c66affSColin Finck NTAPI
965c2c66affSColin Finck PciStringToUSHORT(
966c2c66affSColin Finck     IN PWCHAR String,
967c2c66affSColin Finck     OUT PUSHORT Value
968c2c66affSColin Finck );
969c2c66affSColin Finck 
970c2c66affSColin Finck BOOLEAN
971c2c66affSColin Finck NTAPI
972c2c66affSColin Finck PciIsDatacenter(
973c2c66affSColin Finck     VOID
974c2c66affSColin Finck );
975c2c66affSColin Finck 
976c2c66affSColin Finck NTSTATUS
977c2c66affSColin Finck NTAPI
978c2c66affSColin Finck PciBuildDefaultExclusionLists(
979c2c66affSColin Finck     VOID
980c2c66affSColin Finck );
981c2c66affSColin Finck 
982c2c66affSColin Finck BOOLEAN
983c2c66affSColin Finck NTAPI
984c2c66affSColin Finck PciUnicodeStringStrStr(
985c2c66affSColin Finck     IN PUNICODE_STRING InputString,
986c2c66affSColin Finck     IN PCUNICODE_STRING EqualString,
987c2c66affSColin Finck     IN BOOLEAN CaseInSensitive
988c2c66affSColin Finck );
989c2c66affSColin Finck 
990c2c66affSColin Finck BOOLEAN
991c2c66affSColin Finck NTAPI
992c2c66affSColin Finck PciOpenKey(
993c2c66affSColin Finck     IN PWCHAR KeyName,
994c2c66affSColin Finck     IN HANDLE RootKey,
995c2c66affSColin Finck     IN ACCESS_MASK DesiredAccess,
996c2c66affSColin Finck     OUT PHANDLE KeyHandle,
997c2c66affSColin Finck     OUT PNTSTATUS KeyStatus
998c2c66affSColin Finck );
999c2c66affSColin Finck 
1000c2c66affSColin Finck NTSTATUS
1001c2c66affSColin Finck NTAPI
1002c2c66affSColin Finck PciGetRegistryValue(
1003c2c66affSColin Finck     IN PWCHAR ValueName,
1004c2c66affSColin Finck     IN PWCHAR KeyName,
1005c2c66affSColin Finck     IN HANDLE RootHandle,
1006c2c66affSColin Finck     IN ULONG Type,
1007c2c66affSColin Finck     OUT PVOID *OutputBuffer,
1008c2c66affSColin Finck     OUT PULONG OutputLength
1009c2c66affSColin Finck );
1010c2c66affSColin Finck 
1011c2c66affSColin Finck PPCI_FDO_EXTENSION
1012c2c66affSColin Finck NTAPI
1013c2c66affSColin Finck PciFindParentPciFdoExtension(
1014c2c66affSColin Finck     IN PDEVICE_OBJECT DeviceObject,
1015c2c66affSColin Finck     IN PKEVENT Lock
1016c2c66affSColin Finck );
1017c2c66affSColin Finck 
1018c2c66affSColin Finck VOID
1019c2c66affSColin Finck NTAPI
1020c2c66affSColin Finck PciInsertEntryAtTail(
1021c2c66affSColin Finck     IN PSINGLE_LIST_ENTRY ListHead,
1022c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension,
1023c2c66affSColin Finck     IN PKEVENT Lock
1024c2c66affSColin Finck );
1025c2c66affSColin Finck 
1026c2c66affSColin Finck NTSTATUS
1027c2c66affSColin Finck NTAPI
1028c2c66affSColin Finck PciGetDeviceProperty(
1029c2c66affSColin Finck     IN PDEVICE_OBJECT DeviceObject,
1030c2c66affSColin Finck     IN DEVICE_REGISTRY_PROPERTY DeviceProperty,
1031c2c66affSColin Finck     OUT PVOID *OutputBuffer
1032c2c66affSColin Finck );
1033c2c66affSColin Finck 
1034c2c66affSColin Finck NTSTATUS
1035c2c66affSColin Finck NTAPI
1036c2c66affSColin Finck PciSendIoctl(
1037c2c66affSColin Finck     IN PDEVICE_OBJECT DeviceObject,
1038c2c66affSColin Finck     IN ULONG IoControlCode,
1039c2c66affSColin Finck     IN PVOID InputBuffer,
1040c2c66affSColin Finck     IN ULONG InputBufferLength,
1041c2c66affSColin Finck     IN PVOID OutputBuffer,
1042c2c66affSColin Finck     IN ULONG OutputBufferLength
1043c2c66affSColin Finck );
1044c2c66affSColin Finck 
1045c2c66affSColin Finck VOID
1046c2c66affSColin Finck NTAPI
1047c2c66affSColin Finck PcipLinkSecondaryExtension(
1048c2c66affSColin Finck     IN PSINGLE_LIST_ENTRY List,
1049c2c66affSColin Finck     IN PVOID Lock,
1050c2c66affSColin Finck     IN PPCI_SECONDARY_EXTENSION SecondaryExtension,
1051c2c66affSColin Finck     IN PCI_SIGNATURE ExtensionType,
1052c2c66affSColin Finck     IN PVOID Destructor
1053c2c66affSColin Finck );
1054c2c66affSColin Finck 
1055c2c66affSColin Finck PPCI_SECONDARY_EXTENSION
1056c2c66affSColin Finck NTAPI
1057c2c66affSColin Finck PciFindNextSecondaryExtension(
1058c2c66affSColin Finck     IN PSINGLE_LIST_ENTRY ListHead,
1059c2c66affSColin Finck     IN PCI_SIGNATURE ExtensionType
1060c2c66affSColin Finck );
1061c2c66affSColin Finck 
1062c2c66affSColin Finck ULONGLONG
1063c2c66affSColin Finck NTAPI
1064c2c66affSColin Finck PciGetHackFlags(
1065c2c66affSColin Finck     IN USHORT VendorId,
1066c2c66affSColin Finck     IN USHORT DeviceId,
1067c2c66affSColin Finck     IN USHORT SubVendorId,
1068c2c66affSColin Finck     IN USHORT SubSystemId,
1069c2c66affSColin Finck     IN UCHAR RevisionId
1070c2c66affSColin Finck );
1071c2c66affSColin Finck 
1072c2c66affSColin Finck PPCI_PDO_EXTENSION
1073c2c66affSColin Finck NTAPI
1074c2c66affSColin Finck PciFindPdoByFunction(
1075c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension,
1076c2c66affSColin Finck     IN ULONG FunctionNumber,
1077c2c66affSColin Finck     IN PPCI_COMMON_HEADER PciData
1078c2c66affSColin Finck );
1079c2c66affSColin Finck 
1080c2c66affSColin Finck BOOLEAN
1081c2c66affSColin Finck NTAPI
1082c2c66affSColin Finck PciIsCriticalDeviceClass(
1083c2c66affSColin Finck     IN UCHAR BaseClass,
1084c2c66affSColin Finck     IN UCHAR SubClass
1085c2c66affSColin Finck );
1086c2c66affSColin Finck 
1087c2c66affSColin Finck BOOLEAN
1088c2c66affSColin Finck NTAPI
1089c2c66affSColin Finck PciIsDeviceOnDebugPath(
1090c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension
1091c2c66affSColin Finck );
1092c2c66affSColin Finck 
1093c2c66affSColin Finck NTSTATUS
1094c2c66affSColin Finck NTAPI
1095c2c66affSColin Finck PciGetBiosConfig(
1096c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension,
1097c2c66affSColin Finck     OUT PPCI_COMMON_HEADER PciData
1098c2c66affSColin Finck );
1099c2c66affSColin Finck 
1100c2c66affSColin Finck NTSTATUS
1101c2c66affSColin Finck NTAPI
1102c2c66affSColin Finck PciSaveBiosConfig(
1103c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension,
1104c2c66affSColin Finck     OUT PPCI_COMMON_HEADER PciData
1105c2c66affSColin Finck );
1106c2c66affSColin Finck 
1107c2c66affSColin Finck UCHAR
1108c2c66affSColin Finck NTAPI
1109c2c66affSColin Finck PciReadDeviceCapability(
1110c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension,
1111c2c66affSColin Finck     IN UCHAR Offset,
1112c2c66affSColin Finck     IN ULONG CapabilityId,
1113c2c66affSColin Finck     OUT PPCI_CAPABILITIES_HEADER Buffer,
1114c2c66affSColin Finck     IN ULONG Length
1115c2c66affSColin Finck );
1116c2c66affSColin Finck 
1117c2c66affSColin Finck BOOLEAN
1118c2c66affSColin Finck NTAPI
1119c2c66affSColin Finck PciCanDisableDecodes(
1120c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension,
1121c2c66affSColin Finck     IN PPCI_COMMON_HEADER Config,
1122c2c66affSColin Finck     IN ULONGLONG HackFlags,
1123c2c66affSColin Finck     IN BOOLEAN ForPowerDown
1124c2c66affSColin Finck );
1125c2c66affSColin Finck 
1126c2c66affSColin Finck PCI_DEVICE_TYPES
1127c2c66affSColin Finck NTAPI
1128c2c66affSColin Finck PciClassifyDeviceType(
1129c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension
1130c2c66affSColin Finck );
1131c2c66affSColin Finck 
1132c2c66affSColin Finck KIPI_BROADCAST_WORKER PciExecuteCriticalSystemRoutine;
1133c2c66affSColin Finck 
1134c2c66affSColin Finck ULONG_PTR
1135c2c66affSColin Finck NTAPI
1136c2c66affSColin Finck PciExecuteCriticalSystemRoutine(
1137c2c66affSColin Finck     IN ULONG_PTR IpiContext
1138c2c66affSColin Finck );
1139c2c66affSColin Finck 
1140c2c66affSColin Finck BOOLEAN
1141c2c66affSColin Finck NTAPI
1142c2c66affSColin Finck PciCreateIoDescriptorFromBarLimit(
1143c2c66affSColin Finck     PIO_RESOURCE_DESCRIPTOR ResourceDescriptor,
1144c2c66affSColin Finck     IN PULONG BarArray,
1145c2c66affSColin Finck     IN BOOLEAN Rom
1146c2c66affSColin Finck );
1147c2c66affSColin Finck 
1148c2c66affSColin Finck BOOLEAN
1149c2c66affSColin Finck NTAPI
1150c2c66affSColin Finck PciIsSlotPresentInParentMethod(
1151c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
1152c2c66affSColin Finck     IN ULONG Method
1153c2c66affSColin Finck );
1154c2c66affSColin Finck 
1155c2c66affSColin Finck VOID
1156c2c66affSColin Finck NTAPI
1157c2c66affSColin Finck PciDecodeEnable(
1158c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
1159c2c66affSColin Finck     IN BOOLEAN Enable,
1160c2c66affSColin Finck     OUT PUSHORT Command
1161c2c66affSColin Finck );
1162c2c66affSColin Finck 
1163c2c66affSColin Finck NTSTATUS
1164c2c66affSColin Finck NTAPI
1165c2c66affSColin Finck PciQueryBusInformation(
1166c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
1167c2c66affSColin Finck     IN PPNP_BUS_INFORMATION* Buffer
1168c2c66affSColin Finck );
1169c2c66affSColin Finck 
1170c2c66affSColin Finck NTSTATUS
1171c2c66affSColin Finck NTAPI
1172c2c66affSColin Finck PciQueryCapabilities(
1173c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
1174c2c66affSColin Finck     IN OUT PDEVICE_CAPABILITIES DeviceCapability
1175c2c66affSColin Finck );
1176c2c66affSColin Finck 
1177c2c66affSColin Finck //
1178c2c66affSColin Finck // Configuration Routines
1179c2c66affSColin Finck //
1180c2c66affSColin Finck NTSTATUS
1181c2c66affSColin Finck NTAPI
1182c2c66affSColin Finck PciGetConfigHandlers(
1183c2c66affSColin Finck     IN PPCI_FDO_EXTENSION FdoExtension
1184c2c66affSColin Finck );
1185c2c66affSColin Finck 
1186c2c66affSColin Finck VOID
1187c2c66affSColin Finck NTAPI
1188c2c66affSColin Finck PciReadSlotConfig(
1189c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension,
1190c2c66affSColin Finck     IN PCI_SLOT_NUMBER Slot,
1191c2c66affSColin Finck     IN PVOID Buffer,
1192c2c66affSColin Finck     IN ULONG Offset,
1193c2c66affSColin Finck     IN ULONG Length
1194c2c66affSColin Finck );
1195c2c66affSColin Finck 
1196c2c66affSColin Finck VOID
1197c2c66affSColin Finck NTAPI
1198c2c66affSColin Finck PciWriteDeviceConfig(
1199c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension,
1200c2c66affSColin Finck     IN PVOID Buffer,
1201c2c66affSColin Finck     IN ULONG Offset,
1202c2c66affSColin Finck     IN ULONG Length
1203c2c66affSColin Finck );
1204c2c66affSColin Finck 
1205c2c66affSColin Finck VOID
1206c2c66affSColin Finck NTAPI
1207c2c66affSColin Finck PciReadDeviceConfig(
1208c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension,
1209c2c66affSColin Finck     IN PVOID Buffer,
1210c2c66affSColin Finck     IN ULONG Offset,
1211c2c66affSColin Finck     IN ULONG Length
1212c2c66affSColin Finck );
1213c2c66affSColin Finck 
1214c2c66affSColin Finck UCHAR
1215c2c66affSColin Finck NTAPI
1216c2c66affSColin Finck PciGetAdjustedInterruptLine(
1217c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension
1218c2c66affSColin Finck );
1219c2c66affSColin Finck 
1220c2c66affSColin Finck //
1221c2c66affSColin Finck // State Machine Logic Transition Routines
1222c2c66affSColin Finck //
1223c2c66affSColin Finck VOID
1224c2c66affSColin Finck NTAPI
1225c2c66affSColin Finck PciInitializeState(
1226c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension
1227c2c66affSColin Finck );
1228c2c66affSColin Finck 
1229c2c66affSColin Finck NTSTATUS
1230c2c66affSColin Finck NTAPI
1231c2c66affSColin Finck PciBeginStateTransition(
1232c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension,
1233c2c66affSColin Finck     IN PCI_STATE NewState
1234c2c66affSColin Finck );
1235c2c66affSColin Finck 
1236c2c66affSColin Finck NTSTATUS
1237c2c66affSColin Finck NTAPI
1238c2c66affSColin Finck PciCancelStateTransition(
1239c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension,
1240c2c66affSColin Finck     IN PCI_STATE NewState
1241c2c66affSColin Finck );
1242c2c66affSColin Finck 
1243c2c66affSColin Finck VOID
1244c2c66affSColin Finck NTAPI
1245c2c66affSColin Finck PciCommitStateTransition(
1246c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension,
1247c2c66affSColin Finck     IN PCI_STATE NewState
1248c2c66affSColin Finck );
1249c2c66affSColin Finck 
1250c2c66affSColin Finck //
1251c2c66affSColin Finck // Arbiter Support
1252c2c66affSColin Finck //
1253c2c66affSColin Finck NTSTATUS
1254c2c66affSColin Finck NTAPI
1255c2c66affSColin Finck PciInitializeArbiters(
1256c2c66affSColin Finck     IN PPCI_FDO_EXTENSION FdoExtension
1257c2c66affSColin Finck );
1258c2c66affSColin Finck 
1259c2c66affSColin Finck NTSTATUS
1260c2c66affSColin Finck NTAPI
1261c2c66affSColin Finck PciInitializeArbiterRanges(
1262c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension,
1263c2c66affSColin Finck     IN PCM_RESOURCE_LIST Resources
1264c2c66affSColin Finck );
1265c2c66affSColin Finck 
1266c2c66affSColin Finck //
1267c2c66affSColin Finck // Debug Helpers
1268c2c66affSColin Finck //
1269c2c66affSColin Finck BOOLEAN
1270c2c66affSColin Finck NTAPI
1271c2c66affSColin Finck PciDebugIrpDispatchDisplay(
1272c2c66affSColin Finck     IN PIO_STACK_LOCATION IoStackLocation,
1273c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension,
1274c2c66affSColin Finck     IN USHORT MaxMinor
1275c2c66affSColin Finck );
1276c2c66affSColin Finck 
1277c2c66affSColin Finck VOID
1278c2c66affSColin Finck NTAPI
1279c2c66affSColin Finck PciDebugDumpCommonConfig(
1280c2c66affSColin Finck     IN PPCI_COMMON_HEADER PciData
1281c2c66affSColin Finck );
1282c2c66affSColin Finck 
1283c2c66affSColin Finck VOID
1284c2c66affSColin Finck NTAPI
1285c2c66affSColin Finck PciDebugDumpQueryCapabilities(
1286c2c66affSColin Finck     IN PDEVICE_CAPABILITIES DeviceCaps
1287c2c66affSColin Finck );
1288c2c66affSColin Finck 
1289c2c66affSColin Finck VOID
1290c2c66affSColin Finck NTAPI
1291c2c66affSColin Finck PciDebugPrintIoResReqList(
1292c2c66affSColin Finck     IN PIO_RESOURCE_REQUIREMENTS_LIST Requirements
1293c2c66affSColin Finck );
1294c2c66affSColin Finck 
1295c2c66affSColin Finck VOID
1296c2c66affSColin Finck NTAPI
1297c2c66affSColin Finck PciDebugPrintCmResList(
1298c2c66affSColin Finck     IN PCM_RESOURCE_LIST ResourceList
1299c2c66affSColin Finck );
1300c2c66affSColin Finck 
1301c2c66affSColin Finck VOID
1302c2c66affSColin Finck NTAPI
1303c2c66affSColin Finck PciDebugPrintPartialResource(
1304c2c66affSColin Finck     IN PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialResource
1305c2c66affSColin Finck );
1306c2c66affSColin Finck 
1307c2c66affSColin Finck //
1308c2c66affSColin Finck // Interface Support
1309c2c66affSColin Finck //
1310c2c66affSColin Finck NTSTATUS
1311c2c66affSColin Finck NTAPI
1312c2c66affSColin Finck PciQueryInterface(
1313c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension,
1314c2c66affSColin Finck     IN CONST GUID* InterfaceType,
1315c2c66affSColin Finck     IN ULONG Size,
1316c2c66affSColin Finck     IN ULONG Version,
1317c2c66affSColin Finck     IN PVOID InterfaceData,
1318c2c66affSColin Finck     IN PINTERFACE Interface,
1319c2c66affSColin Finck     IN BOOLEAN LastChance
1320c2c66affSColin Finck );
1321c2c66affSColin Finck 
1322c2c66affSColin Finck NTSTATUS
1323c2c66affSColin Finck NTAPI
1324c2c66affSColin Finck PciPmeInterfaceInitializer(
1325c2c66affSColin Finck     IN PVOID Instance
1326c2c66affSColin Finck );
1327c2c66affSColin Finck 
1328c2c66affSColin Finck NTSTATUS
1329c2c66affSColin Finck NTAPI
1330c2c66affSColin Finck routeintrf_Initializer(
1331c2c66affSColin Finck     IN PVOID Instance
1332c2c66affSColin Finck );
1333c2c66affSColin Finck 
1334c2c66affSColin Finck NTSTATUS
1335c2c66affSColin Finck NTAPI
1336c2c66affSColin Finck arbusno_Initializer(
1337c2c66affSColin Finck     IN PVOID Instance
1338c2c66affSColin Finck );
1339c2c66affSColin Finck 
1340c2c66affSColin Finck NTSTATUS
1341c2c66affSColin Finck NTAPI
1342c2c66affSColin Finck agpintrf_Initializer(
1343c2c66affSColin Finck     IN PVOID Instance
1344c2c66affSColin Finck );
1345c2c66affSColin Finck 
1346c2c66affSColin Finck NTSTATUS
1347c2c66affSColin Finck NTAPI
1348c2c66affSColin Finck tranirq_Initializer(
1349c2c66affSColin Finck     IN PVOID Instance
1350c2c66affSColin Finck );
1351c2c66affSColin Finck 
1352c2c66affSColin Finck NTSTATUS
1353c2c66affSColin Finck NTAPI
1354c2c66affSColin Finck busintrf_Initializer(
1355c2c66affSColin Finck     IN PVOID Instance
1356c2c66affSColin Finck );
1357c2c66affSColin Finck 
1358c2c66affSColin Finck NTSTATUS
1359c2c66affSColin Finck NTAPI
1360c2c66affSColin Finck armem_Initializer(
1361c2c66affSColin Finck     IN PVOID Instance
1362c2c66affSColin Finck );
1363c2c66affSColin Finck 
1364c2c66affSColin Finck NTSTATUS
1365c2c66affSColin Finck NTAPI
1366c2c66affSColin Finck ario_Initializer(
1367c2c66affSColin Finck     IN PVOID Instance
1368c2c66affSColin Finck );
1369c2c66affSColin Finck 
1370c2c66affSColin Finck NTSTATUS
1371c2c66affSColin Finck NTAPI
1372c2c66affSColin Finck locintrf_Initializer(
1373c2c66affSColin Finck     IN PVOID Instance
1374c2c66affSColin Finck );
1375c2c66affSColin Finck 
1376c2c66affSColin Finck NTSTATUS
1377c2c66affSColin Finck NTAPI
1378c2c66affSColin Finck pcicbintrf_Initializer(
1379c2c66affSColin Finck     IN PVOID Instance
1380c2c66affSColin Finck );
1381c2c66affSColin Finck 
1382c2c66affSColin Finck NTSTATUS
1383c2c66affSColin Finck NTAPI
1384c2c66affSColin Finck lddintrf_Initializer(
1385c2c66affSColin Finck     IN PVOID Instance
1386c2c66affSColin Finck );
1387c2c66affSColin Finck 
1388c2c66affSColin Finck NTSTATUS
1389c2c66affSColin Finck NTAPI
1390c2c66affSColin Finck devpresent_Initializer(
1391c2c66affSColin Finck     IN PVOID Instance
1392c2c66affSColin Finck );
1393c2c66affSColin Finck 
1394c2c66affSColin Finck NTSTATUS
1395c2c66affSColin Finck NTAPI
1396c2c66affSColin Finck agpintrf_Constructor(
1397c2c66affSColin Finck     IN PVOID DeviceExtension,
1398c2c66affSColin Finck     IN PVOID Instance,
1399c2c66affSColin Finck     IN PVOID InterfaceData,
1400c2c66affSColin Finck     IN USHORT Version,
1401c2c66affSColin Finck     IN USHORT Size,
1402c2c66affSColin Finck     IN PINTERFACE Interface
1403c2c66affSColin Finck );
1404c2c66affSColin Finck 
1405c2c66affSColin Finck NTSTATUS
1406c2c66affSColin Finck NTAPI
1407c2c66affSColin Finck arbusno_Constructor(
1408c2c66affSColin Finck     IN PVOID DeviceExtension,
1409c2c66affSColin Finck     IN PVOID Instance,
1410c2c66affSColin Finck     IN PVOID InterfaceData,
1411c2c66affSColin Finck     IN USHORT Version,
1412c2c66affSColin Finck     IN USHORT Size,
1413c2c66affSColin Finck     IN PINTERFACE Interface
1414c2c66affSColin Finck );
1415c2c66affSColin Finck 
1416c2c66affSColin Finck NTSTATUS
1417c2c66affSColin Finck NTAPI
1418c2c66affSColin Finck tranirq_Constructor(
1419c2c66affSColin Finck     IN PVOID DeviceExtension,
1420c2c66affSColin Finck     IN PVOID Instance,
1421c2c66affSColin Finck     IN PVOID InterfaceData,
1422c2c66affSColin Finck     IN USHORT Version,
1423c2c66affSColin Finck     IN USHORT Size,
1424c2c66affSColin Finck     IN PINTERFACE Interface
1425c2c66affSColin Finck );
1426c2c66affSColin Finck 
1427c2c66affSColin Finck NTSTATUS
1428c2c66affSColin Finck NTAPI
1429c2c66affSColin Finck armem_Constructor(
1430c2c66affSColin Finck     IN PVOID DeviceExtension,
1431c2c66affSColin Finck     IN PVOID Instance,
1432c2c66affSColin Finck     IN PVOID InterfaceData,
1433c2c66affSColin Finck     IN USHORT Version,
1434c2c66affSColin Finck     IN USHORT Size,
1435c2c66affSColin Finck     IN PINTERFACE Interface
1436c2c66affSColin Finck );
1437c2c66affSColin Finck 
1438c2c66affSColin Finck NTSTATUS
1439c2c66affSColin Finck NTAPI
1440c2c66affSColin Finck busintrf_Constructor(
1441c2c66affSColin Finck     IN PVOID DeviceExtension,
1442c2c66affSColin Finck     IN PVOID Instance,
1443c2c66affSColin Finck     IN PVOID InterfaceData,
1444c2c66affSColin Finck     IN USHORT Version,
1445c2c66affSColin Finck     IN USHORT Size,
1446c2c66affSColin Finck     IN PINTERFACE Interface
1447c2c66affSColin Finck );
1448c2c66affSColin Finck 
1449c2c66affSColin Finck NTSTATUS
1450c2c66affSColin Finck NTAPI
1451c2c66affSColin Finck ario_Constructor(
1452c2c66affSColin Finck     IN PVOID DeviceExtension,
1453c2c66affSColin Finck     IN PVOID Instance,
1454c2c66affSColin Finck     IN PVOID InterfaceData,
1455c2c66affSColin Finck     IN USHORT Version,
1456c2c66affSColin Finck     IN USHORT Size,
1457c2c66affSColin Finck     IN PINTERFACE Interface
1458c2c66affSColin Finck );
1459c2c66affSColin Finck 
1460c2c66affSColin Finck VOID
1461c2c66affSColin Finck NTAPI
1462c2c66affSColin Finck ario_ApplyBrokenVideoHack(
1463c2c66affSColin Finck     IN PPCI_FDO_EXTENSION FdoExtension
1464c2c66affSColin Finck );
1465c2c66affSColin Finck 
1466c2c66affSColin Finck NTSTATUS
1467c2c66affSColin Finck NTAPI
1468c2c66affSColin Finck pcicbintrf_Constructor(
1469c2c66affSColin Finck     IN PVOID DeviceExtension,
1470c2c66affSColin Finck     IN PVOID Instance,
1471c2c66affSColin Finck     IN PVOID InterfaceData,
1472c2c66affSColin Finck     IN USHORT Version,
1473c2c66affSColin Finck     IN USHORT Size,
1474c2c66affSColin Finck     IN PINTERFACE Interface
1475c2c66affSColin Finck );
1476c2c66affSColin Finck 
1477c2c66affSColin Finck NTSTATUS
1478c2c66affSColin Finck NTAPI
1479c2c66affSColin Finck lddintrf_Constructor(
1480c2c66affSColin Finck     IN PVOID DeviceExtension,
1481c2c66affSColin Finck     IN PVOID Instance,
1482c2c66affSColin Finck     IN PVOID InterfaceData,
1483c2c66affSColin Finck     IN USHORT Version,
1484c2c66affSColin Finck     IN USHORT Size,
1485c2c66affSColin Finck     IN PINTERFACE Interface
1486c2c66affSColin Finck );
1487c2c66affSColin Finck 
1488c2c66affSColin Finck NTSTATUS
1489c2c66affSColin Finck NTAPI
1490c2c66affSColin Finck locintrf_Constructor(
1491c2c66affSColin Finck     IN PVOID DeviceExtension,
1492c2c66affSColin Finck     IN PVOID Instance,
1493c2c66affSColin Finck     IN PVOID InterfaceData,
1494c2c66affSColin Finck     IN USHORT Version,
1495c2c66affSColin Finck     IN USHORT Size,
1496c2c66affSColin Finck     IN PINTERFACE Interface
1497c2c66affSColin Finck );
1498c2c66affSColin Finck 
1499c2c66affSColin Finck NTSTATUS
1500c2c66affSColin Finck NTAPI
1501c2c66affSColin Finck PciPmeInterfaceConstructor(
1502c2c66affSColin Finck     IN PVOID DeviceExtension,
1503c2c66affSColin Finck     IN PVOID Instance,
1504c2c66affSColin Finck     IN PVOID InterfaceData,
1505c2c66affSColin Finck     IN USHORT Version,
1506c2c66affSColin Finck     IN USHORT Size,
1507c2c66affSColin Finck     IN PINTERFACE Interface
1508c2c66affSColin Finck );
1509c2c66affSColin Finck 
1510c2c66affSColin Finck NTSTATUS
1511c2c66affSColin Finck NTAPI
1512c2c66affSColin Finck routeintrf_Constructor(
1513c2c66affSColin Finck     IN PVOID DeviceExtension,
1514c2c66affSColin Finck     IN PVOID Instance,
1515c2c66affSColin Finck     IN PVOID InterfaceData,
1516c2c66affSColin Finck     IN USHORT Version,
1517c2c66affSColin Finck     IN USHORT Size,
1518c2c66affSColin Finck     IN PINTERFACE Interface
1519c2c66affSColin Finck );
1520c2c66affSColin Finck 
1521c2c66affSColin Finck NTSTATUS
1522c2c66affSColin Finck NTAPI
1523c2c66affSColin Finck devpresent_Constructor(
1524c2c66affSColin Finck     IN PVOID DeviceExtension,
1525c2c66affSColin Finck     IN PVOID Instance,
1526c2c66affSColin Finck     IN PVOID InterfaceData,
1527c2c66affSColin Finck     IN USHORT Version,
1528c2c66affSColin Finck     IN USHORT Size,
1529c2c66affSColin Finck     IN PINTERFACE Interface
1530c2c66affSColin Finck );
1531c2c66affSColin Finck 
1532c2c66affSColin Finck //
1533c2c66affSColin Finck // PCI Enumeration and Resources
1534c2c66affSColin Finck //
1535c2c66affSColin Finck NTSTATUS
1536c2c66affSColin Finck NTAPI
1537c2c66affSColin Finck PciQueryDeviceRelations(
1538c2c66affSColin Finck     IN PPCI_FDO_EXTENSION DeviceExtension,
1539c2c66affSColin Finck     IN OUT PDEVICE_RELATIONS *pDeviceRelations
1540c2c66affSColin Finck );
1541c2c66affSColin Finck 
1542c2c66affSColin Finck NTSTATUS
1543c2c66affSColin Finck NTAPI
1544c2c66affSColin Finck PciQueryResources(
1545c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
1546c2c66affSColin Finck     OUT PCM_RESOURCE_LIST *Buffer
1547c2c66affSColin Finck );
1548c2c66affSColin Finck 
1549c2c66affSColin Finck NTSTATUS
1550c2c66affSColin Finck NTAPI
1551c2c66affSColin Finck PciQueryTargetDeviceRelations(
1552c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
1553c2c66affSColin Finck     IN OUT PDEVICE_RELATIONS *pDeviceRelations
1554c2c66affSColin Finck );
1555c2c66affSColin Finck 
1556c2c66affSColin Finck NTSTATUS
1557c2c66affSColin Finck NTAPI
1558c2c66affSColin Finck PciQueryEjectionRelations(
1559c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
1560c2c66affSColin Finck     IN OUT PDEVICE_RELATIONS *pDeviceRelations
1561c2c66affSColin Finck );
1562c2c66affSColin Finck 
1563c2c66affSColin Finck NTSTATUS
1564c2c66affSColin Finck NTAPI
1565c2c66affSColin Finck PciQueryRequirements(
1566c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
1567c2c66affSColin Finck     IN OUT PIO_RESOURCE_REQUIREMENTS_LIST *RequirementsList
1568c2c66affSColin Finck );
1569c2c66affSColin Finck 
1570c2c66affSColin Finck BOOLEAN
1571c2c66affSColin Finck NTAPI
1572c2c66affSColin Finck PciComputeNewCurrentSettings(
1573c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
1574c2c66affSColin Finck     IN PCM_RESOURCE_LIST ResourceList
1575c2c66affSColin Finck );
1576c2c66affSColin Finck 
1577c2c66affSColin Finck NTSTATUS
1578c2c66affSColin Finck NTAPI
1579c2c66affSColin Finck PciSetResources(
1580c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
1581c2c66affSColin Finck     IN BOOLEAN DoReset,
1582c2c66affSColin Finck     IN BOOLEAN SomethingSomethingDarkSide
1583c2c66affSColin Finck );
1584c2c66affSColin Finck 
1585c2c66affSColin Finck NTSTATUS
1586c2c66affSColin Finck NTAPI
1587c2c66affSColin Finck PciBuildRequirementsList(
1588c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
1589c2c66affSColin Finck     IN PPCI_COMMON_HEADER PciData,
1590c2c66affSColin Finck     OUT PIO_RESOURCE_REQUIREMENTS_LIST* Buffer
1591c2c66affSColin Finck );
1592c2c66affSColin Finck 
1593c2c66affSColin Finck //
1594c2c66affSColin Finck // Identification Functions
1595c2c66affSColin Finck //
1596c2c66affSColin Finck PWCHAR
1597c2c66affSColin Finck NTAPI
1598c2c66affSColin Finck PciGetDeviceDescriptionMessage(
1599c2c66affSColin Finck     IN UCHAR BaseClass,
1600c2c66affSColin Finck     IN UCHAR SubClass
1601c2c66affSColin Finck );
1602c2c66affSColin Finck 
1603c2c66affSColin Finck NTSTATUS
1604c2c66affSColin Finck NTAPI
1605c2c66affSColin Finck PciQueryDeviceText(
1606c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
1607c2c66affSColin Finck     IN DEVICE_TEXT_TYPE QueryType,
1608c2c66affSColin Finck     IN ULONG Locale,
1609c2c66affSColin Finck     OUT PWCHAR *Buffer
1610c2c66affSColin Finck );
1611c2c66affSColin Finck 
1612c2c66affSColin Finck NTSTATUS
1613c2c66affSColin Finck NTAPI
1614c2c66affSColin Finck PciQueryId(
1615c2c66affSColin Finck     IN PPCI_PDO_EXTENSION DeviceExtension,
1616c2c66affSColin Finck     IN BUS_QUERY_ID_TYPE QueryType,
1617c2c66affSColin Finck     OUT PWCHAR *Buffer
1618c2c66affSColin Finck );
1619c2c66affSColin Finck 
1620c2c66affSColin Finck //
1621c2c66affSColin Finck // CardBUS Support
1622c2c66affSColin Finck //
1623c2c66affSColin Finck VOID
1624c2c66affSColin Finck NTAPI
1625c2c66affSColin Finck Cardbus_MassageHeaderForLimitsDetermination(
1626c2c66affSColin Finck     IN PPCI_CONFIGURATOR_CONTEXT Context
1627c2c66affSColin Finck );
1628c2c66affSColin Finck 
1629c2c66affSColin Finck VOID
1630c2c66affSColin Finck NTAPI
1631c2c66affSColin Finck Cardbus_SaveCurrentSettings(
1632c2c66affSColin Finck     IN PPCI_CONFIGURATOR_CONTEXT Context
1633c2c66affSColin Finck );
1634c2c66affSColin Finck 
1635c2c66affSColin Finck VOID
1636c2c66affSColin Finck NTAPI
1637c2c66affSColin Finck Cardbus_SaveLimits(
1638c2c66affSColin Finck     IN PPCI_CONFIGURATOR_CONTEXT Context
1639c2c66affSColin Finck );
1640c2c66affSColin Finck 
1641c2c66affSColin Finck VOID
1642c2c66affSColin Finck NTAPI
1643c2c66affSColin Finck Cardbus_RestoreCurrent(
1644c2c66affSColin Finck     IN PPCI_CONFIGURATOR_CONTEXT Context
1645c2c66affSColin Finck );
1646c2c66affSColin Finck 
1647c2c66affSColin Finck VOID
1648c2c66affSColin Finck NTAPI
1649c2c66affSColin Finck Cardbus_GetAdditionalResourceDescriptors(
1650c2c66affSColin Finck     IN PPCI_CONFIGURATOR_CONTEXT Context,
1651c2c66affSColin Finck     IN PPCI_COMMON_HEADER PciData,
1652c2c66affSColin Finck     IN PIO_RESOURCE_DESCRIPTOR IoDescriptor
1653c2c66affSColin Finck );
1654c2c66affSColin Finck 
1655c2c66affSColin Finck VOID
1656c2c66affSColin Finck NTAPI
1657c2c66affSColin Finck Cardbus_ResetDevice(
1658c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
1659c2c66affSColin Finck     IN PPCI_COMMON_HEADER PciData
1660c2c66affSColin Finck );
1661c2c66affSColin Finck 
1662c2c66affSColin Finck VOID
1663c2c66affSColin Finck NTAPI
1664c2c66affSColin Finck Cardbus_ChangeResourceSettings(
1665c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
1666c2c66affSColin Finck     IN PPCI_COMMON_HEADER PciData
1667c2c66affSColin Finck );
1668c2c66affSColin Finck 
1669c2c66affSColin Finck //
1670c2c66affSColin Finck // PCI Device Support
1671c2c66affSColin Finck //
1672c2c66affSColin Finck VOID
1673c2c66affSColin Finck NTAPI
1674c2c66affSColin Finck Device_MassageHeaderForLimitsDetermination(
1675c2c66affSColin Finck     IN PPCI_CONFIGURATOR_CONTEXT Context
1676c2c66affSColin Finck );
1677c2c66affSColin Finck 
1678c2c66affSColin Finck VOID
1679c2c66affSColin Finck NTAPI
1680c2c66affSColin Finck Device_SaveCurrentSettings(
1681c2c66affSColin Finck     IN PPCI_CONFIGURATOR_CONTEXT Context
1682c2c66affSColin Finck );
1683c2c66affSColin Finck 
1684c2c66affSColin Finck VOID
1685c2c66affSColin Finck NTAPI
1686c2c66affSColin Finck Device_SaveLimits(
1687c2c66affSColin Finck     IN PPCI_CONFIGURATOR_CONTEXT Context
1688c2c66affSColin Finck );
1689c2c66affSColin Finck 
1690c2c66affSColin Finck VOID
1691c2c66affSColin Finck NTAPI
1692c2c66affSColin Finck Device_RestoreCurrent(
1693c2c66affSColin Finck     IN PPCI_CONFIGURATOR_CONTEXT Context
1694c2c66affSColin Finck );
1695c2c66affSColin Finck 
1696c2c66affSColin Finck VOID
1697c2c66affSColin Finck NTAPI
1698c2c66affSColin Finck Device_GetAdditionalResourceDescriptors(
1699c2c66affSColin Finck     IN PPCI_CONFIGURATOR_CONTEXT Context,
1700c2c66affSColin Finck     IN PPCI_COMMON_HEADER PciData,
1701c2c66affSColin Finck     IN PIO_RESOURCE_DESCRIPTOR IoDescriptor
1702c2c66affSColin Finck );
1703c2c66affSColin Finck 
1704c2c66affSColin Finck VOID
1705c2c66affSColin Finck NTAPI
1706c2c66affSColin Finck Device_ResetDevice(
1707c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
1708c2c66affSColin Finck     IN PPCI_COMMON_HEADER PciData
1709c2c66affSColin Finck );
1710c2c66affSColin Finck 
1711c2c66affSColin Finck VOID
1712c2c66affSColin Finck NTAPI
1713c2c66affSColin Finck Device_ChangeResourceSettings(
1714c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
1715c2c66affSColin Finck     IN PPCI_COMMON_HEADER PciData
1716c2c66affSColin Finck );
1717c2c66affSColin Finck 
1718c2c66affSColin Finck //
1719c2c66affSColin Finck // PCI-to-PCI Bridge Device Support
1720c2c66affSColin Finck //
1721c2c66affSColin Finck VOID
1722c2c66affSColin Finck NTAPI
1723c2c66affSColin Finck PPBridge_MassageHeaderForLimitsDetermination(
1724c2c66affSColin Finck     IN PPCI_CONFIGURATOR_CONTEXT Context
1725c2c66affSColin Finck );
1726c2c66affSColin Finck 
1727c2c66affSColin Finck VOID
1728c2c66affSColin Finck NTAPI
1729c2c66affSColin Finck PPBridge_SaveCurrentSettings(
1730c2c66affSColin Finck     IN PPCI_CONFIGURATOR_CONTEXT Context
1731c2c66affSColin Finck );
1732c2c66affSColin Finck 
1733c2c66affSColin Finck VOID
1734c2c66affSColin Finck NTAPI
1735c2c66affSColin Finck PPBridge_SaveLimits(
1736c2c66affSColin Finck     IN PPCI_CONFIGURATOR_CONTEXT Context
1737c2c66affSColin Finck );
1738c2c66affSColin Finck 
1739c2c66affSColin Finck VOID
1740c2c66affSColin Finck NTAPI
1741c2c66affSColin Finck PPBridge_RestoreCurrent(
1742c2c66affSColin Finck     IN PPCI_CONFIGURATOR_CONTEXT Context
1743c2c66affSColin Finck );
1744c2c66affSColin Finck 
1745c2c66affSColin Finck VOID
1746c2c66affSColin Finck NTAPI
1747c2c66affSColin Finck PPBridge_GetAdditionalResourceDescriptors(
1748c2c66affSColin Finck     IN PPCI_CONFIGURATOR_CONTEXT Context,
1749c2c66affSColin Finck     IN PPCI_COMMON_HEADER PciData,
1750c2c66affSColin Finck     IN PIO_RESOURCE_DESCRIPTOR IoDescriptor
1751c2c66affSColin Finck );
1752c2c66affSColin Finck 
1753c2c66affSColin Finck VOID
1754c2c66affSColin Finck NTAPI
1755c2c66affSColin Finck PPBridge_ResetDevice(
1756c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
1757c2c66affSColin Finck     IN PPCI_COMMON_HEADER PciData
1758c2c66affSColin Finck );
1759c2c66affSColin Finck 
1760c2c66affSColin Finck VOID
1761c2c66affSColin Finck NTAPI
1762c2c66affSColin Finck PPBridge_ChangeResourceSettings(
1763c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
1764c2c66affSColin Finck     IN PPCI_COMMON_HEADER PciData
1765c2c66affSColin Finck );
1766c2c66affSColin Finck 
1767c2c66affSColin Finck //
1768c2c66affSColin Finck // Bus Number Routines
1769c2c66affSColin Finck //
1770c2c66affSColin Finck BOOLEAN
1771c2c66affSColin Finck NTAPI
1772c2c66affSColin Finck PciAreBusNumbersConfigured(
1773c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension
1774c2c66affSColin Finck );
1775c2c66affSColin Finck 
1776c2c66affSColin Finck //
1777c2c66affSColin Finck // Routine Interface
1778c2c66affSColin Finck //
1779c2c66affSColin Finck NTSTATUS
1780c2c66affSColin Finck NTAPI
1781c2c66affSColin Finck PciCacheLegacyDeviceRouting(
1782c2c66affSColin Finck     IN PDEVICE_OBJECT DeviceObject,
1783c2c66affSColin Finck     IN ULONG BusNumber,
1784c2c66affSColin Finck     IN ULONG SlotNumber,
1785c2c66affSColin Finck     IN UCHAR InterruptLine,
1786c2c66affSColin Finck     IN UCHAR InterruptPin,
1787c2c66affSColin Finck     IN UCHAR BaseClass,
1788c2c66affSColin Finck     IN UCHAR SubClass,
1789c2c66affSColin Finck     IN PDEVICE_OBJECT PhysicalDeviceObject,
1790c2c66affSColin Finck     IN PPCI_PDO_EXTENSION PdoExtension,
1791c2c66affSColin Finck     OUT PDEVICE_OBJECT *pFoundDeviceObject
1792c2c66affSColin Finck );
1793c2c66affSColin Finck 
1794c2c66affSColin Finck //
1795c2c66affSColin Finck // External Resources
1796c2c66affSColin Finck //
1797c2c66affSColin Finck extern SINGLE_LIST_ENTRY PciFdoExtensionListHead;
1798c2c66affSColin Finck extern KEVENT PciGlobalLock;
1799c2c66affSColin Finck extern PPCI_INTERFACE PciInterfaces[];
1800c2c66affSColin Finck extern PCI_INTERFACE ArbiterInterfaceBusNumber;
1801c2c66affSColin Finck extern PCI_INTERFACE ArbiterInterfaceMemory;
1802c2c66affSColin Finck extern PCI_INTERFACE ArbiterInterfaceIo;
1803c2c66affSColin Finck extern PCI_INTERFACE BusHandlerInterface;
1804c2c66affSColin Finck extern PCI_INTERFACE PciRoutingInterface;
1805c2c66affSColin Finck extern PCI_INTERFACE PciCardbusPrivateInterface;
1806c2c66affSColin Finck extern PCI_INTERFACE PciLegacyDeviceDetectionInterface;
1807c2c66affSColin Finck extern PCI_INTERFACE PciPmeInterface;
1808c2c66affSColin Finck extern PCI_INTERFACE PciDevicePresentInterface;
1809c2c66affSColin Finck //extern PCI_INTERFACE PciNativeIdeInterface;
1810c2c66affSColin Finck extern PCI_INTERFACE PciLocationInterface;
1811c2c66affSColin Finck extern PCI_INTERFACE AgpTargetInterface;
1812c2c66affSColin Finck extern PCI_INTERFACE TranslatorInterfaceInterrupt;
1813c2c66affSColin Finck extern PDRIVER_OBJECT PciDriverObject;
1814c2c66affSColin Finck extern PWATCHDOG_TABLE WdTable;
1815c2c66affSColin Finck extern PPCI_HACK_ENTRY PciHackTable;
1816c2c66affSColin Finck extern BOOLEAN PciAssignBusNumbers;
1817c2c66affSColin Finck extern BOOLEAN PciEnableNativeModeATA;
1818c2c66affSColin Finck extern PPCI_IRQ_ROUTING_TABLE PciIrqRoutingTable;
1819c2c66affSColin Finck extern BOOLEAN PciRunningDatacenter;
1820c2c66affSColin Finck 
1821c2c66affSColin Finck /* Exported by NTOS, should this go in the NDK? */
1822c2c66affSColin Finck extern NTSYSAPI BOOLEAN InitSafeBootMode;
1823c2c66affSColin Finck 
1824c2c66affSColin Finck #endif /* _PCIX_PCH_ */
1825