Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 854c73a2 authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik
Browse files

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: default avatarTejun Heo <htejun@gmail.com>
Cc: Kriten Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent c78968bb
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -177,7 +177,7 @@ enum {


	AHCI_FLAG_COMMON		= ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
	AHCI_FLAG_COMMON		= ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
					  ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
					  ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
					  ATA_FLAG_ACPI_SATA,
					  ATA_FLAG_ACPI_SATA | ATA_FLAG_AN,
	AHCI_LFLAG_COMMON		= ATA_LFLAG_SKIP_D2H_BSY,
	AHCI_LFLAG_COMMON		= ATA_LFLAG_SKIP_D2H_BSY,
};
};


+14 −10
Original line number Original line Diff line number Diff line
@@ -2010,7 +2010,8 @@ int ata_dev_configure(struct ata_device *dev)


	/* ATAPI-specific feature tests */
	/* ATAPI-specific feature tests */
	else if (dev->class == ATA_DEV_ATAPI) {
	else if (dev->class == ATA_DEV_ATAPI) {
		char *cdb_intr_string = "";
		const char *cdb_intr_string = "";
		const char *atapi_an_string = "";


		rc = atapi_cdb_len(id);
		rc = atapi_cdb_len(id);
		if ((rc < 12) || (rc > ATAPI_CDB_LEN)) {
		if ((rc < 12) || (rc > ATAPI_CDB_LEN)) {
@@ -2026,16 +2027,19 @@ int ata_dev_configure(struct ata_device *dev)
		 * check to see if this ATAPI device supports
		 * check to see if this ATAPI device supports
		 * Asynchronous Notification
		 * Asynchronous Notification
		 */
		 */
		if ((ap->flags & ATA_FLAG_AN) && ata_id_has_AN(id)) {
		if ((ap->flags & ATA_FLAG_AN) && ata_id_has_atapi_AN(id)) {
			int err;
			unsigned int err_mask;

			/* issue SET feature command to turn this on */
			/* issue SET feature command to turn this on */
			err = ata_dev_set_AN(dev, SETFEATURES_SATA_ENABLE);
			err_mask = ata_dev_set_AN(dev, SETFEATURES_SATA_ENABLE);
			if (err)
			if (err_mask)
				ata_dev_printk(dev, KERN_ERR,
				ata_dev_printk(dev, KERN_ERR,
						"unable to set AN, err %x\n",
					"failed to enable ATAPI AN "
						err);
					"(err_mask=0x%x)\n", err_mask);
			else
			else {
				dev->flags |= ATA_DFLAG_AN;
				dev->flags |= ATA_DFLAG_AN;
				atapi_an_string = ", ATAPI AN";
			}
		}
		}


		if (ata_id_cdb_intr(dev->id)) {
		if (ata_id_cdb_intr(dev->id)) {
@@ -2046,10 +2050,10 @@ int ata_dev_configure(struct ata_device *dev)
		/* print device info to dmesg */
		/* print device info to dmesg */
		if (ata_msg_drv(ap) && print_info)
		if (ata_msg_drv(ap) && print_info)
			ata_dev_printk(dev, KERN_INFO,
			ata_dev_printk(dev, KERN_INFO,
				       "ATAPI: %s, %s, max %s%s\n",
				       "ATAPI: %s, %s, max %s%s%s\n",
				       modelbuf, fwrevbuf,
				       modelbuf, fwrevbuf,
				       ata_mode_string(xfer_mask),
				       ata_mode_string(xfer_mask),
				       cdb_intr_string);
				       cdb_intr_string, atapi_an_string);
	}
	}


	/* determine max_sectors */
	/* determine max_sectors */
+4 −3
Original line number Original line Diff line number Diff line
@@ -3238,12 +3238,13 @@ static void ata_scsi_handle_link_detach(struct ata_link *link)
 *	event.
 *	event.
 *
 *
 * 	LOCKING:
 * 	LOCKING:
 * 	interrupt context, may not sleep.
 * 	spin_lock_irqsave(host lock)
 */
 */
void ata_scsi_media_change_notify(struct ata_device *atadev)
void ata_scsi_media_change_notify(struct ata_device *dev)
{
{
#ifdef OTHER_AN_PATCHES_HAVE_BEEN_APPLIED
#ifdef OTHER_AN_PATCHES_HAVE_BEEN_APPLIED
	scsi_device_event_notify(atadev->sdev, SDEV_MEDIA_CHANGE);
	if (dev->sdev)
		scsi_device_event_notify(dev->sdev, SDEV_MEDIA_CHANGE);
#endif
#endif
}
}
EXPORT_SYMBOL_GPL(ata_scsi_media_change_notify);
EXPORT_SYMBOL_GPL(ata_scsi_media_change_notify);
+11 −2
Original line number Original line Diff line number Diff line
@@ -168,7 +168,7 @@ enum {


	DEF_PORT_IRQ		= PORT_IRQ_COMPLETE | PORT_IRQ_ERROR |
	DEF_PORT_IRQ		= PORT_IRQ_COMPLETE | PORT_IRQ_ERROR |
				  PORT_IRQ_PHYRDY_CHG | PORT_IRQ_DEV_XCHG |
				  PORT_IRQ_PHYRDY_CHG | PORT_IRQ_DEV_XCHG |
				  PORT_IRQ_UNK_FIS,
				  PORT_IRQ_UNK_FIS | PORT_IRQ_SDB_NOTIFY,


	/* bits[27:16] are unmasked (raw) */
	/* bits[27:16] are unmasked (raw) */
	PORT_IRQ_RAW_SHIFT	= 16,
	PORT_IRQ_RAW_SHIFT	= 16,
@@ -237,7 +237,8 @@ enum {
	/* host flags */
	/* host flags */
	SIL24_COMMON_FLAGS	= ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
	SIL24_COMMON_FLAGS	= ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
				  ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
				  ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
				  ATA_FLAG_NCQ | ATA_FLAG_ACPI_SATA,
				  ATA_FLAG_NCQ | ATA_FLAG_ACPI_SATA |
				  ATA_FLAG_AN,
	SIL24_COMMON_LFLAGS	= ATA_LFLAG_SKIP_D2H_BSY,
	SIL24_COMMON_LFLAGS	= ATA_LFLAG_SKIP_D2H_BSY,
	SIL24_FLAG_PCIX_IRQ_WOC	= (1 << 24), /* IRQ loss errata on PCI-X */
	SIL24_FLAG_PCIX_IRQ_WOC	= (1 << 24), /* IRQ loss errata on PCI-X */


@@ -818,6 +819,14 @@ static void sil24_error_intr(struct ata_port *ap)


	ata_ehi_push_desc(ehi, "irq_stat 0x%08x", irq_stat);
	ata_ehi_push_desc(ehi, "irq_stat 0x%08x", irq_stat);


	if (irq_stat & PORT_IRQ_SDB_NOTIFY) {
		struct ata_device *dev = ap->link.device;

		ata_ehi_push_desc(ehi, "SDB notify");
		if (dev->flags & ATA_DFLAG_AN)
			ata_scsi_media_change_notify(dev);
	}

	if (irq_stat & (PORT_IRQ_PHYRDY_CHG | PORT_IRQ_DEV_XCHG)) {
	if (irq_stat & (PORT_IRQ_PHYRDY_CHG | PORT_IRQ_DEV_XCHG)) {
		ata_ehi_hotplugged(ehi);
		ata_ehi_hotplugged(ehi);
		ata_ehi_push_desc(ehi, "%s",
		ata_ehi_push_desc(ehi, "%s",
+1 −1
Original line number Original line Diff line number Diff line
@@ -353,7 +353,7 @@ struct ata_taskfile {
#define ata_id_queue_depth(id)	(((id)[75] & 0x1f) + 1)
#define ata_id_queue_depth(id)	(((id)[75] & 0x1f) + 1)
#define ata_id_removeable(id)	((id)[0] & (1 << 7))
#define ata_id_removeable(id)	((id)[0] & (1 << 7))
#define ata_id_has_dword_io(id)	((id)[48] & (1 << 0))
#define ata_id_has_dword_io(id)	((id)[48] & (1 << 0))
#define ata_id_has_AN(id)	\
#define ata_id_has_atapi_AN(id)	\
	( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \
	( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \
	  ((id)[78] & (1 << 5)) )
	  ((id)[78] & (1 << 5)) )
#define ata_id_iordy_disable(id) ((id)[49] & (1 << 10))
#define ata_id_iordy_disable(id) ((id)[49] & (1 << 10))