diff options
-rw-r--r-- | drivers/scsi/libata-core.c | 43 | ||||
-rw-r--r-- | include/linux/libata.h | 5 |
2 files changed, 30 insertions, 18 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 1514cb5e35f7..a87748ba579c 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -65,8 +65,7 @@ static unsigned int ata_dev_init_params(struct ata_port *ap, | |||
65 | struct ata_device *dev); | 65 | struct ata_device *dev); |
66 | static void ata_set_mode(struct ata_port *ap); | 66 | static void ata_set_mode(struct ata_port *ap); |
67 | static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev); | 67 | static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev); |
68 | static unsigned int ata_dev_xfermask(struct ata_port *ap, | 68 | static void ata_dev_xfermask(struct ata_port *ap, struct ata_device *dev); |
69 | struct ata_device *dev); | ||
70 | 69 | ||
71 | static unsigned int ata_unique_id = 1; | 70 | static unsigned int ata_unique_id = 1; |
72 | static struct workqueue_struct *ata_wq; | 71 | static struct workqueue_struct *ata_wq; |
@@ -1801,16 +1800,19 @@ static void ata_set_mode(struct ata_port *ap) | |||
1801 | /* step 1: calculate xfer_mask */ | 1800 | /* step 1: calculate xfer_mask */ |
1802 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 1801 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
1803 | struct ata_device *dev = &ap->device[i]; | 1802 | struct ata_device *dev = &ap->device[i]; |
1804 | unsigned int xfer_mask; | 1803 | unsigned int pio_mask, dma_mask; |
1805 | 1804 | ||
1806 | if (!ata_dev_present(dev)) | 1805 | if (!ata_dev_present(dev)) |
1807 | continue; | 1806 | continue; |
1808 | 1807 | ||
1809 | xfer_mask = ata_dev_xfermask(ap, dev); | 1808 | ata_dev_xfermask(ap, dev); |
1810 | 1809 | ||
1811 | dev->pio_mode = ata_xfer_mask2mode(xfer_mask & ATA_MASK_PIO); | 1810 | /* TODO: let LLDD filter dev->*_mask here */ |
1812 | dev->dma_mode = ata_xfer_mask2mode(xfer_mask & (ATA_MASK_MWDMA | | 1811 | |
1813 | ATA_MASK_UDMA)); | 1812 | pio_mask = ata_pack_xfermask(dev->pio_mask, 0, 0); |
1813 | dma_mask = ata_pack_xfermask(0, dev->mwdma_mask, dev->udma_mask); | ||
1814 | dev->pio_mode = ata_xfer_mask2mode(pio_mask); | ||
1815 | dev->dma_mode = ata_xfer_mask2mode(dma_mask); | ||
1814 | } | 1816 | } |
1815 | 1817 | ||
1816 | /* step 2: always set host PIO timings */ | 1818 | /* step 2: always set host PIO timings */ |
@@ -2653,18 +2655,15 @@ static int ata_dma_blacklisted(const struct ata_device *dev) | |||
2653 | * @ap: Port on which the device to compute xfermask for resides | 2655 | * @ap: Port on which the device to compute xfermask for resides |
2654 | * @dev: Device to compute xfermask for | 2656 | * @dev: Device to compute xfermask for |
2655 | * | 2657 | * |
2656 | * Compute supported xfermask of @dev. This function is | 2658 | * Compute supported xfermask of @dev and store it in |
2657 | * responsible for applying all known limits including host | 2659 | * dev->*_mask. This function is responsible for applying all |
2658 | * controller limits, device blacklist, etc... | 2660 | * known limits including host controller limits, device |
2661 | * blacklist, etc... | ||
2659 | * | 2662 | * |
2660 | * LOCKING: | 2663 | * LOCKING: |
2661 | * None. | 2664 | * None. |
2662 | * | ||
2663 | * RETURNS: | ||
2664 | * Computed xfermask. | ||
2665 | */ | 2665 | */ |
2666 | static unsigned int ata_dev_xfermask(struct ata_port *ap, | 2666 | static void ata_dev_xfermask(struct ata_port *ap, struct ata_device *dev) |
2667 | struct ata_device *dev) | ||
2668 | { | 2667 | { |
2669 | unsigned long xfer_mask; | 2668 | unsigned long xfer_mask; |
2670 | int i; | 2669 | int i; |
@@ -2677,6 +2676,8 @@ static unsigned int ata_dev_xfermask(struct ata_port *ap, | |||
2677 | struct ata_device *d = &ap->device[i]; | 2676 | struct ata_device *d = &ap->device[i]; |
2678 | if (!ata_dev_present(d)) | 2677 | if (!ata_dev_present(d)) |
2679 | continue; | 2678 | continue; |
2679 | xfer_mask &= ata_pack_xfermask(d->pio_mask, d->mwdma_mask, | ||
2680 | d->udma_mask); | ||
2680 | xfer_mask &= ata_id_xfermask(d->id); | 2681 | xfer_mask &= ata_id_xfermask(d->id); |
2681 | if (ata_dma_blacklisted(d)) | 2682 | if (ata_dma_blacklisted(d)) |
2682 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); | 2683 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); |
@@ -2686,7 +2687,8 @@ static unsigned int ata_dev_xfermask(struct ata_port *ap, | |||
2686 | printk(KERN_WARNING "ata%u: dev %u is on DMA blacklist, " | 2687 | printk(KERN_WARNING "ata%u: dev %u is on DMA blacklist, " |
2687 | "disabling DMA\n", ap->id, dev->devno); | 2688 | "disabling DMA\n", ap->id, dev->devno); |
2688 | 2689 | ||
2689 | return xfer_mask; | 2690 | ata_unpack_xfermask(xfer_mask, &dev->pio_mask, &dev->mwdma_mask, |
2691 | &dev->udma_mask); | ||
2690 | } | 2692 | } |
2691 | 2693 | ||
2692 | /** | 2694 | /** |
@@ -4436,8 +4438,13 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host, | |||
4436 | INIT_WORK(&ap->port_task, NULL, NULL); | 4438 | INIT_WORK(&ap->port_task, NULL, NULL); |
4437 | INIT_LIST_HEAD(&ap->eh_done_q); | 4439 | INIT_LIST_HEAD(&ap->eh_done_q); |
4438 | 4440 | ||
4439 | for (i = 0; i < ATA_MAX_DEVICES; i++) | 4441 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
4440 | ap->device[i].devno = i; | 4442 | struct ata_device *dev = &ap->device[i]; |
4443 | dev->devno = i; | ||
4444 | dev->pio_mask = UINT_MAX; | ||
4445 | dev->mwdma_mask = UINT_MAX; | ||
4446 | dev->udma_mask = UINT_MAX; | ||
4447 | } | ||
4441 | 4448 | ||
4442 | #ifdef ATA_IRQ_TRAP | 4449 | #ifdef ATA_IRQ_TRAP |
4443 | ap->stats.unhandled_irq = 1; | 4450 | ap->stats.unhandled_irq = 1; |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 7a54244d30aa..fbe8ba212598 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -358,6 +358,11 @@ struct ata_device { | |||
358 | unsigned int max_sectors; /* per-device max sectors */ | 358 | unsigned int max_sectors; /* per-device max sectors */ |
359 | unsigned int cdb_len; | 359 | unsigned int cdb_len; |
360 | 360 | ||
361 | /* per-dev xfer mask */ | ||
362 | unsigned int pio_mask; | ||
363 | unsigned int mwdma_mask; | ||
364 | unsigned int udma_mask; | ||
365 | |||
361 | /* for CHS addressing */ | 366 | /* for CHS addressing */ |
362 | u16 cylinders; /* Number of cylinders */ | 367 | u16 cylinders; /* Number of cylinders */ |
363 | u16 heads; /* Number of heads */ | 368 | u16 heads; /* Number of heads */ |