1 /*        $NetBSD: ebusvar.h,v 1.12 2014/08/24 19:06:14 palle Exp $   */
2 
3 /*
4  * Copyright (c) 1999, 2000, 2001 Matthew R. Green
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  */
28 
29 #ifndef _SPARC64_DEV_EBUSVAR_H_
30 #define _SPARC64_DEV_EBUSVAR_H_
31 
32 #include <sys/param.h>
33 #include <sys/conf.h>
34 #include <sys/device.h>
35 #include <sys/systm.h>
36 #include <sys/time.h>
37 
38 #define _SPARC_BUS_DMA_PRIVATE
39 #include <sys/bus.h>
40 
41 #include <dev/pci/pcivar.h>
42 #include <dev/pci/pcireg.h>
43 #include <dev/pci/pcidevs.h>
44 
45 #include <dev/ebus/ebusreg.h>
46 #include <dev/ebus/ebusvar.h>
47 
48 struct ebus_softc {
49           device_t                      sc_dev;
50 
51           int                                     sc_node;
52 
53           bus_space_tag_t                         sc_memtag;          /* from pci */
54           bus_space_tag_t                         sc_iotag; /* from pci */
55           bus_space_tag_t                         sc_childbustag;     /* pass to children */
56           bus_dma_tag_t                           sc_dmatag;
57 
58           struct ebus_ranges            *sc_range;
59           struct ebus_interrupt_map     *sc_intmap;
60           struct ebus_interrupt_map_mask          sc_intmapmask;
61 
62           int                                     sc_nrange;          /* counters */
63           int                                     sc_nintmap;
64 };
65 
66 int       ebus_setup_attach_args(struct ebus_softc *, int,
67               struct ebus_attach_args *);
68 void      ebus_destroy_attach_args(struct ebus_attach_args *);
69 int       ebus_print(void *, const char *);
70 void      ebus_find_ino(struct ebus_softc *, struct ebus_attach_args *);
71 
72 paddr_t ebus_bus_mmap(bus_space_tag_t, bus_addr_t, off_t, int, int);
73 
74 bus_space_tag_t ebus_alloc_bus_tag(struct ebus_softc *, int);
75 
76 #endif
77