pci_sun4v_asm.S 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. /* pci_sun4v_asm: Hypervisor calls for PCI support.
  2. *
  3. * Copyright (C) 2006, 2008 David S. Miller <davem@davemloft.net>
  4. */
  5. #include <linux/linkage.h>
  6. #include <asm/hypervisor.h>
  7. /* %o0: devhandle
  8. * %o1: tsbid
  9. * %o2: num ttes
  10. * %o3: io_attributes
  11. * %o4: io_page_list phys address
  12. *
  13. * returns %o0: -status if status was non-zero, else
  14. * %o0: num pages mapped
  15. */
  16. ENTRY(pci_sun4v_iommu_map)
  17. mov %o5, %g1
  18. mov HV_FAST_PCI_IOMMU_MAP, %o5
  19. ta HV_FAST_TRAP
  20. brnz,pn %o0, 1f
  21. sub %g0, %o0, %o0
  22. mov %o1, %o0
  23. 1: retl
  24. nop
  25. ENDPROC(pci_sun4v_iommu_map)
  26. /* %o0: devhandle
  27. * %o1: tsbid
  28. * %o2: num ttes
  29. *
  30. * returns %o0: num ttes demapped
  31. */
  32. ENTRY(pci_sun4v_iommu_demap)
  33. mov HV_FAST_PCI_IOMMU_DEMAP, %o5
  34. ta HV_FAST_TRAP
  35. retl
  36. mov %o1, %o0
  37. ENDPROC(pci_sun4v_iommu_demap)
  38. /* %o0: devhandle
  39. * %o1: tsbid
  40. * %o2: &io_attributes
  41. * %o3: &real_address
  42. *
  43. * returns %o0: status
  44. */
  45. ENTRY(pci_sun4v_iommu_getmap)
  46. mov %o2, %o4
  47. mov HV_FAST_PCI_IOMMU_GETMAP, %o5
  48. ta HV_FAST_TRAP
  49. stx %o1, [%o4]
  50. stx %o2, [%o3]
  51. retl
  52. mov %o0, %o0
  53. ENDPROC(pci_sun4v_iommu_getmap)
  54. /* %o0: devhandle
  55. * %o1: pci_device
  56. * %o2: pci_config_offset
  57. * %o3: size
  58. *
  59. * returns %o0: data
  60. *
  61. * If there is an error, the data will be returned
  62. * as all 1's.
  63. */
  64. ENTRY(pci_sun4v_config_get)
  65. mov HV_FAST_PCI_CONFIG_GET, %o5
  66. ta HV_FAST_TRAP
  67. brnz,a,pn %o1, 1f
  68. mov -1, %o2
  69. 1: retl
  70. mov %o2, %o0
  71. ENDPROC(pci_sun4v_config_get)
  72. /* %o0: devhandle
  73. * %o1: pci_device
  74. * %o2: pci_config_offset
  75. * %o3: size
  76. * %o4: data
  77. *
  78. * returns %o0: status
  79. *
  80. * status will be zero if the operation completed
  81. * successfully, else -1 if not
  82. */
  83. ENTRY(pci_sun4v_config_put)
  84. mov HV_FAST_PCI_CONFIG_PUT, %o5
  85. ta HV_FAST_TRAP
  86. brnz,a,pn %o1, 1f
  87. mov -1, %o1
  88. 1: retl
  89. mov %o1, %o0
  90. ENDPROC(pci_sun4v_config_put)
  91. /* %o0: devhandle
  92. * %o1: msiqid
  93. * %o2: msiq phys address
  94. * %o3: num entries
  95. *
  96. * returns %o0: status
  97. *
  98. * status will be zero if the operation completed
  99. * successfully, else -1 if not
  100. */
  101. ENTRY(pci_sun4v_msiq_conf)
  102. mov HV_FAST_PCI_MSIQ_CONF, %o5
  103. ta HV_FAST_TRAP
  104. retl
  105. mov %o0, %o0
  106. ENDPROC(pci_sun4v_msiq_conf)
  107. /* %o0: devhandle
  108. * %o1: msiqid
  109. * %o2: &msiq_phys_addr
  110. * %o3: &msiq_num_entries
  111. *
  112. * returns %o0: status
  113. */
  114. ENTRY(pci_sun4v_msiq_info)
  115. mov %o2, %o4
  116. mov HV_FAST_PCI_MSIQ_INFO, %o5
  117. ta HV_FAST_TRAP
  118. stx %o1, [%o4]
  119. stx %o2, [%o3]
  120. retl
  121. mov %o0, %o0
  122. ENDPROC(pci_sun4v_msiq_info)
  123. /* %o0: devhandle
  124. * %o1: msiqid
  125. * %o2: &valid
  126. *
  127. * returns %o0: status
  128. */
  129. ENTRY(pci_sun4v_msiq_getvalid)
  130. mov HV_FAST_PCI_MSIQ_GETVALID, %o5
  131. ta HV_FAST_TRAP
  132. stx %o1, [%o2]
  133. retl
  134. mov %o0, %o0
  135. ENDPROC(pci_sun4v_msiq_getvalid)
  136. /* %o0: devhandle
  137. * %o1: msiqid
  138. * %o2: valid
  139. *
  140. * returns %o0: status
  141. */
  142. ENTRY(pci_sun4v_msiq_setvalid)
  143. mov HV_FAST_PCI_MSIQ_SETVALID, %o5
  144. ta HV_FAST_TRAP
  145. retl
  146. mov %o0, %o0
  147. ENDPROC(pci_sun4v_msiq_setvalid)
  148. /* %o0: devhandle
  149. * %o1: msiqid
  150. * %o2: &state
  151. *
  152. * returns %o0: status
  153. */
  154. ENTRY(pci_sun4v_msiq_getstate)
  155. mov HV_FAST_PCI_MSIQ_GETSTATE, %o5
  156. ta HV_FAST_TRAP
  157. stx %o1, [%o2]
  158. retl
  159. mov %o0, %o0
  160. ENDPROC(pci_sun4v_msiq_getstate)
  161. /* %o0: devhandle
  162. * %o1: msiqid
  163. * %o2: state
  164. *
  165. * returns %o0: status
  166. */
  167. ENTRY(pci_sun4v_msiq_setstate)
  168. mov HV_FAST_PCI_MSIQ_SETSTATE, %o5
  169. ta HV_FAST_TRAP
  170. retl
  171. mov %o0, %o0
  172. ENDPROC(pci_sun4v_msiq_setstate)
  173. /* %o0: devhandle
  174. * %o1: msiqid
  175. * %o2: &head
  176. *
  177. * returns %o0: status
  178. */
  179. ENTRY(pci_sun4v_msiq_gethead)
  180. mov HV_FAST_PCI_MSIQ_GETHEAD, %o5
  181. ta HV_FAST_TRAP
  182. stx %o1, [%o2]
  183. retl
  184. mov %o0, %o0
  185. ENDPROC(pci_sun4v_msiq_gethead)
  186. /* %o0: devhandle
  187. * %o1: msiqid
  188. * %o2: head
  189. *
  190. * returns %o0: status
  191. */
  192. ENTRY(pci_sun4v_msiq_sethead)
  193. mov HV_FAST_PCI_MSIQ_SETHEAD, %o5
  194. ta HV_FAST_TRAP
  195. retl
  196. mov %o0, %o0
  197. ENDPROC(pci_sun4v_msiq_sethead)
  198. /* %o0: devhandle
  199. * %o1: msiqid
  200. * %o2: &tail
  201. *
  202. * returns %o0: status
  203. */
  204. ENTRY(pci_sun4v_msiq_gettail)
  205. mov HV_FAST_PCI_MSIQ_GETTAIL, %o5
  206. ta HV_FAST_TRAP
  207. stx %o1, [%o2]
  208. retl
  209. mov %o0, %o0
  210. ENDPROC(pci_sun4v_msiq_gettail)
  211. /* %o0: devhandle
  212. * %o1: msinum
  213. * %o2: &valid
  214. *
  215. * returns %o0: status
  216. */
  217. ENTRY(pci_sun4v_msi_getvalid)
  218. mov HV_FAST_PCI_MSI_GETVALID, %o5
  219. ta HV_FAST_TRAP
  220. stx %o1, [%o2]
  221. retl
  222. mov %o0, %o0
  223. ENDPROC(pci_sun4v_msi_getvalid)
  224. /* %o0: devhandle
  225. * %o1: msinum
  226. * %o2: valid
  227. *
  228. * returns %o0: status
  229. */
  230. ENTRY(pci_sun4v_msi_setvalid)
  231. mov HV_FAST_PCI_MSI_SETVALID, %o5
  232. ta HV_FAST_TRAP
  233. retl
  234. mov %o0, %o0
  235. ENDPROC(pci_sun4v_msi_setvalid)
  236. /* %o0: devhandle
  237. * %o1: msinum
  238. * %o2: &msiq
  239. *
  240. * returns %o0: status
  241. */
  242. ENTRY(pci_sun4v_msi_getmsiq)
  243. mov HV_FAST_PCI_MSI_GETMSIQ, %o5
  244. ta HV_FAST_TRAP
  245. stx %o1, [%o2]
  246. retl
  247. mov %o0, %o0
  248. ENDPROC(pci_sun4v_msi_getmsiq)
  249. /* %o0: devhandle
  250. * %o1: msinum
  251. * %o2: msitype
  252. * %o3: msiq
  253. *
  254. * returns %o0: status
  255. */
  256. ENTRY(pci_sun4v_msi_setmsiq)
  257. mov HV_FAST_PCI_MSI_SETMSIQ, %o5
  258. ta HV_FAST_TRAP
  259. retl
  260. mov %o0, %o0
  261. ENDPROC(pci_sun4v_msi_setmsiq)
  262. /* %o0: devhandle
  263. * %o1: msinum
  264. * %o2: &state
  265. *
  266. * returns %o0: status
  267. */
  268. ENTRY(pci_sun4v_msi_getstate)
  269. mov HV_FAST_PCI_MSI_GETSTATE, %o5
  270. ta HV_FAST_TRAP
  271. stx %o1, [%o2]
  272. retl
  273. mov %o0, %o0
  274. ENDPROC(pci_sun4v_msi_getstate)
  275. /* %o0: devhandle
  276. * %o1: msinum
  277. * %o2: state
  278. *
  279. * returns %o0: status
  280. */
  281. ENTRY(pci_sun4v_msi_setstate)
  282. mov HV_FAST_PCI_MSI_SETSTATE, %o5
  283. ta HV_FAST_TRAP
  284. retl
  285. mov %o0, %o0
  286. ENDPROC(pci_sun4v_msi_setstate)
  287. /* %o0: devhandle
  288. * %o1: msinum
  289. * %o2: &msiq
  290. *
  291. * returns %o0: status
  292. */
  293. ENTRY(pci_sun4v_msg_getmsiq)
  294. mov HV_FAST_PCI_MSG_GETMSIQ, %o5
  295. ta HV_FAST_TRAP
  296. stx %o1, [%o2]
  297. retl
  298. mov %o0, %o0
  299. ENDPROC(pci_sun4v_msg_getmsiq)
  300. /* %o0: devhandle
  301. * %o1: msinum
  302. * %o2: msiq
  303. *
  304. * returns %o0: status
  305. */
  306. ENTRY(pci_sun4v_msg_setmsiq)
  307. mov HV_FAST_PCI_MSG_SETMSIQ, %o5
  308. ta HV_FAST_TRAP
  309. retl
  310. mov %o0, %o0
  311. ENDPROC(pci_sun4v_msg_setmsiq)
  312. /* %o0: devhandle
  313. * %o1: msinum
  314. * %o2: &valid
  315. *
  316. * returns %o0: status
  317. */
  318. ENTRY(pci_sun4v_msg_getvalid)
  319. mov HV_FAST_PCI_MSG_GETVALID, %o5
  320. ta HV_FAST_TRAP
  321. stx %o1, [%o2]
  322. retl
  323. mov %o0, %o0
  324. ENDPROC(pci_sun4v_msg_getvalid)
  325. /* %o0: devhandle
  326. * %o1: msinum
  327. * %o2: valid
  328. *
  329. * returns %o0: status
  330. */
  331. ENTRY(pci_sun4v_msg_setvalid)
  332. mov HV_FAST_PCI_MSG_SETVALID, %o5
  333. ta HV_FAST_TRAP
  334. retl
  335. mov %o0, %o0
  336. ENDPROC(pci_sun4v_msg_setvalid)