xref: /openbmc/linux/drivers/scsi/a100u2w.h (revision e5451c8f8330e03ad3cfa16048b4daf961af434f)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  * Initio A100 device driver for Linux.
31da177e4SLinus Torvalds  *
41da177e4SLinus Torvalds  * Copyright (c) 1994-1998 Initio Corporation
51da177e4SLinus Torvalds  * All rights reserved.
61da177e4SLinus Torvalds  *
71da177e4SLinus Torvalds  * This program is free software; you can redistribute it and/or modify
81da177e4SLinus Torvalds  * it under the terms of the GNU General Public License as published by
91da177e4SLinus Torvalds  * the Free Software Foundation; either version 2, or (at your option)
101da177e4SLinus Torvalds  * any later version.
111da177e4SLinus Torvalds  *
121da177e4SLinus Torvalds  * This program is distributed in the hope that it will be useful,
131da177e4SLinus Torvalds  * but WITHOUT ANY WARRANTY; without even the implied warranty of
141da177e4SLinus Torvalds  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
151da177e4SLinus Torvalds  * GNU General Public License for more details.
161da177e4SLinus Torvalds  *
171da177e4SLinus Torvalds  * You should have received a copy of the GNU General Public License
181da177e4SLinus Torvalds  * along with this program; see the file COPYING.  If not, write to
191da177e4SLinus Torvalds  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
201da177e4SLinus Torvalds  *
211da177e4SLinus Torvalds  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
221da177e4SLinus Torvalds  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
231da177e4SLinus Torvalds  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
241da177e4SLinus Torvalds  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
251da177e4SLinus Torvalds  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
261da177e4SLinus Torvalds  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
271da177e4SLinus Torvalds  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
281da177e4SLinus Torvalds  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
291da177e4SLinus Torvalds  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
301da177e4SLinus Torvalds  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
311da177e4SLinus Torvalds  * SUCH DAMAGE.
32*4023c474SAlan Cox  *
331da177e4SLinus Torvalds  * Revision History:
341da177e4SLinus Torvalds  * 06/18/98 HL, Initial production Version 1.02
351da177e4SLinus Torvalds  * 12/19/98 bv, Use spinlocks for 2.1.95 and up
361da177e4SLinus Torvalds  * 06/25/02 Doug Ledford <dledford@redhat.com>
371da177e4SLinus Torvalds  *	 - This and the i60uscsi.h file are almost identical,
381da177e4SLinus Torvalds  *	   merged them into a single header used by both .c files.
39*4023c474SAlan Cox  * 14/06/07 Alan Cox <alan@redhat.com>
40*4023c474SAlan Cox  *	 - Grand cleanup and Linuxisation
411da177e4SLinus Torvalds  */
421da177e4SLinus Torvalds 
431da177e4SLinus Torvalds #define inia100_REVID "Initio INI-A100U2W SCSI device driver; Revision: 1.02d"
441da177e4SLinus Torvalds 
451da177e4SLinus Torvalds #if 1
461da177e4SLinus Torvalds #define ORC_MAXQUEUE		245
471da177e4SLinus Torvalds #define ORC_MAXTAGS		64
481da177e4SLinus Torvalds #else
491da177e4SLinus Torvalds #define ORC_MAXQUEUE		25
501da177e4SLinus Torvalds #define ORC_MAXTAGS		8
511da177e4SLinus Torvalds #endif
521da177e4SLinus Torvalds 
531da177e4SLinus Torvalds #define TOTAL_SG_ENTRY		32
541da177e4SLinus Torvalds #define MAX_TARGETS		16
551da177e4SLinus Torvalds #define IMAX_CDB			15
561da177e4SLinus Torvalds #define SENSE_SIZE		14
571da177e4SLinus Torvalds 
581da177e4SLinus Torvalds /************************************************************************/
591da177e4SLinus Torvalds /*              Scatter-Gather Element Structure                        */
601da177e4SLinus Torvalds /************************************************************************/
61*4023c474SAlan Cox struct orc_sgent {
62*4023c474SAlan Cox 	u32 base;		/* Data Pointer */
63*4023c474SAlan Cox 	u32 length;		/* Data Length */
64*4023c474SAlan Cox };
651da177e4SLinus Torvalds 
661da177e4SLinus Torvalds /* SCSI related definition                                              */
671da177e4SLinus Torvalds #define DISC_NOT_ALLOW          0x80	/* Disconnect is not allowed    */
681da177e4SLinus Torvalds #define DISC_ALLOW              0xC0	/* Disconnect is allowed        */
691da177e4SLinus Torvalds 
701da177e4SLinus Torvalds 
711da177e4SLinus Torvalds #define ORC_OFFSET_SCB			16
721da177e4SLinus Torvalds #define ORC_MAX_SCBS		    250
731da177e4SLinus Torvalds #define MAX_CHANNELS       2
741da177e4SLinus Torvalds #define MAX_ESCB_ELE				64
751da177e4SLinus Torvalds #define TCF_DRV_255_63     0x0400
761da177e4SLinus Torvalds 
771da177e4SLinus Torvalds /********************************************************/
781da177e4SLinus Torvalds /*      Orchid Host Command Set                         */
791da177e4SLinus Torvalds /********************************************************/
801da177e4SLinus Torvalds #define ORC_CMD_NOP		0x00	/* Host command - NOP             */
811da177e4SLinus Torvalds #define ORC_CMD_VERSION		0x01	/* Host command - Get F/W version */
821da177e4SLinus Torvalds #define ORC_CMD_ECHO		0x02	/* Host command - ECHO            */
831da177e4SLinus Torvalds #define ORC_CMD_SET_NVM		0x03	/* Host command - Set NVRAM       */
841da177e4SLinus Torvalds #define ORC_CMD_GET_NVM		0x04	/* Host command - Get NVRAM       */
851da177e4SLinus Torvalds #define ORC_CMD_GET_BUS_STATUS	0x05	/* Host command - Get SCSI bus status */
861da177e4SLinus Torvalds #define ORC_CMD_ABORT_SCB	0x06	/* Host command - Abort SCB       */
871da177e4SLinus Torvalds #define ORC_CMD_ISSUE_SCB	0x07	/* Host command - Issue SCB       */
881da177e4SLinus Torvalds 
891da177e4SLinus Torvalds /********************************************************/
901da177e4SLinus Torvalds /*              Orchid Register Set                     */
911da177e4SLinus Torvalds /********************************************************/
921da177e4SLinus Torvalds #define ORC_GINTS	0xA0	/* Global Interrupt Status        */
931da177e4SLinus Torvalds #define QINT		0x04	/* Reply Queue Interrupt  */
941da177e4SLinus Torvalds #define ORC_GIMSK	0xA1	/* Global Interrupt MASK  */
951da177e4SLinus Torvalds #define MQINT		0x04	/* Mask Reply Queue Interrupt     */
961da177e4SLinus Torvalds #define	ORC_GCFG	0xA2	/* Global Configure               */
971da177e4SLinus Torvalds #define EEPRG		0x01	/* Enable EEPROM programming */
981da177e4SLinus Torvalds #define	ORC_GSTAT	0xA3	/* Global status          */
991da177e4SLinus Torvalds #define WIDEBUS		0x10	/* Wide SCSI Devices connected    */
1001da177e4SLinus Torvalds #define ORC_HDATA	0xA4	/* Host Data                      */
1011da177e4SLinus Torvalds #define ORC_HCTRL	0xA5	/* Host Control                   */
1021da177e4SLinus Torvalds #define SCSIRST		0x80	/* SCSI bus reset         */
1031da177e4SLinus Torvalds #define HDO			0x40	/* Host data out          */
1041da177e4SLinus Torvalds #define HOSTSTOP		0x02	/* Host stop RISC engine  */
1051da177e4SLinus Torvalds #define DEVRST		0x01	/* Device reset                   */
1061da177e4SLinus Torvalds #define ORC_HSTUS	0xA6	/* Host Status                    */
1071da177e4SLinus Torvalds #define HDI			0x02	/* Host data in                   */
1081da177e4SLinus Torvalds #define RREADY		0x01	/* RISC engine is ready to receive */
1091da177e4SLinus Torvalds #define	ORC_NVRAM	0xA7	/* Nvram port address             */
1101da177e4SLinus Torvalds #define SE2CS		0x008
1111da177e4SLinus Torvalds #define SE2CLK		0x004
1121da177e4SLinus Torvalds #define SE2DO		0x002
1131da177e4SLinus Torvalds #define SE2DI		0x001
1141da177e4SLinus Torvalds #define ORC_PQUEUE	0xA8	/* Posting queue FIFO             */
1151da177e4SLinus Torvalds #define ORC_PQCNT	0xA9	/* Posting queue FIFO Cnt */
1161da177e4SLinus Torvalds #define ORC_RQUEUE	0xAA	/* Reply queue FIFO               */
1171da177e4SLinus Torvalds #define ORC_RQUEUECNT	0xAB	/* Reply queue FIFO Cnt           */
1181da177e4SLinus Torvalds #define	ORC_FWBASEADR	0xAC	/* Firmware base address  */
1191da177e4SLinus Torvalds 
1201da177e4SLinus Torvalds #define	ORC_EBIOSADR0 0xB0	/* External Bios address */
1211da177e4SLinus Torvalds #define	ORC_EBIOSADR1 0xB1	/* External Bios address */
1221da177e4SLinus Torvalds #define	ORC_EBIOSADR2 0xB2	/* External Bios address */
1231da177e4SLinus Torvalds #define	ORC_EBIOSDATA 0xB3	/* External Bios address */
1241da177e4SLinus Torvalds 
1251da177e4SLinus Torvalds #define	ORC_SCBSIZE	0xB7	/* SCB size register              */
1261da177e4SLinus Torvalds #define	ORC_SCBBASE0	0xB8	/* SCB base address 0             */
1271da177e4SLinus Torvalds #define	ORC_SCBBASE1	0xBC	/* SCB base address 1             */
1281da177e4SLinus Torvalds 
1291da177e4SLinus Torvalds #define	ORC_RISCCTL	0xE0	/* RISC Control                   */
1301da177e4SLinus Torvalds #define PRGMRST		0x002
1311da177e4SLinus Torvalds #define DOWNLOAD		0x001
1321da177e4SLinus Torvalds #define	ORC_PRGMCTR0	0xE2	/* RISC program counter           */
1331da177e4SLinus Torvalds #define	ORC_PRGMCTR1	0xE3	/* RISC program counter           */
1341da177e4SLinus Torvalds #define	ORC_RISCRAM	0xEC	/* RISC RAM data port 4 bytes     */
1351da177e4SLinus Torvalds 
136*4023c474SAlan Cox struct orc_extended_scb {	/* Extended SCB                 */
137*4023c474SAlan Cox 	struct orc_sgent sglist[TOTAL_SG_ENTRY];	/*0 Start of SG list              */
138*4023c474SAlan Cox 	struct scsi_cmnd *srb;	/*50 SRB Pointer */
139*4023c474SAlan Cox };
1401da177e4SLinus Torvalds 
1411da177e4SLinus Torvalds /***********************************************************************
1421da177e4SLinus Torvalds 		SCSI Control Block
1431da177e4SLinus Torvalds 
144*4023c474SAlan Cox 		0x40 bytes long, the last 8 are user bytes
145*4023c474SAlan Cox ************************************************************************/
146*4023c474SAlan Cox struct orc_scb {	/* Scsi_Ctrl_Blk                */
147*4023c474SAlan Cox 	u8 opcode;	/*00 SCB command code&residual  */
148*4023c474SAlan Cox 	u8 flags;	/*01 SCB Flags                  */
149*4023c474SAlan Cox 	u8 target;	/*02 Target Id                  */
150*4023c474SAlan Cox 	u8 lun;		/*03 Lun                        */
151*4023c474SAlan Cox 	u32 reserved0;	/*04 Reserved for ORCHID must 0 */
152*4023c474SAlan Cox 	u32 xferlen;	/*08 Data Transfer Length       */
153*4023c474SAlan Cox 	u32 reserved1;	/*0C Reserved for ORCHID must 0 */
154*4023c474SAlan Cox 	u32 sg_len;		/*10 SG list # * 8              */
155*4023c474SAlan Cox 	u32 sg_addr;	/*14 SG List Buf physical Addr  */
156*4023c474SAlan Cox 	u32 sg_addrhigh;	/*18 SG Buffer high physical Addr */
157*4023c474SAlan Cox 	u8 hastat;	/*1C Host Status                */
158*4023c474SAlan Cox 	u8 tastat;	/*1D Target Status              */
159*4023c474SAlan Cox 	u8 status;	/*1E SCB status                 */
160*4023c474SAlan Cox 	u8 link;		/*1F Link pointer, default 0xFF */
161*4023c474SAlan Cox 	u8 sense_len;	/*20 Sense Allocation Length    */
162*4023c474SAlan Cox 	u8 cdb_len;	/*21 CDB Length                 */
163*4023c474SAlan Cox 	u8 ident;	/*22 Identify                   */
164*4023c474SAlan Cox 	u8 tag_msg;	/*23 Tag Message                */
165*4023c474SAlan Cox 	u8 cdb[IMAX_CDB];	/*24 SCSI CDBs                  */
166*4023c474SAlan Cox 	u8 scbidx;	/*3C Index for this ORCSCB      */
167*4023c474SAlan Cox 	u32 sense_addr;	/*34 Sense Buffer physical Addr */
168*4023c474SAlan Cox 
169*4023c474SAlan Cox 	struct orc_extended_scb *escb; /*38 Extended SCB Pointer       */
170*4023c474SAlan Cox         /* 64bit pointer or 32bit pointer + reserved ? */
171*4023c474SAlan Cox #ifndef CONFIG_64BIT
172*4023c474SAlan Cox 	u8 reserved2[4];	/*3E Reserved for Driver use    */
1731da177e4SLinus Torvalds #endif
174*4023c474SAlan Cox };
1751da177e4SLinus Torvalds 
1761da177e4SLinus Torvalds /* Opcodes of ORCSCB_Opcode */
1771da177e4SLinus Torvalds #define ORC_EXECSCSI	0x00	/* SCSI initiator command with residual */
1781da177e4SLinus Torvalds #define ORC_BUSDEVRST	0x01	/* SCSI Bus Device Reset  */
1791da177e4SLinus Torvalds 
1801da177e4SLinus Torvalds /* Status of ORCSCB_Status */
1811da177e4SLinus Torvalds #define ORCSCB_COMPLETE	0x00	/* SCB request completed  */
1821da177e4SLinus Torvalds #define ORCSCB_POST	0x01	/* SCB is posted by the HOST      */
1831da177e4SLinus Torvalds 
1841da177e4SLinus Torvalds /* Bit Definition for ORCSCB_Flags */
1851da177e4SLinus Torvalds #define SCF_DISINT	0x01	/* Disable HOST interrupt */
1861da177e4SLinus Torvalds #define SCF_DIR		0x18	/* Direction bits         */
1871da177e4SLinus Torvalds #define SCF_NO_DCHK	0x00	/* Direction determined by SCSI   */
1881da177e4SLinus Torvalds #define SCF_DIN		0x08	/* From Target to Initiator       */
1891da177e4SLinus Torvalds #define SCF_DOUT	0x10	/* From Initiator to Target       */
1901da177e4SLinus Torvalds #define SCF_NO_XF	0x18	/* No data transfer               */
1911da177e4SLinus Torvalds #define SCF_POLL   0x40
1921da177e4SLinus Torvalds 
1931da177e4SLinus Torvalds /* Error Codes for ORCSCB_HaStat */
1941da177e4SLinus Torvalds #define HOST_SEL_TOUT	0x11
1951da177e4SLinus Torvalds #define HOST_DO_DU	0x12
1961da177e4SLinus Torvalds #define HOST_BUS_FREE	0x13
1971da177e4SLinus Torvalds #define HOST_BAD_PHAS	0x14
1981da177e4SLinus Torvalds #define HOST_INV_CMD	0x16
1991da177e4SLinus Torvalds #define HOST_SCSI_RST	0x1B
2001da177e4SLinus Torvalds #define HOST_DEV_RST	0x1C
2011da177e4SLinus Torvalds 
2021da177e4SLinus Torvalds 
2031da177e4SLinus Torvalds /* Error Codes for ORCSCB_TaStat */
2041da177e4SLinus Torvalds #define TARGET_CHK_COND	0x02
2051da177e4SLinus Torvalds #define TARGET_BUSY	0x08
2061da177e4SLinus Torvalds #define TARGET_TAG_FULL	0x28
2071da177e4SLinus Torvalds 
2081da177e4SLinus Torvalds 
2091da177e4SLinus Torvalds /***********************************************************************
2101da177e4SLinus Torvalds 		Target Device Control Structure
2111da177e4SLinus Torvalds **********************************************************************/
2121da177e4SLinus Torvalds 
213*4023c474SAlan Cox struct orc_target {
214*4023c474SAlan Cox 	u8 TCS_DrvDASD;	/* 6 */
215*4023c474SAlan Cox 	u8 TCS_DrvSCSI;	/* 7 */
216*4023c474SAlan Cox 	u8 TCS_DrvHead;	/* 8 */
217*4023c474SAlan Cox 	u16 TCS_DrvFlags;	/* 4 */
218*4023c474SAlan Cox 	u8 TCS_DrvSector;	/* 7 */
219*4023c474SAlan Cox };
2201da177e4SLinus Torvalds 
2211da177e4SLinus Torvalds /* Bit Definition for TCF_DrvFlags */
2221da177e4SLinus Torvalds #define	TCS_DF_NODASD_SUPT	0x20	/* Suppress OS/2 DASD Mgr support */
2231da177e4SLinus Torvalds #define	TCS_DF_NOSCSI_SUPT	0x40	/* Suppress OS/2 SCSI Mgr support */
2241da177e4SLinus Torvalds 
2251da177e4SLinus Torvalds 
2261da177e4SLinus Torvalds /***********************************************************************
2271da177e4SLinus Torvalds               Host Adapter Control Structure
2281da177e4SLinus Torvalds ************************************************************************/
229*4023c474SAlan Cox struct orc_host {
230*4023c474SAlan Cox 	unsigned long base;	/* Base address */
231*4023c474SAlan Cox 	u8 index;		/* Index (Channel)*/
232*4023c474SAlan Cox 	u8 scsi_id;		/* H/A SCSI ID */
233*4023c474SAlan Cox 	u8 BIOScfg;		/*BIOS configuration */
234*4023c474SAlan Cox 	u8 flags;
235*4023c474SAlan Cox 	u8 max_targets;		/* SCSI0MAXTags */
236*4023c474SAlan Cox 	struct orc_scb *scb_virt;	/* Virtual Pointer to SCB array */
237*4023c474SAlan Cox 	dma_addr_t scb_phys;	/* Scb Physical address */
238*4023c474SAlan Cox 	struct orc_extended_scb *escb_virt; /* Virtual pointer to ESCB Scatter list */
239*4023c474SAlan Cox 	dma_addr_t escb_phys;	/* scatter list Physical address */
240*4023c474SAlan Cox 	u8 target_flag[16];	/* target configuration, TCF_EN_TAG */
241*4023c474SAlan Cox 	u8 max_tags[16];	/* ORC_MAX_SCBS */
242*4023c474SAlan Cox 	u32 allocation_map[MAX_CHANNELS][8];	/* Max STB is 256, So 256/32 */
243*4023c474SAlan Cox 	spinlock_t allocation_lock;
2441da177e4SLinus Torvalds 	struct pci_dev *pdev;
245*4023c474SAlan Cox };
2461da177e4SLinus Torvalds 
2471da177e4SLinus Torvalds /* Bit Definition for HCS_Flags */
2481da177e4SLinus Torvalds 
2491da177e4SLinus Torvalds #define HCF_SCSI_RESET	0x01	/* SCSI BUS RESET         */
2501da177e4SLinus Torvalds #define HCF_PARITY    	0x02	/* parity card                    */
2511da177e4SLinus Torvalds #define HCF_LVDS     	0x10	/* parity card                    */
2521da177e4SLinus Torvalds 
2531da177e4SLinus Torvalds /* Bit Definition for TargetFlag */
2541da177e4SLinus Torvalds 
2551da177e4SLinus Torvalds #define TCF_EN_255	    0x08
2561da177e4SLinus Torvalds #define TCF_EN_TAG	    0x10
2571da177e4SLinus Torvalds #define TCF_BUSY	      0x20
2581da177e4SLinus Torvalds #define TCF_DISCONNECT	0x40
2591da177e4SLinus Torvalds #define TCF_SPIN_UP	  0x80
2601da177e4SLinus Torvalds 
2611da177e4SLinus Torvalds /* Bit Definition for HCS_AFlags */
2621da177e4SLinus Torvalds #define	HCS_AF_IGNORE		0x01	/* Adapter ignore         */
2631da177e4SLinus Torvalds #define	HCS_AF_DISABLE_RESET	0x10	/* Adapter disable reset  */
2641da177e4SLinus Torvalds #define	HCS_AF_DISABLE_ADPT	0x80	/* Adapter disable                */
2651da177e4SLinus Torvalds 
266*4023c474SAlan Cox struct orc_nvram {
2671da177e4SLinus Torvalds /*----------header ---------------*/
268*4023c474SAlan Cox         u8 SubVendorID0;     /* 00 - Sub Vendor ID           */
269*4023c474SAlan Cox         u8 SubVendorID1;     /* 00 - Sub Vendor ID           */
270*4023c474SAlan Cox         u8 SubSysID0;        /* 02 - Sub System ID           */
271*4023c474SAlan Cox         u8 SubSysID1;        /* 02 - Sub System ID           */
272*4023c474SAlan Cox         u8 SubClass;         /* 04 - Sub Class               */
273*4023c474SAlan Cox         u8 VendorID0;        /* 05 - Vendor ID               */
274*4023c474SAlan Cox         u8 VendorID1;        /* 05 - Vendor ID               */
275*4023c474SAlan Cox         u8 DeviceID0;        /* 07 - Device ID               */
276*4023c474SAlan Cox         u8 DeviceID1;        /* 07 - Device ID               */
277*4023c474SAlan Cox         u8 Reserved0[2];     /* 09 - Reserved                */
278*4023c474SAlan Cox         u8 revision;         /* 0B - revision of data structure */
2791da177e4SLinus Torvalds         /* ----Host Adapter Structure ---- */
280*4023c474SAlan Cox         u8 NumOfCh;          /* 0C - Number of SCSI channel  */
281*4023c474SAlan Cox         u8 BIOSConfig1;      /* 0D - BIOS configuration 1    */
282*4023c474SAlan Cox         u8 BIOSConfig2;      /* 0E - BIOS boot channel&target ID */
283*4023c474SAlan Cox         u8 BIOSConfig3;      /* 0F - BIOS configuration 3    */
2841da177e4SLinus Torvalds         /* ----SCSI channel Structure ---- */
2851da177e4SLinus Torvalds         /* from "CTRL-I SCSI Host Adapter SetUp menu "  */
286*4023c474SAlan Cox         u8 scsi_id;          /* 10 - Channel 0 SCSI ID       */
287*4023c474SAlan Cox         u8 SCSI0Config;      /* 11 - Channel 0 SCSI configuration */
288*4023c474SAlan Cox         u8 SCSI0MaxTags;     /* 12 - Channel 0 Maximum tags  */
289*4023c474SAlan Cox         u8 SCSI0ResetTime;   /* 13 - Channel 0 Reset recovering time */
290*4023c474SAlan Cox         u8 ReservedforChannel0[2];   /* 14 - Reserved                */
2911da177e4SLinus Torvalds 
2921da177e4SLinus Torvalds         /* ----SCSI target Structure ----  */
2931da177e4SLinus Torvalds         /* from "CTRL-I SCSI device SetUp menu "                        */
294*4023c474SAlan Cox         u8 Target00Config;   /* 16 - Channel 0 Target 0 config */
295*4023c474SAlan Cox         u8 Target01Config;   /* 17 - Channel 0 Target 1 config */
296*4023c474SAlan Cox         u8 Target02Config;   /* 18 - Channel 0 Target 2 config */
297*4023c474SAlan Cox         u8 Target03Config;   /* 19 - Channel 0 Target 3 config */
298*4023c474SAlan Cox         u8 Target04Config;   /* 1A - Channel 0 Target 4 config */
299*4023c474SAlan Cox         u8 Target05Config;   /* 1B - Channel 0 Target 5 config */
300*4023c474SAlan Cox         u8 Target06Config;   /* 1C - Channel 0 Target 6 config */
301*4023c474SAlan Cox         u8 Target07Config;   /* 1D - Channel 0 Target 7 config */
302*4023c474SAlan Cox         u8 Target08Config;   /* 1E - Channel 0 Target 8 config */
303*4023c474SAlan Cox         u8 Target09Config;   /* 1F - Channel 0 Target 9 config */
304*4023c474SAlan Cox         u8 Target0AConfig;   /* 20 - Channel 0 Target A config */
305*4023c474SAlan Cox         u8 Target0BConfig;   /* 21 - Channel 0 Target B config */
306*4023c474SAlan Cox         u8 Target0CConfig;   /* 22 - Channel 0 Target C config */
307*4023c474SAlan Cox         u8 Target0DConfig;   /* 23 - Channel 0 Target D config */
308*4023c474SAlan Cox         u8 Target0EConfig;   /* 24 - Channel 0 Target E config */
309*4023c474SAlan Cox         u8 Target0FConfig;   /* 25 - Channel 0 Target F config */
3101da177e4SLinus Torvalds 
311*4023c474SAlan Cox         u8 SCSI1Id;          /* 26 - Channel 1 SCSI ID       */
312*4023c474SAlan Cox         u8 SCSI1Config;      /* 27 - Channel 1 SCSI configuration */
313*4023c474SAlan Cox         u8 SCSI1MaxTags;     /* 28 - Channel 1 Maximum tags  */
314*4023c474SAlan Cox         u8 SCSI1ResetTime;   /* 29 - Channel 1 Reset recovering time */
315*4023c474SAlan Cox         u8 ReservedforChannel1[2];   /* 2A - Reserved                */
3161da177e4SLinus Torvalds 
3171da177e4SLinus Torvalds         /* ----SCSI target Structure ----  */
3181da177e4SLinus Torvalds         /* from "CTRL-I SCSI device SetUp menu "                                          */
319*4023c474SAlan Cox         u8 Target10Config;   /* 2C - Channel 1 Target 0 config */
320*4023c474SAlan Cox         u8 Target11Config;   /* 2D - Channel 1 Target 1 config */
321*4023c474SAlan Cox         u8 Target12Config;   /* 2E - Channel 1 Target 2 config */
322*4023c474SAlan Cox         u8 Target13Config;   /* 2F - Channel 1 Target 3 config */
323*4023c474SAlan Cox         u8 Target14Config;   /* 30 - Channel 1 Target 4 config */
324*4023c474SAlan Cox         u8 Target15Config;   /* 31 - Channel 1 Target 5 config */
325*4023c474SAlan Cox         u8 Target16Config;   /* 32 - Channel 1 Target 6 config */
326*4023c474SAlan Cox         u8 Target17Config;   /* 33 - Channel 1 Target 7 config */
327*4023c474SAlan Cox         u8 Target18Config;   /* 34 - Channel 1 Target 8 config */
328*4023c474SAlan Cox         u8 Target19Config;   /* 35 - Channel 1 Target 9 config */
329*4023c474SAlan Cox         u8 Target1AConfig;   /* 36 - Channel 1 Target A config */
330*4023c474SAlan Cox         u8 Target1BConfig;   /* 37 - Channel 1 Target B config */
331*4023c474SAlan Cox         u8 Target1CConfig;   /* 38 - Channel 1 Target C config */
332*4023c474SAlan Cox         u8 Target1DConfig;   /* 39 - Channel 1 Target D config */
333*4023c474SAlan Cox         u8 Target1EConfig;   /* 3A - Channel 1 Target E config */
334*4023c474SAlan Cox         u8 Target1FConfig;   /* 3B - Channel 1 Target F config */
335*4023c474SAlan Cox         u8 reserved[3];      /* 3C - Reserved                */
3361da177e4SLinus Torvalds         /* ---------- CheckSum ----------       */
337*4023c474SAlan Cox         u8 CheckSum;         /* 3F - Checksum of NVRam       */
338*4023c474SAlan Cox };
3391da177e4SLinus Torvalds 
3401da177e4SLinus Torvalds /* Bios Configuration for nvram->BIOSConfig1                            */
3411da177e4SLinus Torvalds #define NBC_BIOSENABLE  0x01    /* BIOS enable                    */
3421da177e4SLinus Torvalds #define NBC_CDROM       0x02    /* Support bootable CDROM */
3431da177e4SLinus Torvalds #define NBC_REMOVABLE   0x04    /* Support removable drive        */
3441da177e4SLinus Torvalds 
3451da177e4SLinus Torvalds /* Bios Configuration for nvram->BIOSConfig2                            */
3461da177e4SLinus Torvalds #define NBB_TARGET_MASK 0x0F    /* Boot SCSI target ID number     */
3471da177e4SLinus Torvalds #define NBB_CHANL_MASK  0xF0    /* Boot SCSI channel number       */
3481da177e4SLinus Torvalds 
3491da177e4SLinus Torvalds /* Bit definition for nvram->SCSIConfig                                 */
3501da177e4SLinus Torvalds #define NCC_BUSRESET    0x01    /* Reset SCSI bus at power up     */
3511da177e4SLinus Torvalds #define NCC_PARITYCHK   0x02    /* SCSI parity enable             */
3521da177e4SLinus Torvalds #define NCC_LVDS        0x10    /* Enable LVDS                    */
3531da177e4SLinus Torvalds #define NCC_ACTTERM1    0x20    /* Enable active terminator 1     */
3541da177e4SLinus Torvalds #define NCC_ACTTERM2    0x40    /* Enable active terminator 2     */
3551da177e4SLinus Torvalds #define NCC_AUTOTERM    0x80    /* Enable auto termination        */
3561da177e4SLinus Torvalds 
3571da177e4SLinus Torvalds /* Bit definition for nvram->TargetxConfig                              */
3581da177e4SLinus Torvalds #define NTC_PERIOD      0x07    /* Maximum Sync. Speed            */
3591da177e4SLinus Torvalds #define NTC_1GIGA       0x08    /* 255 head / 63 sectors (64/32) */
3601da177e4SLinus Torvalds #define NTC_NO_SYNC     0x10    /* NO SYNC. NEGO          */
3611da177e4SLinus Torvalds #define NTC_NO_WIDESYNC 0x20    /* NO WIDE SYNC. NEGO             */
3621da177e4SLinus Torvalds #define NTC_DISC_ENABLE 0x40    /* Enable SCSI disconnect */
3631da177e4SLinus Torvalds #define NTC_SPINUP      0x80    /* Start disk drive               */
3641da177e4SLinus Torvalds 
3651da177e4SLinus Torvalds /* Default NVRam values                                                 */
3661da177e4SLinus Torvalds #define NBC_DEFAULT     (NBC_ENABLE)
3671da177e4SLinus Torvalds #define NCC_DEFAULT     (NCC_BUSRESET | NCC_AUTOTERM | NCC_PARITYCHK)
3681da177e4SLinus Torvalds #define NCC_MAX_TAGS    0x20    /* Maximum tags per target        */
3691da177e4SLinus Torvalds #define NCC_RESET_TIME  0x0A    /* SCSI RESET recovering time     */
3701da177e4SLinus Torvalds #define NTC_DEFAULT     (NTC_1GIGA | NTC_NO_WIDESYNC | NTC_DISC_ENABLE)
3711da177e4SLinus Torvalds 
372