aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2006-12-01 04:56:43 -0500
committerDavid Woodhouse <dwmw2@infradead.org>2006-12-01 04:56:43 -0500
commitbd3c97a7c718bfb9f1e4f31c16c383a5c6f815eb (patch)
tree3f56594e813c6f35cbacbdb3e137ba5bfd0b3069 /drivers/ata
parent6c33cafc794d07c9254c160789120a0e98c088c9 (diff)
parent0215ffb08ce99e2bb59eca114a99499a4d06e704 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/Kconfig1
-rw-r--r--drivers/ata/ahci.c24
-rw-r--r--drivers/ata/ata_piix.c41
-rw-r--r--drivers/ata/libata-core.c3
-rw-r--r--drivers/ata/libata-scsi.c23
-rw-r--r--drivers/ata/libata-sff.c9
-rw-r--r--drivers/ata/libata.h1
-rw-r--r--drivers/ata/pata_amd.c2
-rw-r--r--drivers/ata/pata_artop.c2
-rw-r--r--drivers/ata/pata_hpt37x.c19
-rw-r--r--drivers/ata/sata_nv.c12
-rw-r--r--drivers/ata/sata_sis.c21
-rw-r--r--drivers/ata/sata_via.c2
13 files changed, 92 insertions, 68 deletions
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 3f4aa0c99ee4..03f6338acc8f 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -6,6 +6,7 @@ menu "Serial ATA (prod) and Parallel ATA (experimental) drivers"
6 6
7config ATA 7config ATA
8 tristate "ATA device support" 8 tristate "ATA device support"
9 depends on BLOCK
9 depends on !(M32R || M68K) || BROKEN 10 depends on !(M32R || M68K) || BROKEN
10 depends on !SUN4 || BROKEN 11 depends on !SUN4 || BROKEN
11 select SCSI 12 select SCSI
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 25929123ffff..f510e1196dc6 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -314,6 +314,17 @@ static const struct pci_device_id ahci_pci_tbl[] = {
314 { PCI_VDEVICE(INTEL, 0x2824), board_ahci }, /* ICH8 */ 314 { PCI_VDEVICE(INTEL, 0x2824), board_ahci }, /* ICH8 */
315 { PCI_VDEVICE(INTEL, 0x2829), board_ahci }, /* ICH8M */ 315 { PCI_VDEVICE(INTEL, 0x2829), board_ahci }, /* ICH8M */
316 { PCI_VDEVICE(INTEL, 0x282a), board_ahci }, /* ICH8M */ 316 { PCI_VDEVICE(INTEL, 0x282a), board_ahci }, /* ICH8M */
317 { PCI_VDEVICE(INTEL, 0x2922), board_ahci }, /* ICH9 */
318 { PCI_VDEVICE(INTEL, 0x2923), board_ahci }, /* ICH9 */
319 { PCI_VDEVICE(INTEL, 0x2924), board_ahci }, /* ICH9 */
320 { PCI_VDEVICE(INTEL, 0x2925), board_ahci }, /* ICH9 */
321 { PCI_VDEVICE(INTEL, 0x2927), board_ahci }, /* ICH9 */
322 { PCI_VDEVICE(INTEL, 0x2929), board_ahci }, /* ICH9M */
323 { PCI_VDEVICE(INTEL, 0x292a), board_ahci }, /* ICH9M */
324 { PCI_VDEVICE(INTEL, 0x292b), board_ahci }, /* ICH9M */
325 { PCI_VDEVICE(INTEL, 0x292f), board_ahci }, /* ICH9M */
326 { PCI_VDEVICE(INTEL, 0x294d), board_ahci }, /* ICH9 */
327 { PCI_VDEVICE(INTEL, 0x294e), board_ahci }, /* ICH9M */
317 328
318 /* JMicron */ 329 /* JMicron */
319 { PCI_VDEVICE(JMICRON, 0x2360), board_ahci }, /* JMicron JMB360 */ 330 { PCI_VDEVICE(JMICRON, 0x2360), board_ahci }, /* JMicron JMB360 */
@@ -334,6 +345,14 @@ static const struct pci_device_id ahci_pci_tbl[] = {
334 { PCI_VDEVICE(NVIDIA, 0x044d), board_ahci }, /* MCP65 */ 345 { PCI_VDEVICE(NVIDIA, 0x044d), board_ahci }, /* MCP65 */
335 { PCI_VDEVICE(NVIDIA, 0x044e), board_ahci }, /* MCP65 */ 346 { PCI_VDEVICE(NVIDIA, 0x044e), board_ahci }, /* MCP65 */
336 { PCI_VDEVICE(NVIDIA, 0x044f), board_ahci }, /* MCP65 */ 347 { PCI_VDEVICE(NVIDIA, 0x044f), board_ahci }, /* MCP65 */
348 { PCI_VDEVICE(NVIDIA, 0x0554), board_ahci }, /* MCP67 */
349 { PCI_VDEVICE(NVIDIA, 0x0555), board_ahci }, /* MCP67 */
350 { PCI_VDEVICE(NVIDIA, 0x0556), board_ahci }, /* MCP67 */
351 { PCI_VDEVICE(NVIDIA, 0x0557), board_ahci }, /* MCP67 */
352 { PCI_VDEVICE(NVIDIA, 0x0558), board_ahci }, /* MCP67 */
353 { PCI_VDEVICE(NVIDIA, 0x0559), board_ahci }, /* MCP67 */
354 { PCI_VDEVICE(NVIDIA, 0x055a), board_ahci }, /* MCP67 */
355 { PCI_VDEVICE(NVIDIA, 0x055b), board_ahci }, /* MCP67 */
337 356
338 /* SiS */ 357 /* SiS */
339 { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */ 358 { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */
@@ -736,8 +755,7 @@ static int ahci_softreset(struct ata_port *ap, unsigned int *class)
736 } 755 }
737 756
738 /* check BUSY/DRQ, perform Command List Override if necessary */ 757 /* check BUSY/DRQ, perform Command List Override if necessary */
739 ahci_tf_read(ap, &tf); 758 if (ahci_check_status(ap) & (ATA_BUSY | ATA_DRQ)) {
740 if (tf.command & (ATA_BUSY | ATA_DRQ)) {
741 rc = ahci_clo(ap); 759 rc = ahci_clo(ap);
742 760
743 if (rc == -EOPNOTSUPP) { 761 if (rc == -EOPNOTSUPP) {
@@ -1041,7 +1059,7 @@ static void ahci_host_intr(struct ata_port *ap)
1041 /* hmmm... a spurious interupt */ 1059 /* hmmm... a spurious interupt */
1042 1060
1043 /* some devices send D2H reg with I bit set during NCQ command phase */ 1061 /* some devices send D2H reg with I bit set during NCQ command phase */
1044 if (ap->sactive && status & PORT_IRQ_D2H_REG_FIS) 1062 if (ap->sactive && (status & PORT_IRQ_D2H_REG_FIS))
1045 return; 1063 return;
1046 1064
1047 /* ignore interim PIO setup fis interrupts */ 1065 /* ignore interim PIO setup fis interrupts */
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 5719704eb0ee..720174d628fa 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -126,8 +126,7 @@ enum {
126 ich6_sata = 7, 126 ich6_sata = 7,
127 ich6_sata_ahci = 8, 127 ich6_sata_ahci = 8,
128 ich6m_sata_ahci = 9, 128 ich6m_sata_ahci = 9,
129 ich7m_sata_ahci = 10, 129 ich8_sata_ahci = 10,
130 ich8_sata_ahci = 11,
131 130
132 /* constants for mapping table */ 131 /* constants for mapping table */
133 P0 = 0, /* port 0 */ 132 P0 = 0, /* port 0 */
@@ -227,7 +226,7 @@ static const struct pci_device_id piix_pci_tbl[] = {
227 /* 82801GB/GR/GH (ICH7, identical to ICH6) */ 226 /* 82801GB/GR/GH (ICH7, identical to ICH6) */
228 { 0x8086, 0x27c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, 227 { 0x8086, 0x27c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci },
229 /* 2801GBM/GHM (ICH7M, identical to ICH6M) */ 228 /* 2801GBM/GHM (ICH7M, identical to ICH6M) */
230 { 0x8086, 0x27c4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich7m_sata_ahci }, 229 { 0x8086, 0x27c4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6m_sata_ahci },
231 /* Enterprise Southbridge 2 (where's the datasheet?) */ 230 /* Enterprise Southbridge 2 (where's the datasheet?) */
232 { 0x8086, 0x2680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, 231 { 0x8086, 0x2680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci },
233 /* SATA Controller 1 IDE (ICH8, no datasheet yet) */ 232 /* SATA Controller 1 IDE (ICH8, no datasheet yet) */
@@ -399,23 +398,10 @@ static const struct piix_map_db ich6m_map_db = {
399 .mask = 0x3, 398 .mask = 0x3,
400 .port_enable = 0x5, 399 .port_enable = 0x5,
401 .present_shift = 4, 400 .present_shift = 4,
402 .map = {
403 /* PM PS SM SS MAP */
404 { P0, P2, RV, RV }, /* 00b */
405 { RV, RV, RV, RV },
406 { P0, P2, IDE, IDE }, /* 10b */
407 { RV, RV, RV, RV },
408 },
409};
410
411static const struct piix_map_db ich7m_map_db = {
412 .mask = 0x3,
413 .port_enable = 0x5,
414 .present_shift = 4,
415 401
416 /* Map 01b isn't specified in the doc but some notebooks use 402 /* Map 01b isn't specified in the doc but some notebooks use
417 * it anyway. ATM, the only case spotted carries subsystem ID 403 * it anyway. MAP 01b have been spotted on both ICH6M and
418 * 1025:0107. This is the only difference from ich6m. 404 * ICH7M.
419 */ 405 */
420 .map = { 406 .map = {
421 /* PM PS SM SS MAP */ 407 /* PM PS SM SS MAP */
@@ -432,9 +418,9 @@ static const struct piix_map_db ich8_map_db = {
432 .present_shift = 8, 418 .present_shift = 8,
433 .map = { 419 .map = {
434 /* PM PS SM SS MAP */ 420 /* PM PS SM SS MAP */
435 { P0, NA, P1, NA }, /* 00b (hardwired) */ 421 { P0, P2, P1, P3 }, /* 00b (hardwired when in AHCI) */
436 { RV, RV, RV, RV }, 422 { RV, RV, RV, RV },
437 { RV, RV, RV, RV }, /* 10b (never) */ 423 { IDE, IDE, NA, NA }, /* 10b (IDE mode) */
438 { RV, RV, RV, RV }, 424 { RV, RV, RV, RV },
439 }, 425 },
440}; 426};
@@ -445,7 +431,6 @@ static const struct piix_map_db *piix_map_db_table[] = {
445 [ich6_sata] = &ich6_map_db, 431 [ich6_sata] = &ich6_map_db,
446 [ich6_sata_ahci] = &ich6_map_db, 432 [ich6_sata_ahci] = &ich6_map_db,
447 [ich6m_sata_ahci] = &ich6m_map_db, 433 [ich6m_sata_ahci] = &ich6m_map_db,
448 [ich7m_sata_ahci] = &ich7m_map_db,
449 [ich8_sata_ahci] = &ich8_map_db, 434 [ich8_sata_ahci] = &ich8_map_db,
450}; 435};
451 436
@@ -556,19 +541,7 @@ static struct ata_port_info piix_port_info[] = {
556 .port_ops = &piix_sata_ops, 541 .port_ops = &piix_sata_ops,
557 }, 542 },
558 543
559 /* ich7m_sata_ahci: 10 */ 544 /* ich8_sata_ahci: 10 */
560 {
561 .sht = &piix_sht,
562 .flags = ATA_FLAG_SATA |
563 PIIX_FLAG_CHECKINTR | PIIX_FLAG_SCR |
564 PIIX_FLAG_AHCI,
565 .pio_mask = 0x1f, /* pio0-4 */
566 .mwdma_mask = 0x07, /* mwdma0-2 */
567 .udma_mask = 0x7f, /* udma0-6 */
568 .port_ops = &piix_sata_ops,
569 },
570
571 /* ich8_sata_ahci: 11 */
572 { 545 {
573 .sht = &piix_sht, 546 .sht = &piix_sht,
574 .flags = ATA_FLAG_SATA | 547 .flags = ATA_FLAG_SATA |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 83728a9457ad..915a55a6cc14 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5957,7 +5957,7 @@ static void __exit ata_exit(void)
5957 destroy_workqueue(ata_aux_wq); 5957 destroy_workqueue(ata_aux_wq);
5958} 5958}
5959 5959
5960module_init(ata_init); 5960subsys_initcall(ata_init);
5961module_exit(ata_exit); 5961module_exit(ata_exit);
5962 5962
5963static unsigned long ratelimit_time; 5963static unsigned long ratelimit_time;
@@ -6122,7 +6122,6 @@ EXPORT_SYMBOL_GPL(ata_std_prereset);
6122EXPORT_SYMBOL_GPL(ata_std_softreset); 6122EXPORT_SYMBOL_GPL(ata_std_softreset);
6123EXPORT_SYMBOL_GPL(sata_std_hardreset); 6123EXPORT_SYMBOL_GPL(sata_std_hardreset);
6124EXPORT_SYMBOL_GPL(ata_std_postreset); 6124EXPORT_SYMBOL_GPL(ata_std_postreset);
6125EXPORT_SYMBOL_GPL(ata_dev_revalidate);
6126EXPORT_SYMBOL_GPL(ata_dev_classify); 6125EXPORT_SYMBOL_GPL(ata_dev_classify);
6127EXPORT_SYMBOL_GPL(ata_dev_pair); 6126EXPORT_SYMBOL_GPL(ata_dev_pair);
6128EXPORT_SYMBOL_GPL(ata_port_disable); 6127EXPORT_SYMBOL_GPL(ata_port_disable);
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 7af2a4ba4990..47ea111d5ace 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1451,6 +1451,7 @@ nothing_to_do:
1451 1451
1452static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) 1452static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
1453{ 1453{
1454 struct ata_port *ap = qc->ap;
1454 struct scsi_cmnd *cmd = qc->scsicmd; 1455 struct scsi_cmnd *cmd = qc->scsicmd;
1455 u8 *cdb = cmd->cmnd; 1456 u8 *cdb = cmd->cmnd;
1456 int need_sense = (qc->err_mask != 0); 1457 int need_sense = (qc->err_mask != 0);
@@ -1459,11 +1460,12 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
1459 * schedule EH_REVALIDATE operation to update the IDENTIFY DEVICE 1460 * schedule EH_REVALIDATE operation to update the IDENTIFY DEVICE
1460 * cache 1461 * cache
1461 */ 1462 */
1462 if (!need_sense && (qc->tf.command == ATA_CMD_SET_FEATURES) && 1463 if (ap->ops->error_handler &&
1464 !need_sense && (qc->tf.command == ATA_CMD_SET_FEATURES) &&
1463 ((qc->tf.feature == SETFEATURES_WC_ON) || 1465 ((qc->tf.feature == SETFEATURES_WC_ON) ||
1464 (qc->tf.feature == SETFEATURES_WC_OFF))) { 1466 (qc->tf.feature == SETFEATURES_WC_OFF))) {
1465 qc->ap->eh_info.action |= ATA_EH_REVALIDATE; 1467 ap->eh_info.action |= ATA_EH_REVALIDATE;
1466 ata_port_schedule_eh(qc->ap); 1468 ata_port_schedule_eh(ap);
1467 } 1469 }
1468 1470
1469 /* For ATA pass thru (SAT) commands, generate a sense block if 1471 /* For ATA pass thru (SAT) commands, generate a sense block if
@@ -1490,8 +1492,8 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
1490 } 1492 }
1491 } 1493 }
1492 1494
1493 if (need_sense && !qc->ap->ops->error_handler) 1495 if (need_sense && !ap->ops->error_handler)
1494 ata_dump_status(qc->ap->id, &qc->result_tf); 1496 ata_dump_status(ap->id, &qc->result_tf);
1495 1497
1496 qc->scsidone(cmd); 1498 qc->scsidone(cmd);
1497 1499
@@ -1612,9 +1614,9 @@ early_finish:
1612 1614
1613err_did: 1615err_did:
1614 ata_qc_free(qc); 1616 ata_qc_free(qc);
1615err_mem:
1616 cmd->result = (DID_ERROR << 16); 1617 cmd->result = (DID_ERROR << 16);
1617 done(cmd); 1618 done(cmd);
1619err_mem:
1618 DPRINTK("EXIT - internal\n"); 1620 DPRINTK("EXIT - internal\n");
1619 return 0; 1621 return 0;
1620 1622
@@ -3345,20 +3347,23 @@ EXPORT_SYMBOL_GPL(ata_sas_slave_configure);
3345 * @ap: ATA port to which the command is being sent 3347 * @ap: ATA port to which the command is being sent
3346 * 3348 *
3347 * RETURNS: 3349 * RETURNS:
3348 * Zero. 3350 * Return value from __ata_scsi_queuecmd() if @cmd can be queued,
3351 * 0 otherwise.
3349 */ 3352 */
3350 3353
3351int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), 3354int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *),
3352 struct ata_port *ap) 3355 struct ata_port *ap)
3353{ 3356{
3357 int rc = 0;
3358
3354 ata_scsi_dump_cdb(ap, cmd); 3359 ata_scsi_dump_cdb(ap, cmd);
3355 3360
3356 if (likely(ata_scsi_dev_enabled(ap->device))) 3361 if (likely(ata_scsi_dev_enabled(ap->device)))
3357 __ata_scsi_queuecmd(cmd, done, ap->device); 3362 rc = __ata_scsi_queuecmd(cmd, done, ap->device);
3358 else { 3363 else {
3359 cmd->result = (DID_BAD_TARGET << 16); 3364 cmd->result = (DID_BAD_TARGET << 16);
3360 done(cmd); 3365 done(cmd);
3361 } 3366 }
3362 return 0; 3367 return rc;
3363} 3368}
3364EXPORT_SYMBOL_GPL(ata_sas_queuecmd); 3369EXPORT_SYMBOL_GPL(ata_sas_queuecmd);
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 06daaa3736a2..7645f2b30ccf 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -981,6 +981,15 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
981 mask = (1 << 2) | (1 << 0); 981 mask = (1 << 2) | (1 << 0);
982 if ((tmp8 & mask) != mask) 982 if ((tmp8 & mask) != mask)
983 legacy_mode = (1 << 3); 983 legacy_mode = (1 << 3);
984#if defined(CONFIG_NO_ATA_LEGACY)
985 /* Some platforms with PCI limits cannot address compat
986 port space. In that case we punt if their firmware has
987 left a device in compatibility mode */
988 if (legacy_mode) {
989 printk(KERN_ERR "ata: Compatibility mode ATA is not supported on this platform, skipping.\n");
990 return -EOPNOTSUPP;
991 }
992#endif
984 } 993 }
985 994
986 rc = pci_request_regions(pdev, DRV_NAME); 995 rc = pci_request_regions(pdev, DRV_NAME);
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index a5ecb71390a9..0ed263be652a 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -53,6 +53,7 @@ extern unsigned ata_exec_internal(struct ata_device *dev,
53extern unsigned int ata_do_simple_cmd(struct ata_device *dev, u8 cmd); 53extern unsigned int ata_do_simple_cmd(struct ata_device *dev, u8 cmd);
54extern int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, 54extern int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
55 int post_reset, u16 *id); 55 int post_reset, u16 *id);
56extern int ata_dev_revalidate(struct ata_device *dev, int post_reset);
56extern int ata_dev_configure(struct ata_device *dev, int print_info); 57extern int ata_dev_configure(struct ata_device *dev, int print_info);
57extern int sata_down_spd_limit(struct ata_port *ap); 58extern int sata_down_spd_limit(struct ata_port *ap);
58extern int sata_set_spd_needed(struct ata_port *ap); 59extern int sata_set_spd_needed(struct ata_port *ap);
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c
index 29234c897118..5c47a9e0e0ca 100644
--- a/drivers/ata/pata_amd.c
+++ b/drivers/ata/pata_amd.c
@@ -677,6 +677,8 @@ static const struct pci_device_id amd[] = {
677 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE), 8 }, 677 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE), 8 },
678 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE), 8 }, 678 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE), 8 },
679 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE), 8 }, 679 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE), 8 },
680 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE), 8 },
681 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE), 8 },
680 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CS5536_IDE), 9 }, 682 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CS5536_IDE), 9 },
681 683
682 { }, 684 { },
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c
index 690828eb5226..96a098020a8f 100644
--- a/drivers/ata/pata_artop.c
+++ b/drivers/ata/pata_artop.c
@@ -92,7 +92,7 @@ static int artop6260_pre_reset(struct ata_port *ap)
92 return -ENOENT; 92 return -ENOENT;
93 93
94 pci_read_config_byte(pdev, 0x49, &tmp); 94 pci_read_config_byte(pdev, 0x49, &tmp);
95 if (tmp & (1 >> ap->port_no)) 95 if (tmp & (1 << ap->port_no))
96 ap->cbl = ATA_CBL_PATA40; 96 ap->cbl = ATA_CBL_PATA40;
97 else 97 else
98 ap->cbl = ATA_CBL_PATA80; 98 ap->cbl = ATA_CBL_PATA80;
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
index 7350443948c1..fce3fcdc7e79 100644
--- a/drivers/ata/pata_hpt37x.c
+++ b/drivers/ata/pata_hpt37x.c
@@ -25,7 +25,7 @@
25#include <linux/libata.h> 25#include <linux/libata.h>
26 26
27#define DRV_NAME "pata_hpt37x" 27#define DRV_NAME "pata_hpt37x"
28#define DRV_VERSION "0.5" 28#define DRV_VERSION "0.5.1"
29 29
30struct hpt_clock { 30struct hpt_clock {
31 u8 xfer_speed; 31 u8 xfer_speed;
@@ -453,7 +453,13 @@ static int hpt37x_pre_reset(struct ata_port *ap)
453{ 453{
454 u8 scr2, ata66; 454 u8 scr2, ata66;
455 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 455 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
456 456 static const struct pci_bits hpt37x_enable_bits[] = {
457 { 0x50, 1, 0x04, 0x04 },
458 { 0x54, 1, 0x04, 0x04 }
459 };
460 if (!pci_test_config_bits(pdev, &hpt37x_enable_bits[ap->port_no]))
461 return -ENOENT;
462
457 pci_read_config_byte(pdev, 0x5B, &scr2); 463 pci_read_config_byte(pdev, 0x5B, &scr2);
458 pci_write_config_byte(pdev, 0x5B, scr2 & ~0x01); 464 pci_write_config_byte(pdev, 0x5B, scr2 & ~0x01);
459 /* Cable register now active */ 465 /* Cable register now active */
@@ -488,10 +494,17 @@ static void hpt37x_error_handler(struct ata_port *ap)
488 494
489static int hpt374_pre_reset(struct ata_port *ap) 495static int hpt374_pre_reset(struct ata_port *ap)
490{ 496{
497 static const struct pci_bits hpt37x_enable_bits[] = {
498 { 0x50, 1, 0x04, 0x04 },
499 { 0x54, 1, 0x04, 0x04 }
500 };
491 u16 mcr3, mcr6; 501 u16 mcr3, mcr6;
492 u8 ata66; 502 u8 ata66;
493
494 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 503 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
504
505 if (!pci_test_config_bits(pdev, &hpt37x_enable_bits[ap->port_no]))
506 return -ENOENT;
507
495 /* Do the extra channel work */ 508 /* Do the extra channel work */
496 pci_read_config_word(pdev, 0x52, &mcr3); 509 pci_read_config_word(pdev, 0x52, &mcr3);
497 pci_read_config_word(pdev, 0x56, &mcr6); 510 pci_read_config_word(pdev, 0x56, &mcr6);
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 323b60710806..d65ebfd7c7b2 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -117,10 +117,14 @@ static const struct pci_device_id nv_pci_tbl[] = {
117 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA), GENERIC }, 117 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA), GENERIC },
118 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2), GENERIC }, 118 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2), GENERIC },
119 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3), GENERIC }, 119 { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3), GENERIC },
120 { PCI_VDEVICE(NVIDIA, 0x045c), GENERIC }, 120 { PCI_VDEVICE(NVIDIA, 0x045c), GENERIC }, /* MCP65 */
121 { PCI_VDEVICE(NVIDIA, 0x045d), GENERIC }, 121 { PCI_VDEVICE(NVIDIA, 0x045d), GENERIC }, /* MCP65 */
122 { PCI_VDEVICE(NVIDIA, 0x045e), GENERIC }, 122 { PCI_VDEVICE(NVIDIA, 0x045e), GENERIC }, /* MCP65 */
123 { PCI_VDEVICE(NVIDIA, 0x045f), GENERIC }, 123 { PCI_VDEVICE(NVIDIA, 0x045f), GENERIC }, /* MCP65 */
124 { PCI_VDEVICE(NVIDIA, 0x0550), GENERIC }, /* MCP67 */
125 { PCI_VDEVICE(NVIDIA, 0x0551), GENERIC }, /* MCP67 */
126 { PCI_VDEVICE(NVIDIA, 0x0552), GENERIC }, /* MCP67 */
127 { PCI_VDEVICE(NVIDIA, 0x0553), GENERIC }, /* MCP67 */
124 { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, 128 { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
125 PCI_ANY_ID, PCI_ANY_ID, 129 PCI_ANY_ID, PCI_ANY_ID,
126 PCI_CLASS_STORAGE_IDE<<8, 0xffff00, GENERIC }, 130 PCI_CLASS_STORAGE_IDE<<8, 0xffff00, GENERIC },
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c
index 0738f52463a9..9d1235ba06b1 100644
--- a/drivers/ata/sata_sis.c
+++ b/drivers/ata/sata_sis.c
@@ -240,7 +240,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
240 struct ata_probe_ent *probe_ent = NULL; 240 struct ata_probe_ent *probe_ent = NULL;
241 int rc; 241 int rc;
242 u32 genctl; 242 u32 genctl;
243 struct ata_port_info *ppi[2]; 243 struct ata_port_info pi = sis_port_info, *ppi[2] = { &pi, &pi };
244 int pci_dev_busy = 0; 244 int pci_dev_busy = 0;
245 u8 pmr; 245 u8 pmr;
246 u8 port2_start; 246 u8 port2_start;
@@ -265,27 +265,20 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
265 if (rc) 265 if (rc)
266 goto err_out_regions; 266 goto err_out_regions;
267 267
268 ppi[0] = ppi[1] = &sis_port_info;
269 probe_ent = ata_pci_init_native_mode(pdev, ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY);
270 if (!probe_ent) {
271 rc = -ENOMEM;
272 goto err_out_regions;
273 }
274
275 /* check and see if the SCRs are in IO space or PCI cfg space */ 268 /* check and see if the SCRs are in IO space or PCI cfg space */
276 pci_read_config_dword(pdev, SIS_GENCTL, &genctl); 269 pci_read_config_dword(pdev, SIS_GENCTL, &genctl);
277 if ((genctl & GENCTL_IOMAPPED_SCR) == 0) 270 if ((genctl & GENCTL_IOMAPPED_SCR) == 0)
278 probe_ent->port_flags |= SIS_FLAG_CFGSCR; 271 pi.flags |= SIS_FLAG_CFGSCR;
279 272
280 /* if hardware thinks SCRs are in IO space, but there are 273 /* if hardware thinks SCRs are in IO space, but there are
281 * no IO resources assigned, change to PCI cfg space. 274 * no IO resources assigned, change to PCI cfg space.
282 */ 275 */
283 if ((!(probe_ent->port_flags & SIS_FLAG_CFGSCR)) && 276 if ((!(pi.flags & SIS_FLAG_CFGSCR)) &&
284 ((pci_resource_start(pdev, SIS_SCR_PCI_BAR) == 0) || 277 ((pci_resource_start(pdev, SIS_SCR_PCI_BAR) == 0) ||
285 (pci_resource_len(pdev, SIS_SCR_PCI_BAR) < 128))) { 278 (pci_resource_len(pdev, SIS_SCR_PCI_BAR) < 128))) {
286 genctl &= ~GENCTL_IOMAPPED_SCR; 279 genctl &= ~GENCTL_IOMAPPED_SCR;
287 pci_write_config_dword(pdev, SIS_GENCTL, genctl); 280 pci_write_config_dword(pdev, SIS_GENCTL, genctl);
288 probe_ent->port_flags |= SIS_FLAG_CFGSCR; 281 pi.flags |= SIS_FLAG_CFGSCR;
289 } 282 }
290 283
291 pci_read_config_byte(pdev, SIS_PMR, &pmr); 284 pci_read_config_byte(pdev, SIS_PMR, &pmr);
@@ -306,6 +299,12 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
306 port2_start = 0x20; 299 port2_start = 0x20;
307 } 300 }
308 301
302 probe_ent = ata_pci_init_native_mode(pdev, ppi, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY);
303 if (!probe_ent) {
304 rc = -ENOMEM;
305 goto err_out_regions;
306 }
307
309 if (!(probe_ent->port_flags & SIS_FLAG_CFGSCR)) { 308 if (!(probe_ent->port_flags & SIS_FLAG_CFGSCR)) {
310 probe_ent->port[0].scr_addr = 309 probe_ent->port[0].scr_addr =
311 pci_resource_start(pdev, SIS_SCR_PCI_BAR); 310 pci_resource_start(pdev, SIS_SCR_PCI_BAR);
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index f4455a1efe2d..1c7f19aecc25 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -230,7 +230,7 @@ static int vt6420_prereset(struct ata_port *ap)
230 int online; 230 int online;
231 231
232 /* don't do any SCR stuff if we're not loading */ 232 /* don't do any SCR stuff if we're not loading */
233 if (!ATA_PFLAG_LOADING) 233 if (!(ap->pflags & ATA_PFLAG_LOADING))
234 goto skip_scr; 234 goto skip_scr;
235 235
236 /* Resume phy. This is the old resume sequence from 236 /* Resume phy. This is the old resume sequence from