From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36582) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uh21v-0003G1-JH for qemu-devel@nongnu.org; Mon, 27 May 2013 14:20:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uh21s-0003vc-41 for qemu-devel@nongnu.org; Mon, 27 May 2013 14:20:23 -0400 Received: from mail-oa0-f44.google.com ([209.85.219.44]:55609) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uh21r-0003vL-VJ for qemu-devel@nongnu.org; Mon, 27 May 2013 14:20:20 -0400 Received: by mail-oa0-f44.google.com with SMTP id n12so9128677oag.31 for ; Mon, 27 May 2013 11:20:19 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: Date: Mon, 27 May 2013 22:20:18 +0400 Message-ID: From: Igor Mitsyanko Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Qemu-devel] [PATCH arm-devs v3 1/1] sd/sd.c: Fix "inquiry" ACMD41 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: Peter Maydell , qemu-devel@nongnu.org, "Edgar E. Iglesias" On 05/27/2013 06:41 AM, peter.crosthwaite@xilinx.com wrote: > From: Peter Crosthwaite > > QEMU models two (of the three) ACMD41 has two modes, "inquiry" and > "first". The selection logic for which of the two is incorrect - it > compares != 0 for the entire argument value rather than only bits 23:0 > as per the spec. Fix. > > Signed-off-by: Peter Crosthwaite > --- > Changed since v2: > Macroified magic number > Added explanatory comment (PMM review) > Changed since v1: > Total rewrite > > hw/sd/sd.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/hw/sd/sd.c b/hw/sd/sd.c > index 2e0ef3e..a10313b 100644 > --- a/hw/sd/sd.c > +++ b/hw/sd/sd.c > @@ -43,6 +43,8 @@ do { fprintf(stderr, "SD: " fmt , ## __VA_ARGS__); } while (0) > #define DPRINTF(fmt, ...) do {} while(0) > #endif > > +#define ACMD41_ENQUIRY_MASK 0x00ffffff > + > typedef enum { > sd_r0 = 0, /* no response */ > sd_r1, /* normal response command */ > @@ -1277,9 +1279,14 @@ static sd_rsp_type_t sd_app_command(SDState *sd, > } > switch (sd->state) { > case sd_idle_state: > - /* We accept any voltage. 10000 V is nothing. */ > - if (req.arg) > + /* We accept any voltage. 10000 V is nothing. > + * > + * We don't model init delay so just advance straight to ready state > + * unless its an enquiry ACMD41 (bits 23:0 == 0). > + */ > + if (req.arg & ACMD41_ENQUIRY_MASK) { > sd->state = sd_ready_state; > + } > > return sd_r3; > > Reviewed-by: Igor Mitsyanko -- Best wishes, Igor Mitsyanko email: i.mitsyanko@gmail.com