[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [Qemu-devel] [PATCH v5 03/28] hw/block/pflash: Simplify t
From: |
Alistair Francis |
Subject: |
Re: [Qemu-ppc] [Qemu-devel] [PATCH v5 03/28] hw/block/pflash: Simplify trace_pflash_data_read/write() |
Date: |
Fri, 28 Jun 2019 08:54:57 -0700 |
On Thu, Jun 27, 2019 at 1:30 PM Philippe Mathieu-Daudé
<address@hidden> wrote:
>
> Use a field width format to have a single function to log
> the different width accesses.
>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Alistair Francis <address@hidden>
Alistair
> ---
> hw/block/pflash_cfi01.c | 6 ++----
> hw/block/pflash_cfi02.c | 6 ++----
> hw/block/trace-events | 6 ++----
> 3 files changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
> index 74fc1bc2da..db4a246b22 100644
> --- a/hw/block/pflash_cfi01.c
> +++ b/hw/block/pflash_cfi01.c
> @@ -248,7 +248,6 @@ static uint32_t pflash_data_read(PFlashCFI01 *pfl, hwaddr
> offset,
> switch (width) {
> case 1:
> ret = p[offset];
> - trace_pflash_data_read8(offset, ret);
> break;
> case 2:
> if (be) {
> @@ -258,7 +257,6 @@ static uint32_t pflash_data_read(PFlashCFI01 *pfl, hwaddr
> offset,
> ret = p[offset];
> ret |= p[offset + 1] << 8;
> }
> - trace_pflash_data_read16(offset, ret);
> break;
> case 4:
> if (be) {
> @@ -272,12 +270,12 @@ static uint32_t pflash_data_read(PFlashCFI01 *pfl,
> hwaddr offset,
> ret |= p[offset + 2] << 16;
> ret |= p[offset + 3] << 24;
> }
> - trace_pflash_data_read32(offset, ret);
> break;
> default:
> DPRINTF("BUG in %s\n", __func__);
> abort();
> }
> + trace_pflash_data_read(offset, width << 1, ret);
> return ret;
> }
>
> @@ -415,7 +413,7 @@ static inline void pflash_data_write(PFlashCFI01 *pfl,
> hwaddr offset,
> {
> uint8_t *p = pfl->storage;
>
> - trace_pflash_data_write(offset, value, width, pfl->counter);
> + trace_pflash_data_write(offset, width << 1, value, pfl->counter);
> switch (width) {
> case 1:
> p[offset] = value;
> diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
> index f05cd507b3..6cdfc85264 100644
> --- a/hw/block/pflash_cfi02.c
> +++ b/hw/block/pflash_cfi02.c
> @@ -172,7 +172,6 @@ static uint32_t pflash_read(PFlashCFI02 *pfl, hwaddr
> offset,
> switch (width) {
> case 1:
> ret = p[offset];
> - trace_pflash_data_read8(offset, ret);
> break;
> case 2:
> if (be) {
> @@ -182,7 +181,6 @@ static uint32_t pflash_read(PFlashCFI02 *pfl, hwaddr
> offset,
> ret = p[offset];
> ret |= p[offset + 1] << 8;
> }
> - trace_pflash_data_read16(offset, ret);
> break;
> case 4:
> if (be) {
> @@ -196,9 +194,9 @@ static uint32_t pflash_read(PFlashCFI02 *pfl, hwaddr
> offset,
> ret |= p[offset + 2] << 16;
> ret |= p[offset + 3] << 24;
> }
> - trace_pflash_data_read32(offset, ret);
> break;
> }
> + trace_pflash_data_read(offset, width << 1, ret);
> break;
> case 0x90:
> /* flash ID read */
> @@ -343,7 +341,7 @@ static void pflash_write(PFlashCFI02 *pfl, hwaddr offset,
> /* We need another unlock sequence */
> goto check_unlock0;
> case 0xA0:
> - trace_pflash_data_write(offset, value, width, 0);
> + trace_pflash_data_write(offset, width << 1, value, 0);
> p = pfl->storage;
> if (!pfl->ro) {
> switch (width) {
> diff --git a/hw/block/trace-events b/hw/block/trace-events
> index f637fe918e..13d1b21dd4 100644
> --- a/hw/block/trace-events
> +++ b/hw/block/trace-events
> @@ -10,10 +10,8 @@ pflash_reset(void) "reset"
> pflash_timer_expired(uint8_t cmd) "command 0x%02x done"
> pflash_io_read(uint64_t offset, int width, int fmt_width, uint32_t value,
> uint8_t cmd, uint8_t wcycle) "offset:0x%04"PRIx64" width:%d value:0x%0*x
> cmd:0x%02x wcycle:%u"
> pflash_io_write(uint64_t offset, int width, int fmt_width, uint32_t value,
> uint8_t wcycle) "offset:0x%04"PRIx64" width:%d value:0x%0*x wcycle:%u"
> -pflash_data_read8(uint64_t offset, uint32_t value) "data
> offset:0x%04"PRIx64" value:0x%02x"
> -pflash_data_read16(uint64_t offset, uint32_t value) "data
> offset:0x%04"PRIx64" value:0x%04x"
> -pflash_data_read32(uint64_t offset, uint32_t value) "data
> offset:0x%04"PRIx64" value:0x%08x"
> -pflash_data_write(uint64_t offset, uint32_t value, int width, uint64_t
> counter) "data offset:0x%04"PRIx64" value:0x%08x width:%d
> counter:0x%016"PRIx64
> +pflash_data_read(uint64_t offset, int width, uint32_t value) "data
> offset:0x%04"PRIx64" value:0x%0*x"
> +pflash_data_write(uint64_t offset, int width, uint32_t value, uint64_t
> counter) "data offset:0x%04"PRIx64" value:0x%0*x counter:0x%016"PRIx64
> pflash_manufacturer_id(uint16_t id) "Read Manufacturer ID: 0x%04x"
> pflash_device_id(uint16_t id) "Read Device ID: 0x%04x"
> pflash_device_info(uint64_t offset) "Read Device Information
> offset:0x%04"PRIx64
> --
> 2.20.1
>
>
- [Qemu-ppc] [PATCH v5 00/28] block/pflash_cfi02: Implement missing AMD pflash functionality, Philippe Mathieu-Daudé, 2019/06/27
- [Qemu-ppc] [PATCH v5 01/28] tests/pflash-cfi02: Add test for supported CFI commands, Philippe Mathieu-Daudé, 2019/06/27
- [Qemu-ppc] [PATCH v5 02/28] hw/block/pflash: Simplify trace_pflash_io_read/write(), Philippe Mathieu-Daudé, 2019/06/27
- [Qemu-ppc] [PATCH v5 03/28] hw/block/pflash: Simplify trace_pflash_data_read/write(), Philippe Mathieu-Daudé, 2019/06/27
- Re: [Qemu-ppc] [Qemu-devel] [PATCH v5 03/28] hw/block/pflash: Simplify trace_pflash_data_read/write(),
Alistair Francis <=
- [Qemu-ppc] [PATCH v5 04/28] hw/block/pflash_cfi02: Fix debug format string, Philippe Mathieu-Daudé, 2019/06/27
- [Qemu-ppc] [PATCH v5 05/28] hw/block/pflash_cfi02: Add an enum to define the write cycles, Philippe Mathieu-Daudé, 2019/06/27
- [Qemu-ppc] [PATCH v5 06/28] hw/block/pflash_cfi02: Add helpers to manipulate the status bits, Philippe Mathieu-Daudé, 2019/06/27
- [Qemu-ppc] [PATCH v5 09/28] hw/block/pflash_cfi02: Use the ldst API in pflash_read(), Philippe Mathieu-Daudé, 2019/06/27
- [Qemu-ppc] [PATCH v5 07/28] hw/block/pflash_cfi02: Simplify a statement using fall through, Philippe Mathieu-Daudé, 2019/06/27