|
|
1.1.1.2 root 1: /*
1.1 root 2: * Mach Operating System
3: * Copyright (c) 1993,1992,1991,1990,1989 Carnegie Mellon University
4: * All Rights Reserved.
1.1.1.2 root 5: *
1.1 root 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.
1.1.1.2 root 11: *
1.1 root 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.
1.1.1.2 root 15: *
1.1 root 16: * Carnegie Mellon requests users of this software to return to
1.1.1.2 root 17: *
1.1 root 18: * Software Distribution Coordinator or [email protected]
19: * School of Computer Science
20: * Carnegie Mellon University
21: * Pittsburgh PA 15213-3890
1.1.1.2 root 22: *
1.1 root 23: * any improvements or extensions that they make and grant Carnegie Mellon
24: * the rights to redistribute these changes.
25: */
1.1.1.2 root 26:
1.1.1.3 root 27: #include <kern/printf.h>
1.1 root 28: #include <mach/std_types.h>
29: #include <i386/pic.h>
30: #include <i386/ipl.h>
31: #include <chips/busses.h>
32:
33: /* initialization typecasts */
34: #define SPL_FIVE (vm_offset_t)SPL5
35: #define SPL_SIX (vm_offset_t)SPL6
36: #define SPL_TTY (vm_offset_t)SPLTTY
37:
38:
39: #if NCOM > 0
40: extern struct bus_driver comdriver;
1.1.1.4 ! root 41: #include <i386at/com.h>
1.1 root 42: #endif /* NCOM */
43:
44: #if NLPR > 0
45: extern struct bus_driver lprdriver;
1.1.1.4 ! root 46: #include <i386at/lpr.h>
1.1 root 47: #endif /* NLPR */
48:
49: struct bus_ctlr bus_master_init[] = {
50:
1.1.1.2 root 51: /* driver name unit intr address len phys_address
1.1 root 52: adaptor alive flags spl pic */
53:
1.1.1.3 root 54: {0}
1.1 root 55: };
56:
57:
58: struct bus_device bus_device_init[] = {
59:
1.1.1.2 root 60: /* driver name unit intr address am phys_address
1.1 root 61: adaptor alive ctlr slave flags *mi *next sysdep sysdep */
62:
63: #if NCOM > 0
64: {&comdriver, "com", 0, comintr, 0x3f8, 8, 0x3f8,
65: '?', 0, -1, -1, 0, 0, 0, SPL_TTY, 4},
66: {&comdriver, "com", 1, comintr, 0x2f8, 8, 0x2f8,
67: '?', 0, -1, -1, 0, 0, 0, SPL_TTY, 3},
68: {&comdriver, "com", 2, comintr, 0x3e8, 8, 0x3e8,
69: '?', 0, -1, -1, 0, 0, 0, SPL_TTY, 5},
70: #endif /* NCOM > 0 */
71:
1.1.1.3 root 72: #ifdef MACH_LPR
1.1 root 73: #if NLPR > 0
74: {&lprdriver, "lpr", 0, lprintr, 0x378, 3, 0x378,
75: '?', 0, -1, -1, 0, 0, 0, SPL_TTY, 7},
76: {&lprdriver, "lpr", 0, lprintr, 0x278, 3, 0x278,
77: '?', 0, -1, -1, 0, 0, 0, SPL_TTY, 7},
78: {&lprdriver, "lpr", 0, lprintr, 0x3bc, 3, 0x3bc,
79: '?', 0, -1, -1, 0, 0, 0, SPL_TTY, 7},
80: #endif /* NLPR > 0 */
1.1.1.3 root 81: #endif /* MACH_LPR */
1.1 root 82:
1.1.1.3 root 83: {0}
1.1 root 84: };
85:
86: /*
87: * probeio:
88: *
89: * Probe and subsequently attach devices out on the AT bus.
90: *
91: *
92: */
93: void probeio(void)
94: {
1.1.1.4 ! root 95: struct bus_device *device;
! 96: struct bus_ctlr *master;
! 97: int i = 0;
1.1 root 98:
99: for (master = bus_master_init; master->driver; master++)
100: {
101: if (configure_bus_master(master->name, master->address,
102: master->phys_address, i, "atbus"))
103: i++;
104: }
105:
106: for (device = bus_device_init; device->driver; device++)
107: {
108: /* ignore what we (should) have found already */
109: if (device->alive || device->ctlr >= 0)
110: continue;
111: if (configure_bus_device(device->name, device->address,
112: device->phys_address, i, "atbus"))
113: i++;
114: }
115:
116: #if MACH_TTD
117: /*
118: * Initialize Remote kernel debugger.
119: */
120: ttd_init();
121: #endif /* MACH_TTD */
122: }
123:
124: void take_dev_irq(
1.1.1.4 ! root 125: const struct bus_device *dev)
1.1 root 126: {
127: int pic = (int)dev->sysdep1;
128:
129: if (intpri[pic] == 0) {
130: iunit[pic] = dev->unit;
131: ivect[pic] = dev->intr;
132: intpri[pic] = (int)dev->sysdep;
133: form_pic_mask();
134: } else {
135: printf("The device below will clobber IRQ %d.\n", pic);
136: printf("You have two devices at the same IRQ.\n");
137: printf("This won't work. Reconfigure your hardware and try again.\n");
1.1.1.3 root 138: printf("%s%d: port = %lx, spl = %ld, pic = %d.\n",
1.1 root 139: dev->name, dev->unit, dev->address,
140: dev->sysdep, dev->sysdep1);
141: while (1);
142: }
1.1.1.2 root 143:
1.1 root 144: }
145:
146: void take_ctlr_irq(
1.1.1.4 ! root 147: const struct bus_ctlr *ctlr)
1.1 root 148: {
149: int pic = ctlr->sysdep1;
150: if (intpri[pic] == 0) {
151: iunit[pic] = ctlr->unit;
152: ivect[pic] = ctlr->intr;
153: intpri[pic] = (int)ctlr->sysdep;
154: form_pic_mask();
155: } else {
156: printf("The device below will clobber IRQ %d.\n", pic);
157: printf("You have two devices at the same IRQ. This won't work.\n");
158: printf("Reconfigure your hardware and try again.\n");
159: while (1);
160: }
161: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.