Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  *  arch/alpha/lib/callback_srm.S
0004  */
0005 
0006 #include <asm/console.h>
0007 #include <asm/export.h>
0008 
0009 .text
0010 #define HWRPB_CRB_OFFSET 0xc0
0011 
0012 #if defined(CONFIG_ALPHA_SRM) || defined(CONFIG_ALPHA_GENERIC)
0013 .align 4
0014 srm_dispatch:
0015 #if defined(CONFIG_ALPHA_GENERIC)
0016     ldl $4,alpha_using_srm
0017     beq $4,nosrm
0018 #endif
0019     ldq $0,hwrpb    # gp is set up by CALLBACK macro.
0020     ldl $25,0($25)  # Pick up the wrapper data.
0021     mov $20,$21     # Shift arguments right.
0022     mov $19,$20
0023     ldq $1,HWRPB_CRB_OFFSET($0)
0024     mov $18,$19
0025     mov $17,$18
0026     mov $16,$17
0027     addq    $0,$1,$2    # CRB address
0028     ldq $27,0($2)   # DISPATCH procedure descriptor (VMS call std)
0029     extwl   $25,0,$16   # SRM callback function code
0030     ldq $3,8($27)   # call address
0031     extwl   $25,2,$25   # argument information (VMS calling std)
0032     jmp ($3)        # Return directly to caller of wrapper.
0033 
0034 .align 4
0035 .globl  srm_fixup
0036 .ent    srm_fixup
0037 srm_fixup:
0038     ldgp    $29,0($27)
0039 #if defined(CONFIG_ALPHA_GENERIC)
0040     ldl $4,alpha_using_srm
0041     beq $4,nosrm
0042 #endif
0043     ldq $0,hwrpb
0044     ldq $1,HWRPB_CRB_OFFSET($0)
0045     addq    $0,$1,$2    # CRB address
0046     ldq $27,16($2)  # VA of FIXUP procedure descriptor
0047     ldq $3,8($27)   # call address
0048     lda $25,2($31)  # two integer arguments
0049     jmp ($3)        # Return directly to caller of srm_fixup.
0050 .end    srm_fixup
0051 
0052 #if defined(CONFIG_ALPHA_GENERIC)
0053 .align 3
0054 nosrm:
0055     lda $0,-1($31)
0056     ret
0057 #endif
0058 
0059 #define CALLBACK(NAME, CODE, ARG_CNT) \
0060 .align 4; .globl callback_##NAME; .ent callback_##NAME; callback_##NAME##: \
0061 ldgp $29,0($27); br $25,srm_dispatch; .word CODE, ARG_CNT; .end callback_##NAME
0062 
0063 #else /* defined(CONFIG_ALPHA_SRM) || defined(CONFIG_ALPHA_GENERIC) */
0064 
0065 #define CALLBACK(NAME, CODE, ARG_CNT) \
0066 .align 3; .globl callback_##NAME; .ent callback_##NAME; callback_##NAME##: \
0067 lda $0,-1($31); ret; .end callback_##NAME
0068 
0069 .align 3
0070 .globl  srm_fixup
0071 .ent    srm_fixup
0072 srm_fixup:
0073     lda $0,-1($31)
0074     ret
0075 .end    srm_fixup
0076 #endif /* defined(CONFIG_ALPHA_SRM) || defined(CONFIG_ALPHA_GENERIC) */
0077 
0078 CALLBACK(puts, CCB_PUTS, 4)
0079 CALLBACK(open, CCB_OPEN, 3)
0080 CALLBACK(close, CCB_CLOSE, 2)
0081 CALLBACK(read, CCB_READ, 5)
0082 CALLBACK(open_console, CCB_OPEN_CONSOLE, 1)
0083 CALLBACK(close_console, CCB_CLOSE_CONSOLE, 1)
0084 CALLBACK(getenv, CCB_GET_ENV, 4)
0085 CALLBACK(setenv, CCB_SET_ENV, 4)
0086 CALLBACK(getc, CCB_GETC, 2)
0087 CALLBACK(reset_term, CCB_RESET_TERM, 2)
0088 CALLBACK(term_int, CCB_SET_TERM_INT, 3)
0089 CALLBACK(term_ctl, CCB_SET_TERM_CTL, 3)
0090 CALLBACK(process_keycode, CCB_PROCESS_KEYCODE, 3)
0091 CALLBACK(ioctl, CCB_IOCTL, 6)
0092 CALLBACK(write, CCB_WRITE, 5)
0093 CALLBACK(reset_env, CCB_RESET_ENV, 4)
0094 CALLBACK(save_env, CCB_SAVE_ENV, 1)
0095 CALLBACK(pswitch, CCB_PSWITCH, 3)
0096 CALLBACK(bios_emul, CCB_BIOS_EMUL, 5)
0097 
0098 EXPORT_SYMBOL(callback_getenv)
0099 EXPORT_SYMBOL(callback_setenv)
0100 EXPORT_SYMBOL(callback_save_env)
0101     
0102 .data
0103 __alpha_using_srm:      # For use by bootpheader
0104     .long 7         # value is not 1 for link debugging
0105     .weak alpha_using_srm; alpha_using_srm = __alpha_using_srm
0106 __callback_init_done:       # For use by bootpheader
0107     .long 7         # value is not 1 for link debugging
0108     .weak callback_init_done; callback_init_done = __callback_init_done
0109