diff options
Diffstat (limited to 'drivers/scsi/sata_mv.c')
-rw-r--r-- | drivers/scsi/sata_mv.c | 71 |
1 files changed, 38 insertions, 33 deletions
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index f16f92a6ec0f..4a71578df3c1 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c | |||
@@ -93,7 +93,7 @@ enum { | |||
93 | MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */ | 93 | MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */ |
94 | MV_COMMON_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 94 | MV_COMMON_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
95 | ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | | 95 | ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | |
96 | ATA_FLAG_NO_ATAPI), | 96 | ATA_FLAG_NO_ATAPI | ATA_FLAG_PIO_POLLING), |
97 | MV_6XXX_FLAGS = MV_FLAG_IRQ_COALESCE, | 97 | MV_6XXX_FLAGS = MV_FLAG_IRQ_COALESCE, |
98 | 98 | ||
99 | CRQB_FLAG_READ = (1 << 0), | 99 | CRQB_FLAG_READ = (1 << 0), |
@@ -272,33 +272,33 @@ enum chip_type { | |||
272 | 272 | ||
273 | /* Command ReQuest Block: 32B */ | 273 | /* Command ReQuest Block: 32B */ |
274 | struct mv_crqb { | 274 | struct mv_crqb { |
275 | u32 sg_addr; | 275 | __le32 sg_addr; |
276 | u32 sg_addr_hi; | 276 | __le32 sg_addr_hi; |
277 | u16 ctrl_flags; | 277 | __le16 ctrl_flags; |
278 | u16 ata_cmd[11]; | 278 | __le16 ata_cmd[11]; |
279 | }; | 279 | }; |
280 | 280 | ||
281 | struct mv_crqb_iie { | 281 | struct mv_crqb_iie { |
282 | u32 addr; | 282 | __le32 addr; |
283 | u32 addr_hi; | 283 | __le32 addr_hi; |
284 | u32 flags; | 284 | __le32 flags; |
285 | u32 len; | 285 | __le32 len; |
286 | u32 ata_cmd[4]; | 286 | __le32 ata_cmd[4]; |
287 | }; | 287 | }; |
288 | 288 | ||
289 | /* Command ResPonse Block: 8B */ | 289 | /* Command ResPonse Block: 8B */ |
290 | struct mv_crpb { | 290 | struct mv_crpb { |
291 | u16 id; | 291 | __le16 id; |
292 | u16 flags; | 292 | __le16 flags; |
293 | u32 tmstmp; | 293 | __le32 tmstmp; |
294 | }; | 294 | }; |
295 | 295 | ||
296 | /* EDMA Physical Region Descriptor (ePRD); A.K.A. SG */ | 296 | /* EDMA Physical Region Descriptor (ePRD); A.K.A. SG */ |
297 | struct mv_sg { | 297 | struct mv_sg { |
298 | u32 addr; | 298 | __le32 addr; |
299 | u32 flags_size; | 299 | __le32 flags_size; |
300 | u32 addr_hi; | 300 | __le32 addr_hi; |
301 | u32 reserved; | 301 | __le32 reserved; |
302 | }; | 302 | }; |
303 | 303 | ||
304 | struct mv_port_priv { | 304 | struct mv_port_priv { |
@@ -390,6 +390,7 @@ static struct scsi_host_template mv_sht = { | |||
390 | .proc_name = DRV_NAME, | 390 | .proc_name = DRV_NAME, |
391 | .dma_boundary = MV_DMA_BOUNDARY, | 391 | .dma_boundary = MV_DMA_BOUNDARY, |
392 | .slave_configure = ata_scsi_slave_config, | 392 | .slave_configure = ata_scsi_slave_config, |
393 | .slave_destroy = ata_scsi_slave_destroy, | ||
393 | .bios_param = ata_std_bios_param, | 394 | .bios_param = ata_std_bios_param, |
394 | }; | 395 | }; |
395 | 396 | ||
@@ -406,6 +407,7 @@ static const struct ata_port_operations mv5_ops = { | |||
406 | 407 | ||
407 | .qc_prep = mv_qc_prep, | 408 | .qc_prep = mv_qc_prep, |
408 | .qc_issue = mv_qc_issue, | 409 | .qc_issue = mv_qc_issue, |
410 | .data_xfer = ata_mmio_data_xfer, | ||
409 | 411 | ||
410 | .eng_timeout = mv_eng_timeout, | 412 | .eng_timeout = mv_eng_timeout, |
411 | 413 | ||
@@ -433,6 +435,7 @@ static const struct ata_port_operations mv6_ops = { | |||
433 | 435 | ||
434 | .qc_prep = mv_qc_prep, | 436 | .qc_prep = mv_qc_prep, |
435 | .qc_issue = mv_qc_issue, | 437 | .qc_issue = mv_qc_issue, |
438 | .data_xfer = ata_mmio_data_xfer, | ||
436 | 439 | ||
437 | .eng_timeout = mv_eng_timeout, | 440 | .eng_timeout = mv_eng_timeout, |
438 | 441 | ||
@@ -683,7 +686,7 @@ static void mv_stop_dma(struct ata_port *ap) | |||
683 | } | 686 | } |
684 | 687 | ||
685 | if (EDMA_EN & reg) { | 688 | if (EDMA_EN & reg) { |
686 | printk(KERN_ERR "ata%u: Unable to stop eDMA\n", ap->id); | 689 | ata_port_printk(ap, KERN_ERR, "Unable to stop eDMA\n"); |
687 | /* FIXME: Consider doing a reset here to recover */ | 690 | /* FIXME: Consider doing a reset here to recover */ |
688 | } | 691 | } |
689 | } | 692 | } |
@@ -1028,7 +1031,7 @@ static inline unsigned mv_inc_q_index(unsigned index) | |||
1028 | return (index + 1) & MV_MAX_Q_DEPTH_MASK; | 1031 | return (index + 1) & MV_MAX_Q_DEPTH_MASK; |
1029 | } | 1032 | } |
1030 | 1033 | ||
1031 | static inline void mv_crqb_pack_cmd(u16 *cmdw, u8 data, u8 addr, unsigned last) | 1034 | static inline void mv_crqb_pack_cmd(__le16 *cmdw, u8 data, u8 addr, unsigned last) |
1032 | { | 1035 | { |
1033 | u16 tmp = data | (addr << CRQB_CMD_ADDR_SHIFT) | CRQB_CMD_CS | | 1036 | u16 tmp = data | (addr << CRQB_CMD_ADDR_SHIFT) | CRQB_CMD_CS | |
1034 | (last ? CRQB_CMD_LAST : 0); | 1037 | (last ? CRQB_CMD_LAST : 0); |
@@ -1051,7 +1054,7 @@ static void mv_qc_prep(struct ata_queued_cmd *qc) | |||
1051 | { | 1054 | { |
1052 | struct ata_port *ap = qc->ap; | 1055 | struct ata_port *ap = qc->ap; |
1053 | struct mv_port_priv *pp = ap->private_data; | 1056 | struct mv_port_priv *pp = ap->private_data; |
1054 | u16 *cw; | 1057 | __le16 *cw; |
1055 | struct ata_taskfile *tf; | 1058 | struct ata_taskfile *tf; |
1056 | u16 flags = 0; | 1059 | u16 flags = 0; |
1057 | unsigned in_index; | 1060 | unsigned in_index; |
@@ -1307,8 +1310,8 @@ static void mv_err_intr(struct ata_port *ap, int reset_allowed) | |||
1307 | edma_err_cause = readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); | 1310 | edma_err_cause = readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); |
1308 | 1311 | ||
1309 | if (EDMA_ERR_SERR & edma_err_cause) { | 1312 | if (EDMA_ERR_SERR & edma_err_cause) { |
1310 | serr = scr_read(ap, SCR_ERROR); | 1313 | sata_scr_read(ap, SCR_ERROR, &serr); |
1311 | scr_write_flush(ap, SCR_ERROR, serr); | 1314 | sata_scr_write_flush(ap, SCR_ERROR, serr); |
1312 | } | 1315 | } |
1313 | if (EDMA_ERR_SELF_DIS & edma_err_cause) { | 1316 | if (EDMA_ERR_SELF_DIS & edma_err_cause) { |
1314 | struct mv_port_priv *pp = ap->private_data; | 1317 | struct mv_port_priv *pp = ap->private_data; |
@@ -1377,7 +1380,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1377 | /* Note that DEV_IRQ might happen spuriously during EDMA, | 1380 | /* Note that DEV_IRQ might happen spuriously during EDMA, |
1378 | * and should be ignored in such cases. | 1381 | * and should be ignored in such cases. |
1379 | * The cause of this is still under investigation. | 1382 | * The cause of this is still under investigation. |
1380 | */ | 1383 | */ |
1381 | if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) { | 1384 | if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) { |
1382 | /* EDMA: check for response queue interrupt */ | 1385 | /* EDMA: check for response queue interrupt */ |
1383 | if ((CRPB_DMA_DONE << hard_port) & hc_irq_cause) { | 1386 | if ((CRPB_DMA_DONE << hard_port) & hc_irq_cause) { |
@@ -1398,7 +1401,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1398 | } | 1401 | } |
1399 | } | 1402 | } |
1400 | 1403 | ||
1401 | if (ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR)) | 1404 | if (ap && (ap->flags & ATA_FLAG_DISABLED)) |
1402 | continue; | 1405 | continue; |
1403 | 1406 | ||
1404 | err_mask = ac_err_mask(ata_status); | 1407 | err_mask = ac_err_mask(ata_status); |
@@ -1419,7 +1422,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1419 | VPRINTK("port %u IRQ found for qc, " | 1422 | VPRINTK("port %u IRQ found for qc, " |
1420 | "ata_status 0x%x\n", port,ata_status); | 1423 | "ata_status 0x%x\n", port,ata_status); |
1421 | /* mark qc status appropriately */ | 1424 | /* mark qc status appropriately */ |
1422 | if (!(qc->tf.ctl & ATA_NIEN)) { | 1425 | if (!(qc->tf.flags & ATA_TFLAG_POLLING)) { |
1423 | qc->err_mask |= err_mask; | 1426 | qc->err_mask |= err_mask; |
1424 | ata_qc_complete(qc); | 1427 | ata_qc_complete(qc); |
1425 | } | 1428 | } |
@@ -1949,15 +1952,16 @@ static void __mv_phy_reset(struct ata_port *ap, int can_sleep) | |||
1949 | 1952 | ||
1950 | /* Issue COMRESET via SControl */ | 1953 | /* Issue COMRESET via SControl */ |
1951 | comreset_retry: | 1954 | comreset_retry: |
1952 | scr_write_flush(ap, SCR_CONTROL, 0x301); | 1955 | sata_scr_write_flush(ap, SCR_CONTROL, 0x301); |
1953 | __msleep(1, can_sleep); | 1956 | __msleep(1, can_sleep); |
1954 | 1957 | ||
1955 | scr_write_flush(ap, SCR_CONTROL, 0x300); | 1958 | sata_scr_write_flush(ap, SCR_CONTROL, 0x300); |
1956 | __msleep(20, can_sleep); | 1959 | __msleep(20, can_sleep); |
1957 | 1960 | ||
1958 | timeout = jiffies + msecs_to_jiffies(200); | 1961 | timeout = jiffies + msecs_to_jiffies(200); |
1959 | do { | 1962 | do { |
1960 | sstatus = scr_read(ap, SCR_STATUS) & 0x3; | 1963 | sata_scr_read(ap, SCR_STATUS, &sstatus); |
1964 | sstatus &= 0x3; | ||
1961 | if ((sstatus == 3) || (sstatus == 0)) | 1965 | if ((sstatus == 3) || (sstatus == 0)) |
1962 | break; | 1966 | break; |
1963 | 1967 | ||
@@ -1974,11 +1978,12 @@ comreset_retry: | |||
1974 | "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), | 1978 | "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), |
1975 | mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL)); | 1979 | mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL)); |
1976 | 1980 | ||
1977 | if (sata_dev_present(ap)) { | 1981 | if (ata_port_online(ap)) { |
1978 | ata_port_probe(ap); | 1982 | ata_port_probe(ap); |
1979 | } else { | 1983 | } else { |
1980 | printk(KERN_INFO "ata%u: no device found (phy stat %08x)\n", | 1984 | sata_scr_read(ap, SCR_STATUS, &sstatus); |
1981 | ap->id, scr_read(ap, SCR_STATUS)); | 1985 | ata_port_printk(ap, KERN_INFO, |
1986 | "no device found (phy stat %08x)\n", sstatus); | ||
1982 | ata_port_disable(ap); | 1987 | ata_port_disable(ap); |
1983 | return; | 1988 | return; |
1984 | } | 1989 | } |
@@ -2005,7 +2010,7 @@ comreset_retry: | |||
2005 | tf.nsect = readb((void __iomem *) ap->ioaddr.nsect_addr); | 2010 | tf.nsect = readb((void __iomem *) ap->ioaddr.nsect_addr); |
2006 | 2011 | ||
2007 | dev->class = ata_dev_classify(&tf); | 2012 | dev->class = ata_dev_classify(&tf); |
2008 | if (!ata_dev_present(dev)) { | 2013 | if (!ata_dev_enabled(dev)) { |
2009 | VPRINTK("Port disabled post-sig: No device present.\n"); | 2014 | VPRINTK("Port disabled post-sig: No device present.\n"); |
2010 | ata_port_disable(ap); | 2015 | ata_port_disable(ap); |
2011 | } | 2016 | } |
@@ -2037,7 +2042,7 @@ static void mv_eng_timeout(struct ata_port *ap) | |||
2037 | struct ata_queued_cmd *qc; | 2042 | struct ata_queued_cmd *qc; |
2038 | unsigned long flags; | 2043 | unsigned long flags; |
2039 | 2044 | ||
2040 | printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id); | 2045 | ata_port_printk(ap, KERN_ERR, "Entering mv_eng_timeout\n"); |
2041 | DPRINTK("All regs @ start of eng_timeout\n"); | 2046 | DPRINTK("All regs @ start of eng_timeout\n"); |
2042 | mv_dump_all_regs(ap->host_set->mmio_base, ap->port_no, | 2047 | mv_dump_all_regs(ap->host_set->mmio_base, ap->port_no, |
2043 | to_pci_dev(ap->host_set->dev)); | 2048 | to_pci_dev(ap->host_set->dev)); |