- Correctly set Irp->IoStatus.Information when handling IOCTL_BOOTVID_INITIALIZE...
[reactos.git] / reactos / drivers / bus / pci / pci.h
1 /* $Id: pci.h,v 1.6 2004/03/14 17:10:43 navaraf Exp $ */
2
3 #ifndef __PCI_H
4 #define __PCI_H
5
6
7 typedef enum {
8 pbtUnknown = 0,
9 pbtType1,
10 pbtType2,
11 } PCI_BUS_TYPE;
12
13
14 typedef struct _PCI_DEVICE
15 {
16 // Entry on device list
17 LIST_ENTRY ListEntry;
18 // Physical Device Object of device
19 PDEVICE_OBJECT Pdo;
20 // PCI bus number
21 ULONG BusNumber;
22 // PCI slot number
23 PCI_SLOT_NUMBER SlotNumber;
24 // PCI configuration data
25 PCI_COMMON_CONFIG PciConfig;
26 // Flag used during enumeration to locate removed devices
27 BOOLEAN RemovePending;
28 } PCI_DEVICE, *PPCI_DEVICE;
29
30
31 typedef enum {
32 dsStopped,
33 dsStarted,
34 dsPaused,
35 dsRemoved,
36 dsSurpriseRemoved
37 } PCI_DEVICE_STATE;
38
39
40 typedef struct _COMMON_DEVICE_EXTENSION
41 {
42 // Pointer to device object, this device extension is associated with
43 PDEVICE_OBJECT DeviceObject;
44 // Wether this device extension is for an FDO or PDO
45 BOOLEAN IsFDO;
46 // Wether the device is removed
47 BOOLEAN Removed;
48 // Current device power state for the device
49 DEVICE_POWER_STATE DevicePowerState;
50 } __attribute((packed)) COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION;
51
52 /* Physical Device Object device extension for a child device */
53 typedef struct _PDO_DEVICE_EXTENSION
54 {
55 // Common device data
56 COMMON_DEVICE_EXTENSION Common;
57 // Functional device object
58 PDEVICE_OBJECT Fdo;
59 // PCI bus number
60 ULONG BusNumber;
61 // PCI slot number
62 PCI_SLOT_NUMBER SlotNumber;
63 // Device ID
64 UNICODE_STRING DeviceID;
65 // Instance ID
66 UNICODE_STRING InstanceID;
67 // Hardware IDs
68 UNICODE_STRING HardwareIDs;
69 // Compatible IDs
70 UNICODE_STRING CompatibleIDs;
71 // Textual description of device
72 UNICODE_STRING DeviceText;
73 // Textual description of device
74 UNICODE_STRING DeviceTextLocation;
75 } __attribute((packed)) PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION;
76
77 /* Functional Device Object device extension for the PCI driver device object */
78 typedef struct _FDO_DEVICE_EXTENSION
79 {
80 // Common device data
81 COMMON_DEVICE_EXTENSION Common;
82 // Current state of the driver
83 PCI_DEVICE_STATE State;
84 // Namespace device list
85 LIST_ENTRY DeviceListHead;
86 // Number of (not removed) devices in device list
87 ULONG DeviceListCount;
88 // Lock for namespace device list
89 KSPIN_LOCK DeviceListLock;
90 // Lower device object
91 PDEVICE_OBJECT Ldo;
92 } __attribute((packed)) FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION;
93
94
95 /* fdo.c */
96
97 NTSTATUS
98 FdoPnpControl(
99 PDEVICE_OBJECT DeviceObject,
100 PIRP Irp);
101
102 NTSTATUS
103 FdoPowerControl(
104 PDEVICE_OBJECT DeviceObject,
105 PIRP Irp);
106
107 /* pci.c */
108
109 BOOLEAN
110 PciCreateUnicodeString(
111 PUNICODE_STRING Destination,
112 PWSTR Source,
113 POOL_TYPE PoolType);
114
115 /* pdo.c */
116
117 NTSTATUS
118 PdoPnpControl(
119 PDEVICE_OBJECT DeviceObject,
120 PIRP Irp);
121
122 NTSTATUS
123 PdoPowerControl(
124 PDEVICE_OBJECT DeviceObject,
125 PIRP Irp);
126
127 #endif /* __PCI_H */