aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/Kconfig2
-rw-r--r--drivers/ata/libata-acpi.c3
-rw-r--r--drivers/ata/libata-core.c10
-rw-r--r--drivers/ata/pata_pcmcia.c1
-rw-r--r--drivers/ata/pata_qdi.c2
-rw-r--r--drivers/ata/pata_scc.c4
-rw-r--r--drivers/ata/sata_nv.c92
-rw-r--r--drivers/ata/sata_promise.c24
-rw-r--r--drivers/ata/sata_via.c8
9 files changed, 118 insertions, 28 deletions
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 45dbdc14915f..c7219663f2b9 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -435,7 +435,7 @@ config PATA_OPTIDMA
435 help 435 help
436 This option enables DMA/PIO support for the later OPTi 436 This option enables DMA/PIO support for the later OPTi
437 controllers found on some old motherboards and in some 437 controllers found on some old motherboards and in some
438 latops 438 laptops.
439 439
440 If unsure, say N. 440 If unsure, say N.
441 441
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index 03a0acff6cfa..cb3eab6e379d 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -489,8 +489,7 @@ static void taskfile_load_raw(struct ata_port *ap,
489 489
490 /* convert gtf to tf */ 490 /* convert gtf to tf */
491 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; /* TBD */ 491 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; /* TBD */
492 tf.protocol = atadev->class == ATA_DEV_ATAPI ? 492 tf.protocol = ATA_PROT_NODATA;
493 ATA_PROT_ATAPI_NODATA : ATA_PROT_NODATA;
494 tf.feature = gtf->tfa[0]; /* 0x1f1 */ 493 tf.feature = gtf->tfa[0]; /* 0x1f1 */
495 tf.nsect = gtf->tfa[1]; /* 0x1f2 */ 494 tf.nsect = gtf->tfa[1]; /* 0x1f2 */
496 tf.lbal = gtf->tfa[2]; /* 0x1f3 */ 495 tf.lbal = gtf->tfa[2]; /* 0x1f3 */
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index a7950885d18e..4595d1f8cf60 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -895,6 +895,7 @@ static u64 ata_read_native_max_address(struct ata_device *dev)
895/** 895/**
896 * ata_set_native_max_address_ext - LBA48 native max set 896 * ata_set_native_max_address_ext - LBA48 native max set
897 * @dev: Device to query 897 * @dev: Device to query
898 * @new_sectors: new max sectors value to set for the device
898 * 899 *
899 * Perform an LBA48 size set max upon the device in question. Return the 900 * Perform an LBA48 size set max upon the device in question. Return the
900 * actual LBA48 size or zero if the command fails. 901 * actual LBA48 size or zero if the command fails.
@@ -932,6 +933,7 @@ static u64 ata_set_native_max_address_ext(struct ata_device *dev, u64 new_sector
932/** 933/**
933 * ata_set_native_max_address - LBA28 native max set 934 * ata_set_native_max_address - LBA28 native max set
934 * @dev: Device to query 935 * @dev: Device to query
936 * @new_sectors: new max sectors value to set for the device
935 * 937 *
936 * Perform an LBA28 size set max upon the device in question. Return the 938 * Perform an LBA28 size set max upon the device in question. Return the
937 * actual LBA28 size or zero if the command fails. 939 * actual LBA28 size or zero if the command fails.
@@ -1316,7 +1318,7 @@ void ata_port_flush_task(struct ata_port *ap)
1316 spin_unlock_irqrestore(ap->lock, flags); 1318 spin_unlock_irqrestore(ap->lock, flags);
1317 1319
1318 DPRINTK("flush #1\n"); 1320 DPRINTK("flush #1\n");
1319 flush_workqueue(ata_wq); 1321 cancel_work_sync(&ap->port_task.work); /* akpm: seems unneeded */
1320 1322
1321 /* 1323 /*
1322 * At this point, if a task is running, it's guaranteed to see 1324 * At this point, if a task is running, it's guaranteed to see
@@ -1327,7 +1329,7 @@ void ata_port_flush_task(struct ata_port *ap)
1327 if (ata_msg_ctl(ap)) 1329 if (ata_msg_ctl(ap))
1328 ata_port_printk(ap, KERN_DEBUG, "%s: flush #2\n", 1330 ata_port_printk(ap, KERN_DEBUG, "%s: flush #2\n",
1329 __FUNCTION__); 1331 __FUNCTION__);
1330 flush_workqueue(ata_wq); 1332 cancel_work_sync(&ap->port_task.work);
1331 } 1333 }
1332 1334
1333 spin_lock_irqsave(ap->lock, flags); 1335 spin_lock_irqsave(ap->lock, flags);
@@ -6475,9 +6477,9 @@ void ata_port_detach(struct ata_port *ap)
6475 /* Flush hotplug task. The sequence is similar to 6477 /* Flush hotplug task. The sequence is similar to
6476 * ata_port_flush_task(). 6478 * ata_port_flush_task().
6477 */ 6479 */
6478 flush_workqueue(ata_aux_wq); 6480 cancel_work_sync(&ap->hotplug_task.work); /* akpm: why? */
6479 cancel_delayed_work(&ap->hotplug_task); 6481 cancel_delayed_work(&ap->hotplug_task);
6480 flush_workqueue(ata_aux_wq); 6482 cancel_work_sync(&ap->hotplug_task.work);
6481 6483
6482 skip_eh: 6484 skip_eh:
6483 /* remove the associated SCSI host */ 6485 /* remove the associated SCSI host */
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c
index 75dc84797ff3..11245e331f77 100644
--- a/drivers/ata/pata_pcmcia.c
+++ b/drivers/ata/pata_pcmcia.c
@@ -357,6 +357,7 @@ static struct pcmcia_device_id pcmcia_devices[] = {
357 PCMCIA_DEVICE_MANF_CARD(0x000a, 0x0000), /* I-O Data CFA */ 357 PCMCIA_DEVICE_MANF_CARD(0x000a, 0x0000), /* I-O Data CFA */
358 PCMCIA_DEVICE_MANF_CARD(0x001c, 0x0001), /* Mitsubishi CFA */ 358 PCMCIA_DEVICE_MANF_CARD(0x001c, 0x0001), /* Mitsubishi CFA */
359 PCMCIA_DEVICE_MANF_CARD(0x0032, 0x0704), 359 PCMCIA_DEVICE_MANF_CARD(0x0032, 0x0704),
360 PCMCIA_DEVICE_MANF_CARD(0x0032, 0x2904),
360 PCMCIA_DEVICE_MANF_CARD(0x0045, 0x0401), /* SanDisk CFA */ 361 PCMCIA_DEVICE_MANF_CARD(0x0045, 0x0401), /* SanDisk CFA */
361 PCMCIA_DEVICE_MANF_CARD(0x0098, 0x0000), /* Toshiba */ 362 PCMCIA_DEVICE_MANF_CARD(0x0098, 0x0000), /* Toshiba */
362 PCMCIA_DEVICE_MANF_CARD(0x00a4, 0x002d), 363 PCMCIA_DEVICE_MANF_CARD(0x00a4, 0x002d),
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c
index 27685ce63ceb..fb8c9e14b8d4 100644
--- a/drivers/ata/pata_qdi.c
+++ b/drivers/ata/pata_qdi.c
@@ -375,7 +375,7 @@ static __init int qdi_init(void)
375 res = inb(port + 3); 375 res = inb(port + 3);
376 if (res & 1) { 376 if (res & 1) {
377 /* Single channel mode */ 377 /* Single channel mode */
378 if (qdi_init_one(port, 6580, ide_port[r & 0x01], ide_irq[r & 0x01], r & 0x04)) 378 if (qdi_init_one(port, 6580, ide_port[r & 0x01], ide_irq[r & 0x01], r & 0x04) == 0)
379 ct++; 379 ct++;
380 } else { 380 } else {
381 /* Dual channel mode */ 381 /* Dual channel mode */
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c
index 5df354d573e8..203f463ac39f 100644
--- a/drivers/ata/pata_scc.c
+++ b/drivers/ata/pata_scc.c
@@ -1142,14 +1142,14 @@ static int scc_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1142 static int printed_version; 1142 static int printed_version;
1143 unsigned int board_idx = (unsigned int) ent->driver_data; 1143 unsigned int board_idx = (unsigned int) ent->driver_data;
1144 const struct ata_port_info *ppi[] = { &scc_port_info[board_idx], NULL }; 1144 const struct ata_port_info *ppi[] = { &scc_port_info[board_idx], NULL };
1145 struct device *dev = &pdev->dev; 1145 struct ata_host *host;
1146 int rc; 1146 int rc;
1147 1147
1148 if (!printed_version++) 1148 if (!printed_version++)
1149 dev_printk(KERN_DEBUG, &pdev->dev, 1149 dev_printk(KERN_DEBUG, &pdev->dev,
1150 "version " DRV_VERSION "\n"); 1150 "version " DRV_VERSION "\n");
1151 1151
1152 host = ata_port_alloc_pinfo(&pdev->dev, ppi, 1); 1152 host = ata_host_alloc_pinfo(&pdev->dev, ppi, 1);
1153 if (!host) 1153 if (!host)
1154 return -ENOMEM; 1154 return -ENOMEM;
1155 1155
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index e2e795e58236..a097595d4dc7 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -257,6 +257,8 @@ static void nv_adma_port_stop(struct ata_port *ap);
257static int nv_adma_port_suspend(struct ata_port *ap, pm_message_t mesg); 257static int nv_adma_port_suspend(struct ata_port *ap, pm_message_t mesg);
258static int nv_adma_port_resume(struct ata_port *ap); 258static int nv_adma_port_resume(struct ata_port *ap);
259#endif 259#endif
260static void nv_adma_freeze(struct ata_port *ap);
261static void nv_adma_thaw(struct ata_port *ap);
260static void nv_adma_error_handler(struct ata_port *ap); 262static void nv_adma_error_handler(struct ata_port *ap);
261static void nv_adma_host_stop(struct ata_host *host); 263static void nv_adma_host_stop(struct ata_host *host);
262static void nv_adma_post_internal_cmd(struct ata_queued_cmd *qc); 264static void nv_adma_post_internal_cmd(struct ata_queued_cmd *qc);
@@ -444,8 +446,8 @@ static const struct ata_port_operations nv_adma_ops = {
444 .bmdma_status = ata_bmdma_status, 446 .bmdma_status = ata_bmdma_status,
445 .qc_prep = nv_adma_qc_prep, 447 .qc_prep = nv_adma_qc_prep,
446 .qc_issue = nv_adma_qc_issue, 448 .qc_issue = nv_adma_qc_issue,
447 .freeze = nv_ck804_freeze, 449 .freeze = nv_adma_freeze,
448 .thaw = nv_ck804_thaw, 450 .thaw = nv_adma_thaw,
449 .error_handler = nv_adma_error_handler, 451 .error_handler = nv_adma_error_handler,
450 .post_internal_cmd = nv_adma_post_internal_cmd, 452 .post_internal_cmd = nv_adma_post_internal_cmd,
451 .data_xfer = ata_data_xfer, 453 .data_xfer = ata_data_xfer,
@@ -815,8 +817,16 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance)
815 u16 status; 817 u16 status;
816 u32 gen_ctl; 818 u32 gen_ctl;
817 u32 notifier, notifier_error; 819 u32 notifier, notifier_error;
820
821 /* if ADMA is disabled, use standard ata interrupt handler */
822 if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) {
823 u8 irq_stat = readb(host->iomap[NV_MMIO_BAR] + NV_INT_STATUS_CK804)
824 >> (NV_INT_PORT_SHIFT * i);
825 handled += nv_host_intr(ap, irq_stat);
826 continue;
827 }
818 828
819 /* if in ATA register mode, use standard ata interrupt handler */ 829 /* if in ATA register mode, check for standard interrupts */
820 if (pp->flags & NV_ADMA_PORT_REGISTER_MODE) { 830 if (pp->flags & NV_ADMA_PORT_REGISTER_MODE) {
821 u8 irq_stat = readb(host->iomap[NV_MMIO_BAR] + NV_INT_STATUS_CK804) 831 u8 irq_stat = readb(host->iomap[NV_MMIO_BAR] + NV_INT_STATUS_CK804)
822 >> (NV_INT_PORT_SHIFT * i); 832 >> (NV_INT_PORT_SHIFT * i);
@@ -826,7 +836,6 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance)
826 command is active, to prevent losing interrupts. */ 836 command is active, to prevent losing interrupts. */
827 irq_stat |= NV_INT_DEV; 837 irq_stat |= NV_INT_DEV;
828 handled += nv_host_intr(ap, irq_stat); 838 handled += nv_host_intr(ap, irq_stat);
829 continue;
830 } 839 }
831 840
832 notifier = readl(mmio + NV_ADMA_NOTIFIER); 841 notifier = readl(mmio + NV_ADMA_NOTIFIER);
@@ -912,22 +921,77 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance)
912 return IRQ_RETVAL(handled); 921 return IRQ_RETVAL(handled);
913} 922}
914 923
924static void nv_adma_freeze(struct ata_port *ap)
925{
926 struct nv_adma_port_priv *pp = ap->private_data;
927 void __iomem *mmio = pp->ctl_block;
928 u16 tmp;
929
930 nv_ck804_freeze(ap);
931
932 if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE)
933 return;
934
935 /* clear any outstanding CK804 notifications */
936 writeb( NV_INT_ALL << (ap->port_no * NV_INT_PORT_SHIFT),
937 ap->host->iomap[NV_MMIO_BAR] + NV_INT_STATUS_CK804);
938
939 /* Disable interrupt */
940 tmp = readw(mmio + NV_ADMA_CTL);
941 writew( tmp & ~(NV_ADMA_CTL_AIEN | NV_ADMA_CTL_HOTPLUG_IEN),
942 mmio + NV_ADMA_CTL);
943 readw( mmio + NV_ADMA_CTL ); /* flush posted write */
944}
945
946static void nv_adma_thaw(struct ata_port *ap)
947{
948 struct nv_adma_port_priv *pp = ap->private_data;
949 void __iomem *mmio = pp->ctl_block;
950 u16 tmp;
951
952 nv_ck804_thaw(ap);
953
954 if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE)
955 return;
956
957 /* Enable interrupt */
958 tmp = readw(mmio + NV_ADMA_CTL);
959 writew( tmp | (NV_ADMA_CTL_AIEN | NV_ADMA_CTL_HOTPLUG_IEN),
960 mmio + NV_ADMA_CTL);
961 readw( mmio + NV_ADMA_CTL ); /* flush posted write */
962}
963
915static void nv_adma_irq_clear(struct ata_port *ap) 964static void nv_adma_irq_clear(struct ata_port *ap)
916{ 965{
917 struct nv_adma_port_priv *pp = ap->private_data; 966 struct nv_adma_port_priv *pp = ap->private_data;
918 void __iomem *mmio = pp->ctl_block; 967 void __iomem *mmio = pp->ctl_block;
919 u16 status = readw(mmio + NV_ADMA_STAT); 968 u32 notifier_clears[2];
920 u32 notifier = readl(mmio + NV_ADMA_NOTIFIER);
921 u32 notifier_error = readl(mmio + NV_ADMA_NOTIFIER_ERROR);
922 void __iomem *dma_stat_addr = ap->ioaddr.bmdma_addr + ATA_DMA_STATUS;
923 969
924 /* clear ADMA status */ 970 if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) {
925 writew(status, mmio + NV_ADMA_STAT); 971 ata_bmdma_irq_clear(ap);
926 writel(notifier | notifier_error, 972 return;
927 pp->notifier_clear_block); 973 }
974
975 /* clear any outstanding CK804 notifications */
976 writeb( NV_INT_ALL << (ap->port_no * NV_INT_PORT_SHIFT),
977 ap->host->iomap[NV_MMIO_BAR] + NV_INT_STATUS_CK804);
928 978
929 /** clear legacy status */ 979 /* clear ADMA status */
930 iowrite8(ioread8(dma_stat_addr), dma_stat_addr); 980 writew(0xffff, mmio + NV_ADMA_STAT);
981
982 /* clear notifiers - note both ports need to be written with
983 something even though we are only clearing on one */
984 if (ap->port_no == 0) {
985 notifier_clears[0] = 0xFFFFFFFF;
986 notifier_clears[1] = 0;
987 } else {
988 notifier_clears[0] = 0;
989 notifier_clears[1] = 0xFFFFFFFF;
990 }
991 pp = ap->host->ports[0]->private_data;
992 writel(notifier_clears[0], pp->notifier_clear_block);
993 pp = ap->host->ports[1]->private_data;
994 writel(notifier_clears[1], pp->notifier_clear_block);
931} 995}
932 996
933static void nv_adma_post_internal_cmd(struct ata_queued_cmd *qc) 997static void nv_adma_post_internal_cmd(struct ata_queued_cmd *qc)
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index f56549b90aa6..3a7d9b5332af 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -45,7 +45,7 @@
45#include "sata_promise.h" 45#include "sata_promise.h"
46 46
47#define DRV_NAME "sata_promise" 47#define DRV_NAME "sata_promise"
48#define DRV_VERSION "2.05" 48#define DRV_VERSION "2.07"
49 49
50 50
51enum { 51enum {
@@ -653,6 +653,8 @@ static void pdc_error_intr(struct ata_port *ap, struct ata_queued_cmd *qc,
653 qc->err_mask |= ac_err_mask; 653 qc->err_mask |= ac_err_mask;
654 654
655 pdc_reset_port(ap); 655 pdc_reset_port(ap);
656
657 ata_port_abort(ap);
656} 658}
657 659
658static inline unsigned int pdc_host_intr( struct ata_port *ap, 660static inline unsigned int pdc_host_intr( struct ata_port *ap,
@@ -924,6 +926,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
924 struct ata_host *host; 926 struct ata_host *host;
925 void __iomem *base; 927 void __iomem *base;
926 int n_ports, i, rc; 928 int n_ports, i, rc;
929 int is_sataii_tx4;
927 930
928 if (!printed_version++) 931 if (!printed_version++)
929 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); 932 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
@@ -962,10 +965,23 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
962 } 965 }
963 host->iomap = pcim_iomap_table(pdev); 966 host->iomap = pcim_iomap_table(pdev);
964 967
965 for (i = 0; i < host->n_ports; i++) 968 is_sataii_tx4 = 0;
969 if ((pi->flags & (PDC_FLAG_GEN_II|PDC_FLAG_4_PORTS)) == (PDC_FLAG_GEN_II|PDC_FLAG_4_PORTS)) {
970 is_sataii_tx4 = 1;
971 dev_printk(KERN_INFO, &pdev->dev, "applying SATAII TX4 port numbering workaround\n");
972 }
973 for (i = 0; i < host->n_ports; i++) {
974 static const unsigned char sataii_tx4_port_remap[4] = { 3, 1, 0, 2};
975 int ata_nr;
976
977 ata_nr = i;
978 if (is_sataii_tx4)
979 ata_nr = sataii_tx4_port_remap[i];
980
966 pdc_ata_setup_port(host->ports[i], 981 pdc_ata_setup_port(host->ports[i],
967 base + 0x200 + i * 0x80, 982 base + 0x200 + ata_nr * 0x80,
968 base + 0x400 + i * 0x100); 983 base + 0x400 + ata_nr * 0x100);
984 }
969 985
970 /* initialize adapter */ 986 /* initialize adapter */
971 pdc_host_init(host); 987 pdc_host_init(host);
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index 305ab7c68ca5..939c9246fdd1 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -93,6 +93,10 @@ static struct pci_driver svia_pci_driver = {
93 .name = DRV_NAME, 93 .name = DRV_NAME,
94 .id_table = svia_pci_tbl, 94 .id_table = svia_pci_tbl,
95 .probe = svia_init_one, 95 .probe = svia_init_one,
96#ifdef CONFIG_PM
97 .suspend = ata_pci_device_suspend,
98 .resume = ata_pci_device_resume,
99#endif
96 .remove = ata_pci_remove_one, 100 .remove = ata_pci_remove_one,
97}; 101};
98 102
@@ -112,6 +116,10 @@ static struct scsi_host_template svia_sht = {
112 .slave_configure = ata_scsi_slave_config, 116 .slave_configure = ata_scsi_slave_config,
113 .slave_destroy = ata_scsi_slave_destroy, 117 .slave_destroy = ata_scsi_slave_destroy,
114 .bios_param = ata_std_bios_param, 118 .bios_param = ata_std_bios_param,
119#ifdef CONFIG_PM
120 .suspend = ata_scsi_device_suspend,
121 .resume = ata_scsi_device_resume,
122#endif
115}; 123};
116 124
117static const struct ata_port_operations vt6420_sata_ops = { 125static const struct ata_port_operations vt6420_sata_ops = {