Skip to content

Commit

Permalink
hw/gpio/zaurus.c: Use LOG_GUEST_ERROR for bad guest register accesses
Browse files Browse the repository at this point in the history
Instead of logging guest accesses to invalid register offsets in this
device using zaurus_printf() (which just prints to stderr), use the
usual qemu_log_mask(LOG_GUEST_ERROR,...).

Since this was the only use of the zaurus_printf() macro outside
spitz.c, we can move the definition of that macro from sharpsl.h
to spitz.c.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20200628142429.17111-14-peter.maydell@linaro.org
  • Loading branch information
pm215 committed Jul 3, 2020
1 parent eb2dc88 commit a0a8cf7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 3 additions & 0 deletions hw/arm/spitz.c
Expand Up @@ -62,6 +62,9 @@ typedef struct {
#define SPITZ_MACHINE_CLASS(klass) \
OBJECT_CLASS_CHECK(SpitzMachineClass, klass, TYPE_SPITZ_MACHINE)

#define zaurus_printf(format, ...) \
fprintf(stderr, "%s: " format, __func__, ##__VA_ARGS__)

#undef REG_FMT
#define REG_FMT "0x%02lx"

Expand Down
12 changes: 7 additions & 5 deletions hw/gpio/zaurus.c
Expand Up @@ -22,9 +22,7 @@
#include "hw/sysbus.h"
#include "migration/vmstate.h"
#include "qemu/module.h"

#undef REG_FMT
#define REG_FMT "0x%02lx"
#include "qemu/log.h"

/* SCOOP devices */

Expand Down Expand Up @@ -104,7 +102,9 @@ static uint64_t scoop_read(void *opaque, hwaddr addr,
case SCOOP_GPRR:
return s->gpio_level;
default:
zaurus_printf("Bad register offset " REG_FMT "\n", (unsigned long)addr);
qemu_log_mask(LOG_GUEST_ERROR,
"scoop_read: bad register offset 0x%02" HWADDR_PRIx "\n",
addr);
}

return 0;
Expand Down Expand Up @@ -150,7 +150,9 @@ static void scoop_write(void *opaque, hwaddr addr,
scoop_gpio_handler_update(s);
break;
default:
zaurus_printf("Bad register offset " REG_FMT "\n", (unsigned long)addr);
qemu_log_mask(LOG_GUEST_ERROR,
"scoop_write: bad register offset 0x%02" HWADDR_PRIx "\n",
addr);
}
}

Expand Down
3 changes: 0 additions & 3 deletions include/hw/arm/sharpsl.h
Expand Up @@ -9,9 +9,6 @@

#include "exec/hwaddr.h"

#define zaurus_printf(format, ...) \
fprintf(stderr, "%s: " format, __func__, ##__VA_ARGS__)

/* zaurus.c */

#define SL_PXA_PARAM_BASE 0xa0000a00
Expand Down

0 comments on commit a0a8cf7

Please sign in to comment.