Merge branch 'master' of git://git.denx.de/u-boot-arm

This commit is contained in:
Tom Rini 2015-10-15 17:45:39 -04:00
commit 1275456d31
6 changed files with 55 additions and 27 deletions

View file

@ -112,7 +112,7 @@ ENDPROC(__asm_flush_dcache_all)
ENTRY(__asm_invalidate_dcache_all) ENTRY(__asm_invalidate_dcache_all)
mov x16, lr mov x16, lr
mov x0, #0xffff mov x0, #0x1
bl __asm_dcache_all bl __asm_dcache_all
mov lr, x16 mov lr, x16
ret ret

View file

@ -59,15 +59,15 @@ static void mmu_setup(void)
el = current_el(); el = current_el();
if (el == 1) { if (el == 1) {
set_ttbr_tcr_mair(el, gd->arch.tlb_addr, set_ttbr_tcr_mair(el, gd->arch.tlb_addr,
TCR_FLAGS | TCR_EL1_IPS_BITS, TCR_EL1_RSVD | TCR_FLAGS | TCR_EL1_IPS_BITS,
MEMORY_ATTRIBUTES); MEMORY_ATTRIBUTES);
} else if (el == 2) { } else if (el == 2) {
set_ttbr_tcr_mair(el, gd->arch.tlb_addr, set_ttbr_tcr_mair(el, gd->arch.tlb_addr,
TCR_FLAGS | TCR_EL2_IPS_BITS, TCR_EL2_RSVD | TCR_FLAGS | TCR_EL2_IPS_BITS,
MEMORY_ATTRIBUTES); MEMORY_ATTRIBUTES);
} else { } else {
set_ttbr_tcr_mair(el, gd->arch.tlb_addr, set_ttbr_tcr_mair(el, gd->arch.tlb_addr,
TCR_FLAGS | TCR_EL3_IPS_BITS, TCR_EL3_RSVD | TCR_FLAGS | TCR_EL3_IPS_BITS,
MEMORY_ATTRIBUTES); MEMORY_ATTRIBUTES);
} }
/* enable the mmu */ /* enable the mmu */

View file

