27 DPRINT1(
"PortFdoInterruptRoutine(%p %p)\n",
48 DPRINT1(
"PortFdoConnectInterrupt(%p)\n",
52 if (DeviceExtension->AllocatedResources ==
NULL ||
53 DeviceExtension->TranslatedResources ==
NULL)
68 DPRINT1(
"GetResourceListInterrupt() failed (Status 0x%08lx)\n",
Status);
91 DeviceExtension->InterruptIrql =
Irql;
95 DPRINT1(
"IoConnectInterrupt() failed (Status 0x%08lx)\n",
Status);
111 DPRINT1(
"PortFdoStartDevice(%p)\n", DeviceExtension);
121 if (InitData ==
NULL)
130 DPRINT1(
"MiniportInitialize() failed (Status 0x%08lx)\n",
Status);
138 DPRINT1(
"MiniportFindAdapter() failed (Status 0x%08lx)\n",
Status);
146 DPRINT1(
"PortFdoConnectInterrupt() failed (Status 0x%08lx)\n",
Status);
154 DPRINT1(
"MiniportHwInitialize() failed (Status 0x%08lx)\n",
Status);
159 if (DeviceExtension->HwPassiveInitRoutine !=
NULL)
161 DPRINT1(
"Calling HwPassiveInitRoutine()\n");
162 if (!DeviceExtension->HwPassiveInitRoutine(&DeviceExtension->Miniport.MiniportExtension->HwDeviceExtension))
164 DPRINT1(
"HwPassiveInitRoutine() failed\n");
183 DPRINT1(
"PortFdoStartDevice(%p %p)\n",
184 DeviceExtension,
Irp);
192 if (DeviceExtension->PnpState ==
dsStopped)
205 DPRINT1(
"Lower device failed the IRP (Status 0x%08lx)\n",
Status);
214 if (
Stack->Parameters.StartDevice.AllocatedResources !=
NULL &&
215 Stack->Parameters.StartDevice.AllocatedResourcesTranslated !=
NULL)
218 Stack->Parameters.StartDevice.AllocatedResources);
219 if (DeviceExtension->AllocatedResources ==
NULL)
223 Stack->Parameters.StartDevice.AllocatedResourcesTranslated);
224 if (DeviceExtension->TranslatedResources ==
NULL)
230 (
PGUID)&GUID_BUS_INTERFACE_STANDARD,
233 &DeviceExtension->BusInterface,
238 DPRINT1(
"Context: %p\n", DeviceExtension->BusInterface.Context);
239 DeviceExtension->BusInitialized =
TRUE;
246 DPRINT1(
"FdoStartMiniport() failed (Status 0x%08lx)\n",
Status);
267 ULONG RetryCount = 0;
283 if (SenseBuffer ==
NULL)
307 DPRINT(
"IoBuildDeviceIoControlRequest() failed\n");
350 DPRINT1(
"PortSendInquiry(): Waiting for the driver to process request...\n");
359 DPRINT(
"PortSendInquiry(): Request processed by driver, status = 0x%08X\n",
Status);
363 DPRINT(
"Found a device!\n");
422 if ((RetryCount < 2) &&
451 DPRINT(
"PortSendInquiry() done with Status 0x%08X\n",
Status);
467 DPRINT(
"PortFdoScanBus(%p)\n", DeviceExtension);
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);
474 for (Bus = 0; Bus < DeviceExtension->Miniport.PortConfig.NumberOfBuses; Bus++)
476 DPRINT(
"Scanning bus %ld\n", Bus);
479 for (
Target = 0;
Target < DeviceExtension->Miniport.PortConfig.MaximumNumberOfTargets;
Target++)
483 DPRINT(
" Scanning logical unit %ld:%ld:%ld\n", Bus,
Target, 0);
498 DPRINT(
"ProductRevisionLevel: %.4s\n",
PdoExtension->InquiryBuffer->ProductRevisionLevel);
505 for (
Lun = 1;
Lun < DeviceExtension->Miniport.PortConfig.MaximumNumberOfLogicalUnits;
Lun++)
517 DPRINT(
"PortFdoScanBus() done!\n");
531 DPRINT1(
"PortFdoQueryBusRelations(%p %p)\n",
536 DPRINT1(
"Units found: %lu\n", DeviceExtension->PdoCount);
552 DPRINT1(
"PortFdoFilterRequirements(%p %p)\n", DeviceExtension,
Irp);
614 switch (
Stack->MinorFunction)
617 DPRINT1(
"IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
622 DPRINT1(
"IRP_MJ_PNP / IRP_MN_QUERY_REMOVE_DEVICE\n");
626 DPRINT1(
"IRP_MJ_PNP / IRP_MN_REMOVE_DEVICE\n");
630 DPRINT1(
"IRP_MJ_PNP / IRP_MN_CANCEL_REMOVE_DEVICE\n");
634 DPRINT1(
"IRP_MJ_PNP / IRP_MN_STOP_DEVICE\n");
638 DPRINT1(
"IRP_MJ_PNP / IRP_MN_QUERY_STOP_DEVICE\n");
642 DPRINT1(
"IRP_MJ_PNP / IRP_MN_CANCEL_STOP_DEVICE\n");
646 DPRINT1(
"IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS\n");
647 switch (
Stack->Parameters.QueryDeviceRelations.Type)
650 DPRINT1(
" IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n");
655 DPRINT1(
" IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations\n");
659 DPRINT1(
" IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
660 Stack->Parameters.QueryDeviceRelations.Type);
666 DPRINT1(
"IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
671 DPRINT1(
"IRP_MJ_PNP / IRP_MN_QUERY_PNP_DEVICE_STATE\n");
675 DPRINT1(
"IRP_MJ_PNP / IRP_MN_DEVICE_USAGE_NOTIFICATION\n");
679 DPRINT1(
"IRP_MJ_PNP / IRP_MN_SURPRISE_REMOVAL\n");
683 DPRINT1(
"IRP_MJ_PNP / Unknown IOCTL 0x%lx\n",
Stack->MinorFunction);
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
_In_ PSCSI_REQUEST_BLOCK Srb
#define IOCTL_SCSI_EXECUTE_IN
#define SENSE_BUFFER_SIZE
#define SCSI_SENSE_ILLEGAL_REQUEST
#define INQUIRYDATABUFFERSIZE
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR _In_ UCHAR Lun
#define STATUS_NOT_SUPPORTED
#define NT_SUCCESS(StatCode)
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
struct _SCSI_REQUEST_BLOCK SCSI_REQUEST_BLOCK
#define SRB_FUNCTION_EXECUTE_SCSI
#define SRB_STATUS_DATA_OVERRUN
#define SRB_STATUS_BAD_SRB_BLOCK_LENGTH
#define SRB_STATUS_AUTOSENSE_VALID
#define SRB_FLAGS_DATA_IN
#define SRB_STATUS_SELECTION_TIMEOUT
#define SRB_STATUS_BAD_FUNCTION
#define SRB_FLAGS_DISABLE_SYNCH_TRANSFER
#define SRB_STATUS(Status)
#define SRB_STATUS_QUEUE_FROZEN
#define SRB_STATUS_NO_DEVICE
#define SRB_STATUS_SUCCESS
INTERFACE_TYPE GetBusInterface(PDEVICE_OBJECT DeviceObject)
NTSTATUS QueryBusInterface(PDEVICE_OBJECT DeviceObject, PGUID Guid, USHORT Size, USHORT Version, PBUS_INTERFACE_STANDARD Interface, PVOID InterfaceSpecificData)
PCM_RESOURCE_LIST CopyResourceList(POOL_TYPE PoolType, PCM_RESOURCE_LIST Source)
NTSTATUS GetResourceListInterrupt(PFDO_DEVICE_EXTENSION DeviceExtension, PULONG Vector, PKIRQL Irql, KINTERRUPT_MODE *InterruptMode, PBOOLEAN ShareVector, PKAFFINITY Affinity)
PHW_INITIALIZATION_DATA PortGetDriverInitData(PDRIVER_OBJECT_EXTENSION DriverExtension, INTERFACE_TYPE InterfaceType)
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)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
enum _INTERFACE_TYPE INTERFACE_TYPE
DRIVER_DISPATCH ForwardIrpAndForget
#define ExFreePoolWithTag(_P, _T)
static OUT PIO_STATUS_BLOCK IoStatusBlock
#define IRP_MN_SURPRISE_REMOVAL
#define IoCompleteRequest
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)
BOOLEAN NTAPI IoForwardIrpSynchronously(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
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)
_In_opt_ WDFREQUEST _In_ ULONG _In_ BOOLEAN _In_ PCDB Cdb
enum _KINTERRUPT_MODE KINTERRUPT_MODE
static NTSTATUS PortFdoStartMiniport(_In_ PFDO_DEVICE_EXTENSION DeviceExtension)
static NTSTATUS PortFdoFilterRequirements(PFDO_DEVICE_EXTENSION DeviceExtension, PIRP Irp)
static NTSTATUS PortSendInquiry(_In_ PPDO_DEVICE_EXTENSION PdoExtension)
static NTSTATUS PortFdoScanBus(_In_ PFDO_DEVICE_EXTENSION DeviceExtension)
static NTSTATUS NTAPI PortFdoStartDevice(_In_ PFDO_DEVICE_EXTENSION DeviceExtension, _In_ PIRP Irp)
static NTSTATUS PortFdoQueryBusRelations(_In_ PFDO_DEVICE_EXTENSION DeviceExtension, _Out_ PULONG_PTR Information)
static BOOLEAN NTAPI PortFdoInterruptRoutine(_In_ PKINTERRUPT Interrupt, _In_ PVOID ServiceContext)
NTSTATUS NTAPI PortFdoScsi(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
static NTSTATUS PortFdoConnectInterrupt(_In_ PFDO_DEVICE_EXTENSION DeviceExtension)
NTSTATUS NTAPI PortFdoPnp(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
NTSTATUS MiniportFindAdapter(_In_ PMINIPORT Miniport)
BOOLEAN MiniportHwInterrupt(_In_ PMINIPORT Miniport)
NTSTATUS MiniportHwInitialize(_In_ PMINIPORT Miniport)
NTSTATUS PortDeletePdo(_In_ PPDO_DEVICE_EXTENSION PdoExtension)
NTSTATUS PortCreatePdo(_In_ PFDO_DEVICE_EXTENSION FdoDeviceExtension, _In_ ULONG Bus, _In_ ULONG Target, _In_ ULONG Lun, _Out_ PPDO_DEVICE_EXTENSION *PdoDeviceExtension)
PDEVICE_OBJECT LowerDevice
EXTENSION_TYPE ExtensionType
struct _IO_STACK_LOCATION::@3979::@4001 Scsi
union _IO_STACK_LOCATION::@1580 Parameters
UCHAR SenseInfoBufferLength
#define RtlZeroMemory(Destination, Length)
#define STATUS_IO_DEVICE_ERROR
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_NO_SUCH_DEVICE
#define STATUS_UNSUCCESSFUL
#define STATUS_INSUFFICIENT_RESOURCES
struct _CDB::_CDB6INQUIRY CDB6INQUIRY
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID InterfaceType
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFINTERRUPT * Interrupt
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
_In_ WDFIORESREQLIST RequirementsList
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG _In_ KIRQL _In_ KIRQL _In_ KINTERRUPT_MODE InterruptMode
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG _In_ KIRQL _In_ KIRQL _In_ KINTERRUPT_MODE _In_ BOOLEAN ShareVector
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID ServiceContext
#define IRP_MN_CANCEL_STOP_DEVICE
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#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