[PATCH 12/18] bios: mpdump: print format using inttypes and whitespace tidy
IvanHu
ivan.hu at canonical.com
Tue Oct 2 02:34:48 UTC 2012
On 09/24/2012 03:03 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/bios/multiproc/mpdump.c | 235 ++++++++++++++++++++++++++-----------------
> 1 file changed, 141 insertions(+), 94 deletions(-)
>
> diff --git a/src/bios/multiproc/mpdump.c b/src/bios/multiproc/mpdump.c
> index ce3fa68..b1d8f0f 100644
> --- a/src/bios/multiproc/mpdump.c
> +++ b/src/bios/multiproc/mpdump.c
> @@ -16,6 +16,8 @@
> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
> *
> */
> +#include <inttypes.h>
> +
> #include "fwts.h"
>
> #ifdef FWTS_ARCH_INTEL
> @@ -68,15 +70,15 @@ static const char *mpdump_yes_no[] = {
>
> static void mpdump_dump_header(fwts_framework *fw, fwts_mp_config_table_header *header, uint32_t phys_addr)
> {
> - fwts_log_info_verbatum(fw,"MultiProcessor Header: (@0x%8.8x)", phys_addr);
> - fwts_log_info_verbatum(fw," Signature: %4.4s\n", header->signature);
> - fwts_log_info_verbatum(fw," Table Length: 0x%x bytes\n", header->base_table_length);
> - fwts_log_info_verbatum(fw," Spec Revision: %d (1.%d)\n", header->spec_rev, header->spec_rev);
> - fwts_log_info_verbatum(fw," OEM ID: %8.8s\n", header->oem_id);
> - fwts_log_info_verbatum(fw," Product ID: %12.12s\n", header->product_id);
> - fwts_log_info_verbatum(fw," Entry Count: 0x%x\n", header->entry_count);
> - fwts_log_info_verbatum(fw," LAPIC Address: 0x%8.8x\n", header->lapic_address);
> - fwts_log_info_verbatum(fw," Extended Length: 0x%x bytes\n", header->extended_table_length);
> + fwts_log_info_verbatum(fw,"MultiProcessor Header: (@0x%8.8" PRIx32 ")", phys_addr);
> + fwts_log_info_verbatum(fw," Signature: %4.4s", header->signature);
> + fwts_log_info_verbatum(fw," Table Length: 0x%" PRIx16 " bytes", header->base_table_length);
> + fwts_log_info_verbatum(fw," Spec Revision: %" PRId8 " (1.%" PRId8 ")", header->spec_rev, header->spec_rev);
> + fwts_log_info_verbatum(fw," OEM ID: %8.8s", header->oem_id);
> + fwts_log_info_verbatum(fw," Product ID: %12.12s", header->product_id);
> + fwts_log_info_verbatum(fw," Entry Count: 0x%" PRIx16, header->entry_count);
> + fwts_log_info_verbatum(fw," LAPIC Address: 0x%8.8" PRIx32, header->lapic_address);
> + fwts_log_info_verbatum(fw," Extended Length: 0x%" PRIx16 " bytes", header->extended_table_length);
> fwts_log_nl(fw);
> }
>
> @@ -84,31 +86,37 @@ static void mpdump_dump_cpu_entry(fwts_framework *fw, void *data, uint32_t phys_
> {
> fwts_mp_processor_entry *cpu_entry = (fwts_mp_processor_entry *)data;
>
> - fwts_log_info_verbatum(fw, "CPU Entry: (@0x%8.8x)", phys_addr);
> - fwts_log_info_verbatum(fw, " Local APIC ID: 0x%2.2x", cpu_entry->local_apic_id);
> - fwts_log_info_verbatum(fw, " Local APIC Version: 0x%2.2x", cpu_entry->local_apic_version);
> - fwts_log_info_verbatum(fw, " CPU Flags: 0x%2.2x", cpu_entry->cpu_flags);
> - fwts_log_info_verbatum(fw, " Usable: %1.1d (%s)",
> - cpu_entry->cpu_flags & 1,
> + fwts_log_info_verbatum(fw, "CPU Entry: (@0x%8.8" PRIx32 ")", phys_addr);
> + fwts_log_info_verbatum(fw, " Local APIC ID: 0x%2.2" PRIx8,
> + cpu_entry->local_apic_id);
> + fwts_log_info_verbatum(fw, " Local APIC Version: 0x%2.2" PRIx8,
> + cpu_entry->local_apic_version);
> + fwts_log_info_verbatum(fw, " CPU Flags: 0x%2.2" PRIx8,
> + cpu_entry->cpu_flags);
> + fwts_log_info_verbatum(fw, " Usable: %1.1" PRId8 " (%s)",
> + cpu_entry->cpu_flags & 1,
> mpdump_yes_no[cpu_entry->cpu_flags & 1]);
> - fwts_log_info_verbatum(fw, " Bootstrap CPU: %1.1d (%s)",
> + fwts_log_info_verbatum(fw, " Bootstrap CPU: %1.1" PRId8 " (%s)",
> (cpu_entry->cpu_flags >> 1) & 1,
> mpdump_yes_no[(cpu_entry->cpu_flags >> 1) & 1]);
> fwts_log_info_verbatum(fw, " CPU Signature:");
> - fwts_log_info_verbatum(fw, " Stepping: 0x%2.2x", cpu_entry->cpu_signature & 0xf);
> - fwts_log_info_verbatum(fw, " Model: 0x%2.2x", (cpu_entry->cpu_signature >> 4) & 0xf);
> - fwts_log_info_verbatum(fw, " Family: 0x%2.2x", (cpu_entry->cpu_signature >> 8) & 0xf);
> + fwts_log_info_verbatum(fw, " Stepping: 0x%2.2" PRIx32,
> + cpu_entry->cpu_signature & 0xf);
> + fwts_log_info_verbatum(fw, " Model: 0x%2.2" PRIx32,
> + (cpu_entry->cpu_signature >> 4) & 0xf);
> + fwts_log_info_verbatum(fw, " Family: 0x%2.2" PRIx32,
> + (cpu_entry->cpu_signature >> 8) & 0xf);
> fwts_log_info_verbatum(fw, " Feature Flags:");
> - fwts_log_info_verbatum(fw, " FPU present: %1.1d (%s)",
> + fwts_log_info_verbatum(fw, " FPU present: %1.1" PRId32 " (%s)",
> (cpu_entry->feature_flags) & 1,
> mpdump_yes_no[(cpu_entry->feature_flags) & 1]);
> - fwts_log_info_verbatum(fw, " MCE: %1.1d (%s)",
> + fwts_log_info_verbatum(fw, " MCE: %1.1" PRId32 " (%s)",
> (cpu_entry->feature_flags >> 7) & 1,
> mpdump_yes_no[(cpu_entry->feature_flags >> 7) & 1]);
> - fwts_log_info_verbatum(fw, " CPMPXCHG8B: %1.1d (%s)",
> + fwts_log_info_verbatum(fw, " CPMPXCHG8B: %1.1" PRId32 " (%s)",
> (cpu_entry->feature_flags >> 8) & 1,
> mpdump_yes_no[(cpu_entry->feature_flags >> 8) & 1]);
> - fwts_log_info_verbatum(fw, " APIC enabled: %1.1d (%s)",
> + fwts_log_info_verbatum(fw, " APIC enabled: %1.1" PRId32 " (%s)",
> (cpu_entry->feature_flags >> 9) & 1,
> mpdump_yes_no[(cpu_entry->feature_flags >> 9) & 1]);
> fwts_log_nl(fw);
> @@ -118,9 +126,11 @@ static void mpdump_dump_bus_entry(fwts_framework *fw, void *data, uint32_t phys_
> {
> fwts_mp_bus_entry *bus_entry = (fwts_mp_bus_entry *)data;
>
> - fwts_log_info_verbatum(fw, "Bus Entry: (@0x%8.8x)", phys_addr);
> - fwts_log_info_verbatum(fw, " Bus ID: 0x%2.2x", bus_entry->bus_id);
> - fwts_log_info_verbatum(fw, " Bus Type: %6.6s", bus_entry->bus_type);
> + fwts_log_info_verbatum(fw, "Bus Entry: (@0x%8.8" PRIx32 ")", phys_addr);
> + fwts_log_info_verbatum(fw, " Bus ID: 0x%2.2" PRIx8,
> + bus_entry->bus_id);
> + fwts_log_info_verbatum(fw, " Bus Type: %6.6s",
> + bus_entry->bus_type);
> fwts_log_nl(fw);
> }
>
> @@ -128,11 +138,15 @@ static void mpdump_dump_io_apic_entry(fwts_framework *fw, void *data, uint32_t p
> {
> fwts_mp_io_apic_entry *io_apic_entry = (fwts_mp_io_apic_entry *)data;
>
> - fwts_log_info_verbatum(fw, "IO APIC Entry: (@0x%8.8x)", phys_addr);
> - fwts_log_info_verbatum(fw, " IO APIC ID: 0x%2.2x", io_apic_entry->id);
> - fwts_log_info_verbatum(fw, " IO APIC Version: 0x%2.2x", io_apic_entry->version);
> - fwts_log_info_verbatum(fw, " Flags: 0x%2.2x", io_apic_entry->flags);
> - fwts_log_info_verbatum(fw, " Address: 0x%8.8x", io_apic_entry->address);
> + fwts_log_info_verbatum(fw, "IO APIC Entry: (@0x%8.8" PRIx32 ")", phys_addr);
> + fwts_log_info_verbatum(fw, " IO APIC ID: 0x%2.2" PRIx8,
> + io_apic_entry->id);
> + fwts_log_info_verbatum(fw, " IO APIC Version: 0x%2.2" PRIx8,
> + io_apic_entry->version);
> + fwts_log_info_verbatum(fw, " Flags: 0x%2.2" PRIx8,
> + io_apic_entry->flags);
> + fwts_log_info_verbatum(fw, " Address: 0x%8.8" PRIx32,
> + io_apic_entry->address);
> fwts_log_nl(fw);
> }
>
> @@ -140,18 +154,28 @@ static void mpdump_dump_io_interrupt_entry(fwts_framework *fw, void *data, uint3
> {
> fwts_mp_io_interrupt_entry *io_interrupt_entry = (fwts_mp_io_interrupt_entry *)data;
>
> - fwts_log_info_verbatum(fw, "IO Interrupt Assignment Entry: (@0x%8.8x)", phys_addr);
> - fwts_log_info_verbatum(fw, " Interrupt Type: 0x%2.2x (%s)", io_interrupt_entry->type,
> - io_interrupt_entry->type < 4 ? mpdump_inttype[io_interrupt_entry->type] : "Unknown");
> - fwts_log_info_verbatum(fw, " Flags: 0x%4.4x", io_interrupt_entry->flags);
> - fwts_log_info_verbatum(fw, " PO (Polarity) %1.1d (%s)", io_interrupt_entry->flags & 2,
> + fwts_log_info_verbatum(fw, "IO Interrupt Assignment Entry: (@0x%8.8" PRIx32 ")",
> + phys_addr);
> + fwts_log_info_verbatum(fw, " Interrupt Type: 0x%2.2" PRIx8 " (%s)",
> + io_interrupt_entry->type,
> + io_interrupt_entry->type < 4 ?
> + mpdump_inttype[io_interrupt_entry->type] : "Unknown");
> + fwts_log_info_verbatum(fw, " Flags: 0x%4.4" PRIx16,
> + io_interrupt_entry->flags);
> + fwts_log_info_verbatum(fw, " PO (Polarity) %1.1" PRId16 " (%s)",
> + io_interrupt_entry->flags & 2,
> mpdump_po[io_interrupt_entry->flags & 2]);
> - fwts_log_info_verbatum(fw, " EL (Trigger) %1.1d (%s)", (io_interrupt_entry->flags >> 2) & 2,
> + fwts_log_info_verbatum(fw, " EL (Trigger) %1.1" PRId16 " (%s)",
> + (io_interrupt_entry->flags >> 2) & 2,
> mpdump_el[(io_interrupt_entry->flags >> 2) & 2]);
> - fwts_log_info_verbatum(fw, " Src Bus ID: 0x%2.2x", io_interrupt_entry->source_bus_id);
> - fwts_log_info_verbatum(fw, " Src Bus IRQ 0x%2.2x", io_interrupt_entry->source_bus_irq);
> - fwts_log_info_verbatum(fw, " Dst I/O APIC: 0x%2.2x", io_interrupt_entry->destination_io_apic_id);
> - fwts_log_info_verbatum(fw, " Dst I/O APIC INTIN: 0x%2.2x", io_interrupt_entry->destination_io_apic_intin);
> + fwts_log_info_verbatum(fw, " Src Bus ID: 0x%2.2" PRIx8,
> + io_interrupt_entry->source_bus_id);
> + fwts_log_info_verbatum(fw, " Src Bus IRQ 0x%2.2" PRIx8,
> + io_interrupt_entry->source_bus_irq);
> + fwts_log_info_verbatum(fw, " Dst I/O APIC: 0x%2.2" PRIx8,
> + io_interrupt_entry->destination_io_apic_id);
> + fwts_log_info_verbatum(fw, " Dst I/O APIC INTIN: 0x%2.2" PRIx8,
> + io_interrupt_entry->destination_io_apic_intin);
> fwts_log_nl(fw);
> }
>
> @@ -159,18 +183,28 @@ static void mpdump_dump_local_interrupt_entry(fwts_framework *fw, void *data, ui
> {
> fwts_mp_local_interrupt_entry *local_interrupt_entry = (fwts_mp_local_interrupt_entry *)data;
>
> - fwts_log_info_verbatum(fw, "Local Interrupt Assignement Entry: (@0x%8.8x)", phys_addr);
> - fwts_log_info_verbatum(fw, " Interrupt Type: 0x%2.2x (%s)", local_interrupt_entry->type,
> - local_interrupt_entry->type < 4 ? mpdump_inttype[local_interrupt_entry->type] : "Unknown");
> - fwts_log_info_verbatum(fw, " Flags: 0x%4.4x", local_interrupt_entry->flags);
> - fwts_log_info_verbatum(fw, " PO (Polarity) %1.1d (%s)", local_interrupt_entry->flags & 2,
> + fwts_log_info_verbatum(fw, "Local Interrupt Assignement Entry: (@0x%8.8" PRIx32 ")",
> + phys_addr);
> + fwts_log_info_verbatum(fw, " Interrupt Type: 0x%2.2" PRIx8 " (%s)",
> + local_interrupt_entry->type,
> + local_interrupt_entry->type < 4 ?
> + mpdump_inttype[local_interrupt_entry->type] : "Unknown");
> + fwts_log_info_verbatum(fw, " Flags: 0x%4.4" PRIx16,
> + local_interrupt_entry->flags);
> + fwts_log_info_verbatum(fw, " PO (Polarity) %1.1" PRId16 " (%s)",
> + local_interrupt_entry->flags & 2,
> mpdump_po[local_interrupt_entry->flags & 2]);
> - fwts_log_info_verbatum(fw, " EL (Trigger) %1.1d (%s)", (local_interrupt_entry->flags >> 2) & 2,
> + fwts_log_info_verbatum(fw, " EL (Trigger) %1.1" PRId16 " (%s)",
> + (local_interrupt_entry->flags >> 2) & 2,
> mpdump_el[(local_interrupt_entry->flags >> 2) & 2]);
> - fwts_log_info_verbatum(fw, " Src Bus ID: 0x%2.2x", local_interrupt_entry->source_bus_id);
> - fwts_log_info_verbatum(fw, " Src Bus IRQ 0x%2.2x", local_interrupt_entry->source_bus_irq);
> - fwts_log_info_verbatum(fw, " Dst I/O APIC: 0x%2.2x", local_interrupt_entry->destination_local_apic_id);
> - fwts_log_info_verbatum(fw, " Dst I/O APIC INTIN: 0x%2.2x", local_interrupt_entry->destination_local_apic_intin);
> + fwts_log_info_verbatum(fw, " Src Bus ID: 0x%2.2" PRIx8,
> + local_interrupt_entry->source_bus_id);
> + fwts_log_info_verbatum(fw, " Src Bus IRQ 0x%2.2" PRIx8,
> + local_interrupt_entry->source_bus_irq);
> + fwts_log_info_verbatum(fw, " Dst I/O APIC: 0x%2.2" PRIx8,
> + local_interrupt_entry->destination_local_apic_id);
> + fwts_log_info_verbatum(fw, " Dst I/O APIC INTIN: 0x%2.2" PRIx8,
> + local_interrupt_entry->destination_local_apic_intin);
> fwts_log_nl(fw);
> }
>
> @@ -178,16 +212,20 @@ static void mpdump_dump_sys_addr_entry(fwts_framework *fw, void *data, uint32_t
> {
> fwts_mp_system_address_space_entry *sys_addr_entry = (fwts_mp_system_address_space_entry *)data;
>
> - fwts_log_info_verbatum(fw, "System Address Space Mapping Entry: (@0x%8.8x)", phys_addr);
> - fwts_log_info_verbatum(fw, " Bus ID: 0x%2.2x", sys_addr_entry->bus_id);
> - fwts_log_info_verbatum(fw, " Address Type: 0x%2.2x (%s)", sys_addr_entry->address_type,
> - sys_addr_entry->address_type < 4 ? mpdump_sys_addr_type[sys_addr_entry->address_type] : "Unknown");
> - fwts_log_info_verbatum(fw, " Address Start: 0x%16.16llx",
> - (unsigned long long)sys_addr_entry->address_base);
> - fwts_log_info_verbatum(fw, " Address End: 0x%16.16llx",
> - (unsigned long long)sys_addr_entry->address_base + sys_addr_entry->address_length);
> - fwts_log_info_verbatum(fw, " Address Length 0x%16.16llx",
> - (unsigned long long)sys_addr_entry->address_length);
> + fwts_log_info_verbatum(fw, "System Address Space Mapping Entry: (@0x%8.8" PRIx32 ")",
> + phys_addr);
> + fwts_log_info_verbatum(fw, " Bus ID: 0x%2.2" PRIx8,
> + sys_addr_entry->bus_id);
> + fwts_log_info_verbatum(fw, " Address Type: 0x%2.2" PRIx8 " (%s)",
> + sys_addr_entry->address_type,
> + sys_addr_entry->address_type < 4 ?
> + mpdump_sys_addr_type[sys_addr_entry->address_type] : "Unknown");
> + fwts_log_info_verbatum(fw, " Address Start: 0x%16.16" PRIx64,
> + sys_addr_entry->address_base);
> + fwts_log_info_verbatum(fw, " Address End: 0x%16.16" PRIx64,
> + sys_addr_entry->address_base +sys_addr_entry->address_length);
> + fwts_log_info_verbatum(fw, " Address Length 0x%16.16" PRIx64,
> + sys_addr_entry->address_length);
> fwts_log_nl(fw);
> }
>
> @@ -195,10 +233,14 @@ static void mpdump_dump_bus_hierarchy_entry(fwts_framework *fw, void *data, uint
> {
> fwts_mp_bus_hierarchy_entry *bus_hierarchy_entry = (fwts_mp_bus_hierarchy_entry*)data;
>
> - fwts_log_info_verbatum(fw, "Bus Hierarchy Descriptor Entry: (@0x%8.8x)", phys_addr);
> - fwts_log_info_verbatum(fw, " Bus ID: 0x%2.2x", bus_hierarchy_entry->bus_id);
> - fwts_log_info_verbatum(fw, " Bus Information: 0x%1.1x", bus_hierarchy_entry->bus_info & 0xf);
> - fwts_log_info_verbatum(fw, " Parent Bus: 0x%8.8x", bus_hierarchy_entry->parent_bus);
> + fwts_log_info_verbatum(fw, "Bus Hierarchy Descriptor Entry: (@0x%8.8" PRIx32 ")",
> + phys_addr);
> + fwts_log_info_verbatum(fw, " Bus ID: 0x%2.2" PRIx8,
> + bus_hierarchy_entry->bus_id);
> + fwts_log_info_verbatum(fw, " Bus Information: 0x%1.1" PRIx8,
> + bus_hierarchy_entry->bus_info & 0xf);
> + fwts_log_info_verbatum(fw, " Parent Bus: 0x%2.2" PRIx8,
> + bus_hierarchy_entry->parent_bus);
> fwts_log_nl(fw);
> }
>
> @@ -206,17 +248,21 @@ static void multproc_dump_compat_bus_address_space_entry(fwts_framework *fw, voi
> {
> fwts_mp_compat_bus_address_space_entry *compat_bus_entry = (fwts_mp_compat_bus_address_space_entry*)data;
>
> - fwts_log_info_verbatum(fw, "Compatible Bus Hierarchy Descriptor Entry: (@0x%8.8x)", phys_addr);
> - fwts_log_info_verbatum(fw, " Bus ID: 0x%2.2x", compat_bus_entry->bus_id);
> - fwts_log_info_verbatum(fw, " Address Mod: 0x%2.2x", compat_bus_entry->address_mod);
> - fwts_log_info_verbatum(fw, " Predefine Range: 0x%8.8x", compat_bus_entry->range_list);
> + fwts_log_info_verbatum(fw, "Compatible Bus Hierarchy Descriptor Entry: (@0x%8.8" PRIx32 ")",
> + phys_addr);
> + fwts_log_info_verbatum(fw, " Bus ID: 0x%2.2" PRIx8,
> + compat_bus_entry->bus_id);
> + fwts_log_info_verbatum(fw, " Address Mod: 0x%2.2" PRIx8,
> + compat_bus_entry->address_mod);
> + fwts_log_info_verbatum(fw, " Predefine Range: 0x%8.8" PRIx32,
> + compat_bus_entry->range_list);
> fwts_log_nl(fw);
> }
>
> static fwts_mp_data mp_data;
>
> static int mpdump_init(fwts_framework *fw)
> -{
> +{
> if (fwts_mp_data_get(&mp_data) != FWTS_OK) {
> fwts_log_error(fw, "Failed to get _MP_ data from firmware.");
> return FWTS_SKIP;
> @@ -243,7 +289,7 @@ static void mpdump_dump_bus(fwts_framework *fw)
> fwts_list sorted;
>
> fwts_list_init(&sorted);
> -
> +
> fwts_list_foreach(entry, &mp_data.entries) {
> uint8_t *data = fwts_list_data(uint8_t *, entry);
> if (*data == FWTS_MP_BUS_ENTRY)
> @@ -254,7 +300,7 @@ static void mpdump_dump_bus(fwts_framework *fw)
> fwts_log_info_verbatum(fw, " ID Type");
> fwts_list_foreach(entry, &sorted) {
> fwts_mp_bus_entry *bus_entry = fwts_list_data(fwts_mp_bus_entry *, entry);
> - fwts_log_info_verbatum(fw, " %3d %6.6s",
> + fwts_log_info_verbatum(fw, " %3" PRId8 " %6.6s",
> bus_entry->bus_id, bus_entry->bus_type);
> }
> fwts_log_nl(fw);
> @@ -266,7 +312,7 @@ static int mpdump_compare_io_irq(void *data1, void *data2)
> fwts_mp_io_interrupt_entry *entry1 = (fwts_mp_io_interrupt_entry*)data1;
> fwts_mp_io_interrupt_entry *entry2 = (fwts_mp_io_interrupt_entry*)data2;
>
> - return (entry1->source_bus_irq + (entry1->source_bus_id * 256)) -
> + return (entry1->source_bus_irq + (entry1->source_bus_id * 256)) -
> (entry2->source_bus_irq + (entry2->source_bus_id * 256));
> }
>
> @@ -300,7 +346,7 @@ static char *mpdump_dst_io_apic(uint8_t apic)
> if (apic == 255)
> return "all";
> else {
> - snprintf(buffer, sizeof(buffer), "%d", apic);
> + snprintf(buffer, sizeof(buffer), "%" PRId8, apic);
> return buffer;
> }
> }
> @@ -308,7 +354,7 @@ static char *mpdump_dst_io_apic(uint8_t apic)
> static uint8_t mpdump_get_apic_id(void *data)
> {
> uint8_t *which = (uint8_t*)data;
> -
> +
> if (*which == FWTS_MP_CPU_ENTRY) {
> fwts_mp_processor_entry *cpu_entry = (fwts_mp_processor_entry *)data;
> return cpu_entry->local_apic_id;
> @@ -334,18 +380,18 @@ static void mpdump_dump_apics(fwts_framework *fw)
> fwts_list sorted;
>
> fwts_list_init(&sorted);
> -
> +
> fwts_list_foreach(entry, &mp_data.entries) {
> uint8_t *data = fwts_list_data(uint8_t *, entry);
> if ((*data == FWTS_MP_CPU_ENTRY) || (*data == FWTS_MP_IO_APIC_ENTRY))
> fwts_list_add_ordered(&sorted, data, mpdump_compare_apic_id);
> }
> -
> +
> fwts_log_info_verbatum(fw, "APIC IDs:");
> fwts_log_info_verbatum(fw, " ID Type");
> fwts_list_foreach(entry, &sorted) {
> uint8_t *data = fwts_list_data(uint8_t *, entry);
> - fwts_log_info_verbatum(fw, " %3d %s APIC",
> + fwts_log_info_verbatum(fw, " %3" PRId8 " %s APIC",
> mpdump_get_apic_id(data),
> (*data == FWTS_MP_CPU_ENTRY) ? "CPU Local" : "I/O");
> }
> @@ -366,18 +412,19 @@ static void mpdump_dump_irq_table(fwts_framework *fw)
> }
>
> fwts_log_info_verbatum(fw, "IO Interrupts:");
> - fwts_log_info_verbatum(fw, " Src Bus Src Bus Src Bus Dst I/O Dst I/O Type Polarity Trigger");
> + fwts_log_info_verbatum(fw, " Src Bus Src Bus Src Bus Dst I/O Dst I/O Type Polarity Trigger");
> fwts_log_info_verbatum(fw, " ID Type IRQ APIC APIC INTIN");
> fwts_list_foreach(entry, &sorted) {
> - fwts_mp_io_interrupt_entry *io_interrupt_entry =
> + fwts_mp_io_interrupt_entry *io_interrupt_entry =
> fwts_list_data(fwts_mp_io_interrupt_entry *, entry);
> - fwts_log_info_verbatum(fw, " %3d %-6.6s %3d %3.3s %3d %-6.6s %-7.7s %-7.7s",
> + fwts_log_info_verbatum(fw, " %3" PRId8 " %-6.6s %3" PRId8 " %3.3s %3" PRId8 " %-6.6s %-7.7s %-7.7s",
> io_interrupt_entry->source_bus_id,
> mpdump_find_bus_name(io_interrupt_entry->source_bus_id),
> - io_interrupt_entry->source_bus_irq,
> + io_interrupt_entry->source_bus_irq,
> mpdump_dst_io_apic(io_interrupt_entry->destination_io_apic_id),
> io_interrupt_entry->destination_io_apic_intin,
> - io_interrupt_entry->type < 4 ? mpdump_inttype[io_interrupt_entry->type] : "Unknown",
> + io_interrupt_entry->type < 4 ?
> + mpdump_inttype[io_interrupt_entry->type] : "Unknown",
> mpdump_po_short[io_interrupt_entry->flags & 2],
> mpdump_el_short[(io_interrupt_entry->flags >> 2) & 2]);
> }
> @@ -392,15 +439,15 @@ static void mpdump_dump_irq_table(fwts_framework *fw)
> }
>
> fwts_log_info_verbatum(fw, "Local Interrupts:");
> - fwts_log_info_verbatum(fw, " Src Bus Src Bus Src Bus Dst I/O Dst I/O Type Polarity Trigger");
> + fwts_log_info_verbatum(fw, " Src Bus Src Bus Src Bus Dst I/O Dst I/O Type Polarity Trigger");
> fwts_log_info_verbatum(fw, " ID Type IRQ APIC APIC INTIN");
> fwts_list_foreach(entry, &sorted) {
> - fwts_mp_local_interrupt_entry *local_interrupt_entry =
> + fwts_mp_local_interrupt_entry *local_interrupt_entry =
> fwts_list_data(fwts_mp_local_interrupt_entry *, entry);
> - fwts_log_info_verbatum(fw, " %3d %-6.6s %3d %3.3s %3d %-6.6s %-7.7s %-7.7s",
> + fwts_log_info_verbatum(fw, " %3" PRId8 " %-6.6s %3" PRId8 " %3.3s %3" PRId8 " %-6.6s %-7.7s %-7.7s",
> local_interrupt_entry->source_bus_id,
> mpdump_find_bus_name(local_interrupt_entry->source_bus_id),
> - local_interrupt_entry->source_bus_irq,
> + local_interrupt_entry->source_bus_irq,
> mpdump_dst_io_apic(local_interrupt_entry->destination_local_apic_id),
> local_interrupt_entry->destination_local_apic_intin,
> local_interrupt_entry->type < 4 ? mpdump_inttype[local_interrupt_entry->type] : "Unknown",
> @@ -417,9 +464,9 @@ static void mpdump_dump_irq_table(fwts_framework *fw)
> static int mpdump_compare_system_address_space(void *data1, void *data2)
> {
> int64_t diff;
> - fwts_mp_system_address_space_entry *sys_addr_entry1 =
> + fwts_mp_system_address_space_entry *sys_addr_entry1 =
> (fwts_mp_system_address_space_entry *)data1;
> - fwts_mp_system_address_space_entry *sys_addr_entry2 =
> + fwts_mp_system_address_space_entry *sys_addr_entry2 =
> (fwts_mp_system_address_space_entry *)data2;
>
> diff = sys_addr_entry1->address_base - sys_addr_entry2->address_base;
> @@ -450,12 +497,12 @@ static void mpdump_dump_system_address_table(fwts_framework *fw)
> fwts_list_foreach(entry, &sorted) {
> fwts_mp_system_address_space_entry *sys_addr_entry =
> fwts_list_data(fwts_mp_system_address_space_entry *, entry);
> - fwts_log_info_verbatum(fw, " %16.16llx - %16.16llx %3d %s",
> - (unsigned long long)sys_addr_entry->address_base,
> - (unsigned long long)sys_addr_entry->address_base +
> + fwts_log_info_verbatum(fw, " %16.16" PRIx64 " - %16.16" PRIx64 " %3" PRId8 " %s",
> + sys_addr_entry->address_base,
> + sys_addr_entry->address_base +
> sys_addr_entry->address_length,
> sys_addr_entry->bus_id,
> - sys_addr_entry->address_type < 4 ?
> + sys_addr_entry->address_type < 4 ?
> mpdump_sys_addr_type[sys_addr_entry->address_type] : "Unknown");
> }
>
> @@ -469,7 +516,7 @@ static int mpdump_test1(fwts_framework *fw)
> fwts_infoonly(fw);
>
> mpdump_dump_header(fw, mp_data.header, mp_data.phys_addr);
> -
> +
> fwts_list_foreach(entry, &mp_data.entries) {
> uint8_t *data = fwts_list_data(uint8_t *, entry);
> uint32_t phys_addr = mp_data.phys_addr + ((void *)data - (void *)mp_data.header);
>
Acked-by: Ivan Hu <ivan.hu at canonical.com>
More information about the fwts-devel
mailing list