head_8xx.S 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012
  1. /*
  2. * PowerPC version
  3. * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
  4. * Rewritten by Cort Dougan (cort@cs.nmt.edu) for PReP
  5. * Copyright (C) 1996 Cort Dougan <cort@cs.nmt.edu>
  6. * Low-level exception handlers and MMU support
  7. * rewritten by Paul Mackerras.
  8. * Copyright (C) 1996 Paul Mackerras.
  9. * MPC8xx modifications by Dan Malek
  10. * Copyright (C) 1997 Dan Malek (dmalek@jlc.net).
  11. *
  12. * This file contains low-level support and setup for PowerPC 8xx
  13. * embedded processors, including trap and interrupt dispatch.
  14. *
  15. * This program is free software; you can redistribute it and/or
  16. * modify it under the terms of the GNU General Public License
  17. * as published by the Free Software Foundation; either version
  18. * 2 of the License, or (at your option) any later version.
  19. *
  20. */
  21. #include <linux/init.h>
  22. #include <asm/processor.h>
  23. #include <asm/page.h>
  24. #include <asm/mmu.h>
  25. #include <asm/cache.h>
  26. #include <asm/pgtable.h>
  27. #include <asm/cputable.h>
  28. #include <asm/thread_info.h>
  29. #include <asm/ppc_asm.h>
  30. #include <asm/asm-offsets.h>
  31. #include <asm/ptrace.h>
  32. #include <asm/fixmap.h>
  33. #include <asm/export.h>
  34. /* Macro to make the code more readable. */
  35. #ifdef CONFIG_8xx_CPU6
  36. #define SPRN_MI_TWC_ADDR 0x2b80
  37. #define SPRN_MI_RPN_ADDR 0x2d80
  38. #define SPRN_MD_TWC_ADDR 0x3b80
  39. #define SPRN_MD_RPN_ADDR 0x3d80
  40. #define MTSPR_CPU6(spr, reg, treg) \
  41. li treg, spr##_ADDR; \
  42. stw treg, 12(r0); \
  43. lwz treg, 12(r0); \
  44. mtspr spr, reg
  45. #else
  46. #define MTSPR_CPU6(spr, reg, treg) \
  47. mtspr spr, reg
  48. #endif
  49. /* Macro to test if an address is a kernel address */
  50. #if CONFIG_TASK_SIZE <= 0x80000000 && CONFIG_PAGE_OFFSET >= 0x80000000
  51. #define IS_KERNEL(tmp, addr) \
  52. andis. tmp, addr, 0x8000 /* Address >= 0x80000000 */
  53. #define BRANCH_UNLESS_KERNEL(label) beq label
  54. #else
  55. #define IS_KERNEL(tmp, addr) \
  56. rlwinm tmp, addr, 16, 16, 31; \
  57. cmpli cr0, tmp, PAGE_OFFSET >> 16
  58. #define BRANCH_UNLESS_KERNEL(label) blt label
  59. #endif
  60. /*
  61. * Value for the bits that have fixed value in RPN entries.
  62. * Also used for tagging DAR for DTLBerror.
  63. */
  64. #ifdef CONFIG_PPC_16K_PAGES
  65. #define RPN_PATTERN (0x00f0 | MD_SPS16K)
  66. #else
  67. #define RPN_PATTERN 0x00f0
  68. #endif
  69. #define PAGE_SHIFT_512K 19
  70. #define PAGE_SHIFT_8M 23
  71. __HEAD
  72. _ENTRY(_stext);
  73. _ENTRY(_start);
  74. /* MPC8xx
  75. * This port was done on an MBX board with an 860. Right now I only
  76. * support an ELF compressed (zImage) boot from EPPC-Bug because the
  77. * code there loads up some registers before calling us:
  78. * r3: ptr to board info data
  79. * r4: initrd_start or if no initrd then 0
  80. * r5: initrd_end - unused if r4 is 0
  81. * r6: Start of command line string
  82. * r7: End of command line string
  83. *
  84. * I decided to use conditional compilation instead of checking PVR and
  85. * adding more processor specific branches around code I don't need.
  86. * Since this is an embedded processor, I also appreciate any memory
  87. * savings I can get.
  88. *
  89. * The MPC8xx does not have any BATs, but it supports large page sizes.
  90. * We first initialize the MMU to support 8M byte pages, then load one
  91. * entry into each of the instruction and data TLBs to map the first
  92. * 8M 1:1. I also mapped an additional I/O space 1:1 so we can get to
  93. * the "internal" processor registers before MMU_init is called.
  94. *
  95. * -- Dan
  96. */
  97. .globl __start
  98. __start:
  99. mr r31,r3 /* save device tree ptr */
  100. /* We have to turn on the MMU right away so we get cache modes
  101. * set correctly.
  102. */
  103. bl initial_mmu
  104. /* We now have the lower 8 Meg mapped into TLB entries, and the caches
  105. * ready to work.
  106. */
  107. turn_on_mmu:
  108. mfmsr r0
  109. ori r0,r0,MSR_DR|MSR_IR
  110. mtspr SPRN_SRR1,r0
  111. lis r0,start_here@h
  112. ori r0,r0,start_here@l
  113. mtspr SPRN_SRR0,r0
  114. SYNC
  115. rfi /* enables MMU */
  116. /*
  117. * Exception entry code. This code runs with address translation
  118. * turned off, i.e. using physical addresses.
  119. * We assume sprg3 has the physical address of the current
  120. * task's thread_struct.
  121. */
  122. #define EXCEPTION_PROLOG \
  123. EXCEPTION_PROLOG_0; \
  124. mfcr r10; \
  125. EXCEPTION_PROLOG_1; \
  126. EXCEPTION_PROLOG_2
  127. #define EXCEPTION_PROLOG_0 \
  128. mtspr SPRN_SPRG_SCRATCH0,r10; \
  129. mtspr SPRN_SPRG_SCRATCH1,r11
  130. #define EXCEPTION_PROLOG_1 \
  131. mfspr r11,SPRN_SRR1; /* check whether user or kernel */ \
  132. andi. r11,r11,MSR_PR; \
  133. tophys(r11,r1); /* use tophys(r1) if kernel */ \
  134. beq 1f; \
  135. mfspr r11,SPRN_SPRG_THREAD; \
  136. lwz r11,THREAD_INFO-THREAD(r11); \
  137. addi r11,r11,THREAD_SIZE; \
  138. tophys(r11,r11); \
  139. 1: subi r11,r11,INT_FRAME_SIZE /* alloc exc. frame */
  140. #define EXCEPTION_PROLOG_2 \
  141. stw r10,_CCR(r11); /* save registers */ \
  142. stw r12,GPR12(r11); \
  143. stw r9,GPR9(r11); \
  144. mfspr r10,SPRN_SPRG_SCRATCH0; \
  145. stw r10,GPR10(r11); \
  146. mfspr r12,SPRN_SPRG_SCRATCH1; \
  147. stw r12,GPR11(r11); \
  148. mflr r10; \
  149. stw r10,_LINK(r11); \
  150. mfspr r12,SPRN_SRR0; \
  151. mfspr r9,SPRN_SRR1; \
  152. stw r1,GPR1(r11); \
  153. stw r1,0(r11); \
  154. tovirt(r1,r11); /* set new kernel sp */ \
  155. li r10,MSR_KERNEL & ~(MSR_IR|MSR_DR); /* can take exceptions */ \
  156. MTMSRD(r10); /* (except for mach check in rtas) */ \
  157. stw r0,GPR0(r11); \
  158. SAVE_4GPRS(3, r11); \
  159. SAVE_2GPRS(7, r11)
  160. /*
  161. * Exception exit code.
  162. */
  163. #define EXCEPTION_EPILOG_0 \
  164. mfspr r10,SPRN_SPRG_SCRATCH0; \
  165. mfspr r11,SPRN_SPRG_SCRATCH1
  166. /*
  167. * Note: code which follows this uses cr0.eq (set if from kernel),
  168. * r11, r12 (SRR0), and r9 (SRR1).
  169. *
  170. * Note2: once we have set r1 we are in a position to take exceptions
  171. * again, and we could thus set MSR:RI at that point.
  172. */
  173. /*
  174. * Exception vectors.
  175. */
  176. #define EXCEPTION(n, label, hdlr, xfer) \
  177. . = n; \
  178. label: \
  179. EXCEPTION_PROLOG; \
  180. addi r3,r1,STACK_FRAME_OVERHEAD; \
  181. xfer(n, hdlr)
  182. #define EXC_XFER_TEMPLATE(n, hdlr, trap, copyee, tfer, ret) \
  183. li r10,trap; \
  184. stw r10,_TRAP(r11); \
  185. li r10,MSR_KERNEL; \
  186. copyee(r10, r9); \
  187. bl tfer; \
  188. i##n: \
  189. .long hdlr; \
  190. .long ret
  191. #define COPY_EE(d, s) rlwimi d,s,0,16,16
  192. #define NOCOPY(d, s)
  193. #define EXC_XFER_STD(n, hdlr) \
  194. EXC_XFER_TEMPLATE(n, hdlr, n, NOCOPY, transfer_to_handler_full, \
  195. ret_from_except_full)
  196. #define EXC_XFER_LITE(n, hdlr) \
  197. EXC_XFER_TEMPLATE(n, hdlr, n+1, NOCOPY, transfer_to_handler, \
  198. ret_from_except)
  199. #define EXC_XFER_EE(n, hdlr) \
  200. EXC_XFER_TEMPLATE(n, hdlr, n, COPY_EE, transfer_to_handler_full, \
  201. ret_from_except_full)
  202. #define EXC_XFER_EE_LITE(n, hdlr) \
  203. EXC_XFER_TEMPLATE(n, hdlr, n+1, COPY_EE, transfer_to_handler, \
  204. ret_from_except)
  205. /* System reset */
  206. EXCEPTION(0x100, Reset, system_reset_exception, EXC_XFER_STD)
  207. /* Machine check */
  208. . = 0x200
  209. MachineCheck:
  210. EXCEPTION_PROLOG
  211. mfspr r4,SPRN_DAR
  212. stw r4,_DAR(r11)
  213. li r5,RPN_PATTERN
  214. mtspr SPRN_DAR,r5 /* Tag DAR, to be used in DTLB Error */
  215. mfspr r5,SPRN_DSISR
  216. stw r5,_DSISR(r11)
  217. addi r3,r1,STACK_FRAME_OVERHEAD
  218. EXC_XFER_STD(0x200, machine_check_exception)
  219. /* Data access exception.
  220. * This is "never generated" by the MPC8xx.
  221. */
  222. . = 0x300
  223. DataAccess:
  224. /* Instruction access exception.
  225. * This is "never generated" by the MPC8xx.
  226. */
  227. . = 0x400
  228. InstructionAccess:
  229. /* External interrupt */
  230. EXCEPTION(0x500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
  231. /* Alignment exception */
  232. . = 0x600
  233. Alignment:
  234. EXCEPTION_PROLOG
  235. mfspr r4,SPRN_DAR
  236. stw r4,_DAR(r11)
  237. li r5,RPN_PATTERN
  238. mtspr SPRN_DAR,r5 /* Tag DAR, to be used in DTLB Error */
  239. mfspr r5,SPRN_DSISR
  240. stw r5,_DSISR(r11)
  241. addi r3,r1,STACK_FRAME_OVERHEAD
  242. EXC_XFER_EE(0x600, alignment_exception)
  243. /* Program check exception */
  244. EXCEPTION(0x700, ProgramCheck, program_check_exception, EXC_XFER_STD)
  245. /* No FPU on MPC8xx. This exception is not supposed to happen.
  246. */
  247. EXCEPTION(0x800, FPUnavailable, unknown_exception, EXC_XFER_STD)
  248. /* Decrementer */
  249. EXCEPTION(0x900, Decrementer, timer_interrupt, EXC_XFER_LITE)
  250. EXCEPTION(0xa00, Trap_0a, unknown_exception, EXC_XFER_EE)
  251. EXCEPTION(0xb00, Trap_0b, unknown_exception, EXC_XFER_EE)
  252. /* System call */
  253. . = 0xc00
  254. SystemCall:
  255. EXCEPTION_PROLOG
  256. EXC_XFER_EE_LITE(0xc00, DoSyscall)
  257. /* Single step - not used on 601 */
  258. EXCEPTION(0xd00, SingleStep, single_step_exception, EXC_XFER_STD)
  259. EXCEPTION(0xe00, Trap_0e, unknown_exception, EXC_XFER_EE)
  260. EXCEPTION(0xf00, Trap_0f, unknown_exception, EXC_XFER_EE)
  261. /* On the MPC8xx, this is a software emulation interrupt. It occurs
  262. * for all unimplemented and illegal instructions.
  263. */
  264. EXCEPTION(0x1000, SoftEmu, SoftwareEmulation, EXC_XFER_STD)
  265. . = 0x1100
  266. /*
  267. * For the MPC8xx, this is a software tablewalk to load the instruction
  268. * TLB. The task switch loads the M_TW register with the pointer to the first
  269. * level table.
  270. * If we discover there is no second level table (value is zero) or if there
  271. * is an invalid pte, we load that into the TLB, which causes another fault
  272. * into the TLB Error interrupt where we can handle such problems.
  273. * We have to use the MD_xxx registers for the tablewalk because the
  274. * equivalent MI_xxx registers only perform the attribute functions.
  275. */
  276. #ifdef CONFIG_8xx_CPU15
  277. #define INVALIDATE_ADJACENT_PAGES_CPU15(tmp, addr) \
  278. addi tmp, addr, PAGE_SIZE; \
  279. tlbie tmp; \
  280. addi tmp, addr, -PAGE_SIZE; \
  281. tlbie tmp
  282. #else
  283. #define INVALIDATE_ADJACENT_PAGES_CPU15(tmp, addr)
  284. #endif
  285. InstructionTLBMiss:
  286. #if defined(CONFIG_8xx_CPU6) || defined(CONFIG_MODULES) || defined (CONFIG_DEBUG_PAGEALLOC) || defined (CONFIG_HUGETLB_PAGE)
  287. mtspr SPRN_SPRG_SCRATCH2, r3
  288. #endif
  289. EXCEPTION_PROLOG_0
  290. /* If we are faulting a kernel address, we have to use the
  291. * kernel page tables.
  292. */
  293. mfspr r10, SPRN_SRR0 /* Get effective address of fault */
  294. INVALIDATE_ADJACENT_PAGES_CPU15(r11, r10)
  295. /* Only modules will cause ITLB Misses as we always
  296. * pin the first 8MB of kernel memory */
  297. #if defined(CONFIG_MODULES) || defined (CONFIG_DEBUG_PAGEALLOC) || defined (CONFIG_HUGETLB_PAGE)
  298. mfcr r3
  299. #endif
  300. #if defined(CONFIG_MODULES) || defined (CONFIG_DEBUG_PAGEALLOC)
  301. IS_KERNEL(r11, r10)
  302. #endif
  303. mfspr r11, SPRN_M_TW /* Get level 1 table */
  304. #if defined(CONFIG_MODULES) || defined (CONFIG_DEBUG_PAGEALLOC)
  305. BRANCH_UNLESS_KERNEL(3f)
  306. lis r11, (swapper_pg_dir-PAGE_OFFSET)@ha
  307. 3:
  308. #endif
  309. /* Insert level 1 index */
  310. rlwimi r11, r10, 32 - ((PAGE_SHIFT - 2) << 1), (PAGE_SHIFT - 2) << 1, 29
  311. lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r11) /* Get the level 1 entry */
  312. /* Extract level 2 index */
  313. rlwinm r10, r10, 32 - (PAGE_SHIFT - 2), 32 - PAGE_SHIFT, 29
  314. #ifdef CONFIG_HUGETLB_PAGE
  315. mtcr r11
  316. bt- 28, 10f /* bit 28 = Large page (8M) */
  317. bt- 29, 20f /* bit 29 = Large page (8M or 512k) */
  318. #endif
  319. rlwimi r10, r11, 0, 0, 32 - PAGE_SHIFT - 1 /* Add level 2 base */
  320. lwz r10, 0(r10) /* Get the pte */
  321. 4:
  322. #if defined(CONFIG_MODULES) || defined (CONFIG_DEBUG_PAGEALLOC) || defined (CONFIG_HUGETLB_PAGE)
  323. mtcr r3
  324. #endif
  325. /* Insert the APG into the TWC from the Linux PTE. */
  326. rlwimi r11, r10, 0, 25, 26
  327. /* Load the MI_TWC with the attributes for this "segment." */
  328. MTSPR_CPU6(SPRN_MI_TWC, r11, r3) /* Set segment attributes */
  329. #if defined (CONFIG_HUGETLB_PAGE) && defined (CONFIG_PPC_4K_PAGES)
  330. rlwimi r10, r11, 1, MI_SPS16K
  331. #endif
  332. #ifdef CONFIG_SWAP
  333. rlwinm r11, r10, 32-5, _PAGE_PRESENT
  334. and r11, r11, r10
  335. rlwimi r10, r11, 0, _PAGE_PRESENT
  336. #endif
  337. li r11, RPN_PATTERN
  338. /* The Linux PTE won't go exactly into the MMU TLB.
  339. * Software indicator bits 20-23 and 28 must be clear.
  340. * Software indicator bits 24, 25, 26, and 27 must be
  341. * set. All other Linux PTE bits control the behavior
  342. * of the MMU.
  343. */
  344. #if defined (CONFIG_HUGETLB_PAGE) && defined (CONFIG_PPC_4K_PAGES)
  345. rlwimi r10, r11, 0, 0x0ff0 /* Set 24-27, clear 20-23 */
  346. #else
  347. rlwimi r10, r11, 0, 0x0ff8 /* Set 24-27, clear 20-23,28 */
  348. #endif
  349. MTSPR_CPU6(SPRN_MI_RPN, r10, r3) /* Update TLB entry */
  350. /* Restore registers */
  351. #if defined(CONFIG_8xx_CPU6) || defined(CONFIG_MODULES) || defined (CONFIG_DEBUG_PAGEALLOC) || defined (CONFIG_HUGETLB_PAGE)
  352. mfspr r3, SPRN_SPRG_SCRATCH2
  353. #endif
  354. EXCEPTION_EPILOG_0
  355. rfi
  356. #ifdef CONFIG_HUGETLB_PAGE
  357. 10: /* 8M pages */
  358. #ifdef CONFIG_PPC_16K_PAGES
  359. /* Extract level 2 index */
  360. rlwinm r10, r10, 32 - (PAGE_SHIFT_8M - PAGE_SHIFT), 32 + PAGE_SHIFT_8M - (PAGE_SHIFT << 1), 29
  361. /* Add level 2 base */
  362. rlwimi r10, r11, 0, 0, 32 + PAGE_SHIFT_8M - (PAGE_SHIFT << 1) - 1
  363. #else
  364. /* Level 2 base */
  365. rlwinm r10, r11, 0, ~HUGEPD_SHIFT_MASK
  366. #endif
  367. lwz r10, 0(r10) /* Get the pte */
  368. rlwinm r11, r11, 0, 0xf
  369. b 4b
  370. 20: /* 512k pages */
  371. /* Extract level 2 index */
  372. rlwinm r10, r10, 32 - (PAGE_SHIFT_512K - PAGE_SHIFT), 32 + PAGE_SHIFT_512K - (PAGE_SHIFT << 1), 29
  373. /* Add level 2 base */
  374. rlwimi r10, r11, 0, 0, 32 + PAGE_SHIFT_512K - (PAGE_SHIFT << 1) - 1
  375. lwz r10, 0(r10) /* Get the pte */
  376. rlwinm r11, r11, 0, 0xf
  377. b 4b
  378. #endif
  379. . = 0x1200
  380. DataStoreTLBMiss:
  381. mtspr SPRN_SPRG_SCRATCH2, r3
  382. EXCEPTION_PROLOG_0
  383. mfcr r3
  384. /* If we are faulting a kernel address, we have to use the
  385. * kernel page tables.
  386. */
  387. mfspr r10, SPRN_MD_EPN
  388. rlwinm r10, r10, 16, 0xfff8
  389. cmpli cr0, r10, PAGE_OFFSET@h
  390. mfspr r11, SPRN_M_TW /* Get level 1 table */
  391. blt+ 3f
  392. #ifndef CONFIG_PIN_TLB_IMMR
  393. cmpli cr0, r10, VIRT_IMMR_BASE@h
  394. #endif
  395. _ENTRY(DTLBMiss_cmp)
  396. cmpli cr7, r10, (PAGE_OFFSET + 0x1800000)@h
  397. lis r11, (swapper_pg_dir-PAGE_OFFSET)@ha
  398. #ifndef CONFIG_PIN_TLB_IMMR
  399. _ENTRY(DTLBMiss_jmp)
  400. beq- DTLBMissIMMR
  401. #endif
  402. blt cr7, DTLBMissLinear
  403. 3:
  404. mfspr r10, SPRN_MD_EPN
  405. /* Insert level 1 index */
  406. rlwimi r11, r10, 32 - ((PAGE_SHIFT - 2) << 1), (PAGE_SHIFT - 2) << 1, 29
  407. lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r11) /* Get the level 1 entry */
  408. /* We have a pte table, so load fetch the pte from the table.
  409. */
  410. /* Extract level 2 index */
  411. rlwinm r10, r10, 32 - (PAGE_SHIFT - 2), 32 - PAGE_SHIFT, 29
  412. #ifdef CONFIG_HUGETLB_PAGE
  413. mtcr r11
  414. bt- 28, 10f /* bit 28 = Large page (8M) */
  415. bt- 29, 20f /* bit 29 = Large page (8M or 512k) */
  416. #endif
  417. rlwimi r10, r11, 0, 0, 32 - PAGE_SHIFT - 1 /* Add level 2 base */
  418. lwz r10, 0(r10) /* Get the pte */
  419. 4:
  420. mtcr r3
  421. /* Insert the Guarded flag and APG into the TWC from the Linux PTE.
  422. * It is bit 26-27 of both the Linux PTE and the TWC (at least
  423. * I got that right :-). It will be better when we can put
  424. * this into the Linux pgd/pmd and load it in the operation
  425. * above.
  426. */
  427. rlwimi r11, r10, 0, 26, 27
  428. /* Insert the WriteThru flag into the TWC from the Linux PTE.
  429. * It is bit 25 in the Linux PTE and bit 30 in the TWC
  430. */
  431. rlwimi r11, r10, 32-5, 30, 30
  432. MTSPR_CPU6(SPRN_MD_TWC, r11, r3)
  433. /* In 4k pages mode, SPS (bit 28) in RPN must match PS[1] (bit 29)
  434. * In 16k pages mode, SPS is always 1 */
  435. #if defined (CONFIG_HUGETLB_PAGE) && defined (CONFIG_PPC_4K_PAGES)
  436. rlwimi r10, r11, 1, MD_SPS16K
  437. #endif
  438. /* Both _PAGE_ACCESSED and _PAGE_PRESENT has to be set.
  439. * We also need to know if the insn is a load/store, so:
  440. * Clear _PAGE_PRESENT and load that which will
  441. * trap into DTLB Error with store bit set accordinly.
  442. */
  443. /* PRESENT=0x1, ACCESSED=0x20
  444. * r11 = ((r10 & PRESENT) & ((r10 & ACCESSED) >> 5));
  445. * r10 = (r10 & ~PRESENT) | r11;
  446. */
  447. #ifdef CONFIG_SWAP
  448. rlwinm r11, r10, 32-5, _PAGE_PRESENT
  449. and r11, r11, r10
  450. rlwimi r10, r11, 0, _PAGE_PRESENT
  451. #endif
  452. /* The Linux PTE won't go exactly into the MMU TLB.
  453. * Software indicator bits 22 and 28 must be clear.
  454. * Software indicator bits 24, 25, 26, and 27 must be
  455. * set. All other Linux PTE bits control the behavior
  456. * of the MMU.
  457. */
  458. li r11, RPN_PATTERN
  459. #if defined (CONFIG_HUGETLB_PAGE) && defined (CONFIG_PPC_4K_PAGES)
  460. rlwimi r10, r11, 0, 24, 27 /* Set 24-27 */
  461. #else
  462. rlwimi r10, r11, 0, 24, 28 /* Set 24-27, clear 28 */
  463. #endif
  464. rlwimi r10, r11, 0, 20, 20 /* clear 20 */
  465. MTSPR_CPU6(SPRN_MD_RPN, r10, r3) /* Update TLB entry */
  466. /* Restore registers */
  467. mfspr r3, SPRN_SPRG_SCRATCH2
  468. mtspr SPRN_DAR, r11 /* Tag DAR */
  469. EXCEPTION_EPILOG_0
  470. rfi
  471. #ifdef CONFIG_HUGETLB_PAGE
  472. 10: /* 8M pages */
  473. /* Extract level 2 index */
  474. #ifdef CONFIG_PPC_16K_PAGES
  475. rlwinm r10, r10, 32 - (PAGE_SHIFT_8M - PAGE_SHIFT), 32 + PAGE_SHIFT_8M - (PAGE_SHIFT << 1), 29
  476. /* Add level 2 base */
  477. rlwimi r10, r11, 0, 0, 32 + PAGE_SHIFT_8M - (PAGE_SHIFT << 1) - 1
  478. #else
  479. /* Level 2 base */
  480. rlwinm r10, r11, 0, ~HUGEPD_SHIFT_MASK
  481. #endif
  482. lwz r10, 0(r10) /* Get the pte */
  483. rlwinm r11, r11, 0, 0xf
  484. b 4b
  485. 20: /* 512k pages */
  486. /* Extract level 2 index */
  487. rlwinm r10, r10, 32 - (PAGE_SHIFT_512K - PAGE_SHIFT), 32 + PAGE_SHIFT_512K - (PAGE_SHIFT << 1), 29
  488. /* Add level 2 base */
  489. rlwimi r10, r11, 0, 0, 32 + PAGE_SHIFT_512K - (PAGE_SHIFT << 1) - 1
  490. lwz r10, 0(r10) /* Get the pte */
  491. rlwinm r11, r11, 0, 0xf
  492. b 4b
  493. #endif
  494. /* This is an instruction TLB error on the MPC8xx. This could be due
  495. * to many reasons, such as executing guarded memory or illegal instruction
  496. * addresses. There is nothing to do but handle a big time error fault.
  497. */
  498. . = 0x1300
  499. InstructionTLBError:
  500. EXCEPTION_PROLOG
  501. mr r4,r12
  502. mr r5,r9
  503. andis. r10,r5,0x4000
  504. beq+ 1f
  505. tlbie r4
  506. /* 0x400 is InstructionAccess exception, needed by bad_page_fault() */
  507. 1: EXC_XFER_LITE(0x400, handle_page_fault)
  508. /* This is the data TLB error on the MPC8xx. This could be due to
  509. * many reasons, including a dirty update to a pte. We bail out to
  510. * a higher level function that can handle it.
  511. */
  512. . = 0x1400
  513. DataTLBError:
  514. EXCEPTION_PROLOG_0
  515. mfcr r10
  516. mfspr r11, SPRN_DAR
  517. cmpwi cr0, r11, RPN_PATTERN
  518. beq- FixupDAR /* must be a buggy dcbX, icbi insn. */
  519. DARFixed:/* Return from dcbx instruction bug workaround */
  520. EXCEPTION_PROLOG_1
  521. EXCEPTION_PROLOG_2
  522. mfspr r5,SPRN_DSISR
  523. stw r5,_DSISR(r11)
  524. mfspr r4,SPRN_DAR
  525. andis. r10,r5,0x4000
  526. beq+ 1f
  527. tlbie r4
  528. 1: li r10,RPN_PATTERN
  529. mtspr SPRN_DAR,r10 /* Tag DAR, to be used in DTLB Error */
  530. /* 0x300 is DataAccess exception, needed by bad_page_fault() */
  531. EXC_XFER_LITE(0x300, handle_page_fault)
  532. EXCEPTION(0x1500, Trap_15, unknown_exception, EXC_XFER_EE)
  533. EXCEPTION(0x1600, Trap_16, unknown_exception, EXC_XFER_EE)
  534. EXCEPTION(0x1700, Trap_17, unknown_exception, EXC_XFER_EE)
  535. EXCEPTION(0x1800, Trap_18, unknown_exception, EXC_XFER_EE)
  536. EXCEPTION(0x1900, Trap_19, unknown_exception, EXC_XFER_EE)
  537. EXCEPTION(0x1a00, Trap_1a, unknown_exception, EXC_XFER_EE)
  538. EXCEPTION(0x1b00, Trap_1b, unknown_exception, EXC_XFER_EE)
  539. /* On the MPC8xx, these next four traps are used for development
  540. * support of breakpoints and such. Someday I will get around to
  541. * using them.
  542. */
  543. EXCEPTION(0x1c00, Trap_1c, unknown_exception, EXC_XFER_EE)
  544. EXCEPTION(0x1d00, Trap_1d, unknown_exception, EXC_XFER_EE)
  545. EXCEPTION(0x1e00, Trap_1e, unknown_exception, EXC_XFER_EE)
  546. EXCEPTION(0x1f00, Trap_1f, unknown_exception, EXC_XFER_EE)
  547. . = 0x2000
  548. /*
  549. * Bottom part of DataStoreTLBMiss handlers for IMMR area and linear RAM.
  550. * not enough space in the DataStoreTLBMiss area.
  551. */
  552. DTLBMissIMMR:
  553. mtcr r3
  554. /* Set 512k byte guarded page and mark it valid */
  555. li r10, MD_PS512K | MD_GUARDED | MD_SVALID
  556. MTSPR_CPU6(SPRN_MD_TWC, r10, r11)
  557. mfspr r10, SPRN_IMMR /* Get current IMMR */
  558. rlwinm r10, r10, 0, 0xfff80000 /* Get 512 kbytes boundary */
  559. ori r10, r10, 0xf0 | MD_SPS16K | _PAGE_SHARED | _PAGE_DIRTY | \
  560. _PAGE_PRESENT | _PAGE_NO_CACHE
  561. MTSPR_CPU6(SPRN_MD_RPN, r10, r11) /* Update TLB entry */
  562. li r11, RPN_PATTERN
  563. mtspr SPRN_DAR, r11 /* Tag DAR */
  564. mfspr r3, SPRN_SPRG_SCRATCH2
  565. EXCEPTION_EPILOG_0
  566. rfi
  567. DTLBMissLinear:
  568. mtcr r3
  569. /* Set 8M byte page and mark it valid */
  570. li r11, MD_PS8MEG | MD_SVALID
  571. MTSPR_CPU6(SPRN_MD_TWC, r11, r3)
  572. rlwinm r10, r10, 16, 0x0f800000 /* 8xx supports max 256Mb RAM */
  573. ori r10, r10, 0xf0 | MD_SPS16K | _PAGE_SHARED | _PAGE_DIRTY | \
  574. _PAGE_PRESENT
  575. MTSPR_CPU6(SPRN_MD_RPN, r10, r11) /* Update TLB entry */
  576. li r11, RPN_PATTERN
  577. mtspr SPRN_DAR, r11 /* Tag DAR */
  578. mfspr r3, SPRN_SPRG_SCRATCH2
  579. EXCEPTION_EPILOG_0
  580. rfi
  581. /* This is the procedure to calculate the data EA for buggy dcbx,dcbi instructions
  582. * by decoding the registers used by the dcbx instruction and adding them.
  583. * DAR is set to the calculated address.
  584. */
  585. /* define if you don't want to use self modifying code */
  586. #define NO_SELF_MODIFYING_CODE
  587. FixupDAR:/* Entry point for dcbx workaround. */
  588. mtspr SPRN_SPRG_SCRATCH2, r10
  589. /* fetch instruction from memory. */
  590. mfspr r10, SPRN_SRR0
  591. IS_KERNEL(r11, r10)
  592. mfspr r11, SPRN_M_TW /* Get level 1 table */
  593. BRANCH_UNLESS_KERNEL(3f)
  594. rlwinm r11, r10, 16, 0xfff8
  595. _ENTRY(FixupDAR_cmp)
  596. cmpli cr7, r11, (PAGE_OFFSET + 0x1800000)@h
  597. /* create physical page address from effective address */
  598. tophys(r11, r10)
  599. blt- cr7, 201f
  600. lis r11, (swapper_pg_dir-PAGE_OFFSET)@ha
  601. /* Insert level 1 index */
  602. 3: rlwimi r11, r10, 32 - ((PAGE_SHIFT - 2) << 1), (PAGE_SHIFT - 2) << 1, 29
  603. lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r11) /* Get the level 1 entry */
  604. mtcr r11
  605. bt 28,200f /* bit 28 = Large page (8M) */
  606. bt 29,202f /* bit 29 = Large page (8M or 512K) */
  607. rlwinm r11, r11,0,0,19 /* Extract page descriptor page address */
  608. /* Insert level 2 index */
  609. rlwimi r11, r10, 32 - (PAGE_SHIFT - 2), 32 - PAGE_SHIFT, 29
  610. lwz r11, 0(r11) /* Get the pte */
  611. /* concat physical page address(r11) and page offset(r10) */
  612. rlwimi r11, r10, 0, 32 - PAGE_SHIFT, 31
  613. 201: lwz r11,0(r11)
  614. /* Check if it really is a dcbx instruction. */
  615. /* dcbt and dcbtst does not generate DTLB Misses/Errors,
  616. * no need to include them here */
  617. xoris r10, r11, 0x7c00 /* check if major OP code is 31 */
  618. rlwinm r10, r10, 0, 21, 5
  619. cmpwi cr0, r10, 2028 /* Is dcbz? */
  620. beq+ 142f
  621. cmpwi cr0, r10, 940 /* Is dcbi? */
  622. beq+ 142f
  623. cmpwi cr0, r10, 108 /* Is dcbst? */
  624. beq+ 144f /* Fix up store bit! */
  625. cmpwi cr0, r10, 172 /* Is dcbf? */
  626. beq+ 142f
  627. cmpwi cr0, r10, 1964 /* Is icbi? */
  628. beq+ 142f
  629. 141: mfspr r10,SPRN_SPRG_SCRATCH2
  630. b DARFixed /* Nope, go back to normal TLB processing */
  631. /* concat physical page address(r11) and page offset(r10) */
  632. 200:
  633. #ifdef CONFIG_PPC_16K_PAGES
  634. rlwinm r11, r11, 0, 0, 32 + PAGE_SHIFT_8M - (PAGE_SHIFT << 1) - 1
  635. rlwimi r11, r10, 32 - (PAGE_SHIFT_8M - 2), 32 + PAGE_SHIFT_8M - (PAGE_SHIFT << 1), 29
  636. #else
  637. rlwinm r11, r10, 0, ~HUGEPD_SHIFT_MASK
  638. #endif
  639. lwz r11, 0(r11) /* Get the pte */
  640. /* concat physical page address(r11) and page offset(r10) */
  641. rlwimi r11, r10, 0, 32 - PAGE_SHIFT_8M, 31
  642. b 201b
  643. 202:
  644. rlwinm r11, r11, 0, 0, 32 + PAGE_SHIFT_512K - (PAGE_SHIFT << 1) - 1
  645. rlwimi r11, r10, 32 - (PAGE_SHIFT_512K - 2), 32 + PAGE_SHIFT_512K - (PAGE_SHIFT << 1), 29
  646. lwz r11, 0(r11) /* Get the pte */
  647. /* concat physical page address(r11) and page offset(r10) */
  648. rlwimi r11, r10, 0, 32 - PAGE_SHIFT_512K, 31
  649. b 201b
  650. 144: mfspr r10, SPRN_DSISR
  651. rlwinm r10, r10,0,7,5 /* Clear store bit for buggy dcbst insn */
  652. mtspr SPRN_DSISR, r10
  653. 142: /* continue, it was a dcbx, dcbi instruction. */
  654. #ifndef NO_SELF_MODIFYING_CODE
  655. andis. r10,r11,0x1f /* test if reg RA is r0 */
  656. li r10,modified_instr@l
  657. dcbtst r0,r10 /* touch for store */
  658. rlwinm r11,r11,0,0,20 /* Zero lower 10 bits */
  659. oris r11,r11,640 /* Transform instr. to a "add r10,RA,RB" */
  660. ori r11,r11,532
  661. stw r11,0(r10) /* store add/and instruction */
  662. dcbf 0,r10 /* flush new instr. to memory. */
  663. icbi 0,r10 /* invalidate instr. cache line */
  664. mfspr r11, SPRN_SPRG_SCRATCH1 /* restore r11 */
  665. mfspr r10, SPRN_SPRG_SCRATCH0 /* restore r10 */
  666. isync /* Wait until new instr is loaded from memory */
  667. modified_instr:
  668. .space 4 /* this is where the add instr. is stored */
  669. bne+ 143f
  670. subf r10,r0,r10 /* r10=r10-r0, only if reg RA is r0 */
  671. 143: mtdar r10 /* store faulting EA in DAR */
  672. mfspr r10,SPRN_SPRG_SCRATCH2
  673. b DARFixed /* Go back to normal TLB handling */
  674. #else
  675. mfctr r10
  676. mtdar r10 /* save ctr reg in DAR */
  677. rlwinm r10, r11, 24, 24, 28 /* offset into jump table for reg RB */
  678. addi r10, r10, 150f@l /* add start of table */
  679. mtctr r10 /* load ctr with jump address */
  680. xor r10, r10, r10 /* sum starts at zero */
  681. bctr /* jump into table */
  682. 150:
  683. add r10, r10, r0 ;b 151f
  684. add r10, r10, r1 ;b 151f
  685. add r10, r10, r2 ;b 151f
  686. add r10, r10, r3 ;b 151f
  687. add r10, r10, r4 ;b 151f
  688. add r10, r10, r5 ;b 151f
  689. add r10, r10, r6 ;b 151f
  690. add r10, r10, r7 ;b 151f
  691. add r10, r10, r8 ;b 151f
  692. add r10, r10, r9 ;b 151f
  693. mtctr r11 ;b 154f /* r10 needs special handling */
  694. mtctr r11 ;b 153f /* r11 needs special handling */
  695. add r10, r10, r12 ;b 151f
  696. add r10, r10, r13 ;b 151f
  697. add r10, r10, r14 ;b 151f
  698. add r10, r10, r15 ;b 151f
  699. add r10, r10, r16 ;b 151f
  700. add r10, r10, r17 ;b 151f
  701. add r10, r10, r18 ;b 151f
  702. add r10, r10, r19 ;b 151f
  703. add r10, r10, r20 ;b 151f
  704. add r10, r10, r21 ;b 151f
  705. add r10, r10, r22 ;b 151f
  706. add r10, r10, r23 ;b 151f
  707. add r10, r10, r24 ;b 151f
  708. add r10, r10, r25 ;b 151f
  709. add r10, r10, r26 ;b 151f
  710. add r10, r10, r27 ;b 151f
  711. add r10, r10, r28 ;b 151f
  712. add r10, r10, r29 ;b 151f
  713. add r10, r10, r30 ;b 151f
  714. add r10, r10, r31
  715. 151:
  716. rlwinm. r11,r11,19,24,28 /* offset into jump table for reg RA */
  717. beq 152f /* if reg RA is zero, don't add it */
  718. addi r11, r11, 150b@l /* add start of table */
  719. mtctr r11 /* load ctr with jump address */
  720. rlwinm r11,r11,0,16,10 /* make sure we don't execute this more than once */
  721. bctr /* jump into table */
  722. 152:
  723. mfdar r11
  724. mtctr r11 /* restore ctr reg from DAR */
  725. mtdar r10 /* save fault EA to DAR */
  726. mfspr r10,SPRN_SPRG_SCRATCH2
  727. b DARFixed /* Go back to normal TLB handling */
  728. /* special handling for r10,r11 since these are modified already */
  729. 153: mfspr r11, SPRN_SPRG_SCRATCH1 /* load r11 from SPRN_SPRG_SCRATCH1 */
  730. add r10, r10, r11 /* add it */
  731. mfctr r11 /* restore r11 */
  732. b 151b
  733. 154: mfspr r11, SPRN_SPRG_SCRATCH0 /* load r10 from SPRN_SPRG_SCRATCH0 */
  734. add r10, r10, r11 /* add it */
  735. mfctr r11 /* restore r11 */
  736. b 151b
  737. #endif
  738. /*
  739. * This is where the main kernel code starts.
  740. */
  741. start_here:
  742. /* ptr to current */
  743. lis r2,init_task@h
  744. ori r2,r2,init_task@l
  745. /* ptr to phys current thread */
  746. tophys(r4,r2)
  747. addi r4,r4,THREAD /* init task's THREAD */
  748. mtspr SPRN_SPRG_THREAD,r4
  749. /* stack */
  750. lis r1,init_thread_union@ha
  751. addi r1,r1,init_thread_union@l
  752. li r0,0
  753. stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
  754. bl early_init /* We have to do this with MMU on */
  755. /*
  756. * Decide what sort of machine this is and initialize the MMU.
  757. */
  758. li r3,0
  759. mr r4,r31
  760. bl machine_init
  761. bl MMU_init
  762. /*
  763. * Go back to running unmapped so we can load up new values
  764. * and change to using our exception vectors.
  765. * On the 8xx, all we have to do is invalidate the TLB to clear
  766. * the old 8M byte TLB mappings and load the page table base register.
  767. */
  768. /* The right way to do this would be to track it down through
  769. * init's THREAD like the context switch code does, but this is
  770. * easier......until someone changes init's static structures.
  771. */
  772. lis r6, swapper_pg_dir@ha
  773. tophys(r6,r6)
  774. #ifdef CONFIG_8xx_CPU6
  775. lis r4, cpu6_errata_word@h
  776. ori r4, r4, cpu6_errata_word@l
  777. li r3, 0x3f80
  778. stw r3, 12(r4)
  779. lwz r3, 12(r4)
  780. #endif
  781. mtspr SPRN_M_TW, r6
  782. lis r4,2f@h
  783. ori r4,r4,2f@l
  784. tophys(r4,r4)
  785. li r3,MSR_KERNEL & ~(MSR_IR|MSR_DR)
  786. mtspr SPRN_SRR0,r4
  787. mtspr SPRN_SRR1,r3
  788. rfi
  789. /* Load up the kernel context */
  790. 2:
  791. SYNC /* Force all PTE updates to finish */
  792. tlbia /* Clear all TLB entries */
  793. sync /* wait for tlbia/tlbie to finish */
  794. TLBSYNC /* ... on all CPUs */
  795. /* set up the PTE pointers for the Abatron bdiGDB.
  796. */
  797. tovirt(r6,r6)
  798. lis r5, abatron_pteptrs@h
  799. ori r5, r5, abatron_pteptrs@l
  800. stw r5, 0xf0(r0) /* Must match your Abatron config file */
  801. tophys(r5,r5)
  802. stw r6, 0(r5)
  803. /* Now turn on the MMU for real! */
  804. li r4,MSR_KERNEL
  805. lis r3,start_kernel@h
  806. ori r3,r3,start_kernel@l
  807. mtspr SPRN_SRR0,r3
  808. mtspr SPRN_SRR1,r4
  809. rfi /* enable MMU and jump to start_kernel */
  810. /* Set up the initial MMU state so we can do the first level of
  811. * kernel initialization. This maps the first 8 MBytes of memory 1:1
  812. * virtual to physical. Also, set the cache mode since that is defined
  813. * by TLB entries and perform any additional mapping (like of the IMMR).
  814. * If configured to pin some TLBs, we pin the first 8 Mbytes of kernel,
  815. * 24 Mbytes of data, and the 512k IMMR space. Anything not covered by
  816. * these mappings is mapped by page tables.
  817. */
  818. initial_mmu:
  819. li r8, 0
  820. mtspr SPRN_MI_CTR, r8 /* remove PINNED ITLB entries */
  821. lis r10, MD_RESETVAL@h
  822. #ifndef CONFIG_8xx_COPYBACK
  823. oris r10, r10, MD_WTDEF@h
  824. #endif
  825. mtspr SPRN_MD_CTR, r10 /* remove PINNED DTLB entries */
  826. tlbia /* Invalidate all TLB entries */
  827. /* Always pin the first 8 MB ITLB to prevent ITLB
  828. misses while mucking around with SRR0/SRR1 in asm
  829. */
  830. lis r8, MI_RSV4I@h
  831. ori r8, r8, 0x1c00
  832. mtspr SPRN_MI_CTR, r8 /* Set instruction MMU control */
  833. #ifdef CONFIG_PIN_TLB
  834. oris r10, r10, MD_RSV4I@h
  835. mtspr SPRN_MD_CTR, r10 /* Set data TLB control */
  836. #endif
  837. /* Now map the lower 8 Meg into the ITLB. */
  838. lis r8, KERNELBASE@h /* Create vaddr for TLB */
  839. ori r8, r8, MI_EVALID /* Mark it valid */
  840. mtspr SPRN_MI_EPN, r8
  841. li r8, MI_PS8MEG | (2 << 5) /* Set 8M byte page, APG 2 */
  842. ori r8, r8, MI_SVALID /* Make it valid */
  843. mtspr SPRN_MI_TWC, r8
  844. li r8, MI_BOOTINIT /* Create RPN for address 0 */
  845. mtspr SPRN_MI_RPN, r8 /* Store TLB entry */
  846. lis r8, MI_APG_INIT@h /* Set protection modes */
  847. ori r8, r8, MI_APG_INIT@l
  848. mtspr SPRN_MI_AP, r8
  849. lis r8, MD_APG_INIT@h
  850. ori r8, r8, MD_APG_INIT@l
  851. mtspr SPRN_MD_AP, r8
  852. /* Map a 512k page for the IMMR to get the processor
  853. * internal registers (among other things).
  854. */
  855. #ifdef CONFIG_PIN_TLB_IMMR
  856. ori r10, r10, 0x1c00
  857. mtspr SPRN_MD_CTR, r10
  858. mfspr r9, 638 /* Get current IMMR */
  859. andis. r9, r9, 0xfff8 /* Get 512 kbytes boundary */
  860. lis r8, VIRT_IMMR_BASE@h /* Create vaddr for TLB */
  861. ori r8, r8, MD_EVALID /* Mark it valid */
  862. mtspr SPRN_MD_EPN, r8
  863. li r8, MD_PS512K | MD_GUARDED /* Set 512k byte page */
  864. ori r8, r8, MD_SVALID /* Make it valid */
  865. mtspr SPRN_MD_TWC, r8
  866. mr r8, r9 /* Create paddr for TLB */
  867. ori r8, r8, MI_BOOTINIT|0x2 /* Inhibit cache -- Cort */
  868. mtspr SPRN_MD_RPN, r8
  869. #endif
  870. /* Since the cache is enabled according to the information we
  871. * just loaded into the TLB, invalidate and enable the caches here.
  872. * We should probably check/set other modes....later.
  873. */
  874. lis r8, IDC_INVALL@h
  875. mtspr SPRN_IC_CST, r8
  876. mtspr SPRN_DC_CST, r8
  877. lis r8, IDC_ENABLE@h
  878. mtspr SPRN_IC_CST, r8
  879. #ifdef CONFIG_8xx_COPYBACK
  880. mtspr SPRN_DC_CST, r8
  881. #else
  882. /* For a debug option, I left this here to easily enable
  883. * the write through cache mode
  884. */
  885. lis r8, DC_SFWT@h
  886. mtspr SPRN_DC_CST, r8
  887. lis r8, IDC_ENABLE@h
  888. mtspr SPRN_DC_CST, r8
  889. #endif
  890. blr
  891. /*
  892. * We put a few things here that have to be page-aligned.
  893. * This stuff goes at the beginning of the data segment,
  894. * which is page-aligned.
  895. */
  896. .data
  897. .globl sdata
  898. sdata:
  899. .globl empty_zero_page
  900. .align PAGE_SHIFT
  901. empty_zero_page:
  902. .space PAGE_SIZE
  903. EXPORT_SYMBOL(empty_zero_page)
  904. .globl swapper_pg_dir
  905. swapper_pg_dir:
  906. .space PGD_TABLE_SIZE
  907. /* Room for two PTE table poiners, usually the kernel and current user
  908. * pointer to their respective root page table (pgdir).
  909. */
  910. abatron_pteptrs:
  911. .space 8
  912. #ifdef CONFIG_8xx_CPU6
  913. .globl cpu6_errata_word
  914. cpu6_errata_word:
  915. .space 16
  916. #endif