From owner-svn-soc-all@FreeBSD.ORG Sat Sep 14 15:59:26 2013 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 95ACC7FC for ; Sat, 14 Sep 2013 15:59:26 +0000 (UTC) (envelope-from zcore@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 821922D47 for ; Sat, 14 Sep 2013 15:59:26 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8EFxQfB001131 for ; Sat, 14 Sep 2013 15:59:26 GMT (envelope-from zcore@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.7/8.14.6/Submit) id r8EFxQsM001129 for svn-soc-all@FreeBSD.org; Sat, 14 Sep 2013 15:59:26 GMT (envelope-from zcore@FreeBSD.org) Date: Sat, 14 Sep 2013 15:59:26 GMT Message-Id: <201309141559.r8EFxQsM001129@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to zcore@FreeBSD.org using -f From: zcore@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r257330 - soc2013/zcore/head/usr.sbin/bhyve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 15:59:26 -0000 Author: zcore Date: Sat Sep 14 15:59:26 2013 New Revision: 257330 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=257330 Log: support ATA_PACKET_CMD Modified: soc2013/zcore/head/usr.sbin/bhyve/pci_ahci.c Modified: soc2013/zcore/head/usr.sbin/bhyve/pci_ahci.c ============================================================================== --- soc2013/zcore/head/usr.sbin/bhyve/pci_ahci.c Sat Sep 14 15:57:49 2013 (r257329) +++ soc2013/zcore/head/usr.sbin/bhyve/pci_ahci.c Sat Sep 14 15:59:26 2013 (r257330) @@ -100,6 +100,8 @@ uint32_t unhandled_write; pthread_cond_t flush_cond; uint8_t xfermode; + uint8_t sense_key; + uint8_t asc; uint32_t clb; uint32_t clbu; @@ -570,9 +572,31 @@ } static void +handle_packet_cmd(struct ahci_port *p, int slot, uint8_t *cfis) +{ + uint8_t *acmd = cfis + 0x40; + + { + int i; + dprintf("ACMD:\n"); + for (i = 0; i < 16; i++) + dprintf("%02x ", acmd[i]); + dprintf("\n"); + } + switch (acmd[0]) { + case ATAPI_TEST_UNIT_READY: + cfis[4] = (cfis[4] & ~7) | ATA_I_CMD | ATA_I_IN; + ahci_write_fis_d2h(p, slot, cfis, ATA_S_READY | ATA_S_DSC); + break; + default: + break; + } +} + +static void handle_cmd(struct ahci_port *p, int slot, uint8_t *cfis) { - switch(cfis[2]) { + switch (cfis[2]) { case ATA_ATA_IDENTIFY: handle_identify(p, slot, cfis); break; @@ -645,6 +669,15 @@ case ATA_ATAPI_IDENTIFY: handle_atapi_identify(p, slot, cfis); break; + case ATA_PACKET_CMD: + if (!p->atapi) { + p->tfd = (ATA_E_ABORT << 8) | ATA_S_READY | ATA_S_ERROR; + p->is |= AHCI_P_IX_TFE; + p->ci &= ~(1 << slot); + ahci_generate_intr(p->pr_sc); + } else + handle_packet_cmd(p, slot, cfis); + break; default: WPRINTF(("Unsupported cmd:%02x\n", cfis[2])); p->tfd = (ATA_E_ABORT << 8) | ATA_S_READY | ATA_S_ERROR;