hw/nvram/mac_nvram: Convert debug printf()s to trace events
PATCH 1/1 hw/nvram/mac_nvram: Convert debug printf()s to trace events
Convert NVR_DPRINTF() to trace events and remove ifdef'ry.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
--- hw/nvram/mac_nvram.c | 17 +++-------------- hw/nvram/trace-events | 4 ++++ 2 files changed, 7 insertions(+), 14 deletions(-)
hw/nvram/mac_nvram.c +3 -14
@@ -30,18 +30,9 @@#include "migration/vmstate.h" #include "qemu/cutils.h" #include "qemu/module.h" +#include "trace.h" #include <zlib.h> -/* debug NVR */ -//#define DEBUG_NVR - -#ifdef DEBUG_NVR -#define NVR_DPRINTF (fmt, ...) \ - do { printf("NVR: " fmt , ## __VA_ARGS__); } while (0) -#else -#define NVR_DPRINTF (fmt, ...) -#endif -#define DEF_SYSTEM_SIZE 0xc10/* macio style NVRAM device */
@@ -51,9 +42,8 @@ static void macio_nvram_writeb(void *opaque, hwaddr addr,MacIONVRAMState *s = opaque; addr = (addr >> s->it_shift) & (s->size -1 ); +trace_macio_nvram_write (addr, value); s->data[addr] = value; -NVR_DPRINTF ("writeb addr %04" HWADDR_PRIx" val %" PRIx64"\n" , - addr, value); } static uint64_t macio_nvram_readb(void *opaque, hwaddr addr,
@@ -64,8 +54,7 @@ static uint64_t macio_nvram_readb(void *opaque, hwaddr addr, addr = (addr >> s->it_shift) & (s->size -1 ); value = s->data[addr]; -NVR_DPRINTF ("readb addr %04" HWADDR_PRIx" val %" PRIx32"\n" , - addr, value); +trace_macio_nvram_read (addr, value);return value; }
hw/nvram/trace-events +4 -0
@@ -13,3 +13,7 @@ fw_cfg_add_string(uint16_t key_value, const char *key_name, const char *value) " fw_cfg_add_i16(uint16_t key_value, const char *key_name, uint16_t value) "key 0x%04" PRIx16 " '%s', value 0x%" PRIx16 fw_cfg_add_i32(uint16_t key_value, const char *key_name, uint32_t value) "key 0x%04" PRIx16 " '%s', value 0x%" PRIx32 fw_cfg_add_i64(uint16_t key_value, const char *key_name, uint64_t value) "key 0x%04" PRIx16 " '%s', value 0x%" PRIx64 + +# mac_nvram.c +macio_nvram_read(uint32_t addr, uint8_t val) "read addr=0x%04"PRIx32" val=0x%02x" +macio_nvram_write(uint32_t addr, uint8_t val) "write addr=0x%04"PRIx32" val=0x%02x"
Signature · 1 line
2.21.3
David Gibson
AppliedQuoted 3 lines · Philippe Mathieu-Daudé
Convert
NVR_DPRINTF()to trace events and remove ifdef'ry.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Applied to ppc-for-5.1, thanks.
Quoted 62 lines
--- hw/nvram/mac_nvram.c | 17 +++-------------- hw/nvram/trace-events | 4 ++++ 2 files changed, 7 insertions(+), 14 deletions(-)hw/nvram/mac_nvram.c +3
-14@@ -30,18 +30,9 @@#include "migration/vmstate.h" #include "qemu/cutils.h" #include "qemu/module.h" +#include "trace.h" #include <zlib.h> -/* debug NVR */ -//#define DEBUG_NVR - -#ifdef DEBUG_NVR -#define NVR_DPRINTF (fmt, ...) \ - do { printf("NVR: " fmt , ## __VA_ARGS__); } while (0) -#else -#define NVR_DPRINTF (fmt, ...) -#endif -#define DEF_SYSTEM_SIZE 0xc10/* macio style NVRAM device */ @@ -51,9 +42,8 @@ static void macio_nvram_writeb(void *opaque, hwaddr addr,MacIONVRAMState *s = opaque; addr = (addr >> s->it_shift) & (s->size -1 ); +trace_macio_nvram_write (addr, value); s->data[addr] = value; -NVR_DPRINTF ("writeb addr %04" HWADDR_PRIx" val %" PRIx64"\n" , - addr, value); } static uint64_t macio_nvram_readb(void *opaque, hwaddr addr,@@ -64,8 +54,7 @@ static uint64_t macio_nvram_readb(void *opaque, hwaddr addr, addr = (addr >> s->it_shift) & (s->size -1 ); value = s->data[addr]; -NVR_DPRINTF ("readb addr %04" HWADDR_PRIx" val %" PRIx32"\n" , - addr, value); +trace_macio_nvram_read (addr, value);return value; }hw/nvram/trace-events +4
-0@@ -13,3 +13,7 @@ fw_cfg_add_string(uint16_t key_value, const char *key_name, const char *value) " fw_cfg_add_i16(uint16_t key_value, const char *key_name, uint16_t value) "key 0x%04" PRIx16 " '%s', value 0x%" PRIx16 fw_cfg_add_i32(uint16_t key_value, const char *key_name, uint32_t value) "key 0x%04" PRIx16 " '%s', value 0x%" PRIx32 fw_cfg_add_i64(uint16_t key_value, const char *key_name, uint64_t value) "key 0x%04" PRIx16 " '%s', value 0x%" PRIx64 + +# mac_nvram.c +macio_nvram_read(uint32_t addr, uint8_t val) "read addr=0x%04"PRIx32" val=0x%02x" +macio_nvram_write(uint32_t addr, uint8_t val) "write addr=0x%04"PRIx32" val=0x%02x"
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 58 lines · Philippe Mathieu-Daudé
Convert
NVR_DPRINTF()to trace events and remove ifdef'ry.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/nvram/mac_nvram.c | 17 +++-------------- hw/nvram/trace-events | 4 ++++ 2 files changed, 7 insertions(+), 14 deletions(-)hw/nvram/mac_nvram.c +3
-14@@ -30,18 +30,9 @@#include "migration/vmstate.h" #include "qemu/cutils.h" #include "qemu/module.h" +#include "trace.h" #include <zlib.h> -/* debug NVR */ -//#define DEBUG_NVR - -#ifdef DEBUG_NVR -#define NVR_DPRINTF (fmt, ...) \ - do { printf("NVR: " fmt , ## __VA_ARGS__); } while (0) -#else -#define NVR_DPRINTF (fmt, ...) -#endif -#define DEF_SYSTEM_SIZE 0xc10/* macio style NVRAM device */ @@ -51,9 +42,8 @@ static void macio_nvram_writeb(void *opaque, hwaddr addr,MacIONVRAMState *s = opaque; addr = (addr >> s->it_shift) & (s->size -1 ); +trace_macio_nvram_write (addr, value); s->data[addr] = value; -NVR_DPRINTF ("writeb addr %04" HWADDR_PRIx" val %" PRIx64"\n" , - addr, value); } static uint64_t macio_nvram_readb(void *opaque, hwaddr addr,@@ -64,8 +54,7 @@ static uint64_t macio_nvram_readb(void *opaque, hwaddr addr, addr = (addr >> s->it_shift) & (s->size -1 ); value = s->data[addr]; -NVR_DPRINTF ("readb addr %04" HWADDR_PRIx" val %" PRIx32"\n" , - addr, value); +trace_macio_nvram_read (addr, value);return value; }hw/nvram/trace-events +0
-0
hw/nvram/trace-events fw_cfg_add_string(uint16_t key_value, const char *key_name, const char *value) " · line 19
Quoted 7 lines
hw/nvram/trace-events +4
-0@@ -13,3 +13,7 @@ fw_cfg_add_string(uint16_t key_value, const char *key_name, const char *value) " fw_cfg_add_i16(uint16_t key_value, const char *key_name, uint16_t value) "key 0x%04" PRIx16 " '%s', value 0x%" PRIx16 fw_cfg_add_i32(uint16_t key_value, const char *key_name, uint32_t value) "key 0x%04" PRIx16 " '%s', value 0x%" PRIx32 fw_cfg_add_i64(uint16_t key_value, const char *key_name, uint64_t value) "key 0x%04" PRIx16 " '%s', value 0x%" PRIx64 + +# mac_nvram.c +macio_nvram_read(uint32_t addr, uint8_t val) "read addr=0x%04"PRIx32" val=0x%02x" +macio_nvram_write(uint32_t addr, uint8_t val) "write addr=0x%04"PRIx32" val=0x%02x"
Looks good to me.
Reviewed-by Mark Cave-Ayland <[email protected]>
ATB,
Mark.