Home | History | Annotate | Download | only in ddk
      1 /*
      2  * storport.h
      3  *
      4  * StorPort interface
      5  *
      6  * This file is part of the w32api package.
      7  *
      8  * Contributors:
      9  *   Created by Casper S. Hornstrup <chorns (at) users.sourceforge.net>
     10  *
     11  * THIS SOFTWARE IS NOT COPYRIGHTED
     12  *
     13  * This source code is offered for use in the public domain. You may
     14  * use, modify or distribute it freely.
     15  *
     16  * This code is distributed in the hope that it will be useful but
     17  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
     18  * DISCLAIMED. This includes but is not limited to warranties of
     19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     20  *
     21  */
     22 
     23 #ifndef __STORPORT_H
     24 #define __STORPORT_H
     25 
     26 #include "srb.h"
     27 
     28 #ifdef __cplusplus
     29 extern "C" {
     30 #endif
     31 
     32 #if defined(_STORPORT_)
     33 #define STORPORTAPI
     34 #else
     35 #define STORPORTAPI DECLSPEC_IMPORT
     36 #endif
     37 
     38 
     39 typedef PHYSICAL_ADDRESS STOR_PHYSICAL_ADDRESS;
     40 
     41 typedef struct _STOR_SCATTER_GATHER_ELEMENT {
     42 	STOR_PHYSICAL_ADDRESS  PhysicalAddress;
     43 	ULONG  Length;
     44 	ULONG_PTR  Reserved;
     45 } STOR_SCATTER_GATHER_ELEMENT, *PSTOR_SCATTER_GATHER_ELEMENT;
     46 
     47 typedef struct _STOR_SCATTER_GATHER_LIST {
     48     ULONG  NumberOfElements;
     49     ULONG_PTR  Reserved;
     50     STOR_SCATTER_GATHER_ELEMENT  List[0];
     51 } STOR_SCATTER_GATHER_LIST, *PSTOR_SCATTER_GATHER_LIST;
     52 
     53 typedef struct _SCSI_WMI_REQUEST_BLOCK {
     54   USHORT  Length;
     55   UCHAR  Function;
     56   UCHAR  SrbStatus;
     57   UCHAR  WMISubFunction;
     58   UCHAR  PathId;
     59   UCHAR  TargetId;
     60   UCHAR  Lun;
     61   UCHAR  Reserved1;
     62   UCHAR  WMIFlags;
     63   UCHAR  Reserved2[2];
     64   ULONG  SrbFlags;
     65   ULONG  DataTransferLength;
     66   ULONG  TimeOutValue;
     67   PVOID  DataBuffer;
     68   PVOID  DataPath;
     69   PVOID  Reserved3;
     70   PVOID  OriginalRequest;
     71   PVOID  SrbExtension;
     72   ULONG  Reserved4;
     73   UCHAR  Reserved5[16];
     74 } SCSI_WMI_REQUEST_BLOCK, *PSCSI_WMI_REQUEST_BLOCK;
     75 
     76 
     77 STORPORTAPI
     78 ULONG
     79 NTAPI
     80 StorPortInitialize(
     81   IN PVOID  Argument1,
     82   IN PVOID  Argument2,
     83   IN PHW_INITIALIZATION_DATA  HwInitializationData,
     84   IN PVOID  Unused);
     85 
     86 STORPORTAPI
     87 VOID
     88 NTAPI
     89 StorPortFreeDeviceBase(
     90   IN PVOID  HwDeviceExtension,
     91   IN PVOID  MappedAddress);
     92 
     93 STORPORTAPI
     94 ULONG
     95 NTAPI
     96 StorPortGetBusData(
     97   IN PVOID  DeviceExtension,
     98   IN ULONG  BusDataType,
     99   IN ULONG  SystemIoBusNumber,
    100   IN ULONG  SlotNumber,
    101   IN PVOID  Buffer,
    102   IN ULONG  Length);
    103 
    104 STORPORTAPI
    105 ULONG
    106 NTAPI
    107 StorPortSetBusDataByOffset(
    108   IN PVOID  DeviceExtension,
    109   IN ULONG   BusDataType,
    110   IN ULONG  SystemIoBusNumber,
    111   IN ULONG  SlotNumber,
    112   IN PVOID  Buffer,
    113   IN ULONG  Offset,
    114   IN ULONG  Length);
    115 
    116 STORPORTAPI
    117 PVOID
    118 NTAPI
    119 StorPortGetDeviceBase(
    120   IN PVOID  HwDeviceExtension,
    121   IN INTERFACE_TYPE  BusType,
    122   IN ULONG  SystemIoBusNumber,
    123   IN SCSI_PHYSICAL_ADDRESS  IoAddress,
    124   IN ULONG  NumberOfBytes,
    125   IN BOOLEAN  InIoSpace);
    126 
    127 STORPORTAPI
    128 PVOID
    129 NTAPI
    130 StorPortGetLogicalUnit(
    131   IN PVOID  HwDeviceExtension,
    132   IN UCHAR  PathId,
    133   IN UCHAR  TargetId,
    134   IN UCHAR  Lun);
    135 
    136 STORPORTAPI
    137 PSCSI_REQUEST_BLOCK
    138 NTAPI
    139 StorPortGetSrb(
    140   IN PVOID  DeviceExtension,
    141   IN UCHAR  PathId,
    142   IN UCHAR  TargetId,
    143   IN UCHAR  Lun,
    144   IN LONG  QueueTag);
    145 
    146 STORPORTAPI
    147 STOR_PHYSICAL_ADDRESS
    148 NTAPI
    149 StorPortGetPhysicalAddress(
    150   IN PVOID  HwDeviceExtension,
    151   IN PSCSI_REQUEST_BLOCK  Srb,
    152   IN PVOID  VirtualAddress,
    153   OUT ULONG  *Length);
    154 
    155 STORPORTAPI
    156 PVOID
    157 NTAPI
    158 StorPortGetVirtualAddress(
    159   IN PVOID  HwDeviceExtension,
    160   IN STOR_PHYSICAL_ADDRESS  PhysicalAddress);
    161 
    162 STORPORTAPI
    163 PVOID
    164 NTAPI
    165 StorPortGetUncachedExtension(
    166   IN PVOID HwDeviceExtension,
    167   IN PPORT_CONFIGURATION_INFORMATION ConfigInfo,
    168   IN ULONG NumberOfBytes);
    169 
    170 STORPORTAPI
    171 VOID
    172 __cdecl
    173 StorPortNotification(
    174   IN SCSI_NOTIFICATION_TYPE  NotificationType,
    175   IN PVOID  HwDeviceExtension,
    176   IN ...);
    177 
    178 STORPORTAPI
    179 VOID
    180 NTAPI
    181 StorPortLogError(
    182   IN PVOID  HwDeviceExtension,
    183   IN PSCSI_REQUEST_BLOCK  Srb OPTIONAL,
    184   IN UCHAR  PathId,
    185   IN UCHAR  TargetId,
    186   IN UCHAR  Lun,
    187   IN ULONG  ErrorCode,
    188   IN ULONG  UniqueId);
    189 
    190 STORPORTAPI
    191 VOID
    192 NTAPI
    193 StorPortCompleteRequest(
    194   IN PVOID  HwDeviceExtension,
    195   IN UCHAR  PathId,
    196   IN UCHAR  TargetId,
    197   IN UCHAR  Lun,
    198   IN UCHAR  SrbStatus);
    199 
    200 STORPORTAPI
    201 VOID
    202 NTAPI
    203 StorPortMoveMemory(
    204   IN PVOID  WriteBuffer,
    205   IN PVOID  ReadBuffer,
    206   IN ULONG  Length);
    207 
    208 STORPORTAPI
    209 VOID
    210 NTAPI
    211 StorPortStallExecution(
    212   IN ULONG  Delay);
    213 
    214 STORPORTAPI
    215 STOR_PHYSICAL_ADDRESS
    216 NTAPI
    217 StorPortConvertUlong64ToPhysicalAddress(
    218   IN ULONG64  UlongAddress);
    219 
    220 STORPORTAPI
    221 ULONG64
    222 NTAPI
    223 StorPortConvertPhysicalAddressToUlong64(
    224   IN STOR_PHYSICAL_ADDRESS  Address);
    225 
    226 STORPORTAPI
    227 BOOLEAN
    228 NTAPI
    229 StorPortValidateRange(
    230   IN PVOID  HwDeviceExtension,
    231   IN INTERFACE_TYPE  BusType,
    232   IN ULONG  SystemIoBusNumber,
    233   IN STOR_PHYSICAL_ADDRESS  IoAddress,
    234   IN ULONG  NumberOfBytes,
    235   IN BOOLEAN  InIoSpace);
    236 
    237 STORPORTAPI
    238 VOID
    239 __cdecl
    240 StorPortDebugPrint(
    241   IN ULONG  DebugPrintLevel,
    242   IN PCCHAR  DebugMessage,
    243   IN ...);
    244 
    245 STORPORTAPI
    246 UCHAR
    247 NTAPI
    248 StorPortReadPortUchar(
    249   IN PUCHAR  Port);
    250 
    251 STORPORTAPI
    252 ULONG
    253 NTAPI
    254 StorPortReadPortUlong(
    255   IN PULONG  Port);
    256 
    257 STORPORTAPI
    258 USHORT
    259 NTAPI
    260 StorPortReadPortUshort(
    261   IN PUSHORT  Port);
    262 
    263 STORPORTAPI
    264 UCHAR
    265 NTAPI
    266 StorPortReadRegisterUchar(
    267   IN PUCHAR  Register);
    268 
    269 STORPORTAPI
    270 ULONG
    271 NTAPI
    272 StorPortReadRegisterUlong(
    273   IN PULONG  Register);
    274 
    275 STORPORTAPI
    276 USHORT
    277 NTAPI
    278 StorPortReadRegisterUshort(
    279   IN PUSHORT  Register);
    280 
    281 STORPORTAPI
    282 VOID
    283 NTAPI
    284 StorPortWritePortUchar(
    285   IN PUCHAR  Port,
    286   IN UCHAR  Value);
    287 
    288 STORPORTAPI
    289 VOID
    290 NTAPI
    291 StorPortWritePortUlong(
    292   IN PULONG  Port,
    293   IN ULONG  Value);
    294 
    295 STORPORTAPI
    296 VOID
    297 NTAPI
    298 StorPortWritePortUshort(
    299   IN PUSHORT  Port,
    300   IN USHORT  Value);
    301 
    302 STORPORTAPI
    303 VOID
    304 NTAPI
    305 StorPortWriteRegisterUchar(
    306   IN PUCHAR  Port,
    307   IN UCHAR  Value);
    308 
    309 STORPORTAPI
    310 VOID
    311 NTAPI
    312 StorPortWriteRegisterUlong(
    313   IN PULONG  Port,
    314   IN ULONG  Value);
    315 
    316 STORPORTAPI
    317 VOID
    318 NTAPI
    319 StorPortWriteRegisterUshort(
    320   IN PUSHORT  Port,
    321   IN USHORT  Value);
    322 
    323 STORPORTAPI
    324 BOOLEAN
    325 NTAPI
    326 StorPortPauseDevice(
    327   IN PVOID  HwDeviceExtension,
    328   IN UCHAR  PathId,
    329   IN UCHAR  TargetId,
    330   IN UCHAR  Lun,
    331   IN ULONG  TimeOut);
    332 
    333 STORPORTAPI
    334 BOOLEAN
    335 NTAPI
    336 StorPortResumeDevice(
    337   IN PVOID  HwDeviceExtension,
    338   IN UCHAR  PathId,
    339   IN UCHAR  TargetId,
    340   IN UCHAR  Lun);
    341 
    342 STORPORTAPI
    343 BOOLEAN
    344 NTAPI
    345 StorPortPause(
    346   IN PVOID  HwDeviceExtension,
    347   IN ULONG  TimeOut);
    348 
    349 STORPORTAPI
    350 BOOLEAN
    351 NTAPI
    352 StorPortResume(
    353   IN PVOID  HwDeviceExtension);
    354 
    355 STORPORTAPI
    356 BOOLEAN
    357 NTAPI
    358 StorPortDeviceBusy(
    359   IN PVOID  HwDeviceExtension,
    360   IN UCHAR  PathId,
    361   IN UCHAR  TargetId,
    362   IN UCHAR  Lun,
    363   IN ULONG  RequestsToComplete);
    364 
    365 STORPORTAPI
    366 BOOLEAN
    367 NTAPI
    368 StorPortDeviceReady(
    369   IN PVOID  HwDeviceExtension,
    370   IN UCHAR  PathId,
    371   IN UCHAR  TargetId,
    372   IN UCHAR  Lun);
    373 
    374 STORPORTAPI
    375 BOOLEAN
    376 NTAPI
    377 StorPortBusy(
    378   IN PVOID  HwDeviceExtension,
    379   IN ULONG  RequestsToComplete);
    380 
    381 STORPORTAPI
    382 BOOLEAN
    383 NTAPI
    384 StorPortReady(
    385   IN PVOID  HwDeviceExtension);
    386 
    387 STORPORTAPI
    388 PSTOR_SCATTER_GATHER_LIST
    389 NTAPI
    390 StorPortGetScatterGatherList(
    391   IN PVOID  DeviceExtension,
    392   IN PSCSI_REQUEST_BLOCK  Srb);
    393 
    394 typedef BOOLEAN
    395 (NTAPI *PSTOR_SYNCHRONIZED_ACCESS)(
    396   IN PVOID  HwDeviceExtension,
    397   IN PVOID  Context);
    398 
    399 STORPORTAPI
    400 VOID
    401 NTAPI
    402 StorPortSynchronizeAccess(
    403   IN PVOID  HwDeviceExtension,
    404   IN PSTOR_SYNCHRONIZED_ACCESS  SynchronizedAccessRoutine,
    405   IN PVOID  Context);
    406 
    407 #if DBG
    408 #define DebugPrint(x) StorPortDebugPrint x
    409 #else
    410 #define DebugPrint(x)
    411 #endif
    412 
    413 #ifdef __cplusplus
    414 }
    415 #endif
    416 
    417 #endif /* __STORPORT_H */
    418