18c2ecf20Sopenharmony_ci/************************************************************************** 28c2ecf20Sopenharmony_ci * Initio 9100 device driver for Linux. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright (c) 1994-1998 Initio Corporation 58c2ecf20Sopenharmony_ci * All rights reserved. 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Cleanups (c) Copyright 2007 Red Hat <alan@lxorguk.ukuu.org.uk> 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 108c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License as published by 118c2ecf20Sopenharmony_ci * the Free Software Foundation; either version 2, or (at your option) 128c2ecf20Sopenharmony_ci * any later version. 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, 158c2ecf20Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 168c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 178c2ecf20Sopenharmony_ci * GNU General Public License for more details. 188c2ecf20Sopenharmony_ci * 198c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License 208c2ecf20Sopenharmony_ci * along with this program; see the file COPYING. If not, write to 218c2ecf20Sopenharmony_ci * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 228c2ecf20Sopenharmony_ci * 238c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 248c2ecf20Sopenharmony_ci * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 258c2ecf20Sopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 268c2ecf20Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 278c2ecf20Sopenharmony_ci * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 288c2ecf20Sopenharmony_ci * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 298c2ecf20Sopenharmony_ci * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 308c2ecf20Sopenharmony_ci * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 318c2ecf20Sopenharmony_ci * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 328c2ecf20Sopenharmony_ci * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 338c2ecf20Sopenharmony_ci * SUCH DAMAGE. 348c2ecf20Sopenharmony_ci * 358c2ecf20Sopenharmony_ci **************************************************************************/ 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#include <linux/types.h> 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#define TOTAL_SG_ENTRY 32 418c2ecf20Sopenharmony_ci#define MAX_SUPPORTED_ADAPTERS 8 428c2ecf20Sopenharmony_ci#define MAX_OFFSET 15 438c2ecf20Sopenharmony_ci#define MAX_TARGETS 16 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_citypedef struct { 468c2ecf20Sopenharmony_ci unsigned short base; 478c2ecf20Sopenharmony_ci unsigned short vec; 488c2ecf20Sopenharmony_ci} i91u_config; 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci/***************************************/ 518c2ecf20Sopenharmony_ci/* Tulip Configuration Register Set */ 528c2ecf20Sopenharmony_ci/***************************************/ 538c2ecf20Sopenharmony_ci#define TUL_PVID 0x00 /* Vendor ID */ 548c2ecf20Sopenharmony_ci#define TUL_PDID 0x02 /* Device ID */ 558c2ecf20Sopenharmony_ci#define TUL_PCMD 0x04 /* Command */ 568c2ecf20Sopenharmony_ci#define TUL_PSTUS 0x06 /* Status */ 578c2ecf20Sopenharmony_ci#define TUL_PRID 0x08 /* Revision number */ 588c2ecf20Sopenharmony_ci#define TUL_PPI 0x09 /* Programming interface */ 598c2ecf20Sopenharmony_ci#define TUL_PSC 0x0A /* Sub Class */ 608c2ecf20Sopenharmony_ci#define TUL_PBC 0x0B /* Base Class */ 618c2ecf20Sopenharmony_ci#define TUL_PCLS 0x0C /* Cache line size */ 628c2ecf20Sopenharmony_ci#define TUL_PLTR 0x0D /* Latency timer */ 638c2ecf20Sopenharmony_ci#define TUL_PHDT 0x0E /* Header type */ 648c2ecf20Sopenharmony_ci#define TUL_PBIST 0x0F /* BIST */ 658c2ecf20Sopenharmony_ci#define TUL_PBAD 0x10 /* Base address */ 668c2ecf20Sopenharmony_ci#define TUL_PBAD1 0x14 /* Base address */ 678c2ecf20Sopenharmony_ci#define TUL_PBAD2 0x18 /* Base address */ 688c2ecf20Sopenharmony_ci#define TUL_PBAD3 0x1C /* Base address */ 698c2ecf20Sopenharmony_ci#define TUL_PBAD4 0x20 /* Base address */ 708c2ecf20Sopenharmony_ci#define TUL_PBAD5 0x24 /* Base address */ 718c2ecf20Sopenharmony_ci#define TUL_PRSVD 0x28 /* Reserved */ 728c2ecf20Sopenharmony_ci#define TUL_PRSVD1 0x2C /* Reserved */ 738c2ecf20Sopenharmony_ci#define TUL_PRAD 0x30 /* Expansion ROM base address */ 748c2ecf20Sopenharmony_ci#define TUL_PRSVD2 0x34 /* Reserved */ 758c2ecf20Sopenharmony_ci#define TUL_PRSVD3 0x38 /* Reserved */ 768c2ecf20Sopenharmony_ci#define TUL_PINTL 0x3C /* Interrupt line */ 778c2ecf20Sopenharmony_ci#define TUL_PINTP 0x3D /* Interrupt pin */ 788c2ecf20Sopenharmony_ci#define TUL_PIGNT 0x3E /* MIN_GNT */ 798c2ecf20Sopenharmony_ci#define TUL_PMGNT 0x3F /* MAX_GNT */ 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci/************************/ 828c2ecf20Sopenharmony_ci/* Jasmin Register Set */ 838c2ecf20Sopenharmony_ci/************************/ 848c2ecf20Sopenharmony_ci#define TUL_HACFG0 0x40 /* H/A Configuration Register 0 */ 858c2ecf20Sopenharmony_ci#define TUL_HACFG1 0x41 /* H/A Configuration Register 1 */ 868c2ecf20Sopenharmony_ci#define TUL_HACFG2 0x42 /* H/A Configuration Register 2 */ 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci#define TUL_SDCFG0 0x44 /* SCSI Device Configuration 0 */ 898c2ecf20Sopenharmony_ci#define TUL_SDCFG1 0x45 /* SCSI Device Configuration 1 */ 908c2ecf20Sopenharmony_ci#define TUL_SDCFG2 0x46 /* SCSI Device Configuration 2 */ 918c2ecf20Sopenharmony_ci#define TUL_SDCFG3 0x47 /* SCSI Device Configuration 3 */ 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci#define TUL_GINTS 0x50 /* Global Interrupt Status Register */ 948c2ecf20Sopenharmony_ci#define TUL_GIMSK 0x52 /* Global Interrupt MASK Register */ 958c2ecf20Sopenharmony_ci#define TUL_GCTRL 0x54 /* Global Control Register */ 968c2ecf20Sopenharmony_ci#define TUL_GCTRL_EEPROM_BIT 0x04 978c2ecf20Sopenharmony_ci#define TUL_GCTRL1 0x55 /* Global Control Register */ 988c2ecf20Sopenharmony_ci#define TUL_DMACFG 0x5B /* DMA configuration */ 998c2ecf20Sopenharmony_ci#define TUL_NVRAM 0x5D /* Non-volatile RAM port */ 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci#define TUL_SCnt0 0x80 /* 00 R/W Transfer Counter Low */ 1028c2ecf20Sopenharmony_ci#define TUL_SCnt1 0x81 /* 01 R/W Transfer Counter Mid */ 1038c2ecf20Sopenharmony_ci#define TUL_SCnt2 0x82 /* 02 R/W Transfer Count High */ 1048c2ecf20Sopenharmony_ci#define TUL_SFifoCnt 0x83 /* 03 R FIFO counter */ 1058c2ecf20Sopenharmony_ci#define TUL_SIntEnable 0x84 /* 03 W Interrupt enble */ 1068c2ecf20Sopenharmony_ci#define TUL_SInt 0x84 /* 04 R Interrupt Register */ 1078c2ecf20Sopenharmony_ci#define TUL_SCtrl0 0x85 /* 05 W Control 0 */ 1088c2ecf20Sopenharmony_ci#define TUL_SStatus0 0x85 /* 05 R Status 0 */ 1098c2ecf20Sopenharmony_ci#define TUL_SCtrl1 0x86 /* 06 W Control 1 */ 1108c2ecf20Sopenharmony_ci#define TUL_SStatus1 0x86 /* 06 R Status 1 */ 1118c2ecf20Sopenharmony_ci#define TUL_SConfig 0x87 /* 07 W Configuration */ 1128c2ecf20Sopenharmony_ci#define TUL_SStatus2 0x87 /* 07 R Status 2 */ 1138c2ecf20Sopenharmony_ci#define TUL_SPeriod 0x88 /* 08 W Sync. Transfer Period & Offset */ 1148c2ecf20Sopenharmony_ci#define TUL_SOffset 0x88 /* 08 R Offset */ 1158c2ecf20Sopenharmony_ci#define TUL_SScsiId 0x89 /* 09 W SCSI ID */ 1168c2ecf20Sopenharmony_ci#define TUL_SBusId 0x89 /* 09 R SCSI BUS ID */ 1178c2ecf20Sopenharmony_ci#define TUL_STimeOut 0x8A /* 0A W Sel/Resel Time Out Register */ 1188c2ecf20Sopenharmony_ci#define TUL_SIdent 0x8A /* 0A R Identify Message Register */ 1198c2ecf20Sopenharmony_ci#define TUL_SAvail 0x8A /* 0A R Available Counter Register */ 1208c2ecf20Sopenharmony_ci#define TUL_SData 0x8B /* 0B R/W SCSI data in/out */ 1218c2ecf20Sopenharmony_ci#define TUL_SFifo 0x8C /* 0C R/W FIFO */ 1228c2ecf20Sopenharmony_ci#define TUL_SSignal 0x90 /* 10 R/W SCSI signal in/out */ 1238c2ecf20Sopenharmony_ci#define TUL_SCmd 0x91 /* 11 R/W Command */ 1248c2ecf20Sopenharmony_ci#define TUL_STest0 0x92 /* 12 R/W Test0 */ 1258c2ecf20Sopenharmony_ci#define TUL_STest1 0x93 /* 13 R/W Test1 */ 1268c2ecf20Sopenharmony_ci#define TUL_SCFG1 0x94 /* 14 R/W Configuration */ 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci#define TUL_XAddH 0xC0 /*DMA Transfer Physical Address */ 1298c2ecf20Sopenharmony_ci#define TUL_XAddW 0xC8 /*DMA Current Transfer Physical Address */ 1308c2ecf20Sopenharmony_ci#define TUL_XCntH 0xD0 /*DMA Transfer Counter */ 1318c2ecf20Sopenharmony_ci#define TUL_XCntW 0xD4 /*DMA Current Transfer Counter */ 1328c2ecf20Sopenharmony_ci#define TUL_XCmd 0xD8 /*DMA Command Register */ 1338c2ecf20Sopenharmony_ci#define TUL_Int 0xDC /*Interrupt Register */ 1348c2ecf20Sopenharmony_ci#define TUL_XStatus 0xDD /*DMA status Register */ 1358c2ecf20Sopenharmony_ci#define TUL_Mask 0xE0 /*Interrupt Mask Register */ 1368c2ecf20Sopenharmony_ci#define TUL_XCtrl 0xE4 /*DMA Control Register */ 1378c2ecf20Sopenharmony_ci#define TUL_XCtrl1 0xE5 /*DMA Control Register 1 */ 1388c2ecf20Sopenharmony_ci#define TUL_XFifo 0xE8 /*DMA FIFO */ 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ci#define TUL_WCtrl 0xF7 /*Bus master wait state control */ 1418c2ecf20Sopenharmony_ci#define TUL_DCtrl 0xFB /*DMA delay control */ 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 1448c2ecf20Sopenharmony_ci/* bit definition for Command register of Configuration Space Header */ 1458c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 1468c2ecf20Sopenharmony_ci#define BUSMS 0x04 /* BUS MASTER Enable */ 1478c2ecf20Sopenharmony_ci#define IOSPA 0x01 /* IO Space Enable */ 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 1508c2ecf20Sopenharmony_ci/* Command Codes of Tulip SCSI Command register */ 1518c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 1528c2ecf20Sopenharmony_ci#define TSC_EN_RESEL 0x80 /* Enable Reselection */ 1538c2ecf20Sopenharmony_ci#define TSC_CMD_COMP 0x84 /* Command Complete Sequence */ 1548c2ecf20Sopenharmony_ci#define TSC_SEL 0x01 /* Select Without ATN Sequence */ 1558c2ecf20Sopenharmony_ci#define TSC_SEL_ATN 0x11 /* Select With ATN Sequence */ 1568c2ecf20Sopenharmony_ci#define TSC_SEL_ATN_DMA 0x51 /* Select With ATN Sequence with DMA */ 1578c2ecf20Sopenharmony_ci#define TSC_SEL_ATN3 0x31 /* Select With ATN3 Sequence */ 1588c2ecf20Sopenharmony_ci#define TSC_SEL_ATNSTOP 0x12 /* Select With ATN and Stop Sequence */ 1598c2ecf20Sopenharmony_ci#define TSC_SELATNSTOP 0x1E /* Select With ATN and Stop Sequence */ 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci#define TSC_SEL_ATN_DIRECT_IN 0x95 /* Select With ATN Sequence */ 1628c2ecf20Sopenharmony_ci#define TSC_SEL_ATN_DIRECT_OUT 0x15 /* Select With ATN Sequence */ 1638c2ecf20Sopenharmony_ci#define TSC_SEL_ATN3_DIRECT_IN 0xB5 /* Select With ATN3 Sequence */ 1648c2ecf20Sopenharmony_ci#define TSC_SEL_ATN3_DIRECT_OUT 0x35 /* Select With ATN3 Sequence */ 1658c2ecf20Sopenharmony_ci#define TSC_XF_DMA_OUT_DIRECT 0x06 /* DMA Xfer Information out */ 1668c2ecf20Sopenharmony_ci#define TSC_XF_DMA_IN_DIRECT 0x86 /* DMA Xfer Information in */ 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_ci#define TSC_XF_DMA_OUT 0x43 /* DMA Xfer Information out */ 1698c2ecf20Sopenharmony_ci#define TSC_XF_DMA_IN 0xC3 /* DMA Xfer Information in */ 1708c2ecf20Sopenharmony_ci#define TSC_XF_FIFO_OUT 0x03 /* FIFO Xfer Information out */ 1718c2ecf20Sopenharmony_ci#define TSC_XF_FIFO_IN 0x83 /* FIFO Xfer Information in */ 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_ci#define TSC_MSG_ACCEPT 0x0F /* Message Accept */ 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 1768c2ecf20Sopenharmony_ci/* bit definition for Tulip SCSI Control 0 Register */ 1778c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 1788c2ecf20Sopenharmony_ci#define TSC_RST_SEQ 0x20 /* Reset sequence counter */ 1798c2ecf20Sopenharmony_ci#define TSC_FLUSH_FIFO 0x10 /* Flush FIFO */ 1808c2ecf20Sopenharmony_ci#define TSC_ABT_CMD 0x04 /* Abort command (sequence) */ 1818c2ecf20Sopenharmony_ci#define TSC_RST_CHIP 0x02 /* Reset SCSI Chip */ 1828c2ecf20Sopenharmony_ci#define TSC_RST_BUS 0x01 /* Reset SCSI Bus */ 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 1858c2ecf20Sopenharmony_ci/* bit definition for Tulip SCSI Control 1 Register */ 1868c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 1878c2ecf20Sopenharmony_ci#define TSC_EN_SCAM 0x80 /* Enable SCAM */ 1888c2ecf20Sopenharmony_ci#define TSC_TIMER 0x40 /* Select timeout unit */ 1898c2ecf20Sopenharmony_ci#define TSC_EN_SCSI2 0x20 /* SCSI-2 mode */ 1908c2ecf20Sopenharmony_ci#define TSC_PWDN 0x10 /* Power down mode */ 1918c2ecf20Sopenharmony_ci#define TSC_WIDE_CPU 0x08 /* Wide CPU */ 1928c2ecf20Sopenharmony_ci#define TSC_HW_RESELECT 0x04 /* Enable HW reselect */ 1938c2ecf20Sopenharmony_ci#define TSC_EN_BUS_OUT 0x02 /* Enable SCSI data bus out latch */ 1948c2ecf20Sopenharmony_ci#define TSC_EN_BUS_IN 0x01 /* Enable SCSI data bus in latch */ 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 1978c2ecf20Sopenharmony_ci/* bit definition for Tulip SCSI Configuration Register */ 1988c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 1998c2ecf20Sopenharmony_ci#define TSC_EN_LATCH 0x80 /* Enable phase latch */ 2008c2ecf20Sopenharmony_ci#define TSC_INITIATOR 0x40 /* Initiator mode */ 2018c2ecf20Sopenharmony_ci#define TSC_EN_SCSI_PAR 0x20 /* Enable SCSI parity */ 2028c2ecf20Sopenharmony_ci#define TSC_DMA_8BIT 0x10 /* Alternate dma 8-bits mode */ 2038c2ecf20Sopenharmony_ci#define TSC_DMA_16BIT 0x08 /* Alternate dma 16-bits mode */ 2048c2ecf20Sopenharmony_ci#define TSC_EN_WDACK 0x04 /* Enable DACK while wide SCSI xfer */ 2058c2ecf20Sopenharmony_ci#define TSC_ALT_PERIOD 0x02 /* Alternate sync period mode */ 2068c2ecf20Sopenharmony_ci#define TSC_DIS_SCSIRST 0x01 /* Disable SCSI bus reset us */ 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_ci#define TSC_INITDEFAULT (TSC_INITIATOR | TSC_EN_LATCH | TSC_ALT_PERIOD | TSC_DIS_SCSIRST) 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci#define TSC_WIDE_SCSI 0x80 /* Enable Wide SCSI */ 2118c2ecf20Sopenharmony_ci 2128c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 2138c2ecf20Sopenharmony_ci/* bit definition for Tulip SCSI signal Register */ 2148c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 2158c2ecf20Sopenharmony_ci#define TSC_RST_ACK 0x00 /* Release ACK signal */ 2168c2ecf20Sopenharmony_ci#define TSC_RST_ATN 0x00 /* Release ATN signal */ 2178c2ecf20Sopenharmony_ci#define TSC_RST_BSY 0x00 /* Release BSY signal */ 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci#define TSC_SET_ACK 0x40 /* ACK signal */ 2208c2ecf20Sopenharmony_ci#define TSC_SET_ATN 0x08 /* ATN signal */ 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci#define TSC_REQI 0x80 /* REQ signal */ 2238c2ecf20Sopenharmony_ci#define TSC_ACKI 0x40 /* ACK signal */ 2248c2ecf20Sopenharmony_ci#define TSC_BSYI 0x20 /* BSY signal */ 2258c2ecf20Sopenharmony_ci#define TSC_SELI 0x10 /* SEL signal */ 2268c2ecf20Sopenharmony_ci#define TSC_ATNI 0x08 /* ATN signal */ 2278c2ecf20Sopenharmony_ci#define TSC_MSGI 0x04 /* MSG signal */ 2288c2ecf20Sopenharmony_ci#define TSC_CDI 0x02 /* C/D signal */ 2298c2ecf20Sopenharmony_ci#define TSC_IOI 0x01 /* I/O signal */ 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 2338c2ecf20Sopenharmony_ci/* bit definition for Tulip SCSI Status 0 Register */ 2348c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 2358c2ecf20Sopenharmony_ci#define TSS_INT_PENDING 0x80 /* Interrupt pending */ 2368c2ecf20Sopenharmony_ci#define TSS_SEQ_ACTIVE 0x40 /* Sequencer active */ 2378c2ecf20Sopenharmony_ci#define TSS_XFER_CNT 0x20 /* Transfer counter zero */ 2388c2ecf20Sopenharmony_ci#define TSS_FIFO_EMPTY 0x10 /* FIFO empty */ 2398c2ecf20Sopenharmony_ci#define TSS_PAR_ERROR 0x08 /* SCSI parity error */ 2408c2ecf20Sopenharmony_ci#define TSS_PH_MASK 0x07 /* SCSI phase mask */ 2418c2ecf20Sopenharmony_ci 2428c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 2438c2ecf20Sopenharmony_ci/* bit definition for Tulip SCSI Status 1 Register */ 2448c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 2458c2ecf20Sopenharmony_ci#define TSS_STATUS_RCV 0x08 /* Status received */ 2468c2ecf20Sopenharmony_ci#define TSS_MSG_SEND 0x40 /* Message sent */ 2478c2ecf20Sopenharmony_ci#define TSS_CMD_PH_CMP 0x20 /* command phase done */ 2488c2ecf20Sopenharmony_ci#define TSS_DATA_PH_CMP 0x10 /* Data phase done */ 2498c2ecf20Sopenharmony_ci#define TSS_STATUS_SEND 0x08 /* Status sent */ 2508c2ecf20Sopenharmony_ci#define TSS_XFER_CMP 0x04 /* Transfer completed */ 2518c2ecf20Sopenharmony_ci#define TSS_SEL_CMP 0x02 /* Selection completed */ 2528c2ecf20Sopenharmony_ci#define TSS_ARB_CMP 0x01 /* Arbitration completed */ 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 2558c2ecf20Sopenharmony_ci/* bit definition for Tulip SCSI Status 2 Register */ 2568c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 2578c2ecf20Sopenharmony_ci#define TSS_CMD_ABTED 0x80 /* Command aborted */ 2588c2ecf20Sopenharmony_ci#define TSS_OFFSET_0 0x40 /* Offset counter zero */ 2598c2ecf20Sopenharmony_ci#define TSS_FIFO_FULL 0x20 /* FIFO full */ 2608c2ecf20Sopenharmony_ci#define TSS_TIMEOUT_0 0x10 /* Timeout counter zero */ 2618c2ecf20Sopenharmony_ci#define TSS_BUSY_RLS 0x08 /* Busy release */ 2628c2ecf20Sopenharmony_ci#define TSS_PH_MISMATCH 0x04 /* Phase mismatch */ 2638c2ecf20Sopenharmony_ci#define TSS_SCSI_BUS_EN 0x02 /* SCSI data bus enable */ 2648c2ecf20Sopenharmony_ci#define TSS_SCSIRST 0x01 /* SCSI bus reset in progress */ 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 2678c2ecf20Sopenharmony_ci/* bit definition for Tulip SCSI Interrupt Register */ 2688c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 2698c2ecf20Sopenharmony_ci#define TSS_RESEL_INT 0x80 /* Reselected interrupt */ 2708c2ecf20Sopenharmony_ci#define TSS_SEL_TIMEOUT 0x40 /* Selected/reselected timeout */ 2718c2ecf20Sopenharmony_ci#define TSS_BUS_SERV 0x20 2728c2ecf20Sopenharmony_ci#define TSS_SCSIRST_INT 0x10 /* SCSI bus reset detected */ 2738c2ecf20Sopenharmony_ci#define TSS_DISC_INT 0x08 /* Disconnected interrupt */ 2748c2ecf20Sopenharmony_ci#define TSS_SEL_INT 0x04 /* Select interrupt */ 2758c2ecf20Sopenharmony_ci#define TSS_SCAM_SEL 0x02 /* SCAM selected */ 2768c2ecf20Sopenharmony_ci#define TSS_FUNC_COMP 0x01 2778c2ecf20Sopenharmony_ci 2788c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 2798c2ecf20Sopenharmony_ci/* SCSI Phase Codes. */ 2808c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 2818c2ecf20Sopenharmony_ci#define DATA_OUT 0 2828c2ecf20Sopenharmony_ci#define DATA_IN 1 /* 4 */ 2838c2ecf20Sopenharmony_ci#define CMD_OUT 2 2848c2ecf20Sopenharmony_ci#define STATUS_IN 3 /* 6 */ 2858c2ecf20Sopenharmony_ci#define MSG_OUT 6 /* 3 */ 2868c2ecf20Sopenharmony_ci#define MSG_IN 7 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 2918c2ecf20Sopenharmony_ci/* Command Codes of Tulip xfer Command register */ 2928c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 2938c2ecf20Sopenharmony_ci#define TAX_X_FORC 0x02 2948c2ecf20Sopenharmony_ci#define TAX_X_ABT 0x04 2958c2ecf20Sopenharmony_ci#define TAX_X_CLR_FIFO 0x08 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_ci#define TAX_X_IN 0x21 2988c2ecf20Sopenharmony_ci#define TAX_X_OUT 0x01 2998c2ecf20Sopenharmony_ci#define TAX_SG_IN 0xA1 3008c2ecf20Sopenharmony_ci#define TAX_SG_OUT 0x81 3018c2ecf20Sopenharmony_ci 3028c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 3038c2ecf20Sopenharmony_ci/* Tulip Interrupt Register */ 3048c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 3058c2ecf20Sopenharmony_ci#define XCMP 0x01 3068c2ecf20Sopenharmony_ci#define FCMP 0x02 3078c2ecf20Sopenharmony_ci#define XABT 0x04 3088c2ecf20Sopenharmony_ci#define XERR 0x08 3098c2ecf20Sopenharmony_ci#define SCMP 0x10 3108c2ecf20Sopenharmony_ci#define IPEND 0x80 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 3138c2ecf20Sopenharmony_ci/* Tulip DMA Status Register */ 3148c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 3158c2ecf20Sopenharmony_ci#define XPEND 0x01 /* Transfer pending */ 3168c2ecf20Sopenharmony_ci#define FEMPTY 0x02 /* FIFO empty */ 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_ci 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 3218c2ecf20Sopenharmony_ci/* bit definition for TUL_GCTRL */ 3228c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 3238c2ecf20Sopenharmony_ci#define EXTSG 0x80 3248c2ecf20Sopenharmony_ci#define EXTAD 0x60 3258c2ecf20Sopenharmony_ci#define SEG4K 0x08 3268c2ecf20Sopenharmony_ci#define EEPRG 0x04 3278c2ecf20Sopenharmony_ci#define MRMUL 0x02 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 3308c2ecf20Sopenharmony_ci/* bit definition for TUL_NVRAM */ 3318c2ecf20Sopenharmony_ci/*----------------------------------------------------------------------*/ 3328c2ecf20Sopenharmony_ci#define SE2CS 0x08 3338c2ecf20Sopenharmony_ci#define SE2CLK 0x04 3348c2ecf20Sopenharmony_ci#define SE2DO 0x02 3358c2ecf20Sopenharmony_ci#define SE2DI 0x01 3368c2ecf20Sopenharmony_ci 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_ci/************************************************************************/ 3398c2ecf20Sopenharmony_ci/* Scatter-Gather Element Structure */ 3408c2ecf20Sopenharmony_ci/************************************************************************/ 3418c2ecf20Sopenharmony_cistruct sg_entry { 3428c2ecf20Sopenharmony_ci u32 data; /* Data Pointer */ 3438c2ecf20Sopenharmony_ci u32 len; /* Data Length */ 3448c2ecf20Sopenharmony_ci}; 3458c2ecf20Sopenharmony_ci 3468c2ecf20Sopenharmony_ci/*********************************************************************** 3478c2ecf20Sopenharmony_ci SCSI Control Block 3488c2ecf20Sopenharmony_ci************************************************************************/ 3498c2ecf20Sopenharmony_cistruct scsi_ctrl_blk { 3508c2ecf20Sopenharmony_ci struct scsi_ctrl_blk *next; 3518c2ecf20Sopenharmony_ci u8 status; /*4 */ 3528c2ecf20Sopenharmony_ci u8 next_state; /*5 */ 3538c2ecf20Sopenharmony_ci u8 mode; /*6 */ 3548c2ecf20Sopenharmony_ci u8 msgin; /*7 SCB_Res0 */ 3558c2ecf20Sopenharmony_ci u16 sgidx; /*8 */ 3568c2ecf20Sopenharmony_ci u16 sgmax; /*A */ 3578c2ecf20Sopenharmony_ci#ifdef ALPHA 3588c2ecf20Sopenharmony_ci u32 reserved[2]; /*C */ 3598c2ecf20Sopenharmony_ci#else 3608c2ecf20Sopenharmony_ci u32 reserved[3]; /*C */ 3618c2ecf20Sopenharmony_ci#endif 3628c2ecf20Sopenharmony_ci 3638c2ecf20Sopenharmony_ci u32 xferlen; /*18 Current xfer len */ 3648c2ecf20Sopenharmony_ci u32 totxlen; /*1C Total xfer len */ 3658c2ecf20Sopenharmony_ci u32 paddr; /*20 SCB phy. Addr. */ 3668c2ecf20Sopenharmony_ci 3678c2ecf20Sopenharmony_ci u8 opcode; /*24 SCB command code */ 3688c2ecf20Sopenharmony_ci u8 flags; /*25 SCB Flags */ 3698c2ecf20Sopenharmony_ci u8 target; /*26 Target Id */ 3708c2ecf20Sopenharmony_ci u8 lun; /*27 Lun */ 3718c2ecf20Sopenharmony_ci u32 bufptr; /*28 Data Buffer Pointer */ 3728c2ecf20Sopenharmony_ci u32 buflen; /*2C Data Allocation Length */ 3738c2ecf20Sopenharmony_ci u8 sglen; /*30 SG list # */ 3748c2ecf20Sopenharmony_ci u8 senselen; /*31 Sense Allocation Length */ 3758c2ecf20Sopenharmony_ci u8 hastat; /*32 */ 3768c2ecf20Sopenharmony_ci u8 tastat; /*33 */ 3778c2ecf20Sopenharmony_ci u8 cdblen; /*34 CDB Length */ 3788c2ecf20Sopenharmony_ci u8 ident; /*35 Identify */ 3798c2ecf20Sopenharmony_ci u8 tagmsg; /*36 Tag Message */ 3808c2ecf20Sopenharmony_ci u8 tagid; /*37 Queue Tag */ 3818c2ecf20Sopenharmony_ci u8 cdb[12]; /*38 */ 3828c2ecf20Sopenharmony_ci u32 sgpaddr; /*44 SG List/Sense Buf phy. Addr. */ 3838c2ecf20Sopenharmony_ci u32 senseptr; /*48 Sense data pointer */ 3848c2ecf20Sopenharmony_ci void (*post) (u8 *, u8 *); /*4C POST routine */ 3858c2ecf20Sopenharmony_ci struct scsi_cmnd *srb; /*50 SRB Pointer */ 3868c2ecf20Sopenharmony_ci struct sg_entry sglist[TOTAL_SG_ENTRY]; /*54 Start of SG list */ 3878c2ecf20Sopenharmony_ci}; 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_ci/* Bit Definition for status */ 3908c2ecf20Sopenharmony_ci#define SCB_RENT 0x01 3918c2ecf20Sopenharmony_ci#define SCB_PEND 0x02 3928c2ecf20Sopenharmony_ci#define SCB_CONTIG 0x04 /* Contingent Allegiance */ 3938c2ecf20Sopenharmony_ci#define SCB_SELECT 0x08 3948c2ecf20Sopenharmony_ci#define SCB_BUSY 0x10 3958c2ecf20Sopenharmony_ci#define SCB_DONE 0x20 3968c2ecf20Sopenharmony_ci 3978c2ecf20Sopenharmony_ci 3988c2ecf20Sopenharmony_ci/* Opcodes for opcode */ 3998c2ecf20Sopenharmony_ci#define ExecSCSI 0x1 4008c2ecf20Sopenharmony_ci#define BusDevRst 0x2 4018c2ecf20Sopenharmony_ci#define AbortCmd 0x3 4028c2ecf20Sopenharmony_ci 4038c2ecf20Sopenharmony_ci 4048c2ecf20Sopenharmony_ci/* Bit Definition for mode */ 4058c2ecf20Sopenharmony_ci#define SCM_RSENS 0x01 /* request sense mode */ 4068c2ecf20Sopenharmony_ci 4078c2ecf20Sopenharmony_ci 4088c2ecf20Sopenharmony_ci/* Bit Definition for flags */ 4098c2ecf20Sopenharmony_ci#define SCF_DONE 0x01 4108c2ecf20Sopenharmony_ci#define SCF_POST 0x02 4118c2ecf20Sopenharmony_ci#define SCF_SENSE 0x04 4128c2ecf20Sopenharmony_ci#define SCF_DIR 0x18 4138c2ecf20Sopenharmony_ci#define SCF_NO_DCHK 0x00 4148c2ecf20Sopenharmony_ci#define SCF_DIN 0x08 4158c2ecf20Sopenharmony_ci#define SCF_DOUT 0x10 4168c2ecf20Sopenharmony_ci#define SCF_NO_XF 0x18 4178c2ecf20Sopenharmony_ci#define SCF_WR_VF 0x20 /* Write verify turn on */ 4188c2ecf20Sopenharmony_ci#define SCF_POLL 0x40 4198c2ecf20Sopenharmony_ci#define SCF_SG 0x80 4208c2ecf20Sopenharmony_ci 4218c2ecf20Sopenharmony_ci/* Error Codes for SCB_HaStat */ 4228c2ecf20Sopenharmony_ci#define HOST_SEL_TOUT 0x11 4238c2ecf20Sopenharmony_ci#define HOST_DO_DU 0x12 4248c2ecf20Sopenharmony_ci#define HOST_BUS_FREE 0x13 4258c2ecf20Sopenharmony_ci#define HOST_BAD_PHAS 0x14 4268c2ecf20Sopenharmony_ci#define HOST_INV_CMD 0x16 4278c2ecf20Sopenharmony_ci#define HOST_ABORTED 0x1A /* 07/21/98 */ 4288c2ecf20Sopenharmony_ci#define HOST_SCSI_RST 0x1B 4298c2ecf20Sopenharmony_ci#define HOST_DEV_RST 0x1C 4308c2ecf20Sopenharmony_ci 4318c2ecf20Sopenharmony_ci/* Error Codes for SCB_TaStat */ 4328c2ecf20Sopenharmony_ci#define TARGET_CHKCOND 0x02 4338c2ecf20Sopenharmony_ci#define TARGET_BUSY 0x08 4348c2ecf20Sopenharmony_ci#define INI_QUEUE_FULL 0x28 4358c2ecf20Sopenharmony_ci 4368c2ecf20Sopenharmony_ci/* SCSI MESSAGE */ 4378c2ecf20Sopenharmony_ci#define MSG_COMP 0x00 4388c2ecf20Sopenharmony_ci#define MSG_EXTEND 0x01 4398c2ecf20Sopenharmony_ci#define MSG_SDP 0x02 4408c2ecf20Sopenharmony_ci#define MSG_RESTORE 0x03 4418c2ecf20Sopenharmony_ci#define MSG_DISC 0x04 4428c2ecf20Sopenharmony_ci#define MSG_IDE 0x05 4438c2ecf20Sopenharmony_ci#define MSG_ABORT 0x06 4448c2ecf20Sopenharmony_ci#define MSG_REJ 0x07 4458c2ecf20Sopenharmony_ci#define MSG_NOP 0x08 4468c2ecf20Sopenharmony_ci#define MSG_PARITY 0x09 4478c2ecf20Sopenharmony_ci#define MSG_LINK_COMP 0x0A 4488c2ecf20Sopenharmony_ci#define MSG_LINK_FLAG 0x0B 4498c2ecf20Sopenharmony_ci#define MSG_DEVRST 0x0C 4508c2ecf20Sopenharmony_ci#define MSG_ABORT_TAG 0x0D 4518c2ecf20Sopenharmony_ci 4528c2ecf20Sopenharmony_ci/* Queue tag msg: Simple_quque_tag, Head_of_queue_tag, Ordered_queue_tag */ 4538c2ecf20Sopenharmony_ci#define MSG_STAG 0x20 4548c2ecf20Sopenharmony_ci#define MSG_HTAG 0x21 4558c2ecf20Sopenharmony_ci#define MSG_OTAG 0x22 4568c2ecf20Sopenharmony_ci 4578c2ecf20Sopenharmony_ci#define MSG_IGNOREWIDE 0x23 4588c2ecf20Sopenharmony_ci 4598c2ecf20Sopenharmony_ci#define MSG_IDENT 0x80 4608c2ecf20Sopenharmony_ci 4618c2ecf20Sopenharmony_ci/*********************************************************************** 4628c2ecf20Sopenharmony_ci Target Device Control Structure 4638c2ecf20Sopenharmony_ci**********************************************************************/ 4648c2ecf20Sopenharmony_ci 4658c2ecf20Sopenharmony_cistruct target_control { 4668c2ecf20Sopenharmony_ci u16 flags; 4678c2ecf20Sopenharmony_ci u8 js_period; 4688c2ecf20Sopenharmony_ci u8 sconfig0; 4698c2ecf20Sopenharmony_ci u16 drv_flags; 4708c2ecf20Sopenharmony_ci u8 heads; 4718c2ecf20Sopenharmony_ci u8 sectors; 4728c2ecf20Sopenharmony_ci}; 4738c2ecf20Sopenharmony_ci 4748c2ecf20Sopenharmony_ci/*********************************************************************** 4758c2ecf20Sopenharmony_ci Target Device Control Structure 4768c2ecf20Sopenharmony_ci**********************************************************************/ 4778c2ecf20Sopenharmony_ci 4788c2ecf20Sopenharmony_ci/* Bit Definition for TCF_Flags */ 4798c2ecf20Sopenharmony_ci#define TCF_SCSI_RATE 0x0007 4808c2ecf20Sopenharmony_ci#define TCF_EN_DISC 0x0008 4818c2ecf20Sopenharmony_ci#define TCF_NO_SYNC_NEGO 0x0010 4828c2ecf20Sopenharmony_ci#define TCF_NO_WDTR 0x0020 4838c2ecf20Sopenharmony_ci#define TCF_EN_255 0x0040 4848c2ecf20Sopenharmony_ci#define TCF_EN_START 0x0080 4858c2ecf20Sopenharmony_ci#define TCF_WDTR_DONE 0x0100 4868c2ecf20Sopenharmony_ci#define TCF_SYNC_DONE 0x0200 4878c2ecf20Sopenharmony_ci#define TCF_BUSY 0x0400 4888c2ecf20Sopenharmony_ci 4898c2ecf20Sopenharmony_ci 4908c2ecf20Sopenharmony_ci/* Bit Definition for TCF_DrvFlags */ 4918c2ecf20Sopenharmony_ci#define TCF_DRV_BUSY 0x01 /* Indicate target busy(driver) */ 4928c2ecf20Sopenharmony_ci#define TCF_DRV_EN_TAG 0x0800 4938c2ecf20Sopenharmony_ci#define TCF_DRV_255_63 0x0400 4948c2ecf20Sopenharmony_ci 4958c2ecf20Sopenharmony_ci/*********************************************************************** 4968c2ecf20Sopenharmony_ci Host Adapter Control Structure 4978c2ecf20Sopenharmony_ci************************************************************************/ 4988c2ecf20Sopenharmony_cistruct initio_host { 4998c2ecf20Sopenharmony_ci u16 addr; /* 00 */ 5008c2ecf20Sopenharmony_ci u16 bios_addr; /* 02 */ 5018c2ecf20Sopenharmony_ci u8 irq; /* 04 */ 5028c2ecf20Sopenharmony_ci u8 scsi_id; /* 05 */ 5038c2ecf20Sopenharmony_ci u8 max_tar; /* 06 */ 5048c2ecf20Sopenharmony_ci u8 num_scbs; /* 07 */ 5058c2ecf20Sopenharmony_ci 5068c2ecf20Sopenharmony_ci u8 flags; /* 08 */ 5078c2ecf20Sopenharmony_ci u8 index; /* 09 */ 5088c2ecf20Sopenharmony_ci u8 ha_id; /* 0A */ 5098c2ecf20Sopenharmony_ci u8 config; /* 0B */ 5108c2ecf20Sopenharmony_ci u16 idmask; /* 0C */ 5118c2ecf20Sopenharmony_ci u8 semaph; /* 0E */ 5128c2ecf20Sopenharmony_ci u8 phase; /* 0F */ 5138c2ecf20Sopenharmony_ci u8 jsstatus0; /* 10 */ 5148c2ecf20Sopenharmony_ci u8 jsint; /* 11 */ 5158c2ecf20Sopenharmony_ci u8 jsstatus1; /* 12 */ 5168c2ecf20Sopenharmony_ci u8 sconf1; /* 13 */ 5178c2ecf20Sopenharmony_ci 5188c2ecf20Sopenharmony_ci u8 msg[8]; /* 14 */ 5198c2ecf20Sopenharmony_ci struct scsi_ctrl_blk *next_avail; /* 1C */ 5208c2ecf20Sopenharmony_ci struct scsi_ctrl_blk *scb; /* 20 */ 5218c2ecf20Sopenharmony_ci struct scsi_ctrl_blk *scb_end; /* 24 */ /*UNUSED*/ 5228c2ecf20Sopenharmony_ci struct scsi_ctrl_blk *next_pending; /* 28 */ 5238c2ecf20Sopenharmony_ci struct scsi_ctrl_blk *next_contig; /* 2C */ /*UNUSED*/ 5248c2ecf20Sopenharmony_ci struct scsi_ctrl_blk *active; /* 30 */ 5258c2ecf20Sopenharmony_ci struct target_control *active_tc; /* 34 */ 5268c2ecf20Sopenharmony_ci 5278c2ecf20Sopenharmony_ci struct scsi_ctrl_blk *first_avail; /* 38 */ 5288c2ecf20Sopenharmony_ci struct scsi_ctrl_blk *last_avail; /* 3C */ 5298c2ecf20Sopenharmony_ci struct scsi_ctrl_blk *first_pending; /* 40 */ 5308c2ecf20Sopenharmony_ci struct scsi_ctrl_blk *last_pending; /* 44 */ 5318c2ecf20Sopenharmony_ci struct scsi_ctrl_blk *first_busy; /* 48 */ 5328c2ecf20Sopenharmony_ci struct scsi_ctrl_blk *last_busy; /* 4C */ 5338c2ecf20Sopenharmony_ci struct scsi_ctrl_blk *first_done; /* 50 */ 5348c2ecf20Sopenharmony_ci struct scsi_ctrl_blk *last_done; /* 54 */ 5358c2ecf20Sopenharmony_ci u8 max_tags[16]; /* 58 */ 5368c2ecf20Sopenharmony_ci u8 act_tags[16]; /* 68 */ 5378c2ecf20Sopenharmony_ci struct target_control targets[MAX_TARGETS]; /* 78 */ 5388c2ecf20Sopenharmony_ci spinlock_t avail_lock; 5398c2ecf20Sopenharmony_ci spinlock_t semaph_lock; 5408c2ecf20Sopenharmony_ci struct pci_dev *pci_dev; 5418c2ecf20Sopenharmony_ci}; 5428c2ecf20Sopenharmony_ci 5438c2ecf20Sopenharmony_ci/* Bit Definition for HCB_Config */ 5448c2ecf20Sopenharmony_ci#define HCC_SCSI_RESET 0x01 5458c2ecf20Sopenharmony_ci#define HCC_EN_PAR 0x02 5468c2ecf20Sopenharmony_ci#define HCC_ACT_TERM1 0x04 5478c2ecf20Sopenharmony_ci#define HCC_ACT_TERM2 0x08 5488c2ecf20Sopenharmony_ci#define HCC_AUTO_TERM 0x10 5498c2ecf20Sopenharmony_ci#define HCC_EN_PWR 0x80 5508c2ecf20Sopenharmony_ci 5518c2ecf20Sopenharmony_ci/* Bit Definition for HCB_Flags */ 5528c2ecf20Sopenharmony_ci#define HCF_EXPECT_DISC 0x01 5538c2ecf20Sopenharmony_ci#define HCF_EXPECT_SELECT 0x02 5548c2ecf20Sopenharmony_ci#define HCF_EXPECT_RESET 0x10 5558c2ecf20Sopenharmony_ci#define HCF_EXPECT_DONE_DISC 0x20 5568c2ecf20Sopenharmony_ci 5578c2ecf20Sopenharmony_ci/****************************************************************** 5588c2ecf20Sopenharmony_ci Serial EEProm 5598c2ecf20Sopenharmony_ci*******************************************************************/ 5608c2ecf20Sopenharmony_ci 5618c2ecf20Sopenharmony_citypedef struct _NVRAM_SCSI { /* SCSI channel configuration */ 5628c2ecf20Sopenharmony_ci u8 NVM_ChSCSIID; /* 0Ch -> Channel SCSI ID */ 5638c2ecf20Sopenharmony_ci u8 NVM_ChConfig1; /* 0Dh -> Channel config 1 */ 5648c2ecf20Sopenharmony_ci u8 NVM_ChConfig2; /* 0Eh -> Channel config 2 */ 5658c2ecf20Sopenharmony_ci u8 NVM_NumOfTarg; /* 0Fh -> Number of SCSI target */ 5668c2ecf20Sopenharmony_ci /* SCSI target configuration */ 5678c2ecf20Sopenharmony_ci u8 NVM_Targ0Config; /* 10h -> Target 0 configuration */ 5688c2ecf20Sopenharmony_ci u8 NVM_Targ1Config; /* 11h -> Target 1 configuration */ 5698c2ecf20Sopenharmony_ci u8 NVM_Targ2Config; /* 12h -> Target 2 configuration */ 5708c2ecf20Sopenharmony_ci u8 NVM_Targ3Config; /* 13h -> Target 3 configuration */ 5718c2ecf20Sopenharmony_ci u8 NVM_Targ4Config; /* 14h -> Target 4 configuration */ 5728c2ecf20Sopenharmony_ci u8 NVM_Targ5Config; /* 15h -> Target 5 configuration */ 5738c2ecf20Sopenharmony_ci u8 NVM_Targ6Config; /* 16h -> Target 6 configuration */ 5748c2ecf20Sopenharmony_ci u8 NVM_Targ7Config; /* 17h -> Target 7 configuration */ 5758c2ecf20Sopenharmony_ci u8 NVM_Targ8Config; /* 18h -> Target 8 configuration */ 5768c2ecf20Sopenharmony_ci u8 NVM_Targ9Config; /* 19h -> Target 9 configuration */ 5778c2ecf20Sopenharmony_ci u8 NVM_TargAConfig; /* 1Ah -> Target A configuration */ 5788c2ecf20Sopenharmony_ci u8 NVM_TargBConfig; /* 1Bh -> Target B configuration */ 5798c2ecf20Sopenharmony_ci u8 NVM_TargCConfig; /* 1Ch -> Target C configuration */ 5808c2ecf20Sopenharmony_ci u8 NVM_TargDConfig; /* 1Dh -> Target D configuration */ 5818c2ecf20Sopenharmony_ci u8 NVM_TargEConfig; /* 1Eh -> Target E configuration */ 5828c2ecf20Sopenharmony_ci u8 NVM_TargFConfig; /* 1Fh -> Target F configuration */ 5838c2ecf20Sopenharmony_ci} NVRAM_SCSI; 5848c2ecf20Sopenharmony_ci 5858c2ecf20Sopenharmony_citypedef struct _NVRAM { 5868c2ecf20Sopenharmony_ci/*----------header ---------------*/ 5878c2ecf20Sopenharmony_ci u16 NVM_Signature; /* 0,1: Signature */ 5888c2ecf20Sopenharmony_ci u8 NVM_Size; /* 2: Size of data structure */ 5898c2ecf20Sopenharmony_ci u8 NVM_Revision; /* 3: Revision of data structure */ 5908c2ecf20Sopenharmony_ci /* ----Host Adapter Structure ---- */ 5918c2ecf20Sopenharmony_ci u8 NVM_ModelByte0; /* 4: Model number (byte 0) */ 5928c2ecf20Sopenharmony_ci u8 NVM_ModelByte1; /* 5: Model number (byte 1) */ 5938c2ecf20Sopenharmony_ci u8 NVM_ModelInfo; /* 6: Model information */ 5948c2ecf20Sopenharmony_ci u8 NVM_NumOfCh; /* 7: Number of SCSI channel */ 5958c2ecf20Sopenharmony_ci u8 NVM_BIOSConfig1; /* 8: BIOS configuration 1 */ 5968c2ecf20Sopenharmony_ci u8 NVM_BIOSConfig2; /* 9: BIOS configuration 2 */ 5978c2ecf20Sopenharmony_ci u8 NVM_HAConfig1; /* A: Hoat adapter configuration 1 */ 5988c2ecf20Sopenharmony_ci u8 NVM_HAConfig2; /* B: Hoat adapter configuration 2 */ 5998c2ecf20Sopenharmony_ci NVRAM_SCSI NVM_SCSIInfo[2]; 6008c2ecf20Sopenharmony_ci u8 NVM_reserved[10]; 6018c2ecf20Sopenharmony_ci /* ---------- CheckSum ---------- */ 6028c2ecf20Sopenharmony_ci u16 NVM_CheckSum; /* 0x3E, 0x3F: Checksum of NVRam */ 6038c2ecf20Sopenharmony_ci} NVRAM, *PNVRAM; 6048c2ecf20Sopenharmony_ci 6058c2ecf20Sopenharmony_ci/* Bios Configuration for nvram->BIOSConfig1 */ 6068c2ecf20Sopenharmony_ci#define NBC1_ENABLE 0x01 /* BIOS enable */ 6078c2ecf20Sopenharmony_ci#define NBC1_8DRIVE 0x02 /* Support more than 2 drives */ 6088c2ecf20Sopenharmony_ci#define NBC1_REMOVABLE 0x04 /* Support removable drive */ 6098c2ecf20Sopenharmony_ci#define NBC1_INT19 0x08 /* Intercept int 19h */ 6108c2ecf20Sopenharmony_ci#define NBC1_BIOSSCAN 0x10 /* Dynamic BIOS scan */ 6118c2ecf20Sopenharmony_ci#define NBC1_LUNSUPPORT 0x40 /* Support LUN */ 6128c2ecf20Sopenharmony_ci 6138c2ecf20Sopenharmony_ci/* HA Configuration Byte 1 */ 6148c2ecf20Sopenharmony_ci#define NHC1_BOOTIDMASK 0x0F /* Boot ID number */ 6158c2ecf20Sopenharmony_ci#define NHC1_LUNMASK 0x70 /* Boot LUN number */ 6168c2ecf20Sopenharmony_ci#define NHC1_CHANMASK 0x80 /* Boot Channel number */ 6178c2ecf20Sopenharmony_ci 6188c2ecf20Sopenharmony_ci/* Bit definition for nvram->SCSIconfig1 */ 6198c2ecf20Sopenharmony_ci#define NCC1_BUSRESET 0x01 /* Reset SCSI bus at power up */ 6208c2ecf20Sopenharmony_ci#define NCC1_PARITYCHK 0x02 /* SCSI parity enable */ 6218c2ecf20Sopenharmony_ci#define NCC1_ACTTERM1 0x04 /* Enable active terminator 1 */ 6228c2ecf20Sopenharmony_ci#define NCC1_ACTTERM2 0x08 /* Enable active terminator 2 */ 6238c2ecf20Sopenharmony_ci#define NCC1_AUTOTERM 0x10 /* Enable auto terminator */ 6248c2ecf20Sopenharmony_ci#define NCC1_PWRMGR 0x80 /* Enable power management */ 6258c2ecf20Sopenharmony_ci 6268c2ecf20Sopenharmony_ci/* Bit definition for SCSI Target configuration byte */ 6278c2ecf20Sopenharmony_ci#define NTC_DISCONNECT 0x08 /* Enable SCSI disconnect */ 6288c2ecf20Sopenharmony_ci#define NTC_SYNC 0x10 /* SYNC_NEGO */ 6298c2ecf20Sopenharmony_ci#define NTC_NO_WDTR 0x20 /* SYNC_NEGO */ 6308c2ecf20Sopenharmony_ci#define NTC_1GIGA 0x40 /* 255 head / 63 sectors (64/32) */ 6318c2ecf20Sopenharmony_ci#define NTC_SPINUP 0x80 /* Start disk drive */ 6328c2ecf20Sopenharmony_ci 6338c2ecf20Sopenharmony_ci/* Default NVRam values */ 6348c2ecf20Sopenharmony_ci#define INI_SIGNATURE 0xC925 6358c2ecf20Sopenharmony_ci#define NBC1_DEFAULT (NBC1_ENABLE) 6368c2ecf20Sopenharmony_ci#define NCC1_DEFAULT (NCC1_BUSRESET | NCC1_AUTOTERM | NCC1_PARITYCHK) 6378c2ecf20Sopenharmony_ci#define NTC_DEFAULT (NTC_NO_WDTR | NTC_1GIGA | NTC_DISCONNECT) 6388c2ecf20Sopenharmony_ci 6398c2ecf20Sopenharmony_ci/* SCSI related definition */ 6408c2ecf20Sopenharmony_ci#define DISC_NOT_ALLOW 0x80 /* Disconnect is not allowed */ 6418c2ecf20Sopenharmony_ci#define DISC_ALLOW 0xC0 /* Disconnect is allowed */ 6428c2ecf20Sopenharmony_ci#define SCSICMD_RequestSense 0x03 6438c2ecf20Sopenharmony_ci 6448c2ecf20Sopenharmony_ci#define SCSI_ABORT_SNOOZE 0 6458c2ecf20Sopenharmony_ci#define SCSI_ABORT_SUCCESS 1 6468c2ecf20Sopenharmony_ci#define SCSI_ABORT_PENDING 2 6478c2ecf20Sopenharmony_ci#define SCSI_ABORT_BUSY 3 6488c2ecf20Sopenharmony_ci#define SCSI_ABORT_NOT_RUNNING 4 6498c2ecf20Sopenharmony_ci#define SCSI_ABORT_ERROR 5 6508c2ecf20Sopenharmony_ci 6518c2ecf20Sopenharmony_ci#define SCSI_RESET_SNOOZE 0 6528c2ecf20Sopenharmony_ci#define SCSI_RESET_PUNT 1 6538c2ecf20Sopenharmony_ci#define SCSI_RESET_SUCCESS 2 6548c2ecf20Sopenharmony_ci#define SCSI_RESET_PENDING 3 6558c2ecf20Sopenharmony_ci#define SCSI_RESET_WAKEUP 4 6568c2ecf20Sopenharmony_ci#define SCSI_RESET_NOT_RUNNING 5 6578c2ecf20Sopenharmony_ci#define SCSI_RESET_ERROR 6 6588c2ecf20Sopenharmony_ci 6598c2ecf20Sopenharmony_ci#define SCSI_RESET_SYNCHRONOUS 0x01 6608c2ecf20Sopenharmony_ci#define SCSI_RESET_ASYNCHRONOUS 0x02 6618c2ecf20Sopenharmony_ci#define SCSI_RESET_SUGGEST_BUS_RESET 0x04 6628c2ecf20Sopenharmony_ci#define SCSI_RESET_SUGGEST_HOST_RESET 0x08 6638c2ecf20Sopenharmony_ci 6648c2ecf20Sopenharmony_ci#define SCSI_RESET_BUS_RESET 0x100 6658c2ecf20Sopenharmony_ci#define SCSI_RESET_HOST_RESET 0x200 6668c2ecf20Sopenharmony_ci#define SCSI_RESET_ACTION 0xff 6678c2ecf20Sopenharmony_ci 668