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