ReactOS  0.4.13-dev-482-ge57f103
fdo.c
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 FDO code
5  * COPYRIGHT: Copyright 2017 Eric Kohl (eric.kohl@reactos.org)
6  */
7 
8 /* INCLUDES *******************************************************************/
9 
10 #include "precomp.h"
11 
12 #define NDEBUG
13 #include <debug.h>
14 
15 
16 /* FUNCTIONS ******************************************************************/
17 
18 static
19 BOOLEAN
20 NTAPI
22  _In_ PKINTERRUPT Interrupt,
24 {
25  PFDO_DEVICE_EXTENSION DeviceExtension;
26 
27  DPRINT1("PortFdoInterruptRoutine(%p %p)\n",
28  Interrupt, ServiceContext);
29 
30  DeviceExtension = (PFDO_DEVICE_EXTENSION)ServiceContext;
31 
32  return MiniportHwInterrupt(&DeviceExtension->Miniport);
33 }
34 
35 
36 static
39  _In_ PFDO_DEVICE_EXTENSION DeviceExtension)
40 {
41  ULONG Vector;
42  KIRQL Irql;
47 
48  DPRINT1("PortFdoConnectInterrupt(%p)\n",
49  DeviceExtension);
50 
51  /* No resources, no interrupt. Done! */
52  if (DeviceExtension->AllocatedResources == NULL ||
53  DeviceExtension->TranslatedResources == NULL)
54  {
55  DPRINT1("Checkpoint\n");
56  return STATUS_SUCCESS;
57  }
58 
59  /* Get the interrupt data from the resource list */
60  Status = GetResourceListInterrupt(DeviceExtension,
61  &Vector,
62  &Irql,
64  &ShareVector,
65  &Affinity);
66  if (!NT_SUCCESS(Status))
67  {
68  DPRINT1("GetResourceListInterrupt() failed (Status 0x%08lx)\n", Status);
69  return Status;
70  }
71 
72  DPRINT1("Vector: %lu\n", Vector);
73  DPRINT1("Irql: %lu\n", Irql);
74 
75  DPRINT1("Affinity: 0x%08lx\n", Affinity);
76 
77  /* Connect the interrupt */
78  Status = IoConnectInterrupt(&DeviceExtension->Interrupt,
80  DeviceExtension,
81  NULL,
82  Vector,
83  Irql,
84  Irql,
87  Affinity,
88  FALSE);
89  if (NT_SUCCESS(Status))
90  {
91  DeviceExtension->InterruptIrql = Irql;
92  }
93  else
94  {
95  DPRINT1("IoConnectInterrupt() failed (Status 0x%08lx)\n", Status);
96  }
97 
98  return Status;
99 }
100 
101 
102 static
103 NTSTATUS
105  _In_ PFDO_DEVICE_EXTENSION DeviceExtension)
106 {
107  PHW_INITIALIZATION_DATA InitData;
108  INTERFACE_TYPE InterfaceType;
110 
111  DPRINT1("PortFdoStartDevice(%p)\n", DeviceExtension);
112 
113  /* Get the interface type of the lower device */
114  InterfaceType = GetBusInterface(DeviceExtension->LowerDevice);
115  if (InterfaceType == InterfaceTypeUndefined)
116  return STATUS_NO_SUCH_DEVICE;
117 
118  /* Get the driver init data for the given interface type */
119  InitData = PortGetDriverInitData(DeviceExtension->DriverExtension,
120  InterfaceType);
121  if (InitData == NULL)
122  return STATUS_NO_SUCH_DEVICE;
123 
124  /* Initialize the miniport */
125  Status = MiniportInitialize(&DeviceExtension->Miniport,
126  DeviceExtension,
127  InitData);
128  if (!NT_SUCCESS(Status))
129  {
130  DPRINT1("MiniportInitialize() failed (Status 0x%08lx)\n", Status);
131  return Status;
132  }
133 
134  /* Call the miniports FindAdapter function */
135  Status = MiniportFindAdapter(&DeviceExtension->Miniport);
136  if (!NT_SUCCESS(Status))
137  {
138  DPRINT1("MiniportFindAdapter() failed (Status 0x%08lx)\n", Status);
139  return Status;
140  }
141 
142  /* Connect the configured interrupt */
143  Status = PortFdoConnectInterrupt(DeviceExtension);
144  if (!NT_SUCCESS(Status))
145  {
146  DPRINT1("PortFdoConnectInterrupt() failed (Status 0x%08lx)\n", Status);
147  return Status;
148  }
149 
150  /* Call the miniports HwInitialize function */
151  Status = MiniportHwInitialize(&DeviceExtension->Miniport);
152  if (!NT_SUCCESS(Status))
153  {
154  DPRINT1("MiniportHwInitialize() failed (Status 0x%08lx)\n", Status);
155  return Status;
156  }
157 
158  /* Call the HwPassiveInitRoutine function, if available */
159  if (DeviceExtension->HwPassiveInitRoutine != NULL)
160  {
161  DPRINT1("Calling HwPassiveInitRoutine()\n");
162  if (!DeviceExtension->HwPassiveInitRoutine(&DeviceExtension->Miniport.MiniportExtension->HwDeviceExtension))
163  {
164  DPRINT1("HwPassiveInitRoutine() failed\n");
165  return STATUS_UNSUCCESSFUL;
166  }
167  }
168 
169  return STATUS_SUCCESS;
170 }
171 
172 
173 static
174 NTSTATUS
175 NTAPI
177  _In_ PFDO_DEVICE_EXTENSION DeviceExtension,
178  _In_ PIRP Irp)
179 {
180  PIO_STACK_LOCATION Stack;
182 
183  DPRINT1("PortFdoStartDevice(%p %p)\n",
184  DeviceExtension, Irp);
185 
186  ASSERT(DeviceExtension->ExtensionType == FdoExtension);
187 
188  /* Get the current stack location */
190 
191  /* Start the lower device if the FDO is in 'stopped' state */
192  if (DeviceExtension->PnpState == dsStopped)
193  {
194  Status = ForwardIrpAndWait(DeviceExtension->LowerDevice, Irp);
195  if (!NT_SUCCESS(Status))
196  {
197  DPRINT1("ForwardIrpAndWait() failed (Status 0x%08lx)\n", Status);
198  return Status;
199  }
200  }
201 
202  /* Change to the 'started' state */
203  DeviceExtension->PnpState = dsStarted;
204 
205  /* Copy the raw and translated resource lists into the device extension */
206  if (Stack->Parameters.StartDevice.AllocatedResources != NULL &&
207  Stack->Parameters.StartDevice.AllocatedResourcesTranslated != NULL)
208  {
209  DeviceExtension->AllocatedResources = CopyResourceList(NonPagedPool,
210  Stack->Parameters.StartDevice.AllocatedResources);
211  if (DeviceExtension->AllocatedResources == NULL)
212  return STATUS_NO_MEMORY;
213 
214  DeviceExtension->TranslatedResources = CopyResourceList(NonPagedPool,
215  Stack->Parameters.StartDevice.AllocatedResourcesTranslated);
216  if (DeviceExtension->TranslatedResources == NULL)
217  return STATUS_NO_MEMORY;
218  }
219 
220  /* Get the bus interface of the lower (bus) device */
221  Status = QueryBusInterface(DeviceExtension->LowerDevice,
222  (PGUID)&GUID_BUS_INTERFACE_STANDARD,
223  sizeof(BUS_INTERFACE_STANDARD),
224  1,
225  &DeviceExtension->BusInterface,
226  NULL);
227  DPRINT1("Status: 0x%08lx\n", Status);
228  if (NT_SUCCESS(Status))
229  {
230  DPRINT1("Context: %p\n", DeviceExtension->BusInterface.Context);
231  DeviceExtension->BusInitialized = TRUE;
232  }
233 
234  /* Start the miniport (FindAdapter & Initialize) */
235  Status = PortFdoStartMiniport(DeviceExtension);
236  if (!NT_SUCCESS(Status))
237  {
238  DPRINT1("FdoStartMiniport() failed (Status 0x%08lx)\n", Status);
239  DeviceExtension->PnpState = dsStopped;
240  }
241 
242  return Status;
243 }
244 
245 
246 static NTSTATUS
249  _In_ ULONG Bus,
250  _In_ ULONG Target,
251  _In_ ULONG Lun)
252 {
253  PINQUIRYDATA InquiryBuffer;
254  PUCHAR /*PSENSE_DATA*/ SenseBuffer;
255  BOOLEAN KeepTrying = TRUE;
256  ULONG RetryCount = 0;
258  PCDB Cdb;
259  PFDO_DEVICE_EXTENSION DeviceExtension;
260  PVOID SrbExtension = NULL;
261  BOOLEAN ret;
262  PUNIT_DATA UnitData;
264 
265  DPRINT("PortSendInquiry(%p %lu %lu %lu)\n",
266  DeviceObject, Bus, Target, Lun);
267 
269 
271  if (InquiryBuffer == NULL)
273 
275  if (SenseBuffer == NULL)
276  {
277  ExFreePoolWithTag(InquiryBuffer, TAG_INQUIRY_DATA);
279  }
280 
281  if (DeviceExtension->Miniport.PortConfig.SrbExtensionSize != 0)
282  {
283  SrbExtension = ExAllocatePoolWithTag(NonPagedPool,
284  DeviceExtension->Miniport.PortConfig.SrbExtensionSize,
286  if (SrbExtension == NULL)
287  {
288  ExFreePoolWithTag(SenseBuffer, TAG_SENSE_DATA);
289  ExFreePoolWithTag(InquiryBuffer, TAG_INQUIRY_DATA);
291  }
292  }
293 
294  while (KeepTrying)
295  {
296  /* Prepare SRB */
298 
299  Srb.Length = sizeof(SCSI_REQUEST_BLOCK);
300 // Srb.OriginalRequest = Irp;
301  Srb.PathId = Bus;
302  Srb.TargetId = Target;
303  Srb.Lun = Lun;
304  Srb.Function = SRB_FUNCTION_EXECUTE_SCSI;
306  Srb.TimeOutValue = 4;
307  Srb.CdbLength = 6;
308 
309  Srb.SenseInfoBuffer = SenseBuffer;
310  Srb.SenseInfoBufferLength = SENSE_BUFFER_SIZE;
311 
312  Srb.DataBuffer = InquiryBuffer;
313  Srb.DataTransferLength = INQUIRYDATABUFFERSIZE;
314 
315  Srb.SrbExtension = SrbExtension;
316 
317  /* Fill in CDB */
318  Cdb = (PCDB)Srb.Cdb;
319  Cdb->CDB6INQUIRY3.OperationCode = SCSIOP_INQUIRY;
320  Cdb->CDB6INQUIRY3.EnableVitalProductData = 1;
321  Cdb->CDB6INQUIRY3.CommandSupportData = 0;
322  Cdb->CDB6INQUIRY3.PageCode = 0; //??
323  Cdb->CDB6INQUIRY3.AllocationLength = INQUIRYDATABUFFERSIZE;
324  Cdb->CDB6INQUIRY3.Control = 0;
325 
326  /* Call the miniport driver */
327  ret = MiniportStartIo(&DeviceExtension->Miniport,
328  &Srb);
329  if (ret == FALSE)
330  {
332  KeepTrying = FALSE;
333  continue;
334  }
335 
336  DPRINT("SrbStatus 0x%08lx\n", Srb.SrbStatus);
337  if (SRB_STATUS(Srb.SrbStatus) == SRB_STATUS_SUCCESS)
338  {
339  DPRINT("Found a device!\n");
340 
341  UnitData = ExAllocatePool(NonPagedPool, sizeof(UNIT_DATA));
342  if (UnitData == NULL)
343  {
345  KeepTrying = FALSE;
346  continue;
347  }
348 
349  /* All fine, copy data over */
350  RtlCopyMemory(&UnitData->InquiryData,
351  Srb.DataBuffer,
352  Srb.DataTransferLength);
353 
354  InsertTailList(&DeviceExtension->UnitListHead,
355  &UnitData->ListEntry);
356  DeviceExtension->UnitCount++;
357 
358  /* Quit the loop */
360  KeepTrying = FALSE;
361  continue;
362  }
363 
364  DPRINT("Inquiry SRB failed with SrbStatus 0x%08X\n", Srb.SrbStatus);
365 
366  /* Retry a couple of times if no timeout happened */
367  if ((RetryCount < 2) &&
368  (SRB_STATUS(Srb.SrbStatus) != SRB_STATUS_NO_DEVICE) &&
370  {
371  RetryCount++;
372  KeepTrying = TRUE;
373  }
374  else
375  {
376  /* That's all, quit the loop */
377  KeepTrying = FALSE;
378 
379  /* Set status according to SRB status */
380  if (SRB_STATUS(Srb.SrbStatus) == SRB_STATUS_BAD_FUNCTION ||
382  {
384  }
385  else
386  {
388  }
389  }
390  }
391 
392  /* Free buffers */
393  if (SrbExtension != NULL)
394  ExFreePoolWithTag(SrbExtension, TAG_SENSE_DATA);
395 
396  ExFreePoolWithTag(SenseBuffer, TAG_SENSE_DATA);
397  ExFreePoolWithTag(InquiryBuffer, TAG_INQUIRY_DATA);
398 
399  DPRINT("PortSendInquiry() returns 0x%08lx\n", Status);
400 
401  return Status;
402 }
403 
404 
405 static
406 NTSTATUS
408  _In_ PFDO_DEVICE_EXTENSION DeviceExtension)
409 {
410  ULONG Bus, Target, Lun;
412 
413  DPRINT1("PortFdoScanBus(%p)\n",
414  DeviceExtension);
415 
416  DPRINT1("NumberOfBuses: %lu\n", DeviceExtension->Miniport.PortConfig.NumberOfBuses);
417  DPRINT1("MaximumNumberOfTargets: %lu\n", DeviceExtension->Miniport.PortConfig.MaximumNumberOfTargets);
418  DPRINT1("MaximumNumberOfLogicalUnits: %lu\n", DeviceExtension->Miniport.PortConfig.MaximumNumberOfLogicalUnits);
419 
420  /* Scan all buses */
421  for (Bus = 0; Bus < DeviceExtension->Miniport.PortConfig.NumberOfBuses; Bus++)
422  {
423  DPRINT1("Scanning bus %ld\n", Bus);
424 
425  /* Scan all targets */
426  for (Target = 0; Target < DeviceExtension->Miniport.PortConfig.MaximumNumberOfTargets; Target++)
427  {
428  DPRINT1(" Scanning target %ld:%ld\n", Bus, Target);
429 
430  /* Scan all logical units */
431  for (Lun = 0; Lun < DeviceExtension->Miniport.PortConfig.MaximumNumberOfLogicalUnits; Lun++)
432  {
433  DPRINT1(" Scanning logical unit %ld:%ld:%ld\n", Bus, Target, Lun);
434 
435  Status = PortSendInquiry(DeviceExtension->Device, Bus, Target, Lun);
436  DPRINT1("PortSendInquiry returned 0x%08lx\n", Status);
437  if (!NT_SUCCESS(Status))
438  break;
439  }
440  }
441  }
442 
443  DPRINT("Done!\n");
444 
445  return STATUS_SUCCESS;
446 }
447 
448 
449 static
450 NTSTATUS
452  _In_ PFDO_DEVICE_EXTENSION DeviceExtension,
454 {
456 
457  DPRINT1("PortFdoQueryBusRelations(%p %p)\n",
458  DeviceExtension, Information);
459 
460  Status = PortFdoScanBus(DeviceExtension);
461 
462  DPRINT1("Units found: %lu\n", DeviceExtension->UnitCount);
463 
464  *Information = 0;
465 
466  return Status;
467 }
468 
469 
470 static
471 NTSTATUS
473  PFDO_DEVICE_EXTENSION DeviceExtension,
474  PIRP Irp)
475 {
476  PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList;
477 
478  DPRINT1("PortFdoFilterRequirements(%p %p)\n", DeviceExtension, Irp);
479 
480  /* Get the bus number and the slot number */
481  RequirementsList =(PIO_RESOURCE_REQUIREMENTS_LIST)Irp->IoStatus.Information;
482  if (RequirementsList != NULL)
483  {
484  DeviceExtension->BusNumber = RequirementsList->BusNumber;
485  DeviceExtension->SlotNumber = RequirementsList->SlotNumber;
486  }
487 
488  return STATUS_SUCCESS;
489 }
490 
491 
492 NTSTATUS
493 NTAPI
496  _In_ PIRP Irp)
497 {
498  PFDO_DEVICE_EXTENSION DeviceExtension;
499 // PIO_STACK_LOCATION Stack;
502 
503  DPRINT1("PortFdoScsi(%p %p)\n",
504  DeviceObject, Irp);
505 
507  ASSERT(DeviceExtension);
508  ASSERT(DeviceExtension->ExtensionType == FdoExtension);
509 
510 // Stack = IoGetCurrentIrpStackLocation(Irp);
511 
512 
513  Irp->IoStatus.Information = Information;
514  Irp->IoStatus.Status = Status;
516 
517  return Status;
518 }
519 
520 
521 NTSTATUS
522 NTAPI
525  _In_ PIRP Irp)
526 {
527  PFDO_DEVICE_EXTENSION DeviceExtension;
528  PIO_STACK_LOCATION Stack;
531 
532  DPRINT1("PortFdoPnp(%p %p)\n",
533  DeviceObject, Irp);
534 
536  ASSERT(DeviceExtension);
537  ASSERT(DeviceExtension->ExtensionType == FdoExtension);
538 
540 
541  switch (Stack->MinorFunction)
542  {
543  case IRP_MN_START_DEVICE: /* 0x00 */
544  DPRINT1("IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
545  Status = PortFdoStartDevice(DeviceExtension, Irp);
546  break;
547 
548  case IRP_MN_QUERY_REMOVE_DEVICE: /* 0x01 */
549  DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_REMOVE_DEVICE\n");
550  break;
551 
552  case IRP_MN_REMOVE_DEVICE: /* 0x02 */
553  DPRINT1("IRP_MJ_PNP / IRP_MN_REMOVE_DEVICE\n");
554  break;
555 
556  case IRP_MN_CANCEL_REMOVE_DEVICE: /* 0x03 */
557  DPRINT1("IRP_MJ_PNP / IRP_MN_CANCEL_REMOVE_DEVICE\n");
558  break;
559 
560  case IRP_MN_STOP_DEVICE: /* 0x04 */
561  DPRINT1("IRP_MJ_PNP / IRP_MN_STOP_DEVICE\n");
562  break;
563 
564  case IRP_MN_QUERY_STOP_DEVICE: /* 0x05 */
565  DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_STOP_DEVICE\n");
566  break;
567 
568  case IRP_MN_CANCEL_STOP_DEVICE: /* 0x06 */
569  DPRINT1("IRP_MJ_PNP / IRP_MN_CANCEL_STOP_DEVICE\n");
570  break;
571 
572  case IRP_MN_QUERY_DEVICE_RELATIONS: /* 0x07 */
573  DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS\n");
574  switch (Stack->Parameters.QueryDeviceRelations.Type)
575  {
576  case BusRelations:
577  DPRINT1(" IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n");
578  Status = PortFdoQueryBusRelations(DeviceExtension, &Information);
579  break;
580 
581  case RemovalRelations:
582  DPRINT1(" IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations\n");
583  return ForwardIrpAndForget(DeviceExtension->LowerDevice, Irp);
584 
585  default:
586  DPRINT1(" IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
587  Stack->Parameters.QueryDeviceRelations.Type);
588  return ForwardIrpAndForget(DeviceExtension->LowerDevice, Irp);
589  }
590  break;
591 
592  case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: /* 0x0d */
593  DPRINT1("IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
594  PortFdoFilterRequirements(DeviceExtension, Irp);
595  return ForwardIrpAndForget(DeviceExtension->LowerDevice, Irp);
596 
597  case IRP_MN_QUERY_PNP_DEVICE_STATE: /* 0x14 */
598  DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_PNP_DEVICE_STATE\n");
599  break;
600 
601  case IRP_MN_DEVICE_USAGE_NOTIFICATION: /* 0x16 */
602  DPRINT1("IRP_MJ_PNP / IRP_MN_DEVICE_USAGE_NOTIFICATION\n");
603  break;
604 
605  case IRP_MN_SURPRISE_REMOVAL: /* 0x17 */
606  DPRINT1("IRP_MJ_PNP / IRP_MN_SURPRISE_REMOVAL\n");
607  break;
608 
609  default:
610  DPRINT1("IRP_MJ_PNP / Unknown IOCTL 0x%lx\n", Stack->MinorFunction);
611  return ForwardIrpAndForget(DeviceExtension->LowerDevice, Irp);
612  }
613 
614  Irp->IoStatus.Information = Information;
615  Irp->IoStatus.Status = Status;
617 
618  return Status;
619 }
620 
621 /* EOF */
NTSTATUS NTAPI PortFdoScsi(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: fdo.c:494
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG _In_ KIRQL _In_ KIRQL _In_ KINTERRUPT_MODE InterruptMode
Definition: iofuncs.h:798
#define IRP_MN_REMOVE_DEVICE
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
enum _INTERFACE_TYPE INTERFACE_TYPE
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR _In_ UCHAR Lun
Definition: classpnp.h:1117
NTSTATUS NTAPI ForwardIrpAndWait(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:32
_In_ PIRP Irp
Definition: csq.h:116
PCM_RESOURCE_LIST CopyResourceList(POOL_TYPE PoolType, PCM_RESOURCE_LIST Source)
Definition: misc.c:132
_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
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
unsigned char * PUCHAR
Definition: retypes.h:3
Definition: cdrw_hw.h:28
LONG NTSTATUS
Definition: precomp.h:26
static NTSTATUS GetBusInterface(IN PFDO_DEVICE_EXTENSION DeviceExtension)
Definition: fdo.c:18
#define TAG_SENSE_DATA
Definition: precomp.h:33
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define SRB_STATUS_NO_DEVICE
Definition: srb.h:340
EXTENSION_TYPE ExtensionType
Definition: precomp.h:92
static NTSTATUS PortSendInquiry(_In_ PDEVICE_OBJECT DeviceObject, _In_ ULONG Bus, _In_ ULONG Target, _In_ ULONG Lun)
Definition: fdo.c:247
#define SRB_STATUS_BAD_SRB_BLOCK_LENGTH
Definition: srb.h:352
#define InsertTailList(ListHead, Entry)
#define SRB_FLAGS_DATA_IN
Definition: srb.h:392
_Out_ PKIRQL Irql
Definition: csq.h:179
#define SRB_STATUS(Status)
Definition: srb.h:381
#define SENSE_BUFFER_SIZE
Definition: cdrw_hw.h:1183
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define STATUS_IO_DEVICE_ERROR
Definition: udferr_usr.h:179
UCHAR KIRQL
Definition: env_spec_w32.h:591
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define IRP_MN_QUERY_REMOVE_DEVICE
BOOLEAN MiniportStartIo(_In_ PMINIPORT Miniport, _In_ PSCSI_REQUEST_BLOCK Srb)
Definition: miniport.c:367
NTSTATUS NTAPI IoConnectInterrupt(OUT PKINTERRUPT *InterruptObject, IN PKSERVICE_ROUTINE ServiceRoutine, IN PVOID ServiceContext, IN PKSPIN_LOCK SpinLock, IN ULONG Vector, IN KIRQL Irql, IN KIRQL SynchronizeIrql, IN KINTERRUPT_MODE InterruptMode, IN BOOLEAN ShareVector, IN KAFFINITY ProcessorEnableMask, IN BOOLEAN FloatingSave)
Definition: irq.c:22
PHW_INITIALIZATION_DATA PortGetDriverInitData(PDRIVER_OBJECT_EXTENSION DriverExtension, INTERFACE_TYPE InterfaceType)
Definition: storport.c:78
PVOID DeviceExtension
Definition: env_spec_w32.h:418
unsigned char BOOLEAN
static NTSTATUS PortFdoScanBus(_In_ PFDO_DEVICE_EXTENSION DeviceExtension)
Definition: fdo.c:407
smooth NULL
Definition: ftsmooth.c:416
#define INQUIRYDATABUFFERSIZE
Definition: cdrw_hw.h:1113
enum _KINTERRUPT_MODE KINTERRUPT_MODE
union _CDB * PCDB
#define _Out_
Definition: no_sal2.h:323
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
LIST_ENTRY ListEntry
Definition: precomp.h:86
#define IRP_MN_QUERY_STOP_DEVICE
#define SCSIOP_INQUIRY
Definition: cdrw_hw.h:888
#define SRB_STATUS_BAD_FUNCTION
Definition: srb.h:356
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
static BOOLEAN NTAPI PortFdoInterruptRoutine(_In_ PKINTERRUPT Interrupt, _In_ PVOID ServiceContext)
Definition: fdo.c:21
#define IRP_MN_STOP_DEVICE
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
NTSTATUS MiniportHwInitialize(_In_ PMINIPORT Miniport)
Definition: miniport.c:335
#define IRP_MN_START_DEVICE
#define SRB_FLAGS_DISABLE_SYNCH_TRANSFER
Definition: srb.h:389
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:170
BOOLEAN MiniportHwInterrupt(_In_ PMINIPORT Miniport)
Definition: miniport.c:351
NTSTATUS NTAPI PortFdoPnp(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: fdo.c:523
_Must_inspect_result_ typedef _In_ ULONG _In_ BOOLEAN Target
Definition: iotypes.h:1067
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID ServiceContext
Definition: iofuncs.h:798
struct _SCSI_REQUEST_BLOCK SCSI_REQUEST_BLOCK
static NTSTATUS PortFdoFilterRequirements(PFDO_DEVICE_EXTENSION DeviceExtension, PIRP Irp)
Definition: fdo.c:472
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
ULONG BusNumber
Definition: pci.h:84
int ret
NTSTATUS NTAPI ForwardIrpAndForget(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:66
NDIS_STATUS NTAPI MiniportInitialize(OUT PNDIS_STATUS OpenErrorStatus, OUT PUINT SelectedMediumIndex, IN PNDIS_MEDIUM MediumArray, IN UINT MediumArraySize, IN NDIS_HANDLE MiniportAdapterHandle, IN NDIS_HANDLE WrapperConfigurationContext)
Definition: ndis.c:88
NTSTATUS MiniportFindAdapter(_In_ PMINIPORT Miniport)
Definition: miniport.c:283
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
#define SRB_STATUS_SELECTION_TIMEOUT
Definition: srb.h:342
static NTSTATUS PortFdoStartMiniport(_In_ PFDO_DEVICE_EXTENSION DeviceExtension)
Definition: fdo.c:104
PORT_CONFIGURATION_INFORMATION PortConfig
Definition: precomp.h:80
Status
Definition: gdiplustypes.h:24
#define _In_
Definition: no_sal2.h:204
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
static NTSTATUS PortFdoConnectInterrupt(_In_ PFDO_DEVICE_EXTENSION DeviceExtension)
Definition: fdo.c:38
struct _IO_RESOURCE_REQUIREMENTS_LIST * PIO_RESOURCE_REQUIREMENTS_LIST
NTSTATUS QueryBusInterface(PDEVICE_OBJECT DeviceObject, PGUID Guid, USHORT Size, USHORT Version, PBUS_INTERFACE_STANDARD Interface, PVOID InterfaceSpecificData)
Definition: misc.c:162
ULONG_PTR KAFFINITY
Definition: compat.h:75
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG Vector
Definition: iofuncs.h:798
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
static NTSTATUS PortFdoQueryBusRelations(_In_ PFDO_DEVICE_EXTENSION DeviceExtension, _Out_ PULONG_PTR Information)
Definition: fdo.c:451
static NTSTATUS NTAPI PortFdoStartDevice(_In_ PFDO_DEVICE_EXTENSION DeviceExtension, _In_ PIRP Irp)
Definition: fdo.c:176
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define DPRINT1
Definition: precomp.h:8
#define SRB_FUNCTION_EXECUTE_SCSI
Definition: srb.h:307
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:565
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define SRB_STATUS_SUCCESS
Definition: srb.h:333
uint32_t * PULONG_PTR
Definition: typedefs.h:63
PDEVICE_OBJECT LowerDevice
Definition: i8042prt.h:130
#define IRP_MN_CANCEL_STOP_DEVICE
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define IRP_MN_DEVICE_USAGE_NOTIFICATION
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
return STATUS_SUCCESS
Definition: btrfs.c:2777
struct _CDB::_CDB6INQUIRY3 CDB6INQUIRY3
LIST_ENTRY UnitListHead
Definition: precomp.h:116
INQUIRYDATA InquiryData
Definition: precomp.h:87
#define IRP_MN_QUERY_PNP_DEVICE_STATE
Iosb Information
Definition: create.c:4377
NTSTATUS GetResourceListInterrupt(PFDO_DEVICE_EXTENSION DeviceExtension, PULONG Vector, PKIRQL Irql, KINTERRUPT_MODE *InterruptMode, PBOOLEAN ShareVector, PKAFFINITY Affinity)
Definition: misc.c:282
#define TAG_INQUIRY_DATA
Definition: precomp.h:32