socsvn commit: r255260 - soc2013/zcore/head/usr.sbin/bhyve
zcore at FreeBSD.org
zcore at FreeBSD.org
Sun Jul 28 09:10:24 UTC 2013
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:
More information about the svn-soc-all
mailing list