head_fsl_booke.S 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164
  1. /*
  2. * Kernel execution entry point code.
  3. *
  4. * Copyright (c) 1995-1996 Gary Thomas <gdt@linuxppc.org>
  5. * Initial PowerPC version.
  6. * Copyright (c) 1996 Cort Dougan <cort@cs.nmt.edu>
  7. * Rewritten for PReP
  8. * Copyright (c) 1996 Paul Mackerras <paulus@cs.anu.edu.au>
  9. * Low-level exception handers, MMU support, and rewrite.
  10. * Copyright (c) 1997 Dan Malek <dmalek@jlc.net>
  11. * PowerPC 8xx modifications.
  12. * Copyright (c) 1998-1999 TiVo, Inc.
  13. * PowerPC 403GCX modifications.
  14. * Copyright (c) 1999 Grant Erickson <grant@lcse.umn.edu>
  15. * PowerPC 403GCX/405GP modifications.
  16. * Copyright 2000 MontaVista Software Inc.
  17. * PPC405 modifications
  18. * PowerPC 403GCX/405GP modifications.
  19. * Author: MontaVista Software, Inc.
  20. * frank_rowand@mvista.com or source@mvista.com
  21. * debbie_chu@mvista.com
  22. * Copyright 2002-2004 MontaVista Software, Inc.
  23. * PowerPC 44x support, Matt Porter <mporter@kernel.crashing.org>
  24. * Copyright 2004 Freescale Semiconductor, Inc
  25. * PowerPC e500 modifications, Kumar Gala <galak@kernel.crashing.org>
  26. *
  27. * This program is free software; you can redistribute it and/or modify it
  28. * under the terms of the GNU General Public License as published by the
  29. * Free Software Foundation; either version 2 of the License, or (at your
  30. * option) any later version.
  31. */
  32. #include <linux/init.h>
  33. #include <linux/threads.h>
  34. #include <asm/processor.h>
  35. #include <asm/page.h>
  36. #include <asm/mmu.h>
  37. #include <asm/pgtable.h>
  38. #include <asm/cputable.h>
  39. #include <asm/thread_info.h>
  40. #include <asm/ppc_asm.h>
  41. #include <asm/asm-offsets.h>
  42. #include <asm/cache.h>
  43. #include "head_booke.h"
  44. /* As with the other PowerPC ports, it is expected that when code
  45. * execution begins here, the following registers contain valid, yet
  46. * optional, information:
  47. *
  48. * r3 - Board info structure pointer (DRAM, frequency, MAC address, etc.)
  49. * r4 - Starting address of the init RAM disk
  50. * r5 - Ending address of the init RAM disk
  51. * r6 - Start of kernel command line string (e.g. "mem=128")
  52. * r7 - End of kernel command line string
  53. *
  54. */
  55. __HEAD
  56. _ENTRY(_stext);
  57. _ENTRY(_start);
  58. /*
  59. * Reserve a word at a fixed location to store the address
  60. * of abatron_pteptrs
  61. */
  62. nop
  63. /*
  64. * Save parameters we are passed
  65. */
  66. mr r31,r3
  67. mr r30,r4
  68. mr r29,r5
  69. mr r28,r6
  70. mr r27,r7
  71. li r25,0 /* phys kernel start (low) */
  72. li r24,0 /* CPU number */
  73. li r23,0 /* phys kernel start (high) */
  74. /* We try to not make any assumptions about how the boot loader
  75. * setup or used the TLBs. We invalidate all mappings from the
  76. * boot loader and load a single entry in TLB1[0] to map the
  77. * first 64M of kernel memory. Any boot info passed from the
  78. * bootloader needs to live in this first 64M.
  79. *
  80. * Requirement on bootloader:
  81. * - The page we're executing in needs to reside in TLB1 and
  82. * have IPROT=1. If not an invalidate broadcast could
  83. * evict the entry we're currently executing in.
  84. *
  85. * r3 = Index of TLB1 were executing in
  86. * r4 = Current MSR[IS]
  87. * r5 = Index of TLB1 temp mapping
  88. *
  89. * Later in mapin_ram we will correctly map lowmem, and resize TLB1[0]
  90. * if needed
  91. */
  92. _ENTRY(__early_start)
  93. /* 1. Find the index of the entry we're executing in */
  94. bl invstr /* Find our address */
  95. invstr: mflr r6 /* Make it accessible */
  96. mfmsr r7
  97. rlwinm r4,r7,27,31,31 /* extract MSR[IS] */
  98. mfspr r7, SPRN_PID0
  99. slwi r7,r7,16
  100. or r7,r7,r4
  101. mtspr SPRN_MAS6,r7
  102. tlbsx 0,r6 /* search MSR[IS], SPID=PID0 */
  103. mfspr r7,SPRN_MAS1
  104. andis. r7,r7,MAS1_VALID@h
  105. bne match_TLB
  106. mfspr r7,SPRN_MMUCFG
  107. rlwinm r7,r7,21,28,31 /* extract MMUCFG[NPIDS] */
  108. cmpwi r7,3
  109. bne match_TLB /* skip if NPIDS != 3 */
  110. mfspr r7,SPRN_PID1
  111. slwi r7,r7,16
  112. or r7,r7,r4
  113. mtspr SPRN_MAS6,r7
  114. tlbsx 0,r6 /* search MSR[IS], SPID=PID1 */
  115. mfspr r7,SPRN_MAS1
  116. andis. r7,r7,MAS1_VALID@h
  117. bne match_TLB
  118. mfspr r7, SPRN_PID2
  119. slwi r7,r7,16
  120. or r7,r7,r4
  121. mtspr SPRN_MAS6,r7
  122. tlbsx 0,r6 /* Fall through, we had to match */
  123. match_TLB:
  124. mfspr r7,SPRN_MAS0
  125. rlwinm r3,r7,16,20,31 /* Extract MAS0(Entry) */
  126. mfspr r7,SPRN_MAS1 /* Insure IPROT set */
  127. oris r7,r7,MAS1_IPROT@h
  128. mtspr SPRN_MAS1,r7
  129. tlbwe
  130. /* 2. Invalidate all entries except the entry we're executing in */
  131. mfspr r9,SPRN_TLB1CFG
  132. andi. r9,r9,0xfff
  133. li r6,0 /* Set Entry counter to 0 */
  134. 1: lis r7,0x1000 /* Set MAS0(TLBSEL) = 1 */
  135. rlwimi r7,r6,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r6) */
  136. mtspr SPRN_MAS0,r7
  137. tlbre
  138. mfspr r7,SPRN_MAS1
  139. rlwinm r7,r7,0,2,31 /* Clear MAS1 Valid and IPROT */
  140. cmpw r3,r6
  141. beq skpinv /* Dont update the current execution TLB */
  142. mtspr SPRN_MAS1,r7
  143. tlbwe
  144. isync
  145. skpinv: addi r6,r6,1 /* Increment */
  146. cmpw r6,r9 /* Are we done? */
  147. bne 1b /* If not, repeat */
  148. /* Invalidate TLB0 */
  149. li r6,0x04
  150. tlbivax 0,r6
  151. TLBSYNC
  152. /* Invalidate TLB1 */
  153. li r6,0x0c
  154. tlbivax 0,r6
  155. TLBSYNC
  156. /* 3. Setup a temp mapping and jump to it */
  157. andi. r5, r3, 0x1 /* Find an entry not used and is non-zero */
  158. addi r5, r5, 0x1
  159. lis r7,0x1000 /* Set MAS0(TLBSEL) = 1 */
  160. rlwimi r7,r3,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r3) */
  161. mtspr SPRN_MAS0,r7
  162. tlbre
  163. /* grab and fixup the RPN */
  164. mfspr r6,SPRN_MAS1 /* extract MAS1[SIZE] */
  165. rlwinm r6,r6,25,27,31
  166. li r8,-1
  167. addi r6,r6,10
  168. slw r6,r8,r6 /* convert to mask */
  169. bl 1f /* Find our address */
  170. 1: mflr r7
  171. mfspr r8,SPRN_MAS3
  172. #ifdef CONFIG_PHYS_64BIT
  173. mfspr r23,SPRN_MAS7
  174. #endif
  175. and r8,r6,r8
  176. subfic r9,r6,-4096
  177. and r9,r9,r7
  178. or r25,r8,r9
  179. ori r8,r25,(MAS3_SX|MAS3_SW|MAS3_SR)
  180. /* Just modify the entry ID and EPN for the temp mapping */
  181. lis r7,0x1000 /* Set MAS0(TLBSEL) = 1 */
  182. rlwimi r7,r5,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r5) */
  183. mtspr SPRN_MAS0,r7
  184. xori r6,r4,1 /* Setup TMP mapping in the other Address space */
  185. slwi r6,r6,12
  186. oris r6,r6,(MAS1_VALID|MAS1_IPROT)@h
  187. ori r6,r6,(MAS1_TSIZE(BOOK3E_PAGESZ_4K))@l
  188. mtspr SPRN_MAS1,r6
  189. mfspr r6,SPRN_MAS2
  190. li r7,0 /* temp EPN = 0 */
  191. rlwimi r7,r6,0,20,31
  192. mtspr SPRN_MAS2,r7
  193. mtspr SPRN_MAS3,r8
  194. tlbwe
  195. xori r6,r4,1
  196. slwi r6,r6,5 /* setup new context with other address space */
  197. bl 1f /* Find our address */
  198. 1: mflr r9
  199. rlwimi r7,r9,0,20,31
  200. addi r7,r7,(2f - 1b)
  201. mtspr SPRN_SRR0,r7
  202. mtspr SPRN_SRR1,r6
  203. rfi
  204. 2:
  205. /* 4. Clear out PIDs & Search info */
  206. li r6,0
  207. mtspr SPRN_MAS6,r6
  208. mtspr SPRN_PID0,r6
  209. mfspr r7,SPRN_MMUCFG
  210. rlwinm r7,r7,21,28,31 /* extract MMUCFG[NPIDS] */
  211. cmpwi r7,3
  212. bne 2f /* skip if NPIDS != 3 */
  213. mtspr SPRN_PID1,r6
  214. mtspr SPRN_PID2,r6
  215. /* 5. Invalidate mapping we started in */
  216. 2:
  217. lis r7,0x1000 /* Set MAS0(TLBSEL) = 1 */
  218. rlwimi r7,r3,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r3) */
  219. mtspr SPRN_MAS0,r7
  220. tlbre
  221. mfspr r6,SPRN_MAS1
  222. rlwinm r6,r6,0,2,0 /* clear IPROT */
  223. mtspr SPRN_MAS1,r6
  224. tlbwe
  225. /* Invalidate TLB1 */
  226. li r9,0x0c
  227. tlbivax 0,r9
  228. TLBSYNC
  229. /* The mapping only needs to be cache-coherent on SMP */
  230. #ifdef CONFIG_SMP
  231. #define M_IF_SMP MAS2_M
  232. #else
  233. #define M_IF_SMP 0
  234. #endif
  235. /* 6. Setup KERNELBASE mapping in TLB1[0] */
  236. lis r6,0x1000 /* Set MAS0(TLBSEL) = TLB1(1), ESEL = 0 */
  237. mtspr SPRN_MAS0,r6
  238. lis r6,(MAS1_VALID|MAS1_IPROT)@h
  239. ori r6,r6,(MAS1_TSIZE(BOOK3E_PAGESZ_64M))@l
  240. mtspr SPRN_MAS1,r6
  241. lis r6,MAS2_VAL(PAGE_OFFSET, BOOK3E_PAGESZ_64M, M_IF_SMP)@h
  242. ori r6,r6,MAS2_VAL(PAGE_OFFSET, BOOK3E_PAGESZ_64M, M_IF_SMP)@l
  243. mtspr SPRN_MAS2,r6
  244. mtspr SPRN_MAS3,r8
  245. tlbwe
  246. /* 7. Jump to KERNELBASE mapping */
  247. lis r6,(KERNELBASE & ~0xfff)@h
  248. ori r6,r6,(KERNELBASE & ~0xfff)@l
  249. lis r7,MSR_KERNEL@h
  250. ori r7,r7,MSR_KERNEL@l
  251. bl 1f /* Find our address */
  252. 1: mflr r9
  253. rlwimi r6,r9,0,20,31
  254. addi r6,r6,(2f - 1b)
  255. add r6, r6, r25
  256. mtspr SPRN_SRR0,r6
  257. mtspr SPRN_SRR1,r7
  258. rfi /* start execution out of TLB1[0] entry */
  259. /* 8. Clear out the temp mapping */
  260. 2: lis r7,0x1000 /* Set MAS0(TLBSEL) = 1 */
  261. rlwimi r7,r5,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r5) */
  262. mtspr SPRN_MAS0,r7
  263. tlbre
  264. mfspr r8,SPRN_MAS1
  265. rlwinm r8,r8,0,2,0 /* clear IPROT */
  266. mtspr SPRN_MAS1,r8
  267. tlbwe
  268. /* Invalidate TLB1 */
  269. li r9,0x0c
  270. tlbivax 0,r9
  271. TLBSYNC
  272. /* Establish the interrupt vector offsets */
  273. SET_IVOR(0, CriticalInput);
  274. SET_IVOR(1, MachineCheck);
  275. SET_IVOR(2, DataStorage);
  276. SET_IVOR(3, InstructionStorage);
  277. SET_IVOR(4, ExternalInput);
  278. SET_IVOR(5, Alignment);
  279. SET_IVOR(6, Program);
  280. SET_IVOR(7, FloatingPointUnavailable);
  281. SET_IVOR(8, SystemCall);
  282. SET_IVOR(9, AuxillaryProcessorUnavailable);
  283. SET_IVOR(10, Decrementer);
  284. SET_IVOR(11, FixedIntervalTimer);
  285. SET_IVOR(12, WatchdogTimer);
  286. SET_IVOR(13, DataTLBError);
  287. SET_IVOR(14, InstructionTLBError);
  288. SET_IVOR(15, DebugCrit);
  289. /* Establish the interrupt vector base */
  290. lis r4,interrupt_base@h /* IVPR only uses the high 16-bits */
  291. mtspr SPRN_IVPR,r4
  292. /* Setup the defaults for TLB entries */
  293. li r2,(MAS4_TSIZED(BOOK3E_PAGESZ_4K))@l
  294. #ifdef CONFIG_E200
  295. oris r2,r2,MAS4_TLBSELD(1)@h
  296. #endif
  297. mtspr SPRN_MAS4, r2
  298. #if 0
  299. /* Enable DOZE */
  300. mfspr r2,SPRN_HID0
  301. oris r2,r2,HID0_DOZE@h
  302. mtspr SPRN_HID0, r2
  303. #endif
  304. #if !defined(CONFIG_BDI_SWITCH)
  305. /*
  306. * The Abatron BDI JTAG debugger does not tolerate others
  307. * mucking with the debug registers.
  308. */
  309. lis r2,DBCR0_IDM@h
  310. mtspr SPRN_DBCR0,r2
  311. isync
  312. /* clear any residual debug events */
  313. li r2,-1
  314. mtspr SPRN_DBSR,r2
  315. #endif
  316. #ifdef CONFIG_SMP
  317. /* Check to see if we're the second processor, and jump
  318. * to the secondary_start code if so
  319. */
  320. mfspr r24,SPRN_PIR
  321. cmpwi r24,0
  322. bne __secondary_start
  323. #endif
  324. /*
  325. * This is where the main kernel code starts.
  326. */
  327. /* ptr to current */
  328. lis r2,init_task@h
  329. ori r2,r2,init_task@l
  330. /* ptr to current thread */
  331. addi r4,r2,THREAD /* init task's THREAD */
  332. mtspr SPRN_SPRG_THREAD,r4
  333. /* stack */
  334. lis r1,init_thread_union@h
  335. ori r1,r1,init_thread_union@l
  336. li r0,0
  337. stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
  338. bl early_init
  339. #ifdef CONFIG_RELOCATABLE
  340. lis r3,kernstart_addr@ha
  341. la r3,kernstart_addr@l(r3)
  342. #ifdef CONFIG_PHYS_64BIT
  343. stw r23,0(r3)
  344. stw r25,4(r3)
  345. #else
  346. stw r25,0(r3)
  347. #endif
  348. #endif
  349. /*
  350. * Decide what sort of machine this is and initialize the MMU.
  351. */
  352. mr r3,r31
  353. mr r4,r30
  354. mr r5,r29
  355. mr r6,r28
  356. mr r7,r27
  357. bl machine_init
  358. bl MMU_init
  359. /* Setup PTE pointers for the Abatron bdiGDB */
  360. lis r6, swapper_pg_dir@h
  361. ori r6, r6, swapper_pg_dir@l
  362. lis r5, abatron_pteptrs@h
  363. ori r5, r5, abatron_pteptrs@l
  364. lis r4, KERNELBASE@h
  365. ori r4, r4, KERNELBASE@l
  366. stw r5, 0(r4) /* Save abatron_pteptrs at a fixed location */
  367. stw r6, 0(r5)
  368. /* Let's move on */
  369. lis r4,start_kernel@h
  370. ori r4,r4,start_kernel@l
  371. lis r3,MSR_KERNEL@h
  372. ori r3,r3,MSR_KERNEL@l
  373. mtspr SPRN_SRR0,r4
  374. mtspr SPRN_SRR1,r3
  375. rfi /* change context and jump to start_kernel */
  376. /* Macros to hide the PTE size differences
  377. *
  378. * FIND_PTE -- walks the page tables given EA & pgdir pointer
  379. * r10 -- EA of fault
  380. * r11 -- PGDIR pointer
  381. * r12 -- free
  382. * label 2: is the bailout case
  383. *
  384. * if we find the pte (fall through):
  385. * r11 is low pte word
  386. * r12 is pointer to the pte
  387. */
  388. #ifdef CONFIG_PTE_64BIT
  389. #define FIND_PTE \
  390. rlwinm r12, r10, 13, 19, 29; /* Compute pgdir/pmd offset */ \
  391. lwzx r11, r12, r11; /* Get pgd/pmd entry */ \
  392. rlwinm. r12, r11, 0, 0, 20; /* Extract pt base address */ \
  393. beq 2f; /* Bail if no table */ \
  394. rlwimi r12, r10, 23, 20, 28; /* Compute pte address */ \
  395. lwz r11, 4(r12); /* Get pte entry */
  396. #else
  397. #define FIND_PTE \
  398. rlwimi r11, r10, 12, 20, 29; /* Create L1 (pgdir/pmd) address */ \
  399. lwz r11, 0(r11); /* Get L1 entry */ \
  400. rlwinm. r12, r11, 0, 0, 19; /* Extract L2 (pte) base address */ \
  401. beq 2f; /* Bail if no table */ \
  402. rlwimi r12, r10, 22, 20, 29; /* Compute PTE address */ \
  403. lwz r11, 0(r12); /* Get Linux PTE */
  404. #endif
  405. /*
  406. * Interrupt vector entry code
  407. *
  408. * The Book E MMUs are always on so we don't need to handle
  409. * interrupts in real mode as with previous PPC processors. In
  410. * this case we handle interrupts in the kernel virtual address
  411. * space.
  412. *
  413. * Interrupt vectors are dynamically placed relative to the
  414. * interrupt prefix as determined by the address of interrupt_base.
  415. * The interrupt vectors offsets are programmed using the labels
  416. * for each interrupt vector entry.
  417. *
  418. * Interrupt vectors must be aligned on a 16 byte boundary.
  419. * We align on a 32 byte cache line boundary for good measure.
  420. */
  421. interrupt_base:
  422. /* Critical Input Interrupt */
  423. CRITICAL_EXCEPTION(0x0100, CriticalInput, unknown_exception)
  424. /* Machine Check Interrupt */
  425. #ifdef CONFIG_E200
  426. /* no RFMCI, MCSRRs on E200 */
  427. CRITICAL_EXCEPTION(0x0200, MachineCheck, machine_check_exception)
  428. #else
  429. MCHECK_EXCEPTION(0x0200, MachineCheck, machine_check_exception)
  430. #endif
  431. /* Data Storage Interrupt */
  432. START_EXCEPTION(DataStorage)
  433. NORMAL_EXCEPTION_PROLOG
  434. mfspr r5,SPRN_ESR /* Grab the ESR, save it, pass arg3 */
  435. stw r5,_ESR(r11)
  436. mfspr r4,SPRN_DEAR /* Grab the DEAR, save it, pass arg2 */
  437. andis. r10,r5,(ESR_ILK|ESR_DLK)@h
  438. bne 1f
  439. EXC_XFER_EE_LITE(0x0300, handle_page_fault)
  440. 1:
  441. addi r3,r1,STACK_FRAME_OVERHEAD
  442. EXC_XFER_EE_LITE(0x0300, CacheLockingException)
  443. /* Instruction Storage Interrupt */
  444. INSTRUCTION_STORAGE_EXCEPTION
  445. /* External Input Interrupt */
  446. EXCEPTION(0x0500, ExternalInput, do_IRQ, EXC_XFER_LITE)
  447. /* Alignment Interrupt */
  448. ALIGNMENT_EXCEPTION
  449. /* Program Interrupt */
  450. PROGRAM_EXCEPTION
  451. /* Floating Point Unavailable Interrupt */
  452. #ifdef CONFIG_PPC_FPU
  453. FP_UNAVAILABLE_EXCEPTION
  454. #else
  455. #ifdef CONFIG_E200
  456. /* E200 treats 'normal' floating point instructions as FP Unavail exception */
  457. EXCEPTION(0x0800, FloatingPointUnavailable, program_check_exception, EXC_XFER_EE)
  458. #else
  459. EXCEPTION(0x0800, FloatingPointUnavailable, unknown_exception, EXC_XFER_EE)
  460. #endif
  461. #endif
  462. /* System Call Interrupt */
  463. START_EXCEPTION(SystemCall)
  464. NORMAL_EXCEPTION_PROLOG
  465. EXC_XFER_EE_LITE(0x0c00, DoSyscall)
  466. /* Auxillary Processor Unavailable Interrupt */
  467. EXCEPTION(0x2900, AuxillaryProcessorUnavailable, unknown_exception, EXC_XFER_EE)
  468. /* Decrementer Interrupt */
  469. DECREMENTER_EXCEPTION
  470. /* Fixed Internal Timer Interrupt */
  471. /* TODO: Add FIT support */
  472. EXCEPTION(0x3100, FixedIntervalTimer, unknown_exception, EXC_XFER_EE)
  473. /* Watchdog Timer Interrupt */
  474. #ifdef CONFIG_BOOKE_WDT
  475. CRITICAL_EXCEPTION(0x3200, WatchdogTimer, WatchdogException)
  476. #else
  477. CRITICAL_EXCEPTION(0x3200, WatchdogTimer, unknown_exception)
  478. #endif
  479. /* Data TLB Error Interrupt */
  480. START_EXCEPTION(DataTLBError)
  481. mtspr SPRN_SPRG_WSCRATCH0, r10 /* Save some working registers */
  482. mtspr SPRN_SPRG_WSCRATCH1, r11
  483. mtspr SPRN_SPRG_WSCRATCH2, r12
  484. mtspr SPRN_SPRG_WSCRATCH3, r13
  485. mfcr r11
  486. mtspr SPRN_SPRG_WSCRATCH4, r11
  487. mfspr r10, SPRN_DEAR /* Get faulting address */
  488. /* If we are faulting a kernel address, we have to use the
  489. * kernel page tables.
  490. */
  491. lis r11, PAGE_OFFSET@h
  492. cmplw 5, r10, r11
  493. blt 5, 3f
  494. lis r11, swapper_pg_dir@h
  495. ori r11, r11, swapper_pg_dir@l
  496. mfspr r12,SPRN_MAS1 /* Set TID to 0 */
  497. rlwinm r12,r12,0,16,1
  498. mtspr SPRN_MAS1,r12
  499. b 4f
  500. /* Get the PGD for the current thread */
  501. 3:
  502. mfspr r11,SPRN_SPRG_THREAD
  503. lwz r11,PGDIR(r11)
  504. 4:
  505. /* Mask of required permission bits. Note that while we
  506. * do copy ESR:ST to _PAGE_RW position as trying to write
  507. * to an RO page is pretty common, we don't do it with
  508. * _PAGE_DIRTY. We could do it, but it's a fairly rare
  509. * event so I'd rather take the overhead when it happens
  510. * rather than adding an instruction here. We should measure
  511. * whether the whole thing is worth it in the first place
  512. * as we could avoid loading SPRN_ESR completely in the first
  513. * place...
  514. *
  515. * TODO: Is it worth doing that mfspr & rlwimi in the first
  516. * place or can we save a couple of instructions here ?
  517. */
  518. mfspr r12,SPRN_ESR
  519. #ifdef CONFIG_PTE_64BIT
  520. li r13,_PAGE_PRESENT
  521. oris r13,r13,_PAGE_ACCESSED@h
  522. #else
  523. li r13,_PAGE_PRESENT|_PAGE_ACCESSED
  524. #endif
  525. rlwimi r13,r12,11,29,29
  526. FIND_PTE
  527. andc. r13,r13,r11 /* Check permission */
  528. #ifdef CONFIG_PTE_64BIT
  529. #ifdef CONFIG_SMP
  530. subf r10,r11,r12 /* create false data dep */
  531. lwzx r13,r11,r10 /* Get upper pte bits */
  532. #else
  533. lwz r13,0(r12) /* Get upper pte bits */
  534. #endif
  535. #endif
  536. bne 2f /* Bail if permission/valid mismach */
  537. /* Jump to common tlb load */
  538. b finish_tlb_load
  539. 2:
  540. /* The bailout. Restore registers to pre-exception conditions
  541. * and call the heavyweights to help us out.
  542. */
  543. mfspr r11, SPRN_SPRG_RSCRATCH4
  544. mtcr r11
  545. mfspr r13, SPRN_SPRG_RSCRATCH3
  546. mfspr r12, SPRN_SPRG_RSCRATCH2
  547. mfspr r11, SPRN_SPRG_RSCRATCH1
  548. mfspr r10, SPRN_SPRG_RSCRATCH0
  549. b DataStorage
  550. /* Instruction TLB Error Interrupt */
  551. /*
  552. * Nearly the same as above, except we get our
  553. * information from different registers and bailout
  554. * to a different point.
  555. */
  556. START_EXCEPTION(InstructionTLBError)
  557. mtspr SPRN_SPRG_WSCRATCH0, r10 /* Save some working registers */
  558. mtspr SPRN_SPRG_WSCRATCH1, r11
  559. mtspr SPRN_SPRG_WSCRATCH2, r12
  560. mtspr SPRN_SPRG_WSCRATCH3, r13
  561. mfcr r11
  562. mtspr SPRN_SPRG_WSCRATCH4, r11
  563. mfspr r10, SPRN_SRR0 /* Get faulting address */
  564. /* If we are faulting a kernel address, we have to use the
  565. * kernel page tables.
  566. */
  567. lis r11, PAGE_OFFSET@h
  568. cmplw 5, r10, r11
  569. blt 5, 3f
  570. lis r11, swapper_pg_dir@h
  571. ori r11, r11, swapper_pg_dir@l
  572. mfspr r12,SPRN_MAS1 /* Set TID to 0 */
  573. rlwinm r12,r12,0,16,1
  574. mtspr SPRN_MAS1,r12
  575. /* Make up the required permissions for kernel code */
  576. #ifdef CONFIG_PTE_64BIT
  577. li r13,_PAGE_PRESENT | _PAGE_BAP_SX
  578. oris r13,r13,_PAGE_ACCESSED@h
  579. #else
  580. li r13,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC
  581. #endif
  582. b 4f
  583. /* Get the PGD for the current thread */
  584. 3:
  585. mfspr r11,SPRN_SPRG_THREAD
  586. lwz r11,PGDIR(r11)
  587. /* Make up the required permissions for user code */
  588. #ifdef CONFIG_PTE_64BIT
  589. li r13,_PAGE_PRESENT | _PAGE_BAP_UX
  590. oris r13,r13,_PAGE_ACCESSED@h
  591. #else
  592. li r13,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC
  593. #endif
  594. 4:
  595. FIND_PTE
  596. andc. r13,r13,r11 /* Check permission */
  597. #ifdef CONFIG_PTE_64BIT
  598. #ifdef CONFIG_SMP
  599. subf r10,r11,r12 /* create false data dep */
  600. lwzx r13,r11,r10 /* Get upper pte bits */
  601. #else
  602. lwz r13,0(r12) /* Get upper pte bits */
  603. #endif
  604. #endif
  605. bne 2f /* Bail if permission mismach */
  606. /* Jump to common TLB load point */
  607. b finish_tlb_load
  608. 2:
  609. /* The bailout. Restore registers to pre-exception conditions
  610. * and call the heavyweights to help us out.
  611. */
  612. mfspr r11, SPRN_SPRG_RSCRATCH4
  613. mtcr r11
  614. mfspr r13, SPRN_SPRG_RSCRATCH3
  615. mfspr r12, SPRN_SPRG_RSCRATCH2
  616. mfspr r11, SPRN_SPRG_RSCRATCH1
  617. mfspr r10, SPRN_SPRG_RSCRATCH0
  618. b InstructionStorage
  619. #ifdef CONFIG_SPE
  620. /* SPE Unavailable */
  621. START_EXCEPTION(SPEUnavailable)
  622. NORMAL_EXCEPTION_PROLOG
  623. bne load_up_spe
  624. addi r3,r1,STACK_FRAME_OVERHEAD
  625. EXC_XFER_EE_LITE(0x2010, KernelSPE)
  626. #else
  627. EXCEPTION(0x2020, SPEUnavailable, unknown_exception, EXC_XFER_EE)
  628. #endif /* CONFIG_SPE */
  629. /* SPE Floating Point Data */
  630. #ifdef CONFIG_SPE
  631. EXCEPTION(0x2030, SPEFloatingPointData, SPEFloatingPointException, EXC_XFER_EE);
  632. /* SPE Floating Point Round */
  633. EXCEPTION(0x2050, SPEFloatingPointRound, SPEFloatingPointRoundException, EXC_XFER_EE)
  634. #else
  635. EXCEPTION(0x2040, SPEFloatingPointData, unknown_exception, EXC_XFER_EE)
  636. EXCEPTION(0x2050, SPEFloatingPointRound, unknown_exception, EXC_XFER_EE)
  637. #endif /* CONFIG_SPE */
  638. /* Performance Monitor */
  639. EXCEPTION(0x2060, PerformanceMonitor, performance_monitor_exception, EXC_XFER_STD)
  640. EXCEPTION(0x2070, Doorbell, doorbell_exception, EXC_XFER_STD)
  641. CRITICAL_EXCEPTION(0x2080, CriticalDoorbell, unknown_exception)
  642. /* Debug Interrupt */
  643. DEBUG_DEBUG_EXCEPTION
  644. DEBUG_CRIT_EXCEPTION
  645. /*
  646. * Local functions
  647. */
  648. /*
  649. * Both the instruction and data TLB miss get to this
  650. * point to load the TLB.
  651. * r10 - available to use
  652. * r11 - TLB (info from Linux PTE)
  653. * r12 - available to use
  654. * r13 - upper bits of PTE (if PTE_64BIT) or available to use
  655. * CR5 - results of addr >= PAGE_OFFSET
  656. * MAS0, MAS1 - loaded with proper value when we get here
  657. * MAS2, MAS3 - will need additional info from Linux PTE
  658. * Upon exit, we reload everything and RFI.
  659. */
  660. finish_tlb_load:
  661. /*
  662. * We set execute, because we don't have the granularity to
  663. * properly set this at the page level (Linux problem).
  664. * Many of these bits are software only. Bits we don't set
  665. * here we (properly should) assume have the appropriate value.
  666. */
  667. mfspr r12, SPRN_MAS2
  668. #ifdef CONFIG_PTE_64BIT
  669. rlwimi r12, r11, 32-19, 27, 31 /* extract WIMGE from pte */
  670. #else
  671. rlwimi r12, r11, 26, 27, 31 /* extract WIMGE from pte */
  672. #endif
  673. mtspr SPRN_MAS2, r12
  674. #ifdef CONFIG_PTE_64BIT
  675. rlwinm r12, r11, 32-2, 26, 31 /* Move in perm bits */
  676. andi. r10, r11, _PAGE_DIRTY
  677. bne 1f
  678. li r10, MAS3_SW | MAS3_UW
  679. andc r12, r12, r10
  680. 1: rlwimi r12, r13, 20, 0, 11 /* grab RPN[32:43] */
  681. rlwimi r12, r11, 20, 12, 19 /* grab RPN[44:51] */
  682. mtspr SPRN_MAS3, r12
  683. BEGIN_MMU_FTR_SECTION
  684. srwi r10, r13, 12 /* grab RPN[12:31] */
  685. mtspr SPRN_MAS7, r10
  686. END_MMU_FTR_SECTION_IFSET(MMU_FTR_BIG_PHYS)
  687. #else
  688. li r10, (_PAGE_EXEC | _PAGE_PRESENT)
  689. rlwimi r10, r11, 31, 29, 29 /* extract _PAGE_DIRTY into SW */
  690. and r12, r11, r10
  691. andi. r10, r11, _PAGE_USER /* Test for _PAGE_USER */
  692. slwi r10, r12, 1
  693. or r10, r10, r12
  694. iseleq r12, r12, r10
  695. rlwimi r11, r12, 0, 20, 31 /* Extract RPN from PTE and merge with perms */
  696. mtspr SPRN_MAS3, r11
  697. #endif
  698. #ifdef CONFIG_E200
  699. /* Round robin TLB1 entries assignment */
  700. mfspr r12, SPRN_MAS0
  701. /* Extract TLB1CFG(NENTRY) */
  702. mfspr r11, SPRN_TLB1CFG
  703. andi. r11, r11, 0xfff
  704. /* Extract MAS0(NV) */
  705. andi. r13, r12, 0xfff
  706. addi r13, r13, 1
  707. cmpw 0, r13, r11
  708. addi r12, r12, 1
  709. /* check if we need to wrap */
  710. blt 7f
  711. /* wrap back to first free tlbcam entry */
  712. lis r13, tlbcam_index@ha
  713. lwz r13, tlbcam_index@l(r13)
  714. rlwimi r12, r13, 0, 20, 31
  715. 7:
  716. mtspr SPRN_MAS0,r12
  717. #endif /* CONFIG_E200 */
  718. tlbwe
  719. /* Done...restore registers and get out of here. */
  720. mfspr r11, SPRN_SPRG_RSCRATCH4
  721. mtcr r11
  722. mfspr r13, SPRN_SPRG_RSCRATCH3
  723. mfspr r12, SPRN_SPRG_RSCRATCH2
  724. mfspr r11, SPRN_SPRG_RSCRATCH1
  725. mfspr r10, SPRN_SPRG_RSCRATCH0
  726. rfi /* Force context change */
  727. #ifdef CONFIG_SPE
  728. /* Note that the SPE support is closely modeled after the AltiVec
  729. * support. Changes to one are likely to be applicable to the
  730. * other! */
  731. load_up_spe:
  732. /*
  733. * Disable SPE for the task which had SPE previously,
  734. * and save its SPE registers in its thread_struct.
  735. * Enables SPE for use in the kernel on return.
  736. * On SMP we know the SPE units are free, since we give it up every
  737. * switch. -- Kumar
  738. */
  739. mfmsr r5
  740. oris r5,r5,MSR_SPE@h
  741. mtmsr r5 /* enable use of SPE now */
  742. isync
  743. /*
  744. * For SMP, we don't do lazy SPE switching because it just gets too
  745. * horrendously complex, especially when a task switches from one CPU
  746. * to another. Instead we call giveup_spe in switch_to.
  747. */
  748. #ifndef CONFIG_SMP
  749. lis r3,last_task_used_spe@ha
  750. lwz r4,last_task_used_spe@l(r3)
  751. cmpi 0,r4,0
  752. beq 1f
  753. addi r4,r4,THREAD /* want THREAD of last_task_used_spe */
  754. SAVE_32EVRS(0,r10,r4)
  755. evxor evr10, evr10, evr10 /* clear out evr10 */
  756. evmwumiaa evr10, evr10, evr10 /* evr10 <- ACC = 0 * 0 + ACC */
  757. li r5,THREAD_ACC
  758. evstddx evr10, r4, r5 /* save off accumulator */
  759. lwz r5,PT_REGS(r4)
  760. lwz r4,_MSR-STACK_FRAME_OVERHEAD(r5)
  761. lis r10,MSR_SPE@h
  762. andc r4,r4,r10 /* disable SPE for previous task */
  763. stw r4,_MSR-STACK_FRAME_OVERHEAD(r5)
  764. 1:
  765. #endif /* !CONFIG_SMP */
  766. /* enable use of SPE after return */
  767. oris r9,r9,MSR_SPE@h
  768. mfspr r5,SPRN_SPRG_THREAD /* current task's THREAD (phys) */
  769. li r4,1
  770. li r10,THREAD_ACC
  771. stw r4,THREAD_USED_SPE(r5)
  772. evlddx evr4,r10,r5
  773. evmra evr4,evr4
  774. REST_32EVRS(0,r10,r5)
  775. #ifndef CONFIG_SMP
  776. subi r4,r5,THREAD
  777. stw r4,last_task_used_spe@l(r3)
  778. #endif /* !CONFIG_SMP */
  779. /* restore registers and return */
  780. 2: REST_4GPRS(3, r11)
  781. lwz r10,_CCR(r11)
  782. REST_GPR(1, r11)
  783. mtcr r10
  784. lwz r10,_LINK(r11)
  785. mtlr r10
  786. REST_GPR(10, r11)
  787. mtspr SPRN_SRR1,r9
  788. mtspr SPRN_SRR0,r12
  789. REST_GPR(9, r11)
  790. REST_GPR(12, r11)
  791. lwz r11,GPR11(r11)
  792. rfi
  793. /*
  794. * SPE unavailable trap from kernel - print a message, but let
  795. * the task use SPE in the kernel until it returns to user mode.
  796. */
  797. KernelSPE:
  798. lwz r3,_MSR(r1)
  799. oris r3,r3,MSR_SPE@h
  800. stw r3,_MSR(r1) /* enable use of SPE after return */
  801. #ifdef CONFIG_PRINTK
  802. lis r3,87f@h
  803. ori r3,r3,87f@l
  804. mr r4,r2 /* current */
  805. lwz r5,_NIP(r1)
  806. bl printk
  807. #endif
  808. b ret_from_except
  809. #ifdef CONFIG_PRINTK
  810. 87: .string "SPE used in kernel (task=%p, pc=%x) \n"
  811. #endif
  812. .align 4,0
  813. #endif /* CONFIG_SPE */
  814. /*
  815. * Global functions
  816. */
  817. /* Adjust or setup IVORs for e200 */
  818. _GLOBAL(__setup_e200_ivors)
  819. li r3,DebugDebug@l
  820. mtspr SPRN_IVOR15,r3
  821. li r3,SPEUnavailable@l
  822. mtspr SPRN_IVOR32,r3
  823. li r3,SPEFloatingPointData@l
  824. mtspr SPRN_IVOR33,r3
  825. li r3,SPEFloatingPointRound@l
  826. mtspr SPRN_IVOR34,r3
  827. sync
  828. blr
  829. /* Adjust or setup IVORs for e500v1/v2 */
  830. _GLOBAL(__setup_e500_ivors)
  831. li r3,DebugCrit@l
  832. mtspr SPRN_IVOR15,r3
  833. li r3,SPEUnavailable@l
  834. mtspr SPRN_IVOR32,r3
  835. li r3,SPEFloatingPointData@l
  836. mtspr SPRN_IVOR33,r3
  837. li r3,SPEFloatingPointRound@l
  838. mtspr SPRN_IVOR34,r3
  839. li r3,PerformanceMonitor@l
  840. mtspr SPRN_IVOR35,r3
  841. sync
  842. blr
  843. /* Adjust or setup IVORs for e500mc */
  844. _GLOBAL(__setup_e500mc_ivors)
  845. li r3,DebugDebug@l
  846. mtspr SPRN_IVOR15,r3
  847. li r3,PerformanceMonitor@l
  848. mtspr SPRN_IVOR35,r3
  849. li r3,Doorbell@l
  850. mtspr SPRN_IVOR36,r3
  851. li r3,CriticalDoorbell@l
  852. mtspr SPRN_IVOR37,r3
  853. sync
  854. blr
  855. /*
  856. * extern void giveup_altivec(struct task_struct *prev)
  857. *
  858. * The e500 core does not have an AltiVec unit.
  859. */
  860. _GLOBAL(giveup_altivec)
  861. blr
  862. #ifdef CONFIG_SPE
  863. /*
  864. * extern void giveup_spe(struct task_struct *prev)
  865. *
  866. */
  867. _GLOBAL(giveup_spe)
  868. mfmsr r5
  869. oris r5,r5,MSR_SPE@h
  870. mtmsr r5 /* enable use of SPE now */
  871. isync
  872. cmpi 0,r3,0
  873. beqlr- /* if no previous owner, done */
  874. addi r3,r3,THREAD /* want THREAD of task */
  875. lwz r5,PT_REGS(r3)
  876. cmpi 0,r5,0
  877. SAVE_32EVRS(0, r4, r3)
  878. evxor evr6, evr6, evr6 /* clear out evr6 */
  879. evmwumiaa evr6, evr6, evr6 /* evr6 <- ACC = 0 * 0 + ACC */
  880. li r4,THREAD_ACC
  881. evstddx evr6, r4, r3 /* save off accumulator */
  882. mfspr r6,SPRN_SPEFSCR
  883. stw r6,THREAD_SPEFSCR(r3) /* save spefscr register value */
  884. beq 1f
  885. lwz r4,_MSR-STACK_FRAME_OVERHEAD(r5)
  886. lis r3,MSR_SPE@h
  887. andc r4,r4,r3 /* disable SPE for previous task */
  888. stw r4,_MSR-STACK_FRAME_OVERHEAD(r5)
  889. 1:
  890. #ifndef CONFIG_SMP
  891. li r5,0
  892. lis r4,last_task_used_spe@ha
  893. stw r5,last_task_used_spe@l(r4)
  894. #endif /* !CONFIG_SMP */
  895. blr
  896. #endif /* CONFIG_SPE */
  897. /*
  898. * extern void giveup_fpu(struct task_struct *prev)
  899. *
  900. * Not all FSL Book-E cores have an FPU
  901. */
  902. #ifndef CONFIG_PPC_FPU
  903. _GLOBAL(giveup_fpu)
  904. blr
  905. #endif
  906. /*
  907. * extern void abort(void)
  908. *
  909. * At present, this routine just applies a system reset.
  910. */
  911. _GLOBAL(abort)
  912. li r13,0
  913. mtspr SPRN_DBCR0,r13 /* disable all debug events */
  914. isync
  915. mfmsr r13
  916. ori r13,r13,MSR_DE@l /* Enable Debug Events */
  917. mtmsr r13
  918. isync
  919. mfspr r13,SPRN_DBCR0
  920. lis r13,(DBCR0_IDM|DBCR0_RST_CHIP)@h
  921. mtspr SPRN_DBCR0,r13
  922. isync
  923. _GLOBAL(set_context)
  924. #ifdef CONFIG_BDI_SWITCH
  925. /* Context switch the PTE pointer for the Abatron BDI2000.
  926. * The PGDIR is the second parameter.
  927. */
  928. lis r5, abatron_pteptrs@h
  929. ori r5, r5, abatron_pteptrs@l
  930. stw r4, 0x4(r5)
  931. #endif
  932. mtspr SPRN_PID,r3
  933. isync /* Force context change */
  934. blr
  935. _GLOBAL(flush_dcache_L1)
  936. mfspr r3,SPRN_L1CFG0
  937. rlwinm r5,r3,9,3 /* Extract cache block size */
  938. twlgti r5,1 /* Only 32 and 64 byte cache blocks
  939. * are currently defined.
  940. */
  941. li r4,32
  942. subfic r6,r5,2 /* r6 = log2(1KiB / cache block size) -
  943. * log2(number of ways)
  944. */
  945. slw r5,r4,r5 /* r5 = cache block size */
  946. rlwinm r7,r3,0,0xff /* Extract number of KiB in the cache */
  947. mulli r7,r7,13 /* An 8-way cache will require 13
  948. * loads per set.
  949. */
  950. slw r7,r7,r6
  951. /* save off HID0 and set DCFA */
  952. mfspr r8,SPRN_HID0
  953. ori r9,r8,HID0_DCFA@l
  954. mtspr SPRN_HID0,r9
  955. isync
  956. lis r4,KERNELBASE@h
  957. mtctr r7
  958. 1: lwz r3,0(r4) /* Load... */
  959. add r4,r4,r5
  960. bdnz 1b
  961. msync
  962. lis r4,KERNELBASE@h
  963. mtctr r7
  964. 1: dcbf 0,r4 /* ...and flush. */
  965. add r4,r4,r5
  966. bdnz 1b
  967. /* restore HID0 */
  968. mtspr SPRN_HID0,r8
  969. isync
  970. blr
  971. #ifdef CONFIG_SMP
  972. /* When we get here, r24 needs to hold the CPU # */
  973. .globl __secondary_start
  974. __secondary_start:
  975. lis r3,__secondary_hold_acknowledge@h
  976. ori r3,r3,__secondary_hold_acknowledge@l
  977. stw r24,0(r3)
  978. li r3,0
  979. mr r4,r24 /* Why? */
  980. bl call_setup_cpu
  981. lis r3,tlbcam_index@ha
  982. lwz r3,tlbcam_index@l(r3)
  983. mtctr r3
  984. li r26,0 /* r26 safe? */
  985. /* Load each CAM entry */
  986. 1: mr r3,r26
  987. bl loadcam_entry
  988. addi r26,r26,1
  989. bdnz 1b
  990. /* get current_thread_info and current */
  991. lis r1,secondary_ti@ha
  992. lwz r1,secondary_ti@l(r1)
  993. lwz r2,TI_TASK(r1)
  994. /* stack */
  995. addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
  996. li r0,0
  997. stw r0,0(r1)
  998. /* ptr to current thread */
  999. addi r4,r2,THREAD /* address of our thread_struct */
  1000. mtspr SPRN_SPRG_THREAD,r4
  1001. /* Setup the defaults for TLB entries */
  1002. li r4,(MAS4_TSIZED(BOOK3E_PAGESZ_4K))@l
  1003. mtspr SPRN_MAS4,r4
  1004. /* Jump to start_secondary */
  1005. lis r4,MSR_KERNEL@h
  1006. ori r4,r4,MSR_KERNEL@l
  1007. lis r3,start_secondary@h
  1008. ori r3,r3,start_secondary@l
  1009. mtspr SPRN_SRR0,r3
  1010. mtspr SPRN_SRR1,r4
  1011. sync
  1012. rfi
  1013. sync
  1014. .globl __secondary_hold_acknowledge
  1015. __secondary_hold_acknowledge:
  1016. .long -1
  1017. #endif
  1018. /*
  1019. * We put a few things here that have to be page-aligned. This stuff
  1020. * goes at the beginning of the data segment, which is page-aligned.
  1021. */
  1022. .data
  1023. .align 12
  1024. .globl sdata
  1025. sdata:
  1026. .globl empty_zero_page
  1027. empty_zero_page:
  1028. .space 4096
  1029. .globl swapper_pg_dir
  1030. swapper_pg_dir:
  1031. .space PGD_TABLE_SIZE
  1032. /*
  1033. * Room for two PTE pointers, usually the kernel and current user pointers
  1034. * to their respective root page table.
  1035. */
  1036. abatron_pteptrs:
  1037. .space 8