x86: Fix printk call in print_local_apic()

Instead of this:

[   75.690022] <7>printing local APIC contents on CPU#0/0:
[   75.704406] ... APIC ID:      00000000 (0)
[   75.707905] ... APIC VERSION: 00060015
[   75.722551] ... APIC TASKPRI: 00000000 (00)
[   75.725473] ... APIC PROCPRI: 00000000
[   75.728592] ... APIC LDR: 00000001
[   75.742137] ... APIC SPIV: 000001ff
[   75.744101] ... APIC ISR field:
[   75.746648] 0123456789abcdef0123456789abcdef
[   75.746649] <7>00000000000000000000000000000000

Improve the code to be saner and simpler and just print out
the bitfield in a single line using hexa values - not as a
(rather pointless) binary bitfield.

Partially reused Linus's initial fix for this.

Reported-and-Tested-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <4A4C43BC.90506@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Ingo Molnar 2009-07-02 08:54:01 +02:00
parent 76c06927f2
commit 251e1e44b9

View File

@ -1716,25 +1716,19 @@ __apicdebuginit(void) print_IO_APIC(void)
return; return;
} }
__apicdebuginit(void) print_APIC_bitfield(int base) __apicdebuginit(void) print_APIC_field(int base)
{ {
unsigned int v; int i;
int i, j;
if (apic_verbosity == APIC_QUIET) if (apic_verbosity == APIC_QUIET)
return; return;
printk(KERN_DEBUG "0123456789abcdef0123456789abcdef\n" KERN_DEBUG); printk(KERN_DEBUG);
for (i = 0; i < 8; i++) {
v = apic_read(base + i*0x10); for (i = 0; i < 8; i++)
for (j = 0; j < 32; j++) { printk(KERN_CONT "%08x", apic_read(base + i*0x10));
if (v & (1<<j))
printk("1"); printk(KERN_CONT "\n");
else
printk("0");
}
printk("\n");
}
} }
__apicdebuginit(void) print_local_APIC(void *dummy) __apicdebuginit(void) print_local_APIC(void *dummy)
@ -1745,7 +1739,8 @@ __apicdebuginit(void) print_local_APIC(void *dummy)
if (apic_verbosity == APIC_QUIET) if (apic_verbosity == APIC_QUIET)
return; return;
printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n", printk(KERN_DEBUG "\n");
printk(KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n",
smp_processor_id(), hard_smp_processor_id()); smp_processor_id(), hard_smp_processor_id());
v = apic_read(APIC_ID); v = apic_read(APIC_ID);
printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, read_apic_id()); printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, read_apic_id());
@ -1786,11 +1781,11 @@ __apicdebuginit(void) print_local_APIC(void *dummy)
printk(KERN_DEBUG "... APIC SPIV: %08x\n", v); printk(KERN_DEBUG "... APIC SPIV: %08x\n", v);
printk(KERN_DEBUG "... APIC ISR field:\n"); printk(KERN_DEBUG "... APIC ISR field:\n");
print_APIC_bitfield(APIC_ISR); print_APIC_field(APIC_ISR);
printk(KERN_DEBUG "... APIC TMR field:\n"); printk(KERN_DEBUG "... APIC TMR field:\n");
print_APIC_bitfield(APIC_TMR); print_APIC_field(APIC_TMR);
printk(KERN_DEBUG "... APIC IRR field:\n"); printk(KERN_DEBUG "... APIC IRR field:\n");
print_APIC_bitfield(APIC_IRR); print_APIC_field(APIC_IRR);
if (APIC_INTEGRATED(ver)) { /* !82489DX */ if (APIC_INTEGRATED(ver)) { /* !82489DX */
if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */ if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */