ReactOS 0.4.17-dev-1343-g8fe3cee
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 <ntintsafe.h>
14#include <ntstrsafe.h>
15#include <stdio.h>
16#include <memory.h>
17
18/* Declare STORPORT_API functions as exports rather than imports */
19#define _STORPORT_
20#include <storport.h>
21
22#include <ntddscsi.h>
23#include <ntdddisk.h>
24#include <mountdev.h>
25#include <wdmguid.h>
26
27/* Memory Tags */
28#define TAG_GLOBAL_DATA 'DGtS'
29#define TAG_INIT_DATA 'DItS'
30#define TAG_DEVICE_RELATION 'RDtS'
31#define TAG_DEVICE_ID 'DItS'
32#define TAG_DEVICE_TEXT 'XTtS'
33#define TAG_MINIPORT_DATA 'DMtS'
34#define TAG_ACCRESS_RANGE 'RAtS'
35#define TAG_RESOURCE_LIST 'LRtS'
36#define TAG_ADDRESS_MAPPING 'MAtS'
37#define TAG_INQUIRY_DATA 'QItS'
38#define TAG_LUN_EXTENSION 'ELtS'
39#define TAG_REPORT_LUN_DATA 'LRtS'
40#define TAG_SENSE_DATA 'NStS'
41#define TAG_QUEUED_REQUEST 'RQtS'
42#define TAG_SRB_EXTENSION 'XStS'
43
44#define SET_FLAG(Flags, Bit) ((Flags) |= (Bit))
45#define CLEAR_FLAG(Flags, Bit) ((Flags) &= ~(Bit))
46#define TEST_FLAG(Flags, Bit) (((Flags) & (Bit)) != 0)
47
48typedef enum
49{
56
57typedef enum
58{
64
65typedef struct _DRIVER_INIT_DATA
66{
70
71/* Size of HW_INITIALIZATION_DATA before the virtual miniport members were added */
72#define HW_INIT_DATA_SIZE_PHYSICAL FIELD_OFFSET(HW_INITIALIZATION_DATA, HwFreeAdapterResources)
73
74/* Size of the Win7 virtual miniport initialization data */
75#define HW_INIT_DATA_SIZE_VIRTUAL_LEGACY FIELD_OFFSET(HW_INITIALIZATION_DATA, HwTracingEnabled)
76
78{
81
85
88
90{
94
95typedef struct _MINIPORT
96{
101
102 /* Answers to the supported control type queries, unclaimed types are never sent */
105
106 /* No resources, interrupt or DMA adapter, it gets its own stack's device objects instead */
109
110typedef struct _UNIT_DATA
111{
115
116typedef struct _TIMER_ENTRY
117{
126
127/*
128 * Storport implements some scheduling on how outstanding requests on the PDO are handled.
129 *
130 * Important facts:
131 * A PDO by default can handle (Storport will actually issue that many) 254 outstanding requests;
132 * If miniport actually ate that many requests, incoming requests will wait;
133 * If miniport thinks a device is overloaded, PDO can be marked Busy/Ready by miniport;
134 * A busy PDO device will exit Busy state when completing specified amount (or all) of IOs;
135 * The miniport can pause a PDO for a while, for stuff like load balancing;
136 * By default Storport uses tagged queuing. If an IO is untagged, it has to wait until all tagged
137 * IOs finish, then Storport will schedule these requests synchronously;
138 * If an IO error occured (SCSISTAT_CHECK_CONDITION, SCSISTAT_COMMAND_TERMINATED), a LUN is reset
139 * because of timeout, or a bus reset occured (affects all LUNs on the HBA), the PDO queue is
140 * put into a third halt state known as Frozen;
141 * Class driver can use special SRBs to Unfreeze the device queue and clear all requests it held;
142 * When class driver asks a device for power functionalities, it puts the device to a fourth holdup
143 * state known as Locked (with special SRB function, unlock as well but with a bypass flag).
144 *
145 * Access to IO Flow control is synchronized by a lock in FDO flow control, and contains all
146 * information about pausing, busy state, freezing, untagged requests and possibly other stuff
147 * that affects how Storport schedules IOs sent to the LUN.
148 */
150{
151 // KSPIN_LOCK Lock; // FIXME: Remove
152
153 /*
154 * Basic attributes to determine if a request must go waiting. Actually, awaiting request queue
155 * should be checked too (if we already got waiting requests, new requests must be served later)
156 */
161
162 /*
163 * There are cases when, even the LUN can accept more requests, a new request should still not
164 * be issued until all issued requests have completed:
165 *
166 * 1. A request can have Srb->QueueAction == SRB_ORDERED_QUEUE_TAG_REQUEST which can only be
167 * issued after all previously issued and queued requests have completed;
168 * 2. An untagged request must wait until all tagged requests complete before it can be issued;
169 *
170 * Such ordered requests are always issued only after the last active request completes. To
171 * accomplish this, we check if the request needs strong ordering before taking it out of
172 * approved queue, if it does AND the active list is not empty then this flag is set to TRUE,
173 * the command will stay at the tail of the approved list and only be issued when next time the
174 * active list is empty.
175 */
177
178 /*
179 * Ordered tagged & Untagged requests are strong ordered. When we have them in our wait queue,
180 * new requests must go waiting. This value is counted by SCSI IRP and completion handler.
181 */
183
184 /* How many active requests are still in the hands of miniport */
186
187 /* How many requests needs to be completed before PDO is no longer busy */
189
190 /* How many seconds remaining before PDO is no longer paused */
192
193 /* Requests that PDO and FDO both agreed to send, and already went to the device */
195
196 /* Requests that PDO approved to send, awaiting FDO judgement */
197 // LIST_ENTRY ApprovedRequestsListHead;
198
199 /* Requests that PDO is too busy to handle, awaiting PDO scheduling */
202
203/*
204 * Storport implements some flow control on FDO.
205 *
206 * By default FDO has 1000 total outstanding requests limit;
207 * Storport will actually issue that many requests (from all LUNs);
208 * If miniport thinks the HBA is overloaded, FDO can be marked Busy/Ready by miniport;
209 * A busy FDO will exit Busy state when completing specified amount (or all) of IOs;
210 * The miniport can pause FDO for a while, for stuff like load balancing;
211 *
212 * FDO flow control structure has a lock that synchronizes all flow controlling on an HBA.
213 */
215{
217
220
221 /* Active outstanding request count */
223
226
227 /*
228 * If FDO blocks a request from being issued, it'll be queued on both the PDO queue and
229 * this queue. This is used to implement first-come-first-serve when FDO becomes ready again
230 */
233
234/* Requests that could not allocate their private contexts. Cancel safe, as we hold them. */
236{
241
242typedef struct _FDO_DEVICE_EXTENSION
243{
245
268
269 /* Message signaled interrupts, Interrupt then holds the first message's object */
272
276
277 /* BusChangeDetected can arrive at device IRQL, PnP is told from here instead */
279
280 /*
281 * HBA timers. The first timer, DPC & callback are for StorPortNotification's RequestTimerCall,
282 * and the timer list is for StorPortInitializeTimer (implemented in ExtendedFunction), list
283 * entry type is TIMER_ENTRY.
284 */
291
292 /* Request "flow control" */
294
295 /* This maximum number is set in port configuration */
297
298 /* The requests awaiting completion DPC processing */
300
301 /* Backing store for the per request QUEUED_REQUEST_REFERENCE packets */
304
305 /* Memory for one request, reserved at adapter start, for when pool runs out */
310
311 /*
312 * FIXME: It REALLY should be cached here. The function pointers inside are extremely frequently
313 * used but Eric didn't put them here. Need review.
314 */
316
318
319
320typedef struct _PDO_DEVICE_EXTENSION
321{
323
328
333
335
336 /* Same as FDO flow control */
340
341 LONG SpecialRequestCounter; /* FIXME: DELETE AFTER DEBUG */
342
343 /* What the miniport keeps about this one unit, if it asked for any */
345
347
348/* The miniport reaches the address and CDB by offset, so they must follow the SRB */
349typedef struct _EXTENDED_REQUEST
350{
355
356/*
357 * Storport sends SRBs to HBA, and needs to notify IRPs about IO status.
358 * Conventionally SRB has an OriginalRequest field to point to IRP, and IRP tail overlay
359 * has got a device queue entry, and that should be enough.
360 *
361 * But in Storport we also might wanna store more stuff like per request timeout value,
362 * and possibly request origin processor to redirect completion DPC to other processors,
363 * we use an additional structure here, to store some Storport private per-request data.
364 *
365 * This structure is put into FDO/PDO request queue. It is referenced by SRB OriginalRequest
366 * field, also contains SRB back reference, and source IRP is referenced by this structure.
367 *
368 * FIXME: Before completing a request, restore OriginalRequest as Classpnp will CHECK it.
369 */
371{
377 /* Points at Ex, set only when the miniport takes extended SRBs */
382 /* TODO: Nothing counts this down yet, a timer should call HwResetBus when it expires */
384 /*
385 * Indicates if the current request is outstanding. Some requests are for HBA, and shouldn't be
386 * affected by outstanding requests flow controlling.
387 * If this field is set to FALSE, this request will not trigger flow control code, flow control
388 * lock will not be acquired, and no new request will be scheduled upon its completion.
389 */
393
394 /* This packet and its SRB extension came from the reserve, not from pool */
396
397 /* FIXME: This is solely for debugging and should be removed */
400
401 /* Must be the last member, packets for SCSI SRB miniports end before it */
404
405/* This and next one are for REPORT_LUNS command return structure, seems to be found nowhere else */
406typedef struct _LUN_DESCRIPTOR
407{
415
416typedef struct _REPORT_LUNS_DATA
417{
422
423/* fdo.c */
424
428
429VOID
432 _In_ PIRP Irp);
433
434VOID
437
438VOID
441
442VOID
445
446VOID
449
453 _In_ ULONG Bus,
455 _In_ ULONG Lun);
456
458NTAPI
461 _In_ ULONG Bus,
463 _In_ ULONG Lun);
464
465VOID
466NTAPI
470
471VOID
472NTAPI
476
477VOID
478NTAPI
480 _In_ PKDPC Dpc,
484
486NTAPI
489 _In_ PIRP Irp);
490
492NTAPI
495 _In_ PIRP Irp);
496
497
498/* ioctl.c */
499
501NTAPI
504 _In_ PIRP Irp);
505
507NTAPI
510 _In_ PIRP Irp);
511
512
513/* miniport.c */
514
517 _In_ PMINIPORT Miniport,
518 _In_ PFDO_DEVICE_EXTENSION DeviceExtension,
520
523 _In_ PMINIPORT Miniport);
524
527 _In_ PMINIPORT Miniport);
528
531 _In_ PMINIPORT Miniport);
532
533VOID
534NTAPI
536 _In_ PMINIPORT Miniport);
537
539NTAPI
541 _In_ PMINIPORT Miniport,
543
544VOID
545NTAPI
547 _In_ PMINIPORT Miniport);
548
550NTAPI
552 _In_ PMINIPORT Miniport,
555
556VOID
557NTAPI
559 _In_ PMINIPORT Miniport);
560
562NTAPI
564 _In_ PMINIPORT Miniport,
565 _In_ SCSI_UNIT_CONTROL_TYPE ControlType,
567
570 _In_ PMINIPORT Miniport,
572
573/* misc.c */
574
576NTAPI
578 _In_ PDEVICE_OBJECT LowerDevice,
579 _In_ PIRP Irp);
580
584
589
593 PGUID Guid,
594 USHORT Size,
598
601 PFDO_DEVICE_EXTENSION DeviceExtension,
603 ULONG SystemIoBusNumber,
604 STOR_PHYSICAL_ADDRESS IoAddress,
606 BOOLEAN InIoSpace,
608
611 PFDO_DEVICE_EXTENSION DeviceExtension,
613 PKIRQL Irql,
617
620 PMAPPED_ADDRESS *MappedAddressList,
621 STOR_PHYSICAL_ADDRESS IoAddress,
622 PVOID MappedAddress,
625
626VOID
627NTAPI
629 PKDPC Dpc,
633
634VOID
635NTAPI
637 PKDPC Dpc,
641);
642
643PCSTR
645 _In_ PINQUIRYDATA InquiryData);
646
647PCSTR
649 _In_ PINQUIRYDATA InquiryData);
650
651/* pdo.c */
652
656 _In_ ULONG Bus,
658 _In_ ULONG Lun,
660
664
666NTAPI
669 _In_ PIRP Irp);
670
671
672/* srb.c */
673
674VOID
677
681 _In_ PQUEUED_REQUEST_REFERENCE RequestReference);
682
687 _In_ PQUEUED_REQUEST_REFERENCE RequestReference);
688
690NTAPI
693 _In_ PIRP Irp);
694
695VOID
696NTAPI
698 _In_ PKDPC Dpc,
702
703
704/* srbex.c */
705
706VOID
707NTAPI
711
713NTAPI
715 _In_ PVOID Srb);
716
718NTAPI
721
722PVOID
723NTAPI
726
727VOID
728NTAPI
732
733VOID
734NTAPI
738
739
740/* storport.c */
741
746
748NTAPI
752
753#endif /* _STORPORT_PCH_ */
unsigned char BOOLEAN
Definition: actypes.h:127
@ GetGenericType
Definition: atapi.h:567
@ GetDeviceType
Definition: atapi.h:566
LONG NTSTATUS
Definition: precomp.h:26
KAFFINITY * PKAFFINITY
Definition: basetsd.h:189
_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
_Out_ PKIRQL Irql
Definition: csq.h:179
_In_ HANDLE _In_ CONST PDXGKMDT_OPM_GET_INFO_PARAMETERS Parameters
Definition: dispmprt.h:321
DRIVER_INITIALIZE DriverEntry
Definition: condrv.c:21
VOID(NTAPI * PHW_TIMER)(IN PVOID DeviceExtension)
Definition: srb.h:456
enum _SCSI_ADAPTER_CONTROL_TYPE SCSI_ADAPTER_CONTROL_TYPE
enum _SCSI_ADAPTER_CONTROL_STATUS SCSI_ADAPTER_CONTROL_STATUS
struct _PDO_IO_FLOW_CONTROL * PPDO_IO_FLOW_CONTROL
struct _FDO_DEVICE_EXTENSION FDO_DEVICE_EXTENSION
struct _LUN_DESCRIPTOR LUN_DESCRIPTOR
NTSTATUS NTAPI PortPdoScsi(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: srb.c:548
NTSTATUS NTAPI PortPdoDeviceControl(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: ioctl.c:379
SCSI_ADAPTER_CONTROL_STATUS NTAPI MiniportAdapterControl(_In_ PMINIPORT Miniport, _In_ SCSI_ADAPTER_CONTROL_TYPE ControlType, _In_opt_ PVOID Parameters)
Sends one adapter control request, if the miniport claimed it.
Definition: miniport.c:504
NTSTATUS NTAPI PortFdoDeviceControl(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: ioctl.c:147
VOID PortFlushStarvedRequests(_In_ PFDO_DEVICE_EXTENSION FdoExtension)
Fails every queued request, for when the adapter goes away.
Definition: fdo.c:153
PPDO_DEVICE_EXTENSION FdoFindLun(_In_ PFDO_DEVICE_EXTENSION FdoExtension, _In_ ULONG Bus, _In_ ULONG Target, _In_ ULONG Lun)
Definition: fdo.c:1306
struct _PDO_IO_FLOW_CONTROL PDO_IO_FLOW_CONTROL
NTSTATUS MiniportFindAdapter(_In_ PMINIPORT Miniport)
Definition: miniport.c:325
INTERFACE_TYPE GetBusInterface(PDEVICE_OBJECT DeviceObject)
Definition: misc.c:33
VOID NTAPI StorpCompleteExtendedSrb(_In_ PSCSI_REQUEST_BLOCK Srb, _In_ PEXTENDED_REQUEST Request)
Carries the miniport's answer back to the original request block.
Definition: srbex.c:157
VOID NTAPI PortFdoBusChangeDpc(_In_ PKDPC Dpc, _In_opt_ PVOID DeferredContext, _In_opt_ PVOID SystemArgument1, _In_opt_ PVOID SystemArgument2)
Definition: fdo.c:1471
NTSTATUS MiniportInitialize(_In_ PMINIPORT Miniport, _In_ PFDO_DEVICE_EXTENSION DeviceExtension, _In_ PHW_INITIALIZATION_DATA HwInitializationData)
Definition: miniport.c:264
struct _UNIT_DATA * PUNIT_DATA
struct _DRIVER_INIT_DATA DRIVER_INIT_DATA
struct _LUN_DESCRIPTOR * PLUN_DESCRIPTOR
struct _STARVED_REQUEST_QUEUE * PSTARVED_REQUEST_QUEUE
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
VOID PortFreeRequestReserve(_In_ PFDO_DEVICE_EXTENSION FdoExtension)
Releases the reserve. No request may be using it anymore.
Definition: fdo.c:205
NTSTATUS PortDeletePdo(_In_ PPDO_DEVICE_EXTENSION PdoExtension)
Definition: pdo.c:126
VOID NTAPI TimerCallbackDpcRoutine(PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
Definition: misc.c:348
BOOLEAN NTAPI StorpIsExtendedSrb(_In_ PVOID Srb)
Tells whether a request block is in the extended format.
Definition: srbex.c:47
BOOLEAN PortPdoScheduleRequestFlowControlled(_In_ PPDO_DEVICE_EXTENSION PdoExtension, _In_ PFDO_DEVICE_EXTENSION FdoExtension, _In_ PQUEUED_REQUEST_REFERENCE RequestReference)
Schedules an outstanding request and return a boolean value to indicate if the request can be immedia...
Definition: srb.c:429
struct _QUEUED_REQUEST_REFERENCE QUEUED_REQUEST_REFERENCE
NTSTATUS NTAPI PortPdoPnp(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: pdo.c:710
NTSTATUS PortInitializeStarvedRequestQueue(_In_ PSTARVED_REQUEST_QUEUE Queue)
Definition: fdo.c:105
struct _MINIPORT MINIPORT
NTSTATUS AllocateAddressMapping(PMAPPED_ADDRESS *MappedAddressList, STOR_PHYSICAL_ADDRESS IoAddress, PVOID MappedAddress, ULONG NumberOfBytes, ULONG BusNumber)
Definition: misc.c:291
struct _REPORT_LUNS_DATA REPORT_LUNS_DATA
BOOLEAN MiniportHwInterrupt(_In_ PMINIPORT Miniport)
Definition: miniport.c:436
PHW_INITIALIZATION_DATA PortGetDriverInitData(PDRIVER_OBJECT_EXTENSION DriverExtension, INTERFACE_TYPE InterfaceType)
Definition: storport.c:87
struct _TIMER_ENTRY TIMER_ENTRY
VOID NTAPI MiniportQueryAdapterControl(_In_ PMINIPORT Miniport)
Asks the miniport which adapter control requests it handles.
Definition: miniport.c:456
struct _PDO_DEVICE_EXTENSION PDO_DEVICE_EXTENSION
VOID StorpSrbFreeRequestReference(_In_ PSCSI_REQUEST_BLOCK Srb)
Frees an SRB's Request Reference and restore Srb->OriginalRequest field to IRP. This function does no...
Definition: srb.c:112
struct _REPORT_LUNS_DATA * PREPORT_LUNS_DATA
struct _MINIPORT_DEVICE_EXTENSION * PMINIPORT_DEVICE_EXTENSION
VOID PortQueueStarvedRequest(_In_ PFDO_DEVICE_EXTENSION FdoExtension, _In_ PIRP Irp)
Queues a request that could not allocate its private contexts.
Definition: fdo.c:124
NTSTATUS QueryBusInterface(PDEVICE_OBJECT DeviceObject, PGUID Guid, USHORT Size, USHORT Version, PBUS_INTERFACE_STANDARD Interface, PVOID InterfaceSpecificData)
Definition: misc.c:122
struct _QUEUED_REQUEST_REFERENCE * PQUEUED_REQUEST_REFERENCE
struct _FDO_IO_FLOW_CONTROL * PFDO_IO_FLOW_CONTROL
struct _PDO_DEVICE_EXTENSION * PPDO_DEVICE_EXTENSION
DEVICE_STATE
Definition: precomp.h:49
@ dsSurpriseRemoved
Definition: precomp.h:54
@ dsStopped
Definition: precomp.h:50
@ dsPaused
Definition: precomp.h:52
@ dsStarted
Definition: precomp.h:51
@ dsRemoved
Definition: precomp.h:53
VOID NTAPI StorpBuildUnitAddress(_In_ PPDO_DEVICE_EXTENSION PdoExtension, _Out_ PSTOR_ADDR_BTL8 Address)
Fills in the bus, target and LUN address of a logical unit.
Definition: srbex.c:28
struct _EXTENDED_REQUEST * PEXTENDED_REQUEST
struct _EXTENDED_REQUEST EXTENDED_REQUEST
BOOLEAN NTAPI MiniportHwMSInterrupt(_In_ PMINIPORT Miniport, _In_ ULONG MessageId)
Definition: miniport.c:603
PQUEUED_REQUEST_REFERENCE NTAPI StorpRequestReference(_In_ PSCSI_REQUEST_BLOCK Srb)
Finds the request reference behind an SRB in either format.
Definition: srbex.c:61
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:173
struct _MINIPORT_DEVICE_EXTENSION MINIPORT_DEVICE_EXTENSION
VOID NTAPI MiniportFreeAdapterResources(_In_ PMINIPORT Miniport)
Tells the miniport the adapter is going away.
Definition: miniport.c:419
BOOLEAN MiniportStartIo(_In_ PMINIPORT Miniport, _In_ PSCSI_REQUEST_BLOCK Srb)
Definition: miniport.c:621
PCM_RESOURCE_LIST CopyResourceList(POOL_TYPE PoolType, PCM_RESOURCE_LIST Source)
Definition: misc.c:92
NTSTATUS MiniportHwInitialize(_In_ PMINIPORT Miniport)
Definition: miniport.c:399
PPDO_DEVICE_EXTENSION NTAPI FdoFindLunAboveDispatch(_In_ PFDO_DEVICE_EXTENSION FdoExtension, _In_ ULONG Bus, _In_ ULONG Target, _In_ ULONG Lun)
Finds a unit from an interrupt service routine or any other caller above DISPATCH_LEVEL.
Definition: fdo.c:1405
NTSTATUS PortCreatePdo(_In_ PFDO_DEVICE_EXTENSION FdoExtension, _In_ ULONG Bus, _In_ ULONG Target, _In_ ULONG Lun, _Out_ PPDO_DEVICE_EXTENSION *PdoExtension)
Definition: pdo.c:21
VOID NTAPI PortFdoUnlinkPdo(_Inout_ PFDO_DEVICE_EXTENSION FdoExtension, _Inout_ PPDO_DEVICE_EXTENSION PdoExtension)
Definition: fdo.c:1451
NTSTATUS GetResourceListInterrupt(PFDO_DEVICE_EXTENSION DeviceExtension, PULONG Vector, PKIRQL Irql, KINTERRUPT_MODE *InterruptMode, PBOOLEAN ShareVector, PKAFFINITY Affinity)
Definition: misc.c:242
VOID NTAPI SimpleTimerCallbackDpcRoutine(PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
Definition: misc.c:327
struct _MINIPORT * PMINIPORT
struct _DRIVER_OBJECT_EXTENSION * PDRIVER_OBJECT_EXTENSION
VOID PortRetryStarvedRequest(_In_ PFDO_DEVICE_EXTENSION FdoExtension)
Retries one queued request, so each completion lets exactly one through.
Definition: fdo.c:135
VOID NTAPI MiniportQueryUnitControl(_In_ PMINIPORT Miniport)
Asks the miniport which unit control requests it handles.
Definition: miniport.c:529
VOID NTAPI PortFdoLinkPdo(_Inout_ PFDO_DEVICE_EXTENSION FdoExtension, _Inout_ PPDO_DEVICE_EXTENSION PdoExtension)
Adds a PDO where both the list lock and the interrupt service routines respect it.
Definition: fdo.c:1431
struct _FDO_IO_FLOW_CONTROL FDO_IO_FLOW_CONTROL
struct _TIMER_ENTRY * PTIMER_ENTRY
PVOID NTAPI StorpSrbDataBuffer(_In_ PSCSI_REQUEST_BLOCK Srb)
Finds the data buffer of a request in either format.
Definition: srbex.c:80
EXTENSION_TYPE
Definition: precomp.h:58
@ InvalidExtension
Definition: precomp.h:59
@ PdoExtension
Definition: precomp.h:62
@ DriverExtension
Definition: precomp.h:60
@ FdoExtension
Definition: precomp.h:61
VOID NTAPI PortCompletionDpc(_In_ PKDPC Dpc, _In_ PVOID Context, _In_ PVOID SystemArgument1, _In_ PVOID SystemArgument2)
Definition: srb.c:920
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:1491
struct _DRIVER_OBJECT_EXTENSION DRIVER_OBJECT_EXTENSION
NTSTATUS PortPdoIssueRequest(_In_ PPDO_DEVICE_EXTENSION PdoExtension, _In_ PQUEUED_REQUEST_REFERENCE RequestReference)
Definition: srb.c:311
SCSI_UNIT_CONTROL_STATUS NTAPI MiniportUnitControl(_In_ PMINIPORT Miniport, _In_ SCSI_UNIT_CONTROL_TYPE ControlType, _In_opt_ PVOID Parameters)
Sends one unit control request, if the miniport claimed it.
Definition: miniport.c:581
struct _STARVED_REQUEST_QUEUE STARVED_REQUEST_QUEUE
VOID PortAllocateRequestReserve(_In_ PFDO_DEVICE_EXTENSION FdoExtension)
Reserves the memory a single request needs, so IO can still be issued out of pool.
Definition: fdo.c:168
VOID NTAPI StorpBuildExtendedSrb(_In_ PSCSI_REQUEST_BLOCK Srb, _Out_ PEXTENDED_REQUEST Request)
Fills in the extended request a miniport will be given.
Definition: srbex.c:102
NTSTATUS NTAPI PortFdoPnp(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: fdo.c:1519
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
KIRQL * PKIRQL
Definition: env_spec_w32.h:592
_In_ ULONG MessageId
Definition: hubioctl.cpp:1369
DRIVER_DISPATCH ForwardIrpAndForget
Definition: i8042prt.h:341
_In_ PIRP Irp
Definition: kse.h:79
_In_ PIRP _In_ PIO_COMPLETION_ROUTINE _In_ PVOID Context
Definition: kse.h:81
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3171
#define _Inout_
Definition: no_sal2.h:162
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
_In_ ULONG BusNumber
Definition: pciidex.h:65
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
static WCHAR Address[46]
Definition: ping.c:68
enum _INTERFACE_TYPE INTERFACE_TYPE
enum _KINTERRUPT_MODE KINTERRUPT_MODE
struct STOR_ADDRESS_ALIGN _STOR_ADDR_BTL8 * PSTOR_ADDR_BTL8
struct STOR_ADDRESS_ALIGN _STOR_ADDR_BTL8 STOR_ADDR_BTL8
struct SRB_ALIGN _SRBEX_DATA_SCSI_CDB16 SRBEX_DATA_SCSI_CDB16
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA * HwInitializationData
Definition: srb.h:906
STORAGE_REQUEST_BLOCK
Definition: srb.h:661
enum _SCSI_UNIT_CONTROL_STATUS SCSI_UNIT_CONTROL_STATUS
BOOLEAN(NTAPI * PHW_PASSIVE_INITIALIZE_ROUTINE)(_In_ PVOID DeviceExtension)
Definition: storport.h:7048
VOID(NTAPI * PHW_TIMER_EX)(_In_ PVOID DeviceExtension, _In_opt_ PVOID Context)
Definition: storport.h:7061
enum _SCSI_UNIT_CONTROL_TYPE SCSI_UNIT_CONTROL_TYPE
HW_INITIALIZATION_DATA HwInitData
Definition: precomp.h:68
LIST_ENTRY Entry
Definition: precomp.h:67
LIST_ENTRY AdapterListHead
Definition: precomp.h:83
LIST_ENTRY InitDataListHead
Definition: precomp.h:86
PDRIVER_OBJECT DriverObject
Definition: precomp.h:80
KSPIN_LOCK AdapterListLock
Definition: precomp.h:82
EXTENSION_TYPE ExtensionType
Definition: precomp.h:79
STORAGE_REQUEST_BLOCK Srb
Definition: precomp.h:351
SRBEX_DATA_SCSI_CDB16 Cdb
Definition: precomp.h:353
STOR_ADDR_BTL8 Address
Definition: precomp.h:352
PMAPPED_ADDRESS MappedAddressList
Definition: precomp.h:260
PDEVICE_OBJECT LowerDevice
Definition: i8042prt.h:130
PCM_RESOURCE_LIST AllocatedResources
Definition: precomp.h:256
BOOLEAN MessageInterrupts
Definition: precomp.h:270
struct _QUEUED_REQUEST_REFERENCE * ReservedRequestReference
Definition: precomp.h:306
PDEVICE_OBJECT PhysicalDevice
Definition: precomp.h:248
PHW_PASSIVE_INITIALIZE_ROUTINE HwPassiveInitRoutine
Definition: precomp.h:265
PVOID ReservedSrbExtension
Definition: precomp.h:307
LIST_ENTRY PdoListHead
Definition: precomp.h:274
KSPIN_LOCK PdoListLock
Definition: precomp.h:273
ULONG BusNumber
Definition: pci.h:88
PVOID UncachedExtensionVirtualBase
Definition: precomp.h:261
LIST_ENTRY TimerListHead
Definition: precomp.h:289
PHW_TIMER TimerCallback
Definition: precomp.h:287
PCM_RESOURCE_LIST TranslatedResources
Definition: precomp.h:257
NPAGED_LOOKASIDE_LIST RequestReferenceLookaside
Definition: precomp.h:302
DEVICE_STATE PnpState
Definition: i8042prt.h:132
ULONG UncachedExtensionSize
Definition: precomp.h:263
PHW_INITIALIZATION_DATA HwInitData
Definition: precomp.h:315
EXTENSION_TYPE ExtensionType
Definition: precomp.h:244
PDEVICE_OBJECT Device
Definition: precomp.h:246
FDO_IO_FLOW_CONTROL FlowControl
Definition: precomp.h:293
ULONG OutstandingRequestMax
Definition: precomp.h:296
PDMA_ADAPTER DmaAdapter
Definition: precomp.h:264
PIO_INTERRUPT_MESSAGE_INFO MessageInfo
Definition: precomp.h:271
BOOLEAN BusInitialized
Definition: precomp.h:259
LIST_ENTRY AdapterListEntry
Definition: precomp.h:251
PHYSICAL_ADDRESS UncachedExtensionPhysicalBase
Definition: precomp.h:262
PDRIVER_OBJECT_EXTENSION DriverExtension
Definition: precomp.h:249
KSPIN_LOCK TimerListLock
Definition: precomp.h:288
SLIST_HEADER CompletionList
Definition: precomp.h:299
PKINTERRUPT Interrupt
Definition: parport.h:48
STARVED_REQUEST_QUEUE StarvedRequests
Definition: precomp.h:309
BUS_INTERFACE_STANDARD BusInterface
Definition: precomp.h:258
BOOLEAN RequestReferenceLookasideInitialized
Definition: precomp.h:303
LIST_ENTRY FdoBlockedRequestsListHead
Definition: precomp.h:231
ULONG OutstandingRequestCount
Definition: precomp.h:222
KSPIN_LOCK Lock
Definition: precomp.h:216
ULONG RemainingBusyRequests
Definition: precomp.h:224
ULONG RemainingPauseTime
Definition: precomp.h:225
Definition: csq.h:222
Definition: ketypes.h:767
Definition: typedefs.h:120
UCHAR Level2Address[2]
Definition: precomp.h:411
UCHAR AddressMethod
Definition: precomp.h:409
UCHAR Level4Address[2]
Definition: precomp.h:413
UCHAR Level3Address[2]
Definition: precomp.h:412
UCHAR Level1Address
Definition: precomp.h:410
struct _MINIPORT * Miniport
Definition: precomp.h:91
UCHAR HwDeviceExtension[0]
Definition: precomp.h:92
PORT_CONFIGURATION_INFORMATION PortConfig
Definition: precomp.h:99
ULONG UnitControlSupportedBitmap
Definition: precomp.h:104
PHW_INITIALIZATION_DATA InitData
Definition: precomp.h:98
struct _FDO_DEVICE_EXTENSION * DeviceExtension
Definition: precomp.h:97
BOOLEAN IsVirtual
Definition: precomp.h:107
ULONG AdapterControlSupportedBitmap
Definition: precomp.h:103
PMINIPORT_DEVICE_EXTENSION MiniportExtension
Definition: precomp.h:100
PFDO_DEVICE_EXTENSION FdoExtension
Definition: precomp.h:325
PDO_IO_FLOW_CONTROL FlowControl
Definition: precomp.h:337
LIST_ENTRY PdoListEntry
Definition: precomp.h:327
PDEVICE_OBJECT Device
Definition: precomp.h:324
ULONG OutstandingRequestMax
Definition: precomp.h:338
PINQUIRYDATA InquiryBuffer
Definition: precomp.h:332
DEVICE_STATE PnpState
Definition: precomp.h:326
EXTENSION_TYPE ExtensionType
Definition: precomp.h:322
LONG SpecialRequestCounter
Definition: precomp.h:341
LIST_ENTRY ActiveRequestsListHead
Definition: precomp.h:194
BOOLEAN IsWaitingQueueClear
Definition: precomp.h:176
ULONG RemainingBusyRequests
Definition: precomp.h:188
ULONG OutstandingRequestCount
Definition: precomp.h:185
ULONG StrongOrderedCount
Definition: precomp.h:182
ULONG RemainingPauseTime
Definition: precomp.h:191
LIST_ENTRY AwaitingRequestsListHead
Definition: precomp.h:200
PSCSI_REQUEST_BLOCK Srb
Definition: precomp.h:376
PEXTENDED_REQUEST ExtendedRequest
Definition: precomp.h:378
EXTENDED_REQUEST Ex
Definition: precomp.h:402
PSTOR_SCATTER_GATHER_LIST ScatterGatherList
Definition: precomp.h:380
PPDO_DEVICE_EXTENSION PdoExtension
Definition: precomp.h:375
SLIST_ENTRY CompletionEntry
Definition: precomp.h:372
LUN_DESCRIPTOR LunDescriptor[1]
Definition: precomp.h:420
UCHAR LunListLength[4]
Definition: precomp.h:418
LIST_ENTRY ListHead
Definition: precomp.h:239
Definition: precomp.h:117
KTIMER Timer
Definition: precomp.h:119
PVOID Context
Definition: precomp.h:124
LONG TimerAlreadySet
Definition: precomp.h:121
PHW_TIMER_EX TimerCallback
Definition: precomp.h:123
LIST_ENTRY ListEntry
Definition: precomp.h:118
KDPC TimerCallbackDpc
Definition: precomp.h:120
PVOID HwDeviceExtension
Definition: precomp.h:122
LIST_ENTRY ListEntry
Definition: precomp.h:112
INQUIRYDATA InquiryData
Definition: precomp.h:113
#define SLIST_ENTRY(type)
Definition: queue.h:102
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char UCHAR
Definition: typedefs.h:53
unsigned char * PBOOLEAN
Definition: typedefs.h:53
INT POOL_TYPE
Definition: typedefs.h:78
#define NTAPI
Definition: typedefs.h:36
const char * PCSTR
Definition: typedefs.h:52
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFREQUEST Request
_In_ UCXUSBDEVICE _In_ ULONG Interface
Definition: ucxusbdevice.h:428
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3821
_Must_inspect_result_ _In_ WDFDEVICE _In_ PIRP _In_ WDFQUEUE Queue
Definition: wdfdevice.h:2231
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ PWDF_DPC_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDPC * Dpc
Definition: wdfdpc.h:112
_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 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
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
struct LOOKASIDE_ALIGN _NPAGED_LOOKASIDE_LIST NPAGED_LOOKASIDE_LIST
_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:1124
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2593
_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:1125
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1036
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:756
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:755
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:757