PERFORCE change 177396 for review
Alexander Motin
mav at FreeBSD.org
Tue Apr 27 11:43:41 UTC 2010
http://p4web.freebsd.org/@@177396?ac=10
Change 177396 by mav at 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)) {
More information about the p4-projects
mailing list