pci2000.h
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:7k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /****************************************************************************
  2.  * Perceptive Solutions, Inc. PCI-2000 device driver for Linux.
  3.  *
  4.  * pci2000.h - Linux Host Driver for PCI-2000 IntelliCache SCSI Adapters
  5.  *
  6.  * Copyright (c) 1997-1999 Perceptive Solutions, Inc.
  7.  * All Rights Reserved.
  8.  *
  9.  * Redistribution and use in source and binary forms, with or without
  10.  * modification, are permitted provided that redistributions of source
  11.  * code retain the above copyright notice and this comment without
  12.  * modification.
  13.  *
  14.  * Technical updates and product information at:
  15.  *  http://www.psidisk.com
  16.  *
  17.  * Please send questions, comments, bug reports to:
  18.  *  tech@psidisk.com Technical Support
  19.  *
  20.  ****************************************************************************/
  21. #ifndef _PCI2000_H
  22. #define _PCI2000_H
  23. #include <linux/types.h>
  24. #include <linux/kdev_t.h>
  25. #ifndef PSI_EIDE_SCSIOP
  26. #define PSI_EIDE_SCSIOP 1
  27. #ifndef LINUX_VERSION_CODE
  28. #include <linux/version.h>
  29. #endif 
  30. #define LINUXVERSION(v,p,s)    (((v)<<16) + ((p)<<8) + (s))
  31. /************************************************/
  32. /* definition of standard data types */
  33. /************************************************/
  34. #define CHAR char
  35. #define UCHAR unsigned char
  36. #define SHORT short
  37. #define USHORT unsigned short
  38. #define BOOL long
  39. #define LONG long
  40. #define ULONG unsigned long
  41. #define VOID void
  42. typedef CHAR *PCHAR;
  43. typedef UCHAR *PUCHAR;
  44. typedef SHORT *PSHORT;
  45. typedef USHORT *PUSHORT;
  46. typedef BOOL *PBOOL;
  47. typedef LONG *PLONG;
  48. typedef ULONG *PULONG;
  49. typedef VOID *PVOID;
  50. /************************************************/
  51. /* Misc. macros   */
  52. /************************************************/
  53. #define ANY2SCSI(up, p)
  54. ((UCHAR *)up)[0] = (((ULONG)(p)) >> 8);
  55. ((UCHAR *)up)[1] = ((ULONG)(p));
  56. #define SCSI2LONG(up)
  57. ( (((long)*(((UCHAR *)up))) << 16)
  58. + (((long)(((UCHAR *)up)[1])) << 8)
  59. + ((long)(((UCHAR *)up)[2])) )
  60. #define XANY2SCSI(up, p)
  61. ((UCHAR *)up)[0] = ((long)(p)) >> 24;
  62. ((UCHAR *)up)[1] = ((long)(p)) >> 16;
  63. ((UCHAR *)up)[2] = ((long)(p)) >> 8;
  64. ((UCHAR *)up)[3] = ((long)(p));
  65. #define XSCSI2LONG(up)
  66. ( (((long)(((UCHAR *)up)[0])) << 24)
  67. + (((long)(((UCHAR *)up)[1])) << 16)
  68. + (((long)(((UCHAR *)up)[2])) <<  8)
  69. + ((long)(((UCHAR *)up)[3])) )
  70. /************************************************/
  71. /* SCSI CDB operation codes  */
  72. /************************************************/
  73. #define SCSIOP_TEST_UNIT_READY 0x00
  74. #define SCSIOP_REZERO_UNIT 0x01
  75. #define SCSIOP_REWIND 0x01
  76. #define SCSIOP_REQUEST_BLOCK_ADDR 0x02
  77. #define SCSIOP_REQUEST_SENSE 0x03
  78. #define SCSIOP_FORMAT_UNIT 0x04
  79. #define SCSIOP_READ_BLOCK_LIMITS 0x05
  80. #define SCSIOP_REASSIGN_BLOCKS 0x07
  81. #define SCSIOP_READ6 0x08
  82. #define SCSIOP_RECEIVE 0x08
  83. #define SCSIOP_WRITE6 0x0A
  84. #define SCSIOP_PRINT 0x0A
  85. #define SCSIOP_SEND 0x0A
  86. #define SCSIOP_SEEK6 0x0B
  87. #define SCSIOP_TRACK_SELECT 0x0B
  88. #define SCSIOP_SLEW_PRINT 0x0B
  89. #define SCSIOP_SEEK_BLOCK 0x0C
  90. #define SCSIOP_PARTITION 0x0D
  91. #define SCSIOP_READ_REVERSE 0x0F
  92. #define SCSIOP_WRITE_FILEMARKS 0x10
  93. #define SCSIOP_FLUSH_BUFFER 0x10
  94. #define SCSIOP_SPACE 0x11
  95. #define SCSIOP_INQUIRY 0x12
  96. #define SCSIOP_VERIFY6 0x13
  97. #define SCSIOP_RECOVER_BUF_DATA 0x14
  98. #define SCSIOP_MODE_SELECT 0x15
  99. #define SCSIOP_RESERVE_UNIT 0x16
  100. #define SCSIOP_RELEASE_UNIT 0x17
  101. #define SCSIOP_COPY 0x18
  102. #define SCSIOP_ERASE 0x19
  103. #define SCSIOP_MODE_SENSE 0x1A
  104. #define SCSIOP_START_STOP_UNIT 0x1B
  105. #define SCSIOP_STOP_PRINT 0x1B
  106. #define SCSIOP_LOAD_UNLOAD 0x1B
  107. #define SCSIOP_RECEIVE_DIAGNOSTIC 0x1C
  108. #define SCSIOP_SEND_DIAGNOSTIC 0x1D
  109. #define SCSIOP_MEDIUM_REMOVAL 0x1E
  110. #define SCSIOP_READ_CAPACITY 0x25
  111. #define SCSIOP_READ 0x28
  112. #define SCSIOP_WRITE 0x2A
  113. #define SCSIOP_SEEK 0x2B
  114. #define SCSIOP_LOCATE 0x2B
  115. #define SCSIOP_WRITE_VERIFY 0x2E
  116. #define SCSIOP_VERIFY 0x2F
  117. #define SCSIOP_SEARCH_DATA_HIGH 0x30
  118. #define SCSIOP_SEARCH_DATA_EQUAL 0x31
  119. #define SCSIOP_SEARCH_DATA_LOW 0x32
  120. #define SCSIOP_SET_LIMITS 0x33
  121. #define SCSIOP_READ_POSITION 0x34
  122. #define SCSIOP_SYNCHRONIZE_CACHE 0x35
  123. #define SCSIOP_COMPARE 0x39
  124. #define SCSIOP_COPY_COMPARE 0x3A
  125. #define SCSIOP_WRITE_DATA_BUFF 0x3B
  126. #define SCSIOP_READ_DATA_BUFF 0x3C
  127. #define SCSIOP_CHANGE_DEFINITION 0x40
  128. #define SCSIOP_READ_SUB_CHANNEL 0x42
  129. #define SCSIOP_READ_TOC 0x43
  130. #define SCSIOP_READ_HEADER 0x44
  131. #define SCSIOP_PLAY_AUDIO 0x45
  132. #define SCSIOP_PLAY_AUDIO_MSF 0x47
  133. #define SCSIOP_PLAY_TRACK_INDEX 0x48
  134. #define SCSIOP_PLAY_TRACK_RELATIVE 0x49
  135. #define SCSIOP_PAUSE_RESUME 0x4B
  136. #define SCSIOP_LOG_SELECT 0x4C
  137. #define SCSIOP_LOG_SENSE 0x4D
  138. #define SCSIOP_MODE_SELECT10 0x55
  139. #define SCSIOP_MODE_SENSE10 0x5A
  140. #define SCSIOP_LOAD_UNLOAD_SLOT 0xA6
  141. #define SCSIOP_MECHANISM_STATUS 0xBD
  142. #define SCSIOP_READ_CD 0xBE
  143. // SCSI read capacity structure
  144. typedef struct _READ_CAPACITY_DATA
  145. {
  146. ULONG blks; /* total blocks (converted to little endian) */
  147. ULONG blksiz; /* size of each (converted to little endian) */
  148. } READ_CAPACITY_DATA, *PREAD_CAPACITY_DATA;
  149. // SCSI inquiry data
  150. typedef struct _INQUIRYDATA
  151. {
  152. UCHAR DeviceType :5;
  153. UCHAR DeviceTypeQualifier :3;
  154. UCHAR DeviceTypeModifier :7;
  155. UCHAR RemovableMedia :1;
  156.     UCHAR Versions;
  157.     UCHAR ResponseDataFormat;
  158.     UCHAR AdditionalLength;
  159.     UCHAR Reserved[2];
  160. UCHAR SoftReset :1;
  161. UCHAR CommandQueue :1;
  162. UCHAR Reserved2 :1;
  163. UCHAR LinkedCommands :1;
  164. UCHAR Synchronous :1;
  165. UCHAR Wide16Bit :1;
  166. UCHAR Wide32Bit :1;
  167. UCHAR RelativeAddressing :1;
  168.     UCHAR VendorId[8];
  169.     UCHAR ProductId[16];
  170.     UCHAR ProductRevisionLevel[4];
  171.     UCHAR VendorSpecific[20];
  172.     UCHAR Reserved3[40];
  173. } INQUIRYDATA, *PINQUIRYDATA;
  174. #endif
  175. // function prototypes
  176. int Pci2000_Detect (Scsi_Host_Template *tpnt);
  177. int Pci2000_Command (Scsi_Cmnd *SCpnt);
  178. int Pci2000_QueueCommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *));
  179. int Pci2000_Abort (Scsi_Cmnd *SCpnt);
  180. int Pci2000_Reset (Scsi_Cmnd *SCpnt, unsigned int flags);
  181. int Pci2000_Release (struct Scsi_Host *pshost);
  182. int Pci2000_BiosParam (Disk *disk, kdev_t dev, int geom[]);
  183. #ifndef NULL
  184. #define NULL 0
  185. #endif
  186. /* screen is 80 columns wide, damnit! */
  187. #define PCI2000 {
  188. proc_name: "pci2000",
  189. name: "PCI-2000 SCSI Intelligent Disk Controller",
  190. detect: Pci2000_Detect,
  191. release: Pci2000_Release,
  192. command: Pci2000_Command,
  193. queuecommand: Pci2000_QueueCommand,
  194. abort: Pci2000_Abort,
  195. reset: Pci2000_Reset,
  196. bios_param: Pci2000_BiosParam,
  197. can_queue: 16,
  198. this_id: -1,
  199. sg_tablesize: 16,
  200. cmd_per_lun: 1,
  201. present: 0,
  202. unchecked_isa_dma:0,
  203. use_clustering: DISABLE_CLUSTERING,
  204. use_new_eh_code:0
  205. }
  206. #endif