155117Storek /* 255117Storek * Copyright (c) 1992 The Regents of the University of California. 355117Storek * All rights reserved. 455117Storek * 555117Storek * This software was developed by the Computer Systems Engineering group 655117Storek * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 755117Storek * contributed to Berkeley. 855117Storek * 9*55501Sbostic * All advertising materials mentioning features or use of this software 10*55501Sbostic * must display the following acknowledgement: 11*55501Sbostic * This product includes software developed by the University of 12*55501Sbostic * California, Lawrence Berkeley Laboratories. 13*55501Sbostic * 1455117Storek * %sccs.include.redist.c% 1555117Storek * 16*55501Sbostic * @(#)autoconf.h 7.2 (Berkeley) 07/21/92 1755117Storek * 1855117Storek * from: $Header: autoconf.h,v 1.8 92/06/24 08:55:42 torek Exp $ (LBL) 1955117Storek */ 2055117Storek 2155117Storek /* 2255117Storek * Autoconfiguration information. 2355117Storek */ 2455117Storek 2555117Storek /* 2655117Storek * Most devices are configured according to information kept in 2755117Storek * the FORTH PROMs. In particular, we extract the `name', `reg', 2855117Storek * and `address' properties of each device attached to the mainbus; 2955117Storek * other drives may also use this information. The mainbus itself 3055117Storek * (which `is' the CPU, in some sense) gets just the node, with a 3155117Storek * fake name ("mainbus"). 3255117Storek */ 3355117Storek #define RA_MAXINTR 8 /* max interrupts per device */ 3455117Storek struct romaux { 3555117Storek const char *ra_name; /* name from FORTH PROM */ 3655117Storek int ra_node; /* FORTH PROM node ID */ 3755117Storek int ra_iospace; /* register space (obio, etc) */ 3855117Storek void *ra_paddr; /* register physical address */ 3955117Storek int ra_len; /* register length */ 4055117Storek void *ra_vaddr; /* ROM mapped virtual address, or 0 */ 4155117Storek struct rom_intr { /* interrupt information: */ 4255117Storek int int_pri; /* priority (IPL) */ 4355117Storek int int_vec; /* vector (always 0?) */ 4455117Storek } ra_intr[RA_MAXINTR]; 4555117Storek int ra_nintr; /* number of interrupt info elements */ 4655117Storek }; 4755117Storek 4855117Storek /* 4955117Storek * The various getprop* functions obtain `properties' from the ROMs. 5055117Storek * getprop() obtains a property as a byte-sequence, and returns its 5155117Storek * length; the others convert or make some other guarantee. 5255117Storek */ 5355117Storek int getprop __P((int node, char *name, void *buf, int bufsiz)); 5455117Storek char *getpropstring __P((int node, char *name)); 5555117Storek int getpropint __P((int node, char *name, int deflt)); 5655117Storek 5755117Storek /* Frequently used options node */ 5855117Storek extern int optionsnode; 5955117Storek 6055117Storek /* 6155117Storek * The romprop function gets physical and virtual addresses from the PROM 6255117Storek * and fills in a romaux. It returns 1 on success, 0 if the physical 6355117Storek * address is not available as a "reg" property. 6455117Storek */ 6555117Storek int romprop __P((struct romaux *ra, const char *name, int node)); 6655117Storek 6755117Storek /* 6855117Storek * The matchbyname function is useful in drivers that are matched 6955117Storek * by romaux name, i.e., all `mainbus attached' devices. It expects 7055117Storek * its aux pointer to point to a pointer to the name (the address of 7155117Storek * a romaux structure suffices, for instance). 7255117Storek */ 7355117Storek int matchbyname __P((struct device *, struct cfdata *cf, void *aux)); 7455117Storek 7555117Storek /* 7655117Storek * `clockfreq' produces a printable representation of a clock frequency 7755117Storek * (this is just a frill). 7855117Storek */ 7955117Storek char *clockfreq __P((int freq)); 8055117Storek 8155117Storek /* 8255117Storek * mapiodev maps an I/O device to a virtual address, returning the address. 8355117Storek * mapdev does the real work: you can supply a special virtual address and 8455117Storek * it will use that instead of creating one, but you must only do this if 8555117Storek * you get it from ../sparc/vaddrs.h. 8655117Storek */ 8755117Storek void *mapdev __P((void *pa, int va, int size)); 8855117Storek #define mapiodev(pa, size) mapdev(pa, 0, size) 8955117Storek 9055117Storek /* 9155117Storek * Memory description arrays. Shared between pmap.c and autoconf.c; no 9255117Storek * one else should use this (except maybe mem.c, e.g., if we fix the VM to 9355117Storek * handle discontiguous physical memory). 9455117Storek */ 9555117Storek struct memarr { 9655117Storek u_int addr; 9755117Storek u_int len; 9855117Storek }; 9955117Storek int makememarr(struct memarr *, int max, int which); 10055117Storek #define MEMARR_AVAILPHYS 0 10155117Storek #define MEMARR_TOTALPHYS 1 10255117Storek 10355117Storek /* Pass a string to the FORTH interpreter. May fail silently. */ 10455117Storek void rominterpret __P((char *)); 105