From owner-freebsd-bugs@FreeBSD.ORG Mon Jan 5 01:00:41 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C4E3616A4CE for ; Mon, 5 Jan 2004 01:00:41 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 672B843D3F for ; Mon, 5 Jan 2004 01:00:38 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i0590cFR096304 for ; Mon, 5 Jan 2004 01:00:38 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i0590c50096302; Mon, 5 Jan 2004 01:00:38 -0800 (PST) (envelope-from gnats) Resent-Date: Mon, 5 Jan 2004 01:00:38 -0800 (PST) Resent-Message-Id: <200401050900.i0590c50096302@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Divacky Roman Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5F44116A4CF for ; Mon, 5 Jan 2004 00:50:46 -0800 (PST) Received: from eva.fit.vutbr.cz (eva.fit.vutbr.cz [147.229.10.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id EACDC43D2F for ; Mon, 5 Jan 2004 00:50:43 -0800 (PST) (envelope-from xdivac02@stud.fit.vutbr.cz) Received: from eva.fit.vutbr.cz (localhost [127.0.0.1]) by eva.fit.vutbr.cz (8.12.10/8.12.9) with ESMTP id i058oeYH044073 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Mon, 5 Jan 2004 09:50:40 +0100 (CET) Received: (from xdivac02@localhost) by eva.fit.vutbr.cz (8.12.10/8.12.5/Submit) id i058odRl044071; Mon, 5 Jan 2004 09:50:39 +0100 (CET) Message-Id: <200401050850.i058odRl044071@eva.fit.vutbr.cz> Date: Mon, 5 Jan 2004 09:50:39 +0100 (CET) From: Divacky Roman To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: kern/60917: implementation of ata sleeping X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Divacky Roman List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jan 2004 09:00:41 -0000 >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@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: