callback_srm.S 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * arch/alpha/lib/callback_srm.S
  4. */
  5. #include <asm/console.h>
  6. #include <asm/export.h>
  7. .text
  8. #define HWRPB_CRB_OFFSET 0xc0
  9. #if defined(CONFIG_ALPHA_SRM) || defined(CONFIG_ALPHA_GENERIC)
  10. .align 4
  11. srm_dispatch:
  12. #if defined(CONFIG_ALPHA_GENERIC)
  13. ldl $4,alpha_using_srm
  14. beq $4,nosrm
  15. #endif
  16. ldq $0,hwrpb # gp is set up by CALLBACK macro.
  17. ldl $25,0($25) # Pick up the wrapper data.
  18. mov $20,$21 # Shift arguments right.
  19. mov $19,$20
  20. ldq $1,HWRPB_CRB_OFFSET($0)
  21. mov $18,$19
  22. mov $17,$18
  23. mov $16,$17
  24. addq $0,$1,$2 # CRB address
  25. ldq $27,0($2) # DISPATCH procedure descriptor (VMS call std)
  26. extwl $25,0,$16 # SRM callback function code
  27. ldq $3,8($27) # call address
  28. extwl $25,2,$25 # argument information (VMS calling std)
  29. jmp ($3) # Return directly to caller of wrapper.
  30. .align 4
  31. .globl srm_fixup
  32. .ent srm_fixup
  33. srm_fixup:
  34. ldgp $29,0($27)
  35. #if defined(CONFIG_ALPHA_GENERIC)
  36. ldl $4,alpha_using_srm
  37. beq $4,nosrm
  38. #endif
  39. ldq $0,hwrpb
  40. ldq $1,HWRPB_CRB_OFFSET($0)
  41. addq $0,$1,$2 # CRB address
  42. ldq $27,16($2) # VA of FIXUP procedure descriptor
  43. ldq $3,8($27) # call address
  44. lda $25,2($31) # two integer arguments
  45. jmp ($3) # Return directly to caller of srm_fixup.
  46. .end srm_fixup
  47. #if defined(CONFIG_ALPHA_GENERIC)
  48. .align 3
  49. nosrm:
  50. lda $0,-1($31)
  51. ret
  52. #endif
  53. #define CALLBACK(NAME, CODE, ARG_CNT) \
  54. .align 4; .globl callback_##NAME; .ent callback_##NAME; callback_##NAME##: \
  55. ldgp $29,0($27); br $25,srm_dispatch; .word CODE, ARG_CNT; .end callback_##NAME
  56. #else /* defined(CONFIG_ALPHA_SRM) || defined(CONFIG_ALPHA_GENERIC) */
  57. #define CALLBACK(NAME, CODE, ARG_CNT) \
  58. .align 3; .globl callback_##NAME; .ent callback_##NAME; callback_##NAME##: \
  59. lda $0,-1($31); ret; .end callback_##NAME
  60. .align 3
  61. .globl srm_fixup
  62. .ent srm_fixup
  63. srm_fixup:
  64. lda $0,-1($31)
  65. ret
  66. .end srm_fixup
  67. #endif /* defined(CONFIG_ALPHA_SRM) || defined(CONFIG_ALPHA_GENERIC) */
  68. CALLBACK(puts, CCB_PUTS, 4)
  69. CALLBACK(open, CCB_OPEN, 3)
  70. CALLBACK(close, CCB_CLOSE, 2)
  71. CALLBACK(read, CCB_READ, 5)
  72. CALLBACK(open_console, CCB_OPEN_CONSOLE, 1)
  73. CALLBACK(close_console, CCB_CLOSE_CONSOLE, 1)
  74. CALLBACK(getenv, CCB_GET_ENV, 4)
  75. CALLBACK(setenv, CCB_SET_ENV, 4)
  76. CALLBACK(getc, CCB_GETC, 2)
  77. CALLBACK(reset_term, CCB_RESET_TERM, 2)
  78. CALLBACK(term_int, CCB_SET_TERM_INT, 3)
  79. CALLBACK(term_ctl, CCB_SET_TERM_CTL, 3)
  80. CALLBACK(process_keycode, CCB_PROCESS_KEYCODE, 3)
  81. CALLBACK(ioctl, CCB_IOCTL, 6)
  82. CALLBACK(write, CCB_WRITE, 5)
  83. CALLBACK(reset_env, CCB_RESET_ENV, 4)
  84. CALLBACK(save_env, CCB_SAVE_ENV, 1)
  85. CALLBACK(pswitch, CCB_PSWITCH, 3)
  86. CALLBACK(bios_emul, CCB_BIOS_EMUL, 5)
  87. EXPORT_SYMBOL(callback_getenv)
  88. EXPORT_SYMBOL(callback_setenv)
  89. EXPORT_SYMBOL(callback_save_env)
  90. .data
  91. __alpha_using_srm: # For use by bootpheader
  92. .long 7 # value is not 1 for link debugging
  93. .weak alpha_using_srm; alpha_using_srm = __alpha_using_srm
  94. __callback_init_done: # For use by bootpheader
  95. .long 7 # value is not 1 for link debugging
  96. .weak callback_init_done; callback_init_done = __callback_init_done