lkml.org 
[lkml]   [1998]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: 2.0.34pre6
Oops.. this copy actually has the patch attached!

mlord wrote:
>
> Alan Cox wrote:
> >
> > > Would you be interested in an update to prevent IDE UltraDMA
> > > from frying people's filesystems in 2.0.xx ?
> >
> > This sounds an extremely good idea ;) How is support for >8Gig units btw ?
>
> Alan,
>
> Attached is a patch against linux-2.0.34pre7 which adds UltraDMA
> detection/support, as well as support for >8Gig units.
>
> I have back-ported this code from 2.1.92, but cannot test it completely
> on my own system (my systems cannot boot under 2.0.34 for various
> good reasons).
>
> The patch does NOT include auto-detection/configuration
> of the Promise Ultra33 cards -- need full 2.1.xx for that stuff.
>
> Cheers.
> --
> mlord@pobox.com
> The Linux IDE guy

--
mlord@pobox.com
The Linux IDE guy
Binary files linux-2.0.34pre7/drivers/block/IP-Masquerade.gz and linux/drivers/block/IP-Masquerade.gz differ
diff -u --recursive --new-file --exclude=.* linux-2.0.34pre7/drivers/block/ide.c linux/drivers/block/ide.c
--- linux-2.0.34pre7/drivers/block/ide.c Mon Aug 4 14:45:55 1997
+++ linux/drivers/block/ide.c Tue Apr 7 01:08:02 1998
@@ -272,6 +272,7 @@
* acknowledge media change on removable drives
* add work-around for BMI drives
* remove "LBA" from boot messages
+ * Version 5.53.1 add UDMA "CRC retry" support
*
* Some additional driver compile-time options are in ide.h
*
@@ -602,6 +603,11 @@
unsigned long chs_sects = id->cyls * id->heads * id->sectors;
unsigned long _10_percent = chs_sects / 10;

+ /* very large drives (8GB+) may lie about the number of cylinders */
+ if (id->cyls == 16383 && id->heads == 16 && id->sectors == 63 && lba_sects > chs_sects) {
+ id->cyls = lba_sects / (16 * 63); /* correct cyls */
+ return 1; /* lba_capacity is our only option */
+ }
/* perform a rough sanity check on lba_sects: within 10% is "okay" */
if ((lba_sects - chs_sects) < _10_percent)
return 1; /* lba_capacity is good */
@@ -636,6 +642,7 @@
/* Determine capacity, and use LBA if the drive properly supports it */
if (id != NULL && (id->capability & 2) && lba_capacity_is_ok(id)) {
if (id->lba_capacity >= capacity) {
+ drive->cyl = id->lba_capacity / (drive->head * drive->sect);
capacity = id->lba_capacity;
drive->select.b.lba = 1;
}
@@ -1043,12 +1050,15 @@
} else {
if (drive->media == ide_disk && (stat & ERR_STAT)) {
/* err has different meaning on cdrom and tape */
- if (err & (BBD_ERR | ECC_ERR)) /* retries won't help these */
+ if (err == ABRT_ERR) {
+ if (drive->select.b.lba && IN_BYTE(IDE_COMMAND_REG) == WIN_SPECIFY)
+ return; /* some newer drives don't support WIN_SPECIFY */
+ } else if ((err & (ABRT_ERR | ICRC_ERR)) == (ABRT_ERR | ICRC_ERR))
+ ; /* UDMA crc error -- just retry the operation */
+ else if (err & (BBD_ERR | ECC_ERR)) /* retries won't help these */
rq->errors = ERROR_MAX;
else if (err & TRK0_ERR) /* help it find track zero */
rq->errors |= ERROR_RECAL;
- else if (err & MC_ERR)
- drive->special.b.mc = 1;
}
if ((stat & DRQ_STAT) && rq->cmd != WRITE)
try_to_flush_leftover_data(drive);
@@ -2561,14 +2571,16 @@
drive->head = id->heads;
drive->sect = id->sectors;
}
+
+ /* calculate drive capacity, and select LBA if possible */
+ (void) current_capacity (drive);
+
/* Correct the number of cyls if the bios value is too small */
if (drive->sect == drive->bios_sect && drive->head == drive->bios_head) {
if (drive->cyl > drive->bios_cyl)
drive->bios_cyl = drive->cyl;
}

- (void) current_capacity (drive); /* initialize LBA selection */
-
if (!strncmp(id->model, "BMI ", 4) &&
strstr(id->model, " ENHANCED IDE ") &&
drive->select.b.lba)
@@ -2587,8 +2599,12 @@
drive->special.b.set_multmode = 1;
}
if (drive->autotune != 2 && HWIF(drive)->dmaproc != NULL) {
- if (!(HWIF(drive)->dmaproc(ide_dma_check, drive)))
- printk(", DMA");
+ if (!(HWIF(drive)->dmaproc(ide_dma_check, drive))) {
+ if ((id->field_valid & 4) && (id->dma_ultra & (id->dma_ultra >> 8) & 7))
+ printk(", UDMA");
+ else
+ printk(", DMA");
+ }
}
printk("\n");
}
diff -u --recursive --new-file --exclude=.* linux-2.0.34pre7/drivers/block/triton.c linux/drivers/block/triton.c
--- linux-2.0.34pre7/drivers/block/triton.c Sun Sep 22 02:54:08 1996
+++ linux/drivers/block/triton.c Tue Apr 7 10:38:08 1998
@@ -247,14 +247,21 @@
static int config_drive_for_dma (ide_drive_t *drive)
{
const char **list;
-
struct hd_driveid *id = drive->id;
+
if (id && (id->capability & 1)) {
- /* Enable DMA on any drive that supports mword2 DMA */
- if ((id->field_valid & 2) && (id->dma_mword & 0x404) == 0x404) {
- drive->using_dma = 1;
- return 0; /* DMA enabled */
- }
+ /* Enable DMA on any drive that has UltraDMA (mode 0/1/2) enabled */
+ if (id->field_valid & 4) /* UltraDMA */
+ if ((id->dma_ultra & (id->dma_ultra >> 8) & 7)) {
+ drive->using_dma = 1;
+ return 0; /* dma enabled */
+ }
+ /* Enable DMA on any drive that has mode2 DMA (multi or single) enabled */
+ if (id->field_valid & 2) /* regular DMA */
+ if ((id->dma_mword & 0x404) == 0x404 || (id->dma_1word & 0x404) == 0x404) {
+ drive->using_dma = 1;
+ return 0; /* dma enabled */
+ }
/* Consult the list of known "good" drives */
list = good_dma_drives;
while (*list) {
diff -u --recursive --new-file --exclude=.* linux-2.0.34pre7/include/linux/hdreg.h linux/include/linux/hdreg.h
--- linux-2.0.34pre7/include/linux/hdreg.h Tue Dec 2 17:18:11 1997
+++ linux/include/linux/hdreg.h Tue Apr 7 10:36:38 1998
@@ -78,7 +78,8 @@
#define ID_ERR 0x10 /* ID field not found */
#define MC_ERR 0x20 /* media changed */
#define ECC_ERR 0x40 /* Uncorrectable ECC error */
-#define BBD_ERR 0x80 /* block marked bad */
+#define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */
+#define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */

struct hd_geometry {
unsigned char heads;
@@ -151,11 +152,28 @@
unsigned short eide_dma_time; /* recommended mword dma cycle time (ns) */
unsigned short eide_pio; /* min cycle time (ns), no IORDY */
unsigned short eide_pio_iordy; /* min cycle time (ns), with IORDY */
- unsigned short reserved69; /* reserved (word 69) */
- unsigned short reserved70; /* reserved (word 70) */
- /* unsigned short reservedxx[57];*/ /* reserved (words 71-127) */
- /* unsigned short vendor7 [32];*/ /* vendor unique (words 128-159) */
- /* unsigned short reservedyy[96];*/ /* reserved (words 160-255) */
+ unsigned short word69;
+ unsigned short word70;
+ /* HDIO_GET_IDENTITY currently returns only words 0 through 70 */
+ unsigned short word71;
+ unsigned short word72;
+ unsigned short word73;
+ unsigned short word74;
+ unsigned short word75;
+ unsigned short word76;
+ unsigned short word77;
+ unsigned short word78;
+ unsigned short word79;
+ unsigned short word80;
+ unsigned short word81;
+ unsigned short word82;
+ unsigned short word83;
+ unsigned short word84;
+ unsigned short word85;
+ unsigned short word86;
+ unsigned short word87;
+ unsigned short dma_ultra;
+ unsigned short reserved[167];
};

#ifdef __KERNEL__
\
 
 \ /
  Last update: 2005-03-22 13:42    [from the cache]
©2003-2011 Jasper Spaans