Skip to content

Commit 0384e29

Browse files
committed
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: (35 commits) [libata] Improve timeout handling [libata] Drain data on errors pata_sc1200: Activate secondary channel pata_artop: Serializing support [libata] ahci: correct enclosure LED state save [libata] More robust parsing for IDENTIFY DEVICE multi_count field sata_mv: fix LED blinking for SoC+NCQ sata_mv: optimize IRQ coalescing for 8-port chips sata_mv: implement IRQ coalescing (v2) sata_mv: cosmetic preparations for IRQ coalescing pata-rb532-cf: platform_get_irq() fix ignored failure pata_efar: fix *dma_mask pata_radisys: fix mwdma_mask to exclude mwdma0 [libata] convert drivers to use ata.h mode mask defines include/linux/ata.h: add some more transfer masks ahci: Blacklist HP Compaq 6720s that spins off disks during ACPI power off [libata] sata_mv: Implement direct FIS transmission via mv_qc_issue_fis(). [libata] Export ata_pio_queue_task() so that it can be used from sata_mv. [libata] sata_mv: Add a new mv_sff_check_status() function to sata_mv. [libata] sata_mv: Tighten up interrupt masking in mv_qc_issue() ...
2 parents 61a0918 + c96f173 commit 0384e29

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1330
-542
lines changed

drivers/ata/ahci.c

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -404,23 +404,23 @@ static const struct ata_port_info ahci_port_info[] = {
404404
/* board_ahci */
405405
{
406406
.flags = AHCI_FLAG_COMMON,
407-
.pio_mask = 0x1f, /* pio0-4 */
407+
.pio_mask = ATA_PIO4,
408408
.udma_mask = ATA_UDMA6,
409409
.port_ops = &ahci_ops,
410410
},
411411
/* board_ahci_vt8251 */
412412
{
413413
AHCI_HFLAGS (AHCI_HFLAG_NO_NCQ | AHCI_HFLAG_NO_PMP),
414414
.flags = AHCI_FLAG_COMMON,
415-
.pio_mask = 0x1f, /* pio0-4 */
415+
.pio_mask = ATA_PIO4,
416416
.udma_mask = ATA_UDMA6,
417417
.port_ops = &ahci_vt8251_ops,
418418
},
419419
/* board_ahci_ign_iferr */
420420
{
421421
AHCI_HFLAGS (AHCI_HFLAG_IGN_IRQ_IF_ERR),
422422
.flags = AHCI_FLAG_COMMON,
423-
.pio_mask = 0x1f, /* pio0-4 */
423+
.pio_mask = ATA_PIO4,
424424
.udma_mask = ATA_UDMA6,
425425
.port_ops = &ahci_ops,
426426
},
@@ -430,7 +430,7 @@ static const struct ata_port_info ahci_port_info[] = {
430430
AHCI_HFLAG_32BIT_ONLY | AHCI_HFLAG_NO_MSI |
431431
AHCI_HFLAG_SECT255),
432432
.flags = AHCI_FLAG_COMMON,
433-
.pio_mask = 0x1f, /* pio0-4 */
433+
.pio_mask = ATA_PIO4,
434434
.udma_mask = ATA_UDMA6,
435435
.port_ops = &ahci_sb600_ops,
436436
},
@@ -440,31 +440,31 @@ static const struct ata_port_info ahci_port_info[] = {
440440
AHCI_HFLAG_MV_PATA | AHCI_HFLAG_NO_PMP),
441441
.flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
442442
ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA,
443-
.pio_mask = 0x1f, /* pio0-4 */
443+
.pio_mask = ATA_PIO4,
444444
.udma_mask = ATA_UDMA6,
445445
.port_ops = &ahci_ops,
446446
},
447447
/* board_ahci_sb700, for SB700 and SB800 */
448448
{
449449
AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL),
450450
.flags = AHCI_FLAG_COMMON,
451-
.pio_mask = 0x1f, /* pio0-4 */
451+
.pio_mask = ATA_PIO4,
452452
.udma_mask = ATA_UDMA6,
453453
.port_ops = &ahci_sb600_ops,
454454
},
455455
/* board_ahci_mcp65 */
456456
{
457457
AHCI_HFLAGS (AHCI_HFLAG_YES_NCQ),
458458
.flags = AHCI_FLAG_COMMON,
459-
.pio_mask = 0x1f, /* pio0-4 */
459+
.pio_mask = ATA_PIO4,
460460
.udma_mask = ATA_UDMA6,
461461
.port_ops = &ahci_ops,
462462
},
463463
/* board_ahci_nopmp */
464464
{
465465
AHCI_HFLAGS (AHCI_HFLAG_NO_PMP),
466466
.flags = AHCI_FLAG_COMMON,
467-
.pio_mask = 0x1f, /* pio0-4 */
467+
.pio_mask = ATA_PIO4,
468468
.udma_mask = ATA_UDMA6,
469469
.port_ops = &ahci_ops,
470470
},
@@ -1348,7 +1348,7 @@ static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
13481348
writel(message[1], mmio + hpriv->em_loc+4);
13491349

