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