Messages in this thread Patch in this message | | | From | mlord <> | Subject | Re: Linux v1.3.75 -- IDE fixes | Date | Sun, 17 Mar 1996 02:46:31 -0500 |
| |
Linus Torvalds wrote: ... > - promise caching IDE controller support (Mark Lord)
The promise code was developed by peterd@pnd-pc.demon.co.uk, but got slightly mangled by me when I merged it into the kernel.
Also broken are single-slave IDE drives (hdd with no hdc), sharing of a single irq between two IDE interfaces, and IDE cdroms in general (that "if (!suser())" in ide_ioctl).
At least folks here are real prompt in trying things out once Linus releases the patch files!
The fixes should also make it into 1.3.76.
Blush,
-ml the Linux IDE guy (who DID break things in 1.3.75). diff -u --recursive --new-file linux-1.3.75/Documentation/Configure.help linux/Documentation/Configure.help --- linux-1.3.75/Documentation/Configure.help Sun Mar 17 01:07:26 1996 +++ linux/Documentation/Configure.help Sun Mar 17 01:51:22 1996 @@ -168,6 +168,12 @@ or something similar. Be sure to consult the drivers/block/ide-tape.c and README.ide files for usage information. +Support removeable IDE interfaces (PCMCIA) +CONFIG_BLK_DEV_IDE_PCMCIA + This option adds code to the IDE driver to handle hot insertion + and removal of IDE interfaces and drives, under direction of an + external utility (?). Normally, just say N here. + CMD640 chipset bugfix/support CONFIG_BLK_DEV_CMD640 The CMD-Technologies CMD640 chip is used on many common 486 and @@ -248,7 +254,7 @@ card. This driver is known to incur timeouts/retries during heavy I/O to drives attached to the secondary interface. CDROM and TAPE devices are not supported yet. - See the README.ide and ali14xx.c files for more info. + See the README.ide and promise.c files for more info. XT harddisk support CONFIG_BLK_DEV_XD diff -u --recursive --new-file linux-1.3.75/drivers/block/ide.c linux/drivers/block/ide.c --- linux-1.3.75/drivers/block/ide.c Sun Mar 17 01:07:27 1996 +++ linux/drivers/block/ide.c Sun Mar 17 02:22:29 1996 @@ -1,5 +1,5 @@ /* - * linux/drivers/block/ide.c Version 5.33 Mar 15, 1996 + * linux/drivers/block/ide.c Version 5.34 Mar 16, 1996 * * Copyright (C) 1994-1996 Linus Torvalds & authors (see below) */ @@ -218,7 +218,9 @@ * add config option for PCMCIA baggage * try to make PCMCIA support safer to use * improve security on ioctls(): all are suser() only - * Version 5.33 improve handling of HDIO_DRIVE_CMDs that read data + * Version 5.33 improve handling of HDIO_DRIVE_CMDs that read data + * Version 5.34 fix irq-sharing problem from 5.33 + * fix cdrom ioctl problem from 5.33 * * Some additional driver compile-time options are in ide.h * @@ -1893,8 +1895,6 @@ unsigned long flags; struct request rq; - if (!suser()) - return -EACCES; if (!inode || !(inode->i_rdev)) return -EINVAL; if ((drive = get_info_ptr(inode->i_rdev)) == NULL) @@ -1915,11 +1915,13 @@ return 0; } case BLKFLSBUF: + if (!suser()) return -EACCES; fsync_dev(inode->i_rdev); invalidate_buffers(inode->i_rdev); return 0; case BLKRASET: + if (!suser()) return -EACCES; if(arg > 0xff) return -EINVAL; read_ahead[MAJOR(inode->i_rdev)] = arg; return 0; @@ -1930,6 +1932,7 @@ case BLKGETSIZE: /* Return device size */ return write_fs_long(arg, drive->part[MINOR(inode->i_rdev)&PARTN_MASK].nr_sects); case BLKRRPART: /* Re-read partition tables */ + if (!suser()) return -EACCES; return revalidate_disk(inode->i_rdev); case HDIO_GET_KEEPSETTINGS: @@ -1961,6 +1964,7 @@ return write_fs_long(arg, drive->bad_wstat == BAD_R_STAT); case HDIO_SET_DMA: + if (!suser()) return -EACCES; #ifdef CONFIG_BLK_DEV_IDECD if (drive->media == ide_cdrom) return -EPERM; @@ -1973,6 +1977,7 @@ if (arg > 1) return -EINVAL; case HDIO_SET_32BIT: + if (!suser()) return -EACCES; if ((MINOR(inode->i_rdev) & PARTN_MASK)) return -EINVAL; save_flags(flags); @@ -2012,6 +2017,7 @@ return 0; case HDIO_SET_MULTCOUNT: + if (!suser()) return -EACCES; if (MINOR(inode->i_rdev) & PARTN_MASK) return -EINVAL; if (drive->id && arg > drive->id->max_multsect) @@ -2032,6 +2038,7 @@ { byte args[4], *argbuf = args; int argsize = 4; + if (!suser()) return -EACCES; if (NULL == (void *) arg) { err = ide_do_drive_cmd(drive, &rq, ide_wait); } else if (!(err = verify_area(VERIFY_READ,(void *)arg, 4))) { @@ -2057,6 +2064,7 @@ return err; } case HDIO_SET_PIO_MODE: + if (!suser()) return -EACCES; if (MINOR(inode->i_rdev) & PARTN_MASK) return -EINVAL; if (!HWIF(drive)->tuneproc) @@ -2973,22 +2981,20 @@ * Handle serialization, regardless of init sequence */ mate_hwif = &ide_hwifs[hwif->index ^ 1]; - if (hwif->serialized && mate_hwif->present) { - hwgroup = mate_hwif->hwgroup; + if (hwif->serialized && mate_hwif->present) mate_irq = mate_hwif->irq; - } /* - * If another hwif is sharing our irq, then join its hwgroup. + * Group up with any other hwifs that share our irq(s) */ - if (hwgroup == NULL) { - for (index = 0; index < MAX_HWIFS; index++) { - if (index != hwif->index) { - ide_hwif_t *g = &ide_hwifs[index]; - if (g->irq == hwif->irq || g->irq == mate_irq) { - hwgroup = ide_hwifs[index].hwgroup; - break; - } + for (index = 0; index < MAX_HWIFS; index++) { + if (index != hwif->index) { + ide_hwif_t *g = &ide_hwifs[index]; + if (g->irq == hwif->irq || g->irq == mate_irq) { + if (hwgroup && !g->hwgroup) + g->hwgroup = hwgroup; + else if (!hwgroup) + hwgroup = g->hwgroup; } } } @@ -3001,7 +3007,10 @@ hwgroup->hwif = hwgroup->next_hwif = hwif->next = hwif; hwgroup->rq = NULL; hwgroup->handler = NULL; - hwgroup->drive = &hwif->drives[0]; + if (hwif->drives[0].present) + hwgroup->drive = &hwif->drives[0]; + else + hwgroup->drive = &hwif->drives[1]; hwgroup->poll_timeout = 0; init_timer(&hwgroup->timer); hwgroup->timer.function = &timer_expiry; @@ -3016,7 +3025,11 @@ restore_flags(flags); return 1; } - hwif->got_irq = 1; + for (index = 0; index < MAX_HWIFS; index++) { + ide_hwif_t *g = &ide_hwifs[index]; + if (g->irq == hwif->irq) + g->got_irq = 1; + } } /* diff -u --recursive --new-file linux-1.3.75/drivers/block/promise.c linux/drivers/block/promise.c --- linux-1.3.75/drivers/block/promise.c Sun Mar 17 01:07:27 1996 +++ linux/drivers/block/promise.c Sun Mar 17 02:27:10 1996 @@ -25,6 +25,7 @@ * Version 0.04 Updated for ide.c version 5.30 * Changed initialization strategy * Version 0.05 Kernel integration. -ml + * Version 0.06 Ooops. Add hwgroup to direct call of ide_intr() -ml */ @@ -58,6 +59,7 @@ #include <linux/blkdev.h> #include <linux/hdreg.h> #include <asm/io.h> +#include <asm/irq.h> #include "ide.h" #include "promise.h" @@ -319,7 +321,13 @@ do { stat=GET_STAT(); if(stat & DRQ_STAT) { - ide_intr(HWIF(drive)->irq,NULL,NULL); + unsigned long flags; + save_flags(flags); + cli(); + disable_irq(HWIF(drive)->irq); + ide_intr(HWIF(drive)->irq,HWGROUP(drive),NULL); + enable_irq(HWIF(drive)->irq); + restore_flags(flags); return; } if(IN_BYTE(io_base+IDE_SELECT_OFFSET) & 0x01) | |