socsvn commit: r257081 - soc2013/zcore/head/usr.sbin/bhyve
zcore at FreeBSD.org
zcore at FreeBSD.org
Sat Sep 7 16:05:59 UTC 2013
Author: zcore
Date: Sat Sep 7 16:05:58 2013
New Revision: 257081
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=257081
Log:
support ATA_WRITE_DMA
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 7 16:04:26 2013 (r257080)
+++ soc2013/zcore/head/usr.sbin/bhyve/pci_ahci.c Sat Sep 7 16:05:58 2013 (r257081)
@@ -94,7 +94,8 @@
int atapi;
int reset;
int mult_sectors;
- uint32_t unhandled;
+ uint32_t unhandled_read;
+ uint32_t unhandled_write;
uint8_t xfermode;
uint32_t clb;
@@ -311,9 +312,9 @@
}
static void
-read_dma(struct ahci_port *p, int slot, uint8_t *cfis)
+handle_dma(struct ahci_port *p, int slot, uint8_t *cfis)
{
- int i, err;
+ int i, err, readop = 1;
uint64_t lba;
uint32_t len;
struct ahci_ioreq *aior;
@@ -322,6 +323,17 @@
struct ahci_prdt_entry *prdt = (struct ahci_prdt_entry *)(cfis + 0x80);
struct ahci_cmd_hdr *hdr = p->cmd_lst + slot * AHCI_CL_SIZE;
+ if (cfis[2] == ATA_WRITE_DMA)
+ readop = 0;
+
+ if (!p->iofree) {
+ if (readop)
+ p->unhandled_read |= (1 << slot);
+ else
+ p->unhandled_write |= (1 << slot);
+ return;
+ }
+
lba = ((cfis[7] & 0xf) << 24) | (cfis[6] << 16) |
(cfis[5] << 8) | cfis[4];
lba *= blockif_sectsz(p->bctx);
@@ -335,10 +347,6 @@
/*
* Pull request off free list
*/
- if (!p->iofree) {
- p->unhandled |= (1 << slot);
- return;
- }
aior = STAILQ_FIRST(&p->iofhd);
assert(aior != NULL);
STAILQ_REMOVE_HEAD(&p->iofhd, io_list);
@@ -358,7 +366,10 @@
breq->br_iov[i].iov_len = prdt->dbc + 1;
prdt++;
}
- err = blockif_read(p->bctx, breq);
+ if (readop)
+ err = blockif_read(p->bctx, breq);
+ else
+ err = blockif_write(p->bctx, breq);
assert(err == 0);
}
@@ -488,7 +499,8 @@
ahci_generate_intr(sc);
break;
case ATA_READ_DMA:
- read_dma(p, slot, cfis);
+ case ATA_WRITE_DMA:
+ handle_dma(p, slot, cfis);
break;
default:
break;
@@ -599,10 +611,17 @@
*/
if (p->ioqsz - p->iofree <= 2 && (p->cmd & AHCI_P_CMD_ST)) {
int i;
- for (i = 0; (i < 32) && p->unhandled; i++) {
- if (p->unhandled & (1 << i))
+ uint32_t unhandled = p->unhandled_read | p->unhandled_write;
+ for (i = 0; (i < 32) && unhandled; i++) {
+ if (!p->iofree)
+ break;
+ if (unhandled & (1 << i)) {
handle_slot(p, i);
+ unhandled &= ~(1 << i);
+ }
}
+ p->unhandled_read &= unhandled;
+ p->unhandled_write &= unhandled;
}
pthread_mutex_unlock(&sc->mtx);
More information about the svn-soc-all
mailing list