@@ -50,11 +50,13 @@
//#define DEBUG_BONITO
#ifdef DEBUG_BONITO
-#define DPRINTF(fmt, ...) fprintf(stderr, "%s: " fmt, __FUNCTION__, ##__VA_ARGS__)
+#define DEBUG_BONITO_ENABLED 1
#else
-#define DPRINTF(fmt, ...)
+#define DEBUG_BONITO_ENABLED 0
#endif
+#define DPRINTF(fmt, ...) QEMU_DPRINTF(DEBUG_BONITO_ENABLED, "bonito", fmt, ## __VA_ARGS__)
+
/* from linux soure code. include/asm-mips/mips-boards/bonito64.h*/
#define BONITO_BOOT_BASE 0x1fc00000
#define BONITO_BOOT_SIZE 0x00100000
@@ -235,7 +237,7 @@ static void bonito_writel(void *opaque, hwaddr addr,
saddr = (addr - BONITO_REGBASE) >> 2;
- DPRINTF("bonito_writel "TARGET_FMT_plx" val %x saddr %x\n", addr, val, saddr);
+ DPRINTF("bonito_writel "TARGET_FMT_plx" val %x saddr %x\n", addr, (unsigned)val, saddr);
switch (saddr) {
case BONITO_BONPONCFG:
case BONITO_IODEVCFG:
@@ -322,7 +324,7 @@ static void bonito_pciconf_writel(void *opaque, hwaddr addr,
PCIBonitoState *s = opaque;
PCIDevice *d = PCI_DEVICE(s);
- DPRINTF("bonito_pciconf_writel "TARGET_FMT_plx" val %x\n", addr, val);
+ DPRINTF("bonito_pciconf_writel "TARGET_FMT_plx" val %x\n", addr, (unsigned)val);
d->config_write(d, addr, val, 4);
}
@@ -21,12 +21,16 @@
#include "qemu/bswap.h"
#include "hw/pci-host/ppce500.h"
+//#define DEBUG_PCI
+
#ifdef DEBUG_PCI
-#define pci_debug(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__)
+#define DEBUG_PCI_ENABLED 1
#else
-#define pci_debug(fmt, ...)
+#define DEBUG_PCI_ENABLED 0
#endif
+#define pci_debug(fmt, ...) QEMU_DPRINTF(DEBUG_PCI_ENABLED, "ppce500", fmt, ## __VA_ARGS__)
+
#define PCIE500_CFGADDR 0x0
#define PCIE500_CFGDATA 0x4
#define PCIE500_REG_BASE 0xC00
Modify debug macros to have the same format through the codebase and use regular ifs instead of ifdef. As the debug printf is always put in code, some casting had to be added to avoid warnings treated as errors at compile time. Signed-off-by: Marc Marí <marc.mari.barcelo@gmail.com> --- hw/pci-host/bonito.c | 10 ++++++---- hw/pci-host/ppce500.c | 8 ++++++-- 2 files changed, 12 insertions(+), 6 deletions(-)