ReactOS  0.4.14-dev-593-g1793dcc
precomp.h
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Storport Driver
3  * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE: Storport driver common header file
5  * COPYRIGHT: Copyright 2017 Eric Kohl (eric.kohl@reactos.org)
6  */
7 
8 #ifndef _STORPORT_PCH_
9 #define _STORPORT_PCH_
10 
11 #include <wdm.h>
12 #include <ntddk.h>
13 #include <stdio.h>
14 #include <memory.h>
15 
16 /* Declare STORPORT_API functions as exports rather than imports */
17 #define _STORPORT_
18 #include <storport.h>
19 
20 #include <ntddscsi.h>
21 #include <ntdddisk.h>
22 #include <mountdev.h>
23 #include <wdmguid.h>
24 
25 /* Memory Tags */
26 #define TAG_GLOBAL_DATA 'DGtS'
27 #define TAG_INIT_DATA 'DItS'
28 #define TAG_MINIPORT_DATA 'DMtS'
29 #define TAG_ACCRESS_RANGE 'RAtS'
30 #define TAG_RESOURCE_LIST 'LRtS'
31 #define TAG_ADDRESS_MAPPING 'MAtS'
32 #define TAG_INQUIRY_DATA 'QItS'
33 #define TAG_SENSE_DATA 'NStS'
34 
35 typedef enum
36 {
42 } DEVICE_STATE;
43 
44 typedef enum
45 {
51 
52 typedef struct _DRIVER_INIT_DATA
53 {
57 
59 {
62 
66 
69 
71 {
75 
76 typedef struct _MINIPORT
77 {
83 
84 typedef struct _UNIT_DATA
85 {
89 
90 typedef struct _FDO_DEVICE_EXTENSION
91 {
93 
114 
119 
120 
121 typedef struct _PDO_DEVICE_EXTENSION
122 {
124 
129 
134 
135 
137 
138 
139 /* fdo.c */
140 
141 NTSTATUS
142 NTAPI
145  _In_ PIRP Irp);
146 
147 NTSTATUS
148 NTAPI
149 PortFdoPnp(
151  _In_ PIRP Irp);
152 
153 
154 /* miniport.c */
155 
156 NTSTATUS
158  _In_ PMINIPORT Miniport,
159  _In_ PFDO_DEVICE_EXTENSION DeviceExtension,
161 
162 NTSTATUS
164  _In_ PMINIPORT Miniport);
165 
166 NTSTATUS
168  _In_ PMINIPORT Miniport);
169 
170 BOOLEAN
172  _In_ PMINIPORT Miniport);
173 
174 BOOLEAN
176  _In_ PMINIPORT Miniport,
178 
179 /* misc.c */
180 
181 NTSTATUS
183  _In_ PDEVICE_OBJECT LowerDevice,
184  _In_ PIRP Irp);
185 
186 NTSTATUS
187 NTAPI
189  _In_ PDEVICE_OBJECT LowerDevice,
190  _In_ PIRP Irp);
191 
195 
200 
201 NTSTATUS
204  PGUID Guid,
205  USHORT Size,
206  USHORT Version,
208  PVOID InterfaceSpecificData);
209 
210 BOOLEAN
212  PFDO_DEVICE_EXTENSION DeviceExtension,
214  ULONG SystemIoBusNumber,
215  STOR_PHYSICAL_ADDRESS IoAddress,
217  BOOLEAN InIoSpace,
219 
220 NTSTATUS
222  PFDO_DEVICE_EXTENSION DeviceExtension,
223  PULONG Vector,
224  PKIRQL Irql,
228 
229 NTSTATUS
231  PMAPPED_ADDRESS *MappedAddressList,
232  STOR_PHYSICAL_ADDRESS IoAddress,
233  PVOID MappedAddress,
235  ULONG BusNumber);
236 
237 /* pdo.c */
238 
239 NTSTATUS
242  _In_ ULONG Bus,
243  _In_ ULONG Target,
244  _In_ ULONG Lun,
246 
247 NTSTATUS
250 
251 NTSTATUS
252 NTAPI
255  _In_ PIRP Irp);
256 
257 NTSTATUS
258 NTAPI
259 PortPdoPnp(
261  _In_ PIRP Irp);
262 
263 
264 /* storport.c */
265 
269  INTERFACE_TYPE InterfaceType);
270 
271 NTSTATUS
272 NTAPI
276 
277 #endif /* _STORPORT_PCH_ */
struct _FDO_DEVICE_EXTENSION * DeviceExtension
Definition: precomp.h:78
DEVICE_STATE
Definition: i8042prt.h:14
NTSTATUS PortCreatePdo(_In_ PFDO_DEVICE_EXTENSION FdoExtension, _In_ ULONG Bus, _In_ ULONG Target, _In_ ULONG Lun, _Out_ PPDO_DEVICE_EXTENSION *PdoExtension)
Definition: pdo.c:19
struct _PDO_DEVICE_EXTENSION PDO_DEVICE_EXTENSION
PKINTERRUPT Interrupt
Definition: parport.h:51
LIST_ENTRY InitDataListHead
Definition: precomp.h:67
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:359
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG _In_ KIRQL _In_ KIRQL _In_ KINTERRUPT_MODE InterruptMode
Definition: iofuncs.h:798
PHYSICAL_ADDRESS UncachedExtensionPhysicalBase
Definition: precomp.h:109
PVOID UncachedExtensionVirtualBase
Definition: precomp.h:108
enum _INTERFACE_TYPE INTERFACE_TYPE
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR _In_ UCHAR Lun
Definition: classpnp.h:1117
NTSTATUS ForwardIrpAndWait(_In_ PDEVICE_OBJECT LowerDevice, _In_ PIRP Irp)
Definition: misc.c:33
UCHAR HwDeviceExtension[0]
Definition: precomp.h:73
PDEVICE_OBJECT Device
Definition: precomp.h:94
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE BusType
Definition: halfuncs.h:156
_In_ PIRP Irp
Definition: csq.h:116
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG _In_ KIRQL _In_ KIRQL _In_ KINTERRUPT_MODE _In_ BOOLEAN ShareVector
Definition: iofuncs.h:798
LONG NTSTATUS
Definition: precomp.h:26
DEVICE_STATE PnpState
Definition: precomp.h:127
EXTENSION_TYPE
Definition: precomp.h:44
EXTENSION_TYPE ExtensionType
Definition: precomp.h:92
struct _MINIPORT MINIPORT
PMINIPORT_DEVICE_EXTENSION MiniportExtension
Definition: precomp.h:81
NTSTATUS PortDeletePdo(_In_ PPDO_DEVICE_EXTENSION PdoExtension)
Definition: pdo.c:87
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2268
NTSTATUS NTAPI PortPdoScsi(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: pdo.c:120
_Out_ PKIRQL Irql
Definition: csq.h:179
EXTENSION_TYPE ExtensionType
Definition: precomp.h:60
struct _DRIVER_OBJECT_EXTENSION DRIVER_OBJECT_EXTENSION
BOOLEAN TranslateResourceListAddress(PFDO_DEVICE_EXTENSION DeviceExtension, INTERFACE_TYPE BusType, ULONG SystemIoBusNumber, STOR_PHYSICAL_ADDRESS IoAddress, ULONG NumberOfBytes, BOOLEAN InIoSpace, PPHYSICAL_ADDRESS TranslatedAddress)
Definition: misc.c:213
struct _DRIVER_OBJECT_EXTENSION * PDRIVER_OBJECT_EXTENSION
NTSTATUS NTAPI PortPdoPnp(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: pdo.c:135
NTSTATUS MiniportHwInitialize(_In_ PMINIPORT Miniport)
Definition: miniport.c:335
LIST_ENTRY AdapterListEntry
Definition: precomp.h:99
NTSTATUS AllocateAddressMapping(PMAPPED_ADDRESS *MappedAddressList, STOR_PHYSICAL_ADDRESS IoAddress, PVOID MappedAddress, ULONG NumberOfBytes, ULONG BusNumber)
Definition: misc.c:331
PHW_INITIALIZATION_DATA InitData
Definition: precomp.h:79
struct _FDO_DEVICE_EXTENSION FDO_DEVICE_EXTENSION
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
PHW_INITIALIZATION_DATA PortGetDriverInitData(PDRIVER_OBJECT_EXTENSION DriverExtension, INTERFACE_TYPE InterfaceType)
Definition: storport.c:78
PDRIVER_OBJECT DriverObject
Definition: precomp.h:61
KSPIN_LOCK PdoListLock
Definition: precomp.h:115
NTSTATUS QueryBusInterface(PDEVICE_OBJECT DeviceObject, PGUID Guid, USHORT Size, USHORT Version, PBUS_INTERFACE_STANDARD Interface, PVOID InterfaceSpecificData)
Definition: misc.c:162
PFDO_DEVICE_EXTENSION FdoExtension
Definition: precomp.h:126
KAFFINITY * PKAFFINITY
Definition: basetsd.h:197
PMAPPED_ADDRESS MappedAddressList
Definition: precomp.h:107
unsigned char BOOLEAN
static GUID * Guid
Definition: apphelp.c:93
PDRIVER_OBJECT_EXTENSION DriverExtension
Definition: precomp.h:97
enum _KINTERRUPT_MODE KINTERRUPT_MODE
NTSTATUS MiniportFindAdapter(_In_ PMINIPORT Miniport)
Definition: miniport.c:283
struct _MINIPORT_DEVICE_EXTENSION * PMINIPORT_DEVICE_EXTENSION
#define _Out_
Definition: no_sal2.h:323
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
PINQUIRYDATA InquiryBuffer
Definition: precomp.h:133
NTSTATUS GetResourceListInterrupt(PFDO_DEVICE_EXTENSION DeviceExtension, PULONG Vector, PKIRQL Irql, KINTERRUPT_MODE *InterruptMode, PBOOLEAN ShareVector, PKAFFINITY Affinity)
Definition: misc.c:282
struct _UNIT_DATA * PUNIT_DATA
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
KSPIN_LOCK AdapterListLock
Definition: precomp.h:63
struct _DRIVER_INIT_DATA * PDRIVER_INIT_DATA
LIST_ENTRY ListEntry
Definition: precomp.h:86
ULONG UncachedExtensionSize
Definition: precomp.h:110
DEVICE_STATE
Definition: precomp.h:35
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:359
INT POOL_TYPE
Definition: typedefs.h:76
LIST_ENTRY PdoListEntry
Definition: precomp.h:128
NTSTATUS NTAPI ForwardIrpAndForget(_In_ PDEVICE_OBJECT LowerDevice, _In_ PIRP Irp)
Definition: misc.c:61
struct _UNIT_DATA UNIT_DATA
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:170
struct _MINIPORT * PMINIPORT
_Must_inspect_result_ typedef _In_ ULONG _In_ BOOLEAN Target
Definition: iotypes.h:1068
struct _MINIPORT * Miniport
Definition: precomp.h:72
LIST_ENTRY PdoListHead
Definition: precomp.h:116
PHW_PASSIVE_INITIALIZE_ROUTINE HwPassiveInitRoutine
Definition: precomp.h:111
ULONG BusNumber
Definition: pci.h:84
unsigned char UCHAR
Definition: xmlstorage.h:181
BUS_INTERFACE_STANDARD BusInterface
Definition: precomp.h:105
PDEVICE_OBJECT PhysicalDevice
Definition: precomp.h:96
char * PBOOLEAN
Definition: retypes.h:11
struct _PDO_DEVICE_EXTENSION * PPDO_DEVICE_EXTENSION
KIRQL * PKIRQL
Definition: env_spec_w32.h:592
Definition: typedefs.h:117
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
PDEVICE_OBJECT Device
Definition: precomp.h:125
PORT_CONFIGURATION_INFORMATION PortConfig
Definition: precomp.h:80
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
LIST_ENTRY Entry
Definition: precomp.h:54
PCM_RESOURCE_LIST CopyResourceList(POOL_TYPE PoolType, PCM_RESOURCE_LIST Source)
Definition: misc.c:132
EXTENSION_TYPE ExtensionType
Definition: precomp.h:123
#define _In_
Definition: no_sal2.h:204
struct _DRIVER_INIT_DATA DRIVER_INIT_DATA
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
unsigned short USHORT
Definition: pedump.c:61
BOOLEAN MiniportHwInterrupt(_In_ PMINIPORT Miniport)
Definition: miniport.c:351
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
unsigned int * PULONG
Definition: retypes.h:1
LIST_ENTRY AdapterListHead
Definition: precomp.h:64
BOOLEAN BusInitialized
Definition: precomp.h:106
DEVICE_STATE PnpState
Definition: i8042prt.h:132
PCM_RESOURCE_LIST TranslatedResources
Definition: precomp.h:104
NTSTATUS NTAPI PortFdoScsi(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: fdo.c:560
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:998
unsigned int ULONG
Definition: retypes.h:1
BOOLEAN(* PHW_PASSIVE_INITIALIZE_ROUTINE)(_In_ PVOID DeviceExtension)
Definition: storport.h:2208
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:27
INTERFACE_TYPE GetBusInterface(PDEVICE_OBJECT DeviceObject)
Definition: misc.c:73
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
PDEVICE_OBJECT LowerDevice
Definition: i8042prt.h:130
NTSTATUS NTAPI PortFdoPnp(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: fdo.c:588
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49
BOOLEAN MiniportStartIo(_In_ PMINIPORT Miniport, _In_ PSCSI_REQUEST_BLOCK Srb)
Definition: miniport.c:367
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T _In_ POOL_TYPE PoolType
Definition: fltkernel.h:1444
NTSTATUS NTAPI DriverEntry(_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath)
Definition: ksecdd.c:25
INQUIRYDATA InquiryData
Definition: precomp.h:87
NTSTATUS MiniportInitialize(_In_ PMINIPORT Miniport, _In_ PFDO_DEVICE_EXTENSION DeviceExtension, _In_ PHW_INITIALIZATION_DATA HwInitializationData)
Definition: miniport.c:234
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA * HwInitializationData
Definition: srb.h:664
struct _MINIPORT_DEVICE_EXTENSION MINIPORT_DEVICE_EXTENSION
HW_INITIALIZATION_DATA HwInitData
Definition: precomp.h:55
PCM_RESOURCE_LIST AllocatedResources
Definition: precomp.h:103