From patchwork Thu Sep 3 17:07:56 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artyom Tarasenko X-Patchwork-Id: 32903 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id BA749B70BA for ; Fri, 4 Sep 2009 03:09:05 +1000 (EST) Received: from localhost ([127.0.0.1]:35316 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MjFnx-0006Ad-De for incoming@patchwork.ozlabs.org; Thu, 03 Sep 2009 13:09:01 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MjFnS-000696-UZ for qemu-devel@nongnu.org; Thu, 03 Sep 2009 13:08:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MjFnN-00062G-9E for qemu-devel@nongnu.org; Thu, 03 Sep 2009 13:08:29 -0400 Received: from [199.232.76.173] (port=38300 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MjFnN-000626-3J for qemu-devel@nongnu.org; Thu, 03 Sep 2009 13:08:25 -0400 Received: from mail-yx0-f201.google.com ([209.85.210.201]:38136) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MjFnM-0004Ut-Ob for qemu-devel@nongnu.org; Thu, 03 Sep 2009 13:08:24 -0400 Received: by yxe39 with SMTP id 39so1238501yxe.18 for ; Thu, 03 Sep 2009 10:08:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:from:date:message-id :subject:to:content-type; bh=oPXZjFZYXoWCJh0KiTJzFNx31EMz+Eit9BN6VzRpdYg=; b=w/A4VEM6f+FFTBdRFQzQCS7haenuJhuzQXL6xIO1wQaWYfhSwSLLElKgT7pW7WUMQE BZi//hWQglXChOBqMa1trsGi8hIA3xSY3aaqk0D5M9jTgnjFq5H6UIqwCrDfNLVHT+lS 9YnjiDKnPvZdc9IT20SBSv55fizPS4o1Q3hTw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=l2eVXVIbzX8yj5NWnuPCZ2LqM/ZmMlVQ2CkwoA+W0n33ioaUfXobd/+yt3P12XEah8 pcw7Ge6kgwtJmKIlFE2IyIELI0bIsUdGI0UOdcxBVHHmYoo4RHvtlrnsh+OoQdPaLwnw o/uOb8jX+sSyFxMZXuVwTeK47MeoqqmFxHrGA= MIME-Version: 1.0 Received: by 10.90.58.35 with SMTP id g35mr7345537aga.12.1251997700268; Thu, 03 Sep 2009 10:08:20 -0700 (PDT) From: Artyom Tarasenko Date: Thu, 3 Sep 2009 19:07:56 +0200 Message-ID: To: qemu-devel , Blue Swirl X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: Subject: [Qemu-devel] [patch] esp handle "select without attention" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 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);