Date: Sun, 2 May 2010 05:36:54 GMT From: Alexander Motin <mav@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 177583 for review Message-ID: <201005020536.o425asLw050281@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@177583?ac=10 Change 177583 by mav@mav_mavtest on 2010/05/02 05:36:16 Add SATA capabilities reporting support in mvs. Tune power management a bit. Affected files ... .. //depot/projects/scottl-camlock/src/sys/dev/mvs/mvs.c#22 edit .. //depot/projects/scottl-camlock/src/sys/dev/mvs/mvs.h#12 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/dev/mvs/mvs.c#22 (text+ko) ==== @@ -121,6 +121,11 @@ ch->user[i].bytecount = (ch->quirks & MVS_Q_GENIIE) ? 8192 : 2048; ch->user[i].tags = MVS_MAX_SLOTS; ch->curr[i] = ch->user[i]; + if (ch->pm_level) { + ch->user[i].caps = CTS_SATA_CAPS_H_PMREQ | + CTS_SATA_CAPS_H_APST | + CTS_SATA_CAPS_D_PMREQ | CTS_SATA_CAPS_D_APST; + } } rid = ch->unit; if (!(ch->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, @@ -615,6 +620,7 @@ { struct mvs_channel *ch = device_get_softc(dev); uint32_t work; + int timeout = 0; work = ATA_INL(ch->r_mem, SATA_SS); if (work & SATA_SS_IPM_ACTIVE) @@ -624,6 +630,11 @@ work &= ~SATA_SC_SPM_MASK; work |= SATA_SC_SPM_ACTIVE; ATA_OUTL(ch->r_mem, SATA_SC, work); + /* Wait for transition to happen. */ + while ((ATA_INL(ch->r_mem, SATA_SS) & SATA_SS_IPM_ACTIVE) == 0 && + timeout++ < 100) { + DELAY(100); + } } static void @@ -1484,9 +1495,10 @@ if (slot->state < MVS_SLOT_RUNNING) return; device_printf(dev, "Timeout on slot %d\n", slot->slot); - device_printf(dev, "iec %08x serr %08x edma_s %08x " + device_printf(dev, "iec %08x sstat %08x serr %08x edma_s %08x " "dma_c %08x dma_s %08x rs %08x status %02x\n", - ATA_INL(ch->r_mem, EDMA_IEC), ATA_INL(ch->r_mem, SATA_SE), + ATA_INL(ch->r_mem, EDMA_IEC), + ATA_INL(ch->r_mem, SATA_SS), ATA_INL(ch->r_mem, SATA_SE), ATA_INL(ch->r_mem, EDMA_S), ATA_INL(ch->r_mem, DMA_C), ATA_INL(ch->r_mem, DMA_S), ch->rslots, ATA_INB(ch->r_mem, ATA_ALTSTAT)); @@ -1653,7 +1665,8 @@ et != MVS_ERR_TIMEOUT) mvs_rearm_timeout(dev); /* Start PM timer. */ - if (ch->numrslots == 0 && ch->pm_level > 3) { + if (ch->numrslots == 0 && ch->pm_level > 3 && + (ch->curr[ch->pm_present ? 15 : 0].caps & CTS_SATA_CAPS_D_PMREQ)) { callout_schedule(&ch->pm_timer, (ch->pm_level == 4) ? hz / 1000 : hz / 8); } @@ -2037,6 +2050,8 @@ ch->pm_present = cts->xport_specific.sata.pm_present; if (cts->xport_specific.sata.valid & CTS_SATA_VALID_ATAPI) d->atapi = cts->xport_specific.sata.atapi; + if (cts->xport_specific.sata.valid & CTS_SATA_VALID_CAPS) + d->caps = cts->xport_specific.sata.caps; ccb->ccb_h.status = CAM_REQ_CMP; break; } @@ -2069,9 +2084,17 @@ cts->xport_specific.sata.valid |= CTS_SATA_VALID_REVISION; } + cts->xport_specific.sata.caps = d->caps & CTS_SATA_CAPS_D; +// if (ch->pm_level) +// cts->xport_specific.sata.caps |= CTS_SATA_CAPS_H_PMREQ; + cts->xport_specific.sata.caps &= + ch->user[ccb->ccb_h.target_id].caps; + cts->xport_specific.sata.valid |= CTS_SATA_VALID_CAPS; } else { cts->xport_specific.sata.revision = d->revision; cts->xport_specific.sata.valid |= CTS_SATA_VALID_REVISION; + cts->xport_specific.sata.caps = d->caps; + cts->xport_specific.sata.valid |= CTS_SATA_VALID_CAPS; } cts->xport_specific.sata.mode = d->mode; cts->xport_specific.sata.valid |= CTS_SATA_VALID_MODE; ==== //depot/projects/scottl-camlock/src/sys/dev/mvs/mvs.h#12 (text+ko) ==== @@ -507,6 +507,7 @@ u_int bytecount; u_int atapi; u_int tags; + u_int caps; }; enum mvs_edma_mode {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005020536.o425asLw050281>