Naveen Neel / shedskin
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers storport.h Source File

storport.h

00001 /*
00002  * storport.h
00003  *
00004  * StorPort interface
00005  *
00006  * This file is part of the w32api package.
00007  *
00008  * Contributors:
00009  *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
00010  *
00011  * THIS SOFTWARE IS NOT COPYRIGHTED
00012  *
00013  * This source code is offered for use in the public domain. You may
00014  * use, modify or distribute it freely.
00015  *
00016  * This code is distributed in the hope that it will be useful but
00017  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
00018  * DISCLAIMED. This includes but is not limited to warranties of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00020  *
00021  */
00022 
00023 #ifndef __STORPORT_H
00024 #define __STORPORT_H
00025 
00026 #if __GNUC__ >=3
00027 #pragma GCC system_header
00028 #endif
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033 
00034 #include "ntddk.h"
00035 #include "srb.h"
00036 
00037 #if defined(_STORPORT_)
00038   #define STORPORTAPI DECLSPEC_EXPORT
00039 #else
00040   #define STORPORTAPI DECLSPEC_IMPORT
00041 #endif
00042 
00043 
00044 typedef PHYSICAL_ADDRESS STOR_PHYSICAL_ADDRESS;
00045 
00046 typedef struct _STOR_SCATTER_GATHER_ELEMENT {
00047     STOR_PHYSICAL_ADDRESS  PhysicalAddress;
00048     ULONG  Length;
00049     ULONG_PTR  Reserved;
00050 } STOR_SCATTER_GATHER_ELEMENT, *PSTOR_SCATTER_GATHER_ELEMENT;
00051 
00052 typedef struct _STOR_SCATTER_GATHER_LIST {
00053     ULONG  NumberOfElements;
00054     ULONG_PTR  Reserved;
00055     STOR_SCATTER_GATHER_ELEMENT  List[0];
00056 } STOR_SCATTER_GATHER_LIST, *PSTOR_SCATTER_GATHER_LIST;
00057 
00058 typedef struct _SCSI_WMI_REQUEST_BLOCK {
00059   USHORT  Length;
00060   UCHAR  Function;
00061   UCHAR  SrbStatus;
00062   UCHAR  WMISubFunction;
00063   UCHAR  PathId;
00064   UCHAR  TargetId;
00065   UCHAR  Lun;
00066   UCHAR  Reserved1;
00067   UCHAR  WMIFlags;
00068   UCHAR  Reserved2[2];
00069   ULONG  SrbFlags;
00070   ULONG  DataTransferLength;
00071   ULONG  TimeOutValue;
00072   PVOID  DataBuffer;
00073   PVOID  DataPath;
00074   PVOID  Reserved3;
00075   PVOID  OriginalRequest;
00076   PVOID  SrbExtension;
00077   ULONG  Reserved4;
00078   UCHAR  Reserved5[16];
00079 } SCSI_WMI_REQUEST_BLOCK, *PSCSI_WMI_REQUEST_BLOCK;
00080 
00081 
00082 STORPORTAPI
00083 ULONG
00084 DDKAPI
00085 StorPortInitialize(
00086   /*IN*/ PVOID  Argument1,
00087   /*IN*/ PVOID  Argument2,
00088   /*IN*/ PHW_INITIALIZATION_DATA  HwInitializationData,
00089   /*IN*/ PVOID  Unused);
00090 
00091 STORPORTAPI
00092 VOID
00093 DDKAPI
00094 StorPortFreeDeviceBase(
00095   /*IN*/ PVOID  HwDeviceExtension,
00096   /*IN*/ PVOID  MappedAddress);
00097 
00098 STORPORTAPI
00099 ULONG
00100 DDKAPI
00101 StorPortGetBusData(
00102   /*IN*/ PVOID  DeviceExtension,
00103   /*IN*/ ULONG  BusDataType,
00104   /*IN*/ ULONG  SystemIoBusNumber,
00105   /*IN*/ ULONG  SlotNumber,
00106   /*IN*/ PVOID  Buffer,
00107   /*IN*/ ULONG  Length);
00108 
00109 STORPORTAPI
00110 ULONG
00111 DDKAPI
00112 StorPortSetBusDataByOffset(
00113   /*IN*/ PVOID  DeviceExtension,
00114   /*IN*/ ULONG   BusDataType,
00115   /*IN*/ ULONG  SystemIoBusNumber,
00116   /*IN*/ ULONG  SlotNumber,
00117   /*IN*/ PVOID  Buffer,
00118   /*IN*/ ULONG  Offset,
00119   /*IN*/ ULONG  Length);
00120 
00121 STORPORTAPI
00122 PVOID
00123 DDKAPI
00124 StorPortGetDeviceBase(
00125   /*IN*/ PVOID  HwDeviceExtension,
00126   /*IN*/ INTERFACE_TYPE  BusType,
00127   /*IN*/ ULONG  SystemIoBusNumber,
00128   /*IN*/ SCSI_PHYSICAL_ADDRESS  IoAddress,
00129   /*IN*/ ULONG  NumberOfBytes,
00130   /*IN*/ BOOLEAN  InIoSpace);
00131 
00132 STORPORTAPI
00133 PVOID
00134 DDKAPI
00135 StorPortGetLogicalUnit(
00136   /*IN*/ PVOID  HwDeviceExtension,
00137   /*IN*/ UCHAR  PathId,
00138   /*IN*/ UCHAR  TargetId,
00139   /*IN*/ UCHAR  Lun);
00140 
00141 STORPORTAPI
00142 PSCSI_REQUEST_BLOCK
00143 DDKAPI
00144 StorPortGetSrb(
00145   /*IN*/ PVOID  DeviceExtension,
00146   /*IN*/ UCHAR  PathId,
00147   /*IN*/ UCHAR  TargetId,
00148   /*IN*/ UCHAR  Lun,
00149   /*IN*/ LONG  QueueTag);
00150 
00151 STORPORTAPI
00152 STOR_PHYSICAL_ADDRESS
00153 DDKAPI
00154 StorPortGetPhysicalAddress(
00155   /*IN*/ PVOID  HwDeviceExtension,
00156   /*IN*/ PSCSI_REQUEST_BLOCK  Srb,
00157   /*IN*/ PVOID  VirtualAddress,
00158   /*OUT*/ ULONG  *Length);
00159 
00160 STORPORTAPI
00161 PVOID
00162 DDKAPI
00163 StorPortGetVirtualAddress(
00164   /*IN*/ PVOID  HwDeviceExtension,
00165   /*IN*/ STOR_PHYSICAL_ADDRESS  PhysicalAddress);
00166 
00167 STORPORTAPI
00168 PVOID
00169 DDKAPI
00170 StorPortGetUncachedExtension(
00171   /*IN*/ PVOID HwDeviceExtension,
00172   /*IN*/ PPORT_CONFIGURATION_INFORMATION ConfigInfo,
00173   /*IN*/ ULONG NumberOfBytes);
00174 
00175 STORPORTAPI
00176 VOID
00177 DDKCDECLAPI
00178 StorPortNotification(
00179   /*IN*/ SCSI_NOTIFICATION_TYPE  NotificationType,
00180   /*IN*/ PVOID  HwDeviceExtension,
00181   /*IN*/ ...);
00182 
00183 STORPORTAPI
00184 VOID
00185 DDKAPI
00186 StorPortLogError(
00187   /*IN*/ PVOID  HwDeviceExtension,
00188   /*IN*/ PSCSI_REQUEST_BLOCK  Srb /*OPTIONAL*/,
00189   /*IN*/ UCHAR  PathId,
00190   /*IN*/ UCHAR  TargetId,
00191   /*IN*/ UCHAR  Lun,
00192   /*IN*/ ULONG  ErrorCode,
00193   /*IN*/ ULONG  UniqueId);
00194 
00195 STORPORTAPI
00196 VOID
00197 DDKAPI
00198 StorPortCompleteRequest(
00199   /*IN*/ PVOID  HwDeviceExtension,
00200   /*IN*/ UCHAR  PathId,
00201   /*IN*/ UCHAR  TargetId,
00202   /*IN*/ UCHAR  Lun,
00203   /*IN*/ UCHAR  SrbStatus);
00204 
00205 STORPORTAPI
00206 VOID
00207 DDKAPI
00208 StorPortMoveMemory(
00209   /*IN*/ PVOID  WriteBuffer,
00210   /*IN*/ PVOID  ReadBuffer,
00211   /*IN*/ ULONG  Length);
00212 
00213 STORPORTAPI
00214 VOID
00215 DDKAPI
00216 StorPortStallExecution(
00217   /*IN*/ ULONG  Delay);
00218 
00219 STORPORTAPI
00220 STOR_PHYSICAL_ADDRESS
00221 DDKAPI
00222 StorPortConvertUlong64ToPhysicalAddress(
00223   /*IN*/ ULONG64  UlongAddress);
00224 
00225 STORPORTAPI
00226 ULONG64
00227 DDKAPI
00228 StorPortConvertPhysicalAddressToUlong64(
00229   /*IN*/ STOR_PHYSICAL_ADDRESS  Address);
00230 
00231 STORPORTAPI
00232 BOOLEAN
00233 DDKAPI
00234 StorPortValidateRange(
00235   /*IN*/ PVOID  HwDeviceExtension,
00236   /*IN*/ INTERFACE_TYPE  BusType,
00237   /*IN*/ ULONG  SystemIoBusNumber,
00238   /*IN*/ STOR_PHYSICAL_ADDRESS  IoAddress,
00239   /*IN*/ ULONG  NumberOfBytes,
00240   /*IN*/ BOOLEAN  InIoSpace);
00241 
00242 STORPORTAPI
00243 VOID
00244 DDKCDECLAPI
00245 StorPortDebugPrint(
00246   /*IN*/ ULONG  DebugPrintLevel,
00247   /*IN*/ PCCHAR  DebugMessage,
00248   /*IN*/ ...);
00249 
00250 STORPORTAPI
00251 UCHAR
00252 DDKAPI
00253 StorPortReadPortUchar(
00254   /*IN*/ PUCHAR  Port);
00255 
00256 STORPORTAPI
00257 ULONG
00258 DDKAPI
00259 StorPortReadPortUlong(
00260   /*IN*/ PULONG  Port);
00261 
00262 STORPORTAPI
00263 USHORT
00264 DDKAPI
00265 StorPortReadPortUshort(
00266   /*IN*/ PUSHORT  Port);
00267 
00268 STORPORTAPI
00269 UCHAR
00270 DDKAPI
00271 StorPortReadRegisterUchar(
00272   /*IN*/ PUCHAR  Register);
00273 
00274 STORPORTAPI
00275 ULONG
00276 DDKAPI
00277 StorPortReadRegisterUlong(
00278   /*IN*/ PULONG  Register);
00279 
00280 STORPORTAPI
00281 USHORT
00282 DDKAPI
00283 StorPortReadRegisterUshort(
00284   /*IN*/ PUSHORT  Register);
00285 
00286 STORPORTAPI
00287 VOID
00288 DDKAPI
00289 StorPortWritePortUchar(
00290   /*IN*/ PUCHAR  Port,
00291   /*IN*/ UCHAR  Value);
00292 
00293 STORPORTAPI
00294 VOID
00295 DDKAPI
00296 StorPortWritePortUlong(
00297   /*IN*/ PULONG  Port,
00298   /*IN*/ ULONG  Value);
00299 
00300 STORPORTAPI
00301 VOID
00302 DDKAPI
00303 StorPortWritePortUshort(
00304   /*IN*/ PUSHORT  Port,
00305   /*IN*/ USHORT  Value);
00306 
00307 STORPORTAPI
00308 VOID
00309 DDKAPI
00310 StorPortWriteRegisterUchar(
00311   /*IN*/ PUCHAR  Port,
00312   /*IN*/ UCHAR  Value);
00313 
00314 STORPORTAPI
00315 VOID
00316 DDKAPI
00317 StorPortWriteRegisterUlong(
00318   /*IN*/ PULONG  Port,
00319   /*IN*/ ULONG  Value);
00320 
00321 STORPORTAPI
00322 VOID
00323 DDKAPI
00324 StorPortWriteRegisterUshort(
00325   /*IN*/ PUSHORT  Port,
00326   /*IN*/ USHORT  Value);
00327 
00328 STORPORTAPI
00329 BOOLEAN
00330 DDKAPI
00331 StorPortPauseDevice(
00332   /*IN*/ PVOID  HwDeviceExtension,
00333   /*IN*/ UCHAR  PathId,
00334   /*IN*/ UCHAR  TargetId,
00335   /*IN*/ UCHAR  Lun,
00336   /*IN*/ ULONG  TimeOut);
00337 
00338 STORPORTAPI
00339 BOOLEAN
00340 DDKAPI
00341 StorPortResumeDevice(
00342   /*IN*/ PVOID  HwDeviceExtension,
00343   /*IN*/ UCHAR  PathId,
00344   /*IN*/ UCHAR  TargetId,
00345   /*IN*/ UCHAR  Lun);
00346 
00347 STORPORTAPI
00348 BOOLEAN
00349 DDKAPI
00350 StorPortPause(
00351   /*IN*/ PVOID  HwDeviceExtension,
00352   /*IN*/ ULONG  TimeOut);
00353 
00354 STORPORTAPI
00355 BOOLEAN
00356 DDKAPI
00357 StorPortResume(
00358   /*IN*/ PVOID  HwDeviceExtension);
00359 
00360 STORPORTAPI
00361 BOOLEAN
00362 DDKAPI
00363 StorPortDeviceBusy(
00364   /*IN*/ PVOID  HwDeviceExtension,
00365   /*IN*/ UCHAR  PathId,
00366   /*IN*/ UCHAR  TargetId,
00367   /*IN*/ UCHAR  Lun,
00368   /*IN*/ ULONG  RequestsToComplete);
00369 
00370 STORPORTAPI
00371 BOOLEAN
00372 DDKAPI
00373 StorPortDeviceReady(
00374   /*IN*/ PVOID  HwDeviceExtension,
00375   /*IN*/ UCHAR  PathId,
00376   /*IN*/ UCHAR  TargetId,
00377   /*IN*/ UCHAR  Lun);
00378 
00379 STORPORTAPI
00380 BOOLEAN
00381 DDKAPI
00382 StorPortBusy(
00383   /*IN*/ PVOID  HwDeviceExtension,
00384   /*IN*/ ULONG  RequestsToComplete);
00385 
00386 STORPORTAPI
00387 BOOLEAN
00388 DDKAPI
00389 StorPortReady(
00390   /*IN*/ PVOID  HwDeviceExtension);
00391 
00392 STORPORTAPI
00393 PSTOR_SCATTER_GATHER_LIST
00394 DDKAPI
00395 StorPortGetScatterGatherList(
00396   /*IN*/ PVOID  DeviceExtension,
00397   /*IN*/ PSCSI_REQUEST_BLOCK  Srb);
00398 
00399 typedef BOOLEAN DDKAPI
00400 (*PSTOR_SYNCHRONIZED_ACCESS)(
00401   /*IN*/ PVOID  HwDeviceExtension,
00402   /*IN*/ PVOID  Context);
00403 
00404 STORPORTAPI
00405 VOID
00406 DDKAPI
00407 StorPortSynchronizeAccess(
00408   /*IN*/ PVOID  HwDeviceExtension,
00409   /*IN*/ PSTOR_SYNCHRONIZED_ACCESS  SynchronizedAccessRoutine,
00410   /*IN*/ PVOID  Context);
00411 
00412 #ifdef DBG
00413 #define DebugPrint(x) StorPortDebugPrint x
00414 #else
00415 #define DebugPrint(x)
00416 #endif
00417 
00418 #ifdef __cplusplus
00419 }
00420 #endif
00421 
00422 #endif /* __STORPORT_H */