qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/sd.c: Add missing state change for SD_STATUS, SEND_NUM_WR_BLOCKS
@ 2011-02-18 13:39 Peter Maydell
  2011-02-24  8:03 ` Aurelien Jarno
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2011-02-18 13:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches

The SD_STATUS and SEND_NUM_WR_BLOCKS commands are supposed to cause
the card to send data back to the host. However sd.c was missing the
state change to sd_sendingdata_state for these commands, with the effect
that the Linux driver would either hang indefinitely waiting for
nonexistent data (pl181) or read zeroes and provoke a qemu warning
message (omap).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/sd.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/hw/sd.c b/hw/sd.c
index 789ca84..5e29752 100644
--- a/hw/sd.c
+++ b/hw/sd.c
@@ -1168,6 +1168,7 @@ static sd_rsp_type_t sd_app_command(SDState *sd,
     case 13:	/* ACMD13: SD_STATUS */
         switch (sd->state) {
         case sd_transfer_state:
+            sd->state = sd_sendingdata_state;
             sd->data_start = 0;
             sd->data_offset = 0;
             return sd_r1;
@@ -1182,6 +1183,7 @@ static sd_rsp_type_t sd_app_command(SDState *sd,
         case sd_transfer_state:
             *(uint32_t *) sd->data = sd->blk_written;
 
+            sd->state = sd_sendingdata_state;
             sd->data_start = 0;
             sd->data_offset = 0;
             return sd_r1;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/sd.c: Add missing state change for SD_STATUS, SEND_NUM_WR_BLOCKS
  2011-02-18 13:39 [Qemu-devel] [PATCH] hw/sd.c: Add missing state change for SD_STATUS, SEND_NUM_WR_BLOCKS Peter Maydell
@ 2011-02-24  8:03 ` Aurelien Jarno
  0 siblings, 0 replies; 2+ messages in thread
From: Aurelien Jarno @ 2011-02-24  8:03 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, patches

On Fri, Feb 18, 2011 at 01:39:00PM +0000, Peter Maydell wrote:
> The SD_STATUS and SEND_NUM_WR_BLOCKS commands are supposed to cause
> the card to send data back to the host. However sd.c was missing the
> state change to sd_sendingdata_state for these commands, with the effect
> that the Linux driver would either hang indefinitely waiting for
> nonexistent data (pl181) or read zeroes and provoke a qemu warning
> message (omap).
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  hw/sd.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)

Thanks, applied.

> diff --git a/hw/sd.c b/hw/sd.c
> index 789ca84..5e29752 100644
> --- a/hw/sd.c
> +++ b/hw/sd.c
> @@ -1168,6 +1168,7 @@ static sd_rsp_type_t sd_app_command(SDState *sd,
>      case 13:	/* ACMD13: SD_STATUS */
>          switch (sd->state) {
>          case sd_transfer_state:
> +            sd->state = sd_sendingdata_state;
>              sd->data_start = 0;
>              sd->data_offset = 0;
>              return sd_r1;
> @@ -1182,6 +1183,7 @@ static sd_rsp_type_t sd_app_command(SDState *sd,
>          case sd_transfer_state:
>              *(uint32_t *) sd->data = sd->blk_written;
>  
> +            sd->state = sd_sendingdata_state;
>              sd->data_start = 0;
>              sd->data_offset = 0;
>              return sd_r1;
> -- 
> 1.7.1
> 
> 
> 

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-24  8:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-18 13:39 [Qemu-devel] [PATCH] hw/sd.c: Add missing state change for SD_STATUS, SEND_NUM_WR_BLOCKS Peter Maydell
2011-02-24  8:03 ` Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).