Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Mar 2014 09:50:02 GMT
From:      dfilter@FreeBSD.ORG (dfilter service)
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: misc/187269: commit references a PR
Message-ID:  <201403070950.s279o2TG006395@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/187269; it has been noted by GNATS.

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: misc/187269: commit references a PR
Date: Fri,  7 Mar 2014 09:45:54 +0000 (UTC)

 Author: mav
 Date: Fri Mar  7 09:45:40 2014
 New Revision: 262886
 URL: http://svnweb.freebsd.org/changeset/base/262886
 
 Log:
   Fix support for increased logical sector size (4K-native drives).
   
   - Logical sector size is measured in words, not bytes.
   - If physical sector is not bigger then logical sector, it does not mean
   it should be set equal to 512 bytes, but set to logical sector.
   
   PR:		misc/187269
   Submitted by:	Ravi Pokala <rpokala@panasas.com>
   MFC after:	1 week
 
 Modified:
   head/sys/cam/ata/ata_all.c
   head/sys/sys/ata.h
 
 Modified: head/sys/cam/ata/ata_all.c
 ==============================================================================
 --- head/sys/cam/ata/ata_all.c	Fri Mar  7 07:06:36 2014	(r262885)
 +++ head/sys/cam/ata/ata_all.c	Fri Mar  7 09:45:40 2014	(r262886)
 @@ -338,10 +338,10 @@ semb_print_ident_short(struct sep_identi
  uint32_t
  ata_logical_sector_size(struct ata_params *ident_data)
  {
 -	if ((ident_data->pss & 0xc000) == 0x4000 &&
 +	if ((ident_data->pss & ATA_PSS_VALID_MASK) == ATA_PSS_VALID_VALUE &&
  	    (ident_data->pss & ATA_PSS_LSSABOVE512)) {
 -		return ((u_int32_t)ident_data->lss_1 |
 -		    ((u_int32_t)ident_data->lss_2 << 16));
 +		return (((u_int32_t)ident_data->lss_1 |
 +		    ((u_int32_t)ident_data->lss_2 << 16)) * 2);
  	}
  	return (512);
  }
 @@ -349,10 +349,13 @@ ata_logical_sector_size(struct ata_param
  uint64_t
  ata_physical_sector_size(struct ata_params *ident_data)
  {
 -	if ((ident_data->pss & 0xc000) == 0x4000 &&
 -	    (ident_data->pss & ATA_PSS_MULTLS)) {
 -		return ((uint64_t)ata_logical_sector_size(ident_data) *
 -		    (1 << (ident_data->pss & ATA_PSS_LSPPS)));
 +	if ((ident_data->pss & ATA_PSS_VALID_MASK) == ATA_PSS_VALID_VALUE) {
 +		if (ident_data->pss & ATA_PSS_MULTLS) {
 +			return ((uint64_t)ata_logical_sector_size(ident_data) *
 +			    (1 << (ident_data->pss & ATA_PSS_LSPPS)));
 +		} else {
 +			return (uint64_t)ata_logical_sector_size(ident_data);
 +		}
  	}
  	return (512);
  }
 
 Modified: head/sys/sys/ata.h
 ==============================================================================
 --- head/sys/sys/ata.h	Fri Mar  7 07:06:36 2014	(r262885)
 +++ head/sys/sys/ata.h	Fri Mar  7 09:45:40 2014	(r262886)
 @@ -214,6 +214,8 @@ struct ata_params {
  #define ATA_PSS_LSPPS			0x000F
  #define ATA_PSS_LSSABOVE512		0x1000
  #define ATA_PSS_MULTLS			0x2000
 +#define ATA_PSS_VALID_MASK		0xC000
 +#define ATA_PSS_VALID_VALUE		0x4000
  /*107*/ u_int16_t       isd;
  /*108*/ u_int16_t       wwn[4];
  	u_int16_t       reserved112[5];
 _______________________________________________
 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"
 



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