mptscsih.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:10k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  *  linux/drivers/message/fusion/mptscsih.h
  3.  *      High performance SCSI / Fibre Channel SCSI Host device driver.
  4.  *      For use with PCI chip/adapter(s):
  5.  *          LSIFC9xx/LSI409xx Fibre Channel
  6.  *      running LSI Logic Fusion MPT (Message Passing Technology) firmware.
  7.  *
  8.  *  Credits:
  9.  *      This driver would not exist if not for Alan Cox's development
  10.  *      of the linux i2o driver.
  11.  *
  12.  *      A huge debt of gratitude is owed to David S. Miller (DaveM)
  13.  *      for fixing much of the stupid and broken stuff in the early
  14.  *      driver while porting to sparc64 platform.  THANK YOU!
  15.  *
  16.  *      (see also mptbase.c)
  17.  *
  18.  *  Copyright (c) 1999-2002 LSI Logic Corporation
  19.  *  Originally By: Steven J. Ralston
  20.  *  (mailto:netscape.net)
  21.  *  (mailto:Pam.Delaney@lsil.com)
  22.  *
  23.  *  $Id: mptscsih.h,v 1.18 2002/06/06 15:32:52 pdelaney Exp $
  24.  */
  25. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
  26. /*
  27.     This program is free software; you can redistribute it and/or modify
  28.     it under the terms of the GNU General Public License as published by
  29.     the Free Software Foundation; version 2 of the License.
  30.     This program is distributed in the hope that it will be useful,
  31.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  32.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  33.     GNU General Public License for more details.
  34.     NO WARRANTY
  35.     THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
  36.     CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
  37.     LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
  38.     MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
  39.     solely responsible for determining the appropriateness of using and
  40.     distributing the Program and assumes all risks associated with its
  41.     exercise of rights under this Agreement, including but not limited to
  42.     the risks and costs of program errors, damage to or loss of data,
  43.     programs or equipment, and unavailability or interruption of operations.
  44.     DISCLAIMER OF LIABILITY
  45.     NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
  46.     DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  47.     DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
  48.     ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  49.     TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  50.     USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
  51.     HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
  52.     You should have received a copy of the GNU General Public License
  53.     along with this program; if not, write to the Free Software
  54.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  55. */
  56. #ifndef SCSIHOST_H_INCLUDED
  57. #define SCSIHOST_H_INCLUDED
  58. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
  59. #include "linux/version.h"
  60. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
  61. /*
  62.  * SCSI Public stuff...
  63.  */
  64. /*
  65.  * Try to keep these at 2^N-1
  66.  */
  67. #define MPT_FC_CAN_QUEUE 63
  68. //#define MPT_SCSI_CAN_QUEUE 31
  69. #define MPT_SCSI_CAN_QUEUE MPT_FC_CAN_QUEUE
  70. #define MPT_SCSI_CMD_PER_LUN  7
  71. #define MPT_SCSI_SG_DEPTH 40
  72. /* To disable domain validation, uncomment the
  73.  * following line. No effect for FC devices.
  74.  * For SCSI devices, driver will negotiate to
  75.  * NVRAM settings (if available) or to maximum adapter
  76.  * capabilities.
  77.  */
  78. /* #define MPTSCSIH_DISABLE_DOMAIN_VALIDATION */
  79. /* SCSI driver setup structure. Settings can be overridden
  80.  * by command line options.
  81.  */
  82. #define MPTSCSIH_DOMAIN_VALIDATION      1
  83. #define MPTSCSIH_MAX_WIDTH              1
  84. #define MPTSCSIH_MIN_SYNC               0x08
  85. struct mptscsih_driver_setup
  86. {
  87.         u8      dv;
  88.         u8      max_width;
  89.         u8      min_sync_fac;
  90. };
  91. #define MPTSCSIH_DRIVER_SETUP                   
  92. {                                               
  93.         MPTSCSIH_DOMAIN_VALIDATION,             
  94.         MPTSCSIH_MAX_WIDTH,                     
  95.         MPTSCSIH_MIN_SYNC,                      
  96. }
  97. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
  98. /*
  99.  * Various bits and pieces broke within the lk-2.4.0-testN series:-(
  100.  * So here are various HACKS to work around them.
  101.  */
  102. /*
  103.  * Conditionalizing with "#ifdef MODULE/#endif" around:
  104.  * static Scsi_Host_Template driver_template = XX;
  105.  * #include <../../scsi/scsi_module.c>
  106.  * lines was REMOVED @ lk-2.4.0-test9
  107.  * Issue discovered 20001213 by: sshirron
  108.  */
  109. #define MPT_SCSIHOST_NEED_ENTRY_EXIT_HOOKUPS 1
  110. #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,0)
  111. # if LINUX_VERSION_CODE == KERNEL_VERSION(2,4,0)
  112. /*
  113.  * Super HACK!  -by sralston:-(
  114.  * (good grief; heaven help me!)
  115.  */
  116. # include <linux/capability.h>
  117. # if !defined(CAP_LEASE) && !defined(MODULE)
  118. # undef MPT_SCSIHOST_NEED_ENTRY_EXIT_HOOKUPS
  119. # endif
  120. # else
  121. # ifndef MODULE
  122. # undef MPT_SCSIHOST_NEED_ENTRY_EXIT_HOOKUPS
  123. # endif
  124. # endif
  125. #endif
  126. /*
  127.  * tq_scheduler disappeared @ lk-2.4.0-test12
  128.  * (right when <linux/sched.h> newly defined TQ_ACTIVE)
  129.  */
  130. #define HAVE_TQ_SCHED 1
  131. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
  132. # include <linux/sched.h>
  133. # ifdef TQ_ACTIVE
  134. # undef HAVE_TQ_SCHED
  135. # endif
  136. #endif
  137. #ifdef HAVE_TQ_SCHED
  138. #define SCHEDULE_TASK(x)
  139. /*MOD_INC_USE_COUNT*/;
  140. (x)->next = NULL;
  141. queue_task(x, &tq_scheduler)
  142. #else
  143. #define SCHEDULE_TASK(x)
  144. /*MOD_INC_USE_COUNT*/;
  145. if (schedule_task(x) == 0) {
  146. /*MOD_DEC_USE_COUNT*/;
  147. }
  148. #endif
  149. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
  150. #define x_scsi_detect mptscsih_detect
  151. #define x_scsi_release mptscsih_release
  152. #define x_scsi_info mptscsih_info
  153. #define x_scsi_queuecommand mptscsih_qcmd
  154. #define x_scsi_abort mptscsih_abort
  155. #define x_scsi_bus_reset mptscsih_bus_reset
  156. #define x_scsi_dev_reset mptscsih_dev_reset
  157. #define x_scsi_host_reset mptscsih_host_reset
  158. #define x_scsi_bios_param mptscsih_bios_param
  159. #define x_scsi_select_queue_depths mptscsih_select_queue_depths
  160. #define x_scsi_taskmgmt_bh mptscsih_taskmgmt_bh
  161. #define x_scsi_old_abort mptscsih_old_abort
  162. #define x_scsi_old_reset mptscsih_old_reset
  163. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
  164. /*
  165.  * MPT SCSI Host / Initiator decls...
  166.  */
  167. extern int  x_scsi_detect(Scsi_Host_Template *);
  168. extern int  x_scsi_release(struct Scsi_Host *host);
  169. extern const char *x_scsi_info(struct Scsi_Host *);
  170. extern int  x_scsi_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
  171. #ifdef MPT_SCSI_USE_NEW_EH
  172. extern int  x_scsi_abort(Scsi_Cmnd *);
  173. extern int  x_scsi_bus_reset(Scsi_Cmnd *);
  174. extern int  x_scsi_dev_reset(Scsi_Cmnd *);
  175. extern int  x_scsi_host_reset(Scsi_Cmnd *);
  176. #else
  177. extern int  x_scsi_old_abort(Scsi_Cmnd *);
  178. extern int  x_scsi_old_reset(Scsi_Cmnd *, unsigned int);
  179. #endif
  180. extern int  x_scsi_bios_param(Disk *, kdev_t, int *);
  181. extern void  x_scsi_select_queue_depths(struct Scsi_Host *, Scsi_Device *);
  182. extern void  x_scsi_taskmgmt_bh(void *);
  183. #if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
  184. #define PROC_SCSI_DECL
  185. #else
  186. #define PROC_SCSI_DECL  proc_name: "mptscsih",
  187. #endif
  188. #ifdef MPT_SCSI_USE_NEW_EH
  189. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,1)
  190. #define MPT_SCSIHOST {
  191. next: NULL,
  192. PROC_SCSI_DECL
  193. name: "MPT SCSI Host",
  194. detect: x_scsi_detect,
  195. release: x_scsi_release,
  196. info: x_scsi_info,
  197. command: NULL,
  198. queuecommand: x_scsi_queuecommand,
  199. eh_strategy_handler: NULL,
  200. eh_abort_handler: x_scsi_abort,
  201. eh_device_reset_handler: x_scsi_dev_reset,
  202. eh_bus_reset_handler: x_scsi_bus_reset,
  203. eh_host_reset_handler: x_scsi_host_reset,
  204. bios_param: x_scsi_bios_param,
  205. can_queue: MPT_SCSI_CAN_QUEUE,
  206. this_id: -1,
  207. sg_tablesize: MPT_SCSI_SG_DEPTH,
  208. cmd_per_lun: MPT_SCSI_CMD_PER_LUN,
  209. unchecked_isa_dma: 0,
  210. use_clustering: ENABLE_CLUSTERING,
  211. }
  212. #else  /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,1) */
  213. #define MPT_SCSIHOST {
  214. next: NULL,
  215. PROC_SCSI_DECL
  216. name: "MPT SCSI Host",
  217. detect: x_scsi_detect,
  218. release: x_scsi_release,
  219. info: x_scsi_info,
  220. command: NULL,
  221. queuecommand: x_scsi_queuecommand,
  222. eh_strategy_handler: NULL,
  223. eh_abort_handler: x_scsi_abort,
  224. eh_device_reset_handler: x_scsi_dev_reset,
  225. eh_bus_reset_handler: x_scsi_bus_reset,
  226. eh_host_reset_handler: NULL,
  227. bios_param: x_scsi_bios_param,
  228. can_queue: MPT_SCSI_CAN_QUEUE,
  229. this_id: -1,
  230. sg_tablesize: MPT_SCSI_SG_DEPTH,
  231. cmd_per_lun: MPT_SCSI_CMD_PER_LUN,
  232. unchecked_isa_dma: 0,
  233. use_clustering: ENABLE_CLUSTERING,
  234. use_new_eh_code: 1
  235. }
  236. #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,1) */
  237. #else /* MPT_SCSI_USE_NEW_EH */
  238. #define MPT_SCSIHOST {
  239. next: NULL,
  240. PROC_SCSI_DECL
  241. name: "MPT SCSI Host",
  242. detect: x_scsi_detect,
  243. release: x_scsi_release,
  244. info: x_scsi_info,
  245. command: NULL,
  246. queuecommand: x_scsi_queuecommand,
  247. abort: x_scsi_old_abort,
  248. reset: x_scsi_old_reset,
  249. bios_param: x_scsi_bios_param,
  250. can_queue: MPT_SCSI_CAN_QUEUE,
  251. this_id: -1,
  252. sg_tablesize: MPT_SCSI_SG_DEPTH,
  253. cmd_per_lun: MPT_SCSI_CMD_PER_LUN,
  254. unchecked_isa_dma: 0,
  255. use_clustering: ENABLE_CLUSTERING
  256. }
  257. #endif  /* MPT_SCSI_USE_NEW_EH */
  258. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
  259. /*  include/scsi/scsi.h may not be quite complete...  */
  260. #ifndef RESERVE_10
  261. #define RESERVE_10 0x56
  262. #endif
  263. #ifndef RELEASE_10
  264. #define RELEASE_10 0x57
  265. #endif
  266. #ifndef PERSISTENT_RESERVE_IN
  267. #define PERSISTENT_RESERVE_IN 0x5e
  268. #endif
  269. #ifndef PERSISTENT_RESERVE_OUT
  270. #define PERSISTENT_RESERVE_OUT 0x5f
  271. #endif
  272. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
  273. #endif