xref: /netbsd-src/sys/arch/sparc/stand/common/promdev.h (revision 7709732cb2488bcbe15cafe7a41202bbb527875c)
1*7709732cSchristos /*	$NetBSD: promdev.h,v 1.16 2010/08/25 20:16:49 christos Exp $ */
27cedf69cSmrg 
3acf16f70Spk /*-
4acf16f70Spk  * Copyright (c) 1998 The NetBSD Foundation, Inc.
57cedf69cSmrg  * All rights reserved.
67cedf69cSmrg  *
7acf16f70Spk  * This code is derived from software contributed to The NetBSD Foundation
8acf16f70Spk  * by Paul Kranenburg.
9acf16f70Spk  *
107cedf69cSmrg  * Redistribution and use in source and binary forms, with or without
117cedf69cSmrg  * modification, are permitted provided that the following conditions
127cedf69cSmrg  * are met:
137cedf69cSmrg  * 1. Redistributions of source code must retain the above copyright
147cedf69cSmrg  *    notice, this list of conditions and the following disclaimer.
157cedf69cSmrg  * 2. Redistributions in binary form must reproduce the above copyright
167cedf69cSmrg  *    notice, this list of conditions and the following disclaimer in the
177cedf69cSmrg  *    documentation and/or other materials provided with the distribution.
187cedf69cSmrg  *
19acf16f70Spk  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20acf16f70Spk  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21acf16f70Spk  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22acf16f70Spk  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23acf16f70Spk  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24acf16f70Spk  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25acf16f70Spk  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26acf16f70Spk  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27acf16f70Spk  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28acf16f70Spk  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29acf16f70Spk  * POSSIBILITY OF SUCH DAMAGE.
307cedf69cSmrg  */
317cedf69cSmrg 
327cedf69cSmrg #include <machine/bsd_openprom.h>
337cedf69cSmrg 
347cedf69cSmrg struct promdata {
357cedf69cSmrg 	int	fd;			/* Openboot descriptor */
367cedf69cSmrg 	struct	saioreq *si;		/* Oldmon IO request */
377cedf69cSmrg 	int	devtype;		/* Kind of device we're booting from */
387cedf69cSmrg #define DT_BLOCK	1
397cedf69cSmrg #define DT_NET		2
407cedf69cSmrg #define DT_BYTE		3
417cedf69cSmrg 	/* Hooks for netif.c */
424c3c91e6Suwe 	ssize_t	(*xmit)(struct promdata *, void *, size_t);
434c3c91e6Suwe 	ssize_t	(*recv)(struct promdata *, void *, size_t);
447cedf69cSmrg };
457cedf69cSmrg 
464969489cSpk #define DDB_MAGIC0	( ('D'<<24) | ('D'<<16) | ('B'<<8) | ('0') )
474969489cSpk #define DDB_MAGIC1	( ('D'<<24) | ('D'<<16) | ('B'<<8) | ('1') )
4881248a08Schristos #define DDB_MAGIC2	( ('D'<<24) | ('D'<<16) | ('B'<<8) | ('2') )
494969489cSpk 
500ad90d21Smartin #define	MAX_PROM_PATH	128
510ad90d21Smartin 
520ad90d21Smartin extern char	prom_bootdevice[MAX_PROM_PATH];
537cedf69cSmrg extern int	cputyp, nbpg, pgofset, pgshift;
547cedf69cSmrg extern int	debug;
557cedf69cSmrg 
567cedf69cSmrg /* Note: dvma_*() routines are for "oldmon" machines only */
574c3c91e6Suwe extern void	dvma_init(void);
584c3c91e6Suwe extern char	*dvma_mapin(char *, size_t);
594c3c91e6Suwe extern char	*dvma_mapout(char *, size_t);
604c3c91e6Suwe extern char	*dvma_alloc(int);
614c3c91e6Suwe extern void	dvma_free(char *, int);
62d292580fSpk 
63d292580fSpk /* In net.c: */
644c3c91e6Suwe extern int	net_open(struct promdata *);
654c3c91e6Suwe extern int	net_close(struct promdata *);
664c3c91e6Suwe extern int	net_mountroot(void);
67d292580fSpk 
681b5340d3Spk /* In mmu.c */
691b5340d3Spk extern int	mmu_init(void);
701b5340d3Spk extern int	(*pmap_map)(vaddr_t, paddr_t, psize_t);
711b5340d3Spk extern int	(*pmap_extract)(vaddr_t, paddr_t *);
721b5340d3Spk 
73d292580fSpk /* In str0.S: */
744c3c91e6Suwe extern void	sparc_noop(void);
75d292580fSpk extern void	*romp;
76