Date: Fri, 14 Mar 2014 07:58:11 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r263158 - in stable/8/sys: cam/ata sys Message-ID: <201403140758.s2E7wBmq057896@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Fri Mar 14 07:58:11 2014 New Revision: 263158 URL: http://svnweb.freebsd.org/changeset/base/263158 Log: MFC r262886: 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> Modified: stable/8/sys/cam/ata/ata_all.c stable/8/sys/sys/ata.h Directory Properties: stable/8/ (props changed) stable/8/sys/ (props changed) stable/8/sys/cam/ (props changed) stable/8/sys/sys/ (props changed) Modified: stable/8/sys/cam/ata/ata_all.c ============================================================================== --- stable/8/sys/cam/ata/ata_all.c Fri Mar 14 07:48:35 2014 (r263157) +++ stable/8/sys/cam/ata/ata_all.c Fri Mar 14 07:58:11 2014 (r263158) @@ -289,10 +289,10 @@ ata_print_ident(struct ata_params *ident 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); } @@ -300,10 +300,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: stable/8/sys/sys/ata.h ============================================================================== --- stable/8/sys/sys/ata.h Fri Mar 14 07:48:35 2014 (r263157) +++ stable/8/sys/sys/ata.h Fri Mar 14 07:58:11 2014 (r263158) @@ -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];
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403140758.s2E7wBmq057896>