[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: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Russell King and committed by
Russell King
0f44ba1d fb1c7762

+11 -8
+9 -6
arch/arm/kernel/head.S
··· 82 ENTRY(stext) 83 msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | MODE_SVC @ ensure svc mode 84 @ and irqs disabled 85 bl __lookup_processor_type @ r5=procinfo r9=cpuid 86 movs r10, r5 @ invalid processor (r5=0)? 87 beq __error_p @ yes, error 'p' ··· 157 * as it has already been validated by the primary processor. 158 */ 159 msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | MODE_SVC 160 bl __lookup_processor_type 161 movs r10, r5 @ invalid processor? 162 moveq r0, #'p' @ yes, error 'p' ··· 452 * (and therefore, we are not in the correct address space). We have to 453 * calculate the offset. 454 * 455 * Returns: 456 * r3, r4, r6 corrupted 457 * r5 = proc_info pointer in physical address space 458 - * r9 = cpuid 459 */ 460 .type __lookup_processor_type, %function 461 __lookup_processor_type: 462 adr r3, 3f 463 - ldmda r3, {r5, r6, r9} 464 - sub r3, r3, r9 @ get offset between virt&phys 465 add r5, r5, r3 @ convert virt addresses to 466 add r6, r6, r3 @ physical address space 467 - mrc p15, 0, r9, c0, c0 @ get processor id 468 1: ldmia r5, {r3, r4} @ value, mask 469 and r4, r4, r9 @ mask wanted bits 470 teq r3, r4 ··· 479 * This provides a C-API version of the above function. 480 */ 481 ENTRY(lookup_processor_type) 482 - stmfd sp!, {r4 - r6, r9, lr} 483 bl __lookup_processor_type 484 mov r0, r5 485 - ldmfd sp!, {r4 - r6, r9, pc} 486 487 /* 488 * Look in include/asm-arm/procinfo.h and arch/arm/kernel/arch.[ch] for
··· 82 ENTRY(stext) 83 msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | MODE_SVC @ ensure svc mode 84 @ and irqs disabled 85 + mrc p15, 0, r9, c0, c0 @ get processor id 86 bl __lookup_processor_type @ r5=procinfo r9=cpuid 87 movs r10, r5 @ invalid processor (r5=0)? 88 beq __error_p @ yes, error 'p' ··· 156 * as it has already been validated by the primary processor. 157 */ 158 msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | MODE_SVC 159 + mrc p15, 0, r9, c0, c0 @ get processor id 160 bl __lookup_processor_type 161 movs r10, r5 @ invalid processor? 162 moveq r0, #'p' @ yes, error 'p' ··· 450 * (and therefore, we are not in the correct address space). We have to 451 * calculate the offset. 452 * 453 + * r9 = cpuid 454 * Returns: 455 * r3, r4, r6 corrupted 456 * r5 = proc_info pointer in physical address space 457 + * r9 = cpuid (preserved) 458 */ 459 .type __lookup_processor_type, %function 460 __lookup_processor_type: 461 adr r3, 3f 462 + ldmda r3, {r5 - r7} 463 + sub r3, r3, r7 @ get offset between virt&phys 464 add r5, r5, r3 @ convert virt addresses to 465 add r6, r6, r3 @ physical address space 466 1: ldmia r5, {r3, r4} @ value, mask 467 and r4, r4, r9 @ mask wanted bits 468 teq r3, r4 ··· 477 * This provides a C-API version of the above function. 478 */ 479 ENTRY(lookup_processor_type) 480 + stmfd sp!, {r4 - r7, r9, lr} 481 + mov r9, r0 482 bl __lookup_processor_type 483 mov r0, r5 484 + ldmfd sp!, {r4 - r7, r9, pc} 485 486 /* 487 * Look in include/asm-arm/procinfo.h and arch/arm/kernel/arch.[ch] for
+2 -2
arch/arm/kernel/setup.c
··· 278 * These functions re-use the assembly code in head.S, which 279 * already provide the required functionality. 280 */ 281 - extern struct proc_info_list *lookup_processor_type(void); 282 extern struct machine_desc *lookup_machine_type(unsigned int); 283 284 static void __init setup_processor(void) ··· 290 * types. The linker builds this table for us from the 291 * entries in arch/arm/mm/proc-*.S 292 */ 293 - list = lookup_processor_type(); 294 if (!list) { 295 printk("CPU configuration botched (ID %08x), unable " 296 "to continue.\n", processor_id);
··· 278 * These functions re-use the assembly code in head.S, which 279 * already provide the required functionality. 280 */ 281 + extern struct proc_info_list *lookup_processor_type(unsigned int); 282 extern struct machine_desc *lookup_machine_type(unsigned int); 283 284 static void __init setup_processor(void) ··· 290 * types. The linker builds this table for us from the 291 * entries in arch/arm/mm/proc-*.S 292 */ 293 + list = lookup_processor_type(processor_id); 294 if (!list) { 295 printk("CPU configuration botched (ID %08x), unable " 296 "to continue.\n", processor_id);