xref: /openbsd/sys/arch/sparc64/dev/ebusvar.h (revision 404b540a)
1 /*	$OpenBSD: ebusvar.h,v 1.6 2007/04/04 18:38:54 kettenis Exp $	*/
2 /*	$NetBSD: ebusvar.h,v 1.5 2001/07/20 00:07:13 eeh Exp $	*/
3 
4 /*
5  * Copyright (c) 1999, 2000 Matthew R. Green
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. The name of the author may not be used to endorse or promote products
17  *    derived from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29  * SUCH DAMAGE.
30  */
31 
32 #ifndef _SPARC64_DEV_EBUSVAR_H_
33 #define _SPARC64_DEV_EBUSVAR_H_
34 
35 /*
36  * ebus arguments; ebus attaches to a pci, and devices attach
37  * to the ebus.
38  */
39 
40 struct ebus_attach_args {
41 	char			*ea_name;	/* PROM name */
42 	int			ea_node;	/* PROM node */
43 
44 	bus_space_tag_t		ea_memtag;
45 	bus_space_tag_t		ea_iotag;
46 	bus_dma_tag_t		ea_dmatag;
47 
48 	struct ebus_regs	*ea_regs;	/* registers */
49 	u_int32_t		*ea_vaddrs;	/* virtual addrs */
50 	u_int32_t		*ea_intrs;	/* interrupts */
51 
52 	int			ea_nregs;	/* number of them */
53 	int			ea_nvaddrs;
54 	int			ea_nintrs;
55 };
56 
57 struct ebus_softc {
58 	struct device			sc_dev;
59 
60 	int				sc_node;
61 
62 	bus_space_tag_t			sc_memtag;	/* from pci */
63 	bus_space_tag_t			sc_iotag;	/* from pci */
64 	bus_dma_tag_t			sc_dmatag;	/* XXX */
65 
66 	void				*sc_range;
67 	struct ebus_interrupt_map	*sc_intmap;
68 	struct ebus_interrupt_map_mask	sc_intmapmask;
69 
70 	int				sc_nrange;	/* counters */
71 	int				sc_nintmap;
72 
73 	int				sc_ign;
74 
75 	bus_space_tag_t			sc_bust;
76 	bus_addr_t			sc_csr;
77 	bus_space_handle_t		sc_csrh;
78 };
79 
80 
81 int ebus_setup_attach_args(struct ebus_softc *, int,
82     struct ebus_attach_args *);
83 void ebus_destroy_attach_args(struct ebus_attach_args *);
84 int ebus_print(void *, const char *);
85 
86 
87 bus_dma_tag_t ebus_alloc_dma_tag(struct ebus_softc *, bus_dma_tag_t);
88 
89 #define ebus_bus_map(t, bt, a, s, f, v, hp) \
90 	bus_space_map(t, a, s, f, hp)
91 
92 #endif /* _SPARC64_DEV_EBUSVAR_H_ */
93