From owner-svn-src-head@freebsd.org Wed May 25 01:37:40 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73DD2B495B8; Wed, 25 May 2016 01:37:40 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 383241D83; Wed, 25 May 2016 01:37:40 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4P1bd4t017509; Wed, 25 May 2016 01:37:39 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4P1bd0D017508; Wed, 25 May 2016 01:37:39 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201605250137.u4P1bd0D017508@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Wed, 25 May 2016 01:37:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300640 - head/sys/cam/ata X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2016 01:37:40 -0000 Author: ken Date: Wed May 25 01:37:39 2016 New Revision: 300640 URL: https://svnweb.freebsd.org/changeset/base/300640 Log: Fix a few ada(4) driver issues: o Some Samsung drives do not support the ATA READ LOG EXT or READ LOG DMA EXT commands, despite indicating that they do in their IDENTIFY data. So, fix this in two ways: 1. Only start the log directory probe (ADA_STATE_LOGDIR) if the drive claims to be an SMR drive in the first place. We don't need to do the extra probing for other devices. This will also serve to prevent problems with other drives that have the same issue. 2. Add quirks for the two Samsung drives that have been reported so far (thanks to Oleg Nauman and Alex Petrov). If there is a reason to do a Read Log later on, we will know that it doesn't work on these drives. o Add a quirk entry to mark Seagate Lamarr Drive Managed drives as drive managed. They don't report this in their Identify data. sys/cam/ata/ata_da.c: Add two new quirks: 1. ADA_Q_LOG_BROKEN, for drives that claim to support Read Log but don't really. 2. ADA_Q_SMR_DM, for drives that are Drive Managed SMR, but don't report it. This can matter for software that wants to know when it should make an extra effort to write sequentially. Record two Samsung drives that don't support Read Log, and one Seagate drive that doesn't report that it is a SMR drive. The Seagate drive is already recorded in the da(4) driver. We may have to come up with a similar solution in the da(4) driver for SATA drives that don't properly support Read Log. In adasetflags(), Dont' set the ADA_FLAG_CAN_LOG bit if the device has the LOG_BROKEN quirk set. Also, look at the SMR_DM quirk and set the device type accordingly if it is actually a drive managed drive. When deciding whether to go into the LOGDIR probe state, look to see whether the device claims to be an SMR device. If not, don't bother with the LOGDIR probe state. Sponsored by: Spectra Logic Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Wed May 25 01:37:25 2016 (r300639) +++ head/sys/cam/ata/ata_da.c Wed May 25 01:37:39 2016 (r300640) @@ -115,12 +115,16 @@ typedef enum { ADA_Q_NONE = 0x00, ADA_Q_4K = 0x01, ADA_Q_NCQ_TRIM_BROKEN = 0x02, + ADA_Q_LOG_BROKEN = 0x04, + ADA_Q_SMR_DM = 0x08 } ada_quirks; #define ADA_Q_BIT_STRING \ "\020" \ "\0014K" \ - "\002NCQ_TRIM_BROKEN" + "\002NCQ_TRIM_BROKEN" \ + "\003LOG_BROKEN" \ + "\004SMR_DM" typedef enum { ADA_CCB_RAHEAD = 0x01, @@ -680,6 +684,35 @@ static struct ada_quirk_entry ada_quirk_ /*quirks*/ADA_Q_4K }, { + /* + * Samsung drive that doesn't support READ LOG EXT or + * READ LOG DMA EXT, despite reporting that it does in + * ATA identify data: + * SAMSUNG HD200HJ KF100-06 + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG HD200*", "*" }, + /*quirks*/ADA_Q_LOG_BROKEN + }, + { + /* + * Samsung drive that doesn't support READ LOG EXT or + * READ LOG DMA EXT, despite reporting that it does in + * ATA identify data: + * SAMSUNG HD501LJ CR100-10 + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG HD501*", "*" }, + /*quirks*/ADA_Q_LOG_BROKEN + }, + { + /* + * Seagate Lamarr 8TB Shingled Magnetic Recording (SMR) + * Drive Managed SATA hard drive. This drive doesn't report + * in firmware that it is a drive managed SMR drive. + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST8000AS0002*", "*" }, + /*quirks*/ADA_Q_SMR_DM + }, + { /* Default */ { T_ANY, SIP_MEDIA_REMOVABLE|SIP_MEDIA_FIXED, @@ -1258,7 +1291,8 @@ adaasync(void *callback_arg, u_int32_t c softc->state = ADA_STATE_RAHEAD; else if (ADA_WC >= 0 && softc->flags & ADA_FLAG_CAN_RAHEAD) softc->state = ADA_STATE_WCACHE; - else if (softc->flags & ADA_FLAG_CAN_LOG) + else if ((softc->flags & ADA_FLAG_CAN_LOG) + && (softc->zone_mode != ADA_ZONE_NONE)) softc->state = ADA_STATE_LOGDIR; else break; @@ -1581,7 +1615,8 @@ adasetflags(struct ada_softc *softc, str */ adasetdeletemethod(softc); - if (cgd->ident_data.support.extension & ATA_SUPPORT_GENLOG) + if ((cgd->ident_data.support.extension & ATA_SUPPORT_GENLOG) + && ((softc->quirks & ADA_Q_LOG_BROKEN) == 0)) softc->flags |= ADA_FLAG_CAN_LOG; else softc->flags &= ~ADA_FLAG_CAN_LOG; @@ -1589,8 +1624,9 @@ adasetflags(struct ada_softc *softc, str if ((cgd->ident_data.support3 & ATA_SUPPORT_ZONE_MASK) == ATA_SUPPORT_ZONE_HOST_AWARE) softc->zone_mode = ADA_ZONE_HOST_AWARE; - else if ((cgd->ident_data.support3 & ATA_SUPPORT_ZONE_MASK) == - ATA_SUPPORT_ZONE_DEV_MANAGED) + else if (((cgd->ident_data.support3 & ATA_SUPPORT_ZONE_MASK) == + ATA_SUPPORT_ZONE_DEV_MANAGED) + || (softc->quirks & ADA_Q_SMR_DM)) softc->zone_mode = ADA_ZONE_DRIVE_MANAGED; else softc->zone_mode = ADA_ZONE_NONE; @@ -1818,7 +1854,8 @@ adaregister(struct cam_periph *periph, v softc->state = ADA_STATE_RAHEAD; } else if (ADA_WC >= 0 && softc->flags & ADA_FLAG_CAN_WCACHE) { softc->state = ADA_STATE_WCACHE; - } else if (softc->flags & ADA_FLAG_CAN_LOG) { + } else if ((softc->flags & ADA_FLAG_CAN_LOG) + && (softc->zone_mode != ADA_ZONE_NONE)) { softc->state = ADA_STATE_LOGDIR; } else { /* @@ -2863,7 +2900,8 @@ adadone(struct cam_periph *periph, union /* Drop freeze taken due to CAM_DEV_QFREEZE */ cam_release_devq(path, 0, 0, 0, FALSE); - if (softc->flags & ADA_FLAG_CAN_LOG) { + if ((softc->flags & ADA_FLAG_CAN_LOG) + && (softc->zone_mode != ADA_ZONE_NONE)) { xpt_release_ccb(done_ccb); softc->state = ADA_STATE_LOGDIR; xpt_schedule(periph, priority);