From owner-svn-soc-all@FreeBSD.ORG Sun Jul 28 09:10:24 2013 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 26D41DC9 for ; Sun, 28 Jul 2013 09:10:24 +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 EEECD2627 for ; Sun, 28 Jul 2013 09:10:23 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.7/8.14.7) with ESMTP id r6S9ANgN046989 for ; Sun, 28 Jul 2013 09:10:23 GMT (envelope-from zcore@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.7/8.14.6/Submit) id r6S9AN8K046976 for svn-soc-all@FreeBSD.org; Sun, 28 Jul 2013 09:10:23 GMT (envelope-from zcore@FreeBSD.org) Date: Sun, 28 Jul 2013 09:10:23 GMT Message-Id: <201307280910.r6S9AN8K046976@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: r255260 - 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: Sun, 28 Jul 2013 09:10:24 -0000 Author: zcore Date: Sun Jul 28 09:10:23 2013 New Revision: 255260 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=255260 Log: add AHCI_P_CMD and AHCI_P_CI support Now, all registers seems supported 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 Sun Jul 28 09:09:18 2013 (r255259) +++ soc2013/zcore/head/usr.sbin/bhyve/pci_ahci.c Sun Jul 28 09:10:23 2013 (r255260) @@ -111,7 +111,6 @@ struct pci_devinst *asc_pi; pthread_mutex_t mtx; int ports; - int vbsc_lastq; uint32_t cap; uint32_t ghc; uint32_t is; @@ -206,7 +205,7 @@ { memset(&pr->clb, 0, 17 * sizeof(uint32_t)); pr->sig = 0xFFFFFFFF; - pr->tfd = 0x7F; + pr->tfd = 0; if (pr->bctx) pr->ssts = ATA_SS_DET_PHY_ONLINE | ATA_SS_SPD_GEN2 | ATA_SS_IPM_ACTIVE; @@ -225,6 +224,28 @@ ahci_port_reset(&sc->port[i]); } +static void +handle_slot(struct ahci_port *p, int slot) +{ + /* TODO */ +} + +static void +handle_cmd(struct ahci_port *p) +{ + int i; + + if (!(p->cmd & AHCI_P_CMD_ST) || !p->ci) + return; + + for (i = 0; (i < 32) && p->ci; i++) { + if (p->ci & (1 << i)) { + handle_slot(p, i); + p->ci &= ~(1 << i); + } + } +} + static int pci_ahci_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) { @@ -325,7 +346,26 @@ ahci_generate_intr(sc); break; case AHCI_P_CMD: - /* TODO */ + p->cmd = value; + + if (!(value & AHCI_P_CMD_ST)) { + p->cmd &= ~(AHCI_P_CMD_CR | AHCI_P_CMD_CCS_MASK); + p->ci = 0; + p->sact = 0; + } else + p->cmd |= AHCI_P_CMD_CR; + + if (value & AHCI_P_CMD_FRE) + p->cmd |= AHCI_P_CMD_FR; + else + p->cmd &= ~AHCI_P_CMD_FR; + + if (value & AHCI_P_CMD_CLO) { + p->tfd = 0; + p->cmd &= ~AHCI_P_CMD_CLO; + } + + handle_cmd(p); break; case AHCI_P_TFD: case AHCI_P_SIG: @@ -347,7 +387,7 @@ break; case AHCI_P_CI: p->ci |= value; - /* TODO */ + handle_cmd(p); break; case AHCI_P_SNTF: case AHCI_P_FBS: