ReactOS  0.4.13-dev-259-g5ca9c9c
storport.c File Reference
#include "precomp.h"
#include <debug.h>
Include dependency graph for storport.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static NTSTATUS PortAddDriverInitData (PDRIVER_OBJECT_EXTENSION DriverExtension, PHW_INITIALIZATION_DATA HwInitializationData)
 
static VOID PortDeleteDriverInitData (PDRIVER_OBJECT_EXTENSION DriverExtension)
 
PHW_INITIALIZATION_DATA PortGetDriverInitData (PDRIVER_OBJECT_EXTENSION DriverExtension, INTERFACE_TYPE InterfaceType)
 
static VOID PortAcquireSpinLock (PFDO_DEVICE_EXTENSION DeviceExtension, STOR_SPINLOCK SpinLock, PVOID LockContext, PSTOR_LOCK_HANDLE LockHandle)
 
static VOID PortReleaseSpinLock (PFDO_DEVICE_EXTENSION DeviceExtension, PSTOR_LOCK_HANDLE LockHandle)
 
static NTSTATUS NTAPI PortAddDevice (_In_ PDRIVER_OBJECT DriverObject, _In_ PDEVICE_OBJECT PhysicalDeviceObject)
 
static VOID NTAPI PortUnload (_In_ PDRIVER_OBJECT DriverObject)
 
