11da177e4SLinus Torvalds /************************************************************************** 21da177e4SLinus Torvalds * Initio 9100 device driver for Linux. 31da177e4SLinus Torvalds * 41da177e4SLinus Torvalds * Copyright (c) 1994-1998 Initio Corporation 51da177e4SLinus Torvalds * All rights reserved. 61da177e4SLinus Torvalds * 7fa195afeSAlan Cox * Cleanups (c) Copyright 2007 Red Hat <alan@lxorguk.ukuu.org.uk> 872d39feaSAlan Cox * 91da177e4SLinus Torvalds * This program is free software; you can redistribute it and/or modify 101da177e4SLinus Torvalds * it under the terms of the GNU General Public License as published by 111da177e4SLinus Torvalds * the Free Software Foundation; either version 2, or (at your option) 121da177e4SLinus Torvalds * any later version. 131da177e4SLinus Torvalds * 141da177e4SLinus Torvalds * This program is distributed in the hope that it will be useful, 151da177e4SLinus Torvalds * but WITHOUT ANY WARRANTY; without even the implied warranty of 161da177e4SLinus Torvalds * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 171da177e4SLinus Torvalds * GNU General Public License for more details. 181da177e4SLinus Torvalds * 191da177e4SLinus Torvalds * You should have received a copy of the GNU General Public License 201da177e4SLinus Torvalds * along with this program; see the file COPYING. If not, write to 211da177e4SLinus Torvalds * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 221da177e4SLinus Torvalds * 231da177e4SLinus Torvalds * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 241da177e4SLinus Torvalds * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 251da177e4SLinus Torvalds * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 261da177e4SLinus Torvalds * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 271da177e4SLinus Torvalds * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 281da177e4SLinus Torvalds * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 291da177e4SLinus Torvalds * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 301da177e4SLinus Torvalds * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 311da177e4SLinus Torvalds * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 321da177e4SLinus Torvalds * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 331da177e4SLinus Torvalds * SUCH DAMAGE. 341da177e4SLinus Torvalds * 351da177e4SLinus Torvalds **************************************************************************/ 361da177e4SLinus Torvalds 371da177e4SLinus Torvalds 381da177e4SLinus Torvalds #include <linux/types.h> 391da177e4SLinus Torvalds 401da177e4SLinus Torvalds #define TOTAL_SG_ENTRY 32 411da177e4SLinus Torvalds #define MAX_SUPPORTED_ADAPTERS 8 421da177e4SLinus Torvalds #define MAX_OFFSET 15 431da177e4SLinus Torvalds #define MAX_TARGETS 16 441da177e4SLinus Torvalds 451da177e4SLinus Torvalds typedef struct { 461da177e4SLinus Torvalds unsigned short base; 471da177e4SLinus Torvalds unsigned short vec; 481da177e4SLinus Torvalds } i91u_config; 491da177e4SLinus Torvalds 501da177e4SLinus Torvalds /***************************************/ 511da177e4SLinus Torvalds /* Tulip Configuration Register Set */ 521da177e4SLinus Torvalds /***************************************/ 531da177e4SLinus Torvalds #define TUL_PVID 0x00 /* Vendor ID */ 541da177e4SLinus Torvalds #define TUL_PDID 0x02 /* Device ID */ 551da177e4SLinus Torvalds #define TUL_PCMD 0x04 /* Command */ 561da177e4SLinus Torvalds #define TUL_PSTUS 0x06 /* Status */ 571da177e4SLinus Torvalds #define TUL_PRID 0x08 /* Revision number */ 581da177e4SLinus Torvalds #define TUL_PPI 0x09 /* Programming interface */ 591da177e4SLinus Torvalds #define TUL_PSC 0x0A /* Sub Class */ 601da177e4SLinus Torvalds #define TUL_PBC 0x0B /* Base Class */ 611da177e4SLinus Torvalds #define TUL_PCLS 0x0C /* Cache line size */ 621da177e4SLinus Torvalds #define TUL_PLTR 0x0D /* Latency timer */ 631da177e4SLinus Torvalds #define TUL_PHDT 0x0E /* Header type */ 641da177e4SLinus Torvalds #define TUL_PBIST 0x0F /* BIST */ 651da177e4SLinus Torvalds #define TUL_PBAD 0x10 /* Base address */ 661da177e4SLinus Torvalds #define TUL_PBAD1 0x14 /* Base address */ 671da177e4SLinus Torvalds #define TUL_PBAD2 0x18 /* Base address */ 681da177e4SLinus Torvalds #define TUL_PBAD3 0x1C /* Base address */ 691da177e4SLinus Torvalds #define TUL_PBAD4 0x20 /* Base address */ 701da177e4SLinus Torvalds #define TUL_PBAD5 0x24 /* Base address */ 711da177e4SLinus Torvalds #define TUL_PRSVD 0x28 /* Reserved */ 721da177e4SLinus Torvalds #define TUL_PRSVD1 0x2C /* Reserved */ 731da177e4SLinus Torvalds #define TUL_PRAD 0x30 /* Expansion ROM base address */ 741da177e4SLinus Torvalds #define TUL_PRSVD2 0x34 /* Reserved */ 751da177e4SLinus Torvalds #define TUL_PRSVD3 0x38 /* Reserved */ 761da177e4SLinus Torvalds #define TUL_PINTL 0x3C /* Interrupt line */ 771da177e4SLinus Torvalds #define TUL_PINTP 0x3D /* Interrupt pin */ 781da177e4SLinus Torvalds #define TUL_PIGNT 0x3E /* MIN_GNT */ 791da177e4SLinus Torvalds #define TUL_PMGNT 0x3F /* MAX_GNT */ 801da177e4SLinus Torvalds 811da177e4SLinus Torvalds /************************/ 821da177e4SLinus Torvalds /* Jasmin Register Set */ 831da177e4SLinus Torvalds /************************/ 841da177e4SLinus Torvalds #define TUL_HACFG0 0x40 /* H/A Configuration Register 0 */ 851da177e4SLinus Torvalds #define TUL_HACFG1 0x41 /* H/A Configuration Register 1 */ 861da177e4SLinus Torvalds #define TUL_HACFG2 0x42 /* H/A Configuration Register 2 */ 871da177e4SLinus Torvalds 881da177e4SLinus Torvalds #define TUL_SDCFG0 0x44 /* SCSI Device Configuration 0 */ 891da177e4SLinus Torvalds #define TUL_SDCFG1 0x45 /* SCSI Device Configuration 1 */ 901da177e4SLinus Torvalds #define TUL_SDCFG2 0x46 /* SCSI Device Configuration 2 */ 911da177e4SLinus Torvalds #define TUL_SDCFG3 0x47 /* SCSI Device Configuration 3 */ 921da177e4SLinus Torvalds 931da177e4SLinus Torvalds #define TUL_GINTS 0x50 /* Global Interrupt Status Register */ 941da177e4SLinus Torvalds #define TUL_GIMSK 0x52 /* Global Interrupt MASK Register */ 951da177e4SLinus Torvalds #define TUL_GCTRL 0x54 /* Global Control Register */ 961da177e4SLinus Torvalds #define TUL_GCTRL_EEPROM_BIT 0x04 971da177e4SLinus Torvalds #define TUL_GCTRL1 0x55 /* Global Control Register */ 981da177e4SLinus Torvalds #define TUL_DMACFG 0x5B /* DMA configuration */ 991da177e4SLinus Torvalds #define TUL_NVRAM 0x5D /* Non-volatile RAM port */ 1001da177e4SLinus Torvalds 1011da177e4SLinus Torvalds #define TUL_SCnt0 0x80 /* 00 R/W Transfer Counter Low */ 1021da177e4SLinus Torvalds #define TUL_SCnt1 0x81 /* 01 R/W Transfer Counter Mid */ 1031da177e4SLinus Torvalds #define TUL_SCnt2 0x82 /* 02 R/W Transfer Count High */ 1041da177e4SLinus Torvalds #define TUL_SFifoCnt 0x83 /* 03 R FIFO counter */ 1051da177e4SLinus Torvalds #define TUL_SIntEnable 0x84 /* 03 W Interrupt enble */ 1061da177e4SLinus Torvalds #define TUL_SInt 0x84 /* 04 R Interrupt Register */ 1071da177e4SLinus Torvalds #define TUL_SCtrl0 0x85 /* 05 W Control 0 */ 1081da177e4SLinus Torvalds #define TUL_SStatus0 0x85 /* 05 R Status 0 */ 1091da177e4SLinus Torvalds #define TUL_SCtrl1 0x86 /* 06 W Control 1 */ 1101da177e4SLinus Torvalds #define TUL_SStatus1 0x86 /* 06 R Status 1 */ 1111da177e4SLinus Torvalds #define TUL_SConfig 0x87 /* 07 W Configuration */ 1121da177e4SLinus Torvalds #define TUL_SStatus2 0x87 /* 07 R Status 2 */ 1131da177e4SLinus Torvalds #define TUL_SPeriod 0x88 /* 08 W Sync. Transfer Period & Offset */ 1141da177e4SLinus Torvalds #define TUL_SOffset 0x88 /* 08 R Offset */ 1151da177e4SLinus Torvalds #define TUL_SScsiId 0x89 /* 09 W SCSI ID */ 1161da177e4SLinus Torvalds #define TUL_SBusId 0x89 /* 09 R SCSI BUS ID */ 1171da177e4SLinus Torvalds #define TUL_STimeOut 0x8A /* 0A W Sel/Resel Time Out Register */ 1181da177e4SLinus Torvalds #define TUL_SIdent 0x8A /* 0A R Identify Message Register */ 119*25985edcSLucas De Marchi #define TUL_SAvail 0x8A /* 0A R Available Counter Register */ 1201da177e4SLinus Torvalds #define TUL_SData 0x8B /* 0B R/W SCSI data in/out */ 1211da177e4SLinus Torvalds #define TUL_SFifo 0x8C /* 0C R/W FIFO */ 1221da177e4SLinus Torvalds #define TUL_SSignal 0x90 /* 10 R/W SCSI signal in/out */ 1231da177e4SLinus Torvalds #define TUL_SCmd 0x91 /* 11 R/W Command */ 1241da177e4SLinus Torvalds #define TUL_STest0 0x92 /* 12 R/W Test0 */ 1251da177e4SLinus Torvalds #define TUL_STest1 0x93 /* 13 R/W Test1 */ 1261da177e4SLinus Torvalds #define TUL_SCFG1 0x94 /* 14 R/W Configuration */ 1271da177e4SLinus Torvalds 1281da177e4SLinus Torvalds #define TUL_XAddH 0xC0 /*DMA Transfer Physical Address */ 1291da177e4SLinus Torvalds #define TUL_XAddW 0xC8 /*DMA Current Transfer Physical Address */ 1301da177e4SLinus Torvalds #define TUL_XCntH 0xD0 /*DMA Transfer Counter */ 1311da177e4SLinus Torvalds #define TUL_XCntW 0xD4 /*DMA Current Transfer Counter */ 1321da177e4SLinus Torvalds #define TUL_XCmd 0xD8 /*DMA Command Register */ 1331da177e4SLinus Torvalds #define TUL_Int 0xDC /*Interrupt Register */ 1341da177e4SLinus Torvalds #define TUL_XStatus 0xDD /*DMA status Register */ 1351da177e4SLinus Torvalds #define TUL_Mask 0xE0 /*Interrupt Mask Register */ 1361da177e4SLinus Torvalds #define TUL_XCtrl 0xE4 /*DMA Control Register */ 1371da177e4SLinus Torvalds #define TUL_XCtrl1 0xE5 /*DMA Control Register 1 */ 1381da177e4SLinus Torvalds #define TUL_XFifo 0xE8 /*DMA FIFO */ 1391da177e4SLinus Torvalds 1401da177e4SLinus Torvalds #define TUL_WCtrl 0xF7 /*Bus master wait state control */ 1411da177e4SLinus Torvalds #define TUL_DCtrl 0xFB /*DMA delay control */ 1421da177e4SLinus Torvalds 1431da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 1441da177e4SLinus Torvalds /* bit definition for Command register of Configuration Space Header */ 1451da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 1461da177e4SLinus Torvalds #define BUSMS 0x04 /* BUS MASTER Enable */ 1471da177e4SLinus Torvalds #define IOSPA 0x01 /* IO Space Enable */ 1481da177e4SLinus Torvalds 1491da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 1501da177e4SLinus Torvalds /* Command Codes of Tulip SCSI Command register */ 1511da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 1521da177e4SLinus Torvalds #define TSC_EN_RESEL 0x80 /* Enable Reselection */ 1531da177e4SLinus Torvalds #define TSC_CMD_COMP 0x84 /* Command Complete Sequence */ 1541da177e4SLinus Torvalds #define TSC_SEL 0x01 /* Select Without ATN Sequence */ 1551da177e4SLinus Torvalds #define TSC_SEL_ATN 0x11 /* Select With ATN Sequence */ 1561da177e4SLinus Torvalds #define TSC_SEL_ATN_DMA 0x51 /* Select With ATN Sequence with DMA */ 1571da177e4SLinus Torvalds #define TSC_SEL_ATN3 0x31 /* Select With ATN3 Sequence */ 1581da177e4SLinus Torvalds #define TSC_SEL_ATNSTOP 0x12 /* Select With ATN and Stop Sequence */ 1591da177e4SLinus Torvalds #define TSC_SELATNSTOP 0x1E /* Select With ATN and Stop Sequence */ 1601da177e4SLinus Torvalds 1611da177e4SLinus Torvalds #define TSC_SEL_ATN_DIRECT_IN 0x95 /* Select With ATN Sequence */ 1621da177e4SLinus Torvalds #define TSC_SEL_ATN_DIRECT_OUT 0x15 /* Select With ATN Sequence */ 1631da177e4SLinus Torvalds #define TSC_SEL_ATN3_DIRECT_IN 0xB5 /* Select With ATN3 Sequence */ 1641da177e4SLinus Torvalds #define TSC_SEL_ATN3_DIRECT_OUT 0x35 /* Select With ATN3 Sequence */ 16547bdd718SAdrian Bunk #define TSC_XF_DMA_OUT_DIRECT 0x06 /* DMA Xfer Information out */ 16647bdd718SAdrian Bunk #define TSC_XF_DMA_IN_DIRECT 0x86 /* DMA Xfer Information in */ 1671da177e4SLinus Torvalds 16847bdd718SAdrian Bunk #define TSC_XF_DMA_OUT 0x43 /* DMA Xfer Information out */ 16947bdd718SAdrian Bunk #define TSC_XF_DMA_IN 0xC3 /* DMA Xfer Information in */ 17047bdd718SAdrian Bunk #define TSC_XF_FIFO_OUT 0x03 /* FIFO Xfer Information out */ 17147bdd718SAdrian Bunk #define TSC_XF_FIFO_IN 0x83 /* FIFO Xfer Information in */ 1721da177e4SLinus Torvalds 1731da177e4SLinus Torvalds #define TSC_MSG_ACCEPT 0x0F /* Message Accept */ 1741da177e4SLinus Torvalds 1751da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 1761da177e4SLinus Torvalds /* bit definition for Tulip SCSI Control 0 Register */ 1771da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 1781da177e4SLinus Torvalds #define TSC_RST_SEQ 0x20 /* Reset sequence counter */ 1791da177e4SLinus Torvalds #define TSC_FLUSH_FIFO 0x10 /* Flush FIFO */ 1801da177e4SLinus Torvalds #define TSC_ABT_CMD 0x04 /* Abort command (sequence) */ 1811da177e4SLinus Torvalds #define TSC_RST_CHIP 0x02 /* Reset SCSI Chip */ 1821da177e4SLinus Torvalds #define TSC_RST_BUS 0x01 /* Reset SCSI Bus */ 1831da177e4SLinus Torvalds 1841da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 1851da177e4SLinus Torvalds /* bit definition for Tulip SCSI Control 1 Register */ 1861da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 1871da177e4SLinus Torvalds #define TSC_EN_SCAM 0x80 /* Enable SCAM */ 1881da177e4SLinus Torvalds #define TSC_TIMER 0x40 /* Select timeout unit */ 1891da177e4SLinus Torvalds #define TSC_EN_SCSI2 0x20 /* SCSI-2 mode */ 1901da177e4SLinus Torvalds #define TSC_PWDN 0x10 /* Power down mode */ 1911da177e4SLinus Torvalds #define TSC_WIDE_CPU 0x08 /* Wide CPU */ 1921da177e4SLinus Torvalds #define TSC_HW_RESELECT 0x04 /* Enable HW reselect */ 1931da177e4SLinus Torvalds #define TSC_EN_BUS_OUT 0x02 /* Enable SCSI data bus out latch */ 1941da177e4SLinus Torvalds #define TSC_EN_BUS_IN 0x01 /* Enable SCSI data bus in latch */ 1951da177e4SLinus Torvalds 1961da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 1971da177e4SLinus Torvalds /* bit definition for Tulip SCSI Configuration Register */ 1981da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 1991da177e4SLinus Torvalds #define TSC_EN_LATCH 0x80 /* Enable phase latch */ 2001da177e4SLinus Torvalds #define TSC_INITIATOR 0x40 /* Initiator mode */ 2011da177e4SLinus Torvalds #define TSC_EN_SCSI_PAR 0x20 /* Enable SCSI parity */ 2021da177e4SLinus Torvalds #define TSC_DMA_8BIT 0x10 /* Alternate dma 8-bits mode */ 2031da177e4SLinus Torvalds #define TSC_DMA_16BIT 0x08 /* Alternate dma 16-bits mode */ 2041da177e4SLinus Torvalds #define TSC_EN_WDACK 0x04 /* Enable DACK while wide SCSI xfer */ 2051da177e4SLinus Torvalds #define TSC_ALT_PERIOD 0x02 /* Alternate sync period mode */ 2061da177e4SLinus Torvalds #define TSC_DIS_SCSIRST 0x01 /* Disable SCSI bus reset us */ 2071da177e4SLinus Torvalds 2081da177e4SLinus Torvalds #define TSC_INITDEFAULT (TSC_INITIATOR | TSC_EN_LATCH | TSC_ALT_PERIOD | TSC_DIS_SCSIRST) 2091da177e4SLinus Torvalds 2101da177e4SLinus Torvalds #define TSC_WIDE_SCSI 0x80 /* Enable Wide SCSI */ 2111da177e4SLinus Torvalds 2121da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 2131da177e4SLinus Torvalds /* bit definition for Tulip SCSI signal Register */ 2141da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 2151da177e4SLinus Torvalds #define TSC_RST_ACK 0x00 /* Release ACK signal */ 2161da177e4SLinus Torvalds #define TSC_RST_ATN 0x00 /* Release ATN signal */ 2171da177e4SLinus Torvalds #define TSC_RST_BSY 0x00 /* Release BSY signal */ 2181da177e4SLinus Torvalds 2191da177e4SLinus Torvalds #define TSC_SET_ACK 0x40 /* ACK signal */ 2201da177e4SLinus Torvalds #define TSC_SET_ATN 0x08 /* ATN signal */ 2211da177e4SLinus Torvalds 2221da177e4SLinus Torvalds #define TSC_REQI 0x80 /* REQ signal */ 2231da177e4SLinus Torvalds #define TSC_ACKI 0x40 /* ACK signal */ 2241da177e4SLinus Torvalds #define TSC_BSYI 0x20 /* BSY signal */ 2251da177e4SLinus Torvalds #define TSC_SELI 0x10 /* SEL signal */ 2261da177e4SLinus Torvalds #define TSC_ATNI 0x08 /* ATN signal */ 2271da177e4SLinus Torvalds #define TSC_MSGI 0x04 /* MSG signal */ 2281da177e4SLinus Torvalds #define TSC_CDI 0x02 /* C/D signal */ 2291da177e4SLinus Torvalds #define TSC_IOI 0x01 /* I/O signal */ 2301da177e4SLinus Torvalds 2311da177e4SLinus Torvalds 2321da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 2331da177e4SLinus Torvalds /* bit definition for Tulip SCSI Status 0 Register */ 2341da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 2351da177e4SLinus Torvalds #define TSS_INT_PENDING 0x80 /* Interrupt pending */ 2361da177e4SLinus Torvalds #define TSS_SEQ_ACTIVE 0x40 /* Sequencer active */ 2371da177e4SLinus Torvalds #define TSS_XFER_CNT 0x20 /* Transfer counter zero */ 2381da177e4SLinus Torvalds #define TSS_FIFO_EMPTY 0x10 /* FIFO empty */ 2391da177e4SLinus Torvalds #define TSS_PAR_ERROR 0x08 /* SCSI parity error */ 2401da177e4SLinus Torvalds #define TSS_PH_MASK 0x07 /* SCSI phase mask */ 2411da177e4SLinus Torvalds 2421da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 2431da177e4SLinus Torvalds /* bit definition for Tulip SCSI Status 1 Register */ 2441da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 2451da177e4SLinus Torvalds #define TSS_STATUS_RCV 0x08 /* Status received */ 2461da177e4SLinus Torvalds #define TSS_MSG_SEND 0x40 /* Message sent */ 2471da177e4SLinus Torvalds #define TSS_CMD_PH_CMP 0x20 /* command phase done */ 2481da177e4SLinus Torvalds #define TSS_DATA_PH_CMP 0x10 /* Data phase done */ 2491da177e4SLinus Torvalds #define TSS_STATUS_SEND 0x08 /* Status sent */ 2501da177e4SLinus Torvalds #define TSS_XFER_CMP 0x04 /* Transfer completed */ 2511da177e4SLinus Torvalds #define TSS_SEL_CMP 0x02 /* Selection completed */ 2521da177e4SLinus Torvalds #define TSS_ARB_CMP 0x01 /* Arbitration completed */ 2531da177e4SLinus Torvalds 2541da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 2551da177e4SLinus Torvalds /* bit definition for Tulip SCSI Status 2 Register */ 2561da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 2571da177e4SLinus Torvalds #define TSS_CMD_ABTED 0x80 /* Command aborted */ 2581da177e4SLinus Torvalds #define TSS_OFFSET_0 0x40 /* Offset counter zero */ 2591da177e4SLinus Torvalds #define TSS_FIFO_FULL 0x20 /* FIFO full */ 2601da177e4SLinus Torvalds #define TSS_TIMEOUT_0 0x10 /* Timeout counter zero */ 2611da177e4SLinus Torvalds #define TSS_BUSY_RLS 0x08 /* Busy release */ 2621da177e4SLinus Torvalds #define TSS_PH_MISMATCH 0x04 /* Phase mismatch */ 2631da177e4SLinus Torvalds #define TSS_SCSI_BUS_EN 0x02 /* SCSI data bus enable */ 2641da177e4SLinus Torvalds #define TSS_SCSIRST 0x01 /* SCSI bus reset in progress */ 2651da177e4SLinus Torvalds 2661da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 2671da177e4SLinus Torvalds /* bit definition for Tulip SCSI Interrupt Register */ 2681da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 2691da177e4SLinus Torvalds #define TSS_RESEL_INT 0x80 /* Reselected interrupt */ 2701da177e4SLinus Torvalds #define TSS_SEL_TIMEOUT 0x40 /* Selected/reselected timeout */ 2711da177e4SLinus Torvalds #define TSS_BUS_SERV 0x20 2721da177e4SLinus Torvalds #define TSS_SCSIRST_INT 0x10 /* SCSI bus reset detected */ 2731da177e4SLinus Torvalds #define TSS_DISC_INT 0x08 /* Disconnected interrupt */ 2741da177e4SLinus Torvalds #define TSS_SEL_INT 0x04 /* Select interrupt */ 2751da177e4SLinus Torvalds #define TSS_SCAM_SEL 0x02 /* SCAM selected */ 2761da177e4SLinus Torvalds #define TSS_FUNC_COMP 0x01 2771da177e4SLinus Torvalds 2781da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 2791da177e4SLinus Torvalds /* SCSI Phase Codes. */ 2801da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 2811da177e4SLinus Torvalds #define DATA_OUT 0 2821da177e4SLinus Torvalds #define DATA_IN 1 /* 4 */ 2831da177e4SLinus Torvalds #define CMD_OUT 2 2841da177e4SLinus Torvalds #define STATUS_IN 3 /* 6 */ 2851da177e4SLinus Torvalds #define MSG_OUT 6 /* 3 */ 2861da177e4SLinus Torvalds #define MSG_IN 7 2871da177e4SLinus Torvalds 2881da177e4SLinus Torvalds 2891da177e4SLinus Torvalds 2901da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 2911da177e4SLinus Torvalds /* Command Codes of Tulip xfer Command register */ 2921da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 2931da177e4SLinus Torvalds #define TAX_X_FORC 0x02 2941da177e4SLinus Torvalds #define TAX_X_ABT 0x04 2951da177e4SLinus Torvalds #define TAX_X_CLR_FIFO 0x08 2961da177e4SLinus Torvalds 2971da177e4SLinus Torvalds #define TAX_X_IN 0x21 2981da177e4SLinus Torvalds #define TAX_X_OUT 0x01 2991da177e4SLinus Torvalds #define TAX_SG_IN 0xA1 3001da177e4SLinus Torvalds #define TAX_SG_OUT 0x81 3011da177e4SLinus Torvalds 3021da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 3031da177e4SLinus Torvalds /* Tulip Interrupt Register */ 3041da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 3051da177e4SLinus Torvalds #define XCMP 0x01 3061da177e4SLinus Torvalds #define FCMP 0x02 3071da177e4SLinus Torvalds #define XABT 0x04 3081da177e4SLinus Torvalds #define XERR 0x08 3091da177e4SLinus Torvalds #define SCMP 0x10 3101da177e4SLinus Torvalds #define IPEND 0x80 3111da177e4SLinus Torvalds 3121da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 3131da177e4SLinus Torvalds /* Tulip DMA Status Register */ 3141da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 3151da177e4SLinus Torvalds #define XPEND 0x01 /* Transfer pending */ 3161da177e4SLinus Torvalds #define FEMPTY 0x02 /* FIFO empty */ 3171da177e4SLinus Torvalds 3181da177e4SLinus Torvalds 3191da177e4SLinus Torvalds 3201da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 3211da177e4SLinus Torvalds /* bit definition for TUL_GCTRL */ 3221da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 3231da177e4SLinus Torvalds #define EXTSG 0x80 3241da177e4SLinus Torvalds #define EXTAD 0x60 3251da177e4SLinus Torvalds #define SEG4K 0x08 3261da177e4SLinus Torvalds #define EEPRG 0x04 3271da177e4SLinus Torvalds #define MRMUL 0x02 3281da177e4SLinus Torvalds 3291da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 3301da177e4SLinus Torvalds /* bit definition for TUL_NVRAM */ 3311da177e4SLinus Torvalds /*----------------------------------------------------------------------*/ 3321da177e4SLinus Torvalds #define SE2CS 0x08 3331da177e4SLinus Torvalds #define SE2CLK 0x04 3341da177e4SLinus Torvalds #define SE2DO 0x02 3351da177e4SLinus Torvalds #define SE2DI 0x01 3361da177e4SLinus Torvalds 3371da177e4SLinus Torvalds 3381da177e4SLinus Torvalds /************************************************************************/ 3391da177e4SLinus Torvalds /* Scatter-Gather Element Structure */ 3401da177e4SLinus Torvalds /************************************************************************/ 34172d39feaSAlan Cox struct sg_entry { 34272d39feaSAlan Cox u32 data; /* Data Pointer */ 34372d39feaSAlan Cox u32 len; /* Data Length */ 34472d39feaSAlan Cox }; 3451da177e4SLinus Torvalds 3461da177e4SLinus Torvalds /*********************************************************************** 3471da177e4SLinus Torvalds SCSI Control Block 3481da177e4SLinus Torvalds ************************************************************************/ 34972d39feaSAlan Cox struct scsi_ctrl_blk { 35072d39feaSAlan Cox struct scsi_ctrl_blk *next; 35172d39feaSAlan Cox u8 status; /*4 */ 35272d39feaSAlan Cox u8 next_state; /*5 */ 35372d39feaSAlan Cox u8 mode; /*6 */ 35472d39feaSAlan Cox u8 msgin; /*7 SCB_Res0 */ 35572d39feaSAlan Cox u16 sgidx; /*8 */ 35672d39feaSAlan Cox u16 sgmax; /*A */ 3571da177e4SLinus Torvalds #ifdef ALPHA 35872d39feaSAlan Cox u32 reserved[2]; /*C */ 3591da177e4SLinus Torvalds #else 36072d39feaSAlan Cox u32 reserved[3]; /*C */ 3611da177e4SLinus Torvalds #endif 3621da177e4SLinus Torvalds 36372d39feaSAlan Cox u32 xferlen; /*18 Current xfer len */ 36472d39feaSAlan Cox u32 totxlen; /*1C Total xfer len */ 36572d39feaSAlan Cox u32 paddr; /*20 SCB phy. Addr. */ 3661da177e4SLinus Torvalds 36772d39feaSAlan Cox u8 opcode; /*24 SCB command code */ 36872d39feaSAlan Cox u8 flags; /*25 SCB Flags */ 36972d39feaSAlan Cox u8 target; /*26 Target Id */ 37072d39feaSAlan Cox u8 lun; /*27 Lun */ 37172d39feaSAlan Cox u32 bufptr; /*28 Data Buffer Pointer */ 37272d39feaSAlan Cox u32 buflen; /*2C Data Allocation Length */ 37372d39feaSAlan Cox u8 sglen; /*30 SG list # */ 37472d39feaSAlan Cox u8 senselen; /*31 Sense Allocation Length */ 37572d39feaSAlan Cox u8 hastat; /*32 */ 37672d39feaSAlan Cox u8 tastat; /*33 */ 37772d39feaSAlan Cox u8 cdblen; /*34 CDB Length */ 37872d39feaSAlan Cox u8 ident; /*35 Identify */ 37972d39feaSAlan Cox u8 tagmsg; /*36 Tag Message */ 38072d39feaSAlan Cox u8 tagid; /*37 Queue Tag */ 38172d39feaSAlan Cox u8 cdb[12]; /*38 */ 38272d39feaSAlan Cox u32 sgpaddr; /*44 SG List/Sense Buf phy. Addr. */ 38372d39feaSAlan Cox u32 senseptr; /*48 Sense data pointer */ 38472d39feaSAlan Cox void (*post) (u8 *, u8 *); /*4C POST routine */ 38572d39feaSAlan Cox struct scsi_cmnd *srb; /*50 SRB Pointer */ 38672d39feaSAlan Cox struct sg_entry sglist[TOTAL_SG_ENTRY]; /*54 Start of SG list */ 38772d39feaSAlan Cox }; 3881da177e4SLinus Torvalds 38972d39feaSAlan Cox /* Bit Definition for status */ 3901da177e4SLinus Torvalds #define SCB_RENT 0x01 3911da177e4SLinus Torvalds #define SCB_PEND 0x02 392*25985edcSLucas De Marchi #define SCB_CONTIG 0x04 /* Contingent Allegiance */ 3931da177e4SLinus Torvalds #define SCB_SELECT 0x08 3941da177e4SLinus Torvalds #define SCB_BUSY 0x10 3951da177e4SLinus Torvalds #define SCB_DONE 0x20 3961da177e4SLinus Torvalds 3971da177e4SLinus Torvalds 39872d39feaSAlan Cox /* Opcodes for opcode */ 3991da177e4SLinus Torvalds #define ExecSCSI 0x1 4001da177e4SLinus Torvalds #define BusDevRst 0x2 4011da177e4SLinus Torvalds #define AbortCmd 0x3 4021da177e4SLinus Torvalds 4031da177e4SLinus Torvalds 40472d39feaSAlan Cox /* Bit Definition for mode */ 4051da177e4SLinus Torvalds #define SCM_RSENS 0x01 /* request sense mode */ 4061da177e4SLinus Torvalds 4071da177e4SLinus Torvalds 40872d39feaSAlan Cox /* Bit Definition for flags */ 4091da177e4SLinus Torvalds #define SCF_DONE 0x01 4101da177e4SLinus Torvalds #define SCF_POST 0x02 4111da177e4SLinus Torvalds #define SCF_SENSE 0x04 4121da177e4SLinus Torvalds #define SCF_DIR 0x18 4131da177e4SLinus Torvalds #define SCF_NO_DCHK 0x00 4141da177e4SLinus Torvalds #define SCF_DIN 0x08 4151da177e4SLinus Torvalds #define SCF_DOUT 0x10 4161da177e4SLinus Torvalds #define SCF_NO_XF 0x18 4171da177e4SLinus Torvalds #define SCF_WR_VF 0x20 /* Write verify turn on */ 4181da177e4SLinus Torvalds #define SCF_POLL 0x40 4191da177e4SLinus Torvalds #define SCF_SG 0x80 4201da177e4SLinus Torvalds 4211da177e4SLinus Torvalds /* Error Codes for SCB_HaStat */ 4221da177e4SLinus Torvalds #define HOST_SEL_TOUT 0x11 4231da177e4SLinus Torvalds #define HOST_DO_DU 0x12 4241da177e4SLinus Torvalds #define HOST_BUS_FREE 0x13 4251da177e4SLinus Torvalds #define HOST_BAD_PHAS 0x14 4261da177e4SLinus Torvalds #define HOST_INV_CMD 0x16 4271da177e4SLinus Torvalds #define HOST_ABORTED 0x1A /* 07/21/98 */ 4281da177e4SLinus Torvalds #define HOST_SCSI_RST 0x1B 4291da177e4SLinus Torvalds #define HOST_DEV_RST 0x1C 4301da177e4SLinus Torvalds 4311da177e4SLinus Torvalds /* Error Codes for SCB_TaStat */ 4321da177e4SLinus Torvalds #define TARGET_CHKCOND 0x02 4331da177e4SLinus Torvalds #define TARGET_BUSY 0x08 4341da177e4SLinus Torvalds #define INI_QUEUE_FULL 0x28 4351da177e4SLinus Torvalds 4361da177e4SLinus Torvalds /* SCSI MESSAGE */ 4371da177e4SLinus Torvalds #define MSG_COMP 0x00 4381da177e4SLinus Torvalds #define MSG_EXTEND 0x01 4391da177e4SLinus Torvalds #define MSG_SDP 0x02 4401da177e4SLinus Torvalds #define MSG_RESTORE 0x03 4411da177e4SLinus Torvalds #define MSG_DISC 0x04 4421da177e4SLinus Torvalds #define MSG_IDE 0x05 4431da177e4SLinus Torvalds #define MSG_ABORT 0x06 4441da177e4SLinus Torvalds #define MSG_REJ 0x07 4451da177e4SLinus Torvalds #define MSG_NOP 0x08 4461da177e4SLinus Torvalds #define MSG_PARITY 0x09 4471da177e4SLinus Torvalds #define MSG_LINK_COMP 0x0A 4481da177e4SLinus Torvalds #define MSG_LINK_FLAG 0x0B 4491da177e4SLinus Torvalds #define MSG_DEVRST 0x0C 4501da177e4SLinus Torvalds #define MSG_ABORT_TAG 0x0D 4511da177e4SLinus Torvalds 4521da177e4SLinus Torvalds /* Queue tag msg: Simple_quque_tag, Head_of_queue_tag, Ordered_queue_tag */ 4531da177e4SLinus Torvalds #define MSG_STAG 0x20 4541da177e4SLinus Torvalds #define MSG_HTAG 0x21 4551da177e4SLinus Torvalds #define MSG_OTAG 0x22 4561da177e4SLinus Torvalds 4571da177e4SLinus Torvalds #define MSG_IGNOREWIDE 0x23 4581da177e4SLinus Torvalds 4591da177e4SLinus Torvalds #define MSG_IDENT 0x80 4601da177e4SLinus Torvalds 4611da177e4SLinus Torvalds /*********************************************************************** 4621da177e4SLinus Torvalds Target Device Control Structure 4631da177e4SLinus Torvalds **********************************************************************/ 4641da177e4SLinus Torvalds 46572d39feaSAlan Cox struct target_control { 46672d39feaSAlan Cox u16 flags; 46772d39feaSAlan Cox u8 js_period; 46872d39feaSAlan Cox u8 sconfig0; 46972d39feaSAlan Cox u16 drv_flags; 47072d39feaSAlan Cox u8 heads; 47172d39feaSAlan Cox u8 sectors; 47272d39feaSAlan Cox }; 4731da177e4SLinus Torvalds 4741da177e4SLinus Torvalds /*********************************************************************** 4751da177e4SLinus Torvalds Target Device Control Structure 4761da177e4SLinus Torvalds **********************************************************************/ 4771da177e4SLinus Torvalds 4781da177e4SLinus Torvalds /* Bit Definition for TCF_Flags */ 4791da177e4SLinus Torvalds #define TCF_SCSI_RATE 0x0007 4801da177e4SLinus Torvalds #define TCF_EN_DISC 0x0008 4811da177e4SLinus Torvalds #define TCF_NO_SYNC_NEGO 0x0010 4821da177e4SLinus Torvalds #define TCF_NO_WDTR 0x0020 4831da177e4SLinus Torvalds #define TCF_EN_255 0x0040 4841da177e4SLinus Torvalds #define TCF_EN_START 0x0080 4851da177e4SLinus Torvalds #define TCF_WDTR_DONE 0x0100 4861da177e4SLinus Torvalds #define TCF_SYNC_DONE 0x0200 4871da177e4SLinus Torvalds #define TCF_BUSY 0x0400 4881da177e4SLinus Torvalds 4891da177e4SLinus Torvalds 4901da177e4SLinus Torvalds /* Bit Definition for TCF_DrvFlags */ 4911da177e4SLinus Torvalds #define TCF_DRV_BUSY 0x01 /* Indicate target busy(driver) */ 4921da177e4SLinus Torvalds #define TCF_DRV_EN_TAG 0x0800 4931da177e4SLinus Torvalds #define TCF_DRV_255_63 0x0400 4941da177e4SLinus Torvalds 4951da177e4SLinus Torvalds /*********************************************************************** 4961da177e4SLinus Torvalds Host Adapter Control Structure 4971da177e4SLinus Torvalds ************************************************************************/ 49872d39feaSAlan Cox struct initio_host { 49972d39feaSAlan Cox u16 addr; /* 00 */ 50072d39feaSAlan Cox u16 bios_addr; /* 02 */ 50172d39feaSAlan Cox u8 irq; /* 04 */ 50272d39feaSAlan Cox u8 scsi_id; /* 05 */ 50372d39feaSAlan Cox u8 max_tar; /* 06 */ 50472d39feaSAlan Cox u8 num_scbs; /* 07 */ 5051da177e4SLinus Torvalds 50672d39feaSAlan Cox u8 flags; /* 08 */ 50772d39feaSAlan Cox u8 index; /* 09 */ 50872d39feaSAlan Cox u8 ha_id; /* 0A */ 50972d39feaSAlan Cox u8 config; /* 0B */ 51072d39feaSAlan Cox u16 idmask; /* 0C */ 51172d39feaSAlan Cox u8 semaph; /* 0E */ 51272d39feaSAlan Cox u8 phase; /* 0F */ 51372d39feaSAlan Cox u8 jsstatus0; /* 10 */ 51472d39feaSAlan Cox u8 jsint; /* 11 */ 51572d39feaSAlan Cox u8 jsstatus1; /* 12 */ 51672d39feaSAlan Cox u8 sconf1; /* 13 */ 5171da177e4SLinus Torvalds 51872d39feaSAlan Cox u8 msg[8]; /* 14 */ 51972d39feaSAlan Cox struct scsi_ctrl_blk *next_avail; /* 1C */ 52072d39feaSAlan Cox struct scsi_ctrl_blk *scb; /* 20 */ 52172d39feaSAlan Cox struct scsi_ctrl_blk *scb_end; /* 24 */ /*UNUSED*/ 52272d39feaSAlan Cox struct scsi_ctrl_blk *next_pending; /* 28 */ 52372d39feaSAlan Cox struct scsi_ctrl_blk *next_contig; /* 2C */ /*UNUSED*/ 52472d39feaSAlan Cox struct scsi_ctrl_blk *active; /* 30 */ 52572d39feaSAlan Cox struct target_control *active_tc; /* 34 */ 5261da177e4SLinus Torvalds 52772d39feaSAlan Cox struct scsi_ctrl_blk *first_avail; /* 38 */ 52872d39feaSAlan Cox struct scsi_ctrl_blk *last_avail; /* 3C */ 52972d39feaSAlan Cox struct scsi_ctrl_blk *first_pending; /* 40 */ 53072d39feaSAlan Cox struct scsi_ctrl_blk *last_pending; /* 44 */ 53172d39feaSAlan Cox struct scsi_ctrl_blk *first_busy; /* 48 */ 53272d39feaSAlan Cox struct scsi_ctrl_blk *last_busy; /* 4C */ 53372d39feaSAlan Cox struct scsi_ctrl_blk *first_done; /* 50 */ 53472d39feaSAlan Cox struct scsi_ctrl_blk *last_done; /* 54 */ 53572d39feaSAlan Cox u8 max_tags[16]; /* 58 */ 53672d39feaSAlan Cox u8 act_tags[16]; /* 68 */ 53772d39feaSAlan Cox struct target_control targets[MAX_TARGETS]; /* 78 */ 53872d39feaSAlan Cox spinlock_t avail_lock; 53972d39feaSAlan Cox spinlock_t semaph_lock; 5401da177e4SLinus Torvalds struct pci_dev *pci_dev; 54172d39feaSAlan Cox }; 5421da177e4SLinus Torvalds 5431da177e4SLinus Torvalds /* Bit Definition for HCB_Config */ 5441da177e4SLinus Torvalds #define HCC_SCSI_RESET 0x01 5451da177e4SLinus Torvalds #define HCC_EN_PAR 0x02 5461da177e4SLinus Torvalds #define HCC_ACT_TERM1 0x04 5471da177e4SLinus Torvalds #define HCC_ACT_TERM2 0x08 5481da177e4SLinus Torvalds #define HCC_AUTO_TERM 0x10 5491da177e4SLinus Torvalds #define HCC_EN_PWR 0x80 5501da177e4SLinus Torvalds 5511da177e4SLinus Torvalds /* Bit Definition for HCB_Flags */ 5521da177e4SLinus Torvalds #define HCF_EXPECT_DISC 0x01 5531da177e4SLinus Torvalds #define HCF_EXPECT_SELECT 0x02 5541da177e4SLinus Torvalds #define HCF_EXPECT_RESET 0x10 5551da177e4SLinus Torvalds #define HCF_EXPECT_DONE_DISC 0x20 5561da177e4SLinus Torvalds 5571da177e4SLinus Torvalds /****************************************************************** 5581da177e4SLinus Torvalds Serial EEProm 5591da177e4SLinus Torvalds *******************************************************************/ 5601da177e4SLinus Torvalds 5611da177e4SLinus Torvalds typedef struct _NVRAM_SCSI { /* SCSI channel configuration */ 56272d39feaSAlan Cox u8 NVM_ChSCSIID; /* 0Ch -> Channel SCSI ID */ 56372d39feaSAlan Cox u8 NVM_ChConfig1; /* 0Dh -> Channel config 1 */ 56472d39feaSAlan Cox u8 NVM_ChConfig2; /* 0Eh -> Channel config 2 */ 56572d39feaSAlan Cox u8 NVM_NumOfTarg; /* 0Fh -> Number of SCSI target */ 5661da177e4SLinus Torvalds /* SCSI target configuration */ 56772d39feaSAlan Cox u8 NVM_Targ0Config; /* 10h -> Target 0 configuration */ 56872d39feaSAlan Cox u8 NVM_Targ1Config; /* 11h -> Target 1 configuration */ 56972d39feaSAlan Cox u8 NVM_Targ2Config; /* 12h -> Target 2 configuration */ 57072d39feaSAlan Cox u8 NVM_Targ3Config; /* 13h -> Target 3 configuration */ 57172d39feaSAlan Cox u8 NVM_Targ4Config; /* 14h -> Target 4 configuration */ 57272d39feaSAlan Cox u8 NVM_Targ5Config; /* 15h -> Target 5 configuration */ 57372d39feaSAlan Cox u8 NVM_Targ6Config; /* 16h -> Target 6 configuration */ 57472d39feaSAlan Cox u8 NVM_Targ7Config; /* 17h -> Target 7 configuration */ 57572d39feaSAlan Cox u8 NVM_Targ8Config; /* 18h -> Target 8 configuration */ 57672d39feaSAlan Cox u8 NVM_Targ9Config; /* 19h -> Target 9 configuration */ 57772d39feaSAlan Cox u8 NVM_TargAConfig; /* 1Ah -> Target A configuration */ 57872d39feaSAlan Cox u8 NVM_TargBConfig; /* 1Bh -> Target B configuration */ 57972d39feaSAlan Cox u8 NVM_TargCConfig; /* 1Ch -> Target C configuration */ 58072d39feaSAlan Cox u8 NVM_TargDConfig; /* 1Dh -> Target D configuration */ 58172d39feaSAlan Cox u8 NVM_TargEConfig; /* 1Eh -> Target E configuration */ 58272d39feaSAlan Cox u8 NVM_TargFConfig; /* 1Fh -> Target F configuration */ 5831da177e4SLinus Torvalds } NVRAM_SCSI; 5841da177e4SLinus Torvalds 5851da177e4SLinus Torvalds typedef struct _NVRAM { 5861da177e4SLinus Torvalds /*----------header ---------------*/ 58772d39feaSAlan Cox u16 NVM_Signature; /* 0,1: Signature */ 58872d39feaSAlan Cox u8 NVM_Size; /* 2: Size of data structure */ 58972d39feaSAlan Cox u8 NVM_Revision; /* 3: Revision of data structure */ 5901da177e4SLinus Torvalds /* ----Host Adapter Structure ---- */ 59172d39feaSAlan Cox u8 NVM_ModelByte0; /* 4: Model number (byte 0) */ 59272d39feaSAlan Cox u8 NVM_ModelByte1; /* 5: Model number (byte 1) */ 59372d39feaSAlan Cox u8 NVM_ModelInfo; /* 6: Model information */ 59472d39feaSAlan Cox u8 NVM_NumOfCh; /* 7: Number of SCSI channel */ 59572d39feaSAlan Cox u8 NVM_BIOSConfig1; /* 8: BIOS configuration 1 */ 59672d39feaSAlan Cox u8 NVM_BIOSConfig2; /* 9: BIOS configuration 2 */ 59772d39feaSAlan Cox u8 NVM_HAConfig1; /* A: Hoat adapter configuration 1 */ 59872d39feaSAlan Cox u8 NVM_HAConfig2; /* B: Hoat adapter configuration 2 */ 5991da177e4SLinus Torvalds NVRAM_SCSI NVM_SCSIInfo[2]; 60072d39feaSAlan Cox u8 NVM_reserved[10]; 6011da177e4SLinus Torvalds /* ---------- CheckSum ---------- */ 60272d39feaSAlan Cox u16 NVM_CheckSum; /* 0x3E, 0x3F: Checksum of NVRam */ 6031da177e4SLinus Torvalds } NVRAM, *PNVRAM; 6041da177e4SLinus Torvalds 6051da177e4SLinus Torvalds /* Bios Configuration for nvram->BIOSConfig1 */ 6061da177e4SLinus Torvalds #define NBC1_ENABLE 0x01 /* BIOS enable */ 6071da177e4SLinus Torvalds #define NBC1_8DRIVE 0x02 /* Support more than 2 drives */ 6081da177e4SLinus Torvalds #define NBC1_REMOVABLE 0x04 /* Support removable drive */ 6091da177e4SLinus Torvalds #define NBC1_INT19 0x08 /* Intercept int 19h */ 6101da177e4SLinus Torvalds #define NBC1_BIOSSCAN 0x10 /* Dynamic BIOS scan */ 6111da177e4SLinus Torvalds #define NBC1_LUNSUPPORT 0x40 /* Support LUN */ 6121da177e4SLinus Torvalds 6131da177e4SLinus Torvalds /* HA Configuration Byte 1 */ 6141da177e4SLinus Torvalds #define NHC1_BOOTIDMASK 0x0F /* Boot ID number */ 6151da177e4SLinus Torvalds #define NHC1_LUNMASK 0x70 /* Boot LUN number */ 6161da177e4SLinus Torvalds #define NHC1_CHANMASK 0x80 /* Boot Channel number */ 6171da177e4SLinus Torvalds 6181da177e4SLinus Torvalds /* Bit definition for nvram->SCSIconfig1 */ 6191da177e4SLinus Torvalds #define NCC1_BUSRESET 0x01 /* Reset SCSI bus at power up */ 6201da177e4SLinus Torvalds #define NCC1_PARITYCHK 0x02 /* SCSI parity enable */ 6211da177e4SLinus Torvalds #define NCC1_ACTTERM1 0x04 /* Enable active terminator 1 */ 6221da177e4SLinus Torvalds #define NCC1_ACTTERM2 0x08 /* Enable active terminator 2 */ 6231da177e4SLinus Torvalds #define NCC1_AUTOTERM 0x10 /* Enable auto terminator */ 6241da177e4SLinus Torvalds #define NCC1_PWRMGR 0x80 /* Enable power management */ 6251da177e4SLinus Torvalds 6261da177e4SLinus Torvalds /* Bit definition for SCSI Target configuration byte */ 6271da177e4SLinus Torvalds #define NTC_DISCONNECT 0x08 /* Enable SCSI disconnect */ 6281da177e4SLinus Torvalds #define NTC_SYNC 0x10 /* SYNC_NEGO */ 6291da177e4SLinus Torvalds #define NTC_NO_WDTR 0x20 /* SYNC_NEGO */ 6301da177e4SLinus Torvalds #define NTC_1GIGA 0x40 /* 255 head / 63 sectors (64/32) */ 6311da177e4SLinus Torvalds #define NTC_SPINUP 0x80 /* Start disk drive */ 6321da177e4SLinus Torvalds 6331da177e4SLinus Torvalds /* Default NVRam values */ 6341da177e4SLinus Torvalds #define INI_SIGNATURE 0xC925 6351da177e4SLinus Torvalds #define NBC1_DEFAULT (NBC1_ENABLE) 6361da177e4SLinus Torvalds #define NCC1_DEFAULT (NCC1_BUSRESET | NCC1_AUTOTERM | NCC1_PARITYCHK) 6371da177e4SLinus Torvalds #define NTC_DEFAULT (NTC_NO_WDTR | NTC_1GIGA | NTC_DISCONNECT) 6381da177e4SLinus Torvalds 6391da177e4SLinus Torvalds /* SCSI related definition */ 6401da177e4SLinus Torvalds #define DISC_NOT_ALLOW 0x80 /* Disconnect is not allowed */ 6411da177e4SLinus Torvalds #define DISC_ALLOW 0xC0 /* Disconnect is allowed */ 6421da177e4SLinus Torvalds #define SCSICMD_RequestSense 0x03 6431da177e4SLinus Torvalds 6441da177e4SLinus Torvalds #define SCSI_ABORT_SNOOZE 0 6451da177e4SLinus Torvalds #define SCSI_ABORT_SUCCESS 1 6461da177e4SLinus Torvalds #define SCSI_ABORT_PENDING 2 6471da177e4SLinus Torvalds #define SCSI_ABORT_BUSY 3 6481da177e4SLinus Torvalds #define SCSI_ABORT_NOT_RUNNING 4 6491da177e4SLinus Torvalds #define SCSI_ABORT_ERROR 5 6501da177e4SLinus Torvalds 6511da177e4SLinus Torvalds #define SCSI_RESET_SNOOZE 0 6521da177e4SLinus Torvalds #define SCSI_RESET_PUNT 1 6531da177e4SLinus Torvalds #define SCSI_RESET_SUCCESS 2 6541da177e4SLinus Torvalds #define SCSI_RESET_PENDING 3 6551da177e4SLinus Torvalds #define SCSI_RESET_WAKEUP 4 6561da177e4SLinus Torvalds #define SCSI_RESET_NOT_RUNNING 5 6571da177e4SLinus Torvalds #define SCSI_RESET_ERROR 6 6581da177e4SLinus Torvalds 6591da177e4SLinus Torvalds #define SCSI_RESET_SYNCHRONOUS 0x01 6601da177e4SLinus Torvalds #define SCSI_RESET_ASYNCHRONOUS 0x02 6611da177e4SLinus Torvalds #define SCSI_RESET_SUGGEST_BUS_RESET 0x04 6621da177e4SLinus Torvalds #define SCSI_RESET_SUGGEST_HOST_RESET 0x08 6631da177e4SLinus Torvalds 6641da177e4SLinus Torvalds #define SCSI_RESET_BUS_RESET 0x100 6651da177e4SLinus Torvalds #define SCSI_RESET_HOST_RESET 0x200 6661da177e4SLinus Torvalds #define SCSI_RESET_ACTION 0xff 6671da177e4SLinus Torvalds 668