diff options
-rw-r--r-- | drivers/scsi/ahci.c | 100 | ||||
-rw-r--r-- | drivers/scsi/libata-core.c | 35 | ||||
-rw-r--r-- | drivers/scsi/sata_promise.c | 26 | ||||
-rw-r--r-- | drivers/scsi/sata_svw.c | 27 | ||||
-rw-r--r-- | include/linux/ata.h | 1 | ||||
-rw-r--r-- | include/linux/libata.h | 1 |
6 files changed, 152 insertions, 38 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index fc5263c6b102..9a547ca9c864 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <asm/io.h> | 39 | #include <asm/io.h> |
40 | 40 | ||
41 | #define DRV_NAME "ahci" | 41 | #define DRV_NAME "ahci" |
42 | #define DRV_VERSION "1.00" | 42 | #define DRV_VERSION "1.01" |
43 | 43 | ||
44 | 44 | ||
45 | enum { | 45 | enum { |
@@ -50,6 +50,7 @@ enum { | |||
50 | AHCI_CMD_SLOT_SZ = 32 * 32, | 50 | AHCI_CMD_SLOT_SZ = 32 * 32, |
51 | AHCI_RX_FIS_SZ = 256, | 51 | AHCI_RX_FIS_SZ = 256, |
52 | AHCI_CMD_TBL_HDR = 0x80, | 52 | AHCI_CMD_TBL_HDR = 0x80, |
53 | AHCI_CMD_TBL_CDB = 0x40, | ||
53 | AHCI_CMD_TBL_SZ = AHCI_CMD_TBL_HDR + (AHCI_MAX_SG * 16), | 54 | AHCI_CMD_TBL_SZ = AHCI_CMD_TBL_HDR + (AHCI_MAX_SG * 16), |
54 | AHCI_PORT_PRIV_DMA_SZ = AHCI_CMD_SLOT_SZ + AHCI_CMD_TBL_SZ + | 55 | AHCI_PORT_PRIV_DMA_SZ = AHCI_CMD_SLOT_SZ + AHCI_CMD_TBL_SZ + |
55 | AHCI_RX_FIS_SZ, | 56 | AHCI_RX_FIS_SZ, |
@@ -134,6 +135,9 @@ enum { | |||
134 | PORT_CMD_ICC_ACTIVE = (0x1 << 28), /* Put i/f in active state */ | 135 | PORT_CMD_ICC_ACTIVE = (0x1 << 28), /* Put i/f in active state */ |
135 | PORT_CMD_ICC_PARTIAL = (0x2 << 28), /* Put i/f in partial state */ | 136 | PORT_CMD_ICC_PARTIAL = (0x2 << 28), /* Put i/f in partial state */ |
136 | PORT_CMD_ICC_SLUMBER = (0x6 << 28), /* Put i/f in slumber state */ | 137 | PORT_CMD_ICC_SLUMBER = (0x6 << 28), /* Put i/f in slumber state */ |
138 | |||
139 | /* hpriv->flags bits */ | ||
140 | AHCI_FLAG_MSI = (1 << 0), | ||
137 | }; | 141 | }; |
138 | 142 | ||
139 | struct ahci_cmd_hdr { | 143 | struct ahci_cmd_hdr { |
@@ -183,6 +187,7 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc); | |||
183 | static u8 ahci_check_status(struct ata_port *ap); | 187 | static u8 ahci_check_status(struct ata_port *ap); |
184 | static u8 ahci_check_err(struct ata_port *ap); | 188 | static u8 ahci_check_err(struct ata_port *ap); |
185 | static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); | 189 | static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); |
190 | static void ahci_remove_one (struct pci_dev *pdev); | ||
186 | 191 | ||
187 | static Scsi_Host_Template ahci_sht = { | 192 | static Scsi_Host_Template ahci_sht = { |
188 | .module = THIS_MODULE, | 193 | .module = THIS_MODULE, |
@@ -272,7 +277,7 @@ static struct pci_driver ahci_pci_driver = { | |||
272 | .name = DRV_NAME, | 277 | .name = DRV_NAME, |
273 | .id_table = ahci_pci_tbl, | 278 | .id_table = ahci_pci_tbl, |
274 | .probe = ahci_init_one, | 279 | .probe = ahci_init_one, |
275 | .remove = ata_pci_remove_one, | 280 | .remove = ahci_remove_one, |
276 | }; | 281 | }; |
277 | 282 | ||
278 | 283 | ||
@@ -506,7 +511,8 @@ static void ahci_fill_sg(struct ata_queued_cmd *qc) | |||
506 | 511 | ||
507 | static void ahci_qc_prep(struct ata_queued_cmd *qc) | 512 | static void ahci_qc_prep(struct ata_queued_cmd *qc) |
508 | { | 513 | { |
509 | struct ahci_port_priv *pp = qc->ap->private_data; | 514 | struct ata_port *ap = qc->ap; |
515 | struct ahci_port_priv *pp = ap->private_data; | ||
510 | u32 opts; | 516 | u32 opts; |
511 | const u32 cmd_fis_len = 5; /* five dwords */ | 517 | const u32 cmd_fis_len = 5; /* five dwords */ |
512 | 518 | ||
@@ -518,18 +524,8 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc) | |||
518 | opts = (qc->n_elem << 16) | cmd_fis_len; | 524 | opts = (qc->n_elem << 16) | cmd_fis_len; |
519 | if (qc->tf.flags & ATA_TFLAG_WRITE) | 525 | if (qc->tf.flags & ATA_TFLAG_WRITE) |
520 | opts |= AHCI_CMD_WRITE; | 526 | opts |= AHCI_CMD_WRITE; |
521 | 527 | if (is_atapi_taskfile(&qc->tf)) | |
522 | switch (qc->tf.protocol) { | ||
523 | case ATA_PROT_ATAPI: | ||
524 | case ATA_PROT_ATAPI_NODATA: | ||
525 | case ATA_PROT_ATAPI_DMA: | ||
526 | opts |= AHCI_CMD_ATAPI; | 528 | opts |= AHCI_CMD_ATAPI; |
527 | break; | ||
528 | |||
529 | default: | ||
530 | /* do nothing */ | ||
531 | break; | ||
532 | } | ||
533 | 529 | ||
534 | pp->cmd_slot[0].opts = cpu_to_le32(opts); | 530 | pp->cmd_slot[0].opts = cpu_to_le32(opts); |
535 | pp->cmd_slot[0].status = 0; | 531 | pp->cmd_slot[0].status = 0; |
@@ -541,6 +537,10 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc) | |||
541 | * a SATA Register - Host to Device command FIS. | 537 | * a SATA Register - Host to Device command FIS. |
542 | */ | 538 | */ |
543 | ata_tf_to_fis(&qc->tf, pp->cmd_tbl, 0); | 539 | ata_tf_to_fis(&qc->tf, pp->cmd_tbl, 0); |
540 | if (opts & AHCI_CMD_ATAPI) { | ||
541 | memset(pp->cmd_tbl + AHCI_CMD_TBL_CDB, 0, 32); | ||
542 | memcpy(pp->cmd_tbl + AHCI_CMD_TBL_CDB, qc->cdb, ap->cdb_len); | ||
543 | } | ||
544 | 544 | ||
545 | if (!(qc->flags & ATA_QCFLAG_DMAMAP)) | 545 | if (!(qc->flags & ATA_QCFLAG_DMAMAP)) |
546 | return; | 546 | return; |
@@ -795,8 +795,6 @@ static int ahci_host_init(struct ata_probe_ent *probe_ent) | |||
795 | return rc; | 795 | return rc; |
796 | } | 796 | } |
797 | } | 797 | } |
798 | |||
799 | hpriv->flags |= HOST_CAP_64; | ||
800 | } else { | 798 | } else { |
801 | rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); | 799 | rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); |
802 | if (rc) { | 800 | if (rc) { |
@@ -879,15 +877,19 @@ static int ahci_host_init(struct ata_probe_ent *probe_ent) | |||
879 | } | 877 | } |
880 | 878 | ||
881 | /* move to PCI layer, integrate w/ MSI stuff */ | 879 | /* move to PCI layer, integrate w/ MSI stuff */ |
882 | static void pci_enable_intx(struct pci_dev *pdev) | 880 | static void pci_intx(struct pci_dev *pdev, int enable) |
883 | { | 881 | { |
884 | u16 pci_command; | 882 | u16 pci_command, new; |
885 | 883 | ||
886 | pci_read_config_word(pdev, PCI_COMMAND, &pci_command); | 884 | pci_read_config_word(pdev, PCI_COMMAND, &pci_command); |
887 | if (pci_command & PCI_COMMAND_INTX_DISABLE) { | 885 | |
888 | pci_command &= ~PCI_COMMAND_INTX_DISABLE; | 886 | if (enable) |
887 | new = pci_command & ~PCI_COMMAND_INTX_DISABLE; | ||
888 | else | ||
889 | new = pci_command | PCI_COMMAND_INTX_DISABLE; | ||
890 | |||
891 | if (new != pci_command) | ||
889 | pci_write_config_word(pdev, PCI_COMMAND, pci_command); | 892 | pci_write_config_word(pdev, PCI_COMMAND, pci_command); |
890 | } | ||
891 | } | 893 | } |
892 | 894 | ||
893 | static void ahci_print_info(struct ata_probe_ent *probe_ent) | 895 | static void ahci_print_info(struct ata_probe_ent *probe_ent) |
@@ -969,7 +971,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
969 | unsigned long base; | 971 | unsigned long base; |
970 | void *mmio_base; | 972 | void *mmio_base; |
971 | unsigned int board_idx = (unsigned int) ent->driver_data; | 973 | unsigned int board_idx = (unsigned int) ent->driver_data; |
972 | int pci_dev_busy = 0; | 974 | int have_msi, pci_dev_busy = 0; |
973 | int rc; | 975 | int rc; |
974 | 976 | ||
975 | VPRINTK("ENTER\n"); | 977 | VPRINTK("ENTER\n"); |
@@ -987,12 +989,17 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
987 | goto err_out; | 989 | goto err_out; |
988 | } | 990 | } |
989 | 991 | ||
990 | pci_enable_intx(pdev); | 992 | if (pci_enable_msi(pdev) == 0) |
993 | have_msi = 1; | ||
994 | else { | ||
995 | pci_intx(pdev, 1); | ||
996 | have_msi = 0; | ||
997 | } | ||
991 | 998 | ||
992 | probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); | 999 | probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL); |
993 | if (probe_ent == NULL) { | 1000 | if (probe_ent == NULL) { |
994 | rc = -ENOMEM; | 1001 | rc = -ENOMEM; |
995 | goto err_out_regions; | 1002 | goto err_out_msi; |
996 | } | 1003 | } |
997 | 1004 | ||
998 | memset(probe_ent, 0, sizeof(*probe_ent)); | 1005 | memset(probe_ent, 0, sizeof(*probe_ent)); |
@@ -1025,6 +1032,9 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1025 | probe_ent->mmio_base = mmio_base; | 1032 | probe_ent->mmio_base = mmio_base; |
1026 | probe_ent->private_data = hpriv; | 1033 | probe_ent->private_data = hpriv; |
1027 | 1034 | ||
1035 | if (have_msi) | ||
1036 | hpriv->flags |= AHCI_FLAG_MSI; | ||
1037 | |||
1028 | /* initialize adapter */ | 1038 | /* initialize adapter */ |
1029 | rc = ahci_host_init(probe_ent); | 1039 | rc = ahci_host_init(probe_ent); |
1030 | if (rc) | 1040 | if (rc) |
@@ -1044,7 +1054,11 @@ err_out_iounmap: | |||
1044 | iounmap(mmio_base); | 1054 | iounmap(mmio_base); |
1045 | err_out_free_ent: | 1055 | err_out_free_ent: |
1046 | kfree(probe_ent); | 1056 | kfree(probe_ent); |
1047 | err_out_regions: | 1057 | err_out_msi: |
1058 | if (have_msi) | ||
1059 | pci_disable_msi(pdev); | ||
1060 | else | ||
1061 | pci_intx(pdev, 0); | ||
1048 | pci_release_regions(pdev); | 1062 | pci_release_regions(pdev); |
1049 | err_out: | 1063 | err_out: |
1050 | if (!pci_dev_busy) | 1064 | if (!pci_dev_busy) |
@@ -1052,6 +1066,42 @@ err_out: | |||
1052 | return rc; | 1066 | return rc; |
1053 | } | 1067 | } |
1054 | 1068 | ||
1069 | static void ahci_remove_one (struct pci_dev *pdev) | ||
1070 | { | ||
1071 | struct device *dev = pci_dev_to_dev(pdev); | ||
1072 | struct ata_host_set *host_set = dev_get_drvdata(dev); | ||
1073 | struct ahci_host_priv *hpriv = host_set->private_data; | ||
1074 | struct ata_port *ap; | ||
1075 | unsigned int i; | ||
1076 | int have_msi; | ||
1077 | |||
1078 | for (i = 0; i < host_set->n_ports; i++) { | ||
1079 | ap = host_set->ports[i]; | ||
1080 | |||
1081 | scsi_remove_host(ap->host); | ||
1082 | } | ||
1083 | |||
1084 | have_msi = hpriv->flags & AHCI_FLAG_MSI; | ||
1085 | free_irq(host_set->irq, host_set); | ||
1086 | |||
1087 | for (i = 0; i < host_set->n_ports; i++) { | ||
1088 | ap = host_set->ports[i]; | ||
1089 | |||
1090 | ata_scsi_release(ap->host); | ||
1091 | scsi_host_put(ap->host); | ||
1092 | } | ||
1093 | |||
1094 | host_set->ops->host_stop(host_set); | ||
1095 | kfree(host_set); | ||
1096 | |||
1097 | if (have_msi) | ||
1098 | pci_disable_msi(pdev); | ||
1099 | else | ||
1100 | pci_intx(pdev, 0); | ||
1101 | pci_release_regions(pdev); | ||
1102 | pci_disable_device(pdev); | ||
1103 | dev_set_drvdata(dev, NULL); | ||
1104 | } | ||
1055 | 1105 | ||
1056 | static int __init ahci_init(void) | 1106 | static int __init ahci_init(void) |
1057 | { | 1107 | { |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 9e58f134f68b..36b401fee1f1 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -1295,6 +1295,37 @@ err_out: | |||
1295 | DPRINTK("EXIT, err\n"); | 1295 | DPRINTK("EXIT, err\n"); |
1296 | } | 1296 | } |
1297 | 1297 | ||
1298 | |||
1299 | static inline u8 ata_dev_knobble(struct ata_port *ap) | ||
1300 | { | ||
1301 | return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(ap->device->id))); | ||
1302 | } | ||
1303 | |||
1304 | /** | ||
1305 | * ata_dev_config - Run device specific handlers and check for | ||
1306 | * SATA->PATA bridges | ||
1307 | * @ap: Bus | ||
1308 | * @i: Device | ||
1309 | * | ||
1310 | * LOCKING: | ||
1311 | */ | ||
1312 | |||
1313 | void ata_dev_config(struct ata_port *ap, unsigned int i) | ||
1314 | { | ||
1315 | /* limit bridge transfers to udma5, 200 sectors */ | ||
1316 | if (ata_dev_knobble(ap)) { | ||
1317 | printk(KERN_INFO "ata%u(%u): applying bridge limits\n", | ||
1318 | ap->id, ap->device->devno); | ||
1319 | ap->udma_mask &= ATA_UDMA5; | ||
1320 | ap->host->max_sectors = ATA_MAX_SECTORS; | ||
1321 | ap->host->hostt->max_sectors = ATA_MAX_SECTORS; | ||
1322 | ap->device->flags |= ATA_DFLAG_LOCK_SECTORS; | ||
1323 | } | ||
1324 | |||
1325 | if (ap->ops->dev_config) | ||
1326 | ap->ops->dev_config(ap, &ap->device[i]); | ||
1327 | } | ||
1328 | |||
1298 | /** | 1329 | /** |
1299 | * ata_bus_probe - Reset and probe ATA bus | 1330 | * ata_bus_probe - Reset and probe ATA bus |
1300 | * @ap: Bus to probe | 1331 | * @ap: Bus to probe |
@@ -1322,8 +1353,7 @@ static int ata_bus_probe(struct ata_port *ap) | |||
1322 | ata_dev_identify(ap, i); | 1353 | ata_dev_identify(ap, i); |
1323 | if (ata_dev_present(&ap->device[i])) { | 1354 | if (ata_dev_present(&ap->device[i])) { |
1324 | found = 1; | 1355 | found = 1; |
1325 | if (ap->ops->dev_config) | 1356 | ata_dev_config(ap,i); |
1326 | ap->ops->dev_config(ap, &ap->device[i]); | ||
1327 | } | 1357 | } |
1328 | } | 1358 | } |
1329 | 1359 | ||
@@ -4406,6 +4436,7 @@ EXPORT_SYMBOL_GPL(ata_scsi_release); | |||
4406 | EXPORT_SYMBOL_GPL(ata_host_intr); | 4436 | EXPORT_SYMBOL_GPL(ata_host_intr); |
4407 | EXPORT_SYMBOL_GPL(ata_dev_classify); | 4437 | EXPORT_SYMBOL_GPL(ata_dev_classify); |
4408 | EXPORT_SYMBOL_GPL(ata_dev_id_string); | 4438 | EXPORT_SYMBOL_GPL(ata_dev_id_string); |
4439 | EXPORT_SYMBOL_GPL(ata_dev_config); | ||
4409 | EXPORT_SYMBOL_GPL(ata_scsi_simulate); | 4440 | EXPORT_SYMBOL_GPL(ata_scsi_simulate); |
4410 | 4441 | ||
4411 | #ifdef CONFIG_PCI | 4442 | #ifdef CONFIG_PCI |
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index b18c90582e67..5c1d4411457a 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c | |||
@@ -59,6 +59,7 @@ enum { | |||
59 | 59 | ||
60 | board_2037x = 0, /* FastTrak S150 TX2plus */ | 60 | board_2037x = 0, /* FastTrak S150 TX2plus */ |
61 | board_20319 = 1, /* FastTrak S150 TX4 */ | 61 | board_20319 = 1, /* FastTrak S150 TX4 */ |
62 | board_20619 = 2, /* FastTrak TX4000 */ | ||
62 | 63 | ||
63 | PDC_HAS_PATA = (1 << 1), /* PDC20375 has PATA */ | 64 | PDC_HAS_PATA = (1 << 1), /* PDC20375 has PATA */ |
64 | 65 | ||
@@ -147,6 +148,17 @@ static struct ata_port_info pdc_port_info[] = { | |||
147 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ | 148 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ |
148 | .port_ops = &pdc_ata_ops, | 149 | .port_ops = &pdc_ata_ops, |
149 | }, | 150 | }, |
151 | |||
152 | /* board_20619 */ | ||
153 | { | ||
154 | .sht = &pdc_ata_sht, | ||
155 | .host_flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_SRST | | ||
156 | ATA_FLAG_MMIO | ATA_FLAG_SLAVE_POSS, | ||
157 | .pio_mask = 0x1f, /* pio0-4 */ | ||
158 | .mwdma_mask = 0x07, /* mwdma0-2 */ | ||
159 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ | ||
160 | .port_ops = &pdc_ata_ops, | ||
161 | }, | ||
150 | }; | 162 | }; |
151 | 163 | ||
152 | static struct pci_device_id pdc_ata_pci_tbl[] = { | 164 | static struct pci_device_id pdc_ata_pci_tbl[] = { |
@@ -172,6 +184,9 @@ static struct pci_device_id pdc_ata_pci_tbl[] = { | |||
172 | { PCI_VENDOR_ID_PROMISE, 0x3d18, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 184 | { PCI_VENDOR_ID_PROMISE, 0x3d18, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
173 | board_20319 }, | 185 | board_20319 }, |
174 | 186 | ||
187 | { PCI_VENDOR_ID_PROMISE, 0x6629, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
188 | board_20619 }, | ||
189 | |||
175 | { } /* terminate list */ | 190 | { } /* terminate list */ |
176 | }; | 191 | }; |
177 | 192 | ||
@@ -636,6 +651,15 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
636 | case board_2037x: | 651 | case board_2037x: |
637 | probe_ent->n_ports = 2; | 652 | probe_ent->n_ports = 2; |
638 | break; | 653 | break; |
654 | case board_20619: | ||
655 | probe_ent->n_ports = 4; | ||
656 | |||
657 | pdc_ata_setup_port(&probe_ent->port[2], base + 0x300); | ||
658 | pdc_ata_setup_port(&probe_ent->port[3], base + 0x380); | ||
659 | |||
660 | probe_ent->port[2].scr_addr = base + 0x600; | ||
661 | probe_ent->port[3].scr_addr = base + 0x700; | ||
662 | break; | ||
639 | default: | 663 | default: |
640 | BUG(); | 664 | BUG(); |
641 | break; | 665 | break; |
@@ -676,7 +700,7 @@ static void __exit pdc_ata_exit(void) | |||
676 | 700 | ||
677 | 701 | ||
678 | MODULE_AUTHOR("Jeff Garzik"); | 702 | MODULE_AUTHOR("Jeff Garzik"); |
679 | MODULE_DESCRIPTION("Promise SATA TX2/TX4 low-level driver"); | 703 | MODULE_DESCRIPTION("Promise ATA TX2/TX4/TX4000 low-level driver"); |
680 | MODULE_LICENSE("GPL"); | 704 | MODULE_LICENSE("GPL"); |
681 | MODULE_DEVICE_TABLE(pci, pdc_ata_pci_tbl); | 705 | MODULE_DEVICE_TABLE(pci, pdc_ata_pci_tbl); |
682 | MODULE_VERSION(DRV_VERSION); | 706 | MODULE_VERSION(DRV_VERSION); |
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c index edef1fa969fc..858e07185dbd 100644 --- a/drivers/scsi/sata_svw.c +++ b/drivers/scsi/sata_svw.c | |||
@@ -49,7 +49,7 @@ | |||
49 | #endif /* CONFIG_PPC_OF */ | 49 | #endif /* CONFIG_PPC_OF */ |
50 | 50 | ||
51 | #define DRV_NAME "sata_svw" | 51 | #define DRV_NAME "sata_svw" |
52 | #define DRV_VERSION "1.05" | 52 | #define DRV_VERSION "1.06" |
53 | 53 | ||
54 | /* Taskfile registers offsets */ | 54 | /* Taskfile registers offsets */ |
55 | #define K2_SATA_TF_CMD_OFFSET 0x00 | 55 | #define K2_SATA_TF_CMD_OFFSET 0x00 |
@@ -344,6 +344,7 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
344 | void *mmio_base; | 344 | void *mmio_base; |
345 | int pci_dev_busy = 0; | 345 | int pci_dev_busy = 0; |
346 | int rc; | 346 | int rc; |
347 | int i; | ||
347 | 348 | ||
348 | if (!printed_version++) | 349 | if (!printed_version++) |
349 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); | 350 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); |
@@ -421,11 +422,11 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
421 | probe_ent->mwdma_mask = 0x7; | 422 | probe_ent->mwdma_mask = 0x7; |
422 | probe_ent->udma_mask = 0x7f; | 423 | probe_ent->udma_mask = 0x7f; |
423 | 424 | ||
424 | /* We have 4 ports per PCI function */ | 425 | /* different controllers have different number of ports - currently 4 or 8 */ |
425 | k2_sata_setup_port(&probe_ent->port[0], base + 0 * K2_SATA_PORT_OFFSET); | 426 | /* All ports are on the same function. Multi-function device is no |
426 | k2_sata_setup_port(&probe_ent->port[1], base + 1 * K2_SATA_PORT_OFFSET); | 427 | * longer available. This should not be seen in any system. */ |
427 | k2_sata_setup_port(&probe_ent->port[2], base + 2 * K2_SATA_PORT_OFFSET); | 428 | for (i = 0; i < ent->driver_data; i++) |
428 | k2_sata_setup_port(&probe_ent->port[3], base + 3 * K2_SATA_PORT_OFFSET); | 429 | k2_sata_setup_port(&probe_ent->port[i], base + i * K2_SATA_PORT_OFFSET); |
429 | 430 | ||
430 | pci_set_master(pdev); | 431 | pci_set_master(pdev); |
431 | 432 | ||
@@ -445,11 +446,17 @@ err_out: | |||
445 | return rc; | 446 | return rc; |
446 | } | 447 | } |
447 | 448 | ||
448 | 449 | /* 0x240 is device ID for Apple K2 device | |
450 | * 0x241 is device ID for Serverworks Frodo4 | ||
451 | * 0x242 is device ID for Serverworks Frodo8 | ||
452 | * 0x24a is device ID for BCM5785 (aka HT1000) HT southbridge integrated SATA | ||
453 | * controller | ||
454 | * */ | ||
449 | static struct pci_device_id k2_sata_pci_tbl[] = { | 455 | static struct pci_device_id k2_sata_pci_tbl[] = { |
450 | { 0x1166, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 456 | { 0x1166, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 }, |
451 | { 0x1166, 0x0241, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 457 | { 0x1166, 0x0241, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 }, |
452 | { 0x1166, 0x0242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 458 | { 0x1166, 0x0242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 }, |
459 | { 0x1166, 0x024a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4 }, | ||
453 | { } | 460 | { } |
454 | }; | 461 | }; |
455 | 462 | ||
diff --git a/include/linux/ata.h b/include/linux/ata.h index f178894edd04..ca5fcadf9981 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -224,6 +224,7 @@ struct ata_taskfile { | |||
224 | }; | 224 | }; |
225 | 225 | ||
226 | #define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) | 226 | #define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) |
227 | #define ata_id_is_sata(id) ((id)[93] == 0) | ||
227 | #define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) | 228 | #define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) |
228 | #define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) | 229 | #define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) |
229 | #define ata_id_has_flush(id) ((id)[83] & (1 << 12)) | 230 | #define ata_id_has_flush(id) ((id)[83] & (1 << 12)) |
diff --git a/include/linux/libata.h b/include/linux/libata.h index b009f801e7c5..6cd9ba63563b 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -421,6 +421,7 @@ extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, | |||
421 | extern unsigned int ata_dev_classify(struct ata_taskfile *tf); | 421 | extern unsigned int ata_dev_classify(struct ata_taskfile *tf); |
422 | extern void ata_dev_id_string(u16 *id, unsigned char *s, | 422 | extern void ata_dev_id_string(u16 *id, unsigned char *s, |
423 | unsigned int ofs, unsigned int len); | 423 | unsigned int ofs, unsigned int len); |
424 | extern void ata_dev_config(struct ata_port *ap, unsigned int i); | ||
424 | extern void ata_bmdma_setup (struct ata_queued_cmd *qc); | 425 | extern void ata_bmdma_setup (struct ata_queued_cmd *qc); |
425 | extern void ata_bmdma_start (struct ata_queued_cmd *qc); | 426 | extern void ata_bmdma_start (struct ata_queued_cmd *qc); |
426 | extern void ata_bmdma_stop(struct ata_port *ap); | 427 | extern void ata_bmdma_stop(struct ata_port *ap); |