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