xref: /openbsd/sys/arch/sparc64/dev/ebusvar.h (revision 0af614b4)
1 /*	$OpenBSD: ebusvar.h,v 1.8 2019/12/05 12:46:54 mpi 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  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  */
29 
30 #ifndef _SPARC64_DEV_EBUSVAR_H_
31 #define _SPARC64_DEV_EBUSVAR_H_
32 
33 /*
34  * ebus arguments; ebus attaches to a pci, and devices attach
35  * to the ebus.
36  */
37 
38 struct ebus_attach_args {
39 	char			*ea_name;	/* PROM name */
40 	int			ea_node;	/* PROM node */
41 
42 	bus_space_tag_t		ea_memtag;
43 	bus_space_tag_t		ea_iotag;
44 	bus_dma_tag_t		ea_dmatag;
45 
46 	struct ebus_regs	*ea_regs;	/* registers */
47 	u_int32_t		*ea_vaddrs;	/* virtual addrs */
48 	u_int32_t		*ea_intrs;	/* interrupts */
49 
50 	int			ea_nregs;	/* number of them */
51 	int			ea_nvaddrs;
52 	int			ea_nintrs;
53 };
54 
55 struct ebus_softc {
56 	struct device			sc_dev;
57 
58 	int				sc_node;
59 
60 	bus_space_tag_t			sc_memtag;	/* from pci */
61 	bus_space_tag_t			sc_iotag;	/* from pci */
62 	bus_dma_tag_t			sc_dmatag;	/* XXX */
63 
64 	void				*sc_range;
65 	struct ebus_interrupt_map	*sc_intmap;
66 	struct ebus_interrupt_map_mask	sc_intmapmask;
67 
68 	int				sc_nrange;	/* counters */
69 	int				sc_nintmap;
70 };
71 
72 
73 int ebus_setup_attach_args(struct ebus_softc *, int,
74     struct ebus_attach_args *);
75 void ebus_destroy_attach_args(struct ebus_attach_args *);
76 int ebus_print(void *, const char *);
77 
78 
79 bus_dma_tag_t ebus_alloc_dma_tag(struct ebus_softc *, bus_dma_tag_t);
80 
81 #define ebus_bus_map(t, bt, a, s, f, v, hp) \
82 	bus_space_map(t, a, s, f, hp)
83 
84 #endif /* _SPARC64_DEV_EBUSVAR_H_ */
85