11da177e4SLinus Torvalds /* 21da177e4SLinus Torvalds * Device driver for the SYMBIOS/LSILOGIC 53C8XX and 53C1010 family 31da177e4SLinus Torvalds * of PCI-SCSI IO processors. 41da177e4SLinus Torvalds * 51da177e4SLinus Torvalds * Copyright (C) 1999-2001 Gerard Roudier <groudier@free.fr> 61da177e4SLinus Torvalds * 71da177e4SLinus Torvalds * This driver is derived from the Linux sym53c8xx driver. 81da177e4SLinus Torvalds * Copyright (C) 1998-2000 Gerard Roudier 91da177e4SLinus Torvalds * 101da177e4SLinus Torvalds * The sym53c8xx driver is derived from the ncr53c8xx driver that had been 111da177e4SLinus Torvalds * a port of the FreeBSD ncr driver to Linux-1.2.13. 121da177e4SLinus Torvalds * 131da177e4SLinus Torvalds * The original ncr driver has been written for 386bsd and FreeBSD by 141da177e4SLinus Torvalds * Wolfgang Stanglmeier <wolf@cologne.de> 151da177e4SLinus Torvalds * Stefan Esser <se@mi.Uni-Koeln.de> 161da177e4SLinus Torvalds * Copyright (C) 1994 Wolfgang Stanglmeier 171da177e4SLinus Torvalds * 181da177e4SLinus Torvalds * Other major contributions: 191da177e4SLinus Torvalds * 201da177e4SLinus Torvalds * NVRAM detection and reading. 211da177e4SLinus Torvalds * Copyright (C) 1997 Richard Waltham <dormouse@farsrobt.demon.co.uk> 221da177e4SLinus Torvalds * 231da177e4SLinus Torvalds *----------------------------------------------------------------------------- 241da177e4SLinus Torvalds * 251da177e4SLinus Torvalds * This program is free software; you can redistribute it and/or modify 261da177e4SLinus Torvalds * it under the terms of the GNU General Public License as published by 271da177e4SLinus Torvalds * the Free Software Foundation; either version 2 of the License, or 281da177e4SLinus Torvalds * (at your option) any later version. 291da177e4SLinus Torvalds * 301da177e4SLinus Torvalds * This program is distributed in the hope that it will be useful, 311da177e4SLinus Torvalds * but WITHOUT ANY WARRANTY; without even the implied warranty of 321da177e4SLinus Torvalds * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 331da177e4SLinus Torvalds * GNU General Public License for more details. 341da177e4SLinus Torvalds * 351da177e4SLinus Torvalds * You should have received a copy of the GNU General Public License 361da177e4SLinus Torvalds * along with this program; if not, write to the Free Software 371da177e4SLinus Torvalds * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 381da177e4SLinus Torvalds */ 391da177e4SLinus Torvalds 401da177e4SLinus Torvalds #ifndef SYM_NVRAM_H 411da177e4SLinus Torvalds #define SYM_NVRAM_H 421da177e4SLinus Torvalds 431da177e4SLinus Torvalds #include "sym53c8xx.h" 441da177e4SLinus Torvalds 451da177e4SLinus Torvalds /* 461da177e4SLinus Torvalds * Symbios NVRAM data format 471da177e4SLinus Torvalds */ 481da177e4SLinus Torvalds #define SYMBIOS_NVRAM_SIZE 368 491da177e4SLinus Torvalds #define SYMBIOS_NVRAM_ADDRESS 0x100 501da177e4SLinus Torvalds 511da177e4SLinus Torvalds struct Symbios_nvram { 521da177e4SLinus Torvalds /* Header 6 bytes */ 531da177e4SLinus Torvalds u_short type; /* 0x0000 */ 541da177e4SLinus Torvalds u_short byte_count; /* excluding header/trailer */ 551da177e4SLinus Torvalds u_short checksum; 561da177e4SLinus Torvalds 571da177e4SLinus Torvalds /* Controller set up 20 bytes */ 581da177e4SLinus Torvalds u_char v_major; /* 0x00 */ 591da177e4SLinus Torvalds u_char v_minor; /* 0x30 */ 601da177e4SLinus Torvalds u32 boot_crc; 611da177e4SLinus Torvalds u_short flags; 621da177e4SLinus Torvalds #define SYMBIOS_SCAM_ENABLE (1) 631da177e4SLinus Torvalds #define SYMBIOS_PARITY_ENABLE (1<<1) 641da177e4SLinus Torvalds #define SYMBIOS_VERBOSE_MSGS (1<<2) 651da177e4SLinus Torvalds #define SYMBIOS_CHS_MAPPING (1<<3) 661da177e4SLinus Torvalds #define SYMBIOS_NO_NVRAM (1<<3) /* ??? */ 671da177e4SLinus Torvalds u_short flags1; 681da177e4SLinus Torvalds #define SYMBIOS_SCAN_HI_LO (1) 691da177e4SLinus Torvalds u_short term_state; 701da177e4SLinus Torvalds #define SYMBIOS_TERM_CANT_PROGRAM (0) 711da177e4SLinus Torvalds #define SYMBIOS_TERM_ENABLED (1) 721da177e4SLinus Torvalds #define SYMBIOS_TERM_DISABLED (2) 731da177e4SLinus Torvalds u_short rmvbl_flags; 741da177e4SLinus Torvalds #define SYMBIOS_RMVBL_NO_SUPPORT (0) 751da177e4SLinus Torvalds #define SYMBIOS_RMVBL_BOOT_DEVICE (1) 761da177e4SLinus Torvalds #define SYMBIOS_RMVBL_MEDIA_INSTALLED (2) 771da177e4SLinus Torvalds u_char host_id; 781da177e4SLinus Torvalds u_char num_hba; /* 0x04 */ 791da177e4SLinus Torvalds u_char num_devices; /* 0x10 */ 801da177e4SLinus Torvalds u_char max_scam_devices; /* 0x04 */ 811da177e4SLinus Torvalds u_char num_valid_scam_devices; /* 0x00 */ 821da177e4SLinus Torvalds u_char flags2; 831da177e4SLinus Torvalds #define SYMBIOS_AVOID_BUS_RESET (1<<2) 841da177e4SLinus Torvalds 851da177e4SLinus Torvalds /* Boot order 14 bytes * 4 */ 861da177e4SLinus Torvalds struct Symbios_host{ 871da177e4SLinus Torvalds u_short type; /* 4:8xx / 0:nok */ 881da177e4SLinus Torvalds u_short device_id; /* PCI device id */ 891da177e4SLinus Torvalds u_short vendor_id; /* PCI vendor id */ 901da177e4SLinus Torvalds u_char bus_nr; /* PCI bus number */ 911da177e4SLinus Torvalds u_char device_fn; /* PCI device/function number << 3*/ 921da177e4SLinus Torvalds u_short word8; 931da177e4SLinus Torvalds u_short flags; 941da177e4SLinus Torvalds #define SYMBIOS_INIT_SCAN_AT_BOOT (1) 951da177e4SLinus Torvalds u_short io_port; /* PCI io_port address */ 961da177e4SLinus Torvalds } host[4]; 971da177e4SLinus Torvalds 981da177e4SLinus Torvalds /* Targets 8 bytes * 16 */ 991da177e4SLinus Torvalds struct Symbios_target { 1001da177e4SLinus Torvalds u_char flags; 1011da177e4SLinus Torvalds #define SYMBIOS_DISCONNECT_ENABLE (1) 1021da177e4SLinus Torvalds #define SYMBIOS_SCAN_AT_BOOT_TIME (1<<1) 1031da177e4SLinus Torvalds #define SYMBIOS_SCAN_LUNS (1<<2) 1041da177e4SLinus Torvalds #define SYMBIOS_QUEUE_TAGS_ENABLED (1<<3) 1051da177e4SLinus Torvalds u_char rsvd; 1061da177e4SLinus Torvalds u_char bus_width; /* 0x08/0x10 */ 1071da177e4SLinus Torvalds u_char sync_offset; 1081da177e4SLinus Torvalds u_short sync_period; /* 4*period factor */ 1091da177e4SLinus Torvalds u_short timeout; 1101da177e4SLinus Torvalds } target[16]; 1111da177e4SLinus Torvalds /* Scam table 8 bytes * 4 */ 1121da177e4SLinus Torvalds struct Symbios_scam { 1131da177e4SLinus Torvalds u_short id; 1141da177e4SLinus Torvalds u_short method; 1151da177e4SLinus Torvalds #define SYMBIOS_SCAM_DEFAULT_METHOD (0) 1161da177e4SLinus Torvalds #define SYMBIOS_SCAM_DONT_ASSIGN (1) 1171da177e4SLinus Torvalds #define SYMBIOS_SCAM_SET_SPECIFIC_ID (2) 1181da177e4SLinus Torvalds #define SYMBIOS_SCAM_USE_ORDER_GIVEN (3) 1191da177e4SLinus Torvalds u_short status; 1201da177e4SLinus Torvalds #define SYMBIOS_SCAM_UNKNOWN (0) 1211da177e4SLinus Torvalds #define SYMBIOS_SCAM_DEVICE_NOT_FOUND (1) 1221da177e4SLinus Torvalds #define SYMBIOS_SCAM_ID_NOT_SET (2) 1231da177e4SLinus Torvalds #define SYMBIOS_SCAM_ID_VALID (3) 1241da177e4SLinus Torvalds u_char target_id; 1251da177e4SLinus Torvalds u_char rsvd; 1261da177e4SLinus Torvalds } scam[4]; 1271da177e4SLinus Torvalds 1281da177e4SLinus Torvalds u_char spare_devices[15*8]; 1291da177e4SLinus Torvalds u_char trailer[6]; /* 0xfe 0xfe 0x00 0x00 0x00 0x00 */ 1301da177e4SLinus Torvalds }; 1311da177e4SLinus Torvalds typedef struct Symbios_nvram Symbios_nvram; 1321da177e4SLinus Torvalds typedef struct Symbios_host Symbios_host; 1331da177e4SLinus Torvalds typedef struct Symbios_target Symbios_target; 1341da177e4SLinus Torvalds typedef struct Symbios_scam Symbios_scam; 1351da177e4SLinus Torvalds 1361da177e4SLinus Torvalds /* 1371da177e4SLinus Torvalds * Tekram NvRAM data format. 1381da177e4SLinus Torvalds */ 1391da177e4SLinus Torvalds #define TEKRAM_NVRAM_SIZE 64 1401da177e4SLinus Torvalds #define TEKRAM_93C46_NVRAM_ADDRESS 0 1411da177e4SLinus Torvalds #define TEKRAM_24C16_NVRAM_ADDRESS 0x40 1421da177e4SLinus Torvalds 1431da177e4SLinus Torvalds struct Tekram_nvram { 1441da177e4SLinus Torvalds struct Tekram_target { 1451da177e4SLinus Torvalds u_char flags; 1461da177e4SLinus Torvalds #define TEKRAM_PARITY_CHECK (1) 1471da177e4SLinus Torvalds #define TEKRAM_SYNC_NEGO (1<<1) 1481da177e4SLinus Torvalds #define TEKRAM_DISCONNECT_ENABLE (1<<2) 1491da177e4SLinus Torvalds #define TEKRAM_START_CMD (1<<3) 1501da177e4SLinus Torvalds #define TEKRAM_TAGGED_COMMANDS (1<<4) 1511da177e4SLinus Torvalds #define TEKRAM_WIDE_NEGO (1<<5) 1521da177e4SLinus Torvalds u_char sync_index; 1531da177e4SLinus Torvalds u_short word2; 1541da177e4SLinus Torvalds } target[16]; 1551da177e4SLinus Torvalds u_char host_id; 1561da177e4SLinus Torvalds u_char flags; 1571da177e4SLinus Torvalds #define TEKRAM_MORE_THAN_2_DRIVES (1) 1581da177e4SLinus Torvalds #define TEKRAM_DRIVES_SUP_1GB (1<<1) 1591da177e4SLinus Torvalds #define TEKRAM_RESET_ON_POWER_ON (1<<2) 1601da177e4SLinus Torvalds #define TEKRAM_ACTIVE_NEGATION (1<<3) 1611da177e4SLinus Torvalds #define TEKRAM_IMMEDIATE_SEEK (1<<4) 1621da177e4SLinus Torvalds #define TEKRAM_SCAN_LUNS (1<<5) 1631da177e4SLinus Torvalds #define TEKRAM_REMOVABLE_FLAGS (3<<6) /* 0: disable; */ 1641da177e4SLinus Torvalds /* 1: boot device; 2:all */ 1651da177e4SLinus Torvalds u_char boot_delay_index; 1661da177e4SLinus Torvalds u_char max_tags_index; 1671da177e4SLinus Torvalds u_short flags1; 1681da177e4SLinus Torvalds #define TEKRAM_F2_F6_ENABLED (1) 1691da177e4SLinus Torvalds u_short spare[29]; 1701da177e4SLinus Torvalds }; 1711da177e4SLinus Torvalds typedef struct Tekram_nvram Tekram_nvram; 1721da177e4SLinus Torvalds typedef struct Tekram_target Tekram_target; 1731da177e4SLinus Torvalds 1741da177e4SLinus Torvalds #ifndef CONFIG_PARISC 1751da177e4SLinus Torvalds struct pdc_initiator { int dummy; }; 1761da177e4SLinus Torvalds #endif 1771da177e4SLinus Torvalds 1781da177e4SLinus Torvalds /* 1791da177e4SLinus Torvalds * Union of supported NVRAM formats. 1801da177e4SLinus Torvalds */ 1811da177e4SLinus Torvalds struct sym_nvram { 1821da177e4SLinus Torvalds int type; 1831da177e4SLinus Torvalds #define SYM_SYMBIOS_NVRAM (1) 1841da177e4SLinus Torvalds #define SYM_TEKRAM_NVRAM (2) 1851da177e4SLinus Torvalds #define SYM_PARISC_PDC (3) 1861da177e4SLinus Torvalds #if SYM_CONF_NVRAM_SUPPORT 1871da177e4SLinus Torvalds union { 1881da177e4SLinus Torvalds Symbios_nvram Symbios; 1891da177e4SLinus Torvalds Tekram_nvram Tekram; 1901da177e4SLinus Torvalds struct pdc_initiator parisc; 1911da177e4SLinus Torvalds } data; 1921da177e4SLinus Torvalds #endif 1931da177e4SLinus Torvalds }; 1941da177e4SLinus Torvalds 1951da177e4SLinus Torvalds #if SYM_CONF_NVRAM_SUPPORT 1961da177e4SLinus Torvalds void sym_nvram_setup_host(struct Scsi_Host *shost, struct sym_hcb *np, struct sym_nvram *nvram); 197*b37df489SMatthew Wilcox void sym_nvram_setup_target (struct sym_tcb *tp, int target, struct sym_nvram *nvp); 1981da177e4SLinus Torvalds int sym_read_nvram (struct sym_device *np, struct sym_nvram *nvp); 1991da177e4SLinus Torvalds char *sym_nvram_type(struct sym_nvram *nvp); 2001da177e4SLinus Torvalds #else 2011da177e4SLinus Torvalds static inline void sym_nvram_setup_host(struct Scsi_Host *shost, struct sym_hcb *np, struct sym_nvram *nvram) { } 202*b37df489SMatthew Wilcox static inline void sym_nvram_setup_target(struct sym_tcb *tp, struct sym_nvram *nvram) { } 2031da177e4SLinus Torvalds static inline int sym_read_nvram(struct sym_device *np, struct sym_nvram *nvp) 2041da177e4SLinus Torvalds { 2051da177e4SLinus Torvalds nvp->type = 0; 2061da177e4SLinus Torvalds return 0; 2071da177e4SLinus Torvalds } 2081da177e4SLinus Torvalds static inline char *sym_nvram_type(struct sym_nvram *nvp) 2091da177e4SLinus Torvalds { 2101da177e4SLinus Torvalds return "No NVRAM"; 2111da177e4SLinus Torvalds } 2121da177e4SLinus Torvalds #endif 2131da177e4SLinus Torvalds 2141da177e4SLinus Torvalds #endif /* SYM_NVRAM_H */ 215