qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Artyom Tarasenko <atar4qemu@googlemail.com>
To: qemu-devel <qemu-devel@nongnu.org>, Blue Swirl <blauwirbel@gmail.com>
Subject: [Qemu-devel] [patch] esp handle "select without attention"
Date: Thu, 3 Sep 2009 19:07:56 +0200	[thread overview]
Message-ID: <fb8d4f70909031007o7d739c58w148800866d3c1039@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 413 bytes --]

Up to now "select without attention" was handled the same way as
"select with attention". According to

http://www.ibiblio.org/pub/historic-linux/early-ports/Sparc/NCR/NCR53C9X.txt

select without ATN sends the CDB (Command Descriptor Block) directly,
whereas select with ATN sends one message phase byte
followed by 6, 10, or 12 command phase bytes.

The attached patch implements the behaviour described above.

[-- Attachment #2: 0001-esp-select-without-atn.patch --]
[-- Type: text/plain, Size: 1787 bytes --]

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
---
diff --git a/hw/esp.c b/hw/esp.c
index cc97eb4..85deb46 100644
--- a/hw/esp.c
+++ b/hw/esp.c
@@ -203,14 +203,14 @@ static uint32_t get_cmd(ESPState *s, uint8_t *buf)
     return dmalen;
 }
 
-static void do_cmd(ESPState *s, uint8_t *buf)
+static void do_busid_cmd(ESPState *s, uint8_t *buf,  uint8_t busid)
 {
     int32_t datalen;
     int lun;
 
-    DPRINTF("do_cmd: busid 0x%x\n", buf[0]);
-    lun = buf[0] & 7;
-    datalen = s->current_dev->send_command(s->current_dev, 0, &buf[1], lun);
+    DPRINTF("do_busid_cmd: busid 0x%x\n", busid);
+    lun = busid & 7;
+    datalen = s->current_dev->send_command(s->current_dev, 0, buf, lun);
     s->ti_size = datalen;
     if (datalen != 0) {
         s->rregs[ESP_RSTAT] = STAT_TC;
@@ -229,6 +229,12 @@ static void do_cmd(ESPState *s, uint8_t *buf)
     esp_raise_irq(s);
 }
 
+static void do_cmd(ESPState *s, uint8_t *buf)
+{
+    uint8_t busid = buf[0];
+    do_busid_cmd(s, &buf[1], busid);
+}
+
 static void handle_satn(ESPState *s)
 {
     uint8_t buf[32];
@@ -239,6 +245,16 @@ static void handle_satn(ESPState *s)
         do_cmd(s, buf);
 }
 
+static void handle_s_without_atn (ESPState *s)
+{
+    uint8_t buf[32];
+    int len;
+
+    len = get_cmd(s, buf);
+    if (len)
+        do_busid_cmd(s, buf, 0);
+}
+
 static void handle_satn_stop(ESPState *s)
 {
     s->cmdlen = get_cmd(s, s->cmdbuf);
@@ -544,7 +560,7 @@ static void esp_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
             break;
         case CMD_SEL:
             DPRINTF("Select without ATN (%2.2x)\n", val);
-            handle_satn(s);
+            handle_s_without_atn(s);
             break;
         case CMD_SELATN:
             DPRINTF("Select with ATN (%2.2x)\n", val);

                 reply	other threads:[~2009-09-03 17:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fb8d4f70909031007o7d739c58w148800866d3c1039@mail.gmail.com \
    --to=atar4qemu@googlemail.com \
    --cc=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).