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