pSeries_hvCall.S 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * arch/ppc64/kernel/pSeries_hvCall.S
  3. *
  4. * This file contains the generic code to perform a call to the
  5. * pSeries LPAR hypervisor.
  6. * NOTE: this file will go away when we move to inline this work.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version
  11. * 2 of the License, or (at your option) any later version.
  12. */
  13. #include <asm/hvcall.h>
  14. #include <asm/processor.h>
  15. #include <asm/ppc_asm.h>
  16. #define STK_PARM(i) (48 + ((i)-3)*8)
  17. .text
  18. /* long plpar_hcall(unsigned long opcode, R3
  19. unsigned long arg1, R4
  20. unsigned long arg2, R5
  21. unsigned long arg3, R6
  22. unsigned long arg4, R7
  23. unsigned long *out1, R8
  24. unsigned long *out2, R9
  25. unsigned long *out3); R10
  26. */
  27. _GLOBAL(plpar_hcall)
  28. HMT_MEDIUM
  29. mfcr r0
  30. std r8,STK_PARM(r8)(r1) /* Save out ptrs */
  31. std r9,STK_PARM(r9)(r1)
  32. std r10,STK_PARM(r10)(r1)
  33. stw r0,8(r1)
  34. HVSC /* invoke the hypervisor */
  35. lwz r0,8(r1)
  36. ld r8,STK_PARM(r8)(r1) /* Fetch r4-r6 ret args */
  37. ld r9,STK_PARM(r9)(r1)
  38. ld r10,STK_PARM(r10)(r1)
  39. std r4,0(r8)
  40. std r5,0(r9)
  41. std r6,0(r10)
  42. mtcrf 0xff,r0
  43. blr /* return r3 = status */
  44. /* Simple interface with no output values (other than status) */
  45. _GLOBAL(plpar_hcall_norets)
  46. HMT_MEDIUM
  47. mfcr r0
  48. stw r0,8(r1)
  49. HVSC /* invoke the hypervisor */
  50. lwz r0,8(r1)
  51. mtcrf 0xff,r0
  52. blr /* return r3 = status */
  53. /* long plpar_hcall_8arg_2ret(unsigned long opcode, R3
  54. unsigned long arg1, R4
  55. unsigned long arg2, R5
  56. unsigned long arg3, R6
  57. unsigned long arg4, R7
  58. unsigned long arg5, R8
  59. unsigned long arg6, R9
  60. unsigned long arg7, R10
  61. unsigned long arg8, 112(R1)
  62. unsigned long *out1); 120(R1)
  63. */
  64. _GLOBAL(plpar_hcall_8arg_2ret)
  65. HMT_MEDIUM
  66. mfcr r0
  67. ld r11,STK_PARM(r11)(r1) /* put arg8 in R11 */
  68. stw r0,8(r1)
  69. HVSC /* invoke the hypervisor */
  70. lwz r0,8(r1)
  71. ld r10,STK_PARM(r12)(r1) /* Fetch r4 ret arg */
  72. std r4,0(r10)
  73. mtcrf 0xff,r0
  74. blr /* return r3 = status */
  75. /* long plpar_hcall_4out(unsigned long opcode, R3
  76. unsigned long arg1, R4
  77. unsigned long arg2, R5
  78. unsigned long arg3, R6
  79. unsigned long arg4, R7
  80. unsigned long *out1, R8
  81. unsigned long *out2, R9
  82. unsigned long *out3, R10
  83. unsigned long *out4); 112(R1)
  84. */
  85. _GLOBAL(plpar_hcall_4out)
  86. HMT_MEDIUM
  87. mfcr r0
  88. stw r0,8(r1)
  89. std r8,STK_PARM(r8)(r1) /* Save out ptrs */
  90. std r9,STK_PARM(r9)(r1)
  91. std r10,STK_PARM(r10)(r1)
  92. HVSC /* invoke the hypervisor */
  93. lwz r0,8(r1)
  94. ld r8,STK_PARM(r8)(r1) /* Fetch r4-r7 ret args */
  95. ld r9,STK_PARM(r9)(r1)
  96. ld r10,STK_PARM(r10)(r1)
  97. ld r11,STK_PARM(r11)(r1)
  98. std r4,0(r8)
  99. std r5,0(r9)
  100. std r6,0(r10)
  101. std r7,0(r11)
  102. mtcrf 0xff,r0
  103. blr /* return r3 = status */