1 /*-
2 * Copyright (c) 2014 Andrew Turner
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 */
27
28 #include <machine/asm.h>
29
30 __FBSDID("$FreeBSD: releng/11.2/sys/arm64/arm64/bus_space_asm.S 286768 2015-08-14 09:55:25Z andrew $");
31
32 ENTRY(generic_bs_r_1)
33 ldrb w0, [x1, x2]
34 ret
35 END(generic_bs_r_1)
36
37 ENTRY(generic_bs_r_2)
38 ldrh w0, [x1, x2]
39 ret
40 END(generic_bs_r_2)
41
42 ENTRY(generic_bs_r_4)
43 ldr w0, [x1, x2]
44 ret
45 END(generic_bs_r_4)
46
47 ENTRY(generic_bs_r_8)
48 ldr x0, [x1, x2]
49 ret
50 END(generic_bs_r_8)
51
52 ENTRY(generic_bs_rm_1)
53 /* If there is anything to read. */
54 cbz x4, 2f
55
56 /* Calculate the device address. */
57 add x0, x1, x2
58 /*
59 * x0 = The device address.
60 * x3 = The kernel address.
61 * x4 = Count
62 */
63
64 /* Read the data. */
65 1: ldrb w1, [x0]
66 strb w1, [x3], #1
67 subs x4, x4, #1
68 b.ne 1b
69
70 2: ret
71 END(generic_bs_rm_1)
72
73 ENTRY(generic_bs_rm_2)
74 /* If there is anything to read. */
75 cbz x4, 2f
76
77 /* Calculate the device address. */
78 add x0, x1, x2
79 /*
80 * x0 = The device address.
81 * x3 = The kernel address.
82 * x4 = Count
83 */
84
85 /* Read the data. */
86 1: ldrh w1, [x0]
87 strh w1, [x3], #2
88 subs x4, x4, #1
89 b.ne 1b
90
91 2: ret
92 END(generic_bs_rm_2)
93
94 ENTRY(generic_bs_rm_4)
95 /* If there is anything to read. */
96 cbz x4, 2f
97
98 /* Calculate the device address. */
99 add x0, x1, x2
100 /*
101 * x0 = The device address.
102 * x3 = The kernel address.
103 * x4 = Count
104 */
105
106 /* Read the data. */
107 1: ldr w1, [x0]
108 str w1, [x3], #4
109 subs x4, x4, #1
110 b.ne 1b
111
112 2: ret
113 END(generic_bs_rm_4)
114
115 ENTRY(generic_bs_rm_8)
116 /* If there is anything to read. */
117 cbz x4, 2f
118
119 /* Calculate the device address. */
120 add x0, x1, x2
121 /*
122 * x0 = The device address.
123 * x3 = The kernel address.
124 * x4 = Count
125 */
126
127 /* Read the data. */
128 1: ldr x1, [x0]
129 str x1, [x3], #8
130 subs x4, x4, #1
131 b.ne 1b
132
133 2: ret
134 END(generic_bs_rm_8)
135
136 ENTRY(generic_bs_rr_1)
137 /* Is there is anything to read. */
138 cbz x4, 2f
139
140 /* Calculate the device address. */
141 add x0, x1, x2
142 /*
143 * x0 = The device address.
144 * x3 = The kernel address.
145 * x4 = Count
146 */
147
148 /* Read the data. */
149 1: ldrb w1, [x0], #1
150 strb w1, [x3], #1
151 subs x4, x4, #1
152 b.ne 1b
153
154 2: ret
155 END(generic_bs_rr_1)
156
157 ENTRY(generic_bs_rr_2)
158 /* Is there is anything to read. */
159 cbz x4, 2f
160
161 /* Calculate the device address. */
162 add x0, x1, x2
163 /*
164 * x0 = The device address.
165 * x3 = The kernel address.
166 * x4 = Count
167 */
168
169 /* Read the data. */
170 1: ldrh w1, [x0], #2
171 strh w1, [x3], #2
172 subs x4, x4, #1
173 b.ne 1b
174
175 2: ret
176 END(generic_bs_rr_2)
177
178 ENTRY(generic_bs_rr_4)
179 /* Is there is anything to read. */
180 cbz x4, 2f
181
182 /* Calculate the device address. */
183 add x0, x1, x2
184 /*
185 * x0 = The device address.
186 * x3 = The kernel address.
187 * x4 = Count
188 */
189
190 /* Read the data. */
191 1: ldr w1, [x0], #4
192 str w1, [x3], #4
193 subs x4, x4, #1
194 b.ne 1b
195
196 2: ret
197 END(generic_bs_rr_4)
198
199 ENTRY(generic_bs_rr_8)
200 /* Is there is anything to read. */
201 cbz x4, 2f
202
203 /* Calculate the device address. */
204 add x0, x1, x2
205 /*
206 * x0 = The device address.
207 * x3 = The kernel address.
208 * x4 = Count
209 */
210
211 /* Read the data. */
212 1: ldr x1, [x0], #8
213 str x1, [x3], #8
214 subs x4, x4, #1
215 b.ne 1b
216
217 2: ret
218 END(generic_bs_rr_8)
219
220
221 ENTRY(generic_bs_w_1)
222 strb w3, [x1, x2]
223 ret
224 END(generic_bs_w_1)
225
226 ENTRY(generic_bs_w_2)
227 strh w3, [x1, x2]
228 ret
229 END(generic_bs_w_2)
230
231 ENTRY(generic_bs_w_4)
232 str w3, [x1, x2]
233 ret
234 END(generic_bs_w_4)
235
236 ENTRY(generic_bs_w_8)
237 str x3, [x1, x2]
238 ret
239 END(generic_bs_w_8)
240
241 ENTRY(generic_bs_wm_1)
242 /* If there is anything to write. */
243 cbz x4, 2f
244
245 add x0, x1, x2
246 /*
247 * x0 = The device address.
248 * x3 = The kernel address.
249 * x4 = Count
250 */
251
252 /* Write the data */
253 1: ldrb w1, [x3], #1
254 strb w1, [x0]
255 subs x4, x4, #1
256 b.ne 1b
257
258 2: ret
259 END(generic_bs_wm_1)
260
261 ENTRY(generic_bs_wm_2)
262 /* If there is anything to write. */
263 cbz x4, 2f
264
265 add x0, x1, x2
266 /*
267 * x0 = The device address.
268 * x3 = The kernel address.
269 * x4 = Count
270 */
271
272 /* Write the data */
273 1: ldrh w1, [x3], #2
274 strh w1, [x0]
275 subs x4, x4, #1
276 b.ne 1b
277
278 2: ret
279 END(generic_bs_wm_2)
280
281 ENTRY(generic_bs_wm_4)
282 /* If there is anything to write. */
283 cbz x4, 2f
284
285 add x0, x1, x2
286 /*
287 * x0 = The device address.
288 * x3 = The kernel address.
289 * x4 = Count
290 */
291
292 /* Write the data */
293 1: ldr w1, [x3], #4
294 str w1, [x0]
295 subs x4, x4, #1
296 b.ne 1b
297
298 2: ret
299 END(generic_bs_wm_4)
300
301 ENTRY(generic_bs_wm_8)
302 /* If there is anything to write. */
303 cbz x4, 2f
304
305 add x0, x1, x2
306 /*
307 * x0 = The device address.
308 * x3 = The kernel address.
309 * x4 = Count
310 */
311
312 /* Write the data */
313 1: ldr x1, [x3], #8
314 str x1, [x0]
315 subs x4, x4, #1
316 b.ne 1b
317
318 2: ret
319 END(generic_bs_wm_8)
320
321 ENTRY(generic_bs_wr_1)
322 /* Is there is anything to write. */
323 cbz x4, 2f
324
325 add x0, x1, x2
326 /*
327 * x0 = The device address.
328 * x3 = The kernel address.
329 * x4 = Count
330 */
331
332 /* Write the data */
333 1: ldrb w1, [x3], #1
334 strb w1, [x0], #1
335 subs x4, x4, #1
336 b.ne 1b
337
338 2: ret
339 END(generic_bs_wr_1)
340
341 ENTRY(generic_bs_wr_2)
342 /* Is there is anything to write. */
343 cbz x4, 2f
344
345 add x0, x1, x2
346 /*
347 * x0 = The device address.
348 * x3 = The kernel address.
349 * x4 = Count
350 */
351
352 /* Write the data */
353 1: ldrh w1, [x3], #2
354 strh w1, [x0], #2
355 subs x4, x4, #1
356 b.ne 1b
357
358 2: ret
359 END(generic_bs_wr_2)
360
361 ENTRY(generic_bs_wr_4)
362 /* Is there is anything to write. */
363 cbz x4, 2f
364
365 add x0, x1, x2
366 /*
367 * x0 = The device address.
368 * x3 = The kernel address.
369 * x4 = Count
370 */
371
372 /* Write the data */
373 1: ldr w1, [x3], #4
374 str w1, [x0], #4
375 subs x4, x4, #1
376 b.ne 1b
377
378 2: ret
379 END(generic_bs_wr_4)
380
381 ENTRY(generic_bs_wr_8)
382 /* Is there is anything to write. */
383 cbz x4, 2f
384
385 add x0, x1, x2
386 /*
387 * x0 = The device address.
388 * x3 = The kernel address.
389 * x4 = Count
390 */
391
392 /* Write the data */
393 1: ldr x1, [x3], #8
394 str x1, [x0], #8
395 subs x4, x4, #1
396 b.ne 1b
397
398 2: ret
399 END(generic_bs_wr_8)
Cache object: 63af301865f5a81ebdfb779df4609dc4
|