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