aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/libata-core.c111
-rw-r--r--include/linux/libata.h1
2 files changed, 21 insertions, 91 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index d279666dcb38..1cb981375323 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{
@@ -2078,13 +2008,12 @@ static unsigned int ata_bus_softreset(struct ata_port *ap,
2078 */ 2008 */
2079 msleep(150); 2009 msleep(150);
2080 2010
2081
2082 /* Before we perform post reset processing we want to see if 2011 /* Before we perform post reset processing we want to see if
2083 the bus shows 0xFF because the odd clown forgets the D7 pulldown 2012 * the bus shows 0xFF because the odd clown forgets the D7
2084 resistor */ 2013 * pulldown resistor.
2085 2014 */
2086 if (ata_check_status(ap) == 0xFF) 2015 if (ata_check_status(ap) == 0xFF)
2087 return 1; /* Positive is failure for some reason */ 2016 return AC_ERR_OTHER;
2088 2017
2089 ata_bus_post_reset(ap, devmask); 2018 ata_bus_post_reset(ap, devmask);
2090 2019
@@ -2116,7 +2045,7 @@ void ata_bus_reset(struct ata_port *ap)
2116 struct ata_ioports *ioaddr = &ap->ioaddr; 2045 struct ata_ioports *ioaddr = &ap->ioaddr;
2117 unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS; 2046 unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS;
2118 u8 err; 2047 u8 err;
2119 unsigned int dev0, dev1 = 0, rc = 0, devmask = 0; 2048 unsigned int dev0, dev1 = 0, devmask = 0;
2120 2049
2121 DPRINTK("ENTER, host %u, port %u\n", ap->id, ap->port_no); 2050 DPRINTK("ENTER, host %u, port %u\n", ap->id, ap->port_no);
2122 2051
@@ -2139,18 +2068,8 @@ void ata_bus_reset(struct ata_port *ap)
2139 2068
2140 /* issue bus reset */ 2069 /* issue bus reset */
2141 if (ap->flags & ATA_FLAG_SRST) 2070 if (ap->flags & ATA_FLAG_SRST)
2142 rc = ata_bus_softreset(ap, devmask); 2071 if (ata_bus_softreset(ap, devmask))
2143 else if ((ap->flags & ATA_FLAG_SATA_RESET) == 0) { 2072 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 2073
2155 /* 2074 /*
2156 * determine by signature whether we have ATA or ATAPI devices 2075 * determine by signature whether we have ATA or ATAPI devices
@@ -2714,6 +2633,10 @@ static int ata_dma_blacklisted(const struct ata_device *dev)
2714 * known limits including host controller limits, device 2633 * known limits including host controller limits, device
2715 * blacklist, etc... 2634 * blacklist, etc...
2716 * 2635 *
2636 * FIXME: The current implementation limits all transfer modes to
2637 * the fastest of the lowested device on the port. This is not
2638 * required on most controllers.
2639 *
2717 * LOCKING: 2640 * LOCKING:
2718 * None. 2641 * None.
2719 */ 2642 */
@@ -4536,6 +4459,14 @@ static struct ata_port * ata_host_add(const struct ata_probe_ent *ent,
4536 int rc; 4459 int rc;
4537 4460
4538 DPRINTK("ENTER\n"); 4461 DPRINTK("ENTER\n");
4462
4463 if (!ent->port_ops->probe_reset &&
4464 !(ent->host_flags & (ATA_FLAG_SATA_RESET | ATA_FLAG_SRST))) {
4465 printk(KERN_ERR "ata%u: no reset mechanism available\n",
4466 port_no);
4467 return NULL;
4468 }
4469
4539 host = scsi_host_alloc(ent->sht, sizeof(struct ata_port)); 4470 host = scsi_host_alloc(ent->sht, sizeof(struct ata_port));
4540 if (!host) 4471 if (!host)
4541 return NULL; 4472 return NULL;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 047192253c3a..9fcc061e3adf 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -161,7 +161,6 @@ enum {
161 ATA_QCFLAG_EH_SCHEDULED = (1 << 5), /* EH scheduled */ 161 ATA_QCFLAG_EH_SCHEDULED = (1 << 5), /* EH scheduled */
162 162
163 /* various lengths of time */ 163 /* various lengths of time */
164 ATA_TMOUT_EDD = 5 * HZ, /* heuristic */
165 ATA_TMOUT_PIO = 30 * HZ, 164 ATA_TMOUT_PIO = 30 * HZ,
166 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ 165 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */
167 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ 166 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */