|
Last change
on this file since 23 was
2,
checked in by phkim, 11 years ago
|
|
1.phkim
- revision copy newcon3sk r27
|
-
Property svn:executable set to
*
|
|
File size:
3.2 KB
|
| Line | |
|---|
| 1 | /************************************************************************* |
|---|
| 2 | ** Broadcom Corp. Confidential |
|---|
| 3 | ** Copyright 2010 Broadcom Corp. All Rights Reserved. |
|---|
| 4 | ** |
|---|
| 5 | ** THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 6 | ** AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 7 | ** EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 8 | ** |
|---|
| 9 | ** File: bls2.S |
|---|
| 10 | ** Description: low level board dependent startup code stage 2 |
|---|
| 11 | ** Created: alexp |
|---|
| 12 | ** |
|---|
| 13 | ** REVISION: |
|---|
| 14 | ** |
|---|
| 15 | ***************************************************************************/ |
|---|
| 16 | |
|---|
| 17 | #include "bmips3300.h" |
|---|
| 18 | #include "bchp_common.h" |
|---|
| 19 | #include "bchp_sun_top_ctrl.h" |
|---|
| 20 | |
|---|
| 21 | #define BCHP_REG_BASE PHYS_TO_K1(BCHP_PHYSICAL_OFFSET) |
|---|
| 22 | #define INITIAL_SR ((CP0_STATUS_SR_MASK | CP0_STATUS_CU1_MASK | CP0_STATUS_BEV_MASK | CP0_STATUS_IE_MASK) & ~( CP0_STATUS_ERL_MASK | CP0_STATUS_EXL_MASK)) |
|---|
| 23 | BL_STACK_SIZE = 0x1000 |
|---|
| 24 | |
|---|
| 25 | .lcomm bl_stack, BL_STACK_SIZE |
|---|
| 26 | .text |
|---|
| 27 | .globl __start_s2 |
|---|
| 28 | .set noreorder |
|---|
| 29 | |
|---|
| 30 | __start_s2: |
|---|
| 31 | b init_cpu |
|---|
| 32 | nop |
|---|
| 33 | init_cpu: |
|---|
| 34 | li t0, INITIAL_SR |
|---|
| 35 | mtc0 t0, CP0_STATUS |
|---|
| 36 | nop |
|---|
| 37 | nop |
|---|
| 38 | bal _writeasm |
|---|
| 39 | li a0, '1' |
|---|
| 40 | bal init_mips |
|---|
| 41 | nop |
|---|
| 42 | bal _writeasm |
|---|
| 43 | li a0, '2' |
|---|
| 44 | /* copy exception vector to correct location */ |
|---|
| 45 | la t0, general_exception |
|---|
| 46 | li a0, 0xa0000180 |
|---|
| 47 | lw a1, (t0) |
|---|
| 48 | sw a1, (a0) |
|---|
| 49 | lw a1, 4(t0) |
|---|
| 50 | sw a1, 4(a0) |
|---|
| 51 | lw a1, 8(t0) |
|---|
| 52 | sw a1, 8(a0) |
|---|
| 53 | lw a1, 12(t0) |
|---|
| 54 | sw a1, 12(a0) |
|---|
| 55 | |
|---|
| 56 | bal _writeasm |
|---|
| 57 | li a0, '3' |
|---|
| 58 | |
|---|
| 59 | la t0, start_cached |
|---|
| 60 | /* start execution from cached memory */ |
|---|
| 61 | jr t0 |
|---|
| 62 | nop |
|---|
| 63 | start_cached: |
|---|
| 64 | bal _writeasm |
|---|
| 65 | li a0, '4' |
|---|
| 66 | |
|---|
| 67 | /* copy data segment */ |
|---|
| 68 | la a0, _etext |
|---|
| 69 | la a1, _fdata |
|---|
| 70 | la t2,_edata |
|---|
| 71 | subu a2,t2,a1 |
|---|
| 72 | |
|---|
| 73 | beqz a2, 2f |
|---|
| 74 | nop |
|---|
| 75 | 1: |
|---|
| 76 | lw t0, 0(a0) |
|---|
| 77 | sw t0, 0(a1) |
|---|
| 78 | sub a2, a2, 4 |
|---|
| 79 | addi a0, a0, 4 |
|---|
| 80 | addi a1, a1, 4 |
|---|
| 81 | bnez a2, 1b |
|---|
| 82 | nop |
|---|
| 83 | 2: |
|---|
| 84 | bal _writeasm |
|---|
| 85 | li a0, '5' |
|---|
| 86 | |
|---|
| 87 | /* clear bss segment */ |
|---|
| 88 | la a0,_fbss |
|---|
| 89 | la a1,_end |
|---|
| 90 | subu a1,a1,a0 |
|---|
| 91 | |
|---|
| 92 | beqz a1, 2f |
|---|
| 93 | nop |
|---|
| 94 | 1: |
|---|
| 95 | sw zero,0(a0) |
|---|
| 96 | sub a1, a1, 4 |
|---|
| 97 | addi a0, a0, 4 |
|---|
| 98 | bnez a1, 1b |
|---|
| 99 | nop |
|---|
| 100 | 2: |
|---|
| 101 | bal _writeasm |
|---|
| 102 | li a0, '6' |
|---|
| 103 | |
|---|
| 104 | /* load stack pointer*/ |
|---|
| 105 | la sp, bl_stack + BL_STACK_SIZE - 24 |
|---|
| 106 | /* jump in to cached segment */ |
|---|
| 107 | la t0, bootloader_main |
|---|
| 108 | jalr t0 |
|---|
| 109 | move a0, zero |
|---|
| 110 | loop: |
|---|
| 111 | b loop |
|---|
| 112 | nop |
|---|
| 113 | |
|---|
| 114 | LEAF(aligned_copy) |
|---|
| 115 | |
|---|
| 116 | 1: |
|---|
| 117 | lw v0, 0(a0) |
|---|
| 118 | addiu a2, a2, -4 |
|---|
| 119 | sw v0, 0(a1) |
|---|
| 120 | addiu a0, a0, 4 |
|---|
| 121 | bnez a2, 1b |
|---|
| 122 | addiu a1, a1, 4 |
|---|
| 123 | |
|---|
| 124 | jr ra |
|---|
| 125 | nop |
|---|
| 126 | |
|---|
| 127 | END(aligned_copy) |
|---|
| 128 | |
|---|
| 129 | /* general exception will loop here */ |
|---|
| 130 | LEAF(general_exception) |
|---|
| 131 | b general_exception |
|---|
| 132 | nop |
|---|
| 133 | nop |
|---|
| 134 | nop |
|---|
| 135 | END(general_exception) |
|---|
| 136 | |
|---|
| 137 | #include "uart.s" |
|---|
| 138 | #include "chip.s" |
|---|
| 139 | #undef RelAddrPrintChar |
|---|
| 140 | #undef RelAddrPrintHex32 |
|---|
| 141 | #include "common_routines.s" |
|---|
| 142 | #include "memc_0_client_prog.s" |
|---|
| 143 | #include "cache_lib.s" |
|---|
| 144 | #include "mips_libs.s" |
|---|
| 145 | #include "memc_0_access.s" |
|---|
| 146 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.