autoconf.h revision 1.1 1 1.1 deraadt /*
2 1.1 deraadt * Copyright (c) 1992, 1993
3 1.1 deraadt * The Regents of the University of California. All rights reserved.
4 1.1 deraadt *
5 1.1 deraadt * This software was developed by the Computer Systems Engineering group
6 1.1 deraadt * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
7 1.1 deraadt * contributed to Berkeley.
8 1.1 deraadt *
9 1.1 deraadt * All advertising materials mentioning features or use of this software
10 1.1 deraadt * must display the following acknowledgement:
11 1.1 deraadt * This product includes software developed by the University of
12 1.1 deraadt * California, Lawrence Berkeley Laboratory.
13 1.1 deraadt *
14 1.1 deraadt * Redistribution and use in source and binary forms, with or without
15 1.1 deraadt * modification, are permitted provided that the following conditions
16 1.1 deraadt * are met:
17 1.1 deraadt * 1. Redistributions of source code must retain the above copyright
18 1.1 deraadt * notice, this list of conditions and the following disclaimer.
19 1.1 deraadt * 2. Redistributions in binary form must reproduce the above copyright
20 1.1 deraadt * notice, this list of conditions and the following disclaimer in the
21 1.1 deraadt * documentation and/or other materials provided with the distribution.
22 1.1 deraadt * 3. All advertising materials mentioning features or use of this software
23 1.1 deraadt * must display the following acknowledgement:
24 1.1 deraadt * This product includes software developed by the University of
25 1.1 deraadt * California, Berkeley and its contributors.
26 1.1 deraadt * 4. Neither the name of the University nor the names of its contributors
27 1.1 deraadt * may be used to endorse or promote products derived from this software
28 1.1 deraadt * without specific prior written permission.
29 1.1 deraadt *
30 1.1 deraadt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
31 1.1 deraadt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 1.1 deraadt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33 1.1 deraadt * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
34 1.1 deraadt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35 1.1 deraadt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
36 1.1 deraadt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
37 1.1 deraadt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38 1.1 deraadt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
39 1.1 deraadt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40 1.1 deraadt * SUCH DAMAGE.
41 1.1 deraadt *
42 1.1 deraadt * @(#)autoconf.h 8.1 (Berkeley) 6/11/93
43 1.1 deraadt *
44 1.1 deraadt * from: Header: autoconf.h,v 1.10 92/11/26 02:04:32 torek Exp (LBL)
45 1.1 deraadt * $Id: autoconf.h,v 1.1 1993/10/02 10:23:03 deraadt Exp $
46 1.1 deraadt */
47 1.1 deraadt
48 1.1 deraadt /*
49 1.1 deraadt * Autoconfiguration information.
50 1.1 deraadt */
51 1.1 deraadt
52 1.1 deraadt /*
53 1.1 deraadt * Most devices are configured according to information kept in
54 1.1 deraadt * the FORTH PROMs. In particular, we extract the `name', `reg',
55 1.1 deraadt * and `address' properties of each device attached to the mainbus;
56 1.1 deraadt * other drives may also use this information. The mainbus itself
57 1.1 deraadt * (which `is' the CPU, in some sense) gets just the node, with a
58 1.1 deraadt * fake name ("mainbus").
59 1.1 deraadt */
60 1.1 deraadt #define RA_MAXINTR 8 /* max interrupts per device */
61 1.1 deraadt struct romaux {
62 1.1 deraadt const char *ra_name; /* name from FORTH PROM */
63 1.1 deraadt int ra_node; /* FORTH PROM node ID */
64 1.1 deraadt int ra_iospace; /* register space (obio, etc) */
65 1.1 deraadt void *ra_paddr; /* register physical address */
66 1.1 deraadt int ra_len; /* register length */
67 1.1 deraadt void *ra_vaddr; /* ROM mapped virtual address, or 0 */
68 1.1 deraadt struct rom_intr { /* interrupt information: */
69 1.1 deraadt int int_pri; /* priority (IPL) */
70 1.1 deraadt int int_vec; /* vector (always 0?) */
71 1.1 deraadt } ra_intr[RA_MAXINTR];
72 1.1 deraadt int ra_nintr; /* number of interrupt info elements */
73 1.1 deraadt struct bootpath *ra_bp; /* used for locating boot device */
74 1.1 deraadt };
75 1.1 deraadt
76 1.1 deraadt /*
77 1.1 deraadt * The various getprop* functions obtain `properties' from the ROMs.
78 1.1 deraadt * getprop() obtains a property as a byte-sequence, and returns its
79 1.1 deraadt * length; the others convert or make some other guarantee.
80 1.1 deraadt */
81 1.1 deraadt int getprop __P((int node, char *name, void *buf, int bufsiz));
82 1.1 deraadt char *getpropstring __P((int node, char *name));
83 1.1 deraadt int getpropint __P((int node, char *name, int deflt));
84 1.1 deraadt
85 1.1 deraadt /* Frequently used options node */
86 1.1 deraadt extern int optionsnode;
87 1.1 deraadt
88 1.1 deraadt /*
89 1.1 deraadt * The romprop function gets physical and virtual addresses from the PROM
90 1.1 deraadt * and fills in a romaux. It returns 1 on success, 0 if the physical
91 1.1 deraadt * address is not available as a "reg" property.
92 1.1 deraadt */
93 1.1 deraadt int romprop __P((struct romaux *ra, const char *name, int node));
94 1.1 deraadt
95 1.1 deraadt /*
96 1.1 deraadt * The matchbyname function is useful in drivers that are matched
97 1.1 deraadt * by romaux name, i.e., all `mainbus attached' devices. It expects
98 1.1 deraadt * its aux pointer to point to a pointer to the name (the address of
99 1.1 deraadt * a romaux structure suffices, for instance).
100 1.1 deraadt */
101 1.1 deraadt int matchbyname __P((struct device *, struct cfdata *cf, void *aux));
102 1.1 deraadt
103 1.1 deraadt /*
104 1.1 deraadt * `clockfreq' produces a printable representation of a clock frequency
105 1.1 deraadt * (this is just a frill).
106 1.1 deraadt */
107 1.1 deraadt char *clockfreq __P((int freq));
108 1.1 deraadt
109 1.1 deraadt /*
110 1.1 deraadt * mapiodev maps an I/O device to a virtual address, returning the address.
111 1.1 deraadt * mapdev does the real work: you can supply a special virtual address and
112 1.1 deraadt * it will use that instead of creating one, but you must only do this if
113 1.1 deraadt * you get it from ../sparc/vaddrs.h.
114 1.1 deraadt */
115 1.1 deraadt void *mapdev __P((void *pa, int va, int size));
116 1.1 deraadt #define mapiodev(pa, size) mapdev(pa, 0, size)
117 1.1 deraadt
118 1.1 deraadt /*
119 1.1 deraadt * Memory description arrays. Shared between pmap.c and autoconf.c; no
120 1.1 deraadt * one else should use this (except maybe mem.c, e.g., if we fix the VM to
121 1.1 deraadt * handle discontiguous physical memory).
122 1.1 deraadt */
123 1.1 deraadt struct memarr {
124 1.1 deraadt u_int addr;
125 1.1 deraadt u_int len;
126 1.1 deraadt };
127 1.1 deraadt int makememarr(struct memarr *, int max, int which);
128 1.1 deraadt #define MEMARR_AVAILPHYS 0
129 1.1 deraadt #define MEMARR_TOTALPHYS 1
130 1.1 deraadt
131 1.1 deraadt /* Pass a string to the FORTH interpreter. May fail silently. */
132 1.1 deraadt void rominterpret __P((char *));
133 1.1 deraadt
134 1.1 deraadt /* Openprom V2 style boot path */
135 1.1 deraadt struct bootpath {
136 1.1 deraadt char name[8]; /* name of this node */
137 1.1 deraadt int val[2]; /* up to two optional values */
138 1.1 deraadt };
139 1.1 deraadt
140 1.1 deraadt struct device *bootdv; /* found during autoconfiguration */
141