PageRenderTime 59ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 0ms

/src/netbsd/src/sys/arch/shark/isa/isa_io_asm.S

https://bitbucket.org/killerpenguinassassins/open_distrib_devel
Assembly | 368 lines | 301 code | 67 blank | 0 comment | 6 complexity | 9f7cb6c6af2beb261cc9fc5692386457 MD5 | raw file
Possible License(s): CC0-1.0, MIT, LGPL-2.0, LGPL-3.0, WTFPL, GPL-2.0, BSD-2-Clause, AGPL-3.0, CC-BY-SA-3.0, MPL-2.0, JSON, BSD-3-Clause-No-Nuclear-License-2014, LGPL-2.1, CPL-1.0, AGPL-1.0, 0BSD, ISC, Apache-2.0, GPL-3.0, IPL-1.0, MPL-2.0-no-copyleft-exception, BSD-3-Clause
  1. /* $NetBSD: isa_io_asm.S,v 1.4 2008/04/28 20:23:35 martin Exp $ */
  2. /*-
  3. * Copyright (c) 1997 The NetBSD Foundation, Inc.
  4. * All rights reserved.
  5. *
  6. * This code is derived from software contributed to The NetBSD Foundation
  7. * by Mark Brinicombe.
  8. *
  9. * Redistribution and use in source and binary forms, with or without
  10. * modification, are permitted provided that the following conditions
  11. * are met:
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. * 2. Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in the
  16. * documentation and/or other materials provided with the distribution.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  19. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  20. * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  21. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
  22. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  23. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  24. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  25. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  26. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  27. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  28. * POSSIBILITY OF SUCH DAMAGE.
  29. */
  30. /*
  31. * Copyright 1997
  32. * Digital Equipment Corporation. All rights reserved.
  33. *
  34. * This software is furnished under license and may be used and
  35. * copied only in accordance with the following terms and conditions.
  36. * Subject to these conditions, you may download, copy, install,
  37. * use, modify and distribute this software in source and/or binary
  38. * form. No title or ownership is transferred hereby.
  39. *
  40. * 1) Any source code used, modified or distributed must reproduce
  41. * and retain this copyright notice and list of conditions as
  42. * they appear in the source file.
  43. *
  44. * 2) No right is granted to use any trade name, trademark, or logo of
  45. * Digital Equipment Corporation. Neither the "Digital Equipment
  46. * Corporation" name nor any trademark or logo of Digital Equipment
  47. * Corporation may be used to endorse or promote products derived
  48. * from this software without the prior written permission of
  49. * Digital Equipment Corporation.
  50. *
  51. * 3) This software is provided "AS-IS" and any express or implied
  52. * warranties, including but not limited to, any implied warranties
  53. * of merchantability, fitness for a particular purpose, or
  54. * non-infringement are disclaimed. In no event shall DIGITAL be
  55. * liable for any damages whatsoever, and in particular, DIGITAL
  56. * shall not be liable for special, indirect, consequential, or
  57. * incidental damages or damages for lost profits, loss of
  58. * revenue or loss of use, whether such damages arise in contract,
  59. * negligence, tort, under statute, in equity, at law or otherwise,
  60. * even if advised of the possibility of such damage.
  61. */
  62. /*
  63. * bus_space I/O functions for isa
  64. */
  65. #include <machine/asm.h>
  66. #ifdef GPROF
  67. #define PAUSE nop ; nop ; nop ; nop ; nop
  68. #else
  69. #define PAUSE
  70. #endif
  71. /*
  72. * Note these functions use ARM Architecture V4 instructions as
  73. * all current systems with ISA will be using processors that support
  74. * V4 or later architectures (SHARK & CATS)
  75. */
  76. /*
  77. * read single
  78. */
  79. ENTRY(isa_bs_r_1)
  80. ldrb r0, [r1, r2]
  81. PAUSE
  82. mov pc, lr
  83. ENTRY(isa_bs_r_2)
  84. ldrh r0, [r1, r2] /*.word 0xe19100b2*/
  85. PAUSE
  86. mov pc, lr
  87. ENTRY(isa_bs_r_4)
  88. ldr r0, [r1, r2]
  89. PAUSE
  90. mov pc, lr
  91. /*
  92. * read multiple.
  93. */
  94. ENTRY(isa_bs_rm_1)
  95. add r0, r1, r2
  96. mov r1, r3
  97. ldr r2, [sp, #0]
  98. teq r2, #0
  99. moveq pc, lr
  100. Lisa_rm_1_loop:
  101. ldrb r3, [r0]
  102. strb r3, [r1], #1
  103. subs r2, r2, #1
  104. bne Lisa_rm_1_loop
  105. mov pc, lr
  106. ENTRY(isa_bs_rm_2)
  107. add r0, r1, r2
  108. mov r1, r3
  109. ldr r2, [sp, #0]
  110. teq r2, #0
  111. moveq pc, lr
  112. Lisa_rm_2_loop:
  113. ldrh r3, [r0] /*.word 0xe1d030b0*/
  114. strh r3, [r1], #2 /*.word 0xe0c130b2*/
  115. subs r2, r2, #1
  116. bne Lisa_rm_2_loop
  117. mov pc, lr
  118. ENTRY(isa_bs_rm_4)
  119. add r0, r1, r2
  120. mov r1, r3
  121. ldr r2, [sp, #0]
  122. teq r2, #0
  123. moveq pc, lr
  124. Lisa_rm_4_loop:
  125. ldr r3, [r0]
  126. str r3, [r1], #4
  127. subs r2, r2, #1
  128. bne Lisa_rm_4_loop
  129. mov pc, lr
  130. /*
  131. * read region.
  132. */
  133. ENTRY(isa_bs_rr_1)
  134. add r0, r1, r2
  135. mov r1, r3
  136. ldr r2, [sp, #0]
  137. teq r2, #0
  138. moveq pc, lr
  139. Lisa_rr_1_loop:
  140. ldrb r3, [r0], #1
  141. strb r3, [r1], #1
  142. subs r2, r2, #1
  143. bne Lisa_rr_1_loop
  144. mov pc, lr
  145. ENTRY(isa_bs_rr_2)
  146. add r0, r1, r2
  147. mov r1, r3
  148. ldr r2, [sp, #0]
  149. teq r2, #0
  150. moveq pc, lr
  151. Lisa_rr_2_loop:
  152. ldrh r3, [r0], #2
  153. strh r3, [r1], #2 /*.word 0xe0c130b2*/
  154. subs r2, r2, #1
  155. bne Lisa_rr_2_loop
  156. mov pc, lr
  157. ENTRY(isa_bs_rr_4)
  158. add r0, r1, r2
  159. mov r1, r3
  160. ldr r2, [sp, #0]
  161. teq r2, #0
  162. moveq pc, lr
  163. Lisa_rr_4_loop:
  164. ldr r3, [r0], #4
  165. str r3, [r1], #4
  166. subs r2, r2, #1
  167. bne Lisa_rr_4_loop
  168. mov pc, lr
  169. /*
  170. * write single
  171. */
  172. ENTRY(isa_bs_w_1)
  173. strb r3, [r1, r2]
  174. PAUSE
  175. mov pc, lr
  176. ENTRY(isa_bs_w_2)
  177. strh r3, [r1, r2] /*.word 0xe18130b2*/
  178. PAUSE
  179. mov pc, lr
  180. ENTRY(isa_bs_w_4)
  181. str r3, [r1, r2]
  182. PAUSE
  183. mov pc, lr
  184. /*
  185. * write multiple
  186. */
  187. ENTRY(isa_bs_wm_1)
  188. add r0, r1, r2
  189. mov r1, r3
  190. ldr r2, [sp, #0]
  191. teq r2, #0
  192. moveq pc, lr
  193. Lisa_wm_1_loop:
  194. ldrb r3, [r1], #1
  195. strb r3, [r0]
  196. subs r2, r2, #1
  197. bne Lisa_wm_1_loop
  198. mov pc, lr
  199. ENTRY(isa_bs_wm_2)
  200. add r0, r1, r2
  201. mov r1, r3
  202. ldr r2, [sp, #0]
  203. teq r2, #0
  204. moveq pc, lr
  205. Lisa_wm_2_loop:
  206. ldrh r3, [r1], #2 /*.word 0xe0d130b2*/
  207. strh r3, [r0] /*.word 0xe1c030b0*/
  208. subs r2, r2, #1
  209. bne Lisa_wm_2_loop
  210. mov pc, lr
  211. ENTRY(isa_bs_wm_4)
  212. add r0, r1, r2
  213. mov r1, r3
  214. ldr r2, [sp, #0]
  215. teq r2, #0
  216. moveq pc, lr
  217. Lisa_wm_4_loop:
  218. ldr r3, [r1], #4
  219. str r3, [r0]
  220. subs r2, r2, #1
  221. bne Lisa_wm_4_loop
  222. mov pc, lr
  223. /*
  224. * write region.
  225. */
  226. ENTRY(isa_bs_wr_1)
  227. add r0, r1, r2
  228. mov r1, r3
  229. ldr r2, [sp, #0]
  230. teq r2, #0
  231. moveq pc, lr
  232. Lisa_wr_1_loop:
  233. ldrb r3, [r1], #1
  234. strb r3, [r0], #1
  235. subs r2, r2, #1
  236. bne Lisa_wr_1_loop
  237. mov pc, lr
  238. ENTRY(isa_bs_wr_2)
  239. add r0, r1, r2
  240. mov r1, r3
  241. ldr r2, [sp, #0]
  242. teq r2, #0
  243. moveq pc, lr
  244. Lisa_wr_2_loop:
  245. ldrh r3, [r1], #2 /*.word 0xe0d130b2*/
  246. strh r3, [r0], #2
  247. subs r2, r2, #1
  248. bne Lisa_wr_2_loop
  249. mov pc, lr
  250. ENTRY(isa_bs_wr_4)
  251. add r0, r1, r2
  252. mov r1, r3
  253. ldr r2, [sp, #0]
  254. teq r2, #0
  255. moveq pc, lr
  256. Lisa_wr_4_loop:
  257. ldr r3, [r1], #4
  258. str r3, [r0], #4
  259. subs r2, r2, #1
  260. bne Lisa_wr_4_loop
  261. mov pc, lr
  262. /*
  263. * Set region
  264. */
  265. ENTRY(isa_bs_sr_2)
  266. add r0, r1, r2
  267. mov r1, r3
  268. ldr r2, [sp, #0]
  269. teq r2, #0
  270. moveq pc, lr
  271. Lisa_bs_sr_2_loop:
  272. strh r1, [r0], #2 /*.word e0c010b2*/
  273. subs r2, r2, #1
  274. bne Lisa_bs_sr_2_loop
  275. mov pc, lr
  276. /*
  277. * Copy region
  278. */
  279. ENTRY(isa_bs_c_2)
  280. add r0, r1, r2
  281. ldr r2, [sp, #0]
  282. add r1, r2, r3
  283. ldr r2, [sp, #4]
  284. teq r2, #0
  285. moveq pc, lr
  286. cmp r0, r1
  287. blt 2f
  288. 1: ldrh r3, [r0], #2
  289. strh r3, [r1], #2
  290. subs r2, r2, #1
  291. bne 1b
  292. mov pc, lr
  293. 2: add r0, r0, r2, lsl #1
  294. add r1, r1, r2, lsl #1
  295. sub r0, r0, #2
  296. sub r1, r1, #2
  297. 3: ldrh r3, [r0], #-2
  298. strh r3, [r1], #-2
  299. subs r2, r2, #1
  300. bne 3b
  301. mov pc, lr