diff -u --recursive --new-file v1.1.66/linux/Makefile linux/Makefile --- v1.1.66/linux/Makefile Sat Nov 26 18:36:04 1994 +++ linux/Makefile Sun Nov 27 20:21:20 1994 @@ -1,6 +1,6 @@ VERSION = 1 PATCHLEVEL = 1 -SUBLEVEL = 66 +SUBLEVEL = 67 ARCH = i386 diff -u --recursive --new-file v1.1.66/linux/arch/alpha/Makefile linux/arch/alpha/Makefile --- v1.1.66/linux/arch/alpha/Makefile Thu Jan 1 02:00:00 1970 +++ linux/arch/alpha/Makefile Sun Nov 27 20:19:52 1994 @@ -0,0 +1,77 @@ +# +# alpha/Makefile +# +# This file is subject to the terms and conditions of the GNU General Public +# License. See the file "COPYING" in the main directory of this archive +# for more details. +# +# Copyright (C) 1994 by Linus Torvalds +# + +AS =as +LD =ld +HOSTCC =gcc -I$(TOPDIR)/include +CC =gcc -D__KERNEL__ -I$(TOPDIR)/include +MAKE =make +CPP =$(CC) -E +AR =ar +STRIP =strip + +zBoot/zSystem: zBoot/*.c zBoot/*.S tools/zSystem + $(MAKE) -C zBoot + +zImage: $(CONFIGURE) boot/bootsect boot/setup zBoot/zSystem tools/build + tools/build boot/bootsect boot/setup zBoot/zSystem $(ROOT_DEV) > zImage + sync + +zdisk: zImage + dd bs=8192 if=zImage of=/dev/fd0 + +zlilo: $(CONFIGURE) zImage + if [ -f $(INSTALL_PATH)/vmlinuz ]; then mv $(INSTALL_PATH)/vmlinuz $(INSTALL_PATH)/vmlinuz.old; fi + if [ -f $(INSTALL_PATH)/zSystem.map ]; then mv $(INSTALL_PATH)/zSystem.map $(INSTALL_PATH)/zSystem.old; fi + cat zImage > $(INSTALL_PATH)/vmlinuz + cp zSystem.map $(INSTALL_PATH)/ + if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi + +tools/system: boot/head.o init/main.o tools/version.o linuxsubdirs + $(LD) $(LOWLDFLAGS) boot/head.o init/main.o tools/version.o \ + $(ARCHIVES) \ + $(FILESYSTEMS) \ + $(DRIVERS) \ + $(LIBS) \ + -o tools/system + nm tools/zSystem | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | \ + sort > System.map + +boot/setup.o: boot/setup.s + $(AS) -o $@ $< + +boot/setup.s: boot/setup.S $(CONFIGURE) include/linux/config.h Makefile + $(CPP) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@ + +boot/bootsect.s: boot/bootsect.S $(CONFIGURE) include/linux/config.h Makefile + $(CPP) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@ + +tools/zSystem: boot/head.o init/main.o tools/version.o linuxsubdirs + $(LD) $(HIGHLDFLAGS) boot/head.o init/main.o tools/version.o \ + $(ARCHIVES) \ + $(FILESYSTEMS) \ + $(DRIVERS) \ + $(LIBS) \ + -o tools/zSystem + nm tools/zSystem | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | \ + sort > zSystem.map + +# +# Leave these dummy entries for now to tell people that they are going away.. +# +lilo: + @echo + @echo Uncompressed kernel images no longer supported. Use + @echo \"make zlilo\" instead. + @echo + @exit 1 + +archclean: + rm -f boot/bootsect boot/setup diff -u --recursive --new-file v1.1.66/linux/arch/alpha/boot/head.S linux/arch/alpha/boot/head.S --- v1.1.66/linux/arch/alpha/boot/head.S Thu Jan 1 02:00:00 1970 +++ linux/arch/alpha/boot/head.S Sun Nov 27 20:19:52 1994 @@ -0,0 +1,111 @@ +/* + * alpha/head.S + * + * initial boot stuff.. + */ + +#include + +#define halt .long PAL_halt + +/* + * NOTE! The console bootstrap will load us at 0x20000000, but this image + * is linked to run at START_ADDR, so the first thing we do is to move + * ourself up to the right address.. We'd better be position-independent + * at that stage :-) + */ + .set noreorder + .globl __start + .ent __start +__start: + bis $31,$31,$31 + br $1,$200 + .long START_ADDR, START_ADDR >> 32 /* strange bug in the assembler.. duh */ + .long START_SIZE, START_SIZE >> 32 +$200: ldq $30,0($1) /* new stack - below this */ + lda $2,-8($1) /* __start */ + bis $30,$30,$3 /* new address */ + subq $3,$2,$6 /* difference */ + ldq $4,8($1) /* size */ +$201: subq $4,8,$4 + ldq $5,0($2) + addq $2,8,$2 + stq $5,0($3) + addq $3,8,$3 + bne $4,$201 + br $1,$202 +$202: addq $1,$6,$1 + addq $1,12,$1 /* $203 in the new address space */ + jmp $31,($1),$203 +$203: br $27,$100 +$100: ldgp $29,0($27) + lda $27,start_kernel + jsr $26,($27),start_kernel + halt + .end __start + + .align 5 + .globl wrent + .ent wrent +wrent: + .long PAL_wrent + ret ($26) + .end wrent + + .align 5 + .globl wrkgp + .ent wrkgp +wrkgp: + .long PAL_wrkgp + ret ($26) + .end wrkgp + + .align 5 + .globl switch_to_osf_pal + .ent switch_to_osf_pal +switch_to_osf_pal: + subq $30,128,$30 + stq $26,0($30) + stq $1,8($30) + stq $2,16($30) + stq $3,24($30) + stq $4,32($30) + stq $5,40($30) + stq $6,48($30) + stq $7,56($30) + stq $8,64($30) + stq $9,72($30) + stq $10,80($30) + stq $11,88($30) + stq $12,96($30) + stq $13,104($30) + stq $14,112($30) + stq $15,120($30) + + stq $30,0($17) /* save KSP in PCB */ + + bis $30,$30,$20 /* a4 = KSP */ + br $17,__do_swppal + + ldq $26,0($30) + ldq $1,8($30) + ldq $2,16($30) + ldq $3,24($30) + ldq $4,32($30) + ldq $5,40($30) + ldq $6,48($30) + ldq $7,56($30) + ldq $8,64($30) + ldq $9,72($30) + ldq $10,80($30) + ldq $11,88($30) + ldq $12,96($30) + ldq $13,104($30) + ldq $14,112($30) + ldq $15,120($30) + addq $30,128,$30 + ret ($26) + +__do_swppal: + .long PAL_swppal + .end switch_to_osf_pal diff -u --recursive --new-file v1.1.66/linux/arch/alpha/config.in linux/arch/alpha/config.in --- v1.1.66/linux/arch/alpha/config.in Thu Jan 1 02:00:00 1970 +++ linux/arch/alpha/config.in Sun Nov 27 20:19:52 1994 @@ -0,0 +1,215 @@ +# +# For a description of the syntax of this configuration file, +# see the Configure script. +# + +comment 'General setup' + +bool 'Normal harddisk support' CONFIG_BLK_DEV_HD n +bool 'XT harddisk support' CONFIG_BLK_DEV_XD n +bool 'Networking support' CONFIG_NET y +bool 'System V IPC' CONFIG_SYSVIPC y +bool 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF y + +if [ "$CONFIG_NET" = "y" ]; then +comment 'Networking options' +bool 'TCP/IP networking' CONFIG_INET y +if [ "$CONFIG_INET" "=" "y" ]; then +bool 'IP forwarding/gatewaying' CONFIG_IP_FORWARD n +comment '(it is safe to leave these untouched)' +bool 'PC/TCP compatibility mode' CONFIG_INET_PCTCP n +bool 'Reverse ARP' CONFIG_INET_RARP n +bool 'Assume subnets are local' CONFIG_INET_SNARL y +bool 'Disable NAGLE algorithm (normally enabled)' CONFIG_TCP_NAGLE_OFF n +fi +bool 'The IPX protocol' CONFIG_IPX n +#bool 'Amateur Radio AX.25 Level 2' CONFIG_AX25 n +fi + +comment 'SCSI support' + +bool 'SCSI support?' CONFIG_SCSI y + +if [ "$CONFIG_SCSI" = "n" ]; then + +comment 'Skipping SCSI configuration options...' + +else + +comment 'SCSI support type (disk, tape, CDrom)' + +bool 'Scsi disk support' CONFIG_BLK_DEV_SD y +bool 'Scsi tape support' CONFIG_CHR_DEV_ST n +bool 'Scsi CDROM support' CONFIG_BLK_DEV_SR n +bool 'Scsi generic support' CONFIG_CHR_DEV_SG n + +comment 'SCSI low-level drivers' + +bool 'Adaptec AHA152X support' CONFIG_SCSI_AHA152X n +bool 'Adaptec AHA1542 support' CONFIG_SCSI_AHA1542 n +bool 'Adaptec AHA1740 support' CONFIG_SCSI_AHA1740 y +bool 'Adaptec AHA274X/284X support' CONFIG_SCSI_AHA274X n +bool 'BusLogic SCSI support' CONFIG_SCSI_BUSLOGIC n +bool 'UltraStor 14F/34F support' CONFIG_SCSI_U14_34F n +bool 'Future Domain 16xx SCSI support' CONFIG_SCSI_FUTURE_DOMAIN n +bool 'Generic NCR5380 SCSI support' CONFIG_SCSI_GENERIC_NCR5380 n +bool 'NCR53c7,8xx SCSI support' CONFIG_SCSI_NCR53C7xx n +bool 'Always IN2000 SCSI support' CONFIG_SCSI_IN2000 n +bool 'PAS16 SCSI support' CONFIG_SCSI_PAS16 n +bool 'QLOGIC SCSI support' CONFIG_SCSI_QLOGIC n +bool 'Seagate ST-02 and Future Domain TMC-8xx SCSI support' CONFIG_SCSI_SEAGATE n +bool 'Trantor T128/T128F/T228 SCSI support' CONFIG_SCSI_T128 n +bool 'UltraStor SCSI support' CONFIG_SCSI_ULTRASTOR n +bool '7000FASST SCSI support' CONFIG_SCSI_7000FASST n +bool 'EISA EATA support' CONFIG_SCSI_EATA n +#bool 'SCSI debugging host adapter' CONFIG_SCSI_DEBUG n +fi + + +if [ "$CONFIG_NET" = "y" ]; then + +comment 'Network device support' + +bool 'Network device support?' CONFIG_NETDEVICES y +if [ "$CONFIG_NETDEVICES" = "n" ]; then + +comment 'Skipping network driver configuration options...' + +else +bool 'Dummy net driver support' CONFIG_DUMMY n +bool 'SLIP (serial line) support' CONFIG_SLIP n +if [ "$CONFIG_SLIP" = "y" ]; then + bool ' CSLIP compressed headers' SL_COMPRESSED y +# bool ' SLIP debugging on' SL_DUMP y +fi +bool 'PPP (point-to-point) support' CONFIG_PPP n +bool 'PLIP (parallel port) support' CONFIG_PLIP n +bool 'Load balancing support (experimental)' CONFIG_SLAVE_BALANCING n +bool 'Do you want to be offered ALPHA test drivers' CONFIG_NET_ALPHA n +bool 'Western Digital/SMC cards' CONFIG_NET_VENDOR_SMC n +if [ "$CONFIG_NET_VENDOR_SMC" = "y" ]; then + bool 'WD80*3 support' CONFIG_WD80x3 n + bool 'SMC Ultra support' CONFIG_ULTRA n +fi +bool '3COM cards' CONFIG_NET_VENDOR_3COM n +if [ "$CONFIG_NET_VENDOR_3COM" = "y" ]; then + bool '3c501 support' CONFIG_EL1 n + bool '3c503 support' CONFIG_EL2 n + if [ "$CONFIG_NET_ALPHA" = "y" ]; then + bool '3c505 support' CONFIG_ELPLUS n + bool '3c507 support' CONFIG_EL16 n + fi + bool '3c509/3c579 support' CONFIG_EL3 y +fi +bool 'Other ISA cards' CONFIG_NET_ISA y +if [ "$CONFIG_NET_ISA" = "y" ]; then + bool 'AT1500 and NE2100 (LANCE and PCnet-ISA) support' CONFIG_LANCE n + bool 'Cabletron E21xx support (not recommended)' CONFIG_E2100 n + bool 'DEPCA support' CONFIG_DEPCA y + bool 'EtherWorks 3 support' CONFIG_EWRK3 n + if [ "$CONFIG_NET_ALPHA" = "y" ]; then + bool 'EtherExpress support' CONFIG_EEXPRESS n + bool 'AT1700 support' CONFIG_AT1700 n + bool 'NI5210 support' CONFIG_NI52 n + bool 'NI6510 support' CONFIG_NI65 n + fi + bool 'HP PCLAN support' CONFIG_HPLAN n + bool 'HP PCLAN PLUS support' CONFIG_HPLAN_PLUS n + bool 'NE2000/NE1000 support' CONFIG_NE2000 n + bool 'SK_G16 support' CONFIG_SK_G16 n +fi +bool 'EISA and on board controllers' CONFIG_NET_EISA n + if [ "$CONFIG_NET_ALPHA" = "y" ]; then + bool 'Ansel Communications EISA 3200 support' CONFIG_AC3200 n + fi + bool 'Apricot Xen-II on board ethernet' CONFIG_APRICOT n +bool 'Pocket and portable adaptors' CONFIG_NET_POCKET n +if [ "$CONFIG_NET_POCKET" = "y" ]; then + bool 'D-Link DE600 pocket adaptor support' CONFIG_DE600 n + bool 'D-Link DE620 pocket adaptor support' CONFIG_DE620 n + bool 'AT-LAN-TEC/RealTek pocket adaptor support' CONFIG_ATP n + bool 'Zenith Z-Note support' CONFIG_ZNET n +fi +fi +fi + +comment 'CD-ROM drivers' + +bool 'Sony CDU31A/CDU33A CDROM driver support' CONFIG_CDU31A n +bool 'Mitsumi CDROM driver support' CONFIG_MCD n +bool 'Matsushita/Panasonic CDROM driver support' CONFIG_SBPCD n +if [ "$CONFIG_SBPCD" = "y" ]; then + bool 'Matsushita/Panasonic second CDROM controller support' CONFIG_SBPCD2 n + if [ "$CONFIG_SBPCD2" = "y" ]; then + bool 'Matsushita/Panasonic third CDROM controller support' CONFIG_SBPCD3 n + if [ "$CONFIG_SBPCD3" = "y" ]; then + bool 'Matsushita/Panasonic fourth CDROM controller support' CONFIG_SBPCD4 n + fi + fi +fi + +comment 'Filesystems' + +bool 'Standard (minix) fs support' CONFIG_MINIX_FS y +bool 'Extended fs support' CONFIG_EXT_FS n +bool 'Second extended fs support' CONFIG_EXT2_FS y +bool 'xiafs filesystem support' CONFIG_XIA_FS n +bool 'msdos fs support' CONFIG_MSDOS_FS y +if [ "$CONFIG_MSDOS_FS" = "y" ]; then +bool 'umsdos: Unix like fs on top of std MSDOS FAT fs' CONFIG_UMSDOS_FS n +fi +bool '/proc filesystem support' CONFIG_PROC_FS y +if [ "$CONFIG_INET" = "y" ]; then +bool 'NFS filesystem support' CONFIG_NFS_FS y +fi +if [ "$CONFIG_BLK_DEV_SR" = "y" -o "$CONFIG_CDU31A" = "y" -o "$CONFIG_MCD" = "y" -o "$CONFIG_SBPCD" = "y" -o "$CONFIG_BLK_DEV_IDECD" = "y" ]; then + bool 'ISO9660 cdrom filesystem support' CONFIG_ISO9660_FS y +else + bool 'ISO9660 cdrom filesystem support' CONFIG_ISO9660_FS n +fi +bool 'OS/2 HPFS filesystem support (read only)' CONFIG_HPFS_FS n +bool 'System V and Coherent filesystem support' CONFIG_SYSV_FS n + +comment 'character devices' + +bool 'Parallel printer support' CONFIG_PRINTER n +bool 'Logitech busmouse support' CONFIG_BUSMOUSE n +bool 'PS/2 mouse (aka "auxiliary device") support' CONFIG_PSMOUSE y +if [ "$CONFIG_PSMOUSE" = "y" ]; then +bool 'C&T 82C710 mouse port support (as on TI Travelmate)' CONFIG_82C710_MOUSE y +fi +bool 'Microsoft busmouse support' CONFIG_MS_BUSMOUSE n +bool 'ATIXL busmouse support' CONFIG_ATIXL_BUSMOUSE n +bool 'Selection (cut and paste for virtual consoles)' CONFIG_SELECTION n + +bool 'QIC-02 tape support' CONFIG_QIC02_TAPE n +if [ "$CONFIG_QIC02_TAPE" = "y" ]; then +bool 'Do you want runtime configuration for QIC-02' CONFIG_QIC02_DYNCONF y +if [ "$CONFIG_QIC02_DYNCONF" != "y" ]; then + +comment '>>> Edit configuration parameters in ./include/linux/tpqic02.h!' + +else + +comment '>>> Setting runtime QIC-02 configuration is done with qic02conf' +comment '>>> Which is available from ftp://ftp.funet.fi/pub/OS/Linux/BETA/QIC-02/' + +fi +fi + +bool 'QIC-117 tape support' CONFIG_FTAPE n +if [ "$CONFIG_FTAPE" = "y" ]; then +int ' number of ftape buffers' NR_FTAPE_BUFFERS 3 +fi + +comment 'Sound' + +bool 'Sound card support' CONFIG_SOUND n + +comment 'Kernel hacking' + +#bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC n +bool 'Kernel profiling support' CONFIG_PROFILE n +if [ "$CONFIG_SCSI" = "y" ]; then +bool 'Verbose scsi error reporting (kernel size +=12K)' CONFIG_SCSI_CONSTANTS y +fi diff -u --recursive --new-file v1.1.66/linux/arch/i386/boot/head.S linux/arch/i386/boot/head.S --- v1.1.66/linux/arch/i386/boot/head.S Thu Oct 6 10:36:36 1994 +++ linux/arch/i386/boot/head.S Sun Nov 27 20:19:52 1994 @@ -16,10 +16,10 @@ .globl _empty_zero_page .globl _floppy_track_buffer +#define __ASSEMBLY__ #include -#include -#define ASSEMBLER #include +#include #define CL_MAGIC_ADDR 0x90020 #define CL_MAGIC 0xA33F diff -u --recursive --new-file v1.1.66/linux/arch/i386/boot/setup.S linux/arch/i386/boot/setup.S --- v1.1.66/linux/arch/i386/boot/setup.S Fri Aug 19 08:53:37 1994 +++ linux/arch/i386/boot/setup.S Sun Nov 27 20:19:52 1994 @@ -19,8 +19,9 @@ ! ! NOTE! These had better be the same as in bootsect.s! +#define __ASSEMBLY__ #include -#include +#include #ifndef SVGA_MODE #define SVGA_MODE ASK_VGA diff -u --recursive --new-file v1.1.66/linux/arch/i386/config.in linux/arch/i386/config.in --- v1.1.66/linux/arch/i386/config.in Sat Nov 26 18:36:04 1994 +++ linux/arch/i386/config.in Sat Nov 26 17:04:58 1994 @@ -58,7 +58,7 @@ bool 'Future Domain 16xx SCSI support' CONFIG_SCSI_FUTURE_DOMAIN n bool 'Generic NCR5380 SCSI support' CONFIG_SCSI_GENERIC_NCR5380 n bool 'NCR53c7,8xx SCSI support' CONFIG_SCSI_NCR53C7xx n -bool 'Always IN2000 SCSI support' CONFIG_SCSI_IN2000 n +bool 'Always IN2000 SCSI support (test release)' CONFIG_SCSI_IN2000 n bool 'PAS16 SCSI support' CONFIG_SCSI_PAS16 n bool 'QLOGIC SCSI support' CONFIG_SCSI_QLOGIC n bool 'Seagate ST-02 and Future Domain TMC-8xx SCSI support' CONFIG_SCSI_SEAGATE n diff -u --recursive --new-file v1.1.66/linux/arch/i386/entry.S linux/arch/i386/entry.S --- v1.1.66/linux/arch/i386/entry.S Thu Oct 6 08:32:23 1994 +++ linux/arch/i386/entry.S Sun Nov 27 20:19:52 1994 @@ -40,8 +40,9 @@ * 40(%esp) - %oldss */ -#include +#define __ASSEMBLY__ #include +#include EBX = 0x00 ECX = 0x04 diff -u --recursive --new-file v1.1.66/linux/drivers/FPU-emu/fpu_entry.c linux/drivers/FPU-emu/fpu_entry.c --- v1.1.66/linux/drivers/FPU-emu/fpu_entry.c Thu Jun 2 10:28:24 1994 +++ linux/drivers/FPU-emu/fpu_entry.c Sun Nov 27 20:19:52 1994 @@ -24,15 +24,14 @@ +---------------------------------------------------------------------------*/ #include -#include + +#include #include "fpu_system.h" #include "fpu_emu.h" #include "exception.h" #include "control_w.h" #include "status_w.h" - -#include #define __BAD__ FPU_illegal /* Illegal on an 80486, causes SIGILL */ diff -u --recursive --new-file v1.1.66/linux/drivers/char/console.c linux/drivers/char/console.c --- v1.1.66/linux/drivers/char/console.c Sat Nov 26 18:36:05 1994 +++ linux/drivers/char/console.c Mon Nov 28 10:34:00 1994 @@ -27,7 +27,7 @@ * 'void poke_blanked_console(void)' * 'void scrollback(int lines)' * 'void scrollfront(int lines)' - * 'int do_screendump(int arg)' + * 'int do_screendump(int arg, int mode)' * * 'int con_get_font(char *)' * 'int con_set_font(char *)' @@ -2122,10 +2122,18 @@ lock = 0; } -int do_screendump(int arg) +/* + * do_screendump is used for three tasks: + * if (mode==0) is the old ioctl(TIOCLINUX,0) + * if (mode==1) dumps wd,hg, cursor position, and all the char-attr pairs + * if (mode==2) restores what mode1 got. + * the new modes are needed for a fast and complete dump-restore cycle, + * needed to implement root-window menus in text mode (A Rubini Nov 1994) + */ +int do_screendump(int arg, int mode) { char *sptr, *buf = (char *)arg; - int currcons, l; + int currcons, l, chcount; if (!suser()) return -EPERM; @@ -2136,14 +2144,33 @@ currcons = (currcons ? currcons-1 : fg_console); if (!vc_cons_allocated(currcons)) return -EIO; - l = verify_area(VERIFY_WRITE, buf, 2+video_num_columns*video_num_lines); + + /* mode 0 needs 2+wd*ht, modes 1 and 2 need 4+2*wd*ht */ + chcount=video_num_columns*video_num_lines; + l = verify_area(mode==2 ? VERIFY_READ :VERIFY_WRITE, + buf, (2+chcount)*(1+mode!=0)); if (l) return l; + if (mode<2) { put_fs_byte((char)(video_num_lines),buf++); put_fs_byte((char)(video_num_columns),buf++); + } + switch(mode) { + case 0: sptr = (char *) origin; - for (l=video_num_lines*video_num_columns; l>0 ; l--, sptr++) + for (l=chcount; l>0 ; l--, sptr++) put_fs_byte(*sptr++,buf++); + break; + case 1: + put_fs_byte((char)x,buf++); put_fs_byte((char)y,buf++); + memcpy_tofs(buf,(char *)origin,2*chcount); + break; + case 2: + buf+=2; /* skip the the numnber 9 and console number */ + x=get_fs_byte(buf++); y=get_fs_byte(buf++); + memcpy_fromfs((char *)origin,buf,2*chcount); + break; + } return(0); } diff -u --recursive --new-file v1.1.66/linux/drivers/char/lp.c linux/drivers/char/lp.c --- v1.1.66/linux/drivers/char/lp.c Tue Oct 18 10:07:53 1994 +++ linux/drivers/char/lp.c Sat Nov 26 18:21:34 1994 @@ -456,6 +456,8 @@ } /* take on all known port values */ for (offset = 0; offset < LP_NO; offset++) { + if (check_region(LP_B(offset), 3)) + continue; /* write to port & read back to check */ outb_p( LP_DUMMY, LP_B(offset)); for (testvalue = 0 ; testvalue < LP_DELAY ; testvalue++) @@ -465,6 +467,7 @@ LP_F(offset) |= LP_EXIST; lp_reset(offset); printk("lp_init: lp%d exists, ", offset); + snarf_region(LP_B(offset), 3); if (LP_IRQ(offset)) printk("using IRQ%d\n", LP_IRQ(offset)); else diff -u --recursive --new-file v1.1.66/linux/drivers/char/tty_io.c linux/drivers/char/tty_io.c --- v1.1.66/linux/drivers/char/tty_io.c Wed Nov 9 14:56:34 1994 +++ linux/drivers/char/tty_io.c Mon Nov 28 13:38:20 1994 @@ -72,7 +72,7 @@ extern int mouse_reporting(void); extern int shift_state; #endif /* CONFIG_SELECTION */ -extern int do_screendump(int arg); +extern int do_screendump(int arg, int mode); struct termios tty_std_termios; /* for the benefit of tty drivers */ struct tty_driver *tty_drivers = NULL; /* linked list of tty drivers */ @@ -1400,10 +1400,10 @@ retval = verify_area(VERIFY_READ, (void *) arg, 1); if (retval) return retval; - switch (get_fs_byte((char *)arg)) + switch (retval = get_fs_byte((char *)arg)) { case 0: - return do_screendump(arg); + return do_screendump(arg,0); case 1: printk("Deprecated TIOCLINUX (1) ioctl\n"); return do_get_ps_info(arg); @@ -1420,16 +1420,21 @@ case 5: return sel_loadlut(arg); case 6: - /* Make it possible to react to Shift+Mousebutton */ - /* Note that shift_state is an undocumented - kernel-internal variable; programs not closely - related to the kernel should not use this. */ + /* + * Make it possible to react to Shift+Mousebutton. + * Note that 'shift_state' is an undocumented + * kernel-internal variable; programs not closely + * related to the kernel should not use this. + */ put_fs_byte(shift_state,arg); return 0; case 7: put_fs_byte(mouse_reporting(),arg); return 0; #endif /* CONFIG_SELECTION */ + case 8: /* second arg is 1 or 2 */ + case 9: /* both are explained in console.c */ + return do_screendump(arg,retval-7); default: return -EINVAL; } @@ -1598,7 +1603,7 @@ int found = 0; int major_inuse = 0; - if (driver->refcount) + if (*driver->refcount) return -EBUSY; for (p = tty_drivers; p; p = p->next) { diff -u --recursive --new-file v1.1.66/linux/drivers/net/3c501.c linux/drivers/net/3c501.c --- v1.1.66/linux/drivers/net/3c501.c Sun Oct 9 19:28:47 1994 +++ linux/drivers/net/3c501.c Sun Nov 27 20:19:52 1994 @@ -34,9 +34,10 @@ #include #include #include +#include + #include #include -#include #include #include diff -u --recursive --new-file v1.1.66/linux/drivers/net/8390.c linux/drivers/net/8390.c --- v1.1.66/linux/drivers/net/8390.c Sun Oct 9 19:28:47 1994 +++ linux/drivers/net/8390.c Sun Nov 27 20:19:52 1994 @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include #include diff -u --recursive --new-file v1.1.66/linux/drivers/net/apricot.c linux/drivers/net/apricot.c --- v1.1.66/linux/drivers/net/apricot.c Sat Nov 26 18:36:05 1994 +++ linux/drivers/net/apricot.c Sun Nov 27 20:19:52 1994 @@ -671,13 +671,13 @@ for(i = 0; i < 6 ; i++) - eth_addr[i] = inb(ioaddr +8 +i)); + eth_addr[i] = inb(ioaddr +8 +i); /* Some other boards trip the checksum.. but then appear as ether address 0. Trap these - AC */ if(memcmp(eth_addr,"\x00\x00\x00\x00\x00\x00",6)==0) - return mem_addr; + return mem_start; dev = init_etherdev(0, (sizeof (struct i596_private) + 0xf), &mem_start); printk("%s: Apricot 82596 at %#3x,", dev->name, ioaddr); diff -u --recursive --new-file v1.1.66/linux/drivers/net/at1700.c linux/drivers/net/at1700.c --- v1.1.66/linux/drivers/net/at1700.c Tue Nov 22 15:41:11 1994 +++ linux/drivers/net/at1700.c Sun Nov 27 20:19:53 1994 @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include diff -u --recursive --new-file v1.1.66/linux/drivers/net/atp.c linux/drivers/net/atp.c --- v1.1.66/linux/drivers/net/atp.c Wed Aug 10 20:00:12 1994 +++ linux/drivers/net/atp.c Sun Nov 27 20:19:53 1994 @@ -89,7 +89,7 @@ #include #include #include -#include +#include #include #include diff -u --recursive --new-file v1.1.66/linux/drivers/net/de600.c linux/drivers/net/de600.c --- v1.1.66/linux/drivers/net/de600.c Wed Aug 10 20:00:12 1994 +++ linux/drivers/net/de600.c Sun Nov 27 20:19:53 1994 @@ -98,10 +98,10 @@ #include #include #include -#include +#include #include #include -#include +#include #include #include diff -u --recursive --new-file v1.1.66/linux/drivers/net/de620.c linux/drivers/net/de620.c --- v1.1.66/linux/drivers/net/de620.c Wed Aug 10 20:00:12 1994 +++ linux/drivers/net/de620.c Sun Nov 27 20:19:53 1994 @@ -109,10 +109,10 @@ #include #include #include -#include +#include #include #include -#include +#include #include #include diff -u --recursive --new-file v1.1.66/linux/drivers/net/dummy.c linux/drivers/net/dummy.c --- v1.1.66/linux/drivers/net/dummy.c Fri Jun 17 07:53:53 1994 +++ linux/drivers/net/dummy.c Sun Nov 27 20:19:53 1994 @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include diff -u --recursive --new-file v1.1.66/linux/drivers/net/ne.c linux/drivers/net/ne.c --- v1.1.66/linux/drivers/net/ne.c Sat Nov 26 18:36:05 1994 +++ linux/drivers/net/ne.c Sun Nov 27 13:14:21 1994 @@ -1,3 +1,4 @@ +#define rw_bugfix /* ne.c: A general non-shared-memory NS8390 ethernet driver for linux. */ /* Written 1992-94 by Donald Becker. diff -u --recursive --new-file v1.1.66/linux/drivers/net/plip.c linux/drivers/net/plip.c --- v1.1.66/linux/drivers/net/plip.c Sat Nov 26 18:36:05 1994 +++ linux/drivers/net/plip.c Mon Nov 28 12:34:11 1994 @@ -31,7 +31,7 @@ #ifdef MODULE "MODULAR " #endif - "PLIP.010+ gniibe@mri.co.jp\n"; + "PLIP.014 gniibe@mri.co.jp\n"; #include @@ -75,8 +75,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -85,7 +85,7 @@ #include #include -#include +#include #include #include #include @@ -101,9 +101,6 @@ #endif static unsigned int net_debug = NET_DEBUG; -/* constants */ -#define PLIP_MTU 1500 - /* In micro second */ #define PLIP_DELAY_UNIT 1 @@ -111,7 +108,7 @@ #define PLIP_TRIGGER_WAIT 500 /* Nibble time out = PLIP_NIBBLE_WAIT * PLIP_DELAY_UNIT usec */ -#define PLIP_NIBBLE_WAIT 3000 +#define PLIP_NIBBLE_WAIT 5000 #define PAR_DATA(dev) (dev->base_addr+0) #define PAR_STATUS(dev) (dev->base_addr+1) @@ -121,45 +118,47 @@ static int plip_tx_packet(struct sk_buff *skb, struct device *dev); static int plip_open(struct device *dev); static int plip_close(struct device *dev); -static int plip_header(unsigned char *buff, struct device *dev, - unsigned short type, void *dest, - void *source, unsigned len, struct sk_buff *skb); static struct enet_statistics *plip_get_stats(struct device *dev); static int plip_rebuild_header(void *buff, struct device *dev, unsigned long raddr, struct sk_buff *skb); +static void plip_kick_bh(struct device *dev); +static void plip_bh(struct device *dev); -enum plip_state { - PLIP_ST_DONE=0, - PLIP_ST_TRANSMIT_BEGIN, - PLIP_ST_TRIGGER, - PLIP_ST_LENGTH_LSB, - PLIP_ST_LENGTH_MSB, - PLIP_ST_DATA, - PLIP_ST_CHECKSUM, - PLIP_ST_ERROR +enum plip_connection_state { + PLIP_CN_NONE=0, + PLIP_CN_RECEIVE, + PLIP_CN_SEND, + PLIP_CN_CLOSING, + PLIP_CN_ERROR +}; + +enum plip_packet_state { + PLIP_PK_DONE=0, + PLIP_PK_TRIGGER, + PLIP_PK_LENGTH_LSB, + PLIP_PK_LENGTH_MSB, + PLIP_PK_DATA, + PLIP_PK_CHECKSUM }; enum plip_nibble_state { - PLIP_NST_BEGIN, - PLIP_NST_1, - PLIP_NST_2, - PLIP_NST_END + PLIP_NB_BEGIN, + PLIP_NB_1, + PLIP_NB_2, }; #define PLIP_STATE_STRING(x) \ - (((x) == PLIP_ST_DONE)?"0":\ - ((x) == PLIP_ST_TRANSMIT_BEGIN)?"b":\ - ((x) == PLIP_ST_TRIGGER)?"t":\ - ((x) == PLIP_ST_LENGTH_LSB)?"l":\ - ((x) == PLIP_ST_LENGTH_MSB)?"m":\ - ((x) == PLIP_ST_DATA)?"d":\ - ((x) == PLIP_ST_CHECKSUM)?"s":"B") + (((x) == PLIP_PK_DONE)?"0":\ + ((x) == PLIP_PK_TRIGGER)?"t":\ + ((x) == PLIP_PK_LENGTH_LSB)?"l":\ + ((x) == PLIP_PK_LENGTH_MSB)?"m":\ + ((x) == PLIP_PK_DATA)?"d":\ + ((x) == PLIP_PK_CHECKSUM)?"s":"B") struct plip_local { - enum plip_state state; + enum plip_packet_state state; enum plip_nibble_state nibble; unsigned short length; - unsigned short count; unsigned short byte; unsigned char checksum; unsigned char data; @@ -168,33 +167,31 @@ struct net_local { struct enet_statistics e; - struct timer_list tl; + struct tq_struct immediate; + struct tq_struct deferred; struct plip_local snd_data; struct plip_local rcv_data; unsigned long trigger_us; unsigned long nibble_us; unsigned long unit_us; + enum plip_connection_state connection; + unsigned short timeout_count; }; /* Routines used internally. */ static void plip_device_clear(struct device *dev); -static void plip_error(struct device *dev); -static int plip_receive(struct device *dev, enum plip_nibble_state *ns_p, - unsigned char *data_p); -static void plip_receive_packet(struct device *dev); static void plip_interrupt(int reg_ptr); -static int plip_send(struct device *dev, enum plip_nibble_state *ns_p, - unsigned char data); -static void plip_send_packet(struct device *dev); + +static int plip_error(struct device *dev); +static int plip_receive_packet(struct device *dev); +static int plip_send_packet(struct device *dev); static int plip_ioctl(struct device *dev, struct ifreq *ifr, int cmd); static int plip_config(struct device *dev, struct ifmap *map); - int plip_init(struct device *dev) { - int i; - struct net_local *pl; + struct net_local *nl; /* Check that there is something at base_addr. */ outb(LP_PINITP, PAR_CONTROL(dev)); @@ -212,11 +209,15 @@ } else { printk("%s: configured for parallel port at %#3x", dev->name, dev->base_addr); +#ifdef MODULE + /* autoirq doesn't work :(, but we can set it by ifconfig */ +#else autoirq_setup(0); outb(LP_PINITP|LP_PSELECP, PAR_CONTROL(dev)); outb(LP_PINITP|LP_PSELECP|LP_PINTEN, PAR_CONTROL(dev)); outb(LP_PINITP|LP_PSELECP, PAR_CONTROL(dev)); dev->irq = autoirq_report(1); +#endif if (dev->irq) printk(", probed IRQ %d.\n", dev->irq); else { @@ -225,71 +226,189 @@ } } - /* Initialize the device structure. */ - dev->rmem_end = (unsigned long) NULL; - dev->rmem_start = (unsigned long) NULL; - dev->mem_end = (unsigned long) NULL; - dev->mem_start = (unsigned long) NULL; + /* Fill in the generic fields of the device structure. */ + ether_setup(dev); - dev->priv = kmalloc(sizeof (struct net_local), GFP_KERNEL); - memset(dev->priv, 0, sizeof(struct net_local)); - pl = (struct net_local *) dev->priv; - - pl->trigger_us = PLIP_TRIGGER_WAIT; - pl->nibble_us = PLIP_NIBBLE_WAIT; - - dev->mtu = PLIP_MTU; + /* And, override parts of it */ + dev->rebuild_header = plip_rebuild_header; dev->hard_start_xmit = plip_tx_packet; dev->open = plip_open; dev->stop = plip_close; - dev->hard_header = plip_header; - dev->type_trans = eth_type_trans; dev->get_stats = plip_get_stats; dev->set_config = plip_config; dev->do_ioctl = plip_ioctl; + dev->flags = IFF_POINTOPOINT; + + /* Set private structure */ + dev->priv = kmalloc(sizeof (struct net_local), GFP_KERNEL); + memset(dev->priv, 0, sizeof(struct net_local)); + nl = (struct net_local *) dev->priv; + /* initialize constants */ + nl->trigger_us = PLIP_TRIGGER_WAIT; + nl->nibble_us = PLIP_NIBBLE_WAIT; + nl->unit_us = PLIP_DELAY_UNIT; + + /* initialize task queue structures */ + nl->immediate.next = &tq_last; + nl->immediate.sync = 0; + nl->immediate.routine = (void *)(void *)plip_bh; + nl->immediate.data = dev; + + nl->deferred.next = &tq_last; + nl->deferred.sync = 0; + nl->deferred.routine = (void *)(void *)plip_kick_bh; + nl->deferred.data = dev; - dev->hard_header_len = ETH_HLEN; - dev->addr_len = ETH_ALEN; - dev->type = ARPHRD_ETHER; - dev->rebuild_header = plip_rebuild_header; + return 0; +} + +static void +plip_kick_bh(struct device *dev) +{ + struct net_local *nl = (struct net_local *)dev->priv; - for (i = 0; i < DEV_NUMBUFFS; i++) - skb_queue_head_init(&dev->buffs[i]); + if (nl->connection == PLIP_CN_NONE) + return; + queue_task(&nl->immediate, &tq_immediate); + mark_bh(IMMEDIATE_BH); + return; +} - for (i = 0; i < dev->addr_len; i++) { - dev->broadcast[i]=0xff; - dev->dev_addr[i] = 0; - } - - /* New-style flags. */ - dev->flags = 0; - dev->family = AF_INET; - dev->pa_addr = 0; - dev->pa_brdaddr = 0; - dev->pa_dstaddr = 0; - dev->pa_mask = 0; - dev->pa_alen = sizeof(unsigned long); +static void +plip_bh(struct device *dev) +{ + struct net_local *nl = (struct net_local *)dev->priv; + struct enet_statistics *stats = (struct enet_statistics *) dev->priv; + struct plip_local *rcv = &nl->rcv_data; + struct plip_local *snd = &nl->snd_data; + int result, timeout=0; + unsigned char *s; + unsigned char c0; + struct sk_buff *skb; - return 0; + while (!timeout) { + cli(); + switch (nl->connection) { + case PLIP_CN_NONE: + sti(); + return; + + case PLIP_CN_RECEIVE: + sti(); + disable_irq(dev->irq); + dev->interrupt = 0; + result = plip_receive_packet(dev); + if (result == 0) { /* success */ + outb (0x00, PAR_DATA(dev)); + skb = rcv->skb; + rcv->skb = NULL; + stats->rx_packets++; + netif_rx(skb); + if (snd->state != PLIP_PK_DONE) { + nl->connection = PLIP_CN_SEND; + enable_irq(dev->irq); + } else { + nl->connection = PLIP_CN_NONE; + enable_irq(dev->irq); + return; + } + } else if (result == -1) { /* failure */ + outb(0x00, PAR_DATA(dev)); + if (rcv->skb) + dev_kfree_skb(rcv->skb, FREE_WRITE); + rcv->state = PLIP_PK_DONE; + rcv->skb = NULL; + if (snd->skb) + dev_kfree_skb(snd->skb, FREE_WRITE); + snd->state = PLIP_PK_DONE; + snd->skb = NULL; + dev->tbusy = 1; + nl->connection = PLIP_CN_ERROR; + } else + timeout = 1; + break; + + case PLIP_CN_SEND: + sti(); + result = plip_send_packet(dev); + if (result == -1) /* interrupted */ + break; + if (result == 0) { /* success */ + outb (0x00, PAR_DATA(dev)); + snd->state = PLIP_PK_DONE; + snd->skb = NULL; + nl->connection = PLIP_CN_CLOSING; + queue_task(&nl->deferred, &tq_timer); + enable_irq(dev->irq); + return; + } else + timeout = 1; + break; + + case PLIP_CN_CLOSING: + sti(); + nl->connection = PLIP_CN_NONE; + mark_bh(NET_BH); + dev->tbusy = 0; + return; + + case PLIP_CN_ERROR: + sti(); + result = plip_error(dev); + if (result == 0) { + nl->connection = PLIP_CN_NONE; + dev->tbusy = 0; + enable_irq(dev->irq); + return; + } else { + queue_task(&nl->deferred, &tq_timer); + return; + } + break; + } + } + + /* timeout */ + if (++nl->timeout_count > 3) { /* cable problem? */ + c0 = inb(PAR_STATUS(dev)); + + if (nl->connection == PLIP_CN_SEND) { + stats->tx_errors++; + stats->tx_aborted_errors++; + s = PLIP_STATE_STRING(snd->state); + if (net_debug > 1) + printk("%s: transmit timeout(%s,%02x)... reset interface.\n", + dev->name, s, (unsigned int)c0); + if (snd->skb) + dev_kfree_skb(snd->skb, FREE_WRITE); + } else if (nl->connection == PLIP_CN_RECEIVE) { + stats->rx_dropped++; + s = PLIP_STATE_STRING(rcv->state); + if (net_debug > 1) + printk("%s: receive timeout(%s,%02x)... reset interface.\n", + dev->name, s, (unsigned int)c0); + if (rcv->skb) + dev_kfree_skb(rcv->skb, FREE_WRITE); + } + disable_irq(dev->irq); + dev->tbusy = 1; + nl->connection = PLIP_CN_ERROR; + outb(0x00, PAR_DATA(dev)); + } + + queue_task(&nl->deferred, &tq_timer); + return; } static int -plip_tx_packet (struct sk_buff *skb, struct device *dev) +plip_tx_packet(struct sk_buff *skb, struct device *dev) { - struct net_local *lp = (struct net_local *)dev->priv; - struct plip_local *snd = &lp->snd_data; - - if (dev->tbusy) { - /* it is sending a packet now */ - int tickssofar = jiffies - dev->trans_start; - if (tickssofar < 100) /* please try later, again */ - return 1; + struct net_local *nl = (struct net_local *)dev->priv; + struct plip_local *snd = &nl->snd_data; - /* something wrong... force to reset */ - printk("%s: transmit timed out, cable problem??\n", dev->name); - plip_device_clear(dev); - } + if (dev->tbusy) + return 1; /* If some higher layer thinks we've missed an tx-done interrupt we are passed NULL. Caution: dev_tint() handles the cli()/sti() @@ -299,67 +418,46 @@ return 0; } - cli(); - if (set_bit(0, (void *)&dev->tbusy) != 0) { - sti(); + if (set_bit(0, (void*)&dev->tbusy) != 0) { printk("%s: Transmitter access conflict.\n", dev->name); return 1; } - if (dev->interrupt) { - sti(); - return 1; - } - snd->state = PLIP_ST_TRANSMIT_BEGIN; - sti(); - - dev->trans_start = jiffies; - if (net_debug > 4) - printk("Ss"); if (skb->len > dev->mtu) { printk("%s: packet too big, %d.\n", dev->name, (int)skb->len); + dev->tbusy = 0; return 0; } + snd->state = PLIP_PK_TRIGGER; + dev->trans_start = jiffies; + snd->skb = skb; snd->length = skb->len; - snd->count = 0; cli(); - if (dev->interrupt == 0) { - /* set timer */ - lp->tl.expires = 0; - lp->tl.data = (unsigned long)dev; - lp->tl.function = (void (*)(unsigned long))plip_send_packet; - add_timer(&lp->tl); - mark_bh(TIMER_BH); + if (nl->connection == PLIP_CN_NONE) { + nl->connection = PLIP_CN_SEND; + nl->timeout_count = 0; } - snd->state = PLIP_ST_TRIGGER; sti(); + queue_task(&nl->immediate, &tq_immediate); + mark_bh(IMMEDIATE_BH); return 0; } /* Open/initialize the board. This is called (in the current kernel) - sometime after booting when the 'ifconfig' program is - run. + sometime after booting when the 'ifconfig' program is run. This routine gets exclusive access to the parallel port by allocating its IRQ line. - */ + */ static int plip_open(struct device *dev) { - struct net_local *lp = (struct net_local *)dev->priv; - struct plip_local *rcv = &lp->rcv_data; + int i; - rcv->skb = alloc_skb(dev->mtu, GFP_KERNEL); - if (rcv->skb == NULL) { - printk("%s: couldn't get memory for receiving packet.\n", dev->name); - return -EAGAIN; - } - rcv->skb->len = dev->mtu; - rcv->skb->dev = dev; cli(); if (request_irq(dev->irq , plip_interrupt, 0, "plip") != 0) { sti(); @@ -371,6 +469,12 @@ /* enable rx interrupt. */ outb(LP_PINITP|LP_PSELECP|LP_PINTEN, PAR_CONTROL(dev)); plip_device_clear(dev); + + /* Fill in the MAC-level header. */ + for (i=0; i < ETH_ALEN - sizeof(unsigned long); i++) + dev->dev_addr[i] = 0xfc; + memcpy(&(dev->dev_addr[i]), &dev->pa_addr, sizeof(unsigned long)); + dev->start = 1; #ifdef MODULE MOD_INC_USE_COUNT; @@ -382,8 +486,6 @@ static int plip_close(struct device *dev) { - struct net_local *lp = (struct net_local *)dev->priv; - dev->tbusy = 1; dev->start = 0; cli(); @@ -391,8 +493,6 @@ irq2dev_map[dev->irq] = NULL; sti(); outb(0x00, PAR_DATA(dev)); - /* make sure that we don't register the timer */ - del_timer(&lp->tl); /* release the interrupt. */ outb(LP_PINITP|LP_PSELECP, PAR_CONTROL(dev)); #ifdef MODULE @@ -401,23 +501,6 @@ return 0; } -/* Fill in the MAC-level header. */ -static int -plip_header(unsigned char *buff, struct device *dev, - unsigned short type, void *daddr, - void *saddr, unsigned len, struct sk_buff *skb) -{ - int i; - - if (dev->dev_addr[0] == 0) { - for (i=0; i < ETH_ALEN - sizeof(unsigned long); i++) - dev->dev_addr[i] = 0xfc; - memcpy(&(dev->dev_addr[i]), &dev->pa_addr, sizeof(unsigned long)); - } - - return eth_header(buff, dev, type, daddr, saddr, len, skb); -} - static struct enet_statistics * plip_get_stats(struct device *dev) { @@ -434,7 +517,7 @@ int i; if (eth->h_proto != htons(ETH_P_IP)) { - printk("plip_rebuild_header: Don't know how to resolve type %d addresses?\n",(int)eth->h_proto); + printk("plip_rebuild_header: Don't know how to resolve type %d addresses?\n", (int)eth->h_proto); memcpy(eth->h_source, dev->dev_addr, dev->addr_len); return 0; } @@ -448,245 +531,150 @@ static void plip_device_clear(struct device *dev) { - struct net_local *lp = (struct net_local *)dev->priv; + struct net_local *nl = (struct net_local *)dev->priv; outb (0x00, PAR_DATA(dev)); - lp->snd_data.state = PLIP_ST_DONE; - lp->rcv_data.state = PLIP_ST_DONE; + nl->rcv_data.state = PLIP_PK_DONE; + nl->snd_data.state = PLIP_PK_DONE; + nl->rcv_data.skb = NULL; + nl->snd_data.skb = NULL; + nl->connection = PLIP_CN_NONE; cli(); dev->tbusy = 0; - dev->interrupt = 0; - /* make sure that we don't register the timer */ - del_timer(&lp->tl); sti(); enable_irq(dev->irq); } -static void +/* PLIP_ERROR --- wait til other end setteled */ +static int plip_error(struct device *dev) { - struct net_local *lp = (struct net_local *)dev->priv; - struct plip_local *snd = &((struct net_local *)dev->priv)->snd_data; - struct plip_local *rcv = &lp->rcv_data; unsigned char status; - outb(0x00, PAR_DATA(dev)); - cli(); - del_timer(&lp->tl); - snd->state = PLIP_ST_ERROR; - sti(); - if (rcv->skb == NULL) { - rcv->skb = alloc_skb(dev->mtu, GFP_ATOMIC); - if (rcv->skb == NULL) { - printk("%s: couldn't get memory.\n", dev->name); - goto again; - } - rcv->skb->len = dev->mtu; - rcv->skb->dev = dev; - } - status = inb(PAR_STATUS(dev)); - if ((status & 0xf8) == 0x80) { - plip_device_clear(dev); - mark_bh(NET_BH); - } else { - again: - lp->tl.expires = 1; - lp->tl.data = (unsigned long)dev; - lp->tl.function = (void (*)(unsigned long))plip_error; - add_timer(&lp->tl); - } + if ((status & 0xf8) == 0x80) + return 0; + return 1; } /* PLIP_RECEIVE --- receive a byte(two nibbles) - Return 0 on success, return 1 on failure */ -static int -plip_receive(struct device *dev, enum plip_nibble_state *ns_p, - unsigned char *data_p) + Returns 0 on success, 1 on failure */ +inline static int +plip_receive(unsigned short nibble_timeout, unsigned short unit_us, + unsigned short status_addr, unsigned short data_addr, + enum plip_nibble_state *ns_p, unsigned char *data_p) { unsigned char c0, c1; unsigned int cx; - struct net_local *nl=(struct net_local *)dev->priv; - while (1) - switch (*ns_p) { - case PLIP_NST_BEGIN: - cx = nl->nibble_us; - while (1) { - c0 = inb(PAR_STATUS(dev)); - udelay(PLIP_DELAY_UNIT); - if ((c0 & 0x80) == 0) { - c1 = inb(PAR_STATUS(dev)); - if (c0 == c1) - break; - } - if (--cx == 0) - return 1; + switch (*ns_p) { + case PLIP_NB_BEGIN: + cx = nibble_timeout; + while (1) { + c0 = inb(status_addr); + udelay(unit_us); + if ((c0 & 0x80) == 0) { + c1 = inb(status_addr); + if (c0 == c1) + break; } - *data_p = (c0 >> 3) & 0x0f; - outb(0x10, PAR_DATA(dev)); /* send ACK */ - *ns_p = PLIP_NST_1; - break; - - case PLIP_NST_1: - cx = nl->nibble_us; - while (1) { - c0 = inb(PAR_STATUS(dev)); - udelay(PLIP_DELAY_UNIT); - if (c0 & 0x80) { - c1 = inb(PAR_STATUS(dev)); - if (c0 == c1) - break; - } - if (--cx == 0) - return 1; + if (--cx == 0) + return 1; + } + *data_p = (c0 >> 3) & 0x0f; + outb(0x10, data_addr); /* send ACK */ + *ns_p = PLIP_NB_1; + + case PLIP_NB_1: + cx = nibble_timeout; + while (1) { + c0 = inb(status_addr); + udelay(unit_us); + if (c0 & 0x80) { + c1 = inb(status_addr); + if (c0 == c1) + break; } - *data_p |= (c0 << 1) & 0xf0; - outb(0x00, PAR_DATA(dev)); /* send ACK */ - *ns_p = PLIP_NST_2; - return 0; - break; - - default: - printk("plip:receive state error\n"); - *ns_p = PLIP_NST_2; - return 1; - break; + if (--cx == 0) + return 1; } + *data_p |= (c0 << 1) & 0xf0; + outb(0x00, data_addr); /* send ACK */ + *ns_p = PLIP_NB_BEGIN; + return 0; + + case PLIP_NB_2: + } } -static void +/* PLIP_RECEIVE_PACKET --- receive a packet + Returns 0 on success, 1 when timeout, -1 on failure */ +static int plip_receive_packet(struct device *dev) { - struct net_local *lp = (struct net_local *)dev->priv; + unsigned short data_addr = PAR_DATA(dev), status_addr = PAR_STATUS(dev); + struct net_local *nl = (struct net_local *)dev->priv; + unsigned short nibble_timeout = nl->nibble_us, unit_us = nl->unit_us; + struct plip_local *rcv = &nl->rcv_data; + unsigned char *lbuf; struct enet_statistics *stats = (struct enet_statistics *) dev->priv; - struct plip_local *snd = &lp->snd_data; - struct plip_local *rcv = &lp->rcv_data; - unsigned char *lbuf = rcv->skb->data; - unsigned char c0; - unsigned char *s = PLIP_STATE_STRING(rcv->state); - if (net_debug > 4) - printk("R%s",s); - - while (1) { - switch (rcv->state) { - case PLIP_ST_TRIGGER: - disable_irq(dev->irq); - rcv->state = PLIP_ST_LENGTH_LSB; - rcv->nibble = PLIP_NST_BEGIN; - break; - - case PLIP_ST_LENGTH_LSB: - if (plip_receive(dev, &rcv->nibble, (unsigned char *)&rcv->length)) - goto try_again; - - rcv->state = PLIP_ST_LENGTH_MSB; - rcv->nibble = PLIP_NST_BEGIN; - break; - - case PLIP_ST_LENGTH_MSB: - if (plip_receive(dev, &rcv->nibble, - (unsigned char *)&rcv->length+1)) - goto try_again; - - if (rcv->length > rcv->skb->len || rcv->length < 8) { - printk("%s: bogus packet size %d.\n", dev->name, rcv->length); - plip_error(dev); - return; - } - rcv->skb->len = rcv->length; - rcv->state = PLIP_ST_DATA; - rcv->nibble = PLIP_NST_BEGIN; - rcv->byte = 0; - rcv->checksum = 0; - break; - - case PLIP_ST_DATA: - if (plip_receive(dev, &rcv->nibble, &lbuf[rcv->byte])) - goto try_again; + switch (rcv->state) { + case PLIP_PK_TRIGGER: + rcv->state = PLIP_PK_LENGTH_LSB; + rcv->nibble = PLIP_NB_BEGIN; + + case PLIP_PK_LENGTH_LSB: + if (plip_receive(nibble_timeout, unit_us, status_addr, data_addr, + &rcv->nibble, (unsigned char *)&rcv->length)) + return 1; + rcv->state = PLIP_PK_LENGTH_MSB; + case PLIP_PK_LENGTH_MSB: + if (plip_receive(nibble_timeout, unit_us, status_addr, data_addr, + &rcv->nibble, (unsigned char *)&rcv->length+1)) + return 1; + if (rcv->length > dev->mtu || rcv->length < 8) { + printk("%s: bogus packet size %d.\n", dev->name, rcv->length); + return -1; + } + /* Malloc up new buffer. */ + rcv->skb = alloc_skb(rcv->length, GFP_ATOMIC); + if (rcv->skb == NULL) { + printk("%s: Memory squeeze.\n", dev->name); + return -1; + } + rcv->skb->len = rcv->length; + rcv->skb->dev = dev; + rcv->state = PLIP_PK_DATA; + rcv->byte = 0; + rcv->checksum = 0; + + case PLIP_PK_DATA: + lbuf = rcv->skb->data; + do { + if (plip_receive(nibble_timeout, unit_us, status_addr, data_addr, + &rcv->nibble, &lbuf[rcv->byte])) + return 1; rcv->checksum += lbuf[rcv->byte]; - rcv->byte++; - rcv->nibble = PLIP_NST_BEGIN; - if (rcv->byte == rcv->length) - rcv->state = PLIP_ST_CHECKSUM; - break; - - case PLIP_ST_CHECKSUM: - if (plip_receive(dev, &rcv->nibble, &rcv->data)) - goto try_again; - if (rcv->data != rcv->checksum) { - stats->rx_crc_errors++; - if (net_debug) - printk("%s: checksum error\n", dev->name); - plip_error(dev); - return; - } - - rcv->state = PLIP_ST_DONE; - netif_rx(rcv->skb); + } while (++rcv->byte < rcv->length); + rcv->state = PLIP_PK_CHECKSUM; - /* Malloc up new buffer. */ - rcv->skb = alloc_skb(dev->mtu, GFP_ATOMIC); - if (rcv->skb == NULL) { - printk("%s: Memory squeeze.\n", dev->name); - plip_error(dev); - return; - } - rcv->skb->len = dev->mtu; - rcv->skb->dev = dev; - stats->rx_packets++; - if (net_debug > 4) - printk("R(%4.4d)", rcv->length); - - if (snd->state == PLIP_ST_TRANSMIT_BEGIN) { - dev->interrupt = 0; - enable_irq(dev->irq); - } else if (snd->state == PLIP_ST_TRIGGER) { - cli(); - dev->interrupt = 0; - if (net_debug > 3) - printk("%%"); - lp->tl.expires = 0; - lp->tl.data = (unsigned long)dev; - lp->tl.function - = (void (*)(unsigned long))plip_send_packet; - add_timer(&lp->tl); - mark_bh(TIMER_BH); - enable_irq(dev->irq); - sti(); - } else - plip_device_clear(dev); - return; - - default: - printk("plip: bad STATE?? %04d", rcv->state); - plip_device_clear(dev); - return; + case PLIP_PK_CHECKSUM: + if (plip_receive(nibble_timeout, unit_us, status_addr, data_addr, + &rcv->nibble, &rcv->data)) + return 1; + if (rcv->data != rcv->checksum) { + stats->rx_crc_errors++; + if (net_debug) + printk("%s: checksum error\n", dev->name); + return -1; } - } - - try_again: - if (++rcv->count > 2) { /* timeout */ - s = PLIP_STATE_STRING(rcv->state); - c0 = inb(PAR_STATUS(dev)); - stats->rx_dropped++; - if (net_debug > 1) - printk("%s: receive timeout(%s,%02x)... reset interface.\n", - dev->name, s, (unsigned int)c0); - plip_error(dev); - } else { - s = PLIP_STATE_STRING(rcv->state); - if (net_debug > 3) - printk("r%s",s); + rcv->state = PLIP_PK_DONE; - /* set timer */ - lp->tl.expires = 1; - lp->tl.data = (unsigned long)dev; - lp->tl.function = (void (*)(unsigned long))plip_receive_packet; - add_timer(&lp->tl); + case PLIP_PK_DONE: } + return 0; } /* Handle the parallel port interrupts. */ @@ -695,9 +683,8 @@ { int irq = -(((struct pt_regs *)reg_ptr)->orig_eax+2); struct device *dev = (struct device *) irq2dev_map[irq]; - struct net_local *lp = (struct net_local *)dev->priv; - struct plip_local *rcv = &lp->rcv_data; - struct plip_local *snd = &lp->snd_data; + struct net_local *nl = (struct net_local *)dev->priv; + struct plip_local *rcv = &nl->rcv_data; unsigned char c0; if (dev == NULL) { @@ -706,227 +693,175 @@ return; } - if (dev->interrupt) { - if (net_debug > 3) - printk("2"); - return; - } - - if (dev->tbusy) { - if (snd->state > PLIP_ST_TRIGGER) { - printk("%s: rx interrupt in transmission\n", dev->name); - return; - } - if (net_debug > 3) - printk("3"); - } - - if (snd->state == PLIP_ST_ERROR) + if (dev->interrupt) return; c0 = inb(PAR_STATUS(dev)); if ((c0 & 0xf8) != 0xc0) { if (net_debug > 3) - printk("?"); + printk("plip: spurious interrupt\n"); return; } - + outb(0x01, PAR_DATA(dev)); /* send ACK */ dev->interrupt = 1; - if (net_debug > 3) - printk("!"); + printk("%s: interrupt.\n", dev->name); - dev->last_rx = jiffies; - outb(0x01, PAR_DATA(dev)); /* send ACK */ - rcv->state = PLIP_ST_TRIGGER; - rcv->count = 0; + cli(); + switch (nl->connection) { + case PLIP_CN_CLOSING: + dev->tbusy = 0; + case PLIP_CN_NONE: + case PLIP_CN_SEND: + sti(); + dev->last_rx = jiffies; + rcv->state = PLIP_PK_TRIGGER; + nl->connection = PLIP_CN_RECEIVE; + nl->timeout_count = 0; + queue_task(&nl->immediate, &tq_immediate); + mark_bh(IMMEDIATE_BH); + break; + + case PLIP_CN_RECEIVE: + sti(); + printk("%s: receive interrupt when receiving packet\n", dev->name); + break; - /* set timer */ - del_timer(&lp->tl); - lp->tl.expires = 0; - lp->tl.data = (unsigned long)dev; - lp->tl.function = (void (*)(unsigned long))plip_receive_packet; - add_timer(&lp->tl); - mark_bh (TIMER_BH); + case PLIP_CN_ERROR: + sti(); + printk("%s: receive interrupt in error state\n", dev->name); + break; + } } /* PLIP_SEND --- send a byte (two nibbles) - Return 0 on success, return 1 on failure */ -static int -plip_send(struct device *dev, enum plip_nibble_state *ns_p, unsigned char data) + Returns 0 on success, 1 on failure */ +inline static int +plip_send(unsigned short nibble_timeout, unsigned short unit_us, + unsigned short status_addr, unsigned short data_addr, + enum plip_nibble_state *ns_p, unsigned char data) { unsigned char c0; unsigned int cx; - struct net_local *nl= (struct net_local *)dev->priv; - - while (1) - switch (*ns_p) { - case PLIP_NST_BEGIN: - outb((data & 0x0f), PAR_DATA(dev)); - *ns_p = PLIP_NST_1; - break; - - case PLIP_NST_1: - outb(0x10 | (data & 0x0f), PAR_DATA(dev)); - cx = nl->nibble_us; - while (1) { - c0 = inb(PAR_STATUS(dev)); - if ((c0 & 0x80) == 0) - break; - if (--cx == 0) /* time out */ - return 1; - udelay(PLIP_DELAY_UNIT); - } - outb(0x10 | (data >> 4), PAR_DATA(dev)); - *ns_p = PLIP_NST_2; - break; - - case PLIP_NST_2: - outb((data >> 4), PAR_DATA(dev)); - cx = nl->nibble_us; - while (1) { - c0 = inb(PAR_STATUS(dev)); - if (c0 & 0x80) - break; - if (--cx == 0) /* time out */ - return 1; - udelay(PLIP_DELAY_UNIT); - } - return 0; - default: - printk("plip:send state error\n"); - return 1; + switch (*ns_p) { + case PLIP_NB_BEGIN: + outb((data & 0x0f), data_addr); + *ns_p = PLIP_NB_1; + + case PLIP_NB_1: + outb(0x10 | (data & 0x0f), data_addr); + cx = nibble_timeout; + while (1) { + c0 = inb(status_addr); + if ((c0 & 0x80) == 0) + break; + if (--cx == 0) /* time out */ + return 1; + udelay(unit_us); + } + outb(0x10 | (data >> 4), data_addr); + *ns_p = PLIP_NB_2; + + case PLIP_NB_2: + outb((data >> 4), data_addr); + cx = nibble_timeout; + while (1) { + c0 = inb(status_addr); + if (c0 & 0x80) + break; + if (--cx == 0) /* time out */ + return 1; + udelay(unit_us); } + *ns_p = PLIP_NB_BEGIN; + return 0; + } } -static void +/* PLIP_SEND_PACKET --- send a packet + Returns 0 on success, 1 when timeout, -1 when interrupted */ +static int plip_send_packet(struct device *dev) { - struct enet_statistics *stats = (struct enet_statistics *) dev->priv; - struct net_local *lp = (struct net_local *)dev->priv; - struct plip_local *snd = &lp->snd_data; + unsigned short data_addr = PAR_DATA(dev), status_addr = PAR_STATUS(dev); + struct net_local *nl = (struct net_local *)dev->priv; + unsigned short nibble_timeout = nl->nibble_us, unit_us = nl->unit_us; + struct plip_local *snd = &nl->snd_data; unsigned char *lbuf = snd->skb->data; unsigned char c0; unsigned int cx; - unsigned char *s = PLIP_STATE_STRING(snd->state); - - if (net_debug > 4) - printk("S%s",s); + struct enet_statistics *stats = (struct enet_statistics *) dev->priv; - while (1) { - switch (snd->state) { - case PLIP_ST_TRIGGER: - /* Trigger remote rx interrupt. */ - outb(0x08, PAR_DATA(dev)); - cx = lp->trigger_us; - while (1) { - if (dev->interrupt) { - stats->collisions++; - if (net_debug > 3) - printk("$"); - mark_bh(TIMER_BH); - return; - } - cli(); - c0 = inb(PAR_STATUS(dev)); - if (c0 & 0x08) { - disable_irq(dev->irq); - if (net_debug > 3) - printk("+"); - /* OK, connection established! */ - snd->state = PLIP_ST_LENGTH_LSB; - snd->nibble = PLIP_NST_BEGIN; - snd->count = 0; - sti(); - break; - } + switch (snd->state) { + case PLIP_PK_TRIGGER: + /* Trigger remote rx interrupt. */ + outb(0x08, PAR_DATA(dev)); + cx = nl->trigger_us; + while (1) { + if (nl->connection == PLIP_CN_RECEIVE) { /* interrupted */ + stats->collisions++; + if (net_debug > 3) + printk("%s: collision.\n", dev->name); + return -1; + } + cli(); + c0 = inb(PAR_STATUS(dev)); + if (c0 & 0x08) { + disable_irq(dev->irq); + if (net_debug > 3) + printk("+"); + /* OK, connection established! */ + snd->state = PLIP_PK_LENGTH_LSB; + snd->nibble = PLIP_NB_BEGIN; + nl->timeout_count = 0; sti(); - udelay(PLIP_DELAY_UNIT); - if (--cx == 0) { - outb(0x00, PAR_DATA(dev)); - goto try_again; - } + break; } - break; - - case PLIP_ST_LENGTH_LSB: - if (plip_send(dev, &snd->nibble, snd->length & 0xff)) /* timeout */ - goto try_again; - - snd->state = PLIP_ST_LENGTH_MSB; - snd->nibble = PLIP_NST_BEGIN; - break; - - case PLIP_ST_LENGTH_MSB: - if (plip_send(dev, &snd->nibble, snd->length >> 8)) /* timeout */ - goto try_again; - - snd->state = PLIP_ST_DATA; - snd->nibble = PLIP_NST_BEGIN; - snd->byte = 0; - snd->checksum = 0; - break; + sti(); + udelay(nl->unit_us); + if (--cx == 0) { + outb(0x00, PAR_DATA(dev)); + return 1; + } + } - case PLIP_ST_DATA: - if (plip_send(dev, &snd->nibble, lbuf[snd->byte])) /* timeout */ - goto try_again; + case PLIP_PK_LENGTH_LSB: + if (plip_send(nibble_timeout, unit_us, status_addr, data_addr, + &snd->nibble, snd->length & 0xff)) /* timeout */ + return 1; + snd->state = PLIP_PK_LENGTH_MSB; - snd->nibble = PLIP_NST_BEGIN; + case PLIP_PK_LENGTH_MSB: + if (plip_send(nibble_timeout, unit_us, status_addr, data_addr, + &snd->nibble, snd->length >> 8)) /* timeout */ + return 1; + snd->state = PLIP_PK_DATA; + snd->byte = 0; + snd->checksum = 0; + + case PLIP_PK_DATA: + do { + if (plip_send(nibble_timeout, unit_us, status_addr, data_addr, + &snd->nibble, lbuf[snd->byte])) /* timeout */ + return 1; snd->checksum += lbuf[snd->byte]; - snd->byte++; - if (snd->byte == snd->length) - snd->state = PLIP_ST_CHECKSUM; - break; - - case PLIP_ST_CHECKSUM: - if (plip_send(dev, &snd->nibble, snd->checksum)) /* timeout */ - goto try_again; - - mark_bh(NET_BH); - plip_device_clear(dev); - if (net_debug > 4) - printk("S(%4.4d)", snd->length); - dev_kfree_skb(snd->skb, FREE_WRITE); - stats->tx_packets++; - return; + } while (++snd->byte < snd->length); + snd->state = PLIP_PK_CHECKSUM; - default: - printk("plip: BAD STATE?? %04d", snd->state); - plip_device_clear(dev); - return; - } - } + case PLIP_PK_CHECKSUM: + if (plip_send(nibble_timeout, unit_us, status_addr, data_addr, + &snd->nibble, snd->checksum)) /* timeout */ + return 1; - try_again: - if (++snd->count > 3) { - /* timeout */ - s = PLIP_STATE_STRING(snd->state); - c0 = inb(PAR_STATUS(dev)); - stats->tx_errors++; - stats->tx_aborted_errors++; - if (net_debug > 1) - printk("%s: transmit timeout(%s,%02x)... reset interface.\n", - dev->name, s, (unsigned int)c0); - dev_kfree_skb(snd->skb,FREE_WRITE); - plip_error(dev); - } else { - s = PLIP_STATE_STRING(snd->state); - if (net_debug > 3) - printk("s%s",s); + dev_kfree_skb(snd->skb, FREE_WRITE); + stats->tx_packets++; - cli(); - if (dev->interrupt == 0) { - /* set timer */ - lp->tl.expires = 1; - lp->tl.data = (unsigned long)dev; - lp->tl.function = (void (*)(unsigned long))plip_send_packet; - add_timer(&lp->tl); - } - sti(); + case PLIP_PK_DONE: } + return 0; } - + static int plip_config(struct device *dev, struct ifmap *map) { if(dev->flags&IFF_UP) @@ -996,52 +931,47 @@ int init_module(void) { - int err; + int devices=0; - if ( ((err=register_netdev(&dev_plip0)) == 0) && - ((err=register_netdev(&dev_plip1)) == 0) && - ((err=register_netdev(&dev_plip2)) == 0) - ) - { - if(err==-EEXIST) - printk("plip devices already present. Module not loaded.\n"); - return err; - } - return 0; + if (register_netdev(&dev_plip0) != 0) + devices++; + if (register_netdev(&dev_plip1) != 0) + devices++; + if (register_netdev(&dev_plip2) != 0) + devices++; + if (devices == 0) + return -EIO; + return 0; } void cleanup_module(void) { - if (MOD_IN_USE) - printk("plip: device busy, remove delayed\n"); - else - { - unregister_netdev(&dev_plip0); - if(dev_plip0.priv) - { - kfree_s(dev_plip0.priv,sizeof(struct net_local)); - dev_plip0.priv=NULL; - } - unregister_netdev(&dev_plip1); - if(dev_plip1.priv) - { - kfree_s(dev_plip1.priv,sizeof(struct net_local)); - dev_plip0.priv=NULL; - } - unregister_netdev(&dev_plip2); - if(dev_plip2.priv) - { - kfree_s(dev_plip2.priv,sizeof(struct net_local)); - dev_plip2.priv=NULL; - } + if (MOD_IN_USE) + printk("plip: device busy, remove delayed\n"); + else { + if (dev_plip0.priv) { + unregister_netdev(&dev_plip0); + kfree_s(dev_plip0.priv, sizeof(struct net_local)); + dev_plip0.priv = NULL; + } + if (dev_plip1.priv) { + unregister_netdev(&dev_plip1); + kfree_s(dev_plip1.priv, sizeof(struct net_local)); + dev_plip1.priv = NULL; + } + if (dev_plip2.priv) { + unregister_netdev(&dev_plip2); + kfree_s(dev_plip2.priv, sizeof(struct net_local)); + dev_plip2.priv = NULL; } + } } #endif /* MODULE */ /* * Local variables: - * compile-command: "gcc -D__KERNEL__ -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -c plip.c" + * compile-command: "gcc -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe -m486 -I../../net/inet -c plip.c" * c-indent-level: 4 * c-continued-statement-offset: 4 * c-brace-offset: -4 diff -u --recursive --new-file v1.1.66/linux/drivers/net/sk_g16.c linux/drivers/net/sk_g16.c --- v1.1.66/linux/drivers/net/sk_g16.c Sat Nov 26 18:36:05 1994 +++ linux/drivers/net/sk_g16.c Sun Nov 27 20:19:53 1994 @@ -69,7 +69,7 @@ #include #include #include -#include +#include #include #include diff -u --recursive --new-file v1.1.66/linux/drivers/net/skeleton.c linux/drivers/net/skeleton.c --- v1.1.66/linux/drivers/net/skeleton.c Tue Nov 22 15:41:11 1994 +++ linux/drivers/net/skeleton.c Sun Nov 27 20:19:53 1994 @@ -57,7 +57,7 @@ #include #include #include -#include +#include #include #include diff -u --recursive --new-file v1.1.66/linux/drivers/scsi/README.qlogic linux/drivers/scsi/README.qlogic --- v1.1.66/linux/drivers/scsi/README.qlogic Sat Nov 26 18:36:06 1994 +++ linux/drivers/scsi/README.qlogic Sat Nov 26 18:22:36 1994 @@ -14,7 +14,7 @@ QL40ENBL.SYS. These are a minimum, but loading the rest of the modules won't interfere with the operation. The next thing to do is load the kernel without resetting the hardware, which can be a simple ctrl-alt-delete with -a boot floppy, or by using loadlin with the kernel image accessable from +a boot floppy, or by using loadlin with the kernel image accessible from DOS. If you are using the Linux PCMCIA driver, you will have to adjust it or otherwise stop it from configuring the card. @@ -37,7 +37,7 @@ SOME TROUBLESHOOTING TIPS -Make sure it works properly under DOS. You should also do an inital FDISK +Make sure it works properly under DOS. You should also do an initial FDISK on a new drive if you want partitions. Don't enable all the speedups first. If anything is wrong, they will make diff -u --recursive --new-file v1.1.66/linux/drivers/scsi/in2000.c linux/drivers/scsi/in2000.c --- v1.1.66/linux/drivers/scsi/in2000.c Sat Nov 26 18:36:06 1994 +++ linux/drivers/scsi/in2000.c Sat Nov 26 18:22:28 1994 @@ -1,7 +1,7 @@ /* * This file is in2000.c, written and * Copyright (C) 1993 Brad McLean - * Last edit 07/19/94 WDE + * Last edit 08/25/94 WDE * Disclaimer: * Note: This is ugly. I know it, I wrote it, but my whole * focus was on getting the damn thing up and out quickly. @@ -44,6 +44,9 @@ */ /* Changes for 1.1.28 kernel made 7/19/94, code not affected. (WDE) */ +/* Changes for 1.1.43+ kernels made 8/25/94, code added to check for + * new BIOS version, derived by jshiffle@netcom.com. (WDE) + */ #include #include @@ -124,13 +127,14 @@ tmp = inb(INFLED); /* First, see if the DIP switch values are valid */ /* The test of B7 may fail on some early boards, mine works. */ - if (((~tmp & 0x3) != index ) || (tmp & 0x80) || !(tmp & 0x4) ) + if ( ((~tmp & 0x3) != index ) || (tmp & 0x80) || !(tmp & 0x4) ) return 0; printk("IN-2000 probe got dip setting of %02X\n", tmp); tmp = inb(INVERS); /* Add some extra sanity checks here */ for(i=0; i < 3; i++) - if(*(bios_tab[i]+0x04) == 0x41564f4e) { + if(*(bios_tab[i]+0x04) == 0x41564f4e || + *(bios_tab[i]+0xc) == 0x61776c41) { printk("IN-2000 probe found hdw. vers. %02x, BIOS at %06x\n", tmp, (unsigned int)bios_tab[i]); return 1; @@ -141,7 +145,7 @@ /* - * retreive the current transaction counter from the WD + * retrieve the current transaction counter from the WD */ static unsigned in2000_txcnt(void) @@ -173,7 +177,7 @@ do { txcnt = in2000_txcnt(); /*DEB(printk("FIw:%d %02x %d\n", in2000_datalen, infcnt, txcnt));*/ - count = (infcnt << 3) - 32; /* dont fill completely */ + count = (infcnt << 3) - 32; /* don't fill completely */ if ( count > in2000_datalen ) count = in2000_datalen; /* limit to actual data on hand */ count >>= 1; /* Words, not bytes */ diff -u --recursive --new-file v1.1.66/linux/drivers/scsi/in2000.h linux/drivers/scsi/in2000.h --- v1.1.66/linux/drivers/scsi/in2000.h Sat Nov 26 18:36:06 1994 +++ linux/drivers/scsi/in2000.h Sat Nov 26 18:21:35 1994 @@ -1,6 +1,6 @@ #ifndef _IN2000_H -/* $Id: in2000.h,v 1.1 1994/03/14 06:27:38 root Exp root $ +/* $Id: in2000.h,v 1.2 1994/08/25 06:27:38 root Exp root $ * * Header file for the Always IN 2000 driver for Linux * @@ -26,6 +26,7 @@ /* WD33C93 defines */ #define OWNID 0 +#undef CONTROL #define CONTROL 1 #define TIMEOUT 2 #define TOTSECT 3 @@ -69,22 +70,17 @@ /* Select timeout const, 1 count = 8ms */ #define IN2000_TMOUT 0x1f -#if 0 -/* This is used with scatter-gather */ -struct in2000_chain { - ulong dataptr; /* Location of data */ - ulong datalen; /* Size of this part of chain */ -}; -#endif - /* These belong in scsi.h also */ +#undef any2scsi #define any2scsi(up, p) \ (up)[0] = (((unsigned long)(p)) >> 16); \ (up)[1] = (((unsigned long)(p)) >> 8); \ (up)[2] = ((unsigned long)(p)); +#undef scsi2int #define scsi2int(up) ( ((((long)*(up))&0x1f) << 16) + (((long)(up)[1]) << 8) + ((long)(up)[2]) ) +#undef xany2scsi #define xany2scsi(up, p) \ (up)[0] = ((long)(p)) >> 24; \ (up)[1] = ((long)(p)) >> 16; \ diff -u --recursive --new-file v1.1.66/linux/drivers/scsi/qlogic.c linux/drivers/scsi/qlogic.c --- v1.1.66/linux/drivers/scsi/qlogic.c Sat Nov 26 18:36:06 1994 +++ linux/drivers/scsi/qlogic.c Sat Nov 26 18:22:43 1994 @@ -212,7 +212,7 @@ } /*----------------------------------------------------------------*/ -/* initate scsi command - queueing handler */ +/* initiate scsi command - queueing handler */ static void ql_icmd(Scsi_Cmnd * cmd) { unsigned int i; @@ -524,7 +524,7 @@ /* return bios parameters */ int qlogic_biosparam(Disk * disk, int dev, int ip[]) { -/* This should mimmic the DOS Qlogic driver's behavior exactly */ +/* This should mimic the DOS Qlogic driver's behavior exactly */ ip[0] = 0x40; ip[1] = 0x20; ip[2] = disk->capacity / (ip[0] * ip[1]); diff -u --recursive --new-file v1.1.66/linux/drivers/scsi/scsi.c linux/drivers/scsi/scsi.c --- v1.1.66/linux/drivers/scsi/scsi.c Sat Nov 26 18:36:06 1994 +++ linux/drivers/scsi/scsi.c Sat Nov 26 18:22:05 1994 @@ -347,11 +347,11 @@ scsi_result[1] |= 0x80; /* removable */ } - SDpnt->manufactor = SCSI_MAN_UNKNOWN; + SDpnt->manufacturer = SCSI_MAN_UNKNOWN; if (!strncmp(scsi_result+8,"NEC",3)) - SDpnt->manufactor = SCSI_MAN_NEC; + SDpnt->manufacturer = SCSI_MAN_NEC; if (!strncmp(scsi_result+8,"TOSHIBA",7)) - SDpnt->manufactor = SCSI_MAN_TOSHIBA; + SDpnt->manufacturer = SCSI_MAN_TOSHIBA; SDpnt->removable = (0x80 & scsi_result[1]) >> 7; diff -u --recursive --new-file v1.1.66/linux/drivers/scsi/scsi.h linux/drivers/scsi/scsi.h --- v1.1.66/linux/drivers/scsi/scsi.h Sat Nov 26 18:36:06 1994 +++ linux/drivers/scsi/scsi.h Sat Nov 26 18:22:12 1994 @@ -260,7 +260,7 @@ */ /* - Manufactors list + Manufacturers list */ #define SCSI_MAN_UNKNOWN 0 @@ -275,7 +275,7 @@ typedef struct scsi_device { struct scsi_device * next; /* Used for linked list */ unsigned char id, lun; - unsigned int manufactor; /* Manufactor of device, for using vendor-specific cmd's */ + unsigned int manufacturer; /* Manufacturer of device, for using vendor-specific cmd's */ int attached; /* # of high level drivers attached to this */ int access_count; /* Count of open channels/mounts */ struct wait_queue * device_wait; /* Used to wait if device is busy */ diff -u --recursive --new-file v1.1.66/linux/drivers/scsi/sr.c linux/drivers/scsi/sr.c --- v1.1.66/linux/drivers/scsi/sr.c Sat Nov 26 18:36:07 1994 +++ linux/drivers/scsi/sr.c Mon Nov 28 12:20:57 1994 @@ -19,6 +19,7 @@ #include #include #include +#include #include #define MAJOR_NR SCSI_CDROM_MAJOR @@ -279,7 +280,7 @@ * * Actually works: (should work ;-) * - NEC: Detection and support of multisession CD's. Special handling - * for XA-disks is not nessesary. + * for XA-disks is not necessary. * * - TOSHIBA: setting density is done here now, mounting PhotoCD's should * work now without running the program "set_density" @@ -302,7 +303,7 @@ unsigned char *buffer; int rc; - switch(scsi_CDs[MINOR(inode->i_rdev)].device->manufactor) { + switch(scsi_CDs[MINOR(inode->i_rdev)].device->manufacturer) { case SCSI_MAN_NEC: printk("sr_photocd: use NEC code\n"); @@ -324,6 +325,7 @@ sec = (unsigned long)buffer[16]/16*10 + (unsigned long)buffer[16]%16; frame = (unsigned long)buffer[17]/16*10 + (unsigned long)buffer[17]%16; sector = min*60*75 + sec*75 + frame; + sector-=CD_BLOCK_OFFSET; if (sector) { printk("sr_photocd: multisession PhotoCD detected\n"); }} scsi_free(buffer,512); @@ -372,6 +374,7 @@ sec = (unsigned long)buffer[2]/16*10 + (unsigned long)buffer[2]%16; frame = (unsigned long)buffer[3]/16*10 + (unsigned long)buffer[3]%16; sector = min*60*75 + sec*75 + frame; + sector-=CD_BLOCK_OFFSET; if (sector) { printk("sr_photocd: multisession PhotoCD detected: %lu\n",sector); }} scsi_free(buffer,512); @@ -408,7 +411,9 @@ if(scsi_CDs[MINOR(inode->i_rdev)].needs_sector_size) get_sectorsize(MINOR(inode->i_rdev)); +#if 0 /* don't use for now - it doesn't seem to work for everybody */ sr_photocd(inode); +#endif return 0; } diff -u --recursive --new-file v1.1.66/linux/fs/exec.c linux/fs/exec.c --- v1.1.66/linux/fs/exec.c Tue Nov 22 15:41:13 1994 +++ linux/fs/exec.c Sun Nov 27 20:19:53 1994 @@ -36,16 +36,12 @@ #include #include #include -#include #include - -#include - #include #include -#include #include +#include asmlinkage int sys_exit(int exit_code); asmlinkage int sys_brk(unsigned long); diff -u --recursive --new-file v1.1.66/linux/fs/isofs/dir.c linux/fs/isofs/dir.c --- v1.1.66/linux/fs/isofs/dir.c Tue Nov 15 15:35:40 1994 +++ linux/fs/isofs/dir.c Mon Nov 28 10:34:00 1994 @@ -90,7 +90,7 @@ while (filp->f_pos < inode->i_size) { #ifdef DEBUG - printk("Block, offset: %x %x %x\n", + printk("Block, offset, f_pos: %x %x %x\n", block, offset, filp->f_pos); #endif de = (struct iso_directory_record *) (bh->b_data + offset); @@ -122,7 +122,7 @@ offset += *((unsigned char *) de); filp->f_pos += *((unsigned char *) de); - if (offset >= bufsize) { + if (offset > bufsize) { unsigned int frag1; frag1 = bufsize - old_offset; cpnt = kmalloc(*((unsigned char *) de),GFP_KERNEL); diff -u --recursive --new-file v1.1.66/linux/fs/isofs/file.c linux/fs/isofs/file.c --- v1.1.66/linux/fs/isofs/file.c Sat Nov 26 18:36:07 1994 +++ linux/fs/isofs/file.c Sat Nov 26 18:21:44 1994 @@ -156,14 +156,15 @@ /* * this is for stopping read ahead at EOF. It's important for - * reading PhotoCD's, becauce they have many small data tracks instead + * reading PhotoCD's, because they have many small data tracks instead * of one big. And between two data-tracks are some unreadable sectors. * A read ahead after a EOF may try to read such an unreadable sector. * kraxel@cs.tu-berlin.de (Gerd Knorr) */ - total_blocks = inode->i_size >> ISOFS_BUFFER_BITS(inode); - if (inode->i_size & (ISOFS_BUFFER_BITS(inode)-1)) total_blocks++; - while (block + blocks > total_blocks) blocks--; + total_blocks = (inode->i_size + (1 << ISOFS_BUFFER_BITS(inode)) - 1) + >> ISOFS_BUFFER_BITS(inode); + if (block + blocks > total_blocks) + blocks = total_blocks - block; max_block = (inode->i_size + BLOCK_SIZE - 1)/BLOCK_SIZE; nextblock = -1; diff -u --recursive --new-file v1.1.66/linux/fs/locks.c linux/fs/locks.c --- v1.1.66/linux/fs/locks.c Thu Oct 6 07:33:14 1994 +++ linux/fs/locks.c Mon Nov 28 08:05:37 1994 @@ -11,11 +11,17 @@ * - mandatory locks (requires lots of changes elsewhere) * * Edited by Kai Petzke, wpp@marie.physik.tu-berlin.de + * + * Converted file_lock_table to a linked list from an array, which eliminates + * the limits on how many active file locks are open - Chad Page + * (pageone@netcom.com), November 27, 1994 */ + #define DEADLOCK_DETECTION #include +#include #include #include #include @@ -36,25 +42,8 @@ int locks_deadlocked(int my_pid,int blocked_pid); #endif -static struct file_lock file_lock_table[NR_FILE_LOCKS]; -static struct file_lock *file_lock_free_list; - -/* - * Called at boot time to initialize the lock table ... - */ - -void fcntl_init_locks(void) -{ - struct file_lock *fl; - - for (fl = &file_lock_table[0]; fl < file_lock_table + NR_FILE_LOCKS - 1; fl++) { - fl->fl_next = fl + 1; - fl->fl_owner = NULL; - } - file_lock_table[NR_FILE_LOCKS - 1].fl_next = NULL; - file_lock_table[NR_FILE_LOCKS - 1].fl_owner = NULL; - file_lock_free_list = &file_lock_table[0]; -} +static struct file_lock *file_lock_table = NULL; +static struct file_lock *file_lock_free_list = NULL; int fcntl_getlk(unsigned int fd, struct flock *l) { @@ -185,7 +174,7 @@ int ret_val; struct wait_queue *dlock_wait; struct file_lock *fl; - for (fl = &file_lock_table[0]; fl < file_lock_table + NR_FILE_LOCKS - 1; fl++) { + for (fl = file_lock_table; fl != NULL; fl = fl->fl_nextlink) { if (fl->fl_owner == NULL) continue; /* not a used lock */ if (fl->fl_owner->pid != my_pid) continue; if (fl->fl_wait == NULL) continue; /* no queues */ @@ -453,6 +442,9 @@ /* * File_lock() inserts a lock at the position pos of the linked list. + * + * Modified to create a new node if no free entries available - Chad Page + * */ static struct file_lock *alloc_lock(struct file_lock **pos, @@ -462,13 +454,24 @@ struct file_lock *tmp; tmp = file_lock_free_list; + if (tmp == NULL) - return NULL; /* no available entry */ + { + /* Okay, let's make a new file_lock structure... */ + tmp = (struct file_lock *)kmalloc(sizeof(struct file_lock), GFP_KERNEL); + tmp -> fl_owner = NULL; + tmp -> fl_next = file_lock_free_list; + tmp -> fl_nextlink = file_lock_table; + file_lock_table = tmp; + } + else + { + /* remove from free list */ + file_lock_free_list = tmp->fl_next; + } + if (tmp->fl_owner != NULL) panic("alloc_lock: broken free list\n"); - - /* remove from free list */ - file_lock_free_list = tmp->fl_next; *tmp = *fl; diff -u --recursive --new-file v1.1.66/linux/fs/proc/mem.c linux/fs/proc/mem.c --- v1.1.66/linux/fs/proc/mem.c Wed Aug 10 09:18:33 1994 +++ linux/fs/proc/mem.c Sun Nov 27 20:19:53 1994 @@ -9,8 +9,8 @@ #include #include #include -#include +#include #include #include diff -u --recursive --new-file v1.1.66/linux/fs/super.c linux/fs/super.c --- v1.1.66/linux/fs/super.c Sat Nov 26 18:36:07 1994 +++ linux/fs/super.c Mon Nov 28 12:19:37 1994 @@ -26,7 +26,6 @@ extern struct file_operations * get_chrfops(unsigned int); extern void wait_for_keypress(void); -extern void fcntl_init_locks(void); extern int root_mountflags; @@ -442,14 +441,18 @@ } if (!S_ISDIR(dir_i->i_mode)) { iput(dir_i); - return -EPERM; + return -ENOTDIR; } if (!fs_may_mount(dev)) { iput(dir_i); return -EBUSY; } sb = read_super(dev,type,flags,data,0); - if (!sb || sb->s_covered) { + if (!sb) { + iput(dir_i); + return -EINVAL; + } + if (sb->s_covered) { iput(dir_i); return -EBUSY; } @@ -640,7 +643,6 @@ int retval; memset(super_blocks, 0, sizeof(super_blocks)); - fcntl_init_locks(); #ifdef CONFIG_BLK_DEV_FD if (MAJOR(ROOT_DEV) == FLOPPY_MAJOR) { printk(KERN_NOTICE "VFS: Insert root floppy and press ENTER\n"); diff -u --recursive --new-file v1.1.66/linux/fs/umsdos/inode.c linux/fs/umsdos/inode.c --- v1.1.66/linux/fs/umsdos/inode.c Tue Nov 22 15:41:13 1994 +++ linux/fs/umsdos/inode.c Sun Nov 27 20:19:53 1994 @@ -6,7 +6,6 @@ * */ -#include #include #include #include diff -u --recursive --new-file v1.1.66/linux/ibcs/Makefile linux/ibcs/Makefile --- v1.1.66/linux/ibcs/Makefile Wed May 25 11:24:50 1994 +++ linux/ibcs/Makefile Sun Nov 27 20:19:53 1994 @@ -26,7 +26,6 @@ dep: $(CPP) -M *.c > .depend - set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i dep; done dummy: diff -u --recursive --new-file v1.1.66/linux/include/asm-alpha/dma.h linux/include/asm-alpha/dma.h --- v1.1.66/linux/include/asm-alpha/dma.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-alpha/dma.h Sun Nov 27 21:02:53 1994 @@ -0,0 +1,272 @@ +/* + * include/asm-alpha/dma.h + * + * This is essentially the same as the i386 DMA stuff, as + * the AlphaPC uses normal EISA dma (but the DMA controller + * is not on the EISA bus, but on the local VL82c106 bus). + * + * These DMA-functions don't know about EISA DMA yet.. + */ + +/* $Id: dma.h,v 1.7 1992/12/14 00:29:34 root Exp root $ + * linux/include/asm/dma.h: Defines for using and allocating dma channels. + * Written by Hennus Bergman, 1992. + * High DMA channel support & info by Hannu Savolainen + * and John Boyd, Nov. 1992. + */ + +#ifndef _ASM_DMA_H +#define _ASM_DMA_H + +#include /* need byte IO */ + +#define dma_outb outb_local +#define dma_inb inb_local + +/* + * NOTES about DMA transfers: + * + * controller 1: channels 0-3, byte operations, ports 00-1F + * controller 2: channels 4-7, word operations, ports C0-DF + * + * - ALL registers are 8 bits only, regardless of transfer size + * - channel 4 is not used - cascades 1 into 2. + * - channels 0-3 are byte - addresses/counts are for physical bytes + * - channels 5-7 are word - addresses/counts are for physical words + * - transfers must not cross physical 64K (0-3) or 128K (5-7) boundaries + * - transfer count loaded to registers is 1 less than actual count + * - controller 2 offsets are all even (2x offsets for controller 1) + * - page registers for 5-7 don't use data bit 0, represent 128K pages + * - page registers for 0-3 use bit 0, represent 64K pages + * + * DMA transfers are limited to the lower 16MB of _physical_ memory. + * Note that addresses loaded into registers must be _physical_ addresses, + * not logical addresses (which may differ if paging is active). + * + * Address mapping for channels 0-3: + * + * A23 ... A16 A15 ... A8 A7 ... A0 (Physical addresses) + * | ... | | ... | | ... | + * | ... | | ... | | ... | + * | ... | | ... | | ... | + * P7 ... P0 A7 ... A0 A7 ... A0 + * | Page | Addr MSB | Addr LSB | (DMA registers) + * + * Address mapping for channels 5-7: + * + * A23 ... A17 A16 A15 ... A9 A8 A7 ... A1 A0 (Physical addresses) + * | ... | \ \ ... \ \ \ ... \ \ + * | ... | \ \ ... \ \ \ ... \ (not used) + * | ... | \ \ ... \ \ \ ... \ + * P7 ... P1 (0) A7 A6 ... A0 A7 A6 ... A0 + * | Page | Addr MSB | Addr LSB | (DMA registers) + * + * Again, channels 5-7 transfer _physical_ words (16 bits), so addresses + * and counts _must_ be word-aligned (the lowest address bit is _ignored_ at + * the hardware level, so odd-byte transfers aren't possible). + * + * Transfer count (_not # bytes_) is limited to 64K, represented as actual + * count - 1 : 64K => 0xFFFF, 1 => 0x0000. Thus, count is always 1 or more, + * and up to 128K bytes may be transferred on channels 5-7 in one operation. + * + */ + +#define MAX_DMA_CHANNELS 8 + +/* 8237 DMA controllers */ +#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */ +#define IO_DMA2_BASE 0xC0 /* 16 bit master DMA, ch 4(=slave input)..7 */ + +/* DMA controller registers */ +#define DMA1_CMD_REG 0x08 /* command register (w) */ +#define DMA1_STAT_REG 0x08 /* status register (r) */ +#define DMA1_REQ_REG 0x09 /* request register (w) */ +#define DMA1_MASK_REG 0x0A /* single-channel mask (w) */ +#define DMA1_MODE_REG 0x0B /* mode register (w) */ +#define DMA1_CLEAR_FF_REG 0x0C /* clear pointer flip-flop (w) */ +#define DMA1_TEMP_REG 0x0D /* Temporary Register (r) */ +#define DMA1_RESET_REG 0x0D /* Master Clear (w) */ +#define DMA1_CLR_MASK_REG 0x0E /* Clear Mask */ +#define DMA1_MASK_ALL_REG 0x0F /* all-channels mask (w) */ + +#define DMA2_CMD_REG 0xD0 /* command register (w) */ +#define DMA2_STAT_REG 0xD0 /* status register (r) */ +#define DMA2_REQ_REG 0xD2 /* request register (w) */ +#define DMA2_MASK_REG 0xD4 /* single-channel mask (w) */ +#define DMA2_MODE_REG 0xD6 /* mode register (w) */ +#define DMA2_CLEAR_FF_REG 0xD8 /* clear pointer flip-flop (w) */ +#define DMA2_TEMP_REG 0xDA /* Temporary Register (r) */ +#define DMA2_RESET_REG 0xDA /* Master Clear (w) */ +#define DMA2_CLR_MASK_REG 0xDC /* Clear Mask */ +#define DMA2_MASK_ALL_REG 0xDE /* all-channels mask (w) */ + +#define DMA_ADDR_0 0x00 /* DMA address registers */ +#define DMA_ADDR_1 0x02 +#define DMA_ADDR_2 0x04 +#define DMA_ADDR_3 0x06 +#define DMA_ADDR_4 0xC0 +#define DMA_ADDR_5 0xC4 +#define DMA_ADDR_6 0xC8 +#define DMA_ADDR_7 0xCC + +#define DMA_CNT_0 0x01 /* DMA count registers */ +#define DMA_CNT_1 0x03 +#define DMA_CNT_2 0x05 +#define DMA_CNT_3 0x07 +#define DMA_CNT_4 0xC2 +#define DMA_CNT_5 0xC6 +#define DMA_CNT_6 0xCA +#define DMA_CNT_7 0xCE + +#define DMA_PAGE_0 0x87 /* DMA page registers */ +#define DMA_PAGE_1 0x83 +#define DMA_PAGE_2 0x81 +#define DMA_PAGE_3 0x82 +#define DMA_PAGE_5 0x8B +#define DMA_PAGE_6 0x89 +#define DMA_PAGE_7 0x8A + +#define DMA_MODE_READ 0x44 /* I/O to memory, no autoinit, increment, single mode */ +#define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */ +#define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */ + +/* enable/disable a specific DMA channel */ +static __inline__ void enable_dma(unsigned int dmanr) +{ + if (dmanr<=3) + dma_outb(dmanr, DMA1_MASK_REG); + else + dma_outb(dmanr & 3, DMA2_MASK_REG); +} + +static __inline__ void disable_dma(unsigned int dmanr) +{ + if (dmanr<=3) + dma_outb(dmanr | 4, DMA1_MASK_REG); + else + dma_outb((dmanr & 3) | 4, DMA2_MASK_REG); +} + +/* Clear the 'DMA Pointer Flip Flop'. + * Write 0 for LSB/MSB, 1 for MSB/LSB access. + * Use this once to initialize the FF to a known state. + * After that, keep track of it. :-) + * --- In order to do that, the DMA routines below should --- + * --- only be used while interrupts are disabled! --- + */ +static __inline__ void clear_dma_ff(unsigned int dmanr) +{ + if (dmanr<=3) + dma_outb(0, DMA1_CLEAR_FF_REG); + else + dma_outb(0, DMA2_CLEAR_FF_REG); +} + +/* set mode (above) for a specific DMA channel */ +static __inline__ void set_dma_mode(unsigned int dmanr, char mode) +{ + if (dmanr<=3) + dma_outb(mode | dmanr, DMA1_MODE_REG); + else + dma_outb(mode | (dmanr&3), DMA2_MODE_REG); +} + +/* Set only the page register bits of the transfer address. + * This is used for successive transfers when we know the contents of + * the lower 16 bits of the DMA current address register, but a 64k boundary + * may have been crossed. + */ +static __inline__ void set_dma_page(unsigned int dmanr, char pagenr) +{ + switch(dmanr) { + case 0: + dma_outb(pagenr, DMA_PAGE_0); + break; + case 1: + dma_outb(pagenr, DMA_PAGE_1); + break; + case 2: + dma_outb(pagenr, DMA_PAGE_2); + break; + case 3: + dma_outb(pagenr, DMA_PAGE_3); + break; + case 5: + dma_outb(pagenr & 0xfe, DMA_PAGE_5); + break; + case 6: + dma_outb(pagenr & 0xfe, DMA_PAGE_6); + break; + case 7: + dma_outb(pagenr & 0xfe, DMA_PAGE_7); + break; + } +} + + +/* Set transfer address & page bits for specific DMA channel. + * Assumes dma flipflop is clear. + */ +static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a) +{ + set_dma_page(dmanr, a>>16); + if (dmanr <= 3) { + dma_outb( a & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE ); + dma_outb( (a>>8) & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE ); + } else { + dma_outb( (a>>1) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE ); + dma_outb( (a>>9) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE ); + } +} + + +/* Set transfer size (max 64k for DMA1..3, 128k for DMA5..7) for + * a specific DMA channel. + * You must ensure the parameters are valid. + * NOTE: from a manual: "the number of transfers is one more + * than the initial word count"! This is taken into account. + * Assumes dma flip-flop is clear. + * NOTE 2: "count" represents _bytes_ and must be even for channels 5-7. + */ +static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count) +{ + count--; + if (dmanr <= 3) { + dma_outb( count & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ); + dma_outb( (count>>8) & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ); + } else { + dma_outb( (count>>1) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ); + dma_outb( (count>>9) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ); + } +} + + +/* Get DMA residue count. After a DMA transfer, this + * should return zero. Reading this while a DMA transfer is + * still in progress will return unpredictable results. + * If called before the channel has been used, it may return 1. + * Otherwise, it returns the number of _bytes_ left to transfer. + * + * Assumes DMA flip-flop is clear. + */ +static __inline__ int get_dma_residue(unsigned int dmanr) +{ + unsigned int io_port = (dmanr<=3)? ((dmanr&3)<<1) + 1 + IO_DMA1_BASE + : ((dmanr&3)<<2) + 2 + IO_DMA2_BASE; + + /* using short to get 16-bit wrap around */ + unsigned short count; + + count = 1 + dma_inb(io_port); + count += dma_inb(io_port) << 8; + + return (dmanr<=3)? count : (count<<1); +} + + +/* These are in kernel/dma.c: */ +extern int request_dma(unsigned int dmanr, char * deviceID); /* reserve a DMA channel */ +extern void free_dma(unsigned int dmanr); /* release it again */ + + +#endif /* _ASM_DMA_H */ diff -u --recursive --new-file v1.1.66/linux/include/asm-alpha/irq.h linux/include/asm-alpha/irq.h --- v1.1.66/linux/include/asm-alpha/irq.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-alpha/irq.h Mon Nov 28 07:25:35 1994 @@ -0,0 +1,54 @@ +#ifndef _ALPHA_IRQ_H +#define _ALPHA_IRQ_H + +/* + * linux/include/alpha/irq.h + * + * (C) 1994 Linus Torvalds + */ + +#include + +extern void disable_irq(unsigned int); +extern void enable_irq(unsigned int); + +#define __STR(x) #x +#define STR(x) __STR(x) + +#define SAVE_ALL "xx" + +/* + * SAVE_MOST/RESTORE_MOST is used for the faster version of IRQ handlers, + * installed by using the SA_INTERRUPT flag. These kinds of IRQ's don't + * call the routines that do signal handling etc on return, and can have + * more relaxed register-saving etc. They are also atomic, and are thus + * suited for small, fast interrupts like the serial lines or the harddisk + * drivers, which don't actually need signal handling etc. + * + * Also note that we actually save only those registers that are used in + * C subroutines, so if you do something weird, you're on your own. + */ +#define SAVE_MOST "yy" + +#define RESTORE_MOST "zz" + +#define ACK_FIRST(mask) "aa" + +#define ACK_SECOND(mask) "dummy" + +#define UNBLK_FIRST(mask) "dummy" + +#define UNBLK_SECOND(mask) "dummy" + +#define IRQ_NAME2(nr) nr##_interrupt(void) +#define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr) +#define FAST_IRQ_NAME(nr) IRQ_NAME2(fast_IRQ##nr) +#define BAD_IRQ_NAME(nr) IRQ_NAME2(bad_IRQ##nr) + +#define BUILD_IRQ(chip,nr,mask) \ +asmlinkage void IRQ_NAME(nr); \ +asmlinkage void FAST_IRQ_NAME(nr); \ +asmlinkage void BAD_IRQ_NAME(nr); \ +asm code comes here + +#endif diff -u --recursive --new-file v1.1.66/linux/include/asm-alpha/page.h linux/include/asm-alpha/page.h --- v1.1.66/linux/include/asm-alpha/page.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-alpha/page.h Sun Nov 27 20:19:54 1994 @@ -0,0 +1,50 @@ +#ifndef _ALPHA_PAGE_H +#define _ALPHA_PAGE_H + +#define invalidate_all() \ +__asm__ __volatile__( \ + "lda $16,-2($31)\n\t" \ + ".long 51" \ + : : :"$1", "$16", "$17", "$22","$23","$24","$25") + +#define invalidate() \ +__asm__ __volatile__( \ + "lda $16,-1($31)\n\t" \ + ".long 51" \ + : : :"$1", "$16", "$17", "$22","$23","$24","$25") + + /* PAGE_SHIFT determines the page size */ +#define PAGE_SHIFT 13 +#define PGDIR_SHIFT 23 +#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PGDIR_SIZE (1UL << PGDIR_SHIFT) + +#ifdef __KERNEL__ + + /* number of bits that fit into a memory pointer */ +#define BITS_PER_PTR (8*sizeof(unsigned long)) + /* to mask away the intra-page address bits */ +#define PAGE_MASK (~(PAGE_SIZE-1)) + /* to mask away the intra-page address bits */ +#define PGDIR_MASK (~(PGDIR_SIZE-1)) + /* to align the pointer to the (next) page boundary */ +#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) + /* to align the pointer to a pointer address */ +#define PTR_MASK (~(sizeof(void*)-1)) + + /* sizeof(void*)==1<>(PAGE_SHIFT-SIZEOF_PTR_LOG2)*2&PTR_MASK&~PAGE_MASK))) + /* to find an entry in a page-table */ +#define PAGE_PTR(address) \ + ((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK) + /* the no. of pointers that fit on a page */ +#define PTRS_PER_PAGE (PAGE_SIZE/sizeof(void*)) + +#endif /* __KERNEL__ */ + +#endif /* _ALPHA_PAGE_H */ diff -u --recursive --new-file v1.1.66/linux/include/asm-alpha/segment.h linux/include/asm-alpha/segment.h --- v1.1.66/linux/include/asm-alpha/segment.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-alpha/segment.h Sun Nov 27 20:19:54 1994 @@ -0,0 +1,80 @@ +#ifndef _ASM_SEGMENT_H +#define _ASM_SEGMENT_H + +#include + +static inline unsigned char get_user_byte(const char * addr) +{ + return *addr; +} + +#define get_fs_byte(addr) get_user_byte((char *)(addr)) + +static inline unsigned short get_user_word(const short *addr) +{ + return *addr; +} + +#define get_fs_word(addr) get_user_word((short *)(addr)) + +static inline unsigned long get_user_long(const int *addr) +{ + return *addr; +} + +#define get_fs_long(addr) get_user_long((int *)(addr)) + +static inline unsigned long get_user_quad(const long *addr) +{ + return *addr; +} + +#define get_fs_quad(addr) get_user_quad((long *)(addr)) + +static inline void put_user_byte(char val,char *addr) +{ + *addr = val; +} + +#define put_fs_byte(x,addr) put_user_byte((x),(char *)(addr)) + +static inline void put_user_word(short val,short * addr) +{ + *addr = val; +} + +#define put_fs_word(x,addr) put_user_word((x),(short *)(addr)) + +static inline void put_user_long(unsigned long val,int * addr) +{ + *addr = val; +} + +#define put_fs_long(x,addr) put_user_long((x),(int *)(addr)) + +static inline void put_user_quad(unsigned long val,long * addr) +{ + *addr = val; +} + +#define put_fs_quad(x,addr) put_user_quad((x),(long *)(addr)) + +#define memcpy_fromfs(to, from, n) memcpy((to),(from),(n)) + +#define memcpy_tofs(to, from, n) memcpy((to),(from),(n)) + +static inline unsigned long get_fs(void) +{ + return 0; +} + +static inline unsigned long get_ds(void) +{ + return 0; +} + +static inline void set_fs(unsigned long val) +{ +} + +#endif /* _ASM_SEGMENT_H */ diff -u --recursive --new-file v1.1.66/linux/include/asm-alpha/system.h linux/include/asm-alpha/system.h --- v1.1.66/linux/include/asm-alpha/system.h Tue Nov 22 15:41:13 1994 +++ linux/include/asm-alpha/system.h Sun Nov 27 20:19:54 1994 @@ -15,7 +15,7 @@ #define INIT_PCB 0xfffffc0000300000 #define INIT_STACK 0xfffffc0000302000 #define START_ADDR 0xfffffc0000304000 -#define SIZE (32*1024) +#define START_SIZE (32*1024) /* * Common PAL-code @@ -65,18 +65,6 @@ #ifndef mb #define mb() __asm__ __volatile__("mb": : :"memory") #endif - -#define invalidate_all() \ -__asm__ __volatile__( \ - "lda $16,-2($31)\n\t" \ - ".long 51" \ - : : :"$1", "$16", "$17", "$22","$23","$24","$25") - -#define invalidate() \ -__asm__ __volatile__( \ - "lda $16,-1($31)\n\t" \ - ".long 51" \ - : : :"$1", "$16", "$17", "$22","$23","$24","$25") #define swpipl(__new_ipl) \ ({ unsigned long __old_ipl; \ diff -u --recursive --new-file v1.1.66/linux/include/asm-alpha/types.h linux/include/asm-alpha/types.h --- v1.1.66/linux/include/asm-alpha/types.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-alpha/types.h Mon Nov 28 07:21:52 1994 @@ -0,0 +1,35 @@ +#ifndef _ALPHA_TYPES_H +#define _ALPHA_TYPES_H + +/* + * These aren't exported outside the kernel to avoid name space clashes + */ +#ifdef __KERNEL__ + +typedef signed char s8; +typedef unsigned char u8; + +typedef signed short s16; +typedef unsigned short u16; + +typedef signed int s32; +typedef unsigned int u32; + +/* + * There are 32-bit compilers for the alpha out there.. + */ +#if ((~0UL) == 0xffffffff) + +typedef signed long long s64; +typedef unsigned long long u64; + +#else + +typedef signed long s64; +typedef unsigned long u64; + +#endif + +#endif /* __KERNEL__ */ + +#endif diff -u --recursive --new-file v1.1.66/linux/include/asm-alpha/unistd.h linux/include/asm-alpha/unistd.h --- v1.1.66/linux/include/asm-alpha/unistd.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-alpha/unistd.h Mon Nov 28 07:29:22 1994 @@ -0,0 +1,94 @@ +#ifndef _ALPHA_UNISTD_H +#define _ALPHA_UNISTD_H + +/* + * ".long 131" is "PAL_callsys".. + * + * Duh, the alpha gcc compiler doesn't allow us to specify regs + * yet. I'll have to see about this later.. + */ + +/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */ +#define _syscall0(type,name) \ +type name(void) \ +{ \ +long __res; \ +__asm__ __volatile__ (".long 131" \ + : "=a" (__res) \ + : "0" (__NR_##name)); \ +if (__res >= 0) \ + return (type) __res; \ +errno = -__res; \ +return -1; \ +} + +#define _syscall1(type,name,type1,arg1) \ +type name(type1 arg1) \ +{ \ +long __res; \ +__asm__ __volatile__ (".long 131" \ + : "=a" (__res) \ + : "0" (__NR_##name),"b" ((long)(arg1))); \ +if (__res >= 0) \ + return (type) __res; \ +errno = -__res; \ +return -1; \ +} + +#define _syscall2(type,name,type1,arg1,type2,arg2) \ +type name(type1 arg1,type2 arg2) \ +{ \ +long __res; \ +__asm__ __volatile__ (".long 131" \ + : "=a" (__res) \ + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \ +if (__res >= 0) \ + return (type) __res; \ +errno = -__res; \ +return -1; \ +} + +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ +type name(type1 arg1,type2 arg2,type3 arg3) \ +{ \ +long __res; \ +__asm__ __volatile__ (".long 131" \ + : "=a" (__res) \ + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3))); \ +if (__res>=0) \ + return (type) __res; \ +errno=-__res; \ +return -1; \ +} + +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ +{ \ +long __res; \ +__asm__ __volatile__ (".long 131" \ + : "=a" (__res) \ + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3)),"S" ((long)(arg4))); \ +if (__res>=0) \ + return (type) __res; \ +errno=-__res; \ +return -1; \ +} + +#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ +{ \ +long __res; \ +__asm__ __volatile__ (".long 131" \ + : "=a" (__res) \ + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \ +if (__res>=0) \ + return (type) __res; \ +errno=-__res; \ +return -1; \ +} + +#endif /* _ALPHA_UNISTD_H */ diff -u --recursive --new-file v1.1.66/linux/include/asm-i386/dma.h linux/include/asm-i386/dma.h --- v1.1.66/linux/include/asm-i386/dma.h Tue Aug 23 09:49:02 1994 +++ linux/include/asm-i386/dma.h Sun Nov 27 20:19:54 1994 @@ -17,6 +17,8 @@ #define dma_outb outb #endif +#define dma_inb inb + /* * NOTES about DMA transfers: * @@ -251,8 +253,8 @@ /* using short to get 16-bit wrap around */ unsigned short count; - count = 1 + inb(io_port); - count += inb(io_port) << 8; + count = 1 + dma_inb(io_port); + count += dma_inb(io_port) << 8; return (dmanr<=3)? count : (count<<1); } diff -u --recursive --new-file v1.1.66/linux/include/asm-i386/irq.h linux/include/asm-i386/irq.h --- v1.1.66/linux/include/asm-i386/irq.h Mon Aug 15 10:56:19 1994 +++ linux/include/asm-i386/irq.h Sun Nov 27 20:19:54 1994 @@ -7,8 +7,8 @@ * (C) 1992, 1993 Linus Torvalds */ -#include #include +#include extern void disable_irq(unsigned int); extern void enable_irq(unsigned int); diff -u --recursive --new-file v1.1.66/linux/include/asm-i386/page.h linux/include/asm-i386/page.h --- v1.1.66/linux/include/asm-i386/page.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-i386/page.h Sun Nov 27 20:19:54 1994 @@ -0,0 +1,41 @@ +#ifndef _I386_PAGE_H +#define _I386_PAGE_H + +#define invalidate() \ +__asm__ __volatile__("movl %%cr3,%%eax\n\tmovl %%eax,%%cr3": : :"ax") + + /* PAGE_SHIFT determines the page size */ +#define PAGE_SHIFT 12 +#define PGDIR_SHIFT 22 +#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PGDIR_SIZE (1UL << PGDIR_SHIFT) + +#ifdef __KERNEL__ + + /* number of bits that fit into a memory pointer */ +#define BITS_PER_PTR (8*sizeof(unsigned long)) + /* to mask away the intra-page address bits */ +#define PAGE_MASK (~(PAGE_SIZE-1)) + /* to mask away the intra-page address bits */ +#define PGDIR_MASK (~(PGDIR_SIZE-1)) + /* to align the pointer to the (next) page boundary */ +#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) + /* to align the pointer to a pointer address */ +#define PTR_MASK (~(sizeof(void*)-1)) + + /* sizeof(void*)==1<>(PAGE_SHIFT-SIZEOF_PTR_LOG2)*2&PTR_MASK&~PAGE_MASK))) + /* to find an entry in a page-table */ +#define PAGE_PTR(address) \ + ((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK) + /* the no. of pointers that fit on a page */ +#define PTRS_PER_PAGE (PAGE_SIZE/sizeof(void*)) + +#endif /* __KERNEL__ */ + +#endif /* _I386_PAGE_H */ diff -u --recursive --new-file v1.1.66/linux/include/asm-i386/segment.h linux/include/asm-i386/segment.h --- v1.1.66/linux/include/asm-i386/segment.h Mon Aug 15 10:56:19 1994 +++ linux/include/asm-i386/segment.h Sun Nov 27 20:19:54 1994 @@ -1,6 +1,14 @@ #ifndef _ASM_SEGMENT_H #define _ASM_SEGMENT_H +#define KERNEL_CS 0x10 +#define KERNEL_DS 0x18 + +#define USER_CS 0x23 +#define USER_DS 0x2B + +#ifndef __ASSEMBLY__ + static inline unsigned char get_user_byte(const char * addr) { register unsigned char _v; @@ -215,5 +223,7 @@ { __asm__ __volatile__("mov %w0,%%fs": /* no output */ :"r" (val)); } + +#endif /* __ASSEMBLY__ */ #endif /* _ASM_SEGMENT_H */ diff -u --recursive --new-file v1.1.66/linux/include/asm-i386/system.h linux/include/asm-i386/system.h --- v1.1.66/linux/include/asm-i386/system.h Mon Aug 15 10:56:20 1994 +++ linux/include/asm-i386/system.h Sun Nov 27 20:19:54 1994 @@ -1,7 +1,7 @@ #ifndef __ASM_SYSTEM_H #define __ASM_SYSTEM_H -#include +#include #define move_to_user_mode() \ __asm__ __volatile__ ("movl %%esp,%%eax\n\t" \ diff -u --recursive --new-file v1.1.66/linux/include/asm-i386/types.h linux/include/asm-i386/types.h --- v1.1.66/linux/include/asm-i386/types.h Thu Jan 1 02:00:00 1970 +++ linux/include/asm-i386/types.h Mon Nov 28 07:19:17 1994 @@ -0,0 +1,23 @@ +#ifndef _I386_TYPES_H +#define _I386_TYPES_H + +/* + * These aren't exported outside the kernel to avoid name space clashes + */ +#ifdef __KERNEL__ + +typedef signed char s8; +typedef unsigned char u8; + +typedef signed short s16; +typedef unsigned short u16; + +typedef signed long s32; +typedef unsigned long u32; + +typedef signed long long s64; +typedef unsigned long long u64; + +#endif /* __KERNEL__ */ + +#endif diff -u --recursive --new-file v1.1.66/linux/include/asm-mips/segment.h linux/include/asm-mips/segment.h --- v1.1.66/linux/include/asm-mips/segment.h Mon Aug 15 10:54:23 1994 +++ linux/include/asm-mips/segment.h Sun Nov 27 20:19:54 1994 @@ -12,8 +12,6 @@ #ifndef _ASM_MIPS_SEGMENT_H_ #define _ASM_MIPS_SEGMENT_H_ -#include - static inline unsigned char get_user_byte(const char * addr) { register unsigned char _v; diff -u --recursive --new-file v1.1.66/linux/include/asm-mips/system.h linux/include/asm-mips/system.h --- v1.1.66/linux/include/asm-mips/system.h Mon Aug 15 10:54:23 1994 +++ linux/include/asm-mips/system.h Sun Nov 27 20:19:54 1994 @@ -11,7 +11,7 @@ #ifndef _ASM_MIPS_SYSTEM_H_ #define _ASM_MIPS_SYSTEM_H_ -#include +#include #include /* diff -u --recursive --new-file v1.1.66/linux/include/linux/a.out.h linux/include/linux/a.out.h --- v1.1.66/linux/include/linux/a.out.h Wed Dec 1 14:44:15 1993 +++ linux/include/linux/a.out.h Sun Nov 27 20:19:54 1994 @@ -136,7 +136,7 @@ #endif #ifdef linux -#include +#include #define SEGMENT_SIZE 1024 #endif diff -u --recursive --new-file v1.1.66/linux/include/linux/fd.h linux/include/linux/fd.h --- v1.1.66/linux/include/linux/fd.h Sat Nov 26 18:36:07 1994 +++ linux/include/linux/fd.h Sun Nov 27 20:20:47 1994 @@ -54,7 +54,7 @@ 512 : 128 << FD_SIZECODE(floppy) ) #define FD_PERP 0x40 -#ifndef ASSEMBLER +#ifndef __ASSEMBLY__ /* the following structure is used by FDSETPRM, FDDEFPRM and FDGETPRM */ struct floppy_struct { unsigned int size, /* nr of sectors total */ diff -u --recursive --new-file v1.1.66/linux/include/linux/fs.h linux/include/linux/fs.h --- v1.1.66/linux/include/linux/fs.h Tue Nov 15 15:35:41 1994 +++ linux/include/linux/fs.h Mon Nov 28 07:40:03 1994 @@ -29,7 +29,6 @@ #define NR_FILE 1024 /* this can well be larger on a larger system */ #define NR_SUPER 32 #define NR_IHASH 131 -#define NR_FILE_LOCKS 64 #define BLOCK_SIZE 1024 #define BLOCK_SIZE_BITS 10 @@ -267,6 +266,7 @@ struct file_lock { struct file_lock *fl_next; /* singly linked list */ + struct file_lock *fl_nextlink; struct task_struct *fl_owner; /* NULL if on free list, for sanity checks */ unsigned int fl_fd; /* File descriptor for this lock */ struct wait_queue *fl_wait; diff -u --recursive --new-file v1.1.66/linux/include/linux/ip.h linux/include/linux/ip.h --- v1.1.66/linux/include/linux/ip.h Sat May 7 14:12:56 1994 +++ linux/include/linux/ip.h Mon Nov 28 07:36:27 1994 @@ -29,23 +29,24 @@ struct timestamp { - unsigned char len; - unsigned char ptr; - union { + u8 len; + u8 ptr; + union { #if defined(__i386__) - unsigned char flags:4, + u8 flags:4, overflow:4; -#else -#if defined(__mc680x0__) - unsigned char overflow:4, +#elif defined(__mc680x0__) + u8 overflow:4, flags:4; +#elif defined(__alpha__) + u8 flags:4, + overflow:4; #else #error "Adjust this structure to match your CPU" -#endif #endif - unsigned char full_char; - } x; - unsigned long data[9]; + u8 full_char; + } x; + u32 data[9]; }; @@ -73,26 +74,27 @@ struct iphdr { #if defined(__i386__) - unsigned char ihl:4, - version:4; -#else -#if defined (__mc680x0__) - unsigned char version:4, - ihl:4; + u8 ihl:4, + version:4; +#elif defined (__mc680x0__) + u8 version:4, + ihl:4; +#elif defined (__alpha__) + u8 ihl:4, + version:4; #else #error "Adjust this structure to match your CPU" -#endif #endif - unsigned char tos; - unsigned short tot_len; - unsigned short id; - unsigned short frag_off; - unsigned char ttl; - unsigned char protocol; - unsigned short check; - unsigned long saddr; - unsigned long daddr; - /*The options start here. */ + u8 tos; + u16 tot_len; + u16 id; + u16 frag_off; + u8 ttl; + u8 protocol; + u16 check; + u32 saddr; + u32 daddr; + /*The options start here. */ }; diff -u --recursive --new-file v1.1.66/linux/include/linux/mm.h linux/include/linux/mm.h --- v1.1.66/linux/include/linux/mm.h Tue Nov 15 15:35:41 1994 +++ linux/include/linux/mm.h Sun Nov 27 20:19:54 1994 @@ -1,7 +1,8 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H -#include +#include + #include #include #include @@ -203,9 +204,6 @@ rw_swap_page(READ,(nr),(buf)) #define write_swap_page(nr,buf) \ rw_swap_page(WRITE,(nr),(buf)) - -#define invalidate() \ -__asm__ __volatile__("movl %%cr3,%%eax\n\tmovl %%eax,%%cr3": : :"ax") extern unsigned long high_memory; diff -u --recursive --new-file v1.1.66/linux/include/linux/page.h linux/include/linux/page.h --- v1.1.66/linux/include/linux/page.h Thu Jul 28 10:57:02 1994 +++ linux/include/linux/page.h Sun Nov 27 20:19:54 1994 @@ -1,38 +0,0 @@ -#ifndef _LINUX_PAGE_H -#define _LINUX_PAGE_H - - /* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT 12 -#define PGDIR_SHIFT 22 -#define PAGE_SIZE (1UL << PAGE_SHIFT) -#define PGDIR_SIZE (1UL << PGDIR_SHIFT) - -#ifdef __KERNEL__ - - /* number of bits that fit into a memory pointer */ -#define BITS_PER_PTR (8*sizeof(unsigned long)) - /* to mask away the intra-page address bits */ -#define PAGE_MASK (~(PAGE_SIZE-1)) - /* to mask away the intra-page address bits */ -#define PGDIR_MASK (~(PGDIR_SIZE-1)) - /* to align the pointer to the (next) page boundary */ -#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) - /* to align the pointer to a pointer address */ -#define PTR_MASK (~(sizeof(void*)-1)) - - /* sizeof(void*)==1<>(PAGE_SHIFT-SIZEOF_PTR_LOG2)*2&PTR_MASK&~PAGE_MASK))) - /* to find an entry in a page-table */ -#define PAGE_PTR(address) \ - ((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK) - /* the no. of pointers that fit on a page */ -#define PTRS_PER_PAGE (PAGE_SIZE/sizeof(void*)) - -#endif /* __KERNEL__ */ - -#endif /* _LINUX_PAGE_H */ diff -u --recursive --new-file v1.1.66/linux/include/linux/segment.h linux/include/linux/segment.h --- v1.1.66/linux/include/linux/segment.h Wed Dec 1 14:44:15 1993 +++ linux/include/linux/segment.h Sun Nov 27 20:19:54 1994 @@ -1,10 +0,0 @@ -#ifndef _LINUX_SEGMENT_H -#define _LINUX_SEGMENT_H - -#define KERNEL_CS 0x10 -#define KERNEL_DS 0x18 - -#define USER_CS 0x23 -#define USER_DS 0x2B - -#endif diff -u --recursive --new-file v1.1.66/linux/include/linux/soundcard.h linux/include/linux/soundcard.h --- v1.1.66/linux/include/linux/soundcard.h Fri Aug 19 08:53:37 1994 +++ linux/include/linux/soundcard.h Sun Nov 27 20:19:54 1994 @@ -40,7 +40,7 @@ #define SOUND_VERSION 300 #define VOXWARE -#include +#include /* * Supported card ID numbers (Should be somewhere else?) diff -u --recursive --new-file v1.1.66/linux/include/linux/tcp.h linux/include/linux/tcp.h --- v1.1.66/linux/include/linux/tcp.h Sat May 7 14:12:57 1994 +++ linux/include/linux/tcp.h Mon Nov 28 07:32:13 1994 @@ -17,43 +17,52 @@ #ifndef _LINUX_TCP_H #define _LINUX_TCP_H +#include #define HEADER_SIZE 64 /* maximum header size */ struct tcphdr { - unsigned short source; - unsigned short dest; - unsigned long seq; - unsigned long ack_seq; + u16 source; + u16 dest; + u32 seq; + u32 ack_seq; #if defined(__i386__) - unsigned short res1:4, - doff:4, - fin:1, - syn:1, - rst:1, - psh:1, - ack:1, - urg:1, - res2:2; -#else -#if defined(__mc680x0__) - unsigned short res2:2, - urg:1, - ack:1, - psh:1, - rst:1, - syn:1, - fin:1, - doff:4, - res1:4; + u16 res1:4, + doff:4, + fin:1, + syn:1, + rst:1, + psh:1, + ack:1, + urg:1, + res2:2; +#elif defined(__mc680x0__) + u16 res2:2, + urg:1, + ack:1, + psh:1, + rst:1, + syn:1, + fin:1, + doff:4, + res1:4; +#elif defined(__alpha__) + u16 res1:4, + doff:4, + fin:1, + syn:1, + rst:1, + psh:1, + ack:1, + urg:1, + res2:2; #else #error "Adjust this structure for your cpu alignment rules" -#endif #endif - unsigned short window; - unsigned short check; - unsigned short urg_ptr; + u16 window; + u16 check; + u16 urg_ptr; }; diff -u --recursive --new-file v1.1.66/linux/include/linux/types.h linux/include/linux/types.h --- v1.1.66/linux/include/linux/types.h Fri Aug 26 13:09:49 1994 +++ linux/include/linux/types.h Mon Nov 28 07:15:43 1994 @@ -1,6 +1,8 @@ #ifndef _LINUX_TYPES_H #define _LINUX_TYPES_H +#include + #ifndef _SIZE_T #define _SIZE_T typedef unsigned int size_t; @@ -34,11 +36,7 @@ typedef unsigned short uid_t; typedef unsigned short gid_t; typedef unsigned short dev_t; -#ifdef OLD_LINUX -typedef unsigned short ino_t; -#else typedef unsigned long ino_t; -#endif typedef unsigned short mode_t; typedef unsigned short umode_t; typedef unsigned short nlink_t; diff -u --recursive --new-file v1.1.66/linux/include/linux/umsdos_fs.h linux/include/linux/umsdos_fs.h --- v1.1.66/linux/include/linux/umsdos_fs.h Sun Jul 24 22:27:55 1994 +++ linux/include/linux/umsdos_fs.h Sun Nov 27 20:21:20 1994 @@ -79,14 +79,12 @@ #define UMSDOS_INIT_EMD 1242 /* Create the EMD file if not there */ #define UMSDOS_DOS_SETUP 1243 /* Set the defaults of the MsDOS driver */ -#ifndef _SYS_STAT_H -#include -#endif +#include struct umsdos_ioctl{ struct dirent dos_dirent; struct umsdos_dirent umsdos_dirent; - struct stat stat; + struct new_stat stat; char version,release; }; diff -u --recursive --new-file v1.1.66/linux/kernel/bios32.c linux/kernel/bios32.c --- v1.1.66/linux/kernel/bios32.c Thu Oct 6 08:19:41 1994 +++ linux/kernel/bios32.c Sun Nov 27 20:19:54 1994 @@ -36,9 +36,10 @@ #include #include -#include #include #include + +#include /* * It would seem some PCI bioses are buggy, so we don't actually use these diff -u --recursive --new-file v1.1.66/linux/kernel/fork.c linux/kernel/fork.c --- v1.1.66/linux/kernel/fork.c Wed Nov 9 14:56:37 1994 +++ linux/kernel/fork.c Sun Nov 27 20:19:54 1994 @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff -u --recursive --new-file v1.1.66/linux/kernel/ksyms.c linux/kernel/ksyms.c --- v1.1.66/linux/kernel/ksyms.c Sat Nov 26 18:36:07 1994 +++ linux/kernel/ksyms.c Mon Nov 28 12:20:44 1994 @@ -128,6 +128,8 @@ X(blk_dev), X(is_read_only), X(set_device_ro), + X(bmap), + X(sync_dev), /* Module creation of serial units */ X(register_serial), diff -u --recursive --new-file v1.1.66/linux/kernel/module.c linux/kernel/module.c --- v1.1.66/linux/kernel/module.c Tue Aug 9 09:34:45 1994 +++ linux/kernel/module.c Mon Nov 28 12:20:44 1994 @@ -7,6 +7,10 @@ #include #include /* + * Originally by Anonymous (as far as I know...) + * Linux version by Bas Laarhoven + * 0.99.14 version by Jon Tombs , + * * Heavily modified by Bjorn Ekwall May 1994 (C) * This source is covered by the GNU GPL, the same as all kernel sources. * @@ -213,6 +217,7 @@ struct module_ref *ref; int size; int i; + int legal_start; if ((error = verify_area(VERIFY_READ, symtab, sizeof(int)))) return error; @@ -222,13 +227,33 @@ return -ENOMEM; } - if ((error = verify_area(VERIFY_READ, symtab, size))) + if ((error = verify_area(VERIFY_READ, symtab, size))) { + kfree_s(newtab, size); return error; + } memcpy_fromfs((char *)(newtab), symtab, size); + /* sanity check */ + legal_start = sizeof(struct symbol_table) + + newtab->n_symbols * sizeof(struct internal_symbol) + + newtab->n_refs * sizeof(struct module_ref); + + if ((newtab->n_symbols < 0) || (newtab->n_refs < 0) || + (legal_start > size)) { + printk("Illegal symbol table! Rejected!\n"); + kfree_s(newtab, size); + return -EINVAL; + } + /* relocate name pointers, index referred from start of table */ for (sym = &(newtab->symbol[0]), i = 0; i < newtab->n_symbols; ++sym, ++i) { + if ((int)sym->name < legal_start || size <= (int)sym->name) { + printk("Illegal symbol table! Rejected!\n"); + kfree_s(newtab, size); + return -EINVAL; + } + /* else */ sym->name += (long)newtab; } mp->symtab = newtab; @@ -236,10 +261,24 @@ /* Update module references. * On entry, from "insmod", ref->module points to * the referenced module! + * Now it will point to the current module instead! + * The ref structure becomes the first link in the linked + * list of references to the referenced module. * Also, "sym" from above, points to the first ref entry!!! */ for (ref = (struct module_ref *)sym, i = 0; i < newtab->n_refs; ++ref, ++i) { + + /* Check for valid reference */ + struct module *link = module_list; + while (link && (ref->module != link)) + link = link->next; + + if (link == (struct module *)0) { + printk("Non-module reference! Rejected!\n"); + return -EINVAL; + } + ref->next = ref->module->ref; ref->module->ref = ref; ref->module = mp; diff -u --recursive --new-file v1.1.66/linux/kernel/sched.c linux/kernel/sched.c --- v1.1.66/linux/kernel/sched.c Wed Nov 9 14:56:37 1994 +++ linux/kernel/sched.c Sun Nov 27 20:19:55 1994 @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff -u --recursive --new-file v1.1.66/linux/kernel/traps.c linux/kernel/traps.c --- v1.1.66/linux/kernel/traps.c Tue Aug 9 09:34:45 1994 +++ linux/kernel/traps.c Sun Nov 27 20:19:55 1994 @@ -15,7 +15,6 @@ #include #include #include -#include #include #include diff -u --recursive --new-file v1.1.66/linux/mm/memory.c linux/mm/memory.c --- v1.1.66/linux/mm/memory.c Tue Nov 22 15:41:14 1994 +++ linux/mm/memory.c Sun Nov 27 20:19:55 1994 @@ -33,9 +33,7 @@ * Idea by Alex Bligh (alex@cconcepts.co.uk) */ -#include #include - #include #include #include @@ -45,7 +43,8 @@ #include #include #include -#include + +#include #include /* diff -u --recursive --new-file v1.1.66/linux/net/inet/af_inet.c linux/net/inet/af_inet.c --- v1.1.66/linux/net/inet/af_inet.c Sat Nov 26 18:36:07 1994 +++ linux/net/inet/af_inet.c Sat Nov 26 17:22:06 1994 @@ -1307,12 +1307,6 @@ continue; score++; } - /* - * strange but true: udp sockets don't care that much - * about the remote address. - */ - if (prot == &udp_prot) - return s; /* remote address matches? */ if (s->daddr) { if (s->daddr != raddr) diff -u --recursive --new-file v1.1.66/linux/net/inet/sock.c linux/net/inet/sock.c --- v1.1.66/linux/net/inet/sock.c Sat Nov 26 18:36:07 1994 +++ linux/net/inet/sock.c Sat Nov 26 18:21:59 1994 @@ -504,7 +504,7 @@ /* * Make the backlog atomic. If we don't do this there is a tiny * window where a packet may arrive between the sk->blog being - * tested and then set with sk->inuse stil 0 causing an extra + * tested and then set with sk->inuse still 0 causing an extra * unwanted re-entry into release_sock(). */ diff -u --recursive --new-file v1.1.66/linux/net/inet/tcp.c linux/net/inet/tcp.c --- v1.1.66/linux/net/inet/tcp.c Sat Nov 26 18:36:08 1994 +++ linux/net/inet/tcp.c Sat Nov 26 21:54:49 1994 @@ -3100,8 +3100,8 @@ * the naive implementation: * after(new_seq,sk->acked_seq+1) * will cause bogus resets IFF a resend of a frame that has - * been queued but not yet read after a shutdown has been done - * occured.What we do now is a bit more complex but works as + * been queued but not yet read after a shutdown has been done. + * What we do now is a bit more complex but works as * follows. If the queue is empty copied_seq+1 is right (+1 for FIN) * if the queue has data the shutdown occurs at the right edge of * the last packet queued +1 @@ -4160,7 +4160,7 @@ if (!th->rst) { if (!th->ack) th->ack_seq = 0; - if(sk->debug) printk("Reset on closed socket %s.\n",sk->blog); + if(sk->debug) printk("Reset on closed socket %d.\n",sk->blog); tcp_reset(daddr, saddr, th, sk->prot, opt,dev,sk->ip_tos,sk->ip_ttl); } kfree_skb(skb, FREE_READ); @@ -4174,7 +4174,7 @@ return(0); } if (th->ack) { - printk("Reset on listening socket %d.\n",sk->blog); + if(sk->debug) printk("Reset on listening socket %d.\n",sk->blog); tcp_reset(daddr, saddr, th, sk->prot, opt,dev,sk->ip_tos,sk->ip_ttl); kfree_skb(skb, FREE_READ); release_sock(sk); diff -u --recursive --new-file v1.1.66/linux/zBoot/head.S linux/zBoot/head.S --- v1.1.66/linux/zBoot/head.S Wed Dec 1 14:44:15 1993 +++ linux/zBoot/head.S Sun Nov 27 20:19:55 1994 @@ -18,7 +18,8 @@ */ .text -#include +#define __ASSEMBLY__ +#include startup_32: cld diff -u --recursive --new-file v1.1.66/linux/zBoot/misc.c linux/zBoot/misc.c --- v1.1.66/linux/zBoot/misc.c Tue Aug 9 09:35:23 1994 +++ linux/zBoot/misc.c Sun Nov 27 20:19:55 1994 @@ -11,7 +11,7 @@ #include "gzip.h" #include "lzw.h" -#include +#include /* * These are set up by the setup-routine at boot-time: