2 * Device driver for the SYMBIOS/LSILOGIC 53C8XX and 53C1010 family
3 * of PCI-SCSI IO processors.
5 * Copyright (C) 1999-2001 Gerard Roudier <groudier@free.fr>
7 * This driver is derived from the Linux sym53c8xx driver.
8 * Copyright (C) 1998-2000 Gerard Roudier
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.
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
18 * Other major contributions:
20 * NVRAM detection and reading.
21 * Copyright (C) 1997 Richard Waltham <dormouse@farsrobt.demon.co.uk>
23 *-----------------------------------------------------------------------------
25 * Redistribution and use in source and binary forms, with or without
26 * modification, are permitted provided that the following conditions
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.
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.
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
59 * Symbios NVRAM data format
61 #define SYMBIOS_NVRAM_SIZE 368
62 #define SYMBIOS_NVRAM_ADDRESS 0x100
64 struct Symbios_nvram {
66 u_short type; /* 0x0000 */
67 u_short byte_count; /* excluding header/trailer */
70 /* Controller set up 20 bytes */
71 u_char v_major; /* 0x00 */
72 u_char v_minor; /* 0x30 */
75 #define SYMBIOS_SCAM_ENABLE (1)
76 #define SYMBIOS_PARITY_ENABLE (1<<1)
77 #define SYMBIOS_VERBOSE_MSGS (1<<2)
78 #define SYMBIOS_CHS_MAPPING (1<<3)
79 #define SYMBIOS_NO_NVRAM (1<<3) /* ??? */
81 #define SYMBIOS_SCAN_HI_LO (1)
83 #define SYMBIOS_TERM_CANT_PROGRAM (0)
84 #define SYMBIOS_TERM_ENABLED (1)
85 #define SYMBIOS_TERM_DISABLED (2)
87 #define SYMBIOS_RMVBL_NO_SUPPORT (0)
88 #define SYMBIOS_RMVBL_BOOT_DEVICE (1)
89 #define SYMBIOS_RMVBL_MEDIA_INSTALLED (2)
91 u_char num_hba; /* 0x04 */
92 u_char num_devices; /* 0x10 */
93 u_char max_scam_devices; /* 0x04 */
94 u_char num_valid_scam_devices; /* 0x00 */
96 #define SYMBIOS_AVOID_BUS_RESET (1<<2)
98 /* Boot order 14 bytes * 4 */
100 u_short type; /* 4:8xx / 0:nok */
101 u_short device_id; /* PCI device id */
102 u_short vendor_id; /* PCI vendor id */
103 u_char bus_nr; /* PCI bus number */
104 u_char device_fn; /* PCI device/function number << 3*/
107 #define SYMBIOS_INIT_SCAN_AT_BOOT (1)
108 u_short io_port; /* PCI io_port address */
111 /* Targets 8 bytes * 16 */
112 struct Symbios_target {
114 #define SYMBIOS_DISCONNECT_ENABLE (1)
115 #define SYMBIOS_SCAN_AT_BOOT_TIME (1<<1)
116 #define SYMBIOS_SCAN_LUNS (1<<2)
117 #define SYMBIOS_QUEUE_TAGS_ENABLED (1<<3)
119 u_char bus_width; /* 0x08/0x10 */
121 u_short sync_period; /* 4*period factor */
124 /* Scam table 8 bytes * 4 */
125 struct Symbios_scam {
128 #define SYMBIOS_SCAM_DEFAULT_METHOD (0)
129 #define SYMBIOS_SCAM_DONT_ASSIGN (1)
130 #define SYMBIOS_SCAM_SET_SPECIFIC_ID (2)
131 #define SYMBIOS_SCAM_USE_ORDER_GIVEN (3)
133 #define SYMBIOS_SCAM_UNKNOWN (0)
134 #define SYMBIOS_SCAM_DEVICE_NOT_FOUND (1)
135 #define SYMBIOS_SCAM_ID_NOT_SET (2)
136 #define SYMBIOS_SCAM_ID_VALID (3)
141 u_char spare_devices[15*8];
142 u_char trailer[6]; /* 0xfe 0xfe 0x00 0x00 0x00 0x00 */
144 typedef struct Symbios_nvram Symbios_nvram;
145 typedef struct Symbios_host Symbios_host;
146 typedef struct Symbios_target Symbios_target;
147 typedef struct Symbios_scam Symbios_scam;
150 * Tekram NvRAM data format.
152 #define TEKRAM_NVRAM_SIZE 64
153 #define TEKRAM_93C46_NVRAM_ADDRESS 0
154 #define TEKRAM_24C16_NVRAM_ADDRESS 0x40
156 struct Tekram_nvram {
157 struct Tekram_target {
159 #define TEKRAM_PARITY_CHECK (1)
160 #define TEKRAM_SYNC_NEGO (1<<1)
161 #define TEKRAM_DISCONNECT_ENABLE (1<<2)
162 #define TEKRAM_START_CMD (1<<3)
163 #define TEKRAM_TAGGED_COMMANDS (1<<4)
164 #define TEKRAM_WIDE_NEGO (1<<5)
170 #define TEKRAM_MORE_THAN_2_DRIVES (1)
171 #define TEKRAM_DRIVES_SUP_1GB (1<<1)
172 #define TEKRAM_RESET_ON_POWER_ON (1<<2)
173 #define TEKRAM_ACTIVE_NEGATION (1<<3)
174 #define TEKRAM_IMMEDIATE_SEEK (1<<4)
175 #define TEKRAM_SCAN_LUNS (1<<5)
176 #define TEKRAM_REMOVABLE_FLAGS (3<<6) /* 0: disable; */
177 /* 1: boot device; 2:all */
178 u_char boot_delay_index;
179 u_char max_tags_index;
181 #define TEKRAM_F2_F6_ENABLED (1)
184 typedef struct Tekram_nvram Tekram_nvram;
185 typedef struct Tekram_target Tekram_target;
188 * Union of supported NVRAM formats.
192 #define SYM_SYMBIOS_NVRAM (1)
193 #define SYM_TEKRAM_NVRAM (2)
194 #if SYM_CONF_NVRAM_SUPPORT
196 Symbios_nvram Symbios;
202 #if SYM_CONF_NVRAM_SUPPORT
203 void sym_nvram_setup_host (struct sym_hcb *np, struct sym_nvram *nvram);
204 void sym_nvram_setup_target (struct sym_hcb *np, int target, struct sym_nvram *nvp);
205 int sym_read_nvram (struct sym_device *np, struct sym_nvram *nvp);
207 static inline void sym_nvram_setup_host(struct sym_hcb *np, struct sym_nvram *nvram) { }
208 static inline void sym_nvram_setup_target(struct sym_hcb *np, struct sym_nvram *nvram) { }
209 static inline int sym_read_nvram(struct sym_device *np, struct sym_nvram *nvp)
216 #endif /* SYM_NVRAM_H */