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