Annotation of sys/arch/sparc/stand/common/promdev.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: promdev.h,v 1.3 2003/08/14 17:13:57 deraadt Exp $ */
! 2: /* $NetBSD: promdev.h,v 1.3 1995/09/18 21:31:50 pk Exp $ */
! 3:
! 4: /*
! 5: * Copyright (c) 1993 Paul Kranenburg
! 6: * All rights reserved.
! 7: *
! 8: * Redistribution and use in source and binary forms, with or without
! 9: * modification, are permitted provided that the following conditions
! 10: * are met:
! 11: * 1. Redistributions of source code must retain the above copyright
! 12: * notice, this list of conditions and the following disclaimer.
! 13: * 2. Redistributions in binary form must reproduce the above copyright
! 14: * notice, this list of conditions and the following disclaimer in the
! 15: * documentation and/or other materials provided with the distribution.
! 16: * 3. All advertising materials mentioning features or use of this software
! 17: * must display the following acknowledgement:
! 18: * This product includes software developed by Paul Kranenburg.
! 19: * 4. The name of the author may not be used to endorse or promote products
! 20: * derived from this software without specific prior written permission
! 21: *
! 22: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
! 23: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! 24: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
! 25: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
! 26: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
! 27: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
! 28: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
! 29: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
! 30: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
! 31: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! 32: */
! 33:
! 34: #include <machine/bsd_openprom.h>
! 35:
! 36: struct promdata {
! 37: int fd; /* Openboot descriptor */
! 38: struct saioreq *si; /* Oldmon IO request */
! 39: int devtype; /* Kind of device we're booting from */
! 40: #define DT_BLOCK 1
! 41: #define DT_NET 2
! 42: #define DT_BYTE 3
! 43: /* Hooks for netif.c */
! 44: int (*xmit)(struct promdata *, void *, size_t);
! 45: int (*recv)(struct promdata *, void *, size_t);
! 46: };
! 47:
! 48: #define LOADADDR ((caddr_t)0x4000)
! 49: #define DDB_MAGIC0 ( ('D'<<24) | ('D'<<16) | ('B'<<8) | ('0') )
! 50: #define DDB_MAGIC1 ( ('D'<<24) | ('D'<<16) | ('B'<<8) | ('1') )
! 51: #define DDB_MAGIC DDB_MAGIC0
! 52:
! 53: extern struct promvec *promvec;
! 54: extern char *prom_bootdevice;
! 55: extern char *prom_bootfile;
! 56: extern int prom_boothow;
! 57: extern int hz;
! 58: extern int cputyp, nbpg, pgofset, pgshift;
! 59: extern int debug;
! 60:
! 61: extern void prom_init(void);
! 62:
! 63: /* Note: dvma_*() routines are for "oldmon" machines only */
! 64: extern void dvma_init(void);
! 65: extern char *dvma_mapin(char *, size_t);
! 66: extern char *dvma_mapout(char *, size_t);
! 67: extern char *dvma_alloc(int);
! 68: extern void dvma_free(char *, int);
! 69:
! 70: /*
! 71: * duplicates from pmap.c for mapping device on "oldmon" machines.
! 72: */
! 73: #include <sparc/sparc/asm.h>
! 74:
! 75: #define getcontext() lduba(AC_CONTEXT, ASI_CONTROL)
! 76: #define setcontext(c) stba(AC_CONTEXT, ASI_CONTROL, c)
! 77: #define getsegmap(va) (cputyp == CPU_SUN4C \
! 78: ? lduba(va, ASI_SEGMAP) \
! 79: : lduha(va, ASI_SEGMAP))
! 80: #define setsegmap(va, pmeg) (cputyp == CPU_SUN4C \
! 81: ? stba(va, ASI_SEGMAP, pmeg) \
! 82: : stha(va, ASI_SEGMAP, pmeg))
! 83: #define getregmap(va) ((unsigned)lduha(va+2, ASI_REGMAP) >> 8)
! 84: #define setregmap(va, smeg) stha(va+2, ASI_REGMAP, (smeg << 8))
! 85:
! 86: #define getpte(va) lda(va, ASI_PTE)
! 87: #define setpte(va, pte) sta(va, ASI_PTE, pte)
CVSweb