From ea026b2fc32bdddad6df22f7ab952761a29d9e6b Mon Sep 17 00:00:00 2001 From: blueswir1 Date: Wed, 24 Dec 2008 09:38:16 +0000 Subject: Improve PPC device debugging git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6126 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/mac_nvram.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'hw/mac_nvram.c') diff --git a/hw/mac_nvram.c b/hw/mac_nvram.c index f608ace71d..3787f54d65 100644 --- a/hw/mac_nvram.c +++ b/hw/mac_nvram.c @@ -25,6 +25,16 @@ #include "hw.h" #include "ppc_mac.h" +/* debug NVR */ +//#define DEBUG_NVR + +#ifdef DEBUG_NVR +#define NVR_DPRINTF(fmt, args...) \ +do { printf("NVR: " fmt , ##args); } while (0) +#else +#define NVR_DPRINTF(fmt, args...) +#endif + struct MacIONVRAMState { target_phys_addr_t size; int mem_index; @@ -37,11 +47,11 @@ uint32_t macio_nvram_read (void *opaque, uint32_t addr) MacIONVRAMState *s = opaque; uint32_t ret; - // printf("%s: %p addr %04x\n", __func__, s, addr); if (addr < 0x2000) ret = s->data[addr]; else ret = -1; + NVR_DPRINTF("read addr %04x val %x\n", addr, ret); return ret; } @@ -50,7 +60,7 @@ void macio_nvram_write (void *opaque, uint32_t addr, uint32_t val) { MacIONVRAMState *s = opaque; - // printf("%s: %p addr %04x val %02x\n", __func__, s, addr, val); + NVR_DPRINTF("write addr %04x val %x\n", addr, val); if (addr < 0x2000) s->data[addr] = val; } @@ -63,7 +73,7 @@ static void macio_nvram_writeb (void *opaque, addr = (addr >> 4) & 0x1fff; s->data[addr] = value; - // printf("macio_nvram_writeb %04x = %02x\n", addr, value); + NVR_DPRINTF("writeb addr %04x val %x\n", (int)addr, value); } static uint32_t macio_nvram_readb (void *opaque, target_phys_addr_t addr) @@ -73,7 +83,7 @@ static uint32_t macio_nvram_readb (void *opaque, target_phys_addr_t addr) addr = (addr >> 4) & 0x1fff; value = s->data[addr]; - // printf("macio_nvram_readb %04x = %02x\n", addr, value); + NVR_DPRINTF("readb addr %04x val %x\n", (int)addr, value); return value; } -- cgit v1.2.1