1 /* $NetBSD: mvmebus.h,v 1.2 2007/03/04 06:02:15 christos Exp $ */
4 * Copyright (c) 2000, 2002 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Steve C. Woodford.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _MVME_MVMEBUS_H
33 #define _MVME_MVMEBUS_H
36 * VMEbus master and slave windows are described using
37 * instances of this structure.
39 * The chip-specific code records the details of the available mappings
42 struct mvmebus_range
{
43 vme_am_t vr_am
; /* Address modifier (A16, A24, A32) */
44 vme_datasize_t vr_datasize
; /* Datasize: logical OR of D8,D16,D32 */
45 paddr_t vr_locstart
; /* CPU-relative address of mapping */
46 paddr_t vr_mask
; /* Mask to apply to this mapping */
47 vme_addr_t vr_vmestart
; /* VMEbus start address */
48 vme_addr_t vr_vmeend
; /* VMEbus end address */
51 /* Assigned to vr_am to specify the mapping is not valid */
52 #define MVMEBUS_AM_DISABLED ((vme_am_t)-1)
54 /* For slave mappings, these specify the slave's capabilities */
55 #define MVMEBUS_AM_CAP_DATA 0x0100
56 #define MVMEBUS_AM_CAP_PROG 0x0200
57 #define MVMEBUS_AM_CAP_BLK 0x0400
58 #define MVMEBUS_AM_CAP_BLKD64 0x0800
59 #define MVMEBUS_AM_CAP_USER 0x1000
60 #define MVMEBUS_AM_CAP_SUPER 0x2000
61 #define MVMEBUS_AM_HAS_CAP(x) (((x) & 0x3f00) != 0)
63 #define MVMEBUS_AM2CAP(am) (_mvmebus_am_cap[((am) & \
64 (VME_AM_MODEMASK | VME_AM_PRIVMASK))])
68 * This records VMEbus-specific details of a region of bus_space_map'd
69 * VMEbus address space.
71 struct mvmebus_mapresc
{
72 bus_space_handle_t mr_handle
;
76 vme_datasize_t mr_datasize
;
82 * This records the VMEbus-specific details of a region of phyisical
83 * memory accessible through a VMEbus slave map.
85 struct mvmebus_dmamap
{
87 vme_datasize_t vm_datasize
;
89 struct mvmebus_range
*vm_slave
;
93 struct mvmebus_softc
{
95 bus_space_tag_t sc_bust
;
96 bus_dma_tag_t sc_dmat
;
100 struct mvmebus_range
*sc_masters
;
102 struct mvmebus_range
*sc_slaves
;
103 struct evcnt sc_evcnt
[7];
104 void (*sc_intr_establish
)(void *, int, int, int, int,
105 int (*)(void *), void *, struct evcnt
*);
106 void (*sc_intr_disestablish
)(void *, int, int, int,
108 struct vme_chipset_tag sc_vct
;
109 struct mvme68k_bus_dma_tag sc_mvmedmat
;
113 void mvmebus_attach(struct mvmebus_softc
*);
114 int mvmebus_map(void *, vme_addr_t
, vme_size_t
, vme_am_t
,
115 vme_datasize_t
, vme_swap_t
, bus_space_tag_t
*,
116 bus_space_handle_t
*, vme_mapresc_t
*);
117 void mvmebus_unmap(void *, vme_mapresc_t
);
118 int mvmebus_probe(void *, vme_addr_t
, vme_size_t
,
119 vme_am_t
, vme_datasize_t
,
120 int (*) (void *, bus_space_tag_t
, bus_space_handle_t
), void *arg
);
121 int mvmebus_intmap(void *, int, int, vme_intr_handle_t
*);
122 const struct evcnt
*mvmebus_intr_evcnt(void *, vme_intr_handle_t
);
123 void * mvmebus_intr_establish(void *, vme_intr_handle_t
, int,
124 int (*) (void *), void *);
125 void mvmebus_intr_disestablish(void *, vme_intr_handle_t
);
127 int mvmebus_dmamap_create(void *, vme_size_t
, vme_am_t
, vme_datasize_t
,
128 vme_swap_t
, int, vme_size_t
, vme_addr_t
, int, bus_dmamap_t
*);
129 void mvmebus_dmamap_destroy(void *, bus_dmamap_t
);
130 int mvmebus_dmamap_load(bus_dma_tag_t
, bus_dmamap_t
,
131 void *, bus_size_t
, struct proc
*, int);
132 int mvmebus_dmamap_load_mbuf(bus_dma_tag_t
,
133 bus_dmamap_t
, struct mbuf
*, int);
134 int mvmebus_dmamap_load_uio(bus_dma_tag_t
,
135 bus_dmamap_t
, struct uio
*, int);
136 int mvmebus_dmamap_load_raw(bus_dma_tag_t
,
137 bus_dmamap_t
, bus_dma_segment_t
*, int, bus_size_t
, int);
138 void mvmebus_dmamap_unload(bus_dma_tag_t
, bus_dmamap_t
);
139 void mvmebus_dmamap_sync(bus_dma_tag_t
, bus_dmamap_t
, bus_addr_t
,
142 int mvmebus_dmamem_alloc(void *, vme_size_t
, vme_am_t
, vme_datasize_t
,
143 vme_swap_t
, bus_dma_segment_t
*, int, int *, int);
144 void mvmebus_dmamem_free(void *, bus_dma_segment_t
*, int);
145 int mvmebus_dmamem_map(bus_dma_tag_t
, bus_dma_segment_t
*, int,
146 size_t, void **, int);
147 void mvmebus_dmamem_unmap(bus_dma_tag_t
, void *, size_t);
148 paddr_t
mvmebus_dmamem_mmap(bus_dma_tag_t
, bus_dma_segment_t
*, int,
151 extern vme_am_t _mvmebus_am_cap
[];
152 extern const char *mvmebus_irq_name
[];
154 #endif /* _MVME_MVMEBUS_H */