ReactOS 0.4.15-dev-7889-g76290a6
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
35typedef enum
36{
43
44typedef enum
45{
51
52typedef struct _DRIVER_INIT_DATA
53{
57
59{
62
66
69
71{
75
76typedef struct _MINIPORT
77{
83
84typedef struct _UNIT_DATA
85{
89
90typedef struct _FDO_DEVICE_EXTENSION
91{
93
114
119
120
121typedef struct _PDO_DEVICE_EXTENSION
122{
124
129
134
135
137
138
139/* fdo.c */
140
142NTAPI
145 _In_ PIRP Irp);
146
148NTAPI
151 _In_ PIRP Irp);
152
153
154/* miniport.c */
155
158 _In_ PMINIPORT Miniport,
159 _In_ PFDO_DEVICE_EXTENSION DeviceExtension,
161
164 _In_ PMINIPORT Miniport);
165
168 _In_ PMINIPORT Miniport);
169
172 _In_ PMINIPORT Miniport);
173
176 _In_ PMINIPORT Miniport,
178
179/* misc.c */
180
182NTAPI
184 _In_ PDEVICE_OBJECT LowerDevice,
185 _In_ PIRP Irp);
186
190
195
199 PGUID Guid,
200 USHORT Size,
204
207 PFDO_DEVICE_EXTENSION DeviceExtension,
209 ULONG SystemIoBusNumber,
210 STOR_PHYSICAL_ADDRESS IoAddress,
212 BOOLEAN InIoSpace,
214
217 PFDO_DEVICE_EXTENSION DeviceExtension,
219 PKIRQL Irql,
223
226 PMAPPED_ADDRESS *MappedAddressList,
227 STOR_PHYSICAL_ADDRESS IoAddress,
228 PVOID MappedAddress,
231
232/* pdo.c */
233
237 _In_ ULONG Bus,
239 _In_ ULONG Lun,
241
245
247NTAPI
250 _In_ PIRP Irp);
251
253NTAPI
256 _In_ PIRP Irp);
257
258
259/* storport.c */
260
265
267NTAPI
271
272#endif /* _STORPORT_PCH_ */
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
KAFFINITY * PKAFFINITY
Definition: basetsd.h:195
_In_ PSCSI_REQUEST_BLOCK Srb
Definition: cdrom.h:989
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR _In_ UCHAR Lun
Definition: classpnp.h:1315
_In_ PIRP Irp
Definition: csq.h:116
_Out_ PKIRQL Irql
Definition: csq.h:179
DRIVER_INITIALIZE DriverEntry
Definition: condrv.c:21
struct _FDO_DEVICE_EXTENSION FDO_DEVICE_EXTENSION
NTSTATUS NTAPI PortPdoScsi(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: pdo.c:120
NTSTATUS MiniportFindAdapter(_In_ PMINIPORT Miniport)
Definition: miniport.c:285
INTERFACE_TYPE GetBusInterface(PDEVICE_OBJECT DeviceObject)
Definition: misc.c:32
NTSTATUS MiniportInitialize(_In_ PMINIPORT Miniport, _In_ PFDO_DEVICE_EXTENSION DeviceExtension, _In_ PHW_INITIALIZATION_DATA HwInitializationData)
Definition: miniport.c:236
struct _UNIT_DATA * PUNIT_DATA
struct _DRIVER_INIT_DATA DRIVER_INIT_DATA
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
NTSTATUS PortDeletePdo(_In_ PPDO_DEVICE_EXTENSION PdoExtension)
Definition: pdo.c:87
NTSTATUS NTAPI PortPdoPnp(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: pdo.c:135
struct _MINIPORT MINIPORT
NTSTATUS AllocateAddressMapping(PMAPPED_ADDRESS *MappedAddressList, STOR_PHYSICAL_ADDRESS IoAddress, PVOID MappedAddress, ULONG NumberOfBytes, ULONG BusNumber)
Definition: misc.c:290
BOOLEAN MiniportHwInterrupt(_In_ PMINIPORT Miniport)
Definition: miniport.c:353
PHW_INITIALIZATION_DATA PortGetDriverInitData(PDRIVER_OBJECT_EXTENSION DriverExtension, INTERFACE_TYPE InterfaceType)
Definition: storport.c:78
struct _PDO_DEVICE_EXTENSION PDO_DEVICE_EXTENSION
struct _MINIPORT_DEVICE_EXTENSION * PMINIPORT_DEVICE_EXTENSION
NTSTATUS QueryBusInterface(PDEVICE_OBJECT DeviceObject, PGUID Guid, USHORT Size, USHORT Version, PBUS_INTERFACE_STANDARD Interface, PVOID InterfaceSpecificData)
Definition: misc.c:121
struct _PDO_DEVICE_EXTENSION * PPDO_DEVICE_EXTENSION
DEVICE_STATE
Definition: precomp.h:36
@ dsSurpriseRemoved
Definition: precomp.h:41
@ dsStopped
Definition: precomp.h:37
@ dsPaused
Definition: precomp.h:39
@ dsStarted
Definition: precomp.h:38
@ dsRemoved
Definition: precomp.h:40
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:172
struct _MINIPORT_DEVICE_EXTENSION MINIPORT_DEVICE_EXTENSION
BOOLEAN MiniportStartIo(_In_ PMINIPORT Miniport, _In_ PSCSI_REQUEST_BLOCK Srb)
Definition: miniport.c:369
PCM_RESOURCE_LIST CopyResourceList(POOL_TYPE PoolType, PCM_RESOURCE_LIST Source)
Definition: misc.c:91
NTSTATUS MiniportHwInitialize(_In_ PMINIPORT Miniport)
Definition: miniport.c:337
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
NTSTATUS GetResourceListInterrupt(PFDO_DEVICE_EXTENSION DeviceExtension, PULONG Vector, PKIRQL Irql, KINTERRUPT_MODE *InterruptMode, PBOOLEAN ShareVector, PKAFFINITY Affinity)
Definition: misc.c:241
struct _MINIPORT * PMINIPORT
struct _DRIVER_OBJECT_EXTENSION * PDRIVER_OBJECT_EXTENSION
EXTENSION_TYPE
Definition: precomp.h:45
@ InvalidExtension
Definition: precomp.h:46
@ PdoExtension
Definition: precomp.h:49
@ DriverExtension
Definition: precomp.h:47
@ FdoExtension
Definition: precomp.h:48
struct _DRIVER_INIT_DATA * PDRIVER_INIT_DATA
struct _UNIT_DATA UNIT_DATA
NTSTATUS NTAPI PortFdoScsi(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: fdo.c:568
struct _DRIVER_OBJECT_EXTENSION DRIVER_OBJECT_EXTENSION
NTSTATUS NTAPI PortFdoPnp(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: fdo.c:596
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
KIRQL * PKIRQL
Definition: env_spec_w32.h:592
enum _INTERFACE_TYPE INTERFACE_TYPE
DRIVER_DISPATCH ForwardIrpAndForget
Definition: i8042prt.h:341
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
unsigned short USHORT
Definition: pedump.c:61
enum _KINTERRUPT_MODE KINTERRUPT_MODE
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA * HwInitializationData
Definition: srb.h:906
BOOLEAN(* PHW_PASSIVE_INITIALIZE_ROUTINE)(_In_ PVOID DeviceExtension)
Definition: storport.h:2254
HW_INITIALIZATION_DATA HwInitData
Definition: precomp.h:55
LIST_ENTRY Entry
Definition: precomp.h:54
LIST_ENTRY AdapterListHead
Definition: precomp.h:64
LIST_ENTRY InitDataListHead
Definition: precomp.h:67
PDRIVER_OBJECT DriverObject
Definition: precomp.h:61
KSPIN_LOCK AdapterListLock
Definition: precomp.h:63
EXTENSION_TYPE ExtensionType
Definition: precomp.h:60
PMAPPED_ADDRESS MappedAddressList
Definition: precomp.h:107
PDEVICE_OBJECT LowerDevice
Definition: i8042prt.h:130
PCM_RESOURCE_LIST AllocatedResources
Definition: precomp.h:103
PDEVICE_OBJECT PhysicalDevice
Definition: precomp.h:96
PHW_PASSIVE_INITIALIZE_ROUTINE HwPassiveInitRoutine
Definition: precomp.h:111
LIST_ENTRY PdoListHead
Definition: precomp.h:116
KSPIN_LOCK PdoListLock
Definition: precomp.h:115
ULONG BusNumber
Definition: pci.h:88
PVOID UncachedExtensionVirtualBase
Definition: precomp.h:108
PCM_RESOURCE_LIST TranslatedResources
Definition: precomp.h:104
DEVICE_STATE PnpState
Definition: i8042prt.h:132
ULONG UncachedExtensionSize
Definition: precomp.h:110
EXTENSION_TYPE ExtensionType
Definition: precomp.h:92
PDEVICE_OBJECT Device
Definition: precomp.h:94
BOOLEAN BusInitialized
Definition: precomp.h:106
LIST_ENTRY AdapterListEntry
Definition: precomp.h:99
PHYSICAL_ADDRESS UncachedExtensionPhysicalBase
Definition: precomp.h:109
PDRIVER_OBJECT_EXTENSION DriverExtension
Definition: precomp.h:97
PKINTERRUPT Interrupt
Definition: parport.h:51
BUS_INTERFACE_STANDARD BusInterface
Definition: pciidex.h:92
Definition: typedefs.h:120
struct _MINIPORT * Miniport
Definition: precomp.h:72
UCHAR HwDeviceExtension[0]
Definition: precomp.h:73
PORT_CONFIGURATION_INFORMATION PortConfig
Definition: precomp.h:80
PHW_INITIALIZATION_DATA InitData
Definition: precomp.h:79
struct _FDO_DEVICE_EXTENSION * DeviceExtension
Definition: precomp.h:78
PMINIPORT_DEVICE_EXTENSION MiniportExtension
Definition: precomp.h:81
PFDO_DEVICE_EXTENSION FdoExtension
Definition: precomp.h:126
LIST_ENTRY PdoListEntry
Definition: precomp.h:128
PDEVICE_OBJECT Device
Definition: precomp.h:125
PINQUIRYDATA InquiryBuffer
Definition: precomp.h:133
DEVICE_STATE PnpState
Definition: precomp.h:127
EXTENSION_TYPE ExtensionType
Definition: precomp.h:123
LIST_ENTRY ListEntry
Definition: precomp.h:86
INQUIRYDATA InquiryData
Definition: precomp.h:87
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char * PBOOLEAN
Definition: typedefs.h:53
INT POOL_TYPE
Definition: typedefs.h:78
#define NTAPI
Definition: typedefs.h:36
uint32_t ULONG
Definition: typedefs.h:59
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3815
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
Definition: wdffdo.h:465
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID InterfaceType
Definition: wdffdo.h:463
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
Definition: wdffdo.h:469
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT _In_opt_ PVOID InterfaceSpecificData
Definition: wdffdo.h:472
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
Definition: wdfobject.h:762
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:160
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:174
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE BusType
Definition: halfuncs.h:159
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG _In_ KIRQL _In_ KIRQL _In_ KINTERRUPT_MODE InterruptMode
Definition: iofuncs.h:806
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2275
_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:807
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1036
unsigned char UCHAR
Definition: xmlstorage.h:181