1*d2912cb1SThomas Gleixner/* SPDX-License-Identifier: GPL-2.0-only */ 21da177e4SLinus Torvalds/* 31da177e4SLinus Torvalds * linux/drivers/acorn/scsi/acornscsi-io.S: Acorn SCSI card IO 41da177e4SLinus Torvalds */ 51da177e4SLinus Torvalds#include <linux/linkage.h> 61da177e4SLinus Torvalds 71da177e4SLinus Torvalds#include <asm/assembler.h> 8a09e64fbSRussell King#include <mach/hardware.h> 91da177e4SLinus Torvalds 10324b9337SRussell King#if defined(__APCS_32__) 11324b9337SRussell King#define LOADREGS(t,r,l...) ldm##t r, l 12324b9337SRussell King#elif defined(__APCS_26__) 13324b9337SRussell King#define LOADREGS(t,r,l...) ldm##t r, l##^ 14324b9337SRussell King#endif 15324b9337SRussell King 161da177e4SLinus Torvalds@ Purpose: transfer a block of data from the acorn scsi card to memory 171da177e4SLinus Torvalds@ Proto : void acornscsi_in(unsigned int addr_start, char *buffer, int length) 181da177e4SLinus Torvalds@ Returns: nothing 191da177e4SLinus Torvalds 201da177e4SLinus Torvalds .align 211da177e4SLinus TorvaldsENTRY(__acornscsi_in) 221da177e4SLinus Torvalds stmfd sp!, {r4 - r7, lr} 231da177e4SLinus Torvalds bic r0, r0, #3 241da177e4SLinus Torvalds mov lr, #0xff 251da177e4SLinus Torvalds orr lr, lr, #0xff00 261da177e4SLinus Torvaldsacornscsi_in16lp: 271da177e4SLinus Torvalds subs r2, r2, #16 281da177e4SLinus Torvalds bmi acornscsi_in8 291da177e4SLinus Torvalds ldmia r0!, {r3, r4, r5, r6} 301da177e4SLinus Torvalds and r3, r3, lr 311da177e4SLinus Torvalds orr r3, r3, r4, lsl #16 321da177e4SLinus Torvalds and r4, r5, lr 331da177e4SLinus Torvalds orr r4, r4, r6, lsl #16 341da177e4SLinus Torvalds ldmia r0!, {r5, r6, r7, ip} 351da177e4SLinus Torvalds and r5, r5, lr 361da177e4SLinus Torvalds orr r5, r5, r6, lsl #16 371da177e4SLinus Torvalds and r6, r7, lr 381da177e4SLinus Torvalds orr r6, r6, ip, lsl #16 391da177e4SLinus Torvalds stmia r1!, {r3 - r6} 401da177e4SLinus Torvalds bne acornscsi_in16lp 411da177e4SLinus Torvalds LOADREGS(fd, sp!, {r4 - r7, pc}) 421da177e4SLinus Torvalds 431da177e4SLinus Torvaldsacornscsi_in8: adds r2, r2, #8 441da177e4SLinus Torvalds bmi acornscsi_in4 451da177e4SLinus Torvalds ldmia r0!, {r3, r4, r5, r6} 461da177e4SLinus Torvalds and r3, r3, lr 471da177e4SLinus Torvalds orr r3, r3, r4, lsl #16 481da177e4SLinus Torvalds and r4, r5, lr 491da177e4SLinus Torvalds orr r4, r4, r6, lsl #16 501da177e4SLinus Torvalds stmia r1!, {r3 - r4} 511da177e4SLinus Torvalds LOADREGS(eqfd, sp!, {r4 - r7, pc}) 521da177e4SLinus Torvalds sub r2, r2, #8 531da177e4SLinus Torvalds 541da177e4SLinus Torvaldsacornscsi_in4: adds r2, r2, #4 551da177e4SLinus Torvalds bmi acornscsi_in2 561da177e4SLinus Torvalds ldmia r0!, {r3, r4} 571da177e4SLinus Torvalds and r3, r3, lr 581da177e4SLinus Torvalds orr r3, r3, r4, lsl #16 591da177e4SLinus Torvalds str r3, [r1], #4 601da177e4SLinus Torvalds LOADREGS(eqfd, sp!, {r4 - r7, pc}) 611da177e4SLinus Torvalds sub r2, r2, #4 621da177e4SLinus Torvalds 631da177e4SLinus Torvaldsacornscsi_in2: adds r2, r2, #2 641da177e4SLinus Torvalds ldr r3, [r0], #4 651da177e4SLinus Torvalds and r3, r3, lr 661da177e4SLinus Torvalds strb r3, [r1], #1 671da177e4SLinus Torvalds mov r3, r3, lsr #8 681da177e4SLinus Torvalds strplb r3, [r1], #1 691da177e4SLinus Torvalds LOADREGS(fd, sp!, {r4 - r7, pc}) 701da177e4SLinus Torvalds 711da177e4SLinus Torvalds@ Purpose: transfer a block of data from memory to the acorn scsi card 721da177e4SLinus Torvalds@ Proto : void acornscsi_in(unsigned int addr_start, char *buffer, int length) 731da177e4SLinus Torvalds@ Returns: nothing 741da177e4SLinus Torvalds 751da177e4SLinus TorvaldsENTRY(__acornscsi_out) 761da177e4SLinus Torvalds stmfd sp!, {r4 - r6, lr} 771da177e4SLinus Torvalds bic r0, r0, #3 781da177e4SLinus Torvaldsacornscsi_out16lp: 791da177e4SLinus Torvalds subs r2, r2, #16 801da177e4SLinus Torvalds bmi acornscsi_out8 811da177e4SLinus Torvalds ldmia r1!, {r4, r6, ip, lr} 821da177e4SLinus Torvalds mov r3, r4, lsl #16 831da177e4SLinus Torvalds orr r3, r3, r3, lsr #16 841da177e4SLinus Torvalds mov r4, r4, lsr #16 851da177e4SLinus Torvalds orr r4, r4, r4, lsl #16 861da177e4SLinus Torvalds mov r5, r6, lsl #16 871da177e4SLinus Torvalds orr r5, r5, r5, lsr #16 881da177e4SLinus Torvalds mov r6, r6, lsr #16 891da177e4SLinus Torvalds orr r6, r6, r6, lsl #16 901da177e4SLinus Torvalds stmia r0!, {r3, r4, r5, r6} 911da177e4SLinus Torvalds mov r3, ip, lsl #16 921da177e4SLinus Torvalds orr r3, r3, r3, lsr #16 931da177e4SLinus Torvalds mov r4, ip, lsr #16 941da177e4SLinus Torvalds orr r4, r4, r4, lsl #16 951da177e4SLinus Torvalds mov ip, lr, lsl #16 961da177e4SLinus Torvalds orr ip, ip, ip, lsr #16 971da177e4SLinus Torvalds mov lr, lr, lsr #16 981da177e4SLinus Torvalds orr lr, lr, lr, lsl #16 991da177e4SLinus Torvalds stmia r0!, {r3, r4, ip, lr} 1001da177e4SLinus Torvalds bne acornscsi_out16lp 1011da177e4SLinus Torvalds LOADREGS(fd, sp!, {r4 - r6, pc}) 1021da177e4SLinus Torvalds 1031da177e4SLinus Torvaldsacornscsi_out8: adds r2, r2, #8 1041da177e4SLinus Torvalds bmi acornscsi_out4 1051da177e4SLinus Torvalds ldmia r1!, {r4, r6} 1061da177e4SLinus Torvalds mov r3, r4, lsl #16 1071da177e4SLinus Torvalds orr r3, r3, r3, lsr #16 1081da177e4SLinus Torvalds mov r4, r4, lsr #16 1091da177e4SLinus Torvalds orr r4, r4, r4, lsl #16 1101da177e4SLinus Torvalds mov r5, r6, lsl #16 1111da177e4SLinus Torvalds orr r5, r5, r5, lsr #16 1121da177e4SLinus Torvalds mov r6, r6, lsr #16 1131da177e4SLinus Torvalds orr r6, r6, r6, lsl #16 1141da177e4SLinus Torvalds stmia r0!, {r3, r4, r5, r6} 1151da177e4SLinus Torvalds LOADREGS(eqfd, sp!, {r4 - r6, pc}) 1161da177e4SLinus Torvalds 1171da177e4SLinus Torvalds sub r2, r2, #8 1181da177e4SLinus Torvaldsacornscsi_out4: adds r2, r2, #4 1191da177e4SLinus Torvalds bmi acornscsi_out2 1201da177e4SLinus Torvalds ldr r4, [r1], #4 1211da177e4SLinus Torvalds mov r3, r4, lsl #16 1221da177e4SLinus Torvalds orr r3, r3, r3, lsr #16 1231da177e4SLinus Torvalds mov r4, r4, lsr #16 1241da177e4SLinus Torvalds orr r4, r4, r4, lsl #16 1251da177e4SLinus Torvalds stmia r0!, {r3, r4} 1261da177e4SLinus Torvalds LOADREGS(eqfd, sp!, {r4 - r6, pc}) 1271da177e4SLinus Torvalds 1281da177e4SLinus Torvalds sub r2, r2, #4 1291da177e4SLinus Torvaldsacornscsi_out2: adds r2, r2, #2 1301da177e4SLinus Torvalds ldr r3, [r1], #2 1311da177e4SLinus Torvalds strb r3, [r0], #1 1321da177e4SLinus Torvalds mov r3, r3, lsr #8 1331da177e4SLinus Torvalds strplb r3, [r0], #1 1341da177e4SLinus Torvalds LOADREGS(fd, sp!, {r4 - r6, pc}) 1351da177e4SLinus Torvalds 136