Commit df423dc7f2a801b9a45d7c501a8eb5c529455ea1
Exists in
master
and in
4 other branches
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-sff: Reenable Port Multiplier after libata-sff remodeling. libata: skip EH autopsy and recovery during suspend ahci: AHCI and RAID mode SATA patch for Intel Patsburg DeviceIDs ata_piix: IDE Mode SATA patch for Intel Patsburg DeviceIDs libata,pata_via: revert ata_wait_idle() removal from ata_sff/via_tf_load() ahci: fix hang on failed softreset pata_artop: Fix device ID parity check
Showing 10 changed files Side-by-side Diff
drivers/ata/ahci.c
... | ... | @@ -253,6 +253,9 @@ |
253 | 253 | { PCI_VDEVICE(INTEL, 0x1c05), board_ahci }, /* CPT RAID */ |
254 | 254 | { PCI_VDEVICE(INTEL, 0x1c06), board_ahci }, /* CPT RAID */ |
255 | 255 | { PCI_VDEVICE(INTEL, 0x1c07), board_ahci }, /* CPT RAID */ |
256 | + { PCI_VDEVICE(INTEL, 0x1d02), board_ahci }, /* PBG AHCI */ | |
257 | + { PCI_VDEVICE(INTEL, 0x1d04), board_ahci }, /* PBG RAID */ | |
258 | + { PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG RAID */ | |
256 | 259 | |
257 | 260 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ |
258 | 261 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
drivers/ata/ata_piix.c
... | ... | @@ -302,6 +302,10 @@ |
302 | 302 | { 0x8086, 0x1c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
303 | 303 | /* SATA Controller IDE (CPT) */ |
304 | 304 | { 0x8086, 0x1c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
305 | + /* SATA Controller IDE (PBG) */ | |
306 | + { 0x8086, 0x1d00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | |
307 | + /* SATA Controller IDE (PBG) */ | |
308 | + { 0x8086, 0x1d08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | |
305 | 309 | { } /* terminate list */ |
306 | 310 | }; |
307 | 311 |
drivers/ata/libahci.c
drivers/ata/libata-core.c
... | ... | @@ -5418,6 +5418,7 @@ |
5418 | 5418 | */ |
5419 | 5419 | int ata_host_suspend(struct ata_host *host, pm_message_t mesg) |
5420 | 5420 | { |
5421 | + unsigned int ehi_flags = ATA_EHI_QUIET; | |
5421 | 5422 | int rc; |
5422 | 5423 | |
5423 | 5424 | /* |
... | ... | @@ -5426,7 +5427,18 @@ |
5426 | 5427 | */ |
5427 | 5428 | ata_lpm_enable(host); |
5428 | 5429 | |
5429 | - rc = ata_host_request_pm(host, mesg, 0, ATA_EHI_QUIET, 1); | |
5430 | + /* | |
5431 | + * On some hardware, device fails to respond after spun down | |
5432 | + * for suspend. As the device won't be used before being | |
5433 | + * resumed, we don't need to touch the device. Ask EH to skip | |
5434 | + * the usual stuff and proceed directly to suspend. | |
5435 | + * | |
5436 | + * http://thread.gmane.org/gmane.linux.ide/46764 | |
5437 | + */ | |
5438 | + if (mesg.event == PM_EVENT_SUSPEND) | |
5439 | + ehi_flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_NO_RECOVERY; | |
5440 | + | |
5441 | + rc = ata_host_request_pm(host, mesg, 0, ehi_flags, 1); | |
5430 | 5442 | if (rc == 0) |
5431 | 5443 | host->dev->power.power_state = mesg; |
5432 | 5444 | return rc; |
drivers/ata/libata-eh.c
... | ... | @@ -3235,6 +3235,10 @@ |
3235 | 3235 | if (link->flags & ATA_LFLAG_DISABLED) |
3236 | 3236 | return 1; |
3237 | 3237 | |
3238 | + /* skip if explicitly requested */ | |
3239 | + if (ehc->i.flags & ATA_EHI_NO_RECOVERY) | |
3240 | + return 1; | |
3241 | + | |
3238 | 3242 | /* thaw frozen port and recover failed devices */ |
3239 | 3243 | if ((ap->pflags & ATA_PFLAG_FROZEN) || ata_link_nr_enabled(link)) |
3240 | 3244 | return 0; |
drivers/ata/libata-sff.c
... | ... | @@ -418,6 +418,7 @@ |
418 | 418 | if (ioaddr->ctl_addr) |
419 | 419 | iowrite8(tf->ctl, ioaddr->ctl_addr); |
420 | 420 | ap->last_ctl = tf->ctl; |
421 | + ata_wait_idle(ap); | |
421 | 422 | } |
422 | 423 | |
423 | 424 | if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { |
... | ... | @@ -453,6 +454,8 @@ |
453 | 454 | iowrite8(tf->device, ioaddr->device_addr); |
454 | 455 | VPRINTK("device 0x%X\n", tf->device); |
455 | 456 | } |
457 | + | |
458 | + ata_wait_idle(ap); | |
456 | 459 | } |
457 | 460 | EXPORT_SYMBOL_GPL(ata_sff_tf_load); |
458 | 461 | |
... | ... | @@ -1042,7 +1045,8 @@ |
1042 | 1045 | int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, |
1043 | 1046 | u8 status, int in_wq) |
1044 | 1047 | { |
1045 | - struct ata_eh_info *ehi = &ap->link.eh_info; | |
1048 | + struct ata_link *link = qc->dev->link; | |
1049 | + struct ata_eh_info *ehi = &link->eh_info; | |
1046 | 1050 | unsigned long flags = 0; |
1047 | 1051 | int poll_next; |
1048 | 1052 | |
1049 | 1053 | |
... | ... | @@ -1298,8 +1302,14 @@ |
1298 | 1302 | } |
1299 | 1303 | EXPORT_SYMBOL_GPL(ata_sff_hsm_move); |
1300 | 1304 | |
1301 | -void ata_sff_queue_pio_task(struct ata_port *ap, unsigned long delay) | |
1305 | +void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay) | |
1302 | 1306 | { |
1307 | + struct ata_port *ap = link->ap; | |
1308 | + | |
1309 | + WARN_ON((ap->sff_pio_task_link != NULL) && | |
1310 | + (ap->sff_pio_task_link != link)); | |
1311 | + ap->sff_pio_task_link = link; | |
1312 | + | |
1303 | 1313 | /* may fail if ata_sff_flush_pio_task() in progress */ |
1304 | 1314 | queue_delayed_work(ata_sff_wq, &ap->sff_pio_task, |
1305 | 1315 | msecs_to_jiffies(delay)); |
1306 | 1316 | |
1307 | 1317 | |
1308 | 1318 | |
... | ... | @@ -1321,14 +1331,18 @@ |
1321 | 1331 | { |
1322 | 1332 | struct ata_port *ap = |
1323 | 1333 | container_of(work, struct ata_port, sff_pio_task.work); |
1334 | + struct ata_link *link = ap->sff_pio_task_link; | |
1324 | 1335 | struct ata_queued_cmd *qc; |
1325 | 1336 | u8 status; |
1326 | 1337 | int poll_next; |
1327 | 1338 | |
1339 | + BUG_ON(ap->sff_pio_task_link == NULL); | |
1328 | 1340 | /* qc can be NULL if timeout occurred */ |
1329 | - qc = ata_qc_from_tag(ap, ap->link.active_tag); | |
1330 | - if (!qc) | |
1341 | + qc = ata_qc_from_tag(ap, link->active_tag); | |
1342 | + if (!qc) { | |
1343 | + ap->sff_pio_task_link = NULL; | |
1331 | 1344 | return; |
1345 | + } | |
1332 | 1346 | |
1333 | 1347 | fsm_start: |
1334 | 1348 | WARN_ON_ONCE(ap->hsm_task_state == HSM_ST_IDLE); |
1335 | 1349 | |
... | ... | @@ -1345,11 +1359,16 @@ |
1345 | 1359 | msleep(2); |
1346 | 1360 | status = ata_sff_busy_wait(ap, ATA_BUSY, 10); |
1347 | 1361 | if (status & ATA_BUSY) { |
1348 | - ata_sff_queue_pio_task(ap, ATA_SHORT_PAUSE); | |
1362 | + ata_sff_queue_pio_task(link, ATA_SHORT_PAUSE); | |
1349 | 1363 | return; |
1350 | 1364 | } |
1351 | 1365 | } |
1352 | 1366 | |
1367 | + /* | |
1368 | + * hsm_move() may trigger another command to be processed. | |
1369 | + * clean the link beforehand. | |
1370 | + */ | |
1371 | + ap->sff_pio_task_link = NULL; | |
1353 | 1372 | /* move the HSM */ |
1354 | 1373 | poll_next = ata_sff_hsm_move(ap, qc, status, 1); |
1355 | 1374 | |
... | ... | @@ -1376,6 +1395,7 @@ |
1376 | 1395 | unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc) |
1377 | 1396 | { |
1378 | 1397 | struct ata_port *ap = qc->ap; |
1398 | + struct ata_link *link = qc->dev->link; | |
1379 | 1399 | |
1380 | 1400 | /* Use polling pio if the LLD doesn't handle |
1381 | 1401 | * interrupt driven pio and atapi CDB interrupt. |
... | ... | @@ -1396,7 +1416,7 @@ |
1396 | 1416 | ap->hsm_task_state = HSM_ST_LAST; |
1397 | 1417 | |
1398 | 1418 | if (qc->tf.flags & ATA_TFLAG_POLLING) |
1399 | - ata_sff_queue_pio_task(ap, 0); | |
1419 | + ata_sff_queue_pio_task(link, 0); | |
1400 | 1420 | |
1401 | 1421 | break; |
1402 | 1422 | |
... | ... | @@ -1409,7 +1429,7 @@ |
1409 | 1429 | if (qc->tf.flags & ATA_TFLAG_WRITE) { |
1410 | 1430 | /* PIO data out protocol */ |
1411 | 1431 | ap->hsm_task_state = HSM_ST_FIRST; |
1412 | - ata_sff_queue_pio_task(ap, 0); | |
1432 | + ata_sff_queue_pio_task(link, 0); | |
1413 | 1433 | |
1414 | 1434 | /* always send first data block using the |
1415 | 1435 | * ata_sff_pio_task() codepath. |
... | ... | @@ -1419,7 +1439,7 @@ |
1419 | 1439 | ap->hsm_task_state = HSM_ST; |
1420 | 1440 | |
1421 | 1441 | if (qc->tf.flags & ATA_TFLAG_POLLING) |
1422 | - ata_sff_queue_pio_task(ap, 0); | |
1442 | + ata_sff_queue_pio_task(link, 0); | |
1423 | 1443 | |
1424 | 1444 | /* if polling, ata_sff_pio_task() handles the |
1425 | 1445 | * rest. otherwise, interrupt handler takes |
... | ... | @@ -1441,7 +1461,7 @@ |
1441 | 1461 | /* send cdb by polling if no cdb interrupt */ |
1442 | 1462 | if ((!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) || |
1443 | 1463 | (qc->tf.flags & ATA_TFLAG_POLLING)) |
1444 | - ata_sff_queue_pio_task(ap, 0); | |
1464 | + ata_sff_queue_pio_task(link, 0); | |
1445 | 1465 | break; |
1446 | 1466 | |
1447 | 1467 | default: |
... | ... | @@ -2734,6 +2754,7 @@ |
2734 | 2754 | unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc) |
2735 | 2755 | { |
2736 | 2756 | struct ata_port *ap = qc->ap; |
2757 | + struct ata_link *link = qc->dev->link; | |
2737 | 2758 | |
2738 | 2759 | /* defer PIO handling to sff_qc_issue */ |
2739 | 2760 | if (!ata_is_dma(qc->tf.protocol)) |
... | ... | @@ -2762,7 +2783,7 @@ |
2762 | 2783 | |
2763 | 2784 | /* send cdb by polling if no cdb interrupt */ |
2764 | 2785 | if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) |
2765 | - ata_sff_queue_pio_task(ap, 0); | |
2786 | + ata_sff_queue_pio_task(link, 0); | |
2766 | 2787 | break; |
2767 | 2788 | |
2768 | 2789 | default: |
drivers/ata/pata_artop.c
... | ... | @@ -74,7 +74,8 @@ |
74 | 74 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
75 | 75 | |
76 | 76 | /* Odd numbered device ids are the units with enable bits (the -R cards) */ |
77 | - if (pdev->device % 1 && !pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no])) | |
77 | + if ((pdev->device & 1) && | |
78 | + !pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no])) | |
78 | 79 | return -ENOENT; |
79 | 80 | |
80 | 81 | return ata_sff_prereset(link, deadline); |
drivers/ata/pata_via.c
drivers/ata/sata_mv.c
include/linux/libata.h
... | ... | @@ -335,6 +335,7 @@ |
335 | 335 | ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ |
336 | 336 | ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */ |
337 | 337 | ATA_EHI_QUIET = (1 << 3), /* be quiet */ |
338 | + ATA_EHI_NO_RECOVERY = (1 << 4), /* no recovery */ | |
338 | 339 | |
339 | 340 | ATA_EHI_DID_SOFTRESET = (1 << 16), /* already soft-reset this port */ |
340 | 341 | ATA_EHI_DID_HARDRESET = (1 << 17), /* already soft-reset this port */ |
... | ... | @@ -723,6 +724,7 @@ |
723 | 724 | struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */ |
724 | 725 | u8 ctl; /* cache of ATA control register */ |
725 | 726 | u8 last_ctl; /* Cache last written value */ |
727 | + struct ata_link* sff_pio_task_link; /* link currently used */ | |
726 | 728 | struct delayed_work sff_pio_task; |
727 | 729 | #ifdef CONFIG_ATA_BMDMA |
728 | 730 | struct ata_bmdma_prd *bmdma_prd; /* BMDMA SG list */ |
... | ... | @@ -1594,7 +1596,7 @@ |
1594 | 1596 | extern void ata_sff_irq_clear(struct ata_port *ap); |
1595 | 1597 | extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, |
1596 | 1598 | u8 status, int in_wq); |
1597 | -extern void ata_sff_queue_pio_task(struct ata_port *ap, unsigned long delay); | |
1599 | +extern void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay); | |
1598 | 1600 | extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc); |
1599 | 1601 | extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc); |
1600 | 1602 | extern unsigned int ata_sff_port_intr(struct ata_port *ap, |