Re: [PATCH 2/2] ide: clear bmdma status in ide_intr() (revised)

2007-01-25 Thread Sergei Shtylyov

Albert Lee wrote:

patch 2/2 (revised):
- Do the dma status clearing in ide_intr() and add a new 
hwif-ide_dma_clear_irq such that LLDD can override it.
- Fix drive-waiting_for_dma to work with CDB-intr devices.

Signed-off-by: Albert Lee [EMAIL PROTECTED]
---
hwif-dma is not reliable: ide_intr() races with dma_start(). Sometimes we got 
hwif-dma == 0
in ide_intr() even though it is actually a DMA interrupt. So, 
drive-waiting_for_dma is used instead.

Also revised per Sergei's comments and let ide_dma_clear_irq return void.
The if (hwif-dma_status) check in __ide_dma_clear_irq() is kept as is since 
I think
it would be safer for the old ISA/VESA IDE devices that has no BMDMA registers.


   ISA/VESA drivers shouldn't have this method defined at all since they're 
PIO only. But well, it won't hurt...



For your review, thanks.



diff -Nrup 01_remove_from_ide_cd/drivers/ide/ide-cd.c 
02_add_to_ide_intr/drivers/ide/ide-cd.c
--- 01_remove_from_ide_cd/drivers/ide/ide-cd.c  2007-01-24 11:00:03.0 
+0800
+++ 02_add_to_ide_intr/drivers/ide/ide-cd.c 2007-01-25 16:52:20.0 
+0800
@@ -923,6 +923,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;
@@ -965,6 +969,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,


   Erm... shouldn't we set drive-waiting_for_dma in hwif-dma_start() then?
Why it's set in hwif-dma_setup() at all I wonder?

MBR, Sergei
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] ide: clear bmdma status in ide_intr() (revised)

2007-01-25 Thread Sergei Shtylyov

Hello.

Sergei Shtylyov wrote:


diff -Nrup 01_remove_from_ide_cd/drivers/ide/ide-cd.c 
02_add_to_ide_intr/drivers/ide/ide-cd.c
--- 01_remove_from_ide_cd/drivers/ide/ide-cd.c2007-01-24 11:00:03.0 
+0800
+++ 02_add_to_ide_intr/drivers/ide/ide-cd.c2007-01-25 16:52:20.0 
+0800
@@ -923,6 +923,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;
@@ -965,6 +969,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,


   Erm... shouldn't we set drive-waiting_for_dma in hwif-dma_start() 
then?  Why it's set in hwif-dma_setup() at all I wonder?


   Well, it'll become raicy as well then... Isn't it ugly. :-/

MBR, Sergei
-
To unsubscribe from this list: send the line unsubscribe linux-ide in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html