aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-11-03 15:27:56 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-11-03 15:27:56 -0400
commit468f8afdf4f87378c7c7de1d636a9375fce4078d (patch)
treebd2eb44629e9d3696cd6c3643fbdf1dc7392b7a8
parentebab89909e0dc716282d5e7f6e73a3155fe66d4a (diff)
parent5270222f96608818e431b5c4029b1f12020ab719 (diff)
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev: (23 commits) libata: don't configure downstream links faster than the upstream link libata: request PHY speed configuration on SControl access failure libata: consider errors not associated with commands for speed down libata: more robust reset failure handling libata: cosmetic clean up / reorganization of ata_eh_reset() libata: fix timing computation in ata_eh_reset() libata: increase 128 KB / cmd limit for ATAPI tape drives sata_promise: fix endianess bug in ASIC PRD bug workaround libata: fix docbook make ata_scsi_lpm_get() static libata: suppress two warnings ata/sata_fsl: Remove ata_scsi_suspend/resume callbacks ata/sata_fsl: Remove sending LOG EXT command in sata_fsl_softreset() ata/sata_fsl: Move MPC8315DS link speed limit workaround to specific ifdef ata/sata_fsl: cleanup style problem ata/sata_fsl: remove unneeded sata_fsl_hardreset() ata/sata_fsl: remove unneeded on-stack copy of FIS ata/sata_fsl: cleanup needless casts to/from void __iomem * ata/sata_fsl: Remove unnecessary SCR cases ata/sata_fsl: Kill ata_sg_is_last() ...
-rw-r--r--drivers/ata/libata-core.c38
-rw-r--r--drivers/ata/libata-eh.c148
-rw-r--r--drivers/ata/libata-scsi.c2
-rw-r--r--drivers/ata/sata_fsl.c159
-rw-r--r--drivers/ata/sata_promise.c2
-rw-r--r--include/linux/ata.h6
6 files changed, 149 insertions, 206 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 63035d71a61a..164c7d9514f9 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -704,8 +704,8 @@ static int ata_dev_set_dipm(struct ata_device *dev, enum link_pm policy)
704 704
705/** 705/**
706 * ata_dev_enable_pm - enable SATA interface power management 706 * ata_dev_enable_pm - enable SATA interface power management
707 * @device - device to enable ipm for 707 * @dev: device to enable power management
708 * @policy - the link power management policy 708 * @policy: the link power management policy
709 * 709 *
710 * Enable SATA Interface power management. This will enable 710 * Enable SATA Interface power management. This will enable
711 * Device Interface Power Management (DIPM) for min_power 711 * Device Interface Power Management (DIPM) for min_power
@@ -735,9 +735,10 @@ enable_pm_out:
735 return /* rc */; /* hopefully we can use 'rc' eventually */ 735 return /* rc */; /* hopefully we can use 'rc' eventually */
736} 736}
737 737
738#ifdef CONFIG_PM
738/** 739/**
739 * ata_dev_disable_pm - disable SATA interface power management 740 * ata_dev_disable_pm - disable SATA interface power management
740 * @device - device to enable ipm for 741 * @dev: device to disable power management
741 * 742 *
742 * Disable SATA Interface power management. This will disable 743 * Disable SATA Interface power management. This will disable
743 * Device Interface Power Management (DIPM) without changing 744 * Device Interface Power Management (DIPM) without changing
@@ -755,6 +756,7 @@ static void ata_dev_disable_pm(struct ata_device *dev)
755 if (ap->ops->disable_pm) 756 if (ap->ops->disable_pm)
756 ap->ops->disable_pm(ap); 757 ap->ops->disable_pm(ap);
757} 758}
759#endif /* CONFIG_PM */
758 760
759void ata_lpm_schedule(struct ata_port *ap, enum link_pm policy) 761void ata_lpm_schedule(struct ata_port *ap, enum link_pm policy)
760{ 762{
@@ -764,6 +766,7 @@ void ata_lpm_schedule(struct ata_port *ap, enum link_pm policy)
764 ata_port_schedule_eh(ap); 766 ata_port_schedule_eh(ap);
765} 767}
766 768
769#ifdef CONFIG_PM
767static void ata_lpm_enable(struct ata_host *host) 770static void ata_lpm_enable(struct ata_host *host)
768{ 771{
769 struct ata_link *link; 772 struct ata_link *link;
@@ -789,6 +792,7 @@ static void ata_lpm_disable(struct ata_host *host)
789 ata_lpm_schedule(ap, ap->pm_policy); 792 ata_lpm_schedule(ap, ap->pm_policy);
790 } 793 }
791} 794}
795#endif /* CONFIG_PM */
792 796
793 797
794/** 798/**
@@ -2300,6 +2304,10 @@ int ata_dev_configure(struct ata_device *dev)
2300 dev->max_sectors = ATA_MAX_SECTORS; 2304 dev->max_sectors = ATA_MAX_SECTORS;
2301 } 2305 }
2302 2306
2307 if ((dev->class == ATA_DEV_ATAPI) &&
2308 (atapi_command_packet_set(id) == TYPE_TAPE))
2309 dev->max_sectors = ATA_MAX_SECTORS_TAPE;
2310
2303 if (dev->horkage & ATA_HORKAGE_MAX_SEC_128) 2311 if (dev->horkage & ATA_HORKAGE_MAX_SEC_128)
2304 dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, 2312 dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128,
2305 dev->max_sectors); 2313 dev->max_sectors);
@@ -2743,17 +2751,27 @@ int sata_down_spd_limit(struct ata_link *link)
2743 2751
2744static int __sata_set_spd_needed(struct ata_link *link, u32 *scontrol) 2752static int __sata_set_spd_needed(struct ata_link *link, u32 *scontrol)
2745{ 2753{
2746 u32 spd, limit; 2754 struct ata_link *host_link = &link->ap->link;
2755 u32 limit, target, spd;
2756
2757 limit = link->sata_spd_limit;
2747 2758
2748 if (link->sata_spd_limit == UINT_MAX) 2759 /* Don't configure downstream link faster than upstream link.
2749 limit = 0; 2760 * It doesn't speed up anything and some PMPs choke on such
2761 * configuration.
2762 */
2763 if (!ata_is_host_link(link) && host_link->sata_spd)
2764 limit &= (1 << host_link->sata_spd) - 1;
2765
2766 if (limit == UINT_MAX)
2767 target = 0;
2750 else 2768 else
2751 limit = fls(link->sata_spd_limit); 2769 target = fls(limit);
2752 2770
2753 spd = (*scontrol >> 4) & 0xf; 2771 spd = (*scontrol >> 4) & 0xf;
2754 *scontrol = (*scontrol & ~0xf0) | ((limit & 0xf) << 4); 2772 *scontrol = (*scontrol & ~0xf0) | ((target & 0xf) << 4);
2755 2773
2756 return spd != limit; 2774 return spd != target;
2757} 2775}
2758 2776
2759/** 2777/**
@@ -2776,7 +2794,7 @@ int sata_set_spd_needed(struct ata_link *link)
2776 u32 scontrol; 2794 u32 scontrol;
2777 2795
2778 if (sata_scr_read(link, SCR_CONTROL, &scontrol)) 2796 if (sata_scr_read(link, SCR_CONTROL, &scontrol))
2779 return 0; 2797 return 1;
2780 2798
2781 return __sata_set_spd_needed(link, &scontrol); 2799 return __sata_set_spd_needed(link, &scontrol);
2782} 2800}
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 8d64f8fd8f1d..ed8813b222a0 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1747,6 +1747,7 @@ static void ata_eh_link_autopsy(struct ata_link *link)
1747{ 1747{
1748 struct ata_port *ap = link->ap; 1748 struct ata_port *ap = link->ap;
1749 struct ata_eh_context *ehc = &link->eh_context; 1749 struct ata_eh_context *ehc = &link->eh_context;
1750 struct ata_device *dev;
1750 unsigned int all_err_mask = 0; 1751 unsigned int all_err_mask = 0;
1751 int tag, is_io = 0; 1752 int tag, is_io = 0;
1752 u32 serror; 1753 u32 serror;
@@ -1818,18 +1819,24 @@ static void ata_eh_link_autopsy(struct ata_link *link)
1818 (!is_io && (all_err_mask & ~AC_ERR_DEV))) 1819 (!is_io && (all_err_mask & ~AC_ERR_DEV)))
1819 ehc->i.action |= ATA_EH_REVALIDATE; 1820 ehc->i.action |= ATA_EH_REVALIDATE;
1820 1821
1821 /* if we have offending qcs and the associated failed device */ 1822 /* If we have offending qcs and the associated failed device,
1823 * perform per-dev EH action only on the offending device.
1824 */
1822 if (ehc->i.dev) { 1825 if (ehc->i.dev) {
1823 /* speed down */
1824 ehc->i.action |= ata_eh_speed_down(ehc->i.dev, is_io,
1825 all_err_mask);
1826
1827 /* perform per-dev EH action only on the offending device */
1828 ehc->i.dev_action[ehc->i.dev->devno] |= 1826 ehc->i.dev_action[ehc->i.dev->devno] |=
1829 ehc->i.action & ATA_EH_PERDEV_MASK; 1827 ehc->i.action & ATA_EH_PERDEV_MASK;
1830 ehc->i.action &= ~ATA_EH_PERDEV_MASK; 1828 ehc->i.action &= ~ATA_EH_PERDEV_MASK;
1831 } 1829 }
1832 1830
1831 /* consider speeding down */
1832 dev = ehc->i.dev;
1833 if (!dev && ata_link_max_devices(link) == 1 &&
1834 ata_dev_enabled(link->device))
1835 dev = link->device;
1836
1837 if (dev)
1838 ehc->i.action |= ata_eh_speed_down(dev, is_io, all_err_mask);
1839
1833 DPRINTK("EXIT\n"); 1840 DPRINTK("EXIT\n");
1834} 1841}
1835 1842
@@ -2065,16 +2072,19 @@ int ata_eh_reset(struct ata_link *link, int classify,
2065 ata_prereset_fn_t prereset, ata_reset_fn_t softreset, 2072 ata_prereset_fn_t prereset, ata_reset_fn_t softreset,
2066 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) 2073 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset)
2067{ 2074{
2075 const int max_tries = ARRAY_SIZE(ata_eh_reset_timeouts);
2068 struct ata_port *ap = link->ap; 2076 struct ata_port *ap = link->ap;
2069 struct ata_eh_context *ehc = &link->eh_context; 2077 struct ata_eh_context *ehc = &link->eh_context;
2070 unsigned int *classes = ehc->classes; 2078 unsigned int *classes = ehc->classes;
2079 unsigned int lflags = link->flags;
2071 int verbose = !(ehc->i.flags & ATA_EHI_QUIET); 2080 int verbose = !(ehc->i.flags & ATA_EHI_QUIET);
2072 int try = 0; 2081 int try = 0;
2073 struct ata_device *dev; 2082 struct ata_device *dev;
2074 unsigned long deadline; 2083 unsigned long deadline, now;
2075 unsigned int tmp_action; 2084 unsigned int tmp_action;
2076 ata_reset_fn_t reset; 2085 ata_reset_fn_t reset;
2077 unsigned long flags; 2086 unsigned long flags;
2087 u32 sstatus;
2078 int rc; 2088 int rc;
2079 2089
2080 /* about to reset */ 2090 /* about to reset */
@@ -2106,7 +2116,7 @@ int ata_eh_reset(struct ata_link *link, int classify,
2106 /* Determine which reset to use and record in ehc->i.action. 2116 /* Determine which reset to use and record in ehc->i.action.
2107 * prereset() may examine and modify it. 2117 * prereset() may examine and modify it.
2108 */ 2118 */
2109 if (softreset && (!hardreset || (!(link->flags & ATA_LFLAG_NO_SRST) && 2119 if (softreset && (!hardreset || (!(lflags & ATA_LFLAG_NO_SRST) &&
2110 !sata_set_spd_needed(link) && 2120 !sata_set_spd_needed(link) &&
2111 !(ehc->i.action & ATA_EH_HARDRESET)))) 2121 !(ehc->i.action & ATA_EH_HARDRESET))))
2112 tmp_action = ATA_EH_SOFTRESET; 2122 tmp_action = ATA_EH_SOFTRESET;
@@ -2181,82 +2191,64 @@ int ata_eh_reset(struct ata_link *link, int classify,
2181 "follow-up softreset required " 2191 "follow-up softreset required "
2182 "but no softreset avaliable\n"); 2192 "but no softreset avaliable\n");
2183 rc = -EINVAL; 2193 rc = -EINVAL;
2184 goto out; 2194 goto fail;
2185 } 2195 }
2186 2196
2187 ata_eh_about_to_do(link, NULL, ATA_EH_RESET_MASK); 2197 ata_eh_about_to_do(link, NULL, ATA_EH_RESET_MASK);
2188 rc = ata_do_reset(link, reset, classes, deadline); 2198 rc = ata_do_reset(link, reset, classes, deadline);
2189
2190 if (rc == 0 && classify && classes[0] == ATA_DEV_UNKNOWN &&
2191 !(link->flags & ATA_LFLAG_ASSUME_CLASS)) {
2192 ata_link_printk(link, KERN_ERR,
2193 "classification failed\n");
2194 rc = -EINVAL;
2195 goto out;
2196 }
2197 } 2199 }
2198 2200
2199 /* if we skipped follow-up srst, clear rc */ 2201 /* -EAGAIN can happen if we skipped followup SRST */
2200 if (rc == -EAGAIN) 2202 if (rc && rc != -EAGAIN)
2201 rc = 0; 2203 goto fail;
2202
2203 if (rc && rc != -ERESTART && try < ARRAY_SIZE(ata_eh_reset_timeouts)) {
2204 unsigned long now = jiffies;
2205
2206 if (time_before(now, deadline)) {
2207 unsigned long delta = deadline - jiffies;
2208
2209 ata_link_printk(link, KERN_WARNING, "reset failed "
2210 "(errno=%d), retrying in %u secs\n",
2211 rc, (jiffies_to_msecs(delta) + 999) / 1000);
2212 2204
2213 while (delta) 2205 /* was classification successful? */
2214 delta = schedule_timeout_uninterruptible(delta); 2206 if (classify && classes[0] == ATA_DEV_UNKNOWN &&
2207 !(lflags & ATA_LFLAG_ASSUME_CLASS)) {
2208 if (try < max_tries) {
2209 ata_link_printk(link, KERN_WARNING,
2210 "classification failed\n");
2211 rc = -EINVAL;
2212 goto fail;
2215 } 2213 }
2216 2214
2217 if (rc == -EPIPE || 2215 ata_link_printk(link, KERN_WARNING,
2218 try == ARRAY_SIZE(ata_eh_reset_timeouts) - 1) 2216 "classfication failed, assuming ATA\n");
2219 sata_down_spd_limit(link); 2217 lflags |= ATA_LFLAG_ASSUME_ATA;
2220 if (hardreset)
2221 reset = hardreset;
2222 goto retry;
2223 } 2218 }
2224 2219
2225 if (rc == 0) { 2220 ata_link_for_each_dev(dev, link) {
2226 u32 sstatus; 2221 /* After the reset, the device state is PIO 0 and the
2222 * controller state is undefined. Reset also wakes up
2223 * drives from sleeping mode.
2224 */
2225 dev->pio_mode = XFER_PIO_0;
2226 dev->flags &= ~ATA_DFLAG_SLEEPING;
2227 2227
2228 ata_link_for_each_dev(dev, link) { 2228 if (ata_link_offline(link))
2229 /* After the reset, the device state is PIO 0 2229 continue;
2230 * and the controller state is undefined.
2231 * Reset also wakes up drives from sleeping
2232 * mode.
2233 */
2234 dev->pio_mode = XFER_PIO_0;
2235 dev->flags &= ~ATA_DFLAG_SLEEPING;
2236 2230
2237 if (ata_link_offline(link)) 2231 /* apply class override and convert UNKNOWN to NONE */
2238 continue; 2232 if (lflags & ATA_LFLAG_ASSUME_ATA)
2233 classes[dev->devno] = ATA_DEV_ATA;
2234 else if (lflags & ATA_LFLAG_ASSUME_SEMB)
2235 classes[dev->devno] = ATA_DEV_SEMB_UNSUP; /* not yet */
2236 else if (classes[dev->devno] == ATA_DEV_UNKNOWN)
2237 classes[dev->devno] = ATA_DEV_NONE;
2238 }
2239 2239
2240 /* apply class override and convert UNKNOWN to NONE */ 2240 /* record current link speed */
2241 if (link->flags & ATA_LFLAG_ASSUME_ATA) 2241 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0)
2242 classes[dev->devno] = ATA_DEV_ATA; 2242 link->sata_spd = (sstatus >> 4) & 0xf;
2243 else if (link->flags & ATA_LFLAG_ASSUME_SEMB)
2244 classes[dev->devno] = ATA_DEV_SEMB_UNSUP; /* not yet */
2245 else if (classes[dev->devno] == ATA_DEV_UNKNOWN)
2246 classes[dev->devno] = ATA_DEV_NONE;
2247 }
2248 2243
2249 /* record current link speed */ 2244 if (postreset)
2250 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) 2245 postreset(link, classes);
2251 link->sata_spd = (sstatus >> 4) & 0xf;
2252 2246
2253 if (postreset) 2247 /* reset successful, schedule revalidation */
2254 postreset(link, classes); 2248 ata_eh_done(link, NULL, ehc->i.action & ATA_EH_RESET_MASK);
2249 ehc->i.action |= ATA_EH_REVALIDATE;
2255 2250
2256 /* reset successful, schedule revalidation */ 2251 rc = 0;
2257 ata_eh_done(link, NULL, ehc->i.action & ATA_EH_RESET_MASK);
2258 ehc->i.action |= ATA_EH_REVALIDATE;
2259 }
2260 out: 2252 out:
2261 /* clear hotplug flag */ 2253 /* clear hotplug flag */
2262 ehc->i.flags &= ~ATA_EHI_HOTPLUGGED; 2254 ehc->i.flags &= ~ATA_EHI_HOTPLUGGED;
@@ -2266,6 +2258,28 @@ int ata_eh_reset(struct ata_link *link, int classify,
2266 spin_unlock_irqrestore(ap->lock, flags); 2258 spin_unlock_irqrestore(ap->lock, flags);
2267 2259
2268 return rc; 2260 return rc;
2261
2262 fail:
2263 if (rc == -ERESTART || try >= max_tries)
2264 goto out;
2265
2266 now = jiffies;
2267 if (time_before(now, deadline)) {
2268 unsigned long delta = deadline - now;
2269
2270 ata_link_printk(link, KERN_WARNING, "reset failed "
2271 "(errno=%d), retrying in %u secs\n",
2272 rc, (jiffies_to_msecs(delta) + 999) / 1000);
2273
2274 while (delta)
2275 delta = schedule_timeout_uninterruptible(delta);
2276 }
2277
2278 if (rc == -EPIPE || try == max_tries - 1)
2279 sata_down_spd_limit(link);
2280 if (hardreset)
2281 reset = hardreset;
2282 goto retry;
2269} 2283}
2270 2284
2271static int ata_eh_revalidate_and_attach(struct ata_link *link, 2285static int ata_eh_revalidate_and_attach(struct ata_link *link,
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index fc89590d3772..245057df69d6 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -120,7 +120,7 @@ static const struct {
120 { MEDIUM_POWER, "medium_power" }, 120 { MEDIUM_POWER, "medium_power" },
121}; 121};
122 122
123const char *ata_scsi_lpm_get(enum link_pm policy) 123static const char *ata_scsi_lpm_get(enum link_pm policy)
124{ 124{
125 int i; 125 int i;
126 126
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index b4c37b9e413c..d015b4adcfe0 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -34,7 +34,8 @@ enum {
34 34
35 SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 35 SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
36 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | 36 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
37 ATA_FLAG_NCQ | ATA_FLAG_SKIP_D2H_BSY), 37 ATA_FLAG_NCQ),
38 SATA_FSL_HOST_LFLAGS = ATA_LFLAG_SKIP_D2H_BSY,
38 39
39 SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH, 40 SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH,
40 SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */ 41 SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */
@@ -264,10 +265,11 @@ struct sata_fsl_host_priv {
264 void __iomem *hcr_base; 265 void __iomem *hcr_base;
265 void __iomem *ssr_base; 266 void __iomem *ssr_base;
266 void __iomem *csr_base; 267 void __iomem *csr_base;
268 int irq;
267}; 269};
268 270
269static inline unsigned int sata_fsl_tag(unsigned int tag, 271static inline unsigned int sata_fsl_tag(unsigned int tag,
270 void __iomem * hcr_base) 272 void __iomem *hcr_base)
271{ 273{
272 /* We let libATA core do actual (queue) tag allocation */ 274 /* We let libATA core do actual (queue) tag allocation */
273 275
@@ -306,7 +308,7 @@ static void sata_fsl_setup_cmd_hdr_entry(struct sata_fsl_port_priv *pp,
306 pp->cmdslot[tag].prde_fis_len = 308 pp->cmdslot[tag].prde_fis_len =
307 cpu_to_le32((num_prde << 16) | (fis_len << 2)); 309 cpu_to_le32((num_prde << 16) | (fis_len << 2));
308 pp->cmdslot[tag].ttl = cpu_to_le32(data_xfer_len & ~0x03); 310 pp->cmdslot[tag].ttl = cpu_to_le32(data_xfer_len & ~0x03);
309 pp->cmdslot[tag].desc_info = cpu_to_le32((desc_info | (tag & 0x1F))); 311 pp->cmdslot[tag].desc_info = cpu_to_le32(desc_info | (tag & 0x1F));
310 312
311 VPRINTK("cda=0x%x, prde_fis_len=0x%x, ttl=0x%x, di=0x%x\n", 313 VPRINTK("cda=0x%x, prde_fis_len=0x%x, ttl=0x%x, di=0x%x\n",
312 pp->cmdslot[tag].cda, 314 pp->cmdslot[tag].cda,
@@ -316,7 +318,7 @@ static void sata_fsl_setup_cmd_hdr_entry(struct sata_fsl_port_priv *pp,
316} 318}
317 319
318static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc, 320static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc,
319 u32 * ttl, dma_addr_t cmd_desc_paddr) 321 u32 *ttl, dma_addr_t cmd_desc_paddr)
320{ 322{
321 struct scatterlist *sg; 323 struct scatterlist *sg;
322 unsigned int num_prde = 0; 324 unsigned int num_prde = 0;
@@ -353,7 +355,7 @@ static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc,
353 "s/g len unaligned : 0x%x\n", sg_len); 355 "s/g len unaligned : 0x%x\n", sg_len);
354 356
355 if ((num_prde == (SATA_FSL_MAX_PRD_DIRECT - 1)) && 357 if ((num_prde == (SATA_FSL_MAX_PRD_DIRECT - 1)) &&
356 !ata_sg_is_last(sg, qc)) { 358 (qc->n_iter + 1 != qc->n_elem)) {
357 VPRINTK("setting indirect prde\n"); 359 VPRINTK("setting indirect prde\n");
358 prd_ptr_to_indirect_ext = prd; 360 prd_ptr_to_indirect_ext = prd;
359 prd->dba = cpu_to_le32(indirect_ext_segment_paddr); 361 prd->dba = cpu_to_le32(indirect_ext_segment_paddr);
@@ -404,7 +406,7 @@ static void sata_fsl_qc_prep(struct ata_queued_cmd *qc)
404 cd = (struct command_desc *)pp->cmdentry + tag; 406 cd = (struct command_desc *)pp->cmdentry + tag;
405 cd_paddr = pp->cmdentry_paddr + tag * SATA_FSL_CMD_DESC_SIZE; 407 cd_paddr = pp->cmdentry_paddr + tag * SATA_FSL_CMD_DESC_SIZE;
406 408
407 ata_tf_to_fis(&qc->tf, 0, 1, (u8 *) & cd->cfis); 409 ata_tf_to_fis(&qc->tf, 0, 1, (u8 *) &cd->cfis);
408 410
409 VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n", 411 VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n",
410 cd->cfis[0], cd->cfis[1], cd->cfis[2]); 412 cd->cfis[0], cd->cfis[1], cd->cfis[2]);
@@ -470,16 +472,10 @@ static int sata_fsl_scr_write(struct ata_port *ap, unsigned int sc_reg_in,
470 472
471 switch (sc_reg_in) { 473 switch (sc_reg_in) {
472 case SCR_STATUS: 474 case SCR_STATUS:
473 sc_reg = 0;
474 break;
475 case SCR_ERROR: 475 case SCR_ERROR:
476 sc_reg = 1;
477 break;
478 case SCR_CONTROL: 476 case SCR_CONTROL:
479 sc_reg = 2;
480 break;
481 case SCR_ACTIVE: 477 case SCR_ACTIVE:
482 sc_reg = 3; 478 sc_reg = sc_reg_in;
483 break; 479 break;
484 default: 480 default:
485 return -EINVAL; 481 return -EINVAL;
@@ -487,7 +483,7 @@ static int sata_fsl_scr_write(struct ata_port *ap, unsigned int sc_reg_in,
487 483
488 VPRINTK("xx_scr_write, reg_in = %d\n", sc_reg); 484 VPRINTK("xx_scr_write, reg_in = %d\n", sc_reg);
489 485
490 iowrite32(val, (void __iomem *)ssr_base + (sc_reg * 4)); 486 iowrite32(val, ssr_base + (sc_reg * 4));
491 return 0; 487 return 0;
492} 488}
493 489
@@ -500,16 +496,10 @@ static int sata_fsl_scr_read(struct ata_port *ap, unsigned int sc_reg_in,
500 496
501 switch (sc_reg_in) { 497 switch (sc_reg_in) {
502 case SCR_STATUS: 498 case SCR_STATUS:
503 sc_reg = 0;
504 break;
505 case SCR_ERROR: 499 case SCR_ERROR:
506 sc_reg = 1;
507 break;
508 case SCR_CONTROL: 500 case SCR_CONTROL:
509 sc_reg = 2;
510 break;
511 case SCR_ACTIVE: 501 case SCR_ACTIVE:
512 sc_reg = 3; 502 sc_reg = sc_reg_in;
513 break; 503 break;
514 default: 504 default:
515 return -EINVAL; 505 return -EINVAL;
@@ -517,7 +507,7 @@ static int sata_fsl_scr_read(struct ata_port *ap, unsigned int sc_reg_in,
517 507
518 VPRINTK("xx_scr_read, reg_in = %d\n", sc_reg); 508 VPRINTK("xx_scr_read, reg_in = %d\n", sc_reg);
519 509
520 *val = ioread32((void __iomem *)ssr_base + (sc_reg * 4)); 510 *val = ioread32(ssr_base + (sc_reg * 4));
521 return 0; 511 return 0;
522} 512}
523 513
@@ -571,7 +561,6 @@ static inline void sata_fsl_cache_taskfile_from_d2h_fis(struct ata_queued_cmd
571 struct ata_port *ap) 561 struct ata_port *ap)
572{ 562{
573 struct sata_fsl_port_priv *pp = ap->private_data; 563 struct sata_fsl_port_priv *pp = ap->private_data;
574 u8 fis[6 * 4];
575 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 564 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
576 void __iomem *hcr_base = host_priv->hcr_base; 565 void __iomem *hcr_base = host_priv->hcr_base;
577 unsigned int tag = sata_fsl_tag(qc->tag, hcr_base); 566 unsigned int tag = sata_fsl_tag(qc->tag, hcr_base);
@@ -579,8 +568,7 @@ static inline void sata_fsl_cache_taskfile_from_d2h_fis(struct ata_queued_cmd
579 568
580 cd = pp->cmdentry + tag; 569 cd = pp->cmdentry + tag;
581 570
582 memcpy(fis, &cd->sfis, 6 * 4); /* should we use memcpy_from_io() */ 571 ata_tf_from_fis(cd->sfis, &pp->tf);
583 ata_tf_from_fis(fis, &pp->tf);
584} 572}
585 573
586static u8 sata_fsl_check_status(struct ata_port *ap) 574static u8 sata_fsl_check_status(struct ata_port *ap)
@@ -664,6 +652,7 @@ static int sata_fsl_port_start(struct ata_port *ap)
664 VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL)); 652 VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
665 VPRINTK("CHBA = 0x%x\n", ioread32(hcr_base + CHBA)); 653 VPRINTK("CHBA = 0x%x\n", ioread32(hcr_base + CHBA));
666 654
655#ifdef CONFIG_MPC8315_DS
667 /* 656 /*
668 * Workaround for 8315DS board 3gbps link-up issue, 657 * Workaround for 8315DS board 3gbps link-up issue,
669 * currently limit SATA port to GEN1 speed 658 * currently limit SATA port to GEN1 speed
@@ -676,6 +665,7 @@ static int sata_fsl_port_start(struct ata_port *ap)
676 sata_fsl_scr_read(ap, SCR_CONTROL, &temp); 665 sata_fsl_scr_read(ap, SCR_CONTROL, &temp);
677 dev_printk(KERN_WARNING, dev, "scr_control, speed limited to %x\n", 666 dev_printk(KERN_WARNING, dev, "scr_control, speed limited to %x\n",
678 temp); 667 temp);
668#endif
679 669
680 return 0; 670 return 0;
681} 671}
@@ -728,9 +718,10 @@ static unsigned int sata_fsl_dev_classify(struct ata_port *ap)
728 return ata_dev_classify(&tf); 718 return ata_dev_classify(&tf);
729} 719}
730 720
731static int sata_fsl_softreset(struct ata_port *ap, unsigned int *class, 721static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
732 unsigned long deadline) 722 unsigned long deadline)
733{ 723{
724 struct ata_port *ap = link->ap;
734 struct sata_fsl_port_priv *pp = ap->private_data; 725 struct sata_fsl_port_priv *pp = ap->private_data;
735 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 726 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
736 void __iomem *hcr_base = host_priv->hcr_base; 727 void __iomem *hcr_base = host_priv->hcr_base;
@@ -739,10 +730,6 @@ static int sata_fsl_softreset(struct ata_port *ap, unsigned int *class,
739 u8 *cfis; 730 u8 *cfis;
740 u32 Serror; 731 u32 Serror;
741 int i = 0; 732 int i = 0;
742 struct ata_queued_cmd qc;
743 u8 *buf;
744 dma_addr_t dma_address;
745 struct scatterlist *sg;
746 unsigned long start_jiffies; 733 unsigned long start_jiffies;
747 734
748 DPRINTK("in xx_softreset\n"); 735 DPRINTK("in xx_softreset\n");
@@ -811,7 +798,7 @@ try_offline_again:
811 */ 798 */
812 799
813 temp = ata_wait_register(hcr_base + HSTATUS, 0xFF, 0, 1, 500); 800 temp = ata_wait_register(hcr_base + HSTATUS, 0xFF, 0, 1, 500);
814 if ((!(temp & 0x10)) || ata_port_offline(ap)) { 801 if ((!(temp & 0x10)) || ata_link_offline(link)) {
815 ata_port_printk(ap, KERN_WARNING, 802 ata_port_printk(ap, KERN_WARNING,
816 "No Device OR PHYRDY change,Hstatus = 0x%x\n", 803 "No Device OR PHYRDY change,Hstatus = 0x%x\n",
817 ioread32(hcr_base + HSTATUS)); 804 ioread32(hcr_base + HSTATUS));
@@ -842,13 +829,10 @@ try_offline_again:
842 * reached here, we can send a command to the target device 829 * reached here, we can send a command to the target device
843 */ 830 */
844 831
845 if (ap->sactive)
846 goto skip_srst_do_ncq_error_handling;
847
848 DPRINTK("Sending SRST/device reset\n"); 832 DPRINTK("Sending SRST/device reset\n");
849 833
850 ata_tf_init(ap->device, &tf); 834 ata_tf_init(link->device, &tf);
851 cfis = (u8 *) & pp->cmdentry->cfis; 835 cfis = (u8 *) &pp->cmdentry->cfis;
852 836
853 /* device reset/SRST is a control register update FIS, uses tag0 */ 837 /* device reset/SRST is a control register update FIS, uses tag0 */
854 sata_fsl_setup_cmd_hdr_entry(pp, 0, 838 sata_fsl_setup_cmd_hdr_entry(pp, 0,
@@ -912,76 +896,13 @@ try_offline_again:
912 * command bit of the CCreg 896 * command bit of the CCreg
913 */ 897 */
914 iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */ 898 iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */
915 goto check_device_signature;
916
917skip_srst_do_ncq_error_handling:
918
919 VPRINTK("Sending read log ext(10h) command\n");
920
921 memset(&qc, 0, sizeof(struct ata_queued_cmd));
922 ata_tf_init(ap->device, &tf);
923
924 tf.command = ATA_CMD_READ_LOG_EXT;
925 tf.lbal = ATA_LOG_SATA_NCQ;
926 tf.nsect = 1;
927 tf.hob_nsect = 0;
928 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_LBA48 | ATA_TFLAG_DEVICE;
929 tf.protocol = ATA_PROT_PIO;
930
931 qc.tag = ATA_TAG_INTERNAL;
932 qc.scsicmd = NULL;
933 qc.ap = ap;
934 qc.dev = ap->device;
935
936 qc.tf = tf;
937 qc.flags |= ATA_QCFLAG_RESULT_TF;
938 qc.dma_dir = DMA_FROM_DEVICE;
939
940 buf = ap->sector_buf;
941 ata_sg_init_one(&qc, buf, 1 * ATA_SECT_SIZE);
942
943 /*
944 * Need to DMA-map the memory buffer associated with the command
945 */
946
947 sg = qc.__sg;
948 dma_address = dma_map_single(ap->dev, qc.buf_virt,
949 sg->length, DMA_FROM_DEVICE);
950
951 sg_dma_address(sg) = dma_address;
952 sg_dma_len(sg) = sg->length;
953
954 VPRINTK("EH, addr = 0x%x, len = 0x%x\n", dma_address, sg->length);
955
956 sata_fsl_qc_prep(&qc);
957 sata_fsl_qc_issue(&qc);
958
959 temp = ata_wait_register(CQ + hcr_base, 0x1, 0x1, 1, 5000);
960 if (temp & 0x1) {
961 VPRINTK("READ_LOG_EXT_10H issue failed\n");
962
963 VPRINTK("READ_LOG@5000,CQ=0x%x,CA=0x%x,CC=0x%x\n",
964 ioread32(CQ + hcr_base),
965 ioread32(CA + hcr_base), ioread32(CC + hcr_base));
966
967 sata_fsl_scr_read(ap, SCR_ERROR, &Serror);
968
969 VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
970 VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
971 VPRINTK("Serror = 0x%x\n", Serror);
972 goto err;
973 }
974
975 iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */
976
977 check_device_signature:
978 899
979 DPRINTK("SATA FSL : Now checking device signature\n"); 900 DPRINTK("SATA FSL : Now checking device signature\n");
980 901
981 *class = ATA_DEV_NONE; 902 *class = ATA_DEV_NONE;
982 903
983 /* Verify if SStatus indicates device presence */ 904 /* Verify if SStatus indicates device presence */
984 if (ata_port_online(ap)) { 905 if (ata_link_online(link)) {
985 /* 906 /*
986 * if we are here, device presence has been detected, 907 * if we are here, device presence has been detected,
987 * 1st D2H FIS would have been received, but sfis in 908 * 1st D2H FIS would have been received, but sfis in
@@ -1002,25 +923,13 @@ err:
1002 return -EIO; 923 return -EIO;
1003} 924}
1004 925
1005static int sata_fsl_hardreset(struct ata_port *ap, unsigned int *class,
1006 unsigned long deadline)
1007{
1008 int retval;
1009
1010 retval = sata_std_hardreset(ap, class, deadline);
1011
1012 DPRINTK("SATA FSL : in xx_hardreset, retval = 0x%d\n", retval);
1013
1014 return retval;
1015}
1016
1017static void sata_fsl_error_handler(struct ata_port *ap) 926static void sata_fsl_error_handler(struct ata_port *ap)
1018{ 927{
1019 928
1020 DPRINTK("in xx_error_handler\n"); 929 DPRINTK("in xx_error_handler\n");
1021 930
1022 /* perform recovery */ 931 /* perform recovery */
1023 ata_do_eh(ap, ata_std_prereset, sata_fsl_softreset, sata_fsl_hardreset, 932 ata_do_eh(ap, ata_std_prereset, sata_fsl_softreset, sata_std_hardreset,
1024 ata_std_postreset); 933 ata_std_postreset);
1025} 934}
1026 935
@@ -1042,7 +951,8 @@ static void sata_fsl_irq_clear(struct ata_port *ap)
1042 951
1043static void sata_fsl_error_intr(struct ata_port *ap) 952static void sata_fsl_error_intr(struct ata_port *ap)
1044{ 953{
1045 struct ata_eh_info *ehi = &ap->eh_info; 954 struct ata_link *link = &ap->link;
955 struct ata_eh_info *ehi = &link->eh_info;
1046 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 956 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
1047 void __iomem *hcr_base = host_priv->hcr_base; 957 void __iomem *hcr_base = host_priv->hcr_base;
1048 u32 hstatus, dereg, cereg = 0, SError = 0; 958 u32 hstatus, dereg, cereg = 0, SError = 0;
@@ -1111,7 +1021,7 @@ static void sata_fsl_error_intr(struct ata_port *ap)
1111 } 1021 }
1112 1022
1113 /* record error info */ 1023 /* record error info */
1114 qc = ata_qc_from_tag(ap, ap->active_tag); 1024 qc = ata_qc_from_tag(ap, link->active_tag);
1115 1025
1116 if (qc) { 1026 if (qc) {
1117 sata_fsl_cache_taskfile_from_d2h_fis(qc, qc->ap); 1027 sata_fsl_cache_taskfile_from_d2h_fis(qc, qc->ap);
@@ -1139,6 +1049,7 @@ static void sata_fsl_qc_complete(struct ata_queued_cmd *qc)
1139 1049
1140static void sata_fsl_host_intr(struct ata_port *ap) 1050static void sata_fsl_host_intr(struct ata_port *ap)
1141{ 1051{
1052 struct ata_link *link = &ap->link;
1142 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 1053 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
1143 void __iomem *hcr_base = host_priv->hcr_base; 1054 void __iomem *hcr_base = host_priv->hcr_base;
1144 u32 hstatus, qc_active = 0; 1055 u32 hstatus, qc_active = 0;
@@ -1161,7 +1072,7 @@ static void sata_fsl_host_intr(struct ata_port *ap)
1161 return; 1072 return;
1162 } 1073 }
1163 1074
1164 if (ap->sactive) { /* only true for NCQ commands */ 1075 if (link->sactive) { /* only true for NCQ commands */
1165 int i; 1076 int i;
1166 /* Read command completed register */ 1077 /* Read command completed register */
1167 qc_active = ioread32(hcr_base + CC); 1078 qc_active = ioread32(hcr_base + CC);
@@ -1190,10 +1101,10 @@ static void sata_fsl_host_intr(struct ata_port *ap)
1190 1101
1191 } else if (ap->qc_active) { 1102 } else if (ap->qc_active) {
1192 iowrite32(1, hcr_base + CC); 1103 iowrite32(1, hcr_base + CC);
1193 qc = ata_qc_from_tag(ap, ap->active_tag); 1104 qc = ata_qc_from_tag(ap, link->active_tag);
1194 1105
1195 DPRINTK("completing non-ncq cmd, tag=%d,CC=0x%x\n", 1106 DPRINTK("completing non-ncq cmd, tag=%d,CC=0x%x\n",
1196 ap->active_tag, ioread32(hcr_base + CC)); 1107 link->active_tag, ioread32(hcr_base + CC));
1197 1108
1198 if (qc) { 1109 if (qc) {
1199 sata_fsl_qc_complete(qc); 1110 sata_fsl_qc_complete(qc);
@@ -1312,15 +1223,9 @@ static struct scsi_host_template sata_fsl_sht = {
1312 .slave_configure = ata_scsi_slave_config, 1223 .slave_configure = ata_scsi_slave_config,
1313 .slave_destroy = ata_scsi_slave_destroy, 1224 .slave_destroy = ata_scsi_slave_destroy,
1314 .bios_param = ata_std_bios_param, 1225 .bios_param = ata_std_bios_param,
1315#ifdef CONFIG_PM
1316 .suspend = ata_scsi_device_suspend,
1317 .resume = ata_scsi_device_resume,
1318#endif
1319}; 1226};
1320 1227
1321static const struct ata_port_operations sata_fsl_ops = { 1228static const struct ata_port_operations sata_fsl_ops = {
1322 .port_disable = ata_port_disable,
1323
1324 .check_status = sata_fsl_check_status, 1229 .check_status = sata_fsl_check_status,
1325 .check_altstatus = sata_fsl_check_status, 1230 .check_altstatus = sata_fsl_check_status,
1326 .dev_select = ata_noop_dev_select, 1231 .dev_select = ata_noop_dev_select,
@@ -1330,8 +1235,6 @@ static const struct ata_port_operations sata_fsl_ops = {
1330 .qc_prep = sata_fsl_qc_prep, 1235 .qc_prep = sata_fsl_qc_prep,
1331 .qc_issue = sata_fsl_qc_issue, 1236 .qc_issue = sata_fsl_qc_issue,
1332 .irq_clear = sata_fsl_irq_clear, 1237 .irq_clear = sata_fsl_irq_clear,
1333 .irq_on = ata_dummy_irq_on,
1334 .irq_ack = ata_dummy_irq_ack,
1335 1238
1336 .scr_read = sata_fsl_scr_read, 1239 .scr_read = sata_fsl_scr_read,
1337 .scr_write = sata_fsl_scr_write, 1240 .scr_write = sata_fsl_scr_write,
@@ -1348,6 +1251,7 @@ static const struct ata_port_operations sata_fsl_ops = {
1348static const struct ata_port_info sata_fsl_port_info[] = { 1251static const struct ata_port_info sata_fsl_port_info[] = {
1349 { 1252 {
1350 .flags = SATA_FSL_HOST_FLAGS, 1253 .flags = SATA_FSL_HOST_FLAGS,
1254 .link_flags = SATA_FSL_HOST_LFLAGS,
1351 .pio_mask = 0x1f, /* pio 0-4 */ 1255 .pio_mask = 0x1f, /* pio 0-4 */
1352 .udma_mask = 0x7f, /* udma 0-6 */ 1256 .udma_mask = 0x7f, /* udma 0-6 */
1353 .port_ops = &sata_fsl_ops, 1257 .port_ops = &sata_fsl_ops,
@@ -1398,6 +1302,7 @@ static int sata_fsl_probe(struct of_device *ofdev,
1398 dev_printk(KERN_ERR, &ofdev->dev, "invalid irq from platform\n"); 1302 dev_printk(KERN_ERR, &ofdev->dev, "invalid irq from platform\n");
1399 goto error_exit_with_cleanup; 1303 goto error_exit_with_cleanup;
1400 } 1304 }
1305 host_priv->irq = irq;
1401 1306
1402 /* allocate host structure */ 1307 /* allocate host structure */
1403 host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_FSL_MAX_PORTS); 1308 host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_FSL_MAX_PORTS);
@@ -1444,7 +1349,7 @@ static int sata_fsl_remove(struct of_device *ofdev)
1444 1349
1445 dev_set_drvdata(&ofdev->dev, NULL); 1350 dev_set_drvdata(&ofdev->dev, NULL);
1446 1351
1447 irq_dispose_mapping(host->irq); 1352 irq_dispose_mapping(host_priv->irq);
1448 iounmap(host_priv->hcr_base); 1353 iounmap(host_priv->hcr_base);
1449 kfree(host_priv); 1354 kfree(host_priv);
1450 1355
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 825e717bcef9..7914def54fa3 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -587,7 +587,7 @@ static void pdc_fill_sg(struct ata_queued_cmd *qc)
587 VPRINTK("Splitting last PRD.\n"); 587 VPRINTK("Splitting last PRD.\n");
588 588
589 addr = le32_to_cpu(ap->prd[idx - 1].addr); 589 addr = le32_to_cpu(ap->prd[idx - 1].addr);
590 ap->prd[idx - 1].flags_len -= cpu_to_le32(SG_COUNT_ASIC_BUG); 590 ap->prd[idx - 1].flags_len = cpu_to_le32(len - SG_COUNT_ASIC_BUG);
591 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx - 1, addr, SG_COUNT_ASIC_BUG); 591 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx - 1, addr, SG_COUNT_ASIC_BUG);
592 592
593 addr = addr + len - SG_COUNT_ASIC_BUG; 593 addr = addr + len - SG_COUNT_ASIC_BUG;
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 128dc7ad4901..61535e72834d 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -43,6 +43,7 @@ enum {
43 ATA_MAX_SECTORS_128 = 128, 43 ATA_MAX_SECTORS_128 = 128,
44 ATA_MAX_SECTORS = 256, 44 ATA_MAX_SECTORS = 256,
45 ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */ 45 ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */
46 ATA_MAX_SECTORS_TAPE = 65535,
46 47
47 ATA_ID_WORDS = 256, 48 ATA_ID_WORDS = 256,
48 ATA_ID_SERNO = 10, 49 ATA_ID_SERNO = 10,
@@ -544,6 +545,11 @@ static inline int atapi_cdb_len(const u16 *dev_id)
544 } 545 }
545} 546}
546 547
548static inline int atapi_command_packet_set(const u16 *dev_id)
549{
550 return (dev_id[0] >> 8) & 0x1f;
551}
552
547static inline int is_atapi_taskfile(const struct ata_taskfile *tf) 553static inline int is_atapi_taskfile(const struct ata_taskfile *tf)
548{ 554{
549 return (tf->protocol == ATA_PROT_ATAPI) || 555 return (tf->protocol == ATA_PROT_ATAPI) ||