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

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * Device driver for the SYMBIOS/LSILOGIC 53C8XX and 53C1010 family 
  3.  * of PCI-SCSI IO processors.
  4.  *
  5.  * Copyright (C) 1999-2001  Gerard Roudier <groudier@free.fr>
  6.  *
  7.  * This driver is derived from the Linux sym53c8xx driver.
  8.  * Copyright (C) 1998-2000  Gerard Roudier
  9.  *
  10.  * The sym53c8xx driver is derived from the ncr53c8xx driver that had been 
  11.  * a port of the FreeBSD ncr driver to Linux-1.2.13.
  12.  *
  13.  * The original ncr driver has been written for 386bsd and FreeBSD by
  14.  *         Wolfgang Stanglmeier        <wolf@cologne.de>
  15.  *         Stefan Esser                <se@mi.Uni-Koeln.de>
  16.  * Copyright (C) 1994  Wolfgang Stanglmeier
  17.  *
  18.  * Other major contributions:
  19.  *
  20.  * NVRAM detection and reading.
  21.  * Copyright (C) 1997 Richard Waltham <dormouse@farsrobt.demon.co.uk>
  22.  *
  23.  *-----------------------------------------------------------------------------
  24.  *
  25.  * Redistribution and use in source and binary forms, with or without
  26.  * modification, are permitted provided that the following conditions
  27.  * are met:
  28.  * 1. Redistributions of source code must retain the above copyright
  29.  *    notice, this list of conditions and the following disclaimer.
  30.  * 2. The name of the author may not be used to endorse or promote products
  31.  *    derived from this software without specific prior written permission.
  32.  *
  33.  * Where this Software is combined with software released under the terms of 
  34.  * the GNU Public License ("GPL") and the terms of the GPL would require the 
  35.  * combined work to also be released under the terms of the GPL, the terms
  36.  * and conditions of this License will apply in addition to those of the
  37.  * GPL with the exception of any terms or conditions of this License that
  38.  * conflict with, or are expressly prohibited by, the GPL.
  39.  *
  40.  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
  41.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  42.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  43.  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
  44.  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  45.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  46.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  47.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  48.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  49.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  50.  * SUCH DAMAGE.
  51.  */
  52. #ifndef SYM53C8XX_H
  53. #define SYM53C8XX_H
  54. #if !defined(LINUX_VERSION_CODE)
  55. #include <linux/version.h>
  56. #endif
  57. #include <linux/config.h>
  58. /*
  59.  *  Compatibility with ncr53c8xx and sym53c8xx configuration options.
  60.  */
  61. #ifndef CONFIG_SCSI_SYM53C8XX_IOMAPPED
  62. #ifdef CONFIG_SCSI_NCR53C8XX_IOMAPPED
  63. #define CONFIG_SCSI_SYM53C8XX_IOMAPPED CONFIG_SCSI_NCR53C8XX_IOMAPPED
  64. #endif
  65. #endif
  66. #ifndef CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS
  67. #ifdef CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS
  68. #define CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS
  69. #endif
  70. #endif
  71. #ifndef CONFIG_SCSI_SYM53C8XX_MAX_TAGS
  72. #ifdef CONFIG_SCSI_NCR53C8XX_MAX_TAGS
  73. #define CONFIG_SCSI_SYM53C8XX_MAX_TAGS CONFIG_SCSI_NCR53C8XX_MAX_TAGS
  74. #endif
  75. #endif
  76. int sym53c8xx_detect(Scsi_Host_Template *tpnt);
  77. const char *sym53c8xx_info(struct Scsi_Host *host);
  78. int sym53c8xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
  79. int sym53c8xx_eh_abort_handler(Scsi_Cmnd *);
  80. int sym53c8xx_eh_device_reset_handler(Scsi_Cmnd *);
  81. int sym53c8xx_eh_bus_reset_handler(Scsi_Cmnd *);
  82. int sym53c8xx_eh_host_reset_handler(Scsi_Cmnd *);
  83. #ifdef MODULE
  84. int sym53c8xx_release(struct Scsi_Host *);
  85. #else
  86. #define sym53c8xx_release NULL
  87. #endif
  88. /*
  89.  *  Host template defintion
  90.  */
  91. #if (LINUX_VERSION_CODE >= 0x020400) || defined(HOSTS_C) || defined(MODULE)
  92. #include <scsi/scsicam.h>
  93. #define SYM53C8XX {
  94. name: "sym53c8xx",
  95. detect: sym53c8xx_detect,
  96. release: sym53c8xx_release,
  97. info: sym53c8xx_info, 
  98. queuecommand: sym53c8xx_queue_command,
  99. use_new_eh_code: 1,
  100. eh_abort_handler: sym53c8xx_eh_abort_handler,
  101. eh_device_reset_handler:sym53c8xx_eh_device_reset_handler,
  102. eh_bus_reset_handler: sym53c8xx_eh_bus_reset_handler,
  103. eh_host_reset_handler: sym53c8xx_eh_host_reset_handler,
  104. bios_param: scsicam_bios_param,
  105. can_queue: 0,
  106. this_id: 7,
  107. sg_tablesize: 0,
  108. cmd_per_lun: 0,
  109. use_clustering: DISABLE_CLUSTERING,
  110. highmem_io: 1}
  111. #endif /* defined(HOSTS_C) || defined(MODULE) */ 
  112. /*
  113.  *  Translate kernel configuration parameters
  114.  *  into corresponding driver parameters.
  115.  */
  116. #if !defined(HOSTS_C)
  117. /*
  118.  *  Use normal IO if configured.
  119.  *  Normal IO forced for alpha.
  120.  *  Forced to MMIO for sparc.
  121.  */
  122. #if defined(__alpha__)
  123. #define SYM_CONF_IOMAPPED
  124. #elif defined(__sparc__)
  125. #undef SYM_CONF_IOMAPPED
  126. /* #elif defined(__powerpc__) */
  127. /* #define SYM_CONF_IOMAPPED */
  128. /* #define SYM_OPT_NO_BUS_MEMORY_MAPPING */
  129. #elif defined(CONFIG_SCSI_SYM53C8XX_IOMAPPED)
  130. #define SYM_CONF_IOMAPPED
  131. #endif
  132. /*
  133.  *  DMA addressing mode.
  134.  *
  135.  *  0 : 32 bit addressing for all chips.
  136.  *  1 : 40 bit addressing when supported by chip.
  137.  *  2 : 64 bit addressing when supported by chip,
  138.  *      limited to 16 segments of 4 GB -> 64 GB max.
  139.  */
  140. #ifdef CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE
  141. #define SYM_CONF_DMA_ADDRESSING_MODE CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE
  142. #endif
  143. /*
  144.  *  NCR PQS/PDS special device support.
  145.  */
  146. #if 1
  147. #define SYM_CONF_PQS_PDS_SUPPORT
  148. #endif
  149. /*
  150.  *  NVRAM support.
  151.  */
  152. #if 1
  153. #define SYM_CONF_NVRAM_SUPPORT (1)
  154. #define SYM_SETUP_SYMBIOS_NVRAM (1)
  155. #define SYM_SETUP_TEKRAM_NVRAM (1)
  156. #endif
  157. /*
  158.  *  These options are not tunable from 'make config'
  159.  */
  160. #if 1
  161. #define SYM_LINUX_PROC_INFO_SUPPORT
  162. #define SYM_LINUX_BOOT_COMMAND_LINE_SUPPORT
  163. #define SYM_LINUX_USER_COMMAND_SUPPORT
  164. #define SYM_LINUX_USER_INFO_SUPPORT
  165. #define SYM_LINUX_DEBUG_CONTROL_SUPPORT
  166. #endif
  167. /*
  168.  *  Also handle old NCR chips if not (0).
  169.  */
  170. #define SYM_CONF_GENERIC_SUPPORT (1)
  171. /*
  172.  *  Allow tags from 2 to 256, default 8
  173.  */
  174. #ifndef CONFIG_SCSI_SYM53C8XX_MAX_TAGS
  175. #define CONFIG_SCSI_SYM53C8XX_MAX_TAGS (8)
  176. #endif
  177. #if CONFIG_SCSI_SYM53C8XX_MAX_TAGS < 2
  178. #define SYM_CONF_MAX_TAG (2)
  179. #elif CONFIG_SCSI_SYM53C8XX_MAX_TAGS > 256
  180. #define SYM_CONF_MAX_TAG (256)
  181. #else
  182. #define SYM_CONF_MAX_TAG CONFIG_SCSI_SYM53C8XX_MAX_TAGS
  183. #endif
  184. #ifndef CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS
  185. #define CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS SYM_CONF_MAX_TAG
  186. #endif
  187. /*
  188.  *  Anyway, we configure the driver for at least 64 tags per LUN. :)
  189.  */
  190. #if SYM_CONF_MAX_TAG <= 64
  191. #define SYM_CONF_MAX_TAG_ORDER (6)
  192. #elif SYM_CONF_MAX_TAG <= 128
  193. #define SYM_CONF_MAX_TAG_ORDER (7)
  194. #else
  195. #define SYM_CONF_MAX_TAG_ORDER (8)
  196. #endif
  197. /*
  198.  *  Sync transfer frequency at startup.
  199.  *  Allow up to ULTRA-160. The driver will scale the value 
  200.  *  according to controller capabilities.
  201.  */
  202. #define CONFIG_SCSI_SYM53C8XX_DEFAULT_SYNC (9)
  203. /*
  204.  *  Max number of SG entries.
  205.  */
  206. #define SYM_CONF_MAX_SG (96)
  207. /*
  208.  *  Max number of LUNs per target.
  209.  */
  210. #if 1 /* defined CONFIG_SCSI_MULTI_LUN */
  211. #define CONFIG_SCSI_SYM53C8XX_MAX_LUN (16)
  212. #else
  213. #define CONFIG_SCSI_SYM53C8XX_MAX_LUN (1)
  214. #endif
  215. /*
  216.  *  Driver setup structure.
  217.  *
  218.  *  This structure is initialized from linux config options.
  219.  *  It can be overridden at boot-up by the boot command line.
  220.  */
  221. struct sym_driver_setup {
  222. u_char pci_parity;
  223. u_char scsi_parity;
  224. u_short max_tag;
  225. u_char min_sync;
  226. u_char burst_order;
  227. u_char scsi_led;
  228. u_char max_wide;
  229. u_char scsi_diff;
  230. u_char irq_mode;
  231. u_char scsi_bus_check;
  232. u_char host_id;
  233. u_char max_offs;
  234. u_char max_lun;
  235. u_char pci_fix_up;
  236. u_char reverse_probe;
  237. u_char verbose;
  238. u_short debug;
  239. u_char settle_delay;
  240. u_char use_nvram;
  241. u_long excludes[8];
  242. char tag_ctrl[100];
  243. };
  244. #define SYM_SETUP_PCI_PARITY sym_driver_setup.pci_parity
  245. #define SYM_SETUP_SCSI_PARITY sym_driver_setup.scsi_parity
  246. #define SYM_SETUP_MAX_TAG sym_driver_setup.max_tag
  247. #define SYM_SETUP_MIN_SYNC sym_driver_setup.min_sync
  248. #define SYM_SETUP_BURST_ORDER sym_driver_setup.burst_order
  249. #define SYM_SETUP_SCSI_LED sym_driver_setup.scsi_led
  250. #define SYM_SETUP_MAX_WIDE sym_driver_setup.max_wide
  251. #define SYM_SETUP_SCSI_DIFF sym_driver_setup.scsi_diff
  252. #define SYM_SETUP_IRQ_MODE sym_driver_setup.irq_mode
  253. #define SYM_SETUP_SCSI_BUS_CHECK sym_driver_setup.scsi_bus_check
  254. #define SYM_SETUP_HOST_ID sym_driver_setup.host_id
  255. #define SYM_SETUP_MAX_OFFS sym_driver_setup.max_offs
  256. #define SYM_SETUP_MAX_LUN sym_driver_setup.max_lun
  257. #define SYM_SETUP_PCI_FIX_UP sym_driver_setup.pci_fix_up
  258. /*
  259.  *  Initial setup.
  260.  *
  261.  *  Can be overriden at startup by a command line.
  262.  */
  263. #define SYM_LINUX_DRIVER_SETUP
  264. {
  265. 1, /* pci_parity */
  266. 1, /* scsi_parity */
  267. CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS,
  268. CONFIG_SCSI_SYM53C8XX_DEFAULT_SYNC,
  269. 7, /* burst_order */
  270. 1, /* scsi_led */
  271. 1, /* max_wide */
  272. 1, /* scsi_diff */
  273. 0, /* irq_mode */
  274. 1, /* scsi_bus_check */
  275. 7, /* host_id */
  276. 62, /* max_offs */
  277. CONFIG_SCSI_SYM53C8XX_MAX_LUN,
  278. 3, /* pci_fix_up */
  279. 0, /* reverse_probe */
  280. 0, /* verbose */
  281. 0, /* debug */
  282. 3, /* settle_delay */
  283. 1, /* use_nvram */
  284. }
  285. /*
  286.  *  Boot fail safe setup.
  287.  *
  288.  *  Override initial setup from boot command line:
  289.  *    sym53c8xx=safe:y
  290.  */
  291. #define SYM_LINUX_DRIVER_SAFE_SETUP
  292. {
  293. 0, /* pci_parity */
  294. 0, /* scsi_parity */
  295. 0, /* max_tag */
  296. 50, /* min_sync */
  297. 0, /* burst_order */
  298. 0, /* scsi_led */
  299. 1, /* max_wide */
  300. 1, /* scsi_diff */
  301. 0, /* irq_mode */
  302. 2, /* scsi_bus_check */
  303. 7, /* host_id */
  304. 15, /* max_offs */
  305. 1, /* max_lun */
  306. 0, /* pci_fix_up */
  307. 0, /* reverse_probe */
  308. 2, /* verbose */
  309. 0, /* debug */
  310. 10, /* settle_delay */
  311. 1, /* use_nvram */
  312. }
  313. /*
  314.  *  This structure is initialized from linux config options.
  315.  *  It can be overridden at boot-up by the boot command line.
  316.  */
  317. #ifdef SYM_GLUE_C
  318. struct sym_driver_setup
  319. sym_driver_setup = SYM_LINUX_DRIVER_SETUP;
  320. #ifdef SYM_LINUX_DEBUG_CONTROL_SUPPORT
  321. u_int sym_debug_flags = 0;
  322. #endif
  323. #else
  324. extern struct sym_driver_setup sym_driver_setup;
  325. #ifdef SYM_LINUX_DEBUG_CONTROL_SUPPORT
  326. extern u_int sym_debug_flags;
  327. #endif
  328. #endif /* SYM_GLUE_C */
  329. #ifdef SYM_LINUX_DEBUG_CONTROL_SUPPORT
  330. #define DEBUG_FLAGS sym_debug_flags
  331. #endif
  332. #define boot_verbose sym_driver_setup.verbose
  333. #endif /* !defined(HOSTS_C) */ 
  334. #endif /* SYM53C8XX_H */