Qcom从CPU的启动

来源:互联网 发布:流程的优化 编辑:程序博客网 时间:2024/06/08 07:00

1 从secondary_holding_pen开始

#ifdef CONFIG_SMP
        .align  3
1:      .quad   .
        .quad   secondary_holding_pen_release

        /*
         * This provides a "holding pen" for platforms to hold all secondary
         * cores are held until we're ready for them to initialise.
         */

ENTRY(secondary_holding_pen)
        bl      el2_setup                       // Drop to EL1, w20=cpu_boot_mode
        bl      __calc_phys_offset              // x24=PHYS_OFFSET, x28=PHYS_OFFSET-PAGE_OFFSET
        bl      set_cpu_boot_mode_flag
        mrs     x0, mpidr_el1
        ldr     x1, =MPIDR_HWID_BITMASK
        and     x0, x0, x1
        adr     x1, 1b                                                        /和以下4行把secondary_holding_pen_release读入到X4中。
        ldp     x2, x3, [x1]
        sub     x1, x1, x2
        add     x3, x3, x1
pen:    ldr     x4, [x3]
        cmp     x4, x0
        b.eq    secondary_startup                             /察看x4 的值是否等于当前CPU,如果不是继续等待,如果是跳转到secondary_startup
        b       pen
ENDPROC(secondary_holding_pen)



ENTRY(secondary_startup)
        /*
         * Common entry point for secondary CPUs.
         */
        mrs     x22, midr_el1                   // x22=cpuid
        mov     x0, x22
        bl      lookup_processor_type
        mov     x23, x0                         // x23=current cpu_table
        cbz     x23, __error_p                  // invalid processor (x23=0)?

        pgtbl   x25, x26, x24                   // x25=TTBR0, x26=TTBR1
        ldr     x12, [x23, #CPU_INFO_SETUP]
        add     x12, x12, x28                   // __virt_to_phys
        blr     x12                             // initialise processor

        ldr     x21, =secondary_data
        ldr     x27, =__secondary_switched      // address to jump to after enabling the MMU
        b       __enable_mmu
ENDPROC(secondary_startup)

ENTRY(__secondary_switched)
        ldr     x0, [x21]                       // get secondary_data.stack
        mov     sp, x0
        mov     x29, #0
        b       secondary_start_kernel
ENDPROC(__secondary_switched)

2. 到secondary_start_kernel

secondary_start_kernel开始对从CPU进行设置,代码很容易阅读了。

0 0