Annotation of sys/arch/sparc/include/autoconf.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: autoconf.h,v 1.16 2007/05/04 03:44:44 deraadt Exp $ */
! 2: /* $NetBSD: autoconf.h,v 1.20 1997/05/24 20:03:03 pk Exp $ */
! 3:
! 4: /*
! 5: * Copyright (c) 1992, 1993
! 6: * The Regents of the University of California. All rights reserved.
! 7: *
! 8: * This software was developed by the Computer Systems Engineering group
! 9: * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
! 10: * contributed to Berkeley.
! 11: *
! 12: * All advertising materials mentioning features or use of this software
! 13: * must display the following acknowledgement:
! 14: * This product includes software developed by the University of
! 15: * California, Lawrence Berkeley Laboratory.
! 16: *
! 17: * Redistribution and use in source and binary forms, with or without
! 18: * modification, are permitted provided that the following conditions
! 19: * are met:
! 20: * 1. Redistributions of source code must retain the above copyright
! 21: * notice, this list of conditions and the following disclaimer.
! 22: * 2. Redistributions in binary form must reproduce the above copyright
! 23: * notice, this list of conditions and the following disclaimer in the
! 24: * documentation and/or other materials provided with the distribution.
! 25: * 3. Neither the name of the University nor the names of its contributors
! 26: * may be used to endorse or promote products derived from this software
! 27: * without specific prior written permission.
! 28: *
! 29: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
! 30: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 31: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 32: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
! 33: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 34: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 35: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 36: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 37: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 38: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 39: * SUCH DAMAGE.
! 40: *
! 41: * @(#)autoconf.h 8.2 (Berkeley) 9/30/93
! 42: */
! 43:
! 44: /*
! 45: * Autoconfiguration information.
! 46: */
! 47:
! 48: /*
! 49: * Most devices are configured according to information kept in
! 50: * the FORTH PROMs. In particular, we extract the `name', `reg',
! 51: * and `address' properties of each device attached to the mainbus;
! 52: * other drives may also use this information. The mainbus itself
! 53: * (which `is' the CPU, in some sense) gets just the node, with a
! 54: * fake name ("mainbus").
! 55: */
! 56:
! 57: #define RA_MAXVADDR 8 /* max (virtual) addresses per device */
! 58: #define RA_MAXREG 16 /* max # of register banks per device */
! 59: #define RA_MAXINTR 8 /* max interrupts per device */
! 60:
! 61: struct romaux {
! 62: const char *ra_name; /* name from FORTH PROM */
! 63: int ra_node; /* FORTH PROM node ID */
! 64: void *ra_vaddrs[RA_MAXVADDR];/* ROM mapped virtual addresses */
! 65: int ra_nvaddrs; /* # of ra_vaddrs[]s, may be 0 */
! 66: #define ra_vaddr ra_vaddrs[0] /* compatibility */
! 67:
! 68: struct rom_reg {
! 69: int rr_iospace; /* register space (obio, etc) */
! 70: void *rr_paddr; /* register physical address */
! 71: int rr_len; /* register length */
! 72: } ra_reg[RA_MAXREG];
! 73: int ra_nreg; /* # of ra_reg[]s */
! 74: #define ra_iospace ra_reg[0].rr_iospace
! 75: #define ra_paddr ra_reg[0].rr_paddr
! 76: #define ra_len ra_reg[0].rr_len
! 77:
! 78: struct rom_intr { /* interrupt information: */
! 79: int int_pri; /* priority (IPL) */
! 80: int int_vec; /* vector (always 0?) */
! 81: } ra_intr[RA_MAXINTR];
! 82: int ra_nintr; /* number of interrupt info elements */
! 83:
! 84: struct bootpath *ra_bp; /* used for locating boot device */
! 85: };
! 86:
! 87: struct rom_range { /* Only used on v3 PROMs */
! 88: u_int32_t cspace; /* Client space */
! 89: u_int32_t coffset; /* Client offset */
! 90: u_int32_t pspace; /* Parent space */
! 91: u_int32_t poffset; /* Parent offset */
! 92: u_int32_t size; /* Size in bytes of this range */
! 93: };
! 94:
! 95:
! 96: struct confargs {
! 97: int ca_bustype;
! 98: struct romaux ca_ra;
! 99: int ca_slot;
! 100: int ca_offset;
! 101: };
! 102: #define BUS_MAIN 0
! 103: #define BUS_OBIO 1
! 104: #define BUS_VME16 2
! 105: #define BUS_VME32 3
! 106: #define BUS_SBUS 4
! 107: #define BUS_XBOX 5
! 108: #define BUS_FGA 6
! 109: #define BUS_FGA_A16D8 7
! 110: #define BUS_FGA_A16D16 8
! 111: #define BUS_FGA_A16D32 9
! 112: #define BUS_FGA_A24D8 10
! 113: #define BUS_FGA_A24D16 11
! 114: #define BUS_FGA_A24D32 12
! 115: #define BUS_FGA_A32D8 13
! 116: #define BUS_FGA_A32D16 14
! 117: #define BUS_FGA_A32D32 15
! 118:
! 119: /*
! 120: * mapiodev maps an I/O device to a virtual address, returning the address.
! 121: * mapdev does the real work: you can supply a special virtual address and
! 122: * it will use that instead of creating one, but you must only do this if
! 123: * you get it from ../sparc/vaddrs.h.
! 124: */
! 125: void *mapdev(struct rom_reg *pa, int va, int offset, int size);
! 126: #define mapiodev(pa, offset, size) \
! 127: mapdev(pa, 0, offset, size)
! 128: /*
! 129: * REG2PHYS is provided for drivers with a `d_mmap' function.
! 130: */
! 131: #define REG2PHYS(rr, offset) \
! 132: (((u_int)(rr)->rr_paddr + (offset)) | PMAP_IOENC((rr)->rr_iospace) )
! 133:
! 134: /* For VME and sun4/obio busses */
! 135: void *bus_map(struct rom_reg *, int);
! 136: void bus_untmp(void);
! 137:
! 138: /*
! 139: * The various getprop* functions obtain `properties' from the ROMs.
! 140: * getprop() obtains a property as a byte-sequence, and returns its
! 141: * length; the others convert or make some other guarantee.
! 142: */
! 143: int getproplen(int node, char *name);
! 144: int getprop(int node, char *name, void *buf, int bufsiz);
! 145: char *getpropstring(int node, char *name);
! 146: int getpropint(int node, char *name, int deflt);
! 147:
! 148: /* Frequently used options node */
! 149: extern int optionsnode;
! 150: /* Machine type */
! 151: extern char mainbus_model[30];
! 152:
! 153: /*
! 154: * The romprop function gets physical and virtual addresses from the PROM
! 155: * and fills in a romaux. It returns 1 on success, 0 if the physical
! 156: * address is not available as a "reg" property.
! 157: */
! 158: int romprop(struct romaux *ra, const char *name, int node);
! 159:
! 160: /*
! 161: * `clockfreq' produces a printable representation of a clock frequency
! 162: * (this is just a frill).
! 163: */
! 164: char *clockfreq(int freq);
! 165:
! 166: /*
! 167: * Memory description arrays. Shared between pmap.c and autoconf.c; no
! 168: * one else should use this (except maybe mem.c, e.g., if we fix the VM to
! 169: * handle discontiguous physical memory).
! 170: */
! 171: struct memarr {
! 172: u_int addr;
! 173: u_int len;
! 174: };
! 175: int makememarr(struct memarr *, int max, int which);
! 176: #define MEMARR_AVAILPHYS 0
! 177: #define MEMARR_TOTALPHYS 1
! 178:
! 179: /* Pass a string to the FORTH interpreter. May fail silently. */
! 180: void rominterpret(char *);
! 181:
! 182: /* Openprom V2 style boot path */
! 183: struct device;
! 184: struct bootpath {
! 185: char name[16]; /* name of this node */
! 186: int val[3]; /* up to three optional values */
! 187: struct device *dev; /* device that recognised this component */
! 188: };
! 189:
! 190: struct bootpath *bootpath_store(int, struct bootpath *);
! 191: int sd_crazymap(int);
! 192:
! 193: void bootstrap(void);
! 194: int firstchild(int);
! 195: int nextsibling(int);
! 196: void callrom(void);
! 197: struct device *getdevunit(char *, int);
! 198: void *findzs(int);
! 199: int romgetcursoraddr(int **, int **);
! 200: int findroot(void);
! 201: int findnode(int, const char *);
! 202: int opennode(char *);
! 203: int node_has_property(int, const char *);
CVSweb