All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] lsi53c895a: Update dnad when skipping MSGOUT bytes
@ 2011-01-26 12:31 Stefan Hajnoczi
  2011-03-06 17:43 ` Aurelien Jarno
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hajnoczi @ 2011-01-26 12:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paul Brook, Nicholas A. Bellinger, Stefan Hajnoczi

Update not only dbc but also dnad when skipping bytes during the MSGOUT
phase.  Previously only dbc was updated which is probably wrong and
could lead to bogus message codes being read.

Tested on Linux and Windows Server 2003.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 hw/lsi53c895a.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index 9c761cd..84a4992 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -842,6 +842,13 @@ static uint8_t lsi_get_msgbyte(LSIState *s)
     return data;
 }
 
+/* Skip the next n bytes during a MSGOUT phase. */
+static void lsi_skip_msgbytes(LSIState *s, unsigned int n)
+{
+    s->dnad += n;
+    s->dbc  -= n;
+}
+
 static void lsi_do_msgout(LSIState *s)
 {
     uint8_t msg;
@@ -869,11 +876,11 @@ static void lsi_do_msgout(LSIState *s)
             switch (msg) {
             case 1:
                 DPRINTF("SDTR (ignored)\n");
-                s->dbc -= 2;
+                lsi_skip_msgbytes(s, 2);
                 break;
             case 3:
                 DPRINTF("WDTR (ignored)\n");
-                s->dbc -= 1;
+                lsi_skip_msgbytes(s, 1);
                 break;
             default:
                 goto bad;
-- 
1.7.2.3

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

* Re: [Qemu-devel] [PATCH] lsi53c895a: Update dnad when skipping MSGOUT bytes
  2011-01-26 12:31 [Qemu-devel] [PATCH] lsi53c895a: Update dnad when skipping MSGOUT bytes Stefan Hajnoczi
@ 2011-03-06 17:43 ` Aurelien Jarno
  0 siblings, 0 replies; 2+ messages in thread
From: Aurelien Jarno @ 2011-03-06 17:43 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel, Nicholas A. Bellinger, Paul Brook

On Wed, Jan 26, 2011 at 12:31:00PM +0000, Stefan Hajnoczi wrote:
> Update not only dbc but also dnad when skipping bytes during the MSGOUT
> phase.  Previously only dbc was updated which is probably wrong and
> could lead to bogus message codes being read.
> 
> Tested on Linux and Windows Server 2003.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
> ---
>  hw/lsi53c895a.c |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)

Thanks, applied.

> diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
> index 9c761cd..84a4992 100644
> --- a/hw/lsi53c895a.c
> +++ b/hw/lsi53c895a.c
> @@ -842,6 +842,13 @@ static uint8_t lsi_get_msgbyte(LSIState *s)
>      return data;
>  }
>  
> +/* Skip the next n bytes during a MSGOUT phase. */
> +static void lsi_skip_msgbytes(LSIState *s, unsigned int n)
> +{
> +    s->dnad += n;
> +    s->dbc  -= n;
> +}
> +
>  static void lsi_do_msgout(LSIState *s)
>  {
>      uint8_t msg;
> @@ -869,11 +876,11 @@ static void lsi_do_msgout(LSIState *s)
>              switch (msg) {
>              case 1:
>                  DPRINTF("SDTR (ignored)\n");
> -                s->dbc -= 2;
> +                lsi_skip_msgbytes(s, 2);
>                  break;
>              case 3:
>                  DPRINTF("WDTR (ignored)\n");
> -                s->dbc -= 1;
> +                lsi_skip_msgbytes(s, 1);
>                  break;
>              default:
>                  goto bad;
> -- 
> 1.7.2.3
> 
> 
> 

-- 
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-03-06 17:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-26 12:31 [Qemu-devel] [PATCH] lsi53c895a: Update dnad when skipping MSGOUT bytes Stefan Hajnoczi
2011-03-06 17:43 ` Aurelien Jarno

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.