aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/Kconfig1
-rw-r--r--drivers/ata/ahci.c13
-rw-r--r--drivers/ata/ata_piix.c41
-rw-r--r--drivers/ata/libata-core.c9
-rw-r--r--drivers/ata/libata-scsi.c48
-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/pata_qdi.c2
-rw-r--r--drivers/ata/sata_nv.c12
-rw-r--r--drivers/ata/sata_promise.c1
-rw-r--r--drivers/ata/sata_sis.c21
-rw-r--r--drivers/ata/sata_via.c2
15 files changed, 114 insertions, 69 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..234197e57e9e 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -334,6 +334,14 @@ static const struct pci_device_id ahci_pci_tbl[] = {
334 { PCI_VDEVICE(NVIDIA, 0x044d), board_ahci }, /* MCP65 */ 334 { PCI_VDEVICE(NVIDIA, 0x044d), board_ahci }, /* MCP65 */
335 { PCI_VDEVICE(NVIDIA, 0x044e), board_ahci }, /* MCP65 */ 335 { PCI_VDEVICE(NVIDIA, 0x044e), board_ahci }, /* MCP65 */
336 { PCI_VDEVICE(NVIDIA, 0x044f), board_ahci }, /* MCP65 */ 336 { PCI_VDEVICE(NVIDIA, 0x044f), board_ahci }, /* MCP65 */
337 { PCI_VDEVICE(NVIDIA, 0x0554), board_ahci }, /* MCP67 */
338 { PCI_VDEVICE(NVIDIA, 0x0555), board_ahci }, /* MCP67 */
339 { PCI_VDEVICE(NVIDIA, 0x0556), board_ahci }, /* MCP67 */
340 { PCI_VDEVICE(NVIDIA, 0x0557), board_ahci }, /* MCP67 */
341 { PCI_VDEVICE(NVIDIA, 0x0558), board_ahci }, /* MCP67 */
342 { PCI_VDEVICE(NVIDIA, 0x0559), board_ahci }, /* MCP67 */
343 { PCI_VDEVICE(NVIDIA, 0x055a), board_ahci }, /* MCP67 */
344 { PCI_VDEVICE(NVIDIA, 0x055b), board_ahci }, /* MCP67 */
337 345
338 /* SiS */ 346 /* SiS */
339 { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */ 347 { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */
@@ -736,8 +744,7 @@ static int ahci_softreset(struct ata_port *ap, unsigned int *class)
736 } 744 }
737 745
738 /* check BUSY/DRQ, perform Command List Override if necessary */ 746 /* check BUSY/DRQ, perform Command List Override if necessary */
739 ahci_tf_read(ap, &tf); 747 if (ahci_check_status(ap) & (ATA_BUSY | ATA_DRQ)) {
740 if (tf.command & (ATA_BUSY | ATA_DRQ)) {
741 rc = ahci_clo(ap); 748 rc = ahci_clo(ap);
742 749
743 if (rc == -EOPNOTSUPP) { 750 if (rc == -EOPNOTSUPP) {
@@ -1041,7 +1048,7 @@ static void ahci_host_intr(struct ata_port *ap)
1041 /* hmmm... a spurious interupt */ 1048 /* hmmm... a spurious interupt */
1042 1049
1043 /* some devices send D2H reg with I bit set during NCQ command phase */ 1050 /* some devices send D2H reg with I bit set during NCQ command phase */
1044 if (ap->sactive && status & PORT_IRQ_D2H_REG_FIS) 1051 if (ap->sactive && (status & PORT_IRQ_D2H_REG_FIS))
1045 return; 1052 return;
1046 1053
1047 /* ignore interim PIO setup fis interrupts */ 1054 /* 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 77138a39eb04..915a55a6cc14 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -870,7 +870,11 @@ static unsigned int ata_id_xfermask(const u16 *id)
870 * the PIO timing number for the maximum. Turn it into 870 * the PIO timing number for the maximum. Turn it into
871 * a mask. 871 * a mask.
872 */ 872 */
873 pio_mask = (2 << (id[ATA_ID_OLD_PIO_MODES] & 0xFF)) - 1 ; 873 u8 mode = id[ATA_ID_OLD_PIO_MODES] & 0xFF;
874 if (mode < 5) /* Valid PIO range */
875 pio_mask = (2 << mode) - 1;
876 else
877 pio_mask = 1;
874 878
875 /* But wait.. there's more. Design your standards by 879 /* But wait.. there's more. Design your standards by
876 * committee and you too can get a free iordy field to 880 * committee and you too can get a free iordy field to
@@ -5953,7 +5957,7 @@ static void __exit ata_exit(void)
5953 destroy_workqueue(ata_aux_wq); 5957 destroy_workqueue(ata_aux_wq);
5954} 5958}
5955 5959
5956module_init(ata_init); 5960subsys_initcall(ata_init);
5957module_exit(ata_exit); 5961module_exit(ata_exit);
5958 5962
5959static unsigned long ratelimit_time; 5963static unsigned long ratelimit_time;
@@ -6118,7 +6122,6 @@ EXPORT_SYMBOL_GPL(ata_std_prereset);
6118EXPORT_SYMBOL_GPL(ata_std_softreset); 6122EXPORT_SYMBOL_GPL(ata_std_softreset);
6119EXPORT_SYMBOL_GPL(sata_std_hardreset); 6123EXPORT_SYMBOL_GPL(sata_std_hardreset);
6120EXPORT_SYMBOL_GPL(ata_std_postreset); 6124EXPORT_SYMBOL_GPL(ata_std_postreset);
6121EXPORT_SYMBOL_GPL(ata_dev_revalidate);
6122EXPORT_SYMBOL_GPL(ata_dev_classify); 6125EXPORT_SYMBOL_GPL(ata_dev_classify);
6123EXPORT_SYMBOL_GPL(ata_dev_pair); 6126EXPORT_SYMBOL_GPL(ata_dev_pair);
6124EXPORT_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 b0d0cc41f3e8..5c1fc467fc7f 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -164,10 +164,10 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)
164{ 164{
165 int rc = 0; 165 int rc = 0;
166 u8 scsi_cmd[MAX_COMMAND_SIZE]; 166 u8 scsi_cmd[MAX_COMMAND_SIZE];
167 u8 args[4], *argbuf = NULL; 167 u8 args[4], *argbuf = NULL, *sensebuf = NULL;
168 int argsize = 0; 168 int argsize = 0;
169 struct scsi_sense_hdr sshdr;
170 enum dma_data_direction data_dir; 169 enum dma_data_direction data_dir;
170 int cmd_result;
171 171
172 if (arg == NULL) 172 if (arg == NULL)
173 return -EINVAL; 173 return -EINVAL;
@@ -175,6 +175,10 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)
175 if (copy_from_user(args, arg, sizeof(args))) 175 if (copy_from_user(args, arg, sizeof(args)))
176 return -EFAULT; 176 return -EFAULT;
177 177
178 sensebuf = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_NOIO);
179 if (!sensebuf)
180 return -ENOMEM;
181
178 memset(scsi_cmd, 0, sizeof(scsi_cmd)); 182 memset(scsi_cmd, 0, sizeof(scsi_cmd));
179 183
180 if (args[3]) { 184 if (args[3]) {
@@ -191,7 +195,7 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)
191 data_dir = DMA_FROM_DEVICE; 195 data_dir = DMA_FROM_DEVICE;
192 } else { 196 } else {
193 scsi_cmd[1] = (3 << 1); /* Non-data */ 197 scsi_cmd[1] = (3 << 1); /* Non-data */
194 /* scsi_cmd[2] is already 0 -- no off.line, cc, or data xfer */ 198 scsi_cmd[2] = 0x20; /* cc but no off.line or data xfer */
195 data_dir = DMA_NONE; 199 data_dir = DMA_NONE;
196 } 200 }
197 201
@@ -210,18 +214,46 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)
210 214
211 /* Good values for timeout and retries? Values below 215 /* Good values for timeout and retries? Values below
212 from scsi_ioctl_send_command() for default case... */ 216 from scsi_ioctl_send_command() for default case... */
213 if (scsi_execute_req(scsidev, scsi_cmd, data_dir, argbuf, argsize, 217 cmd_result = scsi_execute(scsidev, scsi_cmd, data_dir, argbuf, argsize,
214 &sshdr, (10*HZ), 5)) { 218 sensebuf, (10*HZ), 5, 0);
219
220 if (driver_byte(cmd_result) == DRIVER_SENSE) {/* sense data available */
221 u8 *desc = sensebuf + 8;
222 cmd_result &= ~(0xFF<<24); /* DRIVER_SENSE is not an error */
223
224 /* If we set cc then ATA pass-through will cause a
225 * check condition even if no error. Filter that. */
226 if (cmd_result & SAM_STAT_CHECK_CONDITION) {
227 struct scsi_sense_hdr sshdr;
228 scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE,
229 &sshdr);
230 if (sshdr.sense_key==0 &&
231 sshdr.asc==0 && sshdr.ascq==0)
232 cmd_result &= ~SAM_STAT_CHECK_CONDITION;
233 }
234
235 /* Send userspace a few ATA registers (same as drivers/ide) */
236 if (sensebuf[0] == 0x72 && /* format is "descriptor" */
237 desc[0] == 0x09 ) { /* code is "ATA Descriptor" */
238 args[0] = desc[13]; /* status */
239 args[1] = desc[3]; /* error */
240 args[2] = desc[5]; /* sector count (0:7) */
241 if (copy_to_user(arg, args, sizeof(args)))
242 rc = -EFAULT;
243 }
244 }
245
246
247 if (cmd_result) {
215 rc = -EIO; 248 rc = -EIO;
216 goto error; 249 goto error;
217 } 250 }
218 251
219 /* Need code to retrieve data from check condition? */
220
221 if ((argbuf) 252 if ((argbuf)
222 && copy_to_user(arg + sizeof(args), argbuf, argsize)) 253 && copy_to_user(arg + sizeof(args), argbuf, argsize))
223 rc = -EFAULT; 254 rc = -EFAULT;
224error: 255error:
256 kfree(sensebuf);
225 kfree(argbuf); 257 kfree(argbuf);
226 return rc; 258 return rc;
227} 259}
@@ -1580,9 +1612,9 @@ early_finish:
1580 1612
1581err_did: 1613err_did:
1582 ata_qc_free(qc); 1614 ata_qc_free(qc);
1583err_mem:
1584 cmd->result = (DID_ERROR << 16); 1615 cmd->result = (DID_ERROR << 16);
1585 done(cmd); 1616 done(cmd);
1617err_mem:
1586 DPRINTK("EXIT - internal\n"); 1618 DPRINTK("EXIT - internal\n");
1587 return 0; 1619 return 0;
1588 1620
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/pata_qdi.c b/drivers/ata/pata_qdi.c
index 7977f471d5e9..2c3cc0ccc606 100644
--- a/drivers/ata/pata_qdi.c
+++ b/drivers/ata/pata_qdi.c
@@ -141,7 +141,7 @@ static void qdi_data_xfer(struct ata_device *adev, unsigned char *buf, unsigned
141 memcpy(&pad, buf + buflen - slop, slop); 141 memcpy(&pad, buf + buflen - slop, slop);
142 outl(le32_to_cpu(pad), ap->ioaddr.data_addr); 142 outl(le32_to_cpu(pad), ap->ioaddr.data_addr);
143 } else { 143 } else {
144 pad = cpu_to_le16(inl(ap->ioaddr.data_addr)); 144 pad = cpu_to_le32(inl(ap->ioaddr.data_addr));
145 memcpy(buf + buflen - slop, &pad, slop); 145 memcpy(buf + buflen - slop, &pad, slop);
146 } 146 }
147 } 147 }
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_promise.c b/drivers/ata/sata_promise.c
index 8bcdfa64667c..72eda5160fad 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -260,6 +260,7 @@ static const struct pci_device_id pdc_ata_pci_tbl[] = {
260#if 0 260#if 0
261 { PCI_VDEVICE(PROMISE, 0x3570), board_20771 }, 261 { PCI_VDEVICE(PROMISE, 0x3570), board_20771 },
262#endif 262#endif
263 { PCI_VDEVICE(PROMISE, 0x3577), board_20771 },
263 264
264 { } /* terminate list */ 265 { } /* terminate list */
265}; 266};
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