aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-11-12 13:39:03 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-12 13:39:03 -0500
commitae5684ceb478bfbb7c3c5a49970e20f4701dbdf7 (patch)
tree75a3fb196cc0c6d345fefcd49d304eb13d77a4ac /drivers
parent0fde7f591860e48dd210144ff24c061da03bfa39 (diff)
parent02eaa66629a29cd5712fe81a360c3ab5b1fc9531 (diff)
Merge branch 'upstream-fixes' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/ahci.c32
-rw-r--r--drivers/scsi/sata_qstor.c9
2 files changed, 33 insertions, 8 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index 57ef7ae387d9..4e96ec5f2ff9 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -134,6 +134,7 @@ enum {
134 PORT_IRQ_D2H_REG_FIS, 134 PORT_IRQ_D2H_REG_FIS,
135 135
136 /* PORT_CMD bits */ 136 /* PORT_CMD bits */
137 PORT_CMD_ATAPI = (1 << 24), /* Device is ATAPI */
137 PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */ 138 PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */
138 PORT_CMD_FIS_ON = (1 << 14), /* FIS DMA engine running */ 139 PORT_CMD_FIS_ON = (1 << 14), /* FIS DMA engine running */
139 PORT_CMD_FIS_RX = (1 << 4), /* Enable FIS receive DMA engine */ 140 PORT_CMD_FIS_RX = (1 << 4), /* Enable FIS receive DMA engine */
@@ -441,7 +442,7 @@ static void ahci_phy_reset(struct ata_port *ap)
441 void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr; 442 void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr;
442 struct ata_taskfile tf; 443 struct ata_taskfile tf;
443 struct ata_device *dev = &ap->device[0]; 444 struct ata_device *dev = &ap->device[0];
444 u32 tmp; 445 u32 new_tmp, tmp;
445 446
446 __sata_phy_reset(ap); 447 __sata_phy_reset(ap);
447 448
@@ -455,8 +456,21 @@ static void ahci_phy_reset(struct ata_port *ap)
455 tf.nsect = (tmp) & 0xff; 456 tf.nsect = (tmp) & 0xff;
456 457
457 dev->class = ata_dev_classify(&tf); 458 dev->class = ata_dev_classify(&tf);
458 if (!ata_dev_present(dev)) 459 if (!ata_dev_present(dev)) {
459 ata_port_disable(ap); 460 ata_port_disable(ap);
461 return;
462 }
463
464 /* Make sure port's ATAPI bit is set appropriately */
465 new_tmp = tmp = readl(port_mmio + PORT_CMD);
466 if (dev->class == ATA_DEV_ATAPI)
467 new_tmp |= PORT_CMD_ATAPI;
468 else
469 new_tmp &= ~PORT_CMD_ATAPI;
470 if (new_tmp != tmp) {
471 writel(new_tmp, port_mmio + PORT_CMD);
472 readl(port_mmio + PORT_CMD); /* flush */
473 }
460} 474}
461 475
462static u8 ahci_check_status(struct ata_port *ap) 476static u8 ahci_check_status(struct ata_port *ap)
@@ -474,11 +488,12 @@ static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
474 ata_tf_from_fis(d2h_fis, tf); 488 ata_tf_from_fis(d2h_fis, tf);
475} 489}
476 490
477static void ahci_fill_sg(struct ata_queued_cmd *qc) 491static unsigned int ahci_fill_sg(struct ata_queued_cmd *qc)
478{ 492{
479 struct ahci_port_priv *pp = qc->ap->private_data; 493 struct ahci_port_priv *pp = qc->ap->private_data;
480 struct scatterlist *sg; 494 struct scatterlist *sg;
481 struct ahci_sg *ahci_sg; 495 struct ahci_sg *ahci_sg;
496 unsigned int n_sg = 0;
482 497
483 VPRINTK("ENTER\n"); 498 VPRINTK("ENTER\n");
484 499
@@ -493,8 +508,12 @@ static void ahci_fill_sg(struct ata_queued_cmd *qc)
493 ahci_sg->addr = cpu_to_le32(addr & 0xffffffff); 508 ahci_sg->addr = cpu_to_le32(addr & 0xffffffff);
494 ahci_sg->addr_hi = cpu_to_le32((addr >> 16) >> 16); 509 ahci_sg->addr_hi = cpu_to_le32((addr >> 16) >> 16);
495 ahci_sg->flags_size = cpu_to_le32(sg_len - 1); 510 ahci_sg->flags_size = cpu_to_le32(sg_len - 1);
511
496 ahci_sg++; 512 ahci_sg++;
513 n_sg++;
497 } 514 }
515
516 return n_sg;
498} 517}
499 518
500static void ahci_qc_prep(struct ata_queued_cmd *qc) 519static void ahci_qc_prep(struct ata_queued_cmd *qc)
@@ -503,13 +522,14 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc)
503 struct ahci_port_priv *pp = ap->private_data; 522 struct ahci_port_priv *pp = ap->private_data;
504 u32 opts; 523 u32 opts;
505 const u32 cmd_fis_len = 5; /* five dwords */ 524 const u32 cmd_fis_len = 5; /* five dwords */
525 unsigned int n_elem;
506 526
507 /* 527 /*
508 * Fill in command slot information (currently only one slot, 528 * Fill in command slot information (currently only one slot,
509 * slot 0, is currently since we don't do queueing) 529 * slot 0, is currently since we don't do queueing)
510 */ 530 */
511 531
512 opts = (qc->n_elem << 16) | cmd_fis_len; 532 opts = cmd_fis_len;
513 if (qc->tf.flags & ATA_TFLAG_WRITE) 533 if (qc->tf.flags & ATA_TFLAG_WRITE)
514 opts |= AHCI_CMD_WRITE; 534 opts |= AHCI_CMD_WRITE;
515 if (is_atapi_taskfile(&qc->tf)) 535 if (is_atapi_taskfile(&qc->tf))
@@ -533,7 +553,9 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc)
533 if (!(qc->flags & ATA_QCFLAG_DMAMAP)) 553 if (!(qc->flags & ATA_QCFLAG_DMAMAP))
534 return; 554 return;
535 555
536 ahci_fill_sg(qc); 556 n_elem = ahci_fill_sg(qc);
557
558 pp->cmd_slot[0].opts |= cpu_to_le32(n_elem << 16);
537} 559}
538 560
539static void ahci_intr_error(struct ata_port *ap, u32 irq_stat) 561static void ahci_intr_error(struct ata_port *ap, u32 irq_stat)
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c
index b2f6324a2eb2..4a6d3067d23c 100644
--- a/drivers/scsi/sata_qstor.c
+++ b/drivers/scsi/sata_qstor.c
@@ -268,7 +268,7 @@ static void qs_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
268 writel(val, (void __iomem *)(ap->ioaddr.scr_addr + (sc_reg * 8))); 268 writel(val, (void __iomem *)(ap->ioaddr.scr_addr + (sc_reg * 8)));
269} 269}
270 270
271static void qs_fill_sg(struct ata_queued_cmd *qc) 271static unsigned int qs_fill_sg(struct ata_queued_cmd *qc)
272{ 272{
273 struct scatterlist *sg; 273 struct scatterlist *sg;
274 struct ata_port *ap = qc->ap; 274 struct ata_port *ap = qc->ap;
@@ -296,6 +296,8 @@ static void qs_fill_sg(struct ata_queued_cmd *qc)
296 (unsigned long long)addr, len); 296 (unsigned long long)addr, len);
297 nelem++; 297 nelem++;
298 } 298 }
299
300 return nelem;
299} 301}
300 302
301static void qs_qc_prep(struct ata_queued_cmd *qc) 303static void qs_qc_prep(struct ata_queued_cmd *qc)
@@ -304,6 +306,7 @@ static void qs_qc_prep(struct ata_queued_cmd *qc)
304 u8 dflags = QS_DF_PORD, *buf = pp->pkt; 306 u8 dflags = QS_DF_PORD, *buf = pp->pkt;
305 u8 hflags = QS_HF_DAT | QS_HF_IEN | QS_HF_VLD; 307 u8 hflags = QS_HF_DAT | QS_HF_IEN | QS_HF_VLD;
306 u64 addr; 308 u64 addr;
309 unsigned int nelem;
307 310
308 VPRINTK("ENTER\n"); 311 VPRINTK("ENTER\n");
309 312
@@ -313,7 +316,7 @@ static void qs_qc_prep(struct ata_queued_cmd *qc)
313 return; 316 return;
314 } 317 }
315 318
316 qs_fill_sg(qc); 319 nelem = qs_fill_sg(qc);
317 320
318 if ((qc->tf.flags & ATA_TFLAG_WRITE)) 321 if ((qc->tf.flags & ATA_TFLAG_WRITE))
319 hflags |= QS_HF_DIRO; 322 hflags |= QS_HF_DIRO;
@@ -324,7 +327,7 @@ static void qs_qc_prep(struct ata_queued_cmd *qc)
324 buf[ 0] = QS_HCB_HDR; 327 buf[ 0] = QS_HCB_HDR;
325 buf[ 1] = hflags; 328 buf[ 1] = hflags;
326 *(__le32 *)(&buf[ 4]) = cpu_to_le32(qc->nsect * ATA_SECT_SIZE); 329 *(__le32 *)(&buf[ 4]) = cpu_to_le32(qc->nsect * ATA_SECT_SIZE);
327 *(__le32 *)(&buf[ 8]) = cpu_to_le32(qc->n_elem); 330 *(__le32 *)(&buf[ 8]) = cpu_to_le32(nelem);
328 addr = ((u64)pp->pkt_dma) + QS_CPB_BYTES; 331 addr = ((u64)pp->pkt_dma) + QS_CPB_BYTES;
329 *(__le64 *)(&buf[16]) = cpu_to_le64(addr); 332 *(__le64 *)(&buf[16]) = cpu_to_le64(addr);
330 333