Commit 5085f3ff authored by Russell King's avatar Russell King

ARM: hotplug cpu: Keep processor information, startup code & __lookup_processor_type

When hotplug CPU is enabled, we need to keep the list of supported CPUs,
their setup functions, and __lookup_processor_type in place so that we
can find and initialize secondary CPUs.  Move these into the __CPUINIT
section.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 37b05b63
...@@ -145,45 +145,14 @@ ENDPROC(__error) ...@@ -145,45 +145,14 @@ ENDPROC(__error)
/* /*
* Read processor ID register (CP#15, CR0), and look up in the linker-built * This provides a C-API version of __lookup_processor_type
* supported processor list. Note that we can't use the absolute addresses
* for the __proc_info lists since we aren't running with the MMU on
* (and therefore, we are not in the correct address space). We have to
* calculate the offset.
*
* r9 = cpuid
* Returns:
* r3, r4, r6 corrupted
* r5 = proc_info pointer in physical address space
* r9 = cpuid (preserved)
*/
__lookup_processor_type:
adr r3, 3f
ldmia r3, {r5 - r7}
add r3, r3, #8
sub r3, r3, r7 @ get offset between virt&phys
add r5, r5, r3 @ convert virt addresses to
add r6, r6, r3 @ physical address space
1: ldmia r5, {r3, r4} @ value, mask
and r4, r4, r9 @ mask wanted bits
teq r3, r4
beq 2f
add r5, r5, #PROC_INFO_SZ @ sizeof(proc_info_list)
cmp r5, r6
blo 1b
mov r5, #0 @ unknown processor
2: mov pc, lr
ENDPROC(__lookup_processor_type)
/*
* This provides a C-API version of the above function.
*/ */
ENTRY(lookup_processor_type) ENTRY(lookup_processor_type)
stmfd sp!, {r4 - r7, r9, lr} stmfd sp!, {r4 - r6, r9, lr}
mov r9, r0 mov r9, r0
bl __lookup_processor_type bl __lookup_processor_type
mov r0, r5 mov r0, r5
ldmfd sp!, {r4 - r7, r9, pc} ldmfd sp!, {r4 - r6, r9, pc}
ENDPROC(lookup_processor_type) ENDPROC(lookup_processor_type)
/* /*
...@@ -191,8 +160,6 @@ ENDPROC(lookup_processor_type) ...@@ -191,8 +160,6 @@ ENDPROC(lookup_processor_type)
* more information about the __proc_info and __arch_info structures. * more information about the __proc_info and __arch_info structures.
*/ */
.align 2 .align 2
3: .long __proc_info_begin
.long __proc_info_end
4: .long . 4: .long .
.long __arch_info_begin .long __arch_info_begin
.long __arch_info_end .long __arch_info_end
...@@ -265,3 +232,45 @@ __vet_atags: ...@@ -265,3 +232,45 @@ __vet_atags:
1: mov r2, #0 1: mov r2, #0
mov pc, lr mov pc, lr
ENDPROC(__vet_atags) ENDPROC(__vet_atags)
/*
* Read processor ID register (CP#15, CR0), and look up in the linker-built
* supported processor list. Note that we can't use the absolute addresses
* for the __proc_info lists since we aren't running with the MMU on
* (and therefore, we are not in the correct address space). We have to
* calculate the offset.
*
* r9 = cpuid
* Returns:
* r3, r4, r6 corrupted
* r5 = proc_info pointer in physical address space
* r9 = cpuid (preserved)
*/
__CPUINIT
__lookup_processor_type:
adr r3, __lookup_processor_type_data
ldmia r3, {r4 - r6}
sub r3, r3, r4 @ get offset between virt&phys
add r5, r5, r3 @ convert virt addresses to
add r6, r6, r3 @ physical address space
1: ldmia r5, {r3, r4} @ value, mask
and r4, r4, r9 @ mask wanted bits
teq r3, r4
beq 2f
add r5, r5, #PROC_INFO_SZ @ sizeof(proc_info_list)
cmp r5, r6
blo 1b
mov r5, #0 @ unknown processor
2: mov pc, lr
ENDPROC(__lookup_processor_type)
/*
* Look in <asm/procinfo.h> for information about the __proc_info structure.
*/
.align 2
.type __lookup_processor_type_data, %object
__lookup_processor_type_data:
.long .
.long __proc_info_begin
.long __proc_info_end
.size __lookup_processor_type_data, . - __lookup_processor_type_data
...@@ -8,6 +8,19 @@ ...@@ -8,6 +8,19 @@
#include <asm/memory.h> #include <asm/memory.h>
#include <asm/page.h> #include <asm/page.h>
#define PROC_INFO \
VMLINUX_SYMBOL(__proc_info_begin) = .; \
*(.proc.info.init) \
VMLINUX_SYMBOL(__proc_info_end) = .;
#ifdef CONFIG_HOTPLUG_CPU
#define ARM_CPU_DISCARD(x)
#define ARM_CPU_KEEP(x) x
#else
#define ARM_CPU_DISCARD(x) x
#define ARM_CPU_KEEP(x)
#endif
OUTPUT_ARCH(arm) OUTPUT_ARCH(arm)
ENTRY(stext) ENTRY(stext)
...@@ -31,9 +44,7 @@ SECTIONS ...@@ -31,9 +44,7 @@ SECTIONS
HEAD_TEXT HEAD_TEXT
INIT_TEXT INIT_TEXT
_einittext = .; _einittext = .;
__proc_info_begin = .; ARM_CPU_DISCARD(PROC_INFO)
*(.proc.info.init)
__proc_info_end = .;
__arch_info_begin = .; __arch_info_begin = .;
*(.arch.info.init) *(.arch.info.init)
__arch_info_end = .; __arch_info_end = .;
...@@ -68,10 +79,8 @@ SECTIONS ...@@ -68,10 +79,8 @@ SECTIONS
/DISCARD/ : { /DISCARD/ : {
*(.ARM.exidx.exit.text) *(.ARM.exidx.exit.text)
*(.ARM.extab.exit.text) *(.ARM.extab.exit.text)
#ifndef CONFIG_HOTPLUG_CPU ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))
*(.ARM.exidx.cpuexit.text) ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))
*(.ARM.extab.cpuexit.text)
#endif
#ifndef CONFIG_HOTPLUG #ifndef CONFIG_HOTPLUG
*(.ARM.exidx.devexit.text) *(.ARM.exidx.devexit.text)
*(.ARM.extab.devexit.text) *(.ARM.extab.devexit.text)
...@@ -100,6 +109,7 @@ SECTIONS ...@@ -100,6 +109,7 @@ SECTIONS
*(.glue_7) *(.glue_7)
*(.glue_7t) *(.glue_7t)
*(.got) /* Global offset table */ *(.got) /* Global offset table */
ARM_CPU_KEEP(PROC_INFO)
} }
RO_DATA(PAGE_SIZE) RO_DATA(PAGE_SIZE)
......
...@@ -430,7 +430,7 @@ ENTRY(cpu_arm1020_set_pte_ext) ...@@ -430,7 +430,7 @@ ENTRY(cpu_arm1020_set_pte_ext)
#endif /* CONFIG_MMU */ #endif /* CONFIG_MMU */
mov pc, lr mov pc, lr
__INIT __CPUINIT
.type __arm1020_setup, #function .type __arm1020_setup, #function
__arm1020_setup: __arm1020_setup:
......
...@@ -412,7 +412,7 @@ ENTRY(cpu_arm1020e_set_pte_ext) ...@@ -412,7 +412,7 @@ ENTRY(cpu_arm1020e_set_pte_ext)
#endif /* CONFIG_MMU */ #endif /* CONFIG_MMU */
mov pc, lr mov pc, lr
__INIT __CPUINIT
.type __arm1020e_setup, #function .type __arm1020e_setup, #function
__arm1020e_setup: __arm1020e_setup:
......
...@@ -394,7 +394,7 @@ ENTRY(cpu_arm1022_set_pte_ext) ...@@ -394,7 +394,7 @@ ENTRY(cpu_arm1022_set_pte_ext)
#endif /* CONFIG_MMU */ #endif /* CONFIG_MMU */
mov pc, lr mov pc, lr
__INIT __CPUINIT
.type __arm1022_setup, #function .type __arm1022_setup, #function
__arm1022_setup: __arm1022_setup:
......
...@@ -384,7 +384,7 @@ ENTRY(cpu_arm1026_set_pte_ext) ...@@ -384,7 +384,7 @@ ENTRY(cpu_arm1026_set_pte_ext)
mov pc, lr mov pc, lr
__INIT __CPUINIT
.type __arm1026_setup, #function .type __arm1026_setup, #function
__arm1026_setup: __arm1026_setup:
......
...@@ -238,7 +238,7 @@ ENTRY(cpu_arm7_reset) ...@@ -238,7 +238,7 @@ ENTRY(cpu_arm7_reset)
mcr p15, 0, r1, c1, c0, 0 @ turn off MMU etc mcr p15, 0, r1, c1, c0, 0 @ turn off MMU etc
mov pc, r0 mov pc, r0
__INIT __CPUINIT
.type __arm6_setup, #function .type __arm6_setup, #function
__arm6_setup: mov r0, #0 __arm6_setup: mov r0, #0
......
...@@ -113,7 +113,7 @@ ENTRY(cpu_arm720_reset) ...@@ -113,7 +113,7 @@ ENTRY(cpu_arm720_reset)
mcr p15, 0, ip, c1, c0, 0 @ ctrl register mcr p15, 0, ip, c1, c0, 0 @ ctrl register
mov pc, r0 mov pc, r0
__INIT __CPUINIT
.type __arm710_setup, #function .type __arm710_setup, #function
__arm710_setup: __arm710_setup:
......
...@@ -55,7 +55,7 @@ ENTRY(cpu_arm740_reset) ...@@ -55,7 +55,7 @@ ENTRY(cpu_arm740_reset)
mcr p15, 0, ip, c1, c0, 0 @ ctrl register mcr p15, 0, ip, c1, c0, 0 @ ctrl register
mov pc, r0 mov pc, r0
__INIT __CPUINIT
.type __arm740_setup, #function .type __arm740_setup, #function
__arm740_setup: __arm740_setup:
......
...@@ -46,7 +46,7 @@ ENTRY(cpu_arm7tdmi_proc_fin) ...@@ -46,7 +46,7 @@ ENTRY(cpu_arm7tdmi_proc_fin)
ENTRY(cpu_arm7tdmi_reset) ENTRY(cpu_arm7tdmi_reset)
mov pc, r0 mov pc, r0
__INIT __CPUINIT
.type __arm7tdmi_setup, #function .type __arm7tdmi_setup, #function
__arm7tdmi_setup: __arm7tdmi_setup:
......
...@@ -375,7 +375,7 @@ ENTRY(cpu_arm920_set_pte_ext) ...@@ -375,7 +375,7 @@ ENTRY(cpu_arm920_set_pte_ext)
#endif #endif
mov pc, lr mov pc, lr
__INIT __CPUINIT
.type __arm920_setup, #function .type __arm920_setup, #function
__arm920_setup: __arm920_setup:
......
...@@ -379,7 +379,7 @@ ENTRY(cpu_arm922_set_pte_ext) ...@@ -379,7 +379,7 @@ ENTRY(cpu_arm922_set_pte_ext)
#endif /* CONFIG_MMU */ #endif /* CONFIG_MMU */
mov pc, lr mov pc, lr
__INIT __CPUINIT
.type __arm922_setup, #function .type __arm922_setup, #function
__arm922_setup: __arm922_setup:
......
...@@ -428,7 +428,7 @@ ENTRY(cpu_arm925_set_pte_ext) ...@@ -428,7 +428,7 @@ ENTRY(cpu_arm925_set_pte_ext)
#endif /* CONFIG_MMU */ #endif /* CONFIG_MMU */
mov pc, lr mov pc, lr
__INIT __CPUINIT
.type __arm925_setup, #function .type __arm925_setup, #function
__arm925_setup: __arm925_setup:
......
...@@ -389,7 +389,7 @@ ENTRY(cpu_arm926_set_pte_ext) ...@@ -389,7 +389,7 @@ ENTRY(cpu_arm926_set_pte_ext)
#endif #endif
mov pc, lr mov pc, lr
__INIT __CPUINIT
.type __arm926_setup, #function .type __arm926_setup, #function
__arm926_setup: __arm926_setup:
......
...@@ -264,7 +264,7 @@ ENTRY(arm940_cache_fns) ...@@ -264,7 +264,7 @@ ENTRY(arm940_cache_fns)
.long arm940_dma_unmap_area .long arm940_dma_unmap_area
.long arm940_dma_flush_range .long arm940_dma_flush_range
__INIT __CPUINIT
.type __arm940_setup, #function .type __arm940_setup, #function
__arm940_setup: __arm940_setup:
......
...@@ -317,7 +317,7 @@ ENTRY(cpu_arm946_dcache_clean_area) ...@@ -317,7 +317,7 @@ ENTRY(cpu_arm946_dcache_clean_area)
mcr p15, 0, r0, c7, c10, 4 @ drain WB mcr p15, 0, r0, c7, c10, 4 @ drain WB
mov pc, lr mov pc, lr
__INIT __CPUINIT
.type __arm946_setup, #function .type __arm946_setup, #function
__arm946_setup: __arm946_setup:
......
...@@ -46,7 +46,7 @@ ENTRY(cpu_arm9tdmi_proc_fin) ...@@ -46,7 +46,7 @@ ENTRY(cpu_arm9tdmi_proc_fin)
ENTRY(cpu_arm9tdmi_reset) ENTRY(cpu_arm9tdmi_reset)
mov pc, r0 mov pc, r0
__INIT __CPUINIT
.type __arm9tdmi_setup, #function .type __arm9tdmi_setup, #function
__arm9tdmi_setup: __arm9tdmi_setup:
......
...@@ -134,7 +134,7 @@ ENTRY(cpu_fa526_set_pte_ext) ...@@ -134,7 +134,7 @@ ENTRY(cpu_fa526_set_pte_ext)
#endif #endif
mov pc, lr mov pc, lr
__INIT __CPUINIT
.type __fa526_setup, #function .type __fa526_setup, #function
__fa526_setup: __fa526_setup:
......
...@@ -494,7 +494,7 @@ ENTRY(cpu_feroceon_set_pte_ext) ...@@ -494,7 +494,7 @@ ENTRY(cpu_feroceon_set_pte_ext)
#endif #endif
mov pc, lr mov pc, lr
__INIT __CPUINIT
.type __feroceon_setup, #function .type __feroceon_setup, #function
__feroceon_setup: __feroceon_setup:
......
...@@ -338,7 +338,7 @@ ENTRY(cpu_mohawk_set_pte_ext) ...@@ -338,7 +338,7 @@ ENTRY(cpu_mohawk_set_pte_ext)
mcr p15, 0, r0, c7, c10, 4 @ drain WB mcr p15, 0, r0, c7, c10, 4 @ drain WB
mov pc, lr mov pc, lr
__INIT __CPUINIT
.type __mohawk_setup, #function .type __mohawk_setup, #function
__mohawk_setup: __mohawk_setup:
......
...@@ -156,7 +156,7 @@ ENTRY(cpu_sa110_set_pte_ext) ...@@ -156,7 +156,7 @@ ENTRY(cpu_sa110_set_pte_ext)
#endif #endif
mov pc, lr mov pc, lr
__INIT __CPUINIT
.type __sa110_setup, #function .type __sa110_setup, #function
__sa110_setup: __sa110_setup:
......
...@@ -169,7 +169,7 @@ ENTRY(cpu_sa1100_set_pte_ext) ...@@ -169,7 +169,7 @@ ENTRY(cpu_sa1100_set_pte_ext)
#endif #endif
mov pc, lr mov pc, lr
__INIT __CPUINIT
.type __sa1100_setup, #function .type __sa1100_setup, #function
__sa1100_setup: __sa1100_setup:
......
...@@ -137,7 +137,7 @@ cpu_pj4_name: ...@@ -137,7 +137,7 @@ cpu_pj4_name:
.align .align
__INIT __CPUINIT
/* /*
* __v6_setup * __v6_setup
...@@ -192,6 +192,8 @@ __v6_setup: ...@@ -192,6 +192,8 @@ __v6_setup:
v6_crval: v6_crval:
crval clear=0x01e0fb7f, mmuset=0x00c0387d, ucset=0x00c0187c crval clear=0x01e0fb7f, mmuset=0x00c0387d, ucset=0x00c0187c
__INITDATA
.type v6_processor_functions, #object .type v6_processor_functions, #object
ENTRY(v6_processor_functions) ENTRY(v6_processor_functions)
.word v6_early_abort .word v6_early_abort
...@@ -205,6 +207,8 @@ ENTRY(v6_processor_functions) ...@@ -205,6 +207,8 @@ ENTRY(v6_processor_functions)
.word cpu_v6_set_pte_ext .word cpu_v6_set_pte_ext
.size v6_processor_functions, . - v6_processor_functions .size v6_processor_functions, . - v6_processor_functions
.section ".rodata"
.type cpu_arch_name, #object .type cpu_arch_name, #object
cpu_arch_name: cpu_arch_name:
.asciz "armv6" .asciz "armv6"
......
...@@ -169,7 +169,7 @@ cpu_v7_name: ...@@ -169,7 +169,7 @@ cpu_v7_name:
.ascii "ARMv7 Processor" .ascii "ARMv7 Processor"
.align .align
__INIT __CPUINIT
/* /*
* __v7_setup * __v7_setup
...@@ -297,6 +297,8 @@ v7_crval: ...@@ -297,6 +297,8 @@ v7_crval:
__v7_setup_stack: __v7_setup_stack:
.space 4 * 11 @ 11 registers .space 4 * 11 @ 11 registers
__INITDATA
.type v7_processor_functions, #object .type v7_processor_functions, #object
ENTRY(v7_processor_functions) ENTRY(v7_processor_functions)
.word v7_early_abort .word v7_early_abort
...@@ -310,6 +312,8 @@ ENTRY(v7_processor_functions) ...@@ -310,6 +312,8 @@ ENTRY(v7_processor_functions)
.word cpu_v7_set_pte_ext .word cpu_v7_set_pte_ext
.size v7_processor_functions, . - v7_processor_functions .size v7_processor_functions, . - v7_processor_functions
.section ".rodata"
.type cpu_arch_name, #object .type cpu_arch_name, #object
cpu_arch_name: cpu_arch_name:
.asciz "armv7" .asciz "armv7"
......
...@@ -404,7 +404,7 @@ ENTRY(cpu_xsc3_set_pte_ext) ...@@ -404,7 +404,7 @@ ENTRY(cpu_xsc3_set_pte_ext)
.align .align
__INIT __CPUINIT
.type __xsc3_setup, #function .type __xsc3_setup, #function
__xsc3_setup: __xsc3_setup:
......
...@@ -506,7 +506,7 @@ ENTRY(cpu_xscale_set_pte_ext) ...@@ -506,7 +506,7 @@ ENTRY(cpu_xscale_set_pte_ext)
.align .align
__INIT __CPUINIT
.type __xscale_setup, #function .type __xscale_setup, #function
__xscale_setup: __xscale_setup:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment