callback_srm.S 2.8 KB

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