162306a36Sopenharmony_ci/************************************************************************** 262306a36Sopenharmony_ci * Initio 9100 device driver for Linux. 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Copyright (c) 1994-1998 Initio Corporation 562306a36Sopenharmony_ci * All rights reserved. 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Cleanups (c) Copyright 2007 Red Hat <alan@lxorguk.ukuu.org.uk> 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 1062306a36Sopenharmony_ci * it under the terms of the GNU General Public License as published by 1162306a36Sopenharmony_ci * the Free Software Foundation; either version 2, or (at your option) 1262306a36Sopenharmony_ci * any later version. 1362306a36Sopenharmony_ci * 1462306a36Sopenharmony_ci * This program is distributed in the hope that it will be useful, 1562306a36Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 1662306a36Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1762306a36Sopenharmony_ci * GNU General Public License for more details. 1862306a36Sopenharmony_ci * 1962306a36Sopenharmony_ci * You should have received a copy of the GNU General Public License 2062306a36Sopenharmony_ci * along with this program; see the file COPYING. If not, write to 2162306a36Sopenharmony_ci * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 2262306a36Sopenharmony_ci * 2362306a36Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 2462306a36Sopenharmony_ci * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2562306a36Sopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2662306a36Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 2762306a36Sopenharmony_ci * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2862306a36Sopenharmony_ci * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2962306a36Sopenharmony_ci * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3062306a36Sopenharmony_ci * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3162306a36Sopenharmony_ci * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3262306a36Sopenharmony_ci * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3362306a36Sopenharmony_ci * SUCH DAMAGE. 3462306a36Sopenharmony_ci * 3562306a36Sopenharmony_ci **************************************************************************/ 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci#include <linux/types.h> 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci#define TOTAL_SG_ENTRY 32 4162306a36Sopenharmony_ci#define MAX_SUPPORTED_ADAPTERS 8 4262306a36Sopenharmony_ci#define MAX_OFFSET 15 4362306a36Sopenharmony_ci#define MAX_TARGETS 16 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_citypedef struct { 4662306a36Sopenharmony_ci unsigned short base; 4762306a36Sopenharmony_ci unsigned short vec; 4862306a36Sopenharmony_ci} i91u_config; 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci/***************************************/ 5162306a36Sopenharmony_ci/* Tulip Configuration Register Set */ 5262306a36Sopenharmony_ci/***************************************/ 5362306a36Sopenharmony_ci#define TUL_PVID 0x00 /* Vendor ID */ 5462306a36Sopenharmony_ci#define TUL_PDID 0x02 /* Device ID */ 5562306a36Sopenharmony_ci#define TUL_PCMD 0x04 /* Command */ 5662306a36Sopenharmony_ci#define TUL_PSTUS 0x06 /* Status */ 5762306a36Sopenharmony_ci#define TUL_PRID 0x08 /* Revision number */ 5862306a36Sopenharmony_ci#define TUL_PPI 0x09 /* Programming interface */ 5962306a36Sopenharmony_ci#define TUL_PSC 0x0A /* Sub Class */ 6062306a36Sopenharmony_ci#define TUL_PBC 0x0B /* Base Class */ 6162306a36Sopenharmony_ci#define TUL_PCLS 0x0C /* Cache line size */ 6262306a36Sopenharmony_ci#define TUL_PLTR 0x0D /* Latency timer */ 6362306a36Sopenharmony_ci#define TUL_PHDT 0x0E /* Header type */ 6462306a36Sopenharmony_ci#define TUL_PBIST 0x0F /* BIST */ 6562306a36Sopenharmony_ci#define TUL_PBAD 0x10 /* Base address */ 6662306a36Sopenharmony_ci#define TUL_PBAD1 0x14 /* Base address */ 6762306a36Sopenharmony_ci#define TUL_PBAD2 0x18 /* Base address */ 6862306a36Sopenharmony_ci#define TUL_PBAD3 0x1C /* Base address */ 6962306a36Sopenharmony_ci#define TUL_PBAD4 0x20 /* Base address */ 7062306a36Sopenharmony_ci#define TUL_PBAD5 0x24 /* Base address */ 7162306a36Sopenharmony_ci#define TUL_PRSVD 0x28 /* Reserved */ 7262306a36Sopenharmony_ci#define TUL_PRSVD1 0x2C /* Reserved */ 7362306a36Sopenharmony_ci#define TUL_PRAD 0x30 /* Expansion ROM base address */ 7462306a36Sopenharmony_ci#define TUL_PRSVD2 0x34 /* Reserved */ 7562306a36Sopenharmony_ci#define TUL_PRSVD3 0x38 /* Reserved */ 7662306a36Sopenharmony_ci#define TUL_PINTL 0x3C /* Interrupt line */ 7762306a36Sopenharmony_ci#define TUL_PINTP 0x3D /* Interrupt pin */ 7862306a36Sopenharmony_ci#define TUL_PIGNT 0x3E /* MIN_GNT */ 7962306a36Sopenharmony_ci#define TUL_PMGNT 0x3F /* MAX_GNT */ 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ci/************************/ 8262306a36Sopenharmony_ci/* Jasmin Register Set */ 8362306a36Sopenharmony_ci/************************/ 8462306a36Sopenharmony_ci#define TUL_HACFG0 0x40 /* H/A Configuration Register 0 */ 8562306a36Sopenharmony_ci#define TUL_HACFG1 0x41 /* H/A Configuration Register 1 */ 8662306a36Sopenharmony_ci#define TUL_HACFG2 0x42 /* H/A Configuration Register 2 */ 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci#define TUL_SDCFG0 0x44 /* SCSI Device Configuration 0 */ 8962306a36Sopenharmony_ci#define TUL_SDCFG1 0x45 /* SCSI Device Configuration 1 */ 9062306a36Sopenharmony_ci#define TUL_SDCFG2 0x46 /* SCSI Device Configuration 2 */ 9162306a36Sopenharmony_ci#define TUL_SDCFG3 0x47 /* SCSI Device Configuration 3 */ 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci#define TUL_GINTS 0x50 /* Global Interrupt Status Register */ 9462306a36Sopenharmony_ci#define TUL_GIMSK 0x52 /* Global Interrupt MASK Register */ 9562306a36Sopenharmony_ci#define TUL_GCTRL 0x54 /* Global Control Register */ 9662306a36Sopenharmony_ci#define TUL_GCTRL_EEPROM_BIT 0x04 9762306a36Sopenharmony_ci#define TUL_GCTRL1 0x55 /* Global Control Register */ 9862306a36Sopenharmony_ci#define TUL_DMACFG 0x5B /* DMA configuration */ 9962306a36Sopenharmony_ci#define TUL_NVRAM 0x5D /* Non-volatile RAM port */ 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci#define TUL_SCnt0 0x80 /* 00 R/W Transfer Counter Low */ 10262306a36Sopenharmony_ci#define TUL_SCnt1 0x81 /* 01 R/W Transfer Counter Mid */ 10362306a36Sopenharmony_ci#define TUL_SCnt2 0x82 /* 02 R/W Transfer Count High */ 10462306a36Sopenharmony_ci#define TUL_SFifoCnt 0x83 /* 03 R FIFO counter */ 10562306a36Sopenharmony_ci#define TUL_SIntEnable 0x84 /* 03 W Interrupt enble */ 10662306a36Sopenharmony_ci#define TUL_SInt 0x84 /* 04 R Interrupt Register */ 10762306a36Sopenharmony_ci#define TUL_SCtrl0 0x85 /* 05 W Control 0 */ 10862306a36Sopenharmony_ci#define TUL_SStatus0 0x85 /* 05 R Status 0 */ 10962306a36Sopenharmony_ci#define TUL_SCtrl1 0x86 /* 06 W Control 1 */ 11062306a36Sopenharmony_ci#define TUL_SStatus1 0x86 /* 06 R Status 1 */ 11162306a36Sopenharmony_ci#define TUL_SConfig 0x87 /* 07 W Configuration */ 11262306a36Sopenharmony_ci#define TUL_SStatus2 0x87 /* 07 R Status 2 */ 11362306a36Sopenharmony_ci#define TUL_SPeriod 0x88 /* 08 W Sync. Transfer Period & Offset */ 11462306a36Sopenharmony_ci#define TUL_SOffset 0x88 /* 08 R Offset */ 11562306a36Sopenharmony_ci#define TUL_SScsiId 0x89 /* 09 W SCSI ID */ 11662306a36Sopenharmony_ci#define TUL_SBusId 0x89 /* 09 R SCSI BUS ID */ 11762306a36Sopenharmony_ci#define TUL_STimeOut 0x8A /* 0A W Sel/Resel Time Out Register */ 11862306a36Sopenharmony_ci#define TUL_SIdent 0x8A /* 0A R Identify Message Register */ 11962306a36Sopenharmony_ci#define TUL_SAvail 0x8A /* 0A R Available Counter Register */ 12062306a36Sopenharmony_ci#define TUL_SData 0x8B /* 0B R/W SCSI data in/out */ 12162306a36Sopenharmony_ci#define TUL_SFifo 0x8C /* 0C R/W FIFO */ 12262306a36Sopenharmony_ci#define TUL_SSignal 0x90 /* 10 R/W SCSI signal in/out */ 12362306a36Sopenharmony_ci#define TUL_SCmd 0x91 /* 11 R/W Command */ 12462306a36Sopenharmony_ci#define TUL_STest0 0x92 /* 12 R/W Test0 */ 12562306a36Sopenharmony_ci#define TUL_STest1 0x93 /* 13 R/W Test1 */ 12662306a36Sopenharmony_ci#define TUL_SCFG1 0x94 /* 14 R/W Configuration */ 12762306a36Sopenharmony_ci 12862306a36Sopenharmony_ci#define TUL_XAddH 0xC0 /*DMA Transfer Physical Address */ 12962306a36Sopenharmony_ci#define TUL_XAddW 0xC8 /*DMA Current Transfer Physical Address */ 13062306a36Sopenharmony_ci#define TUL_XCntH 0xD0 /*DMA Transfer Counter */ 13162306a36Sopenharmony_ci#define TUL_XCntW 0xD4 /*DMA Current Transfer Counter */ 13262306a36Sopenharmony_ci#define TUL_XCmd 0xD8 /*DMA Command Register */ 13362306a36Sopenharmony_ci#define TUL_Int 0xDC /*Interrupt Register */ 13462306a36Sopenharmony_ci#define TUL_XStatus 0xDD /*DMA status Register */ 13562306a36Sopenharmony_ci#define TUL_Mask 0xE0 /*Interrupt Mask Register */ 13662306a36Sopenharmony_ci#define TUL_XCtrl 0xE4 /*DMA Control Register */ 13762306a36Sopenharmony_ci#define TUL_XCtrl1 0xE5 /*DMA Control Register 1 */ 13862306a36Sopenharmony_ci#define TUL_XFifo 0xE8 /*DMA FIFO */ 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci#define TUL_WCtrl 0xF7 /*Bus master wait state control */ 14162306a36Sopenharmony_ci#define TUL_DCtrl 0xFB /*DMA delay control */ 14262306a36Sopenharmony_ci 14362306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 14462306a36Sopenharmony_ci/* bit definition for Command register of Configuration Space Header */ 14562306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 14662306a36Sopenharmony_ci#define BUSMS 0x04 /* BUS MASTER Enable */ 14762306a36Sopenharmony_ci#define IOSPA 0x01 /* IO Space Enable */ 14862306a36Sopenharmony_ci 14962306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 15062306a36Sopenharmony_ci/* Command Codes of Tulip SCSI Command register */ 15162306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 15262306a36Sopenharmony_ci#define TSC_EN_RESEL 0x80 /* Enable Reselection */ 15362306a36Sopenharmony_ci#define TSC_CMD_COMP 0x84 /* Command Complete Sequence */ 15462306a36Sopenharmony_ci#define TSC_SEL 0x01 /* Select Without ATN Sequence */ 15562306a36Sopenharmony_ci#define TSC_SEL_ATN 0x11 /* Select With ATN Sequence */ 15662306a36Sopenharmony_ci#define TSC_SEL_ATN_DMA 0x51 /* Select With ATN Sequence with DMA */ 15762306a36Sopenharmony_ci#define TSC_SEL_ATN3 0x31 /* Select With ATN3 Sequence */ 15862306a36Sopenharmony_ci#define TSC_SEL_ATNSTOP 0x12 /* Select With ATN and Stop Sequence */ 15962306a36Sopenharmony_ci#define TSC_SELATNSTOP 0x1E /* Select With ATN and Stop Sequence */ 16062306a36Sopenharmony_ci 16162306a36Sopenharmony_ci#define TSC_SEL_ATN_DIRECT_IN 0x95 /* Select With ATN Sequence */ 16262306a36Sopenharmony_ci#define TSC_SEL_ATN_DIRECT_OUT 0x15 /* Select With ATN Sequence */ 16362306a36Sopenharmony_ci#define TSC_SEL_ATN3_DIRECT_IN 0xB5 /* Select With ATN3 Sequence */ 16462306a36Sopenharmony_ci#define TSC_SEL_ATN3_DIRECT_OUT 0x35 /* Select With ATN3 Sequence */ 16562306a36Sopenharmony_ci#define TSC_XF_DMA_OUT_DIRECT 0x06 /* DMA Xfer Information out */ 16662306a36Sopenharmony_ci#define TSC_XF_DMA_IN_DIRECT 0x86 /* DMA Xfer Information in */ 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci#define TSC_XF_DMA_OUT 0x43 /* DMA Xfer Information out */ 16962306a36Sopenharmony_ci#define TSC_XF_DMA_IN 0xC3 /* DMA Xfer Information in */ 17062306a36Sopenharmony_ci#define TSC_XF_FIFO_OUT 0x03 /* FIFO Xfer Information out */ 17162306a36Sopenharmony_ci#define TSC_XF_FIFO_IN 0x83 /* FIFO Xfer Information in */ 17262306a36Sopenharmony_ci 17362306a36Sopenharmony_ci#define TSC_MSG_ACCEPT 0x0F /* Message Accept */ 17462306a36Sopenharmony_ci 17562306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 17662306a36Sopenharmony_ci/* bit definition for Tulip SCSI Control 0 Register */ 17762306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 17862306a36Sopenharmony_ci#define TSC_RST_SEQ 0x20 /* Reset sequence counter */ 17962306a36Sopenharmony_ci#define TSC_FLUSH_FIFO 0x10 /* Flush FIFO */ 18062306a36Sopenharmony_ci#define TSC_ABT_CMD 0x04 /* Abort command (sequence) */ 18162306a36Sopenharmony_ci#define TSC_RST_CHIP 0x02 /* Reset SCSI Chip */ 18262306a36Sopenharmony_ci#define TSC_RST_BUS 0x01 /* Reset SCSI Bus */ 18362306a36Sopenharmony_ci 18462306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 18562306a36Sopenharmony_ci/* bit definition for Tulip SCSI Control 1 Register */ 18662306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 18762306a36Sopenharmony_ci#define TSC_EN_SCAM 0x80 /* Enable SCAM */ 18862306a36Sopenharmony_ci#define TSC_TIMER 0x40 /* Select timeout unit */ 18962306a36Sopenharmony_ci#define TSC_EN_SCSI2 0x20 /* SCSI-2 mode */ 19062306a36Sopenharmony_ci#define TSC_PWDN 0x10 /* Power down mode */ 19162306a36Sopenharmony_ci#define TSC_WIDE_CPU 0x08 /* Wide CPU */ 19262306a36Sopenharmony_ci#define TSC_HW_RESELECT 0x04 /* Enable HW reselect */ 19362306a36Sopenharmony_ci#define TSC_EN_BUS_OUT 0x02 /* Enable SCSI data bus out latch */ 19462306a36Sopenharmony_ci#define TSC_EN_BUS_IN 0x01 /* Enable SCSI data bus in latch */ 19562306a36Sopenharmony_ci 19662306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 19762306a36Sopenharmony_ci/* bit definition for Tulip SCSI Configuration Register */ 19862306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 19962306a36Sopenharmony_ci#define TSC_EN_LATCH 0x80 /* Enable phase latch */ 20062306a36Sopenharmony_ci#define TSC_INITIATOR 0x40 /* Initiator mode */ 20162306a36Sopenharmony_ci#define TSC_EN_SCSI_PAR 0x20 /* Enable SCSI parity */ 20262306a36Sopenharmony_ci#define TSC_DMA_8BIT 0x10 /* Alternate dma 8-bits mode */ 20362306a36Sopenharmony_ci#define TSC_DMA_16BIT 0x08 /* Alternate dma 16-bits mode */ 20462306a36Sopenharmony_ci#define TSC_EN_WDACK 0x04 /* Enable DACK while wide SCSI xfer */ 20562306a36Sopenharmony_ci#define TSC_ALT_PERIOD 0x02 /* Alternate sync period mode */ 20662306a36Sopenharmony_ci#define TSC_DIS_SCSIRST 0x01 /* Disable SCSI bus reset us */ 20762306a36Sopenharmony_ci 20862306a36Sopenharmony_ci#define TSC_INITDEFAULT (TSC_INITIATOR | TSC_EN_LATCH | TSC_ALT_PERIOD | TSC_DIS_SCSIRST) 20962306a36Sopenharmony_ci 21062306a36Sopenharmony_ci#define TSC_WIDE_SCSI 0x80 /* Enable Wide SCSI */ 21162306a36Sopenharmony_ci 21262306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 21362306a36Sopenharmony_ci/* bit definition for Tulip SCSI signal Register */ 21462306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 21562306a36Sopenharmony_ci#define TSC_RST_ACK 0x00 /* Release ACK signal */ 21662306a36Sopenharmony_ci#define TSC_RST_ATN 0x00 /* Release ATN signal */ 21762306a36Sopenharmony_ci#define TSC_RST_BSY 0x00 /* Release BSY signal */ 21862306a36Sopenharmony_ci 21962306a36Sopenharmony_ci#define TSC_SET_ACK 0x40 /* ACK signal */ 22062306a36Sopenharmony_ci#define TSC_SET_ATN 0x08 /* ATN signal */ 22162306a36Sopenharmony_ci 22262306a36Sopenharmony_ci#define TSC_REQI 0x80 /* REQ signal */ 22362306a36Sopenharmony_ci#define TSC_ACKI 0x40 /* ACK signal */ 22462306a36Sopenharmony_ci#define TSC_BSYI 0x20 /* BSY signal */ 22562306a36Sopenharmony_ci#define TSC_SELI 0x10 /* SEL signal */ 22662306a36Sopenharmony_ci#define TSC_ATNI 0x08 /* ATN signal */ 22762306a36Sopenharmony_ci#define TSC_MSGI 0x04 /* MSG signal */ 22862306a36Sopenharmony_ci#define TSC_CDI 0x02 /* C/D signal */ 22962306a36Sopenharmony_ci#define TSC_IOI 0x01 /* I/O signal */ 23062306a36Sopenharmony_ci 23162306a36Sopenharmony_ci 23262306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 23362306a36Sopenharmony_ci/* bit definition for Tulip SCSI Status 0 Register */ 23462306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 23562306a36Sopenharmony_ci#define TSS_INT_PENDING 0x80 /* Interrupt pending */ 23662306a36Sopenharmony_ci#define TSS_SEQ_ACTIVE 0x40 /* Sequencer active */ 23762306a36Sopenharmony_ci#define TSS_XFER_CNT 0x20 /* Transfer counter zero */ 23862306a36Sopenharmony_ci#define TSS_FIFO_EMPTY 0x10 /* FIFO empty */ 23962306a36Sopenharmony_ci#define TSS_PAR_ERROR 0x08 /* SCSI parity error */ 24062306a36Sopenharmony_ci#define TSS_PH_MASK 0x07 /* SCSI phase mask */ 24162306a36Sopenharmony_ci 24262306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 24362306a36Sopenharmony_ci/* bit definition for Tulip SCSI Status 1 Register */ 24462306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 24562306a36Sopenharmony_ci#define TSS_STATUS_RCV 0x08 /* Status received */ 24662306a36Sopenharmony_ci#define TSS_MSG_SEND 0x40 /* Message sent */ 24762306a36Sopenharmony_ci#define TSS_CMD_PH_CMP 0x20 /* command phase done */ 24862306a36Sopenharmony_ci#define TSS_DATA_PH_CMP 0x10 /* Data phase done */ 24962306a36Sopenharmony_ci#define TSS_STATUS_SEND 0x08 /* Status sent */ 25062306a36Sopenharmony_ci#define TSS_XFER_CMP 0x04 /* Transfer completed */ 25162306a36Sopenharmony_ci#define TSS_SEL_CMP 0x02 /* Selection completed */ 25262306a36Sopenharmony_ci#define TSS_ARB_CMP 0x01 /* Arbitration completed */ 25362306a36Sopenharmony_ci 25462306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 25562306a36Sopenharmony_ci/* bit definition for Tulip SCSI Status 2 Register */ 25662306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 25762306a36Sopenharmony_ci#define TSS_CMD_ABTED 0x80 /* Command aborted */ 25862306a36Sopenharmony_ci#define TSS_OFFSET_0 0x40 /* Offset counter zero */ 25962306a36Sopenharmony_ci#define TSS_FIFO_FULL 0x20 /* FIFO full */ 26062306a36Sopenharmony_ci#define TSS_TIMEOUT_0 0x10 /* Timeout counter zero */ 26162306a36Sopenharmony_ci#define TSS_BUSY_RLS 0x08 /* Busy release */ 26262306a36Sopenharmony_ci#define TSS_PH_MISMATCH 0x04 /* Phase mismatch */ 26362306a36Sopenharmony_ci#define TSS_SCSI_BUS_EN 0x02 /* SCSI data bus enable */ 26462306a36Sopenharmony_ci#define TSS_SCSIRST 0x01 /* SCSI bus reset in progress */ 26562306a36Sopenharmony_ci 26662306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 26762306a36Sopenharmony_ci/* bit definition for Tulip SCSI Interrupt Register */ 26862306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 26962306a36Sopenharmony_ci#define TSS_RESEL_INT 0x80 /* Reselected interrupt */ 27062306a36Sopenharmony_ci#define TSS_SEL_TIMEOUT 0x40 /* Selected/reselected timeout */ 27162306a36Sopenharmony_ci#define TSS_BUS_SERV 0x20 27262306a36Sopenharmony_ci#define TSS_SCSIRST_INT 0x10 /* SCSI bus reset detected */ 27362306a36Sopenharmony_ci#define TSS_DISC_INT 0x08 /* Disconnected interrupt */ 27462306a36Sopenharmony_ci#define TSS_SEL_INT 0x04 /* Select interrupt */ 27562306a36Sopenharmony_ci#define TSS_SCAM_SEL 0x02 /* SCAM selected */ 27662306a36Sopenharmony_ci#define TSS_FUNC_COMP 0x01 27762306a36Sopenharmony_ci 27862306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 27962306a36Sopenharmony_ci/* SCSI Phase Codes. */ 28062306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 28162306a36Sopenharmony_ci#define DATA_OUT 0 28262306a36Sopenharmony_ci#define DATA_IN 1 /* 4 */ 28362306a36Sopenharmony_ci#define CMD_OUT 2 28462306a36Sopenharmony_ci#define STATUS_IN 3 /* 6 */ 28562306a36Sopenharmony_ci#define MSG_OUT 6 /* 3 */ 28662306a36Sopenharmony_ci#define MSG_IN 7 28762306a36Sopenharmony_ci 28862306a36Sopenharmony_ci 28962306a36Sopenharmony_ci 29062306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 29162306a36Sopenharmony_ci/* Command Codes of Tulip xfer Command register */ 29262306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 29362306a36Sopenharmony_ci#define TAX_X_FORC 0x02 29462306a36Sopenharmony_ci#define TAX_X_ABT 0x04 29562306a36Sopenharmony_ci#define TAX_X_CLR_FIFO 0x08 29662306a36Sopenharmony_ci 29762306a36Sopenharmony_ci#define TAX_X_IN 0x21 29862306a36Sopenharmony_ci#define TAX_X_OUT 0x01 29962306a36Sopenharmony_ci#define TAX_SG_IN 0xA1 30062306a36Sopenharmony_ci#define TAX_SG_OUT 0x81 30162306a36Sopenharmony_ci 30262306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 30362306a36Sopenharmony_ci/* Tulip Interrupt Register */ 30462306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 30562306a36Sopenharmony_ci#define XCMP 0x01 30662306a36Sopenharmony_ci#define FCMP 0x02 30762306a36Sopenharmony_ci#define XABT 0x04 30862306a36Sopenharmony_ci#define XERR 0x08 30962306a36Sopenharmony_ci#define SCMP 0x10 31062306a36Sopenharmony_ci#define IPEND 0x80 31162306a36Sopenharmony_ci 31262306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 31362306a36Sopenharmony_ci/* Tulip DMA Status Register */ 31462306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 31562306a36Sopenharmony_ci#define XPEND 0x01 /* Transfer pending */ 31662306a36Sopenharmony_ci#define FEMPTY 0x02 /* FIFO empty */ 31762306a36Sopenharmony_ci 31862306a36Sopenharmony_ci 31962306a36Sopenharmony_ci 32062306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 32162306a36Sopenharmony_ci/* bit definition for TUL_GCTRL */ 32262306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 32362306a36Sopenharmony_ci#define EXTSG 0x80 32462306a36Sopenharmony_ci#define EXTAD 0x60 32562306a36Sopenharmony_ci#define SEG4K 0x08 32662306a36Sopenharmony_ci#define EEPRG 0x04 32762306a36Sopenharmony_ci#define MRMUL 0x02 32862306a36Sopenharmony_ci 32962306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 33062306a36Sopenharmony_ci/* bit definition for TUL_NVRAM */ 33162306a36Sopenharmony_ci/*----------------------------------------------------------------------*/ 33262306a36Sopenharmony_ci#define SE2CS 0x08 33362306a36Sopenharmony_ci#define SE2CLK 0x04 33462306a36Sopenharmony_ci#define SE2DO 0x02 33562306a36Sopenharmony_ci#define SE2DI 0x01 33662306a36Sopenharmony_ci 33762306a36Sopenharmony_ci 33862306a36Sopenharmony_ci/************************************************************************/ 33962306a36Sopenharmony_ci/* Scatter-Gather Element Structure */ 34062306a36Sopenharmony_ci/************************************************************************/ 34162306a36Sopenharmony_cistruct sg_entry { 34262306a36Sopenharmony_ci u32 data; /* Data Pointer */ 34362306a36Sopenharmony_ci u32 len; /* Data Length */ 34462306a36Sopenharmony_ci}; 34562306a36Sopenharmony_ci 34662306a36Sopenharmony_ci/*********************************************************************** 34762306a36Sopenharmony_ci SCSI Control Block 34862306a36Sopenharmony_ci************************************************************************/ 34962306a36Sopenharmony_cistruct scsi_ctrl_blk { 35062306a36Sopenharmony_ci struct scsi_ctrl_blk *next; 35162306a36Sopenharmony_ci u8 status; /*4 */ 35262306a36Sopenharmony_ci u8 next_state; /*5 */ 35362306a36Sopenharmony_ci u8 mode; /*6 */ 35462306a36Sopenharmony_ci u8 msgin; /*7 SCB_Res0 */ 35562306a36Sopenharmony_ci u16 sgidx; /*8 */ 35662306a36Sopenharmony_ci u16 sgmax; /*A */ 35762306a36Sopenharmony_ci#ifdef ALPHA 35862306a36Sopenharmony_ci u32 reserved[2]; /*C */ 35962306a36Sopenharmony_ci#else 36062306a36Sopenharmony_ci u32 reserved[3]; /*C */ 36162306a36Sopenharmony_ci#endif 36262306a36Sopenharmony_ci 36362306a36Sopenharmony_ci u32 xferlen; /*18 Current xfer len */ 36462306a36Sopenharmony_ci u32 totxlen; /*1C Total xfer len */ 36562306a36Sopenharmony_ci u32 paddr; /*20 SCB phy. Addr. */ 36662306a36Sopenharmony_ci 36762306a36Sopenharmony_ci u8 opcode; /*24 SCB command code */ 36862306a36Sopenharmony_ci u8 flags; /*25 SCB Flags */ 36962306a36Sopenharmony_ci u8 target; /*26 Target Id */ 37062306a36Sopenharmony_ci u8 lun; /*27 Lun */ 37162306a36Sopenharmony_ci u32 bufptr; /*28 Data Buffer Pointer */ 37262306a36Sopenharmony_ci u32 buflen; /*2C Data Allocation Length */ 37362306a36Sopenharmony_ci u8 sglen; /*30 SG list # */ 37462306a36Sopenharmony_ci u8 senselen; /*31 Sense Allocation Length */ 37562306a36Sopenharmony_ci u8 hastat; /*32 */ 37662306a36Sopenharmony_ci u8 tastat; /*33 */ 37762306a36Sopenharmony_ci u8 cdblen; /*34 CDB Length */ 37862306a36Sopenharmony_ci u8 ident; /*35 Identify */ 37962306a36Sopenharmony_ci u8 tagmsg; /*36 Tag Message */ 38062306a36Sopenharmony_ci u8 tagid; /*37 Queue Tag */ 38162306a36Sopenharmony_ci u8 cdb[12]; /*38 */ 38262306a36Sopenharmony_ci u32 sgpaddr; /*44 SG List/Sense Buf phy. Addr. */ 38362306a36Sopenharmony_ci u32 senseptr; /*48 Sense data pointer */ 38462306a36Sopenharmony_ci void (*post) (u8 *, u8 *); /*4C POST routine */ 38562306a36Sopenharmony_ci struct scsi_cmnd *srb; /*50 SRB Pointer */ 38662306a36Sopenharmony_ci struct sg_entry sglist[TOTAL_SG_ENTRY]; /*54 Start of SG list */ 38762306a36Sopenharmony_ci}; 38862306a36Sopenharmony_ci 38962306a36Sopenharmony_ci/* Bit Definition for status */ 39062306a36Sopenharmony_ci#define SCB_RENT 0x01 39162306a36Sopenharmony_ci#define SCB_PEND 0x02 39262306a36Sopenharmony_ci#define SCB_CONTIG 0x04 /* Contingent Allegiance */ 39362306a36Sopenharmony_ci#define SCB_SELECT 0x08 39462306a36Sopenharmony_ci#define SCB_BUSY 0x10 39562306a36Sopenharmony_ci#define SCB_DONE 0x20 39662306a36Sopenharmony_ci 39762306a36Sopenharmony_ci 39862306a36Sopenharmony_ci/* Opcodes for opcode */ 39962306a36Sopenharmony_ci#define ExecSCSI 0x1 40062306a36Sopenharmony_ci#define BusDevRst 0x2 40162306a36Sopenharmony_ci#define AbortCmd 0x3 40262306a36Sopenharmony_ci 40362306a36Sopenharmony_ci 40462306a36Sopenharmony_ci/* Bit Definition for mode */ 40562306a36Sopenharmony_ci#define SCM_RSENS 0x01 /* request sense mode */ 40662306a36Sopenharmony_ci 40762306a36Sopenharmony_ci 40862306a36Sopenharmony_ci/* Bit Definition for flags */ 40962306a36Sopenharmony_ci#define SCF_DONE 0x01 41062306a36Sopenharmony_ci#define SCF_POST 0x02 41162306a36Sopenharmony_ci#define SCF_SENSE 0x04 41262306a36Sopenharmony_ci#define SCF_DIR 0x18 41362306a36Sopenharmony_ci#define SCF_NO_DCHK 0x00 41462306a36Sopenharmony_ci#define SCF_DIN 0x08 41562306a36Sopenharmony_ci#define SCF_DOUT 0x10 41662306a36Sopenharmony_ci#define SCF_NO_XF 0x18 41762306a36Sopenharmony_ci#define SCF_WR_VF 0x20 /* Write verify turn on */ 41862306a36Sopenharmony_ci#define SCF_POLL 0x40 41962306a36Sopenharmony_ci#define SCF_SG 0x80 42062306a36Sopenharmony_ci 42162306a36Sopenharmony_ci/* Error Codes for SCB_HaStat */ 42262306a36Sopenharmony_ci#define HOST_SEL_TOUT 0x11 42362306a36Sopenharmony_ci#define HOST_DO_DU 0x12 42462306a36Sopenharmony_ci#define HOST_BUS_FREE 0x13 42562306a36Sopenharmony_ci#define HOST_BAD_PHAS 0x14 42662306a36Sopenharmony_ci#define HOST_INV_CMD 0x16 42762306a36Sopenharmony_ci#define HOST_ABORTED 0x1A /* 07/21/98 */ 42862306a36Sopenharmony_ci#define HOST_SCSI_RST 0x1B 42962306a36Sopenharmony_ci#define HOST_DEV_RST 0x1C 43062306a36Sopenharmony_ci 43162306a36Sopenharmony_ci/* Error Codes for SCB_TaStat */ 43262306a36Sopenharmony_ci#define TARGET_CHKCOND 0x02 43362306a36Sopenharmony_ci#define TARGET_BUSY 0x08 43462306a36Sopenharmony_ci#define INI_QUEUE_FULL 0x28 43562306a36Sopenharmony_ci 43662306a36Sopenharmony_ci/*********************************************************************** 43762306a36Sopenharmony_ci Target Device Control Structure 43862306a36Sopenharmony_ci**********************************************************************/ 43962306a36Sopenharmony_ci 44062306a36Sopenharmony_cistruct target_control { 44162306a36Sopenharmony_ci u16 flags; 44262306a36Sopenharmony_ci u8 js_period; 44362306a36Sopenharmony_ci u8 sconfig0; 44462306a36Sopenharmony_ci u16 drv_flags; 44562306a36Sopenharmony_ci u8 heads; 44662306a36Sopenharmony_ci u8 sectors; 44762306a36Sopenharmony_ci}; 44862306a36Sopenharmony_ci 44962306a36Sopenharmony_ci/*********************************************************************** 45062306a36Sopenharmony_ci Target Device Control Structure 45162306a36Sopenharmony_ci**********************************************************************/ 45262306a36Sopenharmony_ci 45362306a36Sopenharmony_ci/* Bit Definition for TCF_Flags */ 45462306a36Sopenharmony_ci#define TCF_SCSI_RATE 0x0007 45562306a36Sopenharmony_ci#define TCF_EN_DISC 0x0008 45662306a36Sopenharmony_ci#define TCF_NO_SYNC_NEGO 0x0010 45762306a36Sopenharmony_ci#define TCF_NO_WDTR 0x0020 45862306a36Sopenharmony_ci#define TCF_EN_255 0x0040 45962306a36Sopenharmony_ci#define TCF_EN_START 0x0080 46062306a36Sopenharmony_ci#define TCF_WDTR_DONE 0x0100 46162306a36Sopenharmony_ci#define TCF_SYNC_DONE 0x0200 46262306a36Sopenharmony_ci#define TCF_BUSY 0x0400 46362306a36Sopenharmony_ci 46462306a36Sopenharmony_ci 46562306a36Sopenharmony_ci/* Bit Definition for TCF_DrvFlags */ 46662306a36Sopenharmony_ci#define TCF_DRV_BUSY 0x01 /* Indicate target busy(driver) */ 46762306a36Sopenharmony_ci#define TCF_DRV_EN_TAG 0x0800 46862306a36Sopenharmony_ci#define TCF_DRV_255_63 0x0400 46962306a36Sopenharmony_ci 47062306a36Sopenharmony_ci/*********************************************************************** 47162306a36Sopenharmony_ci Host Adapter Control Structure 47262306a36Sopenharmony_ci************************************************************************/ 47362306a36Sopenharmony_cistruct initio_host { 47462306a36Sopenharmony_ci u16 addr; /* 00 */ 47562306a36Sopenharmony_ci u16 bios_addr; /* 02 */ 47662306a36Sopenharmony_ci u8 irq; /* 04 */ 47762306a36Sopenharmony_ci u8 scsi_id; /* 05 */ 47862306a36Sopenharmony_ci u8 max_tar; /* 06 */ 47962306a36Sopenharmony_ci u8 num_scbs; /* 07 */ 48062306a36Sopenharmony_ci 48162306a36Sopenharmony_ci u8 flags; /* 08 */ 48262306a36Sopenharmony_ci u8 index; /* 09 */ 48362306a36Sopenharmony_ci u8 ha_id; /* 0A */ 48462306a36Sopenharmony_ci u8 config; /* 0B */ 48562306a36Sopenharmony_ci u16 idmask; /* 0C */ 48662306a36Sopenharmony_ci u8 semaph; /* 0E */ 48762306a36Sopenharmony_ci u8 phase; /* 0F */ 48862306a36Sopenharmony_ci u8 jsstatus0; /* 10 */ 48962306a36Sopenharmony_ci u8 jsint; /* 11 */ 49062306a36Sopenharmony_ci u8 jsstatus1; /* 12 */ 49162306a36Sopenharmony_ci u8 sconf1; /* 13 */ 49262306a36Sopenharmony_ci 49362306a36Sopenharmony_ci u8 msg[8]; /* 14 */ 49462306a36Sopenharmony_ci struct scsi_ctrl_blk *next_avail; /* 1C */ 49562306a36Sopenharmony_ci struct scsi_ctrl_blk *scb; /* 20 */ 49662306a36Sopenharmony_ci struct scsi_ctrl_blk *scb_end; /* 24 */ /*UNUSED*/ 49762306a36Sopenharmony_ci struct scsi_ctrl_blk *next_pending; /* 28 */ 49862306a36Sopenharmony_ci struct scsi_ctrl_blk *next_contig; /* 2C */ /*UNUSED*/ 49962306a36Sopenharmony_ci struct scsi_ctrl_blk *active; /* 30 */ 50062306a36Sopenharmony_ci struct target_control *active_tc; /* 34 */ 50162306a36Sopenharmony_ci 50262306a36Sopenharmony_ci struct scsi_ctrl_blk *first_avail; /* 38 */ 50362306a36Sopenharmony_ci struct scsi_ctrl_blk *last_avail; /* 3C */ 50462306a36Sopenharmony_ci struct scsi_ctrl_blk *first_pending; /* 40 */ 50562306a36Sopenharmony_ci struct scsi_ctrl_blk *last_pending; /* 44 */ 50662306a36Sopenharmony_ci struct scsi_ctrl_blk *first_busy; /* 48 */ 50762306a36Sopenharmony_ci struct scsi_ctrl_blk *last_busy; /* 4C */ 50862306a36Sopenharmony_ci struct scsi_ctrl_blk *first_done; /* 50 */ 50962306a36Sopenharmony_ci struct scsi_ctrl_blk *last_done; /* 54 */ 51062306a36Sopenharmony_ci u8 max_tags[16]; /* 58 */ 51162306a36Sopenharmony_ci u8 act_tags[16]; /* 68 */ 51262306a36Sopenharmony_ci struct target_control targets[MAX_TARGETS]; /* 78 */ 51362306a36Sopenharmony_ci spinlock_t avail_lock; 51462306a36Sopenharmony_ci spinlock_t semaph_lock; 51562306a36Sopenharmony_ci struct pci_dev *pci_dev; 51662306a36Sopenharmony_ci}; 51762306a36Sopenharmony_ci 51862306a36Sopenharmony_ci/* Bit Definition for HCB_Config */ 51962306a36Sopenharmony_ci#define HCC_SCSI_RESET 0x01 52062306a36Sopenharmony_ci#define HCC_EN_PAR 0x02 52162306a36Sopenharmony_ci#define HCC_ACT_TERM1 0x04 52262306a36Sopenharmony_ci#define HCC_ACT_TERM2 0x08 52362306a36Sopenharmony_ci#define HCC_AUTO_TERM 0x10 52462306a36Sopenharmony_ci#define HCC_EN_PWR 0x80 52562306a36Sopenharmony_ci 52662306a36Sopenharmony_ci/* Bit Definition for HCB_Flags */ 52762306a36Sopenharmony_ci#define HCF_EXPECT_DISC 0x01 52862306a36Sopenharmony_ci#define HCF_EXPECT_SELECT 0x02 52962306a36Sopenharmony_ci#define HCF_EXPECT_RESET 0x10 53062306a36Sopenharmony_ci#define HCF_EXPECT_DONE_DISC 0x20 53162306a36Sopenharmony_ci 53262306a36Sopenharmony_ci/****************************************************************** 53362306a36Sopenharmony_ci Serial EEProm 53462306a36Sopenharmony_ci*******************************************************************/ 53562306a36Sopenharmony_ci 53662306a36Sopenharmony_citypedef struct _NVRAM_SCSI { /* SCSI channel configuration */ 53762306a36Sopenharmony_ci u8 NVM_ChSCSIID; /* 0Ch -> Channel SCSI ID */ 53862306a36Sopenharmony_ci u8 NVM_ChConfig1; /* 0Dh -> Channel config 1 */ 53962306a36Sopenharmony_ci u8 NVM_ChConfig2; /* 0Eh -> Channel config 2 */ 54062306a36Sopenharmony_ci u8 NVM_NumOfTarg; /* 0Fh -> Number of SCSI target */ 54162306a36Sopenharmony_ci /* SCSI target configuration */ 54262306a36Sopenharmony_ci u8 NVM_Targ0Config; /* 10h -> Target 0 configuration */ 54362306a36Sopenharmony_ci u8 NVM_Targ1Config; /* 11h -> Target 1 configuration */ 54462306a36Sopenharmony_ci u8 NVM_Targ2Config; /* 12h -> Target 2 configuration */ 54562306a36Sopenharmony_ci u8 NVM_Targ3Config; /* 13h -> Target 3 configuration */ 54662306a36Sopenharmony_ci u8 NVM_Targ4Config; /* 14h -> Target 4 configuration */ 54762306a36Sopenharmony_ci u8 NVM_Targ5Config; /* 15h -> Target 5 configuration */ 54862306a36Sopenharmony_ci u8 NVM_Targ6Config; /* 16h -> Target 6 configuration */ 54962306a36Sopenharmony_ci u8 NVM_Targ7Config; /* 17h -> Target 7 configuration */ 55062306a36Sopenharmony_ci u8 NVM_Targ8Config; /* 18h -> Target 8 configuration */ 55162306a36Sopenharmony_ci u8 NVM_Targ9Config; /* 19h -> Target 9 configuration */ 55262306a36Sopenharmony_ci u8 NVM_TargAConfig; /* 1Ah -> Target A configuration */ 55362306a36Sopenharmony_ci u8 NVM_TargBConfig; /* 1Bh -> Target B configuration */ 55462306a36Sopenharmony_ci u8 NVM_TargCConfig; /* 1Ch -> Target C configuration */ 55562306a36Sopenharmony_ci u8 NVM_TargDConfig; /* 1Dh -> Target D configuration */ 55662306a36Sopenharmony_ci u8 NVM_TargEConfig; /* 1Eh -> Target E configuration */ 55762306a36Sopenharmony_ci u8 NVM_TargFConfig; /* 1Fh -> Target F configuration */ 55862306a36Sopenharmony_ci} NVRAM_SCSI; 55962306a36Sopenharmony_ci 56062306a36Sopenharmony_citypedef struct _NVRAM { 56162306a36Sopenharmony_ci/*----------header ---------------*/ 56262306a36Sopenharmony_ci u16 NVM_Signature; /* 0,1: Signature */ 56362306a36Sopenharmony_ci u8 NVM_Size; /* 2: Size of data structure */ 56462306a36Sopenharmony_ci u8 NVM_Revision; /* 3: Revision of data structure */ 56562306a36Sopenharmony_ci /* ----Host Adapter Structure ---- */ 56662306a36Sopenharmony_ci u8 NVM_ModelByte0; /* 4: Model number (byte 0) */ 56762306a36Sopenharmony_ci u8 NVM_ModelByte1; /* 5: Model number (byte 1) */ 56862306a36Sopenharmony_ci u8 NVM_ModelInfo; /* 6: Model information */ 56962306a36Sopenharmony_ci u8 NVM_NumOfCh; /* 7: Number of SCSI channel */ 57062306a36Sopenharmony_ci u8 NVM_BIOSConfig1; /* 8: BIOS configuration 1 */ 57162306a36Sopenharmony_ci u8 NVM_BIOSConfig2; /* 9: BIOS configuration 2 */ 57262306a36Sopenharmony_ci u8 NVM_HAConfig1; /* A: Hoat adapter configuration 1 */ 57362306a36Sopenharmony_ci u8 NVM_HAConfig2; /* B: Hoat adapter configuration 2 */ 57462306a36Sopenharmony_ci NVRAM_SCSI NVM_SCSIInfo[2]; 57562306a36Sopenharmony_ci u8 NVM_reserved[10]; 57662306a36Sopenharmony_ci /* ---------- CheckSum ---------- */ 57762306a36Sopenharmony_ci u16 NVM_CheckSum; /* 0x3E, 0x3F: Checksum of NVRam */ 57862306a36Sopenharmony_ci} NVRAM, *PNVRAM; 57962306a36Sopenharmony_ci 58062306a36Sopenharmony_ci/* Bios Configuration for nvram->BIOSConfig1 */ 58162306a36Sopenharmony_ci#define NBC1_ENABLE 0x01 /* BIOS enable */ 58262306a36Sopenharmony_ci#define NBC1_8DRIVE 0x02 /* Support more than 2 drives */ 58362306a36Sopenharmony_ci#define NBC1_REMOVABLE 0x04 /* Support removable drive */ 58462306a36Sopenharmony_ci#define NBC1_INT19 0x08 /* Intercept int 19h */ 58562306a36Sopenharmony_ci#define NBC1_BIOSSCAN 0x10 /* Dynamic BIOS scan */ 58662306a36Sopenharmony_ci#define NBC1_LUNSUPPORT 0x40 /* Support LUN */ 58762306a36Sopenharmony_ci 58862306a36Sopenharmony_ci/* HA Configuration Byte 1 */ 58962306a36Sopenharmony_ci#define NHC1_BOOTIDMASK 0x0F /* Boot ID number */ 59062306a36Sopenharmony_ci#define NHC1_LUNMASK 0x70 /* Boot LUN number */ 59162306a36Sopenharmony_ci#define NHC1_CHANMASK 0x80 /* Boot Channel number */ 59262306a36Sopenharmony_ci 59362306a36Sopenharmony_ci/* Bit definition for nvram->SCSIconfig1 */ 59462306a36Sopenharmony_ci#define NCC1_BUSRESET 0x01 /* Reset SCSI bus at power up */ 59562306a36Sopenharmony_ci#define NCC1_PARITYCHK 0x02 /* SCSI parity enable */ 59662306a36Sopenharmony_ci#define NCC1_ACTTERM1 0x04 /* Enable active terminator 1 */ 59762306a36Sopenharmony_ci#define NCC1_ACTTERM2 0x08 /* Enable active terminator 2 */ 59862306a36Sopenharmony_ci#define NCC1_AUTOTERM 0x10 /* Enable auto terminator */ 59962306a36Sopenharmony_ci#define NCC1_PWRMGR 0x80 /* Enable power management */ 60062306a36Sopenharmony_ci 60162306a36Sopenharmony_ci/* Bit definition for SCSI Target configuration byte */ 60262306a36Sopenharmony_ci#define NTC_DISCONNECT 0x08 /* Enable SCSI disconnect */ 60362306a36Sopenharmony_ci#define NTC_SYNC 0x10 /* SYNC_NEGO */ 60462306a36Sopenharmony_ci#define NTC_NO_WDTR 0x20 /* SYNC_NEGO */ 60562306a36Sopenharmony_ci#define NTC_1GIGA 0x40 /* 255 head / 63 sectors (64/32) */ 60662306a36Sopenharmony_ci#define NTC_SPINUP 0x80 /* Start disk drive */ 60762306a36Sopenharmony_ci 60862306a36Sopenharmony_ci/* Default NVRam values */ 60962306a36Sopenharmony_ci#define INI_SIGNATURE 0xC925 61062306a36Sopenharmony_ci#define NBC1_DEFAULT (NBC1_ENABLE) 61162306a36Sopenharmony_ci#define NCC1_DEFAULT (NCC1_BUSRESET | NCC1_AUTOTERM | NCC1_PARITYCHK) 61262306a36Sopenharmony_ci#define NTC_DEFAULT (NTC_NO_WDTR | NTC_1GIGA | NTC_DISCONNECT) 61362306a36Sopenharmony_ci 61462306a36Sopenharmony_ci/* SCSI related definition */ 61562306a36Sopenharmony_ci#define DISC_NOT_ALLOW 0x80 /* Disconnect is not allowed */ 61662306a36Sopenharmony_ci#define DISC_ALLOW 0xC0 /* Disconnect is allowed */ 61762306a36Sopenharmony_ci#define SCSICMD_RequestSense 0x03 61862306a36Sopenharmony_ci 61962306a36Sopenharmony_ci#define SCSI_ABORT_SNOOZE 0 62062306a36Sopenharmony_ci#define SCSI_ABORT_SUCCESS 1 62162306a36Sopenharmony_ci#define SCSI_ABORT_PENDING 2 62262306a36Sopenharmony_ci#define SCSI_ABORT_BUSY 3 62362306a36Sopenharmony_ci#define SCSI_ABORT_NOT_RUNNING 4 62462306a36Sopenharmony_ci#define SCSI_ABORT_ERROR 5 62562306a36Sopenharmony_ci 62662306a36Sopenharmony_ci#define SCSI_RESET_SNOOZE 0 62762306a36Sopenharmony_ci#define SCSI_RESET_PUNT 1 62862306a36Sopenharmony_ci#define SCSI_RESET_SUCCESS 2 62962306a36Sopenharmony_ci#define SCSI_RESET_PENDING 3 63062306a36Sopenharmony_ci#define SCSI_RESET_WAKEUP 4 63162306a36Sopenharmony_ci#define SCSI_RESET_NOT_RUNNING 5 63262306a36Sopenharmony_ci#define SCSI_RESET_ERROR 6 63362306a36Sopenharmony_ci 63462306a36Sopenharmony_ci#define SCSI_RESET_SYNCHRONOUS 0x01 63562306a36Sopenharmony_ci#define SCSI_RESET_ASYNCHRONOUS 0x02 63662306a36Sopenharmony_ci#define SCSI_RESET_SUGGEST_BUS_RESET 0x04 63762306a36Sopenharmony_ci#define SCSI_RESET_SUGGEST_HOST_RESET 0x08 63862306a36Sopenharmony_ci 63962306a36Sopenharmony_ci#define SCSI_RESET_BUS_RESET 0x100 64062306a36Sopenharmony_ci#define SCSI_RESET_HOST_RESET 0x200 64162306a36Sopenharmony_ci#define SCSI_RESET_ACTION 0xff 64262306a36Sopenharmony_ci 64362306a36Sopenharmony_cistruct initio_cmd_priv { 64462306a36Sopenharmony_ci dma_addr_t sense_dma_addr; 64562306a36Sopenharmony_ci dma_addr_t sglist_dma_addr; 64662306a36Sopenharmony_ci}; 64762306a36Sopenharmony_ci 64862306a36Sopenharmony_cistatic inline struct initio_cmd_priv *initio_priv(struct scsi_cmnd *cmd) 64962306a36Sopenharmony_ci{ 65062306a36Sopenharmony_ci return scsi_cmd_priv(cmd); 65162306a36Sopenharmony_ci} 652