Adrian Bunk | b00dc83 | 2008-05-19 16:52:27 -0700 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * misc.c: Miscellaneous prom functions that don't belong |
| 3 | * anywhere else. |
| 4 | * |
| 5 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) |
| 6 | * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) |
| 7 | */ |
| 8 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | #include <linux/types.h> |
| 10 | #include <linux/kernel.h> |
| 11 | #include <linux/sched.h> |
| 12 | #include <linux/interrupt.h> |
| 13 | #include <linux/delay.h> |
Sam Ravnborg | 917c366 | 2009-01-08 16:58:20 -0800 | [diff] [blame] | 14 | #include <linux/module.h> |
| 15 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include <asm/openprom.h> |
| 17 | #include <asm/oplib.h> |
| 18 | #include <asm/system.h> |
David S. Miller | b3e13fb | 2007-07-12 15:55:55 -0700 | [diff] [blame] | 19 | #include <asm/ldc.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
David S. Miller | 22d6a1c | 2007-05-25 00:37:12 -0700 | [diff] [blame] | 21 | int prom_service_exists(const char *service_name) |
| 22 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 23 | unsigned long args[5]; |
David S. Miller | 22d6a1c | 2007-05-25 00:37:12 -0700 | [diff] [blame] | 24 | |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 25 | args[0] = (unsigned long) "test"; |
| 26 | args[1] = 1; |
| 27 | args[2] = 1; |
| 28 | args[3] = (unsigned long) service_name; |
| 29 | args[4] = (unsigned long) -1; |
| 30 | |
| 31 | p1275_cmd_direct(args); |
| 32 | |
| 33 | if (args[4]) |
David S. Miller | 22d6a1c | 2007-05-25 00:37:12 -0700 | [diff] [blame] | 34 | return 0; |
| 35 | return 1; |
| 36 | } |
| 37 | |
| 38 | void prom_sun4v_guest_soft_state(void) |
| 39 | { |
| 40 | const char *svc = "SUNW,soft-state-supported"; |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 41 | unsigned long args[3]; |
David S. Miller | 22d6a1c | 2007-05-25 00:37:12 -0700 | [diff] [blame] | 42 | |
| 43 | if (!prom_service_exists(svc)) |
| 44 | return; |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 45 | args[0] = (unsigned long) svc; |
| 46 | args[1] = 0; |
| 47 | args[2] = 0; |
| 48 | p1275_cmd_direct(args); |
David S. Miller | 22d6a1c | 2007-05-25 00:37:12 -0700 | [diff] [blame] | 49 | } |
| 50 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | /* Reset and reboot the machine with the command 'bcommand'. */ |
David S. Miller | bff06d5 | 2005-09-22 20:11:33 -0700 | [diff] [blame] | 52 | void prom_reboot(const char *bcommand) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 54 | unsigned long args[4]; |
| 55 | |
David S. Miller | b3e13fb | 2007-07-12 15:55:55 -0700 | [diff] [blame] | 56 | #ifdef CONFIG_SUN_LDOMS |
| 57 | if (ldom_domaining_enabled) |
| 58 | ldom_reboot(bcommand); |
| 59 | #endif |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 60 | args[0] = (unsigned long) "boot"; |
| 61 | args[1] = 1; |
| 62 | args[2] = 0; |
| 63 | args[3] = (unsigned long) bcommand; |
| 64 | |
| 65 | p1275_cmd_direct(args); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | /* Forth evaluate the expression contained in 'fstring'. */ |
David S. Miller | bff06d5 | 2005-09-22 20:11:33 -0700 | [diff] [blame] | 69 | void prom_feval(const char *fstring) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 71 | unsigned long args[5]; |
| 72 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | if (!fstring || fstring[0] == 0) |
| 74 | return; |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 75 | args[0] = (unsigned long) "interpret"; |
| 76 | args[1] = 1; |
| 77 | args[2] = 1; |
| 78 | args[3] = (unsigned long) fstring; |
| 79 | args[4] = (unsigned long) -1; |
| 80 | |
| 81 | p1275_cmd_direct(args); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | } |
Sam Ravnborg | 917c366 | 2009-01-08 16:58:20 -0800 | [diff] [blame] | 83 | EXPORT_SYMBOL(prom_feval); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | #ifdef CONFIG_SMP |
| 86 | extern void smp_capture(void); |
| 87 | extern void smp_release(void); |
| 88 | #endif |
| 89 | |
| 90 | /* Drop into the prom, with the chance to continue with the 'go' |
| 91 | * prom command. |
| 92 | */ |
| 93 | void prom_cmdline(void) |
| 94 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 95 | unsigned long args[3]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | unsigned long flags; |
| 97 | |
| 98 | local_irq_save(flags); |
| 99 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | #ifdef CONFIG_SMP |
| 101 | smp_capture(); |
| 102 | #endif |
| 103 | |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 104 | args[0] = (unsigned long) "enter"; |
| 105 | args[1] = 0; |
| 106 | args[2] = 0; |
| 107 | |
| 108 | p1275_cmd_direct(args); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | |
| 110 | #ifdef CONFIG_SMP |
| 111 | smp_release(); |
| 112 | #endif |
| 113 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | local_irq_restore(flags); |
| 115 | } |
| 116 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | /* Drop into the prom, but completely terminate the program. |
| 118 | * No chance of continuing. |
| 119 | */ |
David S. Miller | bd4352c | 2009-09-04 03:38:54 -0700 | [diff] [blame] | 120 | void notrace prom_halt(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 122 | unsigned long args[3]; |
| 123 | |
David S. Miller | 4f0234f | 2007-07-13 16:03:42 -0700 | [diff] [blame] | 124 | #ifdef CONFIG_SUN_LDOMS |
| 125 | if (ldom_domaining_enabled) |
| 126 | ldom_power_off(); |
| 127 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | again: |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 129 | args[0] = (unsigned long) "exit"; |
| 130 | args[1] = 0; |
| 131 | args[2] = 0; |
| 132 | p1275_cmd_direct(args); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | goto again; /* PROM is out to get me -DaveM */ |
| 134 | } |
| 135 | |
| 136 | void prom_halt_power_off(void) |
| 137 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 138 | unsigned long args[3]; |
| 139 | |
David S. Miller | 4f0234f | 2007-07-13 16:03:42 -0700 | [diff] [blame] | 140 | #ifdef CONFIG_SUN_LDOMS |
| 141 | if (ldom_domaining_enabled) |
| 142 | ldom_power_off(); |
| 143 | #endif |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 144 | args[0] = (unsigned long) "SUNW,power-off"; |
| 145 | args[1] = 0; |
| 146 | args[2] = 0; |
| 147 | p1275_cmd_direct(args); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 | |
| 149 | /* if nothing else helps, we just halt */ |
| 150 | prom_halt(); |
| 151 | } |
| 152 | |
| 153 | /* Set prom sync handler to call function 'funcp'. */ |
| 154 | void prom_setcallback(callback_func_t funcp) |
| 155 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 156 | unsigned long args[5]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | if (!funcp) |
| 158 | return; |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 159 | args[0] = (unsigned long) "set-callback"; |
| 160 | args[1] = 1; |
| 161 | args[2] = 1; |
| 162 | args[3] = (unsigned long) funcp; |
| 163 | args[4] = (unsigned long) -1; |
| 164 | p1275_cmd_direct(args); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 | } |
| 166 | |
| 167 | /* Get the idprom and stuff it into buffer 'idbuf'. Returns the |
| 168 | * format type. 'num_bytes' is the number of bytes that your idbuf |
| 169 | * has space for. Returns 0xff on error. |
| 170 | */ |
| 171 | unsigned char prom_get_idprom(char *idbuf, int num_bytes) |
| 172 | { |
| 173 | int len; |
| 174 | |
| 175 | len = prom_getproplen(prom_root_node, "idprom"); |
| 176 | if ((len >num_bytes) || (len == -1)) |
| 177 | return 0xff; |
| 178 | if (!prom_getproperty(prom_root_node, "idprom", idbuf, num_bytes)) |
| 179 | return idbuf[0]; |
| 180 | |
| 181 | return 0xff; |
| 182 | } |
| 183 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 184 | int prom_get_mmu_ihandle(void) |
| 185 | { |
| 186 | int node, ret; |
| 187 | |
David S. Miller | bff06d5 | 2005-09-22 20:11:33 -0700 | [diff] [blame] | 188 | if (prom_mmu_ihandle_cache != 0) |
| 189 | return prom_mmu_ihandle_cache; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | |
David S. Miller | bff06d5 | 2005-09-22 20:11:33 -0700 | [diff] [blame] | 191 | node = prom_finddevice(prom_chosen_path); |
| 192 | ret = prom_getint(node, prom_mmu_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 193 | if (ret == -1 || ret == 0) |
David S. Miller | bff06d5 | 2005-09-22 20:11:33 -0700 | [diff] [blame] | 194 | prom_mmu_ihandle_cache = -1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 195 | else |
David S. Miller | bff06d5 | 2005-09-22 20:11:33 -0700 | [diff] [blame] | 196 | prom_mmu_ihandle_cache = ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | |
| 198 | return ret; |
| 199 | } |
| 200 | |
| 201 | static int prom_get_memory_ihandle(void) |
| 202 | { |
| 203 | static int memory_ihandle_cache; |
| 204 | int node, ret; |
| 205 | |
| 206 | if (memory_ihandle_cache != 0) |
| 207 | return memory_ihandle_cache; |
| 208 | |
| 209 | node = prom_finddevice("/chosen"); |
| 210 | ret = prom_getint(node, "memory"); |
| 211 | if (ret == -1 || ret == 0) |
| 212 | memory_ihandle_cache = -1; |
| 213 | else |
| 214 | memory_ihandle_cache = ret; |
| 215 | |
| 216 | return ret; |
| 217 | } |
| 218 | |
| 219 | /* Load explicit I/D TLB entries. */ |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 220 | static long tlb_load(const char *type, unsigned long index, |
| 221 | unsigned long tte_data, unsigned long vaddr) |
| 222 | { |
| 223 | unsigned long args[9]; |
| 224 | |
| 225 | args[0] = (unsigned long) prom_callmethod_name; |
| 226 | args[1] = 5; |
| 227 | args[2] = 1; |
| 228 | args[3] = (unsigned long) type; |
| 229 | args[4] = (unsigned int) prom_get_mmu_ihandle(); |
| 230 | args[5] = vaddr; |
| 231 | args[6] = tte_data; |
| 232 | args[7] = index; |
| 233 | args[8] = (unsigned long) -1; |
| 234 | |
| 235 | p1275_cmd_direct(args); |
| 236 | |
| 237 | return (long) args[8]; |
| 238 | } |
| 239 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | long prom_itlb_load(unsigned long index, |
| 241 | unsigned long tte_data, |
| 242 | unsigned long vaddr) |
| 243 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 244 | return tlb_load("SUNW,itlb-load", index, tte_data, vaddr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | } |
| 246 | |
| 247 | long prom_dtlb_load(unsigned long index, |
| 248 | unsigned long tte_data, |
| 249 | unsigned long vaddr) |
| 250 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 251 | return tlb_load("SUNW,dtlb-load", index, tte_data, vaddr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | } |
| 253 | |
| 254 | int prom_map(int mode, unsigned long size, |
| 255 | unsigned long vaddr, unsigned long paddr) |
| 256 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 257 | unsigned long args[11]; |
| 258 | int ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 260 | args[0] = (unsigned long) prom_callmethod_name; |
| 261 | args[1] = 7; |
| 262 | args[2] = 1; |
| 263 | args[3] = (unsigned long) prom_map_name; |
| 264 | args[4] = (unsigned int) prom_get_mmu_ihandle(); |
| 265 | args[5] = (unsigned int) mode; |
| 266 | args[6] = size; |
| 267 | args[7] = vaddr; |
| 268 | args[8] = 0; |
| 269 | args[9] = paddr; |
| 270 | args[10] = (unsigned long) -1; |
| 271 | |
| 272 | p1275_cmd_direct(args); |
| 273 | |
| 274 | ret = (int) args[10]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 275 | if (ret == 0) |
| 276 | ret = -1; |
| 277 | return ret; |
| 278 | } |
| 279 | |
| 280 | void prom_unmap(unsigned long size, unsigned long vaddr) |
| 281 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 282 | unsigned long args[7]; |
| 283 | |
| 284 | args[0] = (unsigned long) prom_callmethod_name; |
| 285 | args[1] = 4; |
| 286 | args[2] = 0; |
| 287 | args[3] = (unsigned long) prom_unmap_name; |
| 288 | args[4] = (unsigned int) prom_get_mmu_ihandle(); |
| 289 | args[5] = size; |
| 290 | args[6] = vaddr; |
| 291 | |
| 292 | p1275_cmd_direct(args); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | } |
| 294 | |
| 295 | /* Set aside physical memory which is not touched or modified |
| 296 | * across soft resets. |
| 297 | */ |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 298 | int prom_retain(const char *name, unsigned long size, |
| 299 | unsigned long align, unsigned long *paddr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 300 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 301 | unsigned long args[11]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 303 | args[0] = (unsigned long) prom_callmethod_name; |
| 304 | args[1] = 5; |
| 305 | args[2] = 3; |
| 306 | args[3] = (unsigned long) "SUNW,retain"; |
| 307 | args[4] = (unsigned int) prom_get_memory_ihandle(); |
| 308 | args[5] = align; |
| 309 | args[6] = size; |
| 310 | args[7] = (unsigned long) name; |
| 311 | args[8] = (unsigned long) -1; |
| 312 | args[9] = (unsigned long) -1; |
| 313 | args[10] = (unsigned long) -1; |
| 314 | |
| 315 | p1275_cmd_direct(args); |
| 316 | |
| 317 | if (args[8]) |
| 318 | return (int) args[8]; |
| 319 | |
| 320 | /* Next we get "phys_high" then "phys_low". On 64-bit |
| 321 | * the phys_high cell is don't care since the phys_low |
| 322 | * cell has the full value. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | */ |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 324 | *paddr = args[10]; |
| 325 | |
| 326 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 327 | } |
| 328 | |
| 329 | /* Get "Unumber" string for the SIMM at the given |
| 330 | * memory address. Usually this will be of the form |
| 331 | * "Uxxxx" where xxxx is a decimal number which is |
| 332 | * etched into the motherboard next to the SIMM slot |
| 333 | * in question. |
| 334 | */ |
| 335 | int prom_getunumber(int syndrome_code, |
| 336 | unsigned long phys_addr, |
| 337 | char *buf, int buflen) |
| 338 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 339 | unsigned long args[12]; |
| 340 | |
| 341 | args[0] = (unsigned long) prom_callmethod_name; |
| 342 | args[1] = 7; |
| 343 | args[2] = 2; |
| 344 | args[3] = (unsigned long) "SUNW,get-unumber"; |
| 345 | args[4] = (unsigned int) prom_get_memory_ihandle(); |
| 346 | args[5] = buflen; |
| 347 | args[6] = (unsigned long) buf; |
| 348 | args[7] = 0; |
| 349 | args[8] = phys_addr; |
| 350 | args[9] = (unsigned int) syndrome_code; |
| 351 | args[10] = (unsigned long) -1; |
| 352 | args[11] = (unsigned long) -1; |
| 353 | |
| 354 | p1275_cmd_direct(args); |
| 355 | |
| 356 | return (int) args[10]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | } |
| 358 | |
| 359 | /* Power management extensions. */ |
| 360 | void prom_sleepself(void) |
| 361 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 362 | unsigned long args[3]; |
| 363 | |
| 364 | args[0] = (unsigned long) "SUNW,sleep-self"; |
| 365 | args[1] = 0; |
| 366 | args[2] = 0; |
| 367 | p1275_cmd_direct(args); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 368 | } |
| 369 | |
| 370 | int prom_sleepsystem(void) |
| 371 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 372 | unsigned long args[4]; |
| 373 | |
| 374 | args[0] = (unsigned long) "SUNW,sleep-system"; |
| 375 | args[1] = 0; |
| 376 | args[2] = 1; |
| 377 | args[3] = (unsigned long) -1; |
| 378 | p1275_cmd_direct(args); |
| 379 | |
| 380 | return (int) args[3]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 381 | } |
| 382 | |
| 383 | int prom_wakeupsystem(void) |
| 384 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 385 | unsigned long args[4]; |
| 386 | |
| 387 | args[0] = (unsigned long) "SUNW,wakeup-system"; |
| 388 | args[1] = 0; |
| 389 | args[2] = 1; |
| 390 | args[3] = (unsigned long) -1; |
| 391 | p1275_cmd_direct(args); |
| 392 | |
| 393 | return (int) args[3]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 394 | } |
| 395 | |
| 396 | #ifdef CONFIG_SMP |
David S. Miller | 7890f79 | 2006-02-15 02:26:54 -0800 | [diff] [blame] | 397 | void prom_startcpu(int cpunode, unsigned long pc, unsigned long arg) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 398 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 399 | unsigned long args[6]; |
| 400 | |
| 401 | args[0] = (unsigned long) "SUNW,start-cpu"; |
| 402 | args[1] = 3; |
| 403 | args[2] = 0; |
| 404 | args[3] = (unsigned int) cpunode; |
| 405 | args[4] = pc; |
| 406 | args[5] = arg; |
| 407 | p1275_cmd_direct(args); |
David S. Miller | 7890f79 | 2006-02-15 02:26:54 -0800 | [diff] [blame] | 408 | } |
| 409 | |
| 410 | void prom_startcpu_cpuid(int cpuid, unsigned long pc, unsigned long arg) |
| 411 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 412 | unsigned long args[6]; |
| 413 | |
| 414 | args[0] = (unsigned long) "SUNW,start-cpu-by-cpuid"; |
| 415 | args[1] = 3; |
| 416 | args[2] = 0; |
| 417 | args[3] = (unsigned int) cpuid; |
| 418 | args[4] = pc; |
| 419 | args[5] = arg; |
| 420 | p1275_cmd_direct(args); |
David S. Miller | 7890f79 | 2006-02-15 02:26:54 -0800 | [diff] [blame] | 421 | } |
| 422 | |
| 423 | void prom_stopcpu_cpuid(int cpuid) |
| 424 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 425 | unsigned long args[4]; |
| 426 | |
| 427 | args[0] = (unsigned long) "SUNW,stop-cpu-by-cpuid"; |
| 428 | args[1] = 1; |
| 429 | args[2] = 0; |
| 430 | args[3] = (unsigned int) cpuid; |
| 431 | p1275_cmd_direct(args); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 432 | } |
| 433 | |
| 434 | void prom_stopself(void) |
| 435 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 436 | unsigned long args[3]; |
| 437 | |
| 438 | args[0] = (unsigned long) "SUNW,stop-self"; |
| 439 | args[1] = 0; |
| 440 | args[2] = 0; |
| 441 | p1275_cmd_direct(args); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 442 | } |
| 443 | |
| 444 | void prom_idleself(void) |
| 445 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 446 | unsigned long args[3]; |
| 447 | |
| 448 | args[0] = (unsigned long) "SUNW,idle-self"; |
| 449 | args[1] = 0; |
| 450 | args[2] = 0; |
| 451 | p1275_cmd_direct(args); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 452 | } |
| 453 | |
| 454 | void prom_resumecpu(int cpunode) |
| 455 | { |
David S. Miller | 25edd69 | 2010-08-23 23:10:57 -0700 | [diff] [blame] | 456 | unsigned long args[4]; |
| 457 | |
| 458 | args[0] = (unsigned long) "SUNW,resume-cpu"; |
| 459 | args[1] = 1; |
| 460 | args[2] = 0; |
| 461 | args[3] = (unsigned int) cpunode; |
| 462 | p1275_cmd_direct(args); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 463 | } |
| 464 | #endif |