^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Device driver for the SYMBIOS/LSILOGIC 53C8XX and 53C1010 family
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * of PCI-SCSI IO processors.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 1999-2001 Gerard Roudier <groudier@free.fr>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * This driver is derived from the Linux sym53c8xx driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Copyright (C) 1998-2000 Gerard Roudier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * The sym53c8xx driver is derived from the ncr53c8xx driver that had been
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * a port of the FreeBSD ncr driver to Linux-1.2.13.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * The original ncr driver has been written for 386bsd and FreeBSD by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * Wolfgang Stanglmeier <wolf@cologne.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * Stefan Esser <se@mi.Uni-Koeln.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * Copyright (C) 1994 Wolfgang Stanglmeier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * Other major contributions:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * NVRAM detection and reading.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * Copyright (C) 1997 Richard Waltham <dormouse@farsrobt.demon.co.uk>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) *-----------------------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #ifndef SYM53C8XX_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define SYM53C8XX_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * DMA addressing mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * 0 : 32 bit addressing for all chips.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) * 1 : 40 bit addressing when supported by chip.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * 2 : 64 bit addressing when supported by chip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) * limited to 16 segments of 4 GB -> 64 GB max.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define SYM_CONF_DMA_ADDRESSING_MODE CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) * NVRAM support.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #if 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #define SYM_CONF_NVRAM_SUPPORT (1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) * These options are not tunable from 'make config'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #if 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #define SYM_LINUX_PROC_INFO_SUPPORT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #define SYM_LINUX_USER_COMMAND_SUPPORT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #define SYM_LINUX_USER_INFO_SUPPORT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #define SYM_LINUX_DEBUG_CONTROL_SUPPORT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) * Also handle old NCR chips if not (0).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #define SYM_CONF_GENERIC_SUPPORT (1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) * Allow tags from 2 to 256, default 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #ifndef CONFIG_SCSI_SYM53C8XX_MAX_TAGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #define CONFIG_SCSI_SYM53C8XX_MAX_TAGS (8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #if CONFIG_SCSI_SYM53C8XX_MAX_TAGS < 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) #define SYM_CONF_MAX_TAG (2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) #elif CONFIG_SCSI_SYM53C8XX_MAX_TAGS > 256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) #define SYM_CONF_MAX_TAG (256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) #define SYM_CONF_MAX_TAG CONFIG_SCSI_SYM53C8XX_MAX_TAGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) #ifndef CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) #define CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS SYM_CONF_MAX_TAG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) * Anyway, we configure the driver for at least 64 tags per LUN. :)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) #if SYM_CONF_MAX_TAG <= 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) #define SYM_CONF_MAX_TAG_ORDER (6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) #elif SYM_CONF_MAX_TAG <= 128
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) #define SYM_CONF_MAX_TAG_ORDER (7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) #define SYM_CONF_MAX_TAG_ORDER (8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) * Max number of SG entries.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) #define SYM_CONF_MAX_SG (96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) * Driver setup structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) * This structure is initialized from linux config options.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) * It can be overridden at boot-up by the boot command line.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) struct sym_driver_setup {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) u_short max_tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) u_char burst_order;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) u_char scsi_led;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) u_char scsi_diff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) u_char irq_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) u_char scsi_bus_check;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) u_char host_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) u_char verbose;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) u_char settle_delay;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) u_char use_nvram;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) u_long excludes[8];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) #define SYM_SETUP_MAX_TAG sym_driver_setup.max_tag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) #define SYM_SETUP_BURST_ORDER sym_driver_setup.burst_order
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) #define SYM_SETUP_SCSI_LED sym_driver_setup.scsi_led
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) #define SYM_SETUP_SCSI_DIFF sym_driver_setup.scsi_diff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) #define SYM_SETUP_IRQ_MODE sym_driver_setup.irq_mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) #define SYM_SETUP_SCSI_BUS_CHECK sym_driver_setup.scsi_bus_check
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) #define SYM_SETUP_HOST_ID sym_driver_setup.host_id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) #define boot_verbose sym_driver_setup.verbose
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) * Initial setup.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) * Can be overriden at startup by a command line.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) #define SYM_LINUX_DRIVER_SETUP { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) .max_tag = CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) .burst_order = 7, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) .scsi_led = 1, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) .scsi_diff = 1, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) .irq_mode = 0, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) .scsi_bus_check = 1, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) .host_id = 7, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) .verbose = 0, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) .settle_delay = 3, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) .use_nvram = 1, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) extern struct sym_driver_setup sym_driver_setup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) extern unsigned int sym_debug_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) #define DEBUG_FLAGS sym_debug_flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) * Max number of targets.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) * Maximum is 16 and you are advised not to change this value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) #ifndef SYM_CONF_MAX_TARGET
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) #define SYM_CONF_MAX_TARGET (16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) * Max number of logical units.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) * SPI-2 allows up to 64 logical units, but in real life, target
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) * that implements more that 7 logical units are pretty rare.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) * Anyway, the cost of accepting up to 64 logical unit is low in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) * this driver, thus going with the maximum is acceptable.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) #ifndef SYM_CONF_MAX_LUN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) #define SYM_CONF_MAX_LUN (64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) * Max number of IO control blocks queued to the controller.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) * Each entry needs 8 bytes and the queues are allocated contiguously.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) * Since we donnot want to allocate more than a page, the theorical
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) * maximum is PAGE_SIZE/8. For safety, we announce a bit less to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) * access method. :)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) * When not supplied, as it is suggested, the driver compute some
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) * good value for this parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) /* #define SYM_CONF_MAX_START (PAGE_SIZE/8 - 16) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) * Support for Immediate Arbitration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) * Not advised.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) /* #define SYM_CONF_IARB_SUPPORT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) * Only relevant if IARB support configured.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) * - Max number of successive settings of IARB hints.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) * - Set IARB on arbitration lost.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) #define SYM_CONF_IARB_MAX 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) #define SYM_CONF_SET_IARB_ON_ARB_LOST 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) * Returning wrong residuals may make problems.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) * When zero, this define tells the driver to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) * always return 0 as transfer residual.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) * Btw, all my testings of residuals have succeeded.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) #define SYM_SETUP_RESIDUAL_SUPPORT 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) #endif /* SYM53C8XX_H */