Skip to content

Commit

Permalink
hw/display/exynos4210_fimd: Use qemu_log_mask(GUEST_ERROR)
Browse files Browse the repository at this point in the history
Replace DPRINT_ERROR() by qemu_log_mask(GUEST_ERROR).

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20200526062252.19852-13-f4bug@amsat.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
  • Loading branch information
philmd authored and kraxel committed May 28, 2020
1 parent becce5e commit b3caeaf
Showing 1 changed file with 29 additions and 17 deletions.
46 changes: 29 additions & 17 deletions hw/display/exynos4210_fimd.c
Expand Up @@ -31,6 +31,7 @@
#include "ui/pixel_ops.h"
#include "qemu/bswap.h"
#include "qemu/module.h"
#include "qemu/log.h"

/* Debug messages configuration */
#define EXYNOS4210_FIMD_DEBUG 0
Expand All @@ -39,20 +40,15 @@
#if EXYNOS4210_FIMD_DEBUG == 0
#define DPRINT_L1(fmt, args...) do { } while (0)
#define DPRINT_L2(fmt, args...) do { } while (0)
#define DPRINT_ERROR(fmt, args...) do { } while (0)
#elif EXYNOS4210_FIMD_DEBUG == 1
#define DPRINT_L1(fmt, args...) \
do {fprintf(stderr, "QEMU FIMD: "fmt, ## args); } while (0)
#define DPRINT_L2(fmt, args...) do { } while (0)
#define DPRINT_ERROR(fmt, args...) \
do {fprintf(stderr, "QEMU FIMD ERROR: "fmt, ## args); } while (0)
#else
#define DPRINT_L1(fmt, args...) \
do {fprintf(stderr, "QEMU FIMD: "fmt, ## args); } while (0)
#define DPRINT_L2(fmt, args...) \
do {fprintf(stderr, "QEMU FIMD: "fmt, ## args); } while (0)
#define DPRINT_ERROR(fmt, args...) \
do {fprintf(stderr, "QEMU FIMD ERROR: "fmt, ## args); } while (0)
#endif

#if EXYNOS4210_FIMD_MODE_TRACE == 0
Expand Down Expand Up @@ -1108,7 +1104,7 @@ static inline int fimd_get_buffer_id(Exynos4210fimdWindow *w)
case FIMD_WINCON_BUF2_STAT:
return 2;
default:
DPRINT_ERROR("Non-existent buffer index\n");
qemu_log_mask(LOG_GUEST_ERROR, "FIMD: Non-existent buffer index\n");
return 0;
}
}
Expand Down Expand Up @@ -1160,20 +1156,24 @@ static void fimd_update_memory_section(Exynos4210fimdState *s, unsigned win)

if (int128_get64(w->mem_section.size) != w->fb_len ||
!memory_region_is_ram(w->mem_section.mr)) {
DPRINT_ERROR("Failed to find window %u framebuffer region\n", win);
qemu_log_mask(LOG_GUEST_ERROR,
"FIMD: Failed to find window %u framebuffer region\n",
win);
goto error_return;
}

w->host_fb_addr = cpu_physical_memory_map(fb_start_addr, &fb_mapped_len,
false);
if (!w->host_fb_addr) {
DPRINT_ERROR("Failed to map window %u framebuffer\n", win);
qemu_log_mask(LOG_GUEST_ERROR,
"FIMD: Failed to map window %u framebuffer\n", win);
goto error_return;
}

if (fb_mapped_len != w->fb_len) {
DPRINT_ERROR("Window %u mapped framebuffer length is less then "
"expected\n", win);
qemu_log_mask(LOG_GUEST_ERROR,
"FIMD: Window %u mapped framebuffer length is less than "
"expected\n", win);
cpu_physical_memory_unmap(w->host_fb_addr, fb_mapped_len, 0, 0);
goto error_return;
}
Expand Down Expand Up @@ -1490,7 +1490,9 @@ static void exynos4210_fimd_write(void *opaque, hwaddr offset,
break;
case 3:
if (w != 1 && w != 2) {
DPRINT_ERROR("Bad write offset 0x%08x\n", offset);
qemu_log_mask(LOG_GUEST_ERROR,
"FIMD: Bad write offset 0x%08"HWADDR_PRIx"\n",
offset);
return;
}
s->window[w].osdsize = val;
Expand Down Expand Up @@ -1624,7 +1626,9 @@ static void exynos4210_fimd_write(void *opaque, hwaddr offset,
break;
case FIMD_VIDW0ADD0_B2 ... FIMD_VIDW4ADD0_B2:
if (offset & 0x0004) {
DPRINT_ERROR("bad write offset 0x%08x\n", offset);
qemu_log_mask(LOG_GUEST_ERROR,
"FIMD: bad write offset 0x%08"HWADDR_PRIx"\n",
offset);
break;
}
w = (offset - FIMD_VIDW0ADD0_B2) >> 3;
Expand All @@ -1638,14 +1642,18 @@ static void exynos4210_fimd_write(void *opaque, hwaddr offset,
break;
case FIMD_SHD_ADD0_START ... FIMD_SHD_ADD0_END:
if (offset & 0x0004) {
DPRINT_ERROR("bad write offset 0x%08x\n", offset);
qemu_log_mask(LOG_GUEST_ERROR,
"FIMD: bad write offset 0x%08"HWADDR_PRIx"\n",
offset);
break;
}
s->window[(offset - FIMD_SHD_ADD0_START) >> 3].shadow_buf_start = val;
break;
case FIMD_SHD_ADD1_START ... FIMD_SHD_ADD1_END:
if (offset & 0x0004) {
DPRINT_ERROR("bad write offset 0x%08x\n", offset);
qemu_log_mask(LOG_GUEST_ERROR,
"FIMD: bad write offset 0x%08"HWADDR_PRIx"\n",
offset);
break;
}
s->window[(offset - FIMD_SHD_ADD1_START) >> 3].shadow_buf_end = val;
Expand All @@ -1665,7 +1673,8 @@ static void exynos4210_fimd_write(void *opaque, hwaddr offset,
s->window[w].palette[i] = val;
break;
default:
DPRINT_ERROR("bad write offset 0x%08x\n", offset);
qemu_log_mask(LOG_GUEST_ERROR,
"FIMD: bad write offset 0x%08"HWADDR_PRIx"\n", offset);
break;
}
}
Expand Down Expand Up @@ -1715,7 +1724,9 @@ static uint64_t exynos4210_fimd_read(void *opaque, hwaddr offset,
break;
case 3:
if (w != 1 && w != 2) {
DPRINT_ERROR("bad read offset 0x%08x\n", offset);
qemu_log_mask(LOG_GUEST_ERROR,
"FIMD: bad read offset 0x%08"HWADDR_PRIx"\n",
offset);
return 0xBAADBAAD;
}
ret = s->window[w].osdsize;
Expand Down Expand Up @@ -1809,7 +1820,8 @@ static uint64_t exynos4210_fimd_read(void *opaque, hwaddr offset,
return s->window[w].palette[i];
}

DPRINT_ERROR("bad read offset 0x%08x\n", offset);
qemu_log_mask(LOG_GUEST_ERROR,
"FIMD: bad read offset 0x%08"HWADDR_PRIx"\n", offset);
return 0xBAADBAAD;
}

Expand Down

0 comments on commit b3caeaf

Please sign in to comment.