From 15f48aaad6da4f5fba8d474a76e71e824e82c434 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Wed, 20 Aug 2014 22:58:12 +0000 Subject: [PATCH] Turns out that IDENTIFY DEVICE and IDENTIFY PACKET DEVICE return data that's only mostly similar. Specifically word 78 bits are defined for IDENTIFY DEVICE as 5 Supports Hardware Feature Control while a IDENTIFY PACKET DEVICE defines them as 5 Asynchronous notification supported Therefore, only pay attention to bit 5 when we're talking to ATAPI devices (we don't use the hardware feature control at this time). Ignore it for ATA devices. Remove kludge that papered over this issue for Samsung SATA SSDs, since Micron drives also have the bit set and the error was caused by this bad interpretation of the spec (which is quite easy to do, since bits aren't normally overlapping like this). --- sys/cam/ata/ata_xpt.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/sys/cam/ata/ata_xpt.c b/sys/cam/ata/ata_xpt.c index 867b2fe0b972..25b732d227ed 100644 --- a/sys/cam/ata/ata_xpt.c +++ b/sys/cam/ata/ata_xpt.c @@ -458,12 +458,18 @@ negotiate: 0, 0x02); break; case PROBE_SETAN: - /* Remember what transport thinks about AEN. */ - if (softc->caps & CTS_SATA_CAPS_H_AN) + /* + * Only ATAPI defines this bit to mean AEN, but remember + * what transport thinks about AEN. + */ + if ((softc->caps & CTS_SATA_CAPS_H_AN) && + periph->path->device->protocol == PROTO_ATAPI) path->device->inq_flags |= SID_AEN; else path->device->inq_flags &= ~SID_AEN; xpt_async(AC_GETDEV_CHANGED, path, NULL); + if (periph->path->device->protocol != PROTO_ATAPI) + break; cam_fill_ataio(ataio, 1, probedone, @@ -749,14 +755,6 @@ out: status == CAM_ATA_STATUS_ERROR) { goto noerror; - /* - * Some Samsung SSDs report supported Asynchronous Notification, - * but return ABORT on attempt to enable it. - */ - } else if (softc->action == PROBE_SETAN && - status == CAM_ATA_STATUS_ERROR) { - goto noerror; - /* * SES and SAF-TE SEPs have different IDENTIFY commands, * but SATA specification doesn't tell how to identify them.