1 /*        $NetBSD: nexus.h,v 1.27 2011/06/05 16:59:21 matt Exp $      */
2 
3 /*-
4  * Copyright (c) 1982, 1986 The Regents of the University of California.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. Neither the name of the University nor the names of its contributors
16  *    may be used to endorse or promote products derived from this software
17  *    without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29  * SUCH DAMAGE.
30  *
31  *        @(#)nexus.h         7.3 (Berkeley) 5/9/91
32  */
33 
34 /*
35  * ABus support added by Johnny Billquist 2010.
36  */
37 
38 #ifndef _VAX_NEXUS_H_
39 #define _VAX_NEXUS_H_
40 
41 #include <machine/bus.h>
42 
43 #ifdef _KERNEL
44 #include "opt_cputype.h"
45 #endif
46 /*
47  * Different definitions for nicer autoconf probing.
48  */
49 enum bustypes {
50           VAX_SBIBUS,                   /* SBI parent (780) */
51           VAX_CMIBUS,                   /* CMI backplane (750) */
52           VAX_UNIBUS,                   /* Direct backplane (730) */
53           VAX_ABUS,           /* ABus (8600) */
54           VAX_BIBUS,                    /* BI bus (8200) */
55           VAX_NMIBUS,                   /* NMI backplane (8800) */
56           VAX_VSBUS,                    /* Virtual vaxstation bus */
57           VAX_IBUS,           /* Internal Microvax bus */
58           VAX_XMIBUS,                   /* XMI master bus (6000) */
59 };
60 /*
61  * Information about nexus's.
62  *
63  * Each machine has an address of backplane slots (nexi).
64  * Each nexus is some type of adapter, whose code is the low
65  * byte of the first word of the adapter address space.
66  * At boot time the system looks through the array of available
67  * slots and finds the interconnects for the machine.
68  *
69  * VAX8600 nexus information is located in ioa.h
70  */
71 #define IO_CMI750       2
72 #define MAXNMCR         1
73 
74 #define   NNEXSBI             16
75 #if VAX780 || VAXANY
76 #define   NNEX780   NNEXSBI
77 #define   NEX780    ((struct nexus *)0x20000000)
78 #endif
79 #if VAX730 || VAXANY
80 #define   NNEX730   NNEXSBI
81 #define   NEX730    ((struct nexus *)0xf20000)
82 #endif
83 #define   NEXSIZE   0x2000
84 
85 #ifdef _KERNEL
86 
87 struct    nexus {
88           union nexcsr {
89                     long      nex_csr;
90                     u_char    nex_type;
91           } nexcsr;
92           long      nex_pad[NEXSIZE / sizeof (long) - 1];
93 };
94 
95 struct abus_attach_args {
96         const char *aa_name;
97         int aa_type;
98         bus_addr_t aa_base;
99         int aa_num;
100           bus_space_tag_t aa_iot;
101           bus_space_handle_t aa_ioh;
102           bus_dma_tag_t aa_dmat;
103 };
104 
105 struct sbi_attach_args {
106           int sa_nexnum;                /* This nexus TR number */
107           int sa_type;                  /* This nexus type */
108           int sa_sbinum;
109           bus_space_tag_t sa_iot;
110           bus_space_handle_t sa_ioh;
111           bus_dma_tag_t sa_dmat;
112         bus_addr_t sa_base;
113 };
114 
115 /* Memory device struct. This should be somewhere else */
116 struct mem_softc {
117           device_t sc_dev;
118           void *    sc_memaddr;
119           int       sc_memtype;
120           int       sc_memnr;
121 };
122 
123 struct ibus_attach_args {
124           const char *ia_type;
125           int ia_num;
126           int ia_partyp;
127           paddr_t ia_addr;
128 };
129 #endif
130 
131 /*
132  * Bits in high word of nexus's.
133  */
134 #define   SBI_PARFLT          (1<<31)             /* sbi parity fault */
135 #define   SBI_WSQFLT          (1<<30)             /* write sequence fault */
136 #define   SBI_URDFLT          (1<<29)             /* unexpected read data fault */
137 #define   SBI_ISQFLT          (1<<28)             /* interlock sequence fault */
138 #define   SBI_MXTFLT          (1<<27)             /* multiple transmitter fault */
139 #define   SBI_XMTFLT          (1<<26)             /* transmit fault */
140 
141 #define   NEX_CFGFLT          (0xfc000000)
142 
143 #ifndef _LOCORE
144 #if VAX780 || VAX8600 || VAXANY
145 #define   NEXFLT_BITS \
146 "\20\40PARFLT\37WSQFLT\36URDFLT\35ISQFLT\34MXTFLT\33XMTFLT"
147 #endif
148 #endif
149 
150 #define   NEX_APD             (1<<23)             /* adaptor power down */
151 #define   NEX_APU             (1<<22)             /* adaptor power up */
152 
153 #define   MBA_OT              (1<<21)             /* overtemperature */
154 
155 #define   UBA_UBINIT          (1<<18)             /* unibus init */
156 #define   UBA_UBPDN (1<<17)             /* unibus power down */
157 #define   UBA_UBIC  (1<<16)             /* unibus initialization complete */
158 
159 /*
160  * Types for nex_type.
161  */
162 #define   NEX_ANY             0                   /* pseudo for handling 11/750 */
163 #define   NEX_MEM4  0x08                /* 4K chips, non-interleaved mem */
164 #define   NEX_MEM4I 0x09                /* 4K chips, interleaved mem */
165 #define   NEX_MEM16 0x10                /* 16K chips, non-interleaved mem */
166 #define   NEX_MEM16I          0x11                /* 16K chips, interleaved mem */
167 #define   NEX_MBA             0x20                /* Massbus adaptor */
168 #define   NEX_UBA0  0x28                /* Unibus adaptor */
169 #define   NEX_UBA1  0x29                /* 4 flavours for 4 addr spaces */
170 #define   NEX_UBA2  0x2a
171 #define   NEX_UBA3  0x2b
172 #define   NEX_DR32  0x30                /* DR32 user i'face to SBI */
173 #define   NEX_CI              0x38                /* CI adaptor */
174 #define   NEX_MPM0  0x40                /* Multi-port mem */
175 #define   NEX_MPM1  0x41                /* Who knows why 4 different ones ? */
176 #define   NEX_MPM2  0x42
177 #define   NEX_MPM3  0x43
178 #define   NEX_MEM64L          0x68                /* 64K chips, non-interleaved, lower */
179 #define   NEX_MEM64LI         0x69                /* 64K chips, ext-interleaved, lower */
180 #define   NEX_MEM64U          0x6a                /* 64K chips, non-interleaved, upper */
181 #define   NEX_MEM64UI         0x6b                /* 64K chips, ext-interleaved, upper */
182 #define   NEX_MEM64I          0x6c                /* 64K chips, interleaved */
183 #define   NEX_MEM256L         0x70                /* 256K chips, non-interleaved, lower */
184 #define   NEX_MEM256LI        0x71                /* 256K chips, ext-interleaved, lower */
185 #define   NEX_MEM256U         0x72                /* 256K chips, non-interleaved, upper */
186 #define   NEX_MEM256UI        0x73                /* 256K chips, ext-interleaved, upper */
187 #define   NEX_MEM256I         0x74                /* 256K chips, interleaved */
188 
189 /* Memory classes */
190 #define   M_NONE              0
191 #define   M780C               1
192 #define   M780EL              2
193 #define   M780EU              3
194 
195 /* Memory recover defines */
196 #define   MCHK_PANIC          -1
197 #define   MCHK_RECOVERED      0
198 
199 #endif /* _VAX_NEXUS_H_ */
200