xref: /netbsd-src/sys/arch/sparc/dev/sbusvar.h (revision 12ad76b18c6a1b98ee0c961fbee99f5e1641b691)
1*12ad76b1Stsutsui /*	$NetBSD: sbusvar.h,v 1.20 2009/09/17 16:28:12 tsutsui Exp $ */
2165120cfSpk 
3165120cfSpk /*-
4165120cfSpk  * Copyright (c) 1998 The NetBSD Foundation, Inc.
5165120cfSpk  * All rights reserved.
6165120cfSpk  *
7165120cfSpk  * This code is derived from software contributed to The NetBSD Foundation
8165120cfSpk  * by Paul Kranenburg.
9165120cfSpk  *
10165120cfSpk  * Redistribution and use in source and binary forms, with or without
11165120cfSpk  * modification, are permitted provided that the following conditions
12165120cfSpk  * are met:
13165120cfSpk  * 1. Redistributions of source code must retain the above copyright
14165120cfSpk  *    notice, this list of conditions and the following disclaimer.
15165120cfSpk  * 2. Redistributions in binary form must reproduce the above copyright
16165120cfSpk  *    notice, this list of conditions and the following disclaimer in the
17165120cfSpk  *    documentation and/or other materials provided with the distribution.
18165120cfSpk  *
19165120cfSpk  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20165120cfSpk  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21165120cfSpk  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22165120cfSpk  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23165120cfSpk  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24165120cfSpk  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25165120cfSpk  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26165120cfSpk  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27165120cfSpk  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28165120cfSpk  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29165120cfSpk  * POSSIBILITY OF SUCH DAMAGE.
30165120cfSpk  */
31274a9076Sderaadt 
324588caefSderaadt /*
334588caefSderaadt  * Copyright (c) 1992, 1993
344588caefSderaadt  *	The Regents of the University of California.  All rights reserved.
354588caefSderaadt  *
364588caefSderaadt  * This software was developed by the Computer Systems Engineering group
374588caefSderaadt  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
384588caefSderaadt  * contributed to Berkeley.
394588caefSderaadt  *
404588caefSderaadt  * All advertising materials mentioning features or use of this software
414588caefSderaadt  * must display the following acknowledgement:
424588caefSderaadt  *	This product includes software developed by the University of
434588caefSderaadt  *	California, Lawrence Berkeley Laboratory.
444588caefSderaadt  *
454588caefSderaadt  * Redistribution and use in source and binary forms, with or without
464588caefSderaadt  * modification, are permitted provided that the following conditions
474588caefSderaadt  * are met:
484588caefSderaadt  * 1. Redistributions of source code must retain the above copyright
494588caefSderaadt  *    notice, this list of conditions and the following disclaimer.
504588caefSderaadt  * 2. Redistributions in binary form must reproduce the above copyright
514588caefSderaadt  *    notice, this list of conditions and the following disclaimer in the
524588caefSderaadt  *    documentation and/or other materials provided with the distribution.
53aad01611Sagc  * 3. Neither the name of the University nor the names of its contributors
544588caefSderaadt  *    may be used to endorse or promote products derived from this software
554588caefSderaadt  *    without specific prior written permission.
564588caefSderaadt  *
574588caefSderaadt  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
584588caefSderaadt  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
594588caefSderaadt  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
604588caefSderaadt  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
614588caefSderaadt  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
624588caefSderaadt  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
634588caefSderaadt  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
644588caefSderaadt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
654588caefSderaadt  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
664588caefSderaadt  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
674588caefSderaadt  * SUCH DAMAGE.
684588caefSderaadt  *
694588caefSderaadt  *	@(#)sbusvar.h	8.1 (Berkeley) 6/11/93
704588caefSderaadt  */
714588caefSderaadt 
729104b183Spk #ifndef _SBUS_VAR_SPARC_H
739104b183Spk #define _SBUS_VAR_SPARC_H
74165120cfSpk 
754588caefSderaadt 
764588caefSderaadt /* variables per Sbus */
774588caefSderaadt struct sbus_softc {
7821ef3a53Smacallan 	device_t sc_dev;		/* base device */
79165120cfSpk 	bus_space_tag_t	sc_bustag;
80165120cfSpk 	bus_dma_tag_t	sc_dmatag;
8125d48215Spk 	bus_space_handle_t sc_bh;	/* SBus control registers */
824588caefSderaadt 	int	sc_clockfreq;		/* clock frequency (in Hz) */
83709298a1Sabrown 	int	sc_burst;		/* burst transfer sizes supported */
8425d48215Spk 
8525d48215Spk 	/* MD fields follow here */
86165120cfSpk 	int	*sc_intr2ipl;		/* Interrupt level translation */
874588caefSderaadt };
884588caefSderaadt 
898ccad96dSeeh /*
908ccad96dSeeh  * Macro to convert a PROM virtual address to a bus_space_handle_t.
918ccad96dSeeh  */
922f6ced07Sjmc #define	sbus_promaddr_to_handle(tag, promaddr, hp) sparc_promaddr_to_handle(tag, promaddr, hp)
932f6ced07Sjmc 
945f1c88d7Sperry static inline void
sparc_promaddr_to_handle(bus_space_tag_t tag,u_int promaddr,bus_space_handle_t * hp)952f6ced07Sjmc sparc_promaddr_to_handle(bus_space_tag_t tag, u_int promaddr, bus_space_handle_t *hp)
962f6ced07Sjmc {
972f6ced07Sjmc 	*(hp) = (bus_space_handle_t)(promaddr);
982f6ced07Sjmc }
998ccad96dSeeh 
1009104b183Spk #endif /* _SBUS_VAR_SPARC_H */
101