autoconf.h revision 1.2.4.1 1 /* $NetBSD: autoconf.h,v 1.2.4.1 1996/06/13 17:45:34 cgd Exp $ */
2
3 /*
4 * Copyright (c) 1994, 1995 Carnegie-Mellon University.
5 * All rights reserved.
6 *
7 * Author: Chris G. Demetriou
8 *
9 * Permission to use, copy, modify and distribute this software and
10 * its documentation is hereby granted, provided that both the copyright
11 * notice and this permission notice appear in all copies of the
12 * software, derivative works or modified versions, and any portions
13 * thereof, and that both notices appear in supporting documentation.
14 *
15 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18 *
19 * Carnegie Mellon requests users of this software to return to
20 *
21 * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
22 * School of Computer Science
23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890
25 *
26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes.
28 */
29
30 /*
31 * Machine-dependent structures of autoconfiguration
32 */
33
34 struct confargs;
35
36 typedef int (*intr_handler_t) __P((void *));
37
38 struct abus {
39 struct device *ab_dv; /* back-pointer to device */
40 int ab_type; /* bus type (see below) */
41 void (*ab_intr_establish) /* bus's set-handler function */
42 __P((struct confargs *, intr_handler_t, void *));
43 void (*ab_intr_disestablish) /* bus's unset-handler function */
44 __P((struct confargs *));
45 caddr_t (*ab_cvtaddr) /* convert slot/offset to address */
46 __P((struct confargs *));
47 int (*ab_matchname) /* see if name matches driver */
48 __P((struct confargs *, char *));
49 };
50
51 #define BUS_MAIN 1 /* mainbus */
52 #define BUS_TC 2 /* TurboChannel */
53 #define BUS_ASIC 3 /* IOCTL ASIC; under TurboChannel */
54 #define BUS_TCDS 4 /* TCDS ASIC; under TurboChannel */
55
56 #define BUS_INTR_ESTABLISH(ca, handler, val) \
57 (*(ca)->ca_bus->ab_intr_establish)((ca), (handler), (val))
58 #define BUS_INTR_DISESTABLISH(ca) \
59 (*(ca)->ca_bus->ab_intr_establish)(ca)
60 #define BUS_CVTADDR(ca) \
61 (*(ca)->ca_bus->ab_cvtaddr)(ca)
62 #define BUS_MATCHNAME(ca, name) \
63 (*(ca)->ca_bus->ab_matchname)((ca), (name))
64
65 struct confargs {
66 char *ca_name; /* Device name. */
67 int ca_slot; /* Device slot. */
68 int ca_offset; /* Offset into slot. */
69 struct abus *ca_bus; /* bus device resides on. */
70 };
71
72 struct bootdev_data {
73 char *protocol;
74 int bus;
75 int slot;
76 int channel;
77 char *remote_address;
78 int unit;
79 int boot_dev_type;
80 char *ctrl_dev_type;
81 };
82
83 void set_clockintr __P((void));
84 void set_iointr __P((void (*)(void *, int)));
85 int badaddr __P((void *, u_int64_t));
86
87 #ifdef EVCNT_COUNTERS
88 extern struct evcnt clock_intr_evcnt;
89 #endif
90
91 extern struct device *booted_device;
92 extern int booted_partition;
93 extern struct bootdev_data *bootdev_data;
94