1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * linux/drivers/acorn/scsi/acornscsi-io.S: Acorn SCSI card IO
5 #include <linux/linkage.h>
7 #include <asm/assembler.h>
8 #include <mach/hardware.h>
10 #if defined(__APCS_32__)
11 #define LOADREGS(t,r,l...) ldm##t r, l
12 #elif defined(__APCS_26__)
13 #define LOADREGS(t,r,l...) ldm##t r, l##^
16 @ Purpose: transfer a block of data from the acorn scsi card to memory
17 @ Proto : void acornscsi_in(unsigned int addr_start, char *buffer, int length)
22 stmfd sp!, {r4 - r7, lr}
29 ldmia r0!, {r3, r4, r5, r6}
31 orr r3, r3, r4, lsl #16
33 orr r4, r4, r6, lsl #16
34 ldmia r0!, {r5, r6, r7, ip}
36 orr r5, r5, r6, lsl #16
38 orr r6, r6, ip, lsl #16
41 LOADREGS(fd, sp!, {r4 - r7, pc})
43 acornscsi_in8: adds r2, r2, #8
45 ldmia r0!, {r3, r4, r5, r6}
47 orr r3, r3, r4, lsl #16
49 orr r4, r4, r6, lsl #16
51 LOADREGS(eqfd, sp!, {r4 - r7, pc})
54 acornscsi_in4: adds r2, r2, #4
58 orr r3, r3, r4, lsl #16
60 LOADREGS(eqfd, sp!, {r4 - r7, pc})
63 acornscsi_in2: adds r2, r2, #2
69 LOADREGS(fd, sp!, {r4 - r7, pc})
71 @ Purpose: transfer a block of data from memory to the acorn scsi card
72 @ Proto : void acornscsi_in(unsigned int addr_start, char *buffer, int length)
75 ENTRY(__acornscsi_out)
76 stmfd sp!, {r4 - r6, lr}
81 ldmia r1!, {r4, r6, ip, lr}
83 orr r3, r3, r3, lsr #16
85 orr r4, r4, r4, lsl #16
87 orr r5, r5, r5, lsr #16
89 orr r6, r6, r6, lsl #16
90 stmia r0!, {r3, r4, r5, r6}
92 orr r3, r3, r3, lsr #16
94 orr r4, r4, r4, lsl #16
96 orr ip, ip, ip, lsr #16
98 orr lr, lr, lr, lsl #16
99 stmia r0!, {r3, r4, ip, lr}
100 bne acornscsi_out16lp
101 LOADREGS(fd, sp!, {r4 - r6, pc})
103 acornscsi_out8: adds r2, r2, #8
107 orr r3, r3, r3, lsr #16
109 orr r4, r4, r4, lsl #16
111 orr r5, r5, r5, lsr #16
113 orr r6, r6, r6, lsl #16
114 stmia r0!, {r3, r4, r5, r6}
115 LOADREGS(eqfd, sp!, {r4 - r6, pc})
118 acornscsi_out4: adds r2, r2, #4
122 orr r3, r3, r3, lsr #16
124 orr r4, r4, r4, lsl #16
126 LOADREGS(eqfd, sp!, {r4 - r6, pc})
129 acornscsi_out2: adds r2, r2, #2
134 LOADREGS(fd, sp!, {r4 - r6, pc})