13501350
/* save off new led state for port/slot */
1351-
emp->led_state = message[1];
1351+
emp->led_state = state;
13521352

13531353
/*
13541354
* tell hardware to transmit the message
@@ -2565,6 +2565,15 @@ static bool ahci_broken_system_poweroff(struct pci_dev *pdev)
25652565
/* PCI slot number of the controller */
25662566
.driver_data = (void *)0x1FUL,
25672567
},
2568+
{
2569+
.ident = "HP Compaq 6720s",
2570+
.matches = {
2571+
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
2572+
DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6720s"),
2573+
},
2574+
/* PCI slot number of the controller */
2575+
.driver_data = (void *)0x1FUL,
2576+
},
25682577

25692578
{ } /* terminate list */
25702579
};
@@ -2647,8 +2656,8 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
26472656
if (board_id == board_ahci_sb700 && pdev->revision >= 0x40)
26482657
hpriv->flags &= ~AHCI_HFLAG_IGN_SERR_INTERNAL;
26492658

2650-
if ((hpriv->flags & AHCI_HFLAG_NO_MSI) || pci_enable_msi(pdev))
2651-
pci_intx(pdev, 1);
2659+
if (!(hpriv->flags & AHCI_HFLAG_NO_MSI))
2660+
pci_enable_msi(pdev);
26522661

26532662
/* save initial config */
26542663
ahci_save_initial_config(pdev, hpriv);

drivers/ata/ata_generic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id
118118
u16 command;
119119
static const struct ata_port_info info = {
120120
.flags = ATA_FLAG_SLAVE_POSS,
121-
.pio_mask = 0x1f,
122-
.mwdma_mask = 0x07,
121+
.pio_mask = ATA_PIO4,
122+
.mwdma_mask = ATA_MWDMA2,
123123
.udma_mask = ATA_UDMA5,
124124
.port_ops = &generic_port_ops
125125
};

