FreeBSD/Linux Kernel Cross Reference
sys/chips/busses.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1993-1989 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: busses.h,v $
29 * Revision 2.10 93/11/17 16:10:43 dbg
30 * Import mach/machine/vm_types.h for vm_offset_t.
31 * [93/06/11 dbg]
32 *
33 * Revision 2.9 93/05/10 20:07:21 rvb
34 * No more caddr_t.
35 * [93/04/09 af]
36 *
37 * Revision 2.8 93/01/14 17:15:13 danner
38 * Added BUS_CTLR flag. Use on machines that truly have bus
39 * adaptors, and write a probe function for it.
40 * This was the grand plan from the beginning, alpha now does it.
41 * [92/11/30 af]
42 *
43 * Revision 2.7 91/08/24 11:51:27 af
44 * Mods to cope with the 386 PC/AT ISA bus.
45 * [91/06/20 af]
46 *
47 * Revision 2.7 91/06/19 11:46:25 rvb
48 * File moved here from mips/PMAX since it tries to be generic;
49 * it is used on the PMAX and the Vax3100.
50 * [91/06/04 rvb]
51 *
52 * Revision 2.6 91/05/14 17:32:30 mrt
53 * Correcting copyright
54 *
55 * Revision 2.5 91/02/05 17:47:09 mrt
56 * Added author notices
57 * [91/02/04 11:21:07 mrt]
58 *
59 * Changed to use new Mach copyright
60 * [91/02/02 12:24:40 mrt]
61 *
62 * Revision 2.4 90/12/05 23:50:20 af
63 *
64 *
65 * Revision 2.3 90/12/05 20:49:31 af
66 * Made reentrant.
67 * New flag defs for new TC autoconf code. Defs for exported funcs.
68 * [90/12/03 23:01:22 af]
69 *
70 * Revision 2.2 90/08/07 22:21:08 rpd
71 *
72 * Created.
73 * [90/04/18 af]
74 *
75 */
76 /*
77 * File: busses.h
78 * Author: Alessandro Forin, Carnegie Mellon University
79 * Date: 4/90
80 *
81 * Structures used by configuration routines to
82 * explore a given bus structure.
83 */
84
85 #ifndef _CHIPS_BUSSES_H_
86 #define _CHIPS_BUSSES_H_
87
88 #include <mach/boolean.h>
89 #include <mach/machine/vm_types.h>
90
91 /*
92 *
93 * This is mildly modeled after the Unibus on Vaxen,
94 * one of the most complicated bus structures.
95 * Therefore, let's hope this can be done once and for all.
96 *
97 * At the bottom level there is a "bus_device", which
98 * might exist in isolation (e.g. a clock on the CPU
99 * board) or be a standard component of an architecture
100 * (e.g. the bitmap display on some workstations).
101 *
102 * Disk devices and communication lines support multiple
103 * units, hence the "bus_driver" structure which is more
104 * flexible and allows probing and dynamic configuration
105 * of the number and type of attached devices.
106 *
107 * At the top level there is a "bus_ctlr" structure, used
108 * in systems where the I/O bus(ses) are separate from
109 * the memory bus(ses), and/or when memory boards can be
110 * added to the main bus (and they must be config-ed
111 * and/or can interrupt the processor for ECC errors).
112 *
113 * The autoconfiguration process typically starts at
114 * the top level and walks down tables that are
115 * defined either in a generic file or are specially
116 * created by config(1).
117 */
118
119
120 /*
121 * Per-controller structure.
122 */
123 struct bus_ctlr {
124 struct bus_driver *driver; /* myself, as a device */
125 char *name; /* readability */
126 int unit; /* index in driver */
127 int (*intr)(); /* interrupt handler(s) */
128 vm_offset_t address; /* device virtual address */
129 int am; /* address modifier */
130 vm_offset_t phys_address;/* device phys address */
131 char adaptor; /* slot where found */
132 char alive; /* probed successfully */
133 char flags; /* any special conditions */
134 vm_offset_t sysdep; /* On some systems, queue of
135 * operations in-progress */
136 natural_t sysdep1; /* System dependent */
137 };
138
139
140 /*
141 * Per-``device'' structure
142 */
143 struct bus_device {
144 struct bus_driver *driver; /* autoconf info */
145 char *name; /* my name */
146 int unit;
147 int (*intr)();
148 vm_offset_t address; /* device address */
149 int am; /* address modifier */
150 vm_offset_t phys_address;/* device phys address */
151 char adaptor;
152 char alive;
153 char ctlr;
154 char slave;
155 int flags;
156 struct bus_ctlr *mi; /* backpointer to controller */
157 struct bus_device *next; /* optional chaining */
158 vm_offset_t sysdep; /* System dependent */
159 natural_t sysdep1; /* System dependent */
160 };
161
162 /*
163 * General flag definitions
164 */
165 #define BUS_INTR_B4_PROBE 0x01 /* enable interrupts before probe */
166 #define BUS_INTR_DISABLED 0x02 /* ignore all interrupts */
167 #define BUS_CTLR 0x04 /* descriptor for a bus adaptor */
168 #define BUS_XCLU 0x80 /* want exclusive use of bdp's */
169
170 /*
171 * Per-driver structure.
172 *
173 * Each bus driver defines entries for a set of routines
174 * that are used at boot time by the configuration program.
175 */
176 struct bus_driver {
177 int (*probe)(vm_offset_t,
178 struct bus_ctlr *); /* see if the driver is there */
179 int (*slave)(
180 struct bus_device *,
181 vm_offset_t); /* see if any slave is there */
182 void (*attach)(struct bus_device *); /* setup driver after probe */
183 int (*dgo)(); /* start transfer */
184 vm_offset_t *addr; /* device csr addresses */
185 char *dname; /* name of a device */
186 struct bus_device **dinfo; /* backpointers to init structs */
187 char *mname; /* name of a controller */
188 struct bus_ctlr **minfo; /* backpointers to init structs */
189 int flags;
190 };
191
192 #ifdef KERNEL
193 extern struct bus_ctlr bus_master_init[];
194 extern struct bus_device bus_device_init[];
195
196 extern boolean_t configure_bus_master(char*, vm_offset_t, vm_offset_t, int, char* );
197 extern boolean_t configure_bus_device(char*, vm_offset_t, vm_offset_t, int, char* );
198 #endif /* KERNEL */
199
200
201 #endif /* _CHIPS_BUSSES_H_ */
Cache object: 54f505979a9ffb11eefc450e79df2d2e
|