gemini_prom.S 2.3 KB

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