155117Storek /* 263320Sbostic * Copyright (c) 1992, 1993 363320Sbostic * The Regents of the University of California. 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 * 955501Sbostic * All advertising materials mentioning features or use of this software 1055501Sbostic * must display the following acknowledgement: 1155501Sbostic * This product includes software developed by the University of 1259196Storek * California, Lawrence Berkeley Laboratory. 1355501Sbostic * 1455117Storek * %sccs.include.redist.c% 1555117Storek * 16*64689Storek * @(#)autoconf.h 8.2 (Berkeley) 09/30/93 1755117Storek * 18*64689Storek * from: $Header: autoconf.h,v 1.11 93/09/28 05:26:41 leres 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 */ 4659196Storek struct bootpath *ra_bp; /* used for locating boot device */ 4755117Storek }; 4855117Storek 4955117Storek /* 5055117Storek * The various getprop* functions obtain `properties' from the ROMs. 5155117Storek * getprop() obtains a property as a byte-sequence, and returns its 5255117Storek * length; the others convert or make some other guarantee. 5355117Storek */ 5455117Storek int getprop __P((int node, char *name, void *buf, int bufsiz)); 5555117Storek char *getpropstring __P((int node, char *name)); 5655117Storek int getpropint __P((int node, char *name, int deflt)); 5755117Storek 5855117Storek /* Frequently used options node */ 5955117Storek extern int optionsnode; 6055117Storek 6155117Storek /* 6255117Storek * The romprop function gets physical and virtual addresses from the PROM 6355117Storek * and fills in a romaux. It returns 1 on success, 0 if the physical 6455117Storek * address is not available as a "reg" property. 6555117Storek */ 6655117Storek int romprop __P((struct romaux *ra, const char *name, int node)); 6755117Storek 6855117Storek /* 6955117Storek * The matchbyname function is useful in drivers that are matched 7055117Storek * by romaux name, i.e., all `mainbus attached' devices. It expects 7155117Storek * its aux pointer to point to a pointer to the name (the address of 7255117Storek * a romaux structure suffices, for instance). 7355117Storek */ 7455117Storek int matchbyname __P((struct device *, struct cfdata *cf, void *aux)); 7555117Storek 7655117Storek /* 7755117Storek * `clockfreq' produces a printable representation of a clock frequency 7855117Storek * (this is just a frill). 7955117Storek */ 8055117Storek char *clockfreq __P((int freq)); 8155117Storek 8255117Storek /* 8355117Storek * mapiodev maps an I/O device to a virtual address, returning the address. 8455117Storek * mapdev does the real work: you can supply a special virtual address and 8555117Storek * it will use that instead of creating one, but you must only do this if 8655117Storek * you get it from ../sparc/vaddrs.h. 8755117Storek */ 8855117Storek void *mapdev __P((void *pa, int va, int size)); 8955117Storek #define mapiodev(pa, size) mapdev(pa, 0, size) 9055117Storek 9155117Storek /* 9255117Storek * Memory description arrays. Shared between pmap.c and autoconf.c; no 9355117Storek * one else should use this (except maybe mem.c, e.g., if we fix the VM to 9455117Storek * handle discontiguous physical memory). 9555117Storek */ 9655117Storek struct memarr { 9755117Storek u_int addr; 9855117Storek u_int len; 9955117Storek }; 10055117Storek int makememarr(struct memarr *, int max, int which); 10155117Storek #define MEMARR_AVAILPHYS 0 10255117Storek #define MEMARR_TOTALPHYS 1 10355117Storek 10455117Storek /* Pass a string to the FORTH interpreter. May fail silently. */ 10555117Storek void rominterpret __P((char *)); 10659196Storek 10759196Storek /* Openprom V2 style boot path */ 10859196Storek struct bootpath { 10959196Storek char name[8]; /* name of this node */ 11059196Storek int val[2]; /* up to two optional values */ 11159196Storek }; 11259196Storek 11359196Storek struct device *bootdv; /* found during autoconfiguration */ 114*64689Storek 115*64689Storek /* Parse a disk string into a dev_t, return device struct pointer */ 116*64689Storek struct device *parsedisk __P((char *, int, int, dev_t *)); 117