static NTSTATUS NTAPI PortDispatchCreate (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
static NTSTATUS NTAPI PortDispatchClose (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
static NTSTATUS NTAPI PortDispatchDeviceControl (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
static NTSTATUS NTAPI PortDispatchScsi (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
static NTSTATUS NTAPI PortDispatchSystemControl (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
static NTSTATUS NTAPI PortDispatchPnp (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
static NTSTATUS NTAPI PortDispatchPower (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI DriverEntry (_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath)
 
STORPORT_API PUCHAR NTAPI StorPortAllocateRegistryBuffer (_In_ PVOID HwDeviceExtension, _In_ PULONG Length)
 
STORPORT_API BOOLEAN NTAPI StorPortBusy (_In_ PVOID HwDeviceExtension, _In_ ULONG RequestsToComplete)
 
STORPORT_API VOID NTAPI StorPortCompleteRequest (_In_ PVOID HwDeviceExtension, _In_ UCHAR PathId, _In_ UCHAR TargetId, _In_ UCHAR Lun, _In_ UCHAR SrbStatus)
 
STORPORT_API ULONG NTAPI StorPortConvertPhysicalAddressToUlong (_In_ STOR_PHYSICAL_ADDRESS Address)
 
STORPORT_API STOR_PHYSICAL_ADDRESS NTAPI StorPortConvertUlongToPhysicalAddress (_In_ ULONG_PTR UlongAddress)
 
STORPORT_API VOID StorPortDebugPrint (_In_ ULONG DebugPrintLevel, _In_ PCHAR DebugMessage,...)
 
STORPORT_API BOOLEAN NTAPI StorPortDeviceBusy (_In_ PVOID HwDeviceExtension, _In_ UCHAR PathId, _In_ UCHAR TargetId, _In_ UCHAR Lun, _In_ ULONG RequestsToComplete)
 
STORPORT_API BOOLEAN NTAPI StorPortDeviceReady (_In_ PVOID HwDeviceExtension, _In_ UCHAR PathId, _In_ UCHAR TargetId, _In_ UCHAR Lun)
 
STORPORT_API ULONG StorPortExtendedFunction (_In_ STORPORT_FUNCTION_CODE FunctionCode, _In_ PVOID HwDeviceExtension,...)
 
STORPORT_API VOID NTAPI StorPortFreeDeviceBase (_In_ PVOID HwDeviceExtension, _In_ PVOID MappedAddress)
 
STORPORT_API VOID NTAPI StorPortFreeRegistryBuffer (_In_ PVOID HwDeviceExtension, _In_ PUCHAR Buffer)
 
STORPORT_API ULONG NTAPI StorPortGetBusData (_In_ PVOID DeviceExtension, _In_ ULONG BusDataType, _In_ ULONG SystemIoBusNumber, _In_ ULONG SlotNumber, _Out_ _When_(Length !=0, _Out_writes_bytes_(Length)) PVOID Buffer, _In_ ULONG Length)
 
STORPORT_API PVOID NTAPI StorPortGetDeviceBase (_In_ PVOID HwDeviceExtension, _In_ INTERFACE_TYPE BusType, _In_ ULONG SystemIoBusNumber, _In_ STOR_PHYSICAL_ADDRESS IoAddress, _In_ ULONG NumberOfBytes, _In_ BOOLEAN InIoSpace)
 
STORPORT_API PVOID NTAPI StorPortGetLogicalUnit (_In_ PVOID HwDeviceExtension, _In_ UCHAR PathId, _In_ UCHAR TargetId, _In_ UCHAR Lun)
 
STORPORT_API STOR_PHYSICAL_ADDRESS NTAPI StorPortGetPhysicalAddress (_In_ PVOID HwDeviceExtension, _In_opt_ PSCSI_REQUEST_BLOCK Srb, _In_ PVOID VirtualAddress, _Out_ ULONG *Length)
 
STORPORT_API PSTOR_SCATTER_GATHER_LIST NTAPI StorPortGetScatterGatherList (_In_ PVOID DeviceExtension, _In_ PSCSI_REQUEST_BLOCK Srb)
 
STORPORT_API PSCSI_REQUEST_BLOCK NTAPI StorPortGetSrb (_In_ PVOID DeviceExtension, _In_ UCHAR PathId, _In_ UCHAR TargetId, _In_ UCHAR Lun, _In_ LONG QueueTag)
 
STORPORT_API PVOID NTAPI StorPortGetUncachedExtension (_In_ PVOID HwDeviceExtension, _In_ PPORT_CONFIGURATION_INFORMATION ConfigInfo, _In_ ULONG NumberOfBytes)
 
STORPORT_API PVOID NTAPI StorPortGetVirtualAddress (_In_ PVOID HwDeviceExtension, _In_ STOR_PHYSICAL_ADDRESS PhysicalAddress)
 
STORPORT_API ULONG NTAPI StorPortInitialize (_In_ PVOID Argument1, _In_ PVOID Argument2, _In_ struct _HW_INITIALIZATION_DATA *HwInitializationData, _In_opt_ PVOID HwContext)
 
STORPORT_API VOID NTAPI StorPortLogError (_In_ PVOID HwDeviceExtension, _In_opt_ PSCSI_REQUEST_BLOCK Srb, _In_ UCHAR PathId, _In_ UCHAR TargetId, _In_ UCHAR Lun, _In_ ULONG ErrorCode, _In_ ULONG UniqueId)
 
STORPORT_API VOID NTAPI StorPortMoveMemory (_Out_writes_bytes_(Length) PVOID Destination, _In_reads_bytes_(Length) PVOID Source, _In_ ULONG Length)
 
STORPORT_API VOID StorPortNotification (_In_ SCSI_NOTIFICATION_TYPE NotificationType, _In_ PVOID HwDeviceExtension,...)
 
STORPORT_API BOOLEAN NTAPI StorPortPause (_In_ PVOID HwDeviceExtension, _In_ ULONG TimeOut)
 
STORPORT_API BOOLEAN NTAPI StorPortPauseDevice (_In_ PVOID HwDeviceExtension, _In_ UCHAR PathId, _In_ UCHAR TargetId, _In_ UCHAR Lun, _In_ ULONG TimeOut)
 
STORPORT_API BOOLEAN NTAPI StorPortReady (_In_ PVOID HwDeviceExtension)
 
STORPORT_API BOOLEAN NTAPI StorPortRegistryRead (_In_ PVOID HwDeviceExtension, _In_ PUCHAR ValueName, _In_ ULONG Global, _In_ ULONG Type, _In_ PUCHAR Buffer, _In_ PULONG BufferLength)
 
STORPORT_API BOOLEAN NTAPI StorPortRegistryWrite (_In_ PVOID HwDeviceExtension, _In_ PUCHAR ValueName, _In_ ULONG Global, _In_ ULONG Type, _In_ PUCHAR Buffer, _In_ ULONG BufferLength)
 
STORPORT_API BOOLEAN NTAPI StorPortResume (_In_ PVOID HwDeviceExtension)
 
STORPORT_API BOOLEAN NTAPI StorPortResumeDevice (_In_ PVOID HwDeviceExtension, _In_ UCHAR PathId, _In_ UCHAR TargetId, _In_ UCHAR Lun)
 
STORPORT_API ULONG NTAPI StorPortSetBusDataByOffset (_In_ PVOID DeviceExtension, _In_ ULONG BusDataType, _In_ ULONG SystemIoBusNumber, _In_ ULONG SlotNumber, _In_reads_bytes_(Length) PVOID Buffer, _In_ ULONG Offset, _In_ ULONG Length)
 
STORPORT_API BOOLEAN NTAPI StorPortSetDeviceQueueDepth (_In_ PVOID HwDeviceExtension, _In_ UCHAR PathId, _In_ UCHAR TargetId, _In_ UCHAR Lun, _In_ ULONG Depth)
 
STORPORT_API VOID NTAPI StorPortStallExecution (_In_ ULONG Delay)
 
STORPORT_API VOID NTAPI StorPortSynchronizeAccess (_In_ PVOID HwDeviceExtension, _In_ PSTOR_SYNCHRONIZED_ACCESS SynchronizedAccessRoutine, _In_opt_ PVOID Context)
 
STORPORT_API BOOLEAN NTAPI StorPortValidateRange (_In_ PVOID HwDeviceExtension, _In_ INTERFACE_TYPE BusType, _In_ ULONG SystemIoBusNumber, _In_ STOR_PHYSICAL_ADDRESS IoAddress, _In_ ULONG NumberOfBytes, _In_ BOOLEAN InIoSpace)
 

Variables

ULONG PortNumber = 0
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file storport.c.

Function Documentation

◆ DriverEntry()

NTSTATUS NTAPI DriverEntry ( _In_ PDRIVER_OBJECT  DriverObject,
_In_ PUNICODE_STRING  RegistryPath 
)

Definition at line 454 of file storport.c.

457 {
458  DPRINT1("DriverEntry(%p %p)\n", DriverObject, RegistryPath);
459  return STATUS_SUCCESS;
460 }
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
#define DPRINT1
Definition: precomp.h:8
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:27
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by PortAddDevice(), PortUnload(), and StorPortInitialize().

◆ PortAcquireSpinLock()

static VOID PortAcquireSpinLock ( PFDO_DEVICE_EXTENSION  DeviceExtension,
STOR_SPINLOCK  SpinLock,
PVOID  LockContext,
PSTOR_LOCK_HANDLE  LockHandle 
)
static

Definition at line 105 of file storport.c.

110 {
111  DPRINT1("PortAcquireSpinLock(%p %lu %p %p)\n",
112  DeviceExtension, SpinLock, LockContext, LockHandle);
113 
114  LockHandle->Lock = SpinLock;
115 
116  switch (SpinLock)
117  {
118  case DpcLock: /* 1, */
119  DPRINT1("DpcLock\n");
120  break;
121 
122  case StartIoLock: /* 2 */
123  DPRINT1("StartIoLock\n");
124  break;
125 
126  case InterruptLock: /* 3 */
127  DPRINT1("InterruptLock\n");
128  if (DeviceExtension->Interrupt == NULL)
129  LockHandle->Context.OldIrql = 0;
130  else
131  LockHandle->Context.OldIrql = KeAcquireInterruptSpinLock(DeviceExtension->Interrupt);
132  break;
133  }
134 }
PKINTERRUPT Interrupt
Definition: parport.h:51
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
smooth NULL
Definition: ftsmooth.c:416
KIRQL NTAPI KeAcquireInterruptSpinLock(IN PKINTERRUPT Interrupt)
Definition: spinlock.c:148
#define DPRINT1
Definition: precomp.h:8
*LockHandle LockHandle _Out_ PKLOCK_QUEUE_HANDLE LockHandle
Definition: kefuncs.h:742

Referenced by StorPortNotification().

◆ PortAddDevice()

static NTSTATUS NTAPI PortAddDevice ( _In_ PDRIVER_OBJECT  DriverObject,
_In_ PDEVICE_OBJECT  PhysicalDeviceObject 
)
static

Definition at line 169 of file storport.c.

172 {
173  PDRIVER_OBJECT_EXTENSION DriverObjectExtension;
174  PFDO_DEVICE_EXTENSION DeviceExtension = NULL;
175  WCHAR NameBuffer[80];
177  PDEVICE_OBJECT Fdo = NULL;
180 
181  DPRINT1("PortAddDevice(%p %p)\n",
183 
186 
187  swprintf(NameBuffer,
188  L"\\Device\\RaidPort%lu",
189  PortNumber);
190  RtlInitUnicodeString(&DeviceName, NameBuffer);
191  PortNumber++;
192 
193  DPRINT1("Creating device: %wZ\n", &DeviceName);
194 
195  /* Create the port device */
197  sizeof(FDO_DEVICE_EXTENSION),
198  &DeviceName,
201  FALSE,
202  &Fdo);
203  if (!NT_SUCCESS(Status))
204  {
205  DPRINT1("IoCreateDevice() failed (Status 0x%08lx)\n", Status);
206  return Status;
207  }
208 
209  DPRINT1("Created device: %wZ (%p)\n", &DeviceName, Fdo);
210 
211  /* Initialize the device */
212  Fdo->Flags |= DO_DIRECT_IO;
213  Fdo->Flags |= DO_POWER_PAGABLE;
214 
215  /* Initialize the device extension */
216  DeviceExtension = (PFDO_DEVICE_EXTENSION)Fdo->DeviceExtension;
217  RtlZeroMemory(DeviceExtension, sizeof(FDO_DEVICE_EXTENSION));
218 
219  DeviceExtension->ExtensionType = FdoExtension;
220 
221  DeviceExtension->Device = Fdo;
222  DeviceExtension->PhysicalDevice = PhysicalDeviceObject;
223 
224  DeviceExtension->PnpState = dsStopped;
225 
226  /* Attach the FDO to the device stack */
229  &DeviceExtension->LowerDevice);
230  if (!NT_SUCCESS(Status))
231  {
232  DPRINT1("IoAttachDeviceToDeviceStackSafe() failed (Status 0x%08lx)\n", Status);
233  IoDeleteDevice(Fdo);
234  return Status;
235  }
236 
237  /* Insert the FDO to the drivers FDO list */
238  DriverObjectExtension = IoGetDriverObjectExtension(DriverObject,
239  (PVOID)DriverEntry);
240  ASSERT(DriverObjectExtension->ExtensionType == DriverExtension);
241 
242  DeviceExtension->DriverExtension = DriverObjectExtension;
243 
244  KeAcquireInStackQueuedSpinLock(&DriverObjectExtension->AdapterListLock,
245  &LockHandle);
246 
247  InsertHeadList(&DriverObjectExtension->AdapterListHead,
248  &DeviceExtension->AdapterListEntry);
249  DriverObjectExtension->AdapterCount++;
250 
252 
253  /* The device has been initialized */
254  Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
255 
256  DPRINT1("PortAddDevice() done (Status 0x%08lx)\n", Status);
257 
258  return Status;
259 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define DO_POWER_PAGABLE
PDEVICE_OBJECT Device
Definition: precomp.h:88
FORCEINLINE VOID InsertHeadList(_Inout_ PLIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PLIST_ENTRY Entry)
Definition: rtlfuncs.h:201
LONG NTSTATUS
Definition: precomp.h:26
EXTENSION_TYPE ExtensionType
Definition: precomp.h:86
WCHAR DeviceName[]
Definition: adapter.cpp:21
VOID FASTCALL KeAcquireInStackQueuedSpinLock(IN PKSPIN_LOCK SpinLock, IN PKLOCK_QUEUE_HANDLE LockHandle)
Definition: spinlock.c:130
EXTENSION_TYPE ExtensionType
Definition: precomp.h:60
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
LIST_ENTRY AdapterListEntry
Definition: precomp.h:93
#define FILE_DEVICE_CONTROLLER
Definition: winioctl.h:109
ULONG PortNumber
Definition: storport.c:18
PVOID DeviceExtension
Definition: env_spec_w32.h:418
smooth NULL
Definition: ftsmooth.c:416
PDRIVER_OBJECT_EXTENSION DriverExtension
Definition: precomp.h:91
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
KSPIN_LOCK AdapterListLock
Definition: precomp.h:63
VOID FASTCALL KeReleaseInStackQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle)
Definition: spinlock.c:166
__wchar_t WCHAR
Definition: xmlstorage.h:180
NTSTATUS NTAPI IoAttachDeviceToDeviceStackSafe(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice, IN OUT PDEVICE_OBJECT *AttachedToDeviceObject)
Definition: device.c:980
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define swprintf(buf, format,...)
Definition: sprintf.c:56
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
PDEVICE_OBJECT PhysicalDevice
Definition: precomp.h:90
static const WCHAR L[]
Definition: oid.c:1250
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1842
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:41
Status
Definition: gdiplustypes.h:24
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1250
LIST_ENTRY AdapterListHead
Definition: precomp.h:64
#define DPRINT1
Definition: precomp.h:8
DEVICE_STATE PnpState
Definition: i8042prt.h:132
NTSTATUS NTAPI DriverEntry(_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath)
Definition: storport.c:454
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
*LockHandle LockHandle _Out_ PKLOCK_QUEUE_HANDLE LockHandle
Definition: kefuncs.h:742
PDEVICE_OBJECT LowerDevice
Definition: i8042prt.h:130

Referenced by StorPortInitialize().

◆ PortAddDriverInitData()

static NTSTATUS PortAddDriverInitData ( PDRIVER_OBJECT_EXTENSION  DriverExtension,
PHW_INITIALIZATION_DATA  HwInitializationData 
)
static

Definition at line 25 of file storport.c.

28 {
29  PDRIVER_INIT_DATA InitData;
30 
31  DPRINT1("PortAddDriverInitData()\n");
32 
34  sizeof(DRIVER_INIT_DATA),
36  if (InitData == NULL)
37  return STATUS_NO_MEMORY;
38 
39  RtlCopyMemory(&InitData->HwInitData,
41  sizeof(HW_INITIALIZATION_DATA));
42 
43  InsertHeadList(&DriverExtension->InitDataListHead,
44  &InitData->Entry);
45 
46  return STATUS_SUCCESS;
47 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
FORCEINLINE VOID InsertHeadList(_Inout_ PLIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PLIST_ENTRY Entry)
Definition: rtlfuncs.h:201
#define TAG_INIT_DATA
Definition: precomp.h:27
smooth NULL
Definition: ftsmooth.c:416
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:41
LIST_ENTRY Entry
Definition: precomp.h:54
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
#define DPRINT1
Definition: precomp.h:8
return STATUS_SUCCESS
Definition: btrfs.c:2745
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA * HwInitializationData
Definition: srb.h:664
HW_INITIALIZATION_DATA HwInitData
Definition: precomp.h:55

Referenced by StorPortInitialize().

◆ PortDeleteDriverInitData()

static VOID PortDeleteDriverInitData ( PDRIVER_OBJECT_EXTENSION  DriverExtension)
static

Definition at line 52 of file storport.c.

54 {
55  PDRIVER_INIT_DATA InitData;
56  PLIST_ENTRY ListEntry;
57 
58  DPRINT1("PortDeleteDriverInitData()\n");
59 
60  ListEntry = DriverExtension->InitDataListHead.Flink;
61  while (ListEntry != &DriverExtension->InitDataListHead)
62  {
63  InitData = CONTAINING_RECORD(ListEntry,
65  Entry);
66 
67  RemoveEntryList(&InitData->Entry);
68 
69  ExFreePoolWithTag(InitData,
71 
72  ListEntry = DriverExtension->InitDataListHead.Flink;
73  }
74 }
#define TAG_INIT_DATA
Definition: precomp.h:27
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
Definition: typedefs.h:117
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:41
LIST_ENTRY Entry
Definition: precomp.h:54
#define DPRINT1
Definition: precomp.h:8
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
base of all file and directory entries
Definition: entries.h:82

Referenced by PortUnload().

◆ PortDispatchClose()

static NTSTATUS NTAPI PortDispatchClose ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)
static

Definition at line 304 of file storport.c.

307 {
308  DPRINT1("PortDispatchClose(%p %p)\n",
309  DeviceObject, Irp);
310 
311  Irp->IoStatus.Status = STATUS_SUCCESS;
312  Irp->IoStatus.Information = 0;
313 
315 
316  return STATUS_SUCCESS;
317 }
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define DPRINT1
Definition: precomp.h:8
#define IO_NO_INCREMENT
Definition: iotypes.h:565
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by StorPortInitialize().

◆ PortDispatchCreate()

static NTSTATUS NTAPI PortDispatchCreate ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)
static

Definition at line 285 of file storport.c.

288 {
289  DPRINT1("PortDispatchCreate(%p %p)\n",
290  DeviceObject, Irp);
291 
292  Irp->IoStatus.Status = STATUS_SUCCESS;
293  Irp->IoStatus.Information = FILE_OPENED;
294 
296 
297  return STATUS_SUCCESS;
298 }
_In_ PIRP Irp
Definition: csq.h:116
#define FILE_OPENED
Definition: nt_native.h:769
#define IoCompleteRequest
Definition: irp.c:1240
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define DPRINT1
Definition: precomp.h:8
#define IO_NO_INCREMENT
Definition: iotypes.h:565
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by StorPortInitialize().

◆ PortDispatchDeviceControl()

static NTSTATUS NTAPI PortDispatchDeviceControl ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)
static

Definition at line 323 of file storport.c.

326 {
327  DPRINT1("PortDispatchDeviceControl(%p %p)\n",
328  DeviceObject, Irp);
329 
330  Irp->IoStatus.Status = STATUS_SUCCESS;
331  Irp->IoStatus.Information = 0;
332 
334 
335  return STATUS_SUCCESS;
336 }
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define DPRINT1
Definition: precomp.h:8
#define IO_NO_INCREMENT
Definition: iotypes.h:565
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by StorPortInitialize().

◆ PortDispatchPnp()

static NTSTATUS NTAPI PortDispatchPnp ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)
static

Definition at line 397 of file storport.c.

400 {
401  PFDO_DEVICE_EXTENSION DeviceExtension;
402 
403  DPRINT1("PortDispatchPnp(%p %p)\n",
404  DeviceObject, Irp);
405 
407  DPRINT1("ExtensionType: %u\n", DeviceExtension->ExtensionType);
408 
409  switch (DeviceExtension->ExtensionType)
410  {
411  case FdoExtension:
412  return PortFdoPnp(DeviceObject,
413  Irp);
414 
415  case PdoExtension:
416  return PortPdoPnp(DeviceObject,
417  Irp);
418 
419  default:
420  Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
421  Irp->IoStatus.Information = 0;
423  return STATUS_UNSUCCESSFUL;
424  }
425 }
_In_ PIRP Irp
Definition: csq.h:116
NTSTATUS NTAPI PortPdoPnp(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: pdo.c:35
EXTENSION_TYPE ExtensionType
Definition: precomp.h:86
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
PVOID DeviceExtension
Definition: env_spec_w32.h:418
#define IoCompleteRequest
Definition: irp.c:1240
NTSTATUS NTAPI PortFdoPnp(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: fdo.c:601
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define DPRINT1
Definition: precomp.h:8
#define IO_NO_INCREMENT
Definition: iotypes.h:565

Referenced by StorPortInitialize().

◆ PortDispatchPower()

static NTSTATUS NTAPI PortDispatchPower ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)
static

Definition at line 431 of file storport.c.

434 {
435  DPRINT1("PortDispatchPower(%p %p)\n",
436  DeviceObject, Irp);
437 
438  Irp->IoStatus.Status = STATUS_SUCCESS;
439  Irp->IoStatus.Information = 0;
440 
442 
443  return STATUS_SUCCESS;
444 }
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define DPRINT1
Definition: precomp.h:8
#define IO_NO_INCREMENT
Definition: iotypes.h:565
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by StorPortInitialize().

◆ PortDispatchScsi()

static NTSTATUS NTAPI PortDispatchScsi ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)
static

Definition at line 342 of file storport.c.

345 {
346  PFDO_DEVICE_EXTENSION DeviceExtension;
347 
348  DPRINT1("PortDispatchScsi(%p %p)\n",
349  DeviceObject, Irp);
350 
352  DPRINT1("ExtensionType: %u\n", DeviceExtension->ExtensionType);
353 
354  switch (DeviceExtension->ExtensionType)
355  {
356  case FdoExtension:
357  return PortFdoScsi(DeviceObject,
358  Irp);
359 
360  case PdoExtension:
361  return PortPdoScsi(DeviceObject,
362  Irp);
363 
364  default:
365  Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
366  Irp->IoStatus.Information = 0;
368  return STATUS_UNSUCCESSFUL;
369  }
370 
371  return STATUS_SUCCESS;
372 }
NTSTATUS NTAPI PortFdoScsi(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: fdo.c:572
_In_ PIRP Irp
Definition: csq.h:116
EXTENSION_TYPE ExtensionType
Definition: precomp.h:86
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
PVOID DeviceExtension
Definition: env_spec_w32.h:418
#define IoCompleteRequest
Definition: irp.c:1240
NTSTATUS NTAPI PortPdoScsi(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
Definition: pdo.c:20
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define DPRINT1
Definition: precomp.h:8
#define IO_NO_INCREMENT
Definition: iotypes.h:565
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by StorPortInitialize().

◆ PortDispatchSystemControl()

static NTSTATUS NTAPI PortDispatchSystemControl ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)
static

Definition at line 378 of file storport.c.

381 {
382  DPRINT1("PortDispatchSystemControl(%p %p)\n",
383  DeviceObject, Irp);
384 
385  Irp->IoStatus.Status = STATUS_SUCCESS;
386  Irp->IoStatus.Information = 0;
387 
389 
390  return STATUS_SUCCESS;
391 }
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define DPRINT1
Definition: precomp.h:8
#define IO_NO_INCREMENT
Definition: iotypes.h:565
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by StorPortInitialize().

◆ PortGetDriverInitData()

PHW_INITIALIZATION_DATA PortGetDriverInitData ( PDRIVER_OBJECT_EXTENSION  DriverExtension,
INTERFACE_TYPE  InterfaceType 
)

Definition at line 78 of file storport.c.

81 {
82  PDRIVER_INIT_DATA InitData;
83  PLIST_ENTRY ListEntry;
84 
85  DPRINT1("PortGetDriverInitData()\n");
86 
87  ListEntry = DriverExtension->InitDataListHead.Flink;
88  while (ListEntry != &DriverExtension->InitDataListHead)
89  {
90  InitData = CONTAINING_RECORD(ListEntry,
92  Entry);
93  if (InitData->HwInitData.AdapterInterfaceType == InterfaceType)
94  return &InitData->HwInitData;
95 
96  ListEntry = ListEntry->Flink;
97  }
98 
99  return NULL;
100 }
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
Definition: typedefs.h:117
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:41
#define DPRINT1
Definition: precomp.h:8
INTERFACE_TYPE AdapterInterfaceType
Definition: srb.h:557
base of all file and directory entries
Definition: entries.h:82
HW_INITIALIZATION_DATA HwInitData
Definition: precomp.h:55

Referenced by PortFdoStartMiniport().

◆ PortReleaseSpinLock()

static VOID PortReleaseSpinLock ( PFDO_DEVICE_EXTENSION  DeviceExtension,
PSTOR_LOCK_HANDLE  LockHandle 
)
static

Definition at line 139 of file storport.c.

142 {
143  DPRINT1("PortReleaseSpinLock(%p %p)\n",
144  DeviceExtension, LockHandle);
145 
146  switch (LockHandle->Lock)
147  {
148  case DpcLock: /* 1, */
149  DPRINT1("DpcLock\n");
150  break;
151 
152  case StartIoLock: /* 2 */
153  DPRINT1("StartIoLock\n");
154  break;
155 
156  case InterruptLock: /* 3 */
157  DPRINT1("InterruptLock\n");
158  if (DeviceExtension->Interrupt != NULL)
159  KeReleaseInterruptSpinLock(DeviceExtension->Interrupt,
160  LockHandle->Context.OldIrql);
161  break;
162  }
163 }
PKINTERRUPT Interrupt
Definition: parport.h:51
VOID NTAPI KeReleaseInterruptSpinLock(IN PKINTERRUPT Interrupt, IN KIRQL OldIrql)
Definition: spinlock.c:165
smooth NULL
Definition: ftsmooth.c:416
#define DPRINT1
Definition: precomp.h:8
*LockHandle LockHandle _Out_ PKLOCK_QUEUE_HANDLE LockHandle
Definition: kefuncs.h:742

Referenced by StorPortNotification().

◆ PortUnload()

static VOID NTAPI PortUnload ( _In_ PDRIVER_OBJECT  DriverObject)
static

Definition at line 265 of file storport.c.

267 {
269 
270  DPRINT1("PortUnload(%p)\n",
271  DriverObject);
272 
274  (PVOID)DriverEntry);
275  if (DriverExtension != NULL)
276  {
278  }
279 }
static VOID PortDeleteDriverInitData(PDRIVER_OBJECT_EXTENSION DriverExtension)
Definition: storport.c:52
smooth NULL
Definition: ftsmooth.c:416
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1842
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:41
#define DPRINT1
Definition: precomp.h:8
NTSTATUS NTAPI DriverEntry(_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath)
Definition: storport.c:454

Referenced by StorPortInitialize().

◆ StorPortAllocateRegistryBuffer()

STORPORT_API PUCHAR NTAPI StorPortAllocateRegistryBuffer ( _In_ PVOID  HwDeviceExtension,
_In_ PULONG  Length 
)

Definition at line 469 of file storport.c.

472 {
473  DPRINT1("StorPortAllocateRegistryBuffer()\n");
475  return NULL;
476 }
smooth NULL
Definition: ftsmooth.c:416
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:114

◆ StorPortBusy()

STORPORT_API BOOLEAN NTAPI StorPortBusy ( _In_ PVOID  HwDeviceExtension,
_In_ ULONG  RequestsToComplete 
)

Definition at line 485 of file storport.c.

488 {
489  DPRINT1("StorPortBuzy()\n");
491  return FALSE;
492 }
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:114

◆ StorPortCompleteRequest()

STORPORT_API VOID NTAPI StorPortCompleteRequest ( _In_ PVOID  HwDeviceExtension,
_In_ UCHAR  PathId,
_In_ UCHAR  TargetId,
_In_ UCHAR  Lun,
_In_ UCHAR  SrbStatus 
)

Definition at line 501 of file storport.c.

507 {
508  DPRINT1("StorPortCompleteRequest()\n");
510 }
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:114

◆ StorPortConvertPhysicalAddressToUlong()

STORPORT_API ULONG NTAPI StorPortConvertPhysicalAddressToUlong ( _In_ STOR_PHYSICAL_ADDRESS  Address)

Definition at line 519 of file storport.c.

521 {
522  DPRINT1("StorPortConvertPhysicalAddressToUlong()\n");
523 
524  return Address.u.LowPart;
525 }
static WCHAR Address[46]
Definition: ping.c:68
#define DPRINT1
Definition: precomp.h:8

◆ StorPortConvertUlongToPhysicalAddress()

STORPORT_API STOR_PHYSICAL_ADDRESS NTAPI StorPortConvertUlongToPhysicalAddress ( _In_ ULONG_PTR  UlongAddress)

Definition at line 534 of file storport.c.

536 {
538 
539  DPRINT1("StorPortConvertUlongToPhysicalAddress()\n");
540 
541  Address.QuadPart = UlongAddress;
542  return Address;
543 }
static WCHAR Address[46]
Definition: ping.c:68
#define DPRINT1
Definition: precomp.h:8

◆ StorPortDebugPrint()

STORPORT_API VOID StorPortDebugPrint ( _In_ ULONG  DebugPrintLevel,
_In_ PCHAR  DebugMessage,
  ... 
)

Definition at line 551 of file storport.c.

555 {
556  va_list ap;
557 
558  va_start(ap, DebugMessage);
559  vDbgPrintExWithPrefix("STORMINI: ", 0x58, DebugPrintLevel, DebugMessage, ap);
560  va_end(ap);
561 }
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
#define va_start(ap, A)
Definition: acmsvcex.h:91
NTSYSAPI NTSTATUS WINAPI vDbgPrintExWithPrefix(LPCSTR, ULONG, ULONG, LPCSTR, __ms_va_list)
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32

◆ StorPortDeviceBusy()

STORPORT_API BOOLEAN NTAPI StorPortDeviceBusy ( _In_ PVOID  HwDeviceExtension,
_In_ UCHAR  PathId,
_In_ UCHAR  TargetId,
_In_ UCHAR  Lun,
_In_ ULONG  RequestsToComplete 
)

Definition at line 570 of file storport.c.

576 {
577  DPRINT1("StorPortDeviceBusy()\n");
579  return FALSE;
580 }
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:114

◆ StorPortDeviceReady()

STORPORT_API BOOLEAN NTAPI StorPortDeviceReady ( _In_ PVOID  HwDeviceExtension,
_In_ UCHAR  PathId,
_In_ UCHAR  TargetId,
_In_ UCHAR  Lun 
)

Definition at line 589 of file storport.c.

594 {
595  DPRINT1("StorPortDeviceReady()\n");
597  return FALSE;
598 }
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:114

◆ StorPortExtendedFunction()

◆ StorPortFreeDeviceBase()

STORPORT_API VOID NTAPI StorPortFreeDeviceBase ( _In_ PVOID  HwDeviceExtension,
_In_ PVOID  MappedAddress 
)

Definition at line 624 of file storport.c.

627 {
628  DPRINT1("StorPortFreeDeviceBase(%p %p)\n",
629  HwDeviceExtension, MappedAddress);
630 }
#define DPRINT1
Definition: precomp.h:8

◆ StorPortFreeRegistryBuffer()

STORPORT_API VOID NTAPI StorPortFreeRegistryBuffer ( _In_ PVOID  HwDeviceExtension,
_In_ PUCHAR  Buffer 
)

Definition at line 639 of file storport.c.

642 {
643  DPRINT1("StorPortFreeRegistryBuffer()\n");
645 }
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:114

◆ StorPortGetBusData()

STORPORT_API ULONG NTAPI StorPortGetBusData ( _In_ PVOID  DeviceExtension,
_In_ ULONG  BusDataType,
_In_ ULONG  SystemIoBusNumber,
_In_ ULONG  SlotNumber,
_Out_ _When_(Length !=0, _Out_writes_bytes_(Length)) PVOID  Buffer,
_In_ ULONG  Length 
)

Definition at line 654 of file storport.c.

661 {
662  PMINIPORT_DEVICE_EXTENSION MiniportExtension;
665 
666  DPRINT1("StorPortGetBusData(%p %lu %lu %lu %p %lu)\n",
667  DeviceExtension, BusDataType, SystemIoBusNumber, SlotNumber, Buffer, Length);
668 
669  /* Get the miniport extension */
670  MiniportExtension = CONTAINING_RECORD(DeviceExtension,
672  HwDeviceExtension);
673  DPRINT1("DeviceExtension %p MiniportExtension %p\n",
674  DeviceExtension, MiniportExtension);
675 
676  Interface = &MiniportExtension->Miniport->DeviceExtension->BusInterface;
677 
678  if (BusDataType == 4)
679  BusDataType = 0;
680 
681  ReturnLength = Interface->GetBusData(Interface->Context,
682  BusDataType,
683  Buffer,
684  0,
685  Length);
686  DPRINT1("ReturnLength: %lu\n", ReturnLength);
687 
688  return ReturnLength;
689 }
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
Definition: bufpool.h:45
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:359
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
struct _MINIPORT * Miniport
Definition: precomp.h:72
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG _In_ ULONG SlotNumber
Definition: halfuncs.h:156
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1

Referenced by AhciHwFindAdapter().

◆ StorPortGetDeviceBase()

STORPORT_API PVOID NTAPI StorPortGetDeviceBase ( _In_ PVOID  HwDeviceExtension,
_In_ INTERFACE_TYPE  BusType,
_In_ ULONG  SystemIoBusNumber,
_In_ STOR_PHYSICAL_ADDRESS  IoAddress,
_In_ ULONG  NumberOfBytes,
_In_ BOOLEAN  InIoSpace 
)

Definition at line 698 of file storport.c.

705 {
706  PMINIPORT_DEVICE_EXTENSION MiniportExtension;
708  PVOID MappedAddress;
710 
711  DPRINT1("StorPortGetDeviceBase(%p %lu %lu 0x%I64x %lu %u)\n",
712  HwDeviceExtension, BusType, SystemIoBusNumber, IoAddress.QuadPart, NumberOfBytes, InIoSpace);
713 
714  /* Get the miniport extension */
715  MiniportExtension = CONTAINING_RECORD(HwDeviceExtension,
717  HwDeviceExtension);
718  DPRINT1("HwDeviceExtension %p MiniportExtension %p\n",
719  HwDeviceExtension, MiniportExtension);
720 
721  if (!TranslateResourceListAddress(MiniportExtension->Miniport->DeviceExtension,
722  BusType,
723  SystemIoBusNumber,
724  IoAddress,
726  InIoSpace,
728  {
729  DPRINT1("Checkpoint!\n");
730  return NULL;
731  }
732 
733  DPRINT1("Translated Address: 0x%I64x\n", TranslatedAddress.QuadPart);
734 
735  /* In I/O space */
736  if (InIoSpace)
737  {
738  DPRINT1("Translated Address: %p\n", (PVOID)(ULONG_PTR)TranslatedAddress.QuadPart);
740  }
741 
742  /* In memory space */
743  MappedAddress = MmMapIoSpace(TranslatedAddress,
745  FALSE);
746  DPRINT1("Mapped Address: %p\n", MappedAddress);
747 
748  Status = AllocateAddressMapping(&MiniportExtension->Miniport->DeviceExtension->MappedAddressList,
749  IoAddress,
750  MappedAddress,
752  SystemIoBusNumber);
753  if (!NT_SUCCESS(Status))
754  {
755  DPRINT1("Checkpoint!\n");
756  MappedAddress = NULL;
757  }
758 
759  DPRINT1("Mapped Address: %p\n", MappedAddress);
760  return MappedAddress;
761 }
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE BusType
Definition: halfuncs.h:156
LONG NTSTATUS
Definition: precomp.h:26
PVOID NTAPI MmMapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Definition: iosup.c:47
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2268
NTSTATUS AllocateAddressMapping(PMAPPED_ADDRESS *MappedAddressList, STOR_PHYSICAL_ADDRESS IoAddress, PVOID MappedAddress, ULONG NumberOfBytes, ULONG BusNumber)
Definition: misc.c:340
uint32_t ULONG_PTR
Definition: typedefs.h:63
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:222
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct _MINIPORT * Miniport
Definition: precomp.h:72
Status
Definition: gdiplustypes.h:24
#define DPRINT1
Definition: precomp.h:8
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:997
#define ULONG_PTR
Definition: config.h:101
LONGLONG QuadPart
Definition: typedefs.h:112

Referenced by AhciHwFindAdapter().

◆ StorPortGetLogicalUnit()

STORPORT_API PVOID NTAPI StorPortGetLogicalUnit ( _In_ PVOID  HwDeviceExtension,
_In_ UCHAR  PathId,
_In_ UCHAR  TargetId,
_In_ UCHAR  Lun 
)

Definition at line 770 of file storport.c.

775 {
776  DPRINT1("StorPortGetLogicalUnit()\n");
778  return NULL;
779 }
smooth NULL
Definition: ftsmooth.c:416
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:114

◆ StorPortGetPhysicalAddress()

STORPORT_API STOR_PHYSICAL_ADDRESS NTAPI StorPortGetPhysicalAddress ( _In_ PVOID  HwDeviceExtension,
_In_opt_ PSCSI_REQUEST_BLOCK  Srb,
_In_ PVOID  VirtualAddress,
_Out_ ULONG Length 
)

Definition at line 788 of file storport.c.

793 {
794  PMINIPORT_DEVICE_EXTENSION MiniportExtension;
795  PFDO_DEVICE_EXTENSION DeviceExtension;
798 
799  DPRINT1("StorPortGetPhysicalAddress(%p %p %p %p)\n",
800  HwDeviceExtension, Srb, VirtualAddress, Length);
801 
802  /* Get the miniport extension */
803  MiniportExtension = CONTAINING_RECORD(HwDeviceExtension,
805  HwDeviceExtension);
806  DPRINT1("HwDeviceExtension %p MiniportExtension %p\n",
807  HwDeviceExtension, MiniportExtension);
808 
809  DeviceExtension = MiniportExtension->Miniport->DeviceExtension;
810 
811  /* Inside of the uncached extension? */
812  if (((ULONG_PTR)VirtualAddress >= (ULONG_PTR)DeviceExtension->UncachedExtensionVirtualBase) &&
813  ((ULONG_PTR)VirtualAddress <= (ULONG_PTR)DeviceExtension->UncachedExtensionVirtualBase + DeviceExtension->UncachedExtensionSize))
814  {
816 
818  *Length = DeviceExtension->UncachedExtensionSize - Offset;
819 
820  return PhysicalAddress;
821  }
822 
823  // FIXME
824 
825 
827  *Length = 1;
828 // UNIMPLEMENTED;
829 
830 // *Length = 0;
831 // PhysicalAddress.QuadPart = (LONGLONG)0;
832 
833  return PhysicalAddress;
834 }
PHYSICAL_ADDRESS UncachedExtensionPhysicalBase
Definition: precomp.h:103
PVOID UncachedExtensionVirtualBase
Definition: precomp.h:102
uint32_t ULONG_PTR
Definition: typedefs.h:63
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
ULONG UncachedExtensionSize
Definition: precomp.h:104
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
struct _MINIPORT * Miniport
Definition: precomp.h:72
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1060
_In_ ULONG _In_ BOOLEAN _Must_inspect_result_ PVOID * VirtualAddress
Definition: ndis.h:3791
#define DPRINT1
Definition: precomp.h:8
#define ULONG_PTR
Definition: config.h:101
PHYSICAL_ADDRESS NTAPI MmGetPhysicalAddress(IN PVOID Address)
Definition: stubs.c:682
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49
LONGLONG QuadPart
Definition: typedefs.h:112

Referenced by AhciPortInitialize(), and AhciProcessSrb().

◆ StorPortGetScatterGatherList()

STORPORT_API PSTOR_SCATTER_GATHER_LIST NTAPI StorPortGetScatterGatherList ( _In_ PVOID  DeviceExtension,
_In_ PSCSI_REQUEST_BLOCK  Srb 
)

Definition at line 843 of file storport.c.

846 {
847  DPRINT1("StorPortGetScatterGatherList()\n");
849  return NULL;
850 }
smooth NULL
Definition: ftsmooth.c:416
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by AhciATAPICommand(), and DeviceRequestReadWrite().

◆ StorPortGetSrb()

STORPORT_API PSCSI_REQUEST_BLOCK NTAPI StorPortGetSrb ( _In_ PVOID  DeviceExtension,
_In_ UCHAR  PathId,
_In_ UCHAR  TargetId,
_In_ UCHAR  Lun,
_In_ LONG  QueueTag 
)

Definition at line 859 of file storport.c.

865 {
866  DPRINT("StorPortGetSrb()\n");
867  return NULL;
868 }
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61

◆ StorPortGetUncachedExtension()

STORPORT_API PVOID NTAPI StorPortGetUncachedExtension ( _In_ PVOID  HwDeviceExtension,
_In_ PPORT_CONFIGURATION_INFORMATION  ConfigInfo,
_In_ ULONG  NumberOfBytes 
)

Definition at line 877 of file storport.c.

881 {
882  PMINIPORT_DEVICE_EXTENSION MiniportExtension;
883  PFDO_DEVICE_EXTENSION DeviceExtension;
884  PHYSICAL_ADDRESS LowestAddress, HighestAddress, Alignment;
885 
886  DPRINT1("StorPortGetUncachedExtension(%p %p %lu)\n",
887  HwDeviceExtension, ConfigInfo, NumberOfBytes);
888 
889  /* Get the miniport extension */
890  MiniportExtension = CONTAINING_RECORD(HwDeviceExtension,
892  HwDeviceExtension);
893  DPRINT1("HwDeviceExtension %p MiniportExtension %p\n",
894  HwDeviceExtension, MiniportExtension);
895 
896  DeviceExtension = MiniportExtension->Miniport->DeviceExtension;
897 
898  /* Return the uncached extension base address if we already have one */
899  if (DeviceExtension->UncachedExtensionVirtualBase != NULL)
900  return DeviceExtension->UncachedExtensionVirtualBase;
901 
902  // FIXME: Set DMA stuff here?
903 
904  /* Allocate the uncached extension */
905  Alignment.QuadPart = 0;
906  LowestAddress.QuadPart = 0;
907  HighestAddress.QuadPart = 0x00000000FFFFFFFF;
909  LowestAddress,
910  HighestAddress,
911  Alignment,
912  MmCached);
913  if (DeviceExtension->UncachedExtensionVirtualBase == NULL)
914  return NULL;
915 
917  DeviceExtension->UncachedExtensionSize = NumberOfBytes;
918 
919  return DeviceExtension->UncachedExtensionVirtualBase;
920 }
PHYSICAL_ADDRESS UncachedExtensionPhysicalBase
Definition: precomp.h:103
PVOID UncachedExtensionVirtualBase
Definition: precomp.h:102
union Alignment_ Alignment
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
ULONG UncachedExtensionSize
Definition: precomp.h:104
struct _MINIPORT * Miniport
Definition: precomp.h:72
#define DPRINT1
Definition: precomp.h:8
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:997
PHYSICAL_ADDRESS NTAPI MmGetPhysicalAddress(IN PVOID Address)
Definition: stubs.c:682
LONGLONG QuadPart
Definition: typedefs.h:112
PVOID NTAPI MmAllocateContiguousMemorySpecifyCache(IN SIZE_T NumberOfBytes, IN PHYSICAL_ADDRESS LowestAcceptableAddress OPTIONAL, IN PHYSICAL_ADDRESS HighestAcceptableAddress, IN PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL, IN MEMORY_CACHING_TYPE CacheType OPTIONAL)
Definition: contmem.c:569

Referenced by AhciAllocateResourceForAdapter().

◆ StorPortGetVirtualAddress()

STORPORT_API PVOID NTAPI StorPortGetVirtualAddress ( _In_ PVOID  HwDeviceExtension,
_In_ STOR_PHYSICAL_ADDRESS  PhysicalAddress 
)

Definition at line 929 of file storport.c.

932 {
933  DPRINT1("StorPortGetVirtualAddress(%p %I64x)\n",
934  HwDeviceExtension, PhysicalAddress.QuadPart);
936  return NULL;
937 }
smooth NULL
Definition: ftsmooth.c:416
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1060
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:114
LONGLONG QuadPart
Definition: typedefs.h:112

◆ StorPortInitialize()

STORPORT_API ULONG NTAPI StorPortInitialize ( _In_ PVOID  Argument1,
_In_ PVOID  Argument2,
_In_ struct _HW_INITIALIZATION_DATA HwInitializationData,
_In_opt_ PVOID  HwContext 
)

Definition at line 946 of file storport.c.

951 {
954  PDRIVER_OBJECT_EXTENSION DriverObjectExtension;
956 
957  DPRINT1("StorPortInitialize(%p %p %p %p)\n",
959 
960  DPRINT1("HwInitializationDataSize: %lu\n", HwInitializationData->HwInitializationDataSize);
961  DPRINT1("AdapterInterfaceType: %u\n", HwInitializationData->AdapterInterfaceType);
962  DPRINT1("HwInitialize: %p\n", HwInitializationData->HwInitialize);
963  DPRINT1("HwStartIo: %p\n", HwInitializationData->HwStartIo);
964  DPRINT1("HwInterrupt: %p\n", HwInitializationData->HwInterrupt);
965  DPRINT1("HwFindAdapter: %p\n", HwInitializationData->HwFindAdapter);
966  DPRINT1("HwResetBus: %p\n", HwInitializationData->HwResetBus);
967  DPRINT1("HwDmaStarted: %p\n", HwInitializationData->HwDmaStarted);
968  DPRINT1("HwAdapterState: %p\n", HwInitializationData->HwAdapterState);
969  DPRINT1("DeviceExtensionSize: %lu\n", HwInitializationData->DeviceExtensionSize);
970  DPRINT1("SpecificLuExtensionSize: %lu\n", HwInitializationData->SpecificLuExtensionSize);
971  DPRINT1("SrbExtensionSize: %lu\n", HwInitializationData->SrbExtensionSize);
972  DPRINT1("NumberOfAccessRanges: %lu\n", HwInitializationData->NumberOfAccessRanges);
973 
974  /* Check parameters */
975  if ((DriverObject == NULL) ||
976  (RegistryPath == NULL) ||
978  {
979  DPRINT1("Invalid parameter!\n");
981  }
982 
983  /* Check initialization data */
984  if ((HwInitializationData->HwInitializationDataSize < sizeof(HW_INITIALIZATION_DATA)) ||
985  (HwInitializationData->HwInitialize == NULL) ||
986  (HwInitializationData->HwStartIo == NULL) ||
987  (HwInitializationData->HwFindAdapter == NULL) ||
988  (HwInitializationData->HwResetBus == NULL))
989  {
990  DPRINT1("Revision mismatch!\n");
992  }
993 
994  DriverObjectExtension = IoGetDriverObjectExtension(DriverObject,
995  (PVOID)DriverEntry);
996  if (DriverObjectExtension == NULL)
997  {
998  DPRINT1("No driver object extension!\n");
999 
1001  (PVOID)DriverEntry,
1002  sizeof(DRIVER_OBJECT_EXTENSION),
1003  (PVOID *)&DriverObjectExtension);
1004  if (!NT_SUCCESS(Status))
1005  {
1006  DPRINT1("IoAllocateDriverObjectExtension() failed (Status 0x%08lx)\n", Status);
1007  return Status;
1008  }
1009 
1010  DPRINT1("Driver object extension created!\n");
1011 
1012  /* Initialize the driver object extension */
1013  RtlZeroMemory(DriverObjectExtension,
1014  sizeof(DRIVER_OBJECT_EXTENSION));
1015 
1016  DriverObjectExtension->ExtensionType = DriverExtension;
1017  DriverObjectExtension->DriverObject = DriverObject;
1018 
1019  InitializeListHead(&DriverObjectExtension->AdapterListHead);
1020  KeInitializeSpinLock(&DriverObjectExtension->AdapterListLock);
1021 
1022  InitializeListHead(&DriverObjectExtension->InitDataListHead);
1023 
1024  /* Set handlers */
1026 // DriverObject->DriverStartIo = PortStartIo;
1035  }
1036 
1037  /* Add the initialzation data to the driver extension */
1038  Status = PortAddDriverInitData(DriverObjectExtension,
1040 
1041  DPRINT1("StorPortInitialize() done (Status 0x%08lx)\n", Status);
1042 
1043  return Status;
1044 }
#define STATUS_REVISION_MISMATCH
Definition: ntstatus.h:311
LIST_ENTRY InitDataListHead
Definition: precomp.h:67
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
_IRQL_requires_same_ _In_opt_ PVOID Argument1
Definition: cmtypes.h:694
NTSTATUS NTAPI IoAllocateDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress, IN ULONG DriverObjectExtensionSize, OUT PVOID *DriverObjectExtension)
Definition: driver.c:1764
static NTSTATUS NTAPI PortDispatchPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: storport.c:397
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA _In_ PVOID HwContext
Definition: srb.h:664
static NTSTATUS NTAPI PortAddDevice(_In_ PDRIVER_OBJECT DriverObject, _In_ PDEVICE_OBJECT PhysicalDeviceObject)
Definition: storport.c:169
static NTSTATUS PortAddDriverInitData(PDRIVER_OBJECT_EXTENSION DriverExtension, PHW_INITIALIZATION_DATA HwInitializationData)
Definition: storport.c:25
static NTSTATUS NTAPI PortDispatchScsi(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: storport.c:342
EXTENSION_TYPE ExtensionType
Definition: precomp.h:60
#define IRP_MJ_SCSI
PDRIVER_EXTENSION DriverExtension
Definition: iotypes.h:2173
PDRIVER_OBJECT DriverObject
Definition: precomp.h:61
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:251
smooth NULL
Definition: ftsmooth.c:416
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
static NTSTATUS NTAPI PortDispatchSystemControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: storport.c:378
_In_ PVOID Argument2
Definition: classpnp.h:680
KSPIN_LOCK AdapterListLock
Definition: precomp.h:63
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static VOID NTAPI PortUnload(_In_ PDRIVER_OBJECT DriverObject)
Definition: storport.c:265
static NTSTATUS NTAPI PortDispatchPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: storport.c:431
#define IRP_MJ_POWER
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
static NTSTATUS NTAPI PortDispatchClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: storport.c:304
PDRIVER_UNLOAD DriverUnload
Definition: iotypes.h:2179
PVOID NTAPI IoGetDriverObjectExtension(IN PDRIVER_OBJECT DriverObject, IN PVOID ClientIdentificationAddress)
Definition: driver.c:1842
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:41
#define IRP_MJ_SYSTEM_CONTROL
Status
Definition: gdiplustypes.h:24
PDRIVER_ADD_DEVICE AddDevice
Definition: iotypes.h:2111
static NTSTATUS NTAPI PortDispatchCreate(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: storport.c:285
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
LIST_ENTRY AdapterListHead
Definition: precomp.h:64
UNICODE_STRING * PUNICODE_STRING
Definition: env_spec_w32.h:373
#define DPRINT1
Definition: precomp.h:8
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: iotypes.h:2180
NTSTATUS NTAPI DriverEntry(_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath)
Definition: storport.c:454
static NTSTATUS NTAPI PortDispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: storport.c:323
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:27
return STATUS_SUCCESS
Definition: btrfs.c:2745
struct _DRIVER_OBJECT * PDRIVER_OBJECT
_Must_inspect_result_ _In_ PVOID _In_ struct _HW_INITIALIZATION_DATA * HwInitializationData
Definition: srb.h:664
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52

Referenced by DriverEntry().

◆ StorPortLogError()

STORPORT_API VOID NTAPI StorPortLogError ( _In_ PVOID  HwDeviceExtension,
_In_opt_ PSCSI_REQUEST_BLOCK  Srb,
_In_ UCHAR  PathId,
_In_ UCHAR  TargetId,
_In_ UCHAR  Lun,
_In_ ULONG  ErrorCode,
_In_ ULONG  UniqueId 
)

Definition at line 1053 of file storport.c.

1061 {
1062  DPRINT1("ScsiPortLogError() called\n");
1063  DPRINT1("PathId: 0x%02x TargetId: 0x%02x Lun: 0x%02x ErrorCode: 0x%08lx UniqueId: 0x%08lx\n",
1064  PathId, TargetId, Lun, ErrorCode, UniqueId);
1065 
1066  DPRINT1("ScsiPortLogError() done\n");
1067 }
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR _In_ UCHAR Lun
Definition: classpnp.h:1117
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR PathId
Definition: classpnp.h:1117
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR TargetId
Definition: classpnp.h:1117
#define DPRINT1
Definition: precomp.h:8

◆ StorPortMoveMemory()

STORPORT_API VOID NTAPI StorPortMoveMemory ( _Out_writes_bytes_(Length) PVOID  Destination,
_In_reads_bytes_(Length) PVOID  Source,
_In_ ULONG  Length 
)

Definition at line 1076 of file storport.c.

1080 {
1082 }
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2875
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167

◆ StorPortNotification()

STORPORT_API VOID StorPortNotification ( _In_ SCSI_NOTIFICATION_TYPE  NotificationType,
_In_ PVOID  HwDeviceExtension,
  ... 
)

Definition at line 1090 of file storport.c.

1094 {
1095  PMINIPORT_DEVICE_EXTENSION MiniportExtension = NULL;
1096  PFDO_DEVICE_EXTENSION DeviceExtension = NULL;
1097  PHW_PASSIVE_INITIALIZE_ROUTINE HwPassiveInitRoutine;
1098  PSTORPORT_EXTENDED_FUNCTIONS *ppExtendedFunctions;
1099  PBOOLEAN Result;
1100  PSTOR_DPC Dpc;
1101  PHW_DPC_ROUTINE HwDpcRoutine;
1102  va_list ap;
1103 
1105  PVOID LockContext;
1107 
1108  DPRINT1("StorPortNotification(%x %p)\n",
1109  NotificationType, HwDeviceExtension);
1110 
1111  /* Get the miniport extension */
1112  if (HwDeviceExtension != NULL)
1113  {
1114  MiniportExtension = CONTAINING_RECORD(HwDeviceExtension,
1116  HwDeviceExtension);
1117  DPRINT1("HwDeviceExtension %p MiniportExtension %p\n",
1118  HwDeviceExtension, MiniportExtension);
1119 
1120  DeviceExtension = MiniportExtension->Miniport->DeviceExtension;
1121  }
1122 
1123  va_start(ap, HwDeviceExtension);
1124 
1125  switch (NotificationType)
1126  {
1128  DPRINT1("GetExtendedFunctionTable\n");
1130  if (ppExtendedFunctions != NULL)
1131  *ppExtendedFunctions = NULL; /* FIXME */
1132  break;
1133 
1135  DPRINT1("EnablePassiveInitialization\n");
1137  DPRINT1("HwPassiveInitRoutine %p\n", HwPassiveInitRoutine);
1139 
1140  *Result = FALSE;
1141 
1142  if ((DeviceExtension != NULL) &&
1143  (DeviceExtension->HwPassiveInitRoutine == NULL))
1144  {
1145  DeviceExtension->HwPassiveInitRoutine = HwPassiveInitRoutine;
1146  *Result = TRUE;
1147  }
1148  break;
1149 
1150  case InitializeDpc:
1151  DPRINT1("InitializeDpc\n");
1153  DPRINT1("Dpc %p\n", Dpc);
1154  HwDpcRoutine = (PHW_DPC_ROUTINE)va_arg(ap, PHW_DPC_ROUTINE);
1155  DPRINT1("HwDpcRoutine %p\n", HwDpcRoutine);
1156 
1157  KeInitializeDpc((PRKDPC)&Dpc->Dpc,
1158  (PKDEFERRED_ROUTINE)HwDpcRoutine,
1159  (PVOID)DeviceExtension);
1160  KeInitializeSpinLock(&Dpc->Lock);
1161  break;
1162 
1163  case AcquireSpinLock:
1164  DPRINT1("AcquireSpinLock\n");
1166  DPRINT1("SpinLock %lu\n", SpinLock);
1167  LockContext = (PVOID)va_arg(ap, PVOID);
1168  DPRINT1("LockContext %p\n", LockContext);
1170  DPRINT1("LockHandle %p\n", LockHandle);
1171  PortAcquireSpinLock(DeviceExtension,
1172  SpinLock,
1173  LockContext,
1174  LockHandle);
1175  break;
1176 
1177  case ReleaseSpinLock:
1178  DPRINT1("ReleaseSpinLock\n");
1180  DPRINT1("LockHandle %p\n", LockHandle);
1181  PortReleaseSpinLock(DeviceExtension,
1182  LockHandle);
1183  break;
1184 
1185  default:
1186  DPRINT1("Unsupported Notification %lx\n", NotificationType);
1187  break;
1188  }
1189 
1190  va_end(ap);
1191 }
static VOID PortReleaseSpinLock(PFDO_DEVICE_EXTENSION DeviceExtension, PSTOR_LOCK_HANDLE LockHandle)
Definition: storport.c:139
#define TRUE
Definition: types.h:120
enum _STOR_SPINLOCK STOR_SPINLOCK
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
#define va_end(ap)
Definition: acmsvcex.h:90
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:251
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
char * va_list
Definition: acmsvcex.h:78
void * PVOID
Definition: retypes.h:9
struct _STOR_LOCK_HANDLE * PSTOR_LOCK_HANDLE
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
_In_ LARGE_INTEGER _In_opt_ PKDPC Dpc
Definition: kefuncs.h:524
struct _MINIPORT * Miniport
Definition: precomp.h:72
PHW_PASSIVE_INITIALIZE_ROUTINE HwPassiveInitRoutine
Definition: precomp.h:105
char * PBOOLEAN
Definition: retypes.h:11
Definition: ketypes.h:687
KDEFERRED_ROUTINE * PKDEFERRED_ROUTINE
Definition: ketypes.h:678
VOID(* PHW_DPC_ROUTINE)(_In_ PSTOR_DPC Dpc, _In_ PVOID HwDeviceExtension, _In_ PVOID SystemArgument1, _In_ PVOID SystemArgument2)
Definition: storport.h:2176
#define va_arg(ap, T)
Definition: acmsvcex.h:89
static VOID PortAcquireSpinLock(PFDO_DEVICE_EXTENSION DeviceExtension, STOR_SPINLOCK SpinLock, PVOID LockContext, PSTOR_LOCK_HANDLE LockHandle)
Definition: storport.c:105
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define DPRINT1
Definition: precomp.h:8
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
struct _STOR_DPC * PSTOR_DPC
BOOLEAN(* PHW_PASSIVE_INITIALIZE_ROUTINE)(_In_ PVOID DeviceExtension)
Definition: storport.h:2171
*LockHandle LockHandle _Out_ PKLOCK_QUEUE_HANDLE LockHandle
Definition: kefuncs.h:742
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:711

Referenced by AhciCommandCompletionDpcRoutine(), AhciCompleteIssuedSrb(), AhciHwStartIo(), StorPortAcquireSpinLock(), StorPortEnablePassiveInitialization(), StorPortInitializeDpc(), StorPortIssueDpc(), and StorPortReleaseSpinLock().

◆ StorPortPause()

STORPORT_API BOOLEAN NTAPI StorPortPause ( _In_ PVOID  HwDeviceExtension,
_In_ ULONG  TimeOut 
)

Definition at line 1200 of file storport.c.

1203 {
1204  DPRINT1("StorPortPause()\n");
1205  UNIMPLEMENTED;
1206  return FALSE;
1207 }
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:114

◆ StorPortPauseDevice()

STORPORT_API BOOLEAN NTAPI StorPortPauseDevice ( _In_ PVOID  HwDeviceExtension,
_In_ UCHAR  PathId,
_In_ UCHAR  TargetId,
_In_ UCHAR  Lun,
_In_ ULONG  TimeOut 
)

Definition at line 1216 of file storport.c.

1222 {
1223  DPRINT1("StorPortPauseDevice()\n");
1224  UNIMPLEMENTED;
1225  return FALSE;
1226 }
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:114

◆ StorPortReady()

STORPORT_API BOOLEAN NTAPI StorPortReady ( _In_ PVOID  HwDeviceExtension)

Definition at line 1254 of file storport.c.

1256 {
1257  DPRINT1("StorPortReady()\n");
1258  UNIMPLEMENTED;
1259  return FALSE;
1260 }
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:114

◆ StorPortRegistryRead()

STORPORT_API BOOLEAN NTAPI StorPortRegistryRead ( _In_ PVOID  HwDeviceExtension,
_In_ PUCHAR  ValueName,
_In_ ULONG  Global,
_In_ ULONG  Type,
_In_ PUCHAR  Buffer,
_In_ PULONG  BufferLength 
)

Definition at line 1269 of file storport.c.

1276 {
1277  DPRINT1("StorPortRegistryRead()\n");
1278  UNIMPLEMENTED;
1279  return FALSE;
1280 }
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:114

◆ StorPortRegistryWrite()

STORPORT_API BOOLEAN NTAPI StorPortRegistryWrite ( _In_ PVOID  HwDeviceExtension,
_In_ PUCHAR  ValueName,
_In_ ULONG  Global,
_In_ ULONG  Type,
_In_ PUCHAR  Buffer,
_In_ ULONG  BufferLength 
)

Definition at line 1289 of file storport.c.

1296 {
1297  DPRINT1("StorPortRegistryWrite()\n");
1298  UNIMPLEMENTED;
1299  return FALSE;
1300 }
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:114

◆ StorPortResume()

STORPORT_API BOOLEAN NTAPI StorPortResume ( _In_ PVOID  HwDeviceExtension)

Definition at line 1309 of file storport.c.

1311 {
1312  DPRINT1("StorPortResume()\n");
1313  UNIMPLEMENTED;
1314  return FALSE;
1315 }
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:114

◆ StorPortResumeDevice()

STORPORT_API BOOLEAN NTAPI StorPortResumeDevice ( _In_ PVOID  HwDeviceExtension,
_In_ UCHAR  PathId,
_In_ UCHAR  TargetId,
_In_ UCHAR  Lun 
)

Definition at line 1324 of file storport.c.

1329 {
1330  DPRINT1("StorPortResumeDevice()\n");
1331  UNIMPLEMENTED;
1332  return FALSE;
1333 }
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:114

◆ StorPortSetBusDataByOffset()

STORPORT_API ULONG NTAPI StorPortSetBusDataByOffset ( _In_ PVOID  DeviceExtension,
_In_ ULONG  BusDataType,
_In_ ULONG  SystemIoBusNumber,
_In_ ULONG  SlotNumber,
_In_reads_bytes_(Length) PVOID  Buffer,
_In_ ULONG  Offset,
_In_ ULONG  Length 
)

Definition at line 1342 of file storport.c.

1350 {
1351  PMINIPORT_DEVICE_EXTENSION MiniportExtension;
1354 
1355  DPRINT1("StorPortSetBusData(%p %lu %lu %lu %p %lu %lu)\n",
1356  DeviceExtension, BusDataType, SystemIoBusNumber, SlotNumber, Buffer, Offset, Length);
1357 
1358  MiniportExtension = CONTAINING_RECORD(DeviceExtension,
1360  HwDeviceExtension);
1361  DPRINT1("DeviceExtension %p MiniportExtension %p\n",
1362  DeviceExtension, MiniportExtension);
1363 
1364  Interface = &MiniportExtension->Miniport->DeviceExtension->BusInterface;
1365 
1366  ReturnLength = Interface->SetBusData(Interface->Context,
1367  BusDataType,
1368  Buffer,
1369  Offset,
1370  Length);
1371  DPRINT1("ReturnLength: %lu\n", ReturnLength);
1372 
1373  return ReturnLength;
1374 }
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
Definition: bufpool.h:45
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:359
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
struct _MINIPORT * Miniport
Definition: precomp.h:72
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG _In_ ULONG SlotNumber
Definition: halfuncs.h:156
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1

◆ StorPortSetDeviceQueueDepth()

STORPORT_API BOOLEAN NTAPI StorPortSetDeviceQueueDepth ( _In_ PVOID  HwDeviceExtension,
_In_ UCHAR  PathId,
_In_ UCHAR  TargetId,
_In_ UCHAR  Lun,
_In_ ULONG  Depth 
)

Definition at line 1383 of file storport.c.

1389 {
1390  DPRINT1("StorPortSetDeviceQueueDepth()\n");
1391  UNIMPLEMENTED;
1392  return FALSE;
1393 }
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by AtapiInquiryCompletion(), and InquiryCompletion().

◆ StorPortStallExecution()

STORPORT_API VOID NTAPI StorPortStallExecution ( _In_ ULONG  Delay)

Definition at line 1402 of file storport.c.

1404 {
1406 }
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:99

Referenced by AhciAdapterReset(), AhciPortInitialize(), and AhciStartPort().

◆ StorPortSynchronizeAccess()

STORPORT_API VOID NTAPI StorPortSynchronizeAccess ( _In_ PVOID  HwDeviceExtension,
_In_ PSTOR_SYNCHRONIZED_ACCESS  SynchronizedAccessRoutine,
_In_opt_ PVOID  Context 
)

Definition at line 1415 of file storport.c.

1419 {
1420  DPRINT1("StorPortSynchronizeAccess()\n");
1421  UNIMPLEMENTED;
1422 }
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:114

◆ StorPortValidateRange()

STORPORT_API BOOLEAN NTAPI StorPortValidateRange ( _In_ PVOID  HwDeviceExtension,
_In_ INTERFACE_TYPE  BusType,
_In_ ULONG  SystemIoBusNumber,
_In_ STOR_PHYSICAL_ADDRESS  IoAddress,
_In_ ULONG  NumberOfBytes,
_In_ BOOLEAN  InIoSpace 
)

Definition at line 1431 of file storport.c.

1438 {
1439  DPRINT1("StorPortValidateRange()\n");
1440  return TRUE;
1441 }
#define TRUE
Definition: types.h:120
#define DPRINT1
Definition: precomp.h:8

Variable Documentation

◆ PortNumber