Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
[libata] pata_it821x: fix warning
libata: Fix a large collection of DMA mode mismatches
ahci: sis controllers actually can do PMP
pata_via: clean up recent tf_load changes
libata: restore SControl on detach
libata: use ata_link_printk() when printing SError
libata: always do follow-up SRST if hardreset returned -EAGAIN
libata: fix EH action overwriting in ata_eh_reset()
sata_mv: add the Gen IIE flag to the SoC devices.
ata_piix: IDE Mode SATA patch for Intel Ibex Peak DeviceIDs
ahci: RAID mode SATA patch for Intel Ibex Peak DeviceIDs
sata_mv: don't issue two DMA commands concurrently
libata: implement no[hs]rst force params

+123 -126
+3
Documentation/kernel-parameters.txt
··· 1074 1075 * [no]ncq: Turn on or off NCQ. 1076 1077 If there are multiple matching configurations changing 1078 the same attribute, the last one is used. 1079
··· 1074 1075 * [no]ncq: Turn on or off NCQ. 1076 1077 + * nohrst, nosrst, norst: suppress hard, soft 1078 + and both resets. 1079 + 1080 If there are multiple matching configurations changing 1081 the same attribute, the last one is used. 1082
+5 -3
drivers/ata/ahci.c
··· 486 { PCI_VDEVICE(INTEL, 0x502b), board_ahci }, /* Tolapai */ 487 { PCI_VDEVICE(INTEL, 0x3a05), board_ahci }, /* ICH10 */ 488 { PCI_VDEVICE(INTEL, 0x3a25), board_ahci }, /* ICH10 */ 489 490 /* JMicron 360/1/3/5/6, match class to avoid IDE function */ 491 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, ··· 577 { PCI_VDEVICE(NVIDIA, 0x0bc7), board_ahci }, /* MCP7B */ 578 579 /* SiS */ 580 - { PCI_VDEVICE(SI, 0x1184), board_ahci_nopmp }, /* SiS 966 */ 581 - { PCI_VDEVICE(SI, 0x1185), board_ahci_nopmp }, /* SiS 968 */ 582 - { PCI_VDEVICE(SI, 0x0186), board_ahci_nopmp }, /* SiS 968 */ 583 584 /* Marvell */ 585 { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */
··· 486 { PCI_VDEVICE(INTEL, 0x502b), board_ahci }, /* Tolapai */ 487 { PCI_VDEVICE(INTEL, 0x3a05), board_ahci }, /* ICH10 */ 488 { PCI_VDEVICE(INTEL, 0x3a25), board_ahci }, /* ICH10 */ 489 + { PCI_VDEVICE(INTEL, 0x3b24), board_ahci }, /* PCH RAID */ 490 + { PCI_VDEVICE(INTEL, 0x3b2b), board_ahci }, /* PCH RAID */ 491 492 /* JMicron 360/1/3/5/6, match class to avoid IDE function */ 493 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, ··· 575 { PCI_VDEVICE(NVIDIA, 0x0bc7), board_ahci }, /* MCP7B */ 576 577 /* SiS */ 578 + { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */ 579 + { PCI_VDEVICE(SI, 0x1185), board_ahci }, /* SiS 968 */ 580 + { PCI_VDEVICE(SI, 0x0186), board_ahci }, /* SiS 968 */ 581 582 /* Marvell */ 583 { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */
+8
drivers/ata/ata_piix.c
··· 275 { 0x8086, 0x3a20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, 276 /* SATA Controller IDE (ICH10) */ 277 { 0x8086, 0x3a26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 278 279 { } /* terminate list */ 280 };
··· 275 { 0x8086, 0x3a20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, 276 /* SATA Controller IDE (ICH10) */ 277 { 0x8086, 0x3a26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 278 + /* SATA Controller IDE (PCH) */ 279 + { 0x8086, 0x3b20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, 280 + /* SATA Controller IDE (PCH) */ 281 + { 0x8086, 0x3b26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 282 + /* SATA Controller IDE (PCH) */ 283 + { 0x8086, 0x3b2d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 284 + /* SATA Controller IDE (PCH) */ 285 + { 0x8086, 0x3b2e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, 286 287 { } /* terminate list */ 288 };
+37 -23
drivers/ata/libata-core.c
··· 104 unsigned long xfer_mask; 105 unsigned int horkage_on; 106 unsigned int horkage_off; 107 }; 108 109 struct ata_force_ent { ··· 197 } 198 199 /** 200 - * ata_force_spd_limit - force SATA spd limit according to libata.force 201 * @link: ATA link of interest 202 * 203 - * Force SATA spd limit according to libata.force and whine about 204 - * it. When only the port part is specified (e.g. 1:), the limit 205 - * applies to all links connected to both the host link and all 206 - * fan-out ports connected via PMP. If the device part is 207 - * specified as 0 (e.g. 1.00:), it specifies the first fan-out 208 - * link not the host link. Device number 15 always points to the 209 - * host link whether PMP is attached or not. 210 * 211 * LOCKING: 212 * EH context. 213 */ 214 - static void ata_force_spd_limit(struct ata_link *link) 215 { 216 int linkno, i; 217 218 if (ata_is_host_link(link)) ··· 230 if (fe->device != -1 && fe->device != linkno) 231 continue; 232 233 - if (!fe->param.spd_limit) 234 - continue; 235 236 - link->hw_sata_spd_limit = (1 << fe->param.spd_limit) - 1; 237 - ata_link_printk(link, KERN_NOTICE, 238 - "FORCE: PHY spd limit set to %s\n", fe->param.name); 239 - return; 240 } 241 } 242 ··· 3288 dev->dma_mode = ata_xfer_mask2mode(dma_mask); 3289 3290 found = 1; 3291 - if (dev->dma_mode != 0xff) 3292 used_dma = 1; 3293 } 3294 if (!found) ··· 3313 3314 /* step 3: set host DMA timings */ 3315 ata_link_for_each_dev(dev, link) { 3316 - if (!ata_dev_enabled(dev) || dev->dma_mode == 0xff) 3317 continue; 3318 3319 dev->xfer_mode = dev->dma_mode; ··· 5199 */ 5200 int sata_link_init_spd(struct ata_link *link) 5201 { 5202 - u32 scontrol; 5203 u8 spd; 5204 int rc; 5205 5206 - rc = sata_scr_read(link, SCR_CONTROL, &scontrol); 5207 if (rc) 5208 return rc; 5209 5210 - spd = (scontrol >> 4) & 0xf; 5211 if (spd) 5212 link->hw_sata_spd_limit &= (1 << spd) - 1; 5213 5214 - ata_force_spd_limit(link); 5215 5216 link->sata_spd_limit = link->hw_sata_spd_limit; 5217 ··· 5793 ata_port_wait_eh(ap); 5794 5795 /* EH is now guaranteed to see UNLOADING - EH context belongs 5796 - * to us. Disable all existing devices. 5797 */ 5798 - ata_port_for_each_link(link, ap) { 5799 ata_link_for_each_dev(dev, link) 5800 ata_dev_disable(dev); 5801 } ··· 6002 { "udma133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) }, 6003 { "udma/133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) }, 6004 { "udma7", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 7) }, 6005 }; 6006 char *start = *cur, *p = *cur; 6007 char *id, *val, *endp;
··· 104 unsigned long xfer_mask; 105 unsigned int horkage_on; 106 unsigned int horkage_off; 107 + unsigned int lflags; 108 }; 109 110 struct ata_force_ent { ··· 196 } 197 198 /** 199 + * ata_force_link_limits - force link limits according to libata.force 200 * @link: ATA link of interest 201 * 202 + * Force link flags and SATA spd limit according to libata.force 203 + * and whine about it. When only the port part is specified 204 + * (e.g. 1:), the limit applies to all links connected to both 205 + * the host link and all fan-out ports connected via PMP. If the 206 + * device part is specified as 0 (e.g. 1.00:), it specifies the 207 + * first fan-out link not the host link. Device number 15 always 208 + * points to the host link whether PMP is attached or not. 209 * 210 * LOCKING: 211 * EH context. 212 */ 213 + static void ata_force_link_limits(struct ata_link *link) 214 { 215 + bool did_spd = false; 216 int linkno, i; 217 218 if (ata_is_host_link(link)) ··· 228 if (fe->device != -1 && fe->device != linkno) 229 continue; 230 231 + /* only honor the first spd limit */ 232 + if (!did_spd && fe->param.spd_limit) { 233 + link->hw_sata_spd_limit = (1 << fe->param.spd_limit) - 1; 234 + ata_link_printk(link, KERN_NOTICE, 235 + "FORCE: PHY spd limit set to %s\n", 236 + fe->param.name); 237 + did_spd = true; 238 + } 239 240 + /* let lflags stack */ 241 + if (fe->param.lflags) { 242 + link->flags |= fe->param.lflags; 243 + ata_link_printk(link, KERN_NOTICE, 244 + "FORCE: link flag 0x%x forced -> 0x%x\n", 245 + fe->param.lflags, link->flags); 246 + } 247 } 248 } 249 ··· 3277 dev->dma_mode = ata_xfer_mask2mode(dma_mask); 3278 3279 found = 1; 3280 + if (ata_dma_enabled(dev)) 3281 used_dma = 1; 3282 } 3283 if (!found) ··· 3302 3303 /* step 3: set host DMA timings */ 3304 ata_link_for_each_dev(dev, link) { 3305 + if (!ata_dev_enabled(dev) || !ata_dma_enabled(dev)) 3306 continue; 3307 3308 dev->xfer_mode = dev->dma_mode; ··· 5188 */ 5189 int sata_link_init_spd(struct ata_link *link) 5190 { 5191 u8 spd; 5192 int rc; 5193 5194 + rc = sata_scr_read(link, SCR_CONTROL, &link->saved_scontrol); 5195 if (rc) 5196 return rc; 5197 5198 + spd = (link->saved_scontrol >> 4) & 0xf; 5199 if (spd) 5200 link->hw_sata_spd_limit &= (1 << spd) - 1; 5201 5202 + ata_force_link_limits(link); 5203 5204 link->sata_spd_limit = link->hw_sata_spd_limit; 5205 ··· 5783 ata_port_wait_eh(ap); 5784 5785 /* EH is now guaranteed to see UNLOADING - EH context belongs 5786 + * to us. Restore SControl and disable all existing devices. 5787 */ 5788 + __ata_port_for_each_link(link, ap) { 5789 + sata_scr_write(link, SCR_CONTROL, link->saved_scontrol); 5790 ata_link_for_each_dev(dev, link) 5791 ata_dev_disable(dev); 5792 } ··· 5991 { "udma133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) }, 5992 { "udma/133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) }, 5993 { "udma7", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 7) }, 5994 + { "nohrst", .lflags = ATA_LFLAG_NO_HRST }, 5995 + { "nosrst", .lflags = ATA_LFLAG_NO_SRST }, 5996 + { "norst", .lflags = ATA_LFLAG_NO_HRST | ATA_LFLAG_NO_SRST }, 5997 }; 5998 char *start = *cur, *p = *cur; 5999 char *id, *val, *endp;
+13 -17
drivers/ata/libata-eh.c
··· 2040 } 2041 2042 if (ehc->i.serror) 2043 - ata_port_printk(ap, KERN_ERR, 2044 "SError: { %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s}\n", 2045 ehc->i.serror & SERR_DATA_RECOVERED ? "RecovData " : "", 2046 ehc->i.serror & SERR_COMM_RECOVERED ? "RecovComm " : "", ··· 2171 } 2172 2173 static int ata_eh_followup_srst_needed(struct ata_link *link, 2174 - int rc, int classify, 2175 - const unsigned int *classes) 2176 { 2177 if ((link->flags & ATA_LFLAG_NO_SRST) || ata_link_offline(link)) 2178 return 0; 2179 - if (rc == -EAGAIN) { 2180 - if (classify) 2181 - return 1; 2182 - rc = 0; 2183 - } 2184 - if (rc != 0) 2185 - return 0; 2186 if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) 2187 return 1; 2188 return 0; ··· 2204 */ 2205 while (ata_eh_reset_timeouts[max_tries] != ULONG_MAX) 2206 max_tries++; 2207 2208 now = jiffies; 2209 deadline = ata_deadline(ehc->last_reset, ATA_EH_RESET_COOL_DOWN); ··· 2245 ehc->i.action &= ~ATA_EH_RESET; 2246 if (hardreset) { 2247 reset = hardreset; 2248 - ehc->i.action = ATA_EH_HARDRESET; 2249 } else if (softreset) { 2250 reset = softreset; 2251 - ehc->i.action = ATA_EH_SOFTRESET; 2252 } 2253 2254 if (prereset) { ··· 2303 ehc->i.flags |= ATA_EHI_DID_SOFTRESET; 2304 2305 rc = ata_do_reset(link, reset, classes, deadline); 2306 2307 if (reset == hardreset && 2308 - ata_eh_followup_srst_needed(link, rc, classify, classes)) { 2309 /* okay, let's do follow-up softreset */ 2310 reset = softreset; 2311 ··· 2322 ata_eh_about_to_do(link, NULL, ATA_EH_RESET); 2323 rc = ata_do_reset(link, reset, classes, deadline); 2324 } 2325 - 2326 - /* -EAGAIN can happen if we skipped followup SRST */ 2327 - if (rc && rc != -EAGAIN) 2328 - goto fail; 2329 } else { 2330 if (verbose) 2331 ata_link_printk(link, KERN_INFO, "no reset method "
··· 2040 } 2041 2042 if (ehc->i.serror) 2043 + ata_link_printk(link, KERN_ERR, 2044 "SError: { %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s}\n", 2045 ehc->i.serror & SERR_DATA_RECOVERED ? "RecovData " : "", 2046 ehc->i.serror & SERR_COMM_RECOVERED ? "RecovComm " : "", ··· 2171 } 2172 2173 static int ata_eh_followup_srst_needed(struct ata_link *link, 2174 + int rc, const unsigned int *classes) 2175 { 2176 if ((link->flags & ATA_LFLAG_NO_SRST) || ata_link_offline(link)) 2177 return 0; 2178 + if (rc == -EAGAIN) 2179 + return 1; 2180 if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) 2181 return 1; 2182 return 0; ··· 2210 */ 2211 while (ata_eh_reset_timeouts[max_tries] != ULONG_MAX) 2212 max_tries++; 2213 + if (link->flags & ATA_LFLAG_NO_HRST) 2214 + hardreset = NULL; 2215 + if (link->flags & ATA_LFLAG_NO_SRST) 2216 + softreset = NULL; 2217 2218 now = jiffies; 2219 deadline = ata_deadline(ehc->last_reset, ATA_EH_RESET_COOL_DOWN); ··· 2247 ehc->i.action &= ~ATA_EH_RESET; 2248 if (hardreset) { 2249 reset = hardreset; 2250 + ehc->i.action |= ATA_EH_HARDRESET; 2251 } else if (softreset) { 2252 reset = softreset; 2253 + ehc->i.action |= ATA_EH_SOFTRESET; 2254 } 2255 2256 if (prereset) { ··· 2305 ehc->i.flags |= ATA_EHI_DID_SOFTRESET; 2306 2307 rc = ata_do_reset(link, reset, classes, deadline); 2308 + if (rc && rc != -EAGAIN) 2309 + goto fail; 2310 2311 if (reset == hardreset && 2312 + ata_eh_followup_srst_needed(link, rc, classes)) { 2313 /* okay, let's do follow-up softreset */ 2314 reset = softreset; 2315 ··· 2322 ata_eh_about_to_do(link, NULL, ATA_EH_RESET); 2323 rc = ata_do_reset(link, reset, classes, deadline); 2324 } 2325 } else { 2326 if (verbose) 2327 ata_link_printk(link, KERN_INFO, "no reset method "
+1 -1
drivers/ata/pata_acpi.c
··· 181 182 if (adev != acpi->last) { 183 pacpi_set_piomode(ap, adev); 184 - if (adev->dma_mode) 185 pacpi_set_dmamode(ap, adev); 186 acpi->last = adev; 187 }
··· 181 182 if (adev != acpi->last) { 183 pacpi_set_piomode(ap, adev); 184 + if (ata_dma_enabled(adev)) 185 pacpi_set_dmamode(ap, adev); 186 acpi->last = adev; 187 }
+1 -1
drivers/ata/pata_atiixp.c
··· 183 u16 tmp16; 184 185 pci_read_config_word(pdev, ATIIXP_IDE_UDMA_CONTROL, &tmp16); 186 - if (adev->dma_mode >= XFER_UDMA_0) 187 tmp16 |= (1 << dn); 188 else 189 tmp16 &= ~(1 << dn);
··· 183 u16 tmp16; 184 185 pci_read_config_word(pdev, ATIIXP_IDE_UDMA_CONTROL, &tmp16); 186 + if (ata_using_udma(adev)) 187 tmp16 |= (1 << dn); 188 else 189 tmp16 &= ~(1 << dn);
+3 -3
drivers/ata/pata_cs5530.c
··· 149 struct ata_device *prev = ap->private_data; 150 151 /* See if the DMA settings could be wrong */ 152 - if (adev->dma_mode != 0 && adev != prev && prev != NULL) { 153 /* Maybe, but do the channels match MWDMA/UDMA ? */ 154 - if ((adev->dma_mode >= XFER_UDMA_0 && prev->dma_mode < XFER_UDMA_0) || 155 - (adev->dma_mode < XFER_UDMA_0 && prev->dma_mode >= XFER_UDMA_0)) 156 /* Switch the mode bits */ 157 cs5530_set_dmamode(ap, adev); 158 }
··· 149 struct ata_device *prev = ap->private_data; 150 151 /* See if the DMA settings could be wrong */ 152 + if (ata_dma_enabled(adev) && adev != prev && prev != NULL) { 153 /* Maybe, but do the channels match MWDMA/UDMA ? */ 154 + if ((ata_using_udma(adev) && !ata_using_udma(prev)) || 155 + (ata_using_udma(prev) && !ata_using_udma(adev))) 156 /* Switch the mode bits */ 157 cs5530_set_dmamode(ap, adev); 158 }
+1 -1
drivers/ata/pata_it821x.c
··· 606 { 607 unsigned char id[41]; 608 int mode = 0; 609 - char *mtype; 610 char mbuf[8]; 611 char *cbl = "(40 wire cable)"; 612
··· 606 { 607 unsigned char id[41]; 608 int mode = 0; 609 + char *mtype = ""; 610 char mbuf[8]; 611 char *cbl = "(40 wire cable)"; 612
+1 -1
drivers/ata/pata_oldpiix.c
··· 198 199 if (adev != ap->private_data) { 200 oldpiix_set_piomode(ap, adev); 201 - if (adev->dma_mode) 202 oldpiix_set_dmamode(ap, adev); 203 } 204 return ata_sff_qc_issue(qc);
··· 198 199 if (adev != ap->private_data) { 200 oldpiix_set_piomode(ap, adev); 201 + if (ata_dma_enabled(adev)) 202 oldpiix_set_dmamode(ap, adev); 203 } 204 return ata_sff_qc_issue(qc);
+3 -3
drivers/ata/pata_sc1200.c
··· 167 struct ata_device *prev = ap->private_data; 168 169 /* See if the DMA settings could be wrong */ 170 - if (adev->dma_mode != 0 && adev != prev && prev != NULL) { 171 /* Maybe, but do the channels match MWDMA/UDMA ? */ 172 - if ((adev->dma_mode >= XFER_UDMA_0 && prev->dma_mode < XFER_UDMA_0) || 173 - (adev->dma_mode < XFER_UDMA_0 && prev->dma_mode >= XFER_UDMA_0)) 174 /* Switch the mode bits */ 175 sc1200_set_dmamode(ap, adev); 176 }
··· 167 struct ata_device *prev = ap->private_data; 168 169 /* See if the DMA settings could be wrong */ 170 + if (ata_dma_enabled(adev) && adev != prev && prev != NULL) { 171 /* Maybe, but do the channels match MWDMA/UDMA ? */ 172 + if ((ata_using_udma(adev) && !ata_using_udma(prev)) || 173 + (ata_using_udma(prev) && !ata_using_udma(adev))) 174 /* Switch the mode bits */ 175 sc1200_set_dmamode(ap, adev); 176 }
+11 -48
drivers/ata/pata_via.c
··· 324 } 325 326 /** 327 - * via_ata_sff_tf_load - send taskfile registers to host controller 328 * @ap: Port to which output is sent 329 * @tf: ATA taskfile register set 330 * 331 * Outputs ATA taskfile to standard ATA host controller. 332 * 333 * Note: This is to fix the internal bug of via chipsets, which 334 - * will reset the device register after changing the IEN bit on 335 - * ctl register 336 */ 337 - static void via_ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) 338 { 339 - struct ata_ioports *ioaddr = &ap->ioaddr; 340 - unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; 341 342 - if (tf->ctl != ap->last_ctl) { 343 - iowrite8(tf->ctl, ioaddr->ctl_addr); 344 - iowrite8(tf->device, ioaddr->device_addr); 345 - ap->last_ctl = tf->ctl; 346 - ata_wait_idle(ap); 347 } 348 - 349 - if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { 350 - iowrite8(tf->hob_feature, ioaddr->feature_addr); 351 - iowrite8(tf->hob_nsect, ioaddr->nsect_addr); 352 - iowrite8(tf->hob_lbal, ioaddr->lbal_addr); 353 - iowrite8(tf->hob_lbam, ioaddr->lbam_addr); 354 - iowrite8(tf->hob_lbah, ioaddr->lbah_addr); 355 - VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n", 356 - tf->hob_feature, 357 - tf->hob_nsect, 358 - tf->hob_lbal, 359 - tf->hob_lbam, 360 - tf->hob_lbah); 361 - } 362 - 363 - if (is_addr) { 364 - iowrite8(tf->feature, ioaddr->feature_addr); 365 - iowrite8(tf->nsect, ioaddr->nsect_addr); 366 - iowrite8(tf->lbal, ioaddr->lbal_addr); 367 - iowrite8(tf->lbam, ioaddr->lbam_addr); 368 - iowrite8(tf->lbah, ioaddr->lbah_addr); 369 - VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n", 370 - tf->feature, 371 - tf->nsect, 372 - tf->lbal, 373 - tf->lbam, 374 - tf->lbah); 375 - } 376 - 377 - if (tf->flags & ATA_TFLAG_DEVICE) { 378 - iowrite8(tf->device, ioaddr->device_addr); 379 - VPRINTK("device 0x%X\n", tf->device); 380 - } 381 - 382 - ata_wait_idle(ap); 383 } 384 385 static struct scsi_host_template via_sht = { ··· 356 .set_piomode = via_set_piomode, 357 .set_dmamode = via_set_dmamode, 358 .prereset = via_pre_reset, 359 - .sff_tf_load = via_ata_tf_load, 360 }; 361 362 static struct ata_port_operations via_port_ops_noirq = { 363 .inherits = &via_port_ops, 364 .sff_data_xfer = ata_sff_data_xfer_noirq, 365 - .sff_tf_load = via_ata_tf_load, 366 }; 367 368 /**
··· 324 } 325 326 /** 327 + * via_tf_load - send taskfile registers to host controller 328 * @ap: Port to which output is sent 329 * @tf: ATA taskfile register set 330 * 331 * Outputs ATA taskfile to standard ATA host controller. 332 * 333 * Note: This is to fix the internal bug of via chipsets, which 334 + * will reset the device register after changing the IEN bit on 335 + * ctl register 336 */ 337 + static void via_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) 338 { 339 + struct ata_taskfile tmp_tf; 340 341 + if (ap->ctl != ap->last_ctl && !(tf->flags & ATA_TFLAG_DEVICE)) { 342 + tmp_tf = *tf; 343 + tmp_tf.flags |= ATA_TFLAG_DEVICE; 344 + tf = &tmp_tf; 345 } 346 + ata_sff_tf_load(ap, tf); 347 } 348 349 static struct scsi_host_template via_sht = { ··· 392 .set_piomode = via_set_piomode, 393 .set_dmamode = via_set_dmamode, 394 .prereset = via_pre_reset, 395 + .sff_tf_load = via_tf_load, 396 }; 397 398 static struct ata_port_operations via_port_ops_noirq = { 399 .inherits = &via_port_ops, 400 .sff_data_xfer = ata_sff_data_xfer_noirq, 401 }; 402 403 /**
+12 -25
drivers/ata/sata_mv.c
··· 1134 if (ap->nr_active_links == 0) 1135 return 0; 1136 1137 - if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) { 1138 - /* 1139 - * The port is operating in host queuing mode (EDMA). 1140 - * It can accomodate a new qc if the qc protocol 1141 - * is compatible with the current host queue mode. 1142 - */ 1143 - if (pp->pp_flags & MV_PP_FLAG_NCQ_EN) { 1144 - /* 1145 - * The host queue (EDMA) is in NCQ mode. 1146 - * If the new qc is also an NCQ command, 1147 - * then allow the new qc. 1148 - */ 1149 - if (qc->tf.protocol == ATA_PROT_NCQ) 1150 - return 0; 1151 - } else { 1152 - /* 1153 - * The host queue (EDMA) is in non-NCQ, DMA mode. 1154 - * If the new qc is also a non-NCQ, DMA command, 1155 - * then allow the new qc. 1156 - */ 1157 - if (qc->tf.protocol == ATA_PROT_DMA) 1158 - return 0; 1159 - } 1160 - } 1161 return ATA_DEFER_PORT; 1162 } 1163 ··· 3022 break; 3023 case chip_soc: 3024 hpriv->ops = &mv_soc_ops; 3025 - hp_flags |= MV_HP_FLAG_SOC | MV_HP_ERRATA_60X1C0; 3026 break; 3027 3028 default:
··· 1134 if (ap->nr_active_links == 0) 1135 return 0; 1136 1137 + /* 1138 + * The port is operating in host queuing mode (EDMA) with NCQ 1139 + * enabled, allow multiple NCQ commands. EDMA also allows 1140 + * queueing multiple DMA commands but libata core currently 1141 + * doesn't allow it. 1142 + */ 1143 + if ((pp->pp_flags & MV_PP_FLAG_EDMA_EN) && 1144 + (pp->pp_flags & MV_PP_FLAG_NCQ_EN) && ata_is_ncq(qc->tf.protocol)) 1145 + return 0; 1146 + 1147 return ATA_DEFER_PORT; 1148 } 1149 ··· 3036 break; 3037 case chip_soc: 3038 hpriv->ops = &mv_soc_ops; 3039 + hp_flags |= MV_HP_FLAG_SOC | MV_HP_GEN_IIE | 3040 + MV_HP_ERRATA_60X1C0; 3041 break; 3042 3043 default:
+24
include/linux/libata.h
··· 163 ATA_DEV_NONE = 9, /* no device */ 164 165 /* struct ata_link flags */ 166 ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */ 167 ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */ 168 ATA_LFLAG_ASSUME_SEMB = (1 << 4), /* assume SEMB class */ ··· 647 648 unsigned int flags; /* ATA_LFLAG_xxx */ 649 650 unsigned int hw_sata_spd_limit; 651 unsigned int sata_spd_limit; 652 unsigned int sata_spd; /* current SATA PHY speed */ ··· 1429 return from_jiffies + msecs_to_jiffies(timeout_msecs); 1430 } 1431 1432 1433 /************************************************************************** 1434 * PMP - drivers/ata/libata-pmp.c
··· 163 ATA_DEV_NONE = 9, /* no device */ 164 165 /* struct ata_link flags */ 166 + ATA_LFLAG_NO_HRST = (1 << 1), /* avoid hardreset */ 167 ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */ 168 ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */ 169 ATA_LFLAG_ASSUME_SEMB = (1 << 4), /* assume SEMB class */ ··· 646 647 unsigned int flags; /* ATA_LFLAG_xxx */ 648 649 + u32 saved_scontrol; /* SControl on probe */ 650 unsigned int hw_sata_spd_limit; 651 unsigned int sata_spd_limit; 652 unsigned int sata_spd; /* current SATA PHY speed */ ··· 1427 return from_jiffies + msecs_to_jiffies(timeout_msecs); 1428 } 1429 1430 + /* Don't open code these in drivers as there are traps. Firstly the range may 1431 + change in future hardware and specs, secondly 0xFF means 'no DMA' but is 1432 + > UDMA_0. Dyma ddreigiau */ 1433 + 1434 + static inline int ata_using_mwdma(struct ata_device *adev) 1435 + { 1436 + if (adev->dma_mode >= XFER_MW_DMA_0 && adev->dma_mode <= XFER_MW_DMA_4) 1437 + return 1; 1438 + return 0; 1439 + } 1440 + 1441 + static inline int ata_using_udma(struct ata_device *adev) 1442 + { 1443 + if (adev->dma_mode >= XFER_UDMA_0 && adev->dma_mode <= XFER_UDMA_7) 1444 + return 1; 1445 + return 0; 1446 + } 1447 + 1448 + static inline int ata_dma_enabled(struct ata_device *adev) 1449 + { 1450 + return (adev->dma_mode == 0xFF ? 0 : 1); 1451 + } 1452 1453 /************************************************************************** 1454 * PMP - drivers/ata/libata-pmp.c