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