autoconf.h revision 1.2 1 /* $NetBSD: autoconf.h,v 1.2 1995/09/20 04:33:00 jonathan 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 /* Handle device interrupt for given unit of a driver */
37
38 typedef void* intr_arg_t; /* pointer to some softc */
39 typedef int (*intr_handler_t) __P((intr_arg_t));
40
41 struct abus {
42 struct device *ab_dv; /* back-pointer to device */
43 int ab_type; /* bus type (see below) */
44 void (*ab_intr_establish) /* bus's set-handler function */
45 __P((struct confargs *, intr_handler_t, intr_arg_t));
46 void (*ab_intr_disestablish) /* bus's unset-handler function */
47 __P((struct confargs *));
48 caddr_t (*ab_cvtaddr) /* convert slot/offset to address */
49 __P((struct confargs *));
50 int (*ab_matchname) /* see if name matches driver */
51 __P((struct confargs *, char *));
52 };
53
54 #define BUS_MAIN 1 /* mainbus */
55 #define BUS_TC 2 /* TurboChannel */
56 #define BUS_ASIC 3 /* IOCTL ASIC; under TurboChannel */
57 #define BUS_TCDS 4 /* TCDS ASIC; under TurboChannel */
58
59 #define KN02_ASIC_NAME "KN02 " /* very special */
60
61 #define BUS_INTR_ESTABLISH(ca, handler, val) \
62 (*(ca)->ca_bus->ab_intr_establish)((ca), (handler), (val))
63 #define BUS_INTR_DISESTABLISH(ca) \
64 (*(ca)->ca_bus->ab_intr_establish)(ca)
65 #define BUS_CVTADDR(ca) \
66 (*(ca)->ca_bus->ab_cvtaddr)(ca)
67 #define BUS_MATCHNAME(ca, name) \
68 (*(ca)->ca_bus->ab_matchname)((ca), (name))
69
70 struct confargs {
71 char *ca_name; /* Device name. */
72 int ca_slot; /* Device slot (table entry). */
73 int ca_slotpri; /* Device interrupt "priority" */
74 int ca_offset; /* Offset into slot. */
75 struct abus *ca_bus; /* bus device resides on. */
76 };
77
78
79 #ifndef pmax
80 void set_clockintr __P((void (*)(struct clockframe *)));
81 #endif
82 void set_iointr __P((void (*)(void *, int)));
83 int badaddr __P((void *, u_int));
84