Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
31cdd0c3 | 2 | #include <asm/ppc_asm.h> |
ec0c464c | 3 | #include <asm/asm-compat.h> |
31cdd0c3 PM |
4 | |
5 | /* unsigned long xmon_mfspr(sprn, default_value) */ | |
6 | _GLOBAL(xmon_mfspr) | |
dab3b8f4 | 7 | LOAD_REG_ADDR(r5, .Lmfspr_table) |
31cdd0c3 PM |
8 | b xmon_mxspr |
9 | ||
10 | /* void xmon_mtspr(sprn, new_value) */ | |
11 | _GLOBAL(xmon_mtspr) | |
dab3b8f4 | 12 | LOAD_REG_ADDR(r5, .Lmtspr_table) |
31cdd0c3 PM |
13 | b xmon_mxspr |
14 | ||
15 | /* | |
16 | * r3 = sprn | |
17 | * r4 = default or new value | |
18 | * r5 = table base | |
19 | */ | |
20 | xmon_mxspr: | |
21 | /* | |
22 | * To index into the table of mxsprs we need: | |
23 | * i = (sprn & 0x3ff) * 8 | |
24 | * or using rwlinm: | |
25 | * i = (sprn << 3) & (0x3ff << 3) | |
26 | */ | |
27 | rlwinm r3, r3, 3, 0x3ff << 3 | |
28 | add r5, r5, r3 | |
29 | mtctr r5 | |
30 | mr r3, r4 /* put default_value in r3 for mfspr */ | |
31 | bctr | |
32 | ||
33 | .Lmfspr_table: | |
34 | spr = 0 | |
35 | .rept 1024 | |
36 | mfspr r3, spr | |
37 | blr | |
38 | spr = spr + 1 | |
39 | .endr | |
40 | ||
41 | .Lmtspr_table: | |
42 | spr = 0 | |
43 | .rept 1024 | |
44 | mtspr spr, r4 | |
45 | blr | |
46 | spr = spr + 1 | |
47 | .endr |