Commit 0f44ba1d authored by Russell King's avatar Russell King Committed by Russell King

[ARM] Move read of processor ID out of lookup_processor_type()

Read the processor ID at boot, and save it in "processor_id" as we
did before.  Later, when we re-parse the CPU type in the setup.c code,
re-use the value stored in "processor_id".

This allows a cleaner work-around for noMMU devices without CP#15.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent fb1c7762
...@@ -82,6 +82,7 @@ ...@@ -82,6 +82,7 @@
ENTRY(stext) ENTRY(stext)
msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | MODE_SVC @ ensure svc mode msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | MODE_SVC @ ensure svc mode
@ and irqs disabled @ and irqs disabled
mrc p15, 0, r9, c0, c0 @ get processor id
bl __lookup_processor_type @ r5=procinfo r9=cpuid bl __lookup_processor_type @ r5=procinfo r9=cpuid
movs r10, r5 @ invalid processor (r5=0)? movs r10, r5 @ invalid processor (r5=0)?
beq __error_p @ yes, error 'p' beq __error_p @ yes, error 'p'
...@@ -156,6 +157,7 @@ ENTRY(secondary_startup) ...@@ -156,6 +157,7 @@ ENTRY(secondary_startup)
* as it has already been validated by the primary processor. * as it has already been validated by the primary processor.
*/ */
msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | MODE_SVC msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | MODE_SVC
mrc p15, 0, r9, c0, c0 @ get processor id
bl __lookup_processor_type bl __lookup_processor_type
movs r10, r5 @ invalid processor? movs r10, r5 @ invalid processor?
moveq r0, #'p' @ yes, error 'p' moveq r0, #'p' @ yes, error 'p'
...@@ -450,19 +452,19 @@ __error: ...@@ -450,19 +452,19 @@ __error:
* (and therefore, we are not in the correct address space). We have to * (and therefore, we are not in the correct address space). We have to
* calculate the offset. * calculate the offset.
* *
* r9 = cpuid
* Returns: * Returns:
* r3, r4, r6 corrupted * r3, r4, r6 corrupted
* r5 = proc_info pointer in physical address space * r5 = proc_info pointer in physical address space
* r9 = cpuid * r9 = cpuid (preserved)
*/ */
.type __lookup_processor_type, %function .type __lookup_processor_type, %function
__lookup_processor_type: __lookup_processor_type:
adr r3, 3f adr r3, 3f
ldmda r3, {r5, r6, r9} ldmda r3, {r5 - r7}
sub r3, r3, r9 @ get offset between virt&phys sub r3, r3, r7 @ get offset between virt&phys
add r5, r5, r3 @ convert virt addresses to add r5, r5, r3 @ convert virt addresses to
add r6, r6, r3 @ physical address space add r6, r6, r3 @ physical address space
mrc p15, 0, r9, c0, c0 @ get processor id
1: ldmia r5, {r3, r4} @ value, mask 1: ldmia r5, {r3, r4} @ value, mask
and r4, r4, r9 @ mask wanted bits and r4, r4, r9 @ mask wanted bits
teq r3, r4 teq r3, r4
...@@ -477,10 +479,11 @@ __lookup_processor_type: ...@@ -477,10 +479,11 @@ __lookup_processor_type:
* This provides a C-API version of the above function. * This provides a C-API version of the above function.
*/ */
ENTRY(lookup_processor_type) ENTRY(lookup_processor_type)
stmfd sp!, {r4 - r6, r9, lr} stmfd sp!, {r4 - r7, r9, lr}
mov r9, r0
bl __lookup_processor_type bl __lookup_processor_type
mov r0, r5 mov r0, r5
ldmfd sp!, {r4 - r6, r9, pc} ldmfd sp!, {r4 - r7, r9, pc}
/* /*
* Look in include/asm-arm/procinfo.h and arch/arm/kernel/arch.[ch] for * Look in include/asm-arm/procinfo.h and arch/arm/kernel/arch.[ch] for
......
...@@ -278,7 +278,7 @@ int cpu_architecture(void) ...@@ -278,7 +278,7 @@ int cpu_architecture(void)
* These functions re-use the assembly code in head.S, which * These functions re-use the assembly code in head.S, which
* already provide the required functionality. * already provide the required functionality.
*/ */
extern struct proc_info_list *lookup_processor_type(void); extern struct proc_info_list *lookup_processor_type(unsigned int);
extern struct machine_desc *lookup_machine_type(unsigned int); extern struct machine_desc *lookup_machine_type(unsigned int);
static void __init setup_processor(void) static void __init setup_processor(void)
...@@ -290,7 +290,7 @@ static void __init setup_processor(void) ...@@ -290,7 +290,7 @@ static void __init setup_processor(void)
* types. The linker builds this table for us from the * types. The linker builds this table for us from the
* entries in arch/arm/mm/proc-*.S * entries in arch/arm/mm/proc-*.S
*/ */
list = lookup_processor_type(); list = lookup_processor_type(processor_id);
if (!list) { if (!list) {
printk("CPU configuration botched (ID %08x), unable " printk("CPU configuration botched (ID %08x), unable "
"to continue.\n", processor_id); "to continue.\n", processor_id);
......
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