xref: /netbsd-src/sys/arch/sparc/dev/swreg.h (revision ce099b40997c43048fb78bd578195f81d2456523)
1*ce099b40Smartin /*	$NetBSD: swreg.h,v 1.5 2008/04/28 20:23:35 martin Exp $	*/
2e2b1b6cdSpk 
3e2b1b6cdSpk /*-
4e2b1b6cdSpk  * Copyright (c) 2000 The NetBSD Foundation, Inc.
5e2b1b6cdSpk  * All rights reserved.
6e2b1b6cdSpk  *
7e2b1b6cdSpk  * This code is derived from software contributed to The NetBSD Foundation
8e2b1b6cdSpk  * by Paul Kranenburg.
9e2b1b6cdSpk  *
10e2b1b6cdSpk  * Redistribution and use in source and binary forms, with or without
11e2b1b6cdSpk  * modification, are permitted provided that the following conditions
12e2b1b6cdSpk  * are met:
13e2b1b6cdSpk  * 1. Redistributions of source code must retain the above copyright
14e2b1b6cdSpk  *    notice, this list of conditions and the following disclaimer.
15e2b1b6cdSpk  * 2. Redistributions in binary form must reproduce the above copyright
16e2b1b6cdSpk  *    notice, this list of conditions and the following disclaimer in the
17e2b1b6cdSpk  *    documentation and/or other materials provided with the distribution.
18e2b1b6cdSpk  *
19e2b1b6cdSpk  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20e2b1b6cdSpk  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21e2b1b6cdSpk  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22e2b1b6cdSpk  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23e2b1b6cdSpk  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24e2b1b6cdSpk  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25e2b1b6cdSpk  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26e2b1b6cdSpk  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27e2b1b6cdSpk  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28e2b1b6cdSpk  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29e2b1b6cdSpk  * POSSIBILITY OF SUCH DAMAGE.
30e2b1b6cdSpk  */
31e2b1b6cdSpk 
32e2b1b6cdSpk /*
33e2b1b6cdSpk  * Register map for the Sun3 SCSI Interface (si)
34e2b1b6cdSpk  * The first part of this register map is an NCR5380
35e2b1b6cdSpk  * SCSI Bus Interface Controller (SBIC).  The rest is a
36e2b1b6cdSpk  * DMA controller and custom logic for the OBIO interface (3/50,3/60,4/110)
37e2b1b6cdSpk  *
388476e675Skeihan  * Modified for Sun 4 systems by Jason R. Thorpe <thorpej@NetBSD.org>.
39e2b1b6cdSpk  */
40e2b1b6cdSpk 
41e2b1b6cdSpk /*
42e2b1b6cdSpk  * Note that the obio version on the 4/1xx (the so-called "SCSI Weird", or
43e2b1b6cdSpk  * "sw" controller) is laid out a bit differently, and hence the evilness
44e2b1b6cdSpk  * with unions.  Also, the "sw" doesn't appear to have a FIFO.
45e2b1b6cdSpk  */
46e2b1b6cdSpk 
47e2b1b6cdSpk #if __for_reference_only__
48e2b1b6cdSpk struct sw_regs {
49e2b1b6cdSpk 	/*
50e2b1b6cdSpk 	 * Am5380 Register map (no padding). See dev/ic/ncr5380reg.h
51e2b1b6cdSpk 	 */
52e2b1b6cdSpk 	struct ncr5380regs {
53e2b1b6cdSpk 		u_char r[8];
54e2b1b6cdSpk 	} sci;
55e2b1b6cdSpk 
56e2b1b6cdSpk 	/* DMA controller registers on OBIO */
571ffa7b76Swiz 	u_int	dma_addr;	/* DMA address */
581ffa7b76Swiz 	u_int	dma_count;	/* DMA count */
59e2b1b6cdSpk 	u_int	pad0;		/* no-existent register */
60e2b1b6cdSpk 	u_int	sw_csr;		/* sw control/status */
61e2b1b6cdSpk 	u_int	bpr;		/* sw byte pack */
62e2b1b6cdSpk };
63e2b1b6cdSpk #endif
64e2b1b6cdSpk 
65e2b1b6cdSpk /*
66e2b1b6cdSpk  * Size of NCR5380 registers located at the bottom of the register bank.
67e2b1b6cdSpk  */
68e2b1b6cdSpk #define NCR5380REGS_SZ	8
69e2b1b6cdSpk 
70e2b1b6cdSpk /*
71e2b1b6cdSpk  * Register definition for the `sw' OBIO controller
72e2b1b6cdSpk  */
73e2b1b6cdSpk #define SWREG_DMA_ADDR	(NCR5380REGS_SZ + 0)
74e2b1b6cdSpk #define SWREG_DMA_CNT	(NCR5380REGS_SZ + 4)
75e2b1b6cdSpk #define SWREG_CSR	(NCR5380REGS_SZ + 12)
76e2b1b6cdSpk #define SWREG_BPR	(NCR5380REGS_SZ + 16)
77e2b1b6cdSpk #define SWREG_BANK_SZ	(NCR5380REGS_SZ + 20)
78e2b1b6cdSpk 
79e2b1b6cdSpk /*
80e2b1b6cdSpk  * Status Register.
81e2b1b6cdSpk  * Note:
82e2b1b6cdSpk  *	(r)	indicates bit is read only.
83e2b1b6cdSpk  *	(rw)	indicates bit is read or write.
84e2b1b6cdSpk  *	(v)	vme host adaptor interface only.
85e2b1b6cdSpk  *	(o)	sun3/50 onboard host adaptor interface only.
86e2b1b6cdSpk  *	(b)	both vme and sun3/50 host adaptor interfaces.
87e2b1b6cdSpk  */
881ffa7b76Swiz #define SW_CSR_DMA_ACTIVE	0x8000	/* (r,o) DMA transfer active */
891ffa7b76Swiz #define SW_CSR_DMA_CONFLICT	0x4000	/* (r,b) reg accessed while DMA'ing */
901ffa7b76Swiz #define SW_CSR_DMA_BUS_ERR	0x2000	/* (r,b) bus error during DMA */
91e2b1b6cdSpk #define SW_CSR_ID		0x1000	/* (r,b) 0 for 3/50, 1 for SCSI-3, */
92e2b1b6cdSpk 					/* 0 if SCSI-3 unmodified */
93e2b1b6cdSpk #define SW_CSR_FIFO_FULL	0x0800	/* (r,b) fifo full */
94e2b1b6cdSpk #define SW_CSR_FIFO_EMPTY	0x0400	/* (r,b) fifo empty */
95e2b1b6cdSpk #define SW_CSR_SBC_IP		0x0200	/* (r,b) sbc interrupt pending */
961ffa7b76Swiz #define SW_CSR_DMA_IP		0x0100	/* (r,b) DMA interrupt pending */
971ffa7b76Swiz #define SW_CSR_DMA_EN		0x0010	/* (rw,v) DMA/interrupt enable */
981ffa7b76Swiz #define SW_CSR_SEND		0x0008	/* (rw,b) DMA dir, 1=to device */
99e2b1b6cdSpk #define SW_CSR_INTR_EN		0x0004	/* (rw,b) interrupts enable */
100e2b1b6cdSpk #define SW_CSR_FIFO_RES		0x0002	/* (rw,b) inits fifo, 0=reset */
101e2b1b6cdSpk #define SW_CSR_SCSI_RES		0x0001	/* (rw,b) reset sbc and udc, 0=reset */
102