2 * Copyright (c) 2014 Andrew Turner
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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.
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
28 #include <machine/asm.h>
49 ENTRY(generic_bs_rm_1)
50 /* If there is anything to read. */
53 /* Calculate the device address. */
56 * x0 = The device address.
57 * x3 = The kernel address.
70 ENTRY(generic_bs_rm_2)
71 /* If there is anything to read. */
74 /* Calculate the device address. */
77 * x0 = The device address.
78 * x3 = The kernel address.
91 ENTRY(generic_bs_rm_4)
92 /* If there is anything to read. */
95 /* Calculate the device address. */
98 * x0 = The device address.
99 * x3 = The kernel address.
112 ENTRY(generic_bs_rm_8)
113 /* If there is anything to read. */
116 /* Calculate the device address. */
119 * x0 = The device address.
120 * x3 = The kernel address.
133 ENTRY(generic_bs_rr_1)
134 /* Is there is anything to read. */
137 /* Calculate the device address. */
140 * x0 = The device address.
141 * x3 = The kernel address.
154 ENTRY(generic_bs_rr_2)
155 /* Is there is anything to read. */
158 /* Calculate the device address. */
161 * x0 = The device address.
162 * x3 = The kernel address.
175 ENTRY(generic_bs_rr_4)
176 /* Is there is anything to read. */
179 /* Calculate the device address. */
182 * x0 = The device address.
183 * x3 = The kernel address.
196 ENTRY(generic_bs_rr_8)
197 /* Is there is anything to read. */
200 /* Calculate the device address. */
203 * x0 = The device address.
204 * x3 = The kernel address.
218 ENTRY(generic_bs_w_1)
223 ENTRY(generic_bs_w_2)
228 ENTRY(generic_bs_w_4)
233 ENTRY(generic_bs_w_8)
238 ENTRY(generic_bs_wm_1)
239 /* If there is anything to write. */
244 * x0 = The device address.
245 * x3 = The kernel address.
258 ENTRY(generic_bs_wm_2)
259 /* If there is anything to write. */
264 * x0 = The device address.
265 * x3 = The kernel address.
278 ENTRY(generic_bs_wm_4)
279 /* If there is anything to write. */
284 * x0 = The device address.
285 * x3 = The kernel address.
298 ENTRY(generic_bs_wm_8)
299 /* If there is anything to write. */
304 * x0 = The device address.
305 * x3 = The kernel address.
318 ENTRY(generic_bs_wr_1)
319 /* Is there is anything to write. */
324 * x0 = The device address.
325 * x3 = The kernel address.
338 ENTRY(generic_bs_wr_2)
339 /* Is there is anything to write. */
344 * x0 = The device address.
345 * x3 = The kernel address.
358 ENTRY(generic_bs_wr_4)
359 /* Is there is anything to write. */
364 * x0 = The device address.
365 * x3 = The kernel address.
378 ENTRY(generic_bs_wr_8)
379 /* Is there is anything to write. */
384 * x0 = The device address.
385 * x3 = The kernel address.
398 ENTRY(generic_bs_fault)
401 END(generic_bs_fault)
403 ENTRY(generic_bs_peek_1)
404 .globl generic_bs_peek_1f
406 ldrb w0, [x1, x2] /* Checked instruction */
411 END(generic_bs_peek_1)
413 ENTRY(generic_bs_peek_2)
414 .globl generic_bs_peek_2f
416 ldrh w0, [x1, x2] /* Checked instruction */
421 END(generic_bs_peek_2)
423 ENTRY(generic_bs_peek_4)
424 .globl generic_bs_peek_4f
426 ldr w0, [x1, x2] /* Checked instruction */
431 END(generic_bs_peek_4)
433 ENTRY(generic_bs_peek_8)
434 .globl generic_bs_peek_8f
436 ldr x0, [x1, x2] /* Checked instruction */
441 END(generic_bs_peek_8)
443 ENTRY(generic_bs_poke_1)
444 .globl generic_bs_poke_1f
446 strb w3, [x1, x2] /* Checked instruction */
450 END(generic_bs_poke_1)
452 ENTRY(generic_bs_poke_2)
453 .globl generic_bs_poke_2f
455 strh w3, [x1, x2] /* Checked instruction */
459 END(generic_bs_poke_2)
461 ENTRY(generic_bs_poke_4)
462 .globl generic_bs_poke_4f
464 str w3, [x1, x2] /* Checked instruction */
468 END(generic_bs_poke_4)
470 ENTRY(generic_bs_poke_8)
471 .globl generic_bs_poke_8f
473 str x3, [x1, x2] /* Checked instruction */
477 END(generic_bs_poke_8)