|
|
1.1 root 1: /*
2: * Mach Operating System
3: * Copyright (c) 1994-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 [email protected]
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: * File: busses.h
28: * Author: Alessandro Forin, Carnegie Mellon University
29: * Date: 4/90
30: *
31: * Structures used by configuration routines to
32: * explore a given bus structure.
33: */
34:
35: #ifndef _CHIPS_BUSSES_H_
36: #define _CHIPS_BUSSES_H_
37:
38: #include <mach/boolean.h>
39: #include <mach/machine/vm_types.h>
40:
41: /*
42: *
43: * This is mildly modeled after the Unibus on Vaxen,
44: * one of the most complicated bus structures.
45: * Therefore, let's hope this can be done once and for all.
46: *
47: * At the bottom level there is a "bus_device", which
48: * might exist in isolation (e.g. a clock on the CPU
49: * board) or be a standard component of an architecture
50: * (e.g. the bitmap display on some workstations).
51: *
52: * Disk devices and communication lines support multiple
53: * units, hence the "bus_driver" structure which is more
54: * flexible and allows probing and dynamic configuration
55: * of the number and type of attached devices.
56: *
57: * At the top level there is a "bus_ctlr" structure, used
58: * in systems where the I/O bus(ses) are separate from
59: * the memory bus(ses), and/or when memory boards can be
60: * added to the main bus (and they must be config-ed
61: * and/or can interrupt the processor for ECC errors).
62: *
63: * The autoconfiguration process typically starts at
64: * the top level and walks down tables that are
65: * defined either in a generic file or are specially
66: * created by config.
67: */
68:
69: /*
70: * Per-controller structure.
71: */
72: struct bus_ctlr {
73: struct bus_driver *driver; /* myself, as a device */
74: char *name; /* readability */
75: int unit; /* index in driver */
76: int (*intr)(); /* interrupt handler(s) */
77: vm_offset_t address; /* device virtual address */
78: int am; /* address modifier */
79: vm_offset_t phys_address;/* device phys address */
80: char adaptor; /* slot where found */
81: char alive; /* probed successfully */
82: char flags; /* any special conditions */
83: vm_offset_t sysdep; /* On some systems, queue of
84: * operations in-progress */
85: natural_t sysdep1; /* System dependent */
86: };
87:
88:
89: /*
90: * Per-``device'' structure
91: */
92: struct bus_device {
93: struct bus_driver *driver; /* autoconf info */
94: char *name; /* my name */
95: int unit;
96: int (*intr)();
97: vm_offset_t address; /* device address */
98: int am; /* address modifier */
99: vm_offset_t phys_address;/* device phys address */
100: char adaptor;
101: char alive;
102: char ctlr;
103: char slave;
104: int flags;
105: struct bus_ctlr *mi; /* backpointer to controller */
106: struct bus_device *next; /* optional chaining */
107: vm_offset_t sysdep; /* System dependent */
108: natural_t sysdep1; /* System dependent */
109: };
110:
111: /*
112: * General flag definitions
113: */
114: #define BUS_INTR_B4_PROBE 0x01 /* enable interrupts before probe */
115: #define BUS_INTR_DISABLED 0x02 /* ignore all interrupts */
116: #define BUS_CTLR 0x04 /* descriptor for a bus adaptor */
117: #define BUS_XCLU 0x80 /* want exclusive use of bdp's */
118:
119: /*
120: * Per-driver structure.
121: *
122: * Each bus driver defines entries for a set of routines
123: * that are used at boot time by the configuration program.
124: */
125: struct bus_driver {
126: int (*probe)( /* see if the driver is there */
127: /* vm_offset_t address,
128: struct bus_ctlr * */ );
129: int (*slave)( /* see if any slave is there */
130: /* struct bus_device *,
131: vm_offset_t */ );
132: void (*attach)( /* setup driver after probe */
133: /* struct bus_device * */);
134: int (*dgo)(); /* start transfer */
135: vm_offset_t *addr; /* device csr addresses */
136: char *dname; /* name of a device */
137: struct bus_device **dinfo; /* backpointers to init structs */
138: char *mname; /* name of a controller */
139: struct bus_ctlr **minfo; /* backpointers to init structs */
140: int flags;
141: };
142:
143: #ifdef KERNEL
144: extern struct bus_ctlr bus_master_init[];
145: extern struct bus_device bus_device_init[];
146:
147: extern boolean_t configure_bus_master(char *, vm_offset_t, vm_offset_t,
148: int, char * );
149: extern boolean_t configure_bus_device(char *, vm_offset_t, vm_offset_t,
150: int, char * );
151: #endif /* KERNEL */
152:
153:
154: #endif /* _CHIPS_BUSSES_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.