From 0294f4bd40fb64f660ea4568b9e7f2370bb8cbaa Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 23 Nov 2007 15:10:58 -0500 Subject: [PATCH] Import 1.3.100 --- CREDITS | 15 ++ Documentation/Configure.help | 34 +++-- Documentation/devices.tex | 18 ++- Documentation/devices.txt | 11 +- Documentation/filesystems/affs.txt | 12 +- Documentation/java.txt | 91 ++++++++++++ Documentation/modules.txt | 1 + MAINTAINERS | 7 +- Makefile | 2 +- arch/alpha/defconfig | 1 - arch/i386/config.in | 1 + arch/i386/defconfig | 2 +- arch/i386/kernel/setup.c | 2 +- arch/i386/math-emu/fpu_emu.h | 3 +- drivers/block/floppy.c | 147 ++++++++++--------- drivers/block/ide-cd.c | 70 +++++++-- drivers/block/ide.c | 121 ++++++++++------ drivers/block/ide.h | 1 - drivers/block/ll_rw_blk.c | 6 +- drivers/block/umc8672.c | 4 +- drivers/char/ChangeLog | 18 +++ drivers/char/msbusmouse.c | 11 +- drivers/char/random.c | 54 ++++--- drivers/net/hydra.c | 2 +- drivers/net/hydra.h | 2 +- drivers/scsi/Config.in | 2 +- drivers/scsi/advansys.c | 100 +++++++------ drivers/scsi/aha152x.c | 4 +- drivers/scsi/eata_dma.c | 2 +- drivers/scsi/in2000.c | 87 ++++++------ drivers/scsi/in2000.h | 47 +------ drivers/scsi/in2000.readme | 64 +-------- fs/Makefile | 8 ++ fs/affs/amigaffs.c | 2 +- fs/affs/namei.c | 2 +- fs/binfmt_java.c | 187 +++++++++++++++++++++++++ fs/exec.c | 4 + fs/fat/buffer.c | 21 +-- fs/fat/cache.c | 56 ++++---- fs/fat/dir.c | 3 +- fs/fat/file.c | 51 ++++--- fs/fat/inode.c | 68 +++++---- fs/fat/misc.c | 63 +++++---- fs/fat/msbuffer.h | 21 --- fs/msdos/namei.c | 75 +++++----- fs/vfat/namei.c | 60 ++++---- include/asm-alpha/termbits.h | 1 + include/{linux => asm-i386}/math_emu.h | 0 include/asm-i386/processor.h | 3 + include/asm-i386/termbits.h | 1 + include/{linux => asm-i386}/vm86.h | 0 include/asm-m68k/serial.h | 2 +- include/asm-m68k/termbits.h | 1 + include/asm-mips/ioctls.h | 1 + include/asm-ppc/termios.h | 1 + include/asm-sparc/floppy.h | 2 + include/asm-sparc/termbits.h | 1 + include/linux/affs_fs_sb.h | 4 +- include/linux/amigaffs.h | 2 +- include/linux/binfmts.h | 1 + include/linux/cdrom.h | 6 + include/linux/kerneld.h | 20 +++ include/linux/msg.h | 1 + include/linux/random.h | 14 +- include/linux/sched.h | 2 - include/scsi/scsi_ioctl.h | 4 + init/main.c | 4 + ipc/msg.c | 157 ++++++++++++++------- net/ipv4/arp.c | 4 +- 69 files changed, 1150 insertions(+), 645 deletions(-) create mode 100644 Documentation/java.txt create mode 100644 fs/binfmt_java.c rename include/{linux => asm-i386}/math_emu.h (100%) rename include/{linux => asm-i386}/vm86.h (100%) diff --git a/CREDITS b/CREDITS index 73ac9b6fccdf..b129d4362466 100644 --- a/CREDITS +++ b/CREDITS @@ -425,6 +425,13 @@ S: 6/1 M.Koneva bl, apt #125 S: Poltava 314023 S: Ukraine +N: John E. Gotts +E: jgotts@engin.umich.edu +D: kernel hacker +S: 8124 Constitution Apt. 7 +S: Sterling Heights, MI 48313 +S: USA + N: Grant Guenther E: grant@torque.net D: Iomega PPA / ZIP driver @@ -984,6 +991,14 @@ S: Tallak 95 S: 8103 Rein S: Austria +N: Stefan Reinauer +E: stepan@home.culture.mipt.ru +W: http://home.culture.mipt.ru/~stepan +D: Modulized affs and ufs. Minor fixes. +S: Rebmannsweg 34h +S: 79539 Loerrach +S: Germany + N: William E. Roadcap E: roadcapw@cfw.com W: http://www.cfw.com/~roadcapw diff --git a/Documentation/Configure.help b/Documentation/Configure.help index 3e049b06a793..3e419a64630e 100644 --- a/Documentation/Configure.help +++ b/Documentation/Configure.help @@ -608,6 +608,21 @@ CONFIG_BINFMT_AOUT format. Saying M or N here is dangerous, because some crucial programs on your system might be in A.OUT format. +Kernel support for JAVA binaries +CONFIG_BINFMT_JAVA + JAVA binaries are becoming a universal executable format. This + option allows Java binaries and Java Applets to be handled invisibly + to the OS. As more and more Java programs become available, the use + for this will gradually increase. If you want to use this, read the + Java on Linux HOWTO, available via ftp (user: anonymous) at + sunsite.unc.edu:/pub/Linux/docs/HOWTO. In order to execute Java binaries, + you will also need to install the Java Developers Kit. If you disable + this option it will reduce your kernel by about one page. This is not + much and by itself does not warrant removing support. However its + removal is a good idea if you do not have the JDK installed. If you + don't know what to answer at this point then answer Y. You may answer + M for module support and later load the module when you install the + JDK or find a interesting Java program that you can't live without. Processor type CONFIG_M386 This is the processor type of your CPU. It is used for optimizing @@ -1369,18 +1384,15 @@ CONFIG_SCSI_NCR53C7xx_DISCONNECT ### Dunno ### -Always IN2000 SCSI support (test release) +Always IN2000 SCSI support CONFIG_SCSI_IN2000 - Believe it or not, there is a SCSI host adaptor of that name. It is - explained in section 3.6 of the SCSI-HOWTO, available via ftp (user: - anonymous) at sunsite.unc.edu:/pub/Linux/docs/HOWTO. If it doesn't - work out of the box, you may have to change some settings in - drivers/scsi/in2000.h. You may also want to drop in a rewritten, - and probably more reliable, driver from John Shifflett, which you - can get from ftp://ftp.netcom.com/pub/js/jshiffle/in2000/ . If you - want to compile this as a module ( = code which can be inserted in - and removed from the running kernel whenever you want), say M here - and read Documentation/modules.txt. + This is support for an ISA bus SCSI host adaptor. You'll find + more information in drivers/scsi/in2000.readme. If it doesn't + work out of the box, you may have to change the jumpers for IRQ + or address selection. If you want to compile this as a module + ( = code which can be inserted in and removed from the running + kernel whenever you want), say M here and read + Documentation/modules.txt. PAS16 SCSI support CONFIG_SCSI_PAS16 diff --git a/Documentation/devices.tex b/Documentation/devices.tex index eb4e2e033539..47870506e070 100644 --- a/Documentation/devices.tex +++ b/Documentation/devices.tex @@ -42,7 +42,7 @@ foo \kill}% % \title{{\bf Linux Allocated Devices}} \author{Maintained by H. Peter Anvin $<$hpa@zytor.com$>$} -\date{Last revised: May 5, 1996} +\date{Last revised: May 9, 1996} \maketitle % \noindent @@ -167,7 +167,8 @@ least not without contacting me first. \major{48}{}{char }{SDL RISCom serial card} \major{49}{}{char }{SDL RISCom serial card -- alternate devices} \major{50}{}{char }{Reserved for GLINT} -\major{51}{--59}{}{Unallocated} +\major{51}{}{char }{Baycom radio modem} +\major{52}{--59}{}{Unallocated} \major{60}{--63}{}{Local/experimental use} \major{64}{--119}{}{Unallocated} \major{120}{--127}{}{Local/experimental use} @@ -1027,7 +1028,18 @@ driver with this number should not cause ill effects to the system \end{devicelist} \begin{devicelist} -\major{50}{--59}{}{Unallocated} +\major{50}{}{char}{Reserved for GLINT} +\end{devicelist} + +\begin{devicelist} +\major{51}{}{char }{Baycom radio modem} + \minor{0}{/dev/bc0}{First Baycom radio modem} + \minor{1}{/dev/bc1}{Second Baycom radio modem} + \minordots +\end{devicelist} + +\begin{devicelist} +\major{52}{--59}{}{Unallocated} \end{devicelist} \begin{devicelist} diff --git a/Documentation/devices.txt b/Documentation/devices.txt index 3ebcd42b5db1..39afd54c1991 100644 --- a/Documentation/devices.txt +++ b/Documentation/devices.txt @@ -2,7 +2,7 @@ Maintained by H. Peter Anvin - Last revised: May 5, 1996 + Last revised: May 9, 1996 This list is the successor to Rick Miller's Linux Device List, which he stopped maintaining when he got busy with other things in 1993. It @@ -708,7 +708,14 @@ least not without contacting me first. 1 = /dev/cul1 Callout device corresponding to ttyL1 ... - 50-59 UNALLOCATED + 50 char Reserved for GLINT + + 51 char Baycom radio modem + 0 = /dev/bc0 First Baycom radio modem + 1 = /dev/bc1 Second Baycom radio modem + ... + + 52-59 UNALLOCATED 60-63 LOCAL/EXPERIMENTAL USE Allocated for local/experimental use. For devices not diff --git a/Documentation/filesystems/affs.txt b/Documentation/filesystems/affs.txt index 2e9153d1821f..4e47d29e5de9 100644 --- a/Documentation/filesystems/affs.txt +++ b/Documentation/filesystems/affs.txt @@ -19,7 +19,7 @@ DOS\3 The "international" Fast File System. Supported. DOS\4 The original filesystem with directory cache. The directory cache speeds up directory accesses on floppies considerably, - but slowes down file creation/deletion. Doesn't make much + but slows down file creation/deletion. Doesn't make much sense on hard disks. Not supported. DOS\5 The Fast File System with directory cache. Not supported. @@ -37,7 +37,7 @@ protect If this option is set, the protection bits cannot be altered. uid[=uid] This sets the uid of the root directory (i. e. the mount point to uid or to the uid of the current user, if the =uid is - ommitted. + omitted. gid[=gid] Same as above, but for gid. @@ -49,7 +49,7 @@ setgid[=gid] Same as above, but for gid. use_mp The uid and gid are taken from the now covered mount point instead of the current user or value defined. -mode=mode Sets the mode flags to the given (octal) value, regardles +mode=mode Sets the mode flags to the given (octal) value, regardless of the original permissions. Directories will get an x permission, if the corresponding r bit is set. This is useful since most of the plain AmigaOS files @@ -58,12 +58,12 @@ mode=mode Sets the mode flags to the given (octal) value, regardles reserved=num Sets the number of reserved blocks at the start of the partition to num. Default is 2. -root=block Sets the block number of the root block. This schould never - be neccessary. +root=block Sets the block number of the root block. This should never + be necessary. bs=blksize Sets the blocksize to blksize. Valid block sizes are 512, 1024, 2048 and 4096. Like the root option, this should - never be neccessary, as the affs can figure it out itself. + never be necessary, as the affs can figure it out itself. quiet The file system will not return an error for disallowed mode changes. diff --git a/Documentation/java.txt b/Documentation/java.txt new file mode 100644 index 000000000000..9bfa6465fe5d --- /dev/null +++ b/Documentation/java.txt @@ -0,0 +1,91 @@ + JAVA Binary Kernel Support for Linux v1.01 + ------------------------------------------ + +Linux beats them ALL! While all other OS's are TALKING about direct +support of Java Binaries in the OS, Linux is doing it! + +You execute Java classes as you would any other executable, after a few +small details: + + 1) You MUST FIRST install the Java Developers Kit for Linux. + The Java on Linux HOWTO gives the details on getting and + installing this. This HOWTO can be found at: + + ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/Java-HOWTO + + If you install the JDK in a location other than the suggested + directory of /usr/local/java, then you will need to edit the + kernel's fs/binfmt_java.c file and make the needed change to the + _PATH_JAVA definition at the top of that file. + + 2) You must chmod the '*.class' files you wish to execute with + the execute bit. This is not normally (till now) done with + '.class' files. + + 3) You must optionally export a CLASSPATH environment variable, + if you plan to use Java applications installed outside of + /usr/local/java/classes/*. + + 4) Either compile your kernel with Java support builtin, or + as a loadable module. If a module, load it with insmod or + kerneld. + + +To test your new setup, enter in the following simple Java app, and name +it "HelloWorld.java": + + class HelloWorld { + public static void main(String args[]) { + System.out.println("Hello World!"); + } + } + + +Now compile the application with: + + /usr/local/java/bin/javac HelloWorld.java + +Set the executable permissions of the binary file, with: + + chmod 755 HelloWorld.class + +And then execute it: + + ./HellowWorld.class + + +Yes, it's JUST THAT EASY! ;-) + +----------------------------------------------------------------- + +Nope, I didn't forget about Java Applets! ;-) + +While this may not be the best way to do this, it works! + +Take any html file used with the Java appletviewer (like the +demo/Blink/example1.html file), and: + + 1) Insert a new first line of: + + + + Make sure the '<' is the first character in the file. This + will be treated as a valid HTML comment outside of this + Java Applet support, so the modified file can still be used + with all known browsers. + + 2) If you install the JDK in a location other than the suggested + directory of /usr/local/java, then you will need to edit the + kernel's fs/binfmt_java.c file and make the needed change to the + _PATH_APPLET definition at the top of that file. + + 3) You must chmod the '*.html' files you wish to execute with + the execute bit. This is not normally (till now) done with + '.html' files. + + 4) And then execute it. + + + +Brian A. Lantz +brian@lantz.com diff --git a/Documentation/modules.txt b/Documentation/modules.txt index dcc382ceb370..8f48fed0a401 100644 --- a/Documentation/modules.txt +++ b/Documentation/modules.txt @@ -59,6 +59,7 @@ The set of modules is rapidly increasing, but so far these are known: Some misc modules: lp: line printer binfmt_elf: elf loader + binfmt_java: java loader isp16: cdrom interface When you have made the kernel, you create the modules by doing: diff --git a/MAINTAINERS b/MAINTAINERS index 53aedf80bc20..8c00504602f1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -287,7 +287,6 @@ M: begemot@bgm.rosprint.net L: linux-kernel@vger.rutgers.edu S: Maintained - MOUSE AND MISC DEVICES [GENERAL] P: Alessandro Rubini M: rubini@ipvvis.unipv.it @@ -306,6 +305,12 @@ M: tsbogend@bigbug.franken.de L: linux-net@vger.rutgers.edu S: Maintained +ADVANSYS SCSI DRIVER +P: Bob Frey +M: Bob Frey +W: http://www.advansys.com/linux +S: Maintained + REST: P: Linus Torvalds S: Buried alive in email diff --git a/Makefile b/Makefile index d99a63605089..5a35134c4b7a 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ VERSION = 1 PATCHLEVEL = 3 -SUBLEVEL = 99 +SUBLEVEL = 100 ARCH = i386 diff --git a/arch/alpha/defconfig b/arch/alpha/defconfig index a1069c8b724a..4555376ee301 100644 --- a/arch/alpha/defconfig +++ b/arch/alpha/defconfig @@ -32,7 +32,6 @@ CONFIG_ALPHA_EV5=y CONFIG_ALPHA_ALCOR=y # CONFIG_SERIAL_ECHO is not set # CONFIG_TGA_CONSOLE is not set -CONFIG_PCI_OPTIMIZE=y CONFIG_NET=y CONFIG_SYSVIPC=y CONFIG_BINFMT_AOUT=y diff --git a/arch/i386/config.in b/arch/i386/config.in index 8e1691b7fbdd..020bb67d2431 100644 --- a/arch/i386/config.in +++ b/arch/i386/config.in @@ -33,6 +33,7 @@ fi bool 'System V IPC' CONFIG_SYSVIPC tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF +tristate 'Kernel support for JAVA binaries' CONFIG_BINFMT_JAVA bool 'Compile kernel as ELF - if your GCC is ELF-GCC' CONFIG_KERNEL_ELF choice 'Processor type' \ diff --git a/arch/i386/defconfig b/arch/i386/defconfig index b92b21ff09c7..301b181939e1 100644 --- a/arch/i386/defconfig +++ b/arch/i386/defconfig @@ -21,10 +21,10 @@ CONFIG_MODULES=y CONFIG_NET=y # CONFIG_MAX_16M is not set CONFIG_PCI=y -CONFIG_PCI_OPTIMIZE=y CONFIG_SYSVIPC=y CONFIG_BINFMT_AOUT=y CONFIG_BINFMT_ELF=y +# CONFIG_BINFMT_JAVA is not set CONFIG_KERNEL_ELF=y # CONFIG_M386 is not set # CONFIG_M486 is not set diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index 443c10d44797..873bdc36517d 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c @@ -208,7 +208,7 @@ static const char * i486model(unsigned int nr) { static const char *model[] = { "0","DX","SX","DX/2","4","SX/2","6","DX/2-WB","DX/4","DX/4-WB", - "10","11","12","13","Am5x85-WT","Am5x86-WB" + "10","11","12","13","Am5x86-WT","Am5x86-WB" }; if (nr < sizeof(model)/sizeof(char *)) return model[nr]; diff --git a/arch/i386/math-emu/fpu_emu.h b/arch/i386/math-emu/fpu_emu.h index dc249e55b316..68c51cd9e460 100644 --- a/arch/i386/math-emu/fpu_emu.h +++ b/arch/i386/math-emu/fpu_emu.h @@ -58,7 +58,8 @@ #ifndef __ASSEMBLY__ #include /* for struct _fpstate */ -#include +#include + #include /* diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 0fd8d2a04fdb..ce2cc4a060a5 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -248,13 +248,7 @@ static inline int DRIVE(kdev_t x) { #define USETF(x) (set_bit(x##_BIT, &UDRS->flags)) #define UTESTF(x) (test_bit(x##_BIT, &UDRS->flags)) -#define DPRINT(x) printk(DEVICE_NAME "%d: " x,current_drive) - -#define DPRINT1(x,x1) printk(DEVICE_NAME "%d: " x,current_drive,(x1)) - -#define DPRINT2(x,x1,x2) printk(DEVICE_NAME "%d: " x,current_drive,(x1),(x2)) - -#define DPRINT3(x,x1,x2,x3) printk(DEVICE_NAME "%d: " x,current_drive,(x1),(x2),(x3)) +#define DPRINT(format, args...) printk(DEVICE_NAME "%d: " format, current_drive , ## args) #define PH_HEAD(floppy,head) (((((floppy)->stretch & 2) >>1) ^ head) << 2) #define STRETCH(floppy) ((floppy)->stretch & FD_STRETCH) @@ -487,7 +481,8 @@ static void floppy_ready(void); static void floppy_start(void); static void process_fd_request(void); static void recalibrate_floppy(void); -static void floppy_shutdown(unsigned long); +static void floppy_shutdown(void); +static void unexpected_floppy_interrupt(void); static int floppy_grab_irq_and_dma(void); static void floppy_release_irq_and_dma(void); @@ -580,7 +575,7 @@ static void is_alive(const char *message) { /* this routine checks whether the floppy driver is "alive" */ if (fdc_busy && command_status < 2 && !fd_timeout.prev){ - DPRINT1("timeout handler died: %s\n",message); + DPRINT("timeout handler died: %s\n",message); } } #endif @@ -688,17 +683,17 @@ static int disk_change(int drive) (FDCS->dor & 3) != UNIT(drive) || fdc != FDC(drive)){ DPRINT("probing disk change on unselected drive\n"); - DPRINT3("drive=%d fdc=%d dor=%x\n",drive, FDC(drive), + DPRINT("drive=%d fdc=%d dor=%x\n",drive, FDC(drive), FDCS->dor); } #endif #ifdef DCL_DEBUG if (UDP->flags & FD_DEBUG){ - DPRINT1("checking disk change line for drive %d\n",drive); - DPRINT1("jiffies=%ld\n", jiffies); - DPRINT1("disk change line=%x\n",fd_inb(FD_DIR)&0x80); - DPRINT1("flags=%x\n",UDRS->flags); + DPRINT("checking disk change line for drive %d\n",drive); + DPRINT("jiffies=%ld\n", jiffies); + DPRINT("disk change line=%x\n",fd_inb(FD_DIR)&0x80); + DPRINT("flags=%x\n",UDRS->flags); } #endif if (UDP->flags & FD_BROKEN_DCL) @@ -708,17 +703,18 @@ static int disk_change(int drive) if (UDRS->maxblock){ /* mark it changed */ USETF(FD_DISK_CHANGED); + } - /* invalidate its geometry */ - if (UDRS->keep_data >= 0) { - if ((UDP->flags & FTD_MSG) && - current_type[drive] != NULL) - DPRINT("Disk type is undefined after " - "disk change\n"); - current_type[drive] = NULL; - floppy_sizes[TOMINOR(current_drive)] = MAX_DISK_SIZE; - } + /* invalidate its geometry */ + if (UDRS->keep_data >= 0) { + if ((UDP->flags & FTD_MSG) && + current_type[drive] != NULL) + DPRINT("Disk type is undefined after " + "disk change\n"); + current_type[drive] = NULL; + floppy_sizes[TOMINOR(current_drive)] = MAX_DISK_SIZE; } + /*USETF(FD_DISK_NEWCHANGE);*/ return 1; } else { @@ -850,7 +846,7 @@ static inline void unlock_fdc(void) DPRINT("FDC access conflict!\n"); if (DEVICE_INTR) - DPRINT1("device interrupt still active at FDC release: %p!\n", + DPRINT("device interrupt still active at FDC release: %p!\n", DEVICE_INTR); command_status = FD_COMMAND_NONE; del_timer(&fd_timeout); @@ -928,8 +924,22 @@ static void scandrives(void) set_fdc(saved_drive); } +static void empty(void) +{ +} + +static struct tq_struct floppy_tq = +{ 0, 0, (void *) (void *) unexpected_floppy_interrupt, 0 }; + static struct timer_list fd_timer ={ NULL, NULL, 0, 0, 0 }; +static void cancel_activity(void) +{ + CLEAR_INTR; + floppy_tq.routine = (void *)(void *) empty; + del_timer(&fd_timer); +} + /* this function makes sure that the disk stays in the drive during the * transfer */ static void fd_watchdog(void) @@ -942,7 +952,9 @@ static void fd_watchdog(void) if (disk_change(current_drive)){ DPRINT("disk removed during i/o\n"); - floppy_shutdown(1); + cancel_activity(); + cont->done(0); + reset_fdc(); } else { del_timer(&fd_timer); fd_timer.function = (timeout_fn) fd_watchdog; @@ -1063,7 +1075,7 @@ static int wait_til_ready(void) return status; } if (!initialising) { - DPRINT2("Getstatus times out (%x) on fdc %d\n", + DPRINT("Getstatus times out (%x) on fdc %d\n", status, fdc); show_floppy(); } @@ -1090,8 +1102,8 @@ static int output_byte(char byte) } FDCS->reset = 1; if (!initialising) { - DPRINT2("Unable to send byte %x to FDC. Status=%x\n", - byte, status); + DPRINT("Unable to send byte %x to FDC. Fdc=%x Status=%x\n", + byte, fdc, status); show_floppy(); } return -1; @@ -1120,8 +1132,8 @@ static int result(void) break; } if(!initialising) { - DPRINT2("'get result' error. Last status=%x Read bytes=%d\n", - status, i); + DPRINT("get result error. Fdc=%d Last status=%x Read bytes=%d\n", + fdc, status, i); show_floppy(); } FDCS->reset = 1; @@ -1484,7 +1496,7 @@ static void seek_interrupt(void) #ifdef DCL_DEBUG if (DP->flags & FD_DEBUG){ DPRINT("clearing NEWCHANGE flag because of effective seek\n"); - DPRINT1("jiffies=%ld\n", jiffies); + DPRINT("jiffies=%ld\n", jiffies); } #endif CLEARF(FD_DISK_NEWCHANGE); /* effective seek */ @@ -1509,7 +1521,7 @@ static void check_wp(void) #ifdef DCL_DEBUG if (DP->flags & FD_DEBUG){ DPRINT("checking whether disk is write protected\n"); - DPRINT1("wp=%x\n",ST3 & 0x40); + DPRINT("wp=%x\n",ST3 & 0x40); } #endif if (!(ST3 & 0x40)) @@ -1677,9 +1689,6 @@ static void unexpected_floppy_interrupt(void) FDCS->reset = 1; } -static struct tq_struct floppy_tq = -{ 0, 0, (void *) (void *) unexpected_floppy_interrupt, 0 }; - /* interrupt handler */ void floppy_interrupt(int irq, void *dev_id, struct pt_regs * regs) { @@ -1765,10 +1774,6 @@ static void reset_fdc(void) } } -static void empty(void) -{ -} - void show_floppy(void) { int i; @@ -1815,21 +1820,19 @@ void show_floppy(void) printk("\n"); } -static void floppy_shutdown(unsigned long mode) +static void floppy_shutdown(void) { - if (!initialising && !mode) + if (!initialising) show_floppy(); - CLEAR_INTR; - floppy_tq.routine = (void *)(void *) empty; - del_timer(&fd_timer); + cancel_activity(); sti(); floppy_enable_hlt(); fd_disable_dma(); /* avoid dma going to a random drive after shutdown */ - if (!initialising && !mode) - DPRINT("floppy timeout\n"); + if (!initialising) + DPRINT("floppy timeout called\n"); FDCS->reset = 1; if (cont){ cont->done(0); @@ -1940,6 +1943,14 @@ static struct cont_t wakeup_cont={ (done_f)empty }; + +static struct cont_t intr_cont={ + empty, + process_fd_request, + empty, + (done_f) empty +}; + static int wait_til_done(void (*handler)(void), int interruptible) { int ret; @@ -1956,9 +1967,10 @@ static int wait_til_done(void (*handler)(void), int interruptible) sleep_on(&command_done); } if (command_status < 2){ - floppy_shutdown(1); + cancel_activity(); + cont = &intr_cont; + reset_fdc(); sti(); - process_fd_request(); return -EINTR; } sti(); @@ -2046,8 +2058,8 @@ static void set_floppy(kdev_t device) } /* - * formatting and support. - * ======================= + * formatting support. + * =================== */ static void format_interrupt(void) { @@ -2077,7 +2089,7 @@ static void setup_format_params(int track) raw_cmd->track = track; raw_cmd->flags = FD_RAW_WRITE | FD_RAW_INTR | FD_RAW_SPIN | - /*FD_RAW_NEED_DISK |*/ FD_RAW_NEED_SEEK; + FD_RAW_NEED_DISK | FD_RAW_NEED_SEEK; raw_cmd->rate = _floppy->rate & 0x43; raw_cmd->cmd_count = NR_F; COMMAND = FM_MODE(_floppy,FD_FORMAT); @@ -2252,7 +2264,7 @@ static void rw_interrupt(void) if (nr_sectors > current_count_sectors + ssize - (current_count_sectors + sector_t) % ssize + sector_t % ssize){ - DPRINT2("long rw: %x instead of %lx\n", + DPRINT("long rw: %x instead of %lx\n", nr_sectors, current_count_sectors); printk("rs=%d s=%d\n", R_SECTOR, SECTOR); printk("rh=%d h=%d\n", R_HEAD, HEAD); @@ -2287,7 +2299,7 @@ static void rw_interrupt(void) if (probing) { if (DP->flags & FTD_MSG) - DPRINT2("Auto-detected floppy type %s in fd%d\n", + DPRINT("Auto-detected floppy type %s in fd%d\n", _floppy->name,current_drive); current_type[current_drive] = _floppy; floppy_sizes[TOMINOR(current_drive)] = _floppy->size >> 1; @@ -2389,7 +2401,7 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2) if (dma_buffer + size > floppy_track_buffer + (max_buffer_sectors << 10) || dma_buffer < floppy_track_buffer){ - DPRINT1("buffer overrun in copy buffer %d\n", + DPRINT("buffer overrun in copy buffer %d\n", (int) ((floppy_track_buffer - dma_buffer) >>9)); printk("sector_t=%d buffer_min=%d\n", sector_t, buffer_min); @@ -2402,7 +2414,7 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2) break; } if (((unsigned long)buffer) % 512) - DPRINT1("%p buffer not aligned\n", buffer); + DPRINT("%p buffer not aligned\n", buffer); #endif if (CT(COMMAND) == FD_READ) { fd_cacheflush(dma_buffer, size); @@ -2430,7 +2442,7 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2) if (remaining){ if (remaining > 0) max_sector -= remaining >> 9; - DPRINT1("weirdness: remaining %d\n", remaining>>9); + DPRINT("weirdness: remaining %d\n", remaining>>9); } #endif } @@ -2582,7 +2594,7 @@ static int make_raw_rw_request(void) raw_cmd->length = current_count_sectors << 9; if (raw_cmd->length == 0){ DPRINT("zero dma transfer attempted from make_raw_request\n"); - DPRINT3("indirect=%d direct=%d sector_t=%d", + DPRINT("indirect=%d direct=%d sector_t=%d", indirect, direct, sector_t); return 0; } @@ -2638,7 +2650,7 @@ static int make_raw_rw_request(void) aligned_sector_t < buffer_min)) || raw_cmd->length % (128 << SIZECODE) || raw_cmd->length <= 0 || current_count_sectors <= 0){ - DPRINT2("fractionary current count b=%lx s=%lx\n", + DPRINT("fractionary current count b=%lx s=%lx\n", raw_cmd->length, current_count_sectors); if (raw_cmd->kernel_data != CURRENT->buffer) printk("addr=%d, length=%ld\n", @@ -3176,7 +3188,7 @@ static inline int set_geometry(unsigned int cmd, struct floppy_struct *g, if (cmd != FDDEFPRM) /* notice a disk change immediately, else * we loose our settings immediately*/ - CALL(poll_drive(1,0)); + CALL(poll_drive(1, FD_RAW_NEED_DISK)); user_params[drive] = *g; if (buffer_drive == drive) SUPBOUND(buffer_max, user_params[drive].sect); @@ -3362,6 +3374,9 @@ static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, return set_geometry(cmd, & inparam.g, drive, type, device); case FDGETPRM: + LOCK_FDC(drive,1); + CALL(poll_drive(1,0)); + process_fd_request(); if (type) outparam = (char *) &floppy_type[type]; else @@ -3876,7 +3891,7 @@ static void daring(int *ints,int param) default_drive_params[i].params.flags &= ~FD_SILENT_DCL_CLEAR; } } - DPRINT1("Assuming %s floppy hardware\n", param ? "standard" : "broken"); + DPRINT("Assuming %s floppy hardware\n", param ? "standard" : "broken"); } static void set_cmos(int *ints, int dummy) @@ -3896,11 +3911,11 @@ static void set_cmos(int *ints, int dummy) FDC2 = 0x370; if (ints[2] <= 0 || (ints[2] >= NUMBER(default_drive_params) && ints[2] != 16)){ - DPRINT1("bad cmos code %d\n", ints[2]); + DPRINT("bad cmos code %d\n", ints[2]); return; } DP->cmos = ints[2]; - DPRINT1("setting cmos code to %d\n", ints[2]); + DPRINT("setting cmos code to %d\n", ints[2]); } static struct param_table { @@ -3949,14 +3964,14 @@ void floppy_setup(char *str, int *ints) if(config_params[i].fn) config_params[i].fn(ints,param); if(config_params[i].var) { - DPRINT2("%s=%d\n", str, param); + DPRINT("%s=%d\n", str, param); *config_params[i].var = param; } return; } } if (str) { - DPRINT1("unknown floppy option [%s]\n", str); + DPRINT("unknown floppy option [%s]\n", str); DPRINT("allowed options are:"); for (i=0; i< ARRAY_SIZE(config_params); i++) @@ -4091,12 +4106,12 @@ static int floppy_grab_irq_and_dma(void) set_dor(0, ~0, 8); /* avoid immediate interrupt */ if (fd_request_irq()) { - DPRINT1("Unable to grab IRQ%d for the floppy driver\n", + DPRINT("Unable to grab IRQ%d for the floppy driver\n", FLOPPY_IRQ); return -1; } if (fd_request_dma()) { - DPRINT1("Unable to grab DMA%d for the floppy driver\n", + DPRINT("Unable to grab DMA%d for the floppy driver\n", FLOPPY_DMA); fd_free_irq(); return -1; diff --git a/drivers/block/ide-cd.c b/drivers/block/ide-cd.c index db6fa33ef129..50b7a7fd71e5 100644 --- a/drivers/block/ide-cd.c +++ b/drivers/block/ide-cd.c @@ -94,10 +94,17 @@ * 3.10 Apr 10, 1996 -- Fix compilation error with STANDARD_ATAPI. * 3.11 Apr 29, 1996 -- Patch from Heiko Eissfeldt * to remove redundant verify_area calls. + * 3.12 May 7, 1996 -- Rudimentary changer support. Based on patches + * from Gerhard Zuber . + * Let open succeed even if there's no loaded disc. * * NOTE: Direct audio reads will only work on some types of drive. * So far, i've received reports of success for Sony and Toshiba drives. * + * NOTE: The changer functions were tested with the NEC CDR-251 drive. + * They may not work with the Sanyo 3-cd changer, which i understand + * uses a different protocol. + * * ATAPI cd-rom driver. To be used with ide.c. * * Copyright (C) 1994, 1995, 1996 scott snyder @@ -182,6 +189,8 @@ #define MODE_SELECT_10 0x55 #define READ_CD 0xbe +#define LOAD_UNLOAD 0xa6 + /* ATAPI sense keys (mostly copied from scsi.h). */ @@ -1957,6 +1966,23 @@ cdrom_read_block (ide_drive_t *drive, int format, int lba, } +/* If SLOT<0, unload the current slot. Otherwise, try to load SLOT. */ +static int +cdrom_load_unload (ide_drive_t *drive, unsigned long slot, + struct atapi_request_sense *reqbuf) +{ + struct packet_command pc; + + memset (&pc, 0, sizeof (pc)); + pc.sense_data = reqbuf; + + pc.c[0] = LOAD_UNLOAD; + pc.c[4] = 2 + (slot >= 0); + pc.c[8] = slot; + return cdrom_queue_packet_command (drive, &pc); +} + + int ide_cdrom_ioctl (ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { @@ -2370,6 +2396,33 @@ int ide_cdrom_ioctl (ide_drive_t *drive, struct inode *inode, return stat; } + case CDROMLOADFROMSLOT: { + struct atapi_request_sense my_reqbuf; + int stat; + + if (drive->usage > 1) + return -EBUSY; + + stat = cdrom_load_unload (drive, -1, NULL); + if (stat) return stat; + + cdrom_saw_media_change (drive); + if (arg == -1) { + (void) cdrom_lockdoor (drive, 0, NULL); + return 0; + } + stat = cdrom_load_unload (drive, arg, NULL); + if (stat) return stat; + + stat = cdrom_check_status (drive, &my_reqbuf); + if (stat && my_reqbuf.sense_key == NOT_READY) { + return -ENOENT; + } + + /* And try to read the TOC information now. */ + return cdrom_read_toc (drive, &my_reqbuf); + } + #if 0 /* Doesn't work reliably yet. */ case CDROMRESET: { struct request req; @@ -2471,17 +2524,12 @@ int ide_cdrom_open (struct inode *ip, struct file *fp, ide_drive_t *drive) stat = cdrom_check_status (drive, &my_reqbuf); } - /* Return an error if there are still problems. */ - if (stat && my_reqbuf.sense_key != UNIT_ATTENTION) { - --drive->usage; - return -ENXIO; + /* If things worked ok, lock the door and read the + TOC information. */ + if (stat == 0 || my_reqbuf.sense_key == UNIT_ATTENTION) { + (void) cdrom_lockdoor (drive, 1, &my_reqbuf); + (void) cdrom_read_toc (drive, &my_reqbuf); } - - /* Now lock the door. */ - (void) cdrom_lockdoor (drive, 1, &my_reqbuf); - - /* And try to read the TOC information now. */ - (void) cdrom_read_toc (drive, &my_reqbuf); } return 0; @@ -2593,7 +2641,7 @@ void ide_cdrom_setup (ide_drive_t *drive) * duplicated functionality between read and ioctl paths? * Establish interfaces for an IDE port driver, and break out the cdrom * code into a loadable module. - * Support changers. + * Support changers better. * Write some real documentation. */ diff --git a/drivers/block/ide.c b/drivers/block/ide.c index 84bed2ee7504..6ef234a36197 100644 --- a/drivers/block/ide.c +++ b/drivers/block/ide.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/ide.c Version 5.39 May 3, 1996 + * linux/drivers/block/ide.c Version 5.41 May 9, 1996 * * Copyright (C) 1994-1996 Linus Torvalds & authors (see below) */ @@ -231,6 +231,10 @@ * mask drive irq after use, if sharing with another hwif * add code to help debug weird cmd640 problems * Version 5.39 fix horrible error in earlier irq sharing "fix" + * Version 5.40 fix serialization -- was broken in 5.39 + * help sharing by masking device irq after probing + * Version 5.41 more fixes to irq sharing/serialize detection + * disable io_32bit by default on drive reset * * Some additional driver compile-time options are in ide.h * @@ -705,8 +709,10 @@ static void do_reset1 (ide_drive_t *drive, int do_not_try_atapi) /* For an ATAPI device, first try an ATAPI SRST. */ if (drive->media != ide_disk) { if (!do_not_try_atapi) { - if (!drive->keep_settings) + if (!drive->keep_settings) { drive->unmask = 0; + drive->io_32bit = 0; + } OUT_BYTE (drive->select.all, IDE_SELECT_REG); udelay (20); OUT_BYTE (WIN_SRST, IDE_COMMAND_REG); @@ -732,6 +738,7 @@ static void do_reset1 (ide_drive_t *drive, int do_not_try_atapi) if (!rdrive->keep_settings) { rdrive->mult_req = 0; rdrive->unmask = 0; + rdrive->io_32bit = 0; if (rdrive->using_dma) { rdrive->using_dma = 0; printk("%s: disabled DMA\n", rdrive->name); @@ -2376,8 +2383,11 @@ static int try_to_identify (ide_drive_t *drive, byte cmd) #if CONFIG_BLK_DEV_PROMISE if (IS_PROMISE_DRIVE) { - if(promise_cmd(drive,PROMISE_IDENTIFY)) + if (promise_cmd(drive,PROMISE_IDENTIFY)) { + if (irqs) + (void) probe_irq_off(irqs); return 1; + } } else #endif /* CONFIG_BLK_DEV_PROMISE */ OUT_BYTE(cmd,IDE_COMMAND_REG); /* ask drive for ID */ @@ -2385,7 +2395,7 @@ static int try_to_identify (ide_drive_t *drive, byte cmd) timeout += jiffies; do { if (jiffies > timeout) { - if (!HWIF(drive)->irq) + if (irqs) (void) probe_irq_off(irqs); return 1; /* drive timed-out */ } @@ -2409,10 +2419,13 @@ static int try_to_identify (ide_drive_t *drive, byte cmd) } else rc = 2; /* drive refused ID */ if (!HWIF(drive)->irq) { - irqs = probe_irq_off(irqs); /* get irq number */ - if (irqs > 0) - HWIF(drive)->irq = irqs; - else { /* Mmmm.. multiple IRQs */ + irqs = probe_irq_off(irqs); /* get our irq number */ + if (irqs > 0) { + HWIF(drive)->irq = irqs; /* save it for later */ + irqs = probe_irq_on(); /* grab irqs, to ignore next edge */ + OUT_BYTE(drive->ctl|2,IDE_CONTROL_REG); /* mask device irq */ + (void) probe_irq_off(irqs); /* restore irqs again */ + } else { /* Mmmm.. multiple IRQs.. don't know which was ours */ printk("%s: IRQ probe failed (%d)\n", drive->name, irqs); #ifdef CONFIG_BLK_DEV_CMD640 if (HWIF(drive)->chipset == ide_cmd640) { @@ -2998,11 +3011,40 @@ int ide_xlate_1024 (kdev_t i_rdev, int xparm, const char *msg) return 1; } +#if MAX_HWIFS > 1 +/* + * save_match() is used to simplify logic in init_irq() below. + * + * A loophole here is that we may not know about a particular + * hwif's irq until after that hwif is actually probed/initialized.. + * This could be a problem for the case where an hwif is on a + * dual interface that requires serialization (eg. cmd640) and another + * hwif using one of the same irqs is initialized beforehand. + * + * This routine detects and reports such situations, but does not fix them. + */ +static void save_match (ide_hwif_t *hwif, ide_hwif_t *new, ide_hwif_t **match) +{ + ide_hwif_t *m = *match; + + if (m && m->hwgroup && m->hwgroup != new->hwgroup) { + if (!new->hwgroup) + return; + printk("%s: potential irq problem with %s and %s\n", hwif->name, new->name, m->name); + } + if (m->irq != hwif->irq) /* don't undo a prior perfect match */ + *match = new; +} +#endif /* MAX_HWIFS > 1 */ /* * This routine sets up the irq for an ide interface, and creates a new * hwgroup for the irq/hwif if none was previously assigned. * + * Much of the code is for correctly detecting/handling irq sharing + * and irq serialization situations. This is somewhat complex because + * it handles static as well as dynamic (PCMCIA) IDE interfaces. + * * The SA_INTERRUPT in sa_flags means ide_intr() is always entered with * interrupts completely disabled. This can be bad for interrupt latency, * but anything else has led to problems on some machines. We re-enable @@ -3011,48 +3053,52 @@ int ide_xlate_1024 (kdev_t i_rdev, int xparm, const char *msg) static int init_irq (ide_hwif_t *hwif) { unsigned long flags; - ide_hwgroup_t *hwgroup = hwif->hwgroup; - ide_hwif_t *mate_hwif; - unsigned int index, mate_irq = hwif->irq; + unsigned int index; + ide_hwgroup_t *hwgroup; + ide_hwif_t *match = NULL; save_flags(flags); cli(); + hwif->hwgroup = NULL; +#if MAX_HWIFS > 1 /* - * Handle serialization, regardless of init sequence - */ - mate_hwif = &ide_hwifs[hwif->index ^ 1]; - if (hwif->serialized && mate_hwif->present) - mate_irq = mate_hwif->irq; - - /* - * Group up with any other hwifs that share our irq(s) + * Group up with any other hwifs that share our irq(s). */ for (index = 0; index < MAX_HWIFS; index++) { - if (index != hwif->index) { - ide_hwif_t *h = &ide_hwifs[index]; - if (h->irq == hwif->irq || h->irq == mate_irq) { + ide_hwif_t *h = &ide_hwifs[index]; + if (h->hwgroup) { /* scan only initialized hwif's */ + if (hwif->irq == h->irq) { hwif->sharing_irq = h->sharing_irq = 1; - if (hwgroup && !h->hwgroup) - h->hwgroup = hwgroup; - else if (!hwgroup) - hwgroup = h->hwgroup; + save_match(hwif, h, &match); + } + if (hwif->serialized) { + ide_hwif_t *mate = &ide_hwifs[hwif->index^1]; + if (index == mate->index || h->irq == mate->irq) + save_match(hwif, h, &match); + } + if (h->serialized) { + ide_hwif_t *mate = &ide_hwifs[h->index^1]; + if (hwif->irq == mate->irq) + save_match(hwif, h, &match); } } } - +#endif /* MAX_HWIFS > 1 */ /* * If we are still without a hwgroup, then form a new one */ - if (hwgroup == NULL) { - hwgroup = kmalloc (sizeof(ide_hwgroup_t), GFP_KERNEL); + if (match) { + hwgroup = match->hwgroup; + } else { + hwgroup = kmalloc(sizeof(ide_hwgroup_t), GFP_KERNEL); hwgroup->hwif = hwgroup->next_hwif = hwif->next = hwif; hwgroup->rq = NULL; hwgroup->handler = NULL; if (hwif->drives[0].present) - hwgroup->drive = &hwif->drives[0]; + hwgroup->drive = &hwif->drives[0]; else - hwgroup->drive = &hwif->drives[1]; + hwgroup->drive = &hwif->drives[1]; hwgroup->poll_timeout = 0; init_timer(&hwgroup->timer); hwgroup->timer.function = &timer_expiry; @@ -3062,16 +3108,13 @@ static int init_irq (ide_hwif_t *hwif) /* * Allocate the irq, if not already obtained for another hwif */ - if (!hwif->got_irq) { + if (!match || match->irq != hwif->irq) { if (request_irq(hwif->irq, ide_intr, SA_INTERRUPT|SA_SAMPLE_RANDOM, hwif->name, hwgroup)) { + if (!match) + kfree(hwgroup); restore_flags(flags); return 1; } - for (index = 0; index < MAX_HWIFS; index++) { - ide_hwif_t *g = &ide_hwifs[index]; - if (g->irq == hwif->irq) - g->got_irq = 1; - } } /* @@ -3085,8 +3128,8 @@ static int init_irq (ide_hwif_t *hwif) printk("%s at 0x%03x-0x%03x,0x%03x on irq %d", hwif->name, hwif->io_base, hwif->io_base+7, hwif->ctl_port, hwif->irq); - if (hwgroup->hwif != hwif) - printk(" (serialized with %s)", hwgroup->hwif->name); + if (match) + printk(" (%sed with %s)", hwif->sharing_irq ? "shar" : "serializ", match->name); printk("\n"); return 0; } diff --git a/drivers/block/ide.h b/drivers/block/ide.h index 5241b7a8e4c3..4c083959abcf 100644 --- a/drivers/block/ide.h +++ b/drivers/block/ide.h @@ -419,7 +419,6 @@ typedef struct hwif_s { unsigned present : 1; /* this interface exists */ unsigned serialized : 1; /* serialized operation with mate hwif */ unsigned no_unmask : 1; /* disallow setting unmask bits */ - unsigned got_irq : 1; /* 1 = already alloc'd our irq */ unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ #ifdef CONFIG_BLK_DEV_PROMISE unsigned is_promise2: 1; /* 2nd i/f on promise DC4030 */ diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index dd7201afe249..11410f4ca7d7 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c @@ -617,6 +617,9 @@ int blk_dev_init(void) #ifdef CONFIG_BLK_DEV_LOOP loop_init(); #endif +#ifdef CONFIG_CDI_INIT + cdi_init(); /* this MUST precede ide_init */ +#endif CONFIG_CDI_INIT #ifdef CONFIG_BLK_DEV_IDE ide_init(); /* this MUST precede hd_init */ #endif @@ -631,9 +634,6 @@ int blk_dev_init(void) #else outb_p(0xc, 0x3f2); #endif -#ifdef CONFIG_CDI_INIT - cdi_init(); -#endif CONFIG_CDI_INIT #ifdef CONFIG_CDU31A cdu31a_init(); #endif CONFIG_CDU31A diff --git a/drivers/block/umc8672.c b/drivers/block/umc8672.c index c70f1acad3cd..e4868652ebc0 100644 --- a/drivers/block/umc8672.c +++ b/drivers/block/umc8672.c @@ -1,5 +1,5 @@ /* - * linux/drivers/block/umc8672.c Version 0.03 Feb 09, 1996 + * linux/drivers/block/umc8672.c Version 0.04 May 09, 1996 * * Copyright (C) 1995-1996 Linus Torvalds & author (see below) */ @@ -35,7 +35,7 @@ * the results from the DOS speed test program supplied from UMC. 11 is the * highest speed (about PIO mode 3) */ -#undef REALLY_SLOW_IO /* most systems can safely undef this */ +#define REALLY_SLOW_IO /* some systems can safely undef this */ #include #include diff --git a/drivers/char/ChangeLog b/drivers/char/ChangeLog index f2b9a26cf3d0..addeaa453c05 100644 --- a/drivers/char/ChangeLog +++ b/drivers/char/ChangeLog @@ -1,3 +1,21 @@ +Tue May 7 22:51:11 1996 + + * random.c (add_timer_randomness): Limit the amount randomness + that we estimate to 12 bits. (An arbitrary amount). + + (extract_entropy): To make it harder to analyze the hash + function, fold the hash function in half using XOR, and + use the folded result as the value to emit to the user. + Also, add timer randomness each pass through the + exact_entropy call, to increase the amount of unknown + values during the extraction process. + + (random_ioctl): Use IOR/IOW definitions to define the + ioctl values used by the /dev/random driver. Allow the + old ioctl values to be used for backwards compatibility + (for a limited amount of time). + + Wed Apr 24 14:02:04 1996 Theodore Ts'o * random.c (add_timer_randomness): Use 2nd derivative as well to diff --git a/drivers/char/msbusmouse.c b/drivers/char/msbusmouse.c index 9831f3ff6173..d113b43f4215 100644 --- a/drivers/char/msbusmouse.c +++ b/drivers/char/msbusmouse.c @@ -47,6 +47,13 @@ #include static struct mouse_status mouse; +static int mouse_irq = MOUSE_IRQ; + +void msmouse_setup(char *str, int *ints) +{ + if (ints[0] > 0) + mouse_irq=ints[1]; +} static void ms_mouse_interrupt(int irq, void *dev_id, struct pt_regs * regs) { @@ -97,7 +104,7 @@ static void release_mouse(struct inode * inode, struct file * file) return; MS_MSE_INT_OFF(); mouse.ready = 0; - free_irq(MOUSE_IRQ, NULL); + free_irq(mouse_irq, NULL); MOD_DEC_USE_COUNT; } @@ -107,7 +114,7 @@ static int open_mouse(struct inode * inode, struct file * file) return -EINVAL; if (mouse.active++) return 0; - if (request_irq(MOUSE_IRQ, ms_mouse_interrupt, 0, "MS Busmouse", NULL)) { + if (request_irq(mouse_irq, ms_mouse_interrupt, 0, "MS Busmouse", NULL)) { mouse.active--; return -EBUSY; } diff --git a/drivers/char/random.c b/drivers/char/random.c index 9873f8af7262..a9871ba76a49 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1,7 +1,7 @@ /* * random.c -- A strong random number generator * - * Version 0.97, last modified 24-Apr-96 + * Version 0.98, last modified 7-May-96 * * Copyright Theodore Ts'o, 1994, 1995, 1996. All rights reserved. * @@ -458,7 +458,6 @@ static inline void add_entropy_word(struct random_bucket *r, * On the i386, this is assumed to be at most 16 bits, and the high bits * are used for a high-resolution timer. * - * TODO: Read the time stamp register on the Pentium. */ static void add_timer_randomness(struct random_bucket *r, struct timer_rand_state *state, unsigned num) @@ -475,21 +474,6 @@ static void add_timer_randomness(struct random_bucket *r, time = (__u32) low; num ^= (__u32) high; } else { -#if 0 - /* - * On a 386, read the high resolution timer. We assume that - * this gives us 2 bits of randomness. - * - * This is turned off for now because of the speed hit - * it entails. - */ - outb_p(0x00, 0x43); /* latch the count ASAP */ - num |= inb_p(0x40) << 16; - num |= inb(0x40) << 24; - if (!state->dont_count_entropy) - r->entropy_count += 2; -#endif - time = jiffies; } #else @@ -521,6 +505,13 @@ static void add_timer_randomness(struct random_bucket *r, for (nbits = 0; delta; nbits++) delta >>= 1; + /* + * In no case do we assume we've added more than 12 + * bits of randomness. + */ + if (nbits > 12) + nbits = 12; + r->entropy_count += nbits; /* Prevent overflow */ @@ -844,6 +835,7 @@ static inline int extract_entropy(struct random_bucket *r, char * buf, { int ret, i; __u32 tmp[HASH_BUFFER_SIZE]; + char *cp,*dp; add_timer_randomness(r, &extract_timer_state, nbytes); @@ -885,15 +877,27 @@ static inline int extract_entropy(struct random_bucket *r, char * buf, * add_entropy_word(). */ HASH_TRANSFORM(tmp, r->pool); + + /* + * In case the hash function has some recognizeable + * output pattern, we fold it half. + */ + cp = (char *) tmp; + dp = cp + (HASH_BUFFER_SIZE*sizeof(__u32)) - 1; + for (i=0; i < HASH_BUFFER_SIZE*sizeof(__u32)/2; i++) { + *cp ^= *dp; + cp++; dp--; + } /* Copy data to destination buffer */ - i = MIN(nbytes, HASH_BUFFER_SIZE*sizeof(__u32)); + i = MIN(nbytes, HASH_BUFFER_SIZE*sizeof(__u32)/2); if (to_user) memcpy_tofs(buf, (__u8 const *)tmp, i); else memcpy(buf, (__u8 const *)tmp, i); nbytes -= i; buf += i; + add_timer_randomness(r, &extract_timer_state, nbytes); } /* Wipe data from memory */ @@ -1029,6 +1033,20 @@ random_ioctl(struct inode * inode, struct file * file, int *p, size, ent_count; int retval; + /* + * Translate old 1.3.XX values. + * Remove this code in 2.1.0. + * + */ + switch (cmd) { + case 0x01080000: cmd = RNDGETENTCNT; break; + case 0x01080001: cmd = RNDADDTOENTCNT; break; + case 0x01080002: cmd = RNDGETPOOL; break; + case 0x01080003: cmd = RNDADDENTROPY; break; + case 0x01080004: cmd = RNDZAPENTCNT; break; + case 0x01080006: cmd = RNDCLEARPOOL; break; + } + switch (cmd) { case RNDGETENTCNT: retval = verify_area(VERIFY_WRITE, (void *) arg, sizeof(int)); diff --git a/drivers/net/hydra.c b/drivers/net/hydra.c index 5e3b2cd6a4bf..b86fb1e3cfcd 100644 --- a/drivers/net/hydra.c +++ b/drivers/net/hydra.c @@ -382,7 +382,7 @@ static void hydra_interrupt(int irq, struct pt_regs *fp, void *data) #endif - /* overwrite warning occured, stop NIC & check the BOUNDARY pointer */ + /* overwrite warning occurred, stop NIC & check the BOUNDARY pointer */ /* FIXME - real overwrite handling needed !! */ printk("hydra_interrupt(): overwrite warning, resetting NIC\n"); diff --git a/drivers/net/hydra.h b/drivers/net/hydra.h index 0a0919eb7fe8..37414146258d 100644 --- a/drivers/net/hydra.h +++ b/drivers/net/hydra.h @@ -117,7 +117,7 @@ #define ISR_PTX 0x02 /* Packet transmitted without errors */ #define ISR_RXE 0x04 /* Receive error */ #define ISR_TXE 0x08 /* Transmit error */ -#define ISR_OVW 0x10 /* Ring buffer overrrun */ +#define ISR_OVW 0x10 /* Ring buffer overrun */ #define ISR_CNT 0x20 /* Counter overflow */ #define ISR_RDC 0x40 /* Remote DMA compile */ #define ISR_RST 0x80 /* Reset status */ diff --git a/drivers/scsi/Config.in b/drivers/scsi/Config.in index 7fbd8b3b03f6..b1cd0cefcc45 100644 --- a/drivers/scsi/Config.in +++ b/drivers/scsi/Config.in @@ -40,7 +40,7 @@ if [ "$CONFIG_PCI" = "y" ]; then bool ' allow DISCONNECT' CONFIG_SCSI_NCR53C7xx_DISCONNECT fi fi -dep_tristate 'Always IN2000 SCSI support (test release)' CONFIG_SCSI_IN2000 $CONFIG_SCSI +dep_tristate 'Always IN2000 SCSI support' CONFIG_SCSI_IN2000 $CONFIG_SCSI dep_tristate 'PAS16 SCSI support' CONFIG_SCSI_PAS16 $CONFIG_SCSI dep_tristate 'QLOGIC SCSI support' CONFIG_SCSI_QLOGIC $CONFIG_SCSI dep_tristate 'Seagate ST-02 and Future Domain TMC-8xx SCSI support' CONFIG_SCSI_SEAGATE $CONFIG_SCSI diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 2e7d3710188b..90d5725c6ed6 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -1,4 +1,4 @@ -/* $Id: advansys.c,v 1.12 1996/02/23 20:48:27 bobf Exp bobf $ */ +/* $Id: advansys.c,v 1.14 1996/05/10 00:26:31 bobf Exp bobf $ */ /* * advansys.c - Linux Host Driver for AdvanSys SCSI Adapters * @@ -14,8 +14,8 @@ * bobf@advansys.com (Bob Frey) */ -/* The driver has been tested with Linux v1.2.1 and v1.3.57 kernels. */ -#define ASC_VERSION "1.3" /* AdvanSys Driver Version */ +/* The driver has been tested with Linux v1.2.13 and v1.3.57 kernels. */ +#define ASC_VERSION "1.4" /* AdvanSys Driver Version */ /* @@ -359,6 +359,15 @@ 4. Eliminate 'make dep' warning. 5. Try to fix problem with handling resets by increasing their timeout value. + + 5/8/96 1.4: + 1. Change definitions to eliminate conflicts with other subsystems. + 2. Add versioning code for the shared interrupt changes. + 3. Eliminate problem in asc_rmqueue() with iterating after removing + a request. + 4. Remove reset request loop problem from the "Known Problems or + Issues" section. This problem was isolated and fixed in the + mid-level SCSI driver. H. Known Problems or Issues @@ -377,10 +386,6 @@ value is only changed on the first scsi command for each device and never thereafter. The same change is made for reset commands. - 3. The driver occasionally enters a loop handling reset requests. It - isn't clear yet whether this is a bug in the upper or mid-level - scsi modules or in this driver. - I. Credits Nathan Hartwell provided the directions and @@ -482,11 +487,6 @@ #define ASC_LIB_SERIAL_NUMBER 53 typedef unsigned char uchar; -typedef unsigned char BYTE; -typedef unsigned short WORD; -typedef unsigned long DWORD; - -typedef int BOOL; #ifndef NULL #define NULL (0) @@ -502,33 +502,33 @@ typedef int BOOL; #define REG register -#define rchar REG char -#define rshort REG short -#define rint REG int -#define rlong REG long +#define rchar REG __s8 +#define rshort REG __s16 +#define rint REG __s32 +#define rlong REG __s32 -#define ruchar REG uchar -#define rushort REG ushort -#define ruint REG uint -#define rulong REG ulong +#define ruchar REG __u8 +#define rushort REG __u16 +#define ruint REG __u32 +#define rulong REG __u32 #define NULLPTR ( void *)0 #define FNULLPTR ( void dosfar *)0UL #define EOF (-1) #define EOS '\0' #define ERR (-1) -#define UB_ERR (uchar)(0xFF) -#define UW_ERR (uint)(0xFFFF) -#define UL_ERR (ulong)(0xFFFFFFFFUL) +#define UB_ERR (__u8)(0xFF) +#define UW_ERR (__u16)(0xFFFF) +#define UL_ERR (__u32)(0xFFFFFFFFUL) -#define iseven_word( val ) ( ( ( ( uint )val) & ( uint )0x0001 ) == 0 ) -#define isodd_word( val ) ( ( ( ( uint )val) & ( uint )0x0001 ) != 0 ) -#define toeven_word( val ) ( ( ( uint )val ) & ( uint )0xFFFE ) +#define iseven_word( val ) ( ( ( ( __u16 )val) & ( __u16 )0x0001 ) == 0 ) +#define isodd_word( val ) ( ( ( ( __u16 )val) & ( __u16 )0x0001 ) != 0 ) +#define toeven_word( val ) ( ( ( __u16 )val ) & ( __u16 )0xFFFE ) -#define biton( val, bits ) ((( uint )( val >> bits ) & (uint)0x0001 ) != 0 ) -#define bitoff( val, bits ) ((( uint )( val >> bits ) & (uint)0x0001 ) == 0 ) -#define lbiton( val, bits ) ((( ulong )( val >> bits ) & (ulong)0x00000001UL ) != 0 ) -#define lbitoff( val, bits ) ((( ulong )( val >> bits ) & (ulong)0x00000001UL ) == 0 ) +#define biton( val, bits ) ((( __u16 )( val >> bits ) & (__u16)0x0001 ) != 0 ) +#define bitoff( val, bits ) ((( __u16 )( val >> bits ) & (__u16)0x0001 ) == 0 ) +#define lbiton( val, bits ) ((( __u32 )( val >> bits ) & (__u32)0x00000001UL ) != 0 ) +#define lbitoff( val, bits ) ((( __u32 )( val >> bits ) & (__u32)0x00000001UL ) == 0 ) #define absh( val ) ( ( val ) < 0 ? -( val ) : ( val ) ) @@ -546,25 +546,25 @@ typedef int BOOL; #define KBYTE (0x400) #endif -#define HI_BYTE(x) ( *( ( BYTE *)(&x)+1 ) ) -#define LO_BYTE(x) ( *( ( BYTE *)&x ) ) +#define HI_BYTE(x) ( *( ( __u8 *)(&x)+1 ) ) +#define LO_BYTE(x) ( *( ( __u8 *)&x ) ) -#define HI_WORD(x) ( *( ( WORD *)(&x)+1 ) ) -#define LO_WORD(x) ( *( ( WORD *)&x ) ) +#define HI_WORD(x) ( *( ( __u16 *)(&x)+1 ) ) +#define LO_WORD(x) ( *( ( __u16 *)&x ) ) #ifndef MAKEWORD -#define MAKEWORD(lo, hi) ((WORD) (((WORD) lo) | ((WORD) hi << 8))) +#define MAKEWORD(lo, hi) ((__u16) (((__u16) lo) | ((__u16) hi << 8))) #endif #ifndef MAKELONG -#define MAKELONG(lo, hi) ((DWORD) (((DWORD) lo) | ((DWORD) hi << 16))) +#define MAKELONG(lo, hi) ((__u32) (((__u32) lo) | ((__u32) hi << 16))) #endif -#define SwapWords(dWord) ((DWORD) ((dWord >> 16) | (dWord << 16))) -#define SwapBytes(word) ((WORD) ((word >> 8) | (word << 8))) +#define SwapWords(dWord) ((__u32) ((dWord >> 16) | (dWord << 16))) +#define SwapBytes(word) ((__u16) ((word >> 8) | (word << 8))) #define BigToLittle(dWord) \ - ((DWORD) (SwapWords(MAKELONG(SwapBytes(LO_WORD(dWord)), SwapBytes(HI_WORD(dWord)))))) + ((__u32) (SwapWords(MAKELONG(SwapBytes(LO_WORD(dWord)), SwapBytes(HI_WORD(dWord)))))) #define LittleToBig(dWord) BigToLittle(dWord) #define Lptr @@ -2551,7 +2551,11 @@ int asc_dbglvl = 0; #ifdef LINUX_1_3 STATIC int asc_proc_copy(off_t, off_t, char *, int , char *, int); #endif /* LINUX_1_3 */ +#ifdef LINUX_1_2 +STATIC void advansys_interrupt(int, struct pt_regs *); +#else /* LINUX_1_3 */ STATIC void advansys_interrupt(int, void *, struct pt_regs *); +#endif /* LINUX_1_3 */ STATIC void advansys_command_done(Scsi_Cmnd *); STATIC int asc_execute_scsi_cmnd(Scsi_Cmnd *); STATIC void asc_isr_callback(ASC_DVC_VAR *, ASC_QDONE_INFO *); @@ -3106,8 +3110,13 @@ advansys_detect(Scsi_Host_Template *tpnt) /* Register IRQ Number. */ ASC_DBG1(2, "advansys_detect: request_irq() %d\n", shp->irq); +#ifdef LINUX_1_2 + if ((ret = request_irq(shp->irq, advansys_interrupt, + SA_INTERRUPT, "advansys")) != 0) { +#else /* LINUX_1_3 */ if ((ret = request_irq(shp->irq, advansys_interrupt, SA_INTERRUPT, "advansys", NULL)) != 0) { +#endif /* LINUX_1_3 */ ASC_DBG1(0, "advansys_detect: request_irq() failed %d\n", ret); release_region(shp->io_port, shp->n_io_port); if (shp->dma_channel != NO_ISA_DMA) { @@ -3130,7 +3139,11 @@ advansys_detect(Scsi_Host_Template *tpnt) if (shp->dma_channel != NO_ISA_DMA) { free_dma(shp->dma_channel); } +#ifdef LINUX_1_2 + free_irq(shp->irq); +#else /* LINUX_1_3 */ free_irq(shp->irq, NULL); +#endif /* LINUX_1_3 */ scsi_unregister(shp); asc_board_count--; continue; @@ -3152,7 +3165,11 @@ int advansys_release(struct Scsi_Host *shp) { ASC_DBG(1, "advansys_release: begin\n"); +#ifdef LINUX_1_2 + free_irq(shp->irq); +#else /* LINUX_1_3 */ free_irq(shp->irq, NULL); +#endif /* LINUX_1_3 */ if (shp->dma_channel != NO_ISA_DMA) { ASC_DBG(1, "advansys_release: free_dma()\n"); free_dma(shp->dma_channel); @@ -3577,7 +3594,11 @@ asc_proc_copy(off_t advoffset, off_t offset, char *curbuf, int leftlen, * First-level interrupt handler. */ STATIC void +#ifdef LINUX_1_2 +advansys_interrupt(int irq, struct pt_regs *regs) +#else /* LINUX_1_3 */ advansys_interrupt(int irq, void *dev_id, struct pt_regs *regs) +#endif /* LINUX_1_3 */ { int i; int flags; @@ -4455,6 +4476,7 @@ asc_rmqueue(struct Scsi_Host *shp, Scsi_Cmnd *scp, int tid) scp->host_scribble = NULL; ASC_STATS(rmqueue); ret = ASC_TRUE; + break; /* Note: Don't iterate, *scpp may be NULL. */ } } if (ASC_BOARD(shp)->pending[tid] == NULL) { diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index bdd3f9285fab..ccd15ad5340e 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c @@ -1220,9 +1220,9 @@ int aha152x_biosparam(Scsi_Disk * disk, kdev_t dev, int *info_array) info_array[1]=32; info_array[2]=disk->capacity / (64 * 32); } else { - info_array[0] = 256; + info_array[0] = 255; info_array[1] = 63; - info_array[2] = disk->capacity / (256 * 63); + info_array[2] = disk->capacity / (255 * 63); if(info_array[2] > 1023) info_array[2]=1023; } diff --git a/drivers/scsi/eata_dma.c b/drivers/scsi/eata_dma.c index cb534f89ecfc..f735d953b4c6 100644 --- a/drivers/scsi/eata_dma.c +++ b/drivers/scsi/eata_dma.c @@ -1118,7 +1118,7 @@ short register_HBA(u32 base, struct get_conf *gc, Scsi_Host_Template * tpnt, /* * If we are using a ISA board, we can't use extended SG, - * because we would need exessive amounts of memory for + * because we would need excessive amounts of memory for * bounce buffers. */ if (gc->SG_64K==TRUE && ntohs(gc->SGsiz)==64 && hd->bustype!=IS_ISA){ diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c index c7b1f47d9a22..7fe6c3af6beb 100644 --- a/drivers/scsi/in2000.c +++ b/drivers/scsi/in2000.c @@ -82,7 +82,7 @@ * * * TODO: - * proc interface. tagged queuing. multiple cards. + * tagged queuing. multiple cards. * * * NOTE: @@ -120,32 +120,28 @@ #include "hosts.h" #include "in2000.h" -#if LINUX_VERSION_CODE >= 0x010300 #include -#else -#include "../block/blk.h" -#endif +#include #ifdef MODULE #include #endif -#define PROC_INTERFACE /* add code for /proc/scsi/in2000/xxx interface */ - -#define FAST_READ_IO /* No problems with these on my machine */ -#define FAST_WRITE_IO +#define IN2000_VERSION "1.28" +#define IN2000_DATE "07/May/1996" +#define PROC_INTERFACE /* add code for /proc/scsi/in2000/xxx interface */ #define SYNC_DEBUG /* extra info on sync negotiation printed */ #define DEBUGGING_ON /* enable command-line debugging bitmask */ #define DEBUG_DEFAULTS 0 /* default bitmask - change from command-line */ -#define IN2000_VERSION "1.28" -#define IN2000_DATE "27/Apr/1996" +#define FAST_READ_IO /* No problems with these on my machine */ +#define FAST_WRITE_IO #ifdef DEBUGGING_ON #define DB(f,a) if (hostdata->args & (f)) a; -#define CHECK_NULL(p,s) if (!(p)) {printk("\n"); while (1) printk("NP:%s\r",(s));} +#define CHECK_NULL(p,s) /* if (!(p)) {printk("\n"); while (1) printk("NP:%s\r",(s));} */ #else #define DB(f,a) #define CHECK_NULL(p,s) @@ -851,11 +847,7 @@ int i; * re-think the multiple card capability.... */ -#if LINUX_VERSION_CODE >= 0x010346 /* 1.3.70 */ void in2000_intr (int irqnum, void * dev_id, struct pt_regs *ptregs) -#else -void in2000_intr (int irqnum, struct pt_regs *ptregs) -#endif { struct Scsi_Host *instance; struct IN2000_hostdata *hostdata; @@ -1684,11 +1676,7 @@ unsigned long flags; -#if LINUX_VERSION_CODE >= 0x010359 /* 1.3.89 */ int in2000_reset(Scsi_Cmnd *cmd, unsigned int reset_flags) -#else -int in2000_reset(Scsi_Cmnd *cmd) -#endif { unsigned long flags; struct Scsi_Host *instance; @@ -1930,13 +1918,10 @@ char *cp; -#if LINUX_VERSION_CODE >= 0x010300 -#include struct proc_dir_entry proc_scsi_in2000 = { PROC_SCSI_IN2000, 6, "in2000", S_IFDIR | S_IRUGO | S_IXUGO, 2 }; -#endif const unsigned int *bios_tab[] = { @@ -1995,12 +1980,12 @@ char buf[32]; if (check_setup_strings("ioport",&flags,&val,buf)) { base = val; switches = ~inb(base + IO_SWITCHES) & 0xff; - printk("Forcing detection at IOport 0x%x.\n",base); + printk("Forcing IN2000 detection at IOport 0x%x ",base); bios = 2; } else if (*(bios_tab[bios]+0x04) == 0x41564f4e || *(bios_tab[bios]+0x0c) == 0x61776c41) { - printk("Found IN2000 BIOS at 0x%x.\n",(unsigned int)bios_tab[bios]); + printk("Found IN2000 BIOS at 0x%x ",(unsigned int)bios_tab[bios]); /* Read the switch image that's mapped into EPROM space */ @@ -2015,7 +2000,7 @@ char buf[32]; x = ~inb(base + IO_SWITCHES) & 0xff; if (x != switches) { - printk("Bad IO signature: %02x vs %02x\n",x,switches); + printk("Bad IO signature: %02x vs %02x.\n",x,switches); continue; } } @@ -2054,10 +2039,7 @@ char buf[32]; * initialize it. */ -#if LINUX_VERSION_CODE >= 0x010300 tpnt->proc_dir = &proc_scsi_in2000; /* done more than once? harmless. */ -#endif - detect_count++; instance = scsi_register(tpnt, sizeof(struct IN2000_hostdata)); if (!instance_list) @@ -2071,12 +2053,7 @@ char buf[32]; write1_io(0,IO_FIFO_READ); /* start fifo out in read mode */ write1_io(0,IO_INTR_MASK); /* allow all ints */ x = int_tab[(switches & (SW_INT0 | SW_INT1)) >> SW_INT_SHIFT]; - -#if LINUX_VERSION_CODE >= 0x010346 /* 1.3.70 */ if (request_irq(x, in2000_intr, SA_INTERRUPT, "in2000", NULL)) { -#else - if (request_irq(x, in2000_intr, SA_INTERRUPT, "in2000")) { -#endif printk("in2000_detect: Unable to allocate IRQ.\n"); detect_count--; continue; @@ -2119,7 +2096,6 @@ char buf[32]; disc_taken_total = 0; #endif - if (check_setup_strings("nosync",&flags,&val,buf)) hostdata->sync_off = val; @@ -2139,7 +2115,7 @@ char buf[32]; if (check_setup_strings("debug",&flags,&val,buf)) hostdata->args = (val & DB_MASK); - while (check_setup_strings("proc",&flags,&val,buf)) + if (check_setup_strings("proc",&flags,&val,buf)) hostdata->proc = val; x = reset_hardware(instance,(hostdata->args & A_NO_SCSI_RESET)?RESET_CARD:RESET_CARD_AND_BUS); @@ -2154,27 +2130,26 @@ char buf[32]; else hostdata->chip = C_WD33C93; - printk("in2000-%d: dip_switch=%02x: irq=%d ioport=%02x floppy=%s sync/DOS5=%s\n", - instance->host_no,(switches & 0x7f), + printk("dip_switch=%02x irq=%d ioport=%02x floppy=%s sync/DOS5=%s ", + (switches & 0x7f), instance->irq,hostdata->io_base, (switches & SW_FLOPPY)?"Yes":"No", (switches & SW_SYNC_DOS5)?"Yes":"No"); - printk("in2000-%d: hardware_ver=%02x chip=%s microcode=%02x\n", - instance->host_no,hrev, + printk("hardware_ver=%02x chip=%s microcode=%02x\n", + hrev, (hostdata->chip==C_WD33C93)?"WD33c93": (hostdata->chip==C_WD33C93A)?"WD33c93A": (hostdata->chip==C_WD33C93B)?"WD33c93B":"unknown", hostdata->microcode); #ifdef DEBUGGING_ON - printk("in2000-%d: setup_strings = ",instance->host_no); + printk("setup_strings = "); for (x=0; x<8; x++) printk("%s,",setup_strings[x]); printk("\n"); #endif if (hostdata->sync_off == 0xff) - printk("in2000-%d: Sync-transfer DISABLED on all devices: ENABLE from command-line\n",instance->host_no); - printk("in2000-%d: driver version %s - %s\n",instance->host_no, - IN2000_VERSION,IN2000_DATE); + printk("Sync-transfer DISABLED on all devices: ENABLE from command-line\n"); + printk("IN2000 driver version %s - %s\n",IN2000_VERSION,IN2000_DATE); } return detect_count; @@ -2186,11 +2161,7 @@ char buf[32]; * supposed to do... */ -#if LINUX_VERSION_CODE >= 0x010300 int in2000_biosparam(Disk *disk, kdev_t dev, int *iinfo) -#else -int in2000_biosparam(Disk *disk, int dev, int *iinfo) -#endif { int size; @@ -2224,6 +2195,26 @@ int size; } +#ifdef PROC_INTERFACE + +/* Certain older compilers (such as a.out 2.5.8) choke and give a + * "Too many reloads" error when there are a lot of calls to 'strcat()' + * in one function. Modern kernels define 'strcat()' as an inline + * function - I _guess_ this is related to the problem. Regardless, + * we can make everyone happy by doing some macro fudging to force + * gcc to do calls instead of inline expansion. + */ + +char * in2000_strcat(char * dest, const char * src) +{ + return strcat(dest,src); +} + +#define strcat(d,s) (in2000_strcat((d),(s))) + +#endif + + int in2000_proc_info(char *buf, char **start, off_t off, int len, int hn, int in) { diff --git a/drivers/scsi/in2000.h b/drivers/scsi/in2000.h index 1963e987b8b6..60bdd3cb9a63 100644 --- a/drivers/scsi/in2000.h +++ b/drivers/scsi/in2000.h @@ -2,7 +2,7 @@ * in2000.h - Linux device driver definitions for the * Always IN2000 ISA SCSI card. * - * IMPORTANT: This file is for version 1.28 - 27/Apr/1996 + * IMPORTANT: This file is for version 1.28 - 07/May/1996 * * Copyright (c) 1996 John Shifflett, GeoLog Consulting * john@geolog.com @@ -25,16 +25,6 @@ #include -/* We include version.h to get 'LINUX_VERSION_CODE' - a define used here - * and there in the source to get around various compatibility problems: - * - pre-1.3.xx kernels didn't have 'kdev_t' or proc, and their - * was in a different place. - * - 1.3.70 introduced an additional argument for interrupt functions - * - 1.3.89 added an argument to in2000_reset(), which we don't really - * use at the moment. But for completeness... - */ -#include - #define uchar unsigned char @@ -325,17 +315,8 @@ int in2000_abort(Scsi_Cmnd *); void in2000_setup(char *, int *); int in2000_proc_info(char *, char **, off_t, int, int, int); struct proc_dir_entry proc_scsi_in2000; - -#if LINUX_VERSION_CODE >= 0x010300 int in2000_biosparam(struct scsi_disk *, kdev_t, int *); -#else -int in2000_biosparam(Disk *, int, int *); -#endif -#if LINUX_VERSION_CODE >= 0x010359 /* 1.3.89 */ int in2000_reset(Scsi_Cmnd *, unsigned int); -#else -int in2000_reset(Scsi_Cmnd *); -#endif #define IN2000_CAN_Q 16 @@ -343,7 +324,6 @@ int in2000_reset(Scsi_Cmnd *); #define IN2000_CPL 2 #define IN2000_HOST_ID 7 -#if LINUX_VERSION_CODE >= 0x010300 #define IN2000 { NULL, /* link pointer for modules */ \ NULL, /* usage_count for modules */ \ &proc_scsi_in2000, /* pointer to /proc/scsi directory entry */ \ @@ -367,30 +347,5 @@ int in2000_reset(Scsi_Cmnd *); DISABLE_CLUSTERING \ } -#else -#define IN2000 { NULL, /* link pointer for modules */ \ - NULL, /* usage_count for modules */ \ -/* NULL,*/ /* pointer to /proc/scsi directory entry */ \ -/* NULL,*/ /* pointer to proc info function */ \ - "Always IN2000", /* device name */ \ - in2000_detect, /* returns number of in2000's found */ \ - NULL, /* optional unload function for modules */ \ - NULL, /* optional misc info function */ \ - NULL, /* send scsi command, wait for completion */ \ - in2000_queuecommand, /* queue scsi command, don't wait */ \ - in2000_abort, /* abort current command */ \ - in2000_reset, /* reset scsi bus */ \ - NULL, /* slave_attach - unused */ \ - in2000_biosparam, /* figures out BIOS parameters for lilo, etc */ \ - IN2000_CAN_Q, /* max commands we can queue up */ \ - IN2000_HOST_ID, /* host-adapter scsi id */ \ - IN2000_SG, /* scatter-gather table size */ \ - IN2000_CPL, /* commands per lun */ \ - 0, /* board counter */ \ - 0, /* unchecked dma */ \ - DISABLE_CLUSTERING \ - } -#endif - #endif /* IN2000_H */ diff --git a/drivers/scsi/in2000.readme b/drivers/scsi/in2000.readme index 6280b039035a..80a3a7f0bcc3 100644 --- a/drivers/scsi/in2000.readme +++ b/drivers/scsi/in2000.readme @@ -1,5 +1,5 @@ -UPDATE NEWS: version 1.28 - 27 Apr 96 +UPDATE NEWS: version 1.28 - 07 May 96 Tightened up the "interrupts enabled/disabled" discipline in 'in2000_queuecommand()' and maybe 1 or 2 other places. @@ -70,51 +70,8 @@ UPDATE NEWS: version 1.24 - 23 Feb 96 advantage. In a single device system, or if only 1 device is being accessed, transfers usually go faster if disconnects are not allowed. - Hackers -> the positions of some of the 'setup_default' flags - have changed, so check your command-line args if - you've been using them with a previous version. -Hi everyone: - - A revamped IN2000 SCSI driver is available for download and - testing at my ftp site: - - ftp.netcom.com/pub/js/jshiffle - - in the 'in2000' directory. It has what I think are a few - improvements over the stock driver, including disconnect/ - reselect, synchronous transfer, easier debugging, command- - line arguments for setting run-time parameters and debug - output, and better FIFO handling. Swap partitions work now, - as do tape drives and anything else that used to butt heads - with the old driver's 2k block size limit. See the top - of the 'in2000.c' file for more details. - - This is a rewrite of the in2000.[ch] files for Linux. They - are drop-in replacements for the originals in linux/drivers/scsi - - just copy them over the old ones. The driver has been tested - in 1.2.13 with and without ELF, and in the 1.3 series somewhere - up into the 60's. I don't expect any problems with newer kernels. - It is "modular-ised" for those who prefer that route. - -------- Hackers take note: ------------------ -Anyone who wants to use LILO to pass a command line to this driver -will have to make 2 small changes to the file 'init/main.c'. Find -the area between lines 60-80 where all the 'xxxxx_setup()' extern -declarations are and insert a new one like the following: - -extern void in2000_setup(char *str, int *ints); - -Then do a search for "bootsetups" - add a new entry to this array -(somewhere in the middle) that looks like this: - -#ifdef CONFIG_SCSI_IN2000 - { "in2000=", in2000_setup }, -#endif - -[You can skip the above if you're only loading the driver as a module - or if the driver defaults are OK.] The default arguments (you get these when you don't give an 'in2000' command-line argument, or you give a blank argument) will cause @@ -142,30 +99,15 @@ line with the 'period' keyword. ------------------------------------------------ - I have run a LOT of tests on this driver, and it seems very solid, - including with up to 3 simultaneous large copy or tar commands - running between 6 devices at once. Synchronous transfers are - working fine for the devices I have to test, although others have - reported some failures (CDROM drives, mostly). Tape drives work - well (finally!) and so do CD-ROM drives. - I should mention that Drew Eckhardt's 'Generic NCR5380' sources were my main inspiration, with lots of reference to the IN2000 driver currently distributed in the kernel source. I also owe much to a driver written by Hamish Macdonald for Linux-m68k(!). And to Eric Wright for being an ALPHA guinea pig. And to Bill Earnest for 2 tons of great input and information. And to David - Willmore for extensive 'bonnie' testing. - - Be forewarned that while I've had good luck with it, this - is the first time it's been loose out in the wide world. - It wouldn't surprise me if people uncover problems that - I haven't caught.... + Willmore for extensive 'bonnie' testing. And to Joe Mack for + continual testing and feedback. - Please try the driver out. Test it, beat on it. And PLEASE get back - to me - I really need to hear about bugs, stupid or bad code, - and any ideas for enhancements. - Thanks very much... John Shifflett jshiffle@netcom.com diff --git a/fs/Makefile b/fs/Makefile index 5ec162671d61..4359e3acc466 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -173,6 +173,14 @@ else endif endif +ifeq ($(CONFIG_BINFMT_JAVA),y) +BINFMTS += binfmt_java.o +else + ifeq ($(CONFIG_BINFMT_JAVA),m) + M_OBJS += binfmt_java.o + endif +endif + # binfmt_script is always there BINFMTS += binfmt_script.o diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c index 55a125f50f14..49fbfe7f0eeb 100644 --- a/fs/affs/amigaffs.c +++ b/fs/affs/amigaffs.c @@ -128,7 +128,7 @@ affs_fix_link_pred(struct inode *startino, LONG key, LONG newkey) while (1) { if (nextkey == 0) break; - pr_debug("AFFS: find_link_pred(): next key=%d\n", nextkey)); + pr_debug("AFFS: find_link_pred(): next key=%d\n", nextkey); if (!(bh = affs_bread(startino->i_dev,nextkey,AFFS_I2BSIZE(startino)))) break; if (affs_checksum_block(AFFS_I2BSIZE(startino),bh->b_data,&ptype,&stype) diff --git a/fs/affs/namei.c b/fs/affs/namei.c index f213dc1eb9e8..ab06a17ee96f 100644 --- a/fs/affs/namei.c +++ b/fs/affs/namei.c @@ -603,7 +603,7 @@ start_up: if (affs_parent_ino(old_inode) != old_dir->i_ino) goto end_rename; } - /* Unlink destination if existant */ + /* Unlink destination if existent */ if (new_inode) { if ((retval = affs_fix_hash_pred(new_dir,affs_hash_name(new_name,new_len, AFFS_I2FSTYPE(new_dir),AFFS_I2HSIZE(new_dir)) + 6, diff --git a/fs/binfmt_java.c b/fs/binfmt_java.c new file mode 100644 index 000000000000..a7cfa87a5b5b --- /dev/null +++ b/fs/binfmt_java.c @@ -0,0 +1,187 @@ +/* + * linux/fs/binfmt_java.c + * + * Copyright (C) 1996 Brian A. Lantz + * derived from binfmt_script.c + */ + +#include +#include +#include +#include +#include +#include + +#define _PATH_JAVA "/usr/local/java/bin/java" +#define _PATH_APPLET "/usr/local/java/bin/appletviewer" +#define _PATH_BASH "/bin/bash" + +static int do_load_script(struct linux_binprm *bprm,struct pt_regs *regs) +{ + char *cp, *interp, *i_name; + int retval; + unsigned char *ucp = (unsigned char *) bprm->buf; + if ((ucp[0] != 0xca) || (ucp[1] != 0xfe) || (ucp[2] != 0xba) || (ucp[3] != 0xbe)) + return -ENOEXEC; + + iput(bprm->inode); + bprm->dont_iput=1; + + /* + * OK, we've set the interpreter name + * Splice in (1) the interpreter's name for argv[0] (_PATH_BASH) + * (2) the name of the java wrapper for argv[1] (_PATH_JAVA) + * (3) filename of Java class (replace argv[0]) + * without leading path or trailing '.class' + * + * This is done in reverse order, because of how the + * user environment and arguments are stored. + */ + remove_arg_zero(bprm); + if ((cp = strstr (bprm->filename, ".class")) != NULL) + *cp = 0; + if ((i_name = strrchr (bprm->filename, '/')) != NULL) + i_name++; + else + i_name = bprm->filename; + bprm->p = copy_strings(1, &i_name, bprm->page, bprm->p, 2); + bprm->argc++; + + strcpy (bprm->buf, _PATH_JAVA); + cp = bprm->buf; + bprm->p = copy_strings(1, &cp, bprm->page, bprm->p, 2); + bprm->argc++; + + strcpy (bprm->buf, _PATH_BASH); + interp = bprm->buf; + if ((i_name = strrchr (bprm->buf, '/')) != NULL) + i_name++; + else + i_name = bprm->buf; + bprm->p = copy_strings(1, &i_name, bprm->page, bprm->p, 2); + bprm->argc++; + if (!bprm->p) + return -E2BIG; + /* + * OK, now restart the process with the interpreter's inode. + * Note that we use open_namei() as the name is now in kernel + * space, and we don't need to copy it. + */ + retval = open_namei(interp, 0, 0, &bprm->inode, NULL); + if (retval) + return retval; + bprm->dont_iput=0; + retval=prepare_binprm(bprm); + if(retval<0) + return retval; + + return search_binary_handler(bprm,regs); +} + +static int do_load_applet(struct linux_binprm *bprm,struct pt_regs *regs) +{ + char *cp, *interp, *i_name; + int retval; + if (strncmp (bprm->buf, "