qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 06/11] sdcard: do not trace CMD55 when expect


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [PATCH v4 06/11] sdcard: do not trace CMD55 when expecting ACMD
Date: Fri, 9 Mar 2018 15:07:56 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

Hi Peter,

On 02/22/2018 01:01 PM, Peter Maydell wrote:
> On 15 February 2018 at 22:05, Philippe Mathieu-Daudé <address@hidden> wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
>> Acked-by: Alistair Francis <address@hidden>
>> ---
>>  hw/sd/sd.c | 8 +++++---
>>  1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/hw/sd/sd.c b/hw/sd/sd.c
>> index 564f7a9bfd..af4df2b104 100644
>> --- a/hw/sd/sd.c
>> +++ b/hw/sd/sd.c
>> @@ -818,13 +818,15 @@ static void sd_lock_command(SDState *sd)
>>          sd->card_status &= ~CARD_IS_LOCKED;
>>  }
>>
>> -static sd_rsp_type_t sd_normal_command(SDState *sd,
>> -                                       SDRequest req)
>> +static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
>>  {
>>      uint32_t rca = 0x0000;
>>      uint64_t addr = (sd->ocr & (1 << 30)) ? (uint64_t) req.arg << 9 : 
>> req.arg;
>>
>> -    trace_sdcard_normal_command(req.cmd, req.arg, sd_state_name(sd->state));
>> +    if (req.cmd != 55 || sd->expecting_acmd) {
>> +        trace_sdcard_normal_command(req.cmd, req.arg,
>> +                                    sd_state_name(sd->state));
>> +    }
> 
> The commit message says "don't trace CMD55 when expecting ACMD",
> but the code says "don't trace CMD55 when *not* expecting ACMD" --
> which is correct?

If req.cmd == 55 we will expect an ACMD (setting sd->expecting_acmd =
true). Logging CMD55 is not interesting, since we prefer to log the ACMD
directly.

Now if we have another CMD55 after a CMD55, this is not an ACMD and we
want to log it.

I'll use the following message: "Do not trace CMD55, except when we
already expect an ACMD" and add the previous lines as comment.

Is that Ok to you? I don't have clearer if condition, the code looks
correct to me.

Thanks,

Phil.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]