aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc/kernel/head.S
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ppc/kernel/head.S')
-rw-r--r--arch/ppc/kernel/head.S117
1 files changed, 4 insertions, 113 deletions
diff --git a/arch/ppc/kernel/head.S b/arch/ppc/kernel/head.S
index c7cb9d5f24a3..1b0ec7202dd5 100644
--- a/arch/ppc/kernel/head.S
+++ b/arch/ppc/kernel/head.S
@@ -32,10 +32,6 @@
32#include <asm/ppc_asm.h> 32#include <asm/ppc_asm.h>
33#include <asm/asm-offsets.h> 33#include <asm/asm-offsets.h>
34 34
35#ifdef CONFIG_APUS
36#include <asm/amigappc.h>
37#endif
38
39/* 601 only have IBAT; cr0.eq is set on 601 when using this macro */ 35/* 601 only have IBAT; cr0.eq is set on 601 when using this macro */
40#define LOAD_BAT(n, reg, RA, RB) \ 36#define LOAD_BAT(n, reg, RA, RB) \
41 /* see the comment for clear_bats() -- Cort */ \ 37 /* see the comment for clear_bats() -- Cort */ \
@@ -128,14 +124,6 @@ __start:
128 */ 124 */
129 bl early_init 125 bl early_init
130 126
131#ifdef CONFIG_APUS
132/* On APUS the __va/__pa constants need to be set to the correct
133 * values before continuing.
134 */
135 mr r4,r30
136 bl fix_mem_constants
137#endif /* CONFIG_APUS */
138
139/* Switch MMU off, clear BATs and flush TLB. At this point, r3 contains 127/* Switch MMU off, clear BATs and flush TLB. At this point, r3 contains
140 * the physical address we are running at, returned by early_init() 128 * the physical address we are running at, returned by early_init()
141 */ 129 */
@@ -145,7 +133,7 @@ __after_mmu_off:
145 bl flush_tlbs 133 bl flush_tlbs
146 134
147 bl initial_bats 135 bl initial_bats
148#if !defined(CONFIG_APUS) && defined(CONFIG_BOOTX_TEXT) 136#ifdef CONFIG_BOOTX_TEXT
149 bl setup_disp_bat 137 bl setup_disp_bat
150#endif 138#endif
151 139
@@ -161,7 +149,6 @@ __after_mmu_off:
161#endif /* CONFIG_6xx */ 149#endif /* CONFIG_6xx */
162 150
163 151
164#ifndef CONFIG_APUS
165/* 152/*
166 * We need to run with _start at physical address 0. 153 * We need to run with _start at physical address 0.
167 * If the MMU is already turned on, we copy stuff to KERNELBASE, 154 * If the MMU is already turned on, we copy stuff to KERNELBASE,
@@ -172,7 +159,7 @@ __after_mmu_off:
172 addis r4,r3,KERNELBASE@h /* current address of _start */ 159 addis r4,r3,KERNELBASE@h /* current address of _start */
173 cmpwi 0,r4,0 /* are we already running at 0? */ 160 cmpwi 0,r4,0 /* are we already running at 0? */
174 bne relocate_kernel 161 bne relocate_kernel
175#endif /* CONFIG_APUS */ 162
176/* 163/*
177 * we now have the 1st 16M of ram mapped with the bats. 164 * we now have the 1st 16M of ram mapped with the bats.
178 * prep needs the mmu to be turned on here, but pmac already has it on. 165 * prep needs the mmu to be turned on here, but pmac already has it on.
@@ -812,85 +799,6 @@ copy_and_flush:
812 addi r6,r6,4 799 addi r6,r6,4
813 blr 800 blr
814 801
815#ifdef CONFIG_APUS
816/*
817 * On APUS the physical base address of the kernel is not known at compile
818 * time, which means the __pa/__va constants used are incorrect. In the
819 * __init section is recorded the virtual addresses of instructions using
820 * these constants, so all that has to be done is fix these before
821 * continuing the kernel boot.
822 *
823 * r4 = The physical address of the kernel base.
824 */
825fix_mem_constants:
826 mr r10,r4
827 addis r10,r10,-KERNELBASE@h /* virt_to_phys constant */
828 neg r11,r10 /* phys_to_virt constant */
829
830 lis r12,__vtop_table_begin@h
831 ori r12,r12,__vtop_table_begin@l
832 add r12,r12,r10 /* table begin phys address */
833 lis r13,__vtop_table_end@h
834 ori r13,r13,__vtop_table_end@l
835 add r13,r13,r10 /* table end phys address */
836 subi r12,r12,4
837 subi r13,r13,4
8381: lwzu r14,4(r12) /* virt address of instruction */
839 add r14,r14,r10 /* phys address of instruction */
840 lwz r15,0(r14) /* instruction, now insert top */
841 rlwimi r15,r10,16,16,31 /* half of vp const in low half */
842 stw r15,0(r14) /* of instruction and restore. */
843 dcbst r0,r14 /* write it to memory */
844 sync
845 icbi r0,r14 /* flush the icache line */
846 cmpw r12,r13
847 bne 1b
848 sync /* additional sync needed on g4 */
849 isync
850
851/*
852 * Map the memory where the exception handlers will
853 * be copied to when hash constants have been patched.
854 */
855#ifdef CONFIG_APUS_FAST_EXCEPT
856 lis r8,0xfff0
857#else
858 lis r8,0
859#endif
860 ori r8,r8,0x2 /* 128KB, supervisor */
861 mtspr SPRN_DBAT3U,r8
862 mtspr SPRN_DBAT3L,r8
863
864 lis r12,__ptov_table_begin@h
865 ori r12,r12,__ptov_table_begin@l
866 add r12,r12,r10 /* table begin phys address */
867 lis r13,__ptov_table_end@h
868 ori r13,r13,__ptov_table_end@l
869 add r13,r13,r10 /* table end phys address */
870 subi r12,r12,4
871 subi r13,r13,4
8721: lwzu r14,4(r12) /* virt address of instruction */
873 add r14,r14,r10 /* phys address of instruction */
874 lwz r15,0(r14) /* instruction, now insert top */
875 rlwimi r15,r11,16,16,31 /* half of pv const in low half*/
876 stw r15,0(r14) /* of instruction and restore. */
877 dcbst r0,r14 /* write it to memory */
878 sync
879 icbi r0,r14 /* flush the icache line */
880 cmpw r12,r13
881 bne 1b
882
883 sync /* additional sync needed on g4 */
884 isync /* No speculative loading until now */
885 blr
886
887/***********************************************************************
888 * Please note that on APUS the exception handlers are located at the
889 * physical address 0xfff0000. For this reason, the exception handlers
890 * cannot use relative branches to access the code below.
891 ***********************************************************************/
892#endif /* CONFIG_APUS */
893
894#ifdef CONFIG_SMP 802#ifdef CONFIG_SMP
895 .globl __secondary_start_pmac_0 803 .globl __secondary_start_pmac_0
896__secondary_start_pmac_0: 804__secondary_start_pmac_0:
@@ -1043,19 +951,6 @@ start_here:
1043 bl machine_init 951 bl machine_init
1044 bl MMU_init 952 bl MMU_init
1045 953
1046#ifdef CONFIG_APUS
1047 /* Copy exception code to exception vector base on APUS. */
1048 lis r4,KERNELBASE@h
1049#ifdef CONFIG_APUS_FAST_EXCEPT
1050 lis r3,0xfff0 /* Copy to 0xfff00000 */
1051#else
1052 lis r3,0 /* Copy to 0x00000000 */
1053#endif
1054 li r5,0x4000 /* # bytes of memory to copy */
1055 li r6,0
1056 bl copy_and_flush /* copy the first 0x4000 bytes */
1057#endif /* CONFIG_APUS */
1058
1059/* 954/*
1060 * Go back to running unmapped so we can load up new values 955 * Go back to running unmapped so we can load up new values
1061 * for SDR1 (hash table pointer) and the segment registers 956 * for SDR1 (hash table pointer) and the segment registers
@@ -1232,11 +1127,7 @@ initial_bats:
1232#else 1127#else
1233 ori r8,r8,2 /* R/W access */ 1128 ori r8,r8,2 /* R/W access */
1234#endif /* CONFIG_SMP */ 1129#endif /* CONFIG_SMP */
1235#ifdef CONFIG_APUS
1236 ori r11,r11,BL_8M<<2|0x2 /* set up 8MB BAT registers for 604 */
1237#else
1238 ori r11,r11,BL_256M<<2|0x2 /* set up BAT registers for 604 */ 1130 ori r11,r11,BL_256M<<2|0x2 /* set up BAT registers for 604 */
1239#endif /* CONFIG_APUS */
1240 1131
1241 mtspr SPRN_DBAT0L,r8 /* N.B. 6xx (not 601) have valid */ 1132 mtspr SPRN_DBAT0L,r8 /* N.B. 6xx (not 601) have valid */
1242 mtspr SPRN_DBAT0U,r11 /* bit in upper BAT register */ 1133 mtspr SPRN_DBAT0U,r11 /* bit in upper BAT register */
@@ -1245,7 +1136,7 @@ initial_bats:
1245 isync 1136 isync
1246 blr 1137 blr
1247 1138
1248#if !defined(CONFIG_APUS) && defined(CONFIG_BOOTX_TEXT) 1139#ifdef CONFIG_BOOTX_TEXT
1249setup_disp_bat: 1140setup_disp_bat:
1250 /* 1141 /*
1251 * setup the display bat prepared for us in prom.c 1142 * setup the display bat prepared for us in prom.c
@@ -1268,7 +1159,7 @@ setup_disp_bat:
1268 mtspr SPRN_IBAT3U,r11 1159 mtspr SPRN_IBAT3U,r11
1269 blr 1160 blr
1270 1161
1271#endif /* !defined(CONFIG_APUS) && defined(CONFIG_BOOTX_TEXT) */ 1162#endif /* defined(CONFIG_BOOTX_TEXT) */
1272 1163
1273#ifdef CONFIG_8260 1164#ifdef CONFIG_8260
1274/* Jump into the system reset for the rom. 1165/* Jump into the system reset for the rom.