1*f924956aSpalle /* $NetBSD: autoconf.h,v 1.33 2017/09/11 19:25:07 palle Exp $ */ 201e2e698Seeh 301e2e698Seeh /*- 401e2e698Seeh * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. 501e2e698Seeh * All rights reserved. 601e2e698Seeh * 701e2e698Seeh * This code is derived from software contributed to The NetBSD Foundation 801e2e698Seeh * by Paul Kranenburg. 901e2e698Seeh * 1001e2e698Seeh * Redistribution and use in source and binary forms, with or without 1101e2e698Seeh * modification, are permitted provided that the following conditions 1201e2e698Seeh * are met: 1301e2e698Seeh * 1. Redistributions of source code must retain the above copyright 1401e2e698Seeh * notice, this list of conditions and the following disclaimer. 1501e2e698Seeh * 2. Redistributions in binary form must reproduce the above copyright 1601e2e698Seeh * notice, this list of conditions and the following disclaimer in the 1701e2e698Seeh * documentation and/or other materials provided with the distribution. 1801e2e698Seeh * 1901e2e698Seeh * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2001e2e698Seeh * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2101e2e698Seeh * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2201e2e698Seeh * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2301e2e698Seeh * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2401e2e698Seeh * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2501e2e698Seeh * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2601e2e698Seeh * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2701e2e698Seeh * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2801e2e698Seeh * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2901e2e698Seeh * POSSIBILITY OF SUCH DAMAGE. 3001e2e698Seeh */ 3101e2e698Seeh 3201e2e698Seeh /* 3301e2e698Seeh * Copyright (c) 1992, 1993 3401e2e698Seeh * The Regents of the University of California. All rights reserved. 3501e2e698Seeh * 3601e2e698Seeh * This software was developed by the Computer Systems Engineering group 3701e2e698Seeh * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 3801e2e698Seeh * contributed to Berkeley. 3901e2e698Seeh * 4001e2e698Seeh * All advertising materials mentioning features or use of this software 4101e2e698Seeh * must display the following acknowledgement: 4201e2e698Seeh * This product includes software developed by the University of 4301e2e698Seeh * California, Lawrence Berkeley Laboratory. 4401e2e698Seeh * 4501e2e698Seeh * Redistribution and use in source and binary forms, with or without 4601e2e698Seeh * modification, are permitted provided that the following conditions 4701e2e698Seeh * are met: 4801e2e698Seeh * 1. Redistributions of source code must retain the above copyright 4901e2e698Seeh * notice, this list of conditions and the following disclaimer. 5001e2e698Seeh * 2. Redistributions in binary form must reproduce the above copyright 5101e2e698Seeh * notice, this list of conditions and the following disclaimer in the 5201e2e698Seeh * documentation and/or other materials provided with the distribution. 53aad01611Sagc * 3. Neither the name of the University nor the names of its contributors 5401e2e698Seeh * may be used to endorse or promote products derived from this software 5501e2e698Seeh * without specific prior written permission. 5601e2e698Seeh * 5701e2e698Seeh * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 5801e2e698Seeh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 5901e2e698Seeh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 6001e2e698Seeh * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 6101e2e698Seeh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 6201e2e698Seeh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 6301e2e698Seeh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 6401e2e698Seeh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 6501e2e698Seeh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 6601e2e698Seeh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 6701e2e698Seeh * SUCH DAMAGE. 6801e2e698Seeh * 6901e2e698Seeh * @(#)autoconf.h 8.2 (Berkeley) 9/30/93 7001e2e698Seeh */ 7101e2e698Seeh 7201e2e698Seeh /* 7301e2e698Seeh * Autoconfiguration information. 7401e2e698Seeh */ 7501e2e698Seeh 769aff02ebSdyoung #include <sys/bus.h> 7765216210Spk #include <machine/promlib.h> 7801e2e698Seeh 792353478dSjdc /* Machine banner name and model name */ 802353478dSjdc extern char machine_banner[100]; 812353478dSjdc extern char machine_model[100]; 822353478dSjdc 8301e2e698Seeh /* This is used to map device classes to IPLs */ 8401e2e698Seeh struct intrmap { 85a38d2d27Schristos const char *in_class; 8601e2e698Seeh int in_lev; 8701e2e698Seeh }; 8801e2e698Seeh extern struct intrmap intrmap[]; 8901e2e698Seeh 9001e2e698Seeh /* The "mainbus" on ultra desktops is actually the UPA bus. We need to 9101e2e698Seeh * separate this from peripheral buses like SBUS and PCI because each bus may 9201e2e698Seeh * have different ways of encoding properties, such as "reg" and "interrupts". 9301e2e698Seeh * 9401e2e698Seeh * Eventually I'll create a real UPA bus module to allow servers with multiple 9501e2e698Seeh * peripheral buses and things like FHC bus systems. 9601e2e698Seeh */ 9701e2e698Seeh 98fdeb3006Smartin /* Encoding for one "reg" properties item */ 99fdeb3006Smartin struct upa_reg { 100fdeb3006Smartin int64_t ur_paddr; 101fdeb3006Smartin int64_t ur_len; 102fdeb3006Smartin }; 103fdeb3006Smartin 104cf9a8a5aSeeh /* 105cf9a8a5aSeeh * Attach arguments presented by mainbus_attach() 106cf9a8a5aSeeh * 107cf9a8a5aSeeh * Large fields first followed by smaller ones to minimize stack space used. 108cf9a8a5aSeeh */ 10901e2e698Seeh struct mainbus_attach_args { 11001e2e698Seeh bus_space_tag_t ma_bustag; /* parent bus tag */ 11101e2e698Seeh bus_dma_tag_t ma_dmatag; 112a38d2d27Schristos const char *ma_name; /* PROM node name */ 11301e2e698Seeh struct upa_reg *ma_reg; /* "reg" properties */ 114a112a2a4Seeh u_int *ma_address; /* "address" properties -- 32 bits */ 115a112a2a4Seeh u_int *ma_interrupts; /* "interrupts" properties */ 116fdeb3006Smartin int ma_upaid; /* UPA port ID */ 117cf9a8a5aSeeh int ma_node; /* PROM handle */ 118cf9a8a5aSeeh int ma_nreg; /* Counts for those properties */ 119cf9a8a5aSeeh int ma_naddress; 12001e2e698Seeh int ma_ninterrupts; 12101e2e698Seeh int ma_pri; /* priority (IPL) */ 12201e2e698Seeh }; 12301e2e698Seeh 12401e2e698Seeh /* 12501e2e698Seeh * The matchbyname function is useful in drivers that are matched 12601e2e698Seeh * by romaux name, i.e., all `mainbus attached' devices. It expects 12701e2e698Seeh * its aux pointer to point to a pointer to the name (the address of 12801e2e698Seeh * a romaux structure suffices, for instance). (OBSOLETE) 12901e2e698Seeh */ 130cbab9cadSchs int matchbyname(device_t, cfdata_t, void *); 13101e2e698Seeh 13201e2e698Seeh /* 13301e2e698Seeh * `clockfreq' produces a printable representation of a clock frequency 13401e2e698Seeh * (this is just a frill). 13501e2e698Seeh */ 136*f924956aSpalle char *clockfreq(uint64_t); 13701e2e698Seeh 1384c2e4320Scdi /* Kernel initialization routine. */ 1394c2e4320Scdi void bootstrap(void *, void *, void *, void *, void *); 1404c2e4320Scdi 141d0f8217fScdi int romgetcursoraddr(int **, int **); 142