167468Snon/*	$FreeBSD$	*/
279697Snon/*	$NecBSD: nspreg.h,v 1.4.14.3 2001/06/29 06:27:53 honda Exp $	*/
367468Snon/*	$NetBSD$	*/
467468Snon
5139749Simp/*-
667468Snon * [NetBSD for NEC PC-98 series]
767468Snon *  Copyright (c) 1998
867468Snon *	NetBSD/pc98 porting staff. All rights reserved.
967468Snon *
1067468Snon *  Redistribution and use in source and binary forms, with or without
1167468Snon *  modification, are permitted provided that the following conditions
1267468Snon *  are met:
1367468Snon *  1. Redistributions of source code must retain the above copyright
1467468Snon *     notice, this list of conditions and the following disclaimer.
1567468Snon *  2. Redistributions in binary form must reproduce the above copyright
1667468Snon *     notice, this list of conditions and the following disclaimer in the
1767468Snon *     documentation and/or other materials provided with the distribution.
1867468Snon *  3. The name of the author may not be used to endorse or promote products
1967468Snon *     derived from this software without specific prior written permission.
2067468Snon *
2167468Snon * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2267468Snon * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2367468Snon * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2467468Snon * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
2567468Snon * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2667468Snon * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2767468Snon * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2867468Snon * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
2967468Snon * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
3067468Snon * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3167468Snon * POSSIBILITY OF SUCH DAMAGE.
3267468Snon */
3367468Snon
3467468Snon#ifndef	_NSPREG_H_
3567468Snon#define	_NSPREG_H_
3667468Snon
3767468Snon/* base registers */
3867468Snon#define	nsp_irqcr	0
3967468Snon#define	IRQCR_RESCL	0x01
4067468Snon#define	IRQCR_PHCL	0x02
4167468Snon#define	IRQCR_TIMERCL	0x04
4267468Snon#define	IRQCR_FIFOCL	0x08
4367468Snon#define	IRQCR_SCSIIDIS	0x10
4467468Snon#define	IRQCR_EXTIDIS	0x20
4567468Snon#define	IRQCR_TIMERIDIS	0x40
4667468Snon#define	IRQCR_FIFOIDIS	0x80
4767468Snon#define	IRQCR_ALLMASK	0xff
4867468Snon#define	IRQCR_IRQDIS	0xf0
4967468Snon
5067468Snon#define	nsp_irqsr	0
5167468Snon#define	IRQSR_SCSI	0x01
5267468Snon#define	IRQSR_EXT	0x02
5367468Snon#define	IRQSR_TIMER	0x04
5467468Snon#define	IRQSR_FIFO	0x08
5567468Snon#define	IRQSR_MASK	0x0f
5667468Snon
5767468Snon#define	nsp_ifselr	1
5867468Snon#define	IFSELR_IFSEL	0x01
5967468Snon#define	IFSELR_REGSEL	0x04
6067468Snon
6167468Snon#define	nsp_fifosr	1
6267468Snon#define	FIFOSR_CHIPREVM	0x0f
6367468Snon#define	FIFOSR_CHIPIDM	0x70
6467468Snon#define	FIFOSR_FULLEMP	0x80
6567468Snon
6667468Snon#define	nsp_idxr	2
6767468Snon#define	nsp_datar	3
6867468Snon#define	nsp_fifodr	4
6967468Snon
7067468Snon/* indexed registers */
7167468Snon#define	NSPR_EXTBUSC	0x10
7267468Snon
7367468Snon#define	NSPR_CLKDIVR	0x11
7467468Snon#define	CLKDIVR_40M	0x02
7567468Snon#define	CLKDIVR_20M	0x01
7667468Snon
7767468Snon#define	NSPR_TERMPWRC	0x13
7867468Snon#define	TERMPWRC_POWON	0x01
7967468Snon
8067468Snon#define	NSPR_SCIENR	0x15
8167468Snon#define	SCIENR_SCCHG	0x01
8267468Snon#define	SCIENR_RESEL	0x10
8367468Snon#define	SCIENR_FIFO	0x20
8467468Snon#define	SCIENR_RST	0x40
8567468Snon
8667468Snon#define	NSPR_IRQPHS	0x16
8767468Snon#define	IRQPHS_LMSG	0x01
8867468Snon#define	IRQPHS_LIO	0x02
8967468Snon#define	IRQPHS_LCD	0x04
9067468Snon#define	IRQPHS_LBF	0x08
9167468Snon#define	IRQPHS_PCHG	0x10
9267468Snon#define	IRQPHS_RSEL	0x20
9367468Snon#define	IRQPHS_FIFO	0x40
9467468Snon#define	IRQPHS_RST	0x80
9579697Snon#define	IRQPHS_PHMASK   (IRQPHS_LCD | IRQPHS_LMSG | IRQPHS_LIO)
9667468Snon
9767468Snon#define	NSPR_TIMERCNT	0x17
9867468Snon
9967468Snon#define NSPR_SCBUSCR	0x18
10067468Snon#define	SCBUSCR_SEL	0x01
10167468Snon#define	SCBUSCR_RST	0x02
10267468Snon#define	SCBUSCR_DOUT	0x04
10367468Snon#define	SCBUSCR_ATN	0x08
10467468Snon#define	SCBUSCR_ACK	0x10
10567468Snon#define	SCBUSCR_BSY	0x20
10667468Snon#define	SCBUSCR_ADIR	0x40
10767468Snon#define	SCBUSCR_ACKEN	0x80
10867468Snon
10967468Snon#define	NSPR_SCBUSMON	0x19
11067468Snon#define	SCBUSMON_MSG	0x01
11167468Snon#define	SCBUSMON_IO	0x02
11267468Snon#define	SCBUSMON_CD	0x04
11367468Snon#define	SCBUSMON_BSY	0x08
11467468Snon#define	SCBUSMON_ACK	0x10
11567468Snon#define	SCBUSMON_REQ	0x20
11667468Snon#define	SCBUSMON_SEL	0x40
11767468Snon#define SCBUSMON_ATN	0x80
11867468Snon
11967468Snon#define	NSPR_SETARBIT	0x1A
12067468Snon
12167468Snon#define	NSPR_ARBITS	0x1A
12267468Snon#define	ARBITS_EXEC	0x01
12367468Snon#define	ARBITS_CLR	0x02
12467468Snon#define	ARBITS_WIN	0x02
12567468Snon#define	ARBITS_FAIL	0x04
12667468Snon#define	ARBITS_RESEL	0x08
12767468Snon
12867468Snon#define	NSPR_PARITYR	0x1B	/* (W/R) */
12979697Snon#define	PARITYR_ENABLE	0x01
13079697Snon#define	PARITYR_CLEAR	0x02
13179697Snon#define	PARITYR_PE	0x02
13267468Snon
13367468Snon#define	NSPR_CMDCR	0x1C	/* (W) */
13467468Snon#define	CMDCR_PTCLR	0x01
13567468Snon#define	CMDCR_EXEC	0x02
13667468Snon
13767468Snon#define	NSPR_RESELR	0x1C	/* (R) */
13867468Snon#define	NSPR_CMDDR	0x1D	/* (W/R) */
13967468Snon
14067468Snon#define	NSPR_PTCLRR	0x1E	/* (W) */
14167468Snon#define	PTCLRR_PT	0x01
14267468Snon#define	PTCLRR_ACK	0x02
14367468Snon#define	PTCLRR_REQ	0x04
14467468Snon#define	PTCLRR_HOST	0x08
14567468Snon#define	PTCLRR_RSS	0x30
14679697Snon#define	PTCLRR_RSS_ACK	0x00
14779697Snon#define	PTCLRR_RSS_REQ	0x10
14879697Snon#define	PTCLRR_RSS_HOST	0x20
14967468Snon
15067468Snon#define	NSPR_XFERCR	0x1E	/* (R) */
15167468Snon
15267468Snon#define	NSPR_XFERMR	0x20
15367468Snon#define	XFERMR_MEM8	0x01
15467468Snon#define	XFERMR_MEM32	0x02
15567468Snon#define	XFERMR_ADR24	0x04
15667468Snon#define	XFERMR_ADR32	0x08
15767468Snon#define	XFERMR_IO8	0x10
15867468Snon#define	XFERMR_IO32	0x20
15967468Snon#define	XFERMR_XEN	0x40
16067468Snon#define	XFERMR_FIFOEN	0x80
16167468Snon
16267468Snon#define	NSPR_SYNCR	0x21
16367468Snon#define	SYNCR_OFFM	0x0f
16467468Snon#define	SYNCR_PERM	0xf0
16567468Snon#define	SYNCR_PERS	4
16667468Snon
16767468Snon#define	NSPR_DATA	0x22
16867468Snon#define	NSPR_DATAACK	0x23
16967468Snon#define	NSPR_OCR	0x26
17067468Snon#define	OCR_ROMEN	0x01
17167468Snon#define	OCR_TERMPWROUT	0x02
17267468Snon#define	OCR_TERMPWRS	0x04
17367468Snon
17467468Snon#define NSPR_ACKWIDTH	0x27
17567468Snon
17667468Snon/* SCBUSMON phase defs */
17767468Snon#define	SCBUSMON_FREE	0
17867468Snon#define	SCBUSMON_CMD \
17967468Snon	(SCBUSMON_BSY | SCBUSMON_CD | SCBUSMON_REQ)
18067468Snon#define	SCBUSMON_MSGIN \
18167468Snon	(SCBUSMON_BSY | SCBUSMON_MSG | SCBUSMON_IO | SCBUSMON_CD | SCBUSMON_REQ)
18267468Snon#define	SCBUSMON_MSGOUT \
18367468Snon	(SCBUSMON_BSY | SCBUSMON_MSG | SCBUSMON_CD | SCBUSMON_REQ)
18467468Snon#define	SCBUSMON_DATAIN \
18567468Snon	(SCBUSMON_BSY | SCBUSMON_IO | SCBUSMON_REQ)
18667468Snon#define	SCBUSMON_DATAOUT \
18767468Snon	(SCBUSMON_BSY | SCBUSMON_REQ)
18867468Snon#define	SCBUSMON_STATUS \
18967468Snon	(SCBUSMON_BSY | SCBUSMON_IO | SCBUSMON_CD | SCBUSMON_REQ)
19067468Snon#define	SCBUSMON_RESELECT \
19167468Snon	(SCBUSMON_SEL | SCBUSMON_IO)
19267468Snon#define	SCBUSMON_PHMASK \
19367468Snon	(SCBUSMON_SEL | SCBUSMON_CD | SCBUSMON_MSG | SCBUSMON_IO)
19467468Snon
19579697Snon/* Data phase */
19679697Snon#define	NSP_IS_PHASE_DATA(ph) \
19779697Snon	((((ph) & SCBUSMON_PHMASK) & ~SCBUSMON_IO) == 0)
19879697Snon#define	NSP_IS_IRQPHS_DATA(ph) \
19979697Snon	((((ph) & IRQPHS_PHMASK) & ~SCBUSMON_IO) == 0)
20079697Snon
20167468Snon/* SCSI phase */
20267468Snon#define	PHASE_CMD	(SCBUSMON_CMD & SCBUSMON_PHMASK)
20367468Snon#define	PHASE_DATAIN	(SCBUSMON_DATAIN & SCBUSMON_PHMASK)
20467468Snon#define	PHASE_DATAOUT	(SCBUSMON_DATAOUT & SCBUSMON_PHMASK)
20567468Snon#define	PHASE_STATUS	(SCBUSMON_STATUS & SCBUSMON_PHMASK)
20667468Snon#define	PHASE_MSGIN	(SCBUSMON_MSGIN & SCBUSMON_PHMASK)
20767468Snon#define	PHASE_MSGOUT	(SCBUSMON_MSGOUT & SCBUSMON_PHMASK)
20867468Snon#define	PHASE_SEL	(SCBUSMON_SEL | SCBUSMON_IO)
20967468Snon
21079697Snon#define	IRQPHS_CMD	(IRQPHS_LCD)
21179697Snon#define	IRQPHS_DATAIN	(IRQPHS_LIO)
21279697Snon#define	IRQPHS_DATAOUT	(0)
21379697Snon#define	IRQPHS_STATUS	(IRQPHS_LCD | IRQPHS_LIO)
21479697Snon#define	IRQPHS_MSGIN	(IRQPHS_LCD | IRQPHS_LMSG | IRQPHS_LIO)
21579697Snon#define	IRQPHS_MSGOUT	(IRQPHS_LCD | IRQPHS_LMSG)
21679697Snon
21767468Snon/* Size */
21867468Snon#define	NSP_MEMSIZE	NBPG
21967468Snon#define	NSP_IOSIZE	16
22067468Snon#define	NSP_BUFFER_SIZE	512
22167468Snon#endif	/* !_NSPREG_H_ */
222