From owner-svn-soc-all@FreeBSD.ORG Fri Sep 20 02:25:05 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 265584D1 for ; Fri, 20 Sep 2013 02:25:05 +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 1415226C5 for ; Fri, 20 Sep 2013 02:25:05 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8K2P4sU048966 for ; Fri, 20 Sep 2013 02:25:04 GMT (envelope-from zcore@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.7/8.14.6/Submit) id r8K2P4RJ048943 for svn-soc-all@FreeBSD.org; Fri, 20 Sep 2013 02:25:04 GMT (envelope-from zcore@FreeBSD.org) Date: Fri, 20 Sep 2013 02:25:04 GMT Message-Id: <201309200225.r8K2P4RJ048943@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: r257525 - 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: Fri, 20 Sep 2013 02:25:05 -0000 Author: zcore Date: Fri Sep 20 02:25:04 2013 New Revision: 257525 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=257525 Log: set br_offset accordingly 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 Fri Sep 20 01:55:37 2013 (r257524) +++ soc2013/zcore/head/usr.sbin/bhyve/pci_ahci.c Fri Sep 20 02:25:04 2013 (r257525) @@ -111,6 +111,7 @@ STAILQ_ENTRY(ahci_ioreq) io_list; uint8_t *cfis; uint32_t len; + uint32_t done; int slot; int prdtl; }; @@ -379,7 +380,8 @@ } static void -handle_dma(struct ahci_port *p, int slot, uint8_t *cfis, int seek) +handle_dma(struct ahci_port *p, int slot, uint8_t *cfis, + uint32_t done, int seek) { int i, err, iovcnt, ncq = 0, readop = 1; uint64_t lba; @@ -436,8 +438,9 @@ aior->cfis = cfis; aior->slot = slot; aior->len = len; + aior->done = done; breq = &aior->io_req; - breq->br_offset = lba; + breq->br_offset = lba + done; iovcnt = hdr->prdtl - seek; if (iovcnt > BLOCKIF_IOV_MAX) { aior->prdtl = iovcnt - BLOCKIF_IOV_MAX; @@ -453,6 +456,7 @@ breq->br_iov[i].iov_base = paddr_guest2host(ahci_ctx(sc), prdt->dba, prdt->dbc + 1); breq->br_iov[i].iov_len = prdt->dbc + 1; + aior->done += (prdt->dbc + 1); prdt++; } if (readop) @@ -836,7 +840,8 @@ } static void -atapi_read(struct ahci_port *p, int slot, uint8_t *cfis, int seek) +atapi_read(struct ahci_port *p, int slot, uint8_t *cfis, + uint32_t done, int seek) { int i, err, iovcnt; uint64_t lba; @@ -870,8 +875,9 @@ aior->cfis = cfis; aior->slot = slot; aior->len = len; + aior->done = done; breq = &aior->io_req; - breq->br_offset = lba; + breq->br_offset = lba + done; iovcnt = hdr->prdtl - seek; if (iovcnt > BLOCKIF_IOV_MAX) { aior->prdtl = iovcnt - BLOCKIF_IOV_MAX; @@ -887,6 +893,7 @@ breq->br_iov[i].iov_base = paddr_guest2host(ahci_ctx(sc), prdt->dba, prdt->dbc + 1); breq->br_iov[i].iov_len = prdt->dbc + 1; + aior->done += (prdt->dbc + 1); prdt++; } err = blockif_read(p->bctx, breq); @@ -1075,7 +1082,7 @@ break; case READ_10: case READ_12: - atapi_read(p, slot, cfis, 0); + atapi_read(p, slot, cfis, 0, 0); break; case REQUEST_SENSE: atapi_request_sense(p, slot, cfis); @@ -1153,7 +1160,7 @@ case ATA_WRITE_DMA48: case ATA_READ_FPDMA_QUEUED: case ATA_WRITE_FPDMA_QUEUED: - handle_dma(p, slot, cfis, 0); + handle_dma(p, slot, cfis, 0, 0); break; case ATA_FLUSHCACHE: case ATA_FLUSHCACHE48: @@ -1286,11 +1293,11 @@ STAILQ_INSERT_TAIL(&p->iofhd, aior, io_list); if (pending && !err) { - handle_dma(p, slot, cfis, hdr->prdtl - pending); + handle_dma(p, slot, cfis, aior->done, hdr->prdtl - pending); goto out; } - if (!err) { + if (!err && aior->done == aior->len) { tfd = ATA_S_READY | ATA_S_DSC; if (ncq) hdr->prdbc = 0; @@ -1342,11 +1349,11 @@ STAILQ_INSERT_TAIL(&p->iofhd, aior, io_list); if (pending && !err) { - atapi_read(p, slot, cfis, hdr->prdtl - pending); + atapi_read(p, slot, cfis, aior->done, hdr->prdtl - pending); goto out; } - if (!err) { + if (!err && aior->done == aior->len) { tfd = ATA_S_READY | ATA_S_DSC; hdr->prdbc = aior->len; } else {