From: Albert Lee <albertcc@tw.ibm.com>
To: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Linux IDE <linux-ide@vger.kernel.org>,
"Adam W. Hawks" <awhawks@us.ibm.com>
Subject: [PATCH 1/2] ide: clear bmdma status in ide_intr() for ICHx controllers (revised #4)
Date: Wed, 31 Jan 2007 13:54:35 +0800 [thread overview]
Message-ID: <45C02F1B.1000101@tw.ibm.com> (raw)
In-Reply-To: <45C02DD1.7040907@tw.ibm.com>
patch 1/2 (revised):
- Fix drive->waiting_for_dma to work with CDB-intr devices.
- Do the dma status clearing in ide_intr() and add a new hwif->ide_dma_clear_irq for Intel ICHx controllers.
Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
---
Revised per Alan, Sergei and Bart's advice.
Patch against 2.6.20-rc6. Tested ok on my ICH4 and pdc20275 adapters.
Please review/apply, thanks.
diff -Nrup 00_ide_dma/drivers/ide/ide-cd.c 01_add_to_ide_intr/drivers/ide/ide-cd.c
--- 00_ide_dma/drivers/ide/ide-cd.c 2007-01-29 17:19:48.000000000 +0800
+++ 01_add_to_ide_intr/drivers/ide/ide-cd.c 2007-01-31 11:01:03.000000000 +0800
@@ -930,6 +930,10 @@ static ide_startstop_t cdrom_start_packe
HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG);
if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) {
+ /* waiting for CDB interrupt, not DMA yet. */
+ if (info->dma)
+ drive->waiting_for_dma = 0;
+
/* packet command */
ide_execute_command(drive, WIN_PACKETCMD, handler, ATAPI_WAIT_PC, cdrom_timer_expiry);
return ide_started;
@@ -972,6 +976,10 @@ static ide_startstop_t cdrom_transfer_pa
/* Check for errors. */
if (cdrom_decode_status(drive, DRQ_STAT, NULL))
return ide_stopped;
+
+ /* Ok, next interrupt will be DMA interrupt. */
+ if (info->dma)
+ drive->waiting_for_dma = 1;
} else {
/* Otherwise, we must wait for DRQ to get set. */
if (ide_wait_stat(&startstop, drive, DRQ_STAT,
diff -Nrup 00_ide_dma/drivers/ide/ide-io.c 01_add_to_ide_intr/drivers/ide/ide-io.c
--- 00_ide_dma/drivers/ide/ide-io.c 2006-11-30 05:57:37.000000000 +0800
+++ 01_add_to_ide_intr/drivers/ide/ide-io.c 2007-01-31 12:19:09.000000000 +0800
@@ -1646,6 +1646,17 @@ irqreturn_t ide_intr (int irq, void *dev
del_timer(&hwgroup->timer);
spin_unlock(&ide_lock);
+ /* Some controllers might set DMA INTR no matter DMA or PIO;
+ * bmdma status might need to be cleared even for
+ * PIO interrupts to prevent spurious/lost irq.
+ */
+ if (hwif->ide_dma_clear_irq && !(drive->waiting_for_dma))
+ /* ide_dma_end() needs bmdma status for error checking.
+ * So, skip clearing bmdma status here and leave it
+ * to ide_dma_end() if this is dma interrupt.
+ */
+ hwif->ide_dma_clear_irq(drive);
+
if (drive->unmask)
local_irq_enable_in_hardirq();
/* service this interrupt, may set handler for next interrupt */
diff -Nrup 00_ide_dma/drivers/ide/ide.c 01_add_to_ide_intr/drivers/ide/ide.c
--- 00_ide_dma/drivers/ide/ide.c 2007-01-29 17:19:48.000000000 +0800
+++ 01_add_to_ide_intr/drivers/ide/ide.c 2007-01-31 11:01:03.000000000 +0800
@@ -503,6 +503,7 @@ static void ide_hwif_restore(ide_hwif_t
hwif->ide_dma_on = tmp_hwif->ide_dma_on;
hwif->ide_dma_off_quietly = tmp_hwif->ide_dma_off_quietly;
hwif->ide_dma_test_irq = tmp_hwif->ide_dma_test_irq;
+ hwif->ide_dma_clear_irq = tmp_hwif->ide_dma_clear_irq;
hwif->ide_dma_host_on = tmp_hwif->ide_dma_host_on;
hwif->ide_dma_host_off = tmp_hwif->ide_dma_host_off;
hwif->ide_dma_lostirq = tmp_hwif->ide_dma_lostirq;
diff -Nrup 00_ide_dma/drivers/ide/pci/piix.c 01_add_to_ide_intr/drivers/ide/pci/piix.c
--- 00_ide_dma/drivers/ide/pci/piix.c 2007-01-29 17:19:48.000000000 +0800
+++ 01_add_to_ide_intr/drivers/ide/pci/piix.c 2007-01-31 13:38:42.000000000 +0800
@@ -411,17 +411,14 @@ fast_ata_pio:
}
/**
- * init_chipset_piix - set up the PIIX chipset
- * @dev: PCI device to set up
- * @name: Name of the device
+ * piix_is_ichx - check if ICHx
+ * @dev: PCI device to check
*
- * Initialize the PCI device as required. For the PIIX this turns
- * out to be nice and simple
+ * returns 1 if ICHx, 0 otherwise.
*/
-
-static unsigned int __devinit init_chipset_piix (struct pci_dev *dev, const char *name)
+static int piix_is_ichx(struct pci_dev *dev)
{
- switch(dev->device) {
+ switch (dev->device) {
case PCI_DEVICE_ID_INTEL_82801EB_1:
case PCI_DEVICE_ID_INTEL_82801AA_1:
case PCI_DEVICE_ID_INTEL_82801AB_1:
@@ -439,19 +436,51 @@ static unsigned int __devinit init_chips
case PCI_DEVICE_ID_INTEL_ICH7_21:
case PCI_DEVICE_ID_INTEL_ESB2_18:
case PCI_DEVICE_ID_INTEL_ICH8_6:
- {
- unsigned int extra = 0;
- pci_read_config_dword(dev, 0x54, &extra);
- pci_write_config_dword(dev, 0x54, extra|0x400);
- }
- default:
- break;
+ return 1;
+ }
+
+ return 0;
+}
+
+/**
+ * init_chipset_piix - set up the PIIX chipset
+ * @dev: PCI device to set up
+ * @name: Name of the device
+ *
+ * Initialize the PCI device as required. For the PIIX this turns
+ * out to be nice and simple
+ */
+
+static unsigned int __devinit init_chipset_piix (struct pci_dev *dev, const char *name)
+{
+ if (piix_is_ichx(dev)) {
+ unsigned int extra = 0;
+ pci_read_config_dword(dev, 0x54, &extra);
+ pci_write_config_dword(dev, 0x54, extra|0x400);
}
return 0;
}
/**
+ * piix_dma_clear_irq - clear BMDMA status
+ * @drive: IDE drive to clear
+ *
+ * Called from ide_intr() for PIO interrupts
+ * to clear BMDMA status as needed by ICHx
+ */
+static void piix_dma_clear_irq(ide_drive_t *drive)
+{
+ ide_hwif_t *hwif = HWIF(drive);
+ u8 dma_stat;
+
+ /* clear the INTR & ERROR bits */
+ dma_stat = hwif->INB(hwif->dma_status);
+ /* Should we force the bit as well ? */
+ hwif->OUTB(dma_stat, hwif->dma_status);
+}
+
+/**
* init_hwif_piix - fill in the hwif for the PIIX
* @hwif: IDE interface
*
@@ -487,6 +516,10 @@ static void __devinit init_hwif_piix(ide
if (!hwif->dma_base)
return;
+ /* ICHx need to clear the bmdma status for all interrupts */
+ if (piix_is_ichx(hwif->pci_dev))
+ hwif->ide_dma_clear_irq = &piix_dma_clear_irq;
+
hwif->atapi_dma = 1;
hwif->ultra_mask = 0x3f;
hwif->mwdma_mask = 0x06;
diff -Nrup 00_ide_dma/include/linux/ide.h 01_add_to_ide_intr/include/linux/ide.h
--- 00_ide_dma/include/linux/ide.h 2007-01-29 17:19:53.000000000 +0800
+++ 01_add_to_ide_intr/include/linux/ide.h 2007-01-31 11:10:27.000000000 +0800
@@ -727,6 +727,7 @@ typedef struct hwif_s {
int (*ide_dma_on)(ide_drive_t *drive);
int (*ide_dma_off_quietly)(ide_drive_t *drive);
int (*ide_dma_test_irq)(ide_drive_t *drive);
+ void (*ide_dma_clear_irq)(ide_drive_t *drive);
int (*ide_dma_host_on)(ide_drive_t *drive);
int (*ide_dma_host_off)(ide_drive_t *drive);
int (*ide_dma_lostirq)(ide_drive_t *drive);
next prev parent reply other threads:[~2007-01-31 5:54 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-18 11:19 [PATCH] ide: Fix ATAPI DMA lost irq problem with CDB intr devices Albert Lee
[not found] ` <58cb370e0701191133m3dd584ffna5b231b00392c13d@mail.gmail.com>
2007-01-19 19:59 ` Bartlomiej Zolnierkiewicz
2007-01-22 7:28 ` Albert Lee
2007-01-22 8:45 ` Albert Lee
2007-01-22 16:05 ` Bartlomiej Zolnierkiewicz
2007-01-24 3:33 ` [PATCH 0/2] ide: clear bmdma status in ide_intr for all commands Albert Lee
2007-01-24 3:36 ` [PATCH 1/2] ide: remove clearing bmdma status from cdrom_decode_status() Albert Lee
2007-01-24 3:42 ` [PATCH 2/2] ide: clear bmdma status in ide_intr() Albert Lee
2007-01-24 13:04 ` Sergei Shtylyov
2007-01-25 9:31 ` [PATCH 2/2] ide: clear bmdma status in ide_intr() (revised) Albert Lee
2007-01-25 15:17 ` Sergei Shtylyov
2007-01-25 16:40 ` Sergei Shtylyov
2007-01-30 2:49 ` [PATCH 0/2] ide: clear bmdma status in ide_intr for Intel controllers (revised #3) Albert Lee
2007-01-30 2:52 ` [PATCH 1/2] ide: remove clearing bmdma status from cdrom_decode_status() (rev #3) Albert Lee
2007-01-30 3:02 ` [PATCH 2/2] ide: clear bmdma status in ide_intr() for Intel controllers (revised #3) Albert Lee
2007-01-30 14:13 ` Sergei Shtylyov
2007-01-30 14:27 ` Alan
[not found] ` <58cb370e0701301117n316a9efax1e0b6299a8f8594a@mail.gmail.com>
2007-01-30 20:21 ` Bartlomiej Zolnierkiewicz
2007-01-31 5:49 ` [PATCH 0/2] ide: clear bmdma status in ide_intr for Intel controllers (revised #4) Albert Lee
2007-01-31 5:54 ` Albert Lee [this message]
2007-01-31 5:57 ` [PATCH 2/2] ide: remove clearing bmdma status from cdrom_decode_status() (rev #4) Albert Lee
[not found] ` <58cb370e0702021307i3d275e84qbeb3b44f58ad6b51@mail.gmail.com>
2007-02-02 21:14 ` [PATCH 0/2] ide: clear bmdma status in ide_intr for Intel controllers (revised #4) Bartlomiej Zolnierkiewicz
2007-01-22 14:47 ` [PATCH] ide: Fix ATAPI DMA lost irq problem with CDB intr devices Alan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45C02F1B.1000101@tw.ibm.com \
--to=albertcc@tw.ibm.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=albertl@mail.com \
--cc=awhawks@us.ibm.com \
--cc=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=sshtylyov@ru.mvista.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).