1 /* $NetBSD: bus.h,v 1.12 1997/10/01 08:25:15 fvdl Exp $ */
3 * $Id: bus.h,v 1.6 2007/08/09 11:23:32 katta Exp $
5 * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
10 * NASA Ames Research Center.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
21 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
35 * Copyright (c) 1996 Charles M. Hannum. All rights reserved.
36 * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
41 * 1. Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution.
46 * 3. All advertising materials mentioning features or use of this software
47 * must display the following acknowledgement:
48 * This product includes software developed by Christopher G. Demetriou
49 * for the NetBSD Project.
50 * 4. The name of the author may not be used to endorse or promote products
51 * derived from this software without specific prior written permission
53 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
54 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
55 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
56 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
57 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
58 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
59 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
60 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
61 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
62 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
64 * from: src/sys/alpha/include/bus.h,v 1.5 1999/08/28 00:38:40 peter
67 #include <sys/cdefs.h>
68 __FBSDID("$FreeBSD$");
70 #include <sys/param.h>
71 #include <sys/systm.h>
73 #include <sys/kernel.h>
74 #include <sys/malloc.h>
79 #include <vm/vm_kern.h>
80 #include <vm/vm_extern.h>
82 #include <machine/bus.h>
83 #include <machine/cache.h>
85 static int fdt_bs_map(void *, bus_addr_t, bus_size_t, int,
86 bus_space_handle_t *);
88 static struct bus_space fdt_space = {
90 .bs_cookie = (void *) 0,
92 /* mapping/unmapping */
94 .bs_unmap = generic_bs_unmap,
95 .bs_subregion = generic_bs_subregion,
97 /* allocation/deallocation */
98 .bs_alloc = generic_bs_alloc,
99 .bs_free = generic_bs_free,
102 .bs_barrier = generic_bs_barrier,
105 .bs_r_1 = generic_bs_r_1,
106 .bs_r_2 = generic_bs_r_2,
107 .bs_r_4 = generic_bs_r_4,
108 .bs_r_8 = generic_bs_r_8,
111 .bs_rm_1 = generic_bs_rm_1,
112 .bs_rm_2 = generic_bs_rm_2,
113 .bs_rm_4 = generic_bs_rm_4,
114 .bs_rm_8 = generic_bs_rm_8,
117 .bs_rr_1 = generic_bs_rr_1,
118 .bs_rr_2 = generic_bs_rr_2,
119 .bs_rr_4 = generic_bs_rr_4,
120 .bs_rr_8 = generic_bs_rr_8,
123 .bs_w_1 = generic_bs_w_1,
124 .bs_w_2 = generic_bs_w_2,
125 .bs_w_4 = generic_bs_w_4,
126 .bs_w_8 = generic_bs_w_8,
129 .bs_wm_1 = generic_bs_wm_1,
130 .bs_wm_2 = generic_bs_wm_2,
131 .bs_wm_4 = generic_bs_wm_4,
132 .bs_wm_8 = generic_bs_wm_8,
135 .bs_wr_1 = generic_bs_wr_1,
136 .bs_wr_2 = generic_bs_wr_2,
137 .bs_wr_4 = generic_bs_wr_4,
138 .bs_wr_8 = generic_bs_wr_8,
141 .bs_sm_1 = generic_bs_sm_1,
142 .bs_sm_2 = generic_bs_sm_2,
143 .bs_sm_4 = generic_bs_sm_4,
144 .bs_sm_8 = generic_bs_sm_8,
147 .bs_sr_1 = generic_bs_sr_1,
148 .bs_sr_2 = generic_bs_sr_2,
149 .bs_sr_4 = generic_bs_sr_4,
150 .bs_sr_8 = generic_bs_sr_8,
153 .bs_c_1 = generic_bs_c_1,
154 .bs_c_2 = generic_bs_c_2,
155 .bs_c_4 = generic_bs_c_4,
156 .bs_c_8 = generic_bs_c_8,
158 /* read (single) stream */
159 .bs_r_1_s = generic_bs_r_1,
160 .bs_r_2_s = generic_bs_r_2,
161 .bs_r_4_s = generic_bs_r_4,
162 .bs_r_8_s = generic_bs_r_8,
164 /* read multiple stream */
165 .bs_rm_1_s = generic_bs_rm_1,
166 .bs_rm_2_s = generic_bs_rm_2,
167 .bs_rm_4_s = generic_bs_rm_4,
168 .bs_rm_8_s = generic_bs_rm_8,
170 /* read region stream */
171 .bs_rr_1_s = generic_bs_rr_1,
172 .bs_rr_2_s = generic_bs_rr_2,
173 .bs_rr_4_s = generic_bs_rr_4,
174 .bs_rr_8_s = generic_bs_rr_8,
176 /* write (single) stream */
177 .bs_w_1_s = generic_bs_w_1,
178 .bs_w_2_s = generic_bs_w_2,
179 .bs_w_4_s = generic_bs_w_4,
180 .bs_w_8_s = generic_bs_w_8,
182 /* write multiple stream */
183 .bs_wm_1_s = generic_bs_wm_1,
184 .bs_wm_2_s = generic_bs_wm_2,
185 .bs_wm_4_s = generic_bs_wm_4,
186 .bs_wm_8_s = generic_bs_wm_8,
188 /* write region stream */
189 .bs_wr_1_s = generic_bs_wr_1,
190 .bs_wr_2_s = generic_bs_wr_2,
191 .bs_wr_4_s = generic_bs_wr_4,
192 .bs_wr_8_s = generic_bs_wr_8,
195 /* generic bus_space tag */
196 bus_space_tag_t mips_bus_space_fdt = &fdt_space;
199 fdt_bs_map(void *t __unused, bus_addr_t addr, bus_size_t size __unused,
200 int flags __unused, bus_space_handle_t *bshp)
203 *bshp = MIPS_PHYS_TO_DIRECT_UNCACHED(addr);