pci_sun4v_asm.S 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* pci_sun4v_asm: Hypervisor calls for PCI support.
  2. *
  3. * Copyright (C) 2006 David S. Miller <davem@davemloft.net>
  4. */
  5. #include <asm/hypervisor.h>
  6. /* %o0: devhandle
  7. * %o1: devino
  8. *
  9. * returns %o0: sysino
  10. */
  11. .globl pci_sun4v_devino_to_sysino
  12. pci_sun4v_devino_to_sysino:
  13. mov HV_FAST_INTR_DEVINO2SYSINO, %o5
  14. ta HV_FAST_TRAP
  15. retl
  16. mov %o1, %o0
  17. /* %o0: devhandle
  18. * %o1: tsbid
  19. * %o2: num ttes
  20. * %o3: io_attributes
  21. * %o4: io_page_list phys address
  22. *
  23. * returns %o0: num ttes mapped
  24. */
  25. .globl pci_sun4v_iommu_map
  26. pci_sun4v_iommu_map:
  27. mov HV_FAST_PCI_IOMMU_MAP, %o5
  28. ta HV_FAST_TRAP
  29. retl
  30. mov %o1, %o0
  31. /* %o0: devhandle
  32. * %o1: tsbid
  33. * %o2: num ttes
  34. *
  35. * returns %o0: num ttes demapped
  36. */
  37. .globl pci_sun4v_iommu_demap
  38. pci_sun4v_iommu_demap:
  39. mov HV_FAST_PCI_IOMMU_DEMAP, %o5
  40. ta HV_FAST_TRAP
  41. retl
  42. mov %o1, %o0
  43. /* %o0: devhandle
  44. * %o1: tsbid
  45. * %o2: &io_attributes
  46. * %o3: &real_address
  47. *
  48. * returns %o0: status
  49. */
  50. .globl pci_sun4v_iommu_getmap
  51. pci_sun4v_iommu_getmap:
  52. mov %o2, %o4
  53. mov HV_FAST_PCI_IOMMU_GETMAP, %o5
  54. ta HV_FAST_TRAP
  55. stx %o1, [%o4]
  56. stx %o2, [%o3]
  57. retl
  58. mov %o0, %o0
  59. /* %o0: devhandle
  60. * %o1: pci_device
  61. * %o2: pci_config_offset
  62. * %o3: size
  63. *
  64. * returns %o0: data
  65. *
  66. * If there is an error, the data will be returned
  67. * as all 1's.
  68. */
  69. .globl pci_sun4v_config_get
  70. pci_sun4v_config_get:
  71. mov HV_FAST_PCI_CONFIG_GET, %o5
  72. ta HV_FAST_TRAP
  73. brnz,a,pn %o1, 1f
  74. mov -1, %o2
  75. 1: retl
  76. mov %o2, %o0
  77. /* %o0: devhandle
  78. * %o1: pci_device
  79. * %o2: pci_config_offset
  80. * %o3: size
  81. * %o4: data
  82. *
  83. * returns %o0: status
  84. *
  85. * status will be zero if the operation completed
  86. * successfully, else -1 if not
  87. */
  88. .globl pci_sun4v_config_put
  89. pci_sun4v_config_put:
  90. mov HV_FAST_PCI_CONFIG_PUT, %o5
  91. ta HV_FAST_TRAP
  92. brnz,a,pn %o1, 1f
  93. mov -1, %o1
  94. 1: retl
  95. mov %o1, %o0