Home | History | Annotate | Line # | Download | only in ic
ninjascsi32reg.h revision 1.2.70.1
      1  1.2.70.1    mjf /*	$NetBSD: ninjascsi32reg.h,v 1.2.70.1 2008/06/02 13:23:26 mjf Exp $	*/
      2       1.1  itohy 
      3       1.1  itohy /*-
      4       1.1  itohy  * Copyright (c) 2004 The NetBSD Foundation, Inc.
      5       1.1  itohy  * All rights reserved.
      6       1.1  itohy  *
      7       1.1  itohy  * This code is derived from software contributed to The NetBSD Foundation
      8       1.1  itohy  * by ITOH Yasufumi.
      9       1.1  itohy  *
     10       1.1  itohy  * Redistribution and use in source and binary forms, with or without
     11       1.1  itohy  * modification, are permitted provided that the following conditions
     12       1.1  itohy  * are met:
     13       1.1  itohy  * 1. Redistributions of source code must retain the above copyright
     14       1.1  itohy  *    notice, this list of conditions and the following disclaimer.
     15       1.1  itohy  * 2. Redistributions in binary form must reproduce the above copyright
     16       1.1  itohy  *    notice, this list of conditions and the following disclaimer in the
     17       1.1  itohy  *    documentation and/or other materials provided with the distribution.
     18       1.1  itohy  *
     19       1.1  itohy  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20       1.1  itohy  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21       1.1  itohy  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22       1.1  itohy  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23       1.1  itohy  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24       1.1  itohy  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25       1.1  itohy  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26       1.1  itohy  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27       1.1  itohy  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28       1.1  itohy  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29       1.1  itohy  * POSSIBILITY OF SUCH DAMAGE.
     30       1.1  itohy  */
     31       1.1  itohy 
     32       1.1  itohy #ifndef _NJSC32REG_H_
     33       1.1  itohy #define _NJSC32REG_H_
     34       1.1  itohy 
     35       1.1  itohy /*
     36       1.1  itohy  * Workbit NinjaSCSI (32bit versions), Ultra Narrow SCSI3 host adapters:
     37       1.1  itohy  *	NJSC-32Bi	PCMCIA/CardBus dual mode device ("DuoSCSI")
     38       1.1  itohy  *			(CardBus mode only)
     39       1.1  itohy  *	NJSC-32UDE	PCI/CardBus device, DualEdge transfer support
     40       1.1  itohy  */
     41       1.1  itohy 
     42       1.1  itohy #define NJSC32_REGSIZE		128	/* size of register set */
     43       1.1  itohy #define NJSC32_MEMOFFSET_REG	0x800	/* offset of memory mapped register */
     44       1.1  itohy 
     45       1.1  itohy /*
     46       1.1  itohy  * Direct registers
     47       1.1  itohy  */
     48       1.1  itohy #define NJSC32_REG_IRQ			0x00	/* len=2 R/W */
     49       1.1  itohy # define NJSC32_IRQ_MSG			0x0001
     50       1.1  itohy # define NJSC32_IRQ_IO			0x0002
     51       1.1  itohy # define NJSC32_IRQ_CD			0x0004
     52       1.1  itohy # define NJSC32_IRQ_BUS_FREE		0x0008
     53       1.1  itohy # define NJSC32_IRQ_RESELECT		0x0010
     54       1.1  itohy # define NJSC32_IRQ_PHASE_CHANGE	0x0020
     55       1.1  itohy # define NJSC32_IRQ_SCSIRESET		0x0040
     56       1.1  itohy # define NJSC32_IRQ_TIMER		0x0080
     57       1.1  itohy # define NJSC32_IRQ_FIFO_THRESHOLD	0x0100
     58       1.1  itohy # define NJSC32_IRQ_PCI			0x0200
     59       1.1  itohy # define NJSC32_IRQ_BMCNTERR		0x0400
     60       1.1  itohy # define NJSC32_IRQ_AUTOSCSI		0x0800
     61       1.1  itohy # define NJSC32_IRQ_MASK_PCI		0x1000
     62       1.1  itohy # define NJSC32_IRQ_MASK_TIMER		0x2000
     63       1.1  itohy # define NJSC32_IRQ_MASK_FIFO		0x4000
     64       1.1  itohy # define NJSC32_IRQ_MASK_SCSI		0x8000
     65       1.1  itohy 
     66       1.1  itohy # define NJSC32_IRQ_MASK_ALL		0xf000
     67       1.1  itohy # define NJSC32_IRQ_INTR_PENDING	0x0ff0
     68       1.1  itohy 
     69       1.1  itohy #define NJSC32_REG_TRANSFER		0x02	/* len=2 R/W */
     70       1.1  itohy # define NJSC32_XFR_CB_MMIO_MODE	0x0001
     71       1.1  itohy # define NJSC32_XFR_CB_PIO_MODE		0x0002
     72       1.1  itohy # define NJSC32_XFR_BM_TEST		0x0004
     73       1.1  itohy # define NJSC32_XFR_BM_TEST_DIR		0x0008
     74       1.1  itohy # define NJSC32_XFR_DUALEDGE_ENABLE	0x0010	/* (UDE) */
     75       1.1  itohy # define NJSC32_XFR_NO_XFER_TO_HOST	0x0020	/* (UDE) */
     76       1.1  itohy 					/* reserved */
     77       1.1  itohy # define NJSC32_XFR_TRANSFER_GO		0x0080
     78       1.1  itohy # define NJSC32_XFR_BLIND_MODE		0x0100
     79       1.1  itohy # define NJSC32_XFR_BM_START		0x0200
     80       1.1  itohy # define NJSC32_XFR_ADVANCED_BM_WRITE	0x0400
     81       1.1  itohy # define NJSC32_XFR_BM_SINGLE_MODE	0x0800
     82       1.1  itohy # define NJSC32_XFR_FIFO_FULL		0x1000	/* RO */
     83       1.1  itohy # define NJSC32_XFR_FIFO_EMPTY		0x2000	/* RO */
     84       1.1  itohy # define NJSC32_XFR_ALL_COUNT_CLR	0x4000
     85       1.1  itohy # define NJSC32_XFR_FIFO_TEST		0x8000
     86       1.1  itohy 
     87       1.1  itohy #define NJSC32_REG_INDEX		0x04	/* len=1 R/W, len=2 RO */
     88       1.1  itohy # define NJSC32_INDEX_GAREV(x)		((x) >> 8)
     89       1.1  itohy # define NJSC32_INDEX_GAREV_MIN		0x51
     90       1.1  itohy 
     91       1.1  itohy #define NJSC32_REG_TIMER		0x06	/* len=2 R/W */
     92       1.1  itohy # define NJSC32_TIMER_CNT_MASK		0x00ff
     93       1.1  itohy # define NJSC32_TIMER_STOP		0x0100
     94       1.1  itohy 
     95       1.1  itohy #define NJSC32_REG_DATA_LOW		0x08	/* len=2 R/W */
     96       1.1  itohy #define NJSC32_REG_DATA_HIGH		0x0a	/* len=2 R/W */
     97       1.1  itohy 
     98       1.1  itohy #define NJSC32_REG_FIFO_REST_CNT	0x0c	/* len=2 R/W */
     99       1.1  itohy # define NJSC32_FIFOCNT_MASK		0x01ff
    100       1.1  itohy # define NJSC32_FIFOCNT_LOW_WATER	0x4000
    101       1.1  itohy # define NJSC32_FIFOCNT_HIGH_WATER	0x8000
    102       1.1  itohy 
    103       1.1  itohy #define NJSC32_REG_SREQ_SAMPLING	0x0f	/* len=1 R/W */
    104       1.1  itohy # define NJSC32_SREQ_SAMPLING_RATE0	0x01
    105       1.1  itohy # define NJSC32_SREQ_SAMPLING_RATE1	0x02
    106       1.1  itohy # define NJSC32_SREQ_SAMPLING_ENABLE	0x04
    107       1.1  itohy 
    108       1.1  itohy # define NJSC32_SREQ_SAMPLING_1CLK	0
    109       1.1  itohy # define NJSC32_SREQ_SAMPLING_2CLK	NJSC32_SREQ_SAMPLING_RATE0
    110       1.1  itohy # define NJSC32_SREQ_SAMPLING_4CLK	NJSC32_SREQ_SAMPLING_RATE1
    111       1.1  itohy 
    112       1.1  itohy #define NJSC32_REG_SCSI_BUS_CONTROL	0x10	/* len=1 R/W */
    113       1.1  itohy # define NJSC32_SBCTL_SEL		0x01
    114       1.1  itohy # define NJSC32_SBCTL_RST		0x02
    115       1.1  itohy # define NJSC32_SBCTL_DATAOUT_ENABLE	0x04
    116       1.1  itohy # define NJSC32_SBCTL_ATN		0x08
    117       1.1  itohy # define NJSC32_SBCTL_ACK		0x10
    118       1.1  itohy # define NJSC32_SBCTL_BSY		0x20
    119       1.1  itohy # define NJSC32_SBCTL_AUTODIRECTION	0x40
    120       1.1  itohy # define NJSC32_SBCTL_ACK_ENABLE	0x80
    121       1.1  itohy 
    122       1.1  itohy #define NJSC32_REG_CLR_COUNTER		0x12	/* len=1 WO */
    123       1.1  itohy # define NJSC32_CLRCNT_ACK		0x01
    124       1.1  itohy # define NJSC32_CLRCNT_REQ		0x02
    125       1.1  itohy # define NJSC32_CLRCNT_FIFO_HOST_PTR	0x04
    126       1.1  itohy # define NJSC32_CLRCNT_FIFO_REST	0x08
    127       1.1  itohy # define NJSC32_CLRCNT_BM		0x10
    128       1.1  itohy # define NJSC32_CLRCNT_SAVED_ACK	0x20
    129       1.1  itohy 
    130       1.1  itohy # define NJSC32_CLCNT_ALL		0x3f
    131       1.1  itohy 
    132       1.1  itohy #define NJSC32_REG_SCSI_BUS_MONITOR	0x12	/* len=1 RO */
    133       1.1  itohy # define NJSC32_BUSMON_MSG		0x01
    134       1.1  itohy # define NJSC32_BUSMON_IO		0x02
    135       1.1  itohy # define NJSC32_BUSMON_CD		0x04
    136       1.1  itohy # define NJSC32_BUSMON_BSY		0x08
    137       1.1  itohy # define NJSC32_BUSMON_ACK		0x10
    138       1.1  itohy # define NJSC32_BUSMON_REQ		0x20
    139       1.1  itohy # define NJSC32_BUSMON_SEL		0x40
    140       1.1  itohy # define NJSC32_BUSMON_ATN		0x80
    141       1.1  itohy 
    142       1.1  itohy # define NJSC32_BUSMON_BUSFREE		0x00
    143       1.1  itohy # define NJSC32_BUSMON_COMMAND		(NJSC32_BUSMON_CD | \
    144       1.1  itohy 	NJSC32_BUSMON_BSY | NJSC32_BUSMON_REQ)
    145       1.1  itohy # define NJSC32_BUSMON_MESSAGE_IN	(NJSC32_BUSMON_MSG | \
    146       1.1  itohy 	NJSC32_BUSMON_BSY | NJSC32_BUSMON_IO | NJSC32_BUSMON_CD | \
    147       1.1  itohy 	NJSC32_BUSMON_REQ)
    148       1.1  itohy # define NJSC32_BUSMON_MESSAGE_OUT	(NJSC32_BUSMON_MSG | \
    149       1.1  itohy 	NJSC32_BUSMON_BSY | NJSC32_BUSMON_CD | NJSC32_BUSMON_REQ)
    150       1.1  itohy # define NJSC32_BUSMON_DATA_IN		(NJSC32_BUSMON_IO | \
    151       1.1  itohy 	NJSC32_BUSMON_BSY | NJSC32_BUSMON_REQ)
    152       1.1  itohy # define NJSC32_BUSMON_DATA_OUT	(NJSC32_BUSMON_BSY | \
    153       1.1  itohy 	NJSC32_BUSMON_REQ)
    154       1.1  itohy # define NJSC32_BUSMON_STATUS		(NJSC32_BUSMON_IO | \
    155       1.1  itohy 	NJSC32_BUSMON_CD | NJSC32_BUSMON_BSY | NJSC32_BUSMON_REQ)
    156       1.1  itohy # define NJSC32_BUSMON_RESELECT	(NJSC32_BUSMON_IO | NJSC32_BUSMON_SEL)
    157       1.1  itohy 
    158       1.1  itohy # define NJSC32_BUSMON_PHASE_MASK	(NJSC32_BUSMON_MSG | \
    159       1.1  itohy 	NJSC32_BUSMON_IO | NJSC32_BUSMON_BSY | NJSC32_BUSMON_CD | \
    160       1.1  itohy 	NJSC32_BUSMON_SEL)
    161       1.1  itohy 
    162       1.1  itohy # define NJSC32_PHASE_BUSFREE		\
    163       1.1  itohy 	(NJSC32_BUSMON_BUSFREE & NJSC32_BUSMON_PHASE_MASK)
    164       1.1  itohy # define NJSC32_PHASE_COMMAND		\
    165       1.1  itohy 	(NJSC32_BUSMON_COMMAND & NJSC32_BUSMON_PHASE_MASK)
    166       1.1  itohy # define NJSC32_PHASE_MESSAGE_IN	\
    167       1.1  itohy 	(NJSC32_BUSMON_MESSAGE_IN & NJSC32_BUSMON_PHASE_MASK)
    168       1.1  itohy # define NJSC32_PHASE_MESSAGE_OUT	\
    169       1.1  itohy 	(NJSC32_BUSMON_MESSAGE_OUT & NJSC32_BUSMON_PHASE_MASK)
    170       1.1  itohy # define NJSC32_PHASE_DATA_IN		\
    171       1.1  itohy 	(NJSC32_BUSMON_DATA_IN & NJSC32_BUSMON_PHASE_MASK)
    172       1.1  itohy # define NJSC32_PHASE_DATA_OUT		\
    173       1.1  itohy 	(NJSC32_BUSMON_DATA_OUT & NJSC32_BUSMON_PHASE_MASK)
    174       1.1  itohy # define NJSC32_PHASE_STATUS		\
    175       1.1  itohy 	(NJSC32_BUSMON_STATUS & NJSC32_BUSMON_PHASE_MASK)
    176       1.1  itohy # define NJSC32_PHASE_RESELECT		\
    177       1.1  itohy 	(NJSC32_BUSMON_RESELECT & NJSC32_BUSMON_PHASE_MASK)
    178       1.1  itohy 
    179       1.1  itohy #define NJSC32_REG_COMMAND_DATA		0x14	/* len=1 R/W */
    180       1.1  itohy 
    181       1.1  itohy #define NJSC32_REG_PARITY_CONTROL	0x16	/* len=1 WO */
    182       1.1  itohy # define NJSC32_PARITYCTL_CHECK_ENABLE	0x01
    183       1.1  itohy # define NJSC32_PARITYCTL_CLEAR_ERROR	0x02
    184       1.1  itohy 
    185       1.1  itohy #define NJSC32_REG_PARITY_STATUS	0x16	/* len=1 RO */
    186       1.1  itohy # define NJSC32_PARITYSTATUS_ERROR_LSB	0x02
    187       1.1  itohy # define NJSC32_PARITYSTATUS_ERROR_MSB	0x04	/* (UDE) */
    188       1.1  itohy 
    189       1.1  itohy #define NJSC32_REG_RESELECT_ID		0x18	/* len=1 RO */
    190       1.1  itohy 
    191       1.1  itohy #define NJSC32_REG_COMMAND_CONTROL	0x18	/* len=2 WO */
    192       1.1  itohy # define NJSC32_CMD_CLEAR_CDB_FIFO_PTR	0x0001
    193       1.1  itohy # define NJSC32_CMD_AUTO_COMMAND_PHASE	0x0002
    194       1.1  itohy # define NJSC32_CMD_AUTO_SCSI_START	0x0004
    195       1.1  itohy # define NJSC32_CMD_AUTO_SCSI_RESTART	0x0008
    196       1.1  itohy # define NJSC32_CMD_AUTO_PARAMETER	0x0010	/* load parameters via DMA */
    197       1.1  itohy # define NJSC32_CMD_AUTO_ATN		0x0020
    198       1.1  itohy # define NJSC32_CMD_AUTO_MSGIN_00_04	0x0040	/* Command Complete (00)
    199       1.1  itohy 						   or Disconnect (04) */
    200       1.1  itohy # define NJSC32_CMD_AUTO_MSGIN_02	0x0080	/* Save Data Pointer */
    201       1.1  itohy # define NJSC32_CMD_AUTO_MSGIN_03	0x0100	/* Restore Pointers */
    202       1.1  itohy 
    203       1.1  itohy #define NJSC32_REG_SET_ARBITRATION	0x1a	/* len=1 WO */
    204       1.1  itohy # define NJSC32_SETARB_GO		0x01
    205       1.1  itohy # define NJSC32_SETARB_CLEAR		0x02
    206       1.1  itohy 
    207       1.1  itohy #define NJSC32_REG_ARBITRATION_STAT	0x1a	/* len=1 RO */
    208       1.1  itohy # define NJSC32_ARBSTAT_WIN		0x02
    209       1.1  itohy # define NJSC32_ARBSTAT_FAIL		0x04
    210       1.1  itohy # define NJSC32_ARBSTAT_AUTOPARAM_VALID	0x08
    211       1.1  itohy # define NJSC32_ARBSTAT_SG_TABLE_VALID	0x10
    212       1.1  itohy 
    213       1.1  itohy #define NJSC32_REG_SYNC			0x1c	/* len=1 R/W */
    214       1.1  itohy # define NJSC32_SYNC_VAL(periodnum, syncoffset) ((periodnum)<<4 | (syncoffset))
    215       1.1  itohy 
    216       1.1  itohy # define NJSC32_SYNCPERIOD_ASYNC	0
    217       1.1  itohy # define NJSC32_SYNCOFFSET_ASYNC	0
    218       1.1  itohy # define NJSC32_SYNCOFFSET_MAX		15
    219       1.1  itohy 
    220       1.1  itohy #define NJSC32_REG_ACK_WIDTH		0x1d	/* len=1 R/W */
    221       1.1  itohy # define NJSC32_ACK_WIDTH_1CLK		0
    222       1.1  itohy # define NJSC32_ACK_WIDTH_2CLK		1
    223       1.1  itohy # define NJSC32_ACK_WIDTH_3CLK		2
    224       1.1  itohy # define NJSC32_ACK_WIDTH_4CLK		3
    225       1.1  itohy 
    226       1.1  itohy #define NJSC32_REG_SCSI_DATA_WITH_ACK	0x20	/* len=1 R/W */
    227       1.1  itohy 
    228       1.1  itohy #define NJSC32_REG_SCSI_OUT_LATCH	0x22	/* len=1 W */
    229       1.1  itohy #define NJSC32_REG_TARGET_ID		0x22	/* len=1 W */
    230       1.1  itohy #define NJSC32_REG_DATA_IN		0x22	/* len=1 R */
    231       1.1  itohy 
    232       1.1  itohy #define NJSC32_REG_SCAM_CONTROL		0x24	/* len=1 R/W */
    233       1.1  itohy # define NJSC32_SCAMCTL_MSG		0x01
    234       1.1  itohy # define NJSC32_SCAMCTL_IO		0x02
    235       1.1  itohy # define NJSC32_SCAMCTL_CD		0x04
    236       1.1  itohy # define NJSC32_SCAMCTL_BSY		0x08
    237       1.1  itohy # define NJSC32_SCAMCTL_SEL		0x10
    238       1.1  itohy # define NJSC32_SCAMCTL_XFEROK		0x20
    239       1.1  itohy 
    240       1.1  itohy #define NJSC32_REG_SCAM_DATA		0x26	/* len=1 R/W */
    241       1.1  itohy 
    242       1.1  itohy #define NJSC32_REG_SACK_CNT		0x28	/* len=4 R/W */
    243       1.1  itohy 
    244       1.1  itohy #define NJSC32_REG_SREQ_CNT		0x2c	/* len=4 R/W */
    245       1.1  itohy 
    246       1.1  itohy #define NJSC32_REG_FIFO_DATA		0x30	/* len=4 R/W */
    247       1.1  itohy #define NJSC32_REG_FIFO_ADR		0x34	/* len=4 R/W */
    248       1.1  itohy 
    249       1.1  itohy #define NJSC32_REG_BM_CNT		0x38	/* len=4 R/W */
    250       1.1  itohy # define NJSC32_BMCNT_MASK		0x0001ffff
    251       1.1  itohy 
    252       1.1  itohy #define NJSC32_REG_SGT_ADR		0x3c	/* len=4 R/W */
    253       1.1  itohy 
    254       1.1  itohy #define NJSC32_REG_EXECUTE_PHASE	0x40	/* len=2 RO */
    255       1.1  itohy # define NJSC32_XPHASE_COMMAND		0x0001
    256       1.1  itohy # define NJSC32_XPHASE_DATA_IN		0x0002
    257       1.1  itohy # define NJSC32_XPHASE_DATA_OUT		0x0004
    258       1.1  itohy # define NJSC32_XPHASE_MSGOUT		0x0008
    259       1.1  itohy # define NJSC32_XPHASE_STATUS		0x0010
    260       1.1  itohy # define NJSC32_XPHASE_ILLEGAL		0x0020
    261       1.1  itohy # define NJSC32_XPHASE_BUS_FREE		0x0040
    262       1.1  itohy # define NJSC32_XPHASE_PAUSED_MSG_IN	0x0080
    263       1.1  itohy # define NJSC32_XPHASE_PAUSED_MSG_OUT	0x0100
    264       1.1  itohy # define NJSC32_XPHASE_SEL_TIMEOUT	0x0200
    265       1.1  itohy # define NJSC32_XPHASE_MSGIN_00		0x0400	/* Command Complete */
    266       1.1  itohy # define NJSC32_XPHASE_MSGIN_02		0x0800	/* Save Data Pointer */
    267       1.1  itohy # define NJSC32_XPHASE_MSGIN_03		0x1000	/* Restore Pointers */
    268       1.1  itohy # define NJSC32_XPHASE_MSGIN_04		0x2000	/* Disconnect */
    269       1.1  itohy 					/* reserved */
    270       1.1  itohy # define NJSC32_XPHASE_AUTOSCSI_BUSY	0x8000
    271       1.1  itohy 
    272       1.1  itohy #define NJSC32_REG_SCSI_CSB_IN		0x42	/* len=1 RO */
    273       1.1  itohy 
    274       1.1  itohy #define NJSC32_REG_SCSI_MSG_OUT		0x44	/* len=4 R/W */
    275       1.1  itohy # define NJSC32_MSGOUT_COUNT_MASK	0x00000003
    276       1.1  itohy # define NJSC32_MSGOUT_MAX_AUTO		3
    277       1.1  itohy # define NJSC32_MSGOUT_VALID		0x00000080
    278       1.1  itohy # define NJSC32_MSGOUT_MSG1_SHIFT	8	/* used only if cnt == 3 */
    279       1.1  itohy # define NJSC32_MSGOUT_MSG2_SHIFT	16	/* used if cnt == 2 or 3 */
    280       1.1  itohy # define NJSC32_MSGOUT_MSG3_SHIFT	24
    281       1.1  itohy 
    282       1.1  itohy #define NJSC32_REG_SEL_TIMEOUT		0x48	/* len=2 R/W */
    283       1.1  itohy 
    284       1.1  itohy #define NJSC32_REG_SAVED_ACK_CNT	0x4c	/* len=4 RO */
    285       1.1  itohy 
    286       1.1  itohy #define NJSC32_REG_HTOS_DATA_DELAY	0x50	/* len=1 R/W (UDE) */
    287       1.1  itohy # define NJSC32_HTOSDATADELAY_FACTOR	0x07
    288       1.1  itohy # define NJSC32_HTOSDATADELAY_DATA_SEL	0x80
    289       1.1  itohy 
    290       1.1  itohy #define NJSC32_REG_STOH_DATA_DELAY	0x54	/* len=1 R/W (UDE) */
    291       1.1  itohy #define NJSC32_REG_ACK_SUM_CHECK_RD	0x58	/* len=2 RO (UDE) */
    292       1.1  itohy #define NJSC32_REG_REQ_SUM_CHECK_RD	0x5c	/* len=2 RO (UDE) */
    293       1.1  itohy 
    294       1.1  itohy /*
    295       1.1  itohy  * Indexed registers
    296       1.1  itohy  */
    297       1.1  itohy #define NJSC32_IREG_CLOCK		0x00	/* len=1 R/W */
    298       1.1  itohy # define NJSC32_CLOCK_DIV_2		0x01	/* external 20MHz (FAST SCSI)*/
    299       1.1  itohy # define NJSC32_CLOCK_DIV_4		0x02	/* external 40MHz (Ultra SCSI)*/
    300       1.1  itohy # define NJSC32_CLOCK_PCICLK		0x80	/* PCI 33.3MHz */
    301       1.1  itohy 
    302       1.1  itohy #define NJSC32_IREG_TERM_PWR		0x01	/* len=1 R/W */
    303       1.1  itohy # define NJSC32_TERMPWR_BPWR		0x01	/* supply termination power */
    304       1.1  itohy # define NJSC32_TERMPWR_SENSE		0x02	/* RO */
    305       1.1  itohy 
    306       1.1  itohy #define NJSC32_IREG_EXT_PORT_DDR	0x02	/* len=1 R/W */
    307       1.1  itohy #define NJSC32_IREG_EXT_PORT		0x03	/* len=1 R/W */
    308       1.1  itohy # define NJSC32_EXTPORT_LED_ON		0x00
    309       1.1  itohy # define NJSC32_EXTPORT_LED_OFF		0x01
    310       1.1  itohy 
    311       1.1  itohy #define NJSC32_IREG_IRQ_SELECT		0x04	/* len=2 R/W */
    312       1.1  itohy # define NJSC32_IRQSEL_RESELECT		0x0001
    313       1.1  itohy # define NJSC32_IRQSEL_PHASE_CHANGE	0x0002
    314       1.1  itohy # define NJSC32_IRQSEL_SCSIRESET	0x0004
    315       1.1  itohy # define NJSC32_IRQSEL_TIMER		0x0008
    316       1.1  itohy # define NJSC32_IRQSEL_FIFO_THRESHOLD	0x0010
    317       1.1  itohy # define NJSC32_IRQSEL_TARGET_ABORT	0x0020
    318       1.1  itohy # define NJSC32_IRQSEL_MASTER_ABORT	0x0040
    319       1.1  itohy # define NJSC32_IRQSEL_SERR		0x0080
    320       1.1  itohy # define NJSC32_IRQSEL_PERR		0x0100
    321       1.1  itohy # define NJSC32_IRQSEL_BMCNTERR		0x0200
    322       1.1  itohy # define NJSC32_IRQSEL_AUTO_SCSI_SEQ	0x0400
    323       1.1  itohy 
    324       1.1  itohy #define NJSC32_IREG_OLD_SCSI_PHASE	0x05	/* len=1 R/W */
    325       1.1  itohy # define NJSC32_OLDSCSI_PHASE_MSG	0x01
    326       1.1  itohy # define NJSC32_OLDSCSI_PHASE_IO	0x02
    327       1.1  itohy # define NJSC32_OLDSCSI_PHASE_CD	0x04
    328       1.1  itohy # define NJSC32_OLDSCSI_PHASE_BUSY	0x08
    329       1.1  itohy 
    330       1.1  itohy #define NJSC32_IREG_FIFO_THRESHOLD_FULL		0x06	/* len=1 R/W */
    331       1.1  itohy # define NJSC32_FIFO_FULL_PIO_MMIO	0x40
    332       1.1  itohy # define NJSC32_FIFO_FULL_BUSMASTER	0x10
    333       1.1  itohy #define NJSC32_IREG_FIFO_THRESHOLD_EMPTY	0x07	/* len=1 R/W */
    334       1.1  itohy # define NJSC32_FIFO_EMPTY_PIO_MMIO	0x40
    335       1.1  itohy # define NJSC32_FIFO_EMPTY_BUSMASTER	0x60
    336       1.1  itohy 
    337       1.1  itohy #define NJSC32_IREG_EXP_ROM		0x08	/* len=1 R/W */
    338       1.1  itohy # define NJSC32_EXPROM_WRITE_ENB	0x01
    339       1.1  itohy # define NJSC32_EXPROM_IO_ACCESS_ENB	0x02
    340       1.1  itohy # define NJSC32_EXPROM_ADR_CLEAR	0x04
    341       1.1  itohy 
    342       1.1  itohy #define NJSC32_IREG_EXP_ROM_ADR		0x09	/* len=1 R/W */
    343       1.1  itohy #define NJSC32_IREG_EXP_ROM_DATA	0x0a	/* len=1 R/W */
    344       1.1  itohy 
    345       1.1  itohy #define NJSC32_IREG_CHIP_MODE		0x0b	/* len=1 RO (Bi only)*/
    346       1.1  itohy # define NJSC32_CHIPMODE_OEM_MASK	0x06
    347       1.1  itohy #  define NJSC32_CHIPMODE_OEM_IODATA	0x00	/* I-O DATA */
    348       1.1  itohy #  define NJSC32_CHIPMODE_OEM_KME	0x02	/* Kyushu Matsushita Electric */
    349       1.1  itohy #  define NJSC32_CHIPMODE_OEM_WORKBIT	0x04	/* Workbit */
    350       1.1  itohy #  define NJSC32_CHIPMODE_OEM_EXTROM	0x06
    351       1.1  itohy # define NJSC32_CHIPMODE_OPTB		0x08
    352       1.1  itohy # define NJSC32_CHIPMODE_OPTC		0x10
    353       1.1  itohy # define NJSC32_CHIPMODE_OPTD		0x20
    354       1.1  itohy # define NJSC32_CHIPMODE_OPTE		0x40
    355       1.1  itohy # define NJSC32_CHIPMODE_OPTF		0x80
    356       1.1  itohy 
    357       1.1  itohy #define NJSC32_IREG_MISC		0x0c	/* len=2 R/W */
    358       1.1  itohy # define NJSC32_MISC_SCSI_DIRECTION_DETECTOR_SELECT	0x0001
    359       1.1  itohy # define NJSC32_MISC_SCSI2HOST_DIRECTION_VALID		0x0002	/* RO */
    360       1.1  itohy # define NJSC32_MISC_HOST2SCSI_DIRECTION_VALID		0x0004	/* RO */
    361       1.1  itohy # define NJSC32_MISC_DELAYED_BMSTART			0x0008
    362       1.1  itohy # define NJSC32_MISC_MASTER_TERMINATION_SELECT		0x0010
    363       1.1  itohy # define NJSC32_MISC_BMREQ_NEGATE_TIMING_SEL		0x0020
    364       1.1  itohy # define NJSC32_MISC_AUTOSEL_TIMING_SEL			0x0040
    365       1.1  itohy # define NJSC32_MISC_MABORT_MASK			0x0080	/* (UDE) */
    366       1.1  itohy # define NJSC32_MISC_BMSTOP_CHANGE2_NONDATA_PHASE	0x0100	/* (UDE) */
    367       1.1  itohy 
    368       1.1  itohy #define NJSC32_IREG_BM			0x0d	/* len=1 R/W */
    369       1.1  itohy # define NJSC32_BM_CYCLE0			0x01
    370       1.1  itohy # define NJSC32_BM_CYCLE1			0x02
    371       1.1  itohy # define NJSC32_BM_FRAME_ASSERT_TIMING		0x04
    372       1.1  itohy # define NJSC32_BM_IRDY_ASSERT_TIMING		0x08
    373       1.1  itohy # define NJSC32_BM_SINGLE_MASTER		0x10
    374       1.1  itohy # define NJSC32_BM_MEMRD_CMD0			0x20
    375       1.1  itohy # define NJSC32_BM_SGT_AUTO_PARA_MEMRD_CMD	0x40
    376       1.1  itohy # define NJSC32_BM_MEMRD_CMD1			0x80
    377       1.1  itohy 
    378       1.1  itohy #define NJSC32_IREG_UP_CNT		0x0f	/* len=1 WO */
    379       1.1  itohy # define NJSC32_UPCNT_REQCNT		0x01
    380       1.1  itohy # define NJSC32_UPCNT_ACKCNT		0x02
    381       1.1  itohy # define NJSC32_UPCNT_BMADR		0x10
    382       1.1  itohy # define NJSC32_UPCNT_BMCNT		0x20
    383       1.1  itohy # define NJSC32_UPCNT_SGTCNT		0x80
    384       1.1  itohy 
    385       1.1  itohy #define NJSC32_IREG_CFG_CMD_STR		0x10	/* len=2 RO */
    386       1.1  itohy 
    387       1.1  itohy #define NJSC32_IREG_CFG_LATE_CACHE	0x11	/* len=2 R/W */
    388       1.1  itohy 
    389       1.1  itohy #define NJSC32_IREG_CFG_BASE_ADR1	0x12	/* len=2 RO */
    390       1.1  itohy #define NJSC32_IREG_CFG_BASE_ADR2	0x13	/* len=2 RO */
    391       1.1  itohy 
    392       1.1  itohy #define NJSC32_IREG_CFG_INLINE		0x14	/* len=2 RO */
    393       1.1  itohy 
    394       1.1  itohy #define NJSC32_IREG_SERIAL_ROM		0x15	/* len=1 R/W (UDE) */
    395       1.1  itohy # define NJSC32_SERIALROM_CLOCK		0x01
    396       1.1  itohy # define NJSC32_SERIALROM_ENABLE	0x02
    397       1.1  itohy # define NJSC32_SERIALROM_DATA		0x04
    398       1.1  itohy 
    399       1.1  itohy #define NJSC32_IREG_HST_POINTER	0x16	/* len=1 R/W */
    400       1.1  itohy 
    401       1.1  itohy #define NJSC32_IREG_SREQ_DELAY		0x17	/* len=1 R/W (UDE) */
    402       1.1  itohy #define NJSC32_IREG_SACK_DELAY		0x18	/* len=1 R/W (UDE) */
    403       1.1  itohy #define NJSC32_IREG_SREQ_NOISE_CANCEL	0x19	/* len=1 R/W (UDE) */
    404       1.1  itohy #define NJSC32_IREG_SDP_NOISE_CANCEL	0x1a	/* len=1 R/W (UDE) */
    405       1.1  itohy #define NJSC32_IREG_DELAY_TEST		0x1b	/* len=1 R/W (UDE) */
    406       1.1  itohy #define NJSC32_IREG_SD0_NOISE_CANCEL	0x20	/* len=1 R/W (UDE) */
    407       1.1  itohy #define NJSC32_IREG_SD1_NOISE_CANCEL	0x21	/* len=1 R/W (UDE) */
    408       1.1  itohy #define NJSC32_IREG_SD2_NOISE_CANCEL	0x22	/* len=1 R/W (UDE) */
    409       1.1  itohy #define NJSC32_IREG_SD3_NOISE_CANCEL	0x23	/* len=1 R/W (UDE) */
    410       1.1  itohy #define NJSC32_IREG_SD4_NOISE_CANCEL	0x24	/* len=1 R/W (UDE) */
    411       1.1  itohy #define NJSC32_IREG_SD5_NOISE_CANCEL	0x25	/* len=1 R/W (UDE) */
    412       1.1  itohy #define NJSC32_IREG_SD6_NOISE_CANCEL	0x26	/* len=1 R/W (UDE) */
    413       1.1  itohy #define NJSC32_IREG_SD7_NOISE_CANCEL	0x27	/* len=1 R/W (UDE) */
    414       1.1  itohy 
    415       1.1  itohy /*
    416       1.1  itohy  * DMA data structure
    417       1.1  itohy  */
    418       1.1  itohy 
    419       1.1  itohy /* scatter/gather transfer table entry (8 bytes) */
    420       1.1  itohy struct njsc32_sgtable {
    421       1.1  itohy 	u_int32_t	sg_addr;	/* transfer address (little endian) */
    422       1.1  itohy 	u_int32_t	sg_len;		/* transfer length (little endian) */
    423       1.1  itohy #define NJSC32_SGT_ENDMARK	0x80000000
    424       1.1  itohy #define NJSC32_SGT_MAXSEGLEN	0x10000
    425       1.1  itohy };
    426       1.1  itohy #define NJSC32_SGT_MAXENTRY	18
    427       1.1  itohy 
    428       1.1  itohy /* autoparam (88 bytes) */
    429       1.1  itohy #define NJSC32_AUTOPARAM_CDBLEN	16
    430       1.1  itohy struct njsc32_autoparam {
    431       1.1  itohy 	struct njsc32_autoparam_cdb {
    432       1.1  itohy 		u_int8_t	cdb_data;
    433       1.1  itohy 		u_int8_t	cdb_reserved0, cdb_reserved1, cdb_reserved2;
    434       1.1  itohy 	} ap_cdb[NJSC32_AUTOPARAM_CDBLEN];	/* Command Descriptor Block */
    435       1.1  itohy 	u_int32_t	ap_msgout;	/* msgout buffer (little endian) */
    436       1.1  itohy 	u_int8_t	ap_sync;	/* NJSC32_REG_SYNC */
    437       1.1  itohy 	u_int8_t	ap_ackwidth;	/* NJSC32_REG_ACK_WIDTH */
    438       1.1  itohy 	u_int8_t	ap_targetid;	/* initiator and target id */
    439       1.1  itohy 	u_int8_t	ap_sample;	/* NJSC32_REG_SREQ_SAMPLING */
    440       1.1  itohy 	u_int16_t	ap_cmdctl;	/* command control (little endian) */
    441       1.1  itohy 	u_int16_t	ap_xferctl;	/* transfer control (little endian) */
    442       1.1  itohy 	u_int32_t	ap_sgtdmaaddr;	/* SG table addr (little endian) */
    443       1.1  itohy 	u_int32_t	ap_pad[2];
    444       1.1  itohy };
    445       1.1  itohy 
    446       1.1  itohy /*
    447       1.1  itohy  * device specific constants
    448       1.1  itohy  */
    449       1.1  itohy 
    450       1.1  itohy #define NJSC32_NTARGET		8	/* Narrow SCSI */
    451       1.1  itohy #define NJSC32_NLU		8
    452       1.1  itohy 
    453       1.1  itohy #define NJSC32_INITIATOR_ID	7	/* fixed value? */
    454       1.1  itohy #define NJSC32_MAX_TARGET_ID	6	/* 0..6 */
    455       1.1  itohy 
    456       1.1  itohy #endif	/* _NJSC32REG_H_ */
    457