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