drivers/ata/ata_piix.c

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -446,116 +446,116 @@ static struct ata_port_info piix_port_info[] = {
446446
[piix_pata_mwdma] = /* PIIX3 MWDMA only */
447447
{
448448
.flags = PIIX_PATA_FLAGS,
449-
.pio_mask = 0x1f, /* pio0-4 */
450-
.mwdma_mask = 0x06, /* mwdma1-2 ?? CHECK 0 should be ok but slow */
449+
.pio_mask = ATA_PIO4,
450+
.mwdma_mask = ATA_MWDMA12_ONLY, /* mwdma1-2 ?? CHECK 0 should be ok but slow */
451451
.port_ops = &piix_pata_ops,
452452
},
453453

454454
[piix_pata_33] = /* PIIX4 at 33MHz */
455455
{
456456
.flags = PIIX_PATA_FLAGS,
457-
.pio_mask = 0x1f, /* pio0-4 */
458-
.mwdma_mask = 0x06, /* mwdma1-2 ?? CHECK 0 should be ok but slow */
459-
.udma_mask = ATA_UDMA_MASK_40C,
457+
.pio_mask = ATA_PIO4,
458+
.mwdma_mask = ATA_MWDMA12_ONLY, /* mwdma1-2 ?? CHECK 0 should be ok but slow */
459+
.udma_mask = ATA_UDMA2,
460460
.port_ops = &piix_pata_ops,
461461
},
462462

463463
[ich_pata_33] = /* ICH0 - ICH at 33Mhz*/
464464
{
465465
.flags = PIIX_PATA_FLAGS,
466-
.pio_mask = 0x1f, /* pio 0-4 */
467-
.mwdma_mask = 0x06, /* Check: maybe 0x07 */
468-
.udma_mask = ATA_UDMA2, /* UDMA33 */
466+
.pio_mask = ATA_PIO4,
467+
.mwdma_mask = ATA_MWDMA12_ONLY, /* Check: maybe MWDMA0 is ok */
468+
.udma_mask = ATA_UDMA2,
469469
.port_ops = &ich_pata_ops,
470470
},
471471

472472
[ich_pata_66] = /* ICH controllers up to 66MHz */
473473
{
474474
.flags = PIIX_PATA_FLAGS,
475-
.pio_mask = 0x1f, /* pio 0-4 */
476-
.mwdma_mask = 0x06, /* MWDMA0 is broken on chip */
475+
.pio_mask = ATA_PIO4,
476+
.mwdma_mask = ATA_MWDMA12_ONLY, /* MWDMA0 is broken on chip */
477477
.udma_mask = ATA_UDMA4,
478478
.port_ops = &ich_pata_ops,
479479
},
480480

481481
[ich_pata_100] =
482482
{
483483
.flags = PIIX_PATA_FLAGS | PIIX_FLAG_CHECKINTR,
484-
.pio_mask = 0x1f, /* pio0-4 */
485-
.mwdma_mask = 0x06, /* mwdma1-2 */
486-
.udma_mask = ATA_UDMA5, /* udma0-5 */
484+
.pio_mask = ATA_PIO4,
485+
.mwdma_mask = ATA_MWDMA12_ONLY,
486+
.udma_mask = ATA_UDMA5,
487487
.port_ops = &ich_pata_ops,
488488
},
489489

490490
[ich5_sata] =
491491
{
492492
.flags = PIIX_SATA_FLAGS,
493-
.pio_mask = 0x1f, /* pio0-4 */
494-
.mwdma_mask = 0x07, /* mwdma0-2 */
493+
.pio_mask = ATA_PIO4,
494+
.mwdma_mask = ATA_MWDMA2,
495495
.udma_mask = ATA_UDMA6,
496496
.port_ops = &piix_sata_ops,
497497
},
498498

499499
[ich6_sata] =
500500
{
501501
.flags = PIIX_SATA_FLAGS,
502-
.pio_mask = 0x1f, /* pio0-4 */
503-
.mwdma_mask = 0x07, /* mwdma0-2 */
502+
.pio_mask = ATA_PIO4,
503+
.mwdma_mask = ATA_MWDMA2,
504504
.udma_mask = ATA_UDMA6,
505505
.port_ops = &piix_sata_ops,
506506
},
507507

508508
[ich6m_sata] =
509509
{
510510
.flags = PIIX_SATA_FLAGS,
511-
.pio_mask = 0x1f, /* pio0-4 */
512-
.mwdma_mask = 0x07, /* mwdma0-2 */
511+
.pio_mask = ATA_PIO4,
512+
.mwdma_mask = ATA_MWDMA2,
513513
.udma_mask = ATA_UDMA6,
514514
.port_ops = &piix_sata_ops,
515515
},
516516

517517
[ich8_sata] =
518518
{
519519
.flags = PIIX_SATA_FLAGS | PIIX_FLAG_SIDPR,
520-
.pio_mask = 0x1f, /* pio0-4 */
521-
.mwdma_mask = 0x07, /* mwdma0-2 */
520+
.pio_mask = ATA_PIO4,
521+
.mwdma_mask = ATA_MWDMA2,
522522
.udma_mask = ATA_UDMA6,
523523
.port_ops = &piix_sata_ops,
524524
},
525525

526526
[ich8_2port_sata] =
527527
{
528528
.flags = PIIX_SATA_FLAGS | PIIX_FLAG_SIDPR,
529-
.pio_mask = 0x1f, /* pio0-4 */
530-
.mwdma_mask = 0x07, /* mwdma0-2 */
529+
.pio_mask = ATA_PIO4,
530+
.mwdma_mask = ATA_MWDMA2,
531531
.udma_mask = ATA_UDMA6,
532532
.port_ops = &piix_sata_ops,
533533
},
534534

535535
[tolapai_sata] =
536536
{
537537
.flags = PIIX_SATA_FLAGS,
538-
.pio_mask = 0x1f, /* pio0-4 */
539-
.mwdma_mask = 0x07, /* mwdma0-2 */
538+
.pio_mask = ATA_PIO4,
539+
.mwdma_mask = ATA_MWDMA2,
540540
.udma_mask = ATA_UDMA6,
541541
.port_ops = &piix_sata_ops,
542542
},
543543

544544
[ich8m_apple_sata] =
545545
{
546546
.flags = PIIX_SATA_FLAGS,
547-
.pio_mask = 0x1f, /* pio0-4 */
548-
.mwdma_mask = 0x07, /* mwdma0-2 */
547+
.pio_mask = ATA_PIO4,
548+
.mwdma_mask = ATA_MWDMA2,
549549
.udma_mask = ATA_UDMA6,
550550
.port_ops = &piix_sata_ops,
551551
},
552552

553553
[piix_pata_vmw] =
554554
{
555555
.flags = PIIX_PATA_FLAGS,
556-
.pio_mask = 0x1f, /* pio0-4 */
557-
.mwdma_mask = 0x06, /* mwdma1-2 ?? CHECK 0 should be ok but slow */
558-
.udma_mask = ATA_UDMA_MASK_40C,
556+
.pio_mask = ATA_PIO4,
557+
.mwdma_mask = ATA_MWDMA12_ONLY, /* mwdma1-2 ?? CHECK 0 should be ok but slow */
558+
.udma_mask = ATA_UDMA2,
559559
.port_ops = &piix_vmw_ops,
560560
},
561561

drivers/ata/libata-core.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#include <linux/scatterlist.h>
5858
#include <linux/io.h>
5959
#include <linux/async.h>
60+
#include <linux/log2.h>
6061
#include <scsi/scsi.h>
6162
#include <scsi/scsi_cmnd.h>
6263
#include <scsi/scsi_host.h>
@@ -2389,6 +2390,7 @@ int ata_dev_configure(struct ata_device *dev)
23892390
dev->cylinders = 0;
23902391
dev->heads = 0;
23912392
dev->sectors = 0;
2393+
dev->multi_count = 0;
23922394

23932395
/*
23942396
* common ATA, ATAPI feature tests
@@ -2426,8 +2428,15 @@ int ata_dev_configure(struct ata_device *dev)
24262428

24272429
dev->n_sectors = ata_id_n_sectors(id);
24282430

2429-
if (dev->id[59] & 0x100)
2430-
dev->multi_count = dev->id[59] & 0xff;
2431+
/* get current R/W Multiple count setting */
2432+
if ((dev->id[47] >> 8) == 0x80 && (dev->id[59] & 0x100)) {
2433+
unsigned int max = dev->id[47] & 0xff;
2434+
unsigned int cnt = dev->id[59] & 0xff;
2435+
/* only recognize/allow powers of two here */
2436+
if (is_power_of_2(max) && is_power_of_2(cnt))
2437+
if (cnt <= max)
2438+
dev->multi_count = cnt;
2439+
}
24312440

24322441
if (ata_id_has_lba(id)) {
24332442
const char *lba_desc;
@@ -6709,6 +6718,7 @@ EXPORT_SYMBOL_GPL(ata_id_c_string);
67096718
EXPORT_SYMBOL_GPL(ata_do_dev_read_id);
67106719
EXPORT_SYMBOL_GPL(ata_scsi_simulate);
67116720

6721+
EXPORT_SYMBOL_GPL(ata_pio_queue_task);
67126722
EXPORT_SYMBOL_GPL(ata_pio_need_iordy);
67136723
EXPORT_SYMBOL_GPL(ata_timing_find_mode);
67146724
EXPORT_SYMBOL_GPL(ata_timing_compute);

drivers/ata/libata-eh.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ void ata_scsi_error(struct Scsi_Host *host)
547547

548548
/* For new EH, all qcs are finished in one of three ways -
549549
* normal completion, error completion, and SCSI timeout.
550-
* Both cmpletions can race against SCSI timeout. When normal
550+
* Both completions can race against SCSI timeout. When normal
551551
* completion wins, the qc never reaches EH. When error
552552
* completion wins, the qc has ATA_QCFLAG_FAILED set.
553553
*
@@ -562,7 +562,19 @@ void ata_scsi_error(struct Scsi_Host *host)
562562
int nr_timedout = 0;
563563

564564
spin_lock_irqsave(ap->lock, flags);
565-
565+
566+
/* This must occur under the ap->lock as we don't want
567+
a polled recovery to race the real interrupt handler
568+
569+
The lost_interrupt handler checks for any completed but
570+
non-notified command and completes much like an IRQ handler.
571+
572+
We then fall into the error recovery code which will treat
573+
this as if normal completion won the race */
574+
575+
if (ap->ops->lost_interrupt)
576+
ap->ops->lost_interrupt(ap);
577+
566578
list_for_each_entry_safe(scmd, tmp, &host->eh_cmd_q, eh_entry) {
567579
struct ata_queued_cmd *qc;
568580

@@ -606,6 +618,9 @@ void ata_scsi_error(struct Scsi_Host *host)
606618
ap->eh_tries = ATA_EH_MAX_TRIES;
607619
} else
608620
spin_unlock_wait(ap->lock);
621+
622+
/* If we timed raced normal completion and there is nothing to
623+
recover nr_timedout == 0 why exactly are we doing error recovery ? */
609624

610625
repeat:
611626
/* invoke error handler */

0 commit comments

Comments
 (0)