ReactOS 0.4.16-dev-319-g6cf4263
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
18static
24{
25 PFDO_DEVICE_EXTENSION DeviceExtension;
26
27 DPRINT1("PortFdoInterruptRoutine(%p %p)\n",
29
30 DeviceExtension = (PFDO_DEVICE_EXTENSION)ServiceContext;
31
32 return MiniportHwInterrupt(&DeviceExtension->Miniport);
33}
34
35
36static
39 _In_ PFDO_DEVICE_EXTENSION DeviceExtension)
40{
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,
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,
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
102static
105 _In_ PFDO_DEVICE_EXTENSION DeviceExtension)
106{
110
111 DPRINT1("PortFdoStartDevice(%p)\n", DeviceExtension);
112
113 /* Get the interface type of the lower device */
114 InterfaceType = GetBusInterface(DeviceExtension->LowerDevice);
117
118 /* Get the driver init data for the given interface type */
119 InitData = PortGetDriverInitData(DeviceExtension->DriverExtension,
121 if (InitData == NULL)
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
173static
175NTAPI
177 _In_ PFDO_DEVICE_EXTENSION DeviceExtension,
178 _In_ PIRP Irp)
179{
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 if (IoForwardIrpSynchronously(DeviceExtension->LowerDevice, Irp))
195 {
196 Status = Irp->IoStatus.Status;
197 }
198 else
199 {
201 }
202
203 if (!NT_SUCCESS(Status))
204 {
205 DPRINT1("Lower device failed the IRP (Status 0x%08lx)\n", Status);
206 return Status;
207 }
208 }
209
210 /* Change to the 'started' state */
211 DeviceExtension->PnpState = dsStarted;
212
213 /* Copy the raw and translated resource lists into the device extension */
214 if (Stack->Parameters.StartDevice.AllocatedResources != NULL &&
215 Stack->Parameters.StartDevice.AllocatedResourcesTranslated != NULL)
216 {
217 DeviceExtension->AllocatedResources = CopyResourceList(NonPagedPool,
218 Stack->Parameters.StartDevice.AllocatedResources);
219 if (DeviceExtension->AllocatedResources == NULL)
220 return STATUS_NO_MEMORY;
221
222 DeviceExtension->TranslatedResources = CopyResourceList(NonPagedPool,
223 Stack->Parameters.StartDevice.AllocatedResourcesTranslated);
224 if (DeviceExtension->TranslatedResources == NULL)
225 return STATUS_NO_MEMORY;
226 }
227
228 /* Get the bus interface of the lower (bus) device */
229 Status = QueryBusInterface(DeviceExtension->LowerDevice,
230 (PGUID)&GUID_BUS_INTERFACE_STANDARD,
232 1,
233 &DeviceExtension->BusInterface,
234 NULL);
235 DPRINT1("Status: 0x%08lx\n", Status);
236 if (NT_SUCCESS(Status))
237 {
238 DPRINT1("Context: %p\n", DeviceExtension->BusInterface.Context);
239 DeviceExtension->BusInitialized = TRUE;
240 }
241
242 /* Start the miniport (FindAdapter & Initialize) */
243 Status = PortFdoStartMiniport(DeviceExtension);
244 if (!NT_SUCCESS(Status))
245 {
246 DPRINT1("FdoStartMiniport() failed (Status 0x%08lx)\n", Status);
247 DeviceExtension->PnpState = dsStopped;
248 }
249
250 return Status;
251}
252
253
254static
258{
260 PIO_STACK_LOCATION IrpStack;
262// KIRQL Irql;
263 PIRP Irp;
265 PSENSE_DATA SenseBuffer;
266 BOOLEAN KeepTrying = TRUE;
267 ULONG RetryCount = 0;
269 PCDB Cdb;
270// PSCSI_PORT_LUN_EXTENSION LunExtension;
271// PFDO_DEVICE_EXTENSION DeviceExtension;
272
273 DPRINT("PortSendInquiry(%p)\n", PdoExtension);
274
275 if (PdoExtension->InquiryBuffer == NULL)
276 {
278 if (PdoExtension->InquiryBuffer == NULL)
280 }
281
283 if (SenseBuffer == NULL)
284 {
286 }
287
288 while (KeepTrying)
289 {
290 /* Initialize event for waiting */
293 FALSE);
294
295 /* Create an IRP */
297 PdoExtension->Device,
298 NULL,
299 0,
300 PdoExtension->InquiryBuffer,
302 TRUE,
303 &Event,
305 if (Irp == NULL)
306 {
307 DPRINT("IoBuildDeviceIoControlRequest() failed\n");
308
309 /* Quit the loop */
311 KeepTrying = FALSE;
312 continue;
313 }
314
315 /* Prepare SRB */
317
318 Srb.Length = sizeof(SCSI_REQUEST_BLOCK);
320 Srb.PathId = PdoExtension->Bus;
321 Srb.TargetId = PdoExtension->Target;
322 Srb.Lun = PdoExtension->Lun;
325 Srb.TimeOutValue = 4;
326 Srb.CdbLength = 6;
327
328 Srb.SenseInfoBuffer = SenseBuffer;
330
331 Srb.DataBuffer = PdoExtension->InquiryBuffer;
333
334 /* Attach Srb to the Irp */
335 IrpStack = IoGetNextIrpStackLocation(Irp);
336 IrpStack->Parameters.Scsi.Srb = &Srb;
337
338 /* Fill in CDB */
339 Cdb = (PCDB)Srb.Cdb;
340 Cdb->CDB6INQUIRY.OperationCode = SCSIOP_INQUIRY;
341 Cdb->CDB6INQUIRY.LogicalUnitNumber = PdoExtension->Lun;
342 Cdb->CDB6INQUIRY.AllocationLength = INQUIRYDATABUFFERSIZE;
343
344 /* Call the driver */
346
347 /* Wait for it to complete */
348 if (Status == STATUS_PENDING)
349 {
350 DPRINT1("PortSendInquiry(): Waiting for the driver to process request...\n");
352 Executive,
354 FALSE,
355 NULL);
357 }
358
359 DPRINT("PortSendInquiry(): Request processed by driver, status = 0x%08X\n", Status);
360
362 {
363 DPRINT("Found a device!\n");
364
365 /* Quit the loop */
367 KeepTrying = FALSE;
368 continue;
369 }
370
371 DPRINT("Inquiry SRB failed with SrbStatus 0x%08X\n", Srb.SrbStatus);
372
373 /* Check if the queue is frozen */
375 {
376 /* Something weird happened, deal with it (unfreeze the queue) */
377 KeepTrying = FALSE;
378
379 DPRINT("SpiSendInquiry(): the queue is frozen at TargetId %d\n", Srb.TargetId);
380
381// LunExtension = SpiGetLunExtension(DeviceExtension,
382// LunInfo->PathId,
383// LunInfo->TargetId,
384// LunInfo->Lun);
385
386 /* Clear frozen flag */
387// LunExtension->Flags &= ~LUNEX_FROZEN_QUEUE;
388
389 /* Acquire the spinlock */
390// KeAcquireSpinLock(&DeviceExtension->SpinLock, &Irql);
391
392 /* Process the request */
393// SpiGetNextRequestFromLun(DeviceObject->DeviceExtension, LunExtension);
394
395 /* SpiGetNextRequestFromLun() releases the spinlock,
396 so we just lower irql back to what it was before */
397// KeLowerIrql(Irql);
398 }
399
400 /* Check if data overrun happened */
402 {
403 DPRINT("Data overrun at TargetId %d\n", PdoExtension->Target);
404
405 /* Quit the loop */
407 KeepTrying = FALSE;
408 }
410 SenseBuffer->SenseKey == SCSI_SENSE_ILLEGAL_REQUEST)
411 {
412 /* LUN is not valid, but some device responds there.
413 Mark it as invalid anyway */
414
415 /* Quit the loop */
417 KeepTrying = FALSE;
418 }
419 else
420 {
421 /* Retry a couple of times if no timeout happened */
422 if ((RetryCount < 2) &&
425 {
426 RetryCount++;
427 KeepTrying = TRUE;
428 }
429 else
430 {
431 /* That's all, quit the loop */
432 KeepTrying = FALSE;
433
434 /* Set status according to SRB status */
437 {
439 }
440 else
441 {
443 }
444 }
445 }
446 }
447
448 /* Free the sense buffer */
449 ExFreePoolWithTag(SenseBuffer, TAG_SENSE_DATA);
450
451 DPRINT("PortSendInquiry() done with Status 0x%08X\n", Status);
452
453 return Status;
454}
455
456
457
458static
461 _In_ PFDO_DEVICE_EXTENSION DeviceExtension)
462{
464 ULONG Bus, Target; //, Lun;
466
467 DPRINT("PortFdoScanBus(%p)\n", DeviceExtension);
468
469 DPRINT("NumberOfBuses: %lu\n", DeviceExtension->Miniport.PortConfig.NumberOfBuses);
470 DPRINT("MaximumNumberOfTargets: %lu\n", DeviceExtension->Miniport.PortConfig.MaximumNumberOfTargets);
471 DPRINT("MaximumNumberOfLogicalUnits: %lu\n", DeviceExtension->Miniport.PortConfig.MaximumNumberOfLogicalUnits);
472
473 /* Scan all buses */
474 for (Bus = 0; Bus < DeviceExtension->Miniport.PortConfig.NumberOfBuses; Bus++)
475 {
476 DPRINT("Scanning bus %ld\n", Bus);
477
478 /* Scan all targets */
479 for (Target = 0; Target < DeviceExtension->Miniport.PortConfig.MaximumNumberOfTargets; Target++)
480 {
481 DPRINT(" Scanning target %ld:%ld\n", Bus, Target);
482
483 DPRINT(" Scanning logical unit %ld:%ld:%ld\n", Bus, Target, 0);
484 Status = PortCreatePdo(DeviceExtension, Bus, Target, 0, &PdoExtension);
485 if (NT_SUCCESS(Status))
486 {
487 /* Scan LUN 0 */
489 DPRINT("PortSendInquiry returned 0x%08lx\n", Status);
490 if (!NT_SUCCESS(Status))
491 {
493 }
494 else
495 {
496 DPRINT("VendorId: %.8s\n", PdoExtension->InquiryBuffer->VendorId);
497 DPRINT("ProductId: %.16s\n", PdoExtension->InquiryBuffer->ProductId);
498 DPRINT("ProductRevisionLevel: %.4s\n", PdoExtension->InquiryBuffer->ProductRevisionLevel);
499 DPRINT("VendorSpecific: %.20s\n", PdoExtension->InquiryBuffer->VendorSpecific);
500 }
501 }
502
503#if 0
504 /* Scan all logical units */
505 for (Lun = 1; Lun < DeviceExtension->Miniport.PortConfig.MaximumNumberOfLogicalUnits; Lun++)
506 {
507 DPRINT(" Scanning logical unit %ld:%ld:%ld\n", Bus, Target, Lun);
508 Status = PortSendInquiry(DeviceExtension->Device, Bus, Target, Lun);
509 DPRINT("PortSendInquiry returned 0x%08lx\n", Status);
510 if (!NT_SUCCESS(Status))
511 break;
512 }
513#endif
514 }
515 }
516
517 DPRINT("PortFdoScanBus() done!\n");
518
519 return STATUS_SUCCESS;
520}
521
522
523static
526 _In_ PFDO_DEVICE_EXTENSION DeviceExtension,
528{
530
531 DPRINT1("PortFdoQueryBusRelations(%p %p)\n",
532 DeviceExtension, Information);
533
534 Status = PortFdoScanBus(DeviceExtension);
535
536 DPRINT1("Units found: %lu\n", DeviceExtension->PdoCount);
537
538 *Information = 0;
539
540 return Status;
541}
542
543
544static
547 PFDO_DEVICE_EXTENSION DeviceExtension,
548 PIRP Irp)
549{
551
552 DPRINT1("PortFdoFilterRequirements(%p %p)\n", DeviceExtension, Irp);
553
554 /* Get the bus number and the slot number */
557 {
558 DeviceExtension->BusNumber = RequirementsList->BusNumber;
559 DeviceExtension->SlotNumber = RequirementsList->SlotNumber;
560 }
561
562 return STATUS_SUCCESS;
563}
564
565
567NTAPI
570 _In_ PIRP Irp)
571{
572 PFDO_DEVICE_EXTENSION DeviceExtension;
573// PIO_STACK_LOCATION Stack;
576
577 DPRINT("PortFdoScsi(%p %p)\n", DeviceObject, Irp);
578
579 DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
580 ASSERT(DeviceExtension);
581 ASSERT(DeviceExtension->ExtensionType == FdoExtension);
582
583// Stack = IoGetCurrentIrpStackLocation(Irp);
584
585
586 Irp->IoStatus.Information = Information;
587 Irp->IoStatus.Status = Status;
589
590 return Status;
591}
592
593
595NTAPI
598 _In_ PIRP Irp)
599{
600 PFDO_DEVICE_EXTENSION DeviceExtension;
604
605 DPRINT1("PortFdoPnp(%p %p)\n",
607
608 DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
609 ASSERT(DeviceExtension);
610 ASSERT(DeviceExtension->ExtensionType == FdoExtension);
611
613
614 switch (Stack->MinorFunction)
615 {
616 case IRP_MN_START_DEVICE: /* 0x00 */
617 DPRINT1("IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
618 Status = PortFdoStartDevice(DeviceExtension, Irp);
619 break;
620
621 case IRP_MN_QUERY_REMOVE_DEVICE: /* 0x01 */
622 DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_REMOVE_DEVICE\n");
623 break;
624
625 case IRP_MN_REMOVE_DEVICE: /* 0x02 */
626 DPRINT1("IRP_MJ_PNP / IRP_MN_REMOVE_DEVICE\n");
627 break;
628
629 case IRP_MN_CANCEL_REMOVE_DEVICE: /* 0x03 */
630 DPRINT1("IRP_MJ_PNP / IRP_MN_CANCEL_REMOVE_DEVICE\n");
631 break;
632
633 case IRP_MN_STOP_DEVICE: /* 0x04 */
634 DPRINT1("IRP_MJ_PNP / IRP_MN_STOP_DEVICE\n");
635 break;
636
637 case IRP_MN_QUERY_STOP_DEVICE: /* 0x05 */
638 DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_STOP_DEVICE\n");
639 break;
640
641 case IRP_MN_CANCEL_STOP_DEVICE: /* 0x06 */
642 DPRINT1("IRP_MJ_PNP / IRP_MN_CANCEL_STOP_DEVICE\n");
643 break;
644
645 case IRP_MN_QUERY_DEVICE_RELATIONS: /* 0x07 */
646 DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS\n");
647 switch (Stack->Parameters.QueryDeviceRelations.Type)
648 {
649 case BusRelations:
650 DPRINT1(" IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n");
651 Status = PortFdoQueryBusRelations(DeviceExtension, &Information);
652 break;
653
654 case RemovalRelations:
655 DPRINT1(" IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations\n");
656 return ForwardIrpAndForget(DeviceExtension->LowerDevice, Irp);
657
658 default:
659 DPRINT1(" IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
660 Stack->Parameters.QueryDeviceRelations.Type);
661 return ForwardIrpAndForget(DeviceExtension->LowerDevice, Irp);
662 }
663 break;
664
666 DPRINT1("IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
667 PortFdoFilterRequirements(DeviceExtension, Irp);
668 return ForwardIrpAndForget(DeviceExtension->LowerDevice, Irp);
669
670 case IRP_MN_QUERY_PNP_DEVICE_STATE: /* 0x14 */
671 DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_PNP_DEVICE_STATE\n");
672 break;
673
674 case IRP_MN_DEVICE_USAGE_NOTIFICATION: /* 0x16 */
675 DPRINT1("IRP_MJ_PNP / IRP_MN_DEVICE_USAGE_NOTIFICATION\n");
676 break;
677
678 case IRP_MN_SURPRISE_REMOVAL: /* 0x17 */
679 DPRINT1("IRP_MJ_PNP / IRP_MN_SURPRISE_REMOVAL\n");
680 break;
681
682 default:
683 DPRINT1("IRP_MJ_PNP / Unknown IOCTL 0x%lx\n", Stack->MinorFunction);
684 return ForwardIrpAndForget(DeviceExtension->LowerDevice, Irp);
685 }
686
687 Irp->IoStatus.Information = Information;
688 Irp->IoStatus.Status = Status;
690
691 return Status;
692}
693
694/* EOF */
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
_In_ PSCSI_REQUEST_BLOCK Srb
Definition: cdrom.h:989
#define IOCTL_SCSI_EXECUTE_IN
Definition: cdrw_hw.h:1451
#define SCSIOP_INQUIRY
Definition: cdrw_hw.h:888
#define SENSE_BUFFER_SIZE
Definition: cdrw_hw.h:1183
#define SCSI_SENSE_ILLEGAL_REQUEST
Definition: cdrw_hw.h:1192
union _CDB * PCDB
#define INQUIRYDATABUFFERSIZE
Definition: cdrw_hw.h:1113
_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
#define STATUS_PENDING
Definition: d3dkmdt.h:43
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
ULONG_PTR KAFFINITY
Definition: compat.h:85
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
struct _SCSI_REQUEST_BLOCK SCSI_REQUEST_BLOCK
#define SRB_FUNCTION_EXECUTE_SCSI
Definition: srb.h:315
#define SRB_STATUS_DATA_OVERRUN
Definition: srb.h:357
#define SRB_STATUS_BAD_SRB_BLOCK_LENGTH
Definition: srb.h:360
#define SRB_STATUS_AUTOSENSE_VALID
Definition: srb.h:387
#define SRB_FLAGS_DATA_IN
Definition: srb.h:400
#define SRB_STATUS_SELECTION_TIMEOUT
Definition: srb.h:350
#define SRB_STATUS_BAD_FUNCTION
Definition: srb.h:364
#define SRB_FLAGS_DISABLE_SYNCH_TRANSFER
Definition: srb.h:397
#define SRB_STATUS(Status)
Definition: srb.h:389
#define SRB_STATUS_QUEUE_FROZEN
Definition: srb.h:386
#define SRB_STATUS_NO_DEVICE
Definition: srb.h:348
#define SRB_STATUS_SUCCESS
Definition: srb.h:341
INTERFACE_TYPE GetBusInterface(PDEVICE_OBJECT DeviceObject)
Definition: misc.c:32
NTSTATUS QueryBusInterface(PDEVICE_OBJECT DeviceObject, PGUID Guid, USHORT Size, USHORT Version, PBUS_INTERFACE_STANDARD Interface, PVOID InterfaceSpecificData)
Definition: misc.c:121
PCM_RESOURCE_LIST CopyResourceList(POOL_TYPE PoolType, PCM_RESOURCE_LIST Source)
Definition: misc.c:91
NTSTATUS GetResourceListInterrupt(PFDO_DEVICE_EXTENSION DeviceExtension, PULONG Vector, PKIRQL Irql, KINTERRUPT_MODE *InterruptMode, PBOOLEAN ShareVector, PKAFFINITY Affinity)
Definition: misc.c:241
PHW_INITIALIZATION_DATA PortGetDriverInitData(PDRIVER_OBJECT_EXTENSION DriverExtension, INTERFACE_TYPE InterfaceType)
Definition: storport.c:78
#define TAG_INQUIRY_DATA
Definition: precomp.h:32
@ PdoExtension
Definition: precomp.h:49
@ FdoExtension
Definition: precomp.h:48
#define TAG_SENSE_DATA
Definition: precomp.h:33
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:50
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define NonPagedPool
Definition: env_spec_w32.h:307
Status
Definition: gdiplustypes.h:25
@ InterfaceTypeUndefined
Definition: hwresource.cpp:136
enum _INTERFACE_TYPE INTERFACE_TYPE
DRIVER_DISPATCH ForwardIrpAndForget
Definition: i8042prt.h:341
@ dsStopped
Definition: isapnp.h:30
@ dsStarted
Definition: isapnp.h:31
if(dx< 0)
Definition: linetemp.h:194
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define KernelMode
Definition: asm.h:34
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
@ NotificationEvent
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define IoCompleteRequest
Definition: irp.c:1240
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:881
BOOLEAN NTAPI IoForwardIrpSynchronously(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1625
#define IoCallDriver
Definition: irp.c:1225
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:23
_In_opt_ WDFREQUEST _In_ ULONG _In_ BOOLEAN _In_ PCDB Cdb
Definition: scratch.h:159
enum _KINTERRUPT_MODE KINTERRUPT_MODE
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
static NTSTATUS PortFdoStartMiniport(_In_ PFDO_DEVICE_EXTENSION DeviceExtension)
Definition: fdo.c:104
static NTSTATUS PortFdoFilterRequirements(PFDO_DEVICE_EXTENSION DeviceExtension, PIRP Irp)
Definition: fdo.c:546
static NTSTATUS PortSendInquiry(_In_ PPDO_DEVICE_EXTENSION PdoExtension)
Definition: fdo.c:256
static NTSTATUS PortFdoScanBus(_In_ PFDO_DEVICE_EXTENSION DeviceExtension)
Definition: fdo.c:460
static NTSTATUS NTAPI PortFdoStartDevice(_In_ PFDO_DEVICE_EXTENSION DeviceExtension, _In_ PIRP Irp)
Definition: fdo.c:176
static NTSTATUS PortFdoQueryBusRelations(_In_ PFDO_DEVICE_EXTENSION DeviceExtension, _Out_ PULONG_PTR Information)
Definition: fdo.c:525
static BOOLEAN NTAPI PortFdoInterruptRoutine(_In_ PKINTERRUPT Interrupt, _In_ PVOID ServiceContext)
Definition: fdo.c:21
NTSTATUS NTAPI PortFdoScsi(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: fdo.c:568
static NTSTATUS PortFdoConnectInterrupt(_In_ PFDO_DEVICE_EXTENSION DeviceExtension)
Definition: fdo.c:38
NTSTATUS NTAPI PortFdoPnp(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: fdo.c:596
NTSTATUS MiniportFindAdapter(_In_ PMINIPORT Miniport)
Definition: miniport.c:285
BOOLEAN MiniportHwInterrupt(_In_ PMINIPORT Miniport)
Definition: miniport.c:353
NTSTATUS MiniportHwInitialize(_In_ PMINIPORT Miniport)
Definition: miniport.c:337
NTSTATUS PortDeletePdo(_In_ PPDO_DEVICE_EXTENSION PdoExtension)
Definition: pdo.c:87
NTSTATUS PortCreatePdo(_In_ PFDO_DEVICE_EXTENSION FdoDeviceExtension, _In_ ULONG Bus, _In_ ULONG Target, _In_ ULONG Lun, _Out_ PPDO_DEVICE_EXTENSION *PdoDeviceExtension)
Definition: pdo.c:19
PDEVICE_OBJECT LowerDevice
Definition: i8042prt.h:130
ULONG BusNumber
Definition: pci.h:88
EXTENSION_TYPE ExtensionType
Definition: precomp.h:92
struct _IO_STACK_LOCATION::@3979::@4001 Scsi
union _IO_STACK_LOCATION::@1580 Parameters
ULONG TimeOutValue
Definition: srb.h:262
UCHAR TargetId
Definition: srb.h:254
PVOID OriginalRequest
Definition: srb.h:266
UCHAR SenseInfoBufferLength
Definition: srb.h:259
PVOID DataBuffer
Definition: srb.h:263
UCHAR PathId
Definition: srb.h:253
UCHAR CdbLength
Definition: srb.h:258
UCHAR Cdb[16]
Definition: srb.h:279
PVOID SenseInfoBuffer
Definition: srb.h:264
UCHAR Function
Definition: srb.h:250
ULONG DataTransferLength
Definition: srb.h:261
ULONG SrbFlags
Definition: srb.h:260
USHORT Length
Definition: srb.h:249
UCHAR SrbStatus
Definition: srb.h:251
UCHAR SenseKey
Definition: cdrw_hw.h:1167
uint32_t * PULONG_PTR
Definition: typedefs.h:65
#define NTAPI
Definition: typedefs.h:36
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_IO_DEVICE_ERROR
Definition: udferr_usr.h:179
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
Definition: cdrw_hw.h:28
struct _CDB::_CDB6INQUIRY CDB6INQUIRY
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID InterfaceType
Definition: wdffdo.h:463
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFINTERRUPT * Interrupt
Definition: wdfinterrupt.h:379
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1049
_In_ WDFIORESREQLIST RequirementsList
Definition: wdfresource.h:65
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:174
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2695
_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_ 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
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID ServiceContext
Definition: iofuncs.h:801
#define IRP_MN_CANCEL_STOP_DEVICE
@ RemovalRelations
Definition: iotypes.h:2155
@ BusRelations
Definition: iotypes.h:2152
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IRP_MN_START_DEVICE
#define IRP_MN_DEVICE_USAGE_NOTIFICATION
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IRP_MN_QUERY_STOP_DEVICE
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define IRP_MN_STOP_DEVICE
struct _IO_RESOURCE_REQUIREMENTS_LIST * PIO_RESOURCE_REQUIREMENTS_LIST
#define IRP_MN_QUERY_REMOVE_DEVICE
@ Executive
Definition: ketypes.h:415