File indexing completed on 2025-05-11 08:23:56
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 #include <bspopts.h>
0037 #include <bsp/linker-symbols.h>
0038 #include <libcpu/powerpc-utility.h>
0039
0040 #if MPC55XX_CHIP_FAMILY != 551
0041 #define HAS_SPE
0042 #endif
0043
0044 #if MPC55XX_CHIP_FAMILY == 564
0045 #define INIT_REGISTERS_FOR_LSM
0046 #endif
0047
0048 #ifdef HAS_SPE
0049 #define ZERO_GPR(reg) evxor reg, reg, reg
0050 #else
0051 #define ZERO_GPR(reg) xor reg, reg, reg
0052 #endif
0053
0054 .extern __eabi
0055 .extern boot_card
0056 .extern bsp_ram_start
0057 .extern mpc55xx_start_config_mmu_early
0058 .extern mpc55xx_start_config_mmu_early_count
0059 .extern mpc55xx_start_early
0060
0061 .globl _start
0062 .globl mpc55xx_start_load_section
0063 .globl mpc55xx_start_mmu_apply_config
0064
0065 #ifdef MPC55XX_BOOTFLAGS
0066 .globl mpc55xx_bootflag_0
0067 .globl mpc55xx_bootflag_1
0068 #endif
0069
0070 .section ".bsp_start_text", "ax"
0071
0072
0073 .int 0x005a0000
0074
0075
0076 .int _start
0077
0078 #ifdef MPC55XX_BOOTFLAGS
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088 mpc55xx_bootflag_0:
0089 .int 0xffffffff
0090 mpc55xx_bootflag_1:
0091 .int 0xffffffff
0092 #endif
0093
0094 _start:
0095
0096 #ifdef MPC55XX_ENABLE_START_PROLOGUE
0097 bl mpc55xx_start_prologue
0098 #endif
0099
0100 #ifdef MPC55XX_NEEDS_LOW_LEVEL_INIT
0101
0102
0103 #ifdef HAS_SPE
0104 mfmsr r3
0105 oris r3, r3, MSR_SPE >> 16
0106 mtmsr r3
0107 isync
0108 #endif
0109
0110
0111
0112
0113
0114
0115
0116 ZERO_GPR(r0)
0117 #ifdef INIT_REGISTERS_FOR_LSM
0118 ZERO_GPR(r1)
0119 ZERO_GPR(r2)
0120 ZERO_GPR(r4)
0121 ZERO_GPR(r5)
0122 ZERO_GPR(r6)
0123 ZERO_GPR(r7)
0124 ZERO_GPR(r8)
0125 ZERO_GPR(r9)
0126 ZERO_GPR(r10)
0127 ZERO_GPR(r11)
0128 ZERO_GPR(r12)
0129 ZERO_GPR(r13)
0130 ZERO_GPR(r14)
0131 ZERO_GPR(r15)
0132 ZERO_GPR(r16)
0133 ZERO_GPR(r17)
0134 ZERO_GPR(r18)
0135 ZERO_GPR(r19)
0136 ZERO_GPR(r20)
0137 ZERO_GPR(r21)
0138 ZERO_GPR(r22)
0139 ZERO_GPR(r23)
0140 ZERO_GPR(r24)
0141 ZERO_GPR(r25)
0142 ZERO_GPR(r26)
0143 ZERO_GPR(r27)
0144 ZERO_GPR(r28)
0145 ZERO_GPR(r29)
0146 ZERO_GPR(r30)
0147 ZERO_GPR(r31)
0148 mtcrf 0xff, r0
0149 mtcsrr0 r0
0150 mtcsrr1 r0
0151 mtctr r0
0152 mtspr FSL_EIS_DBCNT, r0
0153 mtspr DEAR_BOOKE, r0
0154 mtdec r0
0155 mtspr BOOKE_DECAR, r0
0156 mtspr FSL_EIS_DSRR0, r0
0157 mtspr FSL_EIS_DSRR1, r0
0158 mtspr BOOKE_DVC1, r0
0159 mtspr BOOKE_DVC2, r0
0160 mtspr BOOKE_IVPR, r0
0161 mtlr r0
0162 mtspr FSL_EIS_MCAR, r0
0163 mtmcsrr0 r0
0164 mtmcsrr1 r0
0165 mtspr SPRG0, r0
0166 mtspr SPRG1, r0
0167 mtspr SPRG2, r0
0168 mtspr SPRG3, r0
0169 mtspr SPRG4, r0
0170 mtspr SPRG5, r0
0171 mtspr SPRG6, r0
0172 mtspr SPRG7, r0
0173 mtspr FSL_EIS_SPRG8, r0
0174 mtspr FSL_EIS_SPRG9, r0
0175 mtsrr0 r0
0176 mtsrr1 r0
0177 mtspr USPRG0, r0
0178 #ifdef HAS_SPE
0179 evmra r0, r0
0180 #endif
0181 #endif
0182 mtspr TBWL, r0
0183 mtspr TBWU, r0
0184
0185
0186 mfspr r3, HID0
0187 ori r3, r3, 0x4000
0188 mtspr HID0, r3
0189
0190
0191
0192
0193
0194
0195
0196
0197 #if MPC55XX_CHIP_FAMILY != 567
0198 LWI r3, FSL_EIS_BUCSR_BBFI | FSL_EIS_BUCSR_BALLOC_ALL | FSL_EIS_BUCSR_BPRED_NOT_TAKEN | FSL_EIS_BUCSR_BPEN
0199 mtspr FSL_EIS_BUCSR, r3
0200 #endif
0201
0202 #endif
0203
0204
0205 LA r3, mpc55xx_start_config_mmu_early
0206 LW r4, mpc55xx_start_config_mmu_early_count
0207 bl mpc55xx_start_mmu_apply_config
0208
0209 #ifdef MPC55XX_NEEDS_LOW_LEVEL_INIT
0210
0211
0212
0213 LA r3, bsp_ram_start
0214 addi r4, r3, MPC55XX_EARLY_STACK_SIZE
0215
0216 zero_intermediate_stack_loop:
0217
0218 #ifdef HAS_SPE
0219 evstdd r0, 0(r3)
0220 evstdd r0, 8(r3)
0221 evstdd r0, 16(r3)
0222 evstdd r0, 24(r3)
0223 #else
0224 stw r0, 0(r3)
0225 stw r0, 4(r3)
0226 stw r0, 8(r3)
0227 stw r0, 12(r3)
0228 stw r0, 16(r3)
0229 stw r0, 20(r3)
0230 stw r0, 24(r3)
0231 stw r0, 28(r3)
0232 #endif
0233 addi r3, r3, 32
0234 cmpw cr7, r3, r4
0235 bne cr7, zero_intermediate_stack_loop
0236 subi r1, r3, 16
0237
0238 #endif
0239
0240
0241 bl mpc55xx_start_early
0242
0243
0244 LA r1, _ISR_Stack_area_end
0245 subi r1, r1, 16
0246 li r0, 0
0247 stw r0, 0(r1)
0248
0249
0250
0251
0252
0253 LA r3, bsp_section_fast_text_begin
0254 LA r4, bsp_section_fast_text_load_begin
0255 LA r5, bsp_section_fast_text_size
0256 bl mpc55xx_start_load_section
0257 LA r3, bsp_section_fast_data_begin
0258 LA r4, bsp_section_fast_data_load_begin
0259 LA r5, bsp_section_fast_data_size
0260 bl mpc55xx_start_load_section
0261 LA r3, bsp_section_data_begin
0262 LA r4, bsp_section_data_load_begin
0263 LA r5, bsp_section_data_size
0264 bl mpc55xx_start_load_section
0265
0266
0267 bl __eabi
0268
0269
0270 li r3, 0
0271
0272
0273 bl boot_card
0274
0275
0276 twiddle:
0277
0278 b twiddle
0279
0280 mpc55xx_start_mmu_apply_config:
0281
0282 cmpwi cr7, r4, r0
0283 beqlr cr7
0284 mtctr r4
0285
0286 mmu_init_loop:
0287
0288 lwz r4, 0(r3)
0289 lwz r5, 4(r3)
0290 lwz r6, 8(r3)
0291 lwz r7, 12(r3)
0292 mtspr FSL_EIS_MAS0, r4
0293 mtspr FSL_EIS_MAS1, r5
0294 mtspr FSL_EIS_MAS2, r6
0295 mtspr FSL_EIS_MAS3, r7
0296 tlbwe
0297 addi r3, r3, 16
0298 bdnz mmu_init_loop
0299 blr
0300
0301 mpc55xx_start_load_section:
0302 cmpw cr7, r3, r4
0303 beqlr cr7
0304 b memcpy