Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Aug 2011 15:42:24 +0200
From:      Goran Lowkrantz <goran.lowkrantz@ismobile.com>
To:        Alexander Motin <mav@FreeBSD.org>, svn-src-all@freebsd.org
Subject:   Re: svn commit: r222520 - head/sys/cam/ata
Message-ID:  <ED55D7418551E18CBB78E04E@syn>
In-Reply-To: <201105310922.p4V9MqYY016057@svn.freebsd.org>
References:  <201105310922.p4V9MqYY016057@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--On May 31, 2011 9:22:52 +0000 Alexander Motin <mav@FreeBSD.org> wrote:

> Author: mav
> Date: Tue May 31 09:22:52 2011
> New Revision: 222520
> URL: http://svn.freebsd.org/changeset/base/222520
>
> Log:
>   Add quirks to hint 4K physical sector (Advanced Format) for ATA disks
> not   reporting it properly (none? of known disks now).
>
>   Hitachi and WDC AF disks seem could be identified more or less =
formally.
>   For Seagate and Samsung enumerate some found models/series.
>   For other disks it can be forced with kern.cam.ada.X.quirks=3D1 =
tunable.
>
> Modified:
>   head/sys/cam/ata/ata_da.c
>
> Modified: head/sys/cam/ata/ata_da.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> =3D=3D=3D=3D=3D --- head/sys/cam/ata/ata_da.c	Tue May 31 07:13:07 =
2011	(r222519)
> +++ head/sys/cam/ata/ata_da.c	Tue May 31 09:22:52 2011	(r222520)
> @@ -89,7 +89,8 @@ typedef enum {
>  } ada_flags;
>
>  typedef enum {
> -	ADA_Q_NONE		=3D 0x00
> +	ADA_Q_NONE		=3D 0x00,
> +	ADA_Q_4K		=3D 0x01,
>  } ada_quirks;
>
>  typedef enum {
> @@ -154,6 +155,86 @@ struct ada_quirk_entry {
>  static struct ada_quirk_entry ada_quirk_table[] =3D
>  {
>  	{
> +		/* Hitachi Advanced Format (4k) drives */
> +		{ T_DIRECT, SIP_MEDIA_FIXED, "*", "Hitachi H??????????E3*", "*" },
> +		/*quirks*/ADA_Q_4K
> +	},
> +	{
> +		/* Samsung Advanced Format (4k) drives */
> +		{ T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG HD204UI*", "*" },
> +		/*quirks*/ADA_Q_4K
> +	},
> +	{
> +		/* Seagate Barracuda Green Advanced Format (4k) drives */
> +		{ T_DIRECT, SIP_MEDIA_FIXED, "*", "ST????DL*", "*" },
> +		/*quirks*/ADA_Q_4K
> +	},
> +	{
> +		/* Seagate Momentus Advanced Format (4k) drives */
> +		{ T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9500423AS*", "*" },
> +		/*quirks*/ADA_Q_4K
> +	},
> +	{
> +		/* Seagate Momentus Advanced Format (4k) drives */
> +		{ T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9500424AS*", "*" },
> +		/*quirks*/ADA_Q_4K
> +	},
> +	{
> +		/* Seagate Momentus Advanced Format (4k) drives */
> +		{ T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9750420AS*", "*" },
> +		/*quirks*/ADA_Q_4K
> +	},
> +	{
> +		/* Seagate Momentus Advanced Format (4k) drives */
> +		{ T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9750422AS*", "*" },
> +		/*quirks*/ADA_Q_4K
> +	},
> +	{
> +		/* Seagate Momentus Thin Advanced Format (4k) drives */
> +		{ T_DIRECT, SIP_MEDIA_FIXED, "*", "ST???LT*", "*" },
> +		/*quirks*/ADA_Q_4K
> +	},
> +	{
> +		/* WDC Caviar Green Advanced Format (4k) drives */
> +		{ T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD????RS*", "*" },
> +		/*quirks*/ADA_Q_4K
> +	},
> +	{
> +		/* WDC Caviar Green Advanced Format (4k) drives */
> +		{ T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD????RX*", "*" },
> +		/*quirks*/ADA_Q_4K
> +	},
> +	{
> +		/* WDC Caviar Green Advanced Format (4k) drives */
> +		{ T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD??????RS*", "*" },
> +		/*quirks*/ADA_Q_4K
> +	},
> +	{
> +		/* WDC Caviar Green Advanced Format (4k) drives */
> +		{ T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD??????RX*", "*" },
> +		/*quirks*/ADA_Q_4K
> +	},
> +	{
> +		/* WDC Scorpio Black Advanced Format (4k) drives */
> +		{ T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD???PKT*", "*" },
> +		/*quirks*/ADA_Q_4K
> +	},
> +	{
> +		/* WDC Scorpio Black Advanced Format (4k) drives */
> +		{ T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD?????PKT*", "*" },
> +		/*quirks*/ADA_Q_4K
> +	},
> +	{
> +		/* WDC Scorpio Blue Advanced Format (4k) drives */
> +		{ T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD???PVT*", "*" },
> +		/*quirks*/ADA_Q_4K
> +	},
> +	{
> +		/* WDC Scorpio Blue Advanced Format (4k) drives */
> +		{ T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD?????PVT*", "*" },
> +		/*quirks*/ADA_Q_4K
> +	},
> +	{
>  		/* Default */
>  		{
>  		  T_ANY, SIP_MEDIA_REMOVABLE|SIP_MEDIA_FIXED,
> @@ -740,7 +821,7 @@ adaregister(struct cam_periph *periph, v
>  	struct disk_params *dp;
>  	caddr_t match;
>  	u_int maxio;
> -	int legacy_id;
> +	int legacy_id, quirks;
>
>  	cgd =3D (struct ccb_getdev *)arg;
>  	if (periph =3D=3D NULL) {
> @@ -815,6 +896,11 @@ adaregister(struct cam_periph *periph, v
>  	 */
>  	(void)cam_periph_hold(periph, PRIBIO);
>  	mtx_unlock(periph->sim->mtx);
> +	snprintf(announce_buf, sizeof(announce_buf),
> +	    "kern.cam.ada.%d.quirks", periph->unit_number);
> +	quirks =3D softc->quirks;
> +	TUNABLE_INT_FETCH(announce_buf, &quirks);
> +	softc->quirks =3D quirks;
>  	softc->write_cache =3D -1;
>  	snprintf(announce_buf, sizeof(announce_buf),
>  	    "kern.cam.ada.%d.write_cache", periph->unit_number);
> @@ -870,6 +956,9 @@ adaregister(struct cam_periph *periph, v
>  		softc->disk->d_stripeoffset =3D (softc->disk->d_stripesize -
>  		    ata_logical_sector_offset(&cgd->ident_data)) %
>  		    softc->disk->d_stripesize;
> +	} else if (softc->quirks & ADA_Q_4K) {
> +		softc->disk->d_stripesize =3D 4096;
> +		softc->disk->d_stripeoffset =3D 0;
>  	}
>  	softc->disk->d_fwsectors =3D softc->params.secs_per_track;
>  	softc->disk->d_fwheads =3D softc->params.heads;
> _______________________________________________
> svn-src-all@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/svn-src-all
> To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"

Should this work with SAS/SATA cards like LSI 2008 (mps) too?

/glz

................................................... the future isMobile

  Goran Lowkrantz <goran.lowkrantz@ismobile.com>
  System Architect, isMobile AB
  Sandviksgatan 81, PO Box 58, S-971 03 Lule=E5, Sweden
  Mobile: +46(0)70-587 87 82
http://www.ismobile.com ...............................................



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ED55D7418551E18CBB78E04E>