Fix for ide problems in 2.2.14pre15

Mark Lord (mlord@pobox.com)
Sun, 19 Dec 1999 16:20:56 -0500


This is a multi-part message in MIME format.
--------------4069CB714D39E59230C19240
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Okay,

Here is a patch that fixes all of the IDE trouble
I can find/reproduce from 2.2.14pre15 (including the multwrite bugs):

-- completely restores the multwrite and write behaviour
back to what was in 2.2.13 (two very subtle one-liners).

-- fixes the unsigned<=0 comparisms (day-1 bug in IDE).

-- fixes a problem I found today whereby two IDE interfaces
sharing a PCI interrupt get confused when using PIO mode
(was never an issue for DMA transfers, which is why most
users never see this problem).

I don't know if it completely fixes Petri's system or not,
but he should give it a try.

Is anyone out there still having IDE trouble once this patch
is applied to a fresh 2.2.14pre15 ??

Alan -- I'll be away for a bit beginning tomorrow
(I've already delayed the trip 36 hours to work on this problem).

I can read/reply email, but won't have access to the machine
I used to reproduce the multwrite bugs.

--
Mark Lord
Real-Time Remedies Inc.
mlord@pobox.com
--------------4069CB714D39E59230C19240
Content-Type: text/plain; charset=us-ascii;
 name="ide-2.2.14pre15.fix4"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="ide-2.2.14pre15.fix4"

diff -u --recursive --new-file --exclude=.* linux-2.2.14pre15x/drivers/block/ide-disk.c linux/drivers/block/ide-disk.c --- linux-2.2.14pre15x/drivers/block/ide-disk.c Sat Dec 18 16:03:17 1999 +++ linux/drivers/block/ide-disk.c Sun Dec 19 16:06:25 1999 @@ -137,10 +137,20 @@ int i; unsigned int msect, nsect; struct request *rq; - +#if 0 if (!OK_STAT(stat=GET_STAT(),DATA_READY,BAD_R_STAT)) { return ide_error(drive, "read_intr", stat); } +#else /* new way for dealing with premature shared PCI interrupts */ + if (!OK_STAT(stat=GET_STAT(),DATA_READY,BAD_R_STAT)) { + if (stat & (ERR_STAT|DRQ_STAT)) { + return ide_error(drive, "read_intr", stat); + } + /* no data yet, so wait for another interrupt */ + ide_set_handler(drive, &read_intr, WAIT_CMD); + return ide_started; + } +#endif msect = drive->mult_count; read_next: @@ -161,7 +171,7 @@ rq->buffer += nsect<<9; rq->errors = 0; i = (rq->nr_sectors -= nsect); - if ((rq->current_nr_sectors -= nsect) <= 0) + if (((long)(rq->current_nr_sectors -= nsect)) <= 0) ide_end_request(1, HWGROUP(drive)); if (i > 0) { if (msect) @@ -196,7 +206,7 @@ rq->errors = 0; i = --rq->nr_sectors; --rq->current_nr_sectors; - if (rq->current_nr_sectors <= 0) + if (((long)rq->current_nr_sectors) <= 0) ide_end_request(1, hwgroup); if (i > 0) { idedisk_output_data (drive, rq->buffer, SECTOR_WORDS); @@ -205,7 +215,7 @@ } return ide_stopped; } - printk("%s: write_intr error2: nr_sectors=%ld, stat=0x%02x\n", drive->name, rq->nr_sectors, stat); + return ide_stopped; /* the original code did this here (?) */ } return ide_error(drive, "write_intr", stat); } @@ -251,7 +261,7 @@ * Completed ? */ - if ((rq->nr_sectors -= nsect) <= 0) + if (((long)(rq->nr_sectors -= nsect)) <= 0) { spin_unlock_irqrestore(&io_request_lock, flags); break; @@ -275,7 +285,7 @@ * deep crap */ spin_unlock_irqrestore(&io_request_lock, flags); - printk("%s: buffer list corrupted (%d, %d, %d)\n", drive->name, + printk("%s: buffer list corrupted (%ld, %ld, %d)\n", drive->name, rq->current_nr_sectors, rq->nr_sectors, nsect); ide_end_request(0, hwgroup); return 1; @@ -325,6 +335,7 @@ return ide_stopped; } } + return ide_stopped; /* the original code did this here (?) */ } return ide_error(drive, "multwrite_intr", stat); }

--------------4069CB714D39E59230C19240--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/