misc_64.S 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. /*
  2. * This file contains miscellaneous low-level functions.
  3. * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
  4. *
  5. * Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
  6. * and Paul Mackerras.
  7. * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com)
  8. * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License
  12. * as published by the Free Software Foundation; either version
  13. * 2 of the License, or (at your option) any later version.
  14. *
  15. */
  16. #include <linux/sys.h>
  17. #include <asm/unistd.h>
  18. #include <asm/errno.h>
  19. #include <asm/processor.h>
  20. #include <asm/page.h>
  21. #include <asm/cache.h>
  22. #include <asm/ppc_asm.h>
  23. #include <asm/asm-offsets.h>
  24. #include <asm/cputable.h>
  25. #include <asm/thread_info.h>
  26. #include <asm/kexec.h>
  27. #include <asm/ptrace.h>
  28. #include <asm/mmu.h>
  29. .text
  30. _GLOBAL(call_do_softirq)
  31. mflr r0
  32. std r0,16(r1)
  33. stdu r1,THREAD_SIZE-STACK_FRAME_OVERHEAD(r3)
  34. mr r1,r3
  35. bl __do_softirq
  36. ld r1,0(r1)
  37. ld r0,16(r1)
  38. mtlr r0
  39. blr
  40. _GLOBAL(call_do_irq)
  41. mflr r0
  42. std r0,16(r1)
  43. stdu r1,THREAD_SIZE-STACK_FRAME_OVERHEAD(r4)
  44. mr r1,r4
  45. bl __do_irq
  46. ld r1,0(r1)
  47. ld r0,16(r1)
  48. mtlr r0
  49. blr
  50. .section ".toc","aw"
  51. PPC64_CACHES:
  52. .tc ppc64_caches[TC],ppc64_caches
  53. .section ".text"
  54. /*
  55. * Write any modified data cache blocks out to memory
  56. * and invalidate the corresponding instruction cache blocks.
  57. *
  58. * flush_icache_range(unsigned long start, unsigned long stop)
  59. *
  60. * flush all bytes from start through stop-1 inclusive
  61. */
  62. _KPROBE_TOC(flush_icache_range)
  63. BEGIN_FTR_SECTION
  64. PURGE_PREFETCHED_INS
  65. blr
  66. END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
  67. /*
  68. * Flush the data cache to memory
  69. *
  70. * Different systems have different cache line sizes
  71. * and in some cases i-cache and d-cache line sizes differ from
  72. * each other.
  73. */
  74. ld r10,PPC64_CACHES@toc(r2)
  75. lwz r7,DCACHEL1LINESIZE(r10)/* Get cache line size */
  76. addi r5,r7,-1
  77. andc r6,r3,r5 /* round low to line bdy */
  78. subf r8,r6,r4 /* compute length */
  79. add r8,r8,r5 /* ensure we get enough */
  80. lwz r9,DCACHEL1LOGLINESIZE(r10) /* Get log-2 of cache line size */
  81. srw. r8,r8,r9 /* compute line count */
  82. beqlr /* nothing to do? */
  83. mtctr r8
  84. 1: dcbst 0,r6
  85. add r6,r6,r7
  86. bdnz 1b
  87. sync
  88. /* Now invalidate the instruction cache */
  89. lwz r7,ICACHEL1LINESIZE(r10) /* Get Icache line size */
  90. addi r5,r7,-1
  91. andc r6,r3,r5 /* round low to line bdy */
  92. subf r8,r6,r4 /* compute length */
  93. add r8,r8,r5
  94. lwz r9,ICACHEL1LOGLINESIZE(r10) /* Get log-2 of Icache line size */
  95. srw. r8,r8,r9 /* compute line count */
  96. beqlr /* nothing to do? */
  97. mtctr r8
  98. 2: icbi 0,r6
  99. add r6,r6,r7
  100. bdnz 2b
  101. isync
  102. blr
  103. .previous .text
  104. /*
  105. * Like above, but only do the D-cache.
  106. *
  107. * flush_dcache_range(unsigned long start, unsigned long stop)
  108. *
  109. * flush all bytes from start to stop-1 inclusive
  110. */
  111. _GLOBAL_TOC(flush_dcache_range)
  112. /*
  113. * Flush the data cache to memory
  114. *
  115. * Different systems have different cache line sizes
  116. */
  117. ld r10,PPC64_CACHES@toc(r2)
  118. lwz r7,DCACHEL1LINESIZE(r10) /* Get dcache line size */
  119. addi r5,r7,-1
  120. andc r6,r3,r5 /* round low to line bdy */
  121. subf r8,r6,r4 /* compute length */
  122. add r8,r8,r5 /* ensure we get enough */
  123. lwz r9,DCACHEL1LOGLINESIZE(r10) /* Get log-2 of dcache line size */
  124. srw. r8,r8,r9 /* compute line count */
  125. beqlr /* nothing to do? */
  126. mtctr r8
  127. 0: dcbst 0,r6
  128. add r6,r6,r7
  129. bdnz 0b
  130. sync
  131. blr
  132. /*
  133. * Like above, but works on non-mapped physical addresses.
  134. * Use only for non-LPAR setups ! It also assumes real mode
  135. * is cacheable. Used for flushing out the DART before using
  136. * it as uncacheable memory
  137. *
  138. * flush_dcache_phys_range(unsigned long start, unsigned long stop)
  139. *
  140. * flush all bytes from start to stop-1 inclusive
  141. */
  142. _GLOBAL(flush_dcache_phys_range)
  143. ld r10,PPC64_CACHES@toc(r2)
  144. lwz r7,DCACHEL1LINESIZE(r10) /* Get dcache line size */
  145. addi r5,r7,-1
  146. andc r6,r3,r5 /* round low to line bdy */
  147. subf r8,r6,r4 /* compute length */
  148. add r8,r8,r5 /* ensure we get enough */
  149. lwz r9,DCACHEL1LOGLINESIZE(r10) /* Get log-2 of dcache line size */
  150. srw. r8,r8,r9 /* compute line count */
  151. beqlr /* nothing to do? */
  152. mfmsr r5 /* Disable MMU Data Relocation */
  153. ori r0,r5,MSR_DR
  154. xori r0,r0,MSR_DR
  155. sync
  156. mtmsr r0
  157. sync
  158. isync
  159. mtctr r8
  160. 0: dcbst 0,r6
  161. add r6,r6,r7
  162. bdnz 0b
  163. sync
  164. isync
  165. mtmsr r5 /* Re-enable MMU Data Relocation */
  166. sync
  167. isync
  168. blr
  169. _GLOBAL(flush_inval_dcache_range)
  170. ld r10,PPC64_CACHES@toc(r2)
  171. lwz r7,DCACHEL1LINESIZE(r10) /* Get dcache line size */
  172. addi r5,r7,-1
  173. andc r6,r3,r5 /* round low to line bdy */
  174. subf r8,r6,r4 /* compute length */
  175. add r8,r8,r5 /* ensure we get enough */
  176. lwz r9,DCACHEL1LOGLINESIZE(r10)/* Get log-2 of dcache line size */
  177. srw. r8,r8,r9 /* compute line count */
  178. beqlr /* nothing to do? */
  179. sync
  180. isync
  181. mtctr r8
  182. 0: dcbf 0,r6
  183. add r6,r6,r7
  184. bdnz 0b
  185. sync
  186. isync
  187. blr
  188. /*
  189. * Flush a particular page from the data cache to RAM.
  190. * Note: this is necessary because the instruction cache does *not*
  191. * snoop from the data cache.
  192. *
  193. * void __flush_dcache_icache(void *page)
  194. */
  195. _GLOBAL(__flush_dcache_icache)
  196. /*
  197. * Flush the data cache to memory
  198. *
  199. * Different systems have different cache line sizes
  200. */
  201. BEGIN_FTR_SECTION
  202. PURGE_PREFETCHED_INS
  203. blr
  204. END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
  205. /* Flush the dcache */
  206. ld r7,PPC64_CACHES@toc(r2)
  207. clrrdi r3,r3,PAGE_SHIFT /* Page align */
  208. lwz r4,DCACHEL1LINESPERPAGE(r7) /* Get # dcache lines per page */
  209. lwz r5,DCACHEL1LINESIZE(r7) /* Get dcache line size */
  210. mr r6,r3
  211. mtctr r4
  212. 0: dcbst 0,r6
  213. add r6,r6,r5
  214. bdnz 0b
  215. sync
  216. /* Now invalidate the icache */
  217. lwz r4,ICACHEL1LINESPERPAGE(r7) /* Get # icache lines per page */
  218. lwz r5,ICACHEL1LINESIZE(r7) /* Get icache line size */
  219. mtctr r4
  220. 1: icbi 0,r3
  221. add r3,r3,r5
  222. bdnz 1b
  223. isync
  224. blr
  225. _GLOBAL(__bswapdi2)
  226. srdi r8,r3,32
  227. rlwinm r7,r3,8,0xffffffff
  228. rlwimi r7,r3,24,0,7
  229. rlwinm r9,r8,8,0xffffffff
  230. rlwimi r7,r3,24,16,23
  231. rlwimi r9,r8,24,0,7
  232. rlwimi r9,r8,24,16,23
  233. sldi r7,r7,32
  234. or r3,r7,r9
  235. blr
  236. #ifdef CONFIG_PPC_EARLY_DEBUG_BOOTX
  237. _GLOBAL(rmci_on)
  238. sync
  239. isync
  240. li r3,0x100
  241. rldicl r3,r3,32,0
  242. mfspr r5,SPRN_HID4
  243. or r5,r5,r3
  244. sync
  245. mtspr SPRN_HID4,r5
  246. isync
  247. slbia
  248. isync
  249. sync
  250. blr
  251. _GLOBAL(rmci_off)
  252. sync
  253. isync
  254. li r3,0x100
  255. rldicl r3,r3,32,0
  256. mfspr r5,SPRN_HID4
  257. andc r5,r5,r3
  258. sync
  259. mtspr SPRN_HID4,r5
  260. isync
  261. slbia
  262. isync
  263. sync
  264. blr
  265. #endif /* CONFIG_PPC_EARLY_DEBUG_BOOTX */
  266. #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE)
  267. /*
  268. * Do an IO access in real mode
  269. */
  270. _GLOBAL(real_readb)
  271. mfmsr r7
  272. ori r0,r7,MSR_DR
  273. xori r0,r0,MSR_DR
  274. sync
  275. mtmsrd r0
  276. sync
  277. isync
  278. mfspr r6,SPRN_HID4
  279. rldicl r5,r6,32,0
  280. ori r5,r5,0x100
  281. rldicl r5,r5,32,0
  282. sync
  283. mtspr SPRN_HID4,r5
  284. isync
  285. slbia
  286. isync
  287. lbz r3,0(r3)
  288. sync
  289. mtspr SPRN_HID4,r6
  290. isync
  291. slbia
  292. isync
  293. mtmsrd r7
  294. sync
  295. isync
  296. blr
  297. /*
  298. * Do an IO access in real mode
  299. */
  300. _GLOBAL(real_writeb)
  301. mfmsr r7
  302. ori r0,r7,MSR_DR
  303. xori r0,r0,MSR_DR
  304. sync
  305. mtmsrd r0
  306. sync
  307. isync
  308. mfspr r6,SPRN_HID4
  309. rldicl r5,r6,32,0
  310. ori r5,r5,0x100
  311. rldicl r5,r5,32,0
  312. sync
  313. mtspr SPRN_HID4,r5
  314. isync
  315. slbia
  316. isync
  317. stb r3,0(r4)
  318. sync
  319. mtspr SPRN_HID4,r6
  320. isync
  321. slbia
  322. isync
  323. mtmsrd r7
  324. sync
  325. isync
  326. blr
  327. #endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE) */
  328. #ifdef CONFIG_PPC_PASEMI
  329. _GLOBAL(real_205_readb)
  330. mfmsr r7
  331. ori r0,r7,MSR_DR
  332. xori r0,r0,MSR_DR
  333. sync
  334. mtmsrd r0
  335. sync
  336. isync
  337. LBZCIX(R3,R0,R3)
  338. isync
  339. mtmsrd r7
  340. sync
  341. isync
  342. blr
  343. _GLOBAL(real_205_writeb)
  344. mfmsr r7
  345. ori r0,r7,MSR_DR
  346. xori r0,r0,MSR_DR
  347. sync
  348. mtmsrd r0
  349. sync
  350. isync
  351. STBCIX(R3,R0,R4)
  352. isync
  353. mtmsrd r7
  354. sync
  355. isync
  356. blr
  357. #endif /* CONFIG_PPC_PASEMI */
  358. #if defined(CONFIG_CPU_FREQ_PMAC64) || defined(CONFIG_CPU_FREQ_MAPLE)
  359. /*
  360. * SCOM access functions for 970 (FX only for now)
  361. *
  362. * unsigned long scom970_read(unsigned int address);
  363. * void scom970_write(unsigned int address, unsigned long value);
  364. *
  365. * The address passed in is the 24 bits register address. This code
  366. * is 970 specific and will not check the status bits, so you should
  367. * know what you are doing.
  368. */
  369. _GLOBAL(scom970_read)
  370. /* interrupts off */
  371. mfmsr r4
  372. ori r0,r4,MSR_EE
  373. xori r0,r0,MSR_EE
  374. mtmsrd r0,1
  375. /* rotate 24 bits SCOM address 8 bits left and mask out it's low 8 bits
  376. * (including parity). On current CPUs they must be 0'd,
  377. * and finally or in RW bit
  378. */
  379. rlwinm r3,r3,8,0,15
  380. ori r3,r3,0x8000
  381. /* do the actual scom read */
  382. sync
  383. mtspr SPRN_SCOMC,r3
  384. isync
  385. mfspr r3,SPRN_SCOMD
  386. isync
  387. mfspr r0,SPRN_SCOMC
  388. isync
  389. /* XXX: fixup result on some buggy 970's (ouch ! we lost a bit, bah
  390. * that's the best we can do). Not implemented yet as we don't use
  391. * the scom on any of the bogus CPUs yet, but may have to be done
  392. * ultimately
  393. */
  394. /* restore interrupts */
  395. mtmsrd r4,1
  396. blr
  397. _GLOBAL(scom970_write)
  398. /* interrupts off */
  399. mfmsr r5
  400. ori r0,r5,MSR_EE
  401. xori r0,r0,MSR_EE
  402. mtmsrd r0,1
  403. /* rotate 24 bits SCOM address 8 bits left and mask out it's low 8 bits
  404. * (including parity). On current CPUs they must be 0'd.
  405. */
  406. rlwinm r3,r3,8,0,15
  407. sync
  408. mtspr SPRN_SCOMD,r4 /* write data */
  409. isync
  410. mtspr SPRN_SCOMC,r3 /* write command */
  411. isync
  412. mfspr 3,SPRN_SCOMC
  413. isync
  414. /* restore interrupts */
  415. mtmsrd r5,1
  416. blr
  417. #endif /* CONFIG_CPU_FREQ_PMAC64 || CONFIG_CPU_FREQ_MAPLE */
  418. /* kexec_wait(phys_cpu)
  419. *
  420. * wait for the flag to change, indicating this kernel is going away but
  421. * the slave code for the next one is at addresses 0 to 100.
  422. *
  423. * This is used by all slaves, even those that did not find a matching
  424. * paca in the secondary startup code.
  425. *
  426. * Physical (hardware) cpu id should be in r3.
  427. */
  428. _GLOBAL(kexec_wait)
  429. bl 1f
  430. 1: mflr r5
  431. addi r5,r5,kexec_flag-1b
  432. 99: HMT_LOW
  433. #ifdef CONFIG_KEXEC /* use no memory without kexec */
  434. lwz r4,0(r5)
  435. cmpwi 0,r4,0
  436. beq 99b
  437. #ifdef CONFIG_PPC_BOOK3S_64
  438. li r10,0x60
  439. mfmsr r11
  440. clrrdi r11,r11,1 /* Clear MSR_LE */
  441. mtsrr0 r10
  442. mtsrr1 r11
  443. rfid
  444. #else
  445. /* Create TLB entry in book3e_secondary_core_init */
  446. li r4,0
  447. ba 0x60
  448. #endif
  449. #endif
  450. /* this can be in text because we won't change it until we are
  451. * running in real anyways
  452. */
  453. kexec_flag:
  454. .long 0
  455. #ifdef CONFIG_KEXEC
  456. #ifdef CONFIG_PPC_BOOK3E
  457. /*
  458. * BOOK3E has no real MMU mode, so we have to setup the initial TLB
  459. * for a core to identity map v:0 to p:0. This current implementation
  460. * assumes that 1G is enough for kexec.
  461. */
  462. kexec_create_tlb:
  463. /*
  464. * Invalidate all non-IPROT TLB entries to avoid any TLB conflict.
  465. * IPROT TLB entries should be >= PAGE_OFFSET and thus not conflict.
  466. */
  467. PPC_TLBILX_ALL(0,R0)
  468. sync
  469. isync
  470. mfspr r10,SPRN_TLB1CFG
  471. andi. r10,r10,TLBnCFG_N_ENTRY /* Extract # entries */
  472. subi r10,r10,1 /* Last entry: no conflict with kernel text */
  473. lis r9,MAS0_TLBSEL(1)@h
  474. rlwimi r9,r10,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r9) */
  475. /* Set up a temp identity mapping v:0 to p:0 and return to it. */
  476. #if defined(CONFIG_SMP) || defined(CONFIG_PPC_E500MC)
  477. #define M_IF_NEEDED MAS2_M
  478. #else
  479. #define M_IF_NEEDED 0
  480. #endif
  481. mtspr SPRN_MAS0,r9
  482. lis r9,(MAS1_VALID|MAS1_IPROT)@h
  483. ori r9,r9,(MAS1_TSIZE(BOOK3E_PAGESZ_1GB))@l
  484. mtspr SPRN_MAS1,r9
  485. LOAD_REG_IMMEDIATE(r9, 0x0 | M_IF_NEEDED)
  486. mtspr SPRN_MAS2,r9
  487. LOAD_REG_IMMEDIATE(r9, 0x0 | MAS3_SR | MAS3_SW | MAS3_SX)
  488. mtspr SPRN_MAS3,r9
  489. li r9,0
  490. mtspr SPRN_MAS7,r9
  491. tlbwe
  492. isync
  493. blr
  494. #endif
  495. /* kexec_smp_wait(void)
  496. *
  497. * call with interrupts off
  498. * note: this is a terminal routine, it does not save lr
  499. *
  500. * get phys id from paca
  501. * switch to real mode
  502. * mark the paca as no longer used
  503. * join other cpus in kexec_wait(phys_id)
  504. */
  505. _GLOBAL(kexec_smp_wait)
  506. lhz r3,PACAHWCPUID(r13)
  507. bl real_mode
  508. li r4,KEXEC_STATE_REAL_MODE
  509. stb r4,PACAKEXECSTATE(r13)
  510. SYNC
  511. b kexec_wait
  512. /*
  513. * switch to real mode (turn mmu off)
  514. * we use the early kernel trick that the hardware ignores bits
  515. * 0 and 1 (big endian) of the effective address in real mode
  516. *
  517. * don't overwrite r3 here, it is live for kexec_wait above.
  518. */
  519. real_mode: /* assume normal blr return */
  520. #ifdef CONFIG_PPC_BOOK3E
  521. /* Create an identity mapping. */
  522. b kexec_create_tlb
  523. #else
  524. 1: li r9,MSR_RI
  525. li r10,MSR_DR|MSR_IR
  526. mflr r11 /* return address to SRR0 */
  527. mfmsr r12
  528. andc r9,r12,r9
  529. andc r10,r12,r10
  530. mtmsrd r9,1
  531. mtspr SPRN_SRR1,r10
  532. mtspr SPRN_SRR0,r11
  533. rfid
  534. #endif
  535. /*
  536. * kexec_sequence(newstack, start, image, control, clear_all())
  537. *
  538. * does the grungy work with stack switching and real mode switches
  539. * also does simple calls to other code
  540. */
  541. _GLOBAL(kexec_sequence)
  542. mflr r0
  543. std r0,16(r1)
  544. /* switch stacks to newstack -- &kexec_stack.stack */
  545. stdu r1,THREAD_SIZE-STACK_FRAME_OVERHEAD(r3)
  546. mr r1,r3
  547. li r0,0
  548. std r0,16(r1)
  549. /* save regs for local vars on new stack.
  550. * yes, we won't go back, but ...
  551. */
  552. std r31,-8(r1)
  553. std r30,-16(r1)
  554. std r29,-24(r1)
  555. std r28,-32(r1)
  556. std r27,-40(r1)
  557. std r26,-48(r1)
  558. std r25,-56(r1)
  559. stdu r1,-STACK_FRAME_OVERHEAD-64(r1)
  560. /* save args into preserved regs */
  561. mr r31,r3 /* newstack (both) */
  562. mr r30,r4 /* start (real) */
  563. mr r29,r5 /* image (virt) */
  564. mr r28,r6 /* control, unused */
  565. mr r27,r7 /* clear_all() fn desc */
  566. mr r26,r8 /* spare */
  567. lhz r25,PACAHWCPUID(r13) /* get our phys cpu from paca */
  568. /* disable interrupts, we are overwriting kernel data next */
  569. #ifdef CONFIG_PPC_BOOK3E
  570. wrteei 0
  571. #else
  572. mfmsr r3
  573. rlwinm r3,r3,0,17,15
  574. mtmsrd r3,1
  575. #endif
  576. /* copy dest pages, flush whole dest image */
  577. mr r3,r29
  578. bl kexec_copy_flush /* (image) */
  579. /* turn off mmu */
  580. bl real_mode
  581. /* copy 0x100 bytes starting at start to 0 */
  582. li r3,0
  583. mr r4,r30 /* start, aka phys mem offset */
  584. li r5,0x100
  585. li r6,0
  586. bl copy_and_flush /* (dest, src, copy limit, start offset) */
  587. 1: /* assume normal blr return */
  588. /* release other cpus to the new kernel secondary start at 0x60 */
  589. mflr r5
  590. li r6,1
  591. stw r6,kexec_flag-1b(5)
  592. #ifndef CONFIG_PPC_BOOK3E
  593. /* clear out hardware hash page table and tlb */
  594. #if !defined(_CALL_ELF) || _CALL_ELF != 2
  595. ld r12,0(r27) /* deref function descriptor */
  596. #else
  597. mr r12,r27
  598. #endif
  599. mtctr r12
  600. bctrl /* ppc_md.hpte_clear_all(void); */
  601. #endif /* !CONFIG_PPC_BOOK3E */
  602. /*
  603. * kexec image calling is:
  604. * the first 0x100 bytes of the entry point are copied to 0
  605. *
  606. * all slaves branch to slave = 0x60 (absolute)
  607. * slave(phys_cpu_id);
  608. *
  609. * master goes to start = entry point
  610. * start(phys_cpu_id, start, 0);
  611. *
  612. *
  613. * a wrapper is needed to call existing kernels, here is an approximate
  614. * description of one method:
  615. *
  616. * v2: (2.6.10)
  617. * start will be near the boot_block (maybe 0x100 bytes before it?)
  618. * it will have a 0x60, which will b to boot_block, where it will wait
  619. * and 0 will store phys into struct boot-block and load r3 from there,
  620. * copy kernel 0-0x100 and tell slaves to back down to 0x60 again
  621. *
  622. * v1: (2.6.9)
  623. * boot block will have all cpus scanning device tree to see if they
  624. * are the boot cpu ?????
  625. * other device tree differences (prop sizes, va vs pa, etc)...
  626. */
  627. mr r3,r25 # my phys cpu
  628. mr r4,r30 # start, aka phys mem offset
  629. mtlr 4
  630. li r5,0
  631. blr /* image->start(physid, image->start, 0); */
  632. #endif /* CONFIG_KEXEC */