1 /* $OpenBSD: autoconf.h,v 1.11 2006/03/04 10:31:50 miod Exp $ */ 2 /* $NetBSD: autoconf.h,v 1.10 2001/07/24 19:32:11 eeh Exp $ */ 3 4 /*- 5 * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to The NetBSD Foundation 9 * by Paul Kranenburg. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 3. All advertising materials mentioning features or use of this software 20 * must display the following acknowledgement: 21 * This product includes software developed by the NetBSD 22 * Foundation, Inc. and its contributors. 23 * 4. Neither the name of The NetBSD Foundation nor the names of its 24 * contributors may be used to endorse or promote products derived 25 * from this software without specific prior written permission. 26 * 27 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 28 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 29 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 30 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 31 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 37 * POSSIBILITY OF SUCH DAMAGE. 38 */ 39 40 /* 41 * Copyright (c) 1992, 1993 42 * The Regents of the University of California. All rights reserved. 43 * 44 * This software was developed by the Computer Systems Engineering group 45 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 46 * contributed to Berkeley. 47 * 48 * All advertising materials mentioning features or use of this software 49 * must display the following acknowledgement: 50 * This product includes software developed by the University of 51 * California, Lawrence Berkeley Laboratory. 52 * 53 * Redistribution and use in source and binary forms, with or without 54 * modification, are permitted provided that the following conditions 55 * are met: 56 * 1. Redistributions of source code must retain the above copyright 57 * notice, this list of conditions and the following disclaimer. 58 * 2. Redistributions in binary form must reproduce the above copyright 59 * notice, this list of conditions and the following disclaimer in the 60 * documentation and/or other materials provided with the distribution. 61 * 3. Neither the name of the University nor the names of its contributors 62 * may be used to endorse or promote products derived from this software 63 * without specific prior written permission. 64 * 65 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 66 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 67 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 68 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 69 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 70 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 71 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 72 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 73 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 74 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 75 * SUCH DAMAGE. 76 * 77 * @(#)autoconf.h 8.2 (Berkeley) 9/30/93 78 */ 79 80 /* 81 * Autoconfiguration information. 82 */ 83 84 #include <machine/bus.h> 85 #include <dev/sbus/sbusvar.h> 86 87 /* This is used to map device classes to IPLs */ 88 struct intrmap { 89 char *in_class; 90 int in_lev; 91 }; 92 extern struct intrmap intrmap[]; 93 94 /* The "mainbus" on ultra desktops is actually the UPA bus. We need to 95 * separate this from peripheral buses like SBUS and PCI because each bus may 96 * have different ways of encoding properties, such as "reg" and "interrupts". 97 */ 98 99 /* Device register space description */ 100 struct upa_reg { 101 int64_t ur_paddr; 102 int64_t ur_len; 103 }; 104 105 /* 106 * Attach arguments presented by mainbus_attach() 107 * 108 * Large fields first followed by smaller ones to minimize stack space used. 109 */ 110 struct mainbus_attach_args { 111 bus_space_tag_t ma_bustag; /* parent bus tag */ 112 bus_dma_tag_t ma_dmatag; 113 char *ma_name; /* PROM node name */ 114 struct upa_reg *ma_reg; /* "reg" properties */ 115 u_int *ma_address; /* "address" properties -- 32 bits */ 116 u_int *ma_interrupts; /* "interrupts" properties */ 117 int ma_upaid; /* UPA bus ID */ 118 int ma_node; /* PROM handle */ 119 int ma_nreg; /* Counts for those properties */ 120 int ma_naddress; 121 int ma_ninterrupts; 122 int ma_pri; /* priority (IPL) */ 123 }; 124 125 /* 126 * length; the others convert or make some other guarantee. 127 */ 128 long getproplen(int node, char *name); 129 int getprop(int, char *, size_t, int *, void **); 130 char *getpropstring(int node, char *name); 131 int getpropint(int node, char *name, int deflt); 132 133 /* Frequently used options node */ 134 extern int optionsnode; 135 136 /* new interfaces: */ 137 char *getpropstringA(int, char *, char *); 138 139 /* 140 * `clockfreq' produces a printable representation of a clock frequency 141 * (this is just a frill). 142 */ 143 char *clockfreq(long freq); 144 145 /* Openprom V2 style boot path */ 146 struct device; 147 struct bootpath { 148 char name[16]; /* name of this node */ 149 char compatible[16]; /* "compatible" name of this node */ 150 int val[3]; /* up to three optional values */ 151 struct device *dev; /* device that recognised this component */ 152 }; 153 struct bootpath *bootpath_store(int, struct bootpath *); 154 155 /* Parse a disk string into a dev_t, return device struct pointer */ 156 struct device *parsedisk(char *, int, int, dev_t *); 157 158 /* Establish a mountroot_hook, for benefit of floppy drive, mostly. */ 159 void mountroot_hook_establish(void (*)(struct device *), struct device *); 160 161 void bootstrap(int); 162 int firstchild(int); 163 int nextsibling(int); 164 void callrom(void); 165 struct device *getdevunit(char *, int); 166 void *findzs(int); 167 int romgetcursoraddr(int **, int **); 168 int findroot(void); 169 int findnode(int, const char *); 170 int node_has_property(int, const char *); 171 void device_register(struct device *, void *); 172