From: Linus Torvalds Date: Fri, 23 Nov 2007 20:37:56 +0000 (-0500) Subject: Linux 2.4.0-test7pre2 X-Git-Tag: 2.4.0-test7pre2 X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=544f2c99bbea9501a8e411b0090d3187a4f2c104;p=history.git Linux 2.4.0-test7pre2 - fix modversions.h generation ("make -j dep" works now) - finish 64-bit VFS: getdents64 and fcntl64 (getdents64 also adds the "file type" to the readdir data - VFS layer change. fcntl64 allows 64-bit file locking) - Intel i810 watchdog driver and NS DP83810 network driver - dup2() cannot screw up the file table with threads any more. --- diff --git a/CREDITS b/CREDITS index 49ba8e308656..3c4a466a6fa8 100644 --- a/CREDITS +++ b/CREDITS @@ -740,6 +740,14 @@ S: Via Paolo VI n.29 S: 23900 - LECCO (Lc) S: Italy +N: Nils Faerber +E: nils@kernelconcepts.de +D: i810 TCO watchdog driver author +D: Mitsumi LU005 tests and fixes +S: Dreisbachstrasse 24 +S: D-57250 Netphen +S: Germany + N: Rik Faith E: faith@cs.unc.edu E: faith@acm.org @@ -2011,6 +2019,11 @@ W: http://www.speakeasy.org/~kirk/ D: implemented kmod D: modularized BSD Unix domain sockets +N: Mikael Pettersson +E: mikpe@csd.uu.se +W: http://www.csd.uu.se/~mikpe/ +D: Miscellaneous fixes + N: Reed H. Petty E: rhp@draper.net W: http://www.draper.net diff --git a/Documentation/Configure.help b/Documentation/Configure.help index 310172e91fe7..920f550ecfe1 100644 --- a/Documentation/Configure.help +++ b/Documentation/Configure.help @@ -8736,6 +8736,13 @@ CONFIG_NE2000 module, say M here and read Documentation/modules.txt as well as Documentation/networking/net-modules.txt. +National Semiconductor DP83810 series PCI Ethernet support +CONFIG_NATSEMI + This driver is for the National Semiconductor DP83810 series, + including the 83815 chip. + More specific information and updates are available from + http://www.scyld.com/network/natsemi.html + SK_G16 support CONFIG_SK_G16 If you have a network (Ethernet) card of this type, say Y and read diff --git a/Documentation/sound/Soundblaster b/Documentation/sound/Soundblaster index 515c4ec77c83..3276245ad52f 100644 --- a/Documentation/sound/Soundblaster +++ b/Documentation/sound/Soundblaster @@ -9,8 +9,8 @@ The Sound Blaster module takes the following arguments io I/O address of the Sound Blaster chip (0x220,0x240,0x260,0x280) irq IRQ of the Sound Blaster chip (5,7,9,10) -dma 8-bit DMA channel for the Sound Blaster (0,1,3) -dma16 16-bit DMA channel for SB16 and equivalent cards (5,6,7) +dma 8-bit DMA channel for the Sound Blaster (0,1,3) +dma16 16-bit DMA channel for SB16 and equivalent cards (5,6,7) mpu_io I/O for MPU chip if present (0x300,0x330) sm_games=1 Set if you have a Logitech soundman games @@ -21,11 +21,13 @@ type Use this to specify a specific card type The following arguments are taken if ISAPnP support is compiled in isapnp=0 Set this to disable ISAPnP detection (use io=0xXXX etc. above) -multiple=1 Set to enable detection of multiple Soundblaster cards. +multiple=0 Set to disable detection of multiple Soundblaster cards. + Consider it a bug if this option is needed, and send in a + report. reverse=1 Reverses the order of the search in the PnP table. uart401=1 Set to enable detection of mpu devices on some clones. -isapnpjump Jumps to a specific slot in the driver's PnP table. Use the - source, Luke. +isapnpjump=n Jumps to slot n in the driver's PnP table. Use the source, + Luke. You may well want to load the opl3 driver for synth music on most SB and clone SB devices diff --git a/Documentation/watchdog.txt b/Documentation/watchdog.txt index 893ead8a8bda..c035ad76cfdd 100644 --- a/Documentation/watchdog.txt +++ b/Documentation/watchdog.txt @@ -14,7 +14,7 @@ The following watchdog drivers are currently implemented: Berkshire Products PC Watchdog Revision A & C (by Ken Hollis) -All five interfaces provide /dev/watchdog, which when open must be written +All six interfaces provide /dev/watchdog, which when open must be written to within a timeout or the machine will reboot. Each write delays the reboot time another timeout. In the case of the software watchdog the ability to reboot will depend on the state of the machines and interrupts. The hardware @@ -35,17 +35,27 @@ to use "panic=60" as a boot argument as well. The wdt card cannot be safely probed for. Instead you need to pass wdt=ioaddr,irq as a boot parameter - eg "wdt=0x240,11". +The i810 TCO watchdog modules can be configured with the "i810_margin" +commandline argument which specifies the counter initial value. The counter +is decremented every 0.6 seconds and default to 50 (30 seconds). Values can +range between 3 and 63. + +The i810 TCO watchdog driver also implements the WDIOC_GETSTATUS and +WDIOC_GETBOOTSTATUS ioctl()s. WDIOC_GETSTATUS returns the actual counter value +and WDIOC_GETBOOTSTATUS returns the value of TCO2 Status Register (see Intel's +documentation for the 82801AA and 82801AB datasheet). + Features -------- - WDT501P WDT500P Software Berkshire -Reboot Timer X X X X -External Reboot X X o o -I/O Port Monitor o o o X -Temperature X o o X -Fan Speed X o o o -Power Under X o o o -Power Over X o o o -Overheat X o o o + WDT501P WDT500P Software Berkshire i810 TCO +Reboot Timer X X X X X +External Reboot X X o o o +I/O Port Monitor o o o X o +Temperature X o o X o +Fan Speed X o o o o +Power Under X o o o o +Power Over X o o o o +Overheat X o o o o The external event interfaces on the WDT boards are not currently supported. Minor numbers are however allocated for it. @@ -69,6 +79,7 @@ int main(int argc, const char *argv[]) while(1) { write(fd,"\0",1); + fsync(fd); sleep(10); } } diff --git a/MAINTAINERS b/MAINTAINERS index 22749ec2d031..d74d1596e37d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -496,6 +496,12 @@ M: rhw@memalpha.cx L: Linux-Kernel@vger.rutgers.edu S: Maintained +i810 TCO TIMER WATCHDOG +P: Nils Faerber +M: nils@kernelconcepts.de +W: http://www.kernelconcepts.de/ +S: Maintained + IBM MCA SCSI SUBSYSTEM DRIVER P: Michael Lang M: langa2@kph.uni-mainz.de diff --git a/Makefile b/Makefile index 490ed75c8411..c3d16e0b06cc 100644 --- a/Makefile +++ b/Makefile @@ -428,6 +428,9 @@ dep-files: scripts/mkdep archdep include/linux/version.h scripts/mkdep init/*.c > .depend scripts/mkdep `find $(FINDHPATH) -name SCCS -prune -o -follow -name \*.h ! -name modversions.h -print` > .hdepend $(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)" +ifdef CONFIG_MODVERSIONS + $(MAKE) update-modverfile +endif ifdef CONFIG_MODVERSIONS MODVERFILE := $(TOPDIR)/include/linux/modversions.h @@ -436,7 +439,7 @@ MODVERFILE := endif export MODVERFILE -depend dep: dep-files $(MODVERFILE) +depend dep: dep-files # make checkconfig: Prune 'scripts' directory to avoid "false positives". checkconfig: diff --git a/Rules.make b/Rules.make index c2d795f24185..599f8966c47f 100644 --- a/Rules.make +++ b/Rules.make @@ -208,8 +208,16 @@ $(MODINCL)/%.ver: %.c $(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o=.ver)): $(TOPDIR)/include/linux/autoconf.h -$(TOPDIR)/include/linux/modversions.h: $(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o=.ver)) - @echo updating $(TOPDIR)/include/linux/modversions.h +# updates .ver files but not modversions.h +fastdep: $(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o=.ver)) + +# updates .ver files and modversions.h like before (is this needed?) +dep: fastdep update-modverfile + +endif # SYMTAB_OBJS + +# update modversions.h, but only if it would change +update-modverfile: @(echo "#ifndef _LINUX_MODVERSIONS_H";\ echo "#define _LINUX_MODVERSIONS_H"; \ echo "#include "; \ @@ -218,11 +226,14 @@ $(TOPDIR)/include/linux/modversions.h: $(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o= if [ -f $$f ]; then echo "#include "; fi; \ done; \ echo "#endif"; \ - ) > $@ - -dep fastdep: $(TOPDIR)/include/linux/modversions.h - -endif # SYMTAB_OBJS + ) > $(TOPDIR)/include/linux/modversions.h.tmp + @if [ -r $(TOPDIR)/include/linux/modversions.h ] && cmp -s $(TOPDIR)/include/linux/modversions.h $(TOPDIR)/include/linux/modversions.h.tmp; then \ + echo $(TOPDIR)/include/linux/modversions.h was not updated; \ + rm -f $(TOPDIR)/include/linux/modversions.h.tmp; \ + else \ + echo $(TOPDIR)/include/linux/modversions.h was updated; \ + mv -f $(TOPDIR)/include/linux/modversions.h.tmp $(TOPDIR)/include/linux/modversions.h; \ + fi $(M_OBJS): $(TOPDIR)/include/linux/modversions.h ifdef MAKING_MODULES diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S index ac80051ed33e..7dda5b5662e0 100644 --- a/arch/alpha/kernel/entry.S +++ b/arch/alpha/kernel/entry.S @@ -1160,3 +1160,4 @@ sys_call_table: .quad sys_pivot_root .quad sys_mincore /* 375 */ .quad sys_pciconfig_iobase + .quad sys_getdents64 diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index 6102f22138db..4d574b824690 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c @@ -104,7 +104,8 @@ struct osf_dirent_callback { int error; }; -static int osf_filldir(void *__buf, const char *name, int namlen, off_t offset, ino_t ino) +static int osf_filldir(void *__buf, const char *name, int namlen, off_t offset, + ino_t ino, unsigned int d_type) { struct osf_dirent *dirent; struct osf_dirent_callback *buf = (struct osf_dirent_callback *) __buf; diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S index 0db6d0fde0d2..eee31eeae12f 100644 --- a/arch/arm/kernel/calls.S +++ b/arch/arm/kernel/calls.S @@ -226,8 +226,9 @@ .long SYMBOL_NAME(sys_setgid) /* 215 */ .long SYMBOL_NAME(sys_setfsuid) .long SYMBOL_NAME(sys_setfsgid) + .long SYMBOL_NAME(sys_getdents64) - .rept NR_syscalls-216 + .rept NR_syscalls-217 .long SYMBOL_NAME(sys_ni_syscall) .endr #endif diff --git a/arch/i386/defconfig b/arch/i386/defconfig index 38dd1d25154c..90560a36ccd3 100644 --- a/arch/i386/defconfig +++ b/arch/i386/defconfig @@ -353,6 +353,7 @@ CONFIG_NET_PCI=y # CONFIG_TULIP is not set # CONFIG_DGRS is not set CONFIG_EEPRO100=y +# CONFIG_NATSEMI is not set # CONFIG_NE2K_PCI is not set # CONFIG_8139TOO is not set # CONFIG_SIS900 is not set diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S index 337879b63352..fb9b7b2ea5ec 100644 --- a/arch/i386/kernel/entry.S +++ b/arch/i386/kernel/entry.S @@ -641,7 +641,8 @@ ENTRY(sys_call_table) .long SYMBOL_NAME(sys_pivot_root) .long SYMBOL_NAME(sys_mincore) .long SYMBOL_NAME(sys_madvise) - + .long SYMBOL_NAME(sys_getdents64) /* 220 */ + .long SYMBOL_NAME(sys_fcntl64) /* * NOTE!! This doesn't have to be exact - we just have @@ -649,6 +650,6 @@ ENTRY(sys_call_table) * entries. Don't panic if you notice that this hasn't * been shrunk every time we add a new system call. */ - .rept NR_syscalls-219 + .rept NR_syscalls-221 .long SYMBOL_NAME(sys_ni_syscall) .endr diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c index cbec84f2b0d7..c051082e92a1 100644 --- a/arch/ia64/ia32/sys_ia32.c +++ b/arch/ia64/ia32/sys_ia32.c @@ -711,7 +711,8 @@ struct readdir32_callback { }; static int -filldir32 (void *__buf, const char *name, int namlen, off_t offset, ino_t ino) +filldir32 (void *__buf, const char *name, int namlen, off_t offset, ino_t ino, + unsigned int d_type) { struct linux32_dirent * dirent; struct getdents32_callback * buf = (struct getdents32_callback *) __buf; diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index f9beac21d769..43c99ca062bb 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S @@ -1207,7 +1207,7 @@ sys_call_table: data8 sys_newlstat data8 sys_newfstat data8 sys_clone2 - data8 ia64_ni_syscall + data8 sys_getdents64 data8 ia64_ni_syscall // 1215 data8 ia64_ni_syscall data8 ia64_ni_syscall diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S index 7cbb69d03395..165809c56563 100644 --- a/arch/m68k/kernel/entry.S +++ b/arch/m68k/kernel/entry.S @@ -629,6 +629,10 @@ SYMBOL_NAME_LABEL(sys_call_table) .long SYMBOL_NAME(sys_setgid) .long SYMBOL_NAME(sys_setfsuid) /* 215 */ .long SYMBOL_NAME(sys_setfsgid) + .long SYMBOL_NAME(sys_ni_syscall) + .long SYMBOL_NAME(sys_ni_syscall) + .long SYMBOL_NAME(sys_ni_syscall) + .long SYMBOL_NAME(sys_getdents64) /* 220 */ .rept NR_syscalls-(.-SYMBOL_NAME(sys_call_table))/4 .long SYMBOL_NAME(sys_ni_syscall) diff --git a/arch/mips/kernel/syscalls.h b/arch/mips/kernel/syscalls.h index e1720d46e3bf..4a8088b8afbf 100644 --- a/arch/mips/kernel/syscalls.h +++ b/arch/mips/kernel/syscalls.h @@ -234,3 +234,4 @@ SYS(sys_fstat64, 3) /* 4215 */ SYS(sys_pivot_root, 2) SYS(sys_mincore, 3) SYS(sys_madvise, 3) +SYS(sys_getdents64, 3) diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c index 817e9c1ee621..82c95177f64e 100644 --- a/arch/mips/kernel/sysirix.c +++ b/arch/mips/kernel/sysirix.c @@ -1847,7 +1847,7 @@ struct irix_dirent32_callback { #define ROUND_UP32(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1)) static int irix_filldir32(void *__buf, const char *name, int namlen, - off_t offset, ino_t ino) + off_t offset, ino_t ino, unsigned int d_type) { struct irix_dirent32 *dirent; struct irix_dirent32_callback *buf = @@ -1943,7 +1943,7 @@ struct irix_dirent64_callback { #define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1)) static int irix_filldir64(void * __buf, const char * name, int namlen, - off_t offset, ino_t ino) + off_t offset, ino_t ino, unsigned int d_type) { struct irix_dirent64 *dirent; struct irix_dirent64_callback * buf = diff --git a/arch/mips64/kernel/scall_64.S b/arch/mips64/kernel/scall_64.S index 2e65e1732443..bcabf8f7e059 100644 --- a/arch/mips64/kernel/scall_64.S +++ b/arch/mips64/kernel/scall_64.S @@ -344,3 +344,4 @@ sys_call_table: PTR sys_pivot_root /* 4210 */ PTR sys_mincore PTR sys_madvise + PTR sys_getdents64 diff --git a/arch/mips64/kernel/scall_o32.S b/arch/mips64/kernel/scall_o32.S index 2d7782d11a63..57f7c685fac5 100644 --- a/arch/mips64/kernel/scall_o32.S +++ b/arch/mips64/kernel/scall_o32.S @@ -420,6 +420,7 @@ illegal_syscall: sys sys_pivot_root 2 sys sys_mincore 3 sys sys_madvise 3 + sys sys_getdents64 3 .endm .macro sys function, nargs diff --git a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S index 19a218bd4967..081dda7f35ac 100644 --- a/arch/ppc/kernel/misc.S +++ b/arch/ppc/kernel/misc.S @@ -1216,6 +1216,7 @@ _GLOBAL(sys_call_table) .long sys_pciconfig_write /* 199 */ .long sys_pciconfig_iobase /* 200 */ .long sys_ni_syscall /* 201 - reserved - MacOnLinux - new */ + .long sys_getdents64 /* 202 */ .rept NR_syscalls-201 .long sys_ni_syscall .endr diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S index 9913d5967fc5..e39e186231ca 100644 --- a/arch/s390/kernel/entry.S +++ b/arch/s390/kernel/entry.S @@ -603,7 +603,8 @@ sys_call_table: .long sys_pivot_root .long sys_mincore .long sys_madvise - .rept 255-219 + .long sys_getdents64 /* 220 */ + .rept 255-220 .long sys_ni_syscall .endr diff --git a/arch/sh/kernel/entry.S b/arch/sh/kernel/entry.S index 4e57175e76aa..7335803da8f6 100644 --- a/arch/sh/kernel/entry.S +++ b/arch/sh/kernel/entry.S @@ -1106,6 +1106,7 @@ ENTRY(sys_call_table) .long SYMBOL_NAME(sys_pivot_root) .long SYMBOL_NAME(sys_mincore) .long SYMBOL_NAME(sys_madvise) + .long SYMBOL_NAME(sys_getdents64) /* 220 */ /* * NOTE!! This doesn't have to be exact - we just have @@ -1113,7 +1114,7 @@ ENTRY(sys_call_table) * entries. Don't panic if you notice that this hasn't * been shrunk every time we add a new system call. */ - .rept NR_syscalls-219 + .rept NR_syscalls-220 .long SYMBOL_NAME(sys_ni_syscall) .endr diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c index 8e95ce0ed72a..dde73f4cfcfa 100644 --- a/arch/sparc/kernel/sys_sunos.c +++ b/arch/sparc/kernel/sys_sunos.c @@ -322,7 +322,7 @@ struct sunos_dirent_callback { #define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1)) static int sunos_filldir(void * __buf, const char * name, int namlen, - off_t offset, ino_t ino) + off_t offset, ino_t ino, unsigned int d_type) { struct sunos_dirent * dirent; struct sunos_dirent_callback * buf = (struct sunos_dirent_callback *) __buf; @@ -403,7 +403,7 @@ struct sunos_direntry_callback { }; static int sunos_filldirentry(void * __buf, const char * name, int namlen, - off_t offset, ino_t ino) + off_t offset, ino_t ino, unsigned int d_type) { struct sunos_direntry * dirent; struct sunos_direntry_callback * buf = (struct sunos_direntry_callback *) __buf; diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S index 5bb551a46ba2..81ade3f9824e 100644 --- a/arch/sparc/kernel/systbls.S +++ b/arch/sparc/kernel/systbls.S @@ -48,7 +48,7 @@ sys_call_table: /*135*/ .long sys_nis_syscall, sys_mkdir, sys_rmdir, sys_utimes, sys_stat64 /*140*/ .long sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_getrlimit /*145*/ .long sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write -/*150*/ .long sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_nis_syscall +/*150*/ .long sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64 /*155*/ .long sys_nis_syscall, sys_nis_syscall, sys_statfs, sys_fstatfs, sys_oldumount /*160*/ .long sys_nis_syscall, sys_nis_syscall, sys_getdomainname, sys_setdomainname, sys_nis_syscall /*165*/ .long sys_quotactl, sys_nis_syscall, sys_mount, sys_ustat, sys_nis_syscall diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c index e77d8a3856d7..e84155b067d9 100644 --- a/arch/sparc64/kernel/sys_sparc32.c +++ b/arch/sparc64/kernel/sys_sparc32.c @@ -1235,7 +1235,8 @@ struct getdents_callback32 { int error; }; -static int filldir(void * __buf, const char * name, int namlen, off_t offset, ino_t ino) +static int filldir(void * __buf, const char * name, int namlen, off_t offset, ino_t ino, + unsigned int d_type) { struct linux_dirent32 * dirent; struct getdents_callback32 * buf = (struct getdents_callback32 *) __buf; diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c index 9015a2fec8c7..449f6fd8ba83 100644 --- a/arch/sparc64/kernel/sys_sunos32.c +++ b/arch/sparc64/kernel/sys_sunos32.c @@ -277,7 +277,7 @@ struct sunos_dirent_callback { #define ROUND_UP(x) (((x)+sizeof(s32)-1) & ~(sizeof(s32)-1)) static int sunos_filldir(void * __buf, const char * name, int namlen, - off_t offset, ino_t ino) + off_t offset, ino_t ino, unsigned int d_type) { struct sunos_dirent * dirent; struct sunos_dirent_callback * buf = (struct sunos_dirent_callback *) __buf; @@ -359,7 +359,7 @@ struct sunos_direntry_callback { }; static int sunos_filldirentry(void * __buf, const char * name, int namlen, - off_t offset, ino_t ino) + off_t offset, ino_t ino, unsigned int d_type) { struct sunos_direntry * dirent; struct sunos_direntry_callback * buf = (struct sunos_direntry_callback *) __buf; diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S index f73486541838..c090ccac88f3 100644 --- a/arch/sparc64/kernel/systbls.S +++ b/arch/sparc64/kernel/systbls.S @@ -49,7 +49,7 @@ sys_call_table32: .word sys_nis_syscall, sys_mkdir, sys_rmdir, sys32_utimes, sys_stat64 /*140*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys32_getrlimit .word sys32_setrlimit, sys_pivot_root, sys32_prctl, sys32_pciconfig_read, sys32_pciconfig_write -/*150*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_nis_syscall +/*150*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64 .word sys_nis_syscall, sys_nis_syscall, sys32_statfs, sys32_fstatfs, sys_oldumount /*160*/ .word sys_nis_syscall, sys_nis_syscall, sys_getdomainname, sys_setdomainname, sys_nis_syscall .word sys32_quotactl, sys_nis_syscall, sys32_mount, sys_ustat, sys_nis_syscall @@ -108,7 +108,7 @@ sys_call_table: .word sys_socketpair, sys_mkdir, sys_rmdir, sys_utimes, sys_nis_syscall /*140*/ .word sys_nis_syscall, sys_getpeername, sys_nis_syscall, sys_nis_syscall, sys_getrlimit .word sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write -/*150*/ .word sys_getsockname, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_nis_syscall +/*150*/ .word sys_getsockname, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64 .word sys_nis_syscall, sys_nis_syscall, sys_statfs, sys_fstatfs, sys_oldumount /*160*/ .word sys_nis_syscall, sys_nis_syscall, sys_getdomainname, sys_setdomainname, sys_utrap_install .word sys_quotactl, sys_nis_syscall, sys_mount, sys_ustat, sys_nis_syscall diff --git a/drivers/char/Config.in b/drivers/char/Config.in index 630a642c63be..fd0486f34594 100644 --- a/drivers/char/Config.in +++ b/drivers/char/Config.in @@ -124,8 +124,9 @@ if [ "$CONFIG_WATCHDOG" != "n" ]; then tristate ' Software Watchdog' CONFIG_SOFT_WATCHDOG tristate ' Berkshire Products PC Watchdog' CONFIG_PCWATCHDOG tristate ' Acquire SBC Watchdog Timer' CONFIG_ACQUIRE_WDT - tristate ' SBC-60XX Watchdog Timer' CONFIG_60XX_WDT + tristate ' SBC-60XX Watchdog Timer' CONFIG_60XX_WDT tristate ' Mixcom Watchdog' CONFIG_MIXCOMWD + tristate ' Intel i810 TCO timer / Watchdog' CONFIG_I810_TCO if [ "$CONFIG_FOOTBRIDGE" = "y" ]; then tristate ' DC21285 watchdog' CONFIG_21285_WATCHDOG if [ "$CONFIG_ARCH_NETWINDER" = "y" ]; then diff --git a/drivers/char/Makefile b/drivers/char/Makefile index a83719fb7123..c47164131eab 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile @@ -179,6 +179,7 @@ obj-$(CONFIG_VIDEO_DEV) += videodev.o obj-$(CONFIG_21285_WATCHDOG) += wdt285.o obj-$(CONFIG_977_WATCHDOG) += wdt977.o +obj-$(CONFIG_I810_TCO) += i810-tco.o obj-$(CONFIG_DS1620) += ds1620.o obj-$(CONFIG_INTEL_RNG) += i810_rng.o diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c index 01eb20e9202f..6ceb5a152637 100644 --- a/drivers/char/generic_serial.c +++ b/drivers/char/generic_serial.c @@ -12,7 +12,12 @@ * Version 0.1 -- December, 1998. Initial version. * Version 0.2 -- March, 1999. Some more routines. Bugfixes. Etc. * Version 0.5 -- August, 1999. Some more fixes. Reformat for Linus. - */ + * + * BitWizard is actively maintaining this file. We sometimes find + * that someone submitted changes to this file. We really appreciate + * your help, but please submit changes through us. We're doing our + * best to be responsive. -- REW + * */ #include #include @@ -80,10 +85,18 @@ static void my_hd (unsigned char *addr, int len) void gs_put_char(struct tty_struct * tty, unsigned char ch) { - struct gs_port *port = tty->driver_data; + struct gs_port *port; DECL - /* func_enter (); */ + func_enter (); + + if (!tty) return; + + port = tty->driver_data; + + if (!port) return; + + if (! (port->flags & ASYNC_INITIALIZED)) return; /* Take a lock on the serial tranmit buffer! */ LOCKIT; @@ -99,7 +112,7 @@ void gs_put_char(struct tty_struct * tty, unsigned char ch) port->xmit_cnt++; /* Characters in buffer */ RELEASEIT; - /* func_exit ();*/ + func_exit (); } @@ -115,11 +128,17 @@ void gs_put_char(struct tty_struct * tty, unsigned char ch) int gs_write(struct tty_struct * tty, int from_user, const unsigned char *buf, int count) { - struct gs_port *port = tty->driver_data; + struct gs_port *port; int c, total = 0; int t; - /* func_enter (); */ + func_enter (); + + if (!tty) return 0; + + port = tty->driver; + + if (!port) return 0; if (! (port->flags & ASYNC_INITIALIZED)) return 0; @@ -170,7 +189,7 @@ int gs_write(struct tty_struct * tty, int from_user, port->flags |= GS_TX_INTEN; port->rd->enable_tx_interrupts (port); } - /* func_exit (); */ + func_exit (); return total; } #else @@ -309,11 +328,11 @@ int gs_write_room(struct tty_struct * tty) struct gs_port *port = tty->driver_data; int ret; - /* func_enter (); */ + func_enter (); ret = SERIAL_XMIT_SIZE - port->xmit_cnt - 1; if (ret < 0) ret = 0; - /* func_exit (); */ + func_exit (); return ret; } @@ -361,7 +380,7 @@ static int gs_wait_tx_flushed (void * ptr, int timeout) if (!port || port->xmit_cnt < 0 || !port->xmit_buf) { gs_dprintk (GS_DEBUG_FLUSH, "ERROR: !port, !port->xmit_buf or prot->xmit_cnt < 0.\n"); - func_exit(); + func_exit(); return -EINVAL; /* This is an error which we don't know how to handle. */ } @@ -399,7 +418,7 @@ static int gs_wait_tx_flushed (void * ptr, int timeout) gs_dprintk (GS_DEBUG_FLUSH, "Expect to finish in %d jiffies " "(%d chars).\n", jiffies_to_transmit, charsleft); - current->state = TASK_INTERRUPTIBLE; + set_current_state (TASK_INTERRUPTIBLE); schedule_timeout(jiffies_to_transmit); if (signal_pending (current)) { gs_dprintk (GS_DEBUG_FLUSH, "Signal pending. Bombing out: "); @@ -409,7 +428,7 @@ static int gs_wait_tx_flushed (void * ptr, int timeout) } gs_dprintk (GS_DEBUG_FLUSH, "charsleft = %d.\n", charsleft); - current->state = TASK_RUNNING; + set_current_state (TASK_RUNNING); func_exit(); return rv; @@ -419,10 +438,17 @@ static int gs_wait_tx_flushed (void * ptr, int timeout) void gs_flush_buffer(struct tty_struct *tty) { - struct gs_port *port = tty->driver_data; + struct gs_port *port; unsigned long flags; func_enter (); + + if (!tty) return; + + port = tty->driver_data; + + if (!port) return; + /* XXX Would the write semaphore do? */ save_flags(flags); cli(); port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; @@ -438,9 +464,16 @@ void gs_flush_buffer(struct tty_struct *tty) void gs_flush_chars(struct tty_struct * tty) { - struct gs_port *port = tty->driver_data; + struct gs_port *port; func_enter (); + + if (!tty) return; + + port = tty->driver_data; + + if (!port) return; + if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || !port->xmit_buf) { func_exit (); @@ -456,9 +489,16 @@ void gs_flush_chars(struct tty_struct * tty) void gs_stop(struct tty_struct * tty) { - struct gs_port *port = tty->driver_data; + struct gs_port *port; func_enter (); + + if (!tty) return; + + port = tty->driver_data; + + if (!port) return; + if (port->xmit_cnt && port->xmit_buf && (port->flags & GS_TX_INTEN) ) { @@ -471,7 +511,13 @@ void gs_stop(struct tty_struct * tty) void gs_start(struct tty_struct * tty) { - struct gs_port *port = tty->driver_data; + struct gs_port *port; + + if (!tty) return; + + port = tty->driver_data; + + if (!port) return; if (port->xmit_cnt && port->xmit_buf && @@ -486,7 +532,11 @@ void gs_start(struct tty_struct * tty) void gs_shutdown_port (struct gs_port *port) { long flags; + func_enter(); + + if (!port) return; + if (!(port->flags & ASYNC_INITIALIZED)) return; @@ -505,16 +555,20 @@ void gs_shutdown_port (struct gs_port *port) port->flags &= ~ASYNC_INITIALIZED; restore_flags (flags); + func_exit(); } void gs_hangup(struct tty_struct *tty) { - struct gs_port *port = tty->driver_data; + struct gs_port *port; func_enter (); + if (!tty) return; + + port = tty->driver_data; tty = port->tty; if (!tty) return; @@ -534,8 +588,13 @@ void gs_do_softint(void *private_) struct gs_port *port = private_; struct tty_struct *tty; + func_enter (); + + if (!port) return; + tty = port->tty; - if(!tty) return; + + if (!tty) return; if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &port->event)) { if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && @@ -557,8 +616,13 @@ int block_til_ready(void *port_, struct file * filp) struct tty_struct *tty; func_enter (); + + if (!port) return 0; + tty = port->tty; + if (!tty) return 0; + gs_dprintk (GS_DEBUG_BTR, "Entering block_till_ready.\n"); /* * If the device is in the middle of being closed, then block @@ -571,6 +635,7 @@ int block_til_ready(void *port_, struct file * filp) else return -ERESTARTSYS; } + gs_dprintk (GS_DEBUG_BTR, "after hung up\n"); /* @@ -593,6 +658,7 @@ int block_til_ready(void *port_, struct file * filp) } gs_dprintk (GS_DEBUG_BTR, "after subtype\n"); + /* * If non-blocking mode is set, or the port is not enabled, * then make the check up front and then exit. @@ -606,6 +672,7 @@ int block_til_ready(void *port_, struct file * filp) } gs_dprintk (GS_DEBUG_BTR, "after nonblock\n"); + if (port->flags & ASYNC_CALLOUT_ACTIVE) { if (port->normal_termios.c_cflag & CLOCAL) do_clocal = 1; @@ -614,7 +681,6 @@ int block_til_ready(void *port_, struct file * filp) do_clocal = 1; } - gs_dprintk (GS_DEBUG_BTR, "after clocal check.\n"); /* * Block waiting for the carrier detect and the line to become * free (i.e., not in use by the callout). While we are in @@ -623,9 +689,9 @@ int block_til_ready(void *port_, struct file * filp) * exit, either normal or abnormal. */ retval = 0; - + add_wait_queue(&port->open_wait, &wait); - + gs_dprintk (GS_DEBUG_BTR, "after add waitq.\n"); cli(); if (!tty_hung_up_p(filp)) @@ -635,7 +701,7 @@ int block_til_ready(void *port_, struct file * filp) while (1) { CD = port->rd->get_CD (port); gs_dprintk (GS_DEBUG_BTR, "CD is now %d.\n", CD); - set_current_state(TASK_INTERRUPTIBLE); + set_current_state (TASK_INTERRUPTIBLE); if (tty_hung_up_p(filp) || !(port->flags & ASYNC_INITIALIZED)) { if (port->flags & ASYNC_HUP_NOTIFY) @@ -679,12 +745,11 @@ void gs_close(struct tty_struct * tty, struct file * filp) func_enter (); + if (!tty) return; + port = (struct gs_port *) tty->driver_data; - if(! port) { - func_exit(); - return; - } + if (!port) return; if (!port->tty) { /* This seems to happen when this is called from vhangup. */ @@ -693,6 +758,7 @@ void gs_close(struct tty_struct * tty, struct file * filp) } save_flags(flags); cli(); + if (tty_hung_up_p(filp)) { restore_flags(flags); port->rd->hungup (port); @@ -761,7 +827,7 @@ void gs_close(struct tty_struct * tty, struct file * filp) if (port->blocked_open) { if (port->close_delay) { - current->state = TASK_INTERRUPTIBLE; + set_current_state (TASK_INTERRUPTIBLE); schedule_timeout(port->close_delay); } wake_up_interruptible(&port->open_wait); @@ -784,14 +850,19 @@ static unsigned int gs_baudrates[] = { void gs_set_termios (struct tty_struct * tty, struct termios * old_termios) { - struct gs_port *port = tty->driver_data; + struct gs_port *port; int baudrate, tmp, rv; struct termios *tiosp; func_enter(); - tiosp = tty->termios; + if (!tty) return; + + port = tty->driver_data; + if (!port) return; + + tiosp = tty->termios; if (gs_debug & GS_DEBUG_TERMIOS) { gs_dprintk (GS_DEBUG_TERMIOS, "termios structure (%p):\n", tiosp); diff --git a/drivers/char/i810-tco.c b/drivers/char/i810-tco.c new file mode 100644 index 000000000000..fcd105d35c58 --- /dev/null +++ b/drivers/char/i810-tco.c @@ -0,0 +1,326 @@ +/* + * i810-tco 0.02: TCO timer driver for i810 chipsets + * + * (c) Copyright 2000 kernel concepts , All Rights Reserved. + * http://www.kernelconcepts.de + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Neither kernel concepts nor Nils Faerber admit liability nor provide + * warranty for any of this software. This material is provided + * "AS-IS" and at no charge. + * + * (c) Copyright 2000 kernel concepts + * developed for + * Jentro AG, Haar/Munich (Germany) + * + * TCO timer driver for i810/i815 chipsets + * based on softdog.c by Alan Cox + * + * The TCO timer is implemented in the 82801AA (82801AB) chip, + * see intel documentation from http://developer.intel.com, + * order number 290655-003 + * + * 20000710 Nils Faerber + * Initial Version 0.01 + * 20000728 Nils Faerber + * 0.02 Fix for SMI_EN->TCO_EN bit, some cleanups + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "i810-tco.h" + + +/* Just in case that the PCI vendor and device IDs are not yet defined */ +#ifndef PCI_DEVICE_ID_INTEL_82801AA_0 +#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 +#endif + +/* Default expire timeout */ +#define TIMER_MARGIN 50 /* steps of 0.6sec, 2 0x3f || tmrval < 0x03) + return -1; + + val = inb (TCO1_TMR); + val &= 0xc0; + val |= tmrval; + outb (val, TCO1_TMR); + val = inb (TCO1_TMR); + if ((val & 0x3f) != tmrval) + return -1; + + return 0; +} + +/* + * Reload (trigger) the timer + */ +static void tco_timer_reload (void) +{ + outb (0x01, TCO1_RLD); +} + +/* + * Read the current timer value + */ +static unsigned char tco_timer_read (void) +{ + return (inb (TCO1_RLD)); +} + + +/* + * Allow only one person to hold it open + */ + +static int i810tco_open (struct inode *inode, struct file *file) +{ + if (timer_alive) + return -EBUSY; + + /* + * Reload and activate timer + */ + tco_timer_reload (); + tco_timer_start (); + timer_alive = 1; + return 0; +} + +static int i810tco_release (struct inode *inode, struct file *file) +{ + /* + * Shut off the timer. + */ + tco_timer_stop (); + timer_alive = 0; + return 0; +} + +static ssize_t i810tco_write (struct file *file, const char *data, + size_t len, loff_t * ppos) +{ + /* Can't seek (pwrite) on this device */ + if (ppos != &file->f_pos) + return -ESPIPE; + + /* + * Refresh the timer. + */ + if (len) { + tco_timer_reload (); + return 1; + } + return 0; +} + +static int i810tco_ioctl (struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg) +{ + static struct watchdog_info ident = { + 0, + 0, + "i810 TCO timer" + }; + switch (cmd) { + default: + return -ENOIOCTLCMD; + case WDIOC_GETSUPPORT: + if (copy_to_user + ((struct watchdog_info *) arg, &ident, sizeof (ident))) + return -EFAULT; + return 0; + case WDIOC_GETSTATUS: + return put_user (tco_timer_read (), + (unsigned int *) (int) arg); + case WDIOC_GETBOOTSTATUS: + return put_user (boot_status, (int *) arg); + case WDIOC_KEEPALIVE: + tco_timer_reload (); + return 0; + } +} + +static struct pci_dev *i810tco_pci; + +static unsigned char i810tco_getdevice (void) +{ + u8 val1, val2; + u16 badr; + /* + * Find the PCI device which has vendor id 0x8086 + * and device ID 0x2410 + */ + i810tco_pci = pci_find_device (PCI_VENDOR_ID_INTEL, + PCI_DEVICE_ID_INTEL_82801AA_0, NULL); + if (i810tco_pci) { + /* + * Find the ACPI base I/O address which is the base + * for the TCO registers (TCOBASE=ACPIBASE + 0x60) + * ACPIBASE is bits [15:7] from 0x40-0x43 + */ + pci_read_config_byte (i810tco_pci, 0x40, &val1); + pci_read_config_byte (i810tco_pci, 0x41, &val2); + badr = ((val2 << 1) | (val1 >> 7)) << 7; + ACPIBASE = badr; + /* Something's wrong here, ACPIBASE has to be set */ + if (badr == 0x0001 || badr == 0x0000) { + printk (KERN_ERR "i810tco init: failed to get TCOBASE address\n"); + return 0; + } + /* + * Check chipset's NO_REBOOT bit + */ + pci_read_config_byte (i810tco_pci, 0xd4, &val1); + if (val1 & 0x02) { + val1 &= 0xfd; + pci_write_config_byte (i810tco_pci, 0xd4, val1); + pci_read_config_byte (i810tco_pci, 0xd4, &val1); + if (val1 & 0x02) { + printk (KERN_ERR "i810tco init: failed to reset NO_REBOOT flag\n"); + return 0; /* Cannot reset NO_REBOOT bit */ + } + } + /* Set the TCO_EN bit in SMI_EN register */ + val1 = inb (SMI_EN + 1); + val1 &= 0xdf; + outb (val1, SMI_EN + 1); + /* Clear out the (probably old) status */ + outb (0, TCO1_STS); + boot_status = (int) inb (TCO2_STS); + outb (3, TCO2_STS); + return 1; + } + return 0; +} + +static struct file_operations i810tco_fops = { + owner: THIS_MODULE, + write: i810tco_write, + ioctl: i810tco_ioctl, + open: i810tco_open, + release: i810tco_release, +}; + +static struct miscdevice i810tco_miscdev = { + WATCHDOG_MINOR, + "watchdog", + &i810tco_fops +}; + +static int __init watchdog_init (void) +{ + if (!i810tco_getdevice () || i810tco_pci == NULL) + return -ENODEV; + if (!request_region (TCOBASE, 0x10, "i810 TCO")) { + printk (KERN_ERR + "i810 TCO timer: I/O address 0x%04x already in use\n", + TCOBASE); + return -EIO; + } + if (misc_register (&i810tco_miscdev) != 0) { + release_region (TCOBASE, 0x10); + printk (KERN_ERR "i810 TCO timer: cannot register miscdev\n"); + return -EIO; + } + tco_timer_settimer ((unsigned char) i810_margin); + tco_timer_reload (); + + /* FIXME: no floating point math */ + printk (KERN_INFO + "i810 TCO timer: V0.02, timer margin: %d sec (0x%04x)\n", + (int) (i810_margin * 0.6), TCOBASE); + return 0; +} + +static void __exit watchdog_cleanup (void) +{ + u8 val; + + /* Reset the timer before we leave */ + tco_timer_reload (); + /* Set the NO_REBOOT bit to prevent later reboots, just for sure */ + pci_read_config_byte (i810tco_pci, 0xd4, &val); + val |= 0x02; + pci_write_config_byte (i810tco_pci, 0xd4, val); + release_region (TCOBASE, 0x10); + misc_deregister (&i810tco_miscdev); +} + +module_init(watchdog_init); +module_exit(watchdog_cleanup); diff --git a/drivers/char/i810-tco.h b/drivers/char/i810-tco.h new file mode 100644 index 000000000000..a078ae8f6e81 --- /dev/null +++ b/drivers/char/i810-tco.h @@ -0,0 +1,45 @@ +/* + * i810-tco 0.02: TCO timer driver for i810 chipsets + * + * (c) Copyright 2000 kernel concepts , All Rights Reserved. + * http://www.kernelconcepts.de + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Neither kernel concepts nor Nils Faerber admit liability nor provide + * warranty for any of this software. This material is provided + * "AS-IS" and at no charge. + * + * (c) Copyright 2000 kernel concepts + * developed for + * Jentro AG, Haar/Munich (Germany) + * + * TCO timer driver for i810 chipsets + * based on softdog.c by Alan Cox + * + * The TCO timer is implemented in the 82801AA (82801AB) chip, + * see intel documentation from http://developer.intel.com, + * order number 290655-003 + * + * For history see i810-tco.c + */ + + +/* + * Some address definitions for the i810 TCO + */ + +#define TCOBASE ACPIBASE + 0x60 /* TCO base address */ +#define TCO1_RLD TCOBASE + 0x00 /* TCO Timer Reload and Current Value */ +#define TCO1_TMR TCOBASE + 0x01 /* TCO Timer Initial Value */ +#define TCO1_DAT_IN TCOBASE + 0x02 /* TCO Data In Register */ +#define TCO1_DAT_OUT TCOBASE + 0x03 /* TCO Data Out Register */ +#define TCO1_STS TCOBASE + 0x04 /* TCO1 Status Register */ +#define TCO2_STS TCOBASE + 0x06 /* TCO2 Status Register */ +#define TCO1_CNT TCOBASE + 0x08 /* TCO1 Control Register */ +#define TCO2_CNT TCOBASE + 0x0a /* TCO2 Control Register */ + +#define SMI_EN ACPIBASE + 0x30 /* SMI Control and Enable Register */ diff --git a/drivers/char/rio/linux_compat.h b/drivers/char/rio/linux_compat.h index 3b6d2f3b1a93..ca1649f1efb3 100644 --- a/drivers/char/rio/linux_compat.h +++ b/drivers/char/rio/linux_compat.h @@ -72,8 +72,6 @@ struct ttystatics { extern int rio_debug; -#define rio_dprint(f, p) do {if (rio_debug & f) printk p;} while (0) - #define RIO_DEBUG_INIT 0x000001 #define RIO_DEBUG_BOOT 0x000002 #define RIO_DEBUG_CMD 0x000004 @@ -92,7 +90,7 @@ extern int rio_debug; #define RIO_DEBUG_REC 0x008000 #define RIO_DEBUG_SPINLOCK 0x010000 #define RIO_DEBUG_DELAY 0x020000 - +#define RIO_DEBUG_MOD_COUNT 0x040000 /* Copied over from riowinif.h . This is ugly. The winif file declares also much other stuff which is incompatible with the headers from diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index 01865a09d3fe..93d1e1c46a40 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c @@ -249,6 +249,8 @@ long rio_irqmask = -1; #ifndef TWO_ZERO #ifdef MODULE +MODULE_AUTHOR("Rogier Wolff , Patrick van de Lageweg "); +MODULE_DESCRIPTION("RIO driver"); MODULE_PARM(rio_poll, "i"); MODULE_PARM(rio_debug, "i"); MODULE_PARM(rio_irqmask, "i"); @@ -394,26 +396,37 @@ void rio_udelay (int usecs) void rio_inc_mod_count (void) { +#ifdef MODULE func_enter (); + rio_dprintk (RIO_DEBUG_MOD_COUNT, "rio_inc_mod_count\n"); MOD_INC_USE_COUNT; func_exit (); +#endif } void rio_dec_mod_count (void) { +#ifdef MODULE func_enter (); + rio_dprintk (RIO_DEBUG_MOD_COUNT, "rio_dec_mod_count\n"); MOD_DEC_USE_COUNT; func_exit (); +#endif } static int rio_set_real_termios (void *ptr) { - int rv; + int rv, modem; + struct tty_struct *tty; func_enter(); - rv = RIOParam( (struct Port *) ptr, CONFIG, 0, 1); + tty = ((struct Port *)ptr)->gs.tty; + + modem = (MAJOR(tty->device) == RIO_NORMAL_MAJOR0) || (MAJOR(tty->device) == RIO_NORMAL_MAJOR1); + + rv = RIOParam( (struct Port *) ptr, CONFIG, modem, 1); func_exit (); @@ -631,6 +644,7 @@ static void rio_shutdown_port (void * ptr) func_exit(); } + /* I haven't the foggiest why the decrement use count has to happen here. The whole linux serial drivers stuff needs to be redesigned. My guess is that this is a hack to minimize the impact of a bug @@ -641,7 +655,7 @@ static void rio_shutdown_port (void * ptr) static void rio_hungup (void *ptr) { func_enter (); - /* rio_dec_mod_count (); */ + rio_dec_mod_count (); func_exit (); } @@ -652,9 +666,22 @@ static void rio_hungup (void *ptr) */ static void rio_close (void *ptr) { + struct Port *PortP; + func_enter (); + + PortP = (struct Port *)ptr; + riotclose (ptr); + + if(PortP->gs.count) { + printk (KERN_ERR "WARNING port count:%d\n", PortP->gs.count); + PortP->gs.count = 0; + } + + rio_dec_mod_count (); + func_exit (); } @@ -974,13 +1001,12 @@ static int rio_init_datastructures (void) port->gs.close_delay = HZ/2; port->gs.closing_wait = 30 * HZ; port->gs.rd = &rio_real_driver; - + port->portSem = SPIN_LOCK_UNLOCKED; /* * Initializing wait queue */ init_waitqueue_head(&port->gs.open_wait); - init_waitqueue_head(&port->gs.close_wait); - + init_waitqueue_head(&port->gs.close_wait); } #else /* We could postpone initializing them to when they are configured. */ @@ -1010,7 +1036,7 @@ static int rio_init_datastructures (void) return -ENOMEM; } - +#ifdef MODULE static void rio_release_drivers(void) { func_enter(); @@ -1020,6 +1046,7 @@ static void rio_release_drivers(void) tty_unregister_driver (&rio_driver); func_exit(); } +#endif #ifdef TWO_ZERO #define PDEV unsigned char pci_bus, unsigned pci_fun @@ -1120,7 +1147,7 @@ int rio_init(void) while ((pdev = pci_find_device (PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, pdev))) { - if (pci_enable_device(pdev)) continue; + if (pci_enable_device(pdev)) continue; #else for (i=0;i< RIO_NBOARDS;i++) { if (pcibios_find_device (PCI_VENDOR_ID_SPECIALIX, @@ -1157,6 +1184,7 @@ int rio_init(void) hp->Type = RIO_PCI; hp->Copy = rio_pcicopy; hp->Mode = RIO_PCI_BOOT_FROM_RAM; + hp->HostLock = SPIN_LOCK_UNLOCKED; rio_reset_interrupt (hp); rio_start_card_running (hp); @@ -1206,7 +1234,7 @@ int rio_init(void) while ((pdev = pci_find_device (PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_RIO, pdev))) { - if (pci_enable_device(pdev)) continue; + if (pci_enable_device(pdev)) continue; #else for (i=0;i< RIO_NBOARDS;i++) { if (pcibios_find_device (PCI_VENDOR_ID_SPECIALIX, diff --git a/drivers/char/rio/rio_linux.h b/drivers/char/rio/rio_linux.h index c8b72bdce94c..4242197e5e22 100644 --- a/drivers/char/rio/rio_linux.h +++ b/drivers/char/rio/rio_linux.h @@ -29,6 +29,8 @@ #define RIO_PORTSPERBOARD 128 #define RIO_NPORTS (RIO_NBOARDS * RIO_PORTSPERBOARD) +#define MODEM_SUPPORT + #ifdef __KERNEL__ #define RIO_MAGIC 0x12345678 @@ -85,31 +87,34 @@ struct vpd_prom { #endif +void rio_dec_mod_count (void); +void rio_inc_mod_count (void); + /* Allow us to debug "in the field" without requiring clients to recompile.... */ #if 1 #define rio_spin_lock_irqsave(sem, flags) do { \ - rio_dprint(RIO_DEBUG_SPINLOCK, ("spinlockirqsave: %p %s:%d\n", \ - sem, __FILE__, __LINE__));\ + rio_dprintk (RIO_DEBUG_SPINLOCK, "spinlockirqsave: %p %s:%d\n", \ + sem, __FILE__, __LINE__);\ spin_lock_irqsave(sem, flags);\ } while (0) #define rio_spin_unlock_irqrestore(sem, flags) do { \ - rio_dprint(RIO_DEBUG_SPINLOCK, ("spinunlockirqrestore: %p %s:%d\n",\ - sem, __FILE__, __LINE__));\ + rio_dprintk (RIO_DEBUG_SPINLOCK, "spinunlockirqrestore: %p %s:%d\n",\ + sem, __FILE__, __LINE__);\ spin_unlock_irqrestore(sem, flags);\ } while (0) #define rio_spin_lock(sem) do { \ - rio_dprint(RIO_DEBUG_SPINLOCK, ("spinlock: %p %s:%d\n",\ - sem, __FILE__, __LINE__));\ + rio_dprintk (RIO_DEBUG_SPINLOCK, "spinlock: %p %s:%d\n",\ + sem, __FILE__, __LINE__);\ spin_lock(sem);\ } while (0) #define rio_spin_unlock(sem) do { \ - rio_dprint(RIO_DEBUG_SPINLOCK, ("spinunlock: %p %s:%d\n",\ - sem, __FILE__, __LINE__));\ + rio_dprintk (RIO_DEBUG_SPINLOCK, "spinunlock: %p %s:%d\n",\ + sem, __FILE__, __LINE__);\ spin_unlock(sem);\ } while (0) #else @@ -173,7 +178,7 @@ static inline void *rio_memcpy_fromio (void *dest, void *source, int n) */ #ifdef DEBUG -#define rio_dprintk(f, str...) if (rio_debug & f) printk (str) +#define rio_dprintk(f, str...) do { if (rio_debug & f) printk (str);} while (0) #define func_enter() rio_dprintk (RIO_DEBUG_FLOW, "rio: enter " __FUNCTION__ "\n") #define func_exit() rio_dprintk (RIO_DEBUG_FLOW, "rio: exit " __FUNCTION__ "\n") #define func_enter2() rio_dprintk (RIO_DEBUG_FLOW, "rio: enter " __FUNCTION__ \ diff --git a/drivers/char/rio/rioboot.c b/drivers/char/rio/rioboot.c index 8168f213339f..d5ab5ba02f6c 100644 --- a/drivers/char/rio/rioboot.c +++ b/drivers/char/rio/rioboot.c @@ -118,13 +118,13 @@ struct DownLoad * rbp; "copyin". (Crash when a pagefault occurs). */ /* disable(oldspl); */ - rio_dprint(RIO_DEBUG_BOOT, ("Data at user address 0x%x\n",(int)rbp->DataP)); + rio_dprintk (RIO_DEBUG_BOOT, "Data at user address 0x%x\n",(int)rbp->DataP); /* ** Check that we have set asside enough memory for this */ if ( rbp->Count > SIXTY_FOUR_K ) { - rio_dprint(RIO_DEBUG_BOOT, ("RTA Boot Code Too Large!\n")); + rio_dprintk (RIO_DEBUG_BOOT, "RTA Boot Code Too Large!\n"); p->RIOError.Error = HOST_FILE_TOO_LARGE; /* restore(oldspl); */ func_exit (); @@ -132,7 +132,7 @@ struct DownLoad * rbp; } if ( p->RIOBooting ) { - rio_dprint(RIO_DEBUG_BOOT, ("RTA Boot Code : BUSY BUSY BUSY!\n")); + rio_dprintk (RIO_DEBUG_BOOT, "RTA Boot Code : BUSY BUSY BUSY!\n"); p->RIOError.Error = BOOT_IN_PROGRESS; /* restore(oldspl); */ func_exit (); @@ -160,7 +160,7 @@ struct DownLoad * rbp; if ( copyin((int)rbp->DataP,((caddr_t)(p->RIOBootPackets))+offset, rbp->Count) ==COPYFAIL ) { - rio_dprint(RIO_DEBUG_BOOT, ("Bad data copy from user space\n")); + rio_dprintk (RIO_DEBUG_BOOT, "Bad data copy from user space\n"); p->RIOError.Error = COPYIN_FAILED; /* restore(oldspl); */ func_exit (); @@ -185,7 +185,7 @@ void rio_start_card_running (struct Host * HostP) switch ( HostP->Type ) { case RIO_AT: - rio_dprint(RIO_DEBUG_BOOT, ("Start ISA card running\n")); + rio_dprintk (RIO_DEBUG_BOOT, "Start ISA card running\n"); WBYTE(HostP->Control, BOOT_FROM_RAM | EXTERNAL_BUS_ON | HostP->Mode @@ -198,7 +198,7 @@ void rio_start_card_running (struct Host * HostP) ** MCA handles IRQ vectors differently, so we don't write ** them to this register. */ - rio_dprint(RIO_DEBUG_BOOT, ("Start MCA card running\n")); + rio_dprintk (RIO_DEBUG_BOOT, "Start MCA card running\n"); WBYTE(HostP->Control, McaTpBootFromRam | McaTpBusEnable | HostP->Mode); break; @@ -206,7 +206,7 @@ void rio_start_card_running (struct Host * HostP) /* ** EISA is totally different and expects OUTBZs to turn it on. */ - rio_dprint(RIO_DEBUG_BOOT, NULL,DBG_DAEMON,"Start EISA card running\n"); + rio_dprintk (RIO_DEBUG_BOOT, "Start EISA card running\n"); OUTBZ( HostP->Slot, EISA_CONTROL_PORT, HostP->Mode | RIOEisaVec2Ctrl[HostP->Ivec] | EISA_TP_RUN | EISA_TP_BUS_ENABLE | EISA_TP_BOOT_FROM_RAM ); break; #endif @@ -217,11 +217,11 @@ void rio_start_card_running (struct Host * HostP) ** mapped, so we are writing to memory registers instead of io ** ports. */ - rio_dprint(RIO_DEBUG_BOOT, ("Start PCI card running\n")); + rio_dprintk (RIO_DEBUG_BOOT, "Start PCI card running\n"); WBYTE(HostP->Control, PCITpBootFromRam | PCITpBusEnable | HostP->Mode); break; default: - rio_dprint(RIO_DEBUG_BOOT, ("Unknown host type %d\n",HostP->Type)); + rio_dprintk (RIO_DEBUG_BOOT, "Unknown host type %d\n", HostP->Type); break; } /* @@ -260,15 +260,15 @@ register struct DownLoad *rbp; HostP = NULL; /* Assure the compiler we've initialized it */ for ( host=0; hostRIONumHosts; host++ ) { - rio_dprint(RIO_DEBUG_BOOT, ("Attempt to boot host %d\n",host)); + rio_dprintk (RIO_DEBUG_BOOT, "Attempt to boot host %d\n",host); HostP = &p->RIOHosts[host]; - rio_dprint(RIO_DEBUG_BOOT, ("Host Type = 0x%x, Mode = 0x%x, IVec = 0x%x\n", - HostP->Type, HostP->Mode, HostP->Ivec ) ); + rio_dprintk (RIO_DEBUG_BOOT, "Host Type = 0x%x, Mode = 0x%x, IVec = 0x%x\n", + HostP->Type, HostP->Mode, HostP->Ivec); if ( (HostP->Flags & RUN_STATE) != RC_WAITING ) { - rio_dprint(RIO_DEBUG_BOOT, ("%s %d already running\n","Host",host)); + rio_dprintk (RIO_DEBUG_BOOT, "%s %d already running\n","Host",host); continue; } @@ -285,13 +285,13 @@ register struct DownLoad *rbp; */ StartP = (caddr_t)&Cad[p->RIOConf.HostLoadBase-rbp->Count]; - rio_dprint(RIO_DEBUG_BOOT, ("kernel virtual address for host is 0x%x\n", (int)Cad ) ); - rio_dprint(RIO_DEBUG_BOOT, ("kernel virtual address for download is 0x%x\n", (int)StartP ) ); - rio_dprint(RIO_DEBUG_BOOT, ("host loadbase is 0x%x\n",p->RIOConf.HostLoadBase)); - rio_dprint(RIO_DEBUG_BOOT, ("size of download is 0x%x\n", rbp->Count ) ); + rio_dprintk (RIO_DEBUG_BOOT, "kernel virtual address for host is 0x%x\n", (int)Cad ); + rio_dprintk (RIO_DEBUG_BOOT, "kernel virtual address for download is 0x%x\n", (int)StartP); + rio_dprintk (RIO_DEBUG_BOOT, "host loadbase is 0x%x\n",p->RIOConf.HostLoadBase); + rio_dprintk (RIO_DEBUG_BOOT, "size of download is 0x%x\n", rbp->Count); if ( p->RIOConf.HostLoadBase < rbp->Count ) { - rio_dprint(RIO_DEBUG_BOOT, ("Bin too large\n")); + rio_dprintk (RIO_DEBUG_BOOT, "Bin too large\n"); p->RIOError.Error = HOST_FILE_TOO_LARGE; func_exit (); return EFBIG; @@ -307,7 +307,7 @@ register struct DownLoad *rbp; ** This ain't going to be none too clever if the download ** code is bigger than this segment. */ - rio_dprint(RIO_DEBUG_BOOT, ("Copy in code\n")); + rio_dprintk (RIO_DEBUG_BOOT, "Copy in code\n"); /* ** PCI hostcard can't cope with 32 bit accesses and so need to copy @@ -318,7 +318,7 @@ register struct DownLoad *rbp; DownCode = sysbrk(rbp->Count); if ( !DownCode ) { - rio_dprint(RIO_DEBUG_BOOT, ("No system memory available\n")); + rio_dprintk (RIO_DEBUG_BOOT, "No system memory available\n"); p->RIOError.Error = NOT_ENOUGH_CORE_FOR_PCI_COPY; func_exit (); return ENOMEM; @@ -326,7 +326,7 @@ register struct DownLoad *rbp; bzero(DownCode, rbp->Count); if ( copyin((int)rbp->DataP,DownCode,rbp->Count)==COPYFAIL ) { - rio_dprint(RIO_DEBUG_BOOT, ("Bad copyin of host data\n")); + rio_dprintk (RIO_DEBUG_BOOT, "Bad copyin of host data\n"); p->RIOError.Error = COPYIN_FAILED; func_exit (); return EFAULT; @@ -337,13 +337,13 @@ register struct DownLoad *rbp; sysfree( DownCode, rbp->Count ); } else if ( copyin((int)rbp->DataP,StartP,rbp->Count)==COPYFAIL ) { - rio_dprint(RIO_DEBUG_BOOT, ("Bad copyin of host data\n")); + rio_dprintk (RIO_DEBUG_BOOT, "Bad copyin of host data\n"); p->RIOError.Error = COPYIN_FAILED; func_exit (); return EFAULT; } - rio_dprint(RIO_DEBUG_BOOT, ("Copy completed\n")); + rio_dprintk (RIO_DEBUG_BOOT, "Copy completed\n"); /* ** S T O P ! @@ -444,8 +444,8 @@ register struct DownLoad *rbp; WBYTE( DestP[6] , NFIX(0) ); WBYTE( DestP[7] , JUMP(8) ); - rio_dprint(RIO_DEBUG_BOOT, ("host loadbase is 0x%x\n",p->RIOConf.HostLoadBase)); - rio_dprint(RIO_DEBUG_BOOT, ("startup offset is 0x%x\n",offset)); + rio_dprintk (RIO_DEBUG_BOOT, "host loadbase is 0x%x\n",p->RIOConf.HostLoadBase); + rio_dprintk (RIO_DEBUG_BOOT, "startup offset is 0x%x\n",offset); /* ** Flag what is going on @@ -459,19 +459,19 @@ register struct DownLoad *rbp; */ OldParmMap = RWORD(HostP->__ParmMapR); - rio_dprint(RIO_DEBUG_BOOT, ("Original parmmap is 0x%x\n",OldParmMap)); + rio_dprintk (RIO_DEBUG_BOOT, "Original parmmap is 0x%x\n",OldParmMap); /* ** And start it running (I hope). ** As there is nothing dodgy or obscure about the ** above code, this is guaranteed to work every time. */ - rio_dprint(RIO_DEBUG_BOOT, ("Host Type = 0x%x, Mode = 0x%x, IVec = 0x%x\n", - HostP->Type, HostP->Mode, HostP->Ivec ) ); + rio_dprintk (RIO_DEBUG_BOOT, "Host Type = 0x%x, Mode = 0x%x, IVec = 0x%x\n", + HostP->Type, HostP->Mode, HostP->Ivec); rio_start_card_running(HostP); - rio_dprint(RIO_DEBUG_BOOT, ("Set control port\n")); + rio_dprintk (RIO_DEBUG_BOOT, "Set control port\n"); /* ** Now, wait for upto five seconds for the Tp to setup the parmmap @@ -479,7 +479,7 @@ register struct DownLoad *rbp; */ for ( wait_count=0; (wait_countRIOConf.StartupTime)&& (RWORD(HostP->__ParmMapR)==OldParmMap); wait_count++ ) { - rio_dprint(RIO_DEBUG_BOOT, ("Checkout %d, 0x%x\n",wait_count,RWORD(HostP->__ParmMapR))); + rio_dprintk (RIO_DEBUG_BOOT, "Checkout %d, 0x%x\n",wait_count,RWORD(HostP->__ParmMapR)); delay(HostP, HUNDRED_MS); } @@ -489,8 +489,8 @@ register struct DownLoad *rbp; ** has crashed & burned in a really spectacular way */ if ( RWORD(HostP->__ParmMapR) == OldParmMap ) { - rio_dprint(RIO_DEBUG_BOOT, ("parmmap 0x%x\n", RWORD(HostP->__ParmMapR))); - rio_dprint(RIO_DEBUG_BOOT, ("RIO Mesg Run Fail\n")); + rio_dprintk (RIO_DEBUG_BOOT, "parmmap 0x%x\n", RWORD(HostP->__ParmMapR)); + rio_dprintk (RIO_DEBUG_BOOT, "RIO Mesg Run Fail\n"); #define HOST_DISABLE \ HostP->Flags &= ~RUN_STATE; \ @@ -501,7 +501,7 @@ register struct DownLoad *rbp; HOST_DISABLE; } - rio_dprint(RIO_DEBUG_BOOT, ("Running 0x%x\n",RWORD(HostP->__ParmMapR))); + rio_dprintk (RIO_DEBUG_BOOT, "Running 0x%x\n", RWORD(HostP->__ParmMapR)); /* ** Well, the board thought it was OK, and setup its parmmap @@ -513,10 +513,10 @@ register struct DownLoad *rbp; ** Grab a 32 bit pointer to the parmmap structure */ ParmMapP = (PARM_MAP *)RIO_PTR(Cad,RWORD(HostP->__ParmMapR)); - rio_dprint(RIO_DEBUG_BOOT, ("ParmMapP : %x\n", (int)ParmMapP)); + rio_dprintk (RIO_DEBUG_BOOT, "ParmMapP : %x\n", (int)ParmMapP); ParmMapP = (PARM_MAP *)((unsigned long)Cad + (unsigned long)((RWORD((HostP->__ParmMapR))) & 0xFFFF)); - rio_dprint(RIO_DEBUG_BOOT, ("ParmMapP : %x\n", (int)ParmMapP)); + rio_dprintk (RIO_DEBUG_BOOT, "ParmMapP : %x\n", (int)ParmMapP); /* ** The links entry should be 0xFFFF; we set it up @@ -524,8 +524,8 @@ register struct DownLoad *rbp; ** which links to use. */ if ( (RWORD(ParmMapP->links) & 0xFFFF) != 0xFFFF ) { - rio_dprint(RIO_DEBUG_BOOT, ("RIO Mesg Run Fail %s\n", HostP->Name)); - rio_dprint(RIO_DEBUG_BOOT, ("Links = 0x%x\n",RWORD(ParmMapP->links))); + rio_dprintk (RIO_DEBUG_BOOT, "RIO Mesg Run Fail %s\n", HostP->Name); + rio_dprintk (RIO_DEBUG_BOOT, "Links = 0x%x\n",RWORD(ParmMapP->links)); HOST_DISABLE; } @@ -535,28 +535,28 @@ register struct DownLoad *rbp; ** now wait for the card to set all the parmmap->XXX stuff ** this is a wait of upto two seconds.... */ - rio_dprint(RIO_DEBUG_BOOT, ("Looking for init_done - %d ticks\n",p->RIOConf.StartupTime)); + rio_dprintk (RIO_DEBUG_BOOT, "Looking for init_done - %d ticks\n",p->RIOConf.StartupTime); HostP->timeout_id = 0; for ( wait_count=0; (wait_countRIOConf.StartupTime) && !RWORD(ParmMapP->init_done); wait_count++ ) { - rio_dprint(RIO_DEBUG_BOOT, ("Waiting for init_done\n")); + rio_dprintk (RIO_DEBUG_BOOT, "Waiting for init_done\n"); delay(HostP, HUNDRED_MS); } - rio_dprint(RIO_DEBUG_BOOT, ("OK! init_done!\n")); + rio_dprintk (RIO_DEBUG_BOOT, "OK! init_done!\n"); if (RWORD(ParmMapP->error) != E_NO_ERROR || !RWORD(ParmMapP->init_done) ) { - rio_dprint(RIO_DEBUG_BOOT, ("RIO Mesg Run Fail %s\n", HostP->Name)); - rio_dprint(RIO_DEBUG_BOOT, ("Timedout waiting for init_done\n")); + rio_dprintk (RIO_DEBUG_BOOT, "RIO Mesg Run Fail %s\n", HostP->Name); + rio_dprintk (RIO_DEBUG_BOOT, "Timedout waiting for init_done\n"); HOST_DISABLE; } - rio_dprint(RIO_DEBUG_BOOT, ("Got init_done\n")); + rio_dprintk (RIO_DEBUG_BOOT, "Got init_done\n"); /* ** It runs! It runs! */ - rio_dprint(RIO_DEBUG_BOOT, ("Host ID %x Running\n",HostP->UniqueNum)); + rio_dprintk (RIO_DEBUG_BOOT, "Host ID %x Running\n",HostP->UniqueNum); /* ** set the time period between interrupts. @@ -580,12 +580,14 @@ register struct DownLoad *rbp; HostP->UnixRups[RupN].RupP = &HostP->RupP[RupN]; HostP->UnixRups[RupN].Id = RupN+1; HostP->UnixRups[RupN].BaseSysPort = NO_PORT; + HostP->UnixRups[RupN].RupLock = SPIN_LOCK_UNLOCKED; } for ( RupN = 0; RupNUnixRups[RupN+MAX_RUP].RupP = &HostP->LinkStrP[RupN].rup; HostP->UnixRups[RupN+MAX_RUP].Id = 0; HostP->UnixRups[RupN+MAX_RUP].BaseSysPort = NO_PORT; + HostP->UnixRups[RupN+MAX_RUP].RupLock = SPIN_LOCK_UNLOCKED; } /* @@ -622,7 +624,7 @@ register struct DownLoad *rbp; } } - rio_dprint(RIO_DEBUG_BOOT, ("Set the card running... \n")); + rio_dprintk (RIO_DEBUG_BOOT, "Set the card running... \n"); /* ** last thing - show the world that everything is in place */ @@ -638,7 +640,7 @@ register struct DownLoad *rbp; p->RIOSystemUp++; - rio_dprint(RIO_DEBUG_BOOT, ("Done everything %x\n", HostP->Ivec)); + rio_dprintk (RIO_DEBUG_BOOT, "Done everything %x\n", HostP->Ivec); func_exit (); return 0; } @@ -672,7 +674,7 @@ struct PKT *PacketP; ** If we haven't been told what to boot, we can't boot it. */ if ( p->RIONumBootPkts == 0 ) { - rio_dprint(RIO_DEBUG_BOOT, ("No RTA code to download yet\n")); + rio_dprintk (RIO_DEBUG_BOOT, "No RTA code to download yet\n"); return 0; } @@ -693,7 +695,7 @@ struct PKT *PacketP; ** try to unhook a command block from the command free list. */ if ( !(CmdBlkP = RIOGetCmdBlk()) ) { - rio_dprint(RIO_DEBUG_BOOT, ("No command blocks to boot RTA! come back later.\n")); + rio_dprintk (RIO_DEBUG_BOOT, "No command blocks to boot RTA! come back later.\n"); return 0; } @@ -716,8 +718,8 @@ struct PKT *PacketP; ** We only expect one type of command - a BOOT_REQUEST! */ if ( RBYTE(PktCmdP->Command) != BOOT_REQUEST ) { - rio_dprint(RIO_DEBUG_BOOT, ("Unexpected command %d on BOOT RUP %d of host %d\n", - PktCmdP->Command,Rup,HostP-p->RIOHosts)); + rio_dprintk (RIO_DEBUG_BOOT, "Unexpected command %d on BOOT RUP %d of host %d\n", + PktCmdP->Command,Rup,HostP-p->RIOHosts); ShowPacket( DBG_BOOT, PacketP ); RIOFreeCmdBlk( CmdBlkP ); return 1; @@ -754,9 +756,9 @@ struct PKT *PacketP; bcopy("BOOT",(void *)&CmdBlkP->Packet.data[BOOT_SEQUENCE_LEN],4); - rio_dprint(RIO_DEBUG_BOOT, ("Boot RTA on Host %d Rup %d - %d (0x%x) packets to 0x%x\n", + rio_dprintk (RIO_DEBUG_BOOT, "Boot RTA on Host %d Rup %d - %d (0x%x) packets to 0x%x\n", HostP-p->RIOHosts, Rup, p->RIONumBootPkts, p->RIONumBootPkts, - p->RIOConf.RtaLoadBase)); + p->RIOConf.RtaLoadBase); /* ** If this host is in slave mode, send the RTA an invalid boot @@ -775,11 +777,11 @@ struct PKT *PacketP; */ sequence = RWORD(PktCmdP->Sequence); - rio_dprint(RIO_DEBUG_BOOT, ("Boot block %d on Host %d Rup%d\n",sequence,HostP-p->RIOHosts,Rup)); + rio_dprintk (RIO_DEBUG_BOOT, "Boot block %d on Host %d Rup%d\n",sequence,HostP-p->RIOHosts,Rup); if ( sequence >= p->RIONumBootPkts ) { - rio_dprint(RIO_DEBUG_BOOT, ("Got a request for packet %d, max is %d\n", sequence, - p->RIONumBootPkts)); + rio_dprintk (RIO_DEBUG_BOOT, "Got a request for packet %d, max is %d\n", sequence, + p->RIONumBootPkts); ShowPacket( DBG_BOOT, PacketP ); } @@ -821,26 +823,26 @@ int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, struct Pk driver will never think that the RTA has booted... -- REW */ p->RIOBooting = 0; - rio_dprint(RIO_DEBUG_BOOT, ("RTA Boot completed - BootInProgress now %d\n", p->RIOBooting)); + rio_dprintk (RIO_DEBUG_BOOT, "RTA Boot completed - BootInProgress now %d\n", p->RIOBooting); /* ** Determine type of unit (16/8 port RTA). */ RtaType = GetUnitType(RtaUniq); if ( Rup >= (ushort)MAX_RUP ) { - rio_dprint(RIO_DEBUG_BOOT, ("RIO: Host %s has booted an RTA(%d) on link %c\n", - HostP->Name, 8 * RtaType, RBYTE(PktCmdP->LinkNum)+'A' )); + rio_dprintk (RIO_DEBUG_BOOT, "RIO: Host %s has booted an RTA(%d) on link %c\n", + HostP->Name, 8 * RtaType, RBYTE(PktCmdP->LinkNum)+'A'); } else { - rio_dprint(RIO_DEBUG_BOOT, ("RIO: RTA %s has booted an RTA(%d) on link %c\n", + rio_dprintk (RIO_DEBUG_BOOT, "RIO: RTA %s has booted an RTA(%d) on link %c\n", HostP->Mapping[Rup].Name, 8 * RtaType, - RBYTE(PktCmdP->LinkNum)+'A')); + RBYTE(PktCmdP->LinkNum)+'A'); } - rio_dprint(RIO_DEBUG_BOOT, ("UniqNum is 0x%x\n",RtaUniq)); + rio_dprintk (RIO_DEBUG_BOOT, "UniqNum is 0x%x\n",RtaUniq); if ( ( RtaUniq == 0x00000000 ) || ( RtaUniq == 0xffffffff ) ) { - rio_dprint(RIO_DEBUG_BOOT, ( "Illegal RTA Uniq Number\n")); + rio_dprintk (RIO_DEBUG_BOOT, "Illegal RTA Uniq Number\n"); return TRUE; } @@ -861,8 +863,8 @@ int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, struct Pk */ if (RIOSuspendBootRta(HostP, HostP->Mapping[Rup].ID, MyLink)) { - rio_dprint(RIO_DEBUG_BOOT, ("RTA failed to suspend booting on link %c\n", - 'A' + MyLink)); + rio_dprintk (RIO_DEBUG_BOOT, "RTA failed to suspend booting on link %c\n", + 'A' + MyLink); } } else @@ -874,8 +876,8 @@ int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, struct Pk */ WWORD(HostP->LinkStrP[MyLink].WaitNoBoot, 30); } - rio_dprint(RIO_DEBUG_BOOT, ("RTA %x not owned - suspend booting down link %c on unit %x\n", - RtaUniq, 'A' + MyLink, HostP->Mapping[Rup].RtaUniqueNum)); + rio_dprintk (RIO_DEBUG_BOOT, "RTA %x not owned - suspend booting down link %c on unit %x\n", + RtaUniq, 'A' + MyLink, HostP->Mapping[Rup].RtaUniqueNum); return TRUE; } @@ -925,16 +927,16 @@ int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, struct Pk } } if (RtaType == TYPE_RTA16) { - rio_dprint(RIO_DEBUG_BOOT, ("RTA will be given IDs %d+%d\n", - entry+1, entry2+1)); + rio_dprintk (RIO_DEBUG_BOOT, "RTA will be given IDs %d+%d\n", + entry+1, entry2+1); } else { - rio_dprint(RIO_DEBUG_BOOT, ("RTA will be given ID %d\n",entry+1)); + rio_dprintk (RIO_DEBUG_BOOT, "RTA will be given ID %d\n",entry+1); } return TRUE; } } - rio_dprint(RIO_DEBUG_BOOT, ("RTA not configured for this host\n")); + rio_dprintk (RIO_DEBUG_BOOT, "RTA not configured for this host\n"); if ( Rup >= (ushort)MAX_RUP ) { @@ -978,13 +980,13 @@ int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, struct Pk entry2 = HostP->Mapping[entry].ID2 - 1; if ( (HostP->Mapping[entry2].Flags & SLOT_TENTATIVE) && (HostP->Mapping[entry2].RtaUniqueNum == RtaUniq) ) - rio_dprint(RIO_DEBUG_BOOT, ("Found previous tentative slots (%d+%d)\n", - entry, entry2)); + rio_dprintk (RIO_DEBUG_BOOT, "Found previous tentative slots (%d+%d)\n", + entry, entry2); else continue; } else - rio_dprint(RIO_DEBUG_BOOT, ("Found previous tentative slot (%d)\n",entry)); + rio_dprintk (RIO_DEBUG_BOOT, "Found previous tentative slot (%d)\n",entry); if (! p->RIONoMessage) cprintf("RTA connected to %s '%s' (%c) not configured.\n",MyType,MyName,MyLink+'A'); return TRUE; @@ -1013,7 +1015,7 @@ int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, struct Pk ** + Configure RTA on host A. We now have the same RTA configured ** with different ports on two different hosts. */ - rio_dprint(RIO_DEBUG_BOOT, ("Have we seen RTA %x before?\n", RtaUniq )); + rio_dprintk (RIO_DEBUG_BOOT, "Have we seen RTA %x before?\n", RtaUniq ); found = 0; Flag = 0; /* Convince the compiler this variable is initialized */ for ( host = 0; !found && (host < p->RIONumHosts); host++ ) @@ -1029,12 +1031,12 @@ int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, struct Pk if (RtaType == TYPE_RTA16) { MapP2 = &p->RIOHosts[host].Mapping[MapP->ID2 - 1]; - rio_dprint(RIO_DEBUG_BOOT, ("This RTA is units %d+%d from host %s\n", - rta+1, MapP->ID2, p->RIOHosts[host].Name )); + rio_dprintk (RIO_DEBUG_BOOT, "This RTA is units %d+%d from host %s\n", + rta+1, MapP->ID2, p->RIOHosts[host].Name); } else - rio_dprint(RIO_DEBUG_BOOT, ("This RTA is unit %d from host %s\n", - rta+1, p->RIOHosts[host].Name )); + rio_dprintk (RIO_DEBUG_BOOT, "This RTA is unit %d from host %s\n", + rta+1, p->RIOHosts[host].Name); found = 1; break; } @@ -1052,12 +1054,12 @@ int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, struct Pk */ if ( !MapP ) { - rio_dprint(RIO_DEBUG_BOOT, ("Look for RTA %x in RIOSavedTable\n",RtaUniq)); + rio_dprintk (RIO_DEBUG_BOOT, "Look for RTA %x in RIOSavedTable\n",RtaUniq); for ( rta=0; rta < TOTAL_MAP_ENTRIES; rta++ ) { - rio_dprint(RIO_DEBUG_BOOT, ("Check table entry %d (%x)", + rio_dprintk (RIO_DEBUG_BOOT, "Check table entry %d (%x)", rta, - p->RIOSavedTable[rta].RtaUniqueNum )); + p->RIOSavedTable[rta].RtaUniqueNum); if ( (p->RIOSavedTable[rta].Flags & SLOT_IN_USE) && (p->RIOSavedTable[rta].RtaUniqueNum == RtaUniq) ) @@ -1073,11 +1075,11 @@ int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, struct Pk break; } MapP2 = &p->RIOSavedTable[entry2]; - rio_dprint(RIO_DEBUG_BOOT, ("This RTA is from table entries %d+%d\n", - rta, entry2)); + rio_dprintk (RIO_DEBUG_BOOT, "This RTA is from table entries %d+%d\n", + rta, entry2); } else - rio_dprint(RIO_DEBUG_BOOT, ("This RTA is from table entry %d\n", rta)); + rio_dprintk (RIO_DEBUG_BOOT, "This RTA is from table entry %d\n", rta); break; } } @@ -1133,8 +1135,8 @@ int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, struct Pk { if (Flag & SLOT_IN_USE) { - rio_dprint(RIO_DEBUG_BOOT, ( - "This RTA configured on another host - move entry to current host (1)\n")); + rio_dprintk (RIO_DEBUG_BOOT, + "This RTA configured on another host - move entry to current host (1)\n"); HostP->Mapping[entry].SysPort = MapP->SysPort; CCOPY( MapP->Name, HostP->Mapping[entry].Name, MAX_NAME_LEN ); HostP->Mapping[entry].Flags = @@ -1147,12 +1149,12 @@ int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, struct Pk p->RIOFirstPortsBooted = HostP->Mapping[entry].SysPort; if ( HostP->Mapping[entry].SysPort > p->RIOLastPortsBooted ) p->RIOLastPortsBooted = HostP->Mapping[entry].SysPort; - rio_dprint(RIO_DEBUG_BOOT, ("SysPort %d, Name %s\n",(int)MapP->SysPort,MapP->Name)); + rio_dprintk (RIO_DEBUG_BOOT, "SysPort %d, Name %s\n",(int)MapP->SysPort,MapP->Name); } else { - rio_dprint(RIO_DEBUG_BOOT, ( - "This RTA has a tentative entry on another host - delete that entry (1)\n")); + rio_dprintk (RIO_DEBUG_BOOT, + "This RTA has a tentative entry on another host - delete that entry (1)\n"); HostP->Mapping[entry].Flags = SLOT_TENTATIVE | RTA_BOOTED | RTA_NEWBOOT; #if NEED_TO_FIX @@ -1177,9 +1179,9 @@ int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, struct Pk p->RIOFirstPortsBooted = HostP->Mapping[entry2].SysPort; if (HostP->Mapping[entry2].SysPort > p->RIOLastPortsBooted) p->RIOLastPortsBooted = HostP->Mapping[entry2].SysPort; - rio_dprint(RIO_DEBUG_BOOT, ("SysPort %d, Name %s\n", + rio_dprintk (RIO_DEBUG_BOOT, "SysPort %d, Name %s\n", (int)HostP->Mapping[entry2].SysPort, - HostP->Mapping[entry].Name)); + HostP->Mapping[entry].Name); } else HostP->Mapping[entry2].Flags = SLOT_TENTATIVE | @@ -1272,7 +1274,7 @@ struct Host *HostP; { int link; - rio_dprint(RIO_DEBUG_BOOT, ("FillSlot(%d, %d, 0x%x...)\n", entry, entry2, RtaUniq)); + rio_dprintk (RIO_DEBUG_BOOT, "FillSlot(%d, %d, 0x%x...)\n", entry, entry2, RtaUniq); HostP->Mapping[entry].Flags = (RTA_BOOTED | RTA_NEWBOOT | SLOT_TENTATIVE); HostP->Mapping[entry].SysPort = NO_PORT; diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c index 835d815d35b0..3a330a07c51e 100644 --- a/drivers/char/rio/riocmd.c +++ b/drivers/char/rio/riocmd.c @@ -91,12 +91,12 @@ struct Map * MapP; { struct CmdBlk *CmdBlkP; - rio_dprint(RIO_DEBUG_CMD, ("FOAD RTA\n")); + rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA\n"); CmdBlkP = RIOGetCmdBlk(); if ( !CmdBlkP ) { - rio_dprint(RIO_DEBUG_CMD, ("FOAD RTA: GetCmdBlk failed\n")); + rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA: GetCmdBlk failed\n"); return ENXIO; } @@ -111,7 +111,7 @@ struct Map * MapP; CmdBlkP->Packet.data[3] = (IFOAD_MAGIC >> 8) & 0xFF; if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) { - rio_dprint(RIO_DEBUG_CMD, ("FOAD RTA: Failed to queue foad command\n")); + rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA: Failed to queue foad command\n"); return EIO; } return 0; @@ -124,12 +124,12 @@ struct Map * MapP; { struct CmdBlk *CmdBlkP; - rio_dprint(RIO_DEBUG_CMD, ("ZOMBIE RTA\n")); + rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA\n"); CmdBlkP = RIOGetCmdBlk(); if ( !CmdBlkP ) { - rio_dprint(RIO_DEBUG_CMD, ("ZOMBIE RTA: GetCmdBlk failed\n")); + rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA: GetCmdBlk failed\n"); return ENXIO; } @@ -144,7 +144,7 @@ struct Map * MapP; CmdBlkP->Packet.data[3] = (ZOMBIE_MAGIC >> 8) & 0xFF; if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) { - rio_dprint(RIO_DEBUG_CMD, ("ZOMBIE RTA: Failed to queue zombie command\n")); + rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA: Failed to queue zombie command\n"); return EIO; } return 0; @@ -158,7 +158,7 @@ int (* func)( struct Host *HostP, struct Map *MapP ); { uint Host; - rio_dprint(RIO_DEBUG_CMD, ("Command RTA 0x%x func 0x%x\n", RtaUnique, (int)func )); + rio_dprintk (RIO_DEBUG_CMD, "Command RTA 0x%x func 0x%x\n", RtaUnique, (int)func); if ( !RtaUnique ) return(0); @@ -203,7 +203,7 @@ caddr_t arg; uint Host; if ( copyin( (int)arg, (caddr_t)&IdRta, sizeof(IdRta) ) == COPYFAIL ) { - rio_dprint(RIO_DEBUG_CMD, ("RIO_IDENTIFY_RTA copy failed\n")); + rio_dprintk (RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n"); p->RIOError.Error = COPYIN_FAILED; return EFAULT; } @@ -231,12 +231,12 @@ caddr_t arg; */ struct CmdBlk *CmdBlkP; - rio_dprint(RIO_DEBUG_CMD, ("IDENTIFY RTA\n")); + rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA\n"); CmdBlkP = RIOGetCmdBlk(); if ( !CmdBlkP ) { - rio_dprint(RIO_DEBUG_CMD, ("IDENTIFY RTA: GetCmdBlk failed\n")); + rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA: GetCmdBlk failed\n"); return ENXIO; } @@ -249,9 +249,8 @@ caddr_t arg; CmdBlkP->Packet.data[1] = 0; CmdBlkP->Packet.data[2] = IdRta.ID; - if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) - == RIO_FAIL ) { - rio_dprint(RIO_DEBUG_CMD, ("IDENTIFY RTA: Failed to queue command\n")); + if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) { + rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA: Failed to queue command\n"); return EIO; } return 0; @@ -274,11 +273,10 @@ caddr_t arg; struct Host *HostP; struct CmdBlk *CmdBlkP; - rio_dprint(RIO_DEBUG_CMD, ("KILL HOST NEIGHBOUR\n")); + rio_dprintk (RIO_DEBUG_CMD, "KILL HOST NEIGHBOUR\n"); - if ( copyin( (int)arg, (caddr_t)&KillUnit, - sizeof(KillUnit) ) == COPYFAIL ) { - rio_dprint(RIO_DEBUG_CMD, ("RIO_KILL_NEIGHBOUR copy failed\n")); + if ( copyin( (int)arg, (caddr_t)&KillUnit, sizeof(KillUnit) ) == COPYFAIL ) { + rio_dprintk (RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n"); p->RIOError.Error = COPYIN_FAILED; return EFAULT; } @@ -289,7 +287,7 @@ caddr_t arg; CmdBlkP = RIOGetCmdBlk(); if ( !CmdBlkP ) { - rio_dprint(RIO_DEBUG_CMD, ("UFOAD: GetCmdBlk failed\n")); + rio_dprintk (RIO_DEBUG_CMD, "UFOAD: GetCmdBlk failed\n"); return ENXIO; } @@ -310,7 +308,7 @@ caddr_t arg; if ( HostP->UniqueNum == KillUnit.UniqueNum ) { if ( RIOQueueCmdBlk( HostP, RTAS_PER_HOST+KillUnit.Link, CmdBlkP) == RIO_FAIL ) { - rio_dprint(RIO_DEBUG_CMD, ("UFOAD: Failed queue command\n")); + rio_dprintk (RIO_DEBUG_CMD, "UFOAD: Failed queue command\n"); return EIO; } return 0; @@ -320,7 +318,7 @@ caddr_t arg; if ( HostP->Mapping[ID].RtaUniqueNum == KillUnit.UniqueNum ) { CmdBlkP->Packet.dest_unit = ID+1; if ( RIOQueueCmdBlk( HostP, ID, CmdBlkP) == RIO_FAIL ) { - rio_dprint(RIO_DEBUG_CMD, ("UFOAD: Failed queue command\n")); + rio_dprintk (RIO_DEBUG_CMD, "UFOAD: Failed queue command\n"); return EIO; } return 0; @@ -339,12 +337,12 @@ int Link; { struct CmdBlk *CmdBlkP; - rio_dprint(RIO_DEBUG_CMD, ("SUSPEND BOOT ON RTA ID %d, link %c\n", ID, 'A' + Link)); + rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA ID %d, link %c\n", ID, 'A' + Link); CmdBlkP = RIOGetCmdBlk(); if ( !CmdBlkP ) { - rio_dprint(RIO_DEBUG_CMD, ("SUSPEND BOOT ON RTA: GetCmdBlk failed\n")); + rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: GetCmdBlk failed\n"); return ENXIO; } @@ -359,7 +357,7 @@ int Link; CmdBlkP->Packet.data[3] = (IWAIT_MAGIC >> 8) & 0xFF; if ( RIOQueueCmdBlk( HostP, ID - 1, CmdBlkP) == RIO_FAIL ) { - rio_dprint(RIO_DEBUG_CMD, ("SUSPEND BOOT ON RTA: Failed to queue iwait command\n")); + rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: Failed to queue iwait command\n"); return EIO; } return 0; @@ -416,6 +414,7 @@ PKT *PacketP; ushort subCommand; unsigned long flags; + func_enter (); #ifdef CHECK CheckHost( Host ); @@ -435,34 +434,35 @@ PKT *PacketP; UnixRupP = &HostP->UnixRups[rup]; SysPort = UnixRupP->BaseSysPort + (RBYTE(PktCmdP->PhbNum) % (ushort)PORTS_PER_RTA); - rio_dprint(RIO_DEBUG_CMD, ("Command on rup %d, port %d\n", rup, SysPort)); + rio_dprintk (RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort); #ifdef CHECK CheckRup( rup ); CheckUnixRupP( UnixRupP ); #endif if ( UnixRupP->BaseSysPort == NO_PORT ) { - rio_dprint(RIO_DEBUG_CMD, ("OBSCURE ERROR!\n")); - rio_dprint(RIO_DEBUG_CMD, ("Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n")); - rio_dprint(RIO_DEBUG_CMD, ("CONTROL information: Host number %d, name ``%s''\n", - HostP-p->RIOHosts, HostP->Name )); - rio_dprint(RIO_DEBUG_CMD, ("CONTROL information: Rup number 0x%x\n", rup)); - - if ( Rup >= (ushort)MAX_RUP ) - rio_dprint(RIO_DEBUG_CMD, ("CONTROL information: This is the RUP for RTA ``%s''\n", - HostP->Mapping[Rup].Name )); - else - rio_dprint(RIO_DEBUG_CMD, ("CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", 'A' + Rup - MAX_RUP, HostP->Name )); - - rio_dprint(RIO_DEBUG_CMD, ("PACKET information: Destination 0x%x:0x%x\n", - PacketP->dest_unit, PacketP->dest_port )); - rio_dprint(RIO_DEBUG_CMD, ("PACKET information: Source 0x%x:0x%x\n", - PacketP->src_unit, PacketP->src_port )); - rio_dprint(RIO_DEBUG_CMD, ("PACKET information: Length 0x%x (%d)\n", PacketP->len,PacketP->len )); - rio_dprint(RIO_DEBUG_CMD, ("PACKET information: Control 0x%x (%d)\n", PacketP->control, PacketP->control)); - rio_dprint(RIO_DEBUG_CMD, ("PACKET information: Check 0x%x (%d)\n", PacketP->csum, PacketP->csum )); - rio_dprint(RIO_DEBUG_CMD, ("COMMAND information: Host Port Number 0x%x, - Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command )); + rio_dprintk (RIO_DEBUG_CMD, "OBSCURE ERROR!\n"); + rio_dprintk (RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n"); + rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: Host number %d, name ``%s''\n", + HostP-p->RIOHosts, HostP->Name ); + rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: Rup number 0x%x\n", rup); + + if ( Rup >= (ushort)MAX_RUP ) { + rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n", + HostP->Mapping[Rup].Name); + } else + rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", + ('A' + Rup - MAX_RUP), HostP->Name); + + rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Destination 0x%x:0x%x\n", + PacketP->dest_unit, PacketP->dest_port ); + rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Source 0x%x:0x%x\n", + PacketP->src_unit, PacketP->src_port ); + rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Length 0x%x (%d)\n", PacketP->len,PacketP->len ); + rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Control 0x%x (%d)\n", PacketP->control, PacketP->control); + rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Check 0x%x (%d)\n", PacketP->csum, PacketP->csum ); + rio_dprintk (RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, + Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command ); return TRUE; } @@ -470,13 +470,10 @@ PKT *PacketP; CheckSysPort( SysPort ); #endif PortP = p->RIOPortp[ SysPort ]; -#if 0 - ttyP = PortP->TtyP; -#endif rio_spin_lock_irqsave(&PortP->portSem, flags); switch( RBYTE(PktCmdP->Command) ) { case BREAK_RECEIVED: - rio_dprint(RIO_DEBUG_CMD, ("Received a break!\n")); + rio_dprintk (RIO_DEBUG_CMD, "Received a break!\n"); /* If the current line disc. is not multi-threading and the current processor is not the default, reset rup_intr and return FALSE to ensure that the command packet is @@ -486,16 +483,16 @@ PKT *PacketP; break; case COMPLETE: - rio_dprint(RIO_DEBUG_CMD, ("Command complete on phb %d host %d\n", - RBYTE(PktCmdP->PhbNum), HostP-p->RIOHosts)); + rio_dprintk (RIO_DEBUG_CMD, "Command complete on phb %d host %d\n", + RBYTE(PktCmdP->PhbNum), HostP-p->RIOHosts); subCommand = 1; switch (RBYTE(PktCmdP->SubCommand)) { case MEMDUMP : - rio_dprint(RIO_DEBUG_CMD, ("Memory dump cmd (0x%x) from addr 0x%x\n", - RBYTE(PktCmdP->SubCommand), RWORD(PktCmdP->SubAddr))); + rio_dprintk (RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n", + RBYTE(PktCmdP->SubCommand), RWORD(PktCmdP->SubAddr)); break; case READ_REGISTER : - rio_dprint(RIO_DEBUG_CMD, ("Read register (0x%x)\n", RWORD(PktCmdP->SubAddr))); + rio_dprintk (RIO_DEBUG_CMD, "Read register (0x%x)\n", RWORD(PktCmdP->SubAddr)); p->CdRegister = (RBYTE(PktCmdP->ModemStatus) & MSVR1_HOST); break; default : @@ -504,18 +501,16 @@ PKT *PacketP; } if (subCommand) break; - rio_dprint(RIO_DEBUG_CMD, ("New status is 0x%x was 0x%x\n", - RBYTE(PktCmdP->PortStatus),PortP->PortState)); + rio_dprintk (RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n", + RBYTE(PktCmdP->PortStatus),PortP->PortState); if (PortP->PortState != RBYTE(PktCmdP->PortStatus)) { - rio_dprint(RIO_DEBUG_CMD, ("Mark status & wakeup\n")); + rio_dprintk (RIO_DEBUG_CMD, "Mark status & wakeup\n"); PortP->PortState = RBYTE(PktCmdP->PortStatus); /* What should we do here ... wakeup( &PortP->PortState ); */ - } - else { - rio_dprint(RIO_DEBUG_CMD, ("No change\n")); - } + } else + rio_dprintk (RIO_DEBUG_CMD, "No change\n"); /* FALLTHROUGH */ case MODEM_STATUS: @@ -527,7 +522,7 @@ PKT *PacketP; ReportedModemStatus = RBYTE(PktCmdP->ModemStatus); if ((PortP->ModemState & MSVR1_HOST) == (ReportedModemStatus & MSVR1_HOST)) { - rio_dprint(RIO_DEBUG_CMD, ("Modem status unchanged 0x%x\n", PortP->ModemState)); + rio_dprintk (RIO_DEBUG_CMD, "Modem status unchanged 0x%x\n", PortP->ModemState); /* ** Update ModemState just in case tbusy or tstop states have ** changed. @@ -535,8 +530,8 @@ PKT *PacketP; PortP->ModemState = ReportedModemStatus; } else { - rio_dprint(RIO_DEBUG_CMD, ("Modem status change from 0x%x to 0x%x\n", - PortP->ModemState, ReportedModemStatus)); + rio_dprintk (RIO_DEBUG_CMD, "Modem status change from 0x%x to 0x%x\n", + PortP->ModemState, ReportedModemStatus); PortP->ModemState = ReportedModemStatus; #ifdef MODEM_SUPPORT if ( PortP->Mapped ) { @@ -551,50 +546,41 @@ PKT *PacketP; ** If the device is a modem, then check the modem ** carrier. */ - if(!(ttyP->t_cflag & CLOCAL) && - ((PortP->State & (RIO_MOPEN|RIO_WOPEN)))) - { + if (PortP->gs.tty == NULL) + break; + + if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) && + ((PortP->State & (RIO_MOPEN|RIO_WOPEN)))) { + + rio_dprintk (RIO_DEBUG_CMD, "Is there a Carrier?\n"); /* ** Is there a carrier? */ - if ( PortP->ModemState & MSVR1_CD ) - { + if ( PortP->ModemState & MSVR1_CD ) { /* ** Has carrier just appeared? */ - if (!(ttyP->t_state & CARR_ON)) - { - rio_dprint(RIO_DEBUG_CMD, PortP,DBG_MODEM,"Carrier just came up.\n"); - ttyP->t_state |=CARR_ON; + if (!(PortP->State & RIO_CARR_ON)) { + rio_dprintk (RIO_DEBUG_CMD, "Carrier just came up.\n"); + PortP->State |= RIO_CARR_ON; /* ** wakeup anyone in WOPEN */ - if ( ttyP->t_state & (ISOPEN|WOPEN) ) - wakeup((caddr_t)&ttyP->t_canq); + if (PortP->State & (PORT_ISOPEN | RIO_WOPEN) ) + wake_up_interruptible (&PortP->gs.open_wait); #ifdef STATS PortP->Stat.ModemOnCnt++; #endif } - } - else - { + } else { /* ** Has carrier just dropped? */ - if (ttyP->t_state & CARR_ON) - { - /* - ** send SIGHUP to the process group - */ - if ( ttyP->t_state & (ISOPEN|WOPEN) ) - { - signal(ttyP->t_pgrp,SIGHUP); - ttyflush(ttyP,(FREAD|FWRITE)); - } - ttyP->t_state &= ~CARR_ON; - wakeup( (caddr_t)&PortP->TxBufferOut ); - wakeup( (caddr_t)&PortP->TxBufferIn ); - rio_dprint(RIO_DEBUG_CMD, PortP,DBG_MODEM,"Carrier just went down.\n"); + if (PortP->State & RIO_CARR_ON) { + if (PortP->State & (PORT_ISOPEN|RIO_WOPEN|RIO_MOPEN)) + tty_hangup (PortP->gs.tty); + PortP->State &= ~RIO_CARR_ON; + rio_dprintk (RIO_DEBUG_CMD, "Carrirer just went down\n"); #ifdef STATS PortP->Stat.ModemOffCnt++; #endif @@ -607,11 +593,14 @@ PKT *PacketP; break; default: - rio_dprint(RIO_DEBUG_CMD, ("Unknown command %d on CMD_RUP of host %d\n", - RBYTE(PktCmdP->Command),HostP-p->RIOHosts)); + rio_dprintk (RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %d\n", + RBYTE(PktCmdP->Command),HostP-p->RIOHosts); break; } rio_spin_unlock_irqrestore(&PortP->portSem, flags); + + func_exit (); + return TRUE; } /* @@ -667,11 +656,8 @@ struct CmdBlk *CmdBlkP; CheckRup( Rup ); CheckCmdBlkP( CmdBlkP ); #endif - - rio_dprint(RIO_DEBUG_CMD, ("RIOQueueCmdBlk(Host, Rup %d, 0x%x)\n", Rup, (int)CmdBlkP )); - if ( Rup >= (ushort)(MAX_RUP+LINKS_PER_UNIT) ) { - rio_dprint(RIO_DEBUG_CMD, ("Illegal rup number %d in RIOQueueCmdBlk\n",Rup)); + rio_dprintk (RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n",Rup); RIOFreeCmdBlk( CmdBlkP ); return RIO_FAIL; } @@ -685,11 +671,12 @@ struct CmdBlk *CmdBlkP; ** straight on the RUP.... */ if ( (UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && - (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) && + (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE ) && (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP)(CmdBlkP->PreArg,CmdBlkP) :TRUE)) { - rio_dprint(RIO_DEBUG_CMD, ("RUP inactive-placing command straight on. Cmd byte is 0x%x\n", - CmdBlkP->Packet.data[0])); + rio_dprintk (RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n", + CmdBlkP->Packet.data[0]); + /* ** Whammy! blat that pack! @@ -711,28 +698,27 @@ struct CmdBlk *CmdBlkP; return RIO_SUCCESS; } - - rio_dprint(RIO_DEBUG_CMD, ("RUP active - en-queing\n")); + rio_dprintk (RIO_DEBUG_CMD, "RUP active - en-queing\n"); if ( UnixRupP->CmdsWaitingP != NULL) - rio_dprint(RIO_DEBUG_CMD, ("Rup active - command waiting\n")); + rio_dprintk (RIO_DEBUG_CMD, "Rup active - command waiting\n"); if ( UnixRupP->CmdPendingP != NULL ) - rio_dprint(RIO_DEBUG_CMD, ("Rup active - command pending\n")); + rio_dprintk (RIO_DEBUG_CMD, "Rup active - command pending\n"); if ( RWORD(UnixRupP->RupP->txcontrol) != TX_RUP_INACTIVE ) - rio_dprint(RIO_DEBUG_CMD, ("Rup active - command rup not ready\n")); + rio_dprintk (RIO_DEBUG_CMD, "Rup active - command rup not ready\n"); Base = &UnixRupP->CmdsWaitingP; - rio_dprint(RIO_DEBUG_CMD, ("First try to queue cmdblk 0x%x at 0x%x\n",(int)CmdBlkP,(int)Base)); + rio_dprintk (RIO_DEBUG_CMD, "First try to queue cmdblk 0x%x at 0x%x\n", (int)CmdBlkP,(int)Base); while ( *Base ) { - rio_dprint(RIO_DEBUG_CMD, ("Command cmdblk 0x%x here\n",(int)(*Base))); + rio_dprintk (RIO_DEBUG_CMD, "Command cmdblk 0x%x here\n", (int)(*Base)); Base = &((*Base)->NextP); - rio_dprint(RIO_DEBUG_CMD, ("Now try to queue cmd cmdblk 0x%x at 0x%x\n", - (int)CmdBlkP,(int)Base)); + rio_dprintk (RIO_DEBUG_CMD, "Now try to queue cmd cmdblk 0x%x at 0x%x\n", + (int)CmdBlkP,(int)Base); } - rio_dprint(RIO_DEBUG_CMD, ("Will queue cmdblk 0x%x at 0x%x\n",(int)CmdBlkP,(int)Base)); + rio_dprintk (RIO_DEBUG_CMD, "Will queue cmdblk 0x%x at 0x%x\n",(int)CmdBlkP,(int)Base); *Base = CmdBlkP; @@ -775,17 +761,15 @@ struct Host * HostP; if ( RWORD(UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE ) { int FreeMe; - /* rio_dprint(RIO_DEBUG_CMD, ("RIORupCmd( %d, %d )\n", HostP-p->RIOHosts, Rup )); */ - PacketP =(PKT *)RIO_PTR(HostP->Caddr,RWORD(UnixRupP->RupP->rxpkt)); ShowPacket( DBG_CMD, PacketP ); switch ( RBYTE(PacketP->dest_port) ) { case BOOT_RUP: - rio_dprint(RIO_DEBUG_CMD, ("Incoming Boot %s packet '%x'\n", + rio_dprintk (RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", RBYTE(PacketP->len) & 0x80 ? "Command":"Data", - RBYTE(PacketP->data[0]) )); + RBYTE(PacketP->data[0])); rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); FreeMe= RIOBootRup(p, Rup,HostP,PacketP); rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); @@ -800,8 +784,8 @@ struct Host * HostP; rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); FreeMe= RIOCommandRup(p, Rup,HostP,PacketP); if (PacketP->data[5] == MEMDUMP) { - rio_dprint(RIO_DEBUG_CMD, ("Memdump from 0x%x complete\n", - *(ushort *) &(PacketP->data[6]))); + rio_dprintk (RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", + *(ushort *) &(PacketP->data[6])); HostP->Copy( (caddr_t)&(PacketP->data[8]), (caddr_t)p->RIOMemDump, 32 ); } @@ -815,19 +799,19 @@ struct Host * HostP; break; default: - rio_dprint(RIO_DEBUG_CMD, ("Unknown RUP %d\n", RBYTE(PacketP->dest_port))); + rio_dprintk (RIO_DEBUG_CMD, "Unknown RUP %d\n", RBYTE(PacketP->dest_port)); FreeMe = 1; break; } if ( FreeMe ) { - rio_dprint(RIO_DEBUG_CMD, ("Free processed incoming command packet\n")); + rio_dprintk (RIO_DEBUG_CMD, "Free processed incoming command packet\n"); put_free_end(HostP,PacketP); WWORD(UnixRupP->RupP->rxcontrol , RX_RUP_INACTIVE); if ( RWORD(UnixRupP->RupP->handshake)==PHB_HANDSHAKE_SET ) { - rio_dprint(RIO_DEBUG_CMD, ("Handshake rup %d\n",Rup)); + rio_dprintk (RIO_DEBUG_CMD, "Handshake rup %d\n",Rup); WWORD(UnixRupP->RupP->handshake, PHB_HANDSHAKE_SET|PHB_HANDSHAKE_RESET); } @@ -839,7 +823,7 @@ struct Host * HostP; ** and it has completed, then tidy it up. */ if ( (CmdBlkP = UnixRupP->CmdPendingP) && /* ASSIGN! */ - (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) ) { + (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { /* ** we are idle. ** there is a command in pending. @@ -848,11 +832,11 @@ struct Host * HostP; ** what happened). */ if ( CmdBlkP->Packet.dest_port == BOOT_RUP ) - rio_dprint(RIO_DEBUG_CMD, ("Free Boot %s Command Block '%x'\n", + rio_dprintk (RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", CmdBlkP->Packet.len & 0x80 ? "Command":"Data", - CmdBlkP->Packet.data[0] )); + CmdBlkP->Packet.data[0]); - rio_dprint(RIO_DEBUG_CMD, ("Command 0x%x completed\n",(int)CmdBlkP)); + rio_dprintk (RIO_DEBUG_CMD, "Command 0x%x completed\n",(int)CmdBlkP); /* ** Clear the Rup lock to prevent mutual exclusion. @@ -880,27 +864,27 @@ struct Host * HostP; */ if ( (CmdBlkP = UnixRupP->CmdsWaitingP) && /* ASSIGN! */ (UnixRupP->CmdPendingP == NULL) && - (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) ) { + (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { /* ** if the pre-function is non-zero, call it. ** If it returns RIO_FAIL then don't ** send this command yet! */ #ifdef CHECK -CheckCmdBlkP( CmdBlkP ); + CheckCmdBlkP (CmdBlkP); #endif if ( !(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP)(CmdBlkP->PreArg, CmdBlkP) : TRUE)) { - rio_dprint(RIO_DEBUG_CMD, ("Not ready to start command 0x%x\n",(int)CmdBlkP)); + rio_dprintk (RIO_DEBUG_CMD, "Not ready to start command 0x%x\n",(int)CmdBlkP); } else { - rio_dprint(RIO_DEBUG_CMD, ("Start new command 0x%x Cmd byte is 0x%x\n", - (int)CmdBlkP, CmdBlkP->Packet.data[0])); + rio_dprintk (RIO_DEBUG_CMD, "Start new command 0x%x Cmd byte is 0x%x\n", + (int)CmdBlkP, CmdBlkP->Packet.data[0]); /* ** Whammy! blat that pack! */ #ifdef CHECK -CheckPacketP( (PKT *)RIO_PTR(HostP->Caddr,UnixRupP->RupP->txpkt) ); + CheckPacketP ((PKT *)RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt)); #endif HostP->Copy( (caddr_t)&CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT)); @@ -1026,7 +1010,7 @@ struct CmdBlk *CmdBlkP; ** MAGIC! (Basically, handshake the RX buffer, so that ** the RTAs upstream can be re-enabled.) */ - rio_dprint(RIO_DEBUG_CMD, ("Util: Set RX handshake bit\n")); + rio_dprintk (RIO_DEBUG_CMD, "Util: Set RX handshake bit\n"); WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET|PHB_HANDSHAKE_RESET); } rio_spin_unlock_irqrestore(&PortP->portSem, flags); @@ -1046,7 +1030,7 @@ struct CmdBlk *CmdBlkP; #ifdef CHECK CheckPortP( PortP ); #endif - rio_dprint(RIO_DEBUG_CMD, ("Decrement in use count for port\n")); + rio_dprintk (RIO_DEBUG_CMD, "Decrement in use count for port\n"); if (PortP->InUse) { if ( --PortP->InUse != NOT_INUSE ) { diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c index fa68646d5c1d..af61dc9972dd 100644 --- a/drivers/char/rio/rioctrl.c +++ b/drivers/char/rio/rioctrl.c @@ -137,7 +137,7 @@ int copyin (int arg, caddr_t dp, int siz) { int rv; - rio_dprint (RIO_DEBUG_CTRL, ("Copying %d bytes from user %p to %p.\n", siz, (void *) arg, dp)); + rio_dprintk (RIO_DEBUG_CTRL, "Copying %d bytes from user %p to %p.\n", siz, (void *)arg, dp); rv = copy_from_user (dp, (void *)arg, siz); if (rv < 0) return COPYFAIL; else return rv; @@ -148,7 +148,7 @@ int copyout (caddr_t dp, int arg, int siz) { int rv; - rio_dprint (RIO_DEBUG_CTRL, ("Copying %d bytes to user %p from %p.\n", siz, (void *) arg, dp)); + rio_dprintk (RIO_DEBUG_CTRL, "Copying %d bytes to user %p from %p.\n", siz, (void *)arg, dp); rv = copy_to_user ((void *)arg, dp, siz); if (rv < 0) return COPYFAIL; else return rv; @@ -207,7 +207,7 @@ int su; Host=0; PortP = NULL; - rio_dprint(RIO_DEBUG_CTRL, ("control ioctl cmd: 0x%x arg: 0x%x\n", cmd, (int)arg)); + rio_dprintk (RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: 0x%x\n", cmd, (int)arg); switch (cmd) { /* @@ -218,7 +218,7 @@ int su; ** otherwise just the specified host card will be changed. */ case RIO_SET_TIMER: - rio_dprint(RIO_DEBUG_CTRL, ("RIO_SET_TIMER to %dms\n", (uint)arg)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_TIMER to %dms\n", (uint)arg); { int host, value; host = (uint)arg >> 16; @@ -296,42 +296,42 @@ int su; */ case RIO_FOAD_RTA: - rio_dprint(RIO_DEBUG_CTRL, ("RIO_FOAD_RTA\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_FOAD_RTA\n"); return RIOCommandRta(p, (uint)arg, RIOFoadRta); case RIO_ZOMBIE_RTA: - rio_dprint(RIO_DEBUG_CTRL, ("RIO_ZOMBIE_RTA\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_ZOMBIE_RTA\n"); return RIOCommandRta(p, (uint)arg, RIOZombieRta); case RIO_IDENTIFY_RTA: - rio_dprint(RIO_DEBUG_CTRL, ("RIO_IDENTIFY_RTA\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_IDENTIFY_RTA\n"); return RIOIdentifyRta(p, arg); case RIO_KILL_NEIGHBOUR: - rio_dprint(RIO_DEBUG_CTRL, ("RIO_KILL_NEIGHBOUR\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_KILL_NEIGHBOUR\n"); return RIOKillNeighbour(p, arg); case SPECIAL_RUP_CMD: { struct CmdBlk *CmdBlkP; - rio_dprint(RIO_DEBUG_CTRL, ("SPECIAL_RUP_CMD\n")); + rio_dprintk (RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n"); if (copyin((int)arg, (caddr_t)&SpecialRupCmd, sizeof(SpecialRupCmd)) == COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("SPECIAL_RUP_CMD copy failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n"); p->RIOError.Error = COPYIN_FAILED; return EFAULT; } CmdBlkP = RIOGetCmdBlk(); if ( !CmdBlkP ) { - rio_dprint(RIO_DEBUG_CTRL, ("SPECIAL_RUP_CMD GetCmdBlk failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD GetCmdBlk failed\n"); return ENXIO; } CmdBlkP->Packet = SpecialRupCmd.Packet; if ( SpecialRupCmd.Host >= p->RIONumHosts ) SpecialRupCmd.Host = 0; - rio_dprint(RIO_DEBUG_CTRL, ("Queue special rup command for host %d rup %d\n", - SpecialRupCmd.Host, SpecialRupCmd.RupNum)); + rio_dprintk (RIO_DEBUG_CTRL, "Queue special rup command for host %d rup %d\n", + SpecialRupCmd.Host, SpecialRupCmd.RupNum); if (RIOQueueCmdBlk(&p->RIOHosts[SpecialRupCmd.Host], SpecialRupCmd.RupNum, CmdBlkP) == RIO_FAIL) { cprintf("FAILED TO QUEUE SPECIAL RUP COMMAND\n"); @@ -348,7 +348,7 @@ RIO_DEBUG_CTRL, if (su) return EPERM; case RIO_ALL_MODEM: - rio_dprint(RIO_DEBUG_CTRL, ("RIO_ALL_MODEM\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_ALL_MODEM\n"); p->RIOError.Error = IOCTL_COMMAND_UNKNOWN; return EINVAL; @@ -356,44 +356,44 @@ RIO_DEBUG_CTRL, if (su) /* ** Read the routing table from the device driver to user space */ - rio_dprint(RIO_DEBUG_CTRL, ("RIO_GET_TABLE\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_TABLE\n"); if ((retval = RIOApel(p)) != 0) return retval; if (copyout((caddr_t)p->RIOConnectTable, (int)arg, TOTAL_MAP_ENTRIES*sizeof(struct Map)) == COPYFAIL) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_GET_TABLE copy failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n"); p->RIOError.Error = COPYOUT_FAILED; return EFAULT; } { int entry; - rio_dprint(RIO_DEBUG_CTRL, ("*****\nMAP ENTRIES\n") ); + rio_dprintk (RIO_DEBUG_CTRL, "*****\nMAP ENTRIES\n"); for ( entry=0; entryRIOConnectTable[entry].ID == 0) && (p->RIOConnectTable[entry].HostUniqueNum == 0) && (p->RIOConnectTable[entry].RtaUniqueNum == 0)) continue; - rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.HostUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].HostUniqueNum ) ); - rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.RtaUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].RtaUniqueNum ) ); - rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.ID = 0x%x\n", entry, p->RIOConnectTable[entry].ID ) ); - rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.ID2 = 0x%x\n", entry, p->RIOConnectTable[entry].ID2 ) ); - rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Flags = 0x%x\n", entry, (int)p->RIOConnectTable[entry].Flags ) ); - rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.SysPort = 0x%x\n", entry, (int)p->RIOConnectTable[entry].SysPort ) ); - rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[0].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Unit ) ); - rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[0].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Link ) ); - rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[1].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Unit ) ); - rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[1].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Link ) ); - rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[2].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Unit ) ); - rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[2].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Link ) ); - rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[3].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Unit ) ); - rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Top[4].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Link ) ); - rio_dprint(RIO_DEBUG_CTRL, ("Map entry %d.Name = %s\n", entry, p->RIOConnectTable[entry].Name ) ); + rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.HostUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].HostUniqueNum ); + rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.RtaUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].RtaUniqueNum ); + rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.ID = 0x%x\n", entry, p->RIOConnectTable[entry].ID ); + rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.ID2 = 0x%x\n", entry, p->RIOConnectTable[entry].ID2 ); + rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Flags = 0x%x\n", entry, (int)p->RIOConnectTable[entry].Flags ); + rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.SysPort = 0x%x\n", entry, (int)p->RIOConnectTable[entry].SysPort ); + rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[0].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Unit ); + rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[0].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Link ); + rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[1].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Unit ); + rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[1].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Link ); + rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[2].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Unit ); + rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[2].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Link ); + rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[3].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Unit ); + rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[4].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Link ); + rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Name = %s\n", entry, p->RIOConnectTable[entry].Name ); } - rio_dprint(RIO_DEBUG_CTRL, ("*****\nEND MAP ENTRIES\n") ); + rio_dprintk (RIO_DEBUG_CTRL, "*****\nEND MAP ENTRIES\n"); } p->RIOQuickCheck = NOT_CHANGED; /* a table has been gotten */ return 0; @@ -402,16 +402,16 @@ RIO_DEBUG_CTRL, if (su) /* ** Write the routing table to the device driver from user space */ - rio_dprint(RIO_DEBUG_CTRL, ("RIO_PUT_TABLE\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_TABLE\n"); if ( !su ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_PUT_TABLE !Root\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_TABLE !Root\n"); p->RIOError.Error = NOT_SUPER_USER; return EPERM; } if ( copyin((int)arg, (caddr_t)&p->RIOConnectTable[0], TOTAL_MAP_ENTRIES*sizeof(struct Map) ) == COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_PUT_TABLE copy failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n"); p->RIOError.Error = COPYIN_FAILED; return EFAULT; } @@ -449,17 +449,17 @@ RIO_DEBUG_CTRL, if (su) ** Send bindings table, containing unique numbers of RTAs owned ** by this system to user space */ - rio_dprint(RIO_DEBUG_CTRL, ("RIO_GET_BINDINGS\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_BINDINGS\n"); if ( !su ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_GET_BINDINGS !Root\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_BINDINGS !Root\n"); p->RIOError.Error = NOT_SUPER_USER; return EPERM; } if (copyout((caddr_t) p->RIOBindTab, (int)arg, (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_GET_BINDINGS copy failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n"); p->RIOError.Error = COPYOUT_FAILED; return EFAULT; } @@ -470,17 +470,17 @@ RIO_DEBUG_CTRL, if (su) ** Receive a bindings table, containing unique numbers of RTAs owned ** by this system */ - rio_dprint(RIO_DEBUG_CTRL, ("RIO_PUT_BINDINGS\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS\n"); if ( !su ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_PUT_BINDINGS !Root\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS !Root\n"); p->RIOError.Error = NOT_SUPER_USER; return EPERM; } if (copyin((int)arg, (caddr_t)&p->RIOBindTab[0], (sizeof(ulong) * MAX_RTA_BINDINGS))==COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_PUT_BINDINGS copy failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n"); p->RIOError.Error = COPYIN_FAILED; return EFAULT; } @@ -493,10 +493,10 @@ RIO_DEBUG_CTRL, if (su) ** Bind this RTA to host, so that it will be booted by ** host in 'boot owned RTAs' mode. */ - rio_dprint(RIO_DEBUG_CTRL, ("RIO_BIND_RTA\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_BIND_RTA\n"); if ( !su ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_BIND_RTA !Root\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_BIND_RTA !Root\n"); p->RIOError.Error = NOT_SUPER_USER; return EPERM; } @@ -508,8 +508,8 @@ RIO_DEBUG_CTRL, if (su) ** Already exists - delete */ p->RIOBindTab[Entry] = 0L; - rio_dprint(RIO_DEBUG_CTRL, ("Removing Rta %x from p->RIOBindTab\n", - (int) arg)); + rio_dprintk (RIO_DEBUG_CTRL, "Removing Rta %x from p->RIOBindTab\n", + (int) arg); return 0; } } @@ -518,90 +518,90 @@ RIO_DEBUG_CTRL, if (su) */ if (EmptySlot != -1) { p->RIOBindTab[EmptySlot] = (int) arg; - rio_dprint(RIO_DEBUG_CTRL, ("Adding Rta %x to p->RIOBindTab\n", - (int) arg)); + rio_dprintk (RIO_DEBUG_CTRL, "Adding Rta %x to p->RIOBindTab\n", + (int) arg); } else { - rio_dprint(RIO_DEBUG_CTRL, ("p->RIOBindTab full! - Rta %x not added\n", - (int) arg)); + rio_dprintk (RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %x not added\n", + (int) arg); return 1; } return 0; } case RIO_RESUME : - rio_dprint(RIO_DEBUG_CTRL, ("RIO_RESUME\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME\n"); port = (uint) arg; if ((port < 0) || (port > 511)) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_RESUME: Bad port number %d\n", port)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port); p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; return EINVAL; } PortP = p->RIOPortp[port]; if (!PortP->Mapped) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_RESUME: Port %d not mapped\n", port)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not mapped\n", port); p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM; return EINVAL; } if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_RESUME: Port %d not open\n", port)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not open\n", port); return EINVAL; } rio_spin_lock_irqsave(&PortP->portSem, flags); if (RIOPreemptiveCmd(p, (p->RIOPortp[port]), RESUME) == RIO_FAIL) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_RESUME failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME failed\n"); rio_spin_unlock_irqrestore(&PortP->portSem, flags); return EBUSY; } else { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_RESUME: Port %d resumed\n", port)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d resumed\n", port); PortP->State |= RIO_BUSY; } rio_spin_unlock_irqrestore(&PortP->portSem, flags); return retval; case RIO_ASSIGN_RTA: - rio_dprint(RIO_DEBUG_CTRL, ("RIO_ASSIGN_RTA\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA\n"); if ( !su ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_ASSIGN_RTA !Root\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA !Root\n"); p->RIOError.Error = NOT_SUPER_USER; return EPERM; } if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt)) == COPYFAIL) { - rio_dprint(RIO_DEBUG_CTRL, ("Copy from user space failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "Copy from user space failed\n"); p->RIOError.Error = COPYIN_FAILED; return EFAULT; } return RIOAssignRta(p, &MapEnt); case RIO_CHANGE_NAME: - rio_dprint(RIO_DEBUG_CTRL, ("RIO_CHANGE_NAME\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_CHANGE_NAME\n"); if ( !su ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_CHANGE_NAME !Root\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_CHANGE_NAME !Root\n"); p->RIOError.Error = NOT_SUPER_USER; return EPERM; } if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt)) == COPYFAIL) { - rio_dprint(RIO_DEBUG_CTRL, ("Copy from user space failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "Copy from user space failed\n"); p->RIOError.Error = COPYIN_FAILED; return EFAULT; } return RIOChangeName(p, &MapEnt); case RIO_DELETE_RTA: - rio_dprint(RIO_DEBUG_CTRL, ("RIO_DELETE_RTA\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_DELETE_RTA\n"); if ( !su ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_DELETE_RTA !Root\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_DELETE_RTA !Root\n"); p->RIOError.Error = NOT_SUPER_USER; return EPERM; } if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt)) == COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("Copy from data space failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "Copy from data space failed\n"); p->RIOError.Error = COPYIN_FAILED; return EFAULT; } @@ -638,7 +638,7 @@ RIO_DEBUG_CTRL, if (su) return 0; case RIO_GET_LOG: - rio_dprint(RIO_DEBUG_CTRL, ("RIO_GET_LOG\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_LOG\n"); #ifdef LOGGING RIOGetLog(arg); return 0; @@ -653,17 +653,17 @@ RIO_DEBUG_CTRL, if (su) p->RIOError.Error = COPYIN_FAILED; return EFAULT; } - rio_dprint(RIO_DEBUG_CTRL, ("Get module type for port %d\n", port)); + rio_dprintk (RIO_DEBUG_CTRL, "Get module type for port %d\n", port); if ( port < 0 || port > 511 ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_GET_MODTYPE: Bad port number %d\n", port)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Bad port number %d\n", port); p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; return EINVAL; } PortP = (p->RIOPortp[port]); if (!PortP->Mapped) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_GET_MODTYPE: Port %d not mapped\n", port)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Port %d not mapped\n", port); p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM; return EINVAL; } @@ -703,7 +703,7 @@ RIO_DEBUG_CTRL, if (su) */ case RIO_BLOCK_OPENS: - rio_dprint(RIO_DEBUG_CTRL, ("Opens block until booted\n")); + rio_dprintk (RIO_DEBUG_CTRL, "Opens block until booted\n"); for ( Entry=0; Entry < RIO_PORTS; Entry++ ) { rio_spin_lock_irqsave(&PortP->portSem, flags); p->RIOPortp[Entry]->WaitUntilBooted = 1; @@ -712,33 +712,33 @@ RIO_DEBUG_CTRL, if (su) return 0; case RIO_SETUP_PORTS: - rio_dprint(RIO_DEBUG_CTRL, ("Setup ports\n")); + rio_dprintk (RIO_DEBUG_CTRL, "Setup ports\n"); if (copyin((int)arg, (caddr_t)&PortSetup, sizeof(PortSetup)) == COPYFAIL ) { p->RIOError.Error = COPYIN_FAILED; - rio_dprint(RIO_DEBUG_CTRL, ("EFAULT")); + rio_dprintk (RIO_DEBUG_CTRL, "EFAULT"); return EFAULT; } if ( PortSetup.From > PortSetup.To || PortSetup.To >= RIO_PORTS ) { p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; - rio_dprint(RIO_DEBUG_CTRL, ("ENXIO")); + rio_dprintk (RIO_DEBUG_CTRL, "ENXIO"); return ENXIO; } if ( PortSetup.XpCps > p->RIOConf.MaxXpCps || PortSetup.XpCps < p->RIOConf.MinXpCps ) { p->RIOError.Error = XPRINT_CPS_OUT_OF_RANGE; - rio_dprint(RIO_DEBUG_CTRL, ("EINVAL")); + rio_dprintk (RIO_DEBUG_CTRL, "EINVAL"); return EINVAL; } if ( !p->RIOPortp ) { cprintf("No p->RIOPortp array!\n"); - rio_dprint(RIO_DEBUG_CTRL, ("No p->RIOPortp array!\n")); + rio_dprintk (RIO_DEBUG_CTRL, "No p->RIOPortp array!\n"); return EIO; } - rio_dprint(RIO_DEBUG_CTRL, ("entering loop (%d %d)!\n", PortSetup.From, PortSetup.To)); + rio_dprintk (RIO_DEBUG_CTRL, "entering loop (%d %d)!\n", PortSetup.From, PortSetup.To); for (loop=PortSetup.From; loop<=PortSetup.To; loop++) { - rio_dprint(RIO_DEBUG_CTRL, ("in loop (%d)!\n", loop)); + rio_dprintk (RIO_DEBUG_CTRL, "in loop (%d)!\n", loop); #if 0 PortP = p->RIOPortp[loop]; if ( !PortP->TtyP ) @@ -791,12 +791,12 @@ RIO_DEBUG_CTRL, if (su) rio_spin_unlock_irqrestore( &PortP->portSem , flags); #endif } - rio_dprint(RIO_DEBUG_CTRL, ("after loop (%d)!\n", loop)); - rio_dprint(RIO_DEBUG_CTRL, ("Retval:%x\n", retval ) ); + rio_dprintk (RIO_DEBUG_CTRL, "after loop (%d)!\n", loop); + rio_dprintk (RIO_DEBUG_CTRL, "Retval:%x\n", retval); return retval; case RIO_GET_PORT_SETUP : - rio_dprint(RIO_DEBUG_CTRL, ("Get port setup\n")); + rio_dprintk (RIO_DEBUG_CTRL, "Get port setup\n"); if (copyin((int)arg, (caddr_t)&PortSetup, sizeof(PortSetup)) == COPYFAIL ) { p->RIOError.Error = COPYIN_FAILED; @@ -832,7 +832,7 @@ RIO_DEBUG_CTRL, if (su) return retval; case RIO_GET_PORT_PARAMS : - rio_dprint(RIO_DEBUG_CTRL, ("Get port params\n")); + rio_dprintk (RIO_DEBUG_CTRL, "Get port params\n"); if (copyin( (int)arg, (caddr_t)&PortParams, sizeof(struct PortParams)) == COPYFAIL) { p->RIOError.Error = COPYIN_FAILED; @@ -845,7 +845,7 @@ RIO_DEBUG_CTRL, if (su) PortP = (p->RIOPortp[PortParams.Port]); PortParams.Config = PortP->Config; PortParams.State = PortP->State; - rio_dprint(RIO_DEBUG_CTRL, ("Port %d\n", PortParams.Port)); + rio_dprintk (RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port); if (copyout((caddr_t)&PortParams, (int)arg, sizeof(struct PortParams)) == COPYFAIL ) { @@ -855,7 +855,7 @@ RIO_DEBUG_CTRL, if (su) return retval; case RIO_GET_PORT_TTY : - rio_dprint(RIO_DEBUG_CTRL, ("Get port tty\n")); + rio_dprintk (RIO_DEBUG_CTRL, "Get port tty\n"); if (copyin((int)arg, (caddr_t)&PortTty, sizeof(struct PortTty)) == COPYFAIL) { p->RIOError.Error = COPYIN_FAILED; @@ -866,7 +866,7 @@ RIO_DEBUG_CTRL, if (su) return ENXIO; } - rio_dprint(RIO_DEBUG_CTRL, ("Port %d\n", PortTty.port)); + rio_dprintk (RIO_DEBUG_CTRL, "Port %d\n", PortTty.port); PortP = (p->RIOPortp[PortTty.port]); #if 0 PortTty.Tty.tm.c_iflag = PortP->TtyP->tm.c_iflag; @@ -887,7 +887,7 @@ RIO_DEBUG_CTRL, if (su) p->RIOError.Error = COPYIN_FAILED; return EFAULT; } - rio_dprint(RIO_DEBUG_CTRL, ("Set port %d tty\n", PortTty.port)); + rio_dprintk (RIO_DEBUG_CTRL, "Set port %d tty\n", PortTty.port); if (PortTty.port >= (ushort) RIO_PORTS) { p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; return ENXIO; @@ -906,7 +906,7 @@ RIO_DEBUG_CTRL, if (su) return retval; case RIO_SET_PORT_PARAMS : - rio_dprint(RIO_DEBUG_CTRL, ("Set port params\n")); + rio_dprintk (RIO_DEBUG_CTRL, "Set port params\n"); if ( copyin((int)arg, (caddr_t)&PortParams, sizeof(PortParams)) == COPYFAIL ) { p->RIOError.Error = COPYIN_FAILED; @@ -923,7 +923,7 @@ RIO_DEBUG_CTRL, if (su) return retval; case RIO_GET_PORT_STATS : - rio_dprint(RIO_DEBUG_CTRL, ("RIO_GET_PORT_STATS\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n"); if ( copyin((int)arg, (caddr_t)&portStats, sizeof(struct portStats)) == COPYFAIL ) { p->RIOError.Error = COPYIN_FAILED; @@ -949,7 +949,7 @@ RIO_DEBUG_CTRL, if (su) case RIO_RESET_PORT_STATS : port = (uint) arg; - rio_dprint(RIO_DEBUG_CTRL, ("RIO_RESET_PORT_STATS\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n"); if ( port >= RIO_PORTS ) { p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; return ENXIO; @@ -965,7 +965,7 @@ RIO_DEBUG_CTRL, if (su) return retval; case RIO_GATHER_PORT_STATS : - rio_dprint(RIO_DEBUG_CTRL, ("RIO_GATHER_PORT_STATS\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n"); if ( copyin( (int)arg, (caddr_t)&portStats, sizeof(struct portStats)) == COPYFAIL ) { p->RIOError.Error = COPYIN_FAILED; @@ -985,22 +985,22 @@ RIO_DEBUG_CTRL, if (su) case RIO_READ_LEVELS: { int num; - rio_dprint(RIO_DEBUG_CTRL, ("RIO_READ_LEVELS\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_LEVELS\n"); for ( num=0; RIODbInf[num].Flag; num++ ) ; - rio_dprint(RIO_DEBUG_CTRL, ("%d levels to copy\n",num)); + rio_dprintk (RIO_DEBUG_CTRL, "%d levels to copy\n",num); if (copyout((caddr_t)RIODbInf,(int)arg, sizeof(struct DbInf)*(num+1))==COPYFAIL) { - rio_dprint(RIO_DEBUG_CTRL, ("ReadLevels Copy failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "ReadLevels Copy failed\n"); p->RIOError.Error = COPYOUT_FAILED; return EFAULT; } - rio_dprint(RIO_DEBUG_CTRL, ("%d levels to copied\n",num)); + rio_dprintk (RIO_DEBUG_CTRL, "%d levels to copied\n",num); return retval; } #endif case RIO_READ_CONFIG: - rio_dprint(RIO_DEBUG_CTRL, ("RIO_READ_CONFIG\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n"); if (copyout((caddr_t)&p->RIOConf, (int)arg, sizeof(struct Conf)) ==COPYFAIL ) { p->RIOError.Error = COPYOUT_FAILED; @@ -1009,7 +1009,7 @@ RIO_DEBUG_CTRL, if (su) return retval; case RIO_SET_CONFIG: - rio_dprint(RIO_DEBUG_CTRL, ("RIO_SET_CONFIG\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_CONFIG\n"); if ( !su ) { p->RIOError.Error = NOT_SUPER_USER; return EPERM; @@ -1029,11 +1029,11 @@ RIO_DEBUG_CTRL, if (su) return retval; case RIO_START_POLLER: - rio_dprint(RIO_DEBUG_CTRL, ("RIO_START_POLLER\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_START_POLLER\n"); return EINVAL; case RIO_STOP_POLLER: - rio_dprint(RIO_DEBUG_CTRL, ("RIO_STOP_POLLER\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_STOP_POLLER\n"); if ( !su ) { p->RIOError.Error = NOT_SUPER_USER; return EPERM; @@ -1043,7 +1043,7 @@ RIO_DEBUG_CTRL, if (su) case RIO_SETDEBUG: case RIO_GETDEBUG: - rio_dprint(RIO_DEBUG_CTRL, ("RIO_SETDEBUG/RIO_GETDEBUG\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_SETDEBUG/RIO_GETDEBUG\n"); if ( copyin( (int)arg, (caddr_t)&DebugCtrl, sizeof(DebugCtrl) ) ==COPYFAIL ) { p->RIOError.Error = COPYIN_FAILED; @@ -1057,18 +1057,18 @@ RIO_DEBUG_CTRL, if (su) } p->rio_debug = DebugCtrl.Debug; p->RIODebugWait = DebugCtrl.Wait; - rio_dprint(RIO_DEBUG_CTRL, ("Set global debug to 0x%x set wait to 0x%x\n", - p->rio_debug,p->RIODebugWait)); + rio_dprintk (RIO_DEBUG_CTRL, "Set global debug to 0x%x set wait to 0x%x\n", + p->rio_debug,p->RIODebugWait); } else { - rio_dprint(RIO_DEBUG_CTRL, ("Get global debug 0x%x wait 0x%x\n", - p->rio_debug,p->RIODebugWait)); + rio_dprintk (RIO_DEBUG_CTRL, "Get global debug 0x%x wait 0x%x\n", + p->rio_debug,p->RIODebugWait); DebugCtrl.Debug = p->rio_debug; DebugCtrl.Wait = p->RIODebugWait; if ( copyout((caddr_t)&DebugCtrl,(int)arg, sizeof(DebugCtrl)) == COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_SET/GET DEBUG: bad port number %d\n", - DebugCtrl.SysPort)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", + DebugCtrl.SysPort); p->RIOError.Error = COPYOUT_FAILED; return EFAULT; } @@ -1076,8 +1076,8 @@ RIO_DEBUG_CTRL, if (su) } else if ( DebugCtrl.SysPort >= RIO_PORTS && DebugCtrl.SysPort != NO_PORT ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_SET/GET DEBUG: bad port number %d\n", - DebugCtrl.SysPort)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", + DebugCtrl.SysPort); p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; return ENXIO; } @@ -1089,16 +1089,16 @@ RIO_DEBUG_CTRL, if (su) rio_spin_lock_irqsave(&PortP->portSem, flags); p->RIOPortp[DebugCtrl.SysPort]->Debug = DebugCtrl.Debug; rio_spin_unlock_irqrestore( &PortP->portSem , flags); - rio_dprint(RIO_DEBUG_CTRL, ("RIO_SETDEBUG 0x%x\n", - p->RIOPortp[DebugCtrl.SysPort]->Debug)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_SETDEBUG 0x%x\n", + p->RIOPortp[DebugCtrl.SysPort]->Debug); } else { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_GETDEBUG 0x%x\n", - p->RIOPortp[DebugCtrl.SysPort]->Debug)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n", + p->RIOPortp[DebugCtrl.SysPort]->Debug); DebugCtrl.Debug = p->RIOPortp[DebugCtrl.SysPort]->Debug; if ( copyout((caddr_t)&DebugCtrl,(int)arg, sizeof(DebugCtrl))==COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_GETDEBUG: Bad copy to user space\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n"); p->RIOError.Error = COPYOUT_FAILED; return EFAULT; } @@ -1111,12 +1111,12 @@ RIO_DEBUG_CTRL, if (su) ** We return MAX_VERSION_LEN bytes, being a ** textual null terminated string. */ - rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID\n") ); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_VERSID\n"); if ( copyout( (caddr_t)RIOVersid(), (int)arg, sizeof(struct rioVersion) ) == COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID: Bad copy to user space (host=%d)\n",Host) ); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host); p->RIOError.Error = COPYOUT_FAILED; return EFAULT; } @@ -1150,10 +1150,10 @@ RIO_DEBUG_CTRL, if (su) ** Enquire as to the number of hosts located ** at init time. */ - rio_dprint(RIO_DEBUG_CTRL, ("RIO_NUM_HOSTS\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n"); if (copyout((caddr_t)&p->RIONumHosts, (int)arg, sizeof(p->RIONumHosts) )==COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_NUM_HOSTS: Bad copy to user space\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n"); p->RIOError.Error = COPYOUT_FAILED; return EFAULT; } @@ -1163,9 +1163,9 @@ RIO_DEBUG_CTRL, if (su) /* ** Kill host. This may not be in the final version... */ - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_FOAD %d\n", (int)arg)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_FOAD %d\n", (int)arg); if ( !su ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_FOAD: Not super user\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n"); p->RIOError.Error = NOT_SUPER_USER; return EPERM; } @@ -1213,27 +1213,27 @@ RIO_DEBUG_CTRL, if (su) return retval; case RIO_DOWNLOAD: - rio_dprint(RIO_DEBUG_CTRL, ("RIO_DOWNLOAD\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD\n"); if ( !su ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_DOWNLOAD: Not super user\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Not super user\n"); p->RIOError.Error = NOT_SUPER_USER; return EPERM; } if ( copyin((int)arg, (caddr_t)&DownLoad, sizeof(DownLoad) )==COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_DOWNLOAD: Copy in from user space failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n"); p->RIOError.Error = COPYIN_FAILED; return EFAULT; } - rio_dprint(RIO_DEBUG_CTRL, ("Copied in download code for product code 0x%x\n", - DownLoad.ProductCode ) ); + rio_dprintk (RIO_DEBUG_CTRL, "Copied in download code for product code 0x%x\n", + DownLoad.ProductCode); /* ** It is important that the product code is an unsigned object! */ if ( DownLoad.ProductCode > MAX_PRODUCT ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_DOWNLOAD: Bad product code %d passed\n", - DownLoad.ProductCode)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Bad product code %d passed\n", + DownLoad.ProductCode); p->RIOError.Error = NO_SUCH_PRODUCT; return ENXIO; } @@ -1254,63 +1254,63 @@ RIO_DEBUG_CTRL, if (su) if (copyin((int)arg, (caddr_t)&host, sizeof(host) ) == COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ( - "RIO_HOST_REQ: Copy in from user space failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, + "RIO_HOST_REQ: Copy in from user space failed\n"); p->RIOError.Error = COPYIN_FAILED; return EFAULT; } /* ** Fetch the parmmap */ - rio_dprint(RIO_DEBUG_CTRL, ("RIO_PARMS\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_PARMS\n"); if ( copyout( (caddr_t)p->RIOHosts[host].ParmMapP, (int)arg, sizeof(PARM_MAP) )==COPYFAIL ) { p->RIOError.Error = COPYOUT_FAILED; - rio_dprint(RIO_DEBUG_CTRL, ("RIO_PARMS: Copy out to user space failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n"); return EFAULT; } } return retval; case RIO_HOST_REQ: - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_REQ\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ\n"); if (copyin((int)arg, (caddr_t)&HostReq, sizeof(HostReq) )==COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_REQ: Copy in from user space failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); p->RIOError.Error = COPYIN_FAILED; return EFAULT; } if ( HostReq.HostNum >= p->RIONumHosts ) { p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_REQ: Illegal host number %d\n", - HostReq.HostNum)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Illegal host number %d\n", + HostReq.HostNum); return ENXIO; } - rio_dprint(RIO_DEBUG_CTRL, ("Request for host %d\n", HostReq.HostNum)); + rio_dprintk (RIO_DEBUG_CTRL, "Request for host %d\n", HostReq.HostNum); if (copyout((caddr_t)&p->RIOHosts[HostReq.HostNum], (int)HostReq.HostP,sizeof(struct Host) ) == COPYFAIL) { p->RIOError.Error = COPYOUT_FAILED; - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_REQ: Bad copy to user space\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Bad copy to user space\n"); return EFAULT; } return retval; case RIO_HOST_DPRAM: - rio_dprint(RIO_DEBUG_CTRL, ("Request for DPRAM\n")); + rio_dprintk (RIO_DEBUG_CTRL, "Request for DPRAM\n"); if ( copyin( (int)arg, (caddr_t)&HostDpRam, sizeof(HostDpRam) )==COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_DPRAM: Copy in from user space failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n"); p->RIOError.Error = COPYIN_FAILED; return EFAULT; } if ( HostDpRam.HostNum >= p->RIONumHosts ) { p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_DPRAM: Illegal host number %d\n", - HostDpRam.HostNum)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Illegal host number %d\n", + HostDpRam.HostNum); return ENXIO; } - rio_dprint(RIO_DEBUG_CTRL, ("Request for host %d\n", HostDpRam.HostNum)); + rio_dprintk (RIO_DEBUG_CTRL, "Request for host %d\n", HostDpRam.HostNum); if (p->RIOHosts[HostDpRam.HostNum].Type == RIO_PCI) { int off; @@ -1321,7 +1321,7 @@ RIO_DEBUG_CTRL, if (su) if ( copyout( (caddr_t)copy, (int)HostDpRam.DpRamP, sizeof(struct DpRam) ) == COPYFAIL ) { p->RIOError.Error = COPYOUT_FAILED; - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_DPRAM: Bad copy to user space\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); return EFAULT; } } @@ -1329,15 +1329,15 @@ RIO_DEBUG_CTRL, if (su) (int)HostDpRam.DpRamP, sizeof(struct DpRam) ) == COPYFAIL ) { p->RIOError.Error = COPYOUT_FAILED; - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_DPRAM: Bad copy to user space\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); return EFAULT; } return retval; case RIO_SET_BUSY: - rio_dprint(RIO_DEBUG_CTRL, ("RIO_SET_BUSY\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_BUSY\n"); if ( (int)arg < 0 || (int)arg > 511 ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_SET_BUSY: Bad port number %d\n",(int)arg)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %d\n",(int)arg); p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; return EINVAL; } @@ -1351,26 +1351,26 @@ RIO_DEBUG_CTRL, if (su) ** The daemon want port information ** (probably for debug reasons) */ - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_PORT\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT\n"); if ( copyin((int)arg, (caddr_t)&PortReq, sizeof(PortReq) )==COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_PORT: Copy in from user space failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n"); p->RIOError.Error = COPYIN_FAILED; return EFAULT; } if (PortReq.SysPort >= RIO_PORTS) { /* SysPort is unsigned */ - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_PORT: Illegal port number %d\n", - PortReq.SysPort)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Illegal port number %d\n", + PortReq.SysPort); p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; return ENXIO; } - rio_dprint(RIO_DEBUG_CTRL, ("Request for port %d\n", PortReq.SysPort)); + rio_dprintk (RIO_DEBUG_CTRL, "Request for port %d\n", PortReq.SysPort); if (copyout((caddr_t)p->RIOPortp[PortReq.SysPort], (int)PortReq.PortP, sizeof(struct Port) ) == COPYFAIL) { p->RIOError.Error = COPYOUT_FAILED; - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_PORT: Bad copy to user space\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Bad copy to user space\n"); return EFAULT; } return retval; @@ -1380,40 +1380,40 @@ RIO_DEBUG_CTRL, if (su) ** The daemon want rup information ** (probably for debug reasons) */ - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_RUP\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP\n"); if (copyin((int)arg, (caddr_t)&RupReq, sizeof(RupReq) )==COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_RUP: Copy in from user space failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n"); p->RIOError.Error = COPYIN_FAILED; return EFAULT; } if (RupReq.HostNum >= p->RIONumHosts) { /* host is unsigned */ - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_RUP: Illegal host number %d\n", - RupReq.HostNum)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal host number %d\n", + RupReq.HostNum); p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; return ENXIO; } if ( RupReq.RupNum >= MAX_RUP+LINKS_PER_UNIT ) { /* eek! */ - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_RUP: Illegal rup number %d\n", - RupReq.RupNum)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal rup number %d\n", + RupReq.RupNum); p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; return EINVAL; } HostP = &p->RIOHosts[RupReq.HostNum]; if ((HostP->Flags & RUN_STATE) != RC_RUNNING) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_RUP: Host %d not running\n", - RupReq.HostNum)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Host %d not running\n", + RupReq.HostNum); p->RIOError.Error = HOST_NOT_RUNNING; return EIO; } - rio_dprint(RIO_DEBUG_CTRL, ("Request for rup %d from host %d\n", - RupReq.RupNum,RupReq.HostNum)); + rio_dprintk (RIO_DEBUG_CTRL, "Request for rup %d from host %d\n", + RupReq.RupNum,RupReq.HostNum); if (copyout((caddr_t)HostP->UnixRups[RupReq.RupNum].RupP, (int)RupReq.RupP,sizeof(struct RUP) ) == COPYFAIL) { p->RIOError.Error = COPYOUT_FAILED; - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_RUP: Bad copy to user space\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n"); return EFAULT; } return retval; @@ -1423,39 +1423,39 @@ RIO_DEBUG_CTRL, if (su) ** The daemon want lpb information ** (probably for debug reasons) */ - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_LPB\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB\n"); if (copyin((int)arg, (caddr_t)&LpbReq, sizeof(LpbReq) )==COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_LPB: Bad copy from user space\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n"); p->RIOError.Error = COPYIN_FAILED; return EFAULT; } if (LpbReq.Host >= p->RIONumHosts) { /* host is unsigned */ - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_LPB: Illegal host number %d\n", - LpbReq.Host)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal host number %d\n", + LpbReq.Host); p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; return ENXIO; } if ( LpbReq.Link >= LINKS_PER_UNIT ) { /* eek! */ - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_LPB: Illegal link number %d\n", - LpbReq.Link)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal link number %d\n", + LpbReq.Link); p->RIOError.Error = LINK_NUMBER_OUT_OF_RANGE; return EINVAL; } HostP = &p->RIOHosts[LpbReq.Host]; if ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_LPB: Host %d not running\n", - LpbReq.Host)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Host %d not running\n", + LpbReq.Host ); p->RIOError.Error = HOST_NOT_RUNNING; return EIO; } - rio_dprint(RIO_DEBUG_CTRL, ("Request for lpb %d from host %d\n", - LpbReq.Link, LpbReq.Host)); + rio_dprintk (RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n", + LpbReq.Link, LpbReq.Host); if (copyout((caddr_t)&HostP->LinkStrP[LpbReq.Link], (int)LpbReq.LpbP,sizeof(struct LPB) ) == COPYFAIL) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_HOST_LPB: Bad copy to user space\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n"); p->RIOError.Error = COPYOUT_FAILED; return EFAULT; } @@ -1494,7 +1494,7 @@ RIO_DEBUG_CTRL, if (su) p->RIOError.Error = NOT_RECEIVING_PROCESS; return EPERM; } - rio_dprint(RIO_DEBUG_CTRL, ("Clear signal process to zero\n")); + rio_dprintk (RIO_DEBUG_CTRL, "Clear signal process to zero\n"); p->RIOSignalProcess = 0; return retval; @@ -1526,10 +1526,10 @@ RIO_DEBUG_CTRL, if (su) case RIO_MAP_B50_TO_57600: case RIO_MAP_B110_TO_110: case RIO_MAP_B110_TO_115200: - rio_dprint(RIO_DEBUG_CTRL, ("Baud rate mapping\n")); + rio_dprintk (RIO_DEBUG_CTRL, "Baud rate mapping\n"); port = (uint) arg; if ( port < 0 || port > 511 ) { - rio_dprint(RIO_DEBUG_CTRL, ("Baud rate mapping: Bad port number %d\n", port)); + rio_dprintk (RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port); p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; return EINVAL; } @@ -1553,14 +1553,14 @@ RIO_DEBUG_CTRL, if (su) return retval; case RIO_STREAM_INFO: - rio_dprint(RIO_DEBUG_CTRL, ("RIO_STREAM_INFO\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_STREAM_INFO\n"); return EINVAL; case RIO_SEND_PACKET: - rio_dprint(RIO_DEBUG_CTRL, ("RIO_SEND_PACKET\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n"); if ( copyin( (int)arg, (caddr_t)&SendPack, sizeof(SendPack) )==COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_SEND_PACKET: Bad copy from user space\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n"); p->RIOError.Error = COPYIN_FAILED; return EFAULT; } @@ -1605,7 +1605,7 @@ RIO_DEBUG_CTRL, if (su) case RIO_WHAT_MESG: if ( copyout( (caddr_t)&p->RIONoMessage, (int)arg, sizeof(p->RIONoMessage) )==COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_WHAT_MESG: Bad copy to user space\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n"); p->RIOError.Error = COPYOUT_FAILED; return EFAULT; } @@ -1617,8 +1617,8 @@ RIO_DEBUG_CTRL, if (su) p->RIOError.Error = COPYIN_FAILED; return EFAULT; } - rio_dprint(RIO_DEBUG_CTRL, ("RIO_MEM_DUMP host %d rup %d addr %x\n", - SubCmd.Host, SubCmd.Rup, SubCmd.Addr)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP host %d rup %d addr %x\n", + SubCmd.Host, SubCmd.Rup, SubCmd.Addr); if (SubCmd.Rup >= MAX_RUP+LINKS_PER_UNIT ) { p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; @@ -1638,7 +1638,7 @@ RIO_DEBUG_CTRL, if (su) rio_spin_lock_irqsave(&PortP->portSem, flags); if ( RIOPreemptiveCmd(p, PortP, MEMDUMP ) == RIO_FAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_MEM_DUMP failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP failed\n"); rio_spin_unlock_irqrestore( &PortP->portSem , flags); return EBUSY; } @@ -1648,7 +1648,7 @@ RIO_DEBUG_CTRL, if (su) rio_spin_unlock_irqrestore( &PortP->portSem , flags); if ( copyout( (caddr_t)p->RIOMemDump, (int)arg, MEMDUMP_SIZE) == COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_MEM_DUMP copy failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n"); p->RIOError.Error = COPYOUT_FAILED; return EFAULT; } @@ -1657,14 +1657,14 @@ RIO_DEBUG_CTRL, if (su) case RIO_TICK: if ((int)arg < 0 || (int)arg >= p->RIONumHosts) return EINVAL; - rio_dprint(RIO_DEBUG_CTRL, ("Set interrupt for host %d\n", (int)arg )); + rio_dprintk (RIO_DEBUG_CTRL, "Set interrupt for host %d\n", (int)arg); WBYTE(p->RIOHosts[(int)arg].SetInt , 0xff); return 0; case RIO_TOCK: if ((int)arg < 0 || (int)arg >= p->RIONumHosts) return EINVAL; - rio_dprint(RIO_DEBUG_CTRL, ("Clear interrupt for host %d\n", (int)arg )); + rio_dprintk (RIO_DEBUG_CTRL, "Clear interrupt for host %d\n", (int)arg); WBYTE((p->RIOHosts[(int)arg].ResetInt) , 0xff); return 0; @@ -1684,12 +1684,12 @@ RIO_DEBUG_CTRL, if (su) p->RIOError.Error = COPYIN_FAILED; return EFAULT; } - rio_dprint(RIO_DEBUG_CTRL, ("RIO_READ_REGISTER host %d rup %d port %d reg %x\n", - SubCmd.Host, SubCmd.Rup, SubCmd.Port, SubCmd.Addr)); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER host %d rup %d port %d reg %x\n", + SubCmd.Host, SubCmd.Rup, SubCmd.Port, SubCmd.Addr); if (SubCmd.Port > 511) { - rio_dprint(RIO_DEBUG_CTRL, ("Baud rate mapping: Bad port number %d\n", - SubCmd.Port)); + rio_dprintk (RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", + SubCmd.Port); p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; return EINVAL; } @@ -1711,7 +1711,7 @@ RIO_DEBUG_CTRL, if (su) rio_spin_lock_irqsave(&PortP->portSem, flags); if (RIOPreemptiveCmd(p, PortP, READ_REGISTER) == RIO_FAIL) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_READ_REGISTER failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER failed\n"); rio_spin_unlock_irqrestore( &PortP->portSem , flags); return EBUSY; } @@ -1721,7 +1721,7 @@ RIO_DEBUG_CTRL, if (su) rio_spin_unlock_irqrestore( &PortP->portSem , flags); if (copyout((caddr_t)&p->CdRegister, (int)arg, sizeof(uint)) == COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_READ_REGISTER copy failed\n")); + rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n"); p->RIOError.Error = COPYOUT_FAILED; return EFAULT; } @@ -1738,18 +1738,18 @@ RIO_DEBUG_CTRL, if (su) switch ( (uint)arg & RIO_DEV_MASK ) { case RIO_DEV_DIRECT: arg = (caddr_t)drv_makedev(major(dev), port); - rio_dprint(RIO_DEBUG_CTRL, ("Makedev direct 0x%x is 0x%x\n",port, (int)arg )); + rio_dprintk (RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n",port, (int)arg); return (int)arg; case RIO_DEV_MODEM: arg = (caddr_t)drv_makedev(major(dev), (port|RIO_MODEM_BIT) ); - rio_dprint(RIO_DEBUG_CTRL, ("Makedev modem 0x%x is 0x%x\n",port, (int)arg )); + rio_dprintk (RIO_DEBUG_CTRL, "Makedev modem 0x%x is 0x%x\n",port, (int)arg); return (int)arg; case RIO_DEV_XPRINT: arg = (caddr_t)drv_makedev(major(dev), port); - rio_dprint(RIO_DEBUG_CTRL, ("Makedev printer 0x%x is 0x%x\n",port, (int)arg )); + rio_dprintk (RIO_DEBUG_CTRL, "Makedev printer 0x%x is 0x%x\n",port, (int)arg); return (int)arg; } - rio_dprint(RIO_DEBUG_CTRL, ("MAKE Device is called\n")); + rio_dprintk (RIO_DEBUG_CTRL, "MAKE Device is called\n"); return EINVAL; } /* @@ -1766,17 +1766,17 @@ RIO_DEBUG_CTRL, if (su) mino = RIO_UNMODEM(dv); if ( RIO_ISMODEM(dv) ) { - rio_dprint(RIO_DEBUG_CTRL, ("Minor for device 0x%x: modem %d\n", dv, mino)); + rio_dprintk (RIO_DEBUG_CTRL, "Minor for device 0x%x: modem %d\n", dv, mino); arg = (caddr_t)(mino | RIO_DEV_MODEM); } else { - rio_dprint(RIO_DEBUG_CTRL, ("Minor for device 0x%x: direct %d\n", dv, mino)); + rio_dprintk (RIO_DEBUG_CTRL, "Minor for device 0x%x: direct %d\n", dv, mino); arg = (caddr_t)(mino | RIO_DEV_DIRECT); } return (int)arg; } } - rio_dprint(RIO_DEBUG_CTRL, ("INVALID DAEMON IOCTL 0x%x\n",cmd)); + rio_dprintk (RIO_DEBUG_CTRL, "INVALID DAEMON IOCTL 0x%x\n",cmd); p->RIOError.Error = IOCTL_COMMAND_UNKNOWN; func_exit (); @@ -1803,18 +1803,18 @@ uchar Cmd; #endif if ( PortP->State & RIO_DELETED ) { - rio_dprint(RIO_DEBUG_CTRL, ("Preemptive command to deleted RTA ignored\n")); + rio_dprintk (RIO_DEBUG_CTRL, "Preemptive command to deleted RTA ignored\n"); return RIO_FAIL; } if (((int)((char)PortP->InUse) == -1) || ! (CmdBlkP = RIOGetCmdBlk()) ) { - rio_dprint(RIO_DEBUG_CTRL, ("Cannot allocate command block for command %d on port %d\n", - Cmd, PortP->PortNum)); + rio_dprintk (RIO_DEBUG_CTRL, "Cannot allocate command block for command %d on port %d\n", + Cmd, PortP->PortNum); return RIO_FAIL; } - rio_dprint(RIO_DEBUG_CTRL, ("Command blk 0x%x - InUse now %d\n", - (int)CmdBlkP,PortP->InUse)); + rio_dprintk (RIO_DEBUG_CTRL, "Command blk 0x%x - InUse now %d\n", + (int)CmdBlkP,PortP->InUse); PktCmdP = (struct PktCmd_M *)&CmdBlkP->Packet.data[0]; @@ -1840,40 +1840,40 @@ uchar Cmd; switch ( Cmd ) { case MEMDUMP: - rio_dprint(RIO_DEBUG_CTRL, ("Queue MEMDUMP command blk 0x%x (addr 0x%x)\n", - (int)CmdBlkP, (int)SubCmd.Addr)); + rio_dprintk (RIO_DEBUG_CTRL, "Queue MEMDUMP command blk 0x%x (addr 0x%x)\n", + (int)CmdBlkP, (int)SubCmd.Addr); PktCmdP->SubCommand = MEMDUMP; PktCmdP->SubAddr = SubCmd.Addr; break; case FCLOSE: - rio_dprint(RIO_DEBUG_CTRL, ("Queue FCLOSE command blk 0x%x\n",(int)CmdBlkP)); + rio_dprintk (RIO_DEBUG_CTRL, "Queue FCLOSE command blk 0x%x\n",(int)CmdBlkP); break; case READ_REGISTER: - rio_dprint(RIO_DEBUG_CTRL, ("Queue READ_REGISTER (0x%x) command blk 0x%x\n", - (int)SubCmd.Addr, (int)CmdBlkP)); + rio_dprintk (RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk 0x%x\n", + (int)SubCmd.Addr, (int)CmdBlkP); PktCmdP->SubCommand = READ_REGISTER; PktCmdP->SubAddr = SubCmd.Addr; break; case RESUME: - rio_dprint(RIO_DEBUG_CTRL, ("Queue RESUME command blk 0x%x\n",(int)CmdBlkP)); + rio_dprintk (RIO_DEBUG_CTRL, "Queue RESUME command blk 0x%x\n",(int)CmdBlkP); break; case RFLUSH: - rio_dprint(RIO_DEBUG_CTRL, ("Queue RFLUSH command blk 0x%x\n",(int)CmdBlkP)); + rio_dprintk (RIO_DEBUG_CTRL, "Queue RFLUSH command blk 0x%x\n",(int)CmdBlkP); CmdBlkP->PostFuncP = RIORFlushEnable; break; case SUSPEND: - rio_dprint(RIO_DEBUG_CTRL, ("Queue SUSPEND command blk 0x%x\n",(int)CmdBlkP)); + rio_dprintk (RIO_DEBUG_CTRL, "Queue SUSPEND command blk 0x%x\n",(int)CmdBlkP); break; case MGET : - rio_dprint(RIO_DEBUG_CTRL, ("Queue MGET command blk 0x%x\n", (int)CmdBlkP)); + rio_dprintk (RIO_DEBUG_CTRL, "Queue MGET command blk 0x%x\n", (int)CmdBlkP); break; case MSET : case MBIC : case MBIS : CmdBlkP->Packet.data[4] = (char) PortP->ModemLines; - rio_dprint(RIO_DEBUG_CTRL, ("Queue MSET/MBIC/MBIS command blk 0x%x\n", (int)CmdBlkP)); + rio_dprintk (RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command blk 0x%x\n", (int)CmdBlkP); break; case WFLUSH: @@ -1883,12 +1883,12 @@ uchar Cmd; ** RTA. */ if ((int)((char)PortP->WflushFlag) == (int)-1) { - rio_dprint(RIO_DEBUG_CTRL, ("Trashed WFLUSH, WflushFlag about to wrap!")); + rio_dprintk (RIO_DEBUG_CTRL, "Trashed WFLUSH, WflushFlag about to wrap!"); RIOFreeCmdBlk(CmdBlkP); return(RIO_FAIL); } else { - rio_dprint(RIO_DEBUG_CTRL, ("Queue WFLUSH command blk 0x%x\n", - (int)CmdBlkP)); + rio_dprintk (RIO_DEBUG_CTRL, "Queue WFLUSH command blk 0x%x\n", + (int)CmdBlkP); CmdBlkP->PostFuncP = RIOWFlushMark; } break; diff --git a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c index 59cfdedd5cf8..cbefdac2d989 100644 --- a/drivers/char/rio/rioinit.c +++ b/drivers/char/rio/rioinit.c @@ -81,7 +81,7 @@ static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3"; #include "control.h" #include "cirrus.h" #include "rioioctl.h" - +#include "rio_linux.h" #undef bcopy #define bcopy rio_pcicopy @@ -109,7 +109,7 @@ struct RioHostInfo * info; */ if ( !p->RIOPortp ) { - rio_dprint(RIO_DEBUG_INIT, ("Allocating and setting up driver data structures\n") ); + rio_dprintk (RIO_DEBUG_INIT, "Allocating and setting up driver data structures\n"); RIOAllocDataStructs(p); /* allocate host/port structs */ RIOSetupDataStructs(p); /* setup topology structs */ @@ -155,16 +155,16 @@ struct RioHostInfo * info; if ( info->bus & ISA_BUS ) { - rio_dprint(RIO_DEBUG_INIT, ("initialising card %d (ISA)\n", p->RIONumHosts) ); + rio_dprintk (RIO_DEBUG_INIT, "initialising card %d (ISA)\n", p->RIONumHosts); RIOISAinit(p, p->mode); } else { - rio_dprint(RIO_DEBUG_INIT, ("initialising card %d (PCI)\n", p->RIONumHosts) ); + rio_dprintk (RIO_DEBUG_INIT, "initialising card %d (PCI)\n", p->RIONumHosts); RIOPCIinit(p, RIO_PCI_DEFAULT_MODE); } - rio_dprint(RIO_DEBUG_INIT, ("Total hosts initialised so far : %d\n", p->RIONumHosts) ); + rio_dprintk (RIO_DEBUG_INIT, "Total hosts initialised so far : %d\n", p->RIONumHosts); #ifdef FUTURE_RELEASE @@ -193,13 +193,13 @@ int mode; p->intr_tid = iointset(p->RIOHosts[p->RIONumHosts].Ivec, (int (*)())rio_intr, (char*)p->RIONumHosts); - rio_dprint(RIO_DEBUG_INIT, ("Set interrupt handler, intr_tid = 0x%x\n", p->intr_tid ) ); + rio_dprintk (RIO_DEBUG_INIT, "Set interrupt handler, intr_tid = 0x%x\n", p->intr_tid ); if (RIODoAT(p, p->RIOHosts[p->RIONumHosts].PaddrP, mode)) { return; } else { - rio_dprint(RIO_DEBUG_INIT, ("RIODoAT failed\n")); + rio_dprintk (RIO_DEBUG_INIT, "RIODoAT failed\n"); p->RIOFailed++; } #endif @@ -268,7 +268,7 @@ int Base; ** map it in in one 64K block. */ if (RIOMapin(Base, RIO_AT_MEM_SIZE, &virtAddr) == -1) { - rio_dprint(RIO_DEBUG_INIT, ("RIO-init: Couldn't map the board in!\n")); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Couldn't map the board in!\n"); return((caddr_t)0); } @@ -285,8 +285,8 @@ int Base; ** Signature mismatch - card not at this address */ RIOMapout(Base, RIO_AT_MEM_SIZE, virtAddr); - rio_dprint(RIO_DEBUG_INIT, ("RIO-init: Couldn't match the signature 0x%x 0x%x!\n", - (int)cardp, off)); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Couldn't match the signature 0x%x 0x%x!\n", + (int)cardp, off); return((caddr_t)0); } } @@ -356,10 +356,10 @@ int mode; ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1])&0xFF)<<8)| ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2])&0xFF)<<16)| ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3])&0xFF)<<24); - rio_dprint(RIO_DEBUG_INIT, ("RIO-init: Uniquenum 0x%x\n",p->RIOHosts[p->RIONumHosts].UniqueNum)); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Uniquenum 0x%x\n",p->RIOHosts[p->RIONumHosts].UniqueNum); p->RIONumHosts++; - rio_dprint(RIO_DEBUG_INIT, ("RIO-init: Tests Passed at 0x%x\n", Base)); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Tests Passed at 0x%x\n", Base); return(1); } #if 0 @@ -378,7 +378,7 @@ int RIOMCAinit(int Mode) ** is only FAST LINKS */ Mode = (Mode & FAST_LINKS) ? McaTpFastLinks : McaTpSlowLinks; - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"RIOMCAinit(%d)\n",Mode); + rio_dprintk (RIO_DEBUG_INIT, "RIOMCAinit(%d)\n",Mode); /* @@ -395,7 +395,7 @@ int RIOMCAinit(int Mode) */ if (((inb(McaIdHigh)<< 8)|inb(McaIdLow)) == McaRIOId) { - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"Potential MCA card in slot %d\n",SlotNumber); + rio_dprintk (RIO_DEBUG_INIT, "Potential MCA card in slot %d\n", SlotNumber); /* ** Card appears to be a RIO MCA card! @@ -417,48 +417,44 @@ int RIOMCAinit(int Mode) */ Ivec = inb(McaIrqEnable); - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"Ivec is %x\n",Ivec); + rio_dprintk (RIO_DEBUG_INIT, "Ivec is %x\n", Ivec); switch ( Ivec & McaIrqMask ) { case McaIrq9: - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"IRQ9\n"); + rio_dprintk (RIO_DEBUG_INIT, "IRQ9\n"); break; case McaIrq3: - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"IRQ3\n"); + rio_dprintk (RIO_DEBUG_INIT, "IRQ3\n"); break; case McaIrq4: - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"IRQ4\n"); + rio_dprintk (RIO_DEBUG_INIT, "IRQ4\n"); break; case McaIrq7: - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"IRQ7\n"); + rio_dprintk (RIO_DEBUG_INIT, "IRQ7\n"); break; case McaIrq10: - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"IRQ10\n"); + rio_dprintk (RIO_DEBUG_INIT, "IRQ10\n"); break; case McaIrq11: - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"IRQ11\n"); + rio_dprintk (RIO_DEBUG_INIT, "IRQ11\n"); break; case McaIrq12: - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"IRQ12\n"); + rio_dprintk (RIO_DEBUG_INIT, "IRQ12\n"); break; case McaIrq15: - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"IRQ15\n"); + rio_dprintk (RIO_DEBUG_INIT, "IRQ15\n"); break; } /* ** If the card enable bit isn't set, then set it! */ - if ((Ivec & McaCardEnable) != McaCardEnable ) - { - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"McaCardEnable not set - setting!\n"); - outb(McaIrqEnable,Ivec|McaCardEnable); - } - else - { - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"McaCardEnable already set\n"); - } + if ((Ivec & McaCardEnable) != McaCardEnable) { + rio_dprintk (RIO_DEBUG_INIT, "McaCardEnable not set - setting!\n"); + outb(McaIrqEnable,Ivec|McaCardEnable); + } else + rio_dprintk (RIO_DEBUG_INIT, "McaCardEnable already set\n"); /* ** Convert the IRQ enable mask into something useful @@ -468,10 +464,10 @@ int RIOMCAinit(int Mode) /* ** Find the physical address */ - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"inb(McaMemory) is %x\n",inb(McaMemory)); + rio_dprintk (RIO_DEBUG_INIT, "inb(McaMemory) is %x\n", inb(McaMemory)); Paddr = McaAddress(inb(McaMemory)); - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"MCA card has Ivec %d Addr %x\n",Ivec,Paddr); + rio_dprintk (RIO_DEBUG_INIT, "MCA card has Ivec %d Addr %x\n", Ivec, Paddr); if ( Paddr != 0 ) { @@ -482,21 +478,20 @@ int RIOMCAinit(int Mode) Handle = RIOMapin( Paddr, RIO_MCA_MEM_SIZE, &Caddr ); if ( Handle == -1 ) { - rio_dprint(RIO_DEBUG_INIT, ("Couldn't map %d bytes at %x\n", RIO_MCA_MEM_SIZE,Paddr); + rio_dprintk (RIO_DEBUG_INIT, "Couldn't map %d bytes at %x\n", RIO_MCA_MEM_SIZE, Paddr; continue; } - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"Board mapped to vaddr 0x%x\n",Caddr); + rio_dprintk (RIO_DEBUG_INIT, "Board mapped to vaddr 0x%x\n", Caddr); /* ** And check that it is actually there! */ if ( RIOBoardTest( Paddr,Caddr,RIO_MCA,SlotNumber ) == RIO_SUCCESS ) { - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"Board has passed test\n"); - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT, - "Slot %d. Type %d. Paddr 0x%x. Caddr 0x%x. Mode 0x%x.\n", - SlotNumber,RIO_MCA,Paddr,Caddr,Mode); + rio_dprintk (RIO_DEBUG_INIT, "Board has passed test\n"); + rio_dprintk (RIO_DEBUG_INIT, "Slot %d. Type %d. Paddr 0x%x. Caddr 0x%x. Mode 0x%x.\n", + SlotNumber, RIO_MCA, Paddr, Caddr, Mode); /* ** Board has passed its scrub test. Fill in all the @@ -524,25 +519,25 @@ int RIOMCAinit(int Mode) /* ** It failed the test, so ignore it. */ - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_FAIL,"TEST FAILED\n"); + rio_dprintk (RIO_DEBUG_INIT, "TEST FAILED\n"); RIOMapout(Paddr, RIO_MCA_MEM_SIZE, Caddr ); } } else { - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"Slot %d - Paddr zero!\n",SlotNumber); + rio_dprintk (RIO_DEBUG_INIT, "Slot %d - Paddr zero!\n", SlotNumber); } } else { - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"Slot %d NOT RIO\n",SlotNumber); + rio_dprintk (RIO_DEBUG_INIT, "Slot %d NOT RIO\n", SlotNumber); } } /* ** Now we have checked all the slots, turn off the MCA slot selector */ outb(McaSlotSelect,0); - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"Slot %d NOT RIO\n",SlotNumber); + rio_dprintk (RIO_DEBUG_INIT, "Slot %d NOT RIO\n", SlotNumber); return ret; } @@ -565,13 +560,13 @@ int RIOEISAinit( int Mode ) if ( EISADone ) { - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"RIOEISAinit() - already done, return.\n"); + rio_dprintk (RIO_DEBUG_INIT, "RIOEISAinit() - already done, return.\n"); return(0); } EISADone++; - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"RIOEISAinit()\n"); + rio_dprintk (RIO_DEBUG_INIT, "RIOEISAinit()\n"); /* @@ -584,23 +579,21 @@ int RIOEISAinit( int Mode ) Ident = (INBZ(EisaSlot,EISA_PRODUCT_IDENT_HI)<<8) | INBZ(EisaSlot,EISA_PRODUCT_IDENT_LO); - /* rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT, "Check EISA slot %d, ID=%x\n",EisaSlot,Ident); */ - if ( Ident == RIO_EISA_IDENT ) { - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"Found Specialix product\n"); + rio_dprintk (RIO_DEBUG_INIT, "Found Specialix product\n"); if ( INBZ(EisaSlot,EISA_PRODUCT_NUMBER) != RIO_EISA_PRODUCT_CODE ) { - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"Not Specialix RIO - Product number %x\n", - INBZ(EisaSlot,EISA_PRODUCT_NUMBER)); + rio_dprintk (RIO_DEBUG_INIT, "Not Specialix RIO - Product number %x\n", + INBZ(EisaSlot, EISA_PRODUCT_NUMBER)); continue; /* next slot */ } /* ** Its a Specialix RIO! */ - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"RIO Revision %d\n", - INBZ(EisaSlot,EISA_REVISION_NUMBER)); + rio_dprintk (RIO_DEBUG_INIT, "RIO Revision %d\n", + INBZ(EisaSlot, EISA_REVISION_NUMBER)); RIOMachineType |= (1<RIOLastPCISearch != RIO_SUCCESS) ) { - rio_dprint(RIO_DEBUG_INIT, ("Currently testing slot %d\n", slot ) ); + rio_dprintk (RIO_DEBUG_INIT, "Currently testing slot %d\n", slot); if (read_config(0,slot,0) == RIO_PCI_JET_CARD) { p->RIOHosts[p->RIONumHosts].Ivec = 0; @@ -934,7 +927,7 @@ int Mode; Paddr = Paddr - (Paddr & 0x1); /* Mask off the io bit */ if ( (Paddr == 0) || ((Paddr & 0xffff0000) == 0xffff0000) ) { - rio_dprint(RIO_DEBUG_INIT, ("Goofed up slot\n") ); /* what! */ + rio_dprintk (RIO_DEBUG_INIT, "Goofed up slot\n"); /* what! */ slot++; continue; } @@ -942,11 +935,11 @@ int Mode; p->RIOHosts[p->RIONumHosts].PaddrP = Paddr; Ivec = (read_config(0,slot,0x3c) & 0xff); - rio_dprint(RIO_DEBUG_INIT, ("PCI Host at 0x%x, Intr %d\n", (int)Paddr, Ivec ) ); + rio_dprintk (RIO_DEBUG_INIT, "PCI Host at 0x%x, Intr %d\n", (int)Paddr, Ivec); Handle = RIOMapin( Paddr, RIO_PCI_MEM_SIZE, &Caddr ); if (Handle == -1) { - rio_dprint(RIO_DEBUG_INIT, ("Couldn't map %d bytes at 0x%x\n", RIO_PCI_MEM_SIZE, (int)Paddr ) ); + rio_dprintk (RIO_DEBUG_INIT, "Couldn't map %d bytes at 0x%x\n", RIO_PCI_MEM_SIZE, (int)Paddr); slot++; continue; } @@ -954,9 +947,8 @@ int Mode; p->intr_tid = iointset(p->RIOHosts[p->RIONumHosts].Ivec, (int (*)())rio_intr, (char *)p->RIONumHosts); if (RIOBoardTest( Paddr, Caddr, RIO_PCI, 0 ) == RIO_SUCCESS) { - rio_dprint(RIO_DEBUG_INIT, ("Board has passed test\n")); - rio_dprint(RIO_DEBUG_INIT, ("Paddr 0x%x. Caddr 0x%x. Mode 0x%x.\n", Paddr, Caddr, - Mode)); + rio_dprintk (RIO_DEBUG_INIT, ("Board has passed test\n"); + rio_dprintk (RIO_DEBUG_INIT, ("Paddr 0x%x. Caddr 0x%x. Mode 0x%x.\n", Paddr, Caddr, Mode); /* ** Board has passed its scrub test. Fill in all the @@ -991,8 +983,8 @@ int Mode; ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2])&0xFF)<<16)| ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3])&0xFF)<<24); - rio_dprint(RIO_DEBUG_INIT, ("Unique no 0x%x.\n", - p->RIOHosts[p->RIONumHosts].UniqueNum ) ); + rio_dprintk (RIO_DEBUG_INIT, "Unique no 0x%x.\n", + p->RIOHosts[p->RIONumHosts].UniqueNum); p->RIOLastPCISearch = RIO_SUCCESS; p->RIONumHosts++; @@ -1002,8 +994,8 @@ int Mode; } if ( slot >= MAX_PCI_SLOT ) { - rio_dprint(RIO_DEBUG_INIT, ("All %d PCI slots have tested for RIO cards !!!\n", - MAX_PCI_SLOT ) ); + rio_dprintk (RIO_DEBUG_INIT, "All %d PCI slots have tested for RIO cards !!!\n", + MAX_PCI_SLOT); } @@ -1025,7 +1017,7 @@ void riohalt( void ) int host; for ( host=0; hostRIONumHosts; host++ ) { - rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"Stop host %d\n",host); + rio_dprintk (RIO_DEBUG_INIT, "Stop host %d\n", host); (void)RIOBoardTest( p->RIOHosts[host].PaddrP, p->RIOHosts[host].Caddr, p->RIOHosts[host].Type,p->RIOHosts[host].Slot ); } } @@ -1058,8 +1050,8 @@ int slot; int op, bank; int nbanks; - rio_dprint(RIO_DEBUG_INIT, ("RIO-init: Reset host type=%d, DpRam=0x%x, slot=%d\n", - type,(int)DpRam,slot)); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Reset host type=%d, DpRam=0x%x, slot=%d\n", + type,(int)DpRam, slot); RIOHostReset(type, DpRam, slot); @@ -1071,7 +1063,7 @@ int slot; ** scratch - 1000h bytes */ - rio_dprint(RIO_DEBUG_INIT, ("RIO-init: Setup ram/size arrays\n")); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Setup ram/size arrays\n"); size[0] = DP_SRAM1_SIZE; size[1] = DP_SRAM2_SIZE; @@ -1087,12 +1079,12 @@ int slot; if (nbanks == 3) { - rio_dprint(RIO_DEBUG_INIT, ("RIO-init: Memory: 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x)\n", - (int)ram[0], size[0], (int)ram[1], size[1], (int)ram[2], size[2])); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Memory: 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x)\n", + (int)ram[0], size[0], (int)ram[1], size[1], (int)ram[2], size[2]); } else { - rio_dprint(RIO_DEBUG_INIT, ("RIO-init: 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x)\n", + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x)\n", (int)ram[0], size[0], (int)ram[1], size[1], (int)ram[2], size[2], (int)ram[3], - size[3])); + size[3]); } /* @@ -1103,14 +1095,14 @@ int slot; for (op=0; opRIOPortp = (struct Port *)sysbrk(RIO_PORTS * sizeof(struct Port)); if (!p->RIOPortp) { - rio_dprint(RIO_DEBUG_INIT, ("RIO-init: No memory for port structures\n")); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: No memory for port structures\n"); p->RIOFailed++; return; } bzero( p->RIOPortp, sizeof(struct Port) * RIO_PORTS ); - rio_dprint(RIO_DEBUG_INIT, ("RIO-init: allocated and cleared memory for port structs\n") ); - rio_dprint(RIO_DEBUG_INIT, ("First RIO port struct @0x%x, size=0x%x bytes\n", - (int)p->RIOPortp, sizeof(struct Port) ) ); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: allocated and cleared memory for port structs\n"); + rio_dprintk (RIO_DEBUG_INIT, "First RIO port struct @0x%x, size=0x%x bytes\n", + (int)p->RIOPortp, sizeof(struct Port)); for( port=0; portRIOPortp[port].PortNum = port; @@ -1404,14 +1396,14 @@ struct rio_info * p; p->RIOHosts = (struct Host *)sysbrk(RIO_HOSTS * sizeof(struct Host)); if (!p->RIOHosts) { - rio_dprint(RIO_DEBUG_INIT, ("RIO-init: No memory for host structures\n")); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: No memory for host structures\n"); p->RIOFailed++; return; } bzero(p->RIOHosts, sizeof(struct Host)*RIO_HOSTS); - rio_dprint(RIO_DEBUG_INIT, ("RIO-init: allocated and cleared memory for host structs\n")); - rio_dprint(RIO_DEBUG_INIT, ("First RIO host struct @0x%x, size=0x%x bytes\n", - (int)p->RIOHosts, sizeof(struct Host) ) ); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: allocated and cleared memory for host structs\n"); + rio_dprintk (RIO_DEBUG_INIT, "First RIO host struct @0x%x, size=0x%x bytes\n", + (int)p->RIOHosts, sizeof(struct Host)); for( host=0; hostRIOHosts[host].HostLock); @@ -1494,10 +1486,10 @@ struct rio_info * p; char * RIORelID = RELEASE_ID; int host; - rio_dprint(RIO_DEBUG_INIT, ("RIO : Release: %s ID: %s\n", RIORelease, RIORelID)); + rio_dprintk (RIO_DEBUG_INIT, "RIO : Release: %s ID: %s\n", RIORelease, RIORelID); if ( p->RIONumHosts==0 ) { - rio_dprint(RIO_DEBUG_INIT, ("\nNo Hosts configured\n")); + rio_dprintk (RIO_DEBUG_INIT, "\nNo Hosts configured\n"); return(0); } @@ -1505,7 +1497,7 @@ struct rio_info * p; struct Host *HostP = &p->RIOHosts[host]; switch ( HostP->Type ) { case RIO_AT: - rio_dprint(RIO_DEBUG_INIT, ("AT BUS : found the card at 0x%x\n", HostP->PaddrP)); + rio_dprintk (RIO_DEBUG_INIT, "AT BUS : found the card at 0x%x\n", HostP->PaddrP); } } return 0; @@ -1587,17 +1579,17 @@ uint Slot; /* ** Reset the Tpu */ - rio_dprint(RIO_DEBUG_INIT, ("RIOHostReset: type 0x%x", Type ) ); + rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: type 0x%x", Type); switch ( Type ) { case RIO_AT: - rio_dprint(RIO_DEBUG_INIT, (" (RIO_AT)\n")); + rio_dprintk (RIO_DEBUG_INIT, " (RIO_AT)\n"); WBYTE(DpRamP->DpControl, BOOT_FROM_RAM | EXTERNAL_BUS_OFF | INTERRUPT_DISABLE | BYTE_OPERATION | SLOW_LINKS | SLOW_AT_BUS); WBYTE(DpRamP->DpResetTpu, 0xFF); rio_udelay (3); - rio_dprint(RIO_DEBUG_INIT, ("RIOHostReset: Don't know if it worked. Try reset again\n") ); + rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: Don't know if it worked. Try reset again\n"); WBYTE(DpRamP->DpControl, BOOT_FROM_RAM | EXTERNAL_BUS_OFF | INTERRUPT_DISABLE | BYTE_OPERATION | SLOW_LINKS | SLOW_AT_BUS); @@ -1630,7 +1622,7 @@ uint Slot; break; #endif case RIO_PCI: - rio_dprint(RIO_DEBUG_INIT, (" (RIO_PCI)\n") ); + rio_dprintk (RIO_DEBUG_INIT, " (RIO_PCI)\n"); DpRamP->DpControl = RIO_PCI_BOOT_FROM_RAM; DpRamP->DpResetInt = 0xFF; DpRamP->DpResetTpu = 0xFF; @@ -1645,7 +1637,7 @@ uint Slot; #endif default: - rio_dprint(RIO_DEBUG_INIT, (" (UNKNOWN)\n") ); + rio_dprintk (RIO_DEBUG_INIT, " (UNKNOWN)\n"); break; } return; diff --git a/drivers/char/rio/riointr.c b/drivers/char/rio/riointr.c index e92609839f9b..f52124b78cac 100644 --- a/drivers/char/rio/riointr.c +++ b/drivers/char/rio/riointr.c @@ -190,8 +190,8 @@ char * en; tty = PortP->gs.tty; - rio_dprint (RIO_DEBUG_INTR, ("tx port %d: %d chars queued.\n", - PortP->PortNum, PortP->gs.xmit_cnt)); + rio_dprintk (RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", + PortP->PortNum, PortP->gs.xmit_cnt); if (!PortP->gs.xmit_cnt) return; @@ -215,10 +215,10 @@ char * en; { int t; t = (c > 10)?10:c; - rio_dprint (RIO_DEBUG_INTR, ("tx port %d: copying %d chars: %s - %s\n", - PortP->PortNum, c, - firstchars (PortP->gs.xmit_buf + PortP->gs.xmit_tail , t), - firstchars (PortP->gs.xmit_buf + PortP->gs.xmit_tail + c-t, t))); + rio_dprintk (RIO_DEBUG_INTR, "rio: tx port %d: copying %d chars: %s - %s\n", + PortP->PortNum, c, + firstchars (PortP->gs.xmit_buf + PortP->gs.xmit_tail , t), + firstchars (PortP->gs.xmit_buf + PortP->gs.xmit_tail + c-t, t)); } /* If for one reason or another, we can't copy more data, we're done! */ @@ -244,14 +244,14 @@ char * en; rio_spin_unlock_irqrestore(&PortP->portSem, flags); if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2*PKT_MAX_DATA_LEN)) { - rio_dprint (RIO_DEBUG_INTR, ("Waking up.... ldisc:%d (%d/%d)....", + rio_dprintk (RIO_DEBUG_INTR, "Waking up.... ldisc:%d (%d/%d)....", (int)(PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)), - PortP->gs.wakeup_chars, PortP->gs.xmit_cnt)); + PortP->gs.wakeup_chars, PortP->gs.xmit_cnt); if ((PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && PortP->gs.tty->ldisc.write_wakeup) (PortP->gs.tty->ldisc.write_wakeup)(PortP->gs.tty); - rio_dprint (RIO_DEBUG_INTR, ("(%d/%d)\n", - PortP->gs.wakeup_chars, PortP->gs.xmit_cnt)); + rio_dprintk (RIO_DEBUG_INTR, "(%d/%d)\n", + PortP->gs.wakeup_chars, PortP->gs.xmit_cnt); wake_up_interruptible(&PortP->gs.tty->write_wait); } @@ -273,7 +273,7 @@ struct rio_info * p; for ( host=0; hostRIONumHosts; host++ ) { struct Host *HostP = &p->RIOHosts[host]; - rio_dprint(RIO_DEBUG_INTR, ("riointr() doing host %d type %d\n", host, HostP->Type ) ); + rio_dprintk (RIO_DEBUG_INTR, "riointr() doing host %d type %d\n", host, HostP->Type); switch( HostP->Type ) { case RIO_AT: @@ -363,7 +363,7 @@ int From; static int t =0; rio_spin_unlock (&HostP->HostLock); if ((t++ % 200) == 0) - rio_dprint(RIO_DEBUG_INTR, ("Interrupt but host not running. flags=%x.\n", (int)HostP->Flags)); + rio_dprintk (RIO_DEBUG_INTR, "Interrupt but host not running. flags=%x.\n", (int)HostP->Flags); return; } rio_spin_unlock (&HostP->HostLock); @@ -372,7 +372,7 @@ int From; WWORD( HostP->ParmMapP->rup_intr , 0 ); p->RIORupCount++; RupIntr++; - rio_dprint(RIO_DEBUG_INTR, ("RUP interrupt on host %d\n", HostP-p->RIOHosts )); + rio_dprintk (RIO_DEBUG_INTR, "rio: RUP interrupt on host %d\n", HostP-p->RIOHosts); RIOPollHostCommands(p, HostP ); } @@ -383,7 +383,7 @@ int From; p->RIORxCount++; RxIntr++; - rio_dprint(RIO_DEBUG_INTR, ("RX interrupt on host %d\n", HostP-p->RIOHosts)); + rio_dprintk (RIO_DEBUG_INTR, "rio: RX interrupt on host %d\n", HostP-p->RIOHosts); /* ** Loop through every port. If the port is mapped into ** the system ( i.e. has /dev/ttyXXXX associated ) then it is @@ -451,7 +451,7 @@ int From; ** MAGIC! ( Basically, handshake the RX buffer, so that ** the RTAs upstream can be re-enabled. ) */ - rio_dprint(RIO_DEBUG_INTR, ("Set RX handshake bit\n" )); + rio_dprintk (RIO_DEBUG_INTR, "Set RX handshake bit\n"); WWORD( PortP->PhbP->handshake, PHB_HANDSHAKE_SET|PHB_HANDSHAKE_RESET ); } @@ -466,7 +466,7 @@ int From; p->RIOTxCount++; TxIntr++; - rio_dprint(RIO_DEBUG_INTR, ("TX interrupt on host %d\n", HostP-p->RIOHosts)); + rio_dprintk (RIO_DEBUG_INTR, "rio: TX interrupt on host %d\n", HostP-p->RIOHosts); /* ** Loop through every port. @@ -504,7 +504,7 @@ int From; continue; } - rio_dprint (RIO_DEBUG_INTR, ("Looking into port %d.\n", port)); + rio_dprintk (RIO_DEBUG_INTR, "rio: Looking into port %d.\n", port); /* ** Lock the port before we begin working on it. */ @@ -515,7 +515,7 @@ int From; ** we need do none of this processing. */ if ( !can_add_transmit( &PacketP, PortP ) ) { - rio_dprint (RIO_DEBUG_INTR, ("Can't add to port, so skipping.\n")); + rio_dprintk (RIO_DEBUG_INTR, "Can't add to port, so skipping.\n"); rio_spin_unlock(&PortP->portSem); continue; } @@ -527,7 +527,7 @@ int From; ttyP = PortP->gs.tty; /* If ttyP is NULL, the port is getting closed. Forget about it. */ if (!ttyP) { - rio_dprint (RIO_DEBUG_INTR, ("no tty, so skipping.\n")); + rio_dprintk (RIO_DEBUG_INTR, "no tty, so skipping.\n"); rio_spin_unlock(&PortP->portSem); continue; } @@ -603,10 +603,10 @@ int From; ** with WFLUSH */ if ( PortP->WflushFlag ) { - rio_dprint(RIO_DEBUG_INTR, ("Want to WFLUSH mark this port\n")); + rio_dprintk (RIO_DEBUG_INTR, "Want to WFLUSH mark this port\n"); if ( PortP->InUse ) - rio_dprint(RIO_DEBUG_INTR, ("FAILS - PORT IS IN USE\n")); + rio_dprintk (RIO_DEBUG_INTR, "FAILS - PORT IS IN USE\n"); } while ( PortP->WflushFlag && @@ -615,7 +615,7 @@ int From; int p; struct PktCmd *PktCmdP; - rio_dprint(RIO_DEBUG_INTR, ("Add WFLUSH marker to data queue\n")); + rio_dprintk (RIO_DEBUG_INTR, "Add WFLUSH marker to data queue\n"); /* ** make it look just like a WFLUSH command */ @@ -670,8 +670,8 @@ int From; PortP->MagicFlags &= ~MAGIC_FLUSH; } - rio_dprint(RIO_DEBUG_INTR, ("Wflush count now stands at %d\n", - PortP->WflushFlag)); + rio_dprintk (RIO_DEBUG_INTR, "Wflush count now stands at %d\n", + PortP->WflushFlag); } if ( PortP->MagicFlags & MORE_OUTPUT_EYGOR ) { if ( PortP->MagicFlags & MAGIC_FLUSH ) { @@ -747,12 +747,12 @@ struct Port * PortP; TtyP = PortP->gs.tty; if (!TtyP) { - rio_dprint (RIO_DEBUG_INTR, ("RIOReceive: tty is null. \n")); + rio_dprintk (RIO_DEBUG_INTR, "RIOReceive: tty is null. \n"); return; } if (PortP->State & RIO_THROTTLE_RX) { - rio_dprint (RIO_DEBUG_INTR, ("RIOReceive: Throttled. Can't handle more input.\n")); + rio_dprintk (RIO_DEBUG_INTR, "RIOReceive: Throttled. Can't handle more input.\n"); return; } @@ -786,18 +786,18 @@ struct Port * PortP; ** check that it is not a command! */ if ( PacketP->len & PKT_CMD_BIT ) { - rio_dprint(RIO_DEBUG_INTR, ("RIO: unexpected command packet received on PHB\n")); + rio_dprintk (RIO_DEBUG_INTR, "RIO: unexpected command packet received on PHB\n"); /* rio_dprint(RIO_DEBUG_INTR, (" sysport = %d\n", p->RIOPortp->PortNum)); */ - rio_dprint(RIO_DEBUG_INTR, (" dest_unit = %d\n", PacketP->dest_unit)); - rio_dprint(RIO_DEBUG_INTR, (" dest_port = %d\n", PacketP->dest_port)); - rio_dprint(RIO_DEBUG_INTR, (" src_unit = %d\n", PacketP->src_unit)); - rio_dprint(RIO_DEBUG_INTR, (" src_port = %d\n", PacketP->src_port)); - rio_dprint(RIO_DEBUG_INTR, (" len = %d\n", PacketP->len)); - rio_dprint(RIO_DEBUG_INTR, (" control = %d\n", PacketP->control)); - rio_dprint(RIO_DEBUG_INTR, (" csum = %d\n", PacketP->csum)); - rio_dprint(RIO_DEBUG_INTR, (" data bytes: ")); + rio_dprintk (RIO_DEBUG_INTR, " dest_unit = %d\n", PacketP->dest_unit); + rio_dprintk (RIO_DEBUG_INTR, " dest_port = %d\n", PacketP->dest_port); + rio_dprintk (RIO_DEBUG_INTR, " src_unit = %d\n", PacketP->src_unit); + rio_dprintk (RIO_DEBUG_INTR, " src_port = %d\n", PacketP->src_port); + rio_dprintk (RIO_DEBUG_INTR, " len = %d\n", PacketP->len); + rio_dprintk (RIO_DEBUG_INTR, " control = %d\n", PacketP->control); + rio_dprintk (RIO_DEBUG_INTR, " csum = %d\n", PacketP->csum); + rio_dprintk (RIO_DEBUG_INTR, " data bytes: "); for ( DataCnt=0; DataCntdata[DataCnt])); + rio_dprintk (RIO_DEBUG_INTR, "%d\n", PacketP->data[DataCnt]); remove_receive( PortP ); put_free_end( PortP->HostP, PacketP ); continue; /* with next packet */ @@ -820,8 +820,8 @@ struct Port * PortP; transCount = min(PacketP->len & PKT_LEN_MASK, TTY_FLIPBUF_SIZE - TtyP->flip.count); - rio_dprint(RIO_DEBUG_REC, ("port %d: Copy %d bytes\n", - PortP->PortNum, transCount ) ); + rio_dprintk (RIO_DEBUG_REC, "port %d: Copy %d bytes\n", + PortP->PortNum, transCount); /* ** To use the following 'kkprintfs' for debugging - change the '#undef' ** to '#define', (this is the only place ___DEBUG_IT___ occurs in the @@ -880,7 +880,7 @@ struct Port * PortP; } } if (copied) { - rio_dprint ( RIO_DEBUG_REC, ("port %d: pushing tty flip buffer: %d total bytes copied.\n", PortP->PortNum, copied)); + rio_dprintk (RIO_DEBUG_REC, "port %d: pushing tty flip buffer: %d total bytes copied.\n", PortP->PortNum, copied); tty_flip_buffer_push (TtyP); } @@ -906,25 +906,25 @@ int port; SysPort = port; /* Believe me, it works. */ if ( SysPort < 0 || SysPort >= RIO_PORTS ) { - rio_dprint(RIO_DEBUG_INTR, ("Illegal port %d derived from TTY in riotproc()\n",SysPort)); + rio_dprintk (RIO_DEBUG_INTR, "Illegal port %d derived from TTY in riotproc()\n",SysPort); return 0; } PortP = p->RIOPortp[SysPort]; if ((uint)PortP->PhbP < (uint)PortP->Caddr || (uint)PortP->PhbP >= (uint)PortP->Caddr+SIXTY_FOUR_K ) { - rio_dprint(RIO_DEBUG_INTR, ("RIO: NULL or BAD PhbP on sys port %d in proc routine\n", - SysPort)); - rio_dprint(RIO_DEBUG_INTR, (" PortP = 0x%x\n",PortP)); - rio_dprint(RIO_DEBUG_INTR, (" PortP->PhbP = 0x%x\n",PortP->PhbP)); - rio_dprint(RIO_DEBUG_INTR, (" PortP->Caddr = 0x%x\n",PortP->PhbP)); - rio_dprint(RIO_DEBUG_INTR, (" PortP->HostPort = 0x%x\n",PortP->HostPort)); + rio_dprintk (RIO_DEBUG_INTR, "RIO: NULL or BAD PhbP on sys port %d in proc routine\n", + SysPort); + rio_dprintk (RIO_DEBUG_INTR, " PortP = 0x%x\n",PortP); + rio_dprintk (RIO_DEBUG_INTR, " PortP->PhbP = 0x%x\n",PortP->PhbP); + rio_dprintk (RIO_DEBUG_INTR, " PortP->Caddr = 0x%x\n",PortP->PhbP); + rio_dprintk (RIO_DEBUG_INTR, " PortP->HostPort = 0x%x\n",PortP->HostPort); return 0; } switch(cmd) { case T_WFLUSH: - rio_dprint(RIO_DEBUG_INTR, "T_WFLUSH\n"); + rio_dprintk (RIO_DEBUG_INTR, "T_WFLUSH\n"); /* ** Because of the spooky way the RIO works, we don't need ** to issue a flush command on any of the SET*F commands, @@ -941,14 +941,14 @@ int port; ** form a wflush packet - 1 byte long, no data */ if ( PortP->State & RIO_DELETED ) { - rio_dprint(RIO_DEBUG_INTR, ("WFLUSH on deleted RTA\n")); + rio_dprintk (RIO_DEBUG_INTR, "WFLUSH on deleted RTA\n"); } else { if ( RIOPreemptiveCmd(p, PortP, WFLUSH ) == RIO_FAIL ) { - rio_dprint(RIO_DEBUG_INTR, ("T_WFLUSH Command failed\n")); + rio_dprintk (RIO_DEBUG_INTR, "T_WFLUSH Command failed\n"); } else - rio_dprint(RIO_DEBUG_INTR, ("T_WFLUSH Command\n")); + rio_dprintk (RIO_DEBUG_INTR, "T_WFLUSH Command\n"); } /* ** WFLUSH operation - flush the data! @@ -956,7 +956,7 @@ int port; PortP->TxBufferIn = PortP->TxBufferOut = 0; } else { - rio_dprint(RIO_DEBUG_INTR, ("T_WFLUSH Command ignored\n")); + rio_dprintk (RIO_DEBUG_INTR, "T_WFLUSH Command ignored\n"); } /* ** sort out the line discipline @@ -966,16 +966,16 @@ int port; break; case T_RESUME: - rio_dprint(RIO_DEBUG_INTR, ("T_RESUME\n")); + rio_dprintk (RIO_DEBUG_INTR, "T_RESUME\n"); /* ** send pre-emptive resume packet */ if ( PortP->State & RIO_DELETED ) { - rio_dprint(RIO_DEBUG_INTR, ("RESUME on deleted RTA\n")); + rio_dprintk (RIO_DEBUG_INTR, "RESUME on deleted RTA\n"); } else { if ( RIOPreemptiveCmd(p, PortP, RESUME ) == RIO_FAIL ) { - rio_dprint(RIO_DEBUG_INTR, ("T_RESUME Command failed\n")); + rio_dprintk (RIO_DEBUG_INTR, "T_RESUME Command failed\n"); } } /* @@ -986,7 +986,7 @@ int port; break; case T_TIME: - rio_dprint(RIO_DEBUG_INTR, ("T_TIME\n")); + rio_dprintk (RIO_DEBUG_INTR, "T_TIME\n"); /* ** T_TIME is called when xDLY is set in oflags and ** the line discipline timeout has expired. It's @@ -1008,16 +1008,16 @@ start: break; case T_SUSPEND: - rio_dprint(RIO_DEBUG_INTR, ("T_SUSPEND\n")); + rio_dprintk (RIO_DEBUG_INTR, "T_SUSPEND\n"); /* ** send a suspend pre-emptive packet. */ if ( PortP->State & RIO_DELETED ) { - rio_dprint(RIO_DEBUG_INTR, ("SUSPEND deleted RTA\n")); + rio_dprintk (RIO_DEBUG_INTR, "SUSPEND deleted RTA\n"); } else { if ( RIOPreemptiveCmd(p, PortP, SUSPEND ) == RIO_FAIL ) { - rio_dprint(RIO_DEBUG_INTR, ("T_SUSPEND Command failed\n")); + rio_dprintk (RIO_DEBUG_INTR, "T_SUSPEND Command failed\n"); } } /* @@ -1026,18 +1026,18 @@ start: break; case T_BLOCK: - rio_dprint(RIO_DEBUG_INTR, ("T_BLOCK\n")); + rio_dprintk (RIO_DEBUG_INTR, "T_BLOCK\n"); break; case T_RFLUSH: - rio_dprint(RIO_DEBUG_INTR, ("T_RFLUSH\n")); + rio_dprintk (RIO_DEBUG_INTR, "T_RFLUSH\n"); if ( PortP->State & RIO_DELETED ) { - rio_dprint(RIO_DEBUG_INTR, ("RFLUSH on deleted RTA\n")); + rio_dprintk (RIO_DEBUG_INTR, "RFLUSH on deleted RTA\n"); PortP->RxDataStart = 0; } else { if ( RIOPreemptiveCmd( p, PortP, RFLUSH ) == RIO_FAIL ) { - rio_dprint(RIO_DEBUG_INTR, ("T_RFLUSH Command failed\n")); + rio_dprintk (RIO_DEBUG_INTR, "T_RFLUSH Command failed\n"); return 0; } PortP->RxDataStart = 0; @@ -1050,14 +1050,14 @@ start: /* ** MAGIC! */ - rio_dprint(RIO_DEBUG_INTR, ("Set receive handshake bit\n")); + rio_dprintk (RIO_DEBUG_INTR, "Set receive handshake bit\n"); PortP->PhbP->handshake |= PHB_HANDSHAKE_RESET; } } break; /* FALLTHROUGH */ case T_UNBLOCK: - rio_dprint(RIO_DEBUG_INTR, ("T_UNBLOCK\n")); + rio_dprintk (RIO_DEBUG_INTR, "T_UNBLOCK\n"); /* ** If there is any data to receive set a timeout to service it. */ @@ -1065,7 +1065,7 @@ start: break; case T_BREAK: - rio_dprint(RIO_DEBUG_INTR, ("T_BREAK\n")); + rio_dprintk (RIO_DEBUG_INTR, "T_BREAK\n"); /* ** Send a break command. For Sys V ** this is a timed break, so we @@ -1075,12 +1075,12 @@ start: ** Build a BREAK command */ if ( PortP->State & RIO_DELETED ) { - rio_dprint(RIO_DEBUG_INTR, ("BREAK on deleted RTA\n")); + rio_dprintk (RIO_DEBUG_INTR, "BREAK on deleted RTA\n"); } else { if (RIOShortCommand(PortP,SBREAK,2, p->RIOConf.BreakInterval)==RIO_FAIL) { - rio_dprint(RIO_DEBUG_INTR, ("SBREAK RIOShortCommand failed\n")); + rio_dprintk (RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n"); } } @@ -1090,18 +1090,18 @@ start: break; case T_INPUT: - rio_dprint(RIO_DEBUG_INTR, ("Proc T_INPUT called - I don't know what to do!\n")); + rio_dprintk (RIO_DEBUG_INTR, "Proc T_INPUT called - I don't know what to do!\n"); break; case T_PARM: - rio_dprint(RIO_DEBUG_INTR, ("Proc T_PARM called - I don't know what to do!\n")); + rio_dprintk (RIO_DEBUG_INTR, "Proc T_PARM called - I don't know what to do!\n"); break; case T_SWTCH: - rio_dprint(RIO_DEBUG_INTR, ("Proc T_SWTCH called - I don't know what to do!\n")); + rio_dprintk (RIO_DEBUG_INTR, "Proc T_SWTCH called - I don't know what to do!\n"); break; default: - rio_dprint(RIO_DEBUG_INTR, ("Proc UNKNOWN command %d\n",cmd)); + rio_dprintk (RIO_DEBUG_INTR, "Proc UNKNOWN command %d\n",cmd); } /* ** T_OUTPUT returns without passing through this point! diff --git a/drivers/char/rio/rioparam.c b/drivers/char/rio/rioparam.c index 550e2c17d98d..4ce8443c3417 100644 --- a/drivers/char/rio/rioparam.c +++ b/drivers/char/rio/rioparam.c @@ -176,13 +176,18 @@ int SleepFlag; int retries = 0xff; unsigned long flags; + func_enter (); + TtyP = PortP->gs.tty; - rio_dprint(RIO_DEBUG_PARAM, ("RIOParam: Port:%d cmd:%d Modem:%d SleepFlag:%d Mapped: %d, tty=%p\n", - PortP->PortNum, cmd, Modem, SleepFlag, PortP->Mapped, TtyP) ); + rio_dprintk (RIO_DEBUG_PARAM, "RIOParam: Port:%d cmd:%d Modem:%d SleepFlag:%d Mapped: %d, tty=%p\n", + PortP->PortNum, cmd, Modem, SleepFlag, PortP->Mapped, TtyP); if (!TtyP) { - rio_dprint (RIO_DEBUG_PARAM, ("Can't call rioparam with null tty.\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Can't call rioparam with null tty.\n"); + + func_exit (); + return RIO_FAIL; } rio_spin_lock_irqsave(&PortP->portSem, flags ); @@ -205,7 +210,7 @@ int SleepFlag; PortP->FirstOpen = 0; } else if (PortP->Store || PortP->Lock) { - rio_dprint(RIO_DEBUG_PARAM, ("OPEN: Restoring stored/locked params\n")); + rio_dprintk (RIO_DEBUG_PARAM, "OPEN: Restoring stored/locked params\n"); TtyP->tm.c_iflag = PortP->StoredTty.iflag; TtyP->tm.c_oflag = PortP->StoredTty.oflag; TtyP->tm.c_cflag = PortP->StoredTty.cflag; @@ -226,41 +231,49 @@ int SleepFlag; break; } if ( PortP->InUse != NOT_INUSE ) { - rio_dprint(RIO_DEBUG_PARAM, ("Port IN_USE for pre-emptive command\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Port IN_USE for pre-emptive command\n"); } if ( !res ) { - rio_dprint(RIO_DEBUG_PARAM, ("Port has no space on transmit queue\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Port has no space on transmit queue\n"); } if ( SleepFlag != OK_TO_SLEEP ) { rio_spin_unlock_irqrestore( &PortP->portSem, flags); + func_exit(); + return RIO_FAIL; } - rio_dprint(RIO_DEBUG_PARAM, ("wait for can_add_transmit\n")); + rio_dprintk (RIO_DEBUG_PARAM, "wait for can_add_transmit\n"); rio_spin_unlock_irqrestore( &PortP->portSem, flags); retval = RIODelay(PortP, HUNDRED_MS); rio_spin_lock_irqsave( &PortP->portSem, flags); if (retval == RIO_FAIL) { - rio_dprint(RIO_DEBUG_PARAM, ("wait for can_add_transmit broken by signal\n")); + rio_dprintk (RIO_DEBUG_PARAM, "wait for can_add_transmit broken by signal\n"); rio_spin_unlock_irqrestore( &PortP->portSem, flags); pseterr(EINTR); + func_exit(); + return RIO_FAIL; } if ( PortP->State & RIO_DELETED ) { rio_spin_unlock_irqrestore( &PortP->portSem, flags); + func_exit (); + return RIO_SUCCESS; } } if (!res) { rio_spin_unlock_irqrestore( &PortP->portSem, flags); + func_exit (); + return RIO_FAIL; } - rio_dprint(RIO_DEBUG_PARAM, ("can_add_transmit() returns %x\n",res)); - rio_dprint(RIO_DEBUG_PARAM, ("Packet is 0x%x\n",(int) PacketP)); + rio_dprintk (RIO_DEBUG_PARAM, "can_add_transmit() returns %x\n",res); + rio_dprintk (RIO_DEBUG_PARAM, "Packet is 0x%x\n",(int) PacketP); phb_param_ptr = (struct phb_param *)PacketP->data; @@ -270,7 +283,7 @@ int SleepFlag; ** COR 1 */ if ( TtyP->tm.c_iflag & INPCK ) { - rio_dprint(RIO_DEBUG_PARAM, ("Parity checking on input enabled\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Parity checking on input enabled\n"); Cor1 |= COR1_INPCK; } #endif @@ -278,53 +291,53 @@ int SleepFlag; switch ( TtyP->termios->c_cflag & CSIZE ) { case CS5: { - rio_dprint(RIO_DEBUG_PARAM, ("5 bit data\n")); + rio_dprintk (RIO_DEBUG_PARAM, "5 bit data\n"); Cor1 |= COR1_5BITS; break; } case CS6: { - rio_dprint(RIO_DEBUG_PARAM, ("6 bit data\n")); + rio_dprintk (RIO_DEBUG_PARAM, "6 bit data\n"); Cor1 |= COR1_6BITS; break; } case CS7: { - rio_dprint(RIO_DEBUG_PARAM, ("7 bit data\n")); + rio_dprintk (RIO_DEBUG_PARAM, "7 bit data\n"); Cor1 |= COR1_7BITS; break; } case CS8: { - rio_dprint(RIO_DEBUG_PARAM, ("8 bit data\n")); + rio_dprintk (RIO_DEBUG_PARAM, "8 bit data\n"); Cor1 |= COR1_8BITS; break; } } if ( TtyP->termios->c_cflag & CSTOPB ) { - rio_dprint(RIO_DEBUG_PARAM, ("2 stop bits\n")); + rio_dprintk (RIO_DEBUG_PARAM, "2 stop bits\n"); Cor1 |= COR1_2STOP; } else { - rio_dprint(RIO_DEBUG_PARAM, ("1 stop bit\n")); + rio_dprintk (RIO_DEBUG_PARAM, "1 stop bit\n"); Cor1 |= COR1_1STOP; } if ( TtyP->termios->c_cflag & PARENB ) { - rio_dprint(RIO_DEBUG_PARAM, ("Enable parity\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Enable parity\n"); Cor1 |= COR1_NORMAL; } else { - rio_dprint(RIO_DEBUG_PARAM, ("Disable parity\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Disable parity\n"); Cor1 |= COR1_NOP; } if ( TtyP->termios->c_cflag & PARODD ) { - rio_dprint(RIO_DEBUG_PARAM, ("Odd parity\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Odd parity\n"); Cor1 |= COR1_ODD; } else { - rio_dprint(RIO_DEBUG_PARAM, ("Even parity\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Even parity\n"); Cor1 |= COR1_EVEN; } @@ -332,89 +345,89 @@ int SleepFlag; ** COR 2 */ if ( TtyP->termios->c_iflag & IXON ) { - rio_dprint(RIO_DEBUG_PARAM, ("Enable start/stop output control\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Enable start/stop output control\n"); Cor2 |= COR2_IXON; } else { if ( PortP->Config & RIO_IXON ) { - rio_dprint(RIO_DEBUG_PARAM, ("Force enable start/stop output control\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Force enable start/stop output control\n"); Cor2 |= COR2_IXON; } else - rio_dprint(RIO_DEBUG_PARAM, ("IXON has been disabled.\n")); + rio_dprintk (RIO_DEBUG_PARAM, "IXON has been disabled.\n"); } if (TtyP->termios->c_iflag & IXANY) { if ( PortP->Config & RIO_IXANY ) { - rio_dprint(RIO_DEBUG_PARAM, ("Enable any key to restart output\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Enable any key to restart output\n"); Cor2 |= COR2_IXANY; } else - rio_dprint(RIO_DEBUG_PARAM, ("IXANY has been disabled due to sanity reasons.\n")); + rio_dprintk (RIO_DEBUG_PARAM, "IXANY has been disabled due to sanity reasons.\n"); } if ( TtyP->termios->c_iflag & IXOFF ) { - rio_dprint(RIO_DEBUG_PARAM, ("Enable start/stop input control 2\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Enable start/stop input control 2\n"); Cor2 |= COR2_IXOFF; } if ( TtyP->termios->c_cflag & HUPCL ) { - rio_dprint(RIO_DEBUG_PARAM, ("Hangup on last close\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Hangup on last close\n"); Cor2 |= COR2_HUPCL; } if ( C_CRTSCTS (TtyP)) { - rio_dprint(RIO_DEBUG_PARAM, ("Rx hardware flow control enabled\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Rx hardware flow control enabled\n"); Cor2 |= COR2_CTSFLOW; Cor2 |= COR2_RTSFLOW; } else { - rio_dprint(RIO_DEBUG_PARAM, ("Rx hardware flow control disabled\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Rx hardware flow control disabled\n"); Cor2 &= ~COR2_CTSFLOW; Cor2 &= ~COR2_RTSFLOW; } if ( TtyP->termios->c_cflag & CLOCAL ) { - rio_dprint(RIO_DEBUG_PARAM, ("Local line\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Local line\n"); } else { - rio_dprint(RIO_DEBUG_PARAM, ("Possible Modem line\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Possible Modem line\n"); } /* ** COR 4 (there is no COR 3) */ if ( TtyP->termios->c_iflag & IGNBRK ) { - rio_dprint(RIO_DEBUG_PARAM, ("Ignore break condition\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Ignore break condition\n"); Cor4 |= COR4_IGNBRK; } if ( !(TtyP->termios->c_iflag & BRKINT) ) { - rio_dprint(RIO_DEBUG_PARAM, ("Break generates NULL condition\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Break generates NULL condition\n"); Cor4 |= COR4_NBRKINT; } else { - rio_dprint(RIO_DEBUG_PARAM, ("Interrupt on break condition\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Interrupt on break condition\n"); } if ( TtyP->termios->c_iflag & INLCR ) { - rio_dprint(RIO_DEBUG_PARAM, ("Map newline to carriage return on input\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Map newline to carriage return on input\n"); Cor4 |= COR4_INLCR; } if ( TtyP->termios->c_iflag & IGNCR ) { - rio_dprint(RIO_DEBUG_PARAM, ("Ignore carriage return on input\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Ignore carriage return on input\n"); Cor4 |= COR4_IGNCR; } if ( TtyP->termios->c_iflag & ICRNL ) { - rio_dprint(RIO_DEBUG_PARAM, ("Map carriage return to newline on input\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Map carriage return to newline on input\n"); Cor4 |= COR4_ICRNL; } if ( TtyP->termios->c_iflag & IGNPAR ) { - rio_dprint(RIO_DEBUG_PARAM, ("Ignore characters with parity errors\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Ignore characters with parity errors\n"); Cor4 |= COR4_IGNPAR; } if ( TtyP->termios->c_iflag & PARMRK ) { - rio_dprint(RIO_DEBUG_PARAM, ("Mark parity errors\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Mark parity errors\n"); Cor4 |= COR4_PARMRK; } @@ -444,24 +457,24 @@ int SleepFlag; ** Could set LNE here if you wanted LNext processing. SVR4 will use it. */ if ( TtyP->termios->c_iflag & ISTRIP ) { - rio_dprint(RIO_DEBUG_PARAM, ("Strip input characters\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Strip input characters\n"); if (! (PortP->State & RIO_TRIAD_MODE)) { Cor5 |= COR5_ISTRIP; } } if ( TtyP->termios->c_oflag & ONLCR ) { - rio_dprint(RIO_DEBUG_PARAM, ("Map newline to carriage-return, newline on output\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Map newline to carriage-return, newline on output\n"); if ( PortP->CookMode == COOK_MEDIUM ) Cor5 |= COR5_ONLCR; } if ( TtyP->termios->c_oflag & OCRNL ) { - rio_dprint(RIO_DEBUG_PARAM, ("Map carriage return to newline on output\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Map carriage return to newline on output\n"); if ( PortP->CookMode == COOK_MEDIUM ) Cor5 |= COR5_OCRNL; } if ( ( TtyP->termios->c_oflag & TABDLY) == TAB3 ) { - rio_dprint(RIO_DEBUG_PARAM, ("Tab delay 3 set\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Tab delay 3 set\n"); if ( PortP->CookMode == COOK_MEDIUM ) Cor5 |= COR5_TAB3; } @@ -481,8 +494,8 @@ int SleepFlag; /* ** Baud rate bytes */ - rio_dprint(RIO_DEBUG_PARAM, ("Mapping of rx/tx baud %x (%x)\n", - TtyP->termios->c_cflag, CBAUD)); + rio_dprintk (RIO_DEBUG_PARAM, "Mapping of rx/tx baud %x (%x)\n", + TtyP->termios->c_cflag, CBAUD); switch (TtyP->termios->c_cflag & CBAUD) { #define e(b) case B ## b : RxBaud = TxBaud = RIO_B ## b ;break @@ -494,77 +507,77 @@ int SleepFlag; /* XXX MIssing conversion table. XXX */ /* (TtyP->termios->c_cflag & V_CBAUD); */ - rio_dprint(RIO_DEBUG_PARAM, ("tx baud 0x%x, rx baud 0x%x\n", TxBaud, RxBaud)); + rio_dprintk (RIO_DEBUG_PARAM, "tx baud 0x%x, rx baud 0x%x\n", TxBaud, RxBaud); /* ** Leftovers */ if ( TtyP->termios->c_cflag & CREAD ) - rio_dprint(RIO_DEBUG_PARAM, ("Enable receiver\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Enable receiver\n"); #ifdef RCV1EN if ( TtyP->termios->c_cflag & RCV1EN ) - rio_dprint(RIO_DEBUG_PARAM, ("RCV1EN (?)\n")); + rio_dprintk (RIO_DEBUG_PARAM, "RCV1EN (?)\n"); #endif #ifdef XMT1EN if ( TtyP->termios->c_cflag & XMT1EN ) - rio_dprint(RIO_DEBUG_PARAM, ("XMT1EN (?)\n")); + rio_dprintk (RIO_DEBUG_PARAM, "XMT1EN (?)\n"); #endif #if 0 if ( TtyP->termios->c_cflag & LOBLK ) - rio_dprint(RIO_DEBUG_PARAM, ("LOBLK - JCL output blocks when not current\n")); + rio_dprintk (RIO_DEBUG_PARAM, "LOBLK - JCL output blocks when not current\n"); #endif if ( TtyP->termios->c_lflag & ISIG ) - rio_dprint(RIO_DEBUG_PARAM, ("Input character signal generating enabled\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Input character signal generating enabled\n"); if ( TtyP->termios->c_lflag & ICANON ) - rio_dprint(RIO_DEBUG_PARAM, ("Canonical input: erase and kill enabled\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Canonical input: erase and kill enabled\n"); if ( TtyP->termios->c_lflag & XCASE ) - rio_dprint(RIO_DEBUG_PARAM, ("Canonical upper/lower presentation\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Canonical upper/lower presentation\n"); if ( TtyP->termios->c_lflag & ECHO ) - rio_dprint(RIO_DEBUG_PARAM, ("Enable input echo\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Enable input echo\n"); if ( TtyP->termios->c_lflag & ECHOE ) - rio_dprint(RIO_DEBUG_PARAM, ("Enable echo erase\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Enable echo erase\n"); if ( TtyP->termios->c_lflag & ECHOK ) - rio_dprint(RIO_DEBUG_PARAM, ("Enable echo kill\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Enable echo kill\n"); if ( TtyP->termios->c_lflag & ECHONL ) - rio_dprint(RIO_DEBUG_PARAM, ("Enable echo newline\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Enable echo newline\n"); if ( TtyP->termios->c_lflag & NOFLSH ) - rio_dprint(RIO_DEBUG_PARAM, ("Disable flush after interrupt or quit\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Disable flush after interrupt or quit\n"); #ifdef TOSTOP if ( TtyP->termios->c_lflag & TOSTOP ) - rio_dprint(RIO_DEBUG_PARAM, ("Send SIGTTOU for background output\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Send SIGTTOU for background output\n"); #endif #ifdef XCLUDE if ( TtyP->termios->c_lflag & XCLUDE ) - rio_dprint(RIO_DEBUG_PARAM, ("Exclusive use of this line\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Exclusive use of this line\n"); #endif if ( TtyP->termios->c_iflag & IUCLC ) - rio_dprint(RIO_DEBUG_PARAM, ("Map uppercase to lowercase on input\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Map uppercase to lowercase on input\n"); if ( TtyP->termios->c_oflag & OPOST ) - rio_dprint(RIO_DEBUG_PARAM, ("Enable output post-processing\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Enable output post-processing\n"); if ( TtyP->termios->c_oflag & OLCUC ) - rio_dprint(RIO_DEBUG_PARAM, ("Map lowercase to uppercase on output\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Map lowercase to uppercase on output\n"); if ( TtyP->termios->c_oflag & ONOCR ) - rio_dprint(RIO_DEBUG_PARAM, ("No carriage return output at column 0\n")); + rio_dprintk (RIO_DEBUG_PARAM, "No carriage return output at column 0\n"); if ( TtyP->termios->c_oflag & ONLRET ) - rio_dprint(RIO_DEBUG_PARAM, ("Newline performs carriage return function\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Newline performs carriage return function\n"); if ( TtyP->termios->c_oflag & OFILL ) - rio_dprint(RIO_DEBUG_PARAM, ("Use fill characters for delay\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Use fill characters for delay\n"); if ( TtyP->termios->c_oflag & OFDEL ) - rio_dprint(RIO_DEBUG_PARAM, ("Fill character is DEL\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Fill character is DEL\n"); if ( TtyP->termios->c_oflag & NLDLY ) - rio_dprint(RIO_DEBUG_PARAM, ("Newline delay set\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Newline delay set\n"); if ( TtyP->termios->c_oflag & CRDLY ) - rio_dprint(RIO_DEBUG_PARAM, ("Carriage return delay set\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Carriage return delay set\n"); if ( TtyP->termios->c_oflag & TABDLY ) - rio_dprint(RIO_DEBUG_PARAM, ("Tab delay set\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Tab delay set\n"); #if 0 if ( TtyP->termios->c_oflag & BSDLY ) - rio_dprint(RIO_DEBUG_PARAM, ("Back-space delay set\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Back-space delay set\n"); if ( TtyP->termios->c_oflag & VTDLY ) - rio_dprint(RIO_DEBUG_PARAM, ("Vertical tab delay set\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Vertical tab delay set\n"); if ( TtyP->termios->c_oflag & FFDLY ) - rio_dprint(RIO_DEBUG_PARAM, ("Form-feed delay set\n")); + rio_dprintk (RIO_DEBUG_PARAM, "Form-feed delay set\n"); #endif /* ** These things are kind of useful in a later life! @@ -573,6 +586,8 @@ int SleepFlag; if ( PortP->State & RIO_DELETED ) { rio_spin_unlock_irqrestore( &PortP->portSem, flags); + func_exit (); + return RIO_FAIL; } @@ -610,10 +625,12 @@ int SleepFlag; rio_spin_unlock_irqrestore( &PortP->portSem, flags); - rio_dprint(RIO_DEBUG_PARAM, ("add_transmit returned.\n")); + rio_dprintk (RIO_DEBUG_PARAM, "add_transmit returned.\n"); /* ** job done. */ + func_exit (); + return RIO_SUCCESS; } @@ -644,7 +661,7 @@ add_transmit(PortP) struct Port *PortP; { if (RWORD(*PortP->TxAdd) & PKT_IN_USE) { - rio_dprint (RIO_DEBUG_PARAM, ("add_transmit: Packet has been stolen!")); + rio_dprintk (RIO_DEBUG_PARAM, "add_transmit: Packet has been stolen!"); } WWORD( *(ushort *)PortP->TxAdd, RWORD(*PortP->TxAdd) | PKT_IN_USE); PortP->TxAdd = (PortP->TxAdd == PortP->TxEnd) ? PortP->TxStart : @@ -672,7 +689,7 @@ PKT *PktP; * ************************************************/ - rio_dprint(RIO_DEBUG_PFE, ("put_free_end(PktP=%x)\n",(int)PktP)); + rio_dprintk (RIO_DEBUG_PFE, "put_free_end(PktP=%x)\n",(int)PktP); if ((old_end=RWORD(HostP->ParmMapP->free_list_end)) != TPNULL) { new_end = RIO_OFF(HostP->Caddr,PktP); @@ -683,12 +700,13 @@ PKT *PktP; WWORD(HostP->ParmMapP->free_list_end, new_end); } else { /* First packet on the free list this should never happen! */ - rio_dprint(RIO_DEBUG_PFE, ("put_free_end(): This should never happen\n")); + rio_dprintk (RIO_DEBUG_PFE, "put_free_end(): This should never happen\n"); WWORD(HostP->ParmMapP->free_list_end , RIO_OFF(HostP->Caddr,PktP)); tmp_pointer = (FREE_LIST *)PktP; WWORD(tmp_pointer->prev , TPNULL); WWORD(tmp_pointer->next , TPNULL); } + rio_dprintk (RIO_DEBUG_CMD, "Before unlock: %p\n", &HostP->HostLock); rio_spin_unlock_irqrestore(&HostP->HostLock, flags); } diff --git a/drivers/char/rio/rioroute.c b/drivers/char/rio/rioroute.c index 2f13eb273217..ab78ddf5d1a1 100644 --- a/drivers/char/rio/rioroute.c +++ b/drivers/char/rio/rioroute.c @@ -178,8 +178,8 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP if ( Lies ) { - rio_dprint(RIO_DEBUG_ROUTE, ("LIES! DAMN LIES! %d LIES!\n",Lies)); - rio_dprint(RIO_DEBUG_ROUTE, ("%d:%c %d:%c %d:%c %d:%c\n", + rio_dprintk (RIO_DEBUG_ROUTE, "LIES! DAMN LIES! %d LIES!\n",Lies); + rio_dprintk (RIO_DEBUG_ROUTE, "%d:%c %d:%c %d:%c %d:%c\n", RBYTE(PktCmdP->RouteTopology[0].Unit), 'A'+RBYTE(PktCmdP->RouteTopology[0].Link), RBYTE(PktCmdP->RouteTopology[1].Unit), @@ -187,7 +187,7 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP RBYTE(PktCmdP->RouteTopology[2].Unit), 'A'+RBYTE(PktCmdP->RouteTopology[2].Link), RBYTE(PktCmdP->RouteTopology[3].Unit), - 'A'+RBYTE(PktCmdP->RouteTopology[3].Link))); + 'A'+RBYTE(PktCmdP->RouteTopology[3].Link)); return TRUE; } @@ -219,11 +219,11 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP NewUnit != ROUTE_NO_ID && NewUnit != ROUTE_INTERCONNECT ) { - rio_dprint(RIO_DEBUG_ROUTE, ("I have a link from %s %s to unit %d:%d - I don't like it.\n", + rio_dprintk (RIO_DEBUG_ROUTE, "I have a link from %s %s to unit %d:%d - I don't like it.\n", MyType, MyName, NewUnit, - NewLink)); + NewLink); } else { @@ -248,8 +248,8 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP RIOConCon(p,HostP,ThisUnit,ThisLink,NewUnit,NewLink,CONNECT); if ( NewUnit == ROUTE_NO_ID ) - rio_dprint(RIO_DEBUG_ROUTE, ("%s %s (%c) is connected to an unconfigured unit.\n", - MyType,MyName,'A'+ThisLink)); + rio_dprintk (RIO_DEBUG_ROUTE, "%s %s (%c) is connected to an unconfigured unit.\n", + MyType,MyName,'A'+ThisLink); if ( NewUnit == ROUTE_INTERCONNECT ) { @@ -267,14 +267,14 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP if ( HostP->Topology[OldLink].Unit == ThisUnit && HostP->Topology[OldLink].Link == ThisLink ) { - rio_dprint(RIO_DEBUG_ROUTE, ("SETTING HOST (%c) TO DISCONNECTED!\n", OldLink+'A')); + rio_dprintk (RIO_DEBUG_ROUTE, "SETTING HOST (%c) TO DISCONNECTED!\n", OldLink+'A'); HostP->Topology[OldLink].Unit = ROUTE_DISCONNECT; HostP->Topology[OldLink].Link = NO_LINK; } else { - rio_dprint(RIO_DEBUG_ROUTE, ("HOST(%c) WAS NOT CONNECTED TO %s (%c)!\n", - OldLink+'A',HostP->Mapping[ThisUnit-1].Name,ThisLink+'A')); + rio_dprintk (RIO_DEBUG_ROUTE, "HOST(%c) WAS NOT CONNECTED TO %s (%c)!\n", + OldLink+'A',HostP->Mapping[ThisUnit-1].Name,ThisLink+'A'); } } else if ( OldUnit <= MAX_RUP ) @@ -282,29 +282,29 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP if ( HostP->Mapping[OldUnit-1].Topology[OldLink].Unit == ThisUnit && HostP->Mapping[OldUnit-1].Topology[OldLink].Link == ThisLink ) { - rio_dprint(RIO_DEBUG_ROUTE, ("SETTING RTA %s (%c) TO DISCONNECTED!\n", - HostP->Mapping[OldUnit-1].Name,OldLink+'A')); + rio_dprintk (RIO_DEBUG_ROUTE, "SETTING RTA %s (%c) TO DISCONNECTED!\n", + HostP->Mapping[OldUnit-1].Name,OldLink+'A'); HostP->Mapping[OldUnit-1].Topology[OldLink].Unit=ROUTE_DISCONNECT; HostP->Mapping[OldUnit-1].Topology[OldLink].Link=NO_LINK; } else { - rio_dprint(RIO_DEBUG_ROUTE, ("RTA %s (%c) WAS NOT CONNECTED TO %s (%c)\n", + rio_dprintk (RIO_DEBUG_ROUTE, "RTA %s (%c) WAS NOT CONNECTED TO %s (%c)\n", HostP->Mapping[OldUnit-1].Name,OldLink+'A', - HostP->Mapping[ThisUnit-1].Name,ThisLink+'A')); + HostP->Mapping[ThisUnit-1].Name,ThisLink+'A'); } } if ( NewUnit == HOST_ID ) { - rio_dprint(RIO_DEBUG_ROUTE, ("MARKING HOST (%c) CONNECTED TO %s (%c)\n", - NewLink+'A',MyName,ThisLink+'A')); + rio_dprintk (RIO_DEBUG_ROUTE, "MARKING HOST (%c) CONNECTED TO %s (%c)\n", + NewLink+'A',MyName,ThisLink+'A'); HostP->Topology[NewLink].Unit = ThisUnit; HostP->Topology[NewLink].Link = ThisLink; } else if ( NewUnit <= MAX_RUP ) { - rio_dprint(RIO_DEBUG_ROUTE, ("MARKING RTA %s (%c) CONNECTED TO %s (%c)\n", - HostP->Mapping[NewUnit-1].Name,NewLink+'A',MyName,ThisLink+'A')); + rio_dprintk (RIO_DEBUG_ROUTE, "MARKING RTA %s (%c) CONNECTED TO %s (%c)\n", + HostP->Mapping[NewUnit-1].Name,NewLink+'A',MyName,ThisLink+'A'); HostP->Mapping[NewUnit-1].Topology[NewLink].Unit=ThisUnit; HostP->Mapping[NewUnit-1].Topology[NewLink].Link=ThisLink; } @@ -321,8 +321,8 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP */ if ( RBYTE(PktCmdP->Command) != ROUTE_REQUEST ) { - rio_dprint(RIO_DEBUG_ROUTE, ("Unknown command %d received on rup %d host %d ROUTE_RUP\n", - RBYTE(PktCmdP->Command),Rup,(int)HostP)); + rio_dprintk (RIO_DEBUG_ROUTE, "Unknown command %d received on rup %d host %d ROUTE_RUP\n", + RBYTE(PktCmdP->Command),Rup,(int)HostP); return TRUE; } @@ -336,7 +336,7 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP */ RtaType = GetUnitType(RtaUniq); - rio_dprint(RIO_DEBUG_ROUTE, ("Received a request for an ID for serial number %x\n", RtaUniq)); + rio_dprintk (RIO_DEBUG_ROUTE, "Received a request for an ID for serial number %x\n", RtaUniq); Mod = RBYTE(PktCmdP->ModuleTypes); Mod1 = LONYBLE(Mod); @@ -347,14 +347,14 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP ** with 8 port, set 2nd ident in Mod2 to the same as Mod1. */ Mod2 = Mod1; - rio_dprint(RIO_DEBUG_ROUTE, ("Backplane type is %s (all ports)\n", - p->RIOModuleTypes[Mod1].Name )); + rio_dprintk (RIO_DEBUG_ROUTE, "Backplane type is %s (all ports)\n", + p->RIOModuleTypes[Mod1].Name); } else { Mod2 = HINYBLE(Mod); - rio_dprint(RIO_DEBUG_ROUTE, ("Module types are %s (ports 0-3) and %s (ports 4-7)\n", - p->RIOModuleTypes[Mod1].Name, p->RIOModuleTypes[Mod2].Name )); + rio_dprintk (RIO_DEBUG_ROUTE, "Module types are %s (ports 0-3) and %s (ports 4-7)\n", + p->RIOModuleTypes[Mod1].Name, p->RIOModuleTypes[Mod2].Name); } if ( RtaUniq == 0xffffffff ) @@ -367,7 +367,7 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP */ if ( !(CmdBlkP = RIOGetCmdBlk()) ) { - rio_dprint(RIO_DEBUG_ROUTE, ("No command blocks to route RTA! come back later.\n")); + rio_dprintk (RIO_DEBUG_ROUTE, "No command blocks to route RTA! come back later.\n"); return 0; } @@ -384,8 +384,8 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP if (! RIOBootOk(p, HostP, RtaUniq)) { - rio_dprint(RIO_DEBUG_ROUTE, ("RTA %x tried to get an ID, but does not belong - FOAD it!\n", - RtaUniq)); + rio_dprintk (RIO_DEBUG_ROUTE, "RTA %x tried to get an ID, but does not belong - FOAD it!\n", + RtaUniq); PktReplyP->Command = ROUTE_FOAD; HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7); RIOQueueCmdBlk(HostP, Rup, CmdBlkP); @@ -397,13 +397,13 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP */ for ( ThisUnit=0; ThisUnitMapping[ThisUnit].Flags & SLOT_IN_USE ? "Slot-In-Use":"Not In Use", HostP->Mapping[ThisUnit].Flags & SLOT_TENTATIVE ? "Slot-Tentative":"Not Tentative", - HostP->Mapping[ThisUnit].RtaUniqueNum )); + HostP->Mapping[ThisUnit].RtaUniqueNum); /* ** We have an entry for it. @@ -414,12 +414,12 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP if (RtaType == TYPE_RTA16) { ThisUnit2 = HostP->Mapping[ThisUnit].ID2 - 1; - rio_dprint(RIO_DEBUG_ROUTE, ("Found unit 0x%x at slots %d+%d\n", - RtaUniq,ThisUnit,ThisUnit2)); + rio_dprintk (RIO_DEBUG_ROUTE, "Found unit 0x%x at slots %d+%d\n", + RtaUniq,ThisUnit,ThisUnit2); } else - rio_dprint(RIO_DEBUG_ROUTE, ("Found unit 0x%x at slot %d\n", - RtaUniq,ThisUnit)); + rio_dprintk (RIO_DEBUG_ROUTE, "Found unit 0x%x at slot %d\n", + RtaUniq,ThisUnit); /* ** If we have no knowledge of booting it, then the host has ** been re-booted, and so we must kill the RTA, so that it @@ -458,14 +458,14 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP */ RIOFixPhbs(p, HostP, ThisUnit2); PktReplyP->IDNum2 = ThisUnit2+1; - rio_dprint(RIO_DEBUG_ROUTE, ("RTA '%s' has been allocated IDs %d+%d\n", - HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum, PktReplyP->IDNum2)); + rio_dprintk (RIO_DEBUG_ROUTE, "RTA '%s' has been allocated IDs %d+%d\n", + HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum, PktReplyP->IDNum2); } else { PktReplyP->IDNum2 = ROUTE_NO_ID; - rio_dprint(RIO_DEBUG_ROUTE, ("RTA '%s' has been allocated ID %d\n", - HostP->Mapping[ThisUnit].Name,PktReplyP->IDNum)); + rio_dprintk (RIO_DEBUG_ROUTE, "RTA '%s' has been allocated ID %d\n", + HostP->Mapping[ThisUnit].Name,PktReplyP->IDNum); } HostP->Copy("RT_ALLOCAT",PktReplyP->CommandText,10); @@ -489,7 +489,7 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP PortP = p->RIOPortp[port+HostP->Mapping[ThisUnit].SysPort]; if ( PortP->State & (RIO_MOPEN|RIO_LOPEN) ) { - rio_dprint(RIO_DEBUG_ROUTE, ("Re-opened this port\n")); + rio_dprintk (RIO_DEBUG_ROUTE, "Re-opened this port\n"); rio_spin_lock_irqsave(&PortP->portSem, flags); PortP->MagicFlags |= MAGIC_REBOOT; rio_spin_unlock_irqrestore(&PortP->portSem, flags); @@ -502,7 +502,7 @@ int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP PortP = p->RIOPortp[port+HostP->Mapping[ThisUnit2].SysPort]; if ( PortP->State & (RIO_MOPEN|RIO_LOPEN) ) { - rio_dprint(RIO_DEBUG_ROUTE, ("Re-opened this port\n")); + rio_dprintk (RIO_DEBUG_ROUTE, "Re-opened this port\n"); rio_spin_lock_irqsave(&PortP->portSem, flags); PortP->MagicFlags |= MAGIC_REBOOT; rio_spin_unlock_irqrestore(&PortP->portSem, flags); @@ -628,7 +628,7 @@ uint unit; unsigned long flags; int PortN = HostP->Mapping[unit].SysPort; - rio_dprint(RIO_DEBUG_ROUTE, ("RIOFixPhbs unit %d sysport %d\n", unit, PortN)); + rio_dprintk (RIO_DEBUG_ROUTE, "RIOFixPhbs unit %d sysport %d\n", unit, PortN); if (PortN != -1) { ushort dest_unit = HostP->Mapping[unit].ID2; @@ -656,7 +656,7 @@ uint unit; ** unset, so go no further. */ if (PortP->TxStart == 0) { - rio_dprint(RIO_DEBUG_ROUTE, ("Tx pkts not set up yet\n")); + rio_dprintk (RIO_DEBUG_ROUTE, "Tx pkts not set up yet\n"); break; } @@ -691,10 +691,10 @@ uint unit; WBYTE(Pkt->dest_unit, dest_unit); WBYTE(Pkt->dest_port, dest_port); } - rio_dprint(RIO_DEBUG_ROUTE, ("phb dest: Old %x:%x New %x:%x\n", + rio_dprintk (RIO_DEBUG_ROUTE, "phb dest: Old %x:%x New %x:%x\n", RWORD(PortP->PhbP->destination) & 0xff, (RWORD(PortP->PhbP->destination) >> 8) & 0xff, - dest_unit, dest_port)); + dest_unit, dest_port); WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8)); WWORD(PortP->PhbP->link, link); @@ -706,7 +706,7 @@ uint unit; */ if (link > 3) return; if (((unit * 8) + 7) > RWORD(HostP->LinkStrP[link].last_port)) { - rio_dprint(RIO_DEBUG_ROUTE, ("last port on host link %d: %d\n", link, (unit * 8) + 7)); + rio_dprintk (RIO_DEBUG_ROUTE, "last port on host link %d: %d\n", link, (unit * 8) + 7); WWORD(HostP->LinkStrP[link].last_port, (unit * 8) + 7); } } @@ -732,7 +732,7 @@ uint UnitId; CheckUnitId( UnitId ); #endif if ( RIOCheck( HostP, UnitId ) ) { - rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is NOT isolated\n",UnitId)); + rio_dprintk (RIO_DEBUG_ROUTE, "Unit %d is NOT isolated\n", UnitId); rio_spin_unlock_irqrestore(&HostP->HostLock, flags); return(0); } @@ -771,7 +771,7 @@ uint UnitId; HostP->Mapping[UnitId].Flags |= BEEN_HERE; if ( p->RIOPrintDisabled == DO_PRINT ) - rio_dprint(RIO_DEBUG_ROUTE, ("RIOMesgIsolated %s",HostP->Mapping[UnitId].Name)); + rio_dprintk (RIO_DEBUG_ROUTE, "RIOMesgIsolated %s", HostP->Mapping[UnitId].Name); for ( link=0; linkMapping[UnitId].Topology[link].Unit; @@ -795,7 +795,7 @@ uint UnitId; CheckUnitId( UnitId ); #endif /* rio_dprint(RIO_DEBUG_ROUTE, ("Check to see if unit %d has a route to the host\n",UnitId)); */ - rio_dprint(RIO_DEBUG_ROUTE, ("RIOCheck : UnitID = %d\n",UnitId)); + rio_dprintk (RIO_DEBUG_ROUTE, "RIOCheck : UnitID = %d\n", UnitId); if ( UnitId == HOST_ID ) { /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is NOT isolated - it IS the host!\n", UnitId)); */ @@ -854,16 +854,16 @@ uint Uniq; case RIO_MCA: case RIO_EISA: case RIO_PCI: - rio_dprint(RIO_DEBUG_ROUTE, ("Unit type: Host\n")); + rio_dprintk (RIO_DEBUG_ROUTE, "Unit type: Host\n"); return(TYPE_HOST); case RIO_RTA_16: - rio_dprint(RIO_DEBUG_ROUTE, ("Unit type: 16 port RTA\n")); + rio_dprintk (RIO_DEBUG_ROUTE, "Unit type: 16 port RTA\n"); return(TYPE_RTA16); case RIO_RTA: - rio_dprint(RIO_DEBUG_ROUTE, ("Unit type: 8 port RTA\n")); + rio_dprintk (RIO_DEBUG_ROUTE, "Unit type: 8 port RTA\n"); return(TYPE_RTA8); default : - rio_dprint(RIO_DEBUG_ROUTE, ("Unit type: Unrecognised\n")); + rio_dprintk (RIO_DEBUG_ROUTE, "Unit type: Unrecognised\n"); return(99); } } @@ -876,7 +876,7 @@ struct rio_info * p; return(0); p->RIOQuickCheck = CHANGED; if ( p->RIOSignalProcess ) { - rio_dprint(RIO_DEBUG_ROUTE, ("Send SIG-HUP")); + rio_dprintk (RIO_DEBUG_ROUTE, "Send SIG-HUP"); /* psignal( RIOSignalProcess, SIGHUP ); */ @@ -951,10 +951,10 @@ int Change; ToName = ToId ? HostP->Mapping[ToId-1].Name : HostP->Name; ToType = ToId ? "RTA" : "HOST"; - rio_dprint(RIO_DEBUG_ROUTE, ("Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", + rio_dprintk (RIO_DEBUG_ROUTE, "Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A'+FromLink, ToType, ToName, 'A'+ToLink, - (Change==CONNECT) ? "established" : "disconnected")); + (Change==CONNECT) ? "established" : "disconnected"); cprintf("Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A'+FromLink, ToType, ToName, 'A'+ToLink, @@ -1000,7 +1000,7 @@ RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit) int link; - rio_dprint(RIO_DEBUG_ROUTE, ("RIOFreeDisconnect unit %d\n",unit)); + rio_dprintk (RIO_DEBUG_ROUTE, "RIOFreeDisconnect unit %d\n", unit); /* ** If the slot is tentative and does not belong to the ** second half of a 16 port RTA then scan to see if @@ -1023,17 +1023,17 @@ RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit) ** made this slot tentative and not yet received a topology update. ** Lets check how long ago we made it tentative. */ - rio_dprint(RIO_DEBUG_ROUTE, ("Just about to check LBOLT on entry %d\n",unit)); + rio_dprintk (RIO_DEBUG_ROUTE, "Just about to check LBOLT on entry %d\n", unit); if (drv_getparm(LBOLT, (ulong_t *) ¤t_time)) - rio_dprint(RIO_DEBUG_ROUTE, ("drv_getparm(LBOLT,....) Failed.\n")); + rio_dprintk (RIO_DEBUG_ROUTE, "drv_getparm(LBOLT,....) Failed.\n"); elapse_time = current_time - TentTime[unit]; - rio_dprint(RIO_DEBUG_ROUTE, ("elapse %d = current %d - tent %d (%d usec)\n", - elapse_time, current_time, TentTime[unit],drv_hztousec(elapse_time))); + rio_dprintk (RIO_DEBUG_ROUTE, "elapse %d = current %d - tent %d (%d usec)\n", + elapse_time, current_time, TentTime[unit], drv_hztousec(elapse_time)); if (drv_hztousec(elapse_time) < WAIT_TO_FINISH) { - rio_dprint(RIO_DEBUG_ROUTE, ("Skipping slot %d, not timed out yet %d\n" - ,unit,drv_hztousec(elapse_time))); + rio_dprintk (RIO_DEBUG_ROUTE, "Skipping slot %d, not timed out yet %d\n", + unit, drv_hztousec(elapse_time)); return 1; } #endif @@ -1046,7 +1046,7 @@ RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit) { int nOther = (HostP->Mapping[unit].ID2) -1; - rio_dprint(RIO_DEBUG_ROUTE, ("RioFreedis second slot %d.\n",nOther)); + rio_dprintk (RIO_DEBUG_ROUTE, "RioFreedis second slot %d.\n", nOther); bzero((caddr_t)&HostP->Mapping[nOther], sizeof(struct Map)); } RIORemoveFromSavedTable(p, &HostP->Mapping[unit]); @@ -1082,19 +1082,19 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2) */ for (unit = 0; unit < MAX_RUP; unit++) { - rio_dprint(RIO_DEBUG_ROUTE, ("Scanning unit %d\n",unit)); + rio_dprintk (RIO_DEBUG_ROUTE, "Scanning unit %d\n",unit); /* ** If the flags are zero then the slot is empty. */ if (HostP->Mapping[unit].Flags == 0) { - rio_dprint(RIO_DEBUG_ROUTE, (" This slot is empty.\n")); + rio_dprintk (RIO_DEBUG_ROUTE, " This slot is empty.\n"); /* ** If we haven't allocated the first ID then do it now. */ if (*pID1 == MAX_RUP) { - rio_dprint(RIO_DEBUG_ROUTE, ("Make tentative entry for first unit %d\n", unit)); + rio_dprintk (RIO_DEBUG_ROUTE, "Make tentative entry for first unit %d\n", unit); *pID1 = unit; /* @@ -1109,7 +1109,7 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2) /* ** Allocate the second slot and return. */ - rio_dprint(RIO_DEBUG_ROUTE, ("Make tentative entry for second unit %d\n", unit)); + rio_dprintk (RIO_DEBUG_ROUTE, "Make tentative entry for second unit %d\n", unit); *pID2 = unit; return 0; } @@ -1121,18 +1121,18 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2) ** need to start all over again looking for tentative slots ** that we can re-use. */ - rio_dprint(RIO_DEBUG_ROUTE, ("Starting to scan for tentative slots\n")); + rio_dprintk (RIO_DEBUG_ROUTE, "Starting to scan for tentative slots\n"); for (unit = 0; unit < MAX_RUP; unit++) { if (((HostP->Mapping[unit].Flags & SLOT_TENTATIVE) || (HostP->Mapping[unit].Flags == 0)) && ! (HostP->Mapping[unit].Flags & RTA16_SECOND_SLOT )) { - rio_dprint(RIO_DEBUG_ROUTE, (" Slot %d looks promising.\n",unit)); + rio_dprintk (RIO_DEBUG_ROUTE, " Slot %d looks promising.\n",unit); if(unit == *pID1) { - rio_dprint(RIO_DEBUG_ROUTE, (" No it isn't, its the 1st half\n")); + rio_dprintk (RIO_DEBUG_ROUTE, " No it isn't, its the 1st half\n"); continue; } @@ -1152,7 +1152,7 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2) */ if (*pID1 == MAX_RUP) { - rio_dprint(RIO_DEBUG_ROUTE, ("Grab tentative entry for first unit %d\n", unit)); + rio_dprintk (RIO_DEBUG_ROUTE, "Grab tentative entry for first unit %d\n", unit); *pID1 = unit; /* @@ -1172,8 +1172,8 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2) /* ** Allocate the second slot and return. */ - rio_dprint(RIO_DEBUG_ROUTE, ("Grab tentative/empty entry for second unit %d\n", - unit)); + rio_dprintk (RIO_DEBUG_ROUTE, "Grab tentative/empty entry for second unit %d\n", + unit); *pID2 = unit; /* @@ -1190,7 +1190,7 @@ RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2) if (*pID1 > *pID2) { - rio_dprint(RIO_DEBUG_ROUTE, ("Swapping IDS %d %d\n",*pID1,*pID2)); + rio_dprintk (RIO_DEBUG_ROUTE, "Swapping IDS %d %d\n", *pID1, *pID2); tempID = *pID1; *pID1 = *pID2; *pID2 = tempID; diff --git a/drivers/char/rio/riotable.c b/drivers/char/rio/riotable.c index 6329a6e18dba..2b82c25ad457 100644 --- a/drivers/char/rio/riotable.c +++ b/drivers/char/rio/riotable.c @@ -120,7 +120,7 @@ struct rio_info * p; ** (9) That names aren't duplicated ** xx (10) That hosts that actually exist are mentioned in the table. xx */ - rio_dprint(RIO_DEBUG_TABLE, ("RIONewTable: entering(1)\n")); + rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(1)\n"); if ( p->RIOSystemUp ) { /* (1) */ p->RIOError.Error = HOST_HAS_ALREADY_BEEN_BOOTED; return EBUSY; @@ -133,7 +133,7 @@ struct rio_info * p; for ( Entry=0; EntryRIOConnectTable[Entry]; if ((MapP->Flags & RTA16_SECOND_SLOT) == 0) { - rio_dprint(RIO_DEBUG_TABLE, ("RIONewTable: entering(2)\n")); + rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(2)\n"); cptr = MapP->Name; /* (2) */ cptr[MAX_NAME_LEN-1]='\0'; if ( cptr[0]=='\0' ) { @@ -161,19 +161,19 @@ struct rio_info * p; continue; } - rio_dprint(RIO_DEBUG_TABLE, ("RIONewTable: entering(3)\n")); + rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(3)\n"); if ( !MapP->RtaUniqueNum && !MapP->HostUniqueNum ) { /* (3) */ if ( MapP->ID || MapP->SysPort || MapP->Flags ) { - rio_dprint(RIO_DEBUG_TABLE, ("%s pretending to be empty but isn't\n",MapP->Name)); + rio_dprintk (RIO_DEBUG_TABLE, "%s pretending to be empty but isn't\n",MapP->Name); p->RIOError.Error = TABLE_ENTRY_ISNT_PROPERLY_NULL; p->RIOError.Entry = Entry; return ENXIO; } - rio_dprint(RIO_DEBUG_TABLE, ("!RIO: Daemon: test (3) passes\n")); + rio_dprintk (RIO_DEBUG_TABLE, "!RIO: Daemon: test (3) passes\n"); continue; } - rio_dprint(RIO_DEBUG_TABLE, ("RIONewTable: entering(4)\n")); + rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(4)\n"); for ( Host=0; HostRIONumHosts; Host++ ) { /* (4) */ if ( p->RIOHosts[Host].UniqueNum==MapP->HostUniqueNum ) { HostP = &p->RIOHosts[Host]; @@ -187,8 +187,8 @@ struct rio_info * p; } if ( Host >= p->RIONumHosts ) { - rio_dprint(RIO_DEBUG_TABLE, ("RTA %s has unknown host unique number 0x%x\n", - MapP->Name,MapP->HostUniqueNum)); + rio_dprintk (RIO_DEBUG_TABLE, "RTA %s has unknown host unique number 0x%x\n", + MapP->Name, MapP->HostUniqueNum); MapP->HostUniqueNum = 0; /* MapP->RtaUniqueNum = 0; */ /* MapP->ID = 0; */ @@ -198,18 +198,18 @@ struct rio_info * p; continue; } - rio_dprint(RIO_DEBUG_TABLE, ("RIONewTable: entering(5)\n")); + rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(5)\n"); if ( MapP->RtaUniqueNum ) { /* (5) */ if ( !MapP->ID ) { - rio_dprint(RIO_DEBUG_TABLE, ("RIO: RTA %s has been allocated an ID of zero!\n", - MapP->Name)); + rio_dprintk (RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an ID of zero!\n", + MapP->Name); p->RIOError.Error = ZERO_RTA_ID; p->RIOError.Entry = Entry; return ENXIO; } if ( MapP->ID > MAX_RUP ) { - rio_dprint(RIO_DEBUG_TABLE, ("RIO: RTA %s has been allocated an illegal ID %d\n", - MapP->Name, MapP->ID)); + rio_dprintk (RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an illegal ID %d\n", + MapP->Name, MapP->ID); p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; p->RIOError.Entry = Entry; return ENXIO; @@ -218,8 +218,8 @@ struct rio_info * p; if ( MapP->HostUniqueNum == p->RIOConnectTable[SubEnt].HostUniqueNum && MapP->ID == p->RIOConnectTable[SubEnt].ID ) { - rio_dprint(RIO_DEBUG_TABLE, ("Dupl. ID number allocated to RTA %s and RTA %s\n", - MapP->Name,p->RIOConnectTable[SubEnt].Name)); + rio_dprintk (RIO_DEBUG_TABLE, "Dupl. ID number allocated to RTA %s and RTA %s\n", + MapP->Name, p->RIOConnectTable[SubEnt].Name); p->RIOError.Error = DUPLICATED_RTA_ID; p->RIOError.Entry = Entry; p->RIOError.Other = SubEnt; @@ -232,29 +232,29 @@ struct rio_info * p; if ((MapP->RtaUniqueNum == p->RIOConnectTable[SubEnt].RtaUniqueNum) && (MapP->ID2 != p->RIOConnectTable[SubEnt].ID)) { - rio_dprint(RIO_DEBUG_TABLE, ("RTA %s has duplicate unique number\n",MapP->Name)); - rio_dprint(RIO_DEBUG_TABLE, ("RTA %s has duplicate unique number\n", - p->RIOConnectTable[SubEnt].Name)); + rio_dprintk (RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n",MapP->Name); + rio_dprintk (RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n", + p->RIOConnectTable[SubEnt].Name); p->RIOError.Error = DUPLICATE_UNIQUE_NUMBER; p->RIOError.Entry = Entry; p->RIOError.Other = SubEnt; return ENXIO; } } - rio_dprint(RIO_DEBUG_TABLE, ("RIONewTable: entering(7a)\n")); + rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(7a)\n"); /* (7a) */ if ((MapP->SysPort != NO_PORT)&&(MapP->SysPort % PORTS_PER_RTA)) { - rio_dprint(RIO_DEBUG_TABLE, ("TTY Port number %d-RTA %s is not a multiple of %d!\n", - (int)MapP->SysPort,MapP->Name,PORTS_PER_RTA)); + rio_dprintk (RIO_DEBUG_TABLE, "TTY Port number %d-RTA %s is not a multiple of %d!\n", + (int)MapP->SysPort,MapP->Name, PORTS_PER_RTA); p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; p->RIOError.Entry = Entry; return ENXIO; } - rio_dprint(RIO_DEBUG_TABLE, ("RIONewTable: entering(7b)\n")); + rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(7b)\n"); /* (7b) */ if ((MapP->SysPort != NO_PORT)&&(MapP->SysPort >= RIO_PORTS)) { - rio_dprint(RIO_DEBUG_TABLE, ("TTY Port number %d for RTA %s is too big\n", - (int)MapP->SysPort,MapP->Name)); + rio_dprintk (RIO_DEBUG_TABLE, "TTY Port number %d for RTA %s is too big\n", + (int)MapP->SysPort, MapP->Name); p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; p->RIOError.Entry = Entry; return ENXIO; @@ -263,22 +263,22 @@ struct rio_info * p; if ( p->RIOConnectTable[SubEnt].Flags & RTA16_SECOND_SLOT ) continue; if ( p->RIOConnectTable[SubEnt].RtaUniqueNum ) { - rio_dprint(RIO_DEBUG_TABLE, ("RIONewTable: entering(8)\n")); + rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(8)\n"); /* (8) */ if ( (MapP->SysPort != NO_PORT) && (MapP->SysPort == p->RIOConnectTable[SubEnt].SysPort) ) { - rio_dprint(RIO_DEBUG_TABLE, ("RTA %s:same TTY port # as RTA %s (%d)\n", + rio_dprintk (RIO_DEBUG_TABLE, "RTA %s:same TTY port # as RTA %s (%d)\n", MapP->Name, p->RIOConnectTable[SubEnt].Name, - (int)MapP->SysPort)); + (int)MapP->SysPort); p->RIOError.Error = TTY_NUMBER_IN_USE; p->RIOError.Entry = Entry; p->RIOError.Other = SubEnt; return ENXIO; } - rio_dprint(RIO_DEBUG_TABLE, ("RIONewTable: entering(9)\n")); + rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(9)\n"); if (RIOStrCmp(MapP->Name, p->RIOConnectTable[SubEnt].Name)==0 && !(MapP->Flags & RTA16_SECOND_SLOT)) { /* (9) */ - rio_dprint(RIO_DEBUG_TABLE, ("RTA name %s used twice\n",MapP->Name)); + rio_dprintk (RIO_DEBUG_TABLE, "RTA name %s used twice\n", MapP->Name); p->RIOError.Error = NAME_USED_TWICE; p->RIOError.Entry = Entry; p->RIOError.Other = SubEnt; @@ -288,17 +288,17 @@ struct rio_info * p; } } else { /* (6) */ - rio_dprint(RIO_DEBUG_TABLE, ("RIONewTable: entering(6)\n")); + rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(6)\n"); if ( MapP->ID ) { - rio_dprint(RIO_DEBUG_TABLE, ("RIO:HOST %s has been allocated ID that isn't zero!\n", - MapP->Name)); + rio_dprintk (RIO_DEBUG_TABLE, "RIO:HOST %s has been allocated ID that isn't zero!\n", + MapP->Name); p->RIOError.Error = HOST_ID_NOT_ZERO; p->RIOError.Entry = Entry; return ENXIO; } if ( MapP->SysPort != NO_PORT ) { - rio_dprint(RIO_DEBUG_TABLE, ("RIO: HOST %s has been allocated port numbers!\n", - MapP->Name)); + rio_dprintk (RIO_DEBUG_TABLE, "RIO: HOST %s has been allocated port numbers!\n", + MapP->Name); p->RIOError.Error = HOST_SYSPORT_BAD; p->RIOError.Entry = Entry; return ENXIO; @@ -326,7 +326,7 @@ struct rio_info * p; ** Copy in the new table entries */ for ( Entry=0; Entry< TOTAL_MAP_ENTRIES; Entry++ ) { - rio_dprint(RIO_DEBUG_TABLE, ("RIONewTable: Copy table for Host entry %d\n", Entry)); + rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: Copy table for Host entry %d\n", Entry); MapP = &p->RIOConnectTable[Entry]; /* @@ -344,7 +344,7 @@ struct rio_info * p; ** If it is a host, then we only need to fill in the name field. */ if ( MapP->ID==0 ) { - rio_dprint(RIO_DEBUG_TABLE, ("Host entry found. Name %s\n",MapP->Name)); + rio_dprintk (RIO_DEBUG_TABLE, "Host entry found. Name %s\n", MapP->Name); bcopy(MapP->Name,HostP->Name,MAX_NAME_LEN); continue; } @@ -357,7 +357,7 @@ struct rio_info * p; HostMapP = &HostP->Mapping[MapP->ID-1]; if (MapP->Flags & SLOT_IN_USE) { - rio_dprint(RIO_DEBUG_TABLE, ("Rta entry found. Name %s\n",MapP->Name)); + rio_dprintk (RIO_DEBUG_TABLE, "Rta entry found. Name %s\n", MapP->Name); /* ** structure assign, then sort out the bits we shouldn't have done */ @@ -370,7 +370,7 @@ struct rio_info * p; RIOReMapPorts(p, HostP, HostMapP ); } else { - rio_dprint(RIO_DEBUG_TABLE, ("TENTATIVE Rta entry found. Name %s\n",MapP->Name)); + rio_dprintk (RIO_DEBUG_TABLE, "TENTATIVE Rta entry found. Name %s\n", MapP->Name); } } @@ -420,11 +420,11 @@ struct rio_info * p; */ if (Host1 != Host) { - rio_dprint(RIO_DEBUG_TABLE, ("Default name %s already used\n", p->RIOHosts[Host].Name)); + rio_dprintk (RIO_DEBUG_TABLE, "Default name %s already used\n", p->RIOHosts[Host].Name); bcopy("HOST 1",p->RIOHosts[Host].Name,7); p->RIOHosts[Host].Name[5] += Host1; } - rio_dprint(RIO_DEBUG_TABLE, ("Assigning default name %s\n", p->RIOHosts[Host].Name)); + rio_dprintk (RIO_DEBUG_TABLE, "Assigning default name %s\n", p->RIOHosts[Host].Name); } return 0; } @@ -447,13 +447,13 @@ struct rio_info * p; disable(oldspl); /* strange but true! */ - rio_dprint(RIO_DEBUG_TABLE, ("Generating a table to return to config.rio\n")); + rio_dprintk (RIO_DEBUG_TABLE, "Generating a table to return to config.rio\n"); bzero((caddr_t)&p->RIOConnectTable[0], sizeof(struct Map) * TOTAL_MAP_ENTRIES ); for ( Host=0; HostRIOHosts[Host]; MapP = &p->RIOConnectTable[Next++]; MapP->HostUniqueNum = HostP->UniqueNum; @@ -501,8 +501,8 @@ struct Map *MapP; int work_done = 0; unsigned long flags; - rio_dprint(RIO_DEBUG_TABLE, ("Delete entry on host %x, rta %x\n", - MapP->HostUniqueNum,MapP->RtaUniqueNum)); + rio_dprintk (RIO_DEBUG_TABLE, "Delete entry on host %x, rta %x\n", + MapP->HostUniqueNum, MapP->RtaUniqueNum); for ( host=0; host < p->RIONumHosts; host++ ) { HostP = &p->RIOHosts[host]; @@ -517,15 +517,15 @@ struct Map *MapP; for ( entry=0; entryRtaUniqueNum == HostP->Mapping[entry].RtaUniqueNum ) { HostMapP = &HostP->Mapping[entry]; - rio_dprint(RIO_DEBUG_TABLE, ("Found entry offset %d on host %s\n", - entry,HostP->Name)); + rio_dprintk (RIO_DEBUG_TABLE, "Found entry offset %d on host %s\n", + entry, HostP->Name); /* ** Check all four links of the unit are disconnected */ for ( link=0; link< LINKS_PER_UNIT; link++ ) { if ( HostMapP->Topology[link].Unit != ROUTE_DISCONNECT ) { - rio_dprint(RIO_DEBUG_TABLE, ("Entry is in use and cannot be deleted!\n")); + rio_dprintk (RIO_DEBUG_TABLE, "Entry is in use and cannot be deleted!\n"); p->RIOError.Error = UNIT_IS_IN_USE; rio_spin_unlock_irqrestore( &HostP->HostLock, flags); return EBUSY; @@ -540,7 +540,7 @@ struct Map *MapP; if ( SysPort != NO_PORT ) { for (port=SysPort; port < SysPort+PORTS_PER_RTA; port++) { PortP = p->RIOPortp[port]; - rio_dprint(RIO_DEBUG_TABLE, ("Unmap port\n")); + rio_dprintk (RIO_DEBUG_TABLE, "Unmap port\n"); rio_spin_lock_irqsave( &PortP->portSem, flags ); @@ -548,7 +548,7 @@ struct Map *MapP; if ( PortP->State & (RIO_MOPEN|RIO_LOPEN) ) { - rio_dprint(RIO_DEBUG_TABLE, ("Gob on port\n")); + rio_dprintk (RIO_DEBUG_TABLE, "Gob on port\n"); PortP->TxBufferIn = PortP->TxBufferOut = 0; /* What should I do wakeup( &PortP->TxBufferIn ); @@ -585,25 +585,25 @@ struct Map *MapP; */ Pkt = (PKT *) RIO_PTR(HostP->Caddr, RWORD(*TxPktP)); - rio_dprint(RIO_DEBUG_TABLE, ( + rio_dprintk (RIO_DEBUG_TABLE, "Tx packet (%x) destination: Old %x:%x New %x:%x\n", *TxPktP, Pkt->dest_unit, - Pkt->dest_port, dest_unit, dest_port)); + Pkt->dest_port, dest_unit, dest_port); WWORD(Pkt->dest_unit, dest_unit); WWORD(Pkt->dest_port, dest_port); } - rio_dprint(RIO_DEBUG_TABLE, ( + rio_dprintk (RIO_DEBUG_TABLE, "Port %d phb destination: Old %x:%x New %x:%x\n", port, PortP->PhbP->destination & 0xff, (PortP->PhbP->destination >> 8) & 0xff, - dest_unit, dest_port)); + dest_unit, dest_port); WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8)); } rio_spin_unlock_irqrestore(&PortP->portSem, flags); } } - rio_dprint(RIO_DEBUG_TABLE, ("Entry nulled.\n")); + rio_dprintk (RIO_DEBUG_TABLE, "Entry nulled.\n"); bzero((char *)HostMapP,sizeof(struct Map)); work_done++; } @@ -625,7 +625,7 @@ struct Map *MapP; if ( work_done ) return 0; - rio_dprint(RIO_DEBUG_TABLE, ("Couldn't find entry to be deleted\n")); + rio_dprintk (RIO_DEBUG_TABLE, "Couldn't find entry to be deleted\n"); p->RIOError.Error = COULDNT_FIND_ENTRY; return ENXIO; } @@ -638,32 +638,32 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP ) int link; - rio_dprint(RIO_DEBUG_TABLE, ("Assign entry on host %x, rta %x, ID %d, Sysport %d\n", + rio_dprintk (RIO_DEBUG_TABLE, "Assign entry on host %x, rta %x, ID %d, Sysport %d\n", MapP->HostUniqueNum,MapP->RtaUniqueNum, - MapP->ID, (int)MapP->SysPort )); + MapP->ID, (int)MapP->SysPort); if ((MapP->ID != (ushort)-1) && ((int)MapP->ID < (int)1 || (int)MapP->ID > MAX_RUP )) { - rio_dprint(RIO_DEBUG_TABLE, ("Bad ID in map entry!\n")); + rio_dprintk (RIO_DEBUG_TABLE, "Bad ID in map entry!\n"); p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; return EINVAL; } if (MapP->RtaUniqueNum == 0) { - rio_dprint(RIO_DEBUG_TABLE, ("Rta Unique number zero!\n")); + rio_dprintk (RIO_DEBUG_TABLE, "Rta Unique number zero!\n"); p->RIOError.Error = RTA_UNIQUE_NUMBER_ZERO; return EINVAL; } if ( (MapP->SysPort != NO_PORT) && (MapP->SysPort % PORTS_PER_RTA) ) { - rio_dprint(RIO_DEBUG_TABLE, ("Port %d not multiple of %d!\n",(int)MapP->SysPort,PORTS_PER_RTA)); + rio_dprintk (RIO_DEBUG_TABLE, "Port %d not multiple of %d!\n",(int)MapP->SysPort,PORTS_PER_RTA); p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; return EINVAL; } if ( (MapP->SysPort != NO_PORT) && (MapP->SysPort >= RIO_PORTS) ) { - rio_dprint(RIO_DEBUG_TABLE, ("Port %d not valid!\n",(int)MapP->SysPort)); + rio_dprintk (RIO_DEBUG_TABLE, "Port %d not valid!\n",(int)MapP->SysPort); p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; return EINVAL; } @@ -677,7 +677,7 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP ) { if ( *sptr<' ' || *sptr>'~' ) { - rio_dprint(RIO_DEBUG_TABLE, ("Name entry contains non-printing characters!\n")); + rio_dprintk (RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n"); p->RIOError.Error = BAD_CHARACTER_IN_NAME; return EINVAL; } @@ -702,8 +702,8 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP ) { int nNewID; - rio_dprint(RIO_DEBUG_TABLE, ("Attempting to get a new ID for rta \"%s\"\n", - MapP->Name)); + rio_dprintk (RIO_DEBUG_TABLE, "Attempting to get a new ID for rta \"%s\"\n", + MapP->Name); /* ** The idea here is to allow RTA's to be assigned ** before they actually appear on the network. @@ -721,7 +721,7 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP ) return EBUSY; } MapP->ID = (ushort)nNewID + 1; - rio_dprint(RIO_DEBUG_TABLE, ("Allocated ID %d for this new RTA.\n",MapP->ID)); + rio_dprintk (RIO_DEBUG_TABLE, "Allocated ID %d for this new RTA.\n", MapP->ID); HostMapP = &p->RIOHosts[host].Mapping[nNewID]; HostMapP->RtaUniqueNum = MapP->RtaUniqueNum; HostMapP->HostUniqueNum = MapP->HostUniqueNum; @@ -747,9 +747,9 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP ) HostMapP->Flags |= RTA16_SECOND_SLOT; HostMapP->ID2 = MapP->ID2 = p->RIOHosts[host].Mapping[unit].ID; p->RIOHosts[host].Mapping[unit].ID2 = MapP->ID; - rio_dprint(RIO_DEBUG_TABLE, ("Cross referenced id %d to ID %d.\n", + rio_dprintk (RIO_DEBUG_TABLE, "Cross referenced id %d to ID %d.\n", MapP->ID, - p->RIOHosts[host].Mapping[unit].ID)); + p->RIOHosts[host].Mapping[unit].ID); } } @@ -757,7 +757,7 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP ) if ( HostMapP->Flags & SLOT_IN_USE ) { - rio_dprint(RIO_DEBUG_TABLE, ("Map table slot for ID %d is already in use.\n",MapP->ID)); + rio_dprintk (RIO_DEBUG_TABLE, "Map table slot for ID %d is already in use.\n", MapP->ID); p->RIOError.Error = ID_ALREADY_IN_USE; return EBUSY; } @@ -791,15 +791,15 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP ) p->RIOLastPortsBooted = HostMapP->SysPort; } if (MapP->Flags & RTA16_SECOND_SLOT) - rio_dprint(RIO_DEBUG_TABLE, ("Second map of RTA %s added to configuration\n", - p->RIOHosts[host].Mapping[MapP->ID2 - 1].Name)); + rio_dprintk (RIO_DEBUG_TABLE, "Second map of RTA %s added to configuration\n", + p->RIOHosts[host].Mapping[MapP->ID2 - 1].Name); else - rio_dprint(RIO_DEBUG_TABLE, ("RTA %s added to configuration\n",MapP->Name)); + rio_dprintk (RIO_DEBUG_TABLE, "RTA %s added to configuration\n", MapP->Name); return 0; } } p->RIOError.Error = UNKNOWN_HOST_NUMBER; - rio_dprint(RIO_DEBUG_TABLE, ("Unknown host %x\n",MapP->HostUniqueNum)); + rio_dprintk (RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum); return ENXIO; } @@ -822,7 +822,7 @@ struct Map *HostMapP; CheckHostMapP( HostMapP ); #endif - rio_dprint(RIO_DEBUG_TABLE, ("Mapping sysport %d to id %d\n",(int)HostMapP->SysPort, HostMapP->ID)); + rio_dprintk (RIO_DEBUG_TABLE, "Mapping sysport %d to id %d\n", (int)HostMapP->SysPort, HostMapP->ID); /* ** We need to tell the UnixRups which sysport the rup corresponds to @@ -833,26 +833,26 @@ struct Map *HostMapP; return(0); RtaType = GetUnitType(HostMapP->RtaUniqueNum); - rio_dprint(RIO_DEBUG_TABLE, ("Mapping sysport %d-%d\n", - (int)HostMapP->SysPort,(int)HostMapP->SysPort+PORTS_PER_RTA-1)); + rio_dprintk (RIO_DEBUG_TABLE, "Mapping sysport %d-%d\n", + (int)HostMapP->SysPort, (int)HostMapP->SysPort+PORTS_PER_RTA-1); /* ** now map each of its eight ports */ for ( SubEnt=0; SubEntSysPort = %d\n", - SubEnt, (int) HostMapP->SysPort)); + rio_dprintk (RIO_DEBUG_TABLE, "subent = %d, HostMapP->SysPort = %d\n", + SubEnt, (int)HostMapP->SysPort); SysPort = HostMapP->SysPort+SubEnt; /* portnumber within system */ /* portnumber on host */ HostPort = (HostMapP->ID-1)*PORTS_PER_RTA+SubEnt; - rio_dprint (RIO_DEBUG_TABLE, ("c1 p = %p, p->rioPortp = %p\n", p, p->RIOPortp)); + rio_dprintk (RIO_DEBUG_TABLE, "c1 p = %p, p->rioPortp = %p\n", p, p->RIOPortp); PortP = p->RIOPortp[SysPort]; #if 0 PortP->TtyP = &p->channel[SysPort]; #endif - rio_dprint(RIO_DEBUG_TABLE, ("Map port\n")); + rio_dprintk (RIO_DEBUG_TABLE, "Map port\n"); /* ** Point at all the real neat data structures @@ -1008,12 +1008,12 @@ struct Map* MapP; struct Map *HostMapP; char *sptr; - rio_dprint(RIO_DEBUG_TABLE, ("Change name entry on host %x, rta %x, ID %d, Sysport %d\n", + rio_dprintk (RIO_DEBUG_TABLE, "Change name entry on host %x, rta %x, ID %d, Sysport %d\n", MapP->HostUniqueNum,MapP->RtaUniqueNum, - MapP->ID, (int)MapP->SysPort )); + MapP->ID, (int)MapP->SysPort); if ( MapP->ID > MAX_RUP ) { - rio_dprint(RIO_DEBUG_TABLE, ("Bad ID in map entry!\n")); + rio_dprintk (RIO_DEBUG_TABLE, "Bad ID in map entry!\n"); p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; return EINVAL; } @@ -1023,7 +1023,7 @@ struct Map* MapP; while ( *sptr ) { if ( *sptr<' ' || *sptr>'~' ) { - rio_dprint(RIO_DEBUG_TABLE, ("Name entry contains non-printing characters!\n")); + rio_dprintk (RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n"); p->RIOError.Error = BAD_CHARACTER_IN_NAME; return EINVAL; } @@ -1052,6 +1052,6 @@ struct Map* MapP; } } p->RIOError.Error = UNKNOWN_HOST_NUMBER; - rio_dprint(RIO_DEBUG_TABLE, ("Unknown host %x\n",MapP->HostUniqueNum)); + rio_dprintk (RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum); return ENXIO; } diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c index cda417f3f4da..c9134e3fc84b 100644 --- a/drivers/char/rio/riotty.c +++ b/drivers/char/rio/riotty.c @@ -164,15 +164,15 @@ riotopen(struct tty_struct * tty, struct file * filp) Modem = rio_ismodem (tty->device); if ( p->RIOFailed ) { - rio_dprint(RIO_DEBUG_TTY, ("System initialisation failed\n")); + rio_dprintk (RIO_DEBUG_TTY, "System initialisation failed\n"); pseterr(ENXIO); func_exit (); return -ENXIO; } - rio_dprint(RIO_DEBUG_TTY, ("port open SysPort %d (%s) (mapped:%d)\n", + rio_dprintk (RIO_DEBUG_TTY, "port open SysPort %d (%s) (mapped:%d)\n", SysPort, Modem ? "Modem" : "tty", - p->RIOPortp[SysPort]->Mapped ) ); + p->RIOPortp[SysPort]->Mapped); /* ** Validate that we have received a legitimate request. @@ -181,7 +181,7 @@ riotopen(struct tty_struct * tty, struct file * filp) ** has been mapped onto a host. */ if (SysPort >= RIO_PORTS) { /* out of range ? */ - rio_dprint(RIO_DEBUG_TTY, ("Illegal port number %d\n",SysPort)); + rio_dprintk (RIO_DEBUG_TTY, "Illegal port number %d\n",SysPort); pseterr(ENXIO); func_exit(); return -ENXIO; @@ -197,7 +197,7 @@ riotopen(struct tty_struct * tty, struct file * filp) ** The system doesn't know which RTA this port ** corresponds to. */ - rio_dprint(RIO_DEBUG_TTY, ("port not mapped into system\n")); + rio_dprintk (RIO_DEBUG_TTY, "port not mapped into system\n"); func_exit (); pseterr(ENXIO); return -ENXIO; @@ -206,17 +206,26 @@ riotopen(struct tty_struct * tty, struct file * filp) tty->driver_data = PortP; PortP->gs.tty = tty; + if (!PortP->gs.count) + rio_inc_mod_count (); PortP->gs.count++; - rio_dprint(RIO_DEBUG_TTY, ("%d bytes in tx buffer\n", - PortP->gs.xmit_cnt)); - gs_init_port (&PortP->gs); + rio_dprintk (RIO_DEBUG_TTY, "%d bytes in tx buffer\n", + PortP->gs.xmit_cnt); + + retval = gs_init_port (&PortP->gs); + if (retval) { + PortP->gs.count--; + if (PortP->gs.count) + rio_dec_mod_count (); + return -ENXIO; + } /* ** If the host hasn't been booted yet, then ** fail */ if ( (PortP->HostP->Flags & RUN_STATE) != RC_RUNNING ) { - rio_dprint(RIO_DEBUG_TTY, ("Host not running\n")); + rio_dprintk (RIO_DEBUG_TTY, "Host not running\n"); pseterr(ENXIO); func_exit (); return -ENXIO; @@ -230,24 +239,24 @@ riotopen(struct tty_struct * tty, struct file * filp) #if 0 if (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) { if (PortP->WaitUntilBooted) { - rio_dprint(RIO_DEBUG_TTY, ("Waiting for RTA to boot\n")); + rio_dprintk (RIO_DEBUG_TTY, "Waiting for RTA to boot\n"); do { if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { - rio_dprint(RIO_DEBUG_TTY, ("RTA EINTR in delay \n")); + rio_dprintk (RIO_DEBUG_TTY, "RTA EINTR in delay \n"); func_exit (); return -EINTR; } if (repeat_this -- <= 0) { - rio_dprint(RIO_DEBUG_TTY, ("Waiting for RTA to boot timeout\n")); + rio_dprintk (RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n"); RIOPreemptiveCmd(p, PortP, FCLOSE ); pseterr(EINTR); func_exit (); return -EIO; } } while(!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)); - rio_dprint(RIO_DEBUG_TTY, ("RTA has been booted\n")); + rio_dprintk (RIO_DEBUG_TTY, "RTA has been booted\n"); } else { - rio_dprint(RIO_DEBUG_TTY, ("RTA never booted\n")); + rio_dprintk (RIO_DEBUG_TTY, "RTA never booted\n"); pseterr(ENXIO); func_exit (); return 0; @@ -258,10 +267,10 @@ riotopen(struct tty_struct * tty, struct file * filp) easier to read and shorter. Now, if it works too that would be great... -- REW */ - rio_dprint(RIO_DEBUG_TTY, ("Checking if RTA has booted... \n")); + rio_dprintk (RIO_DEBUG_TTY, "Checking if RTA has booted... \n"); while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) { if (!PortP->WaitUntilBooted) { - rio_dprint(RIO_DEBUG_TTY, ("RTA never booted\n")); + rio_dprintk (RIO_DEBUG_TTY, "RTA never booted\n"); func_exit (); return -ENXIO; } @@ -271,17 +280,17 @@ riotopen(struct tty_struct * tty, struct file * filp) now. --REW */ if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { - rio_dprint(RIO_DEBUG_TTY, ("RTA_wait_for_boot: EINTR in delay \n")); + rio_dprintk (RIO_DEBUG_TTY, "RTA_wait_for_boot: EINTR in delay \n"); func_exit (); return -EINTR; } if (repeat_this -- <= 0) { - rio_dprint(RIO_DEBUG_TTY, ("Waiting for RTA to boot timeout\n")); + rio_dprintk (RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n"); func_exit (); return -EIO; } } - rio_dprint(RIO_DEBUG_TTY, ("RTA has been booted\n")); + rio_dprintk (RIO_DEBUG_TTY, "RTA has been booted\n"); #endif #if 0 tp = PortP->TtyP; /* get tty struct */ @@ -304,9 +313,9 @@ riotopen(struct tty_struct * tty, struct file * filp) ** for it to finish, so that it doesn't close us! */ while ( (PortP->State & RIO_CLOSING) && !p->RIOHalted ) { - rio_dprint(RIO_DEBUG_TTY, ("Waiting for RIO_CLOSING to go away\n")); + rio_dprintk (RIO_DEBUG_TTY, "Waiting for RIO_CLOSING to go away\n"); if (repeat_this -- <= 0) { - rio_dprint(RIO_DEBUG_TTY, ("Waiting for not idle closed broken by signal\n")); + rio_dprintk (RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n"); RIOPreemptiveCmd(p, PortP, FCLOSE ); retval = -EINTR; goto bombout; @@ -321,7 +330,7 @@ riotopen(struct tty_struct * tty, struct file * filp) } if ( !PortP->Mapped ) { - rio_dprint(RIO_DEBUG_TTY, ("Port unmapped while closing!\n")); + rio_dprintk (RIO_DEBUG_TTY, "Port unmapped while closing!\n"); rio_spin_unlock_irqrestore(&PortP->portSem, flags); retval = -ENXIO; func_exit (); @@ -344,8 +353,8 @@ riotopen(struct tty_struct * tty, struct file * filp) } if (!(PortP->firstOpen)) { /* First time ? */ - rio_dprint(RIO_DEBUG_TTY, ("First open for this port\n")); - rio_inc_mod_count (); + rio_dprintk (RIO_DEBUG_TTY, "First open for this port\n"); + PortP->firstOpen++; PortP->CookMode = 0; /* XXX RIOCookMode(tp); */ @@ -375,7 +384,7 @@ riotopen(struct tty_struct * tty, struct file * filp) ** wait for the port to be not closed. */ while ( !(PortP->PortState & PORT_ISOPEN) && !p->RIOHalted ) { - rio_dprint(RIO_DEBUG_TTY, ("Waiting for PORT_ISOPEN-currently %x\n",PortP->PortState)); + rio_dprintk (RIO_DEBUG_TTY, "Waiting for PORT_ISOPEN-currently %x\n",PortP->PortState); /* ** 15.10.1998 ARG - ESIL 0759 ** (Part) fix for port being trashed when opened whilst RTA "disconnected" @@ -392,7 +401,7 @@ riotopen(struct tty_struct * tty, struct file * filp) */ rio_spin_unlock_irqrestore(&PortP->portSem, flags); if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { - rio_dprint(RIO_DEBUG_TTY, ("Waiting for open to finish broken by signal\n")); + rio_dprintk (RIO_DEBUG_TTY, "Waiting for open to finish broken by signal\n"); RIOPreemptiveCmd(p, PortP, FCLOSE ); func_exit (); return -EINTR; @@ -407,52 +416,67 @@ bombout: rio_spin_unlock_irqrestore(&PortP->portSem, flags); return retval; } - rio_dprint(RIO_DEBUG_TTY, ("PORT_ISOPEN found\n")); + rio_dprintk (RIO_DEBUG_TTY, "PORT_ISOPEN found\n"); } #ifdef MODEM_SUPPORT if (Modem) { - rio_dprint(RIO_DEBUG_TTY, ("Modem - test for carrier\n")); + rio_dprintk (RIO_DEBUG_TTY, "Modem - test for carrier\n"); /* ** ACTION ** insert test for carrier here. -- ??? ** I already see that test here. What's the deal? -- REW */ - if ((tp->tm.c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) + if ((PortP->gs.tty->termios->c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) { - rio_dprint(RIO_DEBUG_TTY, (PortP,DBG_OPEN,"open(%d) Modem carr on\n",SysPort)); + rio_dprintk (RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort); + /* tp->tm.c_state |= CARR_ON; wakeup((caddr_t) &tp->tm.c_canq); + */ + PortP->State |= RIO_CARR_ON; + wake_up_interruptible (&PortP->gs.open_wait); } else /* no carrier - wait for DCD */ { - while (!(tp->tm.c_state&CARR_ON) && - !(filp->f_flags&O_NONBLOCK) && !p->RIOHalted ) - { - rio_dprint(RIO_DEBUG_TTY, (PortP,DBG_OPEN,"open(%d) sleeping for carr on\n",SysPort)); - tp->tm.c_state |= WOPEN; + /* + while (!(PortP->gs.tty->termios->c_state & CARR_ON) && + !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted ) + */ + while (!(PortP->State & RIO_CARR_ON) && + !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted ) { + + rio_dprintk (RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n",SysPort); + /* + PortP->gs.tty->termios->c_state |= WOPEN; + */ PortP->State |= RIO_WOPEN; - if ( sleep((caddr_t)&tp->tm.c_canq, TTIPRI|PCATCH)) +#if 0 + if ( sleep((caddr_t)&tp->tm.c_canqo, TTIPRI|PCATCH)) { /* ** ACTION: verify that this is a good thing ** to do here. -- ??? ** I think it's OK. -- REW */ - rio_dprint(RIO_DEBUG_TTY, ("open(%d) sleeping for carr broken by signal\n", - SysPort)); + rio_dprintk (RIO_DEBUG_TTY, "open(%d) sleeping for carr broken by signal\n", + SysPort); RIOPreemptiveCmd( p, PortP, FCLOSE ); + /* tp->tm.c_state &= ~WOPEN; + */ PortP->State &= ~RIO_WOPEN; rio_spin_unlock_irqrestore(&PortP->portSem, flags); func_exit (); return -EINTR; } +#endif } PortP->State &= ~RIO_WOPEN; } - if ( RIOHalted ) + if ( p->RIOHalted ) goto bombout; + rio_dprintk (RIO_DEBUG_TTY, "Setting RIO_MOPEN\n"); PortP->State |= RIO_MOPEN; } else @@ -470,7 +494,7 @@ bombout: goto bombout; } - rio_dprint(RIO_DEBUG_TTY, ("high level open done\n")); + rio_dprintk (RIO_DEBUG_TTY, "high level open done\n"); #ifdef STATS PortP->Stat.OpenCnt++; @@ -482,7 +506,7 @@ bombout: PortP->opens++; rio_spin_unlock_irqrestore(&PortP->portSem, flags); - rio_dprint(RIO_DEBUG_TTY, ("Returning from open\n")); + rio_dprintk (RIO_DEBUG_TTY, "Returning from open\n"); func_exit (); return 0; } @@ -509,13 +533,13 @@ riotclose(void *ptr) int Modem; int rv =0; - rio_dprint(RIO_DEBUG_TTY, ("port close SysPort %d\n",PortP->PortNum)); + rio_dprintk (RIO_DEBUG_TTY, "port close SysPort %d\n",PortP->PortNum); /* PortP = p->RIOPortp[SysPort]; */ - rio_dprint(RIO_DEBUG_TTY, ("Port is at address 0x%x\n",(int)PortP)); + rio_dprintk (RIO_DEBUG_TTY, "Port is at address 0x%x\n",(int)PortP); /* tp = PortP->TtyP;*/ /* Get tty */ tty = PortP->gs.tty; - rio_dprint(RIO_DEBUG_TTY, ("TTY is at address 0x%x\n",(int)tty)); + rio_dprintk (RIO_DEBUG_TTY, "TTY is at address 0x%x\n",(int)tty); Modem = rio_ismodem(tty->device); #if 0 /* What F.CKING cache? Even then, a higly idle multiprocessor, @@ -533,7 +557,7 @@ riotclose(void *ptr) PortP->State |= RIO_CLOSING; if ( (PortP->State & RIO_DELETED) ) { - rio_dprint(RIO_DEBUG_TTY, ("Close on deleted RTA\n")); + rio_dprintk (RIO_DEBUG_TTY, "Close on deleted RTA\n"); deleted = 1; } @@ -543,7 +567,7 @@ riotclose(void *ptr) goto close_end; } - rio_dprint(RIO_DEBUG_TTY, ("Clear bits\n")); + rio_dprintk (RIO_DEBUG_TTY, "Clear bits\n"); /* ** clear the open bits for this device */ @@ -561,7 +585,7 @@ riotclose(void *ptr) ** The port is still open for the other task - ** return, pretending that we are still active. */ - rio_dprint(RIO_DEBUG_TTY, ("Channel %d still open !\n",PortP->PortNum)); + rio_dprintk (RIO_DEBUG_TTY, "Channel %d still open !\n",PortP->PortNum); PortP->State &= ~RIO_CLOSING; if (PortP->firstOpen) PortP->firstOpen--; @@ -569,7 +593,7 @@ riotclose(void *ptr) return -EIO; } - rio_dprint(RIO_DEBUG_TTY, ("Closing down - everything must go!\n")); + rio_dprintk (RIO_DEBUG_TTY, "Closing down - everything must go!\n"); PortP->State &= ~RIO_DYNOROD; @@ -578,7 +602,7 @@ riotclose(void *ptr) ** to drain down before closing. Bye-bye.... ** (We never meant to do this) */ - rio_dprint(RIO_DEBUG_TTY, ("Timeout 1 starts\n")); + rio_dprintk (RIO_DEBUG_TTY, "Timeout 1 starts\n"); #if 0 if (!deleted) @@ -587,14 +611,14 @@ riotclose(void *ptr) cprintf("Need to flush the ttyport\n"); if (repeat_this -- <= 0) { rv = -EINTR; - rio_dprint(RIO_DEBUG_TTY, ("Waiting for not idle closed broken by signal\n")); + rio_dprintk (RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n"); RIOPreemptiveCmd(p, PortP, FCLOSE ); goto close_end; } - rio_dprint(RIO_DEBUG_TTY, ("Calling timeout to flush in closing\n")); + rio_dprintk (RIO_DEBUG_TTY, "Calling timeout to flush in closing\n"); rio_spin_unlock_irqrestore(&PortP->portSem, flags); if (RIODelay_ni(PortP, HUNDRED_MS*10) == RIO_FAIL) { - rio_dprint(RIO_DEBUG_TTY, ("RTA EINTR in delay \n")); + rio_dprintk (RIO_DEBUG_TTY, "RTA EINTR in delay \n"); rv = -EINTR; rio_spin_lock_irqsave(&PortP->portSem, flags); goto close_end; @@ -611,7 +635,7 @@ riotclose(void *ptr) ** The port has been re-opened for the other task - ** return, pretending that we are still active. */ - rio_dprint(RIO_DEBUG_TTY, ("Channel %d re-open!\n", PortP->PortNum)); + rio_dprintk (RIO_DEBUG_TTY, "Channel %d re-open!\n", PortP->PortNum); PortP->State &= ~RIO_CLOSING; rio_spin_unlock_irqrestore(&PortP->portSem, flags); if (PortP->firstOpen) @@ -638,12 +662,12 @@ riotclose(void *ptr) while (try && (PortP->PortState & PORT_ISOPEN)) { try--; if (try == 0) { - rio_dprint(RIO_DEBUG_TTY, ("Run out of tries - force the bugger shut!\n" )); + rio_dprintk (RIO_DEBUG_TTY, "Run out of tries - force the bugger shut!\n" ); RIOPreemptiveCmd(p, PortP,FCLOSE); break; } - rio_dprint(RIO_DEBUG_TTY, ("Close: PortState:ISOPEN is %d\n", - PortP->PortState & PORT_ISOPEN)); + rio_dprintk (RIO_DEBUG_TTY, "Close: PortState:ISOPEN is %d\n", + PortP->PortState & PORT_ISOPEN); if ( p->RIOHalted ) { RIOClearUp( PortP ); @@ -652,7 +676,7 @@ riotclose(void *ptr) RIODelay_ni(PortP, HUNDRED_MS); } rio_spin_lock_irqsave(&PortP->portSem, flags); - rio_dprint(RIO_DEBUG_TTY, ("Close: try was %d on completion\n", try )); + rio_dprintk (RIO_DEBUG_TTY, "Close: try was %d on completion\n", try ); /* RIOPreemptiveCmd(p, PortP, FCLOSE); */ @@ -682,7 +706,7 @@ close_end: if (PortP->firstOpen) PortP->firstOpen--; rio_spin_unlock_irqrestore(&PortP->portSem, flags); - rio_dprint(RIO_DEBUG_TTY, ("Return from close\n")); + rio_dprintk (RIO_DEBUG_TTY, "Return from close\n"); return rv; } @@ -731,7 +755,7 @@ static void RIOClearUp(PortP) struct Port *PortP; { - rio_dprint(RIO_DEBUG_TTY, ("RIOHalted set\n")); + rio_dprintk (RIO_DEBUG_TTY, "RIOHalted set\n"); PortP->Config = 0; /* Direct semaphore */ PortP->PortState = 0; PortP->firstOpen = 0; @@ -761,7 +785,7 @@ static int RIOShortCommand(struct rio_info *p, struct Port *PortP, int retries = 20; /* at 10 per second -> 2 seconds */ unsigned long flags; - rio_dprint(RIO_DEBUG_TTY, ("entering shortcommand.\n")); + rio_dprintk (RIO_DEBUG_TTY, "entering shortcommand.\n"); #ifdef CHECK CheckPortP( PortP ); if ( len < 1 || len > 2 ) @@ -769,7 +793,7 @@ static int RIOShortCommand(struct rio_info *p, struct Port *PortP, #endif if ( PortP->State & RIO_DELETED ) { - rio_dprint(RIO_DEBUG_TTY, ("Short command to deleted RTA ignored\n")); + rio_dprintk (RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n"); return RIO_FAIL; } rio_spin_lock_irqsave(&PortP->portSem, flags); @@ -779,8 +803,8 @@ static int RIOShortCommand(struct rio_info *p, struct Port *PortP, ** be free again. */ while ( (PortP->InUse != NOT_INUSE) && !p->RIOHalted ) { - rio_dprint(RIO_DEBUG_TTY, ("Waiting for not in use (%d)\n", - retries)); + rio_dprintk (RIO_DEBUG_TTY, "Waiting for not in use (%d)\n", + retries); rio_spin_unlock_irqrestore(&PortP->portSem, flags); if (retries-- <= 0) { return RIO_FAIL; @@ -791,16 +815,16 @@ static int RIOShortCommand(struct rio_info *p, struct Port *PortP, rio_spin_lock_irqsave(&PortP->portSem, flags); } if ( PortP->State & RIO_DELETED ) { - rio_dprint(RIO_DEBUG_TTY, ("Short command to deleted RTA ignored\n")); + rio_dprintk (RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n"); rio_spin_unlock_irqrestore(&PortP->portSem, flags); return RIO_FAIL; } while ( !can_add_transmit(&PacketP,PortP) && !p->RIOHalted ) { - rio_dprint(RIO_DEBUG_TTY, ("Waiting to add short command to queue (%d)\n", retries)); + rio_dprintk (RIO_DEBUG_TTY, "Waiting to add short command to queue (%d)\n", retries); rio_spin_unlock_irqrestore(&PortP->portSem, flags); if (retries-- <= 0) { - rio_dprint(RIO_DEBUG_TTY, ("out of tries. Failing\n")); + rio_dprintk (RIO_DEBUG_TTY, "out of tries. Failing\n"); return RIO_FAIL; } if ( RIODelay_ni(PortP, HUNDRED_MS)==RIO_FAIL ) { @@ -865,11 +889,11 @@ register caddr_t arg; int Modem = rio_ismodem(dev); int ioctl_processed; - rio_dprint(RIO_DEBUG_TTY, ("port ioctl SysPort %d command 0x%x argument 0x%x %s\n", - SysPort,cmd,arg,Modem?"Modem":"tty")); + rio_dprintk (RIO_DEBUG_TTY, "port ioctl SysPort %d command 0x%x argument 0x%x %s\n", + SysPort, cmd, arg, Modem?"Modem":"tty") ; if ( SysPort >= RIO_PORTS ) { - rio_dprint(RIO_DEBUG_TTY, ("Bad port number %d\n",SysPort)); + rio_dprintk (RIO_DEBUG_TTY, "Bad port number %d\n", SysPort); return -ENXIO; } @@ -926,22 +950,22 @@ register caddr_t arg; return 0; case TCRIOTSTATE: - rio_dprint(RIO_DEBUG_TTY, ("tbusy/tstop monitoring %sabled\n", - arg ? "en" : "dis")); + rio_dprintk (RIO_DEBUG_TTY, "tbusy/tstop monitoring %sabled\n", + arg ? "en" : "dis"); /* MonitorTstate = 0 ;*/ rio_spin_unlock_irqrestore(&PortP->portSem, flags); RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP); return 0; case TCRIOSTATE: /* current state of Modem input pins */ - rio_dprint(RIO_DEBUG_TTY, ("TCRIOSTATE\n")); + rio_dprintk (RIO_DEBUG_TTY, "TCRIOSTATE\n"); if (RIOPreemptiveCmd(p, PortP, MGET) == RIO_FAIL) - rio_dprint(RIO_DEBUG_TTY, ("TCRIOSTATE command failed\n")); + rio_dprintk (RIO_DEBUG_TTY, "TCRIOSTATE command failed\n"); PortP->State |= RIO_BUSY; current = PortP->ModemState; if ( copyout((caddr_t)¤t, (int)arg, sizeof(current))==COPYFAIL ) { - rio_dprint(RIO_DEBUG_TTY, ("Copyout failed\n")); + rio_dprintk (RIO_DEBUG_TTY, "Copyout failed\n"); rio_spin_unlock_irqrestore(&PortP->portSem, flags); pseterr(EFAULT); } @@ -950,15 +974,15 @@ register caddr_t arg; case TCRIOMBIS: /* Set modem lines */ case TCRIOMBIC: /* Clear modem lines */ - rio_dprint(RIO_DEBUG_TTY, ("TCRIOMBIS/TCRIOMBIC\n")); + rio_dprintk (RIO_DEBUG_TTY, "TCRIOMBIS/TCRIOMBIC\n"); if (cmd == TCRIOMBIS) { uint state; state = (uint)arg; PortP->ModemState |= (ushort)state; PortP->ModemLines = (ulong) arg; if (RIOPreemptiveCmd(p, PortP, MBIS) == RIO_FAIL) - rio_dprint(RIO_DEBUG_TTY, ( - "TCRIOMBIS command failed\n")); + rio_dprintk (RIO_DEBUG_TTY, + "TCRIOMBIS command failed\n"); } else { uint state; @@ -967,17 +991,17 @@ register caddr_t arg; PortP->ModemState &= ~(ushort)state; PortP->ModemLines = (ulong) arg; if (RIOPreemptiveCmd(p, PortP, MBIC) == RIO_FAIL) - rio_dprint(RIO_DEBUG_TTY, ("TCRIOMBIC command failed\n")); + rio_dprintk (RIO_DEBUG_TTY, "TCRIOMBIC command failed\n"); } PortP->State |= RIO_BUSY; rio_spin_unlock_irqrestore(&PortP->portSem, flags); return 0; case TCRIOXPON: /* set Xprint ON string */ - rio_dprint(RIO_DEBUG_TTY, ("TCRIOXPON\n")); + rio_dprintk (RIO_DEBUG_TTY, "TCRIOXPON\n"); if ( copyin((int)arg, (caddr_t)PortP->Xprint.XpOn, MAX_XP_CTRL_LEN)==COPYFAIL ) { - rio_dprint(RIO_DEBUG_TTY, ("Copyin failed\n")); + rio_dprintk (RIO_DEBUG_TTY, "Copyin failed\n"); PortP->Xprint.XpOn[0] = '\0'; rio_spin_unlock_irqrestore(&PortP->portSem, flags); pseterr(EFAULT); @@ -989,10 +1013,10 @@ register caddr_t arg; return 0; case TCRIOXPOFF: /* set Xprint OFF string */ - rio_dprint(RIO_DEBUG_TTY, ("TCRIOXPOFF\n")); + rio_dprintk (RIO_DEBUG_TTY, "TCRIOXPOFF\n"); if ( copyin( (int)arg, (caddr_t)PortP->Xprint.XpOff, MAX_XP_CTRL_LEN)==COPYFAIL ) { - rio_dprint(RIO_DEBUG_TTY, ("Copyin failed\n")); + rio_dprintk (RIO_DEBUG_TTY, "Copyin failed\n"); PortP->Xprint.XpOff[0] = '\0'; rio_spin_unlock_irqrestore(&PortP->portSem, flags); pseterr(EFAULT); @@ -1004,10 +1028,10 @@ register caddr_t arg; return 0; case TCRIOXPCPS: /* set Xprint CPS string */ - rio_dprint(RIO_DEBUG_TTY, ("TCRIOXPCPS\n")); + rio_dprintk (RIO_DEBUG_TTY, "TCRIOXPCPS\n"); if ( (uint)arg > p->RIOConf.MaxXpCps || (uint)arg < p->RIOConf.MinXpCps ) { - rio_dprint(RIO_DEBUG_TTY, ("%d CPS out of range\n",arg)); + rio_dprintk (RIO_DEBUG_TTY, "%d CPS out of range\n",arg); rio_spin_unlock_irqrestore(&PortP->portSem, flags); pseterr(EINVAL); return 0; @@ -1017,7 +1041,7 @@ register caddr_t arg; return 0; case TCRIOXPRINT: - rio_dprint(RIO_DEBUG_TTY, ("TCRIOXPRINT\n")); + rio_dprintk (RIO_DEBUG_TTY, "TCRIOXPRINT\n"); if ( copyout((caddr_t)&PortP->Xprint, (int)arg, sizeof(struct Xprint))==COPYFAIL ) { rio_spin_unlock_irqrestore(&PortP->portSem, flags); @@ -1027,25 +1051,25 @@ register caddr_t arg; return 0; case TCRIOIXANYON: - rio_dprint(RIO_DEBUG_TTY, ("TCRIOIXANYON\n")); + rio_dprintk (RIO_DEBUG_TTY, "TCRIOIXANYON\n"); PortP->Config |= RIO_IXANY; rio_spin_unlock_irqrestore(&PortP->portSem, flags); return 0; case TCRIOIXANYOFF: - rio_dprint(RIO_DEBUG_TTY, ("TCRIOIXANYOFF\n")); + rio_dprintk (RIO_DEBUG_TTY, "TCRIOIXANYOFF\n"); PortP->Config &= ~RIO_IXANY; rio_spin_unlock_irqrestore(&PortP->portSem, flags); return 0; case TCRIOIXONON: - rio_dprint(RIO_DEBUG_TTY, ("TCRIOIXONON\n")); + rio_dprintk (RIO_DEBUG_TTY, "TCRIOIXONON\n"); PortP->Config |= RIO_IXON; rio_spin_unlock_irqrestore(&PortP->portSem, flags); return 0; case TCRIOIXONOFF: - rio_dprint(RIO_DEBUG_TTY, ("TCRIOIXONOFF\n")); + rio_dprintk (RIO_DEBUG_TTY, "TCRIOIXONOFF\n"); PortP->Config &= ~RIO_IXON; rio_spin_unlock_irqrestore(&PortP->portSem, flags); return 0; @@ -1055,28 +1079,28 @@ register caddr_t arg; ** Added support for CTS and RTS flow control ioctls : */ case TCRIOCTSFLOWEN: - rio_dprint(RIO_DEBUG_TTY, ("TCRIOCTSFLOWEN\n")); + rio_dprintk (RIO_DEBUG_TTY, "TCRIOCTSFLOWEN\n"); PortP->Config |= RIO_CTSFLOW; rio_spin_unlock_irqrestore(&PortP->portSem, flags); RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); return 0; case TCRIOCTSFLOWDIS: - rio_dprint(RIO_DEBUG_TTY, ("TCRIOCTSFLOWDIS\n")); + rio_dprintk (RIO_DEBUG_TTY, "TCRIOCTSFLOWDIS\n"); PortP->Config &= ~RIO_CTSFLOW; rio_spin_unlock_irqrestore(&PortP->portSem, flags); RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); return 0; case TCRIORTSFLOWEN: - rio_dprint(RIO_DEBUG_TTY, ("TCRIORTSFLOWEN\n")); + rio_dprintk (RIO_DEBUG_TTY, "TCRIORTSFLOWEN\n"); PortP->Config |= RIO_RTSFLOW; rio_spin_unlock_irqrestore(&PortP->portSem, flags); RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); return 0; case TCRIORTSFLOWDIS: - rio_dprint(RIO_DEBUG_TTY, ("TCRIORTSFLOWDIS\n")); + rio_dprintk (RIO_DEBUG_TTY, "TCRIORTSFLOWDIS\n"); PortP->Config &= ~RIO_RTSFLOW; rio_spin_unlock_irqrestore(&PortP->portSem, flags); RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); @@ -1100,13 +1124,13 @@ register caddr_t arg; case TCSETAW: case TCSETAF: ioctl_processed++; - rio_dprint(RIO_DEBUG_TTY, ("NON POSIX ioctl\n")); + rio_dprintk (RIO_DEBUG_TTY, "NON POSIX ioctl\n"); ttyseth_pv(PortP, tp, (struct termios *)arg, 0); break; case TCSETAP: /* posix tcsetattr() */ case TCSETAWP: /* posix tcsetattr() */ case TCSETAFP: /* posix tcsetattr() */ - rio_dprint(RIO_DEBUG_TTY, ("NON POSIX SYSV ioctl\n")); + rio_dprintk (RIO_DEBUG_TTY, "NON POSIX SYSV ioctl\n"); ttyseth_pv(PortP, tp, (struct termios *)arg, 1); ioctl_processed++; break; @@ -1141,7 +1165,7 @@ register caddr_t arg; #endif case TIOCSETD: case TIOCSETN: - rio_dprint(RIO_DEBUG_TTY, ("wait for non-BUSY, semaphore set\n")); + rio_dprintk (RIO_DEBUG_TTY, "wait for non-BUSY, semaphore set\n"); /* ** Wait for drain here, at least as far as the double buffer ** being empty. @@ -1208,8 +1232,8 @@ register caddr_t arg; PortP->CookMode = RIOCookMode(tp); /* Set new cooking mode */ - rio_dprint(RIO_DEBUG_TTY, ("RIOIoctl changed %d newcook %d oldcook %d\n", - changed,PortP->CookMode,oldcook)); + rio_dprintk (RIO_DEBUG_TTY, "RIOIoctl changed %d newcook %d oldcook %d\n", + changed,PortP->CookMode,oldcook); #ifdef MODEM_SUPPORT /* @@ -1232,7 +1256,7 @@ register caddr_t arg; */ if (changed || oldcook != PortP->CookMode || (ioctl_processed)) { rio_spin_unlock_irqrestore(&PortP->portSem, flags); - rio_dprint(RIO_DEBUG_TTY, ("Ioctl changing the PORT settings\n")); + rio_dprintk (RIO_DEBUG_TTY, "Ioctl changing the PORT settings\n"); RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP); rio_spin_lock_irqsave(&PortP->portSem, flags); } diff --git a/drivers/char/scan_keyb.c b/drivers/char/scan_keyb.c index 1936e0b6eeb4..f2435e9ec1fa 100644 --- a/drivers/char/scan_keyb.c +++ b/drivers/char/scan_keyb.c @@ -82,18 +82,21 @@ int register_scan_keyboard(void (*scan)(unsigned char *buffer), { struct scan_keyboard *kbd; - if((kbd=kmalloc(sizeof(struct scan_keyboard), GFP_KERNEL))==NULL) + kbd = kmalloc(sizeof(struct scan_keyboard), GFP_KERNEL); + if (kbd == NULL) goto error_out; kbd->scan=scan; kbd->table=table; kbd->length=length; - kbd->s0=kbd->s1=NULL; - if((kbd->s0=kmalloc(length, GFP_KERNEL))==NULL) - goto error_mem_free; - if((kbd->s1=kmalloc(length, GFP_KERNEL))==NULL) - goto error_mem_free; + kbd->s0 = kmalloc(length, GFP_KERNEL); + if (kbd->s0 == NULL) + goto error_free_kbd; + + kbd->s1 = kmalloc(length, GFP_KERNEL); + if (kbd->s1 == NULL) + goto error_free_s0; kbd->scan(kbd->s0); kbd->scan(kbd->s1); @@ -103,11 +106,10 @@ int register_scan_keyboard(void (*scan)(unsigned char *buffer), return 0; - error_mem_free: - if(kbd->s0) - kfree(kbd->s0); - if(kbd->s1) - kfree(kbd->s1); + error_free_s0: + kfree(kbd->s0); + + error_free_kbd: kfree(kbd); error_out: diff --git a/drivers/char/sx.c b/drivers/char/sx.c index 82e3cae1ec4d..e6336fc03e71 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c @@ -1518,9 +1518,14 @@ static int sx_open (struct tty_struct * tty, struct file * filp) exit minicom. I expect an "oops". -- REW */ static void sx_hungup (void *ptr) { + /* struct sx_port *port = ptr; + */ func_enter (); + /* Don't force the SX card to close. mgetty doesn't like it !!!!!! -- pvdl */ + /* For some reson we added this code. Don't know why anymore ;-( -- pvdl */ + /* sx_setsignals (port, 0, 0); sx_reconfigure_port(port); sx_send_command (port, HS_CLOSE, 0, 0); @@ -1532,7 +1537,7 @@ static void sx_hungup (void *ptr) } else sx_dprintk (SX_DEBUG_CLOSE, "sent the force_close command.\n"); } - + */ MOD_DEC_USE_COUNT; func_exit (); } @@ -2368,7 +2373,7 @@ static int sx_init_portstructs (int nboards, int nports) return 0; } - +#ifdef MODULE static void sx_release_drivers(void) { func_enter(); @@ -2376,6 +2381,7 @@ static void sx_release_drivers(void) tty_unregister_driver(&sx_callout_driver); func_exit(); } +#endif #ifdef TWO_ZERO #define PDEV unsigned char pci_bus, unsigned pci_fun diff --git a/drivers/isdn/avmb1/capifs.c b/drivers/isdn/avmb1/capifs.c index ec4f9c559073..cbbaca19def2 100644 --- a/drivers/isdn/avmb1/capifs.c +++ b/drivers/isdn/avmb1/capifs.c @@ -130,12 +130,12 @@ static int capifs_root_readdir(struct file *filp, void *dirent, filldir_t filldi switch(nr) { case 0: - if (filldir(dirent, ".", 1, nr, inode->i_ino) < 0) + if (filldir(dirent, ".", 1, nr, inode->i_ino, DT_DIR) < 0) return 0; filp->f_pos = ++nr; /* fall through */ case 1: - if (filldir(dirent, "..", 2, nr, inode->i_ino) < 0) + if (filldir(dirent, "..", 2, nr, inode->i_ino, DT_DIR) < 0) return 0; filp->f_pos = ++nr; /* fall through */ @@ -147,7 +147,7 @@ static int capifs_root_readdir(struct file *filp, void *dirent, filldir_t filldi char *p = numbuf; if (np->type) *p++ = np->type; sprintf(p, "%u", np->num); - if ( filldir(dirent, numbuf, strlen(numbuf), nr, nr) < 0 ) + if ( filldir(dirent, numbuf, strlen(numbuf), nr, nr, DT_UNKNOWN) < 0 ) return 0; } filp->f_pos = ++nr; diff --git a/drivers/net/3c501.c b/drivers/net/3c501.c index 61b51eeaf70e..ad9178ab9b5d 100644 --- a/drivers/net/3c501.c +++ b/drivers/net/3c501.c @@ -279,6 +279,13 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr) int autoirq = 0; int i; + /* + * Reserve I/O resource for exclusive use by this driver + */ + + if (!request_region(ioaddr, EL1_IO_EXTENT, dev->name)) + return -ENODEV; + /* * Read the station address PROM data from the special port. */ @@ -302,15 +309,10 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr) { mname = "NP943"; } - else - return -ENODEV; - - /* - * Grab the region so we can find the another board if autoIRQ fails. - */ - - if (!request_region(ioaddr, EL1_IO_EXTENT,"3c501")) + else { + release_region(ioaddr, EL1_IO_EXTENT); return -ENODEV; + } /* * We auto-IRQ by shutting off the interrupt line and letting it float @@ -332,6 +334,7 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr) { printk("%s probe at %#x failed to detect IRQ line.\n", mname, ioaddr); + release_region(ioaddr, EL1_IO_EXTENT); return -EAGAIN; } } @@ -360,8 +363,10 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr) */ dev->priv = kmalloc(sizeof(struct net_local), GFP_KERNEL); - if (dev->priv == NULL) + if (dev->priv == NULL) { + release_region(ioaddr, EL1_IO_EXTENT); return -ENOMEM; + } memset(dev->priv, 0, sizeof(struct net_local)); lp=dev->priv; diff --git a/drivers/net/Config.in b/drivers/net/Config.in index 2f9442b22522..41a14d9cd824 100644 --- a/drivers/net/Config.in +++ b/drivers/net/Config.in @@ -143,15 +143,18 @@ if [ "$CONFIG_NET_ETHERNET" = "y" ]; then bool ' Enable Power Management (EXPERIMENTAL)' CONFIG_EEPRO100_PM fi tristate ' Mylex EISA LNE390A/B support (EXPERIMENTAL)' CONFIG_LNE390 - tristate ' Novell/Eagle/Microdyne NE3210 EISA support (EXPERIMENTAL)' CONFIG_NE3210 fi + dep_tristate ' National Semiconductor DP83810 series PCI Ethernet support' CONFIG_NATSEMI $CONFIG_PCI dep_tristate ' PCI NE2000 support' CONFIG_NE2K_PCI $CONFIG_PCI - # tristate ' Sundance Alta support' CONFIG_ALTA + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + tristate ' Novell/Eagle/Microdyne NE3210 EISA support (EXPERIMENTAL)' CONFIG_NE3210 + fi if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then tristate ' RealTek 8129 (not 8019/8029!) support (EXPERIMENTAL)' CONFIG_RTL8129 fi tristate ' RealTek RTL-8139 PCI Fast Ethernet Adapter support' CONFIG_8139TOO tristate ' SiS 900/7016 PCI Fast Ethernet Adapter support' CONFIG_SIS900 + # tristate ' Sundance Alta support' CONFIG_ALTA tristate ' TI ThunderLAN support' CONFIG_TLAN tristate ' VIA Rhine support' CONFIG_VIA_RHINE if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then diff --git a/drivers/net/Makefile b/drivers/net/Makefile index e5ac867a60c4..418be6ea26ff 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -136,7 +136,7 @@ obj-$(CONFIG_SIS900) += sis900.o obj-$(CONFIG_DM9102) += dmfe.o obj-$(CONFIG_YELLOWFIN) += yellowfin.o obj-$(CONFIG_ACENIC) += acenic.o - +obj-$(CONFIG_NATSEMI) += natsemi.o obj-$(CONFIG_STNIC) += stnic.o 8390.o ifeq ($(CONFIG_SK98LIN),y) diff --git a/drivers/net/Space.c b/drivers/net/Space.c index 25257b052c2a..2a7237474d5d 100644 --- a/drivers/net/Space.c +++ b/drivers/net/Space.c @@ -102,11 +102,10 @@ extern int macsonic_probe(struct net_device *dev); extern int mac8390_probe(struct net_device *dev); extern int mac89x0_probe(struct net_device *dev); - /* Gigabit Ethernet adapters */ - extern int yellowfin_probe(struct net_device *dev); +/* Gigabit Ethernet adapters */ +extern int yellowfin_probe(struct net_device *dev); /* Detachable devices ("pocket adaptors") */ -extern int atp_init(struct net_device *); extern int de600_probe(struct net_device *); extern int de620_probe(struct net_device *); @@ -309,9 +308,6 @@ struct devprobe parport_probes[] __initdata = { #endif #ifdef CONFIG_DE620 /* D-Link DE-620 adapter */ {de620_probe, 0}, -#endif -#ifdef CONFIG_ATP /* AT-LAN-TEC (RealTek) pocket adaptor. */ - {atp_init, 0}, #endif {NULL, 0}, }; diff --git a/drivers/net/atp.c b/drivers/net/atp.c index 096dd03c5511..a898fbb02d8f 100644 --- a/drivers/net/atp.c +++ b/drivers/net/atp.c @@ -154,7 +154,7 @@ static void set_multicast_list(struct net_device *dev); (detachable devices only). */ -int __init atp_init(struct net_device *dev) +static int __init atp_init(struct net_device *dev) { int *port, ports[] = {0x378, 0x278, 0x3bc, 0}; int base_addr = dev->base_addr; @@ -336,6 +336,9 @@ static int net_open(struct net_device *dev) return -EAGAIN; } hardware_init(dev); + + MOD_INC_USE_COUNT; + netif_start_queue(dev); return 0; } @@ -702,6 +705,8 @@ static int net_close(struct net_device *dev) /* Leave the hardware in a reset state. */ write_reg_high(ioaddr, CMR1, CMR1h_RESET); + MOD_DEC_USE_COUNT; + return 0; } @@ -735,35 +740,27 @@ static void set_multicast_list(struct net_device *dev) lp->addr_mode = num_addrs ? CMR2h_PROMISC : CMR2h_Normal; write_reg_high(ioaddr, CMR2, lp->addr_mode); } - -/* - * Local variables: - * compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/net/inet -Wall -Wstrict-prototypes -O6 -m486 -c atp.c" - * version-control: t - * kept-new-versions: 5 - * tab-width: 4 - * End: - */ - -#ifdef MODULE -static int io = 0; -static struct net_device atp_dev = { - "", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, atp_init }; - +/* module stuff */ +static int io; +static struct net_device atp_dev = { init: atp_init }; +MODULE_AUTHOR("Donald Becker "); +MODULE_DESCRIPTION("Realtek 8002/8012 Pocket Lan Adapter"); MODULE_PARM(io, "I/O port of the pocket adapter"); -int init_module(void) -{ +static int __init atp_init_module(void) { atp_dev.base_addr = io; + if (register_netdev(&atp_dev) != 0) return -EIO; + return 0; } -void cleanup_module(void) -{ +static void __exit atp_cleanup_module(void) { unregister_netdev(&atp_dev); } -#endif +module_init(atp_init_module); +module_exit(atp_cleanup_module); + diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c index f1723670cbfd..afa7538af189 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c @@ -19,17 +19,30 @@ Information and updates available at http://www.scyld.com/network/epic100.html + + --------------------------------------------------------------------- Linux kernel-specific changes: LK1.1.2 (jgarzik): - * Merge becker version 1.09 + * Merge becker version 1.09 (4/08/2000) LK1.1.3: * Major bugfix to 1.09 driver (Francis Romieu) + + LK1.1.4 (jgarzik): + * Merge becker test version 1.09 (5/29/2000) */ +/* These identify the driver base version and may not be removed. */ +static const char version[] = +"epic100.c:v1.09 5/29/2000 Written by Donald Becker \n"; +static const char version2[] = +" http://www.scyld.com/network/epic100.html\n"; +static const char version3[] = +" (unofficial 2.4.x kernel port, version 1.1.4, August 10, 2000)\n"; + /* The user-configurable values. These may be modified when a driver module is loaded.*/ @@ -44,11 +57,12 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1}; /* Set the copy breakpoint for the copy-only-tiny-frames scheme. Setting to > 1518 effectively disables this feature. */ -static int rx_copybreak = 200; +static int rx_copybreak = 0; /* Operational parameters that are set at compile time. */ -/* Keep the ring sizes a power of two for efficiency. +/* Keep the ring sizes a power of two for operational efficiency. + The compiler will convert '%'<2^N> into a bit mask. Making the Tx ring too large decreases the effectiveness of channel bonding and packet priority. There are no ill effects from too-large receive rings. */ @@ -73,7 +87,12 @@ static int rx_copybreak = 200; #error You must compile this driver with "-O". #endif +#include #include +#if LINUX_VERSION_CODE < 0x20300 && defined(MODVERSIONS) +#include +#endif + #include #include #include @@ -91,15 +110,6 @@ static int rx_copybreak = 200; #include #include -/* These identify the driver base version and may not be removed. */ -static char version[] __devinitdata = -"epic100.c:v1.09+LK1.1.3 6/17/2000 Written by Donald Becker \n"; -static char version2[] __devinitdata = -" http://www.scyld.com/network/epic100.html\n"; - -#define EPIC100_MODULE_NAME "epic100" -#define PFX EPIC100_MODULE_NAME ": " - MODULE_AUTHOR("Donald Becker "); MODULE_DESCRIPTION("SMC 83c170 EPIC series Ethernet driver"); MODULE_PARM(debug, "i"); @@ -133,7 +143,7 @@ IVb. References http://www.smsc.com/main/datasheets/83c171.pdf http://www.smsc.com/main/datasheets/83c175.pdf -http://cesdis.gsfc.nasa.gov/linux/misc/NWay.html +http://scyld.com/expert/NWay.html http://www.national.com/pf/DP/DP83840A.html IVc. Errata @@ -149,10 +159,8 @@ enum pci_id_flags_bits { PCI_ADDR_64BITS=0x100, PCI_NO_ACPI_WAKE=0x200, PCI_NO_MIN_LATENCY=0x400, }; - enum chip_capability_flags { MII_PWRDWN=1, TYPE2_INTR=2, NO_MII=4 }; - #define EPIC_TOTAL_SIZE 0x100 #ifdef USE_IO_OPS #define EPIC_IOTYPE PCI_USES_MASTER|PCI_USES_IO|PCI_ADDR0 @@ -289,6 +297,7 @@ struct epic_private { int tx_threshold; unsigned char mc_filter[8]; signed char phys[4]; /* MII device addresses. */ + u16 advertising; /* NWay media advertisement */ int mii_phy_cnt; unsigned int tx_full:1; /* The Tx queue is full. */ unsigned int full_duplex:1; /* Current duplex setting. */ @@ -332,7 +341,8 @@ static int __devinit epic_init_one (struct pci_dev *pdev, card_idx++; if (!printed_version++) - printk (KERN_INFO "%s" KERN_INFO "%s", version, version2); + printk (KERN_INFO "%s" KERN_INFO "%s" KERN_INFO "%s", + version, version2, version3); if ((pci_resource_len(pdev, 0) < ci->io_size) || (pci_resource_len(pdev, 1) < ci->io_size)) { @@ -357,12 +367,12 @@ static int __devinit epic_init_one (struct pci_dev *pdev, * to them */ if (!request_region (pci_resource_start (pdev, 0), pci_resource_len (pdev, 0), dev->name)) { - printk (KERN_ERR PFX "card %d: I/O region busy\n", card_idx); + printk (KERN_ERR "epic100 %d: I/O region busy\n", card_idx); goto err_out_free_netdev; } if (!request_mem_region (pci_resource_start (pdev, 1), pci_resource_len (pdev, 1), dev->name)) { - printk (KERN_ERR PFX "card %d: I/O region busy\n", card_idx); + printk (KERN_ERR "epic100 %d: I/O region busy\n", card_idx); goto err_out_free_pio; } @@ -372,7 +382,7 @@ static int __devinit epic_init_one (struct pci_dev *pdev, ioaddr = pci_resource_start (pdev, 1); ioaddr = (long) ioremap (ioaddr, pci_resource_len (pdev, 1)); if (!ioaddr) { - printk (KERN_ERR PFX "card %d: ioremap failed\n", card_idx); + printk (KERN_ERR "epic100 %d: ioremap failed\n", card_idx); goto err_out_free_mmio; } #endif @@ -387,7 +397,7 @@ static int __devinit epic_init_one (struct pci_dev *pdev, duplex = full_duplex[card_idx]; } - pdev->driver_data = dev; + pdev->driver_data = dev; dev->base_addr = ioaddr; dev->irq = pdev->irq; @@ -426,25 +436,26 @@ static int __devinit epic_init_one (struct pci_dev *pdev, /* Find the connected MII xcvrs. Doing this in open() would allow detecting external xcvrs later, but - takes too much time. */ + takes much time and no cards have external MII. */ { - int phy, phy_idx; - for (phy = 1, phy_idx = 0; phy < 32 && phy_idx < sizeof(ep->phys); - phy++) { + int phy, phy_idx = 0; + for (phy = 1; phy < 32 && phy_idx < sizeof(ep->phys); phy++) { int mii_status = mdio_read(ioaddr, phy, 1); - if (mii_status != 0xffff && mii_status != 0x0000) { + if (mii_status != 0xffff && mii_status != 0x0000) { ep->phys[phy_idx++] = phy; printk(KERN_INFO "%s: MII transceiver #%d control " - "%4.4x status %4.4x.\n" - KERN_INFO "%s: Autonegotiation advertising %4.4x " - "link partner %4.4x.\n", - dev->name, phy, mdio_read(ioaddr, phy, 0), mii_status, - dev->name, mdio_read(ioaddr, phy, 4), - mdio_read(ioaddr, phy, 5)); + "%4.4x status %4.4x.\n", + dev->name, phy, mdio_read(ioaddr, phy, 0), mii_status); } } ep->mii_phy_cnt = phy_idx; - if (phy_idx == 0 && (ep->chip_flags & NO_MII) == 0) { + if (phy_idx != 0) { + phy = ep->phys[0]; + ep->advertising = mdio_read(ioaddr, phy, 4); + printk( KERN_INFO "%s: Autonegotiation advertising %4.4x link " + "partner %4.4x.\n", + dev->name, ep->advertising, mdio_read(ioaddr, phy, 5)); + } else if ( ! (ep->chip_flags & NO_MII)) { printk(KERN_WARNING "%s: ***WARNING***: No MII transceiver found!\n", dev->name); /* Use the known PHY address of the EPII. */ @@ -668,7 +679,7 @@ static int epic_open(struct net_device *dev) if (debug > 1) printk(KERN_DEBUG "%s: epic_open() ioaddr %lx IRQ %d status %4.4x " "%s-duplex.\n", - dev->name, ioaddr, dev->irq, inl(ioaddr + GENCTL), + dev->name, ioaddr, dev->irq, (int)inl(ioaddr + GENCTL), ep->full_duplex ? "full" : "half"); /* Set the timer to switch to check for link beat and perhaps switch @@ -752,8 +763,8 @@ static void epic_restart(struct net_device *dev) ioaddr + INTMASK); printk(KERN_DEBUG "%s: epic_restart() done, cmd status %4.4x, ctl %4.4x" " interrupt %4.4x.\n", - dev->name, inl(ioaddr + COMMAND), inl(ioaddr + GENCTL), - inl(ioaddr + INTSTAT)); + dev->name, (int)inl(ioaddr + COMMAND), (int)inl(ioaddr + GENCTL), + (int)inl(ioaddr + INTSTAT)); return; } @@ -764,18 +775,19 @@ static void epic_timer(unsigned long data) long ioaddr = dev->base_addr; int next_tick = 60*HZ; int mii_reg5 = ep->mii_phy_cnt ? mdio_read(ioaddr, ep->phys[0], 5) : 0; + int negotiated = mii_reg5 & ep->advertising; + int duplex = (negotiated & 0x0100) || (negotiated & 0x01C0) == 0x0040; if (debug > 3) { printk(KERN_DEBUG "%s: Media monitor tick, Tx status %8.8x.\n", - dev->name, inl(ioaddr + TxSTAT)); + dev->name, (int)inl(ioaddr + TxSTAT)); printk(KERN_DEBUG "%s: Other registers are IntMask %4.4x " "IntStatus %4.4x RxStatus %4.4x.\n", - dev->name, inl(ioaddr + INTMASK), inl(ioaddr + INTSTAT), - inl(ioaddr + RxSTAT)); + dev->name, (int)inl(ioaddr + INTMASK), + (int)inl(ioaddr + INTSTAT), (int)inl(ioaddr + RxSTAT)); } - if (! ep->force_fd && mii_reg5 != 0xffff) { - int duplex = (mii_reg5&0x0100) || (mii_reg5 & 0x01C0) == 0x0040; + if (! ep->force_fd) { if (ep->full_duplex != duplex) { ep->full_duplex = duplex; printk(KERN_INFO "%s: Setting %s-duplex based on MII #%d link" @@ -797,7 +809,7 @@ static void epic_tx_timeout(struct net_device *dev) if (debug > 0) { printk(KERN_WARNING "%s: Transmit timeout using MII device, " "Tx status %4.4x.\n", - dev->name, inw(ioaddr + TxSTAT)); + dev->name, (int)inw(ioaddr + TxSTAT)); if (debug > 1) { printk(KERN_DEBUG "%s: Tx indices: dirty_tx %d, cur_tx %d.\n", dev->name, ep->dirty_tx, ep->cur_tx); @@ -880,11 +892,11 @@ static int epic_start_xmit(struct sk_buff *skb, struct net_device *dev) ep->tx_skbuff[entry] = skb; ep->tx_ring[entry].bufaddr = virt_to_le32desc(skb->data); - if (free_count < TX_RING_SIZE/2) {/* Typical path */ + if (free_count < TX_QUEUE_LEN/2) {/* Typical path */ ctrl_word = cpu_to_le32(0x100000); /* No interrupt */ - } else if (free_count == TX_RING_SIZE/2) { + } else if (free_count == TX_QUEUE_LEN/2) { ctrl_word = cpu_to_le32(0x140000); /* Tx-done intr. */ - } else if (free_count < TX_RING_SIZE - 1) { + } else if (free_count < TX_QUEUE_LEN - 1) { ctrl_word = cpu_to_le32(0x100000); /* No Tx-done intr. */ } else { /* Leave room for an additional entry. */ @@ -910,7 +922,7 @@ static int epic_start_xmit(struct sk_buff *skb, struct net_device *dev) printk(KERN_DEBUG "%s: Queued Tx packet size %d to slot %d, " "flag %2.2x Tx status %8.8x.\n", dev->name, (int)skb->len, entry, ctrl_word, - inl(dev->base_addr + TxSTAT)); + (int)inl(dev->base_addr + TxSTAT)); return 0; } @@ -924,7 +936,8 @@ static void epic_interrupt(int irq, void *dev_instance, struct pt_regs *regs) long ioaddr = dev->base_addr; int status, boguscnt = max_interrupt_work; - spin_lock(&ep->lock); + if (!spin_trylock(&ep->lock)) + return; do { status = inl(ioaddr + INTSTAT); @@ -932,9 +945,9 @@ static void epic_interrupt(int irq, void *dev_instance, struct pt_regs *regs) outl(status & 0x00007fff, ioaddr + INTSTAT); if (debug > 4) - printk(KERN_DEBUG "%s: interrupt interrupt=%#8.8x new " + printk(KERN_DEBUG "%s: Interrupt, status=%#8.8x new " "intstat=%#8.8x.\n", - dev->name, status, inl(ioaddr + INTSTAT)); + dev->name, status, (int)inl(ioaddr + INTSTAT)); if ((status & IntrSummary) == 0) break; @@ -995,7 +1008,7 @@ static void epic_interrupt(int irq, void *dev_instance, struct pt_regs *regs) #endif ep->dirty_tx = dirty_tx; if (ep->tx_full - && cur_tx - dirty_tx < TX_RING_SIZE + 2) { + && cur_tx - dirty_tx < TX_QUEUE_LEN - 4) { /* The ring is no longer full, clear tbusy. */ ep->tx_full = 0; netif_wake_queue(dev); @@ -1044,7 +1057,7 @@ static void epic_interrupt(int irq, void *dev_instance, struct pt_regs *regs) if (debug > 3) printk(KERN_DEBUG "%s: exiting interrupt, intr_status=%#4.4x.\n", - dev->name, inl(ioaddr + INTSTAT)); + dev->name, status); spin_unlock(&ep->lock); } @@ -1144,7 +1157,7 @@ static int epic_close(struct net_device *dev) if (debug > 1) printk(KERN_DEBUG "%s: Shutting down ethercard, status was %2.2x.\n", - dev->name, inl(ioaddr + INTSTAT)); + dev->name, (int)inl(ioaddr + INTSTAT)); del_timer_sync(&ep->timer); epic_pause(dev); @@ -1333,7 +1346,7 @@ static void epic_resume (struct pci_dev *pdev) static struct pci_driver epic_driver = { - name: EPIC100_MODULE_NAME, + name: "epic100", id_table: epic_pci_tbl, probe: epic_init_one, remove: epic_remove_one, @@ -1356,14 +1369,3 @@ static void __exit epic_cleanup (void) module_init(epic_init); module_exit(epic_cleanup); - - -/* - * Local variables: - * compile-command: "gcc -DMODULE -Wall -Wstrict-prototypes -O6 -c epic100.c" - * cardbus-compile-command: "gcc -DCARDBUS -DMODULE -Wall -Wstrict-prototypes -O6 -c epic100.c -o epic_cb.o -I/usr/src/pcmcia/include/" - * c-indent-level: 4 - * c-basic-offset: 4 - * tab-width: 4 - * End: - */ diff --git a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c index 6c5964d83f23..60cef746f634 100644 --- a/drivers/net/ewrk3.c +++ b/drivers/net/ewrk3.c @@ -843,6 +843,7 @@ static int ewrk3_queue_pkt(struct sk_buff *skb, struct net_device *dev) } } + lp->stats.tx_bytes += skb->len; dev->trans_start = jiffies; dev_kfree_skb(skb); } else { /* return unused page to the free memory queue */ @@ -1010,6 +1011,7 @@ static int ewrk3_rx(struct net_device *dev) ** Update stats */ lp->stats.rx_packets++; + lp->stats.rx_bytes += pkt_len; for (i = 1; i < EWRK3_PKT_STAT_SZ - 1; i++) { if (pkt_len < i * EWRK3_PKT_BIN_SZ) { lp->pktStats.bins[i]++; diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c new file mode 100644 index 000000000000..565ddc52bf5f --- /dev/null +++ b/drivers/net/natsemi.c @@ -0,0 +1,1186 @@ +/* natsemi.c: A Linux PCI Ethernet driver for the NatSemi DP83810 series. */ +/* + Written/copyright 1999-2000 by Donald Becker. + + This software may be used and distributed according to the terms of + the GNU General Public License (GPL), incorporated herein by reference. + Drivers based on or derived from this code fall under the GPL and must + retain the authorship, copyright and license notice. This file is not + a complete program and may only be used when the entire operating + system is licensed under the GPL. License for under other terms may be + available. Contact the original author for details. + + The original author may be reached as becker@scyld.com, or at + Scyld Computing Corporation + 410 Severn Ave., Suite 210 + Annapolis MD 21403 + + Support information and updates available at + http://www.scyld.com/network/netsemi.html +*/ + +/* These identify the driver base version and may not be removed. */ +static const char version1[] = +"natsemi.c:v1.05 8/7/2000 Written by Donald Becker \n"; +static const char version2[] = +" http://www.scyld.com/network/natsemi.html\n"; +static const char version3[] = +" (unofficial 2.4.x kernel port, version 1.0.0, August 10, 2000)\n"; +/* Updated to recommendations in pci-skeleton v2.03. */ + +/* Automatically extracted configuration info: +probe-func: natsemi_probe +config-in: tristate 'National Semiconductor DP83810 series PCI Ethernet support' CONFIG_NATSEMI + +c-help-name: National Semiconductor DP83810 series PCI Ethernet support +c-help-symbol: CONFIG_NATSEMI +c-help: This driver is for the National Semiconductor DP83810 series, +c-help: including the 83815 chip. +c-help: More specific information and updates are available from +c-help: http://www.scyld.com/network/natsemi.html +*/ + +/* The user-configurable values. + These may be modified when a driver module is loaded.*/ + +static int debug = 1; /* 1 normal messages, 0 quiet .. 7 verbose. */ +/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ +static int max_interrupt_work = 20; +static int mtu = 0; +/* Maximum number of multicast addresses to filter (vs. rx-all-multicast). + This chip uses a 512 element hash table based on the Ethernet CRC. */ +static int multicast_filter_limit = 100; + +/* Set the copy breakpoint for the copy-only-tiny-frames scheme. + Setting to > 1518 effectively disables this feature. */ +static int rx_copybreak = 0; + +/* Used to pass the media type, etc. + Both 'options[]' and 'full_duplex[]' should exist for driver + interoperability. + The media type is usually passed in 'options[]'. +*/ +#define MAX_UNITS 8 /* More are supported, limit only on options */ +static int options[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1}; +static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1}; + +/* Operational parameters that are set at compile time. */ + +/* Keep the ring sizes a power of two for compile efficiency. + The compiler will convert '%'<2^N> into a bit mask. + Making the Tx ring too large decreases the effectiveness of channel + bonding and packet priority. + There are no ill effects from too-large receive rings. */ +#define TX_RING_SIZE 16 +#define TX_QUEUE_LEN 10 /* Limit ring entries actually used. */ +#define RX_RING_SIZE 32 + +/* Operational parameters that usually are not changed. */ +/* Time in jiffies before concluding the transmitter is hung. */ +#define TX_TIMEOUT (2*HZ) + +#define PKT_BUF_SZ 1536 /* Size of each temporary Rx buffer.*/ + +#if !defined(__OPTIMIZE__) +#warning You must compile this file with the correct options! +#warning See the last lines of the source file. +#error You must compile this driver with "-O". +#endif + +/* Include files, designed to support most kernel versions 2.0.0 and later. */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* Processor type for cache alignment. */ +#include +#include + +/* Condensed operations for readability. */ +#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr)) +#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr)) + +MODULE_AUTHOR("Donald Becker "); +MODULE_DESCRIPTION("National Semiconductor DP83810 series PCI Ethernet driver"); +MODULE_PARM(max_interrupt_work, "i"); +MODULE_PARM(mtu, "i"); +MODULE_PARM(debug, "i"); +MODULE_PARM(rx_copybreak, "i"); +MODULE_PARM(options, "1-" __MODULE_STRING(MAX_UNITS) "i"); +MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i"); + +/* + Theory of Operation + +I. Board Compatibility + +This driver is designed for National Semiconductor DP83815 PCI Ethernet NIC. +It also works with other chips in in the DP83810 series. + +II. Board-specific settings + +This driver requires the PCI interrupt line to be valid. +It honors the EEPROM-set values. + +III. Driver operation + +IIIa. Ring buffers + +This driver uses two statically allocated fixed-size descriptor lists +formed into rings by a branch from the final descriptor to the beginning of +the list. The ring sizes are set at compile time by RX/TX_RING_SIZE. +The NatSemi design uses a 'next descriptor' pointer that the driver forms +into a list. + +IIIb/c. Transmit/Receive Structure + +This driver uses a zero-copy receive and transmit scheme. +The driver allocates full frame size skbuffs for the Rx ring buffers at +open() time and passes the skb->data field to the chip as receive data +buffers. When an incoming frame is less than RX_COPYBREAK bytes long, +a fresh skbuff is allocated and the frame is copied to the new skbuff. +When the incoming frame is larger, the skbuff is passed directly up the +protocol stack. Buffers consumed this way are replaced by newly allocated +skbuffs in a later phase of receives. + +The RX_COPYBREAK value is chosen to trade-off the memory wasted by +using a full-sized skbuff for small frames vs. the copying costs of larger +frames. New boards are typically used in generously configured machines +and the underfilled buffers have negligible impact compared to the benefit of +a single allocation size, so the default value of zero results in never +copying packets. When copying is done, the cost is usually mitigated by using +a combined copy/checksum routine. Copying also preloads the cache, which is +most useful with small frames. + +A subtle aspect of the operation is that unaligned buffers are not permitted +by the hardware. Thus the IP header at offset 14 in an ethernet frame isn't +longword aligned for further processing. On copies frames are put into the +skbuff at an offset of "+2", 16-byte aligning the IP header. + +IIId. Synchronization + +The driver runs as two independent, single-threaded flows of control. One +is the send-packet routine, which enforces single-threaded use by the +dev->tbusy flag. The other thread is the interrupt handler, which is single +threaded by the hardware and interrupt handling software. + +The send packet thread has partial control over the Tx ring and 'dev->tbusy' +flag. It sets the tbusy flag whenever it's queuing a Tx packet. If the next +queue slot is empty, it clears the tbusy flag when finished otherwise it sets +the 'lp->tx_full' flag. + +The interrupt handler has exclusive control over the Rx ring and records stats +from the Tx ring. After reaping the stats, it marks the Tx queue entry as +empty by incrementing the dirty_tx mark. Iff the 'lp->tx_full' flag is set, it +clears both the tx_full and tbusy flags. + +IV. Notes + +NatSemi PCI network controllers are very uncommon. + +IVb. References + +http://www.scyld.com/expert/100mbps.html +http://www.scyld.com/expert/NWay.html +No NatSemi datasheet was publically available at the initial release date. + +IVc. Errata + +None characterised. +*/ + + + +enum pcistuff { + PCI_USES_IO = 0x01, + PCI_USES_MEM = 0x02, + PCI_USES_MASTER = 0x04, + PCI_ADDR0 = 0x08, + PCI_ADDR1 = 0x10, +}; + +/* MMIO operations required */ +#define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_MEM | PCI_ADDR1) + + +/* array of board data directly indexed by pci_tbl[x].driver_data */ +static struct { + const char *name; + unsigned long flags; +} natsemi_pci_info[] __devinitdata = { + { "NatSemi DP83815", PCI_IOTYPE }, +}; + +static struct pci_device_id natsemi_pci_tbl[] __devinitdata = { + { 0x100B, 0x0020, PCI_ANY_ID, PCI_ANY_ID, }, + { 0, }, +}; +MODULE_DEVICE_TABLE(pci, natsemi_pci_tbl); + +/* Offsets to the device registers. + Unlike software-only systems, device drivers interact with complex hardware. + It's not useful to define symbolic names for every register bit in the + device. +*/ +enum register_offsets { + ChipCmd=0x00, ChipConfig=0x04, EECtrl=0x08, PCIBusCfg=0x0C, + IntrStatus=0x10, IntrMask=0x14, IntrEnable=0x18, + TxRingPtr=0x20, TxConfig=0x24, + RxRingPtr=0x30, RxConfig=0x34, + WOLCmd=0x40, PauseCmd=0x44, RxFilterAddr=0x48, RxFilterData=0x4C, + BootRomAddr=0x50, BootRomData=0x54, StatsCtrl=0x5C, StatsData=0x60, + RxPktErrs=0x60, RxMissed=0x68, RxCRCErrs=0x64, +}; + +/* Bit in ChipCmd. */ +enum ChipCmdBits { + ChipReset=0x100, RxReset=0x20, TxReset=0x10, RxOff=0x08, RxOn=0x04, + TxOff=0x02, TxOn=0x01, +}; + +/* Bits in the interrupt status/mask registers. */ +enum intr_status_bits { + IntrRxDone=0x0001, IntrRxIntr=0x0002, IntrRxErr=0x0004, IntrRxEarly=0x0008, + IntrRxIdle=0x0010, IntrRxOverrun=0x0020, + IntrTxDone=0x0040, IntrTxIntr=0x0080, IntrTxErr=0x0100, + IntrTxIdle=0x0200, IntrTxOverrun=0x0400, + StatsMax=0x0800, LinkChange=0x4000, + WOLPkt=0x2000, + RxResetDone=0x1000000, TxResetDone=0x2000000, + IntrPCIErr=0x00f00000, + IntrNormalSummary=0x0251, IntrAbnormalSummary=0xCD20, +}; + +/* Bits in the RxMode register. */ +enum rx_mode_bits { + AcceptErr=0x20, AcceptRunt=0x10, + AcceptBroadcast=0xC0000000, + AcceptMulticast=0x00200000, AcceptAllMulticast=0x20000000, + AcceptAllPhys=0x10000000, AcceptMyPhys=0x08000000, +}; + +/* The Rx and Tx buffer descriptors. */ +/* Note that using only 32 bit fields simplifies conversion to big-endian + architectures. */ +struct netdev_desc { + u32 next_desc; + s32 cmd_status; + u32 addr; + u32 software_use; +}; + +/* Bits in network_desc.status */ +enum desc_status_bits { + DescOwn=0x80000000, DescMore=0x40000000, DescIntr=0x20000000, + DescNoCRC=0x10000000, + DescPktOK=0x08000000, RxTooLong=0x00400000, +}; + +#define PRIV_ALIGN 15 /* Required alignment mask */ +struct netdev_private { + /* Descriptor rings first for alignment. */ + struct netdev_desc rx_ring[RX_RING_SIZE]; + struct netdev_desc tx_ring[TX_RING_SIZE]; + /* The addresses of receive-in-place skbuffs. */ + struct sk_buff* rx_skbuff[RX_RING_SIZE]; + /* The saved address of a sent-in-place packet/buffer, for later free(). */ + struct sk_buff* tx_skbuff[TX_RING_SIZE]; + struct net_device_stats stats; + struct timer_list timer; /* Media monitoring timer. */ + /* Frequently used values: keep some adjacent for cache effect. */ + struct pci_dev *pci_dev; + struct netdev_desc *rx_head_desc; + unsigned int cur_rx, dirty_rx; /* Producer/consumer ring indices */ + unsigned int cur_tx, dirty_tx; + unsigned int rx_buf_sz; /* Based on MTU+slack. */ + unsigned int tx_full:1; /* The Tx queue is full. */ + /* These values are keep track of the transceiver/media in use. */ + unsigned int full_duplex:1; /* Full-duplex operation requested. */ + unsigned int duplex_lock:1; + unsigned int medialock:1; /* Do not sense media. */ + unsigned int default_port:4; /* Last dev->if_port value. */ + /* Rx filter. */ + u32 cur_rx_mode; + u32 rx_filter[16]; + /* FIFO and PCI burst thresholds. */ + int tx_config, rx_config; + /* MII transceiver section. */ + u16 advertising; /* NWay media advertisement */ + + unsigned int iosize; + spinlock_t lock; +}; + +static int eeprom_read(long ioaddr, int location); +static int mdio_read(struct net_device *dev, int phy_id, int location); +static void mdio_write(struct net_device *dev, int phy_id, int location, int value); +static int netdev_open(struct net_device *dev); +static void check_duplex(struct net_device *dev); +static void netdev_timer(unsigned long data); +static void tx_timeout(struct net_device *dev); +static void init_ring(struct net_device *dev); +static int start_tx(struct sk_buff *skb, struct net_device *dev); +static void intr_handler(int irq, void *dev_instance, struct pt_regs *regs); +static void netdev_error(struct net_device *dev, int intr_status); +static int netdev_rx(struct net_device *dev); +static void netdev_error(struct net_device *dev, int intr_status); +static void set_rx_mode(struct net_device *dev); +static struct net_device_stats *get_stats(struct net_device *dev); +static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); +static int netdev_close(struct net_device *dev); + + +static int __devinit natsemi_probe1 (struct pci_dev *pdev, + const struct pci_device_id *ent) +{ + struct net_device *dev; + struct netdev_private *np; + int i, option, irq = pdev->irq, chip_idx = ent->driver_data; + static int find_cnt = -1; + static int printed_version; + unsigned long ioaddr; + const int pcibar = 1; /* PCI base address register */ + + if ((debug <= 1) && !printed_version++) + printk(KERN_INFO "%s" KERN_INFO "%s" KERN_INFO "%s", + version1, version2, version3); + + find_cnt++; + option = find_cnt < MAX_UNITS ? options[find_cnt] : 0; + ioaddr = pci_resource_start(pdev, pcibar); + + if (pci_enable_device(pdev)) + return -EIO; + if (natsemi_pci_info[chip_idx].flags & PCI_USES_MASTER) + pci_set_master(pdev); + + dev = init_etherdev(NULL, sizeof (struct netdev_private)); + if (!dev) + return -ENOMEM; + + { + void *mmio; + if (request_mem_region(ioaddr, pci_resource_len (pdev, pcibar), + dev->name) == NULL) { + unregister_netdev(dev); + kfree(dev); + return -EBUSY; + } + mmio = ioremap (ioaddr, pci_resource_len (pdev, pcibar)); + if (!mmio) { + release_mem_region(ioaddr, pci_resource_len (pdev, pcibar)); + unregister_netdev(dev); + kfree(dev); + return -ENOMEM; + } + ioaddr = (unsigned long) mmio; + } + + printk(KERN_INFO "%s: %s at 0x%lx, ", + dev->name, natsemi_pci_info[chip_idx].name, ioaddr); + + for (i = 0; i < 3; i++) + ((u16 *)dev->dev_addr)[i] = be16_to_cpu(eeprom_read(ioaddr, i + 7)); + for (i = 0; i < 5; i++) + printk("%2.2x:", dev->dev_addr[i]); + printk("%2.2x, IRQ %d.\n", dev->dev_addr[i], irq); + +#if ! defined(final_version) /* Dump the EEPROM contents during development. */ + if (debug > 4) + for (i = 0; i < 64; i++) + printk("%4.4x%s", + eeprom_read(ioaddr, i), i % 16 != 15 ? " " : "\n"); +#endif + + /* Reset the chip to erase previous misconfiguration. */ + writel(ChipReset, ioaddr + ChipCmd); + + dev->base_addr = ioaddr; + dev->irq = irq; + + np = dev->priv; + + np->pci_dev = pdev; + pdev->driver_data = dev; + np->iosize = pci_resource_len(pdev, pcibar); + + if (dev->mem_start) + option = dev->mem_start; + + /* The lower four bits are the media type. */ + if (option > 0) { + if (option & 0x200) + np->full_duplex = 1; + np->default_port = option & 15; + if (np->default_port) + np->medialock = 1; + } + if (find_cnt < MAX_UNITS && full_duplex[find_cnt] > 0) + np->full_duplex = 1; + + if (np->full_duplex) + np->duplex_lock = 1; + + /* The chip-specific entries in the device structure. */ + dev->open = &netdev_open; + dev->hard_start_xmit = &start_tx; + dev->stop = &netdev_close; + dev->get_stats = &get_stats; + dev->set_multicast_list = &set_rx_mode; + dev->do_ioctl = &mii_ioctl; + dev->tx_timeout = &tx_timeout; + dev->watchdog_timeo = TX_TIMEOUT; + + if (mtu) + dev->mtu = mtu; + + np->advertising = readl(ioaddr + 0x90); + printk(KERN_INFO "%s: Transceiver status 0x%4.4x advertising %4.4x.\n", + dev->name, (int)readl(ioaddr + 0x84), np->advertising); + + return 0; +} + + +/* Read the EEPROM and MII Management Data I/O (MDIO) interfaces. + The EEPROM code is for the common 93c06/46 EEPROMs with 6 bit addresses. */ + +/* Delay between EEPROM clock transitions. + No extra delay is needed with 33Mhz PCI, but future 66Mhz access may need + a delay. Note that pre-2.0.34 kernels had a cache-alignment bug that + made udelay() unreliable. + The old method of using an ISA access as a delay, __SLOW_DOWN_IO__, is + depricated. +*/ +#define eeprom_delay(ee_addr) readl(ee_addr) + +enum EEPROM_Ctrl_Bits { + EE_ShiftClk=0x04, EE_DataIn=0x01, EE_ChipSelect=0x08, EE_DataOut=0x02, +}; +#define EE_Write0 (EE_ChipSelect) +#define EE_Write1 (EE_ChipSelect | EE_DataIn) + +/* The EEPROM commands include the alway-set leading bit. */ +enum EEPROM_Cmds { + EE_WriteCmd=(5 << 6), EE_ReadCmd=(6 << 6), EE_EraseCmd=(7 << 6), +}; + +static int eeprom_read(long addr, int location) +{ + int i; + int retval = 0; + int ee_addr = addr + EECtrl; + int read_cmd = location | EE_ReadCmd; + writel(EE_Write0, ee_addr); + + /* Shift the read command bits out. */ + for (i = 10; i >= 0; i--) { + short dataval = (read_cmd & (1 << i)) ? EE_Write1 : EE_Write0; + writel(dataval, ee_addr); + eeprom_delay(ee_addr); + writel(dataval | EE_ShiftClk, ee_addr); + eeprom_delay(ee_addr); + } + writel(EE_ChipSelect, ee_addr); + + for (i = 16; i > 0; i--) { + writel(EE_ChipSelect | EE_ShiftClk, ee_addr); + eeprom_delay(ee_addr); + retval = (retval << 1) | ((readl(ee_addr) & EE_DataOut) ? 1 : 0); + writel(EE_ChipSelect, ee_addr); + eeprom_delay(ee_addr); + } + + /* Terminate the EEPROM access. */ + writel(EE_Write0, ee_addr); + writel(0, ee_addr); + return retval; +} + +/* MII transceiver control section. + The 83815 series has an internal transceiver, and we present the + management registers as if they were MII connected. */ + +static int mdio_read(struct net_device *dev, int phy_id, int location) +{ + if (phy_id == 1 && location < 32) + return readl(dev->base_addr + 0x80 + (location<<2)) & 0xffff; + else + return 0xffff; +} + +static void mdio_write(struct net_device *dev, int phy_id, int location, int value) +{ + if (phy_id == 1 && location < 32) + writew(value, dev->base_addr + 0x80 + (location<<2)); +} + + +static int netdev_open(struct net_device *dev) +{ + struct netdev_private *np = (struct netdev_private *)dev->priv; + long ioaddr = dev->base_addr; + int i; + + /* Do we need to reset the chip??? */ + + MOD_INC_USE_COUNT; + + if (request_irq(dev->irq, &intr_handler, SA_SHIRQ, dev->name, dev)) { + MOD_DEC_USE_COUNT; + return -EAGAIN; + } + + if (debug > 1) + printk(KERN_DEBUG "%s: netdev_open() irq %d.\n", + dev->name, dev->irq); + + init_ring(dev); + + writel(virt_to_bus(np->rx_ring), ioaddr + RxRingPtr); + writel(virt_to_bus(np->tx_ring), ioaddr + TxRingPtr); + + for (i = 0; i < 6; i += 2) { + writel(i, ioaddr + RxFilterAddr); + writew(dev->dev_addr[i] + (dev->dev_addr[i+1] << 8), + ioaddr + RxFilterData); + } + + /* Initialize other registers. */ + /* Configure the PCI bus bursts and FIFO thresholds. */ + /* Configure for standard, in-spec Ethernet. */ + np->tx_config = 0x10800802; + writel(np->tx_config, ioaddr + TxConfig); + np->rx_config = 0x0020; + writel(np->rx_config, ioaddr + RxConfig); + + if (dev->if_port == 0) + dev->if_port = np->default_port; + + netif_start_queue(dev); + + check_duplex(dev); + set_rx_mode(dev); + + /* Enable interrupts by setting the interrupt mask. */ + writel(IntrNormalSummary | IntrAbnormalSummary | 0x1f, ioaddr + IntrMask); + writel(1, ioaddr + IntrEnable); + + writel(RxOn | TxOn, ioaddr + ChipCmd); + writel(4, ioaddr + StatsCtrl); /* Clear Stats */ + + if (debug > 2) + printk(KERN_DEBUG "%s: Done netdev_open(), status: %x.\n", + dev->name, (int)readl(ioaddr + ChipCmd)); + + /* Set the timer to check for link beat. */ + init_timer(&np->timer); + np->timer.expires = jiffies + 3*HZ; + np->timer.data = (unsigned long)dev; + np->timer.function = &netdev_timer; /* timer handler */ + add_timer(&np->timer); + + return 0; +} + +static void check_duplex(struct net_device *dev) +{ + struct netdev_private *np = (struct netdev_private *)dev->priv; + long ioaddr = dev->base_addr; + int duplex; + + if (np->duplex_lock) + return; + duplex = readl(ioaddr + ChipConfig) & 0x20000000 ? 1 : 0; + if (np->full_duplex != duplex) { + np->full_duplex = duplex; + if (debug) + printk(KERN_INFO "%s: Setting %s-duplex based on negotiated link" + " capability.\n", dev->name, + duplex ? "full" : "half"); + if (duplex) { + np->rx_config |= 0x10000000; + np->tx_config |= 0xC0000000; + } else { + np->rx_config &= ~0x10000000; + np->tx_config &= ~0xC0000000; + } + writew(np->tx_config, ioaddr + TxConfig); + writew(np->rx_config, ioaddr + RxConfig); + } +} + +static void netdev_timer(unsigned long data) +{ + struct net_device *dev = (struct net_device *)data; + struct netdev_private *np = (struct netdev_private *)dev->priv; + long ioaddr = dev->base_addr; + int next_tick = 60*HZ; + + if (debug > 3) + printk(KERN_DEBUG "%s: Media selection timer tick, status %8.8x.\n", + dev->name, (int)readl(ioaddr + IntrStatus)); + check_duplex(dev); + np->timer.expires = jiffies + next_tick; + add_timer(&np->timer); +} + +static void tx_timeout(struct net_device *dev) +{ + struct netdev_private *np = (struct netdev_private *)dev->priv; + long ioaddr = dev->base_addr; + + printk(KERN_WARNING "%s: Transmit timed out, status %8.8x," + " resetting...\n", dev->name, (int)readl(ioaddr + TxRingPtr)); + +#ifndef __alpha__ + { + int i; + printk(KERN_DEBUG " Rx ring %8.8x: ", (int)np->rx_ring); + for (i = 0; i < RX_RING_SIZE; i++) + printk(" %8.8x", (unsigned int)np->rx_ring[i].cmd_status); + printk("\n"KERN_DEBUG" Tx ring %8.8x: ", (int)np->tx_ring); + for (i = 0; i < TX_RING_SIZE; i++) + printk(" %4.4x", np->tx_ring[i].cmd_status); + printk("\n"); + } +#endif + + /* Perhaps we should reinitialize the hardware here. */ + dev->if_port = 0; + /* Stop and restart the chip's Tx processes . */ + + /* Trigger an immediate transmit demand. */ + + dev->trans_start = jiffies; + np->stats.tx_errors++; + return; +} + + +/* Initialize the Rx and Tx rings, along with various 'dev' bits. */ +static void init_ring(struct net_device *dev) +{ + struct netdev_private *np = (struct netdev_private *)dev->priv; + int i; + + np->tx_full = 0; + np->cur_rx = np->cur_tx = 0; + np->dirty_rx = np->dirty_tx = 0; + + np->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32); + np->rx_head_desc = &np->rx_ring[0]; + + /* Initialize all Rx descriptors. */ + for (i = 0; i < RX_RING_SIZE; i++) { + np->rx_ring[i].next_desc = virt_to_le32desc(&np->rx_ring[i+1]); + np->rx_ring[i].cmd_status = DescOwn; + np->rx_skbuff[i] = 0; + } + /* Mark the last entry as wrapping the ring. */ + np->rx_ring[i-1].next_desc = virt_to_le32desc(&np->rx_ring[0]); + + /* Fill in the Rx buffers. Handle allocation failure gracefully. */ + for (i = 0; i < RX_RING_SIZE; i++) { + struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz); + np->rx_skbuff[i] = skb; + if (skb == NULL) + break; + skb->dev = dev; /* Mark as being used by this device. */ + np->rx_ring[i].addr = virt_to_le32desc(skb->tail); + np->rx_ring[i].cmd_status = + cpu_to_le32(DescIntr | np->rx_buf_sz); + } + np->dirty_rx = (unsigned int)(i - RX_RING_SIZE); + + for (i = 0; i < TX_RING_SIZE; i++) { + np->tx_skbuff[i] = 0; + np->tx_ring[i].next_desc = virt_to_le32desc(&np->tx_ring[i+1]); + np->tx_ring[i].cmd_status = 0; + } + np->tx_ring[i-1].next_desc = virt_to_le32desc(&np->tx_ring[0]); + return; +} + +static int start_tx(struct sk_buff *skb, struct net_device *dev) +{ + struct netdev_private *np = (struct netdev_private *)dev->priv; + unsigned entry; + + /* Note: Ordering is important here, set the field with the + "ownership" bit last, and only then increment cur_tx. */ + + /* Calculate the next Tx descriptor entry. */ + entry = np->cur_tx % TX_RING_SIZE; + + np->tx_skbuff[entry] = skb; + + np->tx_ring[entry].addr = virt_to_le32desc(skb->data); + np->tx_ring[entry].cmd_status = cpu_to_le32(DescOwn|DescIntr | skb->len); + np->cur_tx++; + + /* StrongARM: Explicitly cache flush np->tx_ring and skb->data,skb->len. */ + + if (np->cur_tx - np->dirty_tx >= TX_QUEUE_LEN - 1) { + np->tx_full = 1; + netif_stop_queue(dev); + } + /* Wake the potentially-idle transmit channel. */ + writel(TxOn, dev->base_addr + ChipCmd); + + dev->trans_start = jiffies; + + if (debug > 4) { + printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n", + dev->name, np->cur_tx, entry); + } + return 0; +} + +/* The interrupt handler does all of the Rx thread work and cleans up + after the Tx thread. */ +static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) +{ + struct net_device *dev = (struct net_device *)dev_instance; + struct netdev_private *np; + long ioaddr; + int boguscnt = max_interrupt_work; + +#ifndef final_version /* Can never occur. */ + if (dev == NULL) { + printk (KERN_ERR "Netdev interrupt handler(): IRQ %d for unknown " + "device.\n", irq); + return; + } +#endif + + ioaddr = dev->base_addr; + np = (struct netdev_private *)dev->priv; + + if (!spin_trylock(&np->lock)) + return; + + do { + u32 intr_status = readl(ioaddr + IntrStatus); + + /* Acknowledge all of the current interrupt sources ASAP. */ + writel(intr_status & 0x000ffff, ioaddr + IntrStatus); + + if (debug > 4) + printk(KERN_DEBUG "%s: Interrupt, status %4.4x.\n", + dev->name, intr_status); + + if (intr_status == 0) + break; + + if (intr_status & (IntrRxDone | IntrRxIntr)) + netdev_rx(dev); + + for (; np->cur_tx - np->dirty_tx > 0; np->dirty_tx++) { + int entry = np->dirty_tx % TX_RING_SIZE; + if (np->tx_ring[entry].cmd_status & cpu_to_le32(DescOwn)) + break; + if (np->tx_ring[entry].cmd_status & cpu_to_le32(0x08000000)) { + np->stats.tx_packets++; +#if LINUX_VERSION_CODE > 0x20127 + np->stats.tx_bytes += np->tx_skbuff[entry]->len; +#endif + } else { /* Various Tx errors */ + int tx_status = le32_to_cpu(np->tx_ring[entry].cmd_status); + if (tx_status & 0x04010000) np->stats.tx_aborted_errors++; + if (tx_status & 0x02000000) np->stats.tx_fifo_errors++; + if (tx_status & 0x01000000) np->stats.tx_carrier_errors++; + if (tx_status & 0x00200000) np->stats.tx_window_errors++; + np->stats.tx_errors++; + } + /* Free the original skb. */ + dev_kfree_skb(np->tx_skbuff[entry]); + np->tx_skbuff[entry] = 0; + } + if (np->tx_full + && np->cur_tx - np->dirty_tx < TX_QUEUE_LEN - 4) { + /* The ring is no longer full, wake queue. */ + np->tx_full = 0; + netif_wake_queue(dev); + } + + /* Abnormal error summary/uncommon events handlers. */ + if (intr_status & IntrAbnormalSummary) + netdev_error(dev, intr_status); + + if (--boguscnt < 0) { + printk(KERN_WARNING "%s: Too much work at interrupt, " + "status=0x%4.4x.\n", + dev->name, intr_status); + break; + } + } while (1); + + if (debug > 3) + printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n", + dev->name, (int)readl(ioaddr + IntrStatus)); + +#ifndef final_version + /* Code that should never be run! Perhaps remove after testing.. */ + { + static int stopit = 10; + if (!netif_running(dev) && --stopit < 0) { + printk(KERN_ERR "%s: Emergency stop, looping startup interrupt.\n", + dev->name); + free_irq(irq, dev); + } + } +#endif + + spin_unlock(&np->lock); +} + +/* This routine is logically part of the interrupt handler, but separated + for clarity and better register allocation. */ +static int netdev_rx(struct net_device *dev) +{ + struct netdev_private *np = (struct netdev_private *)dev->priv; + int entry = np->cur_rx % RX_RING_SIZE; + int boguscnt = np->dirty_rx + RX_RING_SIZE - np->cur_rx; + s32 desc_status = le32_to_cpu(np->rx_head_desc->cmd_status); + + /* If the driver owns the next entry it's a new packet. Send it up. */ + while (desc_status < 0) { /* e.g. & DescOwn */ + if (debug > 4) + printk(KERN_DEBUG " In netdev_rx() entry %d status was %8.8x.\n", + entry, desc_status); + if (--boguscnt < 0) + break; + if ((desc_status & (DescMore|DescPktOK|RxTooLong)) != DescPktOK) { + if (desc_status & DescMore) { + printk(KERN_WARNING "%s: Oversized(?) Ethernet frame spanned " + "multiple buffers, entry %#x status %x.\n", + dev->name, np->cur_rx, desc_status); + np->stats.rx_length_errors++; + } else { + /* There was a error. */ + if (debug > 2) + printk(KERN_DEBUG " netdev_rx() Rx error was %8.8x.\n", + desc_status); + np->stats.rx_errors++; + if (desc_status & 0x06000000) np->stats.rx_over_errors++; + if (desc_status & 0x00600000) np->stats.rx_length_errors++; + if (desc_status & 0x00140000) np->stats.rx_frame_errors++; + if (desc_status & 0x00080000) np->stats.rx_crc_errors++; + } + } else { + struct sk_buff *skb; + int pkt_len = (desc_status & 0x0fff) - 4; /* Omit CRC size. */ + /* Check if the packet is long enough to accept without copying + to a minimally-sized skbuff. */ + if (pkt_len < rx_copybreak + && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { + skb->dev = dev; + skb_reserve(skb, 2); /* 16 byte align the IP header */ +#if HAS_IP_COPYSUM + eth_copy_and_sum(skb, np->rx_skbuff[entry]->tail, pkt_len, 0); + skb_put(skb, pkt_len); +#else + memcpy(skb_put(skb, pkt_len), np->rx_skbuff[entry]->tail, + pkt_len); +#endif + } else { + char *temp = skb_put(skb = np->rx_skbuff[entry], pkt_len); + np->rx_skbuff[entry] = NULL; +#ifndef final_version /* Remove after testing. */ + if (le32desc_to_virt(np->rx_ring[entry].addr) != temp) + printk(KERN_ERR "%s: Internal fault: The skbuff addresses " + "do not match in netdev_rx: %p vs. %p / %p.\n", + dev->name, + le32desc_to_virt(np->rx_ring[entry].addr), + skb->head, temp); +#endif + } +#ifndef final_version /* Remove after testing. */ + /* You will want this info for the initial debug. */ + if (debug > 5) + printk(KERN_DEBUG " Rx data %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:" + "%2.2x %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x %2.2x%2.2x " + "%d.%d.%d.%d.\n", + skb->data[0], skb->data[1], skb->data[2], skb->data[3], + skb->data[4], skb->data[5], skb->data[6], skb->data[7], + skb->data[8], skb->data[9], skb->data[10], + skb->data[11], skb->data[12], skb->data[13], + skb->data[14], skb->data[15], skb->data[16], + skb->data[17]); +#endif + skb->protocol = eth_type_trans(skb, dev); + /* W/ hardware checksum: skb->ip_summed = CHECKSUM_UNNECESSARY; */ + netif_rx(skb); + dev->last_rx = jiffies; + np->stats.rx_packets++; +#if LINUX_VERSION_CODE > 0x20127 + np->stats.rx_bytes += pkt_len; +#endif + } + entry = (++np->cur_rx) % RX_RING_SIZE; + np->rx_head_desc = &np->rx_ring[entry]; + desc_status = le32_to_cpu(np->rx_head_desc->cmd_status); + } + + /* Refill the Rx ring buffers. */ + for (; np->cur_rx - np->dirty_rx > 0; np->dirty_rx++) { + struct sk_buff *skb; + entry = np->dirty_rx % RX_RING_SIZE; + if (np->rx_skbuff[entry] == NULL) { + skb = dev_alloc_skb(np->rx_buf_sz); + np->rx_skbuff[entry] = skb; + if (skb == NULL) + break; /* Better luck next round. */ + skb->dev = dev; /* Mark as being used by this device. */ + np->rx_ring[entry].addr = virt_to_le32desc(skb->tail); + } + np->rx_ring[entry].cmd_status = + cpu_to_le32(DescIntr | np->rx_buf_sz); + } + + /* Restart Rx engine if stopped. */ + writel(RxOn, dev->base_addr + ChipCmd); + return 0; +} + +static void netdev_error(struct net_device *dev, int intr_status) +{ + struct netdev_private *np = (struct netdev_private *)dev->priv; + long ioaddr = dev->base_addr; + + if (intr_status & LinkChange) { + printk(KERN_NOTICE "%s: Link changed: Autonegotiation advertising" + " %4.4x partner %4.4x.\n", dev->name, + (int)readl(ioaddr + 0x90), (int)readl(ioaddr + 0x94)); + check_duplex(dev); + } + if (intr_status & StatsMax) { + get_stats(dev); + } + if ((intr_status & ~(LinkChange|StatsMax|RxResetDone|TxResetDone|0x83ff)) + && debug) + printk(KERN_ERR "%s: Something Wicked happened! %4.4x.\n", + dev->name, intr_status); + /* Hmmmmm, it's not clear how to recover from PCI faults. */ + if (intr_status & IntrPCIErr) { + np->stats.tx_fifo_errors++; + np->stats.rx_fifo_errors++; + } +} + +static struct net_device_stats *get_stats(struct net_device *dev) +{ + long ioaddr = dev->base_addr; + struct netdev_private *np = (struct netdev_private *)dev->priv; + + /* We should lock this segment of code for SMP eventually, although + the vulnerability window is very small and statistics are + non-critical. */ + /* The chip only need report frame silently dropped. */ + np->stats.rx_crc_errors += readl(ioaddr + RxCRCErrs); + np->stats.rx_missed_errors += readl(ioaddr + RxMissed); + + return &np->stats; +} + +/* The little-endian AUTODIN II ethernet CRC calculations. + A big-endian version is also available. + This is slow but compact code. Do not use this routine for bulk data, + use a table-based routine instead. + This is common code and should be moved to net/core/crc.c. + Chips may use the upper or lower CRC bits, and may reverse and/or invert + them. Select the endian-ness that results in minimal calculations. +*/ +static unsigned const ethernet_polynomial_le = 0xedb88320U; +static inline unsigned ether_crc_le(int length, unsigned char *data) +{ + unsigned int crc = 0xffffffff; /* Initial value. */ + while(--length >= 0) { + unsigned char current_octet = *data++; + int bit; + for (bit = 8; --bit >= 0; current_octet >>= 1) { + if ((crc ^ current_octet) & 1) { + crc >>= 1; + crc ^= ethernet_polynomial_le; + } else + crc >>= 1; + } + } + return crc; +} + +static void set_rx_mode(struct net_device *dev) +{ + long ioaddr = dev->base_addr; + struct netdev_private *np = (struct netdev_private *)dev->priv; + u16 mc_filter[32]; /* Multicast hash filter */ + u32 rx_mode; + + if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ + /* Unconditionally log net taps. */ + printk(KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name); + rx_mode = AcceptBroadcast | AcceptAllMulticast | AcceptAllPhys + | AcceptMyPhys; + } else if ((dev->mc_count > multicast_filter_limit) + || (dev->flags & IFF_ALLMULTI)) { + rx_mode = AcceptBroadcast | AcceptAllMulticast | AcceptMyPhys; + } else { + struct dev_mc_list *mclist; + int i; + memset(mc_filter, 0, sizeof(mc_filter)); + for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; + i++, mclist = mclist->next) { + set_bit(ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x1ff, + mc_filter); + } + rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys; + for (i = 0; i < 32; i++) { + writew(0x200 + (i<<1), ioaddr + RxFilterAddr); + writew(cpu_to_be16(mc_filter[i]), ioaddr + RxFilterData); + } + } + writel(rx_mode, ioaddr + RxFilterAddr); + np->cur_rx_mode = rx_mode; +} + +static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) +{ + u16 *data = (u16 *)&rq->ifr_data; + + switch(cmd) { + case SIOCDEVPRIVATE: /* Get the address of the PHY in use. */ + data[0] = 1; + /* Fall Through */ + case SIOCDEVPRIVATE+1: /* Read the specified MII register. */ + data[3] = mdio_read(dev, data[0] & 0x1f, data[1] & 0x1f); + return 0; + case SIOCDEVPRIVATE+2: /* Write the specified MII register */ + if (!capable(CAP_NET_ADMIN)) + return -EPERM; + mdio_write(dev, data[0] & 0x1f, data[1] & 0x1f, data[2]); + return 0; + default: + return -EOPNOTSUPP; + } +} + +static int netdev_close(struct net_device *dev) +{ + long ioaddr = dev->base_addr; + struct netdev_private *np = (struct netdev_private *)dev->priv; + int i; + + netif_stop_queue(dev); + + if (debug > 1) { + printk(KERN_DEBUG "%s: Shutting down ethercard, status was %4.4x " + "Int %2.2x.\n", + dev->name, (int)readl(ioaddr + ChipCmd), + (int)readl(ioaddr + IntrStatus)); + printk(KERN_DEBUG "%s: Queue pointers were Tx %d / %d, Rx %d / %d.\n", + dev->name, np->cur_tx, np->dirty_tx, np->cur_rx, np->dirty_rx); + } + + /* Disable interrupts using the mask. */ + writel(0, ioaddr + IntrMask); + writel(0, ioaddr + IntrEnable); + writel(2, ioaddr + StatsCtrl); /* Freeze Stats */ + + /* Stop the chip's Tx and Rx processes. */ + writel(RxOff | TxOff, ioaddr + ChipCmd); + + del_timer_sync(&np->timer); + +#ifdef __i386__ + if (debug > 2) { + printk("\n"KERN_DEBUG" Tx ring at %8.8x:\n", + (int)virt_to_bus(np->tx_ring)); + for (i = 0; i < TX_RING_SIZE; i++) + printk(" #%d desc. %8.8x %8.8x.\n", + i, np->tx_ring[i].cmd_status, np->tx_ring[i].addr); + printk("\n"KERN_DEBUG " Rx ring %8.8x:\n", + (int)virt_to_bus(np->rx_ring)); + for (i = 0; i < RX_RING_SIZE; i++) { + printk(KERN_DEBUG " #%d desc. %8.8x %8.8x\n", + i, np->rx_ring[i].cmd_status, np->rx_ring[i].addr); + } + } +#endif /* __i386__ debugging only */ + + free_irq(dev->irq, dev); + + /* Free all the skbuffs in the Rx queue. */ + for (i = 0; i < RX_RING_SIZE; i++) { + np->rx_ring[i].cmd_status = 0; + np->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */ + if (np->rx_skbuff[i]) { +#if LINUX_VERSION_CODE < 0x20100 + np->rx_skbuff[i]->free = 1; +#endif + dev_kfree_skb(np->rx_skbuff[i]); + } + np->rx_skbuff[i] = 0; + } + for (i = 0; i < TX_RING_SIZE; i++) { + if (np->tx_skbuff[i]) + dev_kfree_skb(np->tx_skbuff[i]); + np->tx_skbuff[i] = 0; + } + +#if 0 + writel(0x0200, ioaddr + ChipConfig); /* Power down Xcvr. */ +#endif + + MOD_DEC_USE_COUNT; + + return 0; +} + + +static void __devexit natsemi_remove1 (struct pci_dev *pdev) +{ + struct net_device *dev = pdev->driver_data; + struct netdev_private *np = (struct netdev_private *)dev->priv; + + unregister_netdev (dev); + release_mem_region(dev->base_addr, np->iosize); + iounmap ((char *) dev->base_addr); + kfree (dev); +} + +static struct pci_driver natsemi_driver = { + name: "natsemi", + id_table: natsemi_pci_tbl, + probe: natsemi_probe1, + remove: natsemi_remove1, +}; + +static int __init natsemi_init_mod (void) +{ + if (debug > 1) + printk(KERN_INFO "%s" KERN_INFO "%s" KERN_INFO "%s", + version1, version2, version3); + + return pci_module_init (&natsemi_driver); +} + +static void __exit natsemi_exit_mod (void) +{ + pci_unregister_driver (&natsemi_driver); +} + +module_init(natsemi_init_mod); +module_exit(natsemi_exit_mod); + diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c index 85089a8ea343..fd453a2de28c 100644 --- a/drivers/net/starfire.c +++ b/drivers/net/starfire.c @@ -17,6 +17,8 @@ Support and updates available at http://www.scyld.com/network/starfire.html + ----------------------------------------------------------- + Linux kernel-specific changes: LK1.1.1 (jgarzik): @@ -29,8 +31,20 @@ LK1.1.3 (Andrew Morton) - Timer cleanups + + LK1.1.4 (jgarzik): + - Merge Becker version 1.03 */ +/* These identify the driver base version and may not be removed. */ +static const char version1[] = +"starfire.c:v1.03 7/26/2000 Written by Donald Becker \n"; +static const char version2[] = +" Updates and info at http://www.scyld.com/network/starfire.html\n"; + +static const char version3[] = +" (unofficial 2.4.x kernel port, version 1.1.4, August 10, 2000)\n"; + /* The user-configurable values. These may be modified when a driver module is loaded.*/ @@ -74,8 +88,6 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1}; #define PKT_BUF_SZ 1536 /* Size of each temporary Rx buffer.*/ -#define PFX "starfire: " - #if !defined(__OPTIMIZE__) #warning You must compile this file with the correct options! #warning See the last lines of the source file. @@ -85,6 +97,10 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1}; /* Include files, designed to support most kernel versions 2.0.0 and later. */ #include #include +#if LINUX_VERSION_CODE < 0x20300 && defined(MODVERSIONS) +#include +#endif + #include #include #include @@ -101,12 +117,6 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1}; #include #include -/* These identify the driver base version and may not be removed. */ -static char version1[] __devinitdata = -"starfire.c:v0.15+LK1.1.3 6/17/2000 Written by Donald Becker \n"; -static char version2[] __devinitdata = -" Updates and info at http://www.scyld.com/network/starfire.html\n"; - MODULE_AUTHOR("Donald Becker "); MODULE_DESCRIPTION("Adaptec Starfire Ethernet driver"); MODULE_PARM(max_interrupt_work, "i"); @@ -187,18 +197,18 @@ IV. Notes IVb. References -The Adaptec Starfire manuals. -http://cesdis.gsfc.nasa.gov/linux/misc/100mbps.html -http://cesdis.gsfc.nasa.gov/linux/misc/NWay.html - +The Adaptec Starfire manuals, available only from Adaptec. +http://www.scyld.com/expert/100mbps.html +http://www.scyld.com/expert/NWay.html IVc. Errata */ + enum chip_capability_flags {CanHaveMII=1, }; - +#define PCI_IOTYPE (PCI_USES_MASTER | PCI_USES_MEM | PCI_ADDR0) #define MEM_ADDR_SZ 0x80000 /* And maps in 0.5MB(!). */ #if 0 @@ -211,14 +221,12 @@ enum chipset { CH_6915 = 0, }; - static struct pci_device_id starfire_pci_tbl[] __devinitdata = { { 0x9004, 0x6915, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_6915 }, { 0, } }; MODULE_DEVICE_TABLE(pci, starfire_pci_tbl); - /* A chip capabilities table, matching the CH_xxx entries in xxx_pci_tbl[] above. */ static struct chip_info { const char *name; @@ -309,6 +317,7 @@ struct tx_done_report { #endif }; +#define PRIV_ALIGN 15 /* Required alignment mask */ struct ring_info { struct sk_buff *skb; dma_addr_t mapping; @@ -333,7 +342,6 @@ struct netdev_private { dma_addr_t tx_done_q_dma; struct net_device_stats stats; struct timer_list timer; /* Media monitoring timer. */ - int chip_id, drv_flags; struct pci_dev *pci_dev; /* Frequently used values: keep some adjacent for cache effect. */ unsigned int cur_rx, dirty_rx; /* Producer/consumer ring indices */ @@ -341,11 +349,10 @@ struct netdev_private { unsigned int rx_buf_sz; /* Based on MTU+slack. */ unsigned int tx_full:1; /* The Tx queue is full. */ /* These values are keep track of the transceiver/media in use. */ - unsigned int duplex_lock:1; unsigned int full_duplex:1, /* Full-duplex operation requested. */ + medialock:1, /* Xcvr set to fixed speed/duplex. */ rx_flowctrl:1, tx_flowctrl:1; /* Use 802.3x flow control. */ - unsigned int medialock:1; /* Do not sense media. */ unsigned int default_port:4; /* Last dev->if_port value. */ u32 tx_mode; u8 tx_threshold; @@ -383,30 +390,31 @@ static int __devinit starfire_init_one (struct pci_dev *pdev, static int card_idx = -1; static int printed_version = 0; long ioaddr; - int io_size = netdrv_tbl[chip_idx].io_size; + int drv_flags, io_size = netdrv_tbl[chip_idx].io_size; card_idx++; option = card_idx < MAX_UNITS ? options[card_idx] : 0; if (!printed_version++) - printk(KERN_INFO "%s" KERN_INFO "%s", version1, version2); + printk(KERN_INFO "%s" KERN_INFO "%s" KERN_INFO "%s", + version1, version2, version3); ioaddr = pci_resource_start (pdev, 0); if (!ioaddr || ((pci_resource_flags (pdev, 0) & IORESOURCE_MEM) == 0)) { - printk (KERN_ERR PFX "card %d: no PCI MEM resources, aborting\n", card_idx); + printk (KERN_ERR "starfire %d: no PCI MEM resources, aborting\n", card_idx); return -ENODEV; } dev = init_etherdev(NULL, sizeof(*np)); if (!dev) { - printk (KERN_ERR PFX "card %d: cannot alloc etherdev, aborting\n", card_idx); + printk (KERN_ERR "starfire %d: cannot alloc etherdev, aborting\n", card_idx); return -ENOMEM; } irq = pdev->irq; if (request_mem_region (ioaddr, io_size, dev->name) == NULL) { - printk (KERN_ERR PFX "card %d: resource 0x%x @ 0x%lx busy, aborting\n", + printk (KERN_ERR "starfire %d: resource 0x%x @ 0x%lx busy, aborting\n", card_idx, io_size, ioaddr); goto err_out_free_netdev; } @@ -416,7 +424,7 @@ static int __devinit starfire_init_one (struct pci_dev *pdev, ioaddr = (long) ioremap (ioaddr, io_size); if (!ioaddr) { - printk (KERN_ERR PFX "card %d: cannot remap 0x%x @ 0x%lx, aborting\n", + printk (KERN_ERR "starfire %d: cannot remap 0x%x @ 0x%lx, aborting\n", card_idx, io_size, ioaddr); goto err_out_free_res; } @@ -436,7 +444,7 @@ static int __devinit starfire_init_one (struct pci_dev *pdev, #if ! defined(final_version) /* Dump the EEPROM contents during development. */ if (debug > 4) for (i = 0; i < 0x20; i++) - printk("%2.2x%s", readb(ioaddr + EEPROMCtrl + i), + printk("%2.2x%s", (unsigned int)readb(ioaddr + EEPROMCtrl + i), i % 16 != 15 ? " " : "\n"); #endif @@ -446,16 +454,11 @@ static int __devinit starfire_init_one (struct pci_dev *pdev, dev->base_addr = ioaddr; dev->irq = irq; - pdev->driver_data = dev; - - /* private struct aligned and zeroed by init_etherdev */ np = dev->priv; + pdev->driver_data = dev; np->pci_dev = pdev; - np->chip_id = chip_idx; - - /* save useful data, netdrv_tbl is __devinitdata and might be dropped */ - np->drv_flags = netdrv_tbl[chip_idx].drv_flags; + drv_flags = netdrv_tbl[chip_idx].drv_flags; if (dev->mem_start) option = dev->mem_start; @@ -472,7 +475,7 @@ static int __devinit starfire_init_one (struct pci_dev *pdev, np->full_duplex = 1; if (np->full_duplex) - np->duplex_lock = 1; + np->medialock = 1; /* The chip-specific entries in the device structure. */ dev->open = &netdev_open; @@ -487,7 +490,7 @@ static int __devinit starfire_init_one (struct pci_dev *pdev, if (mtu) dev->mtu = mtu; - if (np->drv_flags & CanHaveMII) { + if (drv_flags & CanHaveMII) { int phy, phy_idx = 0; for (phy = 0; phy < 32 && phy_idx < 4; phy++) { int mii_status = mdio_read(dev, phy, 1); @@ -611,17 +614,18 @@ static int netdev_open(struct net_device *dev) /* Fill both the unused Tx SA register and the Rx perfect filter. */ for (i = 0; i < 6; i++) - writeb(dev->dev_addr[i], ioaddr + StationAddr + 6-i); + writeb(dev->dev_addr[i], ioaddr + StationAddr + 5-i); for (i = 0; i < 16; i++) { u16 *eaddrs = (u16 *)dev->dev_addr; long setup_frm = ioaddr + 0x56000 + i*16; - writew(eaddrs[0], setup_frm); setup_frm += 4; - writew(eaddrs[1], setup_frm); setup_frm += 4; - writew(eaddrs[2], setup_frm); setup_frm += 4; + writew(cpu_to_be16(eaddrs[2]), setup_frm); setup_frm += 4; + writew(cpu_to_be16(eaddrs[1]), setup_frm); setup_frm += 4; + writew(cpu_to_be16(eaddrs[0]), setup_frm); setup_frm += 8; } /* Initialize other registers. */ /* Configure the PCI bus bursts and FIFO thresholds. */ + np->tx_mode = 0; /* Initialized when TxMode set. */ np->tx_threshold = 4; writel(np->tx_threshold, ioaddr + TxThreshold); writel(interrupt_mitigation, ioaddr + IntrTimerCtrl); @@ -635,6 +639,7 @@ static int netdev_open(struct net_device *dev) printk(KERN_DEBUG "%s: Setting the Rx and Tx modes.\n", dev->name); set_rx_mode(dev); + np->advertising = mdio_read(dev, np->phys[0], 4); check_duplex(dev, 1); /* Set the interrupt mask and enable PCI interrupts. */ @@ -666,23 +671,26 @@ static void check_duplex(struct net_device *dev, int startup) { struct netdev_private *np = (struct netdev_private *)dev->priv; long ioaddr = dev->base_addr; - int mii_reg5 = mdio_read(dev, np->phys[0], 5); - int negotiated = mii_reg5 & np->advertising; - int duplex, new_tx_mode ; - - new_tx_mode = 0x0C04 | (np->tx_flowctrl ? 0x0800:0) | (np->rx_flowctrl ? 0x0400:0); - if (np->duplex_lock) - duplex = 1; - else - duplex = (negotiated & 0x0100) || (negotiated & 0x01C0) == 0x0040; - if (duplex) - new_tx_mode |= 2; - if (np->full_duplex != duplex) { - np->full_duplex = duplex; - if (debug) - printk(KERN_INFO "%s: Setting %s-duplex based on MII #%d" - " negotiated capability %4.4x.\n", dev->name, - duplex ? "full" : "half", np->phys[0], negotiated); + int new_tx_mode ; + + new_tx_mode = 0x0C04 | (np->tx_flowctrl ? 0x0800:0) + | (np->rx_flowctrl ? 0x0400:0); + if (np->medialock) { + if (np->full_duplex) + new_tx_mode |= 2; + } else { + int mii_reg5 = mdio_read(dev, np->phys[0], 5); + int negotiated = mii_reg5 & np->advertising; + int duplex = (negotiated & 0x0100) || (negotiated & 0x01C0) == 0x0040; + if (duplex) + new_tx_mode |= 2; + if (np->full_duplex != duplex) { + np->full_duplex = duplex; + if (debug > 1) + printk(KERN_INFO "%s: Setting %s-duplex based on MII #%d" + " negotiated capability %4.4x.\n", dev->name, + duplex ? "full" : "half", np->phys[0], negotiated); + } } if (new_tx_mode != np->tx_mode) { np->tx_mode = new_tx_mode; @@ -700,7 +708,7 @@ static void netdev_timer(unsigned long data) if (debug > 3) { printk(KERN_DEBUG "%s: Media selection timer tick, status %8.8x.\n", - dev->name, readl(ioaddr + IntrStatus)); + dev->name, (int)readl(ioaddr + IntrStatus)); } check_duplex(dev, 0); #if ! defined(final_version) @@ -710,7 +718,7 @@ static void netdev_timer(unsigned long data) /* Bogus hardware IRQ: Fake an interrupt handler call. */ if (new_status & 1) { printk(KERN_ERR "%s: Interrupt blocked, status %8.8x/%8.8x.\n", - dev->name, new_status, readl(ioaddr + IntrStatus)); + dev->name, new_status, (int)readl(ioaddr + IntrStatus)); intr_handler(dev->irq, dev, 0); } } @@ -726,7 +734,7 @@ static void tx_timeout(struct net_device *dev) long ioaddr = dev->base_addr; printk(KERN_WARNING "%s: Transmit timed out, status %8.8x," - " resetting...\n", dev->name, readl(ioaddr + IntrStatus)); + " resetting...\n", dev->name, (int)readl(ioaddr + IntrStatus)); #ifndef __alpha__ { @@ -743,15 +751,13 @@ static void tx_timeout(struct net_device *dev) /* Perhaps we should reinitialize the hardware here. */ dev->if_port = 0; - /* Stop and restart the chip's Tx processes . */ - /* XXX todo */ /* Trigger an immediate transmit demand. */ - /* XXX todo */ dev->trans_start = jiffies; np->stats.tx_errors++; + return; } @@ -952,7 +958,7 @@ static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) if (debug > 4) printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n", - dev->name, readl(ioaddr + IntrStatus)); + dev->name, (int)readl(ioaddr + IntrStatus)); #ifndef final_version /* Code that should never be run! Remove after testing.. */ @@ -1104,7 +1110,7 @@ static void netdev_error(struct net_device *dev, int intr_status) struct netdev_private *np = (struct netdev_private *)dev->priv; if (intr_status & LinkChange) { - printk(KERN_ERR "%s: Link changed: Autonegotiation advertising" + printk(KERN_NOTICE "%s: Link changed: Autonegotiation advertising" " %4.4x partner %4.4x.\n", dev->name, mdio_read(dev, np->phys[0], 4), mdio_read(dev, np->phys[0], 5)); @@ -1132,9 +1138,7 @@ static struct net_device_stats *get_stats(struct net_device *dev) long ioaddr = dev->base_addr; struct netdev_private *np = (struct netdev_private *)dev->priv; - /* We should lock this segment of code for SMP eventually, although - the vulnerability window is very small and statistics are - non-critical. */ + /* This adapter architecture needs no SMP locks. */ np->stats.tx_bytes = readl(ioaddr + 0x57010); np->stats.rx_bytes = readl(ioaddr + 0x57044); np->stats.tx_packets = readl(ioaddr + 0x57000); @@ -1201,9 +1205,9 @@ static void set_rx_mode(struct net_device *dev) for (i = 1, mclist = dev->mc_list; mclist && i <= dev->mc_count; i++, mclist = mclist->next) { u16 *eaddrs = (u16 *)mclist->dmi_addr; - writew(*eaddrs++, filter_addr); filter_addr += 4; - writew(*eaddrs++, filter_addr); filter_addr += 4; - writew(*eaddrs++, filter_addr); filter_addr += 8; + writew(cpu_to_be16(eaddrs[2]), filter_addr); filter_addr += 4; + writew(cpu_to_be16(eaddrs[1]), filter_addr); filter_addr += 4; + writew(cpu_to_be16(eaddrs[0]), filter_addr); filter_addr += 8; } while (i++ < 16) { writew(0xffff, filter_addr); filter_addr += 4; @@ -1232,16 +1236,17 @@ static void set_rx_mode(struct net_device *dev) writew(mc_filter[i], filter_addr); rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys; } - writel(rx_mode|AcceptAll, ioaddr + RxFilterMode); + writel(rx_mode, ioaddr + RxFilterMode); } static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { + struct netdev_private *np = (struct netdev_private *)dev->priv; u16 *data = (u16 *)&rq->ifr_data; switch(cmd) { case SIOCDEVPRIVATE: /* Get the address of the PHY in use. */ - data[0] = ((struct netdev_private *)dev->priv)->phys[0] & 0x1f; + data[0] = np->phys[0] & 0x1f; /* Fall Through */ case SIOCDEVPRIVATE+1: /* Read the specified MII register. */ data[3] = mdio_read(dev, data[0] & 0x1f, data[1] & 0x1f); @@ -1249,6 +1254,21 @@ static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) case SIOCDEVPRIVATE+2: /* Write the specified MII register */ if (!capable(CAP_NET_ADMIN)) return -EPERM; + if (data[0] == np->phys[0]) { + u16 value = data[2]; + switch (data[1]) { + case 0: + if (value & 0x9000) /* Autonegotiation. */ + np->medialock = 0; + else { + np->full_duplex = (value & 0x0100) ? 1 : 0; + np->medialock = 1; + } + break; + case 4: np->advertising = value; break; + } + check_duplex(dev, 0); + } mdio_write(dev, data[0] & 0x1f, data[1] & 0x1f, data[2]); return 0; default: @@ -1267,8 +1287,8 @@ static int netdev_close(struct net_device *dev) del_timer_sync(&np->timer); if (debug > 1) { - printk(KERN_DEBUG "%s: Shutting down ethercard, status was Int %4.4x.\n", - dev->name, readl(ioaddr + IntrStatus)); + printk(KERN_DEBUG "%s: Shutting down ethercard, Intr status %4.4x.\n", + dev->name, (int)readl(ioaddr + IntrStatus)); printk(KERN_DEBUG "%s: Queue pointers were Tx %d / %d, Rx %d / %d.\n", dev->name, np->cur_tx, np->dirty_tx, np->cur_rx, np->dirty_rx); } diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index 4f6252383d04..4e2338bb376b 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c @@ -28,7 +28,7 @@ #include static char version[] __devinitdata = - "Linux Tulip driver version 0.9.8 (July 13, 2000)\n"; + "Linux Tulip driver version 0.9.9 (August 11, 2000)\n"; /* A few user-configurable values. */ @@ -165,6 +165,8 @@ static struct pci_device_id tulip_pci_tbl[] __devinitdata = { { 0x1317, 0x0981, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, { 0x1317, 0x0985, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, { 0x1317, 0x1985, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, + { 0x13D1, 0xAB02, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, + { 0x13D1, 0xAB03, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET }, { 0x11F6, 0x9881, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMPEX9881 }, { 0x8086, 0x0039, PCI_ANY_ID, PCI_ANY_ID, 0, 0, I21145 }, { 0x1282, 0x9100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21140 }, diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index 67db42e974e7..9d0947b05875 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c @@ -51,8 +51,13 @@ - Urban Widmark: mdio locking, bounce buffer changes merges from Beckers 1.05 version added netif_running_on/off support + + LK1.1.6: + - Urban Widmark: merges from Beckers 1.08b version (VT6102 + mdio) + set netif_running_on/off on startup, del_timer_sync */ + /* A few user-configurable values. These may be modified when a driver module is loaded. */ @@ -85,7 +90,7 @@ static const int multicast_filter_limit = 32; bonding and packet priority. There are no ill effects from too-large receive rings. */ #define TX_RING_SIZE 16 -#define TX_QUEUE_LEN 10 /* Limit ring entries actually used. */ +#define TX_QUEUE_LEN 10 /* Limit ring entries actually used. */ #define RX_RING_SIZE 16 @@ -122,7 +127,7 @@ static const int multicast_filter_limit = 32; /* These identify the driver base version and may not be removed. */ static char version1[] __devinitdata = -"via-rhine.c:v1.05-LK1.1.5 5/2/2000 Written by Donald Becker\n"; +"via-rhine.c:v1.08b-LK1.1.6 8/9/2000 Written by Donald Becker\n"; static char version2[] __devinitdata = " http://www.scyld.com/network/via-rhine.html\n"; @@ -233,13 +238,13 @@ IV. Notes IVb. References Preliminary VT86C100A manual from http://www.via.com.tw/ -http://cesdis.gsfc.nasa.gov/linux/misc/100mbps.html -http://cesdis.gsfc.nasa.gov/linux/misc/NWay.html +http://www.scyld.com/expert/100mbps.html +http://www.scyld.com/expert/NWay.html IVc. Errata The VT86C100A manual is not reliable information. -The chip does not handle unaligned transmit or receive buffers, resulting +The 3043 chip does not handle unaligned transmit or receive buffers, resulting in significant performance degradation for bounce buffer copies on transmit and unaligned IP headers on receive. The chip does not pad to minimum transmit length. @@ -261,6 +266,7 @@ enum pci_flags_bit { enum via_rhine_chips { VT86C100A = 0, + VT6102, VT3043, }; @@ -272,24 +278,33 @@ struct via_rhine_chip_info { }; -enum chip_capability_flags {CanHaveMII=1, HasESIPhy=2 }; +enum chip_capability_flags { + CanHaveMII=1, HasESIPhy=2, HasDavicomPhy=4, + ReqTxAlign=0x10, HasWOL=0x20, }; #if defined(VIA_USE_MEMORY) #define RHINE_IOTYPE (PCI_USES_MEM | PCI_USES_MASTER | PCI_ADDR1) +#define RHINEII_IOSIZE 4096 #else #define RHINE_IOTYPE (PCI_USES_IO | PCI_USES_MASTER | PCI_ADDR0) +#define RHINEII_IOSIZE 256 #endif /* directly indexed by enum via_rhine_chips, above */ static struct via_rhine_chip_info via_rhine_chip_info[] __devinitdata = { - { "VIA VT86C100A Rhine-II", RHINE_IOTYPE, 128, CanHaveMII }, - { "VIA VT3043 Rhine", RHINE_IOTYPE, 128, CanHaveMII } + { "VIA VT86C100A Rhine", RHINE_IOTYPE, 128, + CanHaveMII | ReqTxAlign }, + { "VIA VT6102 Rhine-II", RHINE_IOTYPE, RHINEII_IOSIZE, + CanHaveMII | HasWOL }, + { "VIA VT3043 Rhine", RHINE_IOTYPE, 128, + CanHaveMII | ReqTxAlign } }; static struct pci_device_id via_rhine_pci_tbl[] __devinitdata = { {0x1106, 0x6100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VT86C100A}, + {0x1106, 0x3065, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VT6102}, {0x1106, 0x3043, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VT3043}, {0,} /* terminate list */ }; @@ -304,7 +319,8 @@ enum register_offsets { RxRingPtr=0x18, TxRingPtr=0x1C, MIIPhyAddr=0x6C, MIIStatus=0x6D, PCIBusConfig=0x6E, MIICmd=0x70, MIIRegAddr=0x71, MIIData=0x72, - Config=0x78, RxMissed=0x7C, RxCRCErrs=0x7E, + Config=0x78, ConfigA=0x7A, RxMissed=0x7C, RxCRCErrs=0x7E, + StickyHW=0x83, WOLcrClr=0xA4, WOLcgClr=0xA7, PwrcsrClr=0xAC, }; /* Bits in the interrupt status/mask registers. */ @@ -585,6 +601,12 @@ static int __devinit via_rhine_init_one (struct pci_dev *pdev, "0x%4.4x advertising %4.4x Link %4.4x.\n", dev->name, phy, mii_status, np->advertising, mdio_read(dev, phy, 5)); + + /* set IFF_RUNNING */ + if (mii_status & MIILink) + netif_carrier_on(dev); + else + netif_carrier_off(dev); } } } @@ -641,8 +663,20 @@ static void mdio_write(struct net_device *dev, int phy_id, int regnum, int value long ioaddr = dev->base_addr; int boguscnt = 1024; - if (phy_id == np->phys[0] && regnum == 4) - np->advertising = value; + if (phy_id == np->phys[0]) { + switch (regnum) { + case 0: /* Is user forcing speed/duplex? */ + if (value & 0x9000) /* Autonegotiation. */ + np->duplex_lock = 0; + else + np->full_duplex = (value & 0x0100) ? 1 : 0; + break; + case 4: + np->advertising = value; + break; + } + } + /* Wait for a previous command to complete. */ while ((readb(ioaddr + MIICmd) & 0x60) && --boguscnt > 0) ; @@ -900,7 +934,8 @@ static int via_rhine_start_tx(struct sk_buff *skb, struct net_device *dev) np->tx_skbuff[entry] = skb; - if ((long)skb->data & 3) { /* Must use alignment buffer. */ + if ((np->drv_flags & ReqTxAlign) && ((long)skb->data & 3)) { + /* Must use alignment buffer. */ memcpy(np->tx_buf[entry], skb->data, skb->len); np->tx_skbuff_dma[entry] = 0; np->tx_ring[entry].addr = cpu_to_le32(np->tx_bufs_dma + @@ -1154,10 +1189,11 @@ static void via_rhine_error(struct net_device *dev, int intr_status) spin_lock (&np->lock); if (intr_status & (IntrMIIChange | IntrLinkChange)) { - if (readb(ioaddr + MIIStatus) & 0x02) + if (readb(ioaddr + MIIStatus) & 0x02) { /* Link failed, restart autonegotiation. */ - mdio_write(dev, np->phys[0], 0, 0x3300); - else + if (np->drv_flags & HasDavicomPhy) + mdio_write(dev, np->phys[0], 0, 0x3300); + } else via_rhine_check_duplex(dev); if (debug) printk(KERN_ERR "%s: MII status changed: Autonegotiation " @@ -1309,6 +1345,8 @@ static int via_rhine_close(struct net_device *dev) int i; unsigned long flags; + del_timer_sync(&np->timer); + spin_lock_irqsave(&np->lock, flags); netif_stop_queue(dev); @@ -1317,14 +1355,15 @@ static int via_rhine_close(struct net_device *dev) printk(KERN_DEBUG "%s: Shutting down ethercard, status was %4.4x.\n", dev->name, readw(ioaddr + ChipCmd)); + /* Switch to loopback mode to avoid hardware races. */ + writeb(np->tx_thresh | 0x01, ioaddr + TxConfig); + /* Disable interrupts by clearing the interrupt mask. */ writew(0x0000, ioaddr + IntrEnable); /* Stop the chip's Tx and Rx processes. */ writew(CmdStop, ioaddr + ChipCmd); - del_timer(&np->timer); - spin_unlock_irqrestore(&np->lock, flags); /* Make sure there is no irq-handler running on a different CPU. */ diff --git a/drivers/net/wan/Config.in b/drivers/net/wan/Config.in index c6066f67f013..4c8517081ae9 100644 --- a/drivers/net/wan/Config.in +++ b/drivers/net/wan/Config.in @@ -7,88 +7,87 @@ comment 'Wan interfaces' bool 'Wan interfaces support' CONFIG_WAN if [ "$CONFIG_WAN" = "y" ]; then +# There is no way to detect a comtrol sv11 - force it modular for now. - # There is no way to detect a comtrol sv11 - force it modular for now. - - dep_tristate 'Comtrol Hostess SV-11 support' CONFIG_HOSTESS_SV11 m - - # The COSA/SRP driver has not been tested as non-modular yet. - - dep_tristate 'COSA/SRP sync serial boards support' CONFIG_COSA m - - # - # COMX drivers - # - - tristate 'MultiGate (COMX) synchronous serial boards support' CONFIG_COMX - - # - # Lan Media's board. Currently 1000, 1200, 5200, 5245 - # - tristate 'LanMedia Corp. SSI/V.35, T1/E1, HSSI, T3 boards' CONFIG_LANMEDIA - - if [ "$CONFIG_COMX" != "n" ]; then - dep_tristate ' Support for COMX/CMX/HiCOMX boards' CONFIG_COMX_HW_COMX $CONFIG_COMX - dep_tristate ' Support for LoCOMX board' CONFIG_COMX_HW_LOCOMX $CONFIG_COMX - dep_tristate ' Support for MixCOM board' CONFIG_COMX_HW_MIXCOM $CONFIG_COMX - dep_tristate ' Support for HDLC and syncPPP protocols on MultiGate boards' CONFIG_COMX_PROTO_PPP $CONFIG_COMX - if [ "$CONFIG_LAPB" = "y" ]; then - dep_tristate ' Support for LAPB protocol on MultiGate boards' CONFIG_COMX_PROTO_LAPB $CONFIG_COMX - fi - if [ "$CONFIG_LAPB" = "m" ]; then - dep_tristate ' Support for LAPB protocol on MultiGate boards' CONFIG_COMX_PROTO_LAPB $CONFIG_LAPB - fi - dep_tristate ' Support for Frame Relay on MultiGate boards' CONFIG_COMX_PROTO_FR $CONFIG_COMX - fi - - # There is no way to detect a Sealevel board. Force it modular - - dep_tristate 'Sealevel Systems 4021 support' CONFIG_SEALEVEL_4021 m - - dep_tristate 'SyncLink HDLC/SYNCPPP support' CONFIG_SYNCLINK_SYNCPPP m - - tristate 'Frame relay DLCI support' CONFIG_DLCI - if [ "$CONFIG_DLCI" != "n" ]; then - int 'Max open DLCI' CONFIG_DLCI_COUNT 24 - int 'Max DLCI per device' CONFIG_DLCI_MAX 8 - dep_tristate ' SDLA (Sangoma S502/S508) support' CONFIG_SDLA $CONFIG_DLCI - fi - - # Wan router core. - - if [ "$CONFIG_WAN_ROUTER" != "n" ]; then - bool 'WAN router drivers' CONFIG_WAN_ROUTER_DRIVERS - if [ "$CONFIG_WAN_ROUTER_DRIVERS" = "y" ]; then - dep_tristate ' Sangoma WANPIPE(tm) multiprotocol cards' CONFIG_VENDOR_SANGOMA $CONFIG_WAN_ROUTER_DRIVERS - if [ "$CONFIG_VENDOR_SANGOMA" != "n" ]; then - int ' Maximum number of cards' CONFIG_WANPIPE_CARDS 1 - bool ' WANPIPE Cisco HDLC support' CONFIG_WANPIPE_CHDLC - if [ "$CONFIG_OBSOLETE" = "y" ]; then - bool ' WANPIPE Frame Relay support' CONFIG_WANPIPE_FR - bool ' WANPIPE X.25 support' CONFIG_WANPIPE_X25 - fi - bool ' WANPIPE PPP support' CONFIG_WANPIPE_PPP - fi - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - dep_tristate ' Cyclom 2X(tm) cards (EXPERIMENTAL)' CONFIG_CYCLADES_SYNC $CONFIG_WAN_ROUTER_DRIVERS - if [ "$CONFIG_CYCLADES_SYNC" != "n" ]; then - bool ' Cyclom 2X X.25 support' CONFIG_CYCLOMX_X25 - fi - fi - fi - fi - - # X.25 network drivers - - if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then - dep_tristate 'LAPB over Ethernet driver' CONFIG_LAPBETHER $CONFIG_LAPB $CONFIG_X25 - dep_tristate 'X.25 async driver' CONFIG_X25_ASY $CONFIG_LAPB $CONFIG_X25 - fi - - if [ "$CONFIG_X86" = "y" ]; then - tristate 'SBNI12-xx support' CONFIG_SBNI - fi + dep_tristate ' Comtrol Hostess SV-11 support' CONFIG_HOSTESS_SV11 m + +# The COSA/SRP driver has not been tested as non-modular yet. + + dep_tristate ' COSA/SRP sync serial boards support' CONFIG_COSA m + +# +# COMX drivers +# + + tristate ' MultiGate (COMX) synchronous serial boards support' CONFIG_COMX + if [ "$CONFIG_COMX" != "n" ]; then + dep_tristate ' Support for COMX/CMX/HiCOMX boards' CONFIG_COMX_HW_COMX $CONFIG_COMX + dep_tristate ' Support for LoCOMX board' CONFIG_COMX_HW_LOCOMX $CONFIG_COMX + dep_tristate ' Support for MixCOM board' CONFIG_COMX_HW_MIXCOM $CONFIG_COMX + dep_tristate ' Support for HDLC and syncPPP protocols on MultiGate boards' CONFIG_COMX_PROTO_PPP $CONFIG_COMX + if [ "$CONFIG_LAPB" = "y" ]; then + dep_tristate ' Support for LAPB protocol on MultiGate boards' CONFIG_COMX_PROTO_LAPB $CONFIG_COMX + fi + if [ "$CONFIG_LAPB" = "m" ]; then + dep_tristate ' Support for LAPB protocol on MultiGate boards' CONFIG_COMX_PROTO_LAPB $CONFIG_LAPB + fi + dep_tristate ' Support for Frame Relay on MultiGate boards' CONFIG_COMX_PROTO_FR $CONFIG_COMX + fi + +# +# Lan Media's board. Currently 1000, 1200, 5200, 5245 +# + + tristate ' LanMedia Corp. SSI/V.35, T1/E1, HSSI, T3 boards' CONFIG_LANMEDIA + +# There is no way to detect a Sealevel board. Force it modular + + dep_tristate ' Sealevel Systems 4021 support' CONFIG_SEALEVEL_4021 m + + dep_tristate ' SyncLink HDLC/SYNCPPP support' CONFIG_SYNCLINK_SYNCPPP m + + tristate ' Frame relay DLCI support' CONFIG_DLCI + if [ "$CONFIG_DLCI" != "n" ]; then + int ' Max open DLCI' CONFIG_DLCI_COUNT 24 + int ' Max DLCI per device' CONFIG_DLCI_MAX 8 + dep_tristate ' SDLA (Sangoma S502/S508) support' CONFIG_SDLA $CONFIG_DLCI + fi + +# Wan router core. + + if [ "$CONFIG_WAN_ROUTER" != "n" ]; then + bool ' WAN router drivers' CONFIG_WAN_ROUTER_DRIVERS + if [ "$CONFIG_WAN_ROUTER_DRIVERS" = "y" ]; then + dep_tristate ' Sangoma WANPIPE(tm) multiprotocol cards' CONFIG_VENDOR_SANGOMA $CONFIG_WAN_ROUTER_DRIVERS + if [ "$CONFIG_VENDOR_SANGOMA" != "n" ]; then + int ' Maximum number of cards' CONFIG_WANPIPE_CARDS 1 + bool ' WANPIPE Cisco HDLC support' CONFIG_WANPIPE_CHDLC + if [ "$CONFIG_OBSOLETE" = "y" ]; then + bool ' WANPIPE Frame Relay support (OBSOLETE)' CONFIG_WANPIPE_FR + bool ' WANPIPE X.25 support (OBSOLETE)' CONFIG_WANPIPE_X25 + fi + bool ' WANPIPE PPP support' CONFIG_WANPIPE_PPP + fi + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + dep_tristate ' Cyclom 2X(tm) cards (EXPERIMENTAL)' CONFIG_CYCLADES_SYNC $CONFIG_WAN_ROUTER_DRIVERS + if [ "$CONFIG_CYCLADES_SYNC" != "n" ]; then + bool ' Cyclom 2X X.25 support' CONFIG_CYCLOMX_X25 + fi + fi + fi + fi + + +# X.25 network drivers + + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + dep_tristate ' LAPB over Ethernet driver (EXPERIMENTAL)' CONFIG_LAPBETHER $CONFIG_LAPB $CONFIG_X25 + dep_tristate ' X.25 async driver (EXPERIMENTAL)' CONFIG_X25_ASY $CONFIG_LAPB $CONFIG_X25 + fi + + if [ "$CONFIG_X86" = "y" ]; then + tristate ' SBNI12-xx support' CONFIG_SBNI + fi fi endmenu - diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c index 096d8164a4d2..8a62cc8edcbf 100644 --- a/drivers/net/wan/syncppp.c +++ b/drivers/net/wan/syncppp.c @@ -866,7 +866,7 @@ EXPORT_SYMBOL(sppp_close); * * Close down any existing synchronous session and commence * from scratch. In the PPP case this means negotiating LCP/IPCP - * and friends, while for Cisco HDLC we simply need to staet sending + * and friends, while for Cisco HDLC we simply need to start sending * keepalives */ diff --git a/drivers/scsi/qlogicfc.c b/drivers/scsi/qlogicfc.c index 05fd57cb0cd8..540fdb01212e 100644 --- a/drivers/scsi/qlogicfc.c +++ b/drivers/scsi/qlogicfc.c @@ -1312,7 +1312,7 @@ int isp2x00_queuecommand(Scsi_Cmnd * Cmnd, void (*done) (Scsi_Cmnd *)) } sg_count -= n; } - } else if (Cmnd->request_bufflen) { + } else if (Cmnd->request_bufflen && Cmnd->sc_data_direction != PCI_DMA_NONE) { dma64_addr_t busaddr = pci64_map_single(hostdata->pci_dev, Cmnd->request_buffer, Cmnd->request_bufflen, scsi_to_pci_dma_dir(Cmnd->sc_data_direction)); @@ -1569,7 +1569,7 @@ void isp2x00_intr_handler(int irq, void *dev_id, struct pt_regs *regs) pci64_unmap_sg(hostdata->pci_dev, (struct scatterlist *)Cmnd->buffer, Cmnd->use_sg, scsi_to_pci_dma_dir(Cmnd->sc_data_direction)); - else if (Cmnd->request_bufflen) + else if (Cmnd->request_bufflen && Cmnd->sc_data_direction != PCI_DMA_NONE) pci64_unmap_single(hostdata->pci_dev, *(dma64_addr_t *)&Cmnd->SCp, Cmnd->request_bufflen, scsi_to_pci_dma_dir(Cmnd->sc_data_direction)); diff --git a/drivers/sound/sb_card.c b/drivers/sound/sb_card.c index bb01bf697251..28b1ac8e40cc 100644 --- a/drivers/sound/sb_card.c +++ b/drivers/sound/sb_card.c @@ -188,7 +188,7 @@ struct pci_dev *sb_dev[SB_CARDS_MAX] = {NULL}, #if defined CONFIG_ISAPNP || defined CONFIG_ISAPNP_MODULE static int isapnp = 1; static int isapnpjump = 0; -static int multiple = 0; +static int multiple = 1; static int reverse = 0; static int uart401 = 0; @@ -197,7 +197,7 @@ static int mpu_activated[SB_CARDS_MAX] = {0}; static int opl_activated[SB_CARDS_MAX] = {0}; #else static int isapnp = 0; -static int multiple = 1; +static int multiple = 0; #endif MODULE_DESCRIPTION("Soundblaster driver"); @@ -276,7 +276,7 @@ static struct { ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), 0,0,0,0, 0,1,1,-1}, - {"Sound Blaster 16", + {"Sound Blaster 16", ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x002a), ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031), 0,0,0,0, @@ -435,7 +435,7 @@ static struct { ISAPNP_VENDOR('@','H','@'), ISAPNP_FUNCTION(0x0001), 0,-1,0,0}, {"ALS100", - ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0001), + ISAPNP_VENDOR('A','L','S'), ISAPNP_DEVICE(0x0001), ISAPNP_VENDOR('@','@','@'), ISAPNP_FUNCTION(0x0001), ISAPNP_VENDOR('@','X','@'), ISAPNP_FUNCTION(0x0001), ISAPNP_VENDOR('@','H','@'), ISAPNP_FUNCTION(0x0001), @@ -467,10 +467,6 @@ static struct { {0} }; -/* That's useful. */ - -#define show_base(devname, resname, resptr) printk(KERN_INFO "sb: %s %s base located at %#lx\n", devname, resname, (resptr)->start) - static struct pci_dev *activate_dev(char *devname, char *resname, struct pci_dev *dev) { int err; @@ -635,7 +631,7 @@ int __init sb_isapnp_probe(struct address_info *hw_config, struct address_info * return 0; } } - i += reverse ? -1 : 1; + i += reverse ? -1 : 1; } return -ENODEV; @@ -678,7 +674,7 @@ static int __init init_sb(void) if(cfg[card].slots[0]==-1) return -ENODEV; - if (!isapnp) + if (!isapnp) cfg_mpu[card].io_base = mpu_io; if (probe_sbmpu(&cfg_mpu[card])) sbmpu[card] = 1; diff --git a/drivers/usb/inode.c b/drivers/usb/inode.c index 50970155b662..b55073398a17 100644 --- a/drivers/usb/inode.c +++ b/drivers/usb/inode.c @@ -290,14 +290,14 @@ static int usbdevfs_root_readdir(struct file *filp, void *dirent, filldir_t fill i = filp->f_pos; switch (i) { case 0: - if (filldir(dirent, ".", 1, i, IROOT) < 0) + if (filldir(dirent, ".", 1, i, IROOT, DT_DIR) < 0) return 0; filp->f_pos++; i++; /* fall through */ case 1: - if (filldir(dirent, "..", 2, i, IROOT) < 0) + if (filldir(dirent, "..", 2, i, IROOT, DT_DIR) < 0) return 0; filp->f_pos++; i++; @@ -307,7 +307,7 @@ static int usbdevfs_root_readdir(struct file *filp, void *dirent, filldir_t fill while (i >= 2 && i < 2+NRSPECIAL) { spec = &special[filp->f_pos-2]; - if (filldir(dirent, spec->name, strlen(spec->name), i, ISPECIAL | (filp->f_pos-2+IROOT)) < 0) + if (filldir(dirent, spec->name, strlen(spec->name), i, ISPECIAL | (filp->f_pos-2+IROOT), DT_UNKNOWN) < 0) return 0; filp->f_pos++; i++; @@ -323,7 +323,7 @@ static int usbdevfs_root_readdir(struct file *filp, void *dirent, filldir_t fill } bus = list_entry(list, struct usb_bus, bus_list); sprintf(numbuf, "%03d", bus->busnum); - if (filldir(dirent, numbuf, 3, filp->f_pos, IBUS | ((bus->busnum & 0xff) << 8)) < 0) + if (filldir(dirent, numbuf, 3, filp->f_pos, IBUS | ((bus->busnum & 0xff) << 8), DT_UNKNOWN) < 0) break; filp->f_pos++; } @@ -343,7 +343,7 @@ static int bus_readdir(struct usb_device *dev, unsigned long ino, int pos, struc if (pos > 0) pos--; else { - if (filldir(dirent, numbuf, 3, filp->f_pos, ino | (dev->devnum & 0xff)) < 0) + if (filldir(dirent, numbuf, 3, filp->f_pos, ino | (dev->devnum & 0xff), DT_UNKNOWN) < 0) return -1; filp->f_pos++; } @@ -368,13 +368,13 @@ static int usbdevfs_bus_readdir(struct file *filp, void *dirent, filldir_t filld return -EINVAL; switch ((unsigned int)filp->f_pos) { case 0: - if (filldir(dirent, ".", 1, filp->f_pos, ino) < 0) + if (filldir(dirent, ".", 1, filp->f_pos, ino, DT_DIR) < 0) return 0; filp->f_pos++; /* fall through */ case 1: - if (filldir(dirent, "..", 2, filp->f_pos, IROOT) < 0) + if (filldir(dirent, "..", 2, filp->f_pos, IROOT, DT_DIR) < 0) return 0; filp->f_pos++; /* fall through */ diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c index 21a27734426b..b650f421fb1e 100644 --- a/fs/adfs/dir.c +++ b/fs/adfs/dir.c @@ -40,12 +40,12 @@ adfs_readdir(struct file *filp, void *dirent, filldir_t filldir) switch ((unsigned long)filp->f_pos) { case 0: - if (filldir(dirent, ".", 1, 0, inode->i_ino) < 0) + if (filldir(dirent, ".", 1, 0, inode->i_ino, DT_DIR) < 0) goto free_out; filp->f_pos += 1; case 1: - if (filldir(dirent, "..", 2, 1, dir.parent_id) < 0) + if (filldir(dirent, "..", 2, 1, dir.parent_id, DT_DIR) < 0) goto free_out; filp->f_pos += 1; @@ -60,7 +60,7 @@ adfs_readdir(struct file *filp, void *dirent, filldir_t filldir) goto unlock_out; while (ops->getnext(&dir, &obj) == 0) { if (filldir(dirent, obj.name, obj.name_len, - filp->f_pos, obj.file_id) < 0) + filp->f_pos, obj.file_id, DT_UNKNOWN) < 0) goto unlock_out; filp->f_pos += 1; } diff --git a/fs/affs/dir.c b/fs/affs/dir.c index aba6b0baabfd..c21e5771dccd 100644 --- a/fs/affs/dir.c +++ b/fs/affs/dir.c @@ -72,14 +72,14 @@ affs_readdir(struct file *filp, void *dirent, filldir_t filldir) if (filp->f_pos == 0) { filp->private_data = (void *)0; - if (filldir(dirent,".",1,filp->f_pos,inode->i_ino) < 0) { + if (filldir(dirent,".",1,filp->f_pos,inode->i_ino,DT_DIR) < 0) { return 0; } ++filp->f_pos; stored++; } if (filp->f_pos == 1) { - if (filldir(dirent,"..",2,filp->f_pos,affs_parent_ino(inode)) < 0) { + if (filldir(dirent,"..",2,filp->f_pos,affs_parent_ino(inode),DT_DIR) < 0) { return stored; } filp->f_pos = 2; @@ -135,7 +135,7 @@ affs_readdir(struct file *filp, void *dirent, filldir_t filldir) pr_debug("AFFS: readdir(): filldir(\"%.*s\",ino=%lu), i=%d\n", namelen,name,ino,i); filp->private_data = (void *)ino; - if (filldir(dirent,name,namelen,filp->f_pos,ino) < 0) + if (filldir(dirent,name,namelen,filp->f_pos,ino,DT_UNKNOWN) < 0) goto readdir_done; filp->private_data = (void *)(unsigned long)i; affs_brelse(fh_bh); diff --git a/fs/autofs/root.c b/fs/autofs/root.c index 4ba5674996e2..0df47764883e 100644 --- a/fs/autofs/root.c +++ b/fs/autofs/root.c @@ -54,19 +54,19 @@ static int autofs_root_readdir(struct file *filp, void *dirent, filldir_t filldi switch(nr) { case 0: - if (filldir(dirent, ".", 1, nr, inode->i_ino) < 0) + if (filldir(dirent, ".", 1, nr, inode->i_ino, DT_DIR) < 0) return 0; filp->f_pos = ++nr; /* fall through */ case 1: - if (filldir(dirent, "..", 2, nr, inode->i_ino) < 0) + if (filldir(dirent, "..", 2, nr, inode->i_ino, DT_DIR) < 0) return 0; filp->f_pos = ++nr; /* fall through */ default: while ( onr = nr, ent = autofs_hash_enum(dirhash,&nr,ent) ) { if ( !ent->dentry || d_mountpoint(ent->dentry) ) { - if (filldir(dirent,ent->name,ent->len,onr,ent->ino) < 0) + if (filldir(dirent,ent->name,ent->len,onr,ent->ino,DT_UNKNOWN) < 0) return 0; filp->f_pos = nr; } diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index aca401b73a17..9d21624bc1be 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c @@ -23,7 +23,9 @@ static int is_tree_busy(struct vfsmount *mnt) int count; spin_lock(&dcache_lock); - count = atomic_read(&mnt->mnt_count); + count = atomic_read(&mnt->mnt_count) - 2; + if (!is_autofs4_dentry(mnt->mnt_mountpoint)) + count--; repeat: next = this_parent->mnt_mounts.next; resume: @@ -33,7 +35,7 @@ resume: mnt_child); next = tmp->next; /* Decrement count for unused children */ - count += atomic_read(&p->mnt_count) - 1; + count += atomic_read(&p->mnt_count) - 2; if (!list_empty(&p->mnt_mounts)) { this_parent = p; goto repeat; diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c index 76e55be5dea2..721739e31a86 100644 --- a/fs/bfs/dir.c +++ b/fs/bfs/dir.c @@ -50,7 +50,7 @@ static int bfs_readdir(struct file * f, void * dirent, filldir_t filldir) de = (struct bfs_dirent *)(bh->b_data + offset); if (de->ino) { int size = strnlen(de->name, BFS_NAMELEN); - if (filldir(dirent, de->name, size, f->f_pos, de->ino) < 0) { + if (filldir(dirent, de->name, size, f->f_pos, de->ino, DT_UNKNOWN) < 0) { brelse(bh); return 0; } diff --git a/fs/block_dev.c b/fs/block_dev.c index 7546705faa11..21bc086e3e56 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -347,7 +348,7 @@ static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) } } -void bdev_init(void) +void __init bdev_init(void) { int i; struct list_head *head = bdev_hashtable; @@ -364,7 +365,7 @@ void bdev_init(void) 0, SLAB_HWCACHE_ALIGN, init_once, NULL); if (!bdev_cachep) - panic("cannot create bdev slab cache"); + panic("Cannot create bdev_cache SLAB cache"); } /* diff --git a/fs/coda/dir.c b/fs/coda/dir.c index e53933710c21..a51bfc647ce9 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c @@ -748,7 +748,7 @@ static int coda_venus_readdir(struct file *filp, void *getdent, char *name = vdirent->d_name; errfill = filldir(getdent, name, namlen, - offs, ino); + offs, ino, DT_UNKNOWN); CDEBUG(D_FILE, "entry %d: ino %ld, namlen %d, reclen %d, type %d, pos %d, string_offs %d, name %*s, offset %d, result: %d, errfill: %d.\n", i,vdirent->d_fileno, vdirent->d_namlen, vdirent->d_reclen, vdirent->d_type, pos, string_offset, vdirent->d_namlen, vdirent->d_name, (u_int) offs, result, errfill); /* errfill means no space for filling in this round */ if ( errfill < 0 ) { diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c index 8b0a9142654e..a0cf6ba97312 100644 --- a/fs/cramfs/inode.c +++ b/fs/cramfs/inode.c @@ -258,7 +258,7 @@ static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir) break; namelen--; } - error = filldir(dirent, name, namelen, offset, CRAMINO(de)); + error = filldir(dirent, name, namelen, offset, CRAMINO(de), de->mode >> 12); if (error) break; diff --git a/fs/dcache.c b/fs/dcache.c index e2bcbe6a3345..0e547009d05c 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1228,9 +1228,6 @@ static void __init dcache_init(unsigned long mempages) /* SLAB cache for __getname() consumers */ kmem_cache_t *names_cachep; -/* SLAB cache for files_struct structures */ -kmem_cache_t *files_cachep; - /* SLAB cache for file structures */ kmem_cache_t *filp_cachep; @@ -1246,7 +1243,7 @@ void __init vfs_caches_init(unsigned long mempages) sizeof(struct buffer_head), 0, SLAB_HWCACHE_ALIGN, NULL, NULL); if(!bh_cachep) - panic("Cannot create buffer head SLAB cache\n"); + panic("Cannot create buffer head SLAB cache"); names_cachep = kmem_cache_create("names_cache", PAGE_SIZE, 0, @@ -1254,12 +1251,6 @@ void __init vfs_caches_init(unsigned long mempages) if (!names_cachep) panic("Cannot create names SLAB cache"); - files_cachep = kmem_cache_create("files_cache", - sizeof(struct files_struct), 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); - if (!files_cachep) - panic("Cannot create files SLAB cache"); - filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0, SLAB_HWCACHE_ALIGN, NULL, NULL); diff --git a/fs/devfs/base.c b/fs/devfs/base.c index ad28db63a1bc..3ffb8275e325 100644 --- a/fs/devfs/base.c +++ b/fs/devfs/base.c @@ -2439,14 +2439,14 @@ static int devfs_readdir (struct file *file, void *dirent, filldir_t filldir) case 0: scan_dir_for_removable (parent); err = (*filldir) (dirent, "..", 2, file->f_pos, - file->f_dentry->d_parent->d_inode->i_ino); + file->f_dentry->d_parent->d_inode->i_ino, DT_DIR); if (err == -EINVAL) break; if (err < 0) return err; file->f_pos++; ++stored; /* Fall through */ case 1: - err = (*filldir) (dirent, ".", 1, file->f_pos, inode->i_ino); + err = (*filldir) (dirent, ".", 1, file->f_pos, inode->i_ino, DT_DIR); if (err == -EINVAL) break; if (err < 0) return err; file->f_pos++; @@ -2463,7 +2463,7 @@ static int devfs_readdir (struct file *file, void *dirent, filldir_t filldir) { if ( IS_HIDDEN (de) ) continue; err = (*filldir) (dirent, de->name, de->namelen, - file->f_pos, de->inode.ino); + file->f_pos, de->inode.ino, de->mode >> 12); if (err == -EINVAL) break; if (err < 0) return err; file->f_pos++; diff --git a/fs/devpts/root.c b/fs/devpts/root.c index 06f6b3baa2ee..dd696709f27d 100644 --- a/fs/devpts/root.c +++ b/fs/devpts/root.c @@ -52,12 +52,12 @@ static int devpts_root_readdir(struct file *filp, void *dirent, filldir_t filldi switch(nr) { case 0: - if (filldir(dirent, ".", 1, nr, inode->i_ino) < 0) + if (filldir(dirent, ".", 1, nr, inode->i_ino, DT_DIR) < 0) return 0; filp->f_pos = ++nr; /* fall through */ case 1: - if (filldir(dirent, "..", 2, nr, inode->i_ino) < 0) + if (filldir(dirent, "..", 2, nr, inode->i_ino, DT_DIR) < 0) return 0; filp->f_pos = ++nr; /* fall through */ @@ -66,7 +66,7 @@ static int devpts_root_readdir(struct file *filp, void *dirent, filldir_t filldi int ptynr = nr - 2; if ( sbi->inodes[ptynr] ) { genptsname(numbuf, ptynr); - if ( filldir(dirent, numbuf, strlen(numbuf), nr, nr) < 0 ) + if ( filldir(dirent, numbuf, strlen(numbuf), nr, nr, DT_CHR) < 0 ) return 0; } filp->f_pos = ++nr; diff --git a/fs/efs/dir.c b/fs/efs/dir.c index 2829a60eb460..ac64b8aeb320 100644 --- a/fs/efs/dir.c +++ b/fs/efs/dir.c @@ -78,7 +78,7 @@ static int efs_readdir(struct file *filp, void *dirent, filldir_t filldir) { filp->f_pos = (block << EFS_DIRBSIZE_BITS) | slot; /* copy filename and data in dirslot */ - filldir(dirent, nameptr, namelen, filp->f_pos, inodenum); + filldir(dirent, nameptr, namelen, filp->f_pos, inodenum, DT_UNKNOWN); /* sanity check */ if (nameptr - (char *) dirblock + namelen > EFS_DIRBSIZE) { diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c index 3a18b375c553..cd49b5da6c1c 100644 --- a/fs/ext2/dir.c +++ b/fs/ext2/dir.c @@ -20,6 +20,10 @@ #include +static unsigned char ext2_filetype_table[] = { + DT_UNKNOWN, DT_REG, DT_DIR, DT_CHR, DT_BLK, DT_FIFO, DT_SOCK, DT_LNK +}; + static int ext2_readdir(struct file *, void *, filldir_t); struct file_operations ext2_dir_operations = { @@ -152,10 +156,15 @@ revalidate: * during the copy operation. */ unsigned long version = filp->f_version; + unsigned char d_type = DT_UNKNOWN; + if (EXT2_HAS_INCOMPAT_FEATURE(sb, EXT2_FEATURE_INCOMPAT_FILETYPE) + && de->file_type < EXT2_FT_MAX) + d_type = ext2_filetype_table[de->file_type]; error = filldir(dirent, de->name, de->name_len, - filp->f_pos, le32_to_cpu(de->inode)); + filp->f_pos, le32_to_cpu(de->inode), + d_type); if (error) break; if (version != filp->f_version) diff --git a/fs/fat/dir.c b/fs/fat/dir.c index bbb895285eae..233a18fb31a0 100644 --- a/fs/fat/dir.c +++ b/fs/fat/dir.c @@ -313,7 +313,7 @@ static int fat_readdirx(struct inode *inode, struct file *filp, void *dirent, /* Fake . and .. for the root directory. */ if (inode->i_ino == MSDOS_ROOT_INO) { while (cpos < 2) { - if (filldir(dirent, "..", cpos+1, cpos, MSDOS_ROOT_INO) < 0) + if (filldir(dirent, "..", cpos+1, cpos, MSDOS_ROOT_INO, DT_DIR) < 0) return 0; cpos++; filp->f_pos++; @@ -466,7 +466,8 @@ ParseLong: if (!long_slots||shortnames) { if (both) bufname[i] = '\0'; - if (filldir(dirent, bufname, i, *furrfu, inum) < 0) + if (filldir(dirent, bufname, i, *furrfu, inum, + (de->attr & ATTR_DIR) ? DT_DIR : DT_REG) < 0) goto FillFailed; } else { char longname[275]; @@ -478,7 +479,8 @@ ParseLong: memcpy(&longname[long_len+1], bufname, i); long_len += i; } - if (filldir(dirent, longname, long_len, *furrfu, inum) < 0) + if (filldir(dirent, longname, long_len, *furrfu, inum, + (de->attr & ATTR_DIR) ? DT_DIR : DT_REG) < 0) goto FillFailed; } diff --git a/fs/fcntl.c b/fs/fcntl.c index 35a5dbc7df9b..1ff077f93b90 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c @@ -129,7 +129,7 @@ out_putf: asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd) { int err = -EBADF; - struct file * file; + struct file * file, *tofree; struct files_struct * files = current->files; write_lock(&files->file_lock); @@ -144,31 +144,40 @@ asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd) get_file(file); /* We are now finished with oldfd */ err = expand_files(files, newfd); - if (err < 0) { - write_unlock(&files->file_lock); - fput(file); - goto out; - } + if (err < 0) + goto out_fput; /* To avoid races with open() and dup(), we will mark the fd as * in-use in the open-file bitmap throughout the entire dup2() * process. This is quite safe: do_close() uses the fd array * entry, not the bitmap, to decide what work needs to be * done. --sct */ + /* Doesn't work. open() might be there first. --AV */ + + /* Yes. It's a race. In user space. Nothing sane to do */ + err = -EBUSY; + tofree = files->fd[newfd]; + if (!tofree && FD_ISSET(newfd, files->open_fds)) + goto out_fput; + + files->fd[newfd] = file; FD_SET(newfd, files->open_fds); + FD_CLR(newfd, files->close_on_exec); write_unlock(&files->file_lock); - - do_close(files, newfd, 0); - write_lock(&files->file_lock); - allocate_fd(files, file, newfd); + if (tofree) + filp_close(tofree, files); err = newfd; - out: return err; out_unlock: write_unlock(&files->file_lock); goto out; + +out_fput: + write_unlock(&files->file_lock); + fput(file); + goto out; } asmlinkage long sys_dup(unsigned int fildes) @@ -209,16 +218,11 @@ static int setfl(int fd, struct file * filp, unsigned long arg) return 0; } -asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg) -{ - struct file * filp; - long err = -EBADF; +static long do_fcntl(unsigned int fd, unsigned int cmd, + unsigned long arg, struct file * filp) +{ + long err = 0; - filp = fget(fd); - if (!filp) - goto out; - err = 0; - lock_kernel(); switch (cmd) { case F_DUPFD: err = -EINVAL; @@ -287,11 +291,60 @@ asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg) err = sock_fcntl (filp, cmd, arg); break; } + + return err; +} + +asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg) +{ + struct file * filp; + long err = -EBADF; + + filp = fget(fd); + if (!filp) + goto out; + + lock_kernel(); + err = do_fcntl(fd, cmd, arg, filp); + unlock_kernel(); + + fput(filp); +out: + return err; +} + +#if BITS_PER_LONG == 32 +asmlinkage long sys_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg) +{ + struct file * filp; + long err; + + err = -EBADF; + filp = fget(fd); + if (!filp) + goto out; + + lock_kernel(); + switch (cmd) { + case F_GETLK64: + err = fcntl_getlk64(fd, (struct flock64 *) arg); + break; + case F_SETLK64: + err = fcntl_setlk64(fd, cmd, (struct flock64 *) arg); + break; + case F_SETLKW64: + err = fcntl_setlk64(fd, cmd, (struct flock64 *) arg); + break; + default: + err = do_fcntl(fd, cmd, arg, filp); + break; + } unlock_kernel(); fput(filp); out: return err; } +#endif /* Table to convert sigio signal codes into poll band bitmaps */ diff --git a/fs/hfs/dir_cap.c b/fs/hfs/dir_cap.c index bca53e0870bb..9dfb4ab82633 100644 --- a/fs/hfs/dir_cap.c +++ b/fs/hfs/dir_cap.c @@ -190,7 +190,7 @@ static int cap_readdir(struct file * filp, if (filp->f_pos == 0) { /* Entry 0 is for "." */ - if (filldir(dirent, DOT->Name, DOT_LEN, 0, dir->i_ino)) { + if (filldir(dirent, DOT->Name, DOT_LEN, 0, dir->i_ino, DT_DIR)) { return 0; } filp->f_pos = 1; @@ -207,7 +207,7 @@ static int cap_readdir(struct file * filp, } if (filldir(dirent, DOT_DOT->Name, - DOT_DOT_LEN, 1, ntohl(cnid))) { + DOT_DOT_LEN, 1, ntohl(cnid), DT_DIR)) { return 0; } filp->f_pos = 2; @@ -234,7 +234,7 @@ static int cap_readdir(struct file * filp, len = hfs_namein(dir, tmp_name, &((struct hfs_cat_key *)brec.key)->CName); if (filldir(dirent, tmp_name, len, - filp->f_pos, ino)) { + filp->f_pos, ino, DT_UNKNOWN)) { hfs_cat_close(entry, &brec); return 0; } @@ -250,7 +250,8 @@ static int cap_readdir(struct file * filp, /* In root dir last-2 entry is for ".rootinfo" */ if (filldir(dirent, DOT_ROOTINFO->Name, DOT_ROOTINFO_LEN, filp->f_pos, - ntohl(entry->cnid) | HFS_CAP_FNDR)) { + ntohl(entry->cnid) | HFS_CAP_FNDR, + DT_UNKNOWN)) { return 0; } } @@ -262,7 +263,8 @@ static int cap_readdir(struct file * filp, /* In normal dirs last-1 entry is for ".finderinfo" */ if (filldir(dirent, DOT_FINDERINFO->Name, DOT_FINDERINFO_LEN, filp->f_pos, - ntohl(entry->cnid) | HFS_CAP_FDIR)) { + ntohl(entry->cnid) | HFS_CAP_FDIR, + DT_UNKNOWN)) { return 0; } } @@ -274,7 +276,8 @@ static int cap_readdir(struct file * filp, /* In normal dirs last entry is for ".resource" */ if (filldir(dirent, DOT_RESOURCE->Name, DOT_RESOURCE_LEN, filp->f_pos, - ntohl(entry->cnid) | HFS_CAP_RDIR)) { + ntohl(entry->cnid) | HFS_CAP_RDIR, + DT_UNKNOWN)) { return 0; } } diff --git a/fs/hfs/dir_dbl.c b/fs/hfs/dir_dbl.c index 3d613a8e37a3..8e39508fac48 100644 --- a/fs/hfs/dir_dbl.c +++ b/fs/hfs/dir_dbl.c @@ -183,7 +183,8 @@ static int dbl_readdir(struct file * filp, if (filp->f_pos == 0) { /* Entry 0 is for "." */ - if (filldir(dirent, DOT->Name, DOT_LEN, 0, dir->i_ino)) { + if (filldir(dirent, DOT->Name, DOT_LEN, 0, dir->i_ino, + DT_DIR)) { return 0; } filp->f_pos = 1; @@ -192,7 +193,7 @@ static int dbl_readdir(struct file * filp, if (filp->f_pos == 1) { /* Entry 1 is for ".." */ if (filldir(dirent, DOT_DOT->Name, DOT_DOT_LEN, 1, - hfs_get_hl(entry->key.ParID))) { + hfs_get_hl(entry->key.ParID), DT_DIR)) { return 0; } filp->f_pos = 2; @@ -229,7 +230,8 @@ static int dbl_readdir(struct file * filp, &((struct hfs_cat_key *)brec.key)->CName); } - if (filldir(dirent, tmp_name, len, filp->f_pos, ino)) { + if (filldir(dirent, tmp_name, len, filp->f_pos, ino, + DT_UNKNOWN)) { hfs_cat_close(entry, &brec); return 0; } @@ -243,7 +245,8 @@ static int dbl_readdir(struct file * filp, /* In root dir last entry is for "%RootInfo" */ if (filldir(dirent, PCNT_ROOTINFO->Name, PCNT_ROOTINFO_LEN, filp->f_pos, - ntohl(entry->cnid) | HFS_DBL_HDR)) { + ntohl(entry->cnid) | HFS_DBL_HDR, + DT_UNKNOWN)) { return 0; } } diff --git a/fs/hfs/dir_nat.c b/fs/hfs/dir_nat.c index 992a94b67dd6..4d050e698261 100644 --- a/fs/hfs/dir_nat.c +++ b/fs/hfs/dir_nat.c @@ -191,7 +191,8 @@ static int nat_readdir(struct file * filp, if (filp->f_pos == 0) { /* Entry 0 is for "." */ - if (filldir(dirent, DOT->Name, DOT_LEN, 0, dir->i_ino)) { + if (filldir(dirent, DOT->Name, DOT_LEN, 0, dir->i_ino, + DT_DIR)) { return 0; } filp->f_pos = 1; @@ -208,7 +209,7 @@ static int nat_readdir(struct file * filp, } if (filldir(dirent, DOT_DOT->Name, - DOT_DOT_LEN, 1, ntohl(cnid))) { + DOT_DOT_LEN, 1, ntohl(cnid), DT_DIR)) { return 0; } filp->f_pos = 2; @@ -235,7 +236,7 @@ static int nat_readdir(struct file * filp, len = hfs_namein(dir, tmp_name, &((struct hfs_cat_key *)brec.key)->CName); if (filldir(dirent, tmp_name, len, - filp->f_pos, ino)) { + filp->f_pos, ino, DT_UNKNOWN)) { hfs_cat_close(entry, &brec); return 0; } @@ -250,14 +251,16 @@ static int nat_readdir(struct file * filp, /* In normal dirs entry 2 is for ".AppleDouble" */ if (filldir(dirent, DOT_APPLEDOUBLE->Name, DOT_APPLEDOUBLE_LEN, filp->f_pos, - ntohl(entry->cnid) | HFS_NAT_HDIR)) { + ntohl(entry->cnid) | HFS_NAT_HDIR, + DT_UNKNOWN)) { return 0; } } else if (type == HFS_NAT_HDIR) { /* In .AppleDouble entry 2 is for ".Parent" */ if (filldir(dirent, DOT_PARENT->Name, DOT_PARENT_LEN, filp->f_pos, - ntohl(entry->cnid) | HFS_NAT_HDR)) { + ntohl(entry->cnid) | HFS_NAT_HDR, + DT_UNKNOWN)) { return 0; } } @@ -270,7 +273,8 @@ static int nat_readdir(struct file * filp, (type == HFS_NAT_HDIR)) { if (filldir(dirent, ROOTINFO->Name, ROOTINFO_LEN, filp->f_pos, - ntohl(entry->cnid) | HFS_NAT_HDR)) { + ntohl(entry->cnid) | HFS_NAT_HDR, + DT_UNKNOWN)) { return 0; } } diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c index 15db6e9364ff..40e432163d0f 100644 --- a/fs/hpfs/dir.c +++ b/fs/hpfs/dir.c @@ -108,14 +108,14 @@ int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir) return 0; } if (filp->f_pos == 0) { - if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino) < 0) { + if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino, DT_DIR) < 0) { hpfs_unlock_inode(inode); return 0; } filp->f_pos = 11; } if (filp->f_pos == 11) { - if (filldir(dirent, "..", 2, filp->f_pos, inode->i_hpfs_parent_dir) < 0) { + if (filldir(dirent, "..", 2, filp->f_pos, inode->i_hpfs_parent_dir, DT_DIR) < 0) { hpfs_unlock_inode(inode); return 0; } @@ -144,7 +144,7 @@ int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir) goto again; } tempname = hpfs_translate_name(inode->i_sb, de->name, de->namelen, lc, de->not_8x3); - if (filldir(dirent, tempname, de->namelen, old_pos, de->fnode) < 0) { + if (filldir(dirent, tempname, de->namelen, old_pos, de->fnode, DT_UNKNOWN) < 0) { filp->f_pos = old_pos; if (tempname != (char *)de->name) kfree(tempname); hpfs_brelse4(&qbh); diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c index 1b99acb1995c..41b201767121 100644 --- a/fs/isofs/dir.c +++ b/fs/isofs/dir.c @@ -202,7 +202,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, /* Handle the case of the '.' directory */ if (de->name_len[0] == 1 && de->name[0] == 0) { - if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino) < 0) + if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino, DT_DIR) < 0) break; filp->f_pos += de_len; continue; @@ -213,7 +213,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, /* Handle the case of the '..' directory */ if (de->name_len[0] == 1 && de->name[0] == 1) { inode_number = filp->f_dentry->d_parent->d_inode->i_ino; - if (filldir(dirent, "..", 2, filp->f_pos, inode_number) < 0) + if (filldir(dirent, "..", 2, filp->f_pos, inode_number, DT_DIR) < 0) break; filp->f_pos += de_len; continue; @@ -258,7 +258,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, } } if (len > 0) { - if (filldir(dirent, p, len, filp->f_pos, inode_number) < 0) + if (filldir(dirent, p, len, filp->f_pos, inode_number, DT_UNKNOWN) < 0) break; } filp->f_pos += de_len; diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c index 6078c869e68e..266e7bf642d3 100644 --- a/fs/jffs/inode-v23.c +++ b/fs/jffs/inode-v23.c @@ -557,7 +557,7 @@ jffs_readdir(struct file *filp, void *dirent, filldir_t filldir) D2(printk("jffs_readdir(): inode: 0x%p, filp: 0x%p\n", inode, filp)); if (filp->f_pos == 0) { D3(printk("jffs_readdir(): \".\" %lu\n", inode->i_ino)); - if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino) < 0) { + if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino, DT_DIR) < 0) { return 0; } filp->f_pos = 1; @@ -571,7 +571,7 @@ jffs_readdir(struct file *filp, void *dirent, filldir_t filldir) inode->u.generic_ip)->pino; } D3(printk("jffs_readdir(): \"..\" %u\n", ddino)); - if (filldir(dirent, "..", 2, filp->f_pos, ddino) < 0) + if (filldir(dirent, "..", 2, filp->f_pos, ddino, DT_DIR) < 0) return 0; filp->f_pos++; } @@ -583,7 +583,7 @@ jffs_readdir(struct file *filp, void *dirent, filldir_t filldir) D3(printk("jffs_readdir(): \"%s\" ino: %u\n", (f->name ? f->name : ""), f->ino)); if (filldir(dirent, f->name, f->nsize, - filp->f_pos , f->ino) < 0) + filp->f_pos , f->ino, DT_UNKNOWN) < 0) return 0; filp->f_pos++; } diff --git a/fs/locks.c b/fs/locks.c index c1054c341435..1b8efdcd325d 100644 --- a/fs/locks.c +++ b/fs/locks.c @@ -205,8 +205,8 @@ static struct file_lock *flock_make_lock(struct file *filp, unsigned int type) /* Verify a "struct flock" and copy it to a "struct file_lock" as a POSIX * style lock. */ -static int posix_make_lock(struct file *filp, struct file_lock *fl, - struct flock *l) +static int flock_to_posix_lock(struct file *filp, struct file_lock *fl, + struct flock *l) { loff_t start; @@ -254,6 +254,57 @@ static int posix_make_lock(struct file *filp, struct file_lock *fl, return (1); } +#if BITS_PER_LONG == 32 +static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl, + struct flock64 *l) +{ + loff_t start; + + switch (l->l_whence) { + case 0: /*SEEK_SET*/ + start = 0; + break; + case 1: /*SEEK_CUR*/ + start = filp->f_pos; + break; + case 2: /*SEEK_END*/ + start = filp->f_dentry->d_inode->i_size; + break; + default: + return (0); + } + + if (((start += l->l_start) < 0) || (l->l_len < 0)) + return (0); + fl->fl_end = start + l->l_len - 1; + if (l->l_len > 0 && fl->fl_end < 0) + return (0); + fl->fl_start = start; /* we record the absolute position */ + if (l->l_len == 0) + fl->fl_end = OFFSET_MAX; + + fl->fl_owner = current->files; + fl->fl_pid = current->pid; + fl->fl_file = filp; + fl->fl_flags = FL_POSIX; + fl->fl_notify = NULL; + fl->fl_insert = NULL; + fl->fl_remove = NULL; + + switch (l->l_type) { + case F_RDLCK: + case F_WRLCK: + case F_UNLCK: + fl->fl_type = l->l_type; + break; + default: + return (0); + } + + return (1); +} +#endif + /* Check if two locks overlap each other. */ static inline int locks_overlap(struct file_lock *fl1, struct file_lock *fl2) @@ -816,13 +867,12 @@ int posix_lock_file(struct file *filp, struct file_lock *caller, if (right) { if (left == right) { /* The new lock breaks the old one in two pieces, - * so we have to use the second new lock (in this - * case, even F_UNLCK may fail!). + * so we have to use the second new lock. */ - locks_copy_lock(new_fl2, right); - locks_insert_lock(before, left); left = new_fl2; new_fl2 = NULL; + locks_copy_lock(left, right); + locks_insert_lock(before, left); } right->fl_start = caller->fl_end + 1; locks_wake_up_blocks(right, 0); @@ -909,7 +959,8 @@ int fcntl_getlk(unsigned int fd, struct flock *l) if (!filp) goto out; - if (!posix_make_lock(filp, file_lock, &flock)) + error = -EINVAL; + if (!flock_to_posix_lock(filp, file_lock, &flock)) goto out_putf; if (filp->f_op->lock) { @@ -928,8 +979,21 @@ int fcntl_getlk(unsigned int fd, struct flock *l) flock.l_type = F_UNLCK; if (fl != NULL) { flock.l_pid = fl->fl_pid; +#if BITS_PER_LONG == 32 + /* + * Make sure we can represent the posix lock via + * legacy 32bit flock. + */ + error = -EOVERFLOW; + if (fl->fl_end > OFFT_OFFSET_MAX) + goto out_putf; +#endif flock.l_start = fl->fl_start; +#if BITS_PER_LONG == 32 + flock.l_len = fl->fl_end == OFFT_OFFSET_MAX ? 0 : +#else flock.l_len = fl->fl_end == OFFSET_MAX ? 0 : +#endif fl->fl_end - fl->fl_start + 1; flock.l_whence = 0; flock.l_type = fl->fl_type; @@ -993,7 +1057,7 @@ int fcntl_setlk(unsigned int fd, unsigned int cmd, struct flock *l) } error = -EINVAL; - if (!posix_make_lock(filp, file_lock, &flock)) + if (!flock_to_posix_lock(filp, file_lock, &flock)) goto out_putf; error = -EBADF; @@ -1044,6 +1108,151 @@ out: return error; } +#if BITS_PER_LONG == 32 +/* Report the first existing lock that would conflict with l. + * This implements the F_GETLK command of fcntl(). + */ +int fcntl_getlk64(unsigned int fd, struct flock64 *l) +{ + struct file *filp; + struct file_lock *fl, *file_lock = locks_alloc_lock(); + struct flock64 flock; + int error; + + error = -EFAULT; + if (copy_from_user(&flock, l, sizeof(flock))) + goto out; + error = -EINVAL; + if ((flock.l_type != F_RDLCK) && (flock.l_type != F_WRLCK)) + goto out; + + error = -EBADF; + filp = fget(fd); + if (!filp) + goto out; + + error = -EINVAL; + if (!flock64_to_posix_lock(filp, file_lock, &flock)) + goto out_putf; + + if (filp->f_op->lock) { + error = filp->f_op->lock(filp, F_GETLK, file_lock); + if (error < 0) + goto out_putf; + else if (error == LOCK_USE_CLNT) + /* Bypass for NFS with no locking - 2.0.36 compat */ + fl = posix_test_lock(filp, file_lock); + else + fl = (file_lock->fl_type == F_UNLCK ? NULL : file_lock); + } else { + fl = posix_test_lock(filp, file_lock); + } + + flock.l_type = F_UNLCK; + if (fl != NULL) { + flock.l_pid = fl->fl_pid; + flock.l_start = fl->fl_start; + flock.l_len = fl->fl_end == OFFSET_MAX ? 0 : + fl->fl_end - fl->fl_start + 1; + flock.l_whence = 0; + flock.l_type = fl->fl_type; + } + error = -EFAULT; + if (!copy_to_user(l, &flock, sizeof(flock))) + error = 0; + +out_putf: + fput(filp); +out: + locks_free_lock(file_lock); + return error; +} + +/* Apply the lock described by l to an open file descriptor. + * This implements both the F_SETLK and F_SETLKW commands of fcntl(). + */ +int fcntl_setlk64(unsigned int fd, unsigned int cmd, struct flock64 *l) +{ + struct file *filp; + struct file_lock *file_lock = locks_alloc_lock(); + struct flock64 flock; + struct inode *inode; + int error; + + /* + * This might block, so we do it before checking the inode. + */ + error = -EFAULT; + if (copy_from_user(&flock, l, sizeof(flock))) + goto out; + + /* Get arguments and validate them ... + */ + + error = -EBADF; + filp = fget(fd); + if (!filp) + goto out; + + error = -EINVAL; + inode = filp->f_dentry->d_inode; + + /* Don't allow mandatory locks on files that may be memory mapped + * and shared. + */ + if (IS_MANDLOCK(inode) && + (inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID) { + struct vm_area_struct *vma; + struct address_space *mapping = inode->i_mapping; + spin_lock(&mapping->i_shared_lock); + for(vma = mapping->i_mmap;vma;vma = vma->vm_next_share) { + if (!(vma->vm_flags & VM_MAYSHARE)) + continue; + spin_unlock(&mapping->i_shared_lock); + error = -EAGAIN; + goto out_putf; + } + spin_unlock(&mapping->i_shared_lock); + } + + error = -EINVAL; + if (!flock64_to_posix_lock(filp, file_lock, &flock)) + goto out_putf; + + error = -EBADF; + switch (flock.l_type) { + case F_RDLCK: + if (!(filp->f_mode & FMODE_READ)) + goto out_putf; + break; + case F_WRLCK: + if (!(filp->f_mode & FMODE_WRITE)) + goto out_putf; + break; + case F_UNLCK: + break; + case F_SHLCK: + case F_EXLCK: + default: + error = -EINVAL; + goto out_putf; + } + + if (filp->f_op->lock != NULL) { + error = filp->f_op->lock(filp, cmd, file_lock); + if (error < 0) + goto out_putf; + } + error = posix_lock_file(filp, file_lock, cmd == F_SETLKW); + +out_putf: + fput(filp); +out: + locks_free_lock(file_lock); + return error; +} +#endif /* BITS_PER_LONG == 32 */ + /* * This function is called when the file is being removed * from the task's fd array. diff --git a/fs/minix/dir.c b/fs/minix/dir.c index 6443f05ed37e..1cc918910db7 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c @@ -43,7 +43,7 @@ static int minix_readdir(struct file * filp, de = (struct minix_dir_entry *) (offset + bh->b_data); if (de->inode) { int size = strnlen(de->name, info->s_namelen); - if (filldir(dirent, de->name, size, filp->f_pos, de->inode) < 0) { + if (filldir(dirent, de->name, size, filp->f_pos, de->inode, DT_UNKNOWN) < 0) { brelse(bh); return 0; } diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c index 8cb5a5c06a02..1c0f13e3be10 100644 --- a/fs/ncpfs/dir.c +++ b/fs/ncpfs/dir.c @@ -446,13 +446,13 @@ static int ncp_readdir(struct file *filp, void *dirent, filldir_t filldir) result = 0; if (filp->f_pos == 0) { - if (filldir(dirent, ".", 1, 0, inode->i_ino)) + if (filldir(dirent, ".", 1, 0, inode->i_ino, DT_DIR)) goto out; filp->f_pos = 1; } if (filp->f_pos == 1) { if (filldir(dirent, "..", 2, 1, - dentry->d_parent->d_inode->i_ino)) + dentry->d_parent->d_inode->i_ino, DT_DIR)) goto out; filp->f_pos = 2; } @@ -503,7 +503,7 @@ static int ncp_readdir(struct file *filp, void *dirent, filldir_t filldir) goto invalid_cache; res = filldir(dirent, dent->d_name.name, dent->d_name.len, filp->f_pos, - dent->d_inode->i_ino); + dent->d_inode->i_ino, DT_UNKNOWN); dput(dent); if (res) goto finished; @@ -650,7 +650,7 @@ end_advance: if (!ino) ino = iunique(inode->i_sb, 2); ctl.filled = filldir(dirent, qname.name, qname.len, - filp->f_pos, ino); + filp->f_pos, ino, DT_UNKNOWN); if (!ctl.filled) filp->f_pos += 1; } diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 5c5c3a95f136..a7c7dd10c6b1 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -264,7 +264,7 @@ int nfs_do_filldir(nfs_readdir_descriptor_t *desc, void *dirent, * retrieving the current dirent on the server */ fileid = nfs_fileid_to_ino_t(entry->ino); res = filldir(dirent, entry->name, entry->len, - entry->prev_cookie, fileid); + entry->prev_cookie, fileid, DT_UNKNOWN); if (res < 0) break; file->f_pos = desc->target = entry->cookie; diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c index 948566a6e91b..308db4cd528d 100644 --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c @@ -669,7 +669,7 @@ nfs3svc_encode_readdirres(struct svc_rqst *rqstp, u32 *p, #define NFS3_ENTRYPLUS_BAGGAGE (1 + 21 + 1 + (NFS3_FHSIZE >> 2)) static int encode_entry(struct readdir_cd *cd, const char *name, - int namlen, off_t offset, ino_t ino, int plus) + int namlen, off_t offset, ino_t ino, unsigned int d_type, int plus) { u32 *p = cd->buffer; int buflen, slen, elen; @@ -747,16 +747,16 @@ noexec: int nfs3svc_encode_entry(struct readdir_cd *cd, const char *name, - int namlen, off_t offset, ino_t ino) + int namlen, off_t offset, ino_t ino, unsigned int d_type) { - return encode_entry(cd, name, namlen, offset, ino, 0); + return encode_entry(cd, name, namlen, offset, ino, d_type, 0); } int nfs3svc_encode_entry_plus(struct readdir_cd *cd, const char *name, - int namlen, off_t offset, ino_t ino) + int namlen, off_t offset, ino_t ino, unsigned int d_type) { - return encode_entry(cd, name, namlen, offset, ino, 1); + return encode_entry(cd, name, namlen, offset, ino, d_type, 1); } /* FSSTAT */ diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index 52a0348c1603..d1b6306db1db 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c @@ -41,7 +41,7 @@ struct nfsd_getdents_callback { * the name matching the specified inode number. */ static int filldir_one(void * __buf, const char * name, int len, - off_t pos, ino_t ino) + off_t pos, ino_t ino, unsigned int d_type) { struct nfsd_getdents_callback *buf = __buf; struct qstr *qs = buf->name; diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c index 7b9546d93887..9127e08696d7 100644 --- a/fs/nfsd/nfsxdr.c +++ b/fs/nfsd/nfsxdr.c @@ -390,7 +390,7 @@ nfssvc_encode_statfsres(struct svc_rqst *rqstp, u32 *p, int nfssvc_encode_entry(struct readdir_cd *cd, const char *name, - int namlen, off_t offset, ino_t ino) + int namlen, off_t offset, ino_t ino, unsigned int d_type) { u32 *p = cd->buffer; int buflen, slen; diff --git a/fs/ntfs/fs.c b/fs/ntfs/fs.c index 0d372ddfa326..c99e81e6a73c 100644 --- a/fs/ntfs/fs.c +++ b/fs/ntfs/fs.c @@ -200,7 +200,7 @@ static int ntfs_printcb(ntfs_u8 *entry,void *param) /* filldir expects an off_t rather than an loff_t. Hope we don't have more than 65535 index records */ error=nf->filldir(nf->dirent,nf->name,nf->namelen, - (nf->ph<<16)|nf->pl,inum); + (nf->ph<<16)|nf->pl,inum,DT_UNKNOWN); ntfs_free(nf->name); /* Linux filldir errors are negative, other errors positive */ return error; @@ -226,11 +226,11 @@ static int ntfs_readdir(struct file* filp, void *dirent, filldir_t filldir) if(cb.ph==0xFFFF){ /* FIXME: Maybe we can return those with the previous call */ switch(cb.pl){ - case 0: filldir(dirent,".",1,filp->f_pos,dir->i_ino); + case 0: filldir(dirent,".",1,filp->f_pos,dir->i_ino,DT_DIR); filp->f_pos=0xFFFF0001; return 0; /* FIXME: parent directory */ - case 1: filldir(dirent,"..",2,filp->f_pos,0); + case 1: filldir(dirent,"..",2,filp->f_pos,0,DT_DIR); filp->f_pos=0xFFFF0002; return 0; } diff --git a/fs/open.c b/fs/open.c index c42b15a4102a..0f1787025c0f 100644 --- a/fs/open.c +++ b/fs/open.c @@ -680,7 +680,7 @@ int get_unused_fd(void) repeat: fd = find_next_zero_bit(files->open_fds, - current->files->max_fdset, + files->max_fdset, files->next_fd); /* @@ -691,7 +691,7 @@ repeat: goto out; /* Do we need to expand the fdset array? */ - if (fd >= current->files->max_fdset) { + if (fd >= files->max_fdset) { error = expand_fdset(files, fd); if (!error) { error = -EMFILE; @@ -799,36 +799,27 @@ int filp_close(struct file *filp, fl_owner_t id) * Careful here! We test whether the file pointer is NULL before * releasing the fd. This ensures that one clone task can't release * an fd while another clone is opening it. - * - * The "release" argument tells us whether or not to mark the fd as free - * or not in the open-files bitmap. dup2 uses this to retain the fd - * without races. */ -int do_close(struct files_struct *files, unsigned int fd, int release) +asmlinkage long sys_close(unsigned int fd) { - int error; struct file * filp; + struct files_struct *files = current->files; - error = -EBADF; write_lock(&files->file_lock); - filp = frip(files, fd); + if (fd >= files->max_fds) + goto out_unlock; + filp = files->fd[fd]; if (!filp) goto out_unlock; + files->fd[fd] = NULL; FD_CLR(fd, files->close_on_exec); - if (release) - __put_unused_fd(files, fd); + __put_unused_fd(files, fd); write_unlock(&files->file_lock); - error = filp_close(filp, files); -out: - return error; + return filp_close(filp, files); + out_unlock: write_unlock(&files->file_lock); - goto out; -} - -asmlinkage long sys_close(unsigned int fd) -{ - return do_close(current->files, fd, 1); + return -EBADF; } /* diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c index abd6ec28ed85..6dcfe8ef120e 100644 --- a/fs/openpromfs/inode.c +++ b/fs/openpromfs/inode.c @@ -757,14 +757,14 @@ static int openpromfs_readdir(struct file * filp, void * dirent, filldir_t filld i = filp->f_pos; switch (i) { case 0: - if (filldir(dirent, ".", 1, i, ino) < 0) return 0; + if (filldir(dirent, ".", 1, i, ino, DT_DIR) < 0) return 0; i++; filp->f_pos++; /* fall thru */ case 1: if (filldir(dirent, "..", 2, i, (NODE(ino).parent == 0xffff) ? - OPENPROM_ROOT_INO : NODE2INO(NODE(ino).parent)) < 0) + OPENPROM_ROOT_INO : NODE2INO(NODE(ino).parent), DT_DIR) < 0) return 0; i++; filp->f_pos++; @@ -780,14 +780,14 @@ static int openpromfs_readdir(struct file * filp, void * dirent, filldir_t filld if (prom_getname (nodes[node].node, buffer, 128) < 0) return 0; if (filldir(dirent, buffer, strlen(buffer), - filp->f_pos, NODE2INO(node)) < 0) + filp->f_pos, NODE2INO(node), DT_DIR) < 0) return 0; filp->f_pos++; node = nodes[node].next; } j = NODEP2INO(NODE(ino).first_prop); if (!i) { - if (filldir(dirent, ".node", 5, filp->f_pos, j) < 0) + if (filldir(dirent, ".node", 5, filp->f_pos, j, DT_REG) < 0) return 0; filp->f_pos++; } else @@ -798,7 +798,7 @@ static int openpromfs_readdir(struct file * filp, void * dirent, filldir_t filld if (alias_names [i]) { if (filldir (dirent, alias_names [i], strlen (alias_names [i]), - filp->f_pos, j) < 0) return 0; + filp->f_pos, j, DT_REG) < 0) return 0; filp->f_pos++; } } @@ -810,7 +810,7 @@ static int openpromfs_readdir(struct file * filp, void * dirent, filldir_t filld if (i) i--; else { if (filldir(dirent, p, strlen(p), - filp->f_pos, j) < 0) + filp->f_pos, j, DT_REG) < 0) return 0; filp->f_pos++; } diff --git a/fs/proc/base.c b/fs/proc/base.c index 23151f3d96f8..7625e4d5aff1 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -522,12 +522,12 @@ static int proc_readfd(struct file * filp, void * dirent, filldir_t filldir) fd = filp->f_pos; switch (fd) { case 0: - if (filldir(dirent, ".", 1, 0, inode->i_ino) < 0) + if (filldir(dirent, ".", 1, 0, inode->i_ino, DT_DIR) < 0) goto out; filp->f_pos++; case 1: ino = fake_ino(pid, PROC_PID_INO); - if (filldir(dirent, "..", 2, 1, ino) < 0) + if (filldir(dirent, "..", 2, 1, ino, DT_DIR) < 0) goto out; filp->f_pos++; default: @@ -555,7 +555,7 @@ static int proc_readfd(struct file * filp, void * dirent, filldir_t filldir) } while (i); ino = fake_ino(pid, PROC_PID_FD_DIR + fd); - if (filldir(dirent, buf+j, NUMBUF-j, fd+2, ino) < 0) + if (filldir(dirent, buf+j, NUMBUF-j, fd+2, ino, DT_LNK) < 0) break; } put_files_struct(files); @@ -578,13 +578,13 @@ static int proc_base_readdir(struct file * filp, i = filp->f_pos; switch (i) { case 0: - if (filldir(dirent, ".", 1, i, inode->i_ino) < 0) + if (filldir(dirent, ".", 1, i, inode->i_ino, DT_DIR) < 0) return 0; i++; filp->f_pos++; /* fall through */ case 1: - if (filldir(dirent, "..", 2, i, PROC_ROOT_INO) < 0) + if (filldir(dirent, "..", 2, i, PROC_ROOT_INO, DT_DIR) < 0) return 0; i++; filp->f_pos++; @@ -595,7 +595,8 @@ static int proc_base_readdir(struct file * filp, return 1; p = base_stuff + i; while (p->name) { - if (filldir(dirent, p->name, p->len, filp->f_pos, fake_ino(pid, p->type)) < 0) + if (filldir(dirent, p->name, p->len, filp->f_pos, + fake_ino(pid, p->type), p->mode >> 12) < 0) return 0; filp->f_pos++; p++; @@ -1007,7 +1008,7 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir) if (!nr) { ino_t ino = fake_ino(0,PROC_PID_INO); - if (filldir(dirent, "self", 4, filp->f_pos, ino) < 0) + if (filldir(dirent, "self", 4, filp->f_pos, ino, DT_LNK) < 0) return 0; filp->f_pos++; nr++; @@ -1022,7 +1023,7 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir) do buf[--j] = '0' + (pid % 10); while (pid/=10); - if (filldir(dirent, buf+j, PROC_NUMBUF-j, filp->f_pos, ino) < 0) + if (filldir(dirent, buf+j, PROC_NUMBUF-j, filp->f_pos, ino, DT_DIR) < 0) break; filp->f_pos++; } diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 9c7270070ad7..ba2f88e9f580 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c @@ -294,15 +294,15 @@ int proc_readdir(struct file * filp, i = filp->f_pos; switch (i) { case 0: - if (filldir(dirent, ".", 1, i, ino) < 0) + if (filldir(dirent, ".", 1, i, ino, DT_DIR) < 0) return 0; i++; filp->f_pos++; /* fall through */ case 1: if (filldir(dirent, "..", 2, i, - filp->f_dentry->d_parent->d_inode->i_ino - ) < 0) + filp->f_dentry->d_parent->d_inode->i_ino, + DT_DIR) < 0) return 0; i++; filp->f_pos++; @@ -320,7 +320,8 @@ int proc_readdir(struct file * filp, } do { - if (filldir(dirent, de->name, de->namelen, filp->f_pos, de->low_ino) < 0) + if (filldir(dirent, de->name, de->namelen, filp->f_pos, + de->low_ino, de->mode >> 12) < 0) return 0; filp->f_pos++; de = de->next; diff --git a/fs/qnx4/dir.c b/fs/qnx4/dir.c index 4b146945a0b4..ac5d09b91477 100644 --- a/fs/qnx4/dir.c +++ b/fs/qnx4/dir.c @@ -62,7 +62,7 @@ static int qnx4_readdir(struct file *filp, void *dirent, filldir_t filldir) QNX4_INODES_PER_BLOCK + le->dl_inode_ndx; } - if (filldir(dirent, de->di_fname, size, filp->f_pos, ino) < 0) { + if (filldir(dirent, de->di_fname, size, filp->f_pos, ino, DT_UNKNOWN) < 0) { brelse(bh); return 0; } diff --git a/fs/readdir.c b/fs/readdir.c index e1e90c113d3a..cd8f7ad3d4d9 100644 --- a/fs/readdir.c +++ b/fs/readdir.c @@ -13,9 +13,7 @@ #include -int vfs_readdir(struct file *file, - int (*filler)(void *,const char *,int,off_t,ino_t), - void *buf) +int vfs_readdir(struct file *file, filldir_t filler, void *buf) { struct inode *inode = file->f_dentry->d_inode; int res = -ENOTDIR; @@ -49,13 +47,13 @@ int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir) i = filp->f_pos; switch (i) { case 0: - if (filldir(dirent, ".", 1, i, dentry->d_inode->i_ino) < 0) + if (filldir(dirent, ".", 1, i, dentry->d_inode->i_ino, DT_DIR) < 0) break; i++; filp->f_pos++; /* fallthrough */ case 1: - if (filldir(dirent, "..", 2, i, dentry->d_parent->d_inode->i_ino) < 0) + if (filldir(dirent, "..", 2, i, dentry->d_parent->d_inode->i_ino, DT_DIR) < 0) break; i++; filp->f_pos++; @@ -83,7 +81,7 @@ int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir) if (!list_empty(&de->d_hash) && de->d_inode) { spin_unlock(&dcache_lock); - if (filldir(dirent, de->d_name.name, de->d_name.len, filp->f_pos, de->d_inode->i_ino) < 0) + if (filldir(dirent, de->d_name.name, de->d_name.len, filp->f_pos, de->d_inode->i_ino, DT_UNKNOWN) < 0) break; spin_lock(&dcache_lock); } @@ -124,7 +122,8 @@ struct readdir_callback { int count; }; -static int fillonedir(void * __buf, const char * name, int namlen, off_t offset, ino_t ino) +static int fillonedir(void * __buf, const char * name, int namlen, off_t offset, + ino_t ino, unsigned int d_type) { struct readdir_callback * buf = (struct readdir_callback *) __buf; struct old_linux_dirent * dirent; @@ -184,7 +183,8 @@ struct getdents_callback { int error; }; -static int filldir(void * __buf, const char * name, int namlen, off_t offset, ino_t ino) +static int filldir(void * __buf, const char * name, int namlen, off_t offset, + ino_t ino, unsigned int d_type) { struct linux_dirent * dirent; struct getdents_callback * buf = (struct getdents_callback *) __buf; @@ -240,3 +240,89 @@ out_putf: out: return error; } + +/* + * And even better one including d_type field and 64bit d_ino and d_off. + */ +struct linux_dirent64 { + u64 d_ino; + s64 d_off; + unsigned short d_reclen; + unsigned char d_type; + char d_name[0]; +}; + +#define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1)) + +struct getdents_callback64 { + struct linux_dirent64 * current_dir; + struct linux_dirent64 * previous; + int count; + int error; +}; + +static int filldir64(void * __buf, const char * name, int namlen, off_t offset, + ino_t ino, unsigned int d_type) +{ + struct linux_dirent64 * dirent, d; + struct getdents_callback64 * buf = (struct getdents_callback64 *) __buf; + int reclen = ROUND_UP64(NAME_OFFSET(dirent) + namlen + 1); + + buf->error = -EINVAL; /* only used if we fail.. */ + if (reclen > buf->count) + return -EINVAL; + dirent = buf->previous; + if (dirent) { + d.d_off = offset; + copy_to_user(&dirent->d_off, &d.d_off, sizeof(d.d_off)); + } + dirent = buf->current_dir; + buf->previous = dirent; + memset(&d, 0, NAME_OFFSET(&d)); + d.d_ino = ino; + d.d_reclen = reclen; + d.d_type = d_type; + copy_to_user(dirent, &d, NAME_OFFSET(&d)); + copy_to_user(dirent->d_name, name, namlen); + put_user(0, dirent->d_name + namlen); + ((char *) dirent) += reclen; + buf->current_dir = dirent; + buf->count -= reclen; + return 0; +} + +asmlinkage long sys_getdents64(unsigned int fd, void * dirent, unsigned int count) +{ + struct file * file; + struct linux_dirent64 * lastdirent; + struct getdents_callback64 buf; + int error; + + error = -EBADF; + file = fget(fd); + if (!file) + goto out; + + buf.current_dir = (struct linux_dirent64 *) dirent; + buf.previous = NULL; + buf.count = count; + buf.error = 0; + + error = vfs_readdir(file, filldir64, &buf); + if (error < 0) + goto out_putf; + error = buf.error; + lastdirent = buf.previous; + if (lastdirent) { + struct linux_dirent64 d; + d.d_off = file->f_pos; + copy_to_user(&lastdirent->d_off, &d.d_off, sizeof(d.d_off)); + error = count - buf.count; + } + +out_putf: + fput(file); +out: + return error; +} + diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c index 8d01f17baeb1..081209a487c2 100644 --- a/fs/romfs/inode.c +++ b/fs/romfs/inode.c @@ -254,6 +254,10 @@ romfs_copyfrom(struct inode *i, void *dest, unsigned long offset, unsigned long return res; } +static unsigned char romfs_dtype_table[] = { + DT_UNKNOWN, DT_DIR, DT_REG, DT_LNK, DT_BLK, DT_CHR, DT_SOCK, DT_FIFO +}; + static int romfs_readdir(struct file *filp, void *dirent, filldir_t filldir) { @@ -298,7 +302,8 @@ romfs_readdir(struct file *filp, void *dirent, filldir_t filldir) nextfh = ntohl(ri.next); if ((nextfh & ROMFH_TYPE) == ROMFH_HRD) ino = ntohl(ri.spec); - if (filldir(dirent, fsname, j, offset, ino) < 0) { + if (filldir(dirent, fsname, j, offset, ino, + romfs_dtype_table[nextfh & ROMFH_TYPE]) < 0) { return stored; } stored++; diff --git a/fs/smbfs/dir.c b/fs/smbfs/dir.c index 807d8f2e34ea..9598ab82c929 100644 --- a/fs/smbfs/dir.c +++ b/fs/smbfs/dir.c @@ -66,12 +66,12 @@ smb_readdir(struct file *filp, void *dirent, filldir_t filldir) switch ((unsigned int) filp->f_pos) { case 0: - if (filldir(dirent, ".", 1, 0, dir->i_ino) < 0) + if (filldir(dirent, ".", 1, 0, dir->i_ino, DT_DIR) < 0) goto out; filp->f_pos = 1; case 1: if (filldir(dirent, "..", 2, 1, - dentry->d_parent->d_inode->i_ino) < 0) + dentry->d_parent->d_inode->i_ino, DT_DIR) < 0) goto out; filp->f_pos = 2; } @@ -127,7 +127,7 @@ smb_readdir(struct file *filp, void *dirent, filldir_t filldir) } if (filldir(dirent, entry->name, entry->len, - filp->f_pos, entry->ino) < 0) + filp->f_pos, entry->ino, DT_UNKNOWN) < 0) break; filp->f_pos += 1; } diff --git a/fs/stat.c b/fs/stat.c index 18d1f7a887ea..e07b237e47fb 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -52,6 +52,10 @@ static int cp_old_stat(struct inode * inode, struct __old_kernel_stat * statbuf) SET_OLDSTAT_UID(tmp, inode->i_uid); SET_OLDSTAT_GID(tmp, inode->i_gid); tmp.st_rdev = kdev_t_to_nr(inode->i_rdev); +#if BITS_PER_LONG == 32 + if (inode->i_size > 0x7fffffff) + return -EOVERFLOW; +#endif tmp.st_size = inode->i_size; tmp.st_atime = inode->i_atime; tmp.st_mtime = inode->i_mtime; @@ -74,6 +78,10 @@ static int cp_new_stat(struct inode * inode, struct stat * statbuf) SET_STAT_UID(tmp, inode->i_uid); SET_STAT_GID(tmp, inode->i_gid); tmp.st_rdev = kdev_t_to_nr(inode->i_rdev); +#if BITS_PER_LONG == 32 + if (inode->i_size > 0x7fffffff) + return -EOVERFLOW; +#endif tmp.st_size = inode->i_size; tmp.st_atime = inode->i_atime; tmp.st_mtime = inode->i_mtime; diff --git a/fs/super.c b/fs/super.c index 8576d79d0b33..81a3fafc2b19 100644 --- a/fs/super.c +++ b/fs/super.c @@ -10,13 +10,12 @@ * - umount system call * - ustat system call * - * Added options to /proc/mounts - * Torbjörn Lindh (torbjorn.lindh@gopta.se), April 14, 1996. - * * GK 2/5/95 - Changed to support mounting the root fs via NFS * * Added kerneld support: Jacques Gelinas and Bjorn Ekwall * Added change_root: Werner Almesberger & Hans Lermen, Feb '96 + * Added options to /proc/mounts: + * Torbjörn Lindh (torbjorn.lindh@gopta.se), April 14, 1996. * Added devfs support: Richard Gooch , 13-JAN-1998 * Heavily rewritten for 'one fs - one tree' dcache architecture. AV, Mar 2000 */ @@ -428,6 +427,33 @@ static void remove_vfsmnt(struct vfsmount *mnt) kfree(mnt); } + +/* Use octal escapes, like mount does, for embedded spaces etc. */ +static unsigned char need_escaping[] = { ' ', '\t', '\n', '\\' }; + +static int +mangle(const unsigned char *s, char *buf, int len) { + char *sp; + int n; + + sp = buf; + while(*s && sp-buf < len-3) { + for (n = 0; n < sizeof(need_escaping); n++) { + if (*s == need_escaping[n]) { + *sp++ = '\\'; + *sp++ = '0' + ((*s & 0300) >> 6); + *sp++ = '0' + ((*s & 070) >> 3); + *sp++ = '0' + (*s & 07); + goto next; + } + } + *sp++ = *s; + next: + s++; + } + return sp - buf; /* no trailing NUL */ +} + static struct proc_fs_info { int flag; char *str; @@ -466,27 +492,32 @@ int get_filesystem_info( char *buf ) struct proc_fs_info *fs_infop; struct proc_nfs_info *nfs_infop; struct nfs_server *nfss; - int len = 0; - char *path,*buffer = (char *) __get_free_page(GFP_KERNEL); + int len, prevlen; + char *path, *buffer = (char *) __get_free_page(GFP_KERNEL); if (!buffer) return 0; - for (p = vfsmntlist.next; p!=&vfsmntlist && len < PAGE_SIZE - 160; - p = p->next) { + len = prevlen = 0; + +#define FREEROOM ((int)PAGE_SIZE-200-len) +#define MANGLE(s) len += mangle((s), buf+len, FREEROOM); + + for (p = vfsmntlist.next; p != &vfsmntlist; p = p->next) { struct vfsmount *tmp = list_entry(p, struct vfsmount, mnt_list); if (!(tmp->mnt_flags & MNT_VISIBLE)) continue; path = d_path(tmp->mnt_root, tmp, buffer, PAGE_SIZE); if (!path) continue; - len += sprintf( buf + len, "%s %s %s %s", - tmp->mnt_devname ? tmp->mnt_devname : "none", path, - tmp->mnt_sb->s_type->name, - tmp->mnt_sb->s_flags & MS_RDONLY ? "ro" : "rw" ); + MANGLE(tmp->mnt_devname ? tmp->mnt_devname : "none"); + buf[len++] = ' '; + MANGLE(path); + buf[len++] = ' '; + MANGLE(tmp->mnt_sb->s_type->name); + len += sprintf(buf+len, " %s", + tmp->mnt_sb->s_flags & MS_RDONLY ? "ro" : "rw"); for (fs_infop = fs_info; fs_infop->flag; fs_infop++) { - if (tmp->mnt_sb->s_flags & fs_infop->flag) { - strcpy(buf + len, fs_infop->str); - len += strlen(fs_infop->str); - } + if (tmp->mnt_sb->s_flags & fs_infop->flag) + MANGLE(fs_infop->str); } if (!strcmp("nfs", tmp->mnt_sb->s_type->name)) { nfss = &tmp->mnt_sb->u.nfs_sb.s_server; @@ -527,17 +558,24 @@ int get_filesystem_info( char *buf ) str = nfs_infop->str; else str = nfs_infop->nostr; - strcpy(buf + len, str); - len += strlen(str); + MANGLE(str); } - len += sprintf(buf+len, ",addr=%s", - nfss->hostname); + len += sprintf(buf+len, ",addr="); + MANGLE(nfss->hostname); + } + len += sprintf(buf + len, " 0 0\n"); + if (FREEROOM <= 3) { + len = prevlen; + len += sprintf(buf+len, "# truncated\n"); + break; } - len += sprintf( buf + len, " 0 0\n" ); + prevlen = len; } free_page((unsigned long) buffer); return len; +#undef MANGLE +#undef FREEROOM } /** @@ -775,7 +813,8 @@ static struct super_block *get_sb_bdev(struct file_system_type *fs_type, dev = to_kdev_t(bdev->bd_dev); sb = get_super(dev); if (sb) { - if (fs_type == sb->s_type) { + if (fs_type == sb->s_type && + ((flags ^ sb->s_flags) & MS_RDONLY) == 0) { path_release(&nd); return sb; } @@ -1090,7 +1129,7 @@ asmlinkage long sys_umount(char * name, int flags) if (retval) goto out; retval = -EINVAL; - if (nd.dentry!=nd.mnt->mnt_root) + if (nd.dentry != nd.mnt->mnt_root) goto dput_and_out; retval = -EPERM; @@ -1263,8 +1302,8 @@ static int copy_mount_options (const void *data, unsigned long *where) * PAGE_SIZE-1 bytes, which can contain arbitrary fs-dependent * information (or be NULL). * - * NOTE! As old versions of mount() didn't use this setup, the flags - * have to have a special 16-bit magic number in the high word: + * NOTE! As pre-0.97 versions of mount() didn't use this setup, the + * flags have to have a special 16-bit magic number in the high word: * 0xC0ED. If this magic word isn't present, the flags and data info * aren't used, as the syscall assumes we are talking to an older * version that didn't understand them. @@ -1736,7 +1775,7 @@ int __init change_root(kdev_t new_root_dev,const char *put_old) printk("okay\n"); return 0; } - printk(KERN_ERR "error %d\n",blivet); + printk(KERN_ERR "error %d\n", blivet); return error; } /* FIXME: we should hold i_zombie on nd.dentry */ diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c index 57968a839bf3..5cdf5c605da3 100644 --- a/fs/sysv/dir.c +++ b/fs/sysv/dir.c @@ -61,7 +61,7 @@ static int sysv_readdir(struct file * filp, void * dirent, filldir_t filldir) inode->i_ino, (off_t) filp->f_pos, sde.inode); i = strnlen(sde.name, SYSV_NAMELEN); - if (filldir(dirent, sde.name, i, filp->f_pos, sde.inode) < 0) { + if (filldir(dirent, sde.name, i, filp->f_pos, sde.inode, DT_UNKNOWN) < 0) { brelse(bh); return 0; } diff --git a/fs/udf/dir.c b/fs/udf/dir.c index 09121f0efdf8..9f093c536bc1 100644 --- a/fs/udf/dir.c +++ b/fs/udf/dir.c @@ -94,7 +94,7 @@ int udf_readdir(struct file *filp, void *dirent, filldir_t filldir) if ( filp->f_pos == 0 ) { - if (filldir(dirent, ".", 1, filp->f_pos, dir->i_ino)) + if (filldir(dirent, ".", 1, filp->f_pos, dir->i_ino, DT_DIR)) return 0; } @@ -206,7 +206,7 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d if (!lfi) /* parent directory */ { - if (filldir(dirent, "..", 2, filp->f_pos, filp->f_dentry->d_parent->d_inode->i_ino)) + if (filldir(dirent, "..", 2, filp->f_pos, filp->f_dentry->d_parent->d_inode->i_ino, DT_DIR)) { if (fibh.sbh != fibh.ebh) udf_release_data(fibh.ebh); @@ -219,7 +219,7 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d { if ((flen = udf_get_filename(nameptr, fname, lfi))) { - if (filldir(dirent, fname, flen, filp->f_pos, iblock)) + if (filldir(dirent, fname, flen, filp->f_pos, iblock, DT_UNKNOWN)) { if (fibh.sbh != fibh.ebh) udf_release_data(fibh.ebh); diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c index 08fa1f4bfe1e..755198ded38d 100644 --- a/fs/ufs/dir.c +++ b/fs/ufs/dir.c @@ -122,11 +122,14 @@ revalidate: * not the directory has been modified * during the copy operation. */ unsigned long version = filp->f_version; + unsigned char d_type = DT_UNKNOWN; UFSD(("filldir(%s,%u)\n", de->d_name, SWAB32(de->d_ino))) UFSD(("namlen %u\n", ufs_get_de_namlen(de))) + if ((flags & UFS_DE_MASK) == UFS_DE_44BSD) + d_type = de->d_u.d_44.d_type; error = filldir(dirent, de->d_name, ufs_get_de_namlen(de), - filp->f_pos, SWAB32(de->d_ino)); + filp->f_pos, SWAB32(de->d_ino), d_type); if (error) break; if (version != filp->f_version) diff --git a/fs/umsdos/dir.c b/fs/umsdos/dir.c index a84b8891f572..b5c14c221703 100644 --- a/fs/umsdos/dir.c +++ b/fs/umsdos/dir.c @@ -76,7 +76,7 @@ static int umsdos_dir_once ( void *buf, if (d->count == 0) { PRINTK ((KERN_DEBUG "dir_once :%.*s: offset %Ld\n", len, name, offset)); - ret = d->filldir (d->dirbuf, name, len, offset, ino); + ret = d->filldir (d->dirbuf, name, len, offset, ino, DT_UNKNOWN); d->stop = ret < 0; d->count = 1; } @@ -120,7 +120,7 @@ static int umsdos_readdir_x (struct inode *dir, struct file *filp, Printk ((KERN_WARNING "umsdos_readdir_x: pseudo_root thing UMSDOS_SPECIAL_DIRFPOS\n")); if (filldir (dirbuf, "DOS", 3, - UMSDOS_SPECIAL_DIRFPOS, UMSDOS_ROOT_INO) == 0) { + UMSDOS_SPECIAL_DIRFPOS, UMSDOS_ROOT_INO, DT_DIR) == 0) { filp->f_pos++; } goto out_end; @@ -235,7 +235,7 @@ dret->d_parent->d_name.name, dret->d_name.name); */ if (inode != pseudo_root && !(entry.flags & UMSDOS_HIDDEN)) { if (filldir (dirbuf, entry.name, entry.name_len, - cur_f_pos, inode->i_ino) < 0) { + cur_f_pos, inode->i_ino, DT_UNKNOWN) < 0) { pos = cur_f_pos; } Printk(("umsdos_readdir_x: got %s/%s, ino=%ld\n", diff --git a/fs/umsdos/rdir.c b/fs/umsdos/rdir.c index a477ade2cfc1..ff208e6ac253 100644 --- a/fs/umsdos/rdir.c +++ b/fs/umsdos/rdir.c @@ -33,7 +33,8 @@ static int rdir_filldir ( void *buf, const char *name, int name_len, off_t offset, - ino_t ino) + ino_t ino, + unsigned int d_type) { int ret = 0; struct RDIR_FILLDIR *d = (struct RDIR_FILLDIR *) buf; @@ -48,11 +49,11 @@ static int rdir_filldir ( void *buf, /* Make sure the .. entry points back to the pseudo_root */ ino = pseudo_root->i_ino; } - ret = d->filldir (d->dirbuf, name, name_len, offset, ino); + ret = d->filldir (d->dirbuf, name, name_len, offset, ino, DT_UNKNOWN); } } else { /* Any DOS directory */ - ret = d->filldir (d->dirbuf, name, name_len, offset, ino); + ret = d->filldir (d->dirbuf, name, name_len, offset, ino, DT_UNKNOWN); } return ret; } diff --git a/include/asm-alpha/fcntl.h b/include/asm-alpha/fcntl.h index 0c4a08e30a24..314e3addba83 100644 --- a/include/asm-alpha/fcntl.h +++ b/include/asm-alpha/fcntl.h @@ -63,4 +63,8 @@ struct flock { __kernel_pid_t l_pid; }; +#ifdef __KERNEL__ +#define flock64 flock +#endif + #endif diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h index 75453ddfd08d..4a5b986076f0 100644 --- a/include/asm-alpha/unistd.h +++ b/include/asm-alpha/unistd.h @@ -314,6 +314,7 @@ #define __NR_pivot_root 374 #define __NR_mincore 375 #define __NR_pciconfig_iobase 376 +#define __NR_getdents64 377 #if defined(__GNUC__) diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h index 241cb03a8d57..9dcd009629db 100644 --- a/include/asm-arm/unistd.h +++ b/include/asm-arm/unistd.h @@ -223,6 +223,7 @@ #define __NR_setgid32 (__NR_SYSCALL_BASE+214) #define __NR_setfsuid32 (__NR_SYSCALL_BASE+215) #define __NR_setfsgid32 (__NR_SYSCALL_BASE+216) +#define __NR_getdents64 (__NR_SYSCALL_BASE+217) #define __sys2(x) #x #define __sys1(x) __sys2(x) diff --git a/include/asm-i386/fcntl.h b/include/asm-i386/fcntl.h index 971b563a85af..5292b3798eb9 100644 --- a/include/asm-i386/fcntl.h +++ b/include/asm-i386/fcntl.h @@ -35,6 +35,10 @@ #define F_SETSIG 10 /* for sockets. */ #define F_GETSIG 11 /* for sockets. */ +#define F_GETLK64 12 /* using 'struct flock64' */ +#define F_SETLK64 13 +#define F_SETLKW64 14 + /* for F_[GET|SET]FL */ #define FD_CLOEXEC 1 /* actually anything with low bit set goes */ @@ -62,4 +66,12 @@ struct flock { pid_t l_pid; }; +struct flock64 { + short l_type; + short l_whence; + loff_t l_start; + loff_t l_len; + pid_t l_pid; +}; + #endif diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index 36f4e317651d..83ff6b8b7b2a 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h @@ -225,6 +225,8 @@ #define __NR_mincore 218 #define __NR_madvise 219 #define __NR_madvise1 219 /* delete when C lib stub is removed */ +#define __NR_getdents64 220 +#define __NR_fcntl64 221 /* user-visible error numbers are in the range -1 - -124: see */ diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h index 82de774401b4..456376e1b2bf 100644 --- a/include/asm-ia64/unistd.h +++ b/include/asm-ia64/unistd.h @@ -203,6 +203,7 @@ #define __NR_lstat 1211 #define __NR_fstat 1212 #define __NR_clone2 1213 +#define __NR_getdents64 1214 #if !defined(__ASSEMBLY__) && !defined(ASSEMBLER) diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h index 715eb6496b87..9b88477aa785 100644 --- a/include/asm-m68k/unistd.h +++ b/include/asm-m68k/unistd.h @@ -220,6 +220,7 @@ #define __NR_setgid32 214 #define __NR_setfsuid32 215 #define __NR_setfsgid32 216 +#define __NR_getdents64 220 /* user-visible error numbers are in the range -1 - -122: see */ diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h index ff127260ce0f..46986ccfa2d9 100644 --- a/include/asm-mips/unistd.h +++ b/include/asm-mips/unistd.h @@ -1205,11 +1205,12 @@ #define __NR_pivot_root (__NR_Linux + 216) #define __NR_mincore (__NR_Linux + 217) #define __NR_madvise (__NR_Linux + 218) +#define __NR_getdents64 (__NR_Linux + 219) /* * Offset of the last Linux flavoured syscall */ -#define __NR_Linux_syscalls 218 +#define __NR_Linux_syscalls 219 #ifndef _LANGUAGE_ASSEMBLY diff --git a/include/asm-mips64/unistd.h b/include/asm-mips64/unistd.h index 5c3689b3a730..ac94e6c87ca2 100644 --- a/include/asm-mips64/unistd.h +++ b/include/asm-mips64/unistd.h @@ -1204,11 +1204,12 @@ #define __NR_Linux32_root_pivot (__NR_Linux32 + 216) #define __NR_Linux32_mincore (__NR_Linux32 + 217) #define __NR_Linux32_madvise (__NR_Linux32 + 218) +#define __NR_Linux32_getdents64 (__NR_Linux32 + 219) /* * Offset of the last Linux o32 flavoured syscall */ -#define __NR_Linux32_syscalls 218 +#define __NR_Linux32_syscalls 219 /* * Linux 64-bit syscalls are in the range from 5000 to 5999. @@ -1427,11 +1428,12 @@ #define __NR_root_pivot (__NR_Linux + 210) #define __NR_mincore (__NR_Linux + 211) #define __NR_madvise (__NR_Linux + 212) +#define __NR_getdents64 (__NR_Linux + 213) /* * Offset of the last Linux flavoured syscall */ -#define __NR_Linux_syscalls 212 +#define __NR_Linux_syscalls 213 #ifndef _LANGUAGE_ASSEMBLY diff --git a/include/asm-ppc/unistd.h b/include/asm-ppc/unistd.h index db4e6499b5c8..3b884cbb483f 100644 --- a/include/asm-ppc/unistd.h +++ b/include/asm-ppc/unistd.h @@ -205,6 +205,7 @@ #define __NR_sys_pciconfig_write 199 #define __NR_sys_pciconfig_iobase 200 #define __NR_multiplexer 201 +#define __NR_getdents64 202 #define __NR(n) #n diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h index 4dd04edbc276..e7da084b0067 100644 --- a/include/asm-s390/unistd.h +++ b/include/asm-s390/unistd.h @@ -208,6 +208,7 @@ #define __NR_pivot_root 217 #define __NR_mincore 218 #define __NR_madvise 219 +#define __NR_getdents64 220 /* user-visible error numbers are in the range -1 - -122: see */ diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h index 0594308fe6dc..132a4edc19fb 100644 --- a/include/asm-sh/unistd.h +++ b/include/asm-sh/unistd.h @@ -229,6 +229,7 @@ #define __NR_pivot_root 217 #define __NR_mincore 218 #define __NR_madvise 219 +#define __NR_getdents64 220 /* user-visible error numbers are in the range -1 - -125: see */ diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h index 989c6742c78e..756d3a57d416 100644 --- a/include/asm-sparc/unistd.h +++ b/include/asm-sparc/unistd.h @@ -67,7 +67,7 @@ #define __NR_geteuid 49 /* SunOS calls getuid() */ #define __NR_getegid 50 /* SunOS calls getgid() */ #define __NR_acct 51 /* Common */ -/* #define __NR_ni_syscall 52 ENOSYS under SunOS */ +/* #define __NR_memory_ordering 52 Linux sparc64 specific */ #define __NR_getgid32 53 /* Linux sparc32 specific */ #define __NR_ioctl 54 /* Common */ #define __NR_reboot 55 /* Common */ @@ -169,7 +169,7 @@ /* #define __NR_getmsg 151 SunOS Specific */ /* #define __NR_putmsg 152 SunOS Specific */ #define __NR_poll 153 /* Common */ -/* #define __NR_ni_syscall 154 ENOSYS under SunOS */ +#define __NR_getdents64 154 /* Linux specific */ /* #define __NR_nfssvc 155 SunOS Specific */ /* #define __NR_getdirentries 156 SunOS Specific */ #define __NR_statfs 157 /* Common */ diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h index c7fd4cd191c4..a7848350fbd7 100644 --- a/include/asm-sparc64/unistd.h +++ b/include/asm-sparc64/unistd.h @@ -169,7 +169,7 @@ /* #define __NR_getmsg 151 SunOS Specific */ /* #define __NR_putmsg 152 SunOS Specific */ #define __NR_poll 153 /* Common */ -/* #define __NR_ni_syscall 154 ENOSYS under SunOS */ +#define __NR_getdents64 154 /* Linux specific */ /* #define __NR_nfssvc 155 SunOS Specific */ /* #define __NR_getdirentries 156 SunOS Specific */ #define __NR_statfs 157 /* Common */ diff --git a/include/linux/dirent.h b/include/linux/dirent.h index a18f7e4630e0..bef1120cba96 100644 --- a/include/linux/dirent.h +++ b/include/linux/dirent.h @@ -8,4 +8,12 @@ struct dirent { char d_name[256]; /* We must not include limits.h! */ }; +struct dirent64 { + __u64 d_ino; + __s64 d_off; + unsigned short d_reclen; + unsigned char d_type; + char d_name[256]; +}; + #endif diff --git a/include/linux/file.h b/include/linux/file.h index a206b616bfe2..a2ba66eb9dbe 100644 --- a/include/linux/file.h +++ b/include/linux/file.h @@ -30,15 +30,6 @@ static inline struct file * fcheck(unsigned int fd) return file; } -static inline struct file * frip(struct files_struct *files, unsigned int fd) -{ - struct file * file = NULL; - - if (fd < files->max_fds) - file = xchg(&files->fd[fd], NULL); - return file; -} - extern void put_filp(struct file *); extern int get_unused_fd(void); @@ -67,18 +58,20 @@ static inline void put_unused_fd(unsigned int fd) * array. At any such point, we are vulnerable to a dup2() race * installing a file in the array before us. We need to detect this and * fput() the struct file we are about to overwrite in this case. + * + * It should never happen - if we allow dup2() do it, _really_ bad things + * will follow. */ static inline void fd_install(unsigned int fd, struct file * file) { struct files_struct *files = current->files; - struct file * result; write_lock(&files->file_lock); - result = xchg(&files->fd[fd], file); + if (files->fd[fd]) + BUG(); + files->fd[fd] = file; write_unlock(&files->file_lock); - if (result) - fput(result); } void put_files_struct(struct files_struct *fs); diff --git a/include/linux/fs.h b/include/linux/fs.h index 570aecf20906..4905550fd4af 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -535,6 +535,7 @@ struct file_lock { #ifndef OFFSET_MAX #define INT_LIMIT(x) (~((x)1 << (sizeof(x)*8 - 1))) #define OFFSET_MAX INT_LIMIT(loff_t) +#define OFFT_OFFSET_MAX INT_LIMIT(off_t) #endif extern struct list_head file_lock_list; @@ -544,6 +545,9 @@ extern struct list_head file_lock_list; extern int fcntl_getlk(unsigned int, struct flock *); extern int fcntl_setlk(unsigned int, unsigned int, struct flock *); +extern int fcntl_getlk64(unsigned int, struct flock64 *); +extern int fcntl_setlk64(unsigned int, unsigned int, struct flock64 *); + /* fs/locks.c */ extern void locks_remove_posix(struct file *, fl_owner_t); extern void locks_remove_flock(struct file *); @@ -693,13 +697,26 @@ extern int vfs_rmdir(struct inode *, struct dentry *); extern int vfs_unlink(struct inode *, struct dentry *); extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); +/* + * File types + */ +#define DT_UNKNOWN 0 +#define DT_FIFO 1 +#define DT_CHR 2 +#define DT_DIR 4 +#define DT_BLK 6 +#define DT_REG 8 +#define DT_LNK 10 +#define DT_SOCK 12 +#define DT_WHT 14 + /* * This is the "filldir" function type, used by readdir() to let * the kernel specify what kind of dirent layout it wants to have. * This allows the kernel to read directories into kernel space or * to have different dirent layouts depending on the binary type. */ -typedef int (*filldir_t)(void *, const char *, int, off_t, ino_t); +typedef int (*filldir_t)(void *, const char *, int, off_t, ino_t, unsigned); struct block_device_operations { int (*open) (struct inode *, struct file *); @@ -875,7 +892,6 @@ static inline int locks_verify_truncate(struct inode *inode, asmlinkage long sys_open(const char *, int, int); asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */ -extern int do_close(struct files_struct *, unsigned int, int); /* yes, it's really unsigned */ extern int do_truncate(struct dentry *, loff_t start); extern struct file *filp_open(const char *, int, int); diff --git a/include/linux/mm.h b/include/linux/mm.h index a248e939f749..f606186cfcbc 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -384,7 +384,6 @@ extern void si_meminfo(struct sysinfo * val); extern void swapin_readahead(swp_entry_t); /* mmap.c */ -extern void vma_init(void); extern void merge_segments(struct mm_struct *, unsigned long, unsigned long); extern void insert_vm_struct(struct mm_struct *, struct vm_area_struct *); extern void build_mmap_avl(struct mm_struct *); diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index 26e8edd22666..dacab21982d8 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h @@ -57,7 +57,7 @@ struct readdir_cd { char dotonly; }; typedef int (*encode_dent_fn)(struct readdir_cd *, const char *, - int, off_t, ino_t); + int, off_t, ino_t, unsigned int); typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int); /* diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h index 323c62b83d67..4bb4f668bf7c 100644 --- a/include/linux/nfsd/xdr.h +++ b/include/linux/nfsd/xdr.h @@ -151,7 +151,7 @@ int nfssvc_encode_statfsres(struct svc_rqst *, u32 *, struct nfsd_statfsres *); int nfssvc_encode_readdirres(struct svc_rqst *, u32 *, struct nfsd_readdirres *); int nfssvc_encode_entry(struct readdir_cd *, const char *name, - int namlen, off_t offset, ino_t ino); + int namlen, off_t offset, ino_t ino, unsigned int); int nfssvc_release_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *); diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h index f3e72151c04f..a5ca90410204 100644 --- a/include/linux/nfsd/xdr3.h +++ b/include/linux/nfsd/xdr3.h @@ -292,9 +292,11 @@ int nfs3svc_release_fhandle(struct svc_rqst *, u32 *, int nfs3svc_release_fhandle2(struct svc_rqst *, u32 *, struct nfsd3_fhandle_pair *); int nfs3svc_encode_entry(struct readdir_cd *, const char *name, - int namlen, off_t offset, ino_t ino); + int namlen, off_t offset, ino_t ino, + unsigned int); int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name, - int namlen, off_t offset, ino_t ino); + int namlen, off_t offset, ino_t ino, + unsigned int); #endif /* _LINUX_NFSD_XDR3_H */ diff --git a/include/linux/sched.h b/include/linux/sched.h index e8450e8a4939..b6f3d37d9e93 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -541,6 +541,7 @@ extern void FASTCALL(wake_up_process(struct task_struct * tsk)); extern int in_group_p(gid_t); extern int in_egroup_p(gid_t); +extern void proc_caches_init(void); extern void flush_signals(struct task_struct *); extern void flush_signal_handlers(struct task_struct *); extern int dequeue_signal(sigset_t *, siginfo_t *); diff --git a/include/linux/slab.h b/include/linux/slab.h index 76ccf2dbb074..4f4818873b58 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -73,6 +73,8 @@ extern kmem_cache_t *files_cachep; extern kmem_cache_t *filp_cachep; extern kmem_cache_t *dquot_cachep; extern kmem_cache_t *bh_cachep; +extern kmem_cache_t *fs_cachep; +extern kmem_cache_t *sigact_cachep; #ifdef CONFIG_SMP extern unsigned long slab_cache_drain_mask; diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h index 3c8f1d415cf6..04e4a8a7c7d6 100644 --- a/include/linux/ufs_fs.h +++ b/include/linux/ufs_fs.h @@ -250,19 +250,6 @@ struct ufs_timeval { __s32 tv_usec; }; -/* - * File types - */ -#define DT_UNKNOWN 0 -#define DT_FIFO 1 -#define DT_CHR 2 -#define DT_DIR 4 -#define DT_BLK 6 -#define DT_REG 8 -#define DT_LNK 10 -#define DT_SOCK 12 -#define DT_WHT 14 - struct ufs_dir_entry { __u32 d_ino; /* inode number of this entry */ __u16 d_reclen; /* length of this entry */ diff --git a/init/main.c b/init/main.c index cfe26ace9e77..26a3d3ad5b59 100644 --- a/init/main.c +++ b/init/main.c @@ -562,8 +562,8 @@ asmlinkage void __init start_kernel(void) mempages = num_physpages; fork_init(mempages); + proc_caches_init(); vfs_caches_init(mempages); - vma_init(); buffer_init(mempages); page_cache_init(mempages); kiobuf_setup(); diff --git a/ipc/shm.c b/ipc/shm.c index 86eb539f703c..87f37c3ed9df 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -438,12 +438,12 @@ static int shm_readdir (struct file *filp, void *dirent, filldir_t filldir) switch(nr) { case 0: - if (filldir(dirent, ".", 1, nr, inode->i_ino) < 0) + if (filldir(dirent, ".", 1, nr, inode->i_ino, DT_DIR) < 0) return 0; filp->f_pos = ++nr; /* fall through */ case 1: - if (filldir(dirent, "..", 2, nr, inode->i_ino) < 0) + if (filldir(dirent, "..", 2, nr, inode->i_ino, DT_DIR) < 0) return 0; filp->f_pos = ++nr; /* fall through */ @@ -456,7 +456,7 @@ static int shm_readdir (struct file *filp, void *dirent, filldir_t filldir) continue; if (shp->shm_flags & SHM_UNLK) continue; - if (filldir(dirent, shp->shm_name, shp->shm_namelen, nr, nr) < 0 ) + if (filldir(dirent, shp->shm_name, shp->shm_namelen, nr, nr, DT_REG) < 0 ) break;; } filp->f_pos = nr; diff --git a/kernel/exit.c b/kernel/exit.c index 18b8158bf8a2..ea7f310fb2d8 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -229,7 +229,7 @@ static inline void __put_fs_struct(struct fs_struct *fs) dput(fs->altroot); mntput(fs->altrootmnt); } - kfree(fs); + kmem_cache_free(fs_cachep, fs); } } @@ -264,7 +264,7 @@ static inline void __exit_sighand(struct task_struct *tsk) tsk->sig = NULL; spin_unlock_irq(&tsk->sigmask_lock); if (atomic_dec_and_test(&sig->count)) - kfree(sig); + kmem_cache_free(sigact_cachep, sig); } flush_signals(tsk); diff --git a/kernel/fork.c b/kernel/fork.c index 3bb7ab55a8ea..e84aa43fd259 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -32,9 +32,6 @@ int max_threads; unsigned long total_forks; /* Handle normal Linux uptimes. */ int last_pid; -/* SLAB cache for mm_struct's. */ -kmem_cache_t *mm_cachep; - struct task_struct *pidhash[PIDHASH_SZ]; void add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait) @@ -341,7 +338,7 @@ fail_nomem: static inline struct fs_struct *__copy_fs_struct(struct fs_struct *old) { - struct fs_struct *fs = kmalloc(sizeof(*old), GFP_KERNEL); + struct fs_struct *fs = kmem_cache_alloc(fs_cachep, GFP_KERNEL); /* We don't need to lock fs - think why ;-) */ if (fs) { atomic_set(&fs->count, 1); @@ -507,7 +504,7 @@ static inline int copy_sighand(unsigned long clone_flags, struct task_struct * t atomic_inc(¤t->sig->count); return 0; } - tsk->sig = kmalloc(sizeof(*tsk->sig), GFP_KERNEL); + tsk->sig = kmem_cache_alloc(sigact_cachep, GFP_KERNEL); if (!tsk->sig) return -1; spin_lock_init(&tsk->sig->siglock); @@ -699,3 +696,51 @@ bad_fork_free: free_task_struct(p); goto bad_fork; } + +/* SLAB cache for signal_struct structures (tsk->sig) */ +kmem_cache_t *sigact_cachep; + +/* SLAB cache for files_struct structures (tsk->files) */ +kmem_cache_t *files_cachep; + +/* SLAB cache for fs_struct structures (tsk->fs) */ +kmem_cache_t *fs_cachep; + +/* SLAB cache for vm_area_struct structures */ +kmem_cache_t *vm_area_cachep; + +/* SLAB cache for mm_struct structures (tsk->mm) */ +kmem_cache_t *mm_cachep; + +void __init proc_caches_init(void) +{ + sigact_cachep = kmem_cache_create("signal_act", + sizeof(struct signal_struct), 0, + SLAB_HWCACHE_ALIGN, NULL, NULL); + if (!sigact_cachep) + panic("Cannot create signal action SLAB cache"); + + files_cachep = kmem_cache_create("files_cache", + sizeof(struct files_struct), 0, + SLAB_HWCACHE_ALIGN, NULL, NULL); + if (!files_cachep) + panic("Cannot create files SLAB cache"); + + fs_cachep = kmem_cache_create("fs_cache", + sizeof(struct fs_struct), 0, + SLAB_HWCACHE_ALIGN, NULL, NULL); + if (!fs_cachep) + panic("Cannot create fs_struct SLAB cache"); + + vm_area_cachep = kmem_cache_create("vm_area_struct", + sizeof(struct vm_area_struct), 0, + SLAB_HWCACHE_ALIGN, NULL, NULL); + if(!vm_area_cachep) + panic("vma_init: Cannot alloc vm_area_struct SLAB cache"); + + mm_cachep = kmem_cache_create("mm_struct", + sizeof(struct mm_struct), 0, + SLAB_HWCACHE_ALIGN, NULL, NULL); + if(!mm_cachep) + panic("vma_init: Cannot alloc mm_struct SLAB cache"); +} diff --git a/mm/mmap.c b/mm/mmap.c index d3e596d256f6..9667d19dbfab 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -36,9 +36,6 @@ pgprot_t protection_map[16] = { __S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111 }; -/* SLAB cache for vm_area_struct's. */ -kmem_cache_t *vm_area_cachep; - int sysctl_overcommit_memory; /* Check that a process has enough memory to allocate a @@ -994,20 +991,3 @@ void merge_segments (struct mm_struct * mm, unsigned long start_addr, unsigned l mpnt = prev; } } - -void __init vma_init(void) -{ - vm_area_cachep = kmem_cache_create("vm_area_struct", - sizeof(struct vm_area_struct), - 0, SLAB_HWCACHE_ALIGN, - NULL, NULL); - if(!vm_area_cachep) - panic("vma_init: Cannot alloc vm_area_struct cache."); - - mm_cachep = kmem_cache_create("mm_struct", - sizeof(struct mm_struct), - 0, SLAB_HWCACHE_ALIGN, - NULL, NULL); - if(!mm_cachep) - panic("vma_init: Cannot alloc mm_struct cache."); -} diff --git a/mm/slab.c b/mm/slab.c index 81543069898e..ed5d018f1729 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -843,21 +843,17 @@ static kmem_cache_t *cache_to_drain = NULL; static DECLARE_WAIT_QUEUE_HEAD(cache_drain_wait); unsigned long slab_cache_drain_mask; -static void drain_cpu_caches(kmem_cache_t *cachep) +/* + * Waits for all CPUs to execute slab_drain_local_cache(). + * Caller must be holding cache_drain_sem. + */ +static void slab_drain_all_sync(void) { DECLARE_WAITQUEUE(wait, current); - unsigned long cpu_mask = 0; - int i; - - for (i = 0; i < smp_num_cpus; i++) - cpu_mask |= (1UL << cpu_logical_map(i)); - - down(&cache_drain_sem); - - cache_to_drain = cachep; - slab_cache_drain_mask = cpu_mask; + local_irq_disable(); slab_drain_local_cache(); + local_irq_enable(); add_wait_queue(&cache_drain_wait, &wait); current->state = TASK_UNINTERRUPTIBLE; @@ -865,7 +861,21 @@ static void drain_cpu_caches(kmem_cache_t *cachep) schedule(); current->state = TASK_RUNNING; remove_wait_queue(&cache_drain_wait, &wait); +} + +static void drain_cpu_caches(kmem_cache_t *cachep) +{ + unsigned long cpu_mask = 0; + int i; + for (i = 0; i < smp_num_cpus; i++) + cpu_mask |= (1UL << cpu_logical_map(i)); + + down(&cache_drain_sem); + + cache_to_drain = cachep; + slab_cache_drain_mask = cpu_mask; + slab_drain_all_sync(); cache_to_drain = NULL; up(&cache_drain_sem); @@ -1594,7 +1604,6 @@ static ccupdate_struct_t *ccupdate_state = NULL; /* Called from per-cpu timer interrupt. */ void slab_drain_local_cache(void) { - local_irq_disable(); if (ccupdate_state != NULL) { ccupdate_struct_t *new = ccupdate_state; cpucache_t *old = cc_data(new->cachep); @@ -1610,7 +1619,6 @@ void slab_drain_local_cache(void) cc->avail = 0; } } - local_irq_enable(); clear_bit(smp_processor_id(), &slab_cache_drain_mask); if (slab_cache_drain_mask == 0) @@ -1619,7 +1627,6 @@ void slab_drain_local_cache(void) static void do_ccupdate(ccupdate_struct_t *data) { - DECLARE_WAITQUEUE(wait, current); unsigned long cpu_mask = 0; int i; @@ -1630,16 +1637,7 @@ static void do_ccupdate(ccupdate_struct_t *data) ccupdate_state = data; slab_cache_drain_mask = cpu_mask; - - slab_drain_local_cache(); - - add_wait_queue(&cache_drain_wait, &wait); - current->state = TASK_UNINTERRUPTIBLE; - while (slab_cache_drain_mask != 0UL) - schedule(); - current->state = TASK_RUNNING; - remove_wait_queue(&cache_drain_wait, &wait); - + slab_drain_all_sync(); ccupdate_state = NULL; up(&cache_drain_sem); diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index d6b2a9d915ed..9a85476c1362 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -58,7 +58,6 @@ * J Hadi Salim: ECN support */ -#include #include #include #include