qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 2/4] Refactor lsi_do_command to queue read and write


From: Ryan Harper
Subject: [Qemu-devel] [PATCH 2/4] Refactor lsi_do_command to queue read and write ops
Date: Fri, 3 Oct 2008 17:05:29 -0500

The patch refactors lsi_do_command to queue both read and write operations where
previously the code only queue'ed read operations.

Signed-off-by: Ryan Harper <address@hidden>


diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index 5c161a1..5c0535c 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -649,18 +649,23 @@ static void lsi_do_command(LSIState *s)
     }
 
     if (!s->command_complete) {
-        if (n) {
-            /* Command did not complete immediately so disconnect.  */
-            lsi_add_msg_byte(s, 2); /* SAVE DATA POINTER */
-            lsi_add_msg_byte(s, 4); /* DISCONNECT */
-            /* wait data */
-            lsi_set_phase(s, PHASE_MI);
-            s->msg_action = 1;
-            lsi_queue_command(s, 0);
-        } else {
-            /* wait command complete */
+        if (n == 0) {
+            /* not a read or write command, just wait on completion */
             lsi_set_phase(s, PHASE_DI);
+            return;
         }
+            
+        /* read or write command that did not complete immediately so
+         * inject a disconnect message, and queue the command */
+        lsi_add_msg_byte(s, 2); /* SAVE DATA POINTER */
+        lsi_add_msg_byte(s, 4); /* DISCONNECT */
+        /* wait data */
+        lsi_set_phase(s, PHASE_MI);
+        s->msg_action = 1;
+        if (n > 0) /* read operation */
+            lsi_queue_command(s, 0);
+        else       /* write operation */
+            lsi_queue_command(s, 1);
     }
 }
 




reply via email to

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