diff mbox series

[10/14] sdhci: use qemu_log_mask(UNIMP) instead of fprintf()

Message ID 20171213195852.30439-11-f4bug@amsat.org
State Superseded, archived
Headers show
Series SDHCI housekeeping | expand

Commit Message

Philippe Mathieu-Daudé Dec. 13, 2017, 7:58 p.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/sd/sdhci.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Alistair Francis Dec. 14, 2017, 5:47 p.m. UTC | #1
On Wed, Dec 13, 2017 at 11:58 AM, Philippe Mathieu-Daudé
<f4bug@amsat.org> wrote:
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/sd/sdhci.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
> index 044e3d62f1..8fcd48f849 100644
> --- a/hw/sd/sdhci.c
> +++ b/hw/sd/sdhci.c
> @@ -936,7 +936,8 @@ static uint64_t sdhci_read(void *opaque, hwaddr offset, unsigned size)
>          ret = (SD_HOST_SPECv2_VERS << 16) | sdhci_slotint(s);
>          break;
>      default:
> -        ERRPRINT("bad %ub read: addr[0x%04x]\n", size, (int)offset);
> +        qemu_log_mask(LOG_UNIMP, "SDHC rd_%ub @0x%02" HWADDR_PRIx " "
> +                      "not implemented\n", size, offset);

Is this actually unimplemented? Or is it just a guest error?

Alistair

>          break;
>      }
>
> @@ -1140,8 +1141,8 @@ sdhci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
>          sdhci_update_irq(s);
>          break;
>      default:
> -        ERRPRINT("bad %ub write offset: addr[0x%04x] <- %u(0x%x)\n",
> -                 size, (int)offset, value >> shift, value >> shift);
> +        qemu_log_mask(LOG_UNIMP, "SDHC wr_%ub @0x%02" HWADDR_PRIx " <- 0x%08x "
> +                      "not implemented\n", size, offset, value >> shift);
>          break;
>      }
>      DPRINT_L2("write %ub: addr[0x%04x] <- %u(0x%x)\n",
> --
> 2.15.1
>
>
Philippe Mathieu-Daudé Dec. 14, 2017, 6:14 p.m. UTC | #2
On Thu, Dec 14, 2017 at 2:47 PM, Alistair Francis
<alistair.francis@xilinx.com> wrote:
> On Wed, Dec 13, 2017 at 11:58 AM, Philippe Mathieu-Daudé
> <f4bug@amsat.org> wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>  hw/sd/sdhci.c | 7 ++++---
>>  1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
>> index 044e3d62f1..8fcd48f849 100644
>> --- a/hw/sd/sdhci.c
>> +++ b/hw/sd/sdhci.c
>> @@ -936,7 +936,8 @@ static uint64_t sdhci_read(void *opaque, hwaddr offset, unsigned size)
>>          ret = (SD_HOST_SPECv2_VERS << 16) | sdhci_slotint(s);
>>          break;
>>      default:
>> -        ERRPRINT("bad %ub read: addr[0x%04x]\n", size, (int)offset);
>> +        qemu_log_mask(LOG_UNIMP, "SDHC rd_%ub @0x%02" HWADDR_PRIx " "
>> +                      "not implemented\n", size, offset);
>
> Is this actually unimplemented? Or is it just a guest error?

So far we don't have those registers implemented, that's why I decided
to use UNIMP to remove the fprintf().

This log become useful when we pretend to support the Spec v3, as the
guest start using register we don't have yet implemented.

However depending on the Spec version implemented, this might be a GUEST_ERROR.

I'll sort this out for the current version, v2 (we don't care about v1
since all QEMU models support at least v2).

Thanks,

Phil.
Alistair Francis Dec. 14, 2017, 7:38 p.m. UTC | #3
On Thu, Dec 14, 2017 at 10:14 AM, Philippe Mathieu-Daudé
<f4bug@amsat.org> wrote:
> On Thu, Dec 14, 2017 at 2:47 PM, Alistair Francis
> <alistair.francis@xilinx.com> wrote:
>> On Wed, Dec 13, 2017 at 11:58 AM, Philippe Mathieu-Daudé
>> <f4bug@amsat.org> wrote:
>>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>> ---
>>>  hw/sd/sdhci.c | 7 ++++---
>>>  1 file changed, 4 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
>>> index 044e3d62f1..8fcd48f849 100644
>>> --- a/hw/sd/sdhci.c
>>> +++ b/hw/sd/sdhci.c
>>> @@ -936,7 +936,8 @@ static uint64_t sdhci_read(void *opaque, hwaddr offset, unsigned size)
>>>          ret = (SD_HOST_SPECv2_VERS << 16) | sdhci_slotint(s);
>>>          break;
>>>      default:
>>> -        ERRPRINT("bad %ub read: addr[0x%04x]\n", size, (int)offset);
>>> +        qemu_log_mask(LOG_UNIMP, "SDHC rd_%ub @0x%02" HWADDR_PRIx " "
>>> +                      "not implemented\n", size, offset);
>>
>> Is this actually unimplemented? Or is it just a guest error?
>
> So far we don't have those registers implemented, that's why I decided
> to use UNIMP to remove the fprintf().

Ah, very confusing. I'll let you decide here what to do.

Alistair

>
> This log become useful when we pretend to support the Spec v3, as the
> guest start using register we don't have yet implemented.
>
> However depending on the Spec version implemented, this might be a GUEST_ERROR.
>
> I'll sort this out for the current version, v2 (we don't care about v1
> since all QEMU models support at least v2).
>
> Thanks,
>
> Phil.
>
diff mbox series

Patch

diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index 044e3d62f1..8fcd48f849 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -936,7 +936,8 @@  static uint64_t sdhci_read(void *opaque, hwaddr offset, unsigned size)
         ret = (SD_HOST_SPECv2_VERS << 16) | sdhci_slotint(s);
         break;
     default:
-        ERRPRINT("bad %ub read: addr[0x%04x]\n", size, (int)offset);
+        qemu_log_mask(LOG_UNIMP, "SDHC rd_%ub @0x%02" HWADDR_PRIx " "
+                      "not implemented\n", size, offset);
         break;
     }
 
@@ -1140,8 +1141,8 @@  sdhci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
         sdhci_update_irq(s);
         break;
     default:
-        ERRPRINT("bad %ub write offset: addr[0x%04x] <- %u(0x%x)\n",
-                 size, (int)offset, value >> shift, value >> shift);
+        qemu_log_mask(LOG_UNIMP, "SDHC wr_%ub @0x%02" HWADDR_PRIx " <- 0x%08x "
+                      "not implemented\n", size, offset, value >> shift);
         break;
     }
     DPRINT_L2("write %ub: addr[0x%04x] <- %u(0x%x)\n",