Date: Tue, 27 Apr 2010 11:43:40 GMT From: Alexander Motin <mav@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 177396 for review Message-ID: <201004271143.o3RBhewf002772@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@177396?ac=10 Change 177396 by mav@mav_mavtest on 2010/04/27 11:43:30 Add power management support. Affected files ... .. //depot/projects/scottl-camlock/src/sys/dev/mvs/mvs.c#14 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/dev/mvs/mvs.c#14 (text+ko) ==== @@ -592,20 +592,34 @@ static void mvs_ch_pm(void *arg) { -#if 0 device_t dev = (device_t)arg; struct mvs_channel *ch = device_get_softc(dev); uint32_t work; if (ch->numrslots != 0) return; - work = ATA_INL(ch->r_mem, MVS_P_CMD); + work = ATA_INL(ch->r_mem, SATA_SC); + work &= ~ATA_SC_SPM_MASK; if (ch->pm_level == 4) - work |= MVS_P_CMD_PARTIAL; + work |= ATA_SC_SPM_PARTIAL; else - work |= MVS_P_CMD_SLUMBER; - ATA_OUTL(ch->r_mem, MVS_P_CMD, work); -#endif + work |= ATA_SC_SPM_SLUMBER; + ATA_OUTL(ch->r_mem, SATA_SC, work); +} + +static void +mvs_ch_pm_wake(device_t dev) +{ + struct mvs_channel *ch = device_get_softc(dev); + uint32_t work; + + work = ATA_INL(ch->r_mem, SATA_SS); + if (work & ATA_SS_IPM_ACTIVE) + return; + work = ATA_INL(ch->r_mem, SATA_SC); + work &= ~ATA_SC_SPM_MASK; + work |= ATA_SC_SPM_ACTIVE; + ATA_OUTL(ch->r_mem, SATA_SC, work); } static void @@ -1056,6 +1070,8 @@ struct mvs_slot *slot; int slotn, tag; + if (ch->pm_level > 0) + mvs_ch_pm_wake(dev); /* Softreset is a special case. */ if (ccb->ccb_h.func_code == XPT_ATA_IO && (ccb->ataio.cmd.flags & CAM_ATAIO_CONTROL)) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004271143.o3RBhewf002772>