📄 sym_defs.h
字号:
/* * Device driver for the SYMBIOS/LSILOGIC 53C8XX and 53C1010 family * of PCI-SCSI IO processors. * * Copyright (C) 1999-2001 Gerard Roudier <groudier@free.fr> * * This driver is derived from the Linux sym53c8xx driver. * Copyright (C) 1998-2000 Gerard Roudier * * The sym53c8xx driver is derived from the ncr53c8xx driver that had been * a port of the FreeBSD ncr driver to Linux-1.2.13. * * The original ncr driver has been written for 386bsd and FreeBSD by * Wolfgang Stanglmeier <wolf@cologne.de> * Stefan Esser <se@mi.Uni-Koeln.de> * Copyright (C) 1994 Wolfgang Stanglmeier * * Other major contributions: * * NVRAM detection and reading. * Copyright (C) 1997 Richard Waltham <dormouse@farsrobt.demon.co.uk> * *----------------------------------------------------------------------------- * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * Where this Software is combined with software released under the terms of * the GNU Public License ("GPL") and the terms of the GPL would require the * combined work to also be released under the terms of the GPL, the terms * and conditions of this License will apply in addition to those of the * GPL with the exception of any terms or conditions of this License that * conflict with, or are expressly prohibited by, the GPL. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */#ifndef SYM_DEFS_H#define SYM_DEFS_H/* * Vendor. */#define PCI_VENDOR_NCR 0x1000/* * PCI device identifier of SYMBIOS chips. */#define PCI_ID_SYM53C810 1#define PCI_ID_SYM53C810AP 5#define PCI_ID_SYM53C815 4#define PCI_ID_SYM53C820 2#define PCI_ID_SYM53C825 3#define PCI_ID_SYM53C860 6#define PCI_ID_SYM53C875 0xf#define PCI_ID_SYM53C875_2 0x8f#define PCI_ID_SYM53C885 0xd#define PCI_ID_SYM53C895 0xc#define PCI_ID_SYM53C896 0xb#define PCI_ID_SYM53C895A 0x12#define PCI_ID_SYM53C875A 0x13#define PCI_ID_LSI53C1010 0x20#define PCI_ID_LSI53C1010_2 0x21#define PCI_ID_LSI53C1510D 0xa/* * SYM53C8XX device features descriptor. */struct sym_pci_chip { u_short device_id; u_short revision_id; char *name; u_char burst_max; /* log-base-2 of max burst */ u_char offset_max; u_char nr_divisor; u_char lp_probe_bit; u_int features;#define FE_LED0 (1<<0)#define FE_WIDE (1<<1) /* Wide data transfers */#define FE_ULTRA (1<<2) /* Ultra speed 20Mtrans/sec */#define FE_ULTRA2 (1<<3) /* Ultra 2 - 40 Mtrans/sec */#define FE_DBLR (1<<4) /* Clock doubler present */#define FE_QUAD (1<<5) /* Clock quadrupler present */#define FE_ERL (1<<6) /* Enable read line */#define FE_CLSE (1<<7) /* Cache line size enable */#define FE_WRIE (1<<8) /* Write & Invalidate enable */#define FE_ERMP (1<<9) /* Enable read multiple */#define FE_BOF (1<<10) /* Burst opcode fetch */#define FE_DFS (1<<11) /* DMA fifo size */#define FE_PFEN (1<<12) /* Prefetch enable */#define FE_LDSTR (1<<13) /* Load/Store supported */#define FE_RAM (1<<14) /* On chip RAM present */#define FE_VARCLK (1<<15) /* Clock frequency may vary */#define FE_RAM8K (1<<16) /* On chip RAM sized 8Kb */#define FE_64BIT (1<<17) /* 64-bit PCI BUS interface */#define FE_IO256 (1<<18) /* Requires full 256 bytes in PCI space */#define FE_NOPM (1<<19) /* Scripts handles phase mismatch */#define FE_LEDC (1<<20) /* Hardware control of LED */#define FE_ULTRA3 (1<<21) /* Ultra 3 - 80 Mtrans/sec DT */#define FE_66MHZ (1<<22) /* 66MHz PCI support */#define FE_CRC (1<<23) /* CRC support */#define FE_DIFF (1<<24) /* SCSI HVD support */#define FE_DFBC (1<<25) /* Have DFBC register */#define FE_LCKFRQ (1<<26) /* Have LCKFRQ */#define FE_C10 (1<<27) /* Various C10 core (mis)features */#define FE_U3EN (1<<28) /* U3EN bit usable */#define FE_DAC (1<<29) /* Support PCI DAC (64 bit addressing) */#define FE_ISTAT1 (1<<30) /* Have ISTAT1, MBOX0, MBOX1 registers */#define FE_CACHE_SET (FE_ERL|FE_CLSE|FE_WRIE|FE_ERMP)#define FE_CACHE0_SET (FE_CACHE_SET & ~FE_ERL)};/* * Symbios NVRAM data format */#define SYMBIOS_NVRAM_SIZE 368#define SYMBIOS_NVRAM_ADDRESS 0x100struct Symbios_nvram {/* Header 6 bytes */ u_short type; /* 0x0000 */ u_short byte_count; /* excluding header/trailer */ u_short checksum;/* Controller set up 20 bytes */ u_char v_major; /* 0x00 */ u_char v_minor; /* 0x30 */ u32 boot_crc; u_short flags;#define SYMBIOS_SCAM_ENABLE (1)#define SYMBIOS_PARITY_ENABLE (1<<1)#define SYMBIOS_VERBOSE_MSGS (1<<2)#define SYMBIOS_CHS_MAPPING (1<<3)#define SYMBIOS_NO_NVRAM (1<<3) /* ??? */ u_short flags1;#define SYMBIOS_SCAN_HI_LO (1) u_short term_state;#define SYMBIOS_TERM_CANT_PROGRAM (0)#define SYMBIOS_TERM_ENABLED (1)#define SYMBIOS_TERM_DISABLED (2) u_short rmvbl_flags;#define SYMBIOS_RMVBL_NO_SUPPORT (0)#define SYMBIOS_RMVBL_BOOT_DEVICE (1)#define SYMBIOS_RMVBL_MEDIA_INSTALLED (2) u_char host_id; u_char num_hba; /* 0x04 */ u_char num_devices; /* 0x10 */ u_char max_scam_devices; /* 0x04 */ u_char num_valid_scam_devices; /* 0x00 */ u_char flags2;#define SYMBIOS_AVOID_BUS_RESET (1<<2)/* Boot order 14 bytes * 4 */ struct Symbios_host{ u_short type; /* 4:8xx / 0:nok */ u_short device_id; /* PCI device id */ u_short vendor_id; /* PCI vendor id */ u_char bus_nr; /* PCI bus number */ u_char device_fn; /* PCI device/function number << 3*/ u_short word8; u_short flags;#define SYMBIOS_INIT_SCAN_AT_BOOT (1) u_short io_port; /* PCI io_port address */ } host[4];/* Targets 8 bytes * 16 */ struct Symbios_target { u_char flags;#define SYMBIOS_DISCONNECT_ENABLE (1)#define SYMBIOS_SCAN_AT_BOOT_TIME (1<<1)#define SYMBIOS_SCAN_LUNS (1<<2)#define SYMBIOS_QUEUE_TAGS_ENABLED (1<<3) u_char rsvd; u_char bus_width; /* 0x08/0x10 */ u_char sync_offset; u_short sync_period; /* 4*period factor */ u_short timeout; } target[16];/* Scam table 8 bytes * 4 */ struct Symbios_scam { u_short id; u_short method;#define SYMBIOS_SCAM_DEFAULT_METHOD (0)#define SYMBIOS_SCAM_DONT_ASSIGN (1)#define SYMBIOS_SCAM_SET_SPECIFIC_ID (2)#define SYMBIOS_SCAM_USE_ORDER_GIVEN (3) u_short status;#define SYMBIOS_SCAM_UNKNOWN (0)#define SYMBIOS_SCAM_DEVICE_NOT_FOUND (1)#define SYMBIOS_SCAM_ID_NOT_SET (2)#define SYMBIOS_SCAM_ID_VALID (3) u_char target_id; u_char rsvd; } scam[4]; u_char spare_devices[15*8]; u_char trailer[6]; /* 0xfe 0xfe 0x00 0x00 0x00 0x00 */};typedef struct Symbios_nvram Symbios_nvram;typedef struct Symbios_host Symbios_host;typedef struct Symbios_target Symbios_target;typedef struct Symbios_scam Symbios_scam;/* * Tekram NvRAM data format. */#define TEKRAM_NVRAM_SIZE 64#define TEKRAM_93C46_NVRAM_ADDRESS 0#define TEKRAM_24C16_NVRAM_ADDRESS 0x40struct Tekram_nvram { struct Tekram_target { u_char flags;#define TEKRAM_PARITY_CHECK (1)#define TEKRAM_SYNC_NEGO (1<<1)#define TEKRAM_DISCONNECT_ENABLE (1<<2)#define TEKRAM_START_CMD (1<<3)#define TEKRAM_TAGGED_COMMANDS (1<<4)#define TEKRAM_WIDE_NEGO (1<<5) u_char sync_index; u_short word2; } target[16]; u_char host_id; u_char flags;#define TEKRAM_MORE_THAN_2_DRIVES (1)#define TEKRAM_DRIVES_SUP_1GB (1<<1)#define TEKRAM_RESET_ON_POWER_ON (1<<2)#define TEKRAM_ACTIVE_NEGATION (1<<3)#define TEKRAM_IMMEDIATE_SEEK (1<<4)#define TEKRAM_SCAN_LUNS (1<<5)#define TEKRAM_REMOVABLE_FLAGS (3<<6) /* 0: disable; */ /* 1: boot device; 2:all */ u_char boot_delay_index; u_char max_tags_index; u_short flags1;#define TEKRAM_F2_F6_ENABLED (1) u_short spare[29];};typedef struct Tekram_nvram Tekram_nvram;typedef struct Tekram_target Tekram_target;/* * SYM53C8XX IO register data structure. */struct sym_reg {/*00*/ u8 nc_scntl0; /* full arb., ena parity, par->ATN *//*01*/ u8 nc_scntl1; /* no reset */ #define ISCON 0x10 /* connected to scsi */ #define CRST 0x08 /* force reset */ #define IARB 0x02 /* immediate arbitration *//*02*/ u8 nc_scntl2; /* no disconnect expected */ #define SDU 0x80 /* cmd: disconnect will raise error */ #define CHM 0x40 /* sta: chained mode */ #define WSS 0x08 /* sta: wide scsi send [W]*/ #define WSR 0x01 /* sta: wide scsi received [W]*//*03*/ u8 nc_scntl3; /* cnf system clock dependent */ #define EWS 0x08 /* cmd: enable wide scsi [W]*/ #define ULTRA 0x80 /* cmd: ULTRA enable */ /* bits 0-2, 7 rsvd for C1010 *//*04*/ u8 nc_scid; /* cnf host adapter scsi address */ #define RRE 0x40 /* r/w:e enable response to resel. */ #define SRE 0x20 /* r/w:e enable response to select *//*05*/ u8 nc_sxfer; /* ### Sync speed and count */ /* bits 6-7 rsvd for C1010 *//*06*/ u8 nc_sdid; /* ### Destination-ID *//*07*/ u8 nc_gpreg; /* ??? IO-Pins *//*08*/ u8 nc_sfbr; /* ### First byte received *//*09*/ u8 nc_socl; #define CREQ 0x80 /* r/w: SCSI-REQ */ #define CACK 0x40 /* r/w: SCSI-ACK */ #define CBSY 0x20 /* r/w: SCSI-BSY */ #define CSEL 0x10 /* r/w: SCSI-SEL */ #define CATN 0x08 /* r/w: SCSI-ATN */ #define CMSG 0x04 /* r/w: SCSI-MSG */ #define CC_D 0x02 /* r/w: SCSI-C_D */ #define CI_O 0x01 /* r/w: SCSI-I_O *//*0a*/ u8 nc_ssid;/*0b*/ u8 nc_sbcl;/*0c*/ u8 nc_dstat; #define DFE 0x80 /* sta: dma fifo empty */ #define MDPE 0x40 /* int: master data parity error */ #define BF 0x20 /* int: script: bus fault */ #define ABRT 0x10 /* int: script: command aborted */ #define SSI 0x08 /* int: script: single step */ #define SIR 0x04 /* int: script: interrupt instruct. */ #define IID 0x01 /* int: script: illegal instruct. *//*0d*/ u8 nc_sstat0; #define ILF 0x80 /* sta: data in SIDL register lsb */ #define ORF 0x40 /* sta: data in SODR register lsb */ #define OLF 0x20 /* sta: data in SODL register lsb */ #define AIP 0x10 /* sta: arbitration in progress */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -