kern/60917: implementation of ata sleeping
Divacky Roman
xdivac02 at stud.fit.vutbr.cz
Mon Jan 5 01:00:41 PST 2004
>Number: 60917
>Category: kern
>Synopsis: implementation of ata sleeping
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Mon Jan 05 01:00:38 PST 2004
>Closed-Date:
>Last-Modified:
>Originator: Divacky Roman
>Release: FreeBSD 5.2-CURRENT i386
>Organization:
>Environment:
System: FreeBSD eva.fit.vutbr.cz 4.9-STABLE FreeBSD 4.9-STABLE #2: Thu Nov 20 11:20:53 CET 2003 root at tereza.fit.vutbr.cz:/home/src/sys/sys-49/compile/EVA i386
>Description:
implementation of ata devices sleeping/standbying
>How-To-Repeat:
atacontrol sleep channel device
atacontrol standby channel device
>Fix:
--- ata-all.c.orig Mon Dec 29 13:13:25 2003
+++ ata-all.c Wed Dec 31 14:38:52 2003
@@ -509,6 +509,31 @@
error = ata_detach(device);
/* SOS should disable channel HW on controller XXX */
break;
+ case ATASTANDBY:
+ case ATASLEEP:
+ if (!device || !(ch = device_get_softc(device))) {
+ error = ENXIO;
+ break;
+ }
+ if (ch->device[iocmd->device].param &&
+ ch->device[iocmd->device].param->support.command2
+ & ATA_SUPPORT_FLUSHCACHE)
+ ata_controlcmd(&ch->device[iocmd->device], ATA_FLUSHCACHE, 0, 0, 0);
+ if (iocmd->cmd == ATASLEEP)
+ ata_controlcmd(&ch->device[iocmd->device], ATA_SLEEP, 0, 0, 0);
+ else
+ ata_controlcmd(&ch->device[iocmd->device], ATA_STANDBY, 0, 0, 0);
+ error = 0;
+ break;
+ case ATACHECK:
+ if (!device || !(ch = device_get_softc(device))) {
+ error = ENXIO;
+ break;
+ }
+ iocmd->u.mode.mode[iocmd->device] =
+ ata_controlcmd(&ch->device[iocmd->device], ATA_CHECKMODE, 0, 0, 0);
+ error = 0;
+ break;
#ifdef DEV_ATARAID
--- ata.h.orig Mon Dec 29 13:14:27 2003
+++ /sys/sys/ata.h Wed Dec 31 14:13:27 2003
@@ -227,6 +227,8 @@
#define ATA_READ_DMA 0xc8 /* read w/DMA command */
#define ATA_WRITE_DMA 0xca /* write w/DMA command */
#define ATA_WRITE_DMA_QUEUED 0xcc /* write w/DMA QUEUED command */
+#define ATA_STANDBY 0xe0 /* standby command */
+#define ATA_CHECKMODE 0xe5 /* check power mode */
#define ATA_SLEEP 0xe6 /* sleep command */
#define ATA_FLUSHCACHE 0xe7 /* flush cache to disk */
#define ATA_FLUSHCACHE48 0xea /* flush cache to disk */
@@ -318,6 +320,9 @@
#define ATARAIDADDSPARE 0x0123
#define ATARAIDREBUILD 0x0124
#define ATAENCSTAT 0x0130
+#define ATASLEEP 0x0131
+#define ATASTANDBY 0x0132
+#define ATACHECK 0x0133
union {
int maxchan;
--- atacontrol.c.orig Mon Dec 29 13:25:41 2003
+++ atacontrol.c Wed Dec 31 14:27:38 2003
@@ -493,7 +493,18 @@
mode2str(iocmd.u.mode.mode[1]));
}
}
- else
+ else if (!strcmp(argv[1], "sleep") && argc == 4) {
+ iocmd.cmd = ATASLEEP;
+ iocmd.device = atoi(argv[3]);
+ if (ioctl(fd, IOCATA, &iocmd) < 0)
+ err(1, "ioctl(ATASLEEP)");
+ }
+ else if (!strcmp(argv[1], "standby") && argc == 4) {
+ iocmd.cmd = ATASTANDBY;
+ iocmd.device = atoi(argv[3]);
+ if (ioctl(fd, IOCATA, &iocmd) < 0)
+ err(1, "ioctl(ATASTANDBY)");
+ } else
usage();
exit(EX_OK);
}
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list