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