From owner-freebsd-bugs@FreeBSD.ORG Fri Mar 7 09:50:02 2014 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 900875B5 for ; Fri, 7 Mar 2014 09:50:02 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7127F7CC for ; Fri, 7 Mar 2014 09:50:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.8/8.14.8) with ESMTP id s279o2n0006396 for ; Fri, 7 Mar 2014 09:50:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.8/8.14.8/Submit) id s279o2TG006395; Fri, 7 Mar 2014 09:50:02 GMT (envelope-from gnats) Date: Fri, 7 Mar 2014 09:50:02 GMT Message-Id: <201403070950.s279o2TG006395@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: dfilter@FreeBSD.ORG (dfilter service) Subject: Re: misc/187269: commit references a PR X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: dfilter service List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Mar 2014 09:50:02 -0000 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 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"