ReactOS  0.4.13-dev-100-gc8611ae
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 _FDO_DEVICE_EXTENSION
85 {
87 
109 
110 
111 typedef struct _PDO_DEVICE_EXTENSION
112 {
114 
116 
118 
120 
121 
122 /* fdo.c */
123 
124 NTSTATUS
125 NTAPI
128  _In_ PIRP Irp);
129 
130 NTSTATUS
131 NTAPI
132 PortFdoPnp(
134  _In_ PIRP Irp);
135 
136 
137 /* miniport.c */
138 
139 NTSTATUS
141  _In_ PMINIPORT Miniport,
142  _In_ PFDO_DEVICE_EXTENSION DeviceExtension,
144 
145 NTSTATUS
147  _In_ PMINIPORT Miniport);
148 
149 NTSTATUS
151  _In_ PMINIPORT Miniport);
152 
153 BOOLEAN
155  _In_ PMINIPORT Miniport);
156 
157 BOOLEAN
159  _In_ PMINIPORT Miniport,
161 
162 /* misc.c */
163 
164 NTSTATUS
166  _In_ PDEVICE_OBJECT LowerDevice,
167  _In_ PIRP Irp);
168 
169 NTSTATUS
170 NTAPI
172  _In_ PDEVICE_OBJECT LowerDevice,
173  _In_ PIRP Irp);
174 
178 
183 
184 NTSTATUS
187  PGUID Guid,
188  USHORT Size,
189  USHORT Version,
191  PVOID InterfaceSpecificData);
192 
193 BOOLEAN
195  PFDO_DEVICE_EXTENSION DeviceExtension,
197  ULONG SystemIoBusNumber,
198  STOR_PHYSICAL_ADDRESS IoAddress,
200  BOOLEAN InIoSpace,
202 
203 NTSTATUS
205  PFDO_DEVICE_EXTENSION DeviceExtension,
206  PULONG Vector,
207  PKIRQL Irql,
211 
212 NTSTATUS
214  PMAPPED_ADDRESS *MappedAddressList,
215  STOR_PHYSICAL_ADDRESS IoAddress,
216  PVOID MappedAddress,
218  ULONG BusNumber);
219 
220 /* pdo.c */
221 
222 NTSTATUS
223 NTAPI
226  _In_ PIRP Irp);
227 
228 NTSTATUS
229 NTAPI
230 PortPdoPnp(
232  _In_ PIRP Irp);
233 
234 
235 /* storport.c */
236 
240  INTERFACE_TYPE InterfaceType);
241 
242 NTSTATUS
243 NTAPI
247 
248 #endif /* _STORPORT_PCH_ */
struct _FDO_DEVICE_EXTENSION * DeviceExtension
Definition: precomp.h:78
DEVICE_STATE
Definition: i8042prt.h:14
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:103
PVOID UncachedExtensionVirtualBase
Definition: precomp.h:102
enum _INTERFACE_TYPE INTERFACE_TYPE
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:88
_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:117
EXTENSION_TYPE
Definition: precomp.h:44
EXTENSION_TYPE ExtensionType
Definition: precomp.h:86
struct _MINIPORT MINIPORT
PMINIPORT_DEVICE_EXTENSION MiniportExtension
Definition: precomp.h:81
_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:20
_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:222
struct _DRIVER_OBJECT_EXTENSION * PDRIVER_OBJECT_EXTENSION
NTSTATUS NTAPI PortPdoPnp(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: pdo.c:35
NTSTATUS MiniportHwInitialize(_In_ PMINIPORT Miniport)
Definition: miniport.c:335
LIST_ENTRY AdapterListEntry
Definition: precomp.h:93
NTSTATUS AllocateAddressMapping(PMAPPED_ADDRESS *MappedAddressList, STOR_PHYSICAL_ADDRESS IoAddress, PVOID MappedAddress, ULONG NumberOfBytes, ULONG BusNumber)
Definition: misc.c:340
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
NTSTATUS QueryBusInterface(PDEVICE_OBJECT DeviceObject, PGUID Guid, USHORT Size, USHORT Version, PBUS_INTERFACE_STANDARD Interface, PVOID InterfaceSpecificData)
Definition: misc.c:171
KAFFINITY * PKAFFINITY
Definition: basetsd.h:197
PMAPPED_ADDRESS MappedAddressList
Definition: precomp.h:101
unsigned char BOOLEAN
static GUID * Guid
Definition: apphelp.c:93
PDRIVER_OBJECT_EXTENSION DriverExtension
Definition: precomp.h:91
enum _KINTERRUPT_MODE KINTERRUPT_MODE
NTSTATUS MiniportFindAdapter(_In_ PMINIPORT Miniport)
Definition: miniport.c:283
struct _MINIPORT_DEVICE_EXTENSION * PMINIPORT_DEVICE_EXTENSION
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
NTSTATUS GetResourceListInterrupt(PFDO_DEVICE_EXTENSION DeviceExtension, PULONG Vector, PKIRQL Irql, KINTERRUPT_MODE *InterruptMode, PBOOLEAN ShareVector, PKAFFINITY Affinity)
Definition: misc.c:291
_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
ULONG UncachedExtensionSize
Definition: precomp.h:104
DEVICE_STATE
Definition: precomp.h:35
PDEVICE_OBJECT AttachedFdo
Definition: parport.h:59
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:359
INT POOL_TYPE
Definition: typedefs.h:76
NTSTATUS NTAPI ForwardIrpAndForget(_In_ PDEVICE_OBJECT LowerDevice, _In_ PIRP Irp)
Definition: misc.c:61
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:170
struct _MINIPORT * PMINIPORT
struct _MINIPORT * Miniport
Definition: precomp.h:72
PHW_PASSIVE_INITIALIZE_ROUTINE HwPassiveInitRoutine
Definition: precomp.h:105
ULONG BusNumber
Definition: pci.h:84
unsigned char UCHAR
Definition: xmlstorage.h:181
BUS_INTERFACE_STANDARD BusInterface
Definition: precomp.h:99
PDEVICE_OBJECT PhysicalDevice
Definition: precomp.h:90
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
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:141
EXTENSION_TYPE ExtensionType
Definition: precomp.h:113
#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:100
DEVICE_STATE PnpState
Definition: i8042prt.h:132
PCM_RESOURCE_LIST TranslatedResources
Definition: precomp.h:98
NTSTATUS NTAPI PortFdoScsi(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: fdo.c:572
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:997
unsigned int ULONG
Definition: retypes.h:1
BOOLEAN(* PHW_PASSIVE_INITIALIZE_ROUTINE)(_In_ PVOID DeviceExtension)
Definition: storport.h:2171
_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:3149
PDEVICE_OBJECT LowerDevice
Definition: i8042prt.h:130
NTSTATUS NTAPI PortFdoPnp(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: fdo.c:601
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
MINIPORT Miniport
Definition: precomp.h:94
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:97