acornscsi-io.S 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. * linux/drivers/acorn/scsi/acornscsi-io.S: Acorn SCSI card IO
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #include <linux/linkage.h>
  9. #include <asm/assembler.h>
  10. #include <mach/hardware.h>
  11. #if defined(__APCS_32__)
  12. #define LOADREGS(t,r,l...) ldm##t r, l
  13. #elif defined(__APCS_26__)
  14. #define LOADREGS(t,r,l...) ldm##t r, l##^
  15. #endif
  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)
  18. @ Returns: nothing
  19. .align
  20. ENTRY(__acornscsi_in)
  21. stmfd sp!, {r4 - r7, lr}
  22. bic r0, r0, #3
  23. mov lr, #0xff
  24. orr lr, lr, #0xff00
  25. acornscsi_in16lp:
  26. subs r2, r2, #16
  27. bmi acornscsi_in8
  28. ldmia r0!, {r3, r4, r5, r6}
  29. and r3, r3, lr
  30. orr r3, r3, r4, lsl #16
  31. and r4, r5, lr
  32. orr r4, r4, r6, lsl #16
  33. ldmia r0!, {r5, r6, r7, ip}
  34. and r5, r5, lr
  35. orr r5, r5, r6, lsl #16
  36. and r6, r7, lr
  37. orr r6, r6, ip, lsl #16
  38. stmia r1!, {r3 - r6}
  39. bne acornscsi_in16lp
  40. LOADREGS(fd, sp!, {r4 - r7, pc})
  41. acornscsi_in8: adds r2, r2, #8
  42. bmi acornscsi_in4
  43. ldmia r0!, {r3, r4, r5, r6}
  44. and r3, r3, lr
  45. orr r3, r3, r4, lsl #16
  46. and r4, r5, lr
  47. orr r4, r4, r6, lsl #16
  48. stmia r1!, {r3 - r4}
  49. LOADREGS(eqfd, sp!, {r4 - r7, pc})
  50. sub r2, r2, #8
  51. acornscsi_in4: adds r2, r2, #4
  52. bmi acornscsi_in2
  53. ldmia r0!, {r3, r4}
  54. and r3, r3, lr
  55. orr r3, r3, r4, lsl #16
  56. str r3, [r1], #4
  57. LOADREGS(eqfd, sp!, {r4 - r7, pc})
  58. sub r2, r2, #4
  59. acornscsi_in2: adds r2, r2, #2
  60. ldr r3, [r0], #4
  61. and r3, r3, lr
  62. strb r3, [r1], #1
  63. mov r3, r3, lsr #8
  64. strplb r3, [r1], #1
  65. LOADREGS(fd, sp!, {r4 - r7, pc})
  66. @ Purpose: transfer a block of data from memory to the acorn scsi card
  67. @ Proto : void acornscsi_in(unsigned int addr_start, char *buffer, int length)
  68. @ Returns: nothing
  69. ENTRY(__acornscsi_out)
  70. stmfd sp!, {r4 - r6, lr}
  71. bic r0, r0, #3
  72. acornscsi_out16lp:
  73. subs r2, r2, #16
  74. bmi acornscsi_out8
  75. ldmia r1!, {r4, r6, ip, lr}
  76. mov r3, r4, lsl #16
  77. orr r3, r3, r3, lsr #16
  78. mov r4, r4, lsr #16
  79. orr r4, r4, r4, lsl #16
  80. mov r5, r6, lsl #16
  81. orr r5, r5, r5, lsr #16
  82. mov r6, r6, lsr #16
  83. orr r6, r6, r6, lsl #16
  84. stmia r0!, {r3, r4, r5, r6}
  85. mov r3, ip, lsl #16
  86. orr r3, r3, r3, lsr #16
  87. mov r4, ip, lsr #16
  88. orr r4, r4, r4, lsl #16
  89. mov ip, lr, lsl #16
  90. orr ip, ip, ip, lsr #16
  91. mov lr, lr, lsr #16
  92. orr lr, lr, lr, lsl #16
  93. stmia r0!, {r3, r4, ip, lr}
  94. bne acornscsi_out16lp
  95. LOADREGS(fd, sp!, {r4 - r6, pc})
  96. acornscsi_out8: adds r2, r2, #8
  97. bmi acornscsi_out4
  98. ldmia r1!, {r4, r6}
  99. mov r3, r4, lsl #16
  100. orr r3, r3, r3, lsr #16
  101. mov r4, r4, lsr #16
  102. orr r4, r4, r4, lsl #16
  103. mov r5, r6, lsl #16
  104. orr r5, r5, r5, lsr #16
  105. mov r6, r6, lsr #16
  106. orr r6, r6, r6, lsl #16
  107. stmia r0!, {r3, r4, r5, r6}
  108. LOADREGS(eqfd, sp!, {r4 - r6, pc})
  109. sub r2, r2, #8
  110. acornscsi_out4: adds r2, r2, #4
  111. bmi acornscsi_out2
  112. ldr r4, [r1], #4
  113. mov r3, r4, lsl #16
  114. orr r3, r3, r3, lsr #16
  115. mov r4, r4, lsr #16
  116. orr r4, r4, r4, lsl #16
  117. stmia r0!, {r3, r4}
  118. LOADREGS(eqfd, sp!, {r4 - r6, pc})
  119. sub r2, r2, #4
  120. acornscsi_out2: adds r2, r2, #2
  121. ldr r3, [r1], #2
  122. strb r3, [r0], #1
  123. mov r3, r3, lsr #8
  124. strplb r3, [r0], #1
  125. LOADREGS(fd, sp!, {r4 - r6, pc})