Fix IP22 timer calibration.
[linux-2.6/linux-mips.git] / include / asm-sparc / asmmacro.h
blobd1441ec0a53114940802591edf8c9cb2086d4ed7
1 /* asmmacro.h: Assembler macros.
3 * Copyright (C) 1996 David S. Miller (davem@caipfs.rutgers.edu)
4 */
6 #ifndef _SPARC_ASMMACRO_H
7 #define _SPARC_ASMMACRO_H
9 #include <linux/config.h>
10 #include <asm/btfixup.h>
11 #include <asm/asi.h>
13 #define GET_PROCESSOR4M_ID(reg) \
14 rd %tbr, %reg; \
15 srl %reg, 12, %reg; \
16 and %reg, 3, %reg;
18 #define GET_PROCESSOR4D_ID(reg) \
19 lda [%g0] ASI_M_VIKING_TMP1, %reg;
21 /* Blackbox */
22 #define GET_PROCESSOR_ID(reg) \
23 sethi %hi(___b_smp_processor_id), %reg; \
24 sethi %hi(boot_cpu_id), %reg; \
25 ldub [%reg + %lo(boot_cpu_id)], %reg;
27 #define GET_PROCESSOR_MID(reg, tmp) \
28 rd %tbr, %reg; \
29 sethi %hi(C_LABEL(mid_xlate)), %tmp; \
30 srl %reg, 12, %reg; \
31 or %tmp, %lo(C_LABEL(mid_xlate)), %tmp; \
32 and %reg, 3, %reg; \
33 ldub [%tmp + %reg], %reg;
35 #define GET_PROCESSOR_OFFSET(reg, tmp) \
36 GET_PROCESSOR_ID(reg) \
37 sethi %hi(C_LABEL(cpu_offset)), %tmp; \
38 sll %reg, 2, %reg; \
39 or %tmp, %lo(C_LABEL(cpu_offset)), %tmp; \
40 ld [%tmp + %reg], %reg;
42 /* All trap entry points _must_ begin with this macro or else you
43 * lose. It makes sure the kernel has a proper window so that
44 * c-code can be called.
46 #define SAVE_ALL_HEAD \
47 sethi %hi(trap_setup), %l4; \
48 jmpl %l4 + %lo(trap_setup), %l6;
49 #define SAVE_ALL \
50 SAVE_ALL_HEAD \
51 nop;
53 /* All traps low-level code here must end with this macro. */
54 #define RESTORE_ALL b ret_trap_entry; clr %l6;
56 /* sun4 probably wants half word accesses to ASI_SEGMAP, while sun4c+
57 likes byte accesses. These are to avoid ifdef mania. */
59 #ifdef CONFIG_SUN4
60 #define lduXa lduha
61 #define stXa stha
62 #else
63 #define lduXa lduba
64 #define stXa stba
65 #endif
67 #endif /* !(_SPARC_ASMMACRO_H) */