Date: Fri, 7 Mar 2014 09:45:41 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r262886 - in head/sys: cam/ata sys Message-ID: <201403070945.s279jfos056250@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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];
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403070945.s279jfos056250>