* [PATCH 00/40] ide: generic ATAPI support
@ 2008-05-18 18:54 Bartlomiej Zolnierkiewicz
2008-05-18 18:54 ` [PATCH 01/40] ide-scsi: fix race in idescsi_transfer_pc() Bartlomiej Zolnierkiewicz
` (40 more replies)
0 siblings, 41 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:54 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Hi,
This patch series unifies ATAPI support present in ide-{floppy,tape,scsi}
device drivers and moves it out to the core IDE code (new ide-atapi.c file).
In the process many bugs were shaken out and ~300 LOC were removed.
diffstat:
drivers/ide/Kconfig | 6
drivers/ide/Makefile | 1
drivers/ide/ide-atapi.c | 296 ++++++++++++++++++++++
drivers/ide/ide-cd.c | 5
drivers/ide/ide-floppy.c | 431 +++++++-------------------------
drivers/ide/ide-tape.c | 630 ++++++++++++++---------------------------------
drivers/scsi/ide-scsi.c | 455 +++++++++++----------------------
include/linux/ide.h | 28 +-
8 files changed, 777 insertions(+), 1075 deletions(-)
Now, while this is a big step in the right direction there are still some
things left on TODO for generic ATAPI support to be complete:
- convert ide-cd to use generic ATAPI code
- kill pc and rq stacks in ide-{floppy,tape}
- generic handling of REQUEST SENSE command
- generic handling of MODE SENSE command for ide-{floppy,tape}
- convert ide-{cd,floppy,tape} to use scatterlists for PIO transers
(ala ide-scsi)
I know that Borislav is working on the first two items but other ones
are free at the moment so if you feel brave you may give it a try :-).
PS I'll be travelling during this weekend and be rather busy with day job
so replies from me may be delayed a bit.
Thanks,
Bart
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 01/40] ide-scsi: fix race in idescsi_transfer_pc()
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:54 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:54 ` [PATCH 02/40] ide-scsi: fix DRQ checking for DMA transfers in idescsi_pc_intr() Bartlomiej Zolnierkiewicz
` (39 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:54 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Start DMA engine before sending content of packet command (otherwise
it is possible that IRQ will happen before DMA engine is started).
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/scsi/ide-scsi.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
Index: b/drivers/scsi/ide-scsi.c
===================================================================
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -494,13 +494,14 @@ static ide_startstop_t idescsi_transfer_
/* Set the interrupt routine */
ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
- /* Send the actual packet */
- hwif->output_data(drive, NULL, scsi->pc->c, 12);
-
if (pc->flags & PC_FLAG_DMA_OK) {
pc->flags |= PC_FLAG_DMA_IN_PROGRESS;
hwif->dma_ops->dma_start(drive);
}
+
+ /* Send the actual packet */
+ hwif->output_data(drive, NULL, scsi->pc->c, 12);
+
return ide_started;
}
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 02/40] ide-scsi: fix DRQ checking for DMA transfers in idescsi_pc_intr()
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
2008-05-18 18:54 ` [PATCH 01/40] ide-scsi: fix race in idescsi_transfer_pc() Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:54 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:54 ` [PATCH 03/40] ide-scsi: fix handling of DMA errors " Bartlomiej Zolnierkiewicz
` (38 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:54 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
If DRQ bit of Status Register is not cleared it is an error condition
and should be handled accordingly (disable DMA + reset the device).
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/scsi/ide-scsi.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
Index: b/drivers/scsi/ide-scsi.c
===================================================================
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -388,7 +388,6 @@ static ide_startstop_t idescsi_pc_intr (
return ide_stopped;
}
if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
- pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
#if IDESCSI_DEBUG_LOG
printk ("ide-scsi: %s: DMA complete\n", drive->name);
#endif /* IDESCSI_DEBUG_LOG */
@@ -404,12 +403,20 @@ static ide_startstop_t idescsi_pc_intr (
if (test_bit(IDESCSI_LOG_CMD, &scsi->log))
printk(KERN_INFO "Packet command completed, %d bytes"
" transferred\n", pc->xferred);
+ pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
local_irq_enable_in_hardirq();
if (stat & ERR_STAT)
rq->errors++;
idescsi_end_request (drive, 1, 0);
return ide_stopped;
}
+ if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
+ pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
+ printk(KERN_ERR "%s: The device wants to issue more interrupts "
+ "in DMA mode\n", drive->name);
+ ide_dma_off(drive);
+ return ide_do_reset(drive);
+ }
bcount = (hwif->INB(hwif->io_ports.lbah_addr) << 8) |
hwif->INB(hwif->io_ports.lbam_addr);
ireason = hwif->INB(hwif->io_ports.nsect_addr);
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 03/40] ide-scsi: fix handling of DMA errors in idescsi_pc_intr()
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
2008-05-18 18:54 ` [PATCH 01/40] ide-scsi: fix race in idescsi_transfer_pc() Bartlomiej Zolnierkiewicz
2008-05-18 18:54 ` [PATCH 02/40] ide-scsi: fix DRQ checking for DMA transfers in idescsi_pc_intr() Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:54 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:55 ` [PATCH 04/40] ide-scsi: fix Interrupt Reason checking " Bartlomiej Zolnierkiewicz
` (37 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:54 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Check return value of ->dma_end method and if there was a DMA error
handle it accordingly (set PC_FLAG_DMA_ERROR pc flag, don't update
pc->xferred and increase rq->errors).
Also move debug message in the right place while at it.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/scsi/ide-scsi.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
Index: b/drivers/scsi/ide-scsi.c
===================================================================
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -388,11 +388,13 @@ static ide_startstop_t idescsi_pc_intr (
return ide_stopped;
}
if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
+ if (hwif->dma_ops->dma_end(drive))
+ pc->flags |= PC_FLAG_DMA_ERROR;
+ else
+ pc->xferred = pc->req_xfer;
#if IDESCSI_DEBUG_LOG
printk ("ide-scsi: %s: DMA complete\n", drive->name);
#endif /* IDESCSI_DEBUG_LOG */
- pc->xferred = pc->req_xfer;
- (void)hwif->dma_ops->dma_end(drive);
}
/* Clear the interrupt */
@@ -405,7 +407,7 @@ static ide_startstop_t idescsi_pc_intr (
" transferred\n", pc->xferred);
pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
local_irq_enable_in_hardirq();
- if (stat & ERR_STAT)
+ if ((stat & ERR_STAT) || (pc->flags & PC_FLAG_DMA_ERROR))
rq->errors++;
idescsi_end_request (drive, 1, 0);
return ide_stopped;
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 04/40] ide-scsi: fix Interrupt Reason checking in idescsi_pc_intr()
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (2 preceding siblings ...)
2008-05-18 18:54 ` [PATCH 03/40] ide-scsi: fix handling of DMA errors " Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:55 ` Bartlomiej Zolnierkiewicz
2008-05-19 5:10 ` Borislav Petkov
2008-05-18 18:55 ` [PATCH 05/40] ide-scsi: merge idescsi_input_buffers() and idescsi_output_buffers() Bartlomiej Zolnierkiewicz
` (36 subsequent siblings)
40 siblings, 1 reply; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:55 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Set PC_FLAG_WRITING pc flag in idescsi_queue() (if needed)
and then fix Interrupt Reason checking in idescsi_pc_intr().
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/scsi/ide-scsi.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
Index: b/drivers/scsi/ide-scsi.c
===================================================================
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -427,7 +427,15 @@ static ide_startstop_t idescsi_pc_intr (
printk(KERN_ERR "ide-scsi: CoD != 0 in idescsi_pc_intr\n");
return ide_do_reset (drive);
}
- if (ireason & IO) {
+ if (((ireason & IO) == IO) == !!(pc->flags & PC_FLAG_WRITING)) {
+ /* Hopefully, we will never get here */
+ printk(KERN_ERR "%s: We wanted to %s, but the device wants us "
+ "to %s!\n", drive->name,
+ (ireason & IO) ? "Write" : "Read",
+ (ireason & IO) ? "Read" : "Write");
+ return ide_do_reset(drive);
+ }
+ if (!(pc->flags & PC_FLAG_WRITING)) {
temp = pc->xferred + bcount;
if (temp > pc->req_xfer) {
if (temp > pc->buf_size) {
@@ -436,7 +444,6 @@ static ide_startstop_t idescsi_pc_intr (
"- discarding data\n");
temp = pc->buf_size - pc->xferred;
if (temp) {
- pc->flags &= ~PC_FLAG_WRITING;
if (pc->sg)
idescsi_input_buffers(drive, pc,
temp);
@@ -457,15 +464,11 @@ static ide_startstop_t idescsi_pc_intr (
printk (KERN_NOTICE "ide-scsi: The scsi wants to send us more data than expected - allowing transfer\n");
#endif /* IDESCSI_DEBUG_LOG */
}
- }
- if (ireason & IO) {
- pc->flags &= ~PC_FLAG_WRITING;
if (pc->sg)
idescsi_input_buffers(drive, pc, bcount);
else
hwif->input_data(drive, NULL, pc->cur_pos, bcount);
} else {
- pc->flags |= PC_FLAG_WRITING;
if (pc->sg)
idescsi_output_buffers(drive, pc, bcount);
else
@@ -777,6 +780,8 @@ static int idescsi_queue (struct scsi_cm
memset (pc->c, 0, 12);
pc->flags = 0;
+ if (cmd->sc_data_direction == DMA_TO_DEVICE)
+ pc->flags |= PC_FLAG_WRITING;
pc->rq = rq;
memcpy (pc->c, cmd->cmnd, cmd->cmd_len);
pc->buf = NULL;
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 05/40] ide-scsi: merge idescsi_input_buffers() and idescsi_output_buffers()
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (3 preceding siblings ...)
2008-05-18 18:55 ` [PATCH 04/40] ide-scsi: fix Interrupt Reason checking " Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:55 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:55 ` [PATCH 06/40] ide-scsi: remove superfluous BUG_ON() from idescsi_transfer_pc() Bartlomiej Zolnierkiewicz
` (35 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:55 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
* Merge idescsi_input_buffers() and idescsi_output_buffers()
into ide_scsi_io_buffers() helper.
While at it:
* Log device name instead of driver name on error.
* Use xfer_func_t.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/scsi/ide-scsi.c | 81 ++++++++++++++----------------------------------
1 file changed, 24 insertions(+), 57 deletions(-)
Index: b/drivers/scsi/ide-scsi.c
===================================================================
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -129,51 +129,15 @@ static inline idescsi_scsi_t *drive_to_i
#define IDESCSI_PC_RQ 90
/*
- * PIO data transfer routines using the scatter gather table.
+ * PIO data transfer routine using the scatter gather table.
*/
-static void idescsi_input_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
- unsigned int bcount)
+static void ide_scsi_io_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
+ unsigned int bcount, int write)
{
ide_hwif_t *hwif = drive->hwif;
- int count;
+ xfer_func_t *xf = write ? hwif->output_data : hwif->input_data;
char *buf;
-
- while (bcount) {
- count = min(pc->sg->length - pc->b_count, bcount);
- if (PageHighMem(sg_page(pc->sg))) {
- unsigned long flags;
-
- local_irq_save(flags);
- buf = kmap_atomic(sg_page(pc->sg), KM_IRQ0) +
- pc->sg->offset;
- hwif->input_data(drive, NULL, buf + pc->b_count, count);
- kunmap_atomic(buf - pc->sg->offset, KM_IRQ0);
- local_irq_restore(flags);
- } else {
- buf = sg_virt(pc->sg);
- hwif->input_data(drive, NULL, buf + pc->b_count, count);
- }
- bcount -= count; pc->b_count += count;
- if (pc->b_count == pc->sg->length) {
- if (!--pc->sg_cnt)
- break;
- pc->sg = sg_next(pc->sg);
- pc->b_count = 0;
- }
- }
-
- if (bcount) {
- printk (KERN_ERR "ide-scsi: scatter gather table too small, discarding data\n");
- ide_pad_transfer(drive, 0, bcount);
- }
-}
-
-static void idescsi_output_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
- unsigned int bcount)
-{
- ide_hwif_t *hwif = drive->hwif;
int count;
- char *buf;
while (bcount) {
count = min(pc->sg->length - pc->b_count, bcount);
@@ -182,13 +146,13 @@ static void idescsi_output_buffers(ide_d
local_irq_save(flags);
buf = kmap_atomic(sg_page(pc->sg), KM_IRQ0) +
- pc->sg->offset;
- hwif->output_data(drive, NULL, buf + pc->b_count, count);
+ pc->sg->offset;
+ xf(drive, NULL, buf + pc->b_count, count);
kunmap_atomic(buf - pc->sg->offset, KM_IRQ0);
local_irq_restore(flags);
} else {
buf = sg_virt(pc->sg);
- hwif->output_data(drive, NULL, buf + pc->b_count, count);
+ xf(drive, NULL, buf + pc->b_count, count);
}
bcount -= count; pc->b_count += count;
if (pc->b_count == pc->sg->length) {
@@ -200,8 +164,10 @@ static void idescsi_output_buffers(ide_d
}
if (bcount) {
- printk (KERN_ERR "ide-scsi: scatter gather table too small, padding with zeros\n");
- ide_pad_transfer(drive, 1, bcount);
+ printk(KERN_ERR "%s: scatter gather table too small, %s\n",
+ drive->name, write ? "padding with zeros"
+ : "discarding data");
+ ide_pad_transfer(drive, write, bcount);
}
}
@@ -370,6 +336,7 @@ static ide_startstop_t idescsi_pc_intr (
ide_hwif_t *hwif = drive->hwif;
struct ide_atapi_pc *pc = scsi->pc;
struct request *rq = pc->rq;
+ xfer_func_t *xferfunc;
unsigned int temp;
u16 bcount;
u8 stat, ireason;
@@ -445,8 +412,8 @@ static ide_startstop_t idescsi_pc_intr (
temp = pc->buf_size - pc->xferred;
if (temp) {
if (pc->sg)
- idescsi_input_buffers(drive, pc,
- temp);
+ ide_scsi_io_buffers(drive, pc,
+ temp, 0);
else
hwif->input_data(drive, NULL,
pc->cur_pos, temp);
@@ -464,16 +431,16 @@ static ide_startstop_t idescsi_pc_intr (
printk (KERN_NOTICE "ide-scsi: The scsi wants to send us more data than expected - allowing transfer\n");
#endif /* IDESCSI_DEBUG_LOG */
}
- if (pc->sg)
- idescsi_input_buffers(drive, pc, bcount);
- else
- hwif->input_data(drive, NULL, pc->cur_pos, bcount);
- } else {
- if (pc->sg)
- idescsi_output_buffers(drive, pc, bcount);
- else
- hwif->output_data(drive, NULL, pc->cur_pos, bcount);
- }
+ xferfunc = hwif->input_data;
+ } else
+ xferfunc = hwif->output_data;
+
+ if (pc->sg)
+ ide_scsi_io_buffers(drive, pc, bcount,
+ !!(pc->flags & PC_FLAG_WRITING));
+ else
+ xferfunc(drive, NULL, pc->cur_pos, bcount);
+
/* Update the current position */
pc->xferred += bcount;
pc->cur_pos += bcount;
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 06/40] ide-scsi: remove superfluous BUG_ON() from idescsi_transfer_pc()
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (4 preceding siblings ...)
2008-05-18 18:55 ` [PATCH 05/40] ide-scsi: merge idescsi_input_buffers() and idescsi_output_buffers() Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:55 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:55 ` [PATCH 07/40] ide-scsi: add debug_log() macro Bartlomiej Zolnierkiewicz
` (34 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:55 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
ide_set_handler() bugs on ->handler == NULL so no need to do it
in idescsi_transfer_pc().
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/scsi/ide-scsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: b/drivers/scsi/ide-scsi.c
===================================================================
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -469,7 +469,7 @@ static ide_startstop_t idescsi_transfer_
"issuing a packet command\n");
return ide_do_reset (drive);
}
- BUG_ON(HWGROUP(drive)->handler != NULL);
+
/* Set the interrupt routine */
ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 07/40] ide-scsi: add debug_log() macro
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (5 preceding siblings ...)
2008-05-18 18:55 ` [PATCH 06/40] ide-scsi: remove superfluous BUG_ON() from idescsi_transfer_pc() Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:55 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:55 ` [PATCH 08/40] ide-tape: idetape_pc_intr() should use local_irq_enable_in_hardirq() Bartlomiej Zolnierkiewicz
` (33 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:55 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Add debug_log() macro and convert the driver to use it.
[ This makes debug messages to be always prefixed with "ide-scsi: "
and use KERN_INFO level. ]
While at it:
* Change "DMA complete" debug message to "DMA finished" to match
other ATAPI device drivers.
* Use __func__.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/scsi/ide-scsi.c | 51 +++++++++++++++++++++++-------------------------
1 file changed, 25 insertions(+), 26 deletions(-)
Index: b/drivers/scsi/ide-scsi.c
===================================================================
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -60,6 +60,13 @@
#define IDESCSI_DEBUG_LOG 0
+#if IDESCSI_DEBUG_LOG
+#define debug_log(fmt, args...) \
+ printk(KERN_INFO "ide-scsi: " fmt, ## args)
+#else
+#define debug_log(fmt, args...) do {} while (0)
+#endif
+
/*
* SCSI command transformation layer
*/
@@ -237,10 +244,9 @@ idescsi_atapi_error(ide_drive_t *drive,
static ide_startstop_t
idescsi_atapi_abort(ide_drive_t *drive, struct request *rq)
{
-#if IDESCSI_DEBUG_LOG
- printk(KERN_WARNING "idescsi_atapi_abort called for %lu\n",
+ debug_log("%s called for %lu\n", __func__,
((struct ide_atapi_pc *) rq->special)->scsi_cmd->serial_number);
-#endif
+
rq->errors |= ERROR_MAX;
idescsi_end_request(drive, 0, 0);
@@ -319,9 +325,9 @@ static int idescsi_expiry(ide_drive_t *d
idescsi_scsi_t *scsi = drive_to_idescsi(drive);
struct ide_atapi_pc *pc = scsi->pc;
-#if IDESCSI_DEBUG_LOG
- printk(KERN_WARNING "idescsi_expiry called for %lu at %lu\n", pc->scsi_cmd->serial_number, jiffies);
-#endif
+ debug_log("%s called for %lu at %lu\n", __func__,
+ pc->scsi_cmd->serial_number, jiffies);
+
pc->flags |= PC_FLAG_TIMEDOUT;
return 0; /* we do not want the ide subsystem to retry */
@@ -341,15 +347,11 @@ static ide_startstop_t idescsi_pc_intr (
u16 bcount;
u8 stat, ireason;
-#if IDESCSI_DEBUG_LOG
- printk (KERN_INFO "ide-scsi: Reached idescsi_pc_intr interrupt handler\n");
-#endif /* IDESCSI_DEBUG_LOG */
+ debug_log("Reached %s interrupt handler\n", __func__);
if (pc->flags & PC_FLAG_TIMEDOUT) {
-#if IDESCSI_DEBUG_LOG
- printk(KERN_WARNING "idescsi_pc_intr: got timed out packet %lu at %lu\n",
- pc->scsi_cmd->serial_number, jiffies);
-#endif
+ debug_log("%s: got timed out packet %lu at %lu\n", __func__,
+ pc->scsi_cmd->serial_number, jiffies);
/* end this request now - scsi should retry it*/
idescsi_end_request (drive, 1, 0);
return ide_stopped;
@@ -359,9 +361,7 @@ static ide_startstop_t idescsi_pc_intr (
pc->flags |= PC_FLAG_DMA_ERROR;
else
pc->xferred = pc->req_xfer;
-#if IDESCSI_DEBUG_LOG
- printk ("ide-scsi: %s: DMA complete\n", drive->name);
-#endif /* IDESCSI_DEBUG_LOG */
+ debug_log("%s: DMA finished\n", drive->name);
}
/* Clear the interrupt */
@@ -427,9 +427,8 @@ static ide_startstop_t idescsi_pc_intr (
ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
return ide_started;
}
-#if IDESCSI_DEBUG_LOG
- printk (KERN_NOTICE "ide-scsi: The scsi wants to send us more data than expected - allowing transfer\n");
-#endif /* IDESCSI_DEBUG_LOG */
+ debug_log("The scsi wants to send us more data than "
+ "expected - allowing transfer\n");
}
xferfunc = hwif->input_data;
} else
@@ -566,10 +565,10 @@ static ide_startstop_t idescsi_issue_pc(
*/
static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *rq, sector_t block)
{
-#if IDESCSI_DEBUG_LOG
- printk (KERN_INFO "dev: %s, cmd: %x, errors: %d\n", rq->rq_disk->disk_name,rq->cmd[0],rq->errors);
- printk (KERN_INFO "sector: %ld, nr_sectors: %ld, current_nr_sectors: %d\n",rq->sector,rq->nr_sectors,rq->current_nr_sectors);
-#endif /* IDESCSI_DEBUG_LOG */
+ debug_log("dev: %s, cmd: %x, errors: %d\n", rq->rq_disk->disk_name,
+ rq->cmd[0], rq->errors);
+ debug_log("sector: %ld, nr_sectors: %ld, current_nr_sectors: %d\n",
+ rq->sector, rq->nr_sectors, rq->current_nr_sectors);
if (blk_sense_request(rq) || blk_special_request(rq)) {
return idescsi_issue_pc(drive,
@@ -976,10 +975,10 @@ static int ide_scsi_probe(ide_drive_t *d
host->max_id = 1;
-#if IDESCSI_DEBUG_LOG
if (drive->id->last_lun)
- printk(KERN_NOTICE "%s: id->last_lun=%u\n", drive->name, drive->id->last_lun);
-#endif
+ debug_log("%s: id->last_lun=%u\n", drive->name,
+ drive->id->last_lun);
+
if ((drive->id->last_lun & 0x7) != 7)
host->max_lun = (drive->id->last_lun & 0x7) + 1;
else
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 08/40] ide-tape: idetape_pc_intr() should use local_irq_enable_in_hardirq()
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (6 preceding siblings ...)
2008-05-18 18:55 ` [PATCH 07/40] ide-scsi: add debug_log() macro Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:55 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:55 ` [PATCH 09/40] ide-tape: remove superfluous error message from idetape_pc_intr() Bartlomiej Zolnierkiewicz
` (32 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:55 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-tape.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -794,7 +794,7 @@ static ide_startstop_t idetape_pc_intr(i
" transferred\n", pc->xferred);
pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
- local_irq_enable();
+ local_irq_enable_in_hardirq();
#if SIMULATE_ERRORS
if ((pc->c[0] == WRITE_6 || pc->c[0] == READ_6) &&
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 09/40] ide-tape: remove superfluous error message from idetape_pc_intr()
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (7 preceding siblings ...)
2008-05-18 18:55 ` [PATCH 08/40] ide-tape: idetape_pc_intr() should use local_irq_enable_in_hardirq() Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:55 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:55 ` [PATCH 10/40] ide-tape: remove superfluous warning message from idetape_issue_pc() Bartlomiej Zolnierkiewicz
` (31 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:55 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
ide_dma_off() prints info about DMA being disabled.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-tape.c | 1 -
1 file changed, 1 deletion(-)
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -842,7 +842,6 @@ static ide_startstop_t idetape_pc_intr(i
pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
printk(KERN_ERR "ide-tape: The tape wants to issue more "
"interrupts in DMA mode\n");
- printk(KERN_ERR "ide-tape: DMA disabled, reverting to PIO\n");
ide_dma_off(drive);
return ide_do_reset(drive);
}
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 10/40] ide-tape: remove superfluous warning message from idetape_issue_pc()
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (8 preceding siblings ...)
2008-05-18 18:55 ` [PATCH 09/40] ide-tape: remove superfluous error message from idetape_pc_intr() Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:55 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:56 ` [PATCH 11/40] ide-tape: remove unneeded CONFIG_BLK_DEV_IDEDMA ifdef Bartlomiej Zolnierkiewicz
` (30 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:55 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
ide_dma_off() prints info about DMA being disabled.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-tape.c | 2 --
1 file changed, 2 deletions(-)
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -1038,8 +1038,6 @@ static ide_startstop_t idetape_issue_pc(
if (pc->flags & PC_FLAG_DMA_ERROR) {
pc->flags &= ~PC_FLAG_DMA_ERROR;
- printk(KERN_WARNING "ide-tape: DMA disabled, "
- "reverting to PIO\n");
ide_dma_off(drive);
}
if ((pc->flags & PC_FLAG_DMA_RECOMMENDED) && drive->using_dma)
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 11/40] ide-tape: remove unneeded CONFIG_BLK_DEV_IDEDMA ifdef
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (9 preceding siblings ...)
2008-05-18 18:55 ` [PATCH 10/40] ide-tape: remove superfluous warning message from idetape_issue_pc() Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:56 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:56 ` [PATCH 12/40] ide-tape: remove stale comments from idetape_pc_intr() Bartlomiej Zolnierkiewicz
` (29 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:56 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
PC_FLAG_DMA_IN_PROGRESS flag is never set if DMA support is disabled.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-tape.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -973,11 +973,11 @@ static ide_startstop_t idetape_transfer_
}
/* Set the interrupt routine */
ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL);
-#ifdef CONFIG_BLK_DEV_IDEDMA
+
/* Begin DMA, if necessary */
if (pc->flags & PC_FLAG_DMA_IN_PROGRESS)
hwif->dma_ops->dma_start(drive);
-#endif
+
/* Send the actual packet */
hwif->output_data(drive, NULL, pc->c, 12);
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 12/40] ide-tape: remove stale comments from idetape_pc_intr()
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (10 preceding siblings ...)
2008-05-18 18:56 ` [PATCH 11/40] ide-tape: remove unneeded CONFIG_BLK_DEV_IDEDMA ifdef Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:56 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:56 ` [PATCH 13/40] ide-tape: remove SIMULATE_ERRORS debug code Bartlomiej Zolnierkiewicz
` (28 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:56 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-tape.c | 21 ---------------------
1 file changed, 21 deletions(-)
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -758,27 +758,6 @@ static ide_startstop_t idetape_pc_intr(i
if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
if (hwif->dma_ops->dma_end(drive) || (stat & ERR_STAT)) {
- /*
- * A DMA error is sometimes expected. For example,
- * if the tape is crossing a filemark during a
- * READ command, it will issue an irq and position
- * itself before the filemark, so that only a partial
- * data transfer will occur (which causes the DMA
- * error). In that case, we will later ask the tape
- * how much bytes of the original request were
- * actually transferred (we can't receive that
- * information from the DMA engine on most chipsets).
- */
-
- /*
- * On the contrary, a DMA error is never expected;
- * it usually indicates a hardware error or abort.
- * If the tape crosses a filemark during a READ
- * command, it will issue an irq and position itself
- * after the filemark (not before). Only a partial
- * data transfer will occur, but no DMA error.
- * (AS, 19 Apr 2001)
- */
pc->flags |= PC_FLAG_DMA_ERROR;
} else {
pc->xferred = pc->req_xfer;
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 13/40] ide-tape: remove SIMULATE_ERRORS debug code
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (11 preceding siblings ...)
2008-05-18 18:56 ` [PATCH 12/40] ide-tape: remove stale comments from idetape_pc_intr() Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:56 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:56 ` [PATCH 14/40] ide-floppy: merge idefloppy_transfer_pc() and idefloppy_transfer_pc1() Bartlomiej Zolnierkiewicz
` (27 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:56 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-tape.c | 14 --------------
1 file changed, 14 deletions(-)
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -144,9 +144,6 @@ enum {
/*************************** End of tunable parameters ***********************/
-/* Read/Write error simulation */
-#define SIMULATE_ERRORS 0
-
/* tape directions */
enum {
IDETAPE_DIR_NONE = (1 << 0),
@@ -745,9 +742,6 @@ static ide_startstop_t idetape_pc_intr(i
xfer_func_t *xferfunc;
idetape_io_buf *iobuf;
unsigned int temp;
-#if SIMULATE_ERRORS
- static int error_sim_count;
-#endif
u16 bcount;
u8 stat, ireason;
@@ -775,14 +769,6 @@ static ide_startstop_t idetape_pc_intr(i
pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
local_irq_enable_in_hardirq();
-#if SIMULATE_ERRORS
- if ((pc->c[0] == WRITE_6 || pc->c[0] == READ_6) &&
- (++error_sim_count % 100) == 0) {
- printk(KERN_INFO "ide-tape: %s: simulating error\n",
- tape->name);
- stat |= ERR_STAT;
- }
-#endif
if ((stat & ERR_STAT) && pc->c[0] == REQUEST_SENSE)
stat &= ~ERR_STAT;
if ((stat & ERR_STAT) || (pc->flags & PC_FLAG_DMA_ERROR)) {
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 14/40] ide-floppy: merge idefloppy_transfer_pc() and idefloppy_transfer_pc1()
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (12 preceding siblings ...)
2008-05-18 18:56 ` [PATCH 13/40] ide-tape: remove SIMULATE_ERRORS debug code Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:56 ` Bartlomiej Zolnierkiewicz
2008-05-21 5:24 ` Borislav Petkov
2008-05-18 18:56 ` [PATCH 15/40] ide-{floppy,tape,scsi}: log device name instead of driver name Bartlomiej Zolnierkiewicz
` (26 subsequent siblings)
40 siblings, 1 reply; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:56 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
* Check IDEFLOPPY_FLAG_ZIP_DRIVE flag in idefloppy_transfer_pc1()
and skip idefloppy_transfer_pc2()-phase if the flag is not set.
* Always use idefloppy_transfer_pc1() in idefloppy_issue_pc()
and remove no longer needed idefloppy_transfer_pc().
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-floppy.c | 65 ++++++++++++-----------------------------------
1 file changed, 17 insertions(+), 48 deletions(-)
Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -522,40 +522,6 @@ static ide_startstop_t idefloppy_pc_intr
}
/*
- * This is the original routine that did the packet transfer.
- * It fails at high speeds on the Iomega ZIP drive, so there's a slower version
- * for that drive below. The algorithm is chosen based on drive type
- */
-static ide_startstop_t idefloppy_transfer_pc(ide_drive_t *drive)
-{
- ide_hwif_t *hwif = drive->hwif;
- ide_startstop_t startstop;
- idefloppy_floppy_t *floppy = drive->driver_data;
- u8 ireason;
-
- if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
- printk(KERN_ERR "ide-floppy: Strange, packet command "
- "initiated yet DRQ isn't asserted\n");
- return startstop;
- }
- ireason = hwif->INB(hwif->io_ports.nsect_addr);
- if ((ireason & CD) == 0 || (ireason & IO)) {
- printk(KERN_ERR "ide-floppy: (IO,CoD) != (0,1) while "
- "issuing a packet command\n");
- return ide_do_reset(drive);
- }
-
- /* Set the interrupt routine */
- ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL);
-
- /* Send the actual packet */
- hwif->output_data(drive, NULL, floppy->pc->c, 12);
-
- return ide_started;
-}
-
-
-/*
* What we have here is a classic case of a top half / bottom half interrupt
* service routine. In interrupt mode, the device sends an interrupt to signal
* that it is ready to receive a packet. However, we need to delay about 2-3
@@ -580,6 +546,8 @@ static ide_startstop_t idefloppy_transfe
{
ide_hwif_t *hwif = drive->hwif;
idefloppy_floppy_t *floppy = drive->driver_data;
+ ide_expiry_t *expiry;
+ unsigned int timeout;
ide_startstop_t startstop;
u8 ireason;
@@ -602,9 +570,20 @@ static ide_startstop_t idefloppy_transfe
* 40 and 50msec work well. idefloppy_pc_intr will not be actually
* used until after the packet is moved in about 50 msec.
*/
+ if (floppy->flags & IDEFLOPPY_FLAG_ZIP_DRIVE) {
+ timeout = floppy->ticks;
+ expiry = &idefloppy_transfer_pc2;
+ } else {
+ timeout = IDEFLOPPY_WAIT_CMD;
+ expiry = NULL;
+ }
+
+ ide_set_handler(drive, &idefloppy_pc_intr, timeout, expiry);
+
+ if ((floppy->flags & IDEFLOPPY_FLAG_ZIP_DRIVE) == 0)
+ /* Send the actual packet */
+ hwif->output_data(drive, NULL, floppy->pc->c, 12);
- ide_set_handler(drive, &idefloppy_pc_intr, floppy->ticks,
- &idefloppy_transfer_pc2);
return ide_started;
}
@@ -629,7 +608,6 @@ static ide_startstop_t idefloppy_issue_p
{
idefloppy_floppy_t *floppy = drive->driver_data;
ide_hwif_t *hwif = drive->hwif;
- ide_handler_t *pkt_xfer_routine;
u16 bcount;
u8 dma;
@@ -675,26 +653,17 @@ static ide_startstop_t idefloppy_issue_p
hwif->dma_ops->dma_start(drive);
}
- /* Can we transfer the packet when we get the interrupt or wait? */
- if (floppy->flags & IDEFLOPPY_FLAG_ZIP_DRIVE) {
- /* wait */
- pkt_xfer_routine = &idefloppy_transfer_pc1;
- } else {
- /* immediate */
- pkt_xfer_routine = &idefloppy_transfer_pc;
- }
-
if (floppy->flags & IDEFLOPPY_FLAG_DRQ_INTERRUPT) {
/* Issue the packet command */
ide_execute_command(drive, WIN_PACKETCMD,
- pkt_xfer_routine,
+ &idefloppy_transfer_pc1,
IDEFLOPPY_WAIT_CMD,
NULL);
return ide_started;
} else {
/* Issue the packet command */
ide_execute_pkt_cmd(drive);
- return (*pkt_xfer_routine) (drive);
+ return idefloppy_transfer_pc1(drive);
}
}
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 15/40] ide-{floppy,tape,scsi}: log device name instead of driver name
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (13 preceding siblings ...)
2008-05-18 18:56 ` [PATCH 14/40] ide-floppy: merge idefloppy_transfer_pc() and idefloppy_transfer_pc1() Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:56 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:56 ` [PATCH 16/40] ide-tape: make idetape_retry_pc() void Bartlomiej Zolnierkiewicz
` (25 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:56 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Log device name instead of driver name in *_pc_intr() and *_transfer_pc*().
While at it:
* Merge two consecutive printk()-s in *_pc_intr() together.
* Replace "floppy"/"tape"/"scsi" references in printk()-s by "device".
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-floppy.c | 35 ++++++++++++++++++-----------------
drivers/ide/ide-tape.c | 42 ++++++++++++++++++++++--------------------
drivers/scsi/ide-scsi.c | 24 +++++++++++++-----------
3 files changed, 53 insertions(+), 48 deletions(-)
Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -438,8 +438,8 @@ static ide_startstop_t idefloppy_pc_intr
debug_log("%s: I/O error\n", drive->name);
rq->errors++;
if (pc->c[0] == GPCMD_REQUEST_SENSE) {
- printk(KERN_ERR "ide-floppy: I/O error in "
- "request sense command\n");
+ printk(KERN_ERR "%s: I/O error in request sense"
+ " command\n", drive->name);
return ide_do_reset(drive);
}
/* Retry operation */
@@ -457,8 +457,8 @@ static ide_startstop_t idefloppy_pc_intr
if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
- printk(KERN_ERR "ide-floppy: The floppy wants to issue "
- "more interrupts in DMA mode\n");
+ printk(KERN_ERR "%s: The device wants to issue more interrupts "
+ "in DMA mode\n", drive->name);
ide_dma_off(drive);
return ide_do_reset(drive);
}
@@ -470,14 +470,14 @@ static ide_startstop_t idefloppy_pc_intr
ireason = hwif->INB(hwif->io_ports.nsect_addr);
if (ireason & CD) {
- printk(KERN_ERR "ide-floppy: CoD != 0 in %s\n", __func__);
+ printk(KERN_ERR "%s: CoD != 0 in %s\n", drive->name, __func__);
return ide_do_reset(drive);
}
if (((ireason & IO) == IO) == !!(pc->flags & PC_FLAG_WRITING)) {
/* Hopefully, we will never get here */
- printk(KERN_ERR "ide-floppy: We wanted to %s, ",
- (ireason & IO) ? "Write" : "Read");
- printk(KERN_ERR "but the floppy wants us to %s !\n",
+ printk(KERN_ERR "%s: We wanted to %s, but the device wants us "
+ "to %s!\n", drive->name,
+ (ireason & IO) ? "Write" : "Read",
(ireason & IO) ? "Read" : "Write");
return ide_do_reset(drive);
}
@@ -486,9 +486,10 @@ static ide_startstop_t idefloppy_pc_intr
temp = pc->xferred + bcount;
if (temp > pc->req_xfer) {
if (temp > pc->buf_size) {
- printk(KERN_ERR "ide-floppy: The floppy wants "
- "to send us more data than expected "
- "- discarding data\n");
+ printk(KERN_ERR "%s: The device wants to send "
+ "us more data than expected - "
+ "discarding data\n",
+ drive->name);
ide_pad_transfer(drive, 0, bcount);
ide_set_handler(drive,
@@ -497,8 +498,8 @@ static ide_startstop_t idefloppy_pc_intr
NULL);
return ide_started;
}
- debug_log("The floppy wants to send us more data than"
- " expected - allowing transfer\n");
+ debug_log("The device wants to send us more data than "
+ "expected - allowing transfer\n");
}
}
if (pc->flags & PC_FLAG_WRITING)
@@ -552,14 +553,14 @@ static ide_startstop_t idefloppy_transfe
u8 ireason;
if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
- printk(KERN_ERR "ide-floppy: Strange, packet command "
- "initiated yet DRQ isn't asserted\n");
+ printk(KERN_ERR "%s: Strange, packet command initiated yet "
+ "DRQ isn't asserted\n", drive->name);
return startstop;
}
ireason = hwif->INB(hwif->io_ports.nsect_addr);
if ((ireason & CD) == 0 || (ireason & IO)) {
- printk(KERN_ERR "ide-floppy: (IO,CoD) != (0,1) "
- "while issuing a packet command\n");
+ printk(KERN_ERR "%s: (IO,CoD) != (0,1) while issuing "
+ "a packet command\n", drive->name);
return ide_do_reset(drive);
}
/*
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -776,8 +776,8 @@ static ide_startstop_t idetape_pc_intr(i
debug_log(DBG_ERR, "%s: I/O error\n", tape->name);
if (pc->c[0] == REQUEST_SENSE) {
- printk(KERN_ERR "ide-tape: I/O error in request"
- " sense command\n");
+ printk(KERN_ERR "%s: I/O error in request sense"
+ " command\n", drive->name);
return ide_do_reset(drive);
}
debug_log(DBG_ERR, "[cmd %x]: check condition\n",
@@ -805,8 +805,8 @@ static ide_startstop_t idetape_pc_intr(i
if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
- printk(KERN_ERR "ide-tape: The tape wants to issue more "
- "interrupts in DMA mode\n");
+ printk(KERN_ERR "%s: The device wants to issue more interrupts "
+ "in DMA mode\n", drive->name);
ide_dma_off(drive);
return ide_do_reset(drive);
}
@@ -817,14 +817,14 @@ static ide_startstop_t idetape_pc_intr(i
ireason = hwif->INB(hwif->io_ports.nsect_addr);
if (ireason & CD) {
- printk(KERN_ERR "ide-tape: CoD != 0 in %s\n", __func__);
+ printk(KERN_ERR "%s: CoD != 0 in %s\n", drive->name, __func__);
return ide_do_reset(drive);
}
if (((ireason & IO) == IO) == !!(pc->flags & PC_FLAG_WRITING)) {
/* Hopefully, we will never get here */
- printk(KERN_ERR "ide-tape: We wanted to %s, ",
- (ireason & IO) ? "Write" : "Read");
- printk(KERN_ERR "ide-tape: but the tape wants us to %s !\n",
+ printk(KERN_ERR "%s: We wanted to %s, but the device wants us "
+ "to %s!\n", drive->name,
+ (ireason & IO) ? "Write" : "Read",
(ireason & IO) ? "Read" : "Write");
return ide_do_reset(drive);
}
@@ -833,15 +833,16 @@ static ide_startstop_t idetape_pc_intr(i
temp = pc->xferred + bcount;
if (temp > pc->req_xfer) {
if (temp > pc->buf_size) {
- printk(KERN_ERR "ide-tape: The tape wants to "
- "send us more data than expected "
- "- discarding data\n");
+ printk(KERN_ERR "%s: The device wants to send "
+ "us more data than expected - "
+ "discarding data\n",
+ drive->name);
ide_pad_transfer(drive, 0, bcount);
ide_set_handler(drive, &idetape_pc_intr,
IDETAPE_WAIT_CMD, NULL);
return ide_started;
}
- debug_log(DBG_SENSE, "The tape wants to send us more "
+ debug_log(DBG_SENSE, "The device wants to send us more "
"data than expected - allowing transfer\n");
}
iobuf = &idetape_input_buffers;
@@ -914,26 +915,27 @@ static ide_startstop_t idetape_transfer_
u8 ireason;
if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
- printk(KERN_ERR "ide-tape: Strange, packet command initiated "
- "yet DRQ isn't asserted\n");
+ printk(KERN_ERR "%s: Strange, packet command initiated yet "
+ "DRQ isn't asserted\n", drive->name);
return startstop;
}
ireason = hwif->INB(hwif->io_ports.nsect_addr);
while (retries-- && ((ireason & CD) == 0 || (ireason & IO))) {
- printk(KERN_ERR "ide-tape: (IO,CoD != (0,1) while issuing "
- "a packet command, retrying\n");
+ printk(KERN_ERR "%s: (IO,CoD != (0,1) while issuing "
+ "a packet command, retrying\n", drive->name);
udelay(100);
ireason = hwif->INB(hwif->io_ports.nsect_addr);
if (retries == 0) {
- printk(KERN_ERR "ide-tape: (IO,CoD != (0,1) while "
- "issuing a packet command, ignoring\n");
+ printk(KERN_ERR "%s: (IO,CoD != (0,1) while issuing "
+ "a packet command, ignoring\n",
+ drive->name);
ireason |= CD;
ireason &= ~IO;
}
}
if ((ireason & CD) == 0 || (ireason & IO)) {
- printk(KERN_ERR "ide-tape: (IO,CoD) != (0,1) while issuing "
- "a packet command\n");
+ printk(KERN_ERR "%s: (IO,CoD) != (0,1) while issuing "
+ "a packet command\n", drive->name);
return ide_do_reset(drive);
}
/* Set the interrupt routine */
Index: b/drivers/scsi/ide-scsi.c
===================================================================
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -391,7 +391,7 @@ static ide_startstop_t idescsi_pc_intr (
ireason = hwif->INB(hwif->io_ports.nsect_addr);
if (ireason & CD) {
- printk(KERN_ERR "ide-scsi: CoD != 0 in idescsi_pc_intr\n");
+ printk(KERN_ERR "%s: CoD != 0 in %s\n", drive->name, __func__);
return ide_do_reset (drive);
}
if (((ireason & IO) == IO) == !!(pc->flags & PC_FLAG_WRITING)) {
@@ -406,9 +406,10 @@ static ide_startstop_t idescsi_pc_intr (
temp = pc->xferred + bcount;
if (temp > pc->req_xfer) {
if (temp > pc->buf_size) {
- printk(KERN_ERR "ide-scsi: The scsi wants to "
- "send us more data than expected "
- "- discarding data\n");
+ printk(KERN_ERR "%s: The device wants to send "
+ "us more data than expected - "
+ "discarding data\n",
+ drive->name);
temp = pc->buf_size - pc->xferred;
if (temp) {
if (pc->sg)
@@ -417,8 +418,9 @@ static ide_startstop_t idescsi_pc_intr (
else
hwif->input_data(drive, NULL,
pc->cur_pos, temp);
- printk(KERN_ERR "ide-scsi: transferred"
- " %d of %d bytes\n",
+ printk(KERN_ERR "%s: transferred %d of "
+ "%d bytes\n",
+ drive->name,
temp, bcount);
}
pc->xferred += temp;
@@ -427,7 +429,7 @@ static ide_startstop_t idescsi_pc_intr (
ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
return ide_started;
}
- debug_log("The scsi wants to send us more data than "
+ debug_log("The device wants to send us more data than "
"expected - allowing transfer\n");
}
xferfunc = hwif->input_data;
@@ -458,14 +460,14 @@ static ide_startstop_t idescsi_transfer_
u8 ireason;
if (ide_wait_stat(&startstop,drive,DRQ_STAT,BUSY_STAT,WAIT_READY)) {
- printk(KERN_ERR "ide-scsi: Strange, packet command "
- "initiated yet DRQ isn't asserted\n");
+ printk(KERN_ERR "%s: Strange, packet command initiated yet "
+ "DRQ isn't asserted\n", drive->name);
return startstop;
}
ireason = hwif->INB(hwif->io_ports.nsect_addr);
if ((ireason & CD) == 0 || (ireason & IO)) {
- printk(KERN_ERR "ide-scsi: (IO,CoD) != (0,1) while "
- "issuing a packet command\n");
+ printk(KERN_ERR "%s: (IO,CoD) != (0,1) while issuing "
+ "a packet command\n", drive->name);
return ide_do_reset (drive);
}
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 16/40] ide-tape: make idetape_retry_pc() void
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (14 preceding siblings ...)
2008-05-18 18:56 ` [PATCH 15/40] ide-{floppy,tape,scsi}: log device name instead of driver name Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:56 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:57 ` [PATCH 17/40] ide-tape: merge callbacks Bartlomiej Zolnierkiewicz
` (24 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:56 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
idetape_retry_pc() always returns ide_stopped so make it void.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-tape.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -696,7 +696,7 @@ static void idetape_queue_pc_head(ide_dr
* last packet command. We queue a request sense packet command in
* the head of the request list.
*/
-static ide_startstop_t idetape_retry_pc (ide_drive_t *drive)
+static void idetape_retry_pc(ide_drive_t *drive)
{
idetape_tape_t *tape = drive->driver_data;
struct ide_atapi_pc *pc;
@@ -708,7 +708,6 @@ static ide_startstop_t idetape_retry_pc
idetape_create_request_sense_cmd(pc);
set_bit(IDETAPE_FLAG_IGNORE_DSC, &tape->flags);
idetape_queue_pc_head(drive, pc, rq);
- return ide_stopped;
}
/*
@@ -784,7 +783,8 @@ static ide_startstop_t idetape_pc_intr(i
pc->c[0]);
/* Retry operation */
- return idetape_retry_pc(drive);
+ idetape_retry_pc(drive);
+ return ide_stopped;
}
pc->error = 0;
if ((pc->flags & PC_FLAG_WAIT_FOR_DSC) &&
@@ -1078,7 +1078,8 @@ static ide_startstop_t idetape_media_acc
printk(KERN_ERR "ide-tape: %s: I/O error, ",
tape->name);
/* Retry operation */
- return idetape_retry_pc(drive);
+ idetape_retry_pc(drive);
+ return ide_stopped;
}
pc->error = 0;
if (tape->failed_pc == pc)
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 17/40] ide-tape: merge callbacks
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (15 preceding siblings ...)
2008-05-18 18:56 ` [PATCH 16/40] ide-tape: make idetape_retry_pc() void Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:57 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:57 ` [PATCH 18/40] ide-tape: make pc->idetape_callback void Bartlomiej Zolnierkiewicz
` (23 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:57 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
The appropriate functionality of the callback is established through querying
the ATAPI packet command in pc->c[0].
While at it:
- add uptodate variable + leave just one idetape_end_request() call
- don't use HWGROUP() macro
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-tape.c | 168 ++++++++++++++++++-------------------------------
1 file changed, 64 insertions(+), 104 deletions(-)
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -503,18 +503,6 @@ static struct request *idetape_next_rq_s
return (&tape->rq_stack[tape->rq_stack_index++]);
}
-static void idetape_init_pc(struct ide_atapi_pc *pc)
-{
- memset(pc->c, 0, 12);
- pc->retries = 0;
- pc->flags = 0;
- pc->req_xfer = 0;
- pc->buf = pc->pc_buf;
- pc->buf_size = IDETAPE_PC_BUFFER_SIZE;
- pc->bh = NULL;
- pc->b_data = NULL;
-}
-
/*
* called on each failed packet command retry to analyze the request sense. We
* currently do not utilize this information.
@@ -631,30 +619,85 @@ static int idetape_end_request(ide_drive
return 0;
}
-static ide_startstop_t idetape_request_sense_callback(ide_drive_t *drive)
+static ide_startstop_t ide_tape_callback(ide_drive_t *drive)
{
idetape_tape_t *tape = drive->driver_data;
+ struct ide_atapi_pc *pc = tape->pc;
+ int uptodate = pc->error ? 0 : 1;
debug_log(DBG_PROCS, "Enter %s\n", __func__);
- if (!tape->pc->error) {
- idetape_analyze_error(drive, tape->pc->buf);
- idetape_end_request(drive, 1, 0);
- } else {
- printk(KERN_ERR "ide-tape: Error in REQUEST SENSE itself - "
- "Aborting request!\n");
- idetape_end_request(drive, 0, 0);
+ if (pc->c[0] == REQUEST_SENSE) {
+ if (uptodate)
+ idetape_analyze_error(drive, pc->buf);
+ else
+ printk(KERN_ERR "ide-tape: Error in REQUEST SENSE "
+ "itself - Aborting request!\n");
+ } else if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) {
+ struct request *rq = drive->hwif->hwgroup->rq;
+ int blocks = pc->xferred / tape->blk_size;
+
+ tape->avg_size += blocks * tape->blk_size;
+
+ if (time_after_eq(jiffies, tape->avg_time + HZ)) {
+ tape->avg_speed = tape->avg_size * HZ /
+ (jiffies - tape->avg_time) / 1024;
+ tape->avg_size = 0;
+ tape->avg_time = jiffies;
+ }
+
+ tape->first_frame += blocks;
+ rq->current_nr_sectors -= blocks;
+
+ if (pc->error)
+ uptodate = pc->error;
+ } else if (pc->c[0] == READ_POSITION && uptodate) {
+ u8 *readpos = tape->pc->buf;
+
+ debug_log(DBG_SENSE, "BOP - %s\n",
+ (readpos[0] & 0x80) ? "Yes" : "No");
+ debug_log(DBG_SENSE, "EOP - %s\n",
+ (readpos[0] & 0x40) ? "Yes" : "No");
+
+ if (readpos[0] & 0x4) {
+ printk(KERN_INFO "ide-tape: Block location is unknown"
+ "to the tape\n");
+ clear_bit(IDETAPE_FLAG_ADDRESS_VALID, &tape->flags);
+ uptodate = 0;
+ } else {
+ debug_log(DBG_SENSE, "Block Location - %u\n",
+ be32_to_cpu(*(u32 *)&readpos[4]));
+
+ tape->partition = readpos[1];
+ tape->first_frame = be32_to_cpu(*(u32 *)&readpos[4]);
+ set_bit(IDETAPE_FLAG_ADDRESS_VALID, &tape->flags);
+ }
}
+
+ idetape_end_request(drive, uptodate, 0);
+
return ide_stopped;
}
+static void idetape_init_pc(struct ide_atapi_pc *pc)
+{
+ memset(pc->c, 0, 12);
+ pc->retries = 0;
+ pc->flags = 0;
+ pc->req_xfer = 0;
+ pc->buf = pc->pc_buf;
+ pc->buf_size = IDETAPE_PC_BUFFER_SIZE;
+ pc->bh = NULL;
+ pc->b_data = NULL;
+ pc->idetape_callback = ide_tape_callback;
+}
+
static void idetape_create_request_sense_cmd(struct ide_atapi_pc *pc)
{
idetape_init_pc(pc);
pc->c[0] = REQUEST_SENSE;
pc->c[4] = 20;
pc->req_xfer = 20;
- pc->idetape_callback = &idetape_request_sense_callback;
}
static void idetape_init_rq(struct request *rq, u8 cmd)
@@ -1025,16 +1068,6 @@ static ide_startstop_t idetape_issue_pc(
}
}
-static ide_startstop_t idetape_pc_callback(ide_drive_t *drive)
-{
- idetape_tape_t *tape = drive->driver_data;
-
- debug_log(DBG_PROCS, "Enter %s\n", __func__);
-
- idetape_end_request(drive, tape->pc->error ? 0 : 1, 0);
- return ide_stopped;
-}
-
/* A mode sense command is used to "sense" tape parameters. */
static void idetape_create_mode_sense_cmd(struct ide_atapi_pc *pc, u8 page_code)
{
@@ -1060,7 +1093,6 @@ static void idetape_create_mode_sense_cm
pc->req_xfer = 24;
else
pc->req_xfer = 50;
- pc->idetape_callback = &idetape_pc_callback;
}
static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive)
@@ -1091,32 +1123,6 @@ static ide_startstop_t idetape_media_acc
return pc->idetape_callback(drive);
}
-static ide_startstop_t idetape_rw_callback(ide_drive_t *drive)
-{
- idetape_tape_t *tape = drive->driver_data;
- struct request *rq = HWGROUP(drive)->rq;
- int blocks = tape->pc->xferred / tape->blk_size;
-
- tape->avg_size += blocks * tape->blk_size;
-
- if (time_after_eq(jiffies, tape->avg_time + HZ)) {
- tape->avg_speed = tape->avg_size * HZ /
- (jiffies - tape->avg_time) / 1024;
- tape->avg_size = 0;
- tape->avg_time = jiffies;
- }
- debug_log(DBG_PROCS, "Enter %s\n", __func__);
-
- tape->first_frame += blocks;
- rq->current_nr_sectors -= blocks;
-
- if (!tape->pc->error)
- idetape_end_request(drive, 1, 0);
- else
- idetape_end_request(drive, tape->pc->error, 0);
- return ide_stopped;
-}
-
static void idetape_create_read_cmd(idetape_tape_t *tape,
struct ide_atapi_pc *pc,
unsigned int length, struct idetape_bh *bh)
@@ -1125,7 +1131,6 @@ static void idetape_create_read_cmd(idet
pc->c[0] = READ_6;
put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]);
pc->c[1] = 1;
- pc->idetape_callback = &idetape_rw_callback;
pc->bh = bh;
atomic_set(&bh->b_count, 0);
pc->buf = NULL;
@@ -1143,7 +1148,6 @@ static void idetape_create_write_cmd(ide
pc->c[0] = WRITE_6;
put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]);
pc->c[1] = 1;
- pc->idetape_callback = &idetape_rw_callback;
pc->flags |= PC_FLAG_WRITING;
pc->bh = bh;
pc->b_data = bh->b_data;
@@ -1412,40 +1416,6 @@ static void idetape_init_merge_buffer(id
}
}
-static ide_startstop_t idetape_read_position_callback(ide_drive_t *drive)
-{
- idetape_tape_t *tape = drive->driver_data;
- u8 *readpos = tape->pc->buf;
-
- debug_log(DBG_PROCS, "Enter %s\n", __func__);
-
- if (!tape->pc->error) {
- debug_log(DBG_SENSE, "BOP - %s\n",
- (readpos[0] & 0x80) ? "Yes" : "No");
- debug_log(DBG_SENSE, "EOP - %s\n",
- (readpos[0] & 0x40) ? "Yes" : "No");
-
- if (readpos[0] & 0x4) {
- printk(KERN_INFO "ide-tape: Block location is unknown"
- "to the tape\n");
- clear_bit(IDETAPE_FLAG_ADDRESS_VALID, &tape->flags);
- idetape_end_request(drive, 0, 0);
- } else {
- debug_log(DBG_SENSE, "Block Location - %u\n",
- be32_to_cpu(*(u32 *)&readpos[4]));
-
- tape->partition = readpos[1];
- tape->first_frame =
- be32_to_cpu(*(u32 *)&readpos[4]);
- set_bit(IDETAPE_FLAG_ADDRESS_VALID, &tape->flags);
- idetape_end_request(drive, 1, 0);
- }
- } else {
- idetape_end_request(drive, 0, 0);
- }
- return ide_stopped;
-}
-
/*
* Write a filemark if write_filemark=1. Flush the device buffers without
* writing a filemark otherwise.
@@ -1457,14 +1427,12 @@ static void idetape_create_write_filemar
pc->c[0] = WRITE_FILEMARKS;
pc->c[4] = write_filemark;
pc->flags |= PC_FLAG_WAIT_FOR_DSC;
- pc->idetape_callback = &idetape_pc_callback;
}
static void idetape_create_test_unit_ready_cmd(struct ide_atapi_pc *pc)
{
idetape_init_pc(pc);
pc->c[0] = TEST_UNIT_READY;
- pc->idetape_callback = &idetape_pc_callback;
}
/*
@@ -1502,7 +1470,6 @@ static void idetape_create_load_unload_c
pc->c[0] = START_STOP;
pc->c[4] = cmd;
pc->flags |= PC_FLAG_WAIT_FOR_DSC;
- pc->idetape_callback = &idetape_pc_callback;
}
static int idetape_wait_ready(ide_drive_t *drive, unsigned long timeout)
@@ -1554,7 +1521,6 @@ static void idetape_create_read_position
idetape_init_pc(pc);
pc->c[0] = READ_POSITION;
pc->req_xfer = 20;
- pc->idetape_callback = &idetape_read_position_callback;
}
static int idetape_read_position(ide_drive_t *drive)
@@ -1582,7 +1548,6 @@ static void idetape_create_locate_cmd(id
put_unaligned(cpu_to_be32(block), (unsigned int *) &pc->c[3]);
pc->c[8] = partition;
pc->flags |= PC_FLAG_WAIT_FOR_DSC;
- pc->idetape_callback = &idetape_pc_callback;
}
static int idetape_create_prevent_cmd(ide_drive_t *drive,
@@ -1597,7 +1562,6 @@ static int idetape_create_prevent_cmd(id
idetape_init_pc(pc);
pc->c[0] = ALLOW_MEDIUM_REMOVAL;
pc->c[4] = prevent;
- pc->idetape_callback = &idetape_pc_callback;
return 1;
}
@@ -1704,7 +1668,6 @@ static void idetape_create_inquiry_cmd(s
pc->c[0] = INQUIRY;
pc->c[4] = 254;
pc->req_xfer = 254;
- pc->idetape_callback = &idetape_pc_callback;
}
static void idetape_create_rewind_cmd(ide_drive_t *drive,
@@ -1713,7 +1676,6 @@ static void idetape_create_rewind_cmd(id
idetape_init_pc(pc);
pc->c[0] = REZERO_UNIT;
pc->flags |= PC_FLAG_WAIT_FOR_DSC;
- pc->idetape_callback = &idetape_pc_callback;
}
static void idetape_create_erase_cmd(struct ide_atapi_pc *pc)
@@ -1722,7 +1684,6 @@ static void idetape_create_erase_cmd(str
pc->c[0] = ERASE;
pc->c[1] = 1;
pc->flags |= PC_FLAG_WAIT_FOR_DSC;
- pc->idetape_callback = &idetape_pc_callback;
}
static void idetape_create_space_cmd(struct ide_atapi_pc *pc, int count, u8 cmd)
@@ -1732,7 +1693,6 @@ static void idetape_create_space_cmd(str
put_unaligned(cpu_to_be32(count), (unsigned int *) &pc->c[1]);
pc->c[1] = cmd;
pc->flags |= PC_FLAG_WAIT_FOR_DSC;
- pc->idetape_callback = &idetape_pc_callback;
}
/* Queue up a character device originated write request. */
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 18/40] ide-tape: make pc->idetape_callback void
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (16 preceding siblings ...)
2008-05-18 18:57 ` [PATCH 17/40] ide-tape: merge callbacks Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:57 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:57 ` [PATCH 19/40] ide-floppy: merge callbacks Bartlomiej Zolnierkiewicz
` (22 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:57 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-tape.c | 13 +++++++------
include/linux/ide.h | 2 +-
2 files changed, 8 insertions(+), 7 deletions(-)
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -619,7 +619,7 @@ static int idetape_end_request(ide_drive
return 0;
}
-static ide_startstop_t ide_tape_callback(ide_drive_t *drive)
+static void ide_tape_callback(ide_drive_t *drive)
{
idetape_tape_t *tape = drive->driver_data;
struct ide_atapi_pc *pc = tape->pc;
@@ -675,8 +675,6 @@ static ide_startstop_t ide_tape_callback
}
idetape_end_request(drive, uptodate, 0);
-
- return ide_stopped;
}
static void idetape_init_pc(struct ide_atapi_pc *pc)
@@ -843,7 +841,8 @@ static ide_startstop_t idetape_pc_intr(i
if (tape->failed_pc == pc)
tape->failed_pc = NULL;
/* Command finished - Call the callback function */
- return pc->idetape_callback(drive);
+ pc->idetape_callback(drive);
+ return ide_stopped;
}
if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
@@ -1035,7 +1034,8 @@ static ide_startstop_t idetape_issue_pc(
pc->error = IDETAPE_ERROR_GENERAL;
}
tape->failed_pc = NULL;
- return pc->idetape_callback(drive);
+ pc->idetape_callback(drive);
+ return ide_stopped;
}
debug_log(DBG_SENSE, "Retry #%d, cmd = %02X\n", pc->retries, pc->c[0]);
@@ -1120,7 +1120,8 @@ static ide_startstop_t idetape_media_acc
pc->error = IDETAPE_ERROR_GENERAL;
tape->failed_pc = NULL;
}
- return pc->idetape_callback(drive);
+ pc->idetape_callback(drive);
+ return ide_stopped;
}
static void idetape_create_read_cmd(idetape_tape_t *tape,
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -626,7 +626,7 @@ struct ide_atapi_pc {
*/
u8 pc_buf[256];
void (*idefloppy_callback) (ide_drive_t *);
- ide_startstop_t (*idetape_callback) (ide_drive_t *);
+ void (*idetape_callback) (ide_drive_t *);
/* idetape only */
struct idetape_bh *bh;
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 19/40] ide-floppy: merge callbacks
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (17 preceding siblings ...)
2008-05-18 18:57 ` [PATCH 18/40] ide-tape: make pc->idetape_callback void Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:57 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:57 ` [PATCH 20/40] ide-{floppy,tape}: merge pc->idefloppy_callback and pc->idetape_callback Bartlomiej Zolnierkiewicz
` (21 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:57 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
From: Borislav Petkov <petkovbb@gmail.com>
Subject: [PATCH] ide-floppy: merge callbacks
The appropriate functionality of the callback is established through querying
the ATAPI packet command in pc->c[0].
While at it, simplify if (floppy->failed_pc)-branch to be found in the original
idefloppy_request_sense_callback().
Bart:
- keep handling for blk_pc_request() requests unchanged + add FIXME
- add uptodate variable + leave just one idefloppy_end_request() call
- add newline to the debug message
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-floppy.c | 71 +++++++++++++++--------------------------------
1 file changed, 24 insertions(+), 47 deletions(-)
Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -312,50 +312,38 @@ static struct request *idefloppy_next_rq
return (&floppy->rq_stack[floppy->rq_stack_index++]);
}
-static void idefloppy_request_sense_callback(ide_drive_t *drive)
+static void ide_floppy_callback(ide_drive_t *drive)
{
idefloppy_floppy_t *floppy = drive->driver_data;
- u8 *buf = floppy->pc->buf;
+ struct ide_atapi_pc *pc = floppy->pc;
+ int uptodate = pc->error ? 0 : 1;
debug_log("Reached %s\n", __func__);
- if (!floppy->pc->error) {
- floppy->sense_key = buf[2] & 0x0F;
- floppy->asc = buf[12];
- floppy->ascq = buf[13];
- floppy->progress_indication = buf[15] & 0x80 ?
- (u16)get_unaligned((u16 *)&buf[16]) : 0x10000;
-
- if (floppy->failed_pc)
- debug_log("pc = %x, sense key = %x, asc = %x,"
- " ascq = %x\n",
- floppy->failed_pc->c[0],
- floppy->sense_key,
- floppy->asc,
- floppy->ascq);
- else
- debug_log("sense key = %x, asc = %x, ascq = %x\n",
- floppy->sense_key,
- floppy->asc,
- floppy->ascq);
+ if (pc->c[0] == GPCMD_READ_10 || pc->c[0] == GPCMD_WRITE_10 ||
+ (pc->rq && blk_pc_request(pc->rq)))
+ uptodate = 1; /* FIXME */
+ else if (pc->c[0] == GPCMD_REQUEST_SENSE) {
+ u8 *buf = floppy->pc->buf;
+
+ if (!pc->error) {
+ floppy->sense_key = buf[2] & 0x0F;
+ floppy->asc = buf[12];
+ floppy->ascq = buf[13];
+ floppy->progress_indication = buf[15] & 0x80 ?
+ (u16)get_unaligned((u16 *)&buf[16]) : 0x10000;
+ if (floppy->failed_pc)
+ debug_log("pc = %x, ", floppy->failed_pc->c[0]);
- idefloppy_end_request(drive, 1, 0);
- } else {
- printk(KERN_ERR "Error in REQUEST SENSE itself - Aborting"
- " request!\n");
- idefloppy_end_request(drive, 0, 0);
+ debug_log("sense key = %x, asc = %x, ascq = %x\n",
+ floppy->sense_key, floppy->asc, floppy->ascq);
+ } else
+ printk(KERN_ERR "Error in REQUEST SENSE itself - "
+ "Aborting request!\n");
}
-}
-/* General packet command callback function. */
-static void idefloppy_pc_callback(ide_drive_t *drive)
-{
- idefloppy_floppy_t *floppy = drive->driver_data;
-
- debug_log("Reached %s\n", __func__);
-
- idefloppy_end_request(drive, floppy->pc->error ? 0 : 1, 0);
+ idefloppy_end_request(drive, uptodate, 0);
}
static void idefloppy_init_pc(struct ide_atapi_pc *pc)
@@ -366,7 +354,7 @@ static void idefloppy_init_pc(struct ide
pc->req_xfer = 0;
pc->buf = pc->pc_buf;
pc->buf_size = IDEFLOPPY_PC_BUFFER_SIZE;
- pc->idefloppy_callback = &idefloppy_pc_callback;
+ pc->idefloppy_callback = &ide_floppy_callback;
}
static void idefloppy_create_request_sense_cmd(struct ide_atapi_pc *pc)
@@ -375,7 +363,6 @@ static void idefloppy_create_request_sen
pc->c[0] = GPCMD_REQUEST_SENSE;
pc->c[4] = 255;
pc->req_xfer = 18;
- pc->idefloppy_callback = &idefloppy_request_sense_callback;
}
/*
@@ -668,14 +655,6 @@ static ide_startstop_t idefloppy_issue_p
}
}
-static void idefloppy_rw_callback(ide_drive_t *drive)
-{
- debug_log("Reached %s\n", __func__);
-
- idefloppy_end_request(drive, 1, 0);
- return;
-}
-
static void idefloppy_create_prevent_cmd(struct ide_atapi_pc *pc, int prevent)
{
debug_log("creating prevent removal command, prevent = %d\n", prevent);
@@ -770,7 +749,6 @@ static void idefloppy_create_rw_cmd(idef
put_unaligned(cpu_to_be16(blocks), (unsigned short *)&pc->c[7]);
put_unaligned(cpu_to_be32(block), (unsigned int *) &pc->c[2]);
- pc->idefloppy_callback = &idefloppy_rw_callback;
pc->rq = rq;
pc->b_count = cmd == READ ? 0 : rq->bio->bi_size;
if (rq->cmd_flags & REQ_RW)
@@ -784,7 +762,6 @@ static void idefloppy_blockpc_cmd(ideflo
struct ide_atapi_pc *pc, struct request *rq)
{
idefloppy_init_pc(pc);
- pc->idefloppy_callback = &idefloppy_rw_callback;
memcpy(pc->c, rq->cmd, sizeof(pc->c));
pc->rq = rq;
pc->b_count = rq->data_len;
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 20/40] ide-{floppy,tape}: merge pc->idefloppy_callback and pc->idetape_callback
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (18 preceding siblings ...)
2008-05-18 18:57 ` [PATCH 19/40] ide-floppy: merge callbacks Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:57 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:57 ` [PATCH 21/40] ide-{floppy,tape}: PC_FLAG_DMA_RECOMMENDED -> PC_FLAG_DMA_OK Bartlomiej Zolnierkiewicz
` (20 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:57 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Merge pc->idefloppy_callback and pc->idetape_callback into pc->callback.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-floppy.c | 6 +++---
drivers/ide/ide-tape.c | 8 ++++----
include/linux/ide.h | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)
Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -354,7 +354,7 @@ static void idefloppy_init_pc(struct ide
pc->req_xfer = 0;
pc->buf = pc->pc_buf;
pc->buf_size = IDEFLOPPY_PC_BUFFER_SIZE;
- pc->idefloppy_callback = &ide_floppy_callback;
+ pc->callback = ide_floppy_callback;
}
static void idefloppy_create_request_sense_cmd(struct ide_atapi_pc *pc)
@@ -438,7 +438,7 @@ static ide_startstop_t idefloppy_pc_intr
if (floppy->failed_pc == pc)
floppy->failed_pc = NULL;
/* Command finished - Call the callback function */
- pc->idefloppy_callback(drive);
+ pc->callback(drive);
return ide_stopped;
}
@@ -612,7 +612,7 @@ static ide_startstop_t idefloppy_issue_p
pc->error = IDEFLOPPY_ERROR_GENERAL;
floppy->failed_pc = NULL;
- pc->idefloppy_callback(drive);
+ pc->callback(drive);
return ide_stopped;
}
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -687,7 +687,7 @@ static void idetape_init_pc(struct ide_a
pc->buf_size = IDETAPE_PC_BUFFER_SIZE;
pc->bh = NULL;
pc->b_data = NULL;
- pc->idetape_callback = ide_tape_callback;
+ pc->callback = ide_tape_callback;
}
static void idetape_create_request_sense_cmd(struct ide_atapi_pc *pc)
@@ -841,7 +841,7 @@ static ide_startstop_t idetape_pc_intr(i
if (tape->failed_pc == pc)
tape->failed_pc = NULL;
/* Command finished - Call the callback function */
- pc->idetape_callback(drive);
+ pc->callback(drive);
return ide_stopped;
}
@@ -1034,7 +1034,7 @@ static ide_startstop_t idetape_issue_pc(
pc->error = IDETAPE_ERROR_GENERAL;
}
tape->failed_pc = NULL;
- pc->idetape_callback(drive);
+ pc->callback(drive);
return ide_stopped;
}
debug_log(DBG_SENSE, "Retry #%d, cmd = %02X\n", pc->retries, pc->c[0]);
@@ -1120,7 +1120,7 @@ static ide_startstop_t idetape_media_acc
pc->error = IDETAPE_ERROR_GENERAL;
tape->failed_pc = NULL;
}
- pc->idetape_callback(drive);
+ pc->callback(drive);
return ide_stopped;
}
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -625,8 +625,8 @@ struct ide_atapi_pc {
* to change/removal later.
*/
u8 pc_buf[256];
- void (*idefloppy_callback) (ide_drive_t *);
- void (*idetape_callback) (ide_drive_t *);
+
+ void (*callback)(ide_drive_t *);
/* idetape only */
struct idetape_bh *bh;
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 21/40] ide-{floppy,tape}: PC_FLAG_DMA_RECOMMENDED -> PC_FLAG_DMA_OK
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (19 preceding siblings ...)
2008-05-18 18:57 ` [PATCH 20/40] ide-{floppy,tape}: merge pc->idefloppy_callback and pc->idetape_callback Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:57 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:57 ` [PATCH 22/40] ide-floppy: start DMA engine in idefloppy_transfer_pc1() Bartlomiej Zolnierkiewicz
` (19 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:57 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
* Use PC_FLAG_DMA_OK flag instead of PC_FLAG_DMA_RECOMMENDED one.
* Remove no longer used PC_FLAG_DMA_RECOMMENDED flag.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-floppy.c | 6 +++---
drivers/ide/ide-tape.c | 6 +++---
include/linux/ide.h | 9 ++++-----
3 files changed, 10 insertions(+), 11 deletions(-)
Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -630,7 +630,7 @@ static ide_startstop_t idefloppy_issue_p
}
dma = 0;
- if ((pc->flags & PC_FLAG_DMA_RECOMMENDED) && drive->using_dma)
+ if ((pc->flags & PC_FLAG_DMA_OK) && drive->using_dma)
dma = !hwif->dma_ops->dma_setup(drive);
ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_DEVICE, bcount, dma);
@@ -755,7 +755,7 @@ static void idefloppy_create_rw_cmd(idef
pc->flags |= PC_FLAG_WRITING;
pc->buf = NULL;
pc->req_xfer = pc->buf_size = blocks * floppy->block_size;
- pc->flags |= PC_FLAG_DMA_RECOMMENDED;
+ pc->flags |= PC_FLAG_DMA_OK;
}
static void idefloppy_blockpc_cmd(idefloppy_floppy_t *floppy,
@@ -769,7 +769,7 @@ static void idefloppy_blockpc_cmd(ideflo
pc->flags |= PC_FLAG_WRITING;
pc->buf = rq->data;
if (rq->bio)
- pc->flags |= PC_FLAG_DMA_RECOMMENDED;
+ pc->flags |= PC_FLAG_DMA_OK;
/*
* possibly problematic, doesn't look like ide-floppy correctly
* handled scattered requests if dma fails...
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -1050,7 +1050,7 @@ static ide_startstop_t idetape_issue_pc(
pc->flags &= ~PC_FLAG_DMA_ERROR;
ide_dma_off(drive);
}
- if ((pc->flags & PC_FLAG_DMA_RECOMMENDED) && drive->using_dma)
+ if ((pc->flags & PC_FLAG_DMA_OK) && drive->using_dma)
dma_ok = !hwif->dma_ops->dma_setup(drive);
ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_DEVICE, bcount, dma_ok);
@@ -1138,7 +1138,7 @@ static void idetape_create_read_cmd(idet
pc->buf_size = length * tape->blk_size;
pc->req_xfer = pc->buf_size;
if (pc->req_xfer == tape->buffer_size)
- pc->flags |= PC_FLAG_DMA_RECOMMENDED;
+ pc->flags |= PC_FLAG_DMA_OK;
}
static void idetape_create_write_cmd(idetape_tape_t *tape,
@@ -1157,7 +1157,7 @@ static void idetape_create_write_cmd(ide
pc->buf_size = length * tape->blk_size;
pc->req_xfer = pc->buf_size;
if (pc->req_xfer == tape->buffer_size)
- pc->flags |= PC_FLAG_DMA_RECOMMENDED;
+ pc->flags |= PC_FLAG_DMA_OK;
}
static ide_startstop_t idetape_do_request(ide_drive_t *drive,
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -587,12 +587,11 @@ enum {
PC_FLAG_SUPPRESS_ERROR = (1 << 1),
PC_FLAG_WAIT_FOR_DSC = (1 << 2),
PC_FLAG_DMA_OK = (1 << 3),
- PC_FLAG_DMA_RECOMMENDED = (1 << 4),
- PC_FLAG_DMA_IN_PROGRESS = (1 << 5),
- PC_FLAG_DMA_ERROR = (1 << 6),
- PC_FLAG_WRITING = (1 << 7),
+ PC_FLAG_DMA_IN_PROGRESS = (1 << 4),
+ PC_FLAG_DMA_ERROR = (1 << 5),
+ PC_FLAG_WRITING = (1 << 6),
/* command timed out */
- PC_FLAG_TIMEDOUT = (1 << 8),
+ PC_FLAG_TIMEDOUT = (1 << 7),
};
struct ide_atapi_pc {
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 22/40] ide-floppy: start DMA engine in idefloppy_transfer_pc1()
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (20 preceding siblings ...)
2008-05-18 18:57 ` [PATCH 21/40] ide-{floppy,tape}: PC_FLAG_DMA_RECOMMENDED -> PC_FLAG_DMA_OK Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:57 ` Bartlomiej Zolnierkiewicz
2008-05-20 11:00 ` Sergei Shtylyov
2008-05-18 18:57 ` [PATCH 23/40] ide-tape: set PC_FLAG_DMA_IN_PROGRESS flag in idetape_transfer_pc() Bartlomiej Zolnierkiewicz
` (18 subsequent siblings)
40 siblings, 1 reply; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:57 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Start DMA engine and set PC_FLAG_DMA_IN_PROGRESS flag in
idefloppy_transfer_pc1() instead of idefloppy_issue_pc()
so the Status Register and the Interrupt Reason Register
are checked first.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-floppy.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -534,6 +534,7 @@ static ide_startstop_t idefloppy_transfe
{
ide_hwif_t *hwif = drive->hwif;
idefloppy_floppy_t *floppy = drive->driver_data;
+ struct ide_atapi_pc *pc = floppy->pc;
ide_expiry_t *expiry;
unsigned int timeout;
ide_startstop_t startstop;
@@ -568,6 +569,12 @@ static ide_startstop_t idefloppy_transfe
ide_set_handler(drive, &idefloppy_pc_intr, timeout, expiry);
+ /* Begin DMA, if necessary */
+ if (pc->flags & PC_FLAG_DMA_OK) {
+ pc->flags |= PC_FLAG_DMA_IN_PROGRESS;
+ hwif->dma_ops->dma_start(drive);
+ }
+
if ((floppy->flags & IDEFLOPPY_FLAG_ZIP_DRIVE) == 0)
/* Send the actual packet */
hwif->output_data(drive, NULL, floppy->pc->c, 12);
@@ -633,13 +640,10 @@ static ide_startstop_t idefloppy_issue_p
if ((pc->flags & PC_FLAG_DMA_OK) && drive->using_dma)
dma = !hwif->dma_ops->dma_setup(drive);
- ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_DEVICE, bcount, dma);
+ if (!dma)
+ pc->flags &= ~PC_FLAG_DMA_OK;
- if (dma) {
- /* Begin DMA, if necessary */
- pc->flags |= PC_FLAG_DMA_IN_PROGRESS;
- hwif->dma_ops->dma_start(drive);
- }
+ ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_DEVICE, bcount, dma);
if (floppy->flags & IDEFLOPPY_FLAG_DRQ_INTERRUPT) {
/* Issue the packet command */
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 23/40] ide-tape: set PC_FLAG_DMA_IN_PROGRESS flag in idetape_transfer_pc()
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (21 preceding siblings ...)
2008-05-18 18:57 ` [PATCH 22/40] ide-floppy: start DMA engine in idefloppy_transfer_pc1() Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:57 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:58 ` [PATCH 24/40] ide-tape: factor out waiting for good ireason from idetape_transfer_pc() Bartlomiej Zolnierkiewicz
` (17 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:57 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Set PC_FLAG_DMA_IN_PROGRESS flag in idetape_transfer_pc() instead of
idetape_issue_pc() to match the other ATAPI device drivers.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-tape.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -984,8 +984,10 @@ static ide_startstop_t idetape_transfer_
ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL);
/* Begin DMA, if necessary */
- if (pc->flags & PC_FLAG_DMA_IN_PROGRESS)
+ if (pc->flags & PC_FLAG_DMA_OK) {
+ pc->flags |= PC_FLAG_DMA_IN_PROGRESS;
hwif->dma_ops->dma_start(drive);
+ }
/* Send the actual packet */
hwif->output_data(drive, NULL, pc->c, 12);
@@ -1053,11 +1055,11 @@ static ide_startstop_t idetape_issue_pc(
if ((pc->flags & PC_FLAG_DMA_OK) && drive->using_dma)
dma_ok = !hwif->dma_ops->dma_setup(drive);
+ if (!dma_ok)
+ pc->flags &= ~PC_FLAG_DMA_OK;
+
ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_DEVICE, bcount, dma_ok);
- if (dma_ok)
- /* Will begin DMA later */
- pc->flags |= PC_FLAG_DMA_IN_PROGRESS;
if (test_bit(IDETAPE_FLAG_DRQ_INTERRUPT, &tape->flags)) {
ide_execute_command(drive, WIN_PACKETCMD, &idetape_transfer_pc,
IDETAPE_WAIT_CMD, NULL);
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 24/40] ide-tape: factor out waiting for good ireason from idetape_transfer_pc()
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (22 preceding siblings ...)
2008-05-18 18:57 ` [PATCH 23/40] ide-tape: set PC_FLAG_DMA_IN_PROGRESS flag in idetape_transfer_pc() Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:58 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:58 ` [PATCH 25/40] ide: add PC_FLAG_ZIP_DRIVE pc flag Bartlomiej Zolnierkiewicz
` (16 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:58 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Factor out waiting for good ireason from idetape_transfer_pc()
to ide_tape_wait_ireason() as a preparation for adding generic
ide_transfer_pc() helper.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-tape.c | 34 +++++++++++++++++++++++-----------
1 file changed, 23 insertions(+), 11 deletions(-)
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -947,21 +947,12 @@ static ide_startstop_t idetape_pc_intr(i
* again, the callback function will be called and then we will handle the next
* request.
*/
-static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive)
+
+static u8 ide_tape_wait_ireason(ide_drive_t *drive, u8 ireason)
{
ide_hwif_t *hwif = drive->hwif;
- idetape_tape_t *tape = drive->driver_data;
- struct ide_atapi_pc *pc = tape->pc;
int retries = 100;
- ide_startstop_t startstop;
- u8 ireason;
- if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
- printk(KERN_ERR "%s: Strange, packet command initiated yet "
- "DRQ isn't asserted\n", drive->name);
- return startstop;
- }
- ireason = hwif->INB(hwif->io_ports.nsect_addr);
while (retries-- && ((ireason & CD) == 0 || (ireason & IO))) {
printk(KERN_ERR "%s: (IO,CoD != (0,1) while issuing "
"a packet command, retrying\n", drive->name);
@@ -975,6 +966,27 @@ static ide_startstop_t idetape_transfer_
ireason &= ~IO;
}
}
+
+ return ireason;
+}
+
+static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive)
+{
+ ide_hwif_t *hwif = drive->hwif;
+ idetape_tape_t *tape = drive->driver_data;
+ struct ide_atapi_pc *pc = tape->pc;
+ ide_startstop_t startstop;
+ u8 ireason;
+
+ if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
+ printk(KERN_ERR "%s: Strange, packet command initiated yet "
+ "DRQ isn't asserted\n", drive->name);
+ return startstop;
+ }
+
+ ireason = hwif->INB(hwif->io_ports.nsect_addr);
+ ireason = ide_tape_wait_ireason(drive, ireason);
+
if ((ireason & CD) == 0 || (ireason & IO)) {
printk(KERN_ERR "%s: (IO,CoD) != (0,1) while issuing "
"a packet command\n", drive->name);
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 25/40] ide: add PC_FLAG_ZIP_DRIVE pc flag
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (23 preceding siblings ...)
2008-05-18 18:58 ` [PATCH 24/40] ide-tape: factor out waiting for good ireason from idetape_transfer_pc() Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:58 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:58 ` [PATCH 26/40] ide-{cd,floppy,tape}: remove checking for drive->scsi Bartlomiej Zolnierkiewicz
` (15 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:58 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Add PC_FLAG_ZIP_DRIVE pc flag, set it in idefloppy_do_request()
and check for it (instead of checking for IDEFLOPPY_FLAG_ZIP_DRIVE)
in idefloppy_transfer_pc(). This is a preparation for adding
generic ide_transfer_pc() helper.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-floppy.c | 8 ++++++--
include/linux/ide.h | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -559,7 +559,7 @@ static ide_startstop_t idefloppy_transfe
* 40 and 50msec work well. idefloppy_pc_intr will not be actually
* used until after the packet is moved in about 50 msec.
*/
- if (floppy->flags & IDEFLOPPY_FLAG_ZIP_DRIVE) {
+ if (pc->flags & PC_FLAG_ZIP_DRIVE) {
timeout = floppy->ticks;
expiry = &idefloppy_transfer_pc2;
} else {
@@ -575,7 +575,7 @@ static ide_startstop_t idefloppy_transfe
hwif->dma_ops->dma_start(drive);
}
- if ((floppy->flags & IDEFLOPPY_FLAG_ZIP_DRIVE) == 0)
+ if ((pc->flags & PC_FLAG_ZIP_DRIVE) == 0)
/* Send the actual packet */
hwif->output_data(drive, NULL, floppy->pc->c, 12);
@@ -826,7 +826,11 @@ static ide_startstop_t idefloppy_do_requ
return ide_stopped;
}
+ if (floppy->flags & IDEFLOPPY_FLAG_ZIP_DRIVE)
+ pc->flags |= PC_FLAG_ZIP_DRIVE;
+
pc->rq = rq;
+
return idefloppy_issue_pc(drive, pc);
}
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -592,6 +592,7 @@ enum {
PC_FLAG_WRITING = (1 << 6),
/* command timed out */
PC_FLAG_TIMEDOUT = (1 << 7),
+ PC_FLAG_ZIP_DRIVE = (1 << 8),
};
struct ide_atapi_pc {
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 26/40] ide-{cd,floppy,tape}: remove checking for drive->scsi
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (24 preceding siblings ...)
2008-05-18 18:58 ` [PATCH 25/40] ide: add PC_FLAG_ZIP_DRIVE pc flag Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:58 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:58 ` [PATCH 27/40] ide-scsi: set drive->scsi flag for devices handled by the driver Bartlomiej Zolnierkiewicz
` (14 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:58 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Remove checking for drive->scsi which is no longer set by IDE core code
(leave the flag since it will be re-used for generic ATAPI support).
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-cd.c | 5 -----
drivers/ide/ide-floppy.c | 5 -----
drivers/ide/ide-tape.c | 5 -----
3 files changed, 15 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -2106,11 +2106,6 @@ static int ide_cd_probe(ide_drive_t *dri
goto failed;
}
}
- if (drive->scsi) {
- printk(KERN_INFO "ide-cd: passing drive %s to ide-scsi "
- "emulation.\n", drive->name);
- goto failed;
- }
info = kzalloc(sizeof(struct cdrom_info), GFP_KERNEL);
if (info == NULL) {
printk(KERN_ERR "%s: Can't allocate a cdrom structure\n",
Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -1579,11 +1579,6 @@ static int ide_floppy_probe(ide_drive_t
" of ide-floppy\n", drive->name);
goto failed;
}
- if (drive->scsi) {
- printk(KERN_INFO "ide-floppy: passing drive %s to ide-scsi"
- " emulation.\n", drive->name);
- goto failed;
- }
floppy = kzalloc(sizeof(idefloppy_floppy_t), GFP_KERNEL);
if (!floppy) {
printk(KERN_ERR "ide-floppy: %s: Can't allocate a floppy"
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -2850,11 +2850,6 @@ static int ide_tape_probe(ide_drive_t *d
" the driver\n", drive->name);
goto failed;
}
- if (drive->scsi) {
- printk(KERN_INFO "ide-tape: passing drive %s to ide-scsi"
- " emulation.\n", drive->name);
- goto failed;
- }
tape = kzalloc(sizeof(idetape_tape_t), GFP_KERNEL);
if (tape == NULL) {
printk(KERN_ERR "ide-tape: %s: Can't allocate a tape struct\n",
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 27/40] ide-scsi: set drive->scsi flag for devices handled by the driver
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (25 preceding siblings ...)
2008-05-18 18:58 ` [PATCH 26/40] ide-{cd,floppy,tape}: remove checking for drive->scsi Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:58 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:58 ` [PATCH 28/40] ide: add ide_transfer_pc() helper Bartlomiej Zolnierkiewicz
` (13 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:58 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
This is a preparation for adding generic ide_transfer_pc() helper.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/scsi/ide-scsi.c | 5 +++++
1 file changed, 5 insertions(+)
Index: b/drivers/scsi/ide-scsi.c
===================================================================
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -629,6 +629,8 @@ static void ide_scsi_remove(ide_drive_t
put_disk(g);
ide_scsi_put(scsi);
+
+ drive->scsi = 0;
}
static int ide_scsi_probe(ide_drive_t *);
@@ -969,6 +971,8 @@ static int ide_scsi_probe(ide_drive_t *d
!(host = scsi_host_alloc(&idescsi_template,sizeof(idescsi_scsi_t))))
return -ENODEV;
+ drive->scsi = 1;
+
g = alloc_disk(1 << PARTN_BITS);
if (!g)
goto out_host_put;
@@ -1009,6 +1013,7 @@ static int ide_scsi_probe(ide_drive_t *d
put_disk(g);
out_host_put:
+ drive->scsi = 0;
scsi_host_put(host);
return err;
}
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 28/40] ide: add ide_transfer_pc() helper
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (26 preceding siblings ...)
2008-05-18 18:58 ` [PATCH 27/40] ide-scsi: set drive->scsi flag for devices handled by the driver Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:58 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:58 ` [PATCH 29/40] ide-scsi: move idescsi_map_sg() call out from idescsi_issue_pc() Bartlomiej Zolnierkiewicz
` (12 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:58 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
* Add ide-atapi.c file for generic ATAPI support together with
CONFIG_IDE_ATAPI config option.
* Add generic ide_transfer_pc() helper to ide-atapi.c and then
convert ide-{floppy,tape,scsi} device drivers to use it.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/Kconfig | 6 ++++
drivers/ide/Makefile | 1
drivers/ide/ide-atapi.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++
drivers/ide/ide-floppy.c | 28 ------------------
drivers/ide/ide-tape.c | 56 +------------------------------------
drivers/scsi/ide-scsi.c | 30 +-------------------
include/linux/ide.h | 3 ++
7 files changed, 85 insertions(+), 109 deletions(-)
Index: b/drivers/ide/Kconfig
===================================================================
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -98,6 +98,9 @@ if BLK_DEV_IDE
comment "Please see Documentation/ide/ide.txt for help/info on IDE drives"
+config IDE_ATAPI
+ bool
+
config BLK_DEV_IDE_SATA
bool "Support for SATA (deprecated; conflicts with libata SATA driver)"
default n
@@ -201,6 +204,7 @@ config BLK_DEV_IDECD_VERBOSE_ERRORS
config BLK_DEV_IDETAPE
tristate "Include IDE/ATAPI TAPE support"
+ select IDE_ATAPI
help
If you have an IDE tape drive using the ATAPI protocol, say Y.
ATAPI is a newer protocol used by IDE tape and CD-ROM drives,
@@ -223,6 +227,7 @@ config BLK_DEV_IDETAPE
config BLK_DEV_IDEFLOPPY
tristate "Include IDE/ATAPI FLOPPY support"
+ select IDE_ATAPI
---help---
If you have an IDE floppy drive which uses the ATAPI protocol,
answer Y. ATAPI is a newer protocol used by IDE CD-ROM/tape/floppy
@@ -246,6 +251,7 @@ config BLK_DEV_IDEFLOPPY
config BLK_DEV_IDESCSI
tristate "SCSI emulation support"
depends on SCSI
+ select IDE_ATAPI
---help---
WARNING: ide-scsi is no longer needed for cd writing applications!
The 2.6 kernel supports direct writing to ide-cd, which eliminates
Index: b/drivers/ide/Makefile
===================================================================
--- a/drivers/ide/Makefile
+++ b/drivers/ide/Makefile
@@ -14,6 +14,7 @@ EXTRA_CFLAGS += -Idrivers/ide
ide-core-y += ide.o ide-io.o ide-iops.o ide-lib.o ide-probe.o ide-taskfile.o
# core IDE code
+ide-core-$(CONFIG_IDE_ATAPI) += ide-atapi.o
ide-core-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o
ide-core-$(CONFIG_BLK_DEV_IDEDMA) += ide-dma.o
ide-core-$(CONFIG_IDE_PROC_FS) += ide-proc.o
Index: b/drivers/ide/ide-atapi.c
===================================================================
--- /dev/null
+++ b/drivers/ide/ide-atapi.c
@@ -0,0 +1,70 @@
+/*
+ * ATAPI support.
+ */
+
+#include <linux/kernel.h>
+#include <linux/delay.h>
+#include <linux/ide.h>
+
+static u8 ide_wait_ireason(ide_drive_t *drive, u8 ireason)
+{
+ ide_hwif_t *hwif = drive->hwif;
+ int retries = 100;
+
+ while (retries-- && ((ireason & CD) == 0 || (ireason & IO))) {
+ printk(KERN_ERR "%s: (IO,CoD != (0,1) while issuing "
+ "a packet command, retrying\n", drive->name);
+ udelay(100);
+ ireason = hwif->INB(hwif->io_ports.nsect_addr);
+ if (retries == 0) {
+ printk(KERN_ERR "%s: (IO,CoD != (0,1) while issuing "
+ "a packet command, ignoring\n",
+ drive->name);
+ ireason |= CD;
+ ireason &= ~IO;
+ }
+ }
+
+ return ireason;
+}
+
+ide_startstop_t ide_transfer_pc(ide_drive_t *drive, struct ide_atapi_pc *pc,
+ ide_handler_t *handler, unsigned int timeout,
+ ide_expiry_t *expiry)
+{
+ ide_hwif_t *hwif = drive->hwif;
+ ide_startstop_t startstop;
+ u8 ireason;
+
+ if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
+ printk(KERN_ERR "%s: Strange, packet command initiated yet "
+ "DRQ isn't asserted\n", drive->name);
+ return startstop;
+ }
+
+ ireason = hwif->INB(hwif->io_ports.nsect_addr);
+ if (drive->media == ide_tape && !drive->scsi)
+ ireason = ide_wait_ireason(drive, ireason);
+
+ if ((ireason & CD) == 0 || (ireason & IO)) {
+ printk(KERN_ERR "%s: (IO,CoD) != (0,1) while issuing "
+ "a packet command\n", drive->name);
+ return ide_do_reset(drive);
+ }
+
+ /* Set the interrupt routine */
+ ide_set_handler(drive, handler, timeout, expiry);
+
+ /* Begin DMA, if necessary */
+ if (pc->flags & PC_FLAG_DMA_OK) {
+ pc->flags |= PC_FLAG_DMA_IN_PROGRESS;
+ hwif->dma_ops->dma_start(drive);
+ }
+
+ /* Send the actual packet */
+ if ((pc->flags & PC_FLAG_ZIP_DRIVE) == 0)
+ hwif->output_data(drive, NULL, pc->c, 12);
+
+ return ide_started;
+}
+EXPORT_SYMBOL_GPL(ide_transfer_pc);
Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -532,25 +532,11 @@ static int idefloppy_transfer_pc2(ide_dr
static ide_startstop_t idefloppy_transfer_pc1(ide_drive_t *drive)
{
- ide_hwif_t *hwif = drive->hwif;
idefloppy_floppy_t *floppy = drive->driver_data;
struct ide_atapi_pc *pc = floppy->pc;
ide_expiry_t *expiry;
unsigned int timeout;
- ide_startstop_t startstop;
- u8 ireason;
- if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
- printk(KERN_ERR "%s: Strange, packet command initiated yet "
- "DRQ isn't asserted\n", drive->name);
- return startstop;
- }
- ireason = hwif->INB(hwif->io_ports.nsect_addr);
- if ((ireason & CD) == 0 || (ireason & IO)) {
- printk(KERN_ERR "%s: (IO,CoD) != (0,1) while issuing "
- "a packet command\n", drive->name);
- return ide_do_reset(drive);
- }
/*
* The following delay solves a problem with ATAPI Zip 100 drives
* where the Busy flag was apparently being deasserted before the
@@ -567,19 +553,7 @@ static ide_startstop_t idefloppy_transfe
expiry = NULL;
}
- ide_set_handler(drive, &idefloppy_pc_intr, timeout, expiry);
-
- /* Begin DMA, if necessary */
- if (pc->flags & PC_FLAG_DMA_OK) {
- pc->flags |= PC_FLAG_DMA_IN_PROGRESS;
- hwif->dma_ops->dma_start(drive);
- }
-
- if ((pc->flags & PC_FLAG_ZIP_DRIVE) == 0)
- /* Send the actual packet */
- hwif->output_data(drive, NULL, floppy->pc->c, 12);
-
- return ide_started;
+ return ide_transfer_pc(drive, pc, idefloppy_pc_intr, timeout, expiry);
}
static void ide_floppy_report_error(idefloppy_floppy_t *floppy,
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -947,64 +947,12 @@ static ide_startstop_t idetape_pc_intr(i
* again, the callback function will be called and then we will handle the next
* request.
*/
-
-static u8 ide_tape_wait_ireason(ide_drive_t *drive, u8 ireason)
-{
- ide_hwif_t *hwif = drive->hwif;
- int retries = 100;
-
- while (retries-- && ((ireason & CD) == 0 || (ireason & IO))) {
- printk(KERN_ERR "%s: (IO,CoD != (0,1) while issuing "
- "a packet command, retrying\n", drive->name);
- udelay(100);
- ireason = hwif->INB(hwif->io_ports.nsect_addr);
- if (retries == 0) {
- printk(KERN_ERR "%s: (IO,CoD != (0,1) while issuing "
- "a packet command, ignoring\n",
- drive->name);
- ireason |= CD;
- ireason &= ~IO;
- }
- }
-
- return ireason;
-}
-
static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive)
{
- ide_hwif_t *hwif = drive->hwif;
idetape_tape_t *tape = drive->driver_data;
- struct ide_atapi_pc *pc = tape->pc;
- ide_startstop_t startstop;
- u8 ireason;
-
- if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
- printk(KERN_ERR "%s: Strange, packet command initiated yet "
- "DRQ isn't asserted\n", drive->name);
- return startstop;
- }
-
- ireason = hwif->INB(hwif->io_ports.nsect_addr);
- ireason = ide_tape_wait_ireason(drive, ireason);
-
- if ((ireason & CD) == 0 || (ireason & IO)) {
- printk(KERN_ERR "%s: (IO,CoD) != (0,1) while issuing "
- "a packet command\n", drive->name);
- return ide_do_reset(drive);
- }
- /* Set the interrupt routine */
- ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL);
-
- /* Begin DMA, if necessary */
- if (pc->flags & PC_FLAG_DMA_OK) {
- pc->flags |= PC_FLAG_DMA_IN_PROGRESS;
- hwif->dma_ops->dma_start(drive);
- }
-
- /* Send the actual packet */
- hwif->output_data(drive, NULL, pc->c, 12);
- return ide_started;
+ return ide_transfer_pc(drive, tape->pc, idetape_pc_intr,
+ IDETAPE_WAIT_CMD, NULL);
}
static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
Index: b/drivers/scsi/ide-scsi.c
===================================================================
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -453,36 +453,10 @@ static ide_startstop_t idescsi_pc_intr (
static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive)
{
- ide_hwif_t *hwif = drive->hwif;
idescsi_scsi_t *scsi = drive_to_idescsi(drive);
- struct ide_atapi_pc *pc = scsi->pc;
- ide_startstop_t startstop;
- u8 ireason;
-
- if (ide_wait_stat(&startstop,drive,DRQ_STAT,BUSY_STAT,WAIT_READY)) {
- printk(KERN_ERR "%s: Strange, packet command initiated yet "
- "DRQ isn't asserted\n", drive->name);
- return startstop;
- }
- ireason = hwif->INB(hwif->io_ports.nsect_addr);
- if ((ireason & CD) == 0 || (ireason & IO)) {
- printk(KERN_ERR "%s: (IO,CoD) != (0,1) while issuing "
- "a packet command\n", drive->name);
- return ide_do_reset (drive);
- }
-
- /* Set the interrupt routine */
- ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
-
- if (pc->flags & PC_FLAG_DMA_OK) {
- pc->flags |= PC_FLAG_DMA_IN_PROGRESS;
- hwif->dma_ops->dma_start(drive);
- }
-
- /* Send the actual packet */
- hwif->output_data(drive, NULL, scsi->pc->c, 12);
- return ide_started;
+ return ide_transfer_pc(drive, scsi->pc, idescsi_pc_intr,
+ get_timeout(scsi->pc), idescsi_expiry);
}
static inline int idescsi_set_direction(struct ide_atapi_pc *pc)
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -952,6 +952,9 @@ extern int drive_is_ready(ide_drive_t *)
void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8);
+ide_startstop_t ide_transfer_pc(ide_drive_t *, struct ide_atapi_pc *,
+ ide_handler_t *, unsigned int, ide_expiry_t *);
+
ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *);
void task_end_request(ide_drive_t *, struct request *, u8);
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 29/40] ide-scsi: move idescsi_map_sg() call out from idescsi_issue_pc()
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (27 preceding siblings ...)
2008-05-18 18:58 ` [PATCH 28/40] ide: add ide_transfer_pc() helper Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:58 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:58 ` [PATCH 30/40] ide: add PC_FLAG_DRQ_INTERRUPT pc flag Bartlomiej Zolnierkiewicz
` (11 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:58 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Move idescsi_map_sg() call out from idescsi_issue_pc()
to idescsi_do_request() as a preparation to adding generic
ide_issue_pc() helper.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/scsi/ide-scsi.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
Index: b/drivers/scsi/ide-scsi.c
===================================================================
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -514,16 +514,16 @@ static ide_startstop_t idescsi_issue_pc(
/* Request to transfer the entire buffer at once */
bcount = min(pc->req_xfer, 63 * 1024);
- if (drive->using_dma && !idescsi_map_sg(drive, pc)) {
+ if ((pc->flags & PC_FLAG_DMA_OK) && drive->using_dma) {
hwif->sg_mapped = 1;
dma = !hwif->dma_ops->dma_setup(drive);
hwif->sg_mapped = 0;
}
- ide_pktcmd_tf_load(drive, 0, bcount, dma);
+ if (!dma)
+ pc->flags &= ~PC_FLAG_DMA_OK;
- if (dma)
- pc->flags |= PC_FLAG_DMA_OK;
+ ide_pktcmd_tf_load(drive, 0, bcount, dma);
if (test_bit(IDESCSI_DRQ_INTERRUPT, &scsi->flags)) {
ide_execute_command(drive, WIN_PACKETCMD, &idescsi_transfer_pc,
@@ -547,8 +547,12 @@ static ide_startstop_t idescsi_do_reques
rq->sector, rq->nr_sectors, rq->current_nr_sectors);
if (blk_sense_request(rq) || blk_special_request(rq)) {
- return idescsi_issue_pc(drive,
- (struct ide_atapi_pc *) rq->special);
+ struct ide_atapi_pc *pc = (struct ide_atapi_pc *)rq->special;
+
+ if (drive->using_dma && !idescsi_map_sg(drive, pc))
+ pc->flags |= PC_FLAG_DMA_OK;
+
+ return idescsi_issue_pc(drive, pc);
}
blk_dump_rq_flags(rq, "ide-scsi: unsup command");
idescsi_end_request (drive, 0, 0);
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 30/40] ide: add PC_FLAG_DRQ_INTERRUPT pc flag
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (28 preceding siblings ...)
2008-05-18 18:58 ` [PATCH 29/40] ide-scsi: move idescsi_map_sg() call out from idescsi_issue_pc() Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:58 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:59 ` [PATCH 31/40] ide: add ide_issue_pc() helper Bartlomiej Zolnierkiewicz
` (10 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:58 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Add PC_FLAG_DRQ_INTERRUPT pc flag, set it in ide*_do_request()
and check for it (instead of checking for IDE*_FLAG_DRQ_INTERRUPT)
in ide*_issue_pc(). This is a preparation for adding generic
ide_issue_pc() helper.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-floppy.c | 5 ++++-
drivers/ide/ide-tape.c | 11 ++++++++---
drivers/scsi/ide-scsi.c | 6 +++++-
include/linux/ide.h | 1 +
4 files changed, 18 insertions(+), 5 deletions(-)
Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -619,7 +619,7 @@ static ide_startstop_t idefloppy_issue_p
ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_DEVICE, bcount, dma);
- if (floppy->flags & IDEFLOPPY_FLAG_DRQ_INTERRUPT) {
+ if (pc->flags & PC_FLAG_DRQ_INTERRUPT) {
/* Issue the packet command */
ide_execute_command(drive, WIN_PACKETCMD,
&idefloppy_transfer_pc1,
@@ -800,6 +800,9 @@ static ide_startstop_t idefloppy_do_requ
return ide_stopped;
}
+ if (floppy->flags & IDEFLOPPY_FLAG_DRQ_INTERRUPT)
+ pc->flags |= PC_FLAG_DRQ_INTERRUPT;
+
if (floppy->flags & IDEFLOPPY_FLAG_ZIP_DRIVE)
pc->flags |= PC_FLAG_ZIP_DRIVE;
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -1020,7 +1020,7 @@ static ide_startstop_t idetape_issue_pc(
ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_DEVICE, bcount, dma_ok);
- if (test_bit(IDETAPE_FLAG_DRQ_INTERRUPT, &tape->flags)) {
+ if (pc->flags & PC_FLAG_DRQ_INTERRUPT) {
ide_execute_command(drive, WIN_PACKETCMD, &idetape_transfer_pc,
IDETAPE_WAIT_CMD, NULL);
return ide_started;
@@ -1143,8 +1143,10 @@ static ide_startstop_t idetape_do_reques
}
/* Retry a failed packet command */
- if (tape->failed_pc && tape->pc->c[0] == REQUEST_SENSE)
- return idetape_issue_pc(drive, tape->failed_pc);
+ if (tape->failed_pc && tape->pc->c[0] == REQUEST_SENSE) {
+ pc = tape->failed_pc;
+ goto out;
+ }
if (postponed_rq != NULL)
if (rq != postponed_rq) {
@@ -1216,6 +1218,9 @@ static ide_startstop_t idetape_do_reques
}
BUG();
out:
+ if (test_bit(IDETAPE_FLAG_DRQ_INTERRUPT, &tape->flags))
+ pc->flags |= PC_FLAG_DRQ_INTERRUPT;
+
return idetape_issue_pc(drive, pc);
}
Index: b/drivers/scsi/ide-scsi.c
===================================================================
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -525,7 +525,7 @@ static ide_startstop_t idescsi_issue_pc(
ide_pktcmd_tf_load(drive, 0, bcount, dma);
- if (test_bit(IDESCSI_DRQ_INTERRUPT, &scsi->flags)) {
+ if (pc->flags & PC_FLAG_DRQ_INTERRUPT) {
ide_execute_command(drive, WIN_PACKETCMD, &idescsi_transfer_pc,
get_timeout(pc), idescsi_expiry);
return ide_started;
@@ -548,6 +548,10 @@ static ide_startstop_t idescsi_do_reques
if (blk_sense_request(rq) || blk_special_request(rq)) {
struct ide_atapi_pc *pc = (struct ide_atapi_pc *)rq->special;
+ idescsi_scsi_t *scsi = drive_to_idescsi(drive);
+
+ if (test_bit(IDESCSI_DRQ_INTERRUPT, &scsi->flags))
+ pc->flags |= PC_FLAG_DRQ_INTERRUPT;
if (drive->using_dma && !idescsi_map_sg(drive, pc))
pc->flags |= PC_FLAG_DMA_OK;
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -593,6 +593,7 @@ enum {
/* command timed out */
PC_FLAG_TIMEDOUT = (1 << 7),
PC_FLAG_ZIP_DRIVE = (1 << 8),
+ PC_FLAG_DRQ_INTERRUPT = (1 << 9),
};
struct ide_atapi_pc {
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 31/40] ide: add ide_issue_pc() helper
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (29 preceding siblings ...)
2008-05-18 18:58 ` [PATCH 30/40] ide: add PC_FLAG_DRQ_INTERRUPT pc flag Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:59 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:59 ` [PATCH 32/40] ide-{floppy,tape}: move checking of ->failed_pc to ->callback Bartlomiej Zolnierkiewicz
` (9 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:59 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Add generic ide_issue_pc() helper to ide-atapi.c and then
convert ide-{floppy,tape,scsi} device drivers to use it.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-atapi.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++
drivers/ide/ide-floppy.c | 37 ++---------------------------------
drivers/ide/ide-tape.c | 32 ++----------------------------
drivers/scsi/ide-scsi.c | 32 ++----------------------------
include/linux/ide.h | 2 +
5 files changed, 60 insertions(+), 92 deletions(-)
Index: b/drivers/ide/ide-atapi.c
===================================================================
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -68,3 +68,52 @@ ide_startstop_t ide_transfer_pc(ide_driv
return ide_started;
}
EXPORT_SYMBOL_GPL(ide_transfer_pc);
+
+ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_atapi_pc *pc,
+ ide_handler_t *handler, unsigned int timeout,
+ ide_expiry_t *expiry)
+{
+ ide_hwif_t *hwif = drive->hwif;
+ u16 bcount;
+ u8 dma = 0;
+
+ /* We haven't transferred any data yet */
+ pc->xferred = 0;
+ pc->cur_pos = pc->buf;
+
+ /* Request to transfer the entire buffer at once */
+ if (drive->media == ide_tape && !drive->scsi)
+ bcount = pc->req_xfer;
+ else
+ bcount = min(pc->req_xfer, 63 * 1024);
+
+ if (pc->flags & PC_FLAG_DMA_ERROR) {
+ pc->flags &= ~PC_FLAG_DMA_ERROR;
+ ide_dma_off(drive);
+ }
+
+ if ((pc->flags & PC_FLAG_DMA_OK) && drive->using_dma) {
+ if (drive->scsi)
+ hwif->sg_mapped = 1;
+ dma = !hwif->dma_ops->dma_setup(drive);
+ if (drive->scsi)
+ hwif->sg_mapped = 0;
+ }
+
+ if (!dma)
+ pc->flags &= ~PC_FLAG_DMA_OK;
+
+ ide_pktcmd_tf_load(drive, drive->scsi ? 0 : IDE_TFLAG_OUT_DEVICE,
+ bcount, dma);
+
+ /* Issue the packet command */
+ if (pc->flags & PC_FLAG_DRQ_INTERRUPT) {
+ ide_execute_command(drive, WIN_PACKETCMD, handler,
+ timeout, NULL);
+ return ide_started;
+ } else {
+ ide_execute_pkt_cmd(drive);
+ return (*handler)(drive);
+ }
+}
+EXPORT_SYMBOL_GPL(ide_issue_pc);
Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -576,9 +576,6 @@ static ide_startstop_t idefloppy_issue_p
struct ide_atapi_pc *pc)
{
idefloppy_floppy_t *floppy = drive->driver_data;
- ide_hwif_t *hwif = drive->hwif;
- u16 bcount;
- u8 dma;
if (floppy->failed_pc == NULL &&
pc->c[0] != GPCMD_REQUEST_SENSE)
@@ -600,37 +597,9 @@ static ide_startstop_t idefloppy_issue_p
debug_log("Retry number - %d\n", pc->retries);
pc->retries++;
- /* We haven't transferred any data yet */
- pc->xferred = 0;
- pc->cur_pos = pc->buf;
- bcount = min(pc->req_xfer, 63 * 1024);
-
- if (pc->flags & PC_FLAG_DMA_ERROR) {
- pc->flags &= ~PC_FLAG_DMA_ERROR;
- ide_dma_off(drive);
- }
- dma = 0;
-
- if ((pc->flags & PC_FLAG_DMA_OK) && drive->using_dma)
- dma = !hwif->dma_ops->dma_setup(drive);
-
- if (!dma)
- pc->flags &= ~PC_FLAG_DMA_OK;
-
- ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_DEVICE, bcount, dma);
-
- if (pc->flags & PC_FLAG_DRQ_INTERRUPT) {
- /* Issue the packet command */
- ide_execute_command(drive, WIN_PACKETCMD,
- &idefloppy_transfer_pc1,
- IDEFLOPPY_WAIT_CMD,
- NULL);
- return ide_started;
- } else {
- /* Issue the packet command */
- ide_execute_pkt_cmd(drive);
- return idefloppy_transfer_pc1(drive);
- }
+
+ return ide_issue_pc(drive, pc, idefloppy_transfer_pc1,
+ IDEFLOPPY_WAIT_CMD, NULL);
}
static void idefloppy_create_prevent_cmd(struct ide_atapi_pc *pc, int prevent)
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -958,10 +958,7 @@ static ide_startstop_t idetape_transfer_
static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
struct ide_atapi_pc *pc)
{
- ide_hwif_t *hwif = drive->hwif;
idetape_tape_t *tape = drive->driver_data;
- int dma_ok = 0;
- u16 bcount;
if (tape->pc->c[0] == REQUEST_SENSE &&
pc->c[0] == REQUEST_SENSE) {
@@ -1002,32 +999,9 @@ static ide_startstop_t idetape_issue_pc(
debug_log(DBG_SENSE, "Retry #%d, cmd = %02X\n", pc->retries, pc->c[0]);
pc->retries++;
- /* We haven't transferred any data yet */
- pc->xferred = 0;
- pc->cur_pos = pc->buf;
- /* Request to transfer the entire buffer at once */
- bcount = pc->req_xfer;
-
- if (pc->flags & PC_FLAG_DMA_ERROR) {
- pc->flags &= ~PC_FLAG_DMA_ERROR;
- ide_dma_off(drive);
- }
- if ((pc->flags & PC_FLAG_DMA_OK) && drive->using_dma)
- dma_ok = !hwif->dma_ops->dma_setup(drive);
-
- if (!dma_ok)
- pc->flags &= ~PC_FLAG_DMA_OK;
-
- ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_DEVICE, bcount, dma_ok);
-
- if (pc->flags & PC_FLAG_DRQ_INTERRUPT) {
- ide_execute_command(drive, WIN_PACKETCMD, &idetape_transfer_pc,
- IDETAPE_WAIT_CMD, NULL);
- return ide_started;
- } else {
- ide_execute_pkt_cmd(drive);
- return idetape_transfer_pc(drive);
- }
+
+ return ide_issue_pc(drive, pc, idetape_transfer_pc,
+ IDETAPE_WAIT_CMD, NULL);
}
/* A mode sense command is used to "sense" tape parameters. */
Index: b/drivers/scsi/ide-scsi.c
===================================================================
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -502,38 +502,12 @@ static ide_startstop_t idescsi_issue_pc(
struct ide_atapi_pc *pc)
{
idescsi_scsi_t *scsi = drive_to_idescsi(drive);
- ide_hwif_t *hwif = drive->hwif;
- u16 bcount;
- u8 dma = 0;
/* Set the current packet command */
scsi->pc = pc;
- /* We haven't transferred any data yet */
- pc->xferred = 0;
- pc->cur_pos = pc->buf;
- /* Request to transfer the entire buffer at once */
- bcount = min(pc->req_xfer, 63 * 1024);
-
- if ((pc->flags & PC_FLAG_DMA_OK) && drive->using_dma) {
- hwif->sg_mapped = 1;
- dma = !hwif->dma_ops->dma_setup(drive);
- hwif->sg_mapped = 0;
- }
-
- if (!dma)
- pc->flags &= ~PC_FLAG_DMA_OK;
-
- ide_pktcmd_tf_load(drive, 0, bcount, dma);
-
- if (pc->flags & PC_FLAG_DRQ_INTERRUPT) {
- ide_execute_command(drive, WIN_PACKETCMD, &idescsi_transfer_pc,
- get_timeout(pc), idescsi_expiry);
- return ide_started;
- } else {
- /* Issue the packet command */
- ide_execute_pkt_cmd(drive);
- return idescsi_transfer_pc(drive);
- }
+
+ return ide_issue_pc(drive, pc, idescsi_transfer_pc,
+ get_timeout(pc), idescsi_expiry);
}
/*
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -955,6 +955,8 @@ void ide_pktcmd_tf_load(ide_drive_t *, u
ide_startstop_t ide_transfer_pc(ide_drive_t *, struct ide_atapi_pc *,
ide_handler_t *, unsigned int, ide_expiry_t *);
+ide_startstop_t ide_issue_pc(ide_drive_t *, struct ide_atapi_pc *,
+ ide_handler_t *, unsigned int, ide_expiry_t *);
ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *);
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 32/40] ide-{floppy,tape}: move checking of ->failed_pc to ->callback
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (30 preceding siblings ...)
2008-05-18 18:59 ` [PATCH 31/40] ide: add ide_issue_pc() helper Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:59 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:59 ` [PATCH 33/40] ide-tape: factor out DSC handling from idetape_pc_intr() Bartlomiej Zolnierkiewicz
` (8 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:59 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Move checking/resetting of ->failed_pc from ide*_pc_intr() to ->callback
as a preparation for adding generic ide_pc_intr() helper.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>---
---
drivers/ide/ide-floppy.c | 5 +++--
drivers/ide/ide-tape.c | 7 +++----
2 files changed, 6 insertions(+), 6 deletions(-)
Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -320,6 +320,9 @@ static void ide_floppy_callback(ide_driv
debug_log("Reached %s\n", __func__);
+ if (floppy->failed_pc == pc)
+ floppy->failed_pc = NULL;
+
if (pc->c[0] == GPCMD_READ_10 || pc->c[0] == GPCMD_WRITE_10 ||
(pc->rq && blk_pc_request(pc->rq)))
uptodate = 1; /* FIXME */
@@ -435,8 +438,6 @@ static ide_startstop_t idefloppy_pc_intr
return ide_stopped;
}
pc->error = 0;
- if (floppy->failed_pc == pc)
- floppy->failed_pc = NULL;
/* Command finished - Call the callback function */
pc->callback(drive);
return ide_stopped;
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -627,6 +627,9 @@ static void ide_tape_callback(ide_drive_
debug_log(DBG_PROCS, "Enter %s\n", __func__);
+ if (tape->failed_pc == pc)
+ tape->failed_pc = NULL;
+
if (pc->c[0] == REQUEST_SENSE) {
if (uptodate)
idetape_analyze_error(drive, pc->buf);
@@ -838,8 +841,6 @@ static ide_startstop_t idetape_pc_intr(i
idetape_postpone_request(drive);
return ide_stopped;
}
- if (tape->failed_pc == pc)
- tape->failed_pc = NULL;
/* Command finished - Call the callback function */
pc->callback(drive);
return ide_stopped;
@@ -1050,8 +1051,6 @@ static ide_startstop_t idetape_media_acc
return ide_stopped;
}
pc->error = 0;
- if (tape->failed_pc == pc)
- tape->failed_pc = NULL;
} else {
pc->error = IDETAPE_ERROR_GENERAL;
tape->failed_pc = NULL;
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 33/40] ide-tape: factor out DSC handling from idetape_pc_intr()
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (31 preceding siblings ...)
2008-05-18 18:59 ` [PATCH 32/40] ide-{floppy,tape}: move checking of ->failed_pc to ->callback Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:59 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:59 ` [PATCH 34/40] ide-tape: add ide_tape_io_buffers() helper Bartlomiej Zolnierkiewicz
` (7 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:59 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Factor out DSC handling from idetape_pc_intr() to ide_tape_handle_dsc()
helper as a preparation for adding generic ide_pc_intr() helper.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-tape.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -768,6 +768,18 @@ static void idetape_postpone_request(ide
ide_stall_queue(drive, tape->dsc_poll_freq);
}
+static void ide_tape_handle_dsc(ide_drive_t *drive)
+{
+ idetape_tape_t *tape = drive->driver_data;
+
+ /* Media access command */
+ tape->dsc_polling_start = jiffies;
+ tape->dsc_poll_freq = IDETAPE_DSC_MA_FAST;
+ tape->dsc_timeout = jiffies + IDETAPE_DSC_MA_TIMEOUT;
+ /* Allow ide.c to handle other requests */
+ idetape_postpone_request(drive);
+}
+
typedef void idetape_io_buf(ide_drive_t *, struct ide_atapi_pc *, unsigned int);
/*
@@ -833,12 +845,7 @@ static ide_startstop_t idetape_pc_intr(i
pc->error = 0;
if ((pc->flags & PC_FLAG_WAIT_FOR_DSC) &&
(stat & SEEK_STAT) == 0) {
- /* Media access command */
- tape->dsc_polling_start = jiffies;
- tape->dsc_poll_freq = IDETAPE_DSC_MA_FAST;
- tape->dsc_timeout = jiffies + IDETAPE_DSC_MA_TIMEOUT;
- /* Allow ide.c to handle other requests */
- idetape_postpone_request(drive);
+ ide_tape_handle_dsc(drive);
return ide_stopped;
}
/* Command finished - Call the callback function */
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 34/40] ide-tape: add ide_tape_io_buffers() helper
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (32 preceding siblings ...)
2008-05-18 18:59 ` [PATCH 33/40] ide-tape: factor out DSC handling from idetape_pc_intr() Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:59 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:59 ` [PATCH 35/40] ide-tape: always log debug info in idetape_pc_intr() if debugging is enabled Bartlomiej Zolnierkiewicz
` (6 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:59 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
* Add ide_tape_io_buffers() helper which is a wrapper for
idetape_{in,out}put_buffers() and convert idetape_pc_intr()
to use it.
* Remove no longer used idetape_io_buf typedef.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>---
---
drivers/ide/ide-tape.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -780,7 +780,14 @@ static void ide_tape_handle_dsc(ide_driv
idetape_postpone_request(drive);
}
-typedef void idetape_io_buf(ide_drive_t *, struct ide_atapi_pc *, unsigned int);
+static void ide_tape_io_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
+ unsigned int bcount, int write)
+{
+ if (write)
+ idetape_output_buffers(drive, pc, bcount);
+ else
+ idetape_input_buffers(drive, pc, bcount);
+}
/*
* This is the usual interrupt handler which will be called during a packet
@@ -795,7 +802,6 @@ static ide_startstop_t idetape_pc_intr(i
idetape_tape_t *tape = drive->driver_data;
struct ide_atapi_pc *pc = tape->pc;
xfer_func_t *xferfunc;
- idetape_io_buf *iobuf;
unsigned int temp;
u16 bcount;
u8 stat, ireason;
@@ -895,15 +901,14 @@ static ide_startstop_t idetape_pc_intr(i
debug_log(DBG_SENSE, "The device wants to send us more "
"data than expected - allowing transfer\n");
}
- iobuf = &idetape_input_buffers;
xferfunc = hwif->input_data;
} else {
- iobuf = &idetape_output_buffers;
xferfunc = hwif->output_data;
}
if (pc->bh)
- iobuf(drive, pc, bcount);
+ ide_tape_io_buffers(drive, pc, bcount,
+ !!(pc->flags & PC_FLAG_WRITING));
else
xferfunc(drive, NULL, pc->cur_pos, bcount);
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 35/40] ide-tape: always log debug info in idetape_pc_intr() if debugging is enabled
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (33 preceding siblings ...)
2008-05-18 18:59 ` [PATCH 34/40] ide-tape: add ide_tape_io_buffers() helper Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:59 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:59 ` [PATCH 36/40] ide-floppy: add more debugging to idefloppy_pc_intr() Bartlomiej Zolnierkiewicz
` (5 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:59 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Add DBG_PC_INTR debug level and use it to always log debug info
in idetape_pc_intr() if debugging is enabled.
While at it:
* Use drive->name instead of tape->name.
* Log device name with "DMA finished" message.
This is a preparation for adding generic ide_pc_intr() helper.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-tape.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -56,6 +56,8 @@ enum {
DBG_PROCS = (1 << 3),
/* buffer alloc info (pc_stack & rq_stack) */
DBG_PCRQ_STACK = (1 << 4),
+ /* IRQ handler (always log debug info if debugging is on) */
+ DBG_PC_INTR = (1 << 5),
};
/* define to see debug info */
@@ -64,7 +66,7 @@ enum {
#if IDETAPE_DEBUG_LOG
#define debug_log(lvl, fmt, args...) \
{ \
- if (tape->debug_mask & lvl) \
+ if ((lvl & DBG_PC_INTR) || (tape->debug_mask & lvl)) \
printk(KERN_INFO "ide-tape: " fmt, ## args); \
}
#else
@@ -806,7 +808,7 @@ static ide_startstop_t idetape_pc_intr(i
u16 bcount;
u8 stat, ireason;
- debug_log(DBG_PROCS, "Enter %s - interrupt handler\n", __func__);
+ debug_log(DBG_PC_INTR, "Enter %s - interrupt handler\n", __func__);
/* Clear the interrupt */
stat = ide_read_status(drive);
@@ -818,13 +820,12 @@ static ide_startstop_t idetape_pc_intr(i
pc->xferred = pc->req_xfer;
idetape_update_buffers(pc);
}
- debug_log(DBG_PROCS, "DMA finished\n");
-
+ debug_log(DBG_PC_INTR, "%s: DMA finished\n", drive->name);
}
/* No more interrupts */
if ((stat & DRQ_STAT) == 0) {
- debug_log(DBG_SENSE, "Packet command completed, %d bytes"
+ debug_log(DBG_PC_INTR, "Packet command completed, %d bytes"
" transferred\n", pc->xferred);
pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
@@ -834,14 +835,14 @@ static ide_startstop_t idetape_pc_intr(i
stat &= ~ERR_STAT;
if ((stat & ERR_STAT) || (pc->flags & PC_FLAG_DMA_ERROR)) {
/* Error detected */
- debug_log(DBG_ERR, "%s: I/O error\n", tape->name);
+ debug_log(DBG_PC_INTR, "%s: I/O error\n", drive->name);
if (pc->c[0] == REQUEST_SENSE) {
printk(KERN_ERR "%s: I/O error in request sense"
" command\n", drive->name);
return ide_do_reset(drive);
}
- debug_log(DBG_ERR, "[cmd %x]: check condition\n",
+ debug_log(DBG_PC_INTR, "[cmd %x]: check condition\n",
pc->c[0]);
/* Retry operation */
@@ -898,7 +899,7 @@ static ide_startstop_t idetape_pc_intr(i
IDETAPE_WAIT_CMD, NULL);
return ide_started;
}
- debug_log(DBG_SENSE, "The device wants to send us more "
+ debug_log(DBG_PC_INTR, "The device wants to send us more "
"data than expected - allowing transfer\n");
}
xferfunc = hwif->input_data;
@@ -916,7 +917,7 @@ static ide_startstop_t idetape_pc_intr(i
pc->xferred += bcount;
pc->cur_pos += bcount;
- debug_log(DBG_SENSE, "[cmd %x] transferred %d bytes on that intr.\n",
+ debug_log(DBG_PC_INTR, "[cmd %x] transferred %d bytes on that intr.\n",
pc->c[0], bcount);
/* And set the interrupt handler again */
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 36/40] ide-floppy: add more debugging to idefloppy_pc_intr()
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (34 preceding siblings ...)
2008-05-18 18:59 ` [PATCH 35/40] ide-tape: always log debug info in idetape_pc_intr() if debugging is enabled Bartlomiej Zolnierkiewicz
@ 2008-05-18 18:59 ` Bartlomiej Zolnierkiewicz
2008-05-18 19:00 ` [PATCH 37/40] ide-scsi: use pc->callback Bartlomiej Zolnierkiewicz
` (4 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 18:59 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Add more debugging to idefloppy_pc_intr() to match ide-tape's
idetape_pc_intr().
While at it:
* Correct the first debug message.
* Log device name with "DMA finished" message.
This is a preparation for adding generic ide_pc_intr() helper.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-floppy.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -397,7 +397,7 @@ static ide_startstop_t idefloppy_pc_intr
u16 bcount;
u8 stat, ireason;
- debug_log("Reached %s interrupt handler\n", __func__);
+ debug_log("Enter %s - interrupt handler\n", __func__);
if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
dma_error = hwif->dma_ops->dma_end(drive);
@@ -409,7 +409,7 @@ static ide_startstop_t idefloppy_pc_intr
pc->xferred = pc->req_xfer;
idefloppy_update_buffers(drive, pc);
}
- debug_log("DMA finished\n");
+ debug_log("%s: DMA finished\n", drive->name);
}
/* Clear the interrupt */
@@ -432,6 +432,9 @@ static ide_startstop_t idefloppy_pc_intr
" command\n", drive->name);
return ide_do_reset(drive);
}
+
+ debug_log("[cmd %x]: check condition\n", pc->c[0]);
+
/* Retry operation */
idefloppy_retry_pc(drive);
/* queued, but not started */
@@ -505,6 +508,9 @@ static ide_startstop_t idefloppy_pc_intr
pc->xferred += bcount;
pc->cur_pos += bcount;
+ debug_log("[cmd %x] transferred %d bytes on that intr.\n",
+ pc->c[0], bcount);
+
/* And set the interrupt handler again */
ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL);
return ide_started;
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 37/40] ide-scsi: use pc->callback
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (35 preceding siblings ...)
2008-05-18 18:59 ` [PATCH 36/40] ide-floppy: add more debugging to idefloppy_pc_intr() Bartlomiej Zolnierkiewicz
@ 2008-05-18 19:00 ` Bartlomiej Zolnierkiewicz
2008-05-18 19:00 ` [PATCH 38/40] ide-scsi: add more debugging to idescsi_pc_intr() Bartlomiej Zolnierkiewicz
` (3 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 19:00 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
* Add ide_scsi_callback() pc->callback implementation, then update
idescsi_check_condition() and idescsi_queue() to setup ->callback.
* Convert idescsi_pc_intr() to use pc->callback.
This is a preparation for adding generic ide_pc_intr() helper.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/scsi/ide-scsi.c | 32 ++++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)
Index: b/drivers/scsi/ide-scsi.c
===================================================================
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -183,6 +183,24 @@ static void ide_scsi_hex_dump(u8 *data,
print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, data, len, 0);
}
+static int idescsi_end_request(ide_drive_t *, int, int);
+
+static void ide_scsi_callback(ide_drive_t *drive)
+{
+ idescsi_scsi_t *scsi = drive_to_idescsi(drive);
+ struct ide_atapi_pc *pc = scsi->pc;
+
+ if (pc->flags & PC_FLAG_TIMEDOUT)
+ debug_log("%s: got timed out packet %lu at %lu\n", __func__,
+ pc->scsi_cmd->serial_number, jiffies);
+ /* end this request now - scsi should retry it*/
+ else if (test_bit(IDESCSI_LOG_CMD, &scsi->log))
+ printk(KERN_INFO "Packet command completed, %d bytes"
+ " transferred\n", pc->xferred);
+
+ idescsi_end_request(drive, 1, 0);
+}
+
static int idescsi_check_condition(ide_drive_t *drive,
struct request *failed_cmd)
{
@@ -210,6 +228,7 @@ static int idescsi_check_condition(ide_d
rq->cmd_type = REQ_TYPE_SENSE;
rq->cmd_flags |= REQ_PREEMPT;
pc->timeout = jiffies + WAIT_READY;
+ pc->callback = ide_scsi_callback;
/* NOTE! Save the failed packet command in "rq->buffer" */
rq->buffer = (void *) failed_cmd->special;
pc->scsi_cmd = ((struct ide_atapi_pc *) failed_cmd->special)->scsi_cmd;
@@ -222,8 +241,6 @@ static int idescsi_check_condition(ide_d
return 0;
}
-static int idescsi_end_request(ide_drive_t *, int, int);
-
static ide_startstop_t
idescsi_atapi_error(ide_drive_t *drive, struct request *rq, u8 stat, u8 err)
{
@@ -350,10 +367,7 @@ static ide_startstop_t idescsi_pc_intr (
debug_log("Reached %s interrupt handler\n", __func__);
if (pc->flags & PC_FLAG_TIMEDOUT) {
- debug_log("%s: got timed out packet %lu at %lu\n", __func__,
- pc->scsi_cmd->serial_number, jiffies);
- /* end this request now - scsi should retry it*/
- idescsi_end_request (drive, 1, 0);
+ pc->callback(drive);
return ide_stopped;
}
if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
@@ -369,14 +383,11 @@ static ide_startstop_t idescsi_pc_intr (
if ((stat & DRQ_STAT) == 0) {
/* No more interrupts */
- if (test_bit(IDESCSI_LOG_CMD, &scsi->log))
- printk(KERN_INFO "Packet command completed, %d bytes"
- " transferred\n", pc->xferred);
pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
local_irq_enable_in_hardirq();
if ((stat & ERR_STAT) || (pc->flags & PC_FLAG_DMA_ERROR))
rq->errors++;
- idescsi_end_request (drive, 1, 0);
+ pc->callback(drive);
return ide_stopped;
}
if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
@@ -718,6 +729,7 @@ static int idescsi_queue (struct scsi_cm
pc->scsi_cmd = cmd;
pc->done = done;
pc->timeout = jiffies + cmd->timeout_per_command;
+ pc->callback = ide_scsi_callback;
if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) {
printk ("ide-scsi: %s: que %lu, cmd = ", drive->name, cmd->serial_number);
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 38/40] ide-scsi: add more debugging to idescsi_pc_intr()
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (36 preceding siblings ...)
2008-05-18 19:00 ` [PATCH 37/40] ide-scsi: use pc->callback Bartlomiej Zolnierkiewicz
@ 2008-05-18 19:00 ` Bartlomiej Zolnierkiewicz
2008-05-18 19:00 ` [PATCH 39/40] ide-{floppy,scsi}: read Status Register before stopping DMA engine Bartlomiej Zolnierkiewicz
` (2 subsequent siblings)
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 19:00 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Add more debugging to idescsi_pc_intr() to match ide-tape's
idetape_pc_intr().
While at it:
* Correct the first debug message.
This is a preparation for adding generic ide_pc_intr() helper.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/scsi/ide-scsi.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
Index: b/drivers/scsi/ide-scsi.c
===================================================================
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -364,7 +364,7 @@ static ide_startstop_t idescsi_pc_intr (
u16 bcount;
u8 stat, ireason;
- debug_log("Reached %s interrupt handler\n", __func__);
+ debug_log("Enter %s - interrupt handler\n", __func__);
if (pc->flags & PC_FLAG_TIMEDOUT) {
pc->callback(drive);
@@ -383,10 +383,16 @@ static ide_startstop_t idescsi_pc_intr (
if ((stat & DRQ_STAT) == 0) {
/* No more interrupts */
+ debug_log("Packet command completed, %d bytes transferred\n",
+ pc->xferred);
pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
local_irq_enable_in_hardirq();
- if ((stat & ERR_STAT) || (pc->flags & PC_FLAG_DMA_ERROR))
+ if ((stat & ERR_STAT) || (pc->flags & PC_FLAG_DMA_ERROR)) {
+ /* Error detected */
+ debug_log("%s: I/O error\n", drive->name);
+
rq->errors++;
+ }
pc->callback(drive);
return ide_stopped;
}
@@ -457,6 +463,9 @@ static ide_startstop_t idescsi_pc_intr (
pc->xferred += bcount;
pc->cur_pos += bcount;
+ debug_log("[cmd %x] transferred %d bytes on that intr.\n",
+ pc->c[0], bcount);
+
/* And set the interrupt handler again */
ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
return ide_started;
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 39/40] ide-{floppy,scsi}: read Status Register before stopping DMA engine
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (37 preceding siblings ...)
2008-05-18 19:00 ` [PATCH 38/40] ide-scsi: add more debugging to idescsi_pc_intr() Bartlomiej Zolnierkiewicz
@ 2008-05-18 19:00 ` Bartlomiej Zolnierkiewicz
2008-05-18 19:00 ` [PATCH 40/40] ide: add ide_pc_intr() helper Bartlomiej Zolnierkiewicz
2008-05-22 7:43 ` [PATCH 00/40] ide: generic ATAPI support Borislav Petkov
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 19:00 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
Read Status Register before stopping DMA engine to match ide-tape
device driver - it should be safe and shouldn't affect anything.
This is a preparation for adding generic ide_pc_intr() helper.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-floppy.c | 6 +++---
drivers/scsi/ide-scsi.c | 7 ++++---
2 files changed, 7 insertions(+), 6 deletions(-)
Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -399,6 +399,9 @@ static ide_startstop_t idefloppy_pc_intr
debug_log("Enter %s - interrupt handler\n", __func__);
+ /* Clear the interrupt */
+ stat = ide_read_status(drive);
+
if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
dma_error = hwif->dma_ops->dma_end(drive);
if (dma_error) {
@@ -412,9 +415,6 @@ static ide_startstop_t idefloppy_pc_intr
debug_log("%s: DMA finished\n", drive->name);
}
- /* Clear the interrupt */
- stat = ide_read_status(drive);
-
/* No more interrupts */
if ((stat & DRQ_STAT) == 0) {
debug_log("Packet command completed, %d bytes transferred\n",
Index: b/drivers/scsi/ide-scsi.c
===================================================================
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -370,6 +370,10 @@ static ide_startstop_t idescsi_pc_intr (
pc->callback(drive);
return ide_stopped;
}
+
+ /* Clear the interrupt */
+ stat = ide_read_status(drive);
+
if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
if (hwif->dma_ops->dma_end(drive))
pc->flags |= PC_FLAG_DMA_ERROR;
@@ -378,9 +382,6 @@ static ide_startstop_t idescsi_pc_intr (
debug_log("%s: DMA finished\n", drive->name);
}
- /* Clear the interrupt */
- stat = ide_read_status(drive);
-
if ((stat & DRQ_STAT) == 0) {
/* No more interrupts */
debug_log("Packet command completed, %d bytes transferred\n",
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH 40/40] ide: add ide_pc_intr() helper
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (38 preceding siblings ...)
2008-05-18 19:00 ` [PATCH 39/40] ide-{floppy,scsi}: read Status Register before stopping DMA engine Bartlomiej Zolnierkiewicz
@ 2008-05-18 19:00 ` Bartlomiej Zolnierkiewicz
2008-05-22 7:43 ` [PATCH 00/40] ide: generic ATAPI support Borislav Petkov
40 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-18 19:00 UTC (permalink / raw)
To: linux-ide; +Cc: Borislav Petkov, Bartlomiej Zolnierkiewicz, linux-kernel
* ide-tape.c: add 'drive' argument to idetape_update_buffers().
* Add generic ide_pc_intr() helper to ide-atapi.c and then
convert ide-{floppy,tape,scsi} device drivers to use it.
* ide-tape.c: remove no longer needed DBG_PC_INTR.
There should be no functional changes caused by this patch
(unless the debugging is explicitely compiled in).
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-atapi.c | 177 +++++++++++++++++++++++++++++++++++++++++++++++
drivers/ide/ide-floppy.c | 128 ---------------------------------
drivers/ide/ide-tape.c | 132 +----------------------------------
drivers/scsi/ide-scsi.c | 115 ------------------------------
include/linux/ide.h | 6 +
5 files changed, 195 insertions(+), 363 deletions(-)
Index: b/drivers/ide/ide-atapi.c
===================================================================
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -5,6 +5,183 @@
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/ide.h>
+#include <scsi/scsi.h>
+
+#ifdef DEBUG
+#define debug_log(fmt, args...) \
+ printk(KERN_INFO "ide: " fmt, ## args)
+#else
+#define debug_log(fmt, args...) do {} while (0)
+#endif
+
+/* TODO: unify the code thus making some arguments go away */
+ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
+ ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry,
+ void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *),
+ void (*retry_pc)(ide_drive_t *), void (*dsc_handle)(ide_drive_t *),
+ void (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned, int))
+{
+ ide_hwif_t *hwif = drive->hwif;
+ xfer_func_t *xferfunc;
+ unsigned int temp;
+ u16 bcount;
+ u8 stat, ireason, scsi = drive->scsi;
+
+ debug_log("Enter %s - interrupt handler\n", __func__);
+
+ if (pc->flags & PC_FLAG_TIMEDOUT) {
+ pc->callback(drive);
+ return ide_stopped;
+ }
+
+ /* Clear the interrupt */
+ stat = ide_read_status(drive);
+
+ if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
+ if (hwif->dma_ops->dma_end(drive) ||
+ (drive->media == ide_tape && !scsi && (stat & ERR_STAT))) {
+ if (drive->media == ide_floppy && !scsi)
+ printk(KERN_ERR "%s: DMA %s error\n",
+ drive->name, rq_data_dir(pc->rq)
+ ? "write" : "read");
+ pc->flags |= PC_FLAG_DMA_ERROR;
+ } else {
+ pc->xferred = pc->req_xfer;
+ if (update_buffers)
+ update_buffers(drive, pc);
+ }
+ debug_log("%s: DMA finished\n", drive->name);
+ }
+
+ /* No more interrupts */
+ if ((stat & DRQ_STAT) == 0) {
+ debug_log("Packet command completed, %d bytes transferred\n",
+ pc->xferred);
+
+ pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
+
+ local_irq_enable_in_hardirq();
+
+ if (drive->media == ide_tape && !scsi &&
+ (stat & ERR_STAT) && pc->c[0] == REQUEST_SENSE)
+ stat &= ~ERR_STAT;
+ if ((stat & ERR_STAT) || (pc->flags & PC_FLAG_DMA_ERROR)) {
+ /* Error detected */
+ debug_log("%s: I/O error\n", drive->name);
+
+ if (drive->media != ide_tape || scsi) {
+ pc->rq->errors++;
+ if (scsi)
+ goto cmd_finished;
+ }
+
+ if (pc->c[0] == REQUEST_SENSE) {
+ printk(KERN_ERR "%s: I/O error in request sense"
+ " command\n", drive->name);
+ return ide_do_reset(drive);
+ }
+
+ debug_log("[cmd %x]: check condition\n", pc->c[0]);
+
+ /* Retry operation */
+ retry_pc(drive);
+ /* queued, but not started */
+ return ide_stopped;
+ }
+cmd_finished:
+ pc->error = 0;
+ if ((pc->flags & PC_FLAG_WAIT_FOR_DSC) &&
+ (stat & SEEK_STAT) == 0) {
+ dsc_handle(drive);
+ return ide_stopped;
+ }
+ /* Command finished - Call the callback function */
+ pc->callback(drive);
+ return ide_stopped;
+ }
+
+ if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
+ pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
+ printk(KERN_ERR "%s: The device wants to issue more interrupts "
+ "in DMA mode\n", drive->name);
+ ide_dma_off(drive);
+ return ide_do_reset(drive);
+ }
+ /* Get the number of bytes to transfer on this interrupt. */
+ bcount = (hwif->INB(hwif->io_ports.lbah_addr) << 8) |
+ hwif->INB(hwif->io_ports.lbam_addr);
+
+ ireason = hwif->INB(hwif->io_ports.nsect_addr);
+
+ if (ireason & CD) {
+ printk(KERN_ERR "%s: CoD != 0 in %s\n", drive->name, __func__);
+ return ide_do_reset(drive);
+ }
+ if (((ireason & IO) == IO) == !!(pc->flags & PC_FLAG_WRITING)) {
+ /* Hopefully, we will never get here */
+ printk(KERN_ERR "%s: We wanted to %s, but the device wants us "
+ "to %s!\n", drive->name,
+ (ireason & IO) ? "Write" : "Read",
+ (ireason & IO) ? "Read" : "Write");
+ return ide_do_reset(drive);
+ }
+ if (!(pc->flags & PC_FLAG_WRITING)) {
+ /* Reading - Check that we have enough space */
+ temp = pc->xferred + bcount;
+ if (temp > pc->req_xfer) {
+ if (temp > pc->buf_size) {
+ printk(KERN_ERR "%s: The device wants to send "
+ "us more data than expected - "
+ "discarding data\n",
+ drive->name);
+ if (scsi)
+ temp = pc->buf_size - pc->xferred;
+ else
+ temp = 0;
+ if (temp) {
+ if (pc->sg)
+ io_buffers(drive, pc, temp, 0);
+ else
+ hwif->input_data(drive, NULL,
+ pc->cur_pos, temp);
+ printk(KERN_ERR "%s: transferred %d of "
+ "%d bytes\n",
+ drive->name,
+ temp, bcount);
+ }
+ pc->xferred += temp;
+ pc->cur_pos += temp;
+ ide_pad_transfer(drive, 0, bcount - temp);
+ ide_set_handler(drive, handler, timeout,
+ expiry);
+ return ide_started;
+ }
+ debug_log("The device wants to send us more data than "
+ "expected - allowing transfer\n");
+ }
+ xferfunc = hwif->input_data;
+ } else
+ xferfunc = hwif->output_data;
+
+ if ((drive->media == ide_floppy && !scsi && !pc->buf) ||
+ (drive->media == ide_tape && !scsi && pc->bh) ||
+ (scsi && pc->sg))
+ io_buffers(drive, pc, bcount, !!(pc->flags & PC_FLAG_WRITING));
+ else
+ xferfunc(drive, NULL, pc->cur_pos, bcount);
+
+ /* Update the current position */
+ pc->xferred += bcount;
+ pc->cur_pos += bcount;
+
+ debug_log("[cmd %x] transferred %d bytes on that intr.\n",
+ pc->c[0], bcount);
+
+ /* And set the interrupt handler again */
+ ide_set_handler(drive, handler, timeout, expiry);
+ return ide_started;
+}
+EXPORT_SYMBOL_GPL(ide_pc_intr);
static u8 ide_wait_ireason(ide_drive_t *drive, u8 ireason)
{
Index: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -388,132 +388,10 @@ static void idefloppy_retry_pc(ide_drive
static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
{
idefloppy_floppy_t *floppy = drive->driver_data;
- ide_hwif_t *hwif = drive->hwif;
- struct ide_atapi_pc *pc = floppy->pc;
- struct request *rq = pc->rq;
- xfer_func_t *xferfunc;
- unsigned int temp;
- int dma_error = 0;
- u16 bcount;
- u8 stat, ireason;
-
- debug_log("Enter %s - interrupt handler\n", __func__);
-
- /* Clear the interrupt */
- stat = ide_read_status(drive);
-
- if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
- dma_error = hwif->dma_ops->dma_end(drive);
- if (dma_error) {
- printk(KERN_ERR "%s: DMA %s error\n", drive->name,
- rq_data_dir(rq) ? "write" : "read");
- pc->flags |= PC_FLAG_DMA_ERROR;
- } else {
- pc->xferred = pc->req_xfer;
- idefloppy_update_buffers(drive, pc);
- }
- debug_log("%s: DMA finished\n", drive->name);
- }
-
- /* No more interrupts */
- if ((stat & DRQ_STAT) == 0) {
- debug_log("Packet command completed, %d bytes transferred\n",
- pc->xferred);
- pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
-
- local_irq_enable_in_hardirq();
-
- if ((stat & ERR_STAT) || (pc->flags & PC_FLAG_DMA_ERROR)) {
- /* Error detected */
- debug_log("%s: I/O error\n", drive->name);
- rq->errors++;
- if (pc->c[0] == GPCMD_REQUEST_SENSE) {
- printk(KERN_ERR "%s: I/O error in request sense"
- " command\n", drive->name);
- return ide_do_reset(drive);
- }
-
- debug_log("[cmd %x]: check condition\n", pc->c[0]);
-
- /* Retry operation */
- idefloppy_retry_pc(drive);
- /* queued, but not started */
- return ide_stopped;
- }
- pc->error = 0;
- /* Command finished - Call the callback function */
- pc->callback(drive);
- return ide_stopped;
- }
-
- if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
- pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
- printk(KERN_ERR "%s: The device wants to issue more interrupts "
- "in DMA mode\n", drive->name);
- ide_dma_off(drive);
- return ide_do_reset(drive);
- }
-
- /* Get the number of bytes to transfer */
- bcount = (hwif->INB(hwif->io_ports.lbah_addr) << 8) |
- hwif->INB(hwif->io_ports.lbam_addr);
- /* on this interrupt */
- ireason = hwif->INB(hwif->io_ports.nsect_addr);
-
- if (ireason & CD) {
- printk(KERN_ERR "%s: CoD != 0 in %s\n", drive->name, __func__);
- return ide_do_reset(drive);
- }
- if (((ireason & IO) == IO) == !!(pc->flags & PC_FLAG_WRITING)) {
- /* Hopefully, we will never get here */
- printk(KERN_ERR "%s: We wanted to %s, but the device wants us "
- "to %s!\n", drive->name,
- (ireason & IO) ? "Write" : "Read",
- (ireason & IO) ? "Read" : "Write");
- return ide_do_reset(drive);
- }
- if (!(pc->flags & PC_FLAG_WRITING)) {
- /* Reading - Check that we have enough space */
- temp = pc->xferred + bcount;
- if (temp > pc->req_xfer) {
- if (temp > pc->buf_size) {
- printk(KERN_ERR "%s: The device wants to send "
- "us more data than expected - "
- "discarding data\n",
- drive->name);
- ide_pad_transfer(drive, 0, bcount);
-
- ide_set_handler(drive,
- &idefloppy_pc_intr,
- IDEFLOPPY_WAIT_CMD,
- NULL);
- return ide_started;
- }
- debug_log("The device wants to send us more data than "
- "expected - allowing transfer\n");
- }
- }
- if (pc->flags & PC_FLAG_WRITING)
- xferfunc = hwif->output_data;
- else
- xferfunc = hwif->input_data;
-
- if (pc->buf)
- xferfunc(drive, NULL, pc->cur_pos, bcount);
- else
- ide_floppy_io_buffers(drive, pc, bcount,
- !!(pc->flags & PC_FLAG_WRITING));
- /* Update the current position */
- pc->xferred += bcount;
- pc->cur_pos += bcount;
-
- debug_log("[cmd %x] transferred %d bytes on that intr.\n",
- pc->c[0], bcount);
-
- /* And set the interrupt handler again */
- ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL);
- return ide_started;
+ return ide_pc_intr(drive, floppy->pc, idefloppy_pc_intr,
+ IDEFLOPPY_WAIT_CMD, NULL, idefloppy_update_buffers,
+ idefloppy_retry_pc, NULL, ide_floppy_io_buffers);
}
/*
Index: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -56,8 +56,6 @@ enum {
DBG_PROCS = (1 << 3),
/* buffer alloc info (pc_stack & rq_stack) */
DBG_PCRQ_STACK = (1 << 4),
- /* IRQ handler (always log debug info if debugging is on) */
- DBG_PC_INTR = (1 << 5),
};
/* define to see debug info */
@@ -66,7 +64,7 @@ enum {
#if IDETAPE_DEBUG_LOG
#define debug_log(lvl, fmt, args...) \
{ \
- if ((lvl & DBG_PC_INTR) || (tape->debug_mask & lvl)) \
+ if (tape->debug_mask & lvl) \
printk(KERN_INFO "ide-tape: " fmt, ## args); \
}
#else
@@ -441,7 +439,7 @@ static void idetape_output_buffers(ide_d
}
}
-static void idetape_update_buffers(struct ide_atapi_pc *pc)
+static void idetape_update_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc)
{
struct idetape_bh *bh = pc->bh;
int count;
@@ -526,7 +524,7 @@ static void idetape_analyze_error(ide_dr
pc->xferred = pc->req_xfer -
tape->blk_size *
get_unaligned_be32(&sense[3]);
- idetape_update_buffers(pc);
+ idetape_update_buffers(drive, pc);
}
/*
@@ -800,129 +798,11 @@ static void ide_tape_io_buffers(ide_driv
*/
static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
{
- ide_hwif_t *hwif = drive->hwif;
idetape_tape_t *tape = drive->driver_data;
- struct ide_atapi_pc *pc = tape->pc;
- xfer_func_t *xferfunc;
- unsigned int temp;
- u16 bcount;
- u8 stat, ireason;
-
- debug_log(DBG_PC_INTR, "Enter %s - interrupt handler\n", __func__);
-
- /* Clear the interrupt */
- stat = ide_read_status(drive);
-
- if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
- if (hwif->dma_ops->dma_end(drive) || (stat & ERR_STAT)) {
- pc->flags |= PC_FLAG_DMA_ERROR;
- } else {
- pc->xferred = pc->req_xfer;
- idetape_update_buffers(pc);
- }
- debug_log(DBG_PC_INTR, "%s: DMA finished\n", drive->name);
- }
-
- /* No more interrupts */
- if ((stat & DRQ_STAT) == 0) {
- debug_log(DBG_PC_INTR, "Packet command completed, %d bytes"
- " transferred\n", pc->xferred);
-
- pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
- local_irq_enable_in_hardirq();
-
- if ((stat & ERR_STAT) && pc->c[0] == REQUEST_SENSE)
- stat &= ~ERR_STAT;
- if ((stat & ERR_STAT) || (pc->flags & PC_FLAG_DMA_ERROR)) {
- /* Error detected */
- debug_log(DBG_PC_INTR, "%s: I/O error\n", drive->name);
-
- if (pc->c[0] == REQUEST_SENSE) {
- printk(KERN_ERR "%s: I/O error in request sense"
- " command\n", drive->name);
- return ide_do_reset(drive);
- }
- debug_log(DBG_PC_INTR, "[cmd %x]: check condition\n",
- pc->c[0]);
-
- /* Retry operation */
- idetape_retry_pc(drive);
- return ide_stopped;
- }
- pc->error = 0;
- if ((pc->flags & PC_FLAG_WAIT_FOR_DSC) &&
- (stat & SEEK_STAT) == 0) {
- ide_tape_handle_dsc(drive);
- return ide_stopped;
- }
- /* Command finished - Call the callback function */
- pc->callback(drive);
- return ide_stopped;
- }
-
- if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
- pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
- printk(KERN_ERR "%s: The device wants to issue more interrupts "
- "in DMA mode\n", drive->name);
- ide_dma_off(drive);
- return ide_do_reset(drive);
- }
- /* Get the number of bytes to transfer on this interrupt. */
- bcount = (hwif->INB(hwif->io_ports.lbah_addr) << 8) |
- hwif->INB(hwif->io_ports.lbam_addr);
-
- ireason = hwif->INB(hwif->io_ports.nsect_addr);
-
- if (ireason & CD) {
- printk(KERN_ERR "%s: CoD != 0 in %s\n", drive->name, __func__);
- return ide_do_reset(drive);
- }
- if (((ireason & IO) == IO) == !!(pc->flags & PC_FLAG_WRITING)) {
- /* Hopefully, we will never get here */
- printk(KERN_ERR "%s: We wanted to %s, but the device wants us "
- "to %s!\n", drive->name,
- (ireason & IO) ? "Write" : "Read",
- (ireason & IO) ? "Read" : "Write");
- return ide_do_reset(drive);
- }
- if (!(pc->flags & PC_FLAG_WRITING)) {
- /* Reading - Check that we have enough space */
- temp = pc->xferred + bcount;
- if (temp > pc->req_xfer) {
- if (temp > pc->buf_size) {
- printk(KERN_ERR "%s: The device wants to send "
- "us more data than expected - "
- "discarding data\n",
- drive->name);
- ide_pad_transfer(drive, 0, bcount);
- ide_set_handler(drive, &idetape_pc_intr,
- IDETAPE_WAIT_CMD, NULL);
- return ide_started;
- }
- debug_log(DBG_PC_INTR, "The device wants to send us more "
- "data than expected - allowing transfer\n");
- }
- xferfunc = hwif->input_data;
- } else {
- xferfunc = hwif->output_data;
- }
-
- if (pc->bh)
- ide_tape_io_buffers(drive, pc, bcount,
- !!(pc->flags & PC_FLAG_WRITING));
- else
- xferfunc(drive, NULL, pc->cur_pos, bcount);
- /* Update the current position */
- pc->xferred += bcount;
- pc->cur_pos += bcount;
-
- debug_log(DBG_PC_INTR, "[cmd %x] transferred %d bytes on that intr.\n",
- pc->c[0], bcount);
-
- /* And set the interrupt handler again */
- ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL);
- return ide_started;
+ return ide_pc_intr(drive, tape->pc, idetape_pc_intr, IDETAPE_WAIT_CMD,
+ NULL, idetape_update_buffers, idetape_retry_pc,
+ ide_tape_handle_dsc, ide_tape_io_buffers);
}
/*
Index: b/drivers/scsi/ide-scsi.c
===================================================================
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -356,120 +356,11 @@ static int idescsi_expiry(ide_drive_t *d
static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive)
{
idescsi_scsi_t *scsi = drive_to_idescsi(drive);
- ide_hwif_t *hwif = drive->hwif;
struct ide_atapi_pc *pc = scsi->pc;
- struct request *rq = pc->rq;
- xfer_func_t *xferfunc;
- unsigned int temp;
- u16 bcount;
- u8 stat, ireason;
-
- debug_log("Enter %s - interrupt handler\n", __func__);
-
- if (pc->flags & PC_FLAG_TIMEDOUT) {
- pc->callback(drive);
- return ide_stopped;
- }
-
- /* Clear the interrupt */
- stat = ide_read_status(drive);
-
- if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
- if (hwif->dma_ops->dma_end(drive))
- pc->flags |= PC_FLAG_DMA_ERROR;
- else
- pc->xferred = pc->req_xfer;
- debug_log("%s: DMA finished\n", drive->name);
- }
-
- if ((stat & DRQ_STAT) == 0) {
- /* No more interrupts */
- debug_log("Packet command completed, %d bytes transferred\n",
- pc->xferred);
- pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
- local_irq_enable_in_hardirq();
- if ((stat & ERR_STAT) || (pc->flags & PC_FLAG_DMA_ERROR)) {
- /* Error detected */
- debug_log("%s: I/O error\n", drive->name);
-
- rq->errors++;
- }
- pc->callback(drive);
- return ide_stopped;
- }
- if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
- pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
- printk(KERN_ERR "%s: The device wants to issue more interrupts "
- "in DMA mode\n", drive->name);
- ide_dma_off(drive);
- return ide_do_reset(drive);
- }
- bcount = (hwif->INB(hwif->io_ports.lbah_addr) << 8) |
- hwif->INB(hwif->io_ports.lbam_addr);
- ireason = hwif->INB(hwif->io_ports.nsect_addr);
-
- if (ireason & CD) {
- printk(KERN_ERR "%s: CoD != 0 in %s\n", drive->name, __func__);
- return ide_do_reset (drive);
- }
- if (((ireason & IO) == IO) == !!(pc->flags & PC_FLAG_WRITING)) {
- /* Hopefully, we will never get here */
- printk(KERN_ERR "%s: We wanted to %s, but the device wants us "
- "to %s!\n", drive->name,
- (ireason & IO) ? "Write" : "Read",
- (ireason & IO) ? "Read" : "Write");
- return ide_do_reset(drive);
- }
- if (!(pc->flags & PC_FLAG_WRITING)) {
- temp = pc->xferred + bcount;
- if (temp > pc->req_xfer) {
- if (temp > pc->buf_size) {
- printk(KERN_ERR "%s: The device wants to send "
- "us more data than expected - "
- "discarding data\n",
- drive->name);
- temp = pc->buf_size - pc->xferred;
- if (temp) {
- if (pc->sg)
- ide_scsi_io_buffers(drive, pc,
- temp, 0);
- else
- hwif->input_data(drive, NULL,
- pc->cur_pos, temp);
- printk(KERN_ERR "%s: transferred %d of "
- "%d bytes\n",
- drive->name,
- temp, bcount);
- }
- pc->xferred += temp;
- pc->cur_pos += temp;
- ide_pad_transfer(drive, 0, bcount - temp);
- ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
- return ide_started;
- }
- debug_log("The device wants to send us more data than "
- "expected - allowing transfer\n");
- }
- xferfunc = hwif->input_data;
- } else
- xferfunc = hwif->output_data;
-
- if (pc->sg)
- ide_scsi_io_buffers(drive, pc, bcount,
- !!(pc->flags & PC_FLAG_WRITING));
- else
- xferfunc(drive, NULL, pc->cur_pos, bcount);
- /* Update the current position */
- pc->xferred += bcount;
- pc->cur_pos += bcount;
-
- debug_log("[cmd %x] transferred %d bytes on that intr.\n",
- pc->c[0], bcount);
-
- /* And set the interrupt handler again */
- ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
- return ide_started;
+ return ide_pc_intr(drive, pc, idescsi_pc_intr, get_timeout(pc),
+ idescsi_expiry, NULL, NULL, NULL,
+ ide_scsi_io_buffers);
}
static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive)
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -953,6 +953,12 @@ extern int drive_is_ready(ide_drive_t *)
void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8);
+ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
+ ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry,
+ void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *),
+ void (*retry_pc)(ide_drive_t *), void (*dsc_handle)(ide_drive_t *),
+ void (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned int,
+ int));
ide_startstop_t ide_transfer_pc(ide_drive_t *, struct ide_atapi_pc *,
ide_handler_t *, unsigned int, ide_expiry_t *);
ide_startstop_t ide_issue_pc(ide_drive_t *, struct ide_atapi_pc *,
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH 04/40] ide-scsi: fix Interrupt Reason checking in idescsi_pc_intr()
2008-05-18 18:55 ` [PATCH 04/40] ide-scsi: fix Interrupt Reason checking " Bartlomiej Zolnierkiewicz
@ 2008-05-19 5:10 ` Borislav Petkov
2008-05-27 18:30 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 51+ messages in thread
From: Borislav Petkov @ 2008-05-19 5:10 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel
On Sun, May 18, 2008 at 08:55:03PM +0200, Bartlomiej Zolnierkiewicz wrote:
> Set PC_FLAG_WRITING pc flag in idescsi_queue() (if needed)
> and then fix Interrupt Reason checking in idescsi_pc_intr().
>
> Cc: Borislav Petkov <petkovbb@gmail.com>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
> drivers/scsi/ide-scsi.c | 17 +++++++++++------
> 1 file changed, 11 insertions(+), 6 deletions(-)
>
> Index: b/drivers/scsi/ide-scsi.c
> ===================================================================
> --- a/drivers/scsi/ide-scsi.c
> +++ b/drivers/scsi/ide-scsi.c
> @@ -427,7 +427,15 @@ static ide_startstop_t idescsi_pc_intr (
> printk(KERN_ERR "ide-scsi: CoD != 0 in idescsi_pc_intr\n");
> return ide_do_reset (drive);
> }
> - if (ireason & IO) {
> + if (((ireason & IO) == IO) == !!(pc->flags & PC_FLAG_WRITING)) {
> + /* Hopefully, we will never get here */
> + printk(KERN_ERR "%s: We wanted to %s, but the device wants us "
> + "to %s!\n", drive->name,
> + (ireason & IO) ? "Write" : "Read",
> + (ireason & IO) ? "Read" : "Write");
> + return ide_do_reset(drive);
> + }
> + if (!(pc->flags & PC_FLAG_WRITING)) {
> temp = pc->xferred + bcount;
> if (temp > pc->req_xfer) {
> if (temp > pc->buf_size) {
> @@ -436,7 +444,6 @@ static ide_startstop_t idescsi_pc_intr (
> "- discarding data\n");
> temp = pc->buf_size - pc->xferred;
> if (temp) {
> - pc->flags &= ~PC_FLAG_WRITING;
> if (pc->sg)
> idescsi_input_buffers(drive, pc,
> temp);
> @@ -457,15 +464,11 @@ static ide_startstop_t idescsi_pc_intr (
> printk (KERN_NOTICE "ide-scsi: The scsi wants to send us more data than expected - allowing transfer\n");
> #endif /* IDESCSI_DEBUG_LOG */
> }
> - }
> - if (ireason & IO) {
> - pc->flags &= ~PC_FLAG_WRITING;
> if (pc->sg)
> idescsi_input_buffers(drive, pc, bcount);
> else
> hwif->input_data(drive, NULL, pc->cur_pos, bcount);
> } else {
> - pc->flags |= PC_FLAG_WRITING;
Yeah, what was the driver doing turning on/off that flag in the irq handler? Are
those pc's getting reused in ide-scsi... I guess this is one of the bugs you
were talking about :).
> if (pc->sg)
> idescsi_output_buffers(drive, pc, bcount);
> else
> @@ -777,6 +780,8 @@ static int idescsi_queue (struct scsi_cm
>
> memset (pc->c, 0, 12);
> pc->flags = 0;
> + if (cmd->sc_data_direction == DMA_TO_DEVICE)
> + pc->flags |= PC_FLAG_WRITING;
> pc->rq = rq;
> memcpy (pc->c, cmd->cmnd, cmd->cmd_len);
> pc->buf = NULL;
--
Regards/Gruß,
Boris.
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH 22/40] ide-floppy: start DMA engine in idefloppy_transfer_pc1()
2008-05-18 18:57 ` [PATCH 22/40] ide-floppy: start DMA engine in idefloppy_transfer_pc1() Bartlomiej Zolnierkiewicz
@ 2008-05-20 11:00 ` Sergei Shtylyov
2008-05-27 18:58 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 51+ messages in thread
From: Sergei Shtylyov @ 2008-05-20 11:00 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, Borislav Petkov, linux-kernel
Hello.
Bartlomiej Zolnierkiewicz wrote:
> Start DMA engine and set PC_FLAG_DMA_IN_PROGRESS flag in
> idefloppy_transfer_pc1() instead of idefloppy_issue_pc()
Good. I have long ago noticed that DMA is started too early in ide-floppy
which is known to cobfuse some chips (like PDC20246) and was going to do a
patch at first but the lack of hardware (and time) stopped me...
> so the Status Register and the Interrupt Reason Register
> are checked first.
> Cc: Borislav Petkov <petkovbb@gmail.com>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Index: b/drivers/ide/ide-floppy.c
> ===================================================================
> --- a/drivers/ide/ide-floppy.c
> +++ b/drivers/ide/ide-floppy.c
[...]
> @@ -568,6 +569,12 @@ static ide_startstop_t idefloppy_transfe
>
> ide_set_handler(drive, &idefloppy_pc_intr, timeout, expiry);
>
> + /* Begin DMA, if necessary */
> + if (pc->flags & PC_FLAG_DMA_OK) {
> + pc->flags |= PC_FLAG_DMA_IN_PROGRESS;
> + hwif->dma_ops->dma_start(drive);
> + }
> +
May be too early still... ide-cd does this after writing the command packet.
WBR, Sergei
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH 14/40] ide-floppy: merge idefloppy_transfer_pc() and idefloppy_transfer_pc1()
2008-05-18 18:56 ` [PATCH 14/40] ide-floppy: merge idefloppy_transfer_pc() and idefloppy_transfer_pc1() Bartlomiej Zolnierkiewicz
@ 2008-05-21 5:24 ` Borislav Petkov
2008-05-27 18:57 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 51+ messages in thread
From: Borislav Petkov @ 2008-05-21 5:24 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel
On Sun, May 18, 2008 at 08:56:33PM +0200, Bartlomiej Zolnierkiewicz wrote:
> * Check IDEFLOPPY_FLAG_ZIP_DRIVE flag in idefloppy_transfer_pc1()
> and skip idefloppy_transfer_pc2()-phase if the flag is not set.
>
> * Always use idefloppy_transfer_pc1() in idefloppy_issue_pc()
> and remove no longer needed idefloppy_transfer_pc().
... and also probably mv idefloppy_transfer_pc1() to something like
idefloppy_start_transfer_pc() and rename idefloppy_transfer_pc2() to something
more appropriate like e.g. idefloppy_do_transfer_pc() or similar and do away
with those misleading names and probably even the comments are superfluous then.
>
> There should be no functional changes caused by this patch.
>
> Cc: Borislav Petkov <petkovbb@gmail.com>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
> drivers/ide/ide-floppy.c | 65 ++++++++++++-----------------------------------
> 1 file changed, 17 insertions(+), 48 deletions(-)
>
> Index: b/drivers/ide/ide-floppy.c
> ===================================================================
> --- a/drivers/ide/ide-floppy.c
> +++ b/drivers/ide/ide-floppy.c
> @@ -522,40 +522,6 @@ static ide_startstop_t idefloppy_pc_intr
> }
>
> /*
> - * This is the original routine that did the packet transfer.
> - * It fails at high speeds on the Iomega ZIP drive, so there's a slower version
> - * for that drive below. The algorithm is chosen based on drive type
> - */
> -static ide_startstop_t idefloppy_transfer_pc(ide_drive_t *drive)
> -{
> - ide_hwif_t *hwif = drive->hwif;
> - ide_startstop_t startstop;
> - idefloppy_floppy_t *floppy = drive->driver_data;
> - u8 ireason;
> -
> - if (ide_wait_stat(&startstop, drive, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
> - printk(KERN_ERR "ide-floppy: Strange, packet command "
> - "initiated yet DRQ isn't asserted\n");
> - return startstop;
> - }
> - ireason = hwif->INB(hwif->io_ports.nsect_addr);
> - if ((ireason & CD) == 0 || (ireason & IO)) {
> - printk(KERN_ERR "ide-floppy: (IO,CoD) != (0,1) while "
> - "issuing a packet command\n");
> - return ide_do_reset(drive);
> - }
> -
> - /* Set the interrupt routine */
> - ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL);
> -
> - /* Send the actual packet */
> - hwif->output_data(drive, NULL, floppy->pc->c, 12);
> -
> - return ide_started;
> -}
> -
> -
> -/*
> * What we have here is a classic case of a top half / bottom half interrupt
> * service routine. In interrupt mode, the device sends an interrupt to signal
> * that it is ready to receive a packet. However, we need to delay about 2-3
> @@ -580,6 +546,8 @@ static ide_startstop_t idefloppy_transfe
> {
> ide_hwif_t *hwif = drive->hwif;
> idefloppy_floppy_t *floppy = drive->driver_data;
> + ide_expiry_t *expiry;
> + unsigned int timeout;
> ide_startstop_t startstop;
> u8 ireason;
>
> @@ -602,9 +570,20 @@ static ide_startstop_t idefloppy_transfe
> * 40 and 50msec work well. idefloppy_pc_intr will not be actually
> * used until after the packet is moved in about 50 msec.
> */
> + if (floppy->flags & IDEFLOPPY_FLAG_ZIP_DRIVE) {
> + timeout = floppy->ticks;
> + expiry = &idefloppy_transfer_pc2;
> + } else {
> + timeout = IDEFLOPPY_WAIT_CMD;
> + expiry = NULL;
> + }
> +
> + ide_set_handler(drive, &idefloppy_pc_intr, timeout, expiry);
> +
> + if ((floppy->flags & IDEFLOPPY_FLAG_ZIP_DRIVE) == 0)
> + /* Send the actual packet */
> + hwif->output_data(drive, NULL, floppy->pc->c, 12);
>
> - ide_set_handler(drive, &idefloppy_pc_intr, floppy->ticks,
> - &idefloppy_transfer_pc2);
> return ide_started;
> }
>
> @@ -629,7 +608,6 @@ static ide_startstop_t idefloppy_issue_p
> {
> idefloppy_floppy_t *floppy = drive->driver_data;
> ide_hwif_t *hwif = drive->hwif;
> - ide_handler_t *pkt_xfer_routine;
> u16 bcount;
> u8 dma;
>
> @@ -675,26 +653,17 @@ static ide_startstop_t idefloppy_issue_p
> hwif->dma_ops->dma_start(drive);
> }
>
> - /* Can we transfer the packet when we get the interrupt or wait? */
> - if (floppy->flags & IDEFLOPPY_FLAG_ZIP_DRIVE) {
> - /* wait */
> - pkt_xfer_routine = &idefloppy_transfer_pc1;
> - } else {
> - /* immediate */
> - pkt_xfer_routine = &idefloppy_transfer_pc;
> - }
> -
> if (floppy->flags & IDEFLOPPY_FLAG_DRQ_INTERRUPT) {
> /* Issue the packet command */
> ide_execute_command(drive, WIN_PACKETCMD,
> - pkt_xfer_routine,
> + &idefloppy_transfer_pc1,
> IDEFLOPPY_WAIT_CMD,
> NULL);
> return ide_started;
> } else {
> /* Issue the packet command */
> ide_execute_pkt_cmd(drive);
> - return (*pkt_xfer_routine) (drive);
> + return idefloppy_transfer_pc1(drive);
> }
> }
>
--
Regards/Gruß,
Boris.
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH 00/40] ide: generic ATAPI support
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
` (39 preceding siblings ...)
2008-05-18 19:00 ` [PATCH 40/40] ide: add ide_pc_intr() helper Bartlomiej Zolnierkiewicz
@ 2008-05-22 7:43 ` Borislav Petkov
2008-05-25 13:23 ` Bartlomiej Zolnierkiewicz
40 siblings, 1 reply; 51+ messages in thread
From: Borislav Petkov @ 2008-05-22 7:43 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel
On Sun, May 18, 2008 at 08:54:28PM +0200, Bartlomiej Zolnierkiewicz wrote:
>
> Hi,
>
> This patch series unifies ATAPI support present in ide-{floppy,tape,scsi}
> device drivers and moves it out to the core IDE code (new ide-atapi.c file).
>
> In the process many bugs were shaken out and ~300 LOC were removed.
>
> diffstat:
>
> drivers/ide/Kconfig | 6
> drivers/ide/Makefile | 1
> drivers/ide/ide-atapi.c | 296 ++++++++++++++++++++++
> drivers/ide/ide-cd.c | 5
> drivers/ide/ide-floppy.c | 431 +++++++-------------------------
> drivers/ide/ide-tape.c | 630 ++++++++++++++---------------------------------
> drivers/scsi/ide-scsi.c | 455 +++++++++++----------------------
> include/linux/ide.h | 28 +-
> 8 files changed, 777 insertions(+), 1075 deletions(-)
>
> Now, while this is a big step in the right direction there are still some
> things left on TODO for generic ATAPI support to be complete:
>
> - convert ide-cd to use generic ATAPI code
>
> - kill pc and rq stacks in ide-{floppy,tape}
>
> - generic handling of REQUEST SENSE command
>
> - generic handling of MODE SENSE command for ide-{floppy,tape}
>
> - convert ide-{cd,floppy,tape} to use scatterlists for PIO transers
> (ala ide-scsi)
>
> I know that Borislav is working on the first two items but other ones
> are free at the moment so if you feel brave you may give it a try :-).
>
> PS I'll be travelling during this weekend and be rather busy with day job
> so replies from me may be delayed a bit.
Hi Bart,
yep, these all look real good, makes all drivers really lightweight. Looks like
ide-cd will follow not too far behind. By the way, here's another one you count apply ontop:
From: Borislav Petkov <petkovbb@gmail.com>
Date: Thu, 22 May 2008 09:36:53 +0200
Subject: [PATCH] ide-tape: unify idetape_create_read/write_cmd
A straightforward one. There should be no functional change resulting from this
change.
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
---
drivers/ide/ide-tape.c | 47 ++++++++++++++++++++---------------------------
1 files changed, 20 insertions(+), 27 deletions(-)
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 0afa109..da08a6a 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -952,40 +952,31 @@ static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive)
return ide_stopped;
}
-static void idetape_create_read_cmd(idetape_tape_t *tape,
- struct ide_atapi_pc *pc,
- unsigned int length, struct idetape_bh *bh)
+static void ide_tape_create_rw_cmd(idetape_tape_t *tape,
+ struct ide_atapi_pc *pc, unsigned int length,
+ struct idetape_bh *bh, int opcode)
{
idetape_init_pc(pc);
- pc->c[0] = READ_6;
put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]);
pc->c[1] = 1;
pc->bh = bh;
- atomic_set(&bh->b_count, 0);
pc->buf = NULL;
pc->buf_size = length * tape->blk_size;
pc->req_xfer = pc->buf_size;
if (pc->req_xfer == tape->buffer_size)
pc->flags |= PC_FLAG_DMA_OK;
-}
-static void idetape_create_write_cmd(idetape_tape_t *tape,
- struct ide_atapi_pc *pc,
- unsigned int length, struct idetape_bh *bh)
-{
- idetape_init_pc(pc);
- pc->c[0] = WRITE_6;
- put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]);
- pc->c[1] = 1;
- pc->flags |= PC_FLAG_WRITING;
- pc->bh = bh;
- pc->b_data = bh->b_data;
- pc->b_count = atomic_read(&bh->b_count);
- pc->buf = NULL;
- pc->buf_size = length * tape->blk_size;
- pc->req_xfer = pc->buf_size;
- if (pc->req_xfer == tape->buffer_size)
- pc->flags |= PC_FLAG_DMA_OK;
+ if (opcode == READ_6) {
+ pc->c[0] = READ_6;
+ atomic_set(&bh->b_count, 0);
+ }
+ else if (opcode == WRITE_6) {
+ pc->c[0] = WRITE_6;
+ pc->flags |= PC_FLAG_WRITING;
+ pc->b_data = bh->b_data;
+ pc->b_count = atomic_read(&bh->b_count);
+ } else
+ printk(KERN_ERR "%s: Invalid opcode: 0x%x\n", __func__, opcode);
}
static ide_startstop_t idetape_do_request(ide_drive_t *drive,
@@ -1062,14 +1053,16 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
}
if (rq->cmd[0] & REQ_IDETAPE_READ) {
pc = idetape_next_pc_storage(drive);
- idetape_create_read_cmd(tape, pc, rq->current_nr_sectors,
- (struct idetape_bh *)rq->special);
+ ide_tape_create_rw_cmd(tape, pc, rq->current_nr_sectors,
+ (struct idetape_bh *)rq->special,
+ READ_6);
goto out;
}
if (rq->cmd[0] & REQ_IDETAPE_WRITE) {
pc = idetape_next_pc_storage(drive);
- idetape_create_write_cmd(tape, pc, rq->current_nr_sectors,
- (struct idetape_bh *)rq->special);
+ ide_tape_create_rw_cmd(tape, pc, rq->current_nr_sectors,
+ (struct idetape_bh *)rq->special,
+ WRITE_6);
goto out;
}
if (rq->cmd[0] & REQ_IDETAPE_PC1) {
--
1.5.5.1
--
Regards/Gruß,
Boris.
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH 00/40] ide: generic ATAPI support
2008-05-22 7:43 ` [PATCH 00/40] ide: generic ATAPI support Borislav Petkov
@ 2008-05-25 13:23 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-25 13:23 UTC (permalink / raw)
To: petkovbb; +Cc: linux-ide, linux-kernel
On Thursday 22 May 2008, Borislav Petkov wrote:
> On Sun, May 18, 2008 at 08:54:28PM +0200, Bartlomiej Zolnierkiewicz wrote:
> >
> > Hi,
> >
> > This patch series unifies ATAPI support present in ide-{floppy,tape,scsi}
> > device drivers and moves it out to the core IDE code (new ide-atapi.c file).
> >
> > In the process many bugs were shaken out and ~300 LOC were removed.
> >
> > diffstat:
> >
> > drivers/ide/Kconfig | 6
> > drivers/ide/Makefile | 1
> > drivers/ide/ide-atapi.c | 296 ++++++++++++++++++++++
> > drivers/ide/ide-cd.c | 5
> > drivers/ide/ide-floppy.c | 431 +++++++-------------------------
> > drivers/ide/ide-tape.c | 630 ++++++++++++++---------------------------------
> > drivers/scsi/ide-scsi.c | 455 +++++++++++----------------------
> > include/linux/ide.h | 28 +-
> > 8 files changed, 777 insertions(+), 1075 deletions(-)
> >
> > Now, while this is a big step in the right direction there are still some
> > things left on TODO for generic ATAPI support to be complete:
> >
> > - convert ide-cd to use generic ATAPI code
> >
> > - kill pc and rq stacks in ide-{floppy,tape}
> >
> > - generic handling of REQUEST SENSE command
> >
> > - generic handling of MODE SENSE command for ide-{floppy,tape}
> >
> > - convert ide-{cd,floppy,tape} to use scatterlists for PIO transers
> > (ala ide-scsi)
> >
> > I know that Borislav is working on the first two items but other ones
> > are free at the moment so if you feel brave you may give it a try :-).
> >
> > PS I'll be travelling during this weekend and be rather busy with day job
> > so replies from me may be delayed a bit.
>
> Hi Bart,
>
> yep, these all look real good, makes all drivers really lightweight. Looks like
> ide-cd will follow not too far behind. By the way, here's another one you count apply ontop:
>
> From: Borislav Petkov <petkovbb@gmail.com>
> Date: Thu, 22 May 2008 09:36:53 +0200
> Subject: [PATCH] ide-tape: unify idetape_create_read/write_cmd
>
> A straightforward one. There should be no functional change resulting from this
> change.
>
> Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
applied with minor fixups (mainly to silence checkpatch.pl, interdiff below)
thanks!
diff -u b/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
--- b/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -954,7 +954,7 @@
static void ide_tape_create_rw_cmd(idetape_tape_t *tape,
struct ide_atapi_pc *pc, unsigned int length,
- struct idetape_bh *bh, int opcode)
+ struct idetape_bh *bh, u8 opcode)
{
idetape_init_pc(pc);
put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]);
@@ -969,14 +969,12 @@
if (opcode == READ_6) {
pc->c[0] = READ_6;
atomic_set(&bh->b_count, 0);
- }
- else if (opcode == WRITE_6) {
+ } else if (opcode == WRITE_6) {
pc->c[0] = WRITE_6;
pc->flags |= PC_FLAG_WRITING;
pc->b_data = bh->b_data;
pc->b_count = atomic_read(&bh->b_count);
- } else
- printk(KERN_ERR "%s: Invalid opcode: 0x%x\n", __func__, opcode);
+ }
}
static ide_startstop_t idetape_do_request(ide_drive_t *drive,
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH 14/40] ide-floppy: merge idefloppy_transfer_pc() and idefloppy_transfer_pc1()
2008-05-27 18:57 ` Bartlomiej Zolnierkiewicz
@ 2008-05-27 5:37 ` Borislav Petkov
2008-05-29 23:01 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 51+ messages in thread
From: Borislav Petkov @ 2008-05-27 5:37 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide, linux-kernel
On Tue, May 27, 2008 at 08:57:42PM +0200, Bartlomiej Zolnierkiewicz wrote:
> On Wednesday 21 May 2008, Borislav Petkov wrote:
> > On Sun, May 18, 2008 at 08:56:33PM +0200, Bartlomiej Zolnierkiewicz wrote:
> > > * Check IDEFLOPPY_FLAG_ZIP_DRIVE flag in idefloppy_transfer_pc1()
> > > and skip idefloppy_transfer_pc2()-phase if the flag is not set.
> > >
> > > * Always use idefloppy_transfer_pc1() in idefloppy_issue_pc()
> > > and remove no longer needed idefloppy_transfer_pc().
> >
> > ... and also probably mv idefloppy_transfer_pc1() to something like
> > idefloppy_start_transfer_pc() and rename idefloppy_transfer_pc2() to something
> > more appropriate like e.g. idefloppy_do_transfer_pc() or similar and do away
> > with those misleading names and probably even the comments are superfluous then.
>
> Probably the most intuitive would be to do:
>
> idefloppy_transfer_pc1() -> idefloppy_transfer_pc()
>
> and
>
> idefloppy_transfer_pc2() -> idefloppy_do_transfer_pc()
>
> but I don't feel too strong about it and welcome other ideas
> (preferably in form of patches :).
^Hint^! :) Sure, what about the following:
--
From: Borislav Petkov <petkovbb@gmail.com>
Date: Tue, 27 May 2008 07:31:37 +0200
Subject: [PATCH] ide-floppy: fix unfortunate function naming
mv idefloppy_transfer_pc1 idefloppy_start_pc_transfer
mv idefloppy_transfer_pc2 idefloppy_transfer_pc
which describes their functionality and disambiguates them. There should be no
functionality change introduced by this patch.
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
---
drivers/ide/ide-floppy.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 0f3602a..b368943 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -399,12 +399,8 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
* service routine. In interrupt mode, the device sends an interrupt to signal
* that it is ready to receive a packet. However, we need to delay about 2-3
* ticks before issuing the packet or we gets in trouble.
- *
- * So, follow carefully. transfer_pc1 is called as an interrupt (or directly).
- * In either case, when the device says it's ready for a packet, we schedule
- * the packet transfer to occur about 2-3 ticks later in transfer_pc2.
*/
-static int idefloppy_transfer_pc2(ide_drive_t *drive)
+static int idefloppy_transfer_pc(ide_drive_t *drive)
{
idefloppy_floppy_t *floppy = drive->driver_data;
@@ -415,7 +411,13 @@ static int idefloppy_transfer_pc2(ide_drive_t *drive)
return IDEFLOPPY_WAIT_CMD;
}
-static ide_startstop_t idefloppy_transfer_pc1(ide_drive_t *drive)
+
+/*
+ * Called as an interrupt (or directly). When the device says it's ready for a
+ * packet, we schedule the packet transfer to occur about 2-3 ticks later in
+ * transfer_pc.
+ */
+static ide_startstop_t idefloppy_start_pc_transfer(ide_drive_t *drive)
{
idefloppy_floppy_t *floppy = drive->driver_data;
struct ide_atapi_pc *pc = floppy->pc;
@@ -432,7 +434,7 @@ static ide_startstop_t idefloppy_transfer_pc1(ide_drive_t *drive)
*/
if (pc->flags & PC_FLAG_ZIP_DRIVE) {
timeout = floppy->ticks;
- expiry = &idefloppy_transfer_pc2;
+ expiry = &idefloppy_transfer_pc;
} else {
timeout = IDEFLOPPY_WAIT_CMD;
expiry = NULL;
@@ -483,7 +485,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
pc->retries++;
- return ide_issue_pc(drive, pc, idefloppy_transfer_pc1,
+ return ide_issue_pc(drive, pc, idefloppy_start_pc_transfer,
IDEFLOPPY_WAIT_CMD, NULL);
}
--
1.5.5.1
--
Regards/Gruß,
Boris.
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH 04/40] ide-scsi: fix Interrupt Reason checking in idescsi_pc_intr()
2008-05-19 5:10 ` Borislav Petkov
@ 2008-05-27 18:30 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-27 18:30 UTC (permalink / raw)
To: petkovbb; +Cc: linux-ide, linux-kernel
On Monday 19 May 2008, Borislav Petkov wrote:
> On Sun, May 18, 2008 at 08:55:03PM +0200, Bartlomiej Zolnierkiewicz wrote:
> > Set PC_FLAG_WRITING pc flag in idescsi_queue() (if needed)
> > and then fix Interrupt Reason checking in idescsi_pc_intr().
> >
> > Cc: Borislav Petkov <petkovbb@gmail.com>
> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > ---
> > drivers/scsi/ide-scsi.c | 17 +++++++++++------
> > 1 file changed, 11 insertions(+), 6 deletions(-)
> >
> > Index: b/drivers/scsi/ide-scsi.c
> > ===================================================================
> > --- a/drivers/scsi/ide-scsi.c
> > +++ b/drivers/scsi/ide-scsi.c
> > @@ -427,7 +427,15 @@ static ide_startstop_t idescsi_pc_intr (
> > printk(KERN_ERR "ide-scsi: CoD != 0 in idescsi_pc_intr\n");
> > return ide_do_reset (drive);
> > }
> > - if (ireason & IO) {
> > + if (((ireason & IO) == IO) == !!(pc->flags & PC_FLAG_WRITING)) {
> > + /* Hopefully, we will never get here */
> > + printk(KERN_ERR "%s: We wanted to %s, but the device wants us "
> > + "to %s!\n", drive->name,
> > + (ireason & IO) ? "Write" : "Read",
> > + (ireason & IO) ? "Read" : "Write");
> > + return ide_do_reset(drive);
> > + }
> > + if (!(pc->flags & PC_FLAG_WRITING)) {
> > temp = pc->xferred + bcount;
> > if (temp > pc->req_xfer) {
> > if (temp > pc->buf_size) {
> > @@ -436,7 +444,6 @@ static ide_startstop_t idescsi_pc_intr (
> > "- discarding data\n");
> > temp = pc->buf_size - pc->xferred;
> > if (temp) {
> > - pc->flags &= ~PC_FLAG_WRITING;
> > if (pc->sg)
> > idescsi_input_buffers(drive, pc,
> > temp);
> > @@ -457,15 +464,11 @@ static ide_startstop_t idescsi_pc_intr (
> > printk (KERN_NOTICE "ide-scsi: The scsi wants to send us more data than expected - allowing transfer\n");
> > #endif /* IDESCSI_DEBUG_LOG */
> > }
> > - }
> > - if (ireason & IO) {
> > - pc->flags &= ~PC_FLAG_WRITING;
> > if (pc->sg)
> > idescsi_input_buffers(drive, pc, bcount);
> > else
> > hwif->input_data(drive, NULL, pc->cur_pos, bcount);
> > } else {
> > - pc->flags |= PC_FLAG_WRITING;
>
> Yeah, what was the driver doing turning on/off that flag in the irq handler? Are
> those pc's getting reused in ide-scsi... I guess this is one of the bugs you
> were talking about :).
I guess that it was a left-over from the old days...
[ nowadays idescsi_queue() dynamically allocates new pc-s ]
Thanks,
Bart
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH 14/40] ide-floppy: merge idefloppy_transfer_pc() and idefloppy_transfer_pc1()
2008-05-21 5:24 ` Borislav Petkov
@ 2008-05-27 18:57 ` Bartlomiej Zolnierkiewicz
2008-05-27 5:37 ` Borislav Petkov
0 siblings, 1 reply; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-27 18:57 UTC (permalink / raw)
To: petkovbb; +Cc: linux-ide, linux-kernel
On Wednesday 21 May 2008, Borislav Petkov wrote:
> On Sun, May 18, 2008 at 08:56:33PM +0200, Bartlomiej Zolnierkiewicz wrote:
> > * Check IDEFLOPPY_FLAG_ZIP_DRIVE flag in idefloppy_transfer_pc1()
> > and skip idefloppy_transfer_pc2()-phase if the flag is not set.
> >
> > * Always use idefloppy_transfer_pc1() in idefloppy_issue_pc()
> > and remove no longer needed idefloppy_transfer_pc().
>
> ... and also probably mv idefloppy_transfer_pc1() to something like
> idefloppy_start_transfer_pc() and rename idefloppy_transfer_pc2() to something
> more appropriate like e.g. idefloppy_do_transfer_pc() or similar and do away
> with those misleading names and probably even the comments are superfluous then.
Probably the most intuitive would be to do:
idefloppy_transfer_pc1() -> idefloppy_transfer_pc()
and
idefloppy_transfer_pc2() -> idefloppy_do_transfer_pc()
but I don't feel too strong about it and welcome other ideas
(preferably in form of patches :).
Thanks,
Bart
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH 22/40] ide-floppy: start DMA engine in idefloppy_transfer_pc1()
2008-05-20 11:00 ` Sergei Shtylyov
@ 2008-05-27 18:58 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-27 18:58 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: linux-ide, Borislav Petkov, linux-kernel
On Tuesday 20 May 2008, Sergei Shtylyov wrote:
> Hello.
>
> Bartlomiej Zolnierkiewicz wrote:
>
> > Start DMA engine and set PC_FLAG_DMA_IN_PROGRESS flag in
> > idefloppy_transfer_pc1() instead of idefloppy_issue_pc()
>
> Good. I have long ago noticed that DMA is started too early in ide-floppy
> which is known to cobfuse some chips (like PDC20246) and was going to do a
> patch at first but the lack of hardware (and time) stopped me...
>
> > so the Status Register and the Interrupt Reason Register
> > are checked first.
>
> > Cc: Borislav Petkov <petkovbb@gmail.com>
> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
>
> > Index: b/drivers/ide/ide-floppy.c
> > ===================================================================
> > --- a/drivers/ide/ide-floppy.c
> > +++ b/drivers/ide/ide-floppy.c
> [...]
> > @@ -568,6 +569,12 @@ static ide_startstop_t idefloppy_transfe
> >
> > ide_set_handler(drive, &idefloppy_pc_intr, timeout, expiry);
> >
> > + /* Begin DMA, if necessary */
> > + if (pc->flags & PC_FLAG_DMA_OK) {
> > + pc->flags |= PC_FLAG_DMA_IN_PROGRESS;
> > + hwif->dma_ops->dma_start(drive);
> > + }
> > +
>
> May be too early still... ide-cd does this after writing the command packet.
I would rather say that ide-cd is doing things too late.
Now that's your patch opportunity! No excuses this time... ;)
Thanks,
Bart
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH 14/40] ide-floppy: merge idefloppy_transfer_pc() and idefloppy_transfer_pc1()
2008-05-27 5:37 ` Borislav Petkov
@ 2008-05-29 23:01 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 51+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-05-29 23:01 UTC (permalink / raw)
To: petkovbb; +Cc: linux-ide, linux-kernel
On Tuesday 27 May 2008, Borislav Petkov wrote:
> On Tue, May 27, 2008 at 08:57:42PM +0200, Bartlomiej Zolnierkiewicz wrote:
> > On Wednesday 21 May 2008, Borislav Petkov wrote:
> > > On Sun, May 18, 2008 at 08:56:33PM +0200, Bartlomiej Zolnierkiewicz wrote:
> > > > * Check IDEFLOPPY_FLAG_ZIP_DRIVE flag in idefloppy_transfer_pc1()
> > > > and skip idefloppy_transfer_pc2()-phase if the flag is not set.
> > > >
> > > > * Always use idefloppy_transfer_pc1() in idefloppy_issue_pc()
> > > > and remove no longer needed idefloppy_transfer_pc().
> > >
> > > ... and also probably mv idefloppy_transfer_pc1() to something like
> > > idefloppy_start_transfer_pc() and rename idefloppy_transfer_pc2() to something
> > > more appropriate like e.g. idefloppy_do_transfer_pc() or similar and do away
> > > with those misleading names and probably even the comments are superfluous then.
> >
> > Probably the most intuitive would be to do:
> >
> > idefloppy_transfer_pc1() -> idefloppy_transfer_pc()
> >
> > and
> >
> > idefloppy_transfer_pc2() -> idefloppy_do_transfer_pc()
> >
> > but I don't feel too strong about it and welcome other ideas
> > (preferably in form of patches :).
>
> ^Hint^! :) Sure, what about the following:
> --
>
> From: Borislav Petkov <petkovbb@gmail.com>
> Date: Tue, 27 May 2008 07:31:37 +0200
> Subject: [PATCH] ide-floppy: fix unfortunate function naming
>
> mv idefloppy_transfer_pc1 idefloppy_start_pc_transfer
> mv idefloppy_transfer_pc2 idefloppy_transfer_pc
>
> which describes their functionality and disambiguates them. There should be no
> functionality change introduced by this patch.
>
> Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
applied, thanks
^ permalink raw reply [flat|nested] 51+ messages in thread
end of thread, other threads:[~2008-05-29 23:21 UTC | newest]
Thread overview: 51+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-18 18:54 [PATCH 00/40] ide: generic ATAPI support Bartlomiej Zolnierkiewicz
2008-05-18 18:54 ` [PATCH 01/40] ide-scsi: fix race in idescsi_transfer_pc() Bartlomiej Zolnierkiewicz
2008-05-18 18:54 ` [PATCH 02/40] ide-scsi: fix DRQ checking for DMA transfers in idescsi_pc_intr() Bartlomiej Zolnierkiewicz
2008-05-18 18:54 ` [PATCH 03/40] ide-scsi: fix handling of DMA errors " Bartlomiej Zolnierkiewicz
2008-05-18 18:55 ` [PATCH 04/40] ide-scsi: fix Interrupt Reason checking " Bartlomiej Zolnierkiewicz
2008-05-19 5:10 ` Borislav Petkov
2008-05-27 18:30 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:55 ` [PATCH 05/40] ide-scsi: merge idescsi_input_buffers() and idescsi_output_buffers() Bartlomiej Zolnierkiewicz
2008-05-18 18:55 ` [PATCH 06/40] ide-scsi: remove superfluous BUG_ON() from idescsi_transfer_pc() Bartlomiej Zolnierkiewicz
2008-05-18 18:55 ` [PATCH 07/40] ide-scsi: add debug_log() macro Bartlomiej Zolnierkiewicz
2008-05-18 18:55 ` [PATCH 08/40] ide-tape: idetape_pc_intr() should use local_irq_enable_in_hardirq() Bartlomiej Zolnierkiewicz
2008-05-18 18:55 ` [PATCH 09/40] ide-tape: remove superfluous error message from idetape_pc_intr() Bartlomiej Zolnierkiewicz
2008-05-18 18:55 ` [PATCH 10/40] ide-tape: remove superfluous warning message from idetape_issue_pc() Bartlomiej Zolnierkiewicz
2008-05-18 18:56 ` [PATCH 11/40] ide-tape: remove unneeded CONFIG_BLK_DEV_IDEDMA ifdef Bartlomiej Zolnierkiewicz
2008-05-18 18:56 ` [PATCH 12/40] ide-tape: remove stale comments from idetape_pc_intr() Bartlomiej Zolnierkiewicz
2008-05-18 18:56 ` [PATCH 13/40] ide-tape: remove SIMULATE_ERRORS debug code Bartlomiej Zolnierkiewicz
2008-05-18 18:56 ` [PATCH 14/40] ide-floppy: merge idefloppy_transfer_pc() and idefloppy_transfer_pc1() Bartlomiej Zolnierkiewicz
2008-05-21 5:24 ` Borislav Petkov
2008-05-27 18:57 ` Bartlomiej Zolnierkiewicz
2008-05-27 5:37 ` Borislav Petkov
2008-05-29 23:01 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:56 ` [PATCH 15/40] ide-{floppy,tape,scsi}: log device name instead of driver name Bartlomiej Zolnierkiewicz
2008-05-18 18:56 ` [PATCH 16/40] ide-tape: make idetape_retry_pc() void Bartlomiej Zolnierkiewicz
2008-05-18 18:57 ` [PATCH 17/40] ide-tape: merge callbacks Bartlomiej Zolnierkiewicz
2008-05-18 18:57 ` [PATCH 18/40] ide-tape: make pc->idetape_callback void Bartlomiej Zolnierkiewicz
2008-05-18 18:57 ` [PATCH 19/40] ide-floppy: merge callbacks Bartlomiej Zolnierkiewicz
2008-05-18 18:57 ` [PATCH 20/40] ide-{floppy,tape}: merge pc->idefloppy_callback and pc->idetape_callback Bartlomiej Zolnierkiewicz
2008-05-18 18:57 ` [PATCH 21/40] ide-{floppy,tape}: PC_FLAG_DMA_RECOMMENDED -> PC_FLAG_DMA_OK Bartlomiej Zolnierkiewicz
2008-05-18 18:57 ` [PATCH 22/40] ide-floppy: start DMA engine in idefloppy_transfer_pc1() Bartlomiej Zolnierkiewicz
2008-05-20 11:00 ` Sergei Shtylyov
2008-05-27 18:58 ` Bartlomiej Zolnierkiewicz
2008-05-18 18:57 ` [PATCH 23/40] ide-tape: set PC_FLAG_DMA_IN_PROGRESS flag in idetape_transfer_pc() Bartlomiej Zolnierkiewicz
2008-05-18 18:58 ` [PATCH 24/40] ide-tape: factor out waiting for good ireason from idetape_transfer_pc() Bartlomiej Zolnierkiewicz
2008-05-18 18:58 ` [PATCH 25/40] ide: add PC_FLAG_ZIP_DRIVE pc flag Bartlomiej Zolnierkiewicz
2008-05-18 18:58 ` [PATCH 26/40] ide-{cd,floppy,tape}: remove checking for drive->scsi Bartlomiej Zolnierkiewicz
2008-05-18 18:58 ` [PATCH 27/40] ide-scsi: set drive->scsi flag for devices handled by the driver Bartlomiej Zolnierkiewicz
2008-05-18 18:58 ` [PATCH 28/40] ide: add ide_transfer_pc() helper Bartlomiej Zolnierkiewicz
2008-05-18 18:58 ` [PATCH 29/40] ide-scsi: move idescsi_map_sg() call out from idescsi_issue_pc() Bartlomiej Zolnierkiewicz
2008-05-18 18:58 ` [PATCH 30/40] ide: add PC_FLAG_DRQ_INTERRUPT pc flag Bartlomiej Zolnierkiewicz
2008-05-18 18:59 ` [PATCH 31/40] ide: add ide_issue_pc() helper Bartlomiej Zolnierkiewicz
2008-05-18 18:59 ` [PATCH 32/40] ide-{floppy,tape}: move checking of ->failed_pc to ->callback Bartlomiej Zolnierkiewicz
2008-05-18 18:59 ` [PATCH 33/40] ide-tape: factor out DSC handling from idetape_pc_intr() Bartlomiej Zolnierkiewicz
2008-05-18 18:59 ` [PATCH 34/40] ide-tape: add ide_tape_io_buffers() helper Bartlomiej Zolnierkiewicz
2008-05-18 18:59 ` [PATCH 35/40] ide-tape: always log debug info in idetape_pc_intr() if debugging is enabled Bartlomiej Zolnierkiewicz
2008-05-18 18:59 ` [PATCH 36/40] ide-floppy: add more debugging to idefloppy_pc_intr() Bartlomiej Zolnierkiewicz
2008-05-18 19:00 ` [PATCH 37/40] ide-scsi: use pc->callback Bartlomiej Zolnierkiewicz
2008-05-18 19:00 ` [PATCH 38/40] ide-scsi: add more debugging to idescsi_pc_intr() Bartlomiej Zolnierkiewicz
2008-05-18 19:00 ` [PATCH 39/40] ide-{floppy,scsi}: read Status Register before stopping DMA engine Bartlomiej Zolnierkiewicz
2008-05-18 19:00 ` [PATCH 40/40] ide: add ide_pc_intr() helper Bartlomiej Zolnierkiewicz
2008-05-22 7:43 ` [PATCH 00/40] ide: generic ATAPI support Borislav Petkov
2008-05-25 13:23 ` Bartlomiej Zolnierkiewicz
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).