autoconf.h revision 1.9 1 /* $NetBSD: autoconf.h,v 1.9 1997/07/25 06:59:47 cgd Exp $ */
2
3 /*
4 * Copyright (c) 1994, 1995, 1996 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 /*
84 * The boot program passes a pointer to a bootinfo to the kernel
85 * using the following convention:
86 *
87 * a0 contains first free page frame number
88 * a1 contains page number of current level 1 page table
89 * if a2 contains BOOTINFO_MAGIC:
90 * a3 contains (boot env. virtual) address of bootinfo
91 */
92
93 #define BOOTINFO_MAGIC 0xdeadbeeffeedface
94
95 struct bootinfo_v1 {
96 u_long ssym; /* 0: start of kernel sym table */
97 u_long esym; /* 8: end of kernel sym table */
98 char boot_flags[64]; /* 16: boot flags */
99 char booted_kernel[64]; /* 80: name of booted kernel */
100 void *hwrpb; /* 144: hwrpb pointer */
101 int (*cngetc) __P((void)); /* 152: console getc pointer */
102 void (*cnputc) __P((int)); /* 160: console putc pointer */
103 void (*cnpollc) __P((int)); /* 168: console pollc pointer */
104 /* 176: total size */
105 };
106
107 struct bootinfo {
108 u_long version; /* 0: version number */
109 union { /* 8: union: */
110 struct bootinfo_v1 v1; /* version 1 boot info */
111 char pad[256]; /* space rsvd for future use */
112 } un; /* */
113 /* 264: total size */
114 };
115
116 #ifdef EVCNT_COUNTERS
117 extern struct evcnt clock_intr_evcnt;
118 #endif
119
120 extern struct device *booted_device;
121 extern int booted_partition;
122 extern struct bootdev_data *bootdev_data;
123