Changeset 0259524 in mainline for arch/ia64/include/asm.h
- Timestamp:
- 2005-11-03T20:26:29Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 05d9dd89
- Parents:
- dbd1059
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia64/include/asm.h
rdbd1059 r0259524 32 32 #include <arch/types.h> 33 33 #include <config.h> 34 #include <arch/register.h> 34 35 35 36 /** Return base address of current stack … … 48 49 } 49 50 50 /** Read IVR (External Interrupt Vector Register) 51 /** Read IVR (External Interrupt Vector Register). 51 52 * 52 53 * @return Highest priority, pending, unmasked external interrupt vector. 53 54 */ 54 static inline __u8 read_ivr(void) 55 { 56 __u64 v; 57 58 __asm__ volatile ("mov %0 = cr65\n" : "=r" (v)); 59 60 return (__u8) (v & 0xf); 61 } 62 63 64 void cpu_sleep(void); 65 66 void asm_delay_loop(__u32 t); 67 55 static inline __u64 ivr_read(void) 56 { 57 __u64 v; 58 59 __asm__ volatile ("mov %0 = cr.ivr\n" : "=r" (v)); 60 61 return v; 62 } 63 64 /** Write ITC (Interval Timer Counter) register. 65 * 66 * @param New counter value. 67 */ 68 static inline void itc_write(__u64 v) 69 { 70 __asm__ volatile ("mov ar.itc = %0\n" : : "r" (v)); 71 } 72 73 /** Read ITC (Interval Timer Counter) register. 74 * 75 * @return Current counter value. 76 */ 77 static inline __u64 itc_read(void) 78 { 79 __u64 v; 80 81 __asm__ volatile ("mov %0 = ar.itc\n" : "=r" (v)); 82 83 return v; 84 } 85 86 /** Write ITM (Interval Timer Match) register. 87 * 88 * @param New match value. 89 */ 90 static inline void itm_write(__u64 v) 91 { 92 __asm__ volatile ("mov cr.itm = %0\n" : : "r" (v)); 93 } 94 95 /** Write ITV (Interval Timer Vector) register. 96 * 97 * @param New vector and masked bit. 98 */ 99 static inline void itv_write(__u64 v) 100 { 101 __asm__ volatile ("mov cr.itv = %0\n" : : "r" (v)); 102 } 103 104 /** Write EOI (End Of Interrupt) register. 105 * 106 * @param This value is ignored. 107 */ 108 static inline void eoi_write(__u64 v) 109 { 110 __asm__ volatile ("mov cr.eoi = %0\n" : : "r" (v)); 111 } 112 113 /** Read TPR (Task Priority Register). 114 * 115 * @return Current value of TPR. 116 */ 117 static inline __u64 tpr_read(void) 118 { 119 __u64 v; 120 121 __asm__ volatile ("mov %0 = cr.tpr\n" : "=r" (v)); 122 123 return v; 124 } 125 126 /** Write TPR (Task Priority Register). 127 * 128 * @param New value of TPR. 129 */ 130 static inline void tpr_write(__u64 v) 131 { 132 __asm__ volatile ("mov cr.tpr = %0\n" : : "r" (v)); 133 } 134 135 /** Disable interrupts. 136 * 137 * Disable interrupts and return previous 138 * value of PSR. 139 * 140 * @return Old interrupt priority level. 141 */ 142 static ipl_t interrupts_disable(void) 143 { 144 __u64 v; 145 146 __asm__ volatile ( 147 "mov %0 = psr\n" 148 "rsm %1\n" 149 : "=r" (v) 150 : "i" (PSR_I_MASK) 151 ); 152 153 return (ipl_t) v; 154 } 155 156 /** Enable interrupts. 157 * 158 * Enable interrupts and return previous 159 * value of PSR. 160 * 161 * @return Old interrupt priority level. 162 */ 163 static ipl_t interrupts_enable(void) 164 { 165 __u64 v; 166 167 __asm__ volatile ( 168 "mov %0 = psr\n" 169 "ssm %1\n" 170 ";;\n" 171 "srlz.d\n" 172 : "=r" (v) 173 : "i" (PSR_I_MASK) 174 ); 175 176 return (ipl_t) v; 177 } 178 179 /** Restore interrupt priority level. 180 * 181 * Restore PSR. 182 * 183 * @param ipl Saved interrupt priority level. 184 */ 185 static inline void interrupts_restore(ipl_t ipl) 186 { 187 __asm__ volatile ( 188 "mov psr.l = %0\n" 189 ";;\n" 190 "srlz.d\n" 191 : : "r" ((__u64) ipl) 192 ); 193 } 194 195 /** Return interrupt priority level. 196 * 197 * @return PSR. 198 */ 199 static inline ipl_t interrupts_read(void) 200 { 201 __u64 v; 202 203 __asm__ volatile ("mov %0 = psr\n" : "=r" (v)); 204 205 return (ipl_t) v; 206 } 68 207 69 208 #define set_shadow_register(reg,val) {__u64 v = val; __asm__ volatile("mov r15 = %0;;\n""bsw.0;;\n""mov " #reg " = r15;;\n""bsw.1;;\n" : : "r" (v) : "r15" ); } … … 74 213 #define get_psr(val) {__u64 v ; __asm__ volatile("mov r15 = psr;;\n" "mov %0 = r15;;\n" : "=r" (v) : : "r15" ); val=v; } 75 214 76 77 void cpu_halt(void); 78 79 80 215 extern void cpu_halt(void); 216 extern void cpu_sleep(void); 217 extern void asm_delay_loop(__u32 t); 81 218 82 219 #endif
Note:
See TracChangeset
for help on using the changeset viewer.