x86/PCI: Make pci=earlydump output neat
PATCH 1/1 x86/PCI: Make pci=earlydump output neat
Currently the early dump of PCI configuration space looks quite unhelpful, e.g.
[ 0.000000] 60: [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000]
which makes really hard to get anything out of this. Convert the function to use print_hex_dump() to make output neat.
In the result we will have
[ 0.000000] 00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
which is much, much better.
Signed-off-by Andy Shevchenko <[email protected]>
--- arch/x86/pci/early.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)
arch/x86/pci/early.c +5 -14
@@ -59,24 +59,15 @@ int early_pci_allowed(void)void early_dump_pci_device (u8 bus,u8 slot,u8 func) { +u32 value[256 /4 ];int i; -int j; -u32 val; -printk (KERN_INFO "pci 0000:%02x:%02x.%d config space:" , - bus, slot, func); +pr_info ("pci 0000:%02x:%02x.%d config space:\n" , bus, slot, func); -for (i =0 ; i <256 ; i +=4 ) { -if (!(i &0x0f )) -printk ("\n %02x:" ,i); +for (i =0 ; i <256 ; i +=4 ) + value[i/4 ] =read_pci_config (bus, slot, func, i); - val =read_pci_config (bus, slot, func, i); -for (j =0 ; j <4 ; j++) { -printk (" %02x" , val &0xff ); - val >>=8 ; - } - } -printk ("\n" ); +print_hex_dump (KERN_INFO ,"" ,DUMP_PREFIX_OFFSET ,16 ,1 , value,256 , false); }void early_dump_pci_devices (void )
Signature · 1 line
2.16.3
Quoted 47 lines · Andy Shevchenko
Currently the early dump of PCI configuration space looks quite unhelpful, e.g.
[ 0.000000] 60: [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000] 00 [ 0.000000]which makes really hard to get anything out of this. Convert the function to use
print_hex_dump()to make output neat.In the result we will have
[ 0.000000] 00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00which is much, much better.
Signed-off-by Andy Shevchenko <[email protected]>--- arch/x86/pci/early.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)arch/x86/pci/early.c +1
-2@@ -59,24 +59,15 @@ int early_pci_allowed(void)void early_dump_pci_device (u8 bus,u8 slot,u8 func) { +u32 value[256 /4 ];int i; -int j; -u32 val;
arch/x86/pci/early.c int early_pci_allowed(void) · line 68
Quoted 10 lines
arch/x86/pci/early.c +3
-5-printk (KERN_INFO "pci 0000:%02x:%02x.%d config space:" , - bus, slot, func); +pr_info ("pci 0000:%02x:%02x.%d config space:\n" , bus, slot, func); -for (i =0 ; i <256 ; i +=4 ) { -if (!(i &0x0f )) -printk ("\n %02x:" ,i); +for (i =0 ; i <256 ; i +=4 ) + value[i/4 ] =read_pci_config (bus, slot, func, i);
Please be consistent with your use of whitespace: 256 / 4 vs. i/4.
Other than that looks good and certainly is an improvement,
Reviewed-by Mika Westerberg <[email protected]>