summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtyom Tarasenko <atar4qemu@googlemail.com>2009-09-05 06:24:47 +0000
committerBlue Swirl <blauwirbel@gmail.com>2009-09-05 06:24:47 +0000
commitf2818f22016b072388363dd56c0c8cd5dfb936bb (patch)
tree83942a37a6ef21b602a562173a18a2bc02569356
parentf40d753718c72693c5f520f0d9899f6e50395e94 (diff)
downloadqemu-f2818f22016b072388363dd56c0c8cd5dfb936bb.tar.gz
esp: handle "select without attention"
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. Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com> [blauwirbel@gmail.com: cleaned up formatting] Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
-rw-r--r--hw/esp.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/hw/esp.c b/hw/esp.c
index cc97eb441b..54878b610d 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,13 @@ 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 +246,17 @@ 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 +562,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);