From owner-freebsd-current@FreeBSD.ORG Sat Mar 5 12:34:49 2005 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 13D0216A4CE for ; Sat, 5 Mar 2005 12:34:49 +0000 (GMT) Received: from mail28.syd.optusnet.com.au (mail28.syd.optusnet.com.au [211.29.133.169]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1EF1143D46 for ; Sat, 5 Mar 2005 12:34:48 +0000 (GMT) (envelope-from PeterJeremy@optushome.com.au) Received: from cirb503493.alcatel.com.au (c211-30-75-229.belrs2.nsw.optusnet.com.au [211.30.75.229]) j25CYb4q023502 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Sat, 5 Mar 2005 23:34:39 +1100 Received: from cirb503493.alcatel.com.au (localhost.alcatel.com.au [127.0.0.1])j25CYb7l009059; Sat, 5 Mar 2005 23:34:37 +1100 (EST) (envelope-from pjeremy@cirb503493.alcatel.com.au) Received: (from pjeremy@localhost)j25CYa3E009058; Sat, 5 Mar 2005 23:34:36 +1100 (EST) (envelope-from pjeremy) Date: Sat, 5 Mar 2005 23:34:35 +1100 From: Peter Jeremy To: sos@deepcore.dk Message-ID: <20050305123435.GF28983@cirb503493.alcatel.com.au> References: <20050227025811.GP57256@cirb503493.alcatel.com.au> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="oyUTqETQ0mS9luUI" Content-Disposition: inline In-Reply-To: <20050227025811.GP57256@cirb503493.alcatel.com.au> User-Agent: Mutt/1.4.2i cc: freebsd-current@freebsd.org Subject: Re: Request for new ATA feature X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Mar 2005 12:34:49 -0000 --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, 2005-Feb-27 13:58:11 +1100, Peter Jeremy wrote: >I have a suggestion for a feature that would be useful to me: I am >in the process of rejunenating an old system for use as a proxy server. >Unfortunately, the BIOS is limited to 32GB and I want to put an 80GB >drive in. The drive (Seagate Barracuda) includes a jumper that makes >the drive report a capacity of 32GB until it is reset using a "set >features/report full capacity available" command. Attached is a patch against 5.3-RELEASE to implement this. It applies cleanly to -CURRENT but I haven't tested it there. -- Peter Jeremy --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=diff Index: sys/ata.h =================================================================== RCS file: /usr/ncvs/src/sys/sys/ata.h,v retrieving revision 1.23 diff -u -r1.23 ata.h --- sys/ata.h 20 May 2004 15:09:41 -0000 1.23 +++ sys/ata.h 5 Mar 2005 10:52:27 -0000 @@ -251,6 +251,7 @@ #define ATA_SF_DIS_RELIRQ 0xdd /* disable release interrupt */ #define ATA_SF_ENAB_SRVIRQ 0x5e /* enable service interrupt */ #define ATA_SF_DIS_SRVIRQ 0xde /* disable service interrupt */ +#define ATA_SF_SEA_FULLCAP 0xf1 /* SGT Report Full Capacity */ /* ATAPI commands */ #define ATAPI_TEST_UNIT_READY 0x00 /* check if device is ready */ Index: dev/ata/ata-all.c =================================================================== RCS file: /usr/ncvs/src/sys/dev/ata/ata-all.c,v retrieving revision 1.222.2.4.2.1 diff -u -r1.222.2.4.2.1 ata-all.c --- dev/ata/ata-all.c 24 Oct 2004 09:31:25 -0000 1.222.2.4.2.1 +++ dev/ata/ata-all.c 5 Mar 2005 10:45:30 -0000 @@ -68,7 +68,6 @@ /* prototypes */ static void ata_shutdown(void *, int); static void ata_interrupt(void *); -static int ata_getparam(struct ata_device *, u_int8_t); static void ata_identify_devices(struct ata_channel *); static void ata_boot_attach(void); static void bswap(int8_t *, int); @@ -638,7 +637,7 @@ /* * device probe functions */ -static int +int ata_getparam(struct ata_device *atadev, u_int8_t command) { struct ata_request *request; Index: dev/ata/ata-all.h =================================================================== RCS file: /usr/ncvs/src/sys/dev/ata/ata-all.h,v retrieving revision 1.81.2.3 diff -u -r1.81.2.3 ata-all.h --- dev/ata/ata-all.h 10 Oct 2004 15:01:47 -0000 1.81.2.3 +++ dev/ata/ata-all.h 5 Mar 2005 10:45:30 -0000 @@ -408,6 +408,7 @@ int ata_wmode(struct ata_params *ap); int ata_umode(struct ata_params *ap); int ata_limit_mode(struct ata_device *atadev, int mode, int maxmode); +int ata_getparam(struct ata_device *atadev, u_int8_t command); /* ata-queue.c: */ int ata_reinit(struct ata_channel *ch); Index: dev/ata/ata-commands.h =================================================================== RCS file: /usr/ncvs/src/sys/dev/ata/ata-commands.h,v retrieving revision 1.2 diff -u -r1.2 ata-commands.h --- dev/ata/ata-commands.h 30 Apr 2004 16:21:34 -0000 1.2 +++ dev/ata/ata-commands.h 5 Mar 2005 10:45:30 -0000 @@ -69,6 +69,7 @@ #define ATA_SF_DIS_RELIRQ 0xdd /* disable release interrupt */ #define ATA_SF_ENAB_SRVIRQ 0x5e /* enable service interrupt */ #define ATA_SF_DIS_SRVIRQ 0xde /* disable service interrupt */ +#define ATA_SF_SEA_FULLCAP 0xf1 /* SGT Report Full Capacity */ /* ATAPI commands */ #define ATAPI_TEST_UNIT_READY 0x00 /* check if device is ready */ Index: dev/ata/ata-disk.c =================================================================== RCS file: /usr/ncvs/src/sys/dev/ata/ata-disk.c,v retrieving revision 1.175.2.2 diff -u -r1.175.2.2 ata-disk.c --- dev/ata/ata-disk.c 30 Sep 2004 21:29:19 -0000 1.175.2.2 +++ dev/ata/ata-disk.c 5 Mar 2005 12:29:32 -0000 @@ -89,6 +89,24 @@ adp->lun = ata_get_lun(&adp_lun_map); #endif ata_set_name(atadev, "ad", adp->lun); + /* + * If this looks like a Seagate drive running in limited capacity mode + * (reported capacity about 32GB), send an ATA Set Features "Report Full + * Capacity Available" command and redo the drive identification + */ + if (!strncmp(atadev->param->model, "ST", 2) && + atadev->param->lba_size_2 > 950 && atadev->param->lba_size_2 < 1025) { + if (bootverbose) + ata_prtdev(atadev, "Initial geometry: %u sectors (%u/%u/%u)\n", + (u_int32_t)atadev->param->lba_size_1 | + ((u_int32_t)atadev->param->lba_size_2 << 16), + atadev->param->cylinders, atadev->param->heads, + atadev->param->sectors); + /* Reset the drive capacity */ + ata_controlcmd(atadev, ATA_SETFEATURES, ATA_SF_SEA_FULLCAP, 0, 0); + /* Repeat drive identification */ + ata_getparam(atadev, ATA_ATA_IDENTIFY); + } adp->heads = atadev->param->heads; adp->sectors = atadev->param->sectors; adp->total_secs = atadev->param->cylinders * adp->heads * adp->sectors; --oyUTqETQ0mS9luUI--