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