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