aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2006-03-24 11:33:34 -0500
committerJeff Garzik <jeff@garzik.org>2006-03-24 12:24:33 -0500
commitaec5c3c1a929d7d79a420e943285cf3ba26a7c0d (patch)
tree980faf6aafcc7ab5c85b680ee9345c6c2cb56f64 /drivers
parente93252faca2eb1a14b44369705be7c79eba2f037 (diff)
[PATCH] libata: kill E.D.D.
E.D.D. has no user in-tree and mostly useless. Kill it. For possible out-of-tree users, add a nice warning message and error handling if LLDD doesn't report any useable reset mechanism (and thus tries to use E.D.D.). Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/libata-core.c98
1 files changed, 13 insertions, 85 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index d279666dcb3..0aff888d9ec 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1081,9 +1081,8 @@ unsigned int ata_pio_need_iordy(const struct ata_device *adev)
1081 * 1081 *
1082 * Read ID data from the specified device. ATA_CMD_ID_ATA is 1082 * Read ID data from the specified device. ATA_CMD_ID_ATA is
1083 * performed on ATA devices and ATA_CMD_ID_ATAPI on ATAPI 1083 * performed on ATA devices and ATA_CMD_ID_ATAPI on ATAPI
1084 * devices. This function also takes care of EDD signature 1084 * devices. This function also issues ATA_CMD_INIT_DEV_PARAMS
1085 * misreporting (to be removed once EDD support is gone) and 1085 * for pre-ATA4 drives.
1086 * issues ATA_CMD_INIT_DEV_PARAMS for pre-ATA4 drives.
1087 * 1086 *
1088 * LOCKING: 1087 * LOCKING:
1089 * Kernel thread context (may sleep) 1088 * Kernel thread context (may sleep)
@@ -1095,7 +1094,6 @@ static int ata_dev_read_id(struct ata_port *ap, struct ata_device *dev,
1095 unsigned int *p_class, int post_reset, u16 **p_id) 1094 unsigned int *p_class, int post_reset, u16 **p_id)
1096{ 1095{
1097 unsigned int class = *p_class; 1096 unsigned int class = *p_class;
1098 unsigned int using_edd;
1099 struct ata_taskfile tf; 1097 struct ata_taskfile tf;
1100 unsigned int err_mask = 0; 1098 unsigned int err_mask = 0;
1101 u16 *id; 1099 u16 *id;
@@ -1104,12 +1102,6 @@ static int ata_dev_read_id(struct ata_port *ap, struct ata_device *dev,
1104 1102
1105 DPRINTK("ENTER, host %u, dev %u\n", ap->id, dev->devno); 1103 DPRINTK("ENTER, host %u, dev %u\n", ap->id, dev->devno);
1106 1104
1107 if (ap->ops->probe_reset ||
1108 ap->flags & (ATA_FLAG_SRST | ATA_FLAG_SATA_RESET))
1109 using_edd = 0;
1110 else
1111 using_edd = 1;
1112
1113 ata_dev_select(ap, dev->devno, 1, 1); /* select device 0/1 */ 1105 ata_dev_select(ap, dev->devno, 1, 1); /* select device 0/1 */
1114 1106
1115 id = kmalloc(sizeof(id[0]) * ATA_ID_WORDS, GFP_KERNEL); 1107 id = kmalloc(sizeof(id[0]) * ATA_ID_WORDS, GFP_KERNEL);
@@ -1139,32 +1131,9 @@ static int ata_dev_read_id(struct ata_port *ap, struct ata_device *dev,
1139 1131
1140 err_mask = ata_exec_internal(ap, dev, &tf, DMA_FROM_DEVICE, 1132 err_mask = ata_exec_internal(ap, dev, &tf, DMA_FROM_DEVICE,
1141 id, sizeof(id[0]) * ATA_ID_WORDS); 1133 id, sizeof(id[0]) * ATA_ID_WORDS);
1142
1143 if (err_mask) { 1134 if (err_mask) {
1144 rc = -EIO; 1135 rc = -EIO;
1145 reason = "I/O error"; 1136 reason = "I/O error";
1146
1147 if (err_mask & ~AC_ERR_DEV)
1148 goto err_out;
1149
1150 /*
1151 * arg! EDD works for all test cases, but seems to return
1152 * the ATA signature for some ATAPI devices. Until the
1153 * reason for this is found and fixed, we fix up the mess
1154 * here. If IDENTIFY DEVICE returns command aborted
1155 * (as ATAPI devices do), then we issue an
1156 * IDENTIFY PACKET DEVICE.
1157 *
1158 * ATA software reset (SRST, the default) does not appear
1159 * to have this problem.
1160 */
1161 if ((using_edd) && (class == ATA_DEV_ATA)) {
1162 u8 err = tf.feature;
1163 if (err & ATA_ABORTED) {
1164 class = ATA_DEV_ATAPI;
1165 goto retry;
1166 }
1167 }
1168 goto err_out; 1137 goto err_out;
1169 } 1138 }
1170 1139
@@ -2005,45 +1974,6 @@ static void ata_bus_post_reset(struct ata_port *ap, unsigned int devmask)
2005 ap->ops->dev_select(ap, 0); 1974 ap->ops->dev_select(ap, 0);
2006} 1975}
2007 1976
2008/**
2009 * ata_bus_edd - Issue EXECUTE DEVICE DIAGNOSTIC command.
2010 * @ap: Port to reset and probe
2011 *
2012 * Use the EXECUTE DEVICE DIAGNOSTIC command to reset and
2013 * probe the bus. Not often used these days.
2014 *
2015 * LOCKING:
2016 * PCI/etc. bus probe sem.
2017 * Obtains host_set lock.
2018 *
2019 */
2020
2021static unsigned int ata_bus_edd(struct ata_port *ap)
2022{
2023 struct ata_taskfile tf;
2024 unsigned long flags;
2025
2026 /* set up execute-device-diag (bus reset) taskfile */
2027 /* also, take interrupts to a known state (disabled) */
2028 DPRINTK("execute-device-diag\n");
2029 ata_tf_init(ap, &tf, 0);
2030 tf.ctl |= ATA_NIEN;
2031 tf.command = ATA_CMD_EDD;
2032 tf.protocol = ATA_PROT_NODATA;
2033
2034 /* do bus reset */
2035 spin_lock_irqsave(&ap->host_set->lock, flags);
2036 ata_tf_to_host(ap, &tf);
2037 spin_unlock_irqrestore(&ap->host_set->lock, flags);
2038
2039 /* spec says at least 2ms. but who knows with those
2040 * crazy ATAPI devices...
2041 */
2042 msleep(150);
2043
2044 return ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT);
2045}
2046
2047static unsigned int ata_bus_softreset(struct ata_port *ap, 1977static unsigned int ata_bus_softreset(struct ata_port *ap,
2048 unsigned int devmask) 1978 unsigned int devmask)
2049{ 1979{
@@ -2116,7 +2046,7 @@ void ata_bus_reset(struct ata_port *ap)
2116 struct ata_ioports *ioaddr = &ap->ioaddr; 2046 struct ata_ioports *ioaddr = &ap->ioaddr;
2117 unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS; 2047 unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS;
2118 u8 err; 2048 u8 err;
2119 unsigned int dev0, dev1 = 0, rc = 0, devmask = 0; 2049 unsigned int dev0, dev1 = 0, devmask = 0;
2120 2050
2121 DPRINTK("ENTER, host %u, port %u\n", ap->id, ap->port_no); 2051 DPRINTK("ENTER, host %u, port %u\n", ap->id, ap->port_no);
2122 2052
@@ -2139,18 +2069,8 @@ void ata_bus_reset(struct ata_port *ap)
2139 2069
2140 /* issue bus reset */ 2070 /* issue bus reset */
2141 if (ap->flags & ATA_FLAG_SRST) 2071 if (ap->flags & ATA_FLAG_SRST)
2142 rc = ata_bus_softreset(ap, devmask); 2072 if (ata_bus_softreset(ap, devmask))
2143 else if ((ap->flags & ATA_FLAG_SATA_RESET) == 0) { 2073 goto err_out;
2144 /* set up device control */
2145 if (ap->flags & ATA_FLAG_MMIO)
2146 writeb(ap->ctl, (void __iomem *) ioaddr->ctl_addr);
2147 else
2148 outb(ap->ctl, ioaddr->ctl_addr);
2149 rc = ata_bus_edd(ap);
2150 }
2151
2152 if (rc)
2153 goto err_out;
2154 2074
2155 /* 2075 /*
2156 * determine by signature whether we have ATA or ATAPI devices 2076 * determine by signature whether we have ATA or ATAPI devices
@@ -4536,6 +4456,14 @@ static struct ata_port * ata_host_add(const struct ata_probe_ent *ent,
4536 int rc; 4456 int rc;
4537 4457
4538 DPRINTK("ENTER\n"); 4458 DPRINTK("ENTER\n");
4459
4460 if (!ent->port_ops->probe_reset &&
4461 !(ent->host_flags & (ATA_FLAG_SATA_RESET | ATA_FLAG_SRST))) {
4462 printk(KERN_ERR "ata%u: no reset mechanism available\n",
4463 port_no);
4464 return NULL;
4465 }
4466
4539 host = scsi_host_alloc(ent->sht, sizeof(struct ata_port)); 4467 host = scsi_host_alloc(ent->sht, sizeof(struct ata_port));
4540 if (!host) 4468 if (!host)
4541 return NULL; 4469 return NULL;