diff options
author | Tejun Heo <htejun@gmail.com> | 2007-09-23 00:14:11 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-12 14:55:40 -0400 |
commit | 854c73a2f1c3bcc4aa88c25e208dc597e8efb795 (patch) | |
tree | 210569f3c4fa4f9413ceb0bc3fcf89648a9894b2 | |
parent | c78968bb0f7714ceba1cdfa23714454fc98cefdf (diff) |
libata: misc updates for AN
Update AN support in preparation of PMP support.
* s/ata_id_has_AN/ata_id_has_atapi_AN/
* add AN enabled reporting during configuration
* add err_mask to AN configuration failure reporting
* update LOCKING comment for ata_scsi_media_change_notify()
* check whether ATA dev is attached to SCSI dev ata_scsi_media_change_notify()
* set ATA_FLAG_AN in ahci and sata_sil24
Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Kriten Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/ata/ahci.c | 2 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 24 | ||||
-rw-r--r-- | drivers/ata/libata-scsi.c | 7 | ||||
-rw-r--r-- | drivers/ata/sata_sil24.c | 13 | ||||
-rw-r--r-- | include/linux/ata.h | 2 |
5 files changed, 31 insertions, 17 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index b721569faaf8..0a6b694f0d3a 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -177,7 +177,7 @@ enum { | |||
177 | 177 | ||
178 | AHCI_FLAG_COMMON = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 178 | AHCI_FLAG_COMMON = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
179 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | | 179 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | |
180 | ATA_FLAG_ACPI_SATA, | 180 | ATA_FLAG_ACPI_SATA | ATA_FLAG_AN, |
181 | AHCI_LFLAG_COMMON = ATA_LFLAG_SKIP_D2H_BSY, | 181 | AHCI_LFLAG_COMMON = ATA_LFLAG_SKIP_D2H_BSY, |
182 | }; | 182 | }; |
183 | 183 | ||
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 8d425064ce2c..1daea1caf3e5 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -2010,7 +2010,8 @@ int ata_dev_configure(struct ata_device *dev) | |||
2010 | 2010 | ||
2011 | /* ATAPI-specific feature tests */ | 2011 | /* ATAPI-specific feature tests */ |
2012 | else if (dev->class == ATA_DEV_ATAPI) { | 2012 | else if (dev->class == ATA_DEV_ATAPI) { |
2013 | char *cdb_intr_string = ""; | 2013 | const char *cdb_intr_string = ""; |
2014 | const char *atapi_an_string = ""; | ||
2014 | 2015 | ||
2015 | rc = atapi_cdb_len(id); | 2016 | rc = atapi_cdb_len(id); |
2016 | if ((rc < 12) || (rc > ATAPI_CDB_LEN)) { | 2017 | if ((rc < 12) || (rc > ATAPI_CDB_LEN)) { |
@@ -2026,16 +2027,19 @@ int ata_dev_configure(struct ata_device *dev) | |||
2026 | * check to see if this ATAPI device supports | 2027 | * check to see if this ATAPI device supports |
2027 | * Asynchronous Notification | 2028 | * Asynchronous Notification |
2028 | */ | 2029 | */ |
2029 | if ((ap->flags & ATA_FLAG_AN) && ata_id_has_AN(id)) { | 2030 | if ((ap->flags & ATA_FLAG_AN) && ata_id_has_atapi_AN(id)) { |
2030 | int err; | 2031 | unsigned int err_mask; |
2032 | |||
2031 | /* issue SET feature command to turn this on */ | 2033 | /* issue SET feature command to turn this on */ |
2032 | err = ata_dev_set_AN(dev, SETFEATURES_SATA_ENABLE); | 2034 | err_mask = ata_dev_set_AN(dev, SETFEATURES_SATA_ENABLE); |
2033 | if (err) | 2035 | if (err_mask) |
2034 | ata_dev_printk(dev, KERN_ERR, | 2036 | ata_dev_printk(dev, KERN_ERR, |
2035 | "unable to set AN, err %x\n", | 2037 | "failed to enable ATAPI AN " |
2036 | err); | 2038 | "(err_mask=0x%x)\n", err_mask); |
2037 | else | 2039 | else { |
2038 | dev->flags |= ATA_DFLAG_AN; | 2040 | dev->flags |= ATA_DFLAG_AN; |
2041 | atapi_an_string = ", ATAPI AN"; | ||
2042 | } | ||
2039 | } | 2043 | } |
2040 | 2044 | ||
2041 | if (ata_id_cdb_intr(dev->id)) { | 2045 | if (ata_id_cdb_intr(dev->id)) { |
@@ -2046,10 +2050,10 @@ int ata_dev_configure(struct ata_device *dev) | |||
2046 | /* print device info to dmesg */ | 2050 | /* print device info to dmesg */ |
2047 | if (ata_msg_drv(ap) && print_info) | 2051 | if (ata_msg_drv(ap) && print_info) |
2048 | ata_dev_printk(dev, KERN_INFO, | 2052 | ata_dev_printk(dev, KERN_INFO, |
2049 | "ATAPI: %s, %s, max %s%s\n", | 2053 | "ATAPI: %s, %s, max %s%s%s\n", |
2050 | modelbuf, fwrevbuf, | 2054 | modelbuf, fwrevbuf, |
2051 | ata_mode_string(xfer_mask), | 2055 | ata_mode_string(xfer_mask), |
2052 | cdb_intr_string); | 2056 | cdb_intr_string, atapi_an_string); |
2053 | } | 2057 | } |
2054 | 2058 | ||
2055 | /* determine max_sectors */ | 2059 | /* determine max_sectors */ |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 468d791a303c..dc274001ddd9 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -3238,12 +3238,13 @@ static void ata_scsi_handle_link_detach(struct ata_link *link) | |||
3238 | * event. | 3238 | * event. |
3239 | * | 3239 | * |
3240 | * LOCKING: | 3240 | * LOCKING: |
3241 | * interrupt context, may not sleep. | 3241 | * spin_lock_irqsave(host lock) |
3242 | */ | 3242 | */ |
3243 | void ata_scsi_media_change_notify(struct ata_device *atadev) | 3243 | void ata_scsi_media_change_notify(struct ata_device *dev) |
3244 | { | 3244 | { |
3245 | #ifdef OTHER_AN_PATCHES_HAVE_BEEN_APPLIED | 3245 | #ifdef OTHER_AN_PATCHES_HAVE_BEEN_APPLIED |
3246 | scsi_device_event_notify(atadev->sdev, SDEV_MEDIA_CHANGE); | 3246 | if (dev->sdev) |
3247 | scsi_device_event_notify(dev->sdev, SDEV_MEDIA_CHANGE); | ||
3247 | #endif | 3248 | #endif |
3248 | } | 3249 | } |
3249 | EXPORT_SYMBOL_GPL(ata_scsi_media_change_notify); | 3250 | EXPORT_SYMBOL_GPL(ata_scsi_media_change_notify); |
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index 3dcb223117be..d9c010ab2280 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -168,7 +168,7 @@ enum { | |||
168 | 168 | ||
169 | DEF_PORT_IRQ = PORT_IRQ_COMPLETE | PORT_IRQ_ERROR | | 169 | DEF_PORT_IRQ = PORT_IRQ_COMPLETE | PORT_IRQ_ERROR | |
170 | PORT_IRQ_PHYRDY_CHG | PORT_IRQ_DEV_XCHG | | 170 | PORT_IRQ_PHYRDY_CHG | PORT_IRQ_DEV_XCHG | |
171 | PORT_IRQ_UNK_FIS, | 171 | PORT_IRQ_UNK_FIS | PORT_IRQ_SDB_NOTIFY, |
172 | 172 | ||
173 | /* bits[27:16] are unmasked (raw) */ | 173 | /* bits[27:16] are unmasked (raw) */ |
174 | PORT_IRQ_RAW_SHIFT = 16, | 174 | PORT_IRQ_RAW_SHIFT = 16, |
@@ -237,7 +237,8 @@ enum { | |||
237 | /* host flags */ | 237 | /* host flags */ |
238 | SIL24_COMMON_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 238 | SIL24_COMMON_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
239 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | | 239 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | |
240 | ATA_FLAG_NCQ | ATA_FLAG_ACPI_SATA, | 240 | ATA_FLAG_NCQ | ATA_FLAG_ACPI_SATA | |
241 | ATA_FLAG_AN, | ||
241 | SIL24_COMMON_LFLAGS = ATA_LFLAG_SKIP_D2H_BSY, | 242 | SIL24_COMMON_LFLAGS = ATA_LFLAG_SKIP_D2H_BSY, |
242 | SIL24_FLAG_PCIX_IRQ_WOC = (1 << 24), /* IRQ loss errata on PCI-X */ | 243 | SIL24_FLAG_PCIX_IRQ_WOC = (1 << 24), /* IRQ loss errata on PCI-X */ |
243 | 244 | ||
@@ -818,6 +819,14 @@ static void sil24_error_intr(struct ata_port *ap) | |||
818 | 819 | ||
819 | ata_ehi_push_desc(ehi, "irq_stat 0x%08x", irq_stat); | 820 | ata_ehi_push_desc(ehi, "irq_stat 0x%08x", irq_stat); |
820 | 821 | ||
822 | if (irq_stat & PORT_IRQ_SDB_NOTIFY) { | ||
823 | struct ata_device *dev = ap->link.device; | ||
824 | |||
825 | ata_ehi_push_desc(ehi, "SDB notify"); | ||
826 | if (dev->flags & ATA_DFLAG_AN) | ||
827 | ata_scsi_media_change_notify(dev); | ||
828 | } | ||
829 | |||
821 | if (irq_stat & (PORT_IRQ_PHYRDY_CHG | PORT_IRQ_DEV_XCHG)) { | 830 | if (irq_stat & (PORT_IRQ_PHYRDY_CHG | PORT_IRQ_DEV_XCHG)) { |
822 | ata_ehi_hotplugged(ehi); | 831 | ata_ehi_hotplugged(ehi); |
823 | ata_ehi_push_desc(ehi, "%s", | 832 | ata_ehi_push_desc(ehi, "%s", |
diff --git a/include/linux/ata.h b/include/linux/ata.h index a749f006387f..21f00a0646d8 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -353,7 +353,7 @@ struct ata_taskfile { | |||
353 | #define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1) | 353 | #define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1) |
354 | #define ata_id_removeable(id) ((id)[0] & (1 << 7)) | 354 | #define ata_id_removeable(id) ((id)[0] & (1 << 7)) |
355 | #define ata_id_has_dword_io(id) ((id)[48] & (1 << 0)) | 355 | #define ata_id_has_dword_io(id) ((id)[48] & (1 << 0)) |
356 | #define ata_id_has_AN(id) \ | 356 | #define ata_id_has_atapi_AN(id) \ |
357 | ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \ | 357 | ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \ |
358 | ((id)[78] & (1 << 5)) ) | 358 | ((id)[78] & (1 << 5)) ) |
359 | #define ata_id_iordy_disable(id) ((id)[49] & (1 << 10)) | 359 | #define ata_id_iordy_disable(id) ((id)[49] & (1 << 10)) |