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