From c018f1ee5cf81e58b93d9e93a2ee39cad13dc1ac Mon Sep 17 00:00:00 2001 From: Sergei Shtylyov Date: Sat, 18 Apr 2009 17:42:19 +0200 Subject: hpt366: fix HPT370 DMA timeouts The big driver change in 2.4.19-rc1 introduced a regression for many HPT370[A] chips -- DMA stopped to work completely, only causing endless timeouts... The culprit has been identified (at last!): it turned to be the code resetting the DMA state machine before each transfer. Stop doing it now as this counter- measure has clearly caused more harm than good. This should fix the kernel.org bug #7703. Signed-off-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/hpt366.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/ide/hpt366.c b/drivers/ide/hpt366.c index a0eb87f59134..cea1ac222a90 100644 --- a/drivers/ide/hpt366.c +++ b/drivers/ide/hpt366.c @@ -114,6 +114,8 @@ * the register setting lists into the table indexed by the clock selected * - set the correct hwif->ultra_mask for each individual chip * - add Ultra and MW DMA mode filtering for the HPT37[24] based SATA cards + * - stop resetting HPT370's state machine before each DMA transfer as that has + * caused more harm than good * Sergei Shtylyov, or */ @@ -133,7 +135,7 @@ #define DRV_NAME "hpt366" /* various tuning parameters */ -#define HPT_RESET_STATE_ENGINE +#undef HPT_RESET_STATE_ENGINE #undef HPT_DELAY_INTERRUPT static const char *quirk_drives[] = { -- cgit v1.2.3-55-g7522 From 59c8d04f5ee97ea46da854e9adbbaa45d988c39d Mon Sep 17 00:00:00 2001 From: Sergei Shtylyov Date: Sat, 18 Apr 2009 17:42:19 +0200 Subject: hpt366: use ATA_DMA_* constants Use ATA_DMA_* constants instead of the bare numbers for the BMIDE register bits. Signed-off-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/hpt366.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/ide/hpt366.c b/drivers/ide/hpt366.c index cea1ac222a90..0feb66c720e1 100644 --- a/drivers/ide/hpt366.c +++ b/drivers/ide/hpt366.c @@ -3,7 +3,7 @@ * Portions Copyright (C) 2001 Sun Microsystems, Inc. * Portions Copyright (C) 2003 Red Hat Inc * Portions Copyright (C) 2007 Bartlomiej Zolnierkiewicz - * Portions Copyright (C) 2005-2008 MontaVista Software, Inc. + * Portions Copyright (C) 2005-2009 MontaVista Software, Inc. * * Thanks to HighPoint Technologies for their assistance, and hardware. * Special Thanks to Jon Burchmore in SanDiego for the deep pockets, his @@ -810,7 +810,7 @@ static void hpt370_irq_timeout(ide_drive_t *drive) /* get DMA command mode */ dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD); /* stop DMA */ - outb(dma_cmd & ~0x1, hwif->dma_base + ATA_DMA_CMD); + outb(dma_cmd & ~ATA_DMA_START, hwif->dma_base + ATA_DMA_CMD); hpt370_clear_engine(drive); } @@ -827,11 +827,11 @@ static int hpt370_dma_end(ide_drive_t *drive) ide_hwif_t *hwif = drive->hwif; u8 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS); - if (dma_stat & 0x01) { + if (dma_stat & ATA_DMA_ACTIVE) { /* wait a little */ udelay(20); dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS); - if (dma_stat & 0x01) + if (dma_stat & ATA_DMA_ACTIVE) hpt370_irq_timeout(drive); } return ide_dma_end(drive); @@ -853,7 +853,7 @@ static int hpt374_dma_test_irq(ide_drive_t *drive) dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS); /* return 1 if INTR asserted */ - if (dma_stat & 4) + if (dma_stat & ATA_DMA_INTR) return 1; return 0; -- cgit v1.2.3-55-g7522 From d5f840bf74c09ca5a31e518c9d984999926b5f44 Mon Sep 17 00:00:00 2001 From: Jack Stone Date: Sat, 18 Apr 2009 17:42:19 +0200 Subject: ide: Remove void casts Remove uneeded void casts Signed-off-by: Jack Stone Cc: jeff@garzik.org Cc: kernel-janitors@vger.kernel.org Cc: Jack Stone Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c index 052b9bf1f8fb..f76e4e6b408f 100644 --- a/drivers/ide/pmac.c +++ b/drivers/ide/pmac.c @@ -1682,7 +1682,7 @@ static int __devinit pmac_ide_init_dma(ide_hwif_t *hwif, * The +2 is +1 for the stop command and +1 to allow for * aligning the start address to a multiple of 16 bytes. */ - pmif->dma_table_cpu = (struct dbdma_cmd*)pci_alloc_consistent( + pmif->dma_table_cpu = pci_alloc_consistent( dev, (MAX_DCMDS + 2) * sizeof(struct dbdma_cmd), &hwif->dmatable_dma); -- cgit v1.2.3-55-g7522 From f505d49ffd25ed062e76ffd17568d3937fcd338c Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 18 Apr 2009 17:42:20 +0200 Subject: ide: fix barriers support Freeing non-slab objects is bad and results in an oops. Fix it. Reported-and-tested-by: Andrew Price Cc: Theodore Tso Cc: "Rafael J. Wysocki" Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-io.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 2ae02b8d7f8e..35dc38d3b2c5 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -102,11 +102,14 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) drive->dev_flags |= IDE_DFLAG_PARKED; } - if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE) - memcpy(rq->special, cmd, sizeof(*cmd)); + if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { + struct ide_cmd *orig_cmd = rq->special; - if (cmd->tf_flags & IDE_TFLAG_DYN) - kfree(cmd); + if (cmd->tf_flags & IDE_TFLAG_DYN) + kfree(orig_cmd); + else + memcpy(orig_cmd, cmd, sizeof(*cmd)); + } } /* obsolete, blk_rq_bytes() should be used instead */ -- cgit v1.2.3-55-g7522 From 15da90b516e9da92cc1d90001e640fd6707d0e27 Mon Sep 17 00:00:00 2001 From: Sergei Shtylyov Date: Sat, 18 Apr 2009 17:42:20 +0200 Subject: cs5536: define dma_sff_read_status() method The driver somehow got merged with the initializer for the dma_sff_read_status() method missing which caused kernel panic on bootup. This should fix the kernel.org bug #13026... Signed-off-by: Sergei Shtylyov Reported-by: Arnd Hannemann Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/cs5536.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/ide/cs5536.c b/drivers/ide/cs5536.c index 353a35bbba63..0332a95eefd4 100644 --- a/drivers/ide/cs5536.c +++ b/drivers/ide/cs5536.c @@ -236,6 +236,7 @@ static const struct ide_dma_ops cs5536_dma_ops = { .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, .dma_timer_expiry = ide_dma_sff_timer_expiry, + .dma_sff_read_status = ide_dma_sff_read_status, }; static const struct ide_port_info cs5536_info = { -- cgit v1.2.3-55-g7522