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