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
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
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
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
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
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
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.
while(1)
{
write(fd,"\0",1);
+ fsync(fd);
sleep(10);
}
}
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
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
endif
export MODVERFILE
-depend dep: dep-files $(MODVERFILE)
+depend dep: dep-files
# make checkconfig: Prune 'scripts' directory to avoid "false positives".
checkconfig:
$(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 <linux/modsetver.h>"; \
if [ -f $$f ]; then echo "#include <linux/modules/$${f}>"; 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
.quad sys_pivot_root
.quad sys_mincore /* 375 */
.quad sys_pciconfig_iobase
+ .quad sys_getdents64
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;
.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
# 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
.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
* 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
};
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;
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
.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)
SYS(sys_pivot_root, 2)
SYS(sys_mincore, 3)
SYS(sys_madvise, 3)
+SYS(sys_getdents64, 3)
#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 =
#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 =
PTR sys_pivot_root /* 4210 */
PTR sys_mincore
PTR sys_madvise
+ PTR sys_getdents64
sys sys_pivot_root 2
sys sys_mincore 3
sys sys_madvise 3
+ sys sys_getdents64 3
.endm
.macro sys function, nargs
.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
.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
.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
* 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
#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;
};
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;
/*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
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;
#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;
};
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;
.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
.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
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
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
* 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 <linux/tty.h>
#include <linux/serial.h>
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;
port->xmit_cnt++; /* Characters in buffer */
RELEASEIT;
- /* func_exit ();*/
+ func_exit ();
}
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;
port->flags |= GS_TX_INTEN;
port->rd->enable_tx_interrupts (port);
}
- /* func_exit (); */
+ func_exit ();
return total;
}
#else
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;
}
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. */
}
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: ");
}
gs_dprintk (GS_DEBUG_FLUSH, "charsleft = %d.\n", charsleft);
- current->state = TASK_RUNNING;
+ set_current_state (TASK_RUNNING);
func_exit();
return rv;
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;
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 ();
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) ) {
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 &&
void gs_shutdown_port (struct gs_port *port)
{
long flags;
+
func_enter();
+
+ if (!port) return;
+
if (!(port->flags & ASYNC_INITIALIZED))
return;
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;
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)) &&
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
else
return -ERESTARTSYS;
}
+
gs_dprintk (GS_DEBUG_BTR, "after hung up\n");
/*
}
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.
}
gs_dprintk (GS_DEBUG_BTR, "after nonblock\n");
+
if (port->flags & ASYNC_CALLOUT_ACTIVE) {
if (port->normal_termios.c_cflag & CLOCAL)
do_clocal = 1;
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
* 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))
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)
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. */
}
save_flags(flags); cli();
+
if (tty_hung_up_p(filp)) {
restore_flags(flags);
port->rd->hungup (port);
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);
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);
--- /dev/null
+/*
+ * i810-tco 0.02: TCO timer driver for i810 chipsets
+ *
+ * (c) Copyright 2000 kernel concepts <nils@kernelconcepts.de>, 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 <nils@kernelconcepts.de>
+ * developed for
+ * Jentro AG, Haar/Munich (Germany)
+ *
+ * TCO timer driver for i810/i815 chipsets
+ * based on softdog.c by Alan Cox <alan@redhat.com>
+ *
+ * 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 <linux/module.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/fs.h>
+#include <linux/mm.h>
+#include <linux/miscdevice.h>
+#include <linux/watchdog.h>
+#include <linux/reboot.h>
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <linux/ioport.h>
+#include <asm/uaccess.h>
+#include <asm/io.h>
+#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<n<64. Default is 30 seconds */
+
+static unsigned int ACPIBASE;
+
+static int i810_margin = TIMER_MARGIN; /* steps of 0.6sec */
+
+MODULE_PARM (i810_margin, "i");
+
+/*
+ * Timer active flag
+ */
+
+static int timer_alive;
+static int boot_status;
+
+/*
+ * Some i810 specific functions
+ */
+
+
+/*
+ * Start the timer countdown
+ */
+static int tco_timer_start (void)
+{
+ unsigned char val;
+
+ val = inb (TCO1_CNT + 1);
+ val &= 0xf7;
+ outb (val, TCO1_CNT + 1);
+ val = inb (TCO1_CNT + 1);
+ if (val & 0x08)
+ return -1;
+ return 0;
+}
+
+/*
+ * Stop the timer countdown
+ */
+static int tco_timer_stop (void)
+{
+ unsigned char val;
+
+ val = inb (TCO1_CNT + 1);
+ val |= 0x08;
+ outb (val, TCO1_CNT + 1);
+ val = inb (TCO1_CNT + 1);
+ if ((val & 0x08) == 0)
+ return -1;
+ return 0;
+}
+
+/*
+ * Set the timer reload value
+ */
+static int tco_timer_settimer (unsigned char tmrval)
+{
+ unsigned char val;
+
+ /* from the specs: */
+ /* "Values of 0h-3h are ignored and should not be attempted" */
+ if (tmrval > 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);
--- /dev/null
+/*
+ * i810-tco 0.02: TCO timer driver for i810 chipsets
+ *
+ * (c) Copyright 2000 kernel concepts <nils@kernelconcepts.de>, 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 <nils@kernelconcepts.de>
+ * developed for
+ * Jentro AG, Haar/Munich (Germany)
+ *
+ * TCO timer driver for i810 chipsets
+ * based on softdog.c by Alan Cox <alan@redhat.com>
+ *
+ * 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 */
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
#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
#ifndef TWO_ZERO
#ifdef MODULE
+MODULE_AUTHOR("Rogier Wolff <R.E.Wolff@bitwizard.nl>, Patrick van de Lageweg <patrick@bitwizard.nl>");
+MODULE_DESCRIPTION("RIO driver");
MODULE_PARM(rio_poll, "i");
MODULE_PARM(rio_debug, "i");
MODULE_PARM(rio_irqmask, "i");
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 ();
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
static void rio_hungup (void *ptr)
{
func_enter ();
- /* rio_dec_mod_count (); */
+ rio_dec_mod_count ();
func_exit ();
}
*/
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 ();
}
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. */
return -ENOMEM;
}
-
+#ifdef MODULE
static void rio_release_drivers(void)
{
func_enter();
tty_unregister_driver (&rio_driver);
func_exit();
}
+#endif
#ifdef TWO_ZERO
#define PDEV unsigned char pci_bus, unsigned pci_fun
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,
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);
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,
#define RIO_PORTSPERBOARD 128
#define RIO_NPORTS (RIO_NBOARDS * RIO_PORTSPERBOARD)
+#define MODEM_SUPPORT
+
#ifdef __KERNEL__
#define RIO_MAGIC 0x12345678
#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
*/
#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__ \
"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 ();
}
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 ();
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 ();
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
** 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;
/*
** 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
** 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;
}
/*
HostP = NULL; /* Assure the compiler we've initialized it */
for ( host=0; host<p->RIONumHosts; 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;
}
*/
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;
** 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
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;
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;
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 !
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
*/
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
*/
for ( wait_count=0; (wait_count<p->RIOConf.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);
}
** 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; \
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
** 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
** 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;
}
** 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_count<p->RIOConf.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.
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; RupN<LINKS_PER_UNIT; RupN++ ) {
HostP->UnixRups[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;
}
/*
}
}
- 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
*/
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;
}
** 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;
}
** 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;
}
** 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;
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
*/
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 );
}
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;
}
*/
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
*/
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;
}
}
}
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 )
{
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;
** + 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++ )
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;
}
*/
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) )
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;
}
}
{
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 =
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
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 |
{
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;
{
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;
}
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;
{
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;
}
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;
{
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);
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;
}
*/
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;
}
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;
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;
}
CmdBlkP = RIOGetCmdBlk();
if ( !CmdBlkP ) {
- rio_dprint(RIO_DEBUG_CMD, ("UFOAD: GetCmdBlk failed\n"));
+ rio_dprintk (RIO_DEBUG_CMD, "UFOAD: GetCmdBlk failed\n");
return ENXIO;
}
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;
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;
{
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;
}
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;
ushort subCommand;
unsigned long flags;
+ func_enter ();
#ifdef CHECK
CheckHost( Host );
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;
}
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
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 :
}
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:
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.
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 ) {
** 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
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;
}
/*
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;
}
** 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!
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;
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);
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 );
}
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);
}
** 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.
** 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.
*/
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));
** 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);
#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 ) {
{
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;
{
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;
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) {
/*
** 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;
*/
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");
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;
/*
** 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; entry<TOTAL_MAP_ENTRIES; entry++ )
{
if ((p->RIOConnectTable[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;
/*
** 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;
}
** 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;
}
** 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;
}
** 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;
}
** 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;
}
}
*/
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;
}
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;
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;
}
*/
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;
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 )
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;
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;
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 ) {
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
}
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;
}
}
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;
}
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;
}
** 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;
}
** 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;
}
/*
** 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;
}
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;
}
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;
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;
}
}
(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;
}
** 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;
** 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;
** 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;
}
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;
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;
}
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;
}
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;
}
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;
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;
}
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;
}
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;
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;
}
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;
}
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;
}
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;
}
/*
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 ();
#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];
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:
** 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;
#include "control.h"
#include "cirrus.h"
#include "rioioctl.h"
-
+#include "rio_linux.h"
#undef bcopy
#define bcopy rio_pcicopy
*/
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 */
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
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
** 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);
}
** 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);
}
}
((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
** 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);
/*
*/
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!
*/
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
/*
** 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 )
{
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
/*
** 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;
}
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");
/*
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<<RIO_EISA);
switch ( Ivec & EISA_INTERRUPT_MASK )
{
case EISA_IRQ_3:
- rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"EISA IRQ 3\n");
+ rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 3\n");
break;
case EISA_IRQ_4:
- rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"EISA IRQ 4\n");
+ rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 4\n");
break;
case EISA_IRQ_5:
- rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"EISA IRQ 5\n");
+ rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 5\n");
break;
case EISA_IRQ_6:
- rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"EISA IRQ 6\n");
+ rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 6\n");
break;
case EISA_IRQ_7:
- rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"EISA IRQ 7\n");
+ rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 7\n");
break;
case EISA_IRQ_9:
- rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"EISA IRQ 9\n");
+ rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 9\n");
break;
case EISA_IRQ_10:
- rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"EISA IRQ 10\n");
+ rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 10\n");
break;
case EISA_IRQ_11:
- rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"EISA IRQ 11\n");
+ rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 11\n");
break;
case EISA_IRQ_12:
- rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"EISA IRQ 12\n");
+ rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 12\n");
break;
case EISA_IRQ_14:
- rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"EISA IRQ 14\n");
+ rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 14\n");
break;
case EISA_IRQ_15:
- rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"EISA IRQ 15\n");
+ rio_dprintk (RIO_DEBUG_INIT, "EISA IRQ 15\n");
break;
case EISA_POLLED:
- rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,"EISA POLLED\n");
+ rio_dprintk (RIO_DEBUG_INIT, "EISA POLLED\n");
break;
default:
- rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT|DBG_FAIL,"Shagged interrupt number!\n");
+ rio_dprintk (RIO_DEBUG_INIT, NULL,DBG_INIT|DBG_FAIL,"Shagged interrupt number!\n");
Ivec &= EISA_CONTROL_MASK;
}
#endif
*/
Ivec = RIOEisaToIvec(Ivec);
- rio_dprint(RIO_DEBUG_INIT, NULL, DBG_INIT, "EISA host in slot %d has Ivec 0x%x\n",
+ rio_dprintk (RIO_DEBUG_INIT, "EISA host in slot %d has Ivec 0x%x\n",
EisaSlot, Ivec);
/*
Paddr = (INBZ(EisaSlot,EISA_MEMORY_BASE_HI)<<24) |
(INBZ(EisaSlot,EISA_MEMORY_BASE_LO)<<16);
- rio_dprint(RIO_DEBUG_INIT, NULL, DBG_INIT,"EISA card has Ivec %d Addr %x\n",Ivec,Paddr);
+ rio_dprintk (RIO_DEBUG_INIT, "EISA card has Ivec %d Addr %x\n", Ivec, Paddr);
if ( Paddr == 0 )
{
- rio_dprint(RIO_DEBUG_INIT, NULL, DBG_INIT | DBG_FAIL,
+ rio_dprintk (RIO_DEBUG_INIT,
"Board in slot %d configured for address zero!\n", EisaSlot);
continue;
}
/*
** Tell the memory mapper that we want to talk to it
*/
- rio_dprint(RIO_DEBUG_INIT, NULL, DBG_INIT,"About to map EISA card \n");
+ rio_dprintk (RIO_DEBUG_INIT, "About to map EISA card \n");
if (RIOMapin( Paddr, RIO_EISA_MEM_SIZE, &Caddr) == -1) {
- rio_dprint(RIO_DEBUG_INIT, NULL,DBG_FAIL,"Couldn't map %d bytes at %x\n",
+ rio_dprintk (RIO_DEBUG_INIT, "Couldn't map %d bytes at %x\n",
RIO_EISA_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_EISA,EisaSlot) == RIO_SUCCESS )
{
- rio_dprint(RIO_DEBUG_INIT, NULL, DBG_INIT,"Board has passed test\n");
- rio_dprint(RIO_DEBUG_INIT, NULL,DBG_INIT,
+ rio_dprintk (RIO_DEBUG_INIT, "Board has passed test\n");
+ rio_dprintk (RIO_DEBUG_INIT,
"Slot %d. Ivec %d. Type %d. Paddr 0x%x. Caddr 0x%x. Mode 0x%x.\n",
EisaSlot,Ivec,RIO_EISA,Paddr,Caddr,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_EISA_MEM_SIZE, Caddr );
}
int Handle; /* Handle to Virtual memory allocated for current PCI host */
- rio_dprint(RIO_DEBUG_INIT, ("Search for a RIO PCI card - start at slot %d\n", slot ) );
+ rio_dprintk (RIO_DEBUG_INIT, "Search for a RIO PCI card - start at slot %d\n", slot);
/*
** Initialise the search status
while ( (slot < MAX_PCI_SLOT) & (p->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;
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;
}
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;
}
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
((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++;
}
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);
}
int host;
for ( host=0; host<p->RIONumHosts; 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 );
}
}
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);
** 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;
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]);
}
/*
for (op=0; op<TEST_END; op++) {
for (bank=0; bank<nbanks; bank++) {
if (RIOScrub(op, (BYTE *)ram[bank], size[bank]) == RIO_FAIL) {
- rio_dprint(RIO_DEBUG_INIT, ("RIO-init: RIOScrub band %d, op %d failed\n",
- bank, op));
+ rio_dprintk (RIO_DEBUG_INIT, "RIO-init: RIOScrub band %d, op %d failed\n",
+ bank, op);
return RIO_FAIL;
}
}
}
- rio_dprint(RIO_DEBUG_INIT, ("Test completed\n"));
+ rio_dprintk (RIO_DEBUG_INIT, "Test completed\n");
return RIO_SUCCESS;
}
if (op) {
for (off=0; off<size; off++) {
if (RBYTE(ram[off]) != oldbyte) {
- rio_dprint(RIO_DEBUG_INIT, ("RIO-init: Byte Pre Check 1: BYTE at offset 0x%x should have been=%x, was=%x\n", off, oldbyte, RBYTE(ram[off])));
+ rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Pre Check 1: BYTE at offset 0x%x should have been=%x, was=%x\n", off, oldbyte, RBYTE(ram[off]));
return RIO_FAIL;
}
}
for (off=0; off<size; off+=2) {
if (*(ushort *)&ram[off] != oldword) {
- rio_dprint(RIO_DEBUG_INIT, ("RIO-init: Word Pre Check: WORD at offset 0x%x should have been=%x, was=%x\n",off,oldword,*(ushort *)&ram[off]));
- rio_dprint(RIO_DEBUG_INIT, ("RIO-init: Word Pre Check: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n",off,RBYTE(ram[off]),off+1,RBYTE(ram[off+1])));
+ rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Pre Check: WORD at offset 0x%x should have been=%x, was=%x\n",off,oldword,*(ushort *)&ram[off]);
+ rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Pre Check: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, RBYTE(ram[off]), off+1, RBYTE(ram[off+1]));
return RIO_FAIL;
}
}
*/
for (off=0; off<size; off++) {
if (op && (RBYTE(ram[off]) != oldbyte)) {
- rio_dprint(RIO_DEBUG_INIT, ("RIO-init: Byte Pre Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n",off,oldbyte,RBYTE(ram[off])));
+ rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Pre Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off, oldbyte, RBYTE(ram[off]));
return RIO_FAIL;
}
WBYTE(ram[off],invbyte);
if (RBYTE(ram[off]) != invbyte) {
- rio_dprint(RIO_DEBUG_INIT, ("RIO-init: Byte Inv Check: BYTE at offset 0x%x should have been=%x, was=%x\n",off,invbyte,RBYTE(ram[off])));
+ rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Inv Check: BYTE at offset 0x%x should have been=%x, was=%x\n", off, invbyte, RBYTE(ram[off]));
return RIO_FAIL;
}
}
*/
for (off=0; off<size; off+=2) {
if (*(ushort *)&ram[off] != invword) {
- rio_dprint(RIO_DEBUG_INIT, ("RIO-init: Word Inv Check: WORD at offset 0x%x should have been=%x, was=%x\n",off,invword,*(ushort *)&ram[off]));
- rio_dprint(RIO_DEBUG_INIT, ("RIO-init: Word Inv Check: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n",off,RBYTE(ram[off]),off+1,RBYTE(ram[off+1])));
+ rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Inv Check: WORD at offset 0x%x should have been=%x, was=%x\n", off, invword, *(ushort *)&ram[off]);
+ rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Inv Check: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, RBYTE(ram[off]), off+1, RBYTE(ram[off+1]));
return RIO_FAIL;
}
*(ushort *)&ram[off] = newword;
if ( *(ushort *)&ram[off] != newword ) {
- rio_dprint(RIO_DEBUG_INIT, ("RIO-init: Post Word Check 1: WORD at offset 0x%x should have been=%x, was=%x\n",off,newword,*(ushort *)&ram[off]));
- rio_dprint(RIO_DEBUG_INIT, ("RIO-init: Post Word Check 1: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n",off,RBYTE(ram[off]),off+1,RBYTE(ram[off+1])));
+ rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 1: WORD at offset 0x%x should have been=%x, was=%x\n", off, newword, *(ushort *)&ram[off]);
+ rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 1: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, RBYTE(ram[off]), off+1, RBYTE(ram[off+1]));
return RIO_FAIL;
}
}
*/
for (off=0; off<size; off++) {
if (RBYTE(ram[off]) != newbyte) {
- rio_dprint(RIO_DEBUG_INIT, ("RIO-init: Post Byte Check: BYTE at offset 0x%x should have been=%x, was=%x\n",off,newbyte,RBYTE(ram[off])));
+ rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Byte Check: BYTE at offset 0x%x should have been=%x, was=%x\n", off, newbyte, RBYTE(ram[off]));
return RIO_FAIL;
}
}
for (off=0; off<size; off+=2) {
if ( *(ushort *)&ram[off] != newword ) {
- rio_dprint(RIO_DEBUG_INIT, ("RIO-init: Post Word Check 2: WORD at offset 0x%x should have been=%x, was=%x\n",off,newword,*(ushort *)&ram[off]));
- rio_dprint(RIO_DEBUG_INIT, ("RIO-init: Post Word Check 2: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n",off,RBYTE(ram[off]),off+1,RBYTE(ram[off+1])));
+ rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 2: WORD at offset 0x%x should have been=%x, was=%x\n", off, newword, *(ushort *)&ram[off]);
+ rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 2: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, RBYTE(ram[off]), off+1, RBYTE(ram[off+1]));
return RIO_FAIL;
}
}
for ( off=0; off<size; off+=2 ) {
if (*(ushort *)&ram[off] != swapword) {
- rio_dprint(RIO_DEBUG_INIT, ("RIO-init: SwapWord Check 1: WORD at offset 0x%x should have been=%x, was=%x\n",off,swapword,*((ushort *)&ram[off])));
- rio_dprint(RIO_DEBUG_INIT, ("RIO-init: SwapWord Check 1: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n",off,RBYTE(ram[off]),off+1,RBYTE(ram[off+1])));
+ rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 1: WORD at offset 0x%x should have been=%x, was=%x\n", off, swapword, *((ushort *)&ram[off]));
+ rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 1: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, RBYTE(ram[off]), off+1, RBYTE(ram[off+1]));
return RIO_FAIL;
}
*((ushort *)&ram[off]) = ~swapword;
for (off=0; off<size; off+=2) {
if (RBYTE(ram[off]) != newbyte) {
- rio_dprint(RIO_DEBUG_INIT, ("RIO-init: SwapWord Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n",off,newbyte,RBYTE(ram[off])));
+ rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off, newbyte, RBYTE(ram[off]));
return RIO_FAIL;
}
if (RBYTE(ram[off+1]) != invbyte) {
- rio_dprint(RIO_DEBUG_INIT, ("RIO-init: SwapWord Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n",off+1,invbyte,RBYTE(ram[off+1])));
+ rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off+1, invbyte, RBYTE(ram[off+1]));
return RIO_FAIL;
}
*((ushort *)&ram[off]) = newword;
p->RIOPortp = (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; port<RIO_PORTS; port++ ) {
p->RIOPortp[port].PortNum = port;
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; host<RIO_HOSTS; host++ ) {
spin_lock_init (&p->RIOHosts[host].HostLock);
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);
}
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;
/*
** 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);
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;
#endif
default:
- rio_dprint(RIO_DEBUG_INIT, (" (UNKNOWN)\n") );
+ rio_dprintk (RIO_DEBUG_INIT, " (UNKNOWN)\n");
break;
}
return;
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;
{ 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! */
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);
}
for ( host=0; host<p->RIONumHosts; 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:
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);
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 );
}
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
** 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 );
}
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.
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.
*/
** 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;
}
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;
}
** 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 &&
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
*/
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 ) {
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;
}
** 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; DataCnt<PKT_MAX_DATA_LEN; DataCnt++ )
- rio_dprint(RIO_DEBUG_INTR, ("%d\n", PacketP->data[DataCnt]));
+ rio_dprintk (RIO_DEBUG_INTR, "%d\n", PacketP->data[DataCnt]);
remove_receive( PortP );
put_free_end( PortP->HostP, PacketP );
continue; /* with next packet */
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
}
}
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);
}
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,
** 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!
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
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");
}
}
/*
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
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");
}
}
/*
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;
/*
** 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.
*/
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
** 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");
}
}
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!
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 );
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;
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;
** 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
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;
}
** 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;
}
** 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;
}
/*
** 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
/* 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!
if ( PortP->State & RIO_DELETED ) {
rio_spin_unlock_irqrestore( &PortP->portSem, flags);
+ func_exit ();
+
return RIO_FAIL;
}
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;
}
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 :
*
************************************************/
- 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);
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);
}
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),
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;
}
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
{
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 )
{
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 )
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;
}
*/
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;
}
*/
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);
** 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 )
*/
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;
}
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);
*/
for ( ThisUnit=0; ThisUnit<MAX_RUP; ThisUnit++ )
{
- rio_dprint(RIO_DEBUG_ROUTE, ("Entry %d Flags=%s %s UniqueNum=0x%x\n",
+ rio_dprintk (RIO_DEBUG_ROUTE, "Entry %d Flags=%s %s UniqueNum=0x%x\n",
ThisUnit,
HostP->Mapping[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.
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
*/
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);
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);
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);
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;
** 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;
}
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);
*/
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);
}
}
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);
}
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; link<LINKS_PER_UNIT; link++) {
unit = HostP->Mapping[UnitId].Topology[link].Unit;
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)); */
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);
}
}
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 );
*/
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,
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
** 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
{
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]);
*/
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;
/*
/*
** 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;
}
** 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;
}
*/
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;
/*
/*
** 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;
/*
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;
** (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;
for ( Entry=0; Entry<TOTAL_MAP_ENTRIES; Entry++ ) {
MapP = &p->RIOConnectTable[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' ) {
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; Host<p->RIONumHosts; Host++ ) { /* (4) */
if ( p->RIOHosts[Host].UniqueNum==MapP->HostUniqueNum ) {
HostP = &p->RIOHosts[Host];
}
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; */
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;
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;
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;
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;
}
}
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;
** 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];
/*
** 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;
}
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
*/
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);
}
}
*/
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;
}
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; Host<RIO_HOSTS; Host++ ) {
- rio_dprint(RIO_DEBUG_TABLE, ("Processing host %d\n", Host));
+ rio_dprintk (RIO_DEBUG_TABLE, "Processing host %d\n", Host);
HostP = &p->RIOHosts[Host];
MapP = &p->RIOConnectTable[Next++];
MapP->HostUniqueNum = HostP->UniqueNum;
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];
for ( entry=0; entry<MAX_RUP; entry++ ) {
if ( MapP->RtaUniqueNum == 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;
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 );
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 );
*/
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++;
}
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;
}
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;
}
{
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;
}
{
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.
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;
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);
}
}
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;
}
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;
}
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
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; SubEnt<PORTS_PER_RTA; SubEnt++) {
- rio_dprint (RIO_DEBUG_TABLE, ("subent = %d, HostMapP->SysPort = %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
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;
}
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;
}
}
}
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;
}
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.
** 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;
** 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;
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;
#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;
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;
}
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 */
** 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;
}
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 ();
}
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); */
** 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"
*/
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;
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
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++;
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;
}
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,
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;
}
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
*/
** 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--;
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;
** 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)
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;
** 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)
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 );
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); */
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;
}
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;
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 )
#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);
** 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;
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 ) {
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;
}
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);
}
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;
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);
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);
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;
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);
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;
** 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);
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;
#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.
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
/*
*/
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);
}
{
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);
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:
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);
} else
sx_dprintk (SX_DEBUG_CLOSE, "sent the force_close command.\n");
}
-
+ */
MOD_DEC_USE_COUNT;
func_exit ();
}
return 0;
}
-
+#ifdef MODULE
static void sx_release_drivers(void)
{
func_enter();
tty_unregister_driver(&sx_callout_driver);
func_exit();
}
+#endif
#ifdef TWO_ZERO
#define PDEV unsigned char pci_bus, unsigned pci_fun
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 */
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;
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.
*/
{
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
{
printk("%s probe at %#x failed to detect IRQ line.\n",
mname, ioaddr);
+ release_region(ioaddr, EL1_IO_EXTENT);
return -EAGAIN;
}
}
*/
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;
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
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)
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 *);
#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},
};
(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;
return -EAGAIN;
}
hardware_init(dev);
+
+ MOD_INC_USE_COUNT;
+
netif_start_queue(dev);
return 0;
}
/* Leave the hardware in a reset state. */
write_reg_high(ioaddr, CMR1, CMR1h_RESET);
+ MOD_DEC_USE_COUNT;
+
return 0;
}
lp->addr_mode = num_addrs ? CMR2h_PROMISC : CMR2h_Normal;
write_reg_high(ioaddr, CMR2, lp->addr_mode);
}
-\f
-/*
- * 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 <becker@scyld.com>");
+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);
+
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 <becker@scyld.com>\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.*/
/* 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 <unsigned>'%'<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. */
#error You must compile this driver with "-O".
#endif
+#include <linux/version.h>
#include <linux/module.h>
+#if LINUX_VERSION_CODE < 0x20300 && defined(MODVERSIONS)
+#include <linux/modversions.h>
+#endif
+
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/timer.h>
#include <asm/bitops.h>
#include <asm/io.h>
-/* 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 <becker@scyld.com>\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 <becker@scyld.com>");
MODULE_DESCRIPTION("SMC 83c170 EPIC series Ethernet driver");
MODULE_PARM(debug, "i");
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
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
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. */
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)) {
* 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;
}
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
duplex = full_duplex[card_idx];
}
- pdev->driver_data = dev;
+ pdev->driver_data = dev;
dev->base_addr = ioaddr;
dev->irq = pdev->irq;
/* 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. */
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
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;
}
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"
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);
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. */
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;
}
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);
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;
#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);
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);
}
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);
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,
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:
- */
}
}
+ lp->stats.tx_bytes += skb->len;
dev->trans_start = jiffies;
dev_kfree_skb(skb);
} else { /* return unused page to the free memory queue */
** 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]++;
--- /dev/null
+/* 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 <becker@scyld.com>\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 <unsigned>'%'<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 <linux/version.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/timer.h>
+#include <linux/errno.h>
+#include <linux/ioport.h>
+#include <linux/malloc.h>
+#include <linux/interrupt.h>
+#include <linux/pci.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/skbuff.h>
+#include <linux/init.h>
+#include <linux/spinlock.h>
+#include <asm/processor.h> /* Processor type for cache alignment. */
+#include <asm/bitops.h>
+#include <asm/io.h>
+
+/* 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 <becker@scyld.com>");
+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.
+*/
+
+\f
+
+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);
+
+\f
+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;
+}
+
+\f
+/* 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));
+}
+
+\f
+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;
+}
+
+\f
+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);
+
Support and updates available at
http://www.scyld.com/network/starfire.html
+ -----------------------------------------------------------
+
Linux kernel-specific changes:
LK1.1.1 (jgarzik):
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 <becker@scyld.com>\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.*/
#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.
/* Include files, designed to support most kernel versions 2.0.0 and later. */
#include <linux/version.h>
#include <linux/module.h>
+#if LINUX_VERSION_CODE < 0x20300 && defined(MODVERSIONS)
+#include <linux/modversions.h>
+#endif
+
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/timer.h>
#include <asm/bitops.h>
#include <asm/io.h>
-/* 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 <becker@scyld.com>\n";
-static char version2[] __devinitdata =
-" Updates and info at http://www.scyld.com/network/starfire.html\n";
-
MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
MODULE_DESCRIPTION("Adaptec Starfire Ethernet driver");
MODULE_PARM(max_interrupt_work, "i");
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
*/
+\f
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
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;
#endif
};
+#define PRIV_ALIGN 15 /* Required alignment mask */
struct ring_info {
struct sk_buff *skb;
dma_addr_t mapping;
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 */
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;
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;
}
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;
}
#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
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;
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;
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);
/* 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);
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. */
{
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;
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)
/* 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);
}
}
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__
{
/* 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;
}
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.. */
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));
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);
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;
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);
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:
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);
}
#include <asm/unaligned.h>
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. */
{ 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 },
- 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. */
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
/* 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";
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.
enum via_rhine_chips {
VT86C100A = 0,
+ VT6102,
VT3043,
};
};
-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 */
};
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. */
"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);
}
}
}
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)
;
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 +
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 "
int i;
unsigned long flags;
+ del_timer_sync(&np->timer);
+
spin_lock_irqsave(&np->lock, flags);
netif_stop_queue(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. */
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
-
*
* 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
*/
}
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));
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));
#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;
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");
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,
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),
{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;
return 0;
}
}
- i += reverse ? -1 : 1;
+ i += reverse ? -1 : 1;
}
return -ENODEV;
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;
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++;
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++;
}
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++;
}
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++;
}
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 */
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;
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;
}
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;
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);
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;
}
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:
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;
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;
}
*/
#include <linux/config.h>
+#include <linux/init.h>
#include <linux/mm.h>
#include <linux/locks.h>
#include <linux/fcntl.h>
}
}
-void bdev_init(void)
+void __init bdev_init(void)
{
int i;
struct list_head *head = bdev_hashtable;
0, SLAB_HWCACHE_ALIGN, init_once,
NULL);
if (!bdev_cachep)
- panic("cannot create bdev slab cache");
+ panic("Cannot create bdev_cache SLAB cache");
}
/*
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 ) {
break;
namelen--;
}
- error = filldir(dirent, name, namelen, offset, CRAMINO(de));
+ error = filldir(dirent, name, namelen, offset, CRAMINO(de), de->mode >> 12);
if (error)
break;
/* 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;
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,
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);
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++;
{
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++;
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 */
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;
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) {
#include <linux/fs.h>
+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 = {
* 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)
/* 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++;
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];
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;
}
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);
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)
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;
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 */
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;
}
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;
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;
}
/* 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;
}
}
/* 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;
}
}
/* 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;
}
}
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;
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;
&((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;
}
/* 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;
}
}
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;
}
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;
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;
}
/* 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;
}
}
(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;
}
}
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;
}
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);
/* 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;
/* 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;
}
}
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;
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;
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++;
}
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++;
}
/* 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;
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)
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);
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) {
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;
}
error = -EINVAL;
- if (!posix_make_lock(filp, file_lock, &flock))
+ if (!flock_to_posix_lock(filp, file_lock, &flock))
goto out_putf;
error = -EBADF;
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.
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;
}
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;
}
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;
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;
}
* 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;
#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;
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 */
* 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;
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;
/* 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;
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;
}
repeat:
fd = find_next_zero_bit(files->open_fds,
- current->files->max_fdset,
+ files->max_fdset,
files->next_fd);
/*
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;
* 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;
}
/*
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++;
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
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++;
}
}
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++;
}
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:
} 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);
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++;
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++;
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++;
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++;
}
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++;
}
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;
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;
}
#include <asm/uaccess.h>
-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;
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++;
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);
}
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;
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;
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;
+}
+
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)
{
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++;
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;
}
}
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;
}
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;
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;
* - 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 <rgooch@atnf.csiro.au>, 13-JAN-1998
* Heavily rewritten for 'one fs - one tree' dcache architecture. AV, Mar 2000
*/
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;
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;
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
}
/**
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;
}
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;
* 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.
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 */
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;
}
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;
}
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);
{
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);
* 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)
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;
}
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;
*/
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",
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;
/* 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;
}
__kernel_pid_t l_pid;
};
+#ifdef __KERNEL__
+#define flock64 flock
+#endif
+
#endif
#define __NR_pivot_root 374
#define __NR_mincore 375
#define __NR_pciconfig_iobase 376
+#define __NR_getdents64 377
#if defined(__GNUC__)
#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)
#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 */
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
#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 <asm-i386/errno.h> */
#define __NR_lstat 1211
#define __NR_fstat 1212
#define __NR_clone2 1213
+#define __NR_getdents64 1214
#if !defined(__ASSEMBLY__) && !defined(ASSEMBLER)
#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
<asm-m68k/errno.h> */
#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
#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.
#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
#define __NR_sys_pciconfig_write 199
#define __NR_sys_pciconfig_iobase 200
#define __NR_multiplexer 201
+#define __NR_getdents64 202
#define __NR(n) #n
#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 <asm-s390/errno.h> */
#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 <asm-sh/errno.h> */
#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 */
/* #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 */
/* #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 */
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
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);
* 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);
#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;
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 *);
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 *);
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);
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 *);
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);
/*
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 *);
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 */
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 *);
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;
__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 */
mempages = num_physpages;
fork_init(mempages);
+ proc_caches_init();
vfs_caches_init(mempages);
- vma_init();
buffer_init(mempages);
page_cache_init(mempages);
kiobuf_setup();
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 */
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;
dput(fs->altroot);
mntput(fs->altrootmnt);
}
- kfree(fs);
+ kmem_cache_free(fs_cachep, fs);
}
}
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);
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)
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);
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);
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");
+}
__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
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.");
-}
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;
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);
/* 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);
cc->avail = 0;
}
}
- local_irq_enable();
clear_bit(smp_processor_id(), &slab_cache_drain_mask);
if (slab_cache_drain_mask == 0)
static void do_ccupdate(ccupdate_struct_t *data)
{
- DECLARE_WAITQUEUE(wait, current);
unsigned long cpu_mask = 0;
int i;
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);
* J Hadi Salim: ECN support
*/
-#include <linux/config.h>
#include <linux/mm.h>
#include <linux/sysctl.h>
#include <net/tcp.h>