@ -103,13 +103,17 @@
#define TCR_EL2_IPS_BITS (3 << 16) /* 42 bits physical address */ #define TCR_EL2_IPS_BITS (3 << 16) /* 42 bits physical address */
#define TCR_EL3_IPS_BITS (3 << 16) /* 42 bits physical address */ #define TCR_EL3_IPS_BITS (3 << 16) /* 42 bits physical address */
/* PTWs cacheable, inner/outer WBWA and non-shareable */ /* PTWs cacheable, inner/outer WBWA and inner shareable */
#define TCR_FLAGS (TCR_TG0_64K | \ #define TCR_FLAGS (TCR_TG0_64K | \
TCR_SHARED_NON | \ TCR_SHARED_INNER | \
TCR_ORGN_WBWA | \ TCR_ORGN_WBWA | \
TCR_IRGN_WBWA | \ TCR_IRGN_WBWA | \
TCR_T0SZ(VA_BITS)) TCR_T0SZ(VA_BITS))
#define TCR_EL1_RSVD (1 << 31)
#define TCR_EL2_RSVD (1 << 31 | 1 << 23)
#define TCR_EL3_RSVD (1 << 31 | 1 << 23)
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
void set_pgtable_section(u64 *page_table, u64 index, void set_pgtable_section(u64 *page_table, u64 index,

View file

@ -25,7 +25,8 @@
* the GD ('global data') structure, both located in some readily * the GD ('global data') structure, both located in some readily
* available RAM (SRAM, locked cache...). In this context, VARIABLE * available RAM (SRAM, locked cache...). In this context, VARIABLE
* global data, initialized or not (BSS), are UNAVAILABLE; only * global data, initialized or not (BSS), are UNAVAILABLE; only
* CONSTANT initialized data are available. * CONSTANT initialized data are available. GD should be zeroed
* before board_init_f() is called.
* *
* 2. Call board_init_f(). This function prepares the hardware for * 2. Call board_init_f(). This function prepares the hardware for
* execution from system RAM (DRAM, DDR...) As system RAM may not * execution from system RAM (DRAM, DDR...) As system RAM may not
@ -34,24 +35,29 @@
* data include the relocation destination, the future stack, and * data include the relocation destination, the future stack, and
* the future GD location. * the future GD location.
* *
* (the following applies only to non-SPL builds)
*
* 3. Set up intermediate environment where the stack and GD are the * 3. Set up intermediate environment where the stack and GD are the
* ones allocated by board_init_f() in system RAM, but BSS and * ones allocated by board_init_f() in system RAM, but BSS and
* initialized non-const data are still not available. * initialized non-const data are still not available.
* *
* 4. Call relocate_code(). This function relocates U-Boot from its * 4a.For U-Boot proper (not SPL), call relocate_code(). This function
* current location into the relocation destination computed by * relocates U-Boot from its current location into the relocation
* board_init_f(). * destination computed by board_init_f().
*
* 4b.For SPL, board_init_f() just returns (to crt0). There is no
* code relocation in SPL.
* *
* 5. Set up final environment for calling board_init_r(). This * 5. Set up final environment for calling board_init_r(). This
* environment has BSS (initialized to 0), initialized non-const * environment has BSS (initialized to 0), initialized non-const
* data (initialized to their intended value), and stack in system * data (initialized to their intended value), and stack in system
* RAM. GD has retained values set by board_init_f(). Some CPUs * RAM (for SPL moving the stack and GD into RAM is optional - see
* have some work left to do at this point regarding memory, so * CONFIG_SPL_STACK_R). GD has retained values set by board_init_f().
* call c_runtime_cpu_setup.
* *
* 6. Branch to board_init_r(). * 6. For U-Boot proper (not SPL), some CPUs have some work left to do
* at this point regarding memory, so call c_runtime_cpu_setup.
*
* 7. Branch to board_init_r().
*
* For more information see 'Board Initialisation Flow in README.
*/ */
/* /*

View file

@ -27,7 +27,8 @@
* the GD ('global data') structure, both located in some readily * the GD ('global data') structure, both located in some readily
* available RAM (SRAM, locked cache...). In this context, VARIABLE * available RAM (SRAM, locked cache...). In this context, VARIABLE
* global data, initialized or not (BSS), are UNAVAILABLE; only * global data, initialized or not (BSS), are UNAVAILABLE; only
* CONSTANT initialized data are available. * CONSTANT initialized data are available. GD should be zeroed
* before board_init_f() is called.
* *
* 2. Call board_init_f(). This function prepares the hardware for * 2. Call board_init_f(). This function prepares the hardware for
* execution from system RAM (DRAM, DDR...) As system RAM may not * execution from system RAM (DRAM, DDR...) As system RAM may not
@ -36,24 +37,31 @@
* data include the relocation destination, the future stack, and * data include the relocation destination, the future stack, and
* the future GD location. * the future GD location.
* *
* (the following applies only to non-SPL builds)
*
* 3. Set up intermediate environment where the stack and GD are the * 3. Set up intermediate environment where the stack and GD are the
* ones allocated by board_init_f() in system RAM, but BSS and * ones allocated by board_init_f() in system RAM, but BSS and
* initialized non-const data are still not available. * initialized non-const data are still not available.
* *
* 4. Call relocate_code(). This function relocates U-Boot from its * 4a.For U-Boot proper (not SPL), call relocate_code(). This function
* current location into the relocation destination computed by * relocates U-Boot from its current location into the relocation
* board_init_f(). * destination computed by board_init_f().
*
* 4b.For SPL, board_init_f() just returns (to crt0). There is no
* code relocation in SPL.
* *
* 5. Set up final environment for calling board_init_r(). This * 5. Set up final environment for calling board_init_r(). This
* environment has BSS (initialized to 0), initialized non-const * environment has BSS (initialized to 0), initialized non-const
* data (initialized to their intended value), and stack in system * data (initialized to their intended value), and stack in system
* RAM. GD has retained values set by board_init_f(). Some CPUs * RAM (for SPL moving the stack and GD into RAM is optional - see
* have some work left to do at this point regarding memory, so * CONFIG_SPL_STACK_R). GD has retained values set by board_init_f().
* call c_runtime_cpu_setup.
* *
* 6. Branch to board_init_r(). * TODO: For SPL, implement stack relocation on AArch64.
*
* 6. For U-Boot proper (not SPL), some CPUs have some work left to do
* at this point regarding memory, so call c_runtime_cpu_setup.
*
* 7. Branch to board_init_r().
*
* For more information see 'Board Initialisation Flow in README.
*/ */
ENTRY(_main) ENTRY(_main)
@ -106,6 +114,8 @@ relocation_return:
*/ */
bl c_runtime_cpu_setup /* still call old routine */ bl c_runtime_cpu_setup /* still call old routine */
/* TODO: For SPL, call spl_relocate_stack_gd() to alloc stack relocation */
/* /*
* Clear BSS section * Clear BSS section
*/ */

View file

@ -46,11 +46,19 @@ ENTRY(gic_init_secure)
ldr w9, [x0, GICD_TYPER] ldr w9, [x0, GICD_TYPER]
and w10, w9, #0x1f /* ITLinesNumber */ and w10, w9, #0x1f /* ITLinesNumber */
cbz w10, 1f /* No SPIs */ cbz w10, 1f /* No SPIs */
add x11, x0, (GICD_IGROUPRn + 4) add x11, x0, GICD_IGROUPRn
mov w9, #~0 /* Config SPIs as Grp1 */ mov w9, #~0 /* Config SPIs as Grp1 */
str w9, [x11], #0x4
0: str w9, [x11], #0x4 0: str w9, [x11], #0x4
sub w10, w10, #0x1 sub w10, w10, #0x1
cbnz w10, 0b cbnz w10, 0b
ldr x1, =GICC_BASE /* GICC_CTLR */
mov w0, #3 /* EnableGrp0 | EnableGrp1 */
str w0, [x1]
mov w0, #1 << 7 /* allow NS access to GICC_PMR */
str w0, [x1, #4] /* GICC_PMR */
#endif #endif
1: 1:
ret ret