Can't sleep so write more source codes! add scan bus functions to get power caps...
[reactos.git] / reactos / 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 Debugging Device Support
67 //
68 #define MAX_DEBUGGING_DEVICES_SUPPORTED 0x04
69
70 //
71 // PCI Driver Verifier Failures
72 //
73 #define PCI_VERIFIER_CODES 0x04
74
75 //
76 // Device Extension, Interface, Translator and Arbiter Signatures
77 //
78 typedef enum _PCI_SIGNATURE
79 {
80 PciPdoExtensionType = 'icP0',
81 PciFdoExtensionType = 'icP1',
82 PciArb_Io = 'icP2',
83 PciArb_Memory = 'icP3',
84 PciArb_Interrupt = 'icP4',
85 PciArb_BusNumber = 'icP5',
86 PciTrans_Interrupt = 'icP6',
87 PciInterface_BusHandler = 'icP7',
88 PciInterface_IntRouteHandler = 'icP8',
89 PciInterface_PciCb = 'icP9',
90 PciInterface_LegacyDeviceDetection = 'icP:',
91 PciInterface_PmeHandler = 'icP;',
92 PciInterface_DevicePresent = 'icP<',
93 PciInterface_NativeIde = 'icP=',
94 PciInterface_AgpTarget = 'icP>',
95 PciInterface_Location = 'icP?'
96 } PCI_SIGNATURE, *PPCI_SIGNATURE;
97
98 //
99 // Device Extension Logic States
100 //
101 typedef enum _PCI_STATE
102 {
103 PciNotStarted,
104 PciStarted,
105 PciDeleted,
106 PciStopped,
107 PciSurpriseRemoved,
108 PciSynchronizedOperation,
109 PciMaxObjectState
110 } PCI_STATE;
111
112 //
113 // IRP Dispatch Logic Style
114 //
115 typedef enum _PCI_DISPATCH_STYLE
116 {
117 IRP_COMPLETE,
118 IRP_DOWNWARD,
119 IRP_UPWARD,
120 IRP_DISPATCH,
121 } PCI_DISPATCH_STYLE;
122
123 //
124 // PCI Hack Entry Information
125 //
126 typedef struct _PCI_HACK_ENTRY
127 {
128 USHORT VendorID;
129 USHORT DeviceID;
130 USHORT SubVendorID;
131 USHORT SubSystemID;
132 ULONGLONG HackFlags;
133 USHORT RevisionID;
134 UCHAR Flags;
135 } PCI_HACK_ENTRY, *PPCI_HACK_ENTRY;
136
137 //
138 // Power State Information for Device Extension
139 //
140 typedef struct _PCI_POWER_STATE
141 {
142 SYSTEM_POWER_STATE CurrentSystemState;
143 DEVICE_POWER_STATE CurrentDeviceState;
144 SYSTEM_POWER_STATE SystemWakeLevel;
145 DEVICE_POWER_STATE DeviceWakeLevel;
146 DEVICE_POWER_STATE SystemStateMapping[7];
147 PIRP WaitWakeIrp;
148 PVOID SavedCancelRoutine;
149 LONG Paging;
150 LONG Hibernate;
151 LONG CrashDump;
152 } PCI_POWER_STATE, *PPCI_POWER_STATE;
153
154 //
155 // Internal PCI Lock Structure
156 //
157 typedef struct _PCI_LOCK
158 {
159 LONG Atom;
160 BOOLEAN OldIrql;
161 } PCI_LOCK, *PPCI_LOCK;
162
163 //
164 // Device Extension for a Bus FDO
165 //
166 typedef struct _PCI_FDO_EXTENSION
167 {
168 SINGLE_LIST_ENTRY List;
169 ULONG ExtensionType;
170 struct _PCI_MJ_DISPATCH_TABLE *IrpDispatchTable;
171 BOOLEAN DeviceState;
172 BOOLEAN TentativeNextState;
173 KEVENT SecondaryExtLock;
174 PDEVICE_OBJECT PhysicalDeviceObject;
175 PDEVICE_OBJECT FunctionalDeviceObject;
176 PDEVICE_OBJECT AttachedDeviceObject;
177 KEVENT ChildListLock;
178 struct _PCI_PDO_EXTENSION *ChildPdoList;
179 struct _PCI_FDO_EXTENSION *BusRootFdoExtension;
180 struct _PCI_FDO_EXTENSION *ParentFdoExtension;
181 struct _PCI_PDO_EXTENSION *ChildBridgePdoList;
182 PPCI_BUS_INTERFACE_STANDARD PciBusInterface;
183 BOOLEAN MaxSubordinateBus;
184 BUS_HANDLER *BusHandler;
185 BOOLEAN BaseBus;
186 BOOLEAN Fake;
187 BOOLEAN ChildDelete;
188 BOOLEAN Scanned;
189 BOOLEAN ArbitersInitialized;
190 BOOLEAN BrokenVideoHackApplied;
191 BOOLEAN Hibernated;
192 PCI_POWER_STATE PowerState;
193 SINGLE_LIST_ENTRY SecondaryExtension;
194 LONG ChildWaitWakeCount;
195 PPCI_COMMON_CONFIG PreservedConfig;
196 PCI_LOCK Lock;
197 struct
198 {
199 BOOLEAN Acquired;
200 BOOLEAN CacheLineSize;
201 BOOLEAN LatencyTimer;
202 BOOLEAN EnablePERR;
203 BOOLEAN EnableSERR;
204 } HotPlugParameters;
205 LONG BusHackFlags;
206 } PCI_FDO_EXTENSION, *PPCI_FDO_EXTENSION;
207
208 typedef struct _PCI_FUNCTION_RESOURCES
209 {
210 IO_RESOURCE_DESCRIPTOR Limit[7];
211 CM_PARTIAL_RESOURCE_DESCRIPTOR Current[7];
212 } PCI_FUNCTION_RESOURCES, *PPCI_FUNCTION_RESOURCES;
213
214 typedef union _PCI_HEADER_TYPE_DEPENDENT
215 {
216 struct
217 {
218 UCHAR Spare[4];
219 } type0;
220 struct
221 {
222 UCHAR PrimaryBus;
223 UCHAR SecondaryBus;
224 UCHAR SubordinateBus;
225 UCHAR SubtractiveDecode:1;
226 UCHAR IsaBitSet:1;
227 UCHAR VgaBitSet:1;
228 UCHAR WeChangedBusNumbers:1;
229 UCHAR IsaBitRequired:1;
230 } type1;
231 struct
232 {
233 UCHAR Spare[4];
234 } type2;
235 } PCI_HEADER_TYPE_DEPENDENT, *PPCI_HEADER_TYPE_DEPENDENT;
236
237 typedef struct _PCI_PDO_EXTENSION
238 {
239 PVOID Next;
240 ULONG ExtensionType;
241 struct _PCI_MJ_DISPATCH_TABLE *IrpDispatchTable;
242 BOOLEAN DeviceState;
243 BOOLEAN TentativeNextState;
244
245 KEVENT SecondaryExtLock;
246 PCI_SLOT_NUMBER Slot;
247 PDEVICE_OBJECT PhysicalDeviceObject;
248 PPCI_FDO_EXTENSION ParentFdoExtension;
249 SINGLE_LIST_ENTRY SecondaryExtension;
250 LONG BusInterfaceReferenceCount;
251 LONG AgpInterfaceReferenceCount;
252 USHORT VendorId;
253 USHORT DeviceId;
254 USHORT SubsystemVendorId;
255 USHORT SubsystemId;
256 BOOLEAN RevisionId;
257 BOOLEAN ProgIf;
258 BOOLEAN SubClass;
259 BOOLEAN BaseClass;
260 BOOLEAN AdditionalResourceCount;
261 BOOLEAN AdjustedInterruptLine;
262 BOOLEAN InterruptPin;
263 BOOLEAN RawInterruptLine;
264 BOOLEAN CapabilitiesPtr;
265 BOOLEAN SavedLatencyTimer;
266 BOOLEAN SavedCacheLineSize;
267 BOOLEAN HeaderType;
268 BOOLEAN NotPresent;
269 BOOLEAN ReportedMissing;
270 BOOLEAN ExpectedWritebackFailure;
271 BOOLEAN NoTouchPmeEnable;
272 BOOLEAN LegacyDriver;
273 BOOLEAN UpdateHardware;
274 BOOLEAN MovedDevice;
275 BOOLEAN DisablePowerDown;
276 BOOLEAN NeedsHotPlugConfiguration;
277 BOOLEAN SwitchedIDEToNativeMode;
278 BOOLEAN BIOSAllowsIDESwitchToNativeMode;
279 BOOLEAN IoSpaceUnderNativeIdeControl;
280 BOOLEAN OnDebugPath;
281 PCI_POWER_STATE PowerState;
282 PCI_HEADER_TYPE_DEPENDENT Dependent;
283 ULONGLONG HackFlags;
284 PCI_FUNCTION_RESOURCES *Resources;
285 PCI_FDO_EXTENSION *BridgeFdoExtension;
286 struct _PCI_PDO_EXTENSION *NextBridge;
287 struct _PCI_PDO_EXTENSION *NextHashEntry;
288 PCI_LOCK Lock;
289 PCI_PMC PowerCapabilities;
290 BOOLEAN TargetAgpCapabilityId;
291 USHORT CommandEnables;
292 USHORT InitialCommand;
293 } PCI_PDO_EXTENSION, *PPCI_PDO_EXTENSION;
294
295 //
296 // IRP Dispatch Function Type
297 //
298 typedef NTSTATUS (NTAPI *PCI_DISPATCH_FUNCTION)(
299 IN PIRP Irp,
300 IN PIO_STACK_LOCATION IoStackLocation,
301 IN PVOID DeviceExtension
302 );
303
304 //
305 // IRP Dispatch Minor Table
306 //
307 typedef struct _PCI_MN_DISPATCH_TABLE
308 {
309 PCI_DISPATCH_STYLE DispatchStyle;
310 PCI_DISPATCH_FUNCTION DispatchFunction;
311 } PCI_MN_DISPATCH_TABLE, *PPCI_MN_DISPATCH_TABLE;
312
313 //
314 // IRP Dispatch Major Table
315 //
316 typedef struct _PCI_MJ_DISPATCH_TABLE
317 {
318 ULONG PnpIrpMaximumMinorFunction;
319 PPCI_MN_DISPATCH_TABLE PnpIrpDispatchTable;
320 ULONG PowerIrpMaximumMinorFunction;
321 PPCI_MN_DISPATCH_TABLE PowerIrpDispatchTable;
322 PCI_DISPATCH_STYLE SystemControlIrpDispatchStyle;
323 PCI_DISPATCH_FUNCTION SystemControlIrpDispatchFunction;
324 PCI_DISPATCH_STYLE OtherIrpDispatchStyle;
325 PCI_DISPATCH_FUNCTION OtherIrpDispatchFunction;
326 } PCI_MJ_DISPATCH_TABLE, *PPCI_MJ_DISPATCH_TABLE;
327
328 //
329 // Generic PCI Interface Constructor and Initializer
330 //
331 struct _PCI_INTERFACE;
332 typedef NTSTATUS (NTAPI *PCI_INTERFACE_CONSTRUCTOR)(
333 IN PVOID DeviceExtension,
334 IN PVOID Instance,
335 IN PVOID InterfaceData,
336 IN USHORT Version,
337 IN USHORT Size,
338 IN PINTERFACE Interface
339 );
340
341 typedef NTSTATUS (NTAPI *PCI_INTERFACE_INITIALIZER)(
342 IN PVOID Instance
343 );
344
345 //
346 // Generic PCI Interface (Interface, Translator, Arbiter)
347 //
348 typedef struct _PCI_INTERFACE
349 {
350 CONST GUID *InterfaceType;
351 USHORT MinSize;
352 USHORT MinVersion;
353 USHORT MaxVersion;
354 USHORT Flags;
355 LONG ReferenceCount;
356 PCI_SIGNATURE Signature;
357 PCI_INTERFACE_CONSTRUCTOR Constructor;
358 PCI_INTERFACE_INITIALIZER Initializer;
359 } PCI_INTERFACE, *PPCI_INTERFACE;
360
361 //
362 // Generic Secondary Extension Instance Header (Interface, Translator, Arbiter)
363 //
364 typedef struct PCI_SECONDARY_EXTENSION
365 {
366 SINGLE_LIST_ENTRY List;
367 PCI_SIGNATURE ExtensionType;
368 PVOID Destructor;
369 } PCI_SECONDARY_EXTENSION, *PPCI_SECONDARY_EXTENSION;
370
371 //
372 // PCI Arbiter Instance
373 //
374 typedef struct PCI_ARBITER_INSTANCE
375 {
376 PCI_SECONDARY_EXTENSION Header;
377 PPCI_INTERFACE Interface;
378 PPCI_FDO_EXTENSION BusFdoExtension;
379 WCHAR InstanceName[24];
380 //ARBITER_INSTANCE CommonInstance; FIXME: Need Arbiter Headers
381 } PCI_ARBITER_INSTANCE, *PPCI_ARBITER_INSTANCE;
382
383 //
384 // PCI Verifier Data
385 //
386 typedef struct _PCI_VERIFIER_DATA
387 {
388 ULONG FailureCode;
389 VF_FAILURE_CLASS FailureClass;
390 ULONG AssertionControl;
391 PCHAR DebuggerMessageText;
392 } PCI_VERIFIER_DATA, *PPCI_VERIFIER_DATA;
393
394 //
395 // IRP Dispatch Routines
396 //
397 NTSTATUS
398 NTAPI
399 PciDispatchIrp(
400 IN PDEVICE_OBJECT DeviceObject,
401 IN PIRP Irp
402 );
403
404 NTSTATUS
405 NTAPI
406 PciIrpNotSupported(
407 IN PIRP Irp,
408 IN PIO_STACK_LOCATION IoStackLocation,
409 IN PPCI_FDO_EXTENSION DeviceExtension
410 );
411
412 NTSTATUS
413 NTAPI
414 PciPassIrpFromFdoToPdo(
415 IN PPCI_FDO_EXTENSION DeviceExtension,
416 IN PIRP Irp
417 );
418
419 NTSTATUS
420 NTAPI
421 PciCallDownIrpStack(
422 IN PPCI_FDO_EXTENSION DeviceExtension,
423 IN PIRP Irp
424 );
425
426 NTSTATUS
427 NTAPI
428 PciIrpInvalidDeviceRequest(
429 IN PIRP Irp,
430 IN PIO_STACK_LOCATION IoStackLocation,
431 IN PPCI_FDO_EXTENSION DeviceExtension
432 );
433
434 //
435 // Power Routines
436 //
437 NTSTATUS
438 NTAPI
439 PciFdoWaitWake(
440 IN PIRP Irp,
441 IN PIO_STACK_LOCATION IoStackLocation,
442 IN PPCI_FDO_EXTENSION DeviceExtension
443 );
444
445 NTSTATUS
446 NTAPI
447 PciFdoSetPowerState(
448 IN PIRP Irp,
449 IN PIO_STACK_LOCATION IoStackLocation,
450 IN PPCI_FDO_EXTENSION DeviceExtension
451 );
452
453 NTSTATUS
454 NTAPI
455 PciFdoIrpQueryPower(
456 IN PIRP Irp,
457 IN PIO_STACK_LOCATION IoStackLocation,
458 IN PPCI_FDO_EXTENSION DeviceExtension
459 );
460
461 NTSTATUS
462 NTAPI
463 PciSetPowerManagedDevicePowerState(
464 IN PPCI_PDO_EXTENSION DeviceExtension,
465 IN DEVICE_POWER_STATE DeviceState,
466 IN BOOLEAN IrpSet
467 );
468
469 //
470 // Bus FDO Routines
471 //
472 NTSTATUS
473 NTAPI
474 PciAddDevice(
475 IN PDRIVER_OBJECT DriverObject,
476 IN PDEVICE_OBJECT PhysicalDeviceObject
477 );
478
479 NTSTATUS
480 NTAPI
481 PciFdoIrpStartDevice(
482 IN PIRP Irp,
483 IN PIO_STACK_LOCATION IoStackLocation,
484 IN PPCI_FDO_EXTENSION DeviceExtension
485 );
486
487 NTSTATUS
488 NTAPI
489 PciFdoIrpQueryRemoveDevice(
490 IN PIRP Irp,
491 IN PIO_STACK_LOCATION IoStackLocation,
492 IN PPCI_FDO_EXTENSION DeviceExtension
493 );
494
495 NTSTATUS
496 NTAPI
497 PciFdoIrpRemoveDevice(
498 IN PIRP Irp,
499 IN PIO_STACK_LOCATION IoStackLocation,
500 IN PPCI_FDO_EXTENSION DeviceExtension
501 );
502
503 NTSTATUS
504 NTAPI
505 PciFdoIrpCancelRemoveDevice(
506 IN PIRP Irp,
507 IN PIO_STACK_LOCATION IoStackLocation,
508 IN PPCI_FDO_EXTENSION DeviceExtension
509 );
510
511 NTSTATUS
512 NTAPI
513 PciFdoIrpStopDevice(
514 IN PIRP Irp,
515 IN PIO_STACK_LOCATION IoStackLocation,
516 IN PPCI_FDO_EXTENSION DeviceExtension
517 );
518
519 NTSTATUS
520 NTAPI
521 PciFdoIrpQueryStopDevice(
522 IN PIRP Irp,
523 IN PIO_STACK_LOCATION IoStackLocation,
524 IN PPCI_FDO_EXTENSION DeviceExtension
525 );
526
527 NTSTATUS
528 NTAPI
529 PciFdoIrpCancelStopDevice(
530 IN PIRP Irp,
531 IN PIO_STACK_LOCATION IoStackLocation,
532 IN PPCI_FDO_EXTENSION DeviceExtension
533 );
534
535 NTSTATUS
536 NTAPI
537 PciFdoIrpQueryDeviceRelations(
538 IN PIRP Irp,
539 IN PIO_STACK_LOCATION IoStackLocation,
540 IN PPCI_FDO_EXTENSION DeviceExtension
541 );
542
543 NTSTATUS
544 NTAPI
545 PciFdoIrpQueryInterface(
546 IN PIRP Irp,
547 IN PIO_STACK_LOCATION IoStackLocation,
548 IN PPCI_FDO_EXTENSION DeviceExtension
549 );
550
551 NTSTATUS
552 NTAPI
553 PciFdoIrpQueryCapabilities(
554 IN PIRP Irp,
555 IN PIO_STACK_LOCATION IoStackLocation,
556 IN PPCI_FDO_EXTENSION DeviceExtension
557 );
558
559 NTSTATUS
560 NTAPI
561 PciFdoIrpDeviceUsageNotification(
562 IN PIRP Irp,
563 IN PIO_STACK_LOCATION IoStackLocation,
564 IN PPCI_FDO_EXTENSION DeviceExtension
565 );
566
567 NTSTATUS
568 NTAPI
569 PciFdoIrpSurpriseRemoval(
570 IN PIRP Irp,
571 IN PIO_STACK_LOCATION IoStackLocation,
572 IN PPCI_FDO_EXTENSION DeviceExtension
573 );
574
575 NTSTATUS
576 NTAPI
577 PciFdoIrpQueryLegacyBusInformation(
578 IN PIRP Irp,
579 IN PIO_STACK_LOCATION IoStackLocation,
580 IN PPCI_FDO_EXTENSION DeviceExtension
581 );
582
583 //
584 // Device PDO Routines
585 //
586 NTSTATUS
587 NTAPI
588 PciPdoCreate(
589 IN PPCI_FDO_EXTENSION DeviceExtension,
590 IN PCI_SLOT_NUMBER Slot,
591 OUT PDEVICE_OBJECT *PdoDeviceObject
592 );
593
594 NTSTATUS
595 NTAPI
596 PciPdoWaitWake(
597 IN PIRP Irp,
598 IN PIO_STACK_LOCATION IoStackLocation,
599 IN PPCI_PDO_EXTENSION DeviceExtension
600 );
601
602 NTSTATUS
603 NTAPI
604 PciPdoSetPowerState(
605 IN PIRP Irp,
606 IN PIO_STACK_LOCATION IoStackLocation,
607 IN PPCI_PDO_EXTENSION DeviceExtension
608 );
609
610 NTSTATUS
611 NTAPI
612 PciPdoIrpQueryPower(
613 IN PIRP Irp,
614 IN PIO_STACK_LOCATION IoStackLocation,
615 IN PPCI_PDO_EXTENSION DeviceExtension
616 );
617
618 NTSTATUS
619 NTAPI
620 PciPdoIrpStartDevice(
621 IN PIRP Irp,
622 IN PIO_STACK_LOCATION IoStackLocation,
623 IN PPCI_PDO_EXTENSION DeviceExtension
624 );
625
626 NTSTATUS
627 NTAPI
628 PciPdoIrpQueryRemoveDevice(
629 IN PIRP Irp,
630 IN PIO_STACK_LOCATION IoStackLocation,
631 IN PPCI_PDO_EXTENSION DeviceExtension
632 );
633
634 NTSTATUS
635 NTAPI
636 PciPdoIrpRemoveDevice(
637 IN PIRP Irp,
638 IN PIO_STACK_LOCATION IoStackLocation,
639 IN PPCI_PDO_EXTENSION DeviceExtension
640 );
641
642 NTSTATUS
643 NTAPI
644 PciPdoIrpCancelRemoveDevice(
645 IN PIRP Irp,
646 IN PIO_STACK_LOCATION IoStackLocation,
647 IN PPCI_PDO_EXTENSION DeviceExtension
648 );
649
650 NTSTATUS
651 NTAPI
652 PciPdoIrpStopDevice(
653 IN PIRP Irp,
654 IN PIO_STACK_LOCATION IoStackLocation,
655 IN PPCI_PDO_EXTENSION DeviceExtension
656 );
657
658 NTSTATUS
659 NTAPI
660 PciPdoIrpQueryStopDevice(
661 IN PIRP Irp,
662 IN PIO_STACK_LOCATION IoStackLocation,
663 IN PPCI_PDO_EXTENSION DeviceExtension
664 );
665
666 NTSTATUS
667 NTAPI
668 PciPdoIrpCancelStopDevice(
669 IN PIRP Irp,
670 IN PIO_STACK_LOCATION IoStackLocation,
671 IN PPCI_PDO_EXTENSION DeviceExtension
672 );
673
674 NTSTATUS
675 NTAPI
676 PciPdoIrpQueryDeviceRelations(
677 IN PIRP Irp,
678 IN PIO_STACK_LOCATION IoStackLocation,
679 IN PPCI_PDO_EXTENSION DeviceExtension
680 );
681
682 NTSTATUS
683 NTAPI
684 PciPdoIrpQueryInterface(
685 IN PIRP Irp,
686 IN PIO_STACK_LOCATION IoStackLocation,
687 IN PPCI_PDO_EXTENSION DeviceExtension
688 );
689
690 NTSTATUS
691 NTAPI
692 PciPdoIrpQueryCapabilities(
693 IN PIRP Irp,
694 IN PIO_STACK_LOCATION IoStackLocation,
695 IN PPCI_PDO_EXTENSION DeviceExtension
696 );
697
698 NTSTATUS
699 NTAPI
700 PciPdoIrpQueryResources(
701 IN PIRP Irp,
702 IN PIO_STACK_LOCATION IoStackLocation,
703 IN PPCI_PDO_EXTENSION DeviceExtension
704 );
705
706 NTSTATUS
707 NTAPI
708 PciPdoIrpQueryResourceRequirements(
709 IN PIRP Irp,
710 IN PIO_STACK_LOCATION IoStackLocation,
711 IN PPCI_PDO_EXTENSION DeviceExtension
712 );
713
714 NTSTATUS
715 NTAPI
716 PciPdoIrpQueryDeviceText(
717 IN PIRP Irp,
718 IN PIO_STACK_LOCATION IoStackLocation,
719 IN PPCI_PDO_EXTENSION DeviceExtension
720 );
721
722 NTSTATUS
723 NTAPI
724 PciPdoIrpReadConfig(
725 IN PIRP Irp,
726 IN PIO_STACK_LOCATION IoStackLocation,
727 IN PPCI_PDO_EXTENSION DeviceExtension
728 );
729
730 NTSTATUS
731 NTAPI
732 PciPdoIrpWriteConfig(
733 IN PIRP Irp,
734 IN PIO_STACK_LOCATION IoStackLocation,
735 IN PPCI_PDO_EXTENSION DeviceExtension
736 );
737
738 NTSTATUS
739 NTAPI
740 PciPdoIrpQueryId(
741 IN PIRP Irp,
742 IN PIO_STACK_LOCATION IoStackLocation,
743 IN PPCI_PDO_EXTENSION DeviceExtension
744 );
745
746 NTSTATUS
747 NTAPI
748 PciPdoIrpQueryDeviceState(
749 IN PIRP Irp,
750 IN PIO_STACK_LOCATION IoStackLocation,
751 IN PPCI_PDO_EXTENSION DeviceExtension
752 );
753
754 NTSTATUS
755 NTAPI
756 PciPdoIrpQueryBusInformation(
757 IN PIRP Irp,
758 IN PIO_STACK_LOCATION IoStackLocation,
759 IN PPCI_PDO_EXTENSION DeviceExtension
760 );
761
762 NTSTATUS
763 NTAPI
764 PciPdoIrpDeviceUsageNotification(
765 IN PIRP Irp,
766 IN PIO_STACK_LOCATION IoStackLocation,
767 IN PPCI_PDO_EXTENSION DeviceExtension
768 );
769
770 NTSTATUS
771 NTAPI
772 PciPdoIrpSurpriseRemoval(
773 IN PIRP Irp,
774 IN PIO_STACK_LOCATION IoStackLocation,
775 IN PPCI_PDO_EXTENSION DeviceExtension
776 );
777
778 NTSTATUS
779 NTAPI
780 PciPdoIrpQueryLegacyBusInformation(
781 IN PIRP Irp,
782 IN PIO_STACK_LOCATION IoStackLocation,
783 IN PPCI_PDO_EXTENSION DeviceExtension
784 );
785
786
787 //
788 // HAL Callback/Hook Routines
789 //
790 VOID
791 NTAPI
792 PciHookHal(
793 VOID
794 );
795
796 //
797 // PCI Verifier Routines
798 //
799 VOID
800 NTAPI
801 PciVerifierInit(
802 IN PDRIVER_OBJECT DriverObject
803 );
804
805 PPCI_VERIFIER_DATA
806 NTAPI
807 PciVerifierRetrieveFailureData(
808 IN ULONG FailureCode
809 );
810
811 //
812 // Utility Routines
813 //
814 BOOLEAN
815 NTAPI
816 PciStringToUSHORT(
817 IN PWCHAR String,
818 OUT PUSHORT Value
819 );
820
821 BOOLEAN
822 NTAPI
823 PciIsDatacenter(
824 VOID
825 );
826
827 NTSTATUS
828 NTAPI
829 PciBuildDefaultExclusionLists(
830 VOID
831 );
832
833 BOOLEAN
834 NTAPI
835 PciUnicodeStringStrStr(
836 IN PUNICODE_STRING InputString,
837 IN PCUNICODE_STRING EqualString,
838 IN BOOLEAN CaseInSensitive
839 );
840
841 BOOLEAN
842 NTAPI
843 PciOpenKey(
844 IN PWCHAR KeyName,
845 IN HANDLE RootKey,
846 IN ACCESS_MASK DesiredAccess,
847 OUT PHANDLE KeyHandle,
848 OUT PNTSTATUS KeyStatus
849 );
850
851 NTSTATUS
852 NTAPI
853 PciGetRegistryValue(
854 IN PWCHAR ValueName,
855 IN PWCHAR KeyName,
856 IN HANDLE RootHandle,
857 IN ULONG Type,
858 OUT PVOID *OutputBuffer,
859 OUT PULONG OutputLength
860 );
861
862 PPCI_FDO_EXTENSION
863 NTAPI
864 PciFindParentPciFdoExtension(
865 IN PDEVICE_OBJECT DeviceObject,
866 IN PKEVENT Lock
867 );
868
869 VOID
870 NTAPI
871 PciInsertEntryAtTail(
872 IN PSINGLE_LIST_ENTRY ListHead,
873 IN PPCI_FDO_EXTENSION DeviceExtension,
874 IN PKEVENT Lock
875 );
876
877 NTSTATUS
878 NTAPI
879 PciGetDeviceProperty(
880 IN PDEVICE_OBJECT DeviceObject,
881 IN DEVICE_REGISTRY_PROPERTY DeviceProperty,
882 OUT PVOID *OutputBuffer
883 );
884
885 NTSTATUS
886 NTAPI
887 PciSendIoctl(
888 IN PDEVICE_OBJECT DeviceObject,
889 IN ULONG IoControlCode,
890 IN PVOID InputBuffer,
891 IN ULONG InputBufferLength,
892 IN PVOID OutputBuffer,
893 IN ULONG OutputBufferLength
894 );
895
896 VOID
897 NTAPI
898 PcipLinkSecondaryExtension(
899 IN PSINGLE_LIST_ENTRY List,
900 IN PVOID Lock,
901 IN PPCI_SECONDARY_EXTENSION SecondaryExtension,
902 IN PCI_SIGNATURE ExtensionType,
903 IN PVOID Destructor
904 );
905
906 PPCI_SECONDARY_EXTENSION
907 NTAPI
908 PciFindNextSecondaryExtension(
909 IN PSINGLE_LIST_ENTRY ListHead,
910 IN PCI_SIGNATURE ExtensionType
911 );
912
913 ULONGLONG
914 NTAPI
915 PciGetHackFlags(
916 IN USHORT VendorId,
917 IN USHORT DeviceId,
918 IN USHORT SubVendorId,
919 IN USHORT SubSystemId,
920 IN UCHAR RevisionId
921 );
922
923 PPCI_PDO_EXTENSION
924 NTAPI
925 PciFindPdoByFunction(
926 IN PPCI_FDO_EXTENSION DeviceExtension,
927 IN ULONG FunctionNumber,
928 IN PPCI_COMMON_HEADER PciData
929 );
930
931 BOOLEAN
932 NTAPI
933 PciIsCriticalDeviceClass(
934 IN UCHAR BaseClass,
935 IN UCHAR SubClass
936 );
937
938 BOOLEAN
939 NTAPI
940 PciIsDeviceOnDebugPath(
941 IN PPCI_PDO_EXTENSION DeviceExtension
942 );
943
944 NTSTATUS
945 NTAPI
946 PciGetBiosConfig(
947 IN PPCI_PDO_EXTENSION DeviceExtension,
948 OUT PPCI_COMMON_HEADER PciData
949 );
950
951 NTSTATUS
952 NTAPI
953 PciSaveBiosConfig(
954 IN PPCI_PDO_EXTENSION DeviceExtension,
955 OUT PPCI_COMMON_HEADER PciData
956 );
957
958 UCHAR
959 NTAPI
960 PciReadDeviceCapability(
961 IN PPCI_PDO_EXTENSION DeviceExtension,
962 IN UCHAR Offset,
963 IN ULONG CapabilityId,
964 OUT PPCI_CAPABILITIES_HEADER Buffer,
965 IN ULONG Length
966 );
967
968 BOOLEAN
969 NTAPI
970 PciCanDisableDecodes(
971 IN PPCI_PDO_EXTENSION DeviceExtension,
972 IN PPCI_COMMON_HEADER Config,
973 IN ULONGLONG HackFlags,
974 IN BOOLEAN ForPowerDown
975 );
976
977 //
978 // Configuration Routines
979 //
980 NTSTATUS
981 NTAPI
982 PciGetConfigHandlers(
983 IN PPCI_FDO_EXTENSION FdoExtension
984 );
985
986 VOID
987 NTAPI
988 PciReadSlotConfig(
989 IN PPCI_FDO_EXTENSION DeviceExtension,
990 IN PCI_SLOT_NUMBER Slot,
991 IN PVOID Buffer,
992 IN ULONG Offset,
993 IN ULONG Length
994 );
995
996 VOID
997 NTAPI
998 PciWriteDeviceConfig(
999 IN PPCI_PDO_EXTENSION DeviceExtension,
1000 IN PVOID Buffer,
1001 IN ULONG Offset,
1002 IN ULONG Length
1003 );
1004
1005 VOID
1006 NTAPI
1007 PciReadDeviceConfig(
1008 IN PPCI_PDO_EXTENSION DeviceExtension,
1009 IN PVOID Buffer,
1010 IN ULONG Offset,
1011 IN ULONG Length
1012 );
1013
1014 UCHAR
1015 NTAPI
1016 PciGetAdjustedInterruptLine(
1017 IN PPCI_PDO_EXTENSION PdoExtension
1018 );
1019
1020 //
1021 // State Machine Logic Transition Routines
1022 //
1023 VOID
1024 NTAPI
1025 PciInitializeState(
1026 IN PPCI_FDO_EXTENSION DeviceExtension
1027 );
1028
1029 NTSTATUS
1030 NTAPI
1031 PciBeginStateTransition(
1032 IN PPCI_FDO_EXTENSION DeviceExtension,
1033 IN PCI_STATE NewState
1034 );
1035
1036 NTSTATUS
1037 NTAPI
1038 PciCancelStateTransition(
1039 IN PPCI_FDO_EXTENSION DeviceExtension,
1040 IN PCI_STATE NewState
1041 );
1042
1043 VOID
1044 NTAPI
1045 PciCommitStateTransition(
1046 IN PPCI_FDO_EXTENSION DeviceExtension,
1047 IN PCI_STATE NewState
1048 );
1049
1050
1051 //
1052 // Arbiter Support
1053 //
1054 NTSTATUS
1055 NTAPI
1056 PciInitializeArbiters(
1057 IN PPCI_FDO_EXTENSION FdoExtension
1058 );
1059
1060 NTSTATUS
1061 NTAPI
1062 PciInitializeArbiterRanges(
1063 IN PPCI_FDO_EXTENSION DeviceExtension,
1064 IN PCM_RESOURCE_LIST Resources
1065 );
1066
1067 //
1068 // Debug Helpers
1069 //
1070 BOOLEAN
1071 NTAPI
1072 PciDebugIrpDispatchDisplay(
1073 IN PIO_STACK_LOCATION IoStackLocation,
1074 IN PPCI_FDO_EXTENSION DeviceExtension,
1075 IN USHORT MaxMinor
1076 );
1077
1078 VOID
1079 NTAPI
1080 PciDebugDumpCommonConfig(
1081 IN PPCI_COMMON_HEADER PciData
1082 );
1083
1084 //
1085 // Interface Support
1086 //
1087 NTSTATUS
1088 NTAPI
1089 PciQueryInterface(
1090 IN PPCI_FDO_EXTENSION DeviceExtension,
1091 IN CONST GUID* InterfaceType,
1092 IN ULONG Size,
1093 IN ULONG Version,
1094 IN PVOID InterfaceData,
1095 IN PINTERFACE Interface,
1096 IN BOOLEAN LastChance
1097 );
1098
1099 NTSTATUS
1100 NTAPI
1101 PciPmeInterfaceInitializer(
1102 IN PVOID Instance
1103 );
1104
1105 NTSTATUS
1106 NTAPI
1107 routeintrf_Initializer(
1108 IN PVOID Instance
1109 );
1110
1111 NTSTATUS
1112 NTAPI
1113 arbusno_Initializer(
1114 IN PVOID Instance
1115 );
1116
1117 NTSTATUS
1118 NTAPI
1119 agpintrf_Initializer(
1120 IN PVOID Instance
1121 );
1122
1123 NTSTATUS
1124 NTAPI
1125 tranirq_Initializer(
1126 IN PVOID Instance
1127 );
1128
1129 NTSTATUS
1130 NTAPI
1131 busintrf_Initializer(
1132 IN PVOID Instance
1133 );
1134
1135 NTSTATUS
1136 NTAPI
1137 armem_Initializer(
1138 IN PVOID Instance
1139 );
1140
1141 NTSTATUS
1142 NTAPI
1143 ario_Initializer(
1144 IN PVOID Instance
1145 );
1146
1147 NTSTATUS
1148 NTAPI
1149 locintrf_Initializer(
1150 IN PVOID Instance
1151 );
1152
1153 NTSTATUS
1154 NTAPI
1155 pcicbintrf_Initializer(
1156 IN PVOID Instance
1157 );
1158
1159 NTSTATUS
1160 NTAPI
1161 lddintrf_Initializer(
1162 IN PVOID Instance
1163 );
1164
1165 NTSTATUS
1166 NTAPI
1167 devpresent_Initializer(
1168 IN PVOID Instance
1169 );
1170
1171 NTSTATUS
1172 NTAPI
1173 agpintrf_Constructor(
1174 IN PVOID DeviceExtension,
1175 IN PVOID Instance,
1176 IN PVOID InterfaceData,
1177 IN USHORT Version,
1178 IN USHORT Size,
1179 IN PINTERFACE Interface
1180 );
1181
1182 NTSTATUS
1183 NTAPI
1184 arbusno_Constructor(
1185 IN PVOID DeviceExtension,
1186 IN PVOID Instance,
1187 IN PVOID InterfaceData,
1188 IN USHORT Version,
1189 IN USHORT Size,
1190 IN PINTERFACE Interface
1191 );
1192
1193 NTSTATUS
1194 NTAPI
1195 tranirq_Constructor(
1196 IN PVOID DeviceExtension,
1197 IN PVOID Instance,
1198 IN PVOID InterfaceData,
1199 IN USHORT Version,
1200 IN USHORT Size,
1201 IN PINTERFACE Interface
1202 );
1203
1204 NTSTATUS
1205 NTAPI
1206 armem_Constructor(
1207 IN PVOID DeviceExtension,
1208 IN PVOID Instance,
1209 IN PVOID InterfaceData,
1210 IN USHORT Version,
1211 IN USHORT Size,
1212 IN PINTERFACE Interface
1213 );
1214
1215 NTSTATUS
1216 NTAPI
1217 busintrf_Constructor(
1218 IN PVOID DeviceExtension,
1219 IN PVOID Instance,
1220 IN PVOID InterfaceData,
1221 IN USHORT Version,
1222 IN USHORT Size,
1223 IN PINTERFACE Interface
1224 );
1225
1226 NTSTATUS
1227 NTAPI
1228 ario_Constructor(
1229 IN PVOID DeviceExtension,
1230 IN PVOID Instance,
1231 IN PVOID InterfaceData,
1232 IN USHORT Version,
1233 IN USHORT Size,
1234 IN PINTERFACE Interface
1235 );
1236
1237 NTSTATUS
1238 NTAPI
1239 pcicbintrf_Constructor(
1240 IN PVOID DeviceExtension,
1241 IN PVOID Instance,
1242 IN PVOID InterfaceData,
1243 IN USHORT Version,
1244 IN USHORT Size,
1245 IN PINTERFACE Interface
1246 );
1247
1248 NTSTATUS
1249 NTAPI
1250 lddintrf_Constructor(
1251 IN PVOID DeviceExtension,
1252 IN PVOID Instance,
1253 IN PVOID InterfaceData,
1254 IN USHORT Version,
1255 IN USHORT Size,
1256 IN PINTERFACE Interface
1257 );
1258
1259 NTSTATUS
1260 NTAPI
1261 locintrf_Constructor(
1262 IN PVOID DeviceExtension,
1263 IN PVOID Instance,
1264 IN PVOID InterfaceData,
1265 IN USHORT Version,
1266 IN USHORT Size,
1267 IN PINTERFACE Interface
1268 );
1269
1270 NTSTATUS
1271 NTAPI
1272 PciPmeInterfaceConstructor(
1273 IN PVOID DeviceExtension,
1274 IN PVOID Instance,
1275 IN PVOID InterfaceData,
1276 IN USHORT Version,
1277 IN USHORT Size,
1278 IN PINTERFACE Interface
1279 );
1280
1281 NTSTATUS
1282 NTAPI
1283 routeintrf_Constructor(
1284 IN PVOID DeviceExtension,
1285 IN PVOID Instance,
1286 IN PVOID InterfaceData,
1287 IN USHORT Version,
1288 IN USHORT Size,
1289 IN PINTERFACE Interface
1290 );
1291
1292 NTSTATUS
1293 NTAPI
1294 devpresent_Constructor(
1295 IN PVOID DeviceExtension,
1296 IN PVOID Instance,
1297 IN PVOID InterfaceData,
1298 IN USHORT Version,
1299 IN USHORT Size,
1300 IN PINTERFACE Interface
1301 );
1302
1303 //
1304 // PCI Enumeration and Resources
1305 //
1306 NTSTATUS
1307 NTAPI
1308 PciQueryDeviceRelations(
1309 IN PPCI_FDO_EXTENSION DeviceExtension,
1310 IN OUT PDEVICE_RELATIONS *pDeviceRelations
1311 );
1312
1313 //
1314 // Identification Functions
1315 //
1316 PWCHAR
1317 NTAPI
1318 PciGetDeviceDescriptionMessage(
1319 IN UCHAR BaseClass,
1320 IN UCHAR SubClass
1321 );
1322
1323 //
1324 // External Resources
1325 //
1326 extern SINGLE_LIST_ENTRY PciFdoExtensionListHead;
1327 extern KEVENT PciGlobalLock;
1328 extern PPCI_INTERFACE PciInterfaces[];
1329 extern PCI_INTERFACE ArbiterInterfaceBusNumber;
1330 extern PCI_INTERFACE ArbiterInterfaceMemory;
1331 extern PCI_INTERFACE ArbiterInterfaceIo;
1332 extern PCI_INTERFACE BusHandlerInterface;
1333 extern PCI_INTERFACE PciRoutingInterface;
1334 extern PCI_INTERFACE PciCardbusPrivateInterface;
1335 extern PCI_INTERFACE PciLegacyDeviceDetectionInterface;
1336 extern PCI_INTERFACE PciPmeInterface;
1337 extern PCI_INTERFACE PciDevicePresentInterface;
1338 //extern PCI_INTERFACE PciNativeIdeInterface;
1339 extern PCI_INTERFACE PciLocationInterface;
1340 extern PCI_INTERFACE AgpTargetInterface;
1341 extern PCI_INTERFACE TranslatorInterfaceInterrupt;
1342 extern PDRIVER_OBJECT PciDriverObject;
1343 extern PWATCHDOG_TABLE WdTable;
1344 extern PPCI_HACK_ENTRY PciHackTable;
1345
1346 /* EOF */