gemini_prom.S 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Not really prom support code (yet), but sort of anti-prom code. The current
  3. * bootloader does a number of things it shouldn't and doesn't do things that it
  4. * should. The stuff in here is mainly a hodge-podge collection of setup code
  5. * to get the board up and running.
  6. * ---Dan
  7. */
  8. #include <linux/config.h>
  9. #include <asm/reg.h>
  10. #include <asm/page.h>
  11. #include <platforms/gemini.h>
  12. #include <asm/ppc_asm.h>
  13. /*
  14. * On 750's the MMU is on when Linux is booted, so we need to clear out the
  15. * bootloader's BAT settings, make sure we're in supervisor state (gotcha!),
  16. * and turn off the MMU.
  17. *
  18. */
  19. _GLOBAL(gemini_prom_init)
  20. #ifdef CONFIG_SMP
  21. /* Since the MMU's on, get stuff in rom space that we'll need */
  22. lis r4,GEMINI_CPUSTAT@h
  23. ori r4,r4,GEMINI_CPUSTAT@l
  24. lbz r5,0(r4)
  25. andi. r5,r5,3
  26. mr r24,r5 /* cpu # used later on */
  27. #endif
  28. mfmsr r4
  29. li r3,MSR_PR /* ensure supervisor! */
  30. ori r3,r3,MSR_IR|MSR_DR
  31. andc r4,r4,r3
  32. mtmsr r4
  33. isync
  34. #if 0
  35. /* zero out the bats now that the MMU is off */
  36. prom_no_mmu:
  37. li r3,0
  38. mtspr SPRN_IBAT0U,r3
  39. mtspr SPRN_IBAT0L,r3
  40. mtspr SPRN_IBAT1U,r3
  41. mtspr SPRN_IBAT1L,r3
  42. mtspr SPRN_IBAT2U,r3
  43. mtspr SPRN_IBAT2L,r3
  44. mtspr SPRN_IBAT3U,r3
  45. mtspr SPRN_IBAT3L,r3
  46. mtspr SPRN_DBAT0U,r3
  47. mtspr SPRN_DBAT0L,r3
  48. mtspr SPRN_DBAT1U,r3
  49. mtspr SPRN_DBAT1L,r3
  50. mtspr SPRN_DBAT2U,r3
  51. mtspr SPRN_DBAT2L,r3
  52. mtspr SPRN_DBAT3U,r3
  53. mtspr SPRN_DBAT3L,r3
  54. #endif
  55. /* the bootloader (as far as I'm currently aware) doesn't mess with page
  56. tables, but since we're already here, might as well zap these, too */
  57. li r4,0
  58. mtspr SPRN_SDR1,r4
  59. li r4,16
  60. mtctr r4
  61. li r3,0
  62. li r4,0
  63. 3: mtsrin r3,r4
  64. addi r3,r3,1
  65. bdnz 3b
  66. #ifdef CONFIG_SMP
  67. /* The 750 book (and Mot/IBM support) says that this will "assist" snooping
  68. when in SMP. Not sure yet whether this should stay or leave... */
  69. mfspr r4,SPRN_HID0
  70. ori r4,r4,HID0_ABE
  71. mtspr SPRN_HID0,r4
  72. sync
  73. #endif /* CONFIG_SMP */
  74. blr
  75. /* apparently, SMon doesn't pay attention to HID0[SRST]. Disable the MMU and
  76. branch to 0xfff00100 */
  77. _GLOBAL(_gemini_reboot)
  78. lis r5,GEMINI_BOOT_INIT@h
  79. ori r5,r5,GEMINI_BOOT_INIT@l
  80. li r6,MSR_IP
  81. mtspr SPRN_SRR0,r5
  82. mtspr SPRN_SRR1,r6
  83. rfi