1 /* $OpenBSD: promdev.h,v 1.1 1997/09/17 10:46:19 downsj Exp $ */
2 /* $NetBSD: promdev.h,v 1.3 1995/09/18 21:31:50 pk Exp $ */
5 * Copyright (c) 1993 Paul Kranenburg
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
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
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.
34 #include <machine/bsd_openprom.h>
37 int fd
; /* Openboot descriptor */
38 struct saioreq
*si
; /* Oldmon IO request */
39 int devtype
; /* Kind of device we're booting from */
43 /* Hooks for netif.c */
44 int (*xmit
) __P((struct promdata
*, void *, size_t));
45 int (*recv
) __P((struct promdata
*, void *, size_t));
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
53 extern struct promvec
*promvec
;
54 extern char *prom_bootdevice
;
55 extern char *prom_bootfile
;
56 extern int prom_boothow
;
58 extern int cputyp
, nbpg
, pgofset
, pgshift
;
61 extern void prom_init
__P((void));
63 /* Note: dvma_*() routines are for "oldmon" machines only */
64 extern char *dvma_mapin
__P((char *, size_t));
65 extern char *dvma_mapout
__P((char *, size_t));
66 extern char *dvma_alloc
__P((int));
69 * duplicates from pmap.c for mapping device on "oldmon" machines.
71 #include <sparc/asm.h>
73 #define getcontext() lduba(AC_CONTEXT, ASI_CONTROL)
74 #define setcontext(c) stba(AC_CONTEXT, ASI_CONTROL, c)
75 #define getsegmap(va) (cputyp == CPU_SUN4C \
76 ? lduba(va, ASI_SEGMAP) \
77 : lduha(va, ASI_SEGMAP))
78 #define setsegmap(va, pmeg) (cputyp == CPU_SUN4C \
79 ? stba(va, ASI_SEGMAP, pmeg) \
80 : stha(va, ASI_SEGMAP, pmeg))
81 #define getregmap(va) ((unsigned)lduha(va+2, ASI_REGMAP) >> 8)
82 #define setregmap(va, smeg) stha(va+2, ASI_REGMAP, (smeg << 8))
84 #define getpte(va) lda(va, ASI_PTE)
85 #define setpte(va, pte) sta(va, ASI_PTE, pte)