# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.600 -> 1.601 # drivers/ide/legacy/pdc4030.c 1.3 -> 1.4 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 02/09/23 axboe@burns.home.kernel.dk 1.601 # make pdc4030 work # -------------------------------------------- # diff -Nru a/drivers/ide/legacy/pdc4030.c b/drivers/ide/legacy/pdc4030.c --- a/drivers/ide/legacy/pdc4030.c Mon Sep 23 11:34:33 2002 +++ b/drivers/ide/legacy/pdc4030.c Mon Sep 23 11:34:33 2002 @@ -462,7 +462,7 @@ rq->nr_sectors -= nsect; total_remaining = rq->nr_sectors; if ((rq->current_nr_sectors -= nsect) <= 0) { - DRIVER(drive)->end_request(drive, 1); + DRIVER(drive)->end_request(drive, 1, 0); } /* * Now the data has been read in, do the following: @@ -539,7 +539,7 @@ #endif /* DEBUG_WRITE */ for (i = rq->nr_sectors; i > 0; ) { i -= rq->current_nr_sectors; - DRIVER(drive)->end_request(drive, 1); + DRIVER(drive)->end_request(drive, 1, 0); } return ide_stopped; } @@ -584,16 +584,24 @@ /* Do we move to the next bh after this? */ if (!rq->current_nr_sectors) { - struct buffer_head *bh = rq->bh->b_reqnext; + struct bio *bio = rq->bio; + + /* + * only move to next bio, when we have processed + * all bvecs in this one. + */ + if (++bio->bi_idx >= bio->bi_vcnt) { + bio->bi_idx = 0; + bio = bio->bi_next; + } /* end early early we ran out of requests */ - if (!bh) { + if (!bio) { mcount = 0; } else { - rq->bh = bh; - rq->current_nr_sectors = bh->b_size >> 9; + rq->bio = bio; + rq->current_nr_sectors = bio_iovec(bio)->bv_len >> 9; rq->hard_cur_sectors = rq->current_nr_sectors; - rq->buffer = bh->b_data; } } @@ -720,6 +728,12 @@ unsigned long timeout; u8 stat = 0; + if (!blk_fs_request(rq)) { + blk_dump_rq_flags(rq, "do_pdc4030_io - bad command"); + DRIVER(drive)->end_request(drive, 0, 0); + return ide_stopped; + } + #ifdef CONFIG_IDE_TASKFILE_IO if (IDE_CONTROL_REG) HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG); /* clear nIEN */ @@ -735,8 +749,7 @@ HWIF(drive)->OUTB(taskfile->command, IDE_COMMAND_REG); #endif /* CONFIG_IDE_TASKFILE_IO */ - switch(rq->cmd) { - case READ: + if (rq_data_dir(rq) == READ) { #ifndef CONFIG_IDE_TASKFILE_IO HWIF(drive)->OUTB(PROMISE_READ, IDE_COMMAND_REG); #endif /* CONFIG_IDE_TASKFILE_IO */ @@ -774,7 +787,7 @@ printk(KERN_ERR "%s: reading: No DRQ and not " "waiting - Odd!\n", drive->name); return ide_stopped; - case WRITE: + } else { #ifndef CONFIG_IDE_TASKFILE_IO HWIF(drive)->OUTB(PROMISE_WRITE, IDE_COMMAND_REG); #endif /* CONFIG_IDE_TASKFILE_IO */ @@ -788,11 +801,6 @@ local_irq_disable(); HWGROUP(drive)->wrq = *rq; /* scratchpad */ return promise_write(drive); - default: - printk("KERN_WARNING %s: bad command: %d\n", - drive->name, rq->cmd); - DRIVER(drive)->end_request(drive, 0); - return ide_stopped; } }