diff options
Diffstat (limited to 'drivers/scsi/ata_piix.c')
-rw-r--r-- | drivers/scsi/ata_piix.c | 112 |
1 files changed, 50 insertions, 62 deletions
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c index 6dc88149f9f1..521b718763f6 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c | |||
@@ -93,7 +93,7 @@ | |||
93 | #include <linux/libata.h> | 93 | #include <linux/libata.h> |
94 | 94 | ||
95 | #define DRV_NAME "ata_piix" | 95 | #define DRV_NAME "ata_piix" |
96 | #define DRV_VERSION "1.05" | 96 | #define DRV_VERSION "1.10" |
97 | 97 | ||
98 | enum { | 98 | enum { |
99 | PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ | 99 | PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ |
@@ -146,11 +146,10 @@ struct piix_map_db { | |||
146 | 146 | ||
147 | static int piix_init_one (struct pci_dev *pdev, | 147 | static int piix_init_one (struct pci_dev *pdev, |
148 | const struct pci_device_id *ent); | 148 | const struct pci_device_id *ent); |
149 | |||
150 | static int piix_pata_probe_reset(struct ata_port *ap, unsigned int *classes); | ||
151 | static int piix_sata_probe_reset(struct ata_port *ap, unsigned int *classes); | ||
152 | static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev); | 149 | static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev); |
153 | static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev); | 150 | static void piix_set_dmamode (struct ata_port *ap, struct ata_device *adev); |
151 | static void piix_pata_error_handler(struct ata_port *ap); | ||
152 | static void piix_sata_error_handler(struct ata_port *ap); | ||
154 | 153 | ||
155 | static unsigned int in_module_init = 1; | 154 | static unsigned int in_module_init = 1; |
156 | 155 | ||
@@ -159,6 +158,7 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
159 | { 0x8086, 0x7111, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix4_pata }, | 158 | { 0x8086, 0x7111, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix4_pata }, |
160 | { 0x8086, 0x24db, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_pata }, | 159 | { 0x8086, 0x24db, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_pata }, |
161 | { 0x8086, 0x25a2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_pata }, | 160 | { 0x8086, 0x25a2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_pata }, |
161 | { 0x8086, 0x27df, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_pata }, | ||
162 | #endif | 162 | #endif |
163 | 163 | ||
164 | /* NOTE: The following PCI ids must be kept in sync with the | 164 | /* NOTE: The following PCI ids must be kept in sync with the |
@@ -218,6 +218,7 @@ static struct scsi_host_template piix_sht = { | |||
218 | .proc_name = DRV_NAME, | 218 | .proc_name = DRV_NAME, |
219 | .dma_boundary = ATA_DMA_BOUNDARY, | 219 | .dma_boundary = ATA_DMA_BOUNDARY, |
220 | .slave_configure = ata_scsi_slave_config, | 220 | .slave_configure = ata_scsi_slave_config, |
221 | .slave_destroy = ata_scsi_slave_destroy, | ||
221 | .bios_param = ata_std_bios_param, | 222 | .bios_param = ata_std_bios_param, |
222 | .resume = ata_scsi_device_resume, | 223 | .resume = ata_scsi_device_resume, |
223 | .suspend = ata_scsi_device_suspend, | 224 | .suspend = ata_scsi_device_suspend, |
@@ -227,6 +228,7 @@ static const struct ata_port_operations piix_pata_ops = { | |||
227 | .port_disable = ata_port_disable, | 228 | .port_disable = ata_port_disable, |
228 | .set_piomode = piix_set_piomode, | 229 | .set_piomode = piix_set_piomode, |
229 | .set_dmamode = piix_set_dmamode, | 230 | .set_dmamode = piix_set_dmamode, |
231 | .mode_filter = ata_pci_default_filter, | ||
230 | 232 | ||
231 | .tf_load = ata_tf_load, | 233 | .tf_load = ata_tf_load, |
232 | .tf_read = ata_tf_read, | 234 | .tf_read = ata_tf_read, |
@@ -234,16 +236,18 @@ static const struct ata_port_operations piix_pata_ops = { | |||
234 | .exec_command = ata_exec_command, | 236 | .exec_command = ata_exec_command, |
235 | .dev_select = ata_std_dev_select, | 237 | .dev_select = ata_std_dev_select, |
236 | 238 | ||
237 | .probe_reset = piix_pata_probe_reset, | ||
238 | |||
239 | .bmdma_setup = ata_bmdma_setup, | 239 | .bmdma_setup = ata_bmdma_setup, |
240 | .bmdma_start = ata_bmdma_start, | 240 | .bmdma_start = ata_bmdma_start, |
241 | .bmdma_stop = ata_bmdma_stop, | 241 | .bmdma_stop = ata_bmdma_stop, |
242 | .bmdma_status = ata_bmdma_status, | 242 | .bmdma_status = ata_bmdma_status, |
243 | .qc_prep = ata_qc_prep, | 243 | .qc_prep = ata_qc_prep, |
244 | .qc_issue = ata_qc_issue_prot, | 244 | .qc_issue = ata_qc_issue_prot, |
245 | .data_xfer = ata_pio_data_xfer, | ||
245 | 246 | ||
246 | .eng_timeout = ata_eng_timeout, | 247 | .freeze = ata_bmdma_freeze, |
248 | .thaw = ata_bmdma_thaw, | ||
249 | .error_handler = piix_pata_error_handler, | ||
250 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | ||
247 | 251 | ||
248 | .irq_handler = ata_interrupt, | 252 | .irq_handler = ata_interrupt, |
249 | .irq_clear = ata_bmdma_irq_clear, | 253 | .irq_clear = ata_bmdma_irq_clear, |
@@ -262,16 +266,18 @@ static const struct ata_port_operations piix_sata_ops = { | |||
262 | .exec_command = ata_exec_command, | 266 | .exec_command = ata_exec_command, |
263 | .dev_select = ata_std_dev_select, | 267 | .dev_select = ata_std_dev_select, |
264 | 268 | ||
265 | .probe_reset = piix_sata_probe_reset, | ||
266 | |||
267 | .bmdma_setup = ata_bmdma_setup, | 269 | .bmdma_setup = ata_bmdma_setup, |
268 | .bmdma_start = ata_bmdma_start, | 270 | .bmdma_start = ata_bmdma_start, |
269 | .bmdma_stop = ata_bmdma_stop, | 271 | .bmdma_stop = ata_bmdma_stop, |
270 | .bmdma_status = ata_bmdma_status, | 272 | .bmdma_status = ata_bmdma_status, |
271 | .qc_prep = ata_qc_prep, | 273 | .qc_prep = ata_qc_prep, |
272 | .qc_issue = ata_qc_issue_prot, | 274 | .qc_issue = ata_qc_issue_prot, |
275 | .data_xfer = ata_pio_data_xfer, | ||
273 | 276 | ||
274 | .eng_timeout = ata_eng_timeout, | 277 | .freeze = ata_bmdma_freeze, |
278 | .thaw = ata_bmdma_thaw, | ||
279 | .error_handler = piix_sata_error_handler, | ||
280 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | ||
275 | 281 | ||
276 | .irq_handler = ata_interrupt, | 282 | .irq_handler = ata_interrupt, |
277 | .irq_clear = ata_bmdma_irq_clear, | 283 | .irq_clear = ata_bmdma_irq_clear, |
@@ -455,59 +461,51 @@ cbl40: | |||
455 | } | 461 | } |
456 | 462 | ||
457 | /** | 463 | /** |
458 | * piix_pata_probeinit - probeinit for PATA host controller | 464 | * piix_pata_prereset - prereset for PATA host controller |
459 | * @ap: Target port | 465 | * @ap: Target port |
460 | * | 466 | * |
461 | * Probeinit including cable detection. | 467 | * Prereset including cable detection. |
462 | * | ||
463 | * LOCKING: | ||
464 | * None (inherited from caller). | ||
465 | */ | ||
466 | static void piix_pata_probeinit(struct ata_port *ap) | ||
467 | { | ||
468 | piix_pata_cbl_detect(ap); | ||
469 | ata_std_probeinit(ap); | ||
470 | } | ||
471 | |||
472 | /** | ||
473 | * piix_pata_probe_reset - Perform reset on PATA port and classify | ||
474 | * @ap: Port to reset | ||
475 | * @classes: Resulting classes of attached devices | ||
476 | * | ||
477 | * Reset PATA phy and classify attached devices. | ||
478 | * | 468 | * |
479 | * LOCKING: | 469 | * LOCKING: |
480 | * None (inherited from caller). | 470 | * None (inherited from caller). |
481 | */ | 471 | */ |
482 | static int piix_pata_probe_reset(struct ata_port *ap, unsigned int *classes) | 472 | static int piix_pata_prereset(struct ata_port *ap) |
483 | { | 473 | { |
484 | struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); | 474 | struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); |
485 | 475 | ||
486 | if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->hard_port_no])) { | 476 | if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->hard_port_no])) { |
487 | printk(KERN_INFO "ata%u: port disabled. ignoring.\n", ap->id); | 477 | ata_port_printk(ap, KERN_INFO, "port disabled. ignoring.\n"); |
478 | ap->eh_context.i.action &= ~ATA_EH_RESET_MASK; | ||
488 | return 0; | 479 | return 0; |
489 | } | 480 | } |
490 | 481 | ||
491 | return ata_drive_probe_reset(ap, piix_pata_probeinit, | 482 | piix_pata_cbl_detect(ap); |
492 | ata_std_softreset, NULL, | 483 | |
493 | ata_std_postreset, classes); | 484 | return ata_std_prereset(ap); |
485 | } | ||
486 | |||
487 | static void piix_pata_error_handler(struct ata_port *ap) | ||
488 | { | ||
489 | ata_bmdma_drive_eh(ap, piix_pata_prereset, ata_std_softreset, NULL, | ||
490 | ata_std_postreset); | ||
494 | } | 491 | } |
495 | 492 | ||
496 | /** | 493 | /** |
497 | * piix_sata_probe - Probe PCI device for present SATA devices | 494 | * piix_sata_prereset - prereset for SATA host controller |
498 | * @ap: Port associated with the PCI device we wish to probe | 495 | * @ap: Target port |
499 | * | 496 | * |
500 | * Reads and configures SATA PCI device's PCI config register | 497 | * Reads and configures SATA PCI device's PCI config register |
501 | * Port Configuration and Status (PCS) to determine port and | 498 | * Port Configuration and Status (PCS) to determine port and |
502 | * device availability. | 499 | * device availability. Return -ENODEV to skip reset if no |
500 | * device is present. | ||
503 | * | 501 | * |
504 | * LOCKING: | 502 | * LOCKING: |
505 | * None (inherited from caller). | 503 | * None (inherited from caller). |
506 | * | 504 | * |
507 | * RETURNS: | 505 | * RETURNS: |
508 | * Mask of avaliable devices on the port. | 506 | * 0 if device is present, -ENODEV otherwise. |
509 | */ | 507 | */ |
510 | static unsigned int piix_sata_probe (struct ata_port *ap) | 508 | static int piix_sata_prereset(struct ata_port *ap) |
511 | { | 509 | { |
512 | struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); | 510 | struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); |
513 | const unsigned int *map = ap->host_set->private_data; | 511 | const unsigned int *map = ap->host_set->private_data; |
@@ -549,29 +547,19 @@ static unsigned int piix_sata_probe (struct ata_port *ap) | |||
549 | DPRINTK("ata%u: LEAVE, pcs=0x%x present_mask=0x%x\n", | 547 | DPRINTK("ata%u: LEAVE, pcs=0x%x present_mask=0x%x\n", |
550 | ap->id, pcs, present_mask); | 548 | ap->id, pcs, present_mask); |
551 | 549 | ||
552 | return present_mask; | 550 | if (!present_mask) { |
553 | } | 551 | ata_port_printk(ap, KERN_INFO, "SATA port has no device.\n"); |
554 | 552 | ap->eh_context.i.action &= ~ATA_EH_RESET_MASK; | |
555 | /** | ||
556 | * piix_sata_probe_reset - Perform reset on SATA port and classify | ||
557 | * @ap: Port to reset | ||
558 | * @classes: Resulting classes of attached devices | ||
559 | * | ||
560 | * Reset SATA phy and classify attached devices. | ||
561 | * | ||
562 | * LOCKING: | ||
563 | * None (inherited from caller). | ||
564 | */ | ||
565 | static int piix_sata_probe_reset(struct ata_port *ap, unsigned int *classes) | ||
566 | { | ||
567 | if (!piix_sata_probe(ap)) { | ||
568 | printk(KERN_INFO "ata%u: SATA port has no device.\n", ap->id); | ||
569 | return 0; | 553 | return 0; |
570 | } | 554 | } |
571 | 555 | ||
572 | return ata_drive_probe_reset(ap, ata_std_probeinit, | 556 | return ata_std_prereset(ap); |
573 | ata_std_softreset, NULL, | 557 | } |
574 | ata_std_postreset, classes); | 558 | |
559 | static void piix_sata_error_handler(struct ata_port *ap) | ||
560 | { | ||
561 | ata_bmdma_drive_eh(ap, piix_sata_prereset, ata_std_softreset, NULL, | ||
562 | ata_std_postreset); | ||
575 | } | 563 | } |
576 | 564 | ||
577 | /** | 565 | /** |
@@ -760,15 +748,15 @@ static int __devinit piix_check_450nx_errata(struct pci_dev *ata_dev) | |||
760 | pci_read_config_byte(pdev, PCI_REVISION_ID, &rev); | 748 | pci_read_config_byte(pdev, PCI_REVISION_ID, &rev); |
761 | pci_read_config_word(pdev, 0x41, &cfg); | 749 | pci_read_config_word(pdev, 0x41, &cfg); |
762 | /* Only on the original revision: IDE DMA can hang */ | 750 | /* Only on the original revision: IDE DMA can hang */ |
763 | if(rev == 0x00) | 751 | if (rev == 0x00) |
764 | no_piix_dma = 1; | 752 | no_piix_dma = 1; |
765 | /* On all revisions below 5 PXB bus lock must be disabled for IDE */ | 753 | /* On all revisions below 5 PXB bus lock must be disabled for IDE */ |
766 | else if(cfg & (1<<14) && rev < 5) | 754 | else if (cfg & (1<<14) && rev < 5) |
767 | no_piix_dma = 2; | 755 | no_piix_dma = 2; |
768 | } | 756 | } |
769 | if(no_piix_dma) | 757 | if (no_piix_dma) |
770 | dev_printk(KERN_WARNING, &ata_dev->dev, "450NX errata present, disabling IDE DMA.\n"); | 758 | dev_printk(KERN_WARNING, &ata_dev->dev, "450NX errata present, disabling IDE DMA.\n"); |
771 | if(no_piix_dma == 2) | 759 | if (no_piix_dma == 2) |
772 | dev_printk(KERN_WARNING, &ata_dev->dev, "A BIOS update may resolve this.\n"); | 760 | dev_printk(KERN_WARNING, &ata_dev->dev, "A BIOS update may resolve this.\n"); |
773 | return no_piix_dma; | 761 | return no_piix_dma; |
774 | } | 762 | } |