From: NIIBE Y. <gn...@m1...> - 2002-02-27 00:24:50
|
I have _not_ yet finished this work, but I think that it's good to share this so that people can see the move, even if it's partial update. It's not complete, cannot compile. I'll do the work to support new asm-sh/thread_info.h, along with asm-sh/io.h, asm-sh/processor.h, asm-sh/hardirq.h, asm-sh/hw_irq.h, and arch/sh/kernel/fpu.c. And move of joystick driver. HOWTO: I have list of our files in CVS repository, say, it's called FILES. Removing first space of output of $ gzip -c -d patch-2.5.4.gz | diffstat | sort we get the list of changes in the patch, say, it's saved to changes-2.5.4. Then, $ join changes-2.5.4 FILES let you know changes required to our repository. Then, I check arch/i386/* and asm-i386/* changes to follow. 2002-02-27 NIIBE Yutaka <gn...@m1...> Updated to 2.5.4. * Makefile: Version 2.5.4 * AGAINST-2.5.4: New file. * AGAINST-2.5.3: Removed. * arch/sh/kernel/signal.c (setup_frame): Use current_thread_info. (setup_rt_frame): Likewise. * include/asm-sh/uaccess.h (get_fs,set_fs,__addr_ok,__range_ok): Likewise. * arch/sh/kernel/setup.c (setup_arch): Use set_thread_flag. * arch/sh/kernel/fpu.c (save_fpu,ieee_fpe_handler,do_fpu_state_restore): Likewise. * arch/sh/kernel/ptrace.c (sys_ptrace): Use set_tsk_thread_flag and clear_tsk_thread_flag. (do_syscall_trace): Follow the change of i386. * arch/sh/kernel/pci-dma.c (pci_alloc_consistent): Use virt_to_phys instead of virt_to_bus. * arch/sh/kernel/init_task.c (init_thread_union): New variable. * arch/sh/kernel/entry.S (syscall_call): Rename from syscall_traced. 2002-02-27 NIIBE Yutaka <gn...@m1...> * drivers/char/joystick -> drivers/input/joystick. * include/linux/input.h: Updated to version 1.57. * include/asm-sh/siginfo.h (SI_TKILL): Added. * include/asm-sh/scatterlist.h (struct scatterlist): Remove member address. * include/asm-sh/pci.h (pci_map_sg, pci_dma_sync_sg): Follow struct scatterlist interface change. * drivers/net/8139too.c: Merged version 0.9.24. * drivers/char/sh-sci.c (sci_ioctl TIOCGSERIAL): Set return code. * arch/sh/vmlinux.lds.S (.text.lock): Removed. * arch/sh/kernel/signal.c (do_signal): Use sig_exit. * Makefile: Version 2.5.4. Merged. * arch/sh/kernel/entry.S (sys_tkill): Added. * drivers/char/Makefile: Merged (Removed joystick). * drivers/Makefile (subdir-$(CONFIG_SERIO), subdir-$(CONFIG_GAMEPORT)): Merged. Index: Makefile =================================================================== RCS file: /cvsroot/linuxsh/linux/Makefile,v retrieving revision 1.7 diff -u -3 -p -r1.7 Makefile --- Makefile 26 Feb 2002 09:15:15 -0000 1.7 +++ Makefile 27 Feb 2002 00:14:15 -0000 @@ -1,6 +1,6 @@ VERSION = 2 PATCHLEVEL = 5 -SUBLEVEL = 3 +SUBLEVEL = 4 EXTRAVERSION = KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) @@ -140,7 +140,6 @@ DRIVERS-y += drivers/base/base.o \ DRIVERS-$(CONFIG_AGP) += drivers/char/agp/agp.o DRIVERS-$(CONFIG_DRM) += drivers/char/drm/drm.o DRIVERS-$(CONFIG_NUBUS) += drivers/nubus/nubus.a -DRIVERS-$(CONFIG_ISDN) += drivers/isdn/isdn.a DRIVERS-$(CONFIG_NET_FC) += drivers/net/fc/fc.o DRIVERS-$(CONFIG_APPLETALK) += drivers/net/appletalk/appletalk.o DRIVERS-$(CONFIG_TR) += drivers/net/tokenring/tr.o @@ -178,6 +177,8 @@ DRIVERS-$(CONFIG_HAMRADIO) += drivers/ne DRIVERS-$(CONFIG_TC) += drivers/tc/tc.a DRIVERS-$(CONFIG_USB) += drivers/usb/usbdrv.o DRIVERS-$(CONFIG_INPUT) += drivers/input/inputdrv.o +DRIVERS-$(CONFIG_GAMEPORT) += drivers/input/gameport/gamedrv.o +DRIVERS-$(CONFIG_SERIO) += drivers/input/serio/seriodrv.o DRIVERS-$(CONFIG_I2O) += drivers/message/i2o/i2o.o DRIVERS-$(CONFIG_IRDA) += drivers/net/irda/irda.o DRIVERS-$(CONFIG_I2C) += drivers/i2c/i2c.o @@ -185,6 +186,7 @@ DRIVERS-$(CONFIG_PHONE) += drivers/telep DRIVERS-$(CONFIG_MD) += drivers/md/mddev.o DRIVERS-$(CONFIG_BLUEZ) += drivers/bluetooth/bluetooth.o DRIVERS-$(CONFIG_HOTPLUG_PCI) += drivers/hotplug/vmlinux-obj.o +DRIVERS-$(CONFIG_ISDN) += drivers/isdn/vmlinux-obj.a DRIVERS-$(CONFIG_MAPLE) += drivers/maple/maplebus.o DRIVERS := $(DRIVERS-y) @@ -206,7 +208,7 @@ CLEAN_FILES = \ drivers/scsi/aic7xxx/aicasm/aicasm_scan.c \ drivers/scsi/aic7xxx/aicasm/y.tab.h \ drivers/scsi/aic7xxx/aicasm/aicasm \ - drivers/scsi/53c700-mem.c \ + drivers/scsi/53c700_d.h \ net/khttpd/make_times_h \ net/khttpd/times.h \ submenu* @@ -325,6 +327,8 @@ include/linux/compile.h: $(CONFIGURATION @echo \#define LINUX_COMPILER \"`$(CC) $(CFLAGS) -v 2>&1 | tail -1`\" >> .ver @mv -f .ver $@ +comma := , + include/linux/version.h: ./Makefile @echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver @@ -332,10 +336,10 @@ include/linux/version.h: ./Makefile @mv -f .ver $@ init/version.o: init/version.c include/linux/compile.h include/config/MARKER - $(CC) $(CFLAGS) $(CFLAGS_KERNEL) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c + $(CC) $(CFLAGS) $(CFLAGS_KERNEL) -DUTS_MACHINE='"$(ARCH)"' -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c -o init/version.o init/version.c init/main.o: init/main.c include/config/MARKER - $(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -c -o $*.o $< + $(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c -o $*.o $< init/do_mounts.o: init/do_mounts.c include/config/MARKER $(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -c -o $*.o $< Index: arch/sh/vmlinux.lds.S =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/vmlinux.lds.S,v retrieving revision 1.2 diff -u -3 -p -r1.2 vmlinux.lds.S --- arch/sh/vmlinux.lds.S 24 Jan 2002 11:04:15 -0000 1.2 +++ arch/sh/vmlinux.lds.S 27 Feb 2002 00:14:15 -0000 @@ -23,7 +23,6 @@ SECTIONS *(.fixup) *(.gnu.warning) } = 0x0009 - .text.lock : { *(.text.lock) } /* out-of-line lock text */ .rodata : { *(.rodata) *(.rodata.*) } .kstrtab : { *(.kstrtab) } Index: arch/sh/kernel/entry.S =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/entry.S,v retrieving revision 1.3 diff -u -3 -p -r1.3 entry.S --- arch/sh/kernel/entry.S 26 Feb 2002 09:15:15 -0000 1.3 +++ arch/sh/kernel/entry.S 27 Feb 2002 00:14:16 -0000 @@ -426,7 +426,7 @@ system_call: tst r10, r10 bf syscall_trace_entry ! -syscall_traced: +syscall_call: shll2 r9 ! x4 mov.l 3f, r11 ! Load the address of sys_call_table add r11, r9 @@ -530,7 +530,7 @@ syscall_trace_entry: ! again as the system call returns. mov.l 2f, r10 ! Number of syscalls cmp/hs r10, r3 - bf syscall_traced + bf syscall_call bra syscall_exit mov #-ENOSYS, r0 @@ -1164,6 +1164,7 @@ ENTRY(sys_call_table) .long SYMBOL_NAME(sys_removexattr) /* 235 */ .long SYMBOL_NAME(sys_lremovexattr) .long SYMBOL_NAME(sys_fremovexattr) + .long SYMBOL_NAME(sys_tkill) .rept NR_syscalls-(.-sys_call_table)/4 .long SYMBOL_NAME(sys_ni_syscall) Index: arch/sh/kernel/fpu.c =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/fpu.c,v retrieving revision 1.2 diff -u -3 -p -r1.2 fpu.c --- arch/sh/kernel/fpu.c 29 Dec 2001 06:50:38 -0000 1.2 +++ arch/sh/kernel/fpu.c 27 Feb 2002 00:14:16 -0000 @@ -67,7 +67,7 @@ save_fpu(struct task_struct *tsk) "r" (FPSCR_INIT) : "memory"); - tsk->flags &= ~PF_USEDFPU; + clear_thread_flag(TIF_USEDFPU); release_fpu(); } @@ -260,7 +260,7 @@ ieee_fpe_handler (struct pt_regs *regs) ~(FPSCR_CAUSE_MASK | FPSCR_FLAG_MASK); grab_fpu(); restore_fpu(tsk); - tsk->flags |= PF_USEDFPU; + set_thread_flag(TIF_USEDFPU); } else { tsk->thread.trap_no = 11; tsk->thread.error_code = 0; @@ -310,5 +310,5 @@ do_fpu_state_restore(unsigned long r4, u fpu_init(); tsk->used_math = 1; } - tsk->flags |= PF_USEDFPU; + set_thread_flag(TIF_USEDFPU); } Index: arch/sh/kernel/init_task.c =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/init_task.c,v retrieving revision 1.2 diff -u -3 -p -r1.2 init_task.c --- arch/sh/kernel/init_task.c 24 Jan 2002 11:04:15 -0000 1.2 +++ arch/sh/kernel/init_task.c 27 Feb 2002 00:14:16 -0000 @@ -12,12 +12,19 @@ static struct signal_struct init_signals struct mm_struct init_mm = INIT_MM(init_mm); /* - * Initial task structure. + * Initial thread structure. * * We need to make sure that this is 8192-byte aligned due to the * way process stacks are handled. This is done by having a special * "init_task" linker map entry.. */ -union task_union init_task_union +union thread_union init_thread_union __attribute__((__section__(".data.init_task"))) = - { INIT_TASK(init_task_union.task) }; + { INIT_THREAD_INFO(init_task) }; + +/* + * Initial task structure. + * + * All other task structs will be allocated on slabs in fork.c + */ +struct task_struct init_task = INIT_TASK(init_task); Index: arch/sh/kernel/pci-dma.c =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/pci-dma.c,v retrieving revision 1.1 diff -u -3 -p -r1.1 pci-dma.c --- arch/sh/kernel/pci-dma.c 15 Oct 2001 20:44:50 -0000 1.1 +++ arch/sh/kernel/pci-dma.c 27 Feb 2002 00:14:16 -0000 @@ -26,7 +26,7 @@ void *pci_alloc_consistent(struct pci_de if (ret != NULL) { /* Is it neccessary to do the memset? */ memset(ret, 0, size); - *dma_handle = virt_to_bus(ret); + *dma_handle = virt_to_phys(ret); } /* We must flush the cache before we pass it on to the device */ dma_cache_wback_inv(ret, size); Index: arch/sh/kernel/ptrace.c =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/ptrace.c,v retrieving revision 1.2 diff -u -3 -p -r1.2 ptrace.c --- arch/sh/kernel/ptrace.c 26 Feb 2002 09:15:15 -0000 1.2 +++ arch/sh/kernel/ptrace.c 27 Feb 2002 00:14:16 -0000 @@ -275,9 +275,9 @@ asmlinkage int sys_ptrace(long request, if ((unsigned long) data > _NSIG) break; if (request == PTRACE_SYSCALL) - child->ptrace |= PT_SYSCALLTRACE; + set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); else - child->ptrace &= ~PT_SYSCALLTRACE; + clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); child->exit_code = data; wake_up_process(child); ret = 0; @@ -308,7 +308,7 @@ asmlinkage int sys_ptrace(long request, ret = -EIO; if ((unsigned long) data > _NSIG) break; - child->ptrace &= ~PT_SYSCALLTRACE; + clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); if ((child->ptrace & PT_DTRACE) == 0) { /* Spurious delayed TF traps may occur */ child->ptrace |= PT_DTRACE; @@ -366,7 +366,7 @@ asmlinkage int sys_ptrace(long request, break; } out_tsk: - free_task_struct(child); + put_task_struct(child); out: unlock_kernel(); return ret; @@ -376,8 +376,9 @@ asmlinkage void do_syscall_trace(void) { struct task_struct *tsk = current; - if ((tsk->ptrace & (PT_PTRACED|PT_SYSCALLTRACE)) - != (PT_PTRACED|PT_SYSCALLTRACE)) + if (!test_thread_flag(TIF_SYSCALL_TRACE)) + return; + if (!(current->ptrace & PT_PTRACED)) return; /* the 0x80 provides a way for the tracing parent to distinguish between a syscall stop and SIGTRAP delivery */ Index: arch/sh/kernel/setup.c =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/setup.c,v retrieving revision 1.3 diff -u -3 -p -r1.3 setup.c --- arch/sh/kernel/setup.c 15 Jan 2002 07:59:52 -0000 1.3 +++ arch/sh/kernel/setup.c 27 Feb 2002 00:14:16 -0000 @@ -476,7 +476,7 @@ void __init setup_arch(char **cmdline_p) #if defined(__SH4__) /* We already grab/initialized FPU in head.S. Make it consisitent. */ init_task.used_math = 1; - init_task.flags |= PF_USEDFPU; + set_thread_flag(TIF_USEDFPU); #endif paging_init(); } Index: arch/sh/kernel/signal.c =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/signal.c,v retrieving revision 1.2 diff -u -3 -p -r1.2 signal.c --- arch/sh/kernel/signal.c 24 Jan 2002 11:24:57 -0000 1.2 +++ arch/sh/kernel/signal.c 27 Feb 2002 00:14:16 -0000 @@ -390,10 +390,10 @@ static void setup_frame(int sig, struct if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) goto give_sigsegv; - signal = current->exec_domain - && current->exec_domain->signal_invmap + signal = current_thread_info()->exec_domain + && current_thread_info()->exec_domain->signal_invmap && sig < 32 - ? current->exec_domain->signal_invmap[sig] + ? current_thread_info()->exec_domain->signal_invmap[sig] : sig; err |= setup_sigcontext(&frame->sc, regs, set->sig[0]); @@ -455,10 +455,10 @@ static void setup_rt_frame(int sig, stru if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) goto give_sigsegv; - signal = current->exec_domain - && current->exec_domain->signal_invmap + signal = current_thread_info()->exec_domain + && current_thread_info()->exec_domain->signal_invmap && sig < 32 - ? current->exec_domain->signal_invmap[sig] + ? current_thread_info()->exec_domain->signal_invmap[sig] : sig; err |= __put_user(&frame->info, &frame->pinfo); @@ -673,10 +673,7 @@ int do_signal(struct pt_regs *regs, sigs /* FALLTHRU */ default: - sigaddset(¤t->pending.signal, signr); - recalc_sigpending(current); - current->flags |= PF_SIGNALED; - do_exit(exit_code); + sig_exit(signr, exit_code, &info); /* NOTREACHED */ } } Index: drivers/Makefile =================================================================== RCS file: /cvsroot/linuxsh/linux/drivers/Makefile,v retrieving revision 1.3 diff -u -3 -p -r1.3 Makefile --- drivers/Makefile 26 Feb 2002 09:15:15 -0000 1.3 +++ drivers/Makefile 27 Feb 2002 00:14:16 -0000 @@ -8,7 +8,7 @@ mod-subdirs := dio mtd sbus video macintosh usb input telephony sgi ide \ message/i2o message/fusion scsi md ieee1394 pnp isdn atm \ - fc4 net/hamradio i2c acpi bluetooth maple + fc4 net/hamradio i2c acpi bluetooth input/serio input/gameport maple subdir-y := base parport char block net sound misc media cdrom hotplug subdir-m := $(subdir-y) @@ -27,6 +27,8 @@ subdir-$(CONFIG_MAC) += macintosh subdir-$(CONFIG_ALL_PPC) += macintosh subdir-$(CONFIG_USB) += usb subdir-$(CONFIG_INPUT) += input +subdir-$(CONFIG_SERIO) += input/serio +subdir-$(CONFIG_GAMEPORT) += input/gameport subdir-$(CONFIG_PHONE) += telephony subdir-$(CONFIG_SGI) += sgi subdir-$(CONFIG_IDE) += ide Index: drivers/char/Makefile =================================================================== RCS file: /cvsroot/linuxsh/linux/drivers/char/Makefile,v retrieving revision 1.2 diff -u -3 -p -r1.2 Makefile --- drivers/char/Makefile 3 Dec 2001 22:15:34 -0000 1.2 +++ drivers/char/Makefile 27 Feb 2002 00:14:16 -0000 @@ -25,7 +25,7 @@ export-objs := busmouse.o console.o misc.o pty.o random.o selection.o serial.o \ sonypi.o tty_io.o tty_ioctl.o generic_serial.o -mod-subdirs := joystick ftape drm pcmcia +mod-subdirs := ftape drm pcmcia list-multi := @@ -166,15 +166,10 @@ obj-$(CONFIG_BVME6000_SCC) += generic_se obj-$(CONFIG_SERIAL_TX3912) += generic_serial.o serial_tx3912.o subdir-$(CONFIG_RIO) += rio -subdir-$(CONFIG_INPUT) += joystick obj-$(CONFIG_ATIXL_BUSMOUSE) += atixlmouse.o obj-$(CONFIG_LOGIBUSMOUSE) += logibusmouse.o obj-$(CONFIG_PRINTER) += lp.o - -ifeq ($(CONFIG_INPUT),y) -obj-y += joystick/js.o -endif obj-$(CONFIG_MAPLE_KEYBOARD) += maple_keyb.o obj-$(CONFIG_MAPLE_MOUSE) += maplemouse.o Index: drivers/char/sh-sci.c =================================================================== RCS file: /cvsroot/linuxsh/linux/drivers/char/sh-sci.c,v retrieving revision 1.2 diff -u -3 -p -r1.2 sh-sci.c --- drivers/char/sh-sci.c 15 Jan 2002 07:59:52 -0000 1.2 +++ drivers/char/sh-sci.c 27 Feb 2002 00:14:16 -0000 @@ -919,7 +919,7 @@ static int sci_ioctl(struct tty_struct * case TIOCGSERIAL: if ((rc = verify_area(VERIFY_WRITE, (void *) arg, sizeof(struct serial_struct))) == 0) - gs_getserial(&port->gs, (struct serial_struct *) arg); + rc = gs_getserial(&port->gs, (struct serial_struct *) arg); break; case TIOCSSERIAL: if ((rc = verify_area(VERIFY_READ, (void *) arg, Index: drivers/net/8139too.c =================================================================== RCS file: /cvsroot/linuxsh/linux/drivers/net/8139too.c,v retrieving revision 1.6 diff -u -3 -p -r1.6 8139too.c --- drivers/net/8139too.c 25 Jan 2002 02:07:59 -0000 1.6 +++ drivers/net/8139too.c 27 Feb 2002 00:14:16 -0000 @@ -92,7 +92,7 @@ */ #define DRV_NAME "8139too" -#define DRV_VERSION "0.9.22" +#define DRV_VERSION "0.9.24" #include <linux/config.h> @@ -168,6 +168,9 @@ static int max_interrupt_work = 20; The RTL chips use a 64 element hash table based on the Ethernet CRC. */ static int multicast_filter_limit = 32; +/* bitmapped message enable number */ +static int debug = -1; + /* Size of the in-memory receive ring. */ #ifdef CONFIG_8139TOO_BUF16K #define RX_BUF_LEN_IDX 1 /* 0==8K, 1==16K, 2==32K, 3==64K */ @@ -225,6 +228,7 @@ typedef enum { ADDTRON8139, DFE538TX, DFE690TXD, + FE2000VX, SEGABBA, RTL8129, } board_t; @@ -243,6 +247,7 @@ static struct { { "Addtron Technolgy 8139 10/100BaseTX", RTL8139_CAPS }, { "D-Link DFE-538TX (RealTek RTL8139)", RTL8139_CAPS }, { "D-Link DFE-690TXD (RealTek RTL8139)", RTL8139_CAPS }, + { "AboCom FE2000VX (RealTek RTL8139)", RTL8139_CAPS }, { "SEGA Broadband Adapter", RTL8139_CAPS }, { "RealTek RTL8129", RTL8129_CAPS }, }; @@ -257,6 +262,7 @@ static struct pci_device_id rtl8139_pci_ {0x4033, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ADDTRON8139 }, {0x1186, 0x1300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DFE538TX }, {0x1186, 0x1340, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DFE690TXD }, + {0x13d1, 0xab06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, FE2000VX }, {0x11db, 0x1234, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SEGABBA }, #ifdef CONFIG_8139TOO_8129 @@ -269,6 +275,7 @@ static struct pci_device_id rtl8139_pci_ */ {PCI_ANY_ID, 0x8139, 0x10ec, 0x8139, 0, 0, RTL8139 }, {PCI_ANY_ID, 0x8139, 0x1186, 0x1300, 0, 0, DFE538TX }, + {PCI_ANY_ID, 0x8139, 0x13d1, 0xab06, 0, 0, FE2000VX }, {0,} }; @@ -541,6 +548,7 @@ struct rtl_extra_stats { unsigned long early_rx; unsigned long tx_buf_mapped; unsigned long tx_timeouts; + unsigned long rx_lost_in_ring; }; struct rtl8139_private { @@ -559,12 +567,8 @@ struct rtl8139_private { dma_addr_t tx_bufs_dma; signed char phys[4]; /* MII device addresses. */ char twistie, twist_row, twist_col; /* Twister tune state. */ - unsigned int full_duplex:1; /* Full-duplex operation requested. */ - unsigned int duplex_lock:1; unsigned int default_port:4; /* Last dev->if_port value. */ - unsigned int media2:4; /* Secondary monitored media port. */ unsigned int medialock:1; /* Don't sense media type. */ - unsigned int mediasense:1; /* Media sensing in progress. */ spinlock_t lock; chip_t chipset; pid_t thr_pid; @@ -573,6 +577,7 @@ struct rtl8139_private { u32 rx_config; struct rtl_extra_stats xstats; int time_to_die; + struct mii_if_info mii; }; MODULE_AUTHOR ("Jeff Garzik <jg...@ma...>"); @@ -583,6 +588,8 @@ MODULE_PARM (multicast_filter_limit, "i" MODULE_PARM (max_interrupt_work, "i"); MODULE_PARM (media, "1-" __MODULE_STRING(MAX_UNITS) "i"); MODULE_PARM (full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i"); +MODULE_PARM (debug, "i"); +MODULE_PARM_DESC (debug, "8139too bitmapped message enable number"); MODULE_PARM_DESC (multicast_filter_limit, "8139too maximum number of filtered multicast addresses"); MODULE_PARM_DESC (max_interrupt_work, "8139too maximum events handled per interrupt"); MODULE_PARM_DESC (media, "8139too: Bits 4+9: force full duplex, bit 5: 100Mbps"); @@ -970,6 +977,9 @@ static int __devinit rtl8139_init_one (s spin_lock_init (&tp->lock); init_waitqueue_head (&tp->thr_wait); init_completion (&tp->thr_exited); + tp->mii.dev = dev; + tp->mii.mdio_read = mdio_read; + tp->mii.mdio_write = mdio_write; /* dev is fully set up and ready to use now */ DPRINTK("about to register device named %s (%p)...\n", dev->name, dev); @@ -1021,18 +1031,18 @@ static int __devinit rtl8139_init_one (s /* The lower four bits are the media type. */ option = (board_idx >= MAX_UNITS) ? 0 : media[board_idx]; if (option > 0) { - tp->full_duplex = (option & 0x210) ? 1 : 0; + tp->mii.full_duplex = (option & 0x210) ? 1 : 0; tp->default_port = option & 0xFF; if (tp->default_port) tp->medialock = 1; } if (board_idx < MAX_UNITS && full_duplex[board_idx] > 0) - tp->full_duplex = full_duplex[board_idx]; - if (tp->full_duplex) { + tp->mii.full_duplex = full_duplex[board_idx]; + if (tp->mii.full_duplex) { printk(KERN_INFO "%s: Media type forced to Full Duplex.\n", dev->name); /* Changing the MII-advertised media because might prevent re-connection. */ - tp->duplex_lock = 1; + tp->mii.duplex_lock = 1; } if (tp->default_port) { printk(KERN_INFO " Forcing %dMbps %s-duplex operation.\n", @@ -1289,7 +1299,7 @@ static int rtl8139_open (struct net_devi } - tp->full_duplex = tp->duplex_lock; + tp->mii.full_duplex = tp->mii.duplex_lock; tp->tx_flag = (TX_FIFO_THRESH << 11) & 0x003f0000; tp->twistie = 1; tp->time_to_die = 0; @@ -1301,7 +1311,7 @@ static int rtl8139_open (struct net_devi " GP Pins %2.2x %s-duplex.\n", dev->name, pci_resource_start (tp->pci_dev, 1), dev->irq, RTL_R8 (MediaStatus), - tp->full_duplex ? "full" : "half"); + tp->mii.full_duplex ? "full" : "half"); tp->thr_pid = kernel_thread (rtl8139_thread, dev, CLONE_FS | CLONE_FILES); if (tp->thr_pid < 0) @@ -1317,18 +1327,18 @@ static void rtl_check_media (struct net_ struct rtl8139_private *tp = dev->priv; if (tp->phys[0] >= 0) { - u16 mii_reg5 = mdio_read(dev, tp->phys[0], 5); - if (mii_reg5 == 0xffff) + u16 mii_lpa = mdio_read(dev, tp->phys[0], MII_LPA); + if (mii_lpa == 0xffff) ; /* Not there */ - else if ((mii_reg5 & 0x0100) == 0x0100 - || (mii_reg5 & 0x00C0) == 0x0040) - tp->full_duplex = 1; + else if ((mii_lpa & LPA_100FULL) == LPA_100FULL + || (mii_reg5 & 0x00C0) == LPA_10FULL) + tp->mii.full_duplex = 1; printk (KERN_INFO"%s: Setting %s%s-duplex based on" " auto-negotiated partner ability %4.4x.\n", - dev->name, mii_reg5 == 0 ? "" : - (mii_reg5 & 0x0180) ? "100mbps " : "10mbps ", - tp->full_duplex ? "full" : "half", mii_reg5); + dev->name, mii_lpa == 0 ? "" : + (mii_lpa & 0x0180) ? "100mbps " : "10mbps ", + tp->mii.full_duplex ? "full" : "half", mii_lpa); } } @@ -1517,30 +1527,30 @@ static inline void rtl8139_thread_iter ( struct rtl8139_private *tp, void *ioaddr) { - int mii_reg5; + int mii_lpa; - mii_reg5 = mdio_read (dev, tp->phys[0], 5); + mii_lpa = mdio_read (dev, tp->phys[0], MII_LPA); - if (!tp->duplex_lock && mii_reg5 != 0xffff) { - int duplex = (mii_reg5 & 0x0100) - || (mii_reg5 & 0x01C0) == 0x0040; - if (tp->full_duplex != duplex) { - tp->full_duplex = duplex; + if (!tp->mii.duplex_lock && mii_lpa != 0xffff) { + int duplex = (mii_lpa & LPA_100FULL) + || (mii_lpa & 0x01C0) == 0x0040; + if (tp->mii.full_duplex != duplex) { + tp->mii.full_duplex = duplex; - if (mii_reg5) { + if (mii_lpa) { printk (KERN_INFO "%s: Setting %s-duplex based on MII #%d link" " partner ability of %4.4x.\n", dev->name, - tp->full_duplex ? "full" : "half", - tp->phys[0], mii_reg5); + tp->mii.full_duplex ? "full" : "half", + tp->phys[0], mii_lpa); } else { printk(KERN_INFO"%s: media is unconnected, link down, or incompatible connection\n", dev->name); } #if 0 RTL_W8 (Cfg9346, Cfg9346_Unlock); - RTL_W8 (Config1, tp->full_duplex ? 0x60 : 0x20); + RTL_W8 (Config1, tp->mii.full_duplex ? 0x60 : 0x20); RTL_W8 (Cfg9346, Cfg9346_Lock); #endif } @@ -1773,23 +1783,36 @@ static void rtl8139_rx_err (u32 rx_statu struct rtl8139_private *tp, void *ioaddr) { u8 tmp8; +#ifndef CONFIG_8139_NEW_RX_RESET int tmp_work; +#endif DPRINTK ("%s: Ethernet frame had errors, status %8.8x.\n", dev->name, rx_status); - if (rx_status & RxTooLong) { - DPRINTK ("%s: Oversized Ethernet frame, status %4.4x!\n", - dev->name, rx_status); - /* A.C.: The chip hangs here. */ - } tp->stats.rx_errors++; - if (rx_status & (RxBadSymbol | RxBadAlign)) - tp->stats.rx_frame_errors++; - if (rx_status & (RxRunt | RxTooLong)) - tp->stats.rx_length_errors++; - if (rx_status & RxCRCErr) - tp->stats.rx_crc_errors++; + if (!(rx_status & RxStatusOK)) { + if (rx_status & RxTooLong) { + DPRINTK ("%s: Oversized Ethernet frame, status %4.4x!\n", + dev->name, rx_status); + /* A.C.: The chip hangs here. */ + } + if (rx_status & (RxBadSymbol | RxBadAlign)) + tp->stats.rx_frame_errors++; + if (rx_status & (RxRunt | RxTooLong)) + tp->stats.rx_length_errors++; + if (rx_status & RxCRCErr) + tp->stats.rx_crc_errors++; + } else { + tp->xstats.rx_lost_in_ring++; + } +#ifdef CONFIG_8139_NEW_RX_RESET + tmp8 = RTL_R8 (ChipCmd); + RTL_W8 (ChipCmd, tmp8 & ~CmdRxEnb); + RTL_W8 (ChipCmd, tmp8); + RTL_W32 (RxConfig, tp->rx_config); + tp->cur_rx = 0; +#else /* Reset the receiver, based on RealTek recommendation. (Bug?) */ /* disable receive */ @@ -1834,6 +1857,7 @@ static void rtl8139_rx_err (u32 rx_statu /* A.C.: Reset the multicast list. */ __set_rx_mode (dev); +#endif } static void rtl8139_rx_interrupt (struct net_device *dev, @@ -1968,13 +1992,13 @@ static void rtl8139_weird_interrupt (str (tp->drv_flags & HAS_LNK_CHNG)) { /* Really link-change on new chips. */ int lpar = RTL_R16 (NWayLPAR); - int duplex = (lpar & 0x0100) || (lpar & 0x01C0) == 0x0040 - || tp->duplex_lock; - if (tp->full_duplex != duplex) { - tp->full_duplex = duplex; + int duplex = (lpar & LPA_100FULL) || (lpar & 0x01C0) == 0x0040 + || tp->mii.duplex_lock; + if (tp->mii.full_duplex != duplex) { + tp->mii.full_duplex = duplex; #if 0 RTL_W8 (Cfg9346, Cfg9346_Unlock); - RTL_W8 (Config1, tp->full_duplex ? 0x60 : 0x20); + RTL_W8 (Config1, tp->mii.full_duplex ? 0x60 : 0x20); RTL_W8 (Cfg9346, Cfg9346_Lock); #endif } @@ -2133,48 +2157,6 @@ static int rtl8139_close (struct net_dev } -/* Get the ethtool settings. Assumes that eset points to kernel - memory, *eset has been initialized as {ETHTOOL_GSET}, and other - threads or interrupts aren't messing with the 8139. */ -static void netdev_get_eset (struct net_device *dev, struct ethtool_cmd *eset) -{ - struct rtl8139_private *np = dev->priv; - void *ioaddr = np->mmio_addr; - u16 advert; - - eset->supported = SUPPORTED_10baseT_Half - | SUPPORTED_10baseT_Full - | SUPPORTED_100baseT_Half - | SUPPORTED_100baseT_Full - | SUPPORTED_Autoneg - | SUPPORTED_TP; - - eset->advertising = ADVERTISED_TP | ADVERTISED_Autoneg; - advert = mdio_read (dev, np->phys[0], 4); - if (advert & 0x0020) - eset->advertising |= ADVERTISED_10baseT_Half; - if (advert & 0x0040) - eset->advertising |= ADVERTISED_10baseT_Full; - if (advert & 0x0080) - eset->advertising |= ADVERTISED_100baseT_Half; - if (advert & 0x0100) - eset->advertising |= ADVERTISED_100baseT_Full; - - eset->speed = (RTL_R8 (MediaStatus) & 0x08) ? 10 : 100; - /* (KON)FIXME: np->full_duplex is set or reset by the thread, - which means this always shows half duplex if the interface - isn't up yet, even if it has already autonegotiated. */ - eset->duplex = np->full_duplex ? DUPLEX_FULL : DUPLEX_HALF; - eset->port = PORT_TP; - /* (KON)FIXME: Is np->phys[0] correct? starfire.c uses that. */ - eset->phy_address = np->phys[0]; - eset->transceiver = XCVR_INTERNAL; - eset->autoneg = (mdio_read (dev, np->phys[0], 0) & 0x1000) != 0; - eset->maxtxpkt = 1; - eset->maxrxpkt = 1; -} - - /* Get the ethtool Wake-on-LAN settings. Assumes that wol points to kernel memory, *wol has been initialized as {ETHTOOL_GWOL}, and other threads or interrupts aren't messing with the 8139. */ @@ -2249,7 +2231,6 @@ static int netdev_set_wol (struct net_de return 0; } - static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr) { struct rtl8139_private *np = dev->priv; @@ -2258,33 +2239,70 @@ static int netdev_ethtool_ioctl (struct /* dev_ioctl() in ../../net/core/dev.c has already checked capable(CAP_NET_ADMIN), so don't bother with that here. */ - if (copy_from_user (ðcmd, useraddr, sizeof (ethcmd))) + if (get_user (ethcmd, (u32 *)useraddr)) return -EFAULT; switch (ethcmd) { - case ETHTOOL_GSET: - { - struct ethtool_cmd eset = { ETHTOOL_GSET }; - spin_lock_irq (&np->lock); - netdev_get_eset (dev, &eset); - spin_unlock_irq (&np->lock); - if (copy_to_user (useraddr, &eset, sizeof (eset))) - return -EFAULT; - return 0; - } + case ETHTOOL_GDRVINFO: { + struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO }; + strcpy (info.driver, DRV_NAME); + strcpy (info.version, DRV_VERSION); + strcpy (info.bus_info, np->pci_dev->slot_name); + if (copy_to_user (useraddr, &info, sizeof (info))) + return -EFAULT; + return 0; + } - /* TODO: ETHTOOL_SSET */ + /* get settings */ + case ETHTOOL_GSET: { + struct ethtool_cmd ecmd = { ETHTOOL_GSET }; + spin_lock_irq(&np->lock); + mii_ethtool_gset(&np->mii, &ecmd); + spin_unlock_irq(&np->lock); + if (copy_to_user(useraddr, &ecmd, sizeof(ecmd))) + return -EFAULT; + return 0; + } + /* set settings */ + case ETHTOOL_SSET: { + int r; + struct ethtool_cmd ecmd; + if (copy_from_user(&ecmd, useraddr, sizeof(ecmd))) + return -EFAULT; + spin_lock_irq(&np->lock); + r = mii_ethtool_sset(&np->mii, &ecmd); + spin_unlock_irq(&np->lock); + return r; + } + /* restart autonegotiation */ + case ETHTOOL_NWAY_RST: { + return mii_nway_restart(&np->mii); + } + /* get link status */ + case ETHTOOL_GLINK: { + struct ethtool_value edata = {ETHTOOL_GLINK}; + edata.data = mii_link_ok(&np->mii); + if (copy_to_user(useraddr, &edata, sizeof(edata))) + return -EFAULT; + return 0; + } - case ETHTOOL_GDRVINFO: - { - struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO }; - strcpy (info.driver, DRV_NAME); - strcpy (info.version, DRV_VERSION); - strcpy (info.bus_info, np->pci_dev->slot_name); - if (copy_to_user (useraddr, &info, sizeof (info))) - return -EFAULT; - return 0; - } + /* get message-level */ + case ETHTOOL_GMSGLVL: { + struct ethtool_value edata = {ETHTOOL_GMSGLVL}; + edata.data = debug; + if (copy_to_user(useraddr, &edata, sizeof(edata))) + return -EFAULT; + return 0; + } + /* set message-level */ + case ETHTOOL_SMSGLVL: { + struct ethtool_value edata; + if (copy_from_user(&edata, useraddr, sizeof(edata))) + return -EFAULT; + debug = edata.data; + return 0; + } case ETHTOOL_GWOL: { @@ -2338,17 +2356,14 @@ static int netdev_ioctl (struct net_devi return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data); case SIOCGMIIPHY: /* Get the address of the PHY in use. */ - case SIOCDEVPRIVATE: /* binary compat, remove in 2.5 */ data->phy_id = phy; /* Fall Through */ case SIOCGMIIREG: /* Read the specified MII register. */ - case SIOCDEVPRIVATE+1: /* binary compat, remove in 2.5 */ data->val_out = mdio_read (dev, data->phy_id, data->reg_num); break; case SIOCSMIIREG: /* Write the specified MII register */ - case SIOCDEVPRIVATE+2: /* binary compat, remove in 2.5 */ if (!capable (CAP_NET_ADMIN)) { rc = -EPERM; break; @@ -2361,9 +2376,9 @@ static int netdev_ioctl (struct net_devi /* Check for autonegotiation on or reset. */ tp->medialock = (value & 0x9000) ? 0 : 1; if (tp->medialock) - tp->full_duplex = (value & 0x0100) ? 1 : 0; + tp->mii.full_duplex = (value & 0x0100) ? 1 : 0; break; - case 4: /* tp->advertising = value; */ break; + case 4: tp->mii.advertising = value; break; } } mdio_write(dev, data->phy_id, data->reg_num, data->val_in); Index: drivers/net/Config.help =================================================================== RCS file: /cvsroot/linuxsh/linux/drivers/net/Config.help,v retrieving revision 1.2 diff -u -3 -p -r1.2 Config.help --- drivers/net/Config.help 25 Jan 2002 04:27:53 -0000 1.2 +++ drivers/net/Config.help 27 Feb 2002 00:14:16 -0000 @@ -1160,6 +1160,17 @@ CONFIG_NATSEMI More specific information and updates are available from <http://www.scyld.com/network/natsemi.html>. +CONFIG_NATSEMI_CABLE_MAGIC + Some systems see lots of errors with NatSemi ethernet controllers + on certain cables. If you are seeing lots of errors, try turning + this option on. Some boards have incorrect values for supporting + resistors that can cause this change to break. If you turn this + option on and your network suddenly stops working, turn this + option off. + + Say N unless you are certain you need this option. + Vendors should not enable this option by default. + CONFIG_SK_G16 If you have a network (Ethernet) card of this type, say Y and read the Ethernet-HOWTO, available from Index: drivers/net/Config.in =================================================================== RCS file: /cvsroot/linuxsh/linux/drivers/net/Config.in,v retrieving revision 1.3 diff -u -3 -p -r1.3 Config.in --- drivers/net/Config.in 24 Jan 2002 11:04:15 -0000 1.3 +++ drivers/net/Config.in 27 Feb 2002 00:14:16 -0000 @@ -67,7 +67,6 @@ if [ "$CONFIG_NET_ETHERNET" = "y" ]; the if [ "$CONFIG_SUPERH" = "y" ]; then tristate ' National DP83902AV support' CONFIG_STNIC fi - dep_tristate ' Sun LANCE support' CONFIG_SUNLANCE $CONFIG_SBUS if [ "$CONFIG_SBUS" = "y" -o "$CONFIG_PCI" = "y" ]; then tristate ' Sun Happy Meal 10/100baseT support' CONFIG_HAPPYMEAL fi @@ -171,6 +170,9 @@ if [ "$CONFIG_NET_ETHERNET" = "y" ]; the dep_tristate ' Mylex EISA LNE390A/B support (EXPERIMENTAL)' CONFIG_LNE390 $CONFIG_EISA $CONFIG_EXPERIMENTAL dep_tristate ' Myson MTD-8xx PCI Ethernet support' CONFIG_FEALNX $CONFIG_PCI dep_tristate ' National Semiconductor DP8381x series PCI Ethernet support' CONFIG_NATSEMI $CONFIG_PCI + if [ "$CONFIG_NATSEMI" = "y" -o "$CONFIG_NATSEMI" = "m" ]; then + bool ' NatSemi workaround for high errors' CONFIG_NATSEMI_CABLE_MAGIC + fi dep_tristate ' PCI NE2000 and clones support (see help)' CONFIG_NE2K_PCI $CONFIG_PCI dep_tristate ' Novell/Eagle/Microdyne NE3210 EISA support (EXPERIMENTAL)' CONFIG_NE3210 $CONFIG_EISA $CONFIG_EXPERIMENTAL dep_tristate ' Racal-Interlan EISA ES3210 support (EXPERIMENTAL)' CONFIG_ES3210 $CONFIG_EISA $CONFIG_EXPERIMENTAL @@ -179,6 +181,7 @@ if [ "$CONFIG_NET_ETHERNET" = "y" ]; the dep_mbool ' Use PIO instead of MMIO' CONFIG_8139TOO_PIO $CONFIG_8139TOO dep_mbool ' Support for automatic channel equalization (EXPERIMENTAL)' CONFIG_8139TOO_TUNE_TWISTER $CONFIG_8139TOO $CONFIG_EXPERIMENTAL dep_mbool ' Support for older RTL-8129/8130 boards' CONFIG_8139TOO_8129 $CONFIG_8139TOO + dep_mbool ' Experiment for better RX reset (EXPERIMENTAL)' CONFIG_8139_NEW_RX_RESET $CONFIG_8139TOO $CONFIG_EXPERIMENTAL dep_mbool ' Support for Dreamcast Broad Band Adaptor' CONFIG_8139TOO_DREAMCAST $CONFIG_8139TOO dep_tristate ' SiS 900/7016 PCI Fast Ethernet Adapter support' CONFIG_SIS900 $CONFIG_PCI dep_tristate ' SMC EtherPower II' CONFIG_EPIC100 $CONFIG_PCI Index: include/asm-sh/current.h =================================================================== RCS file: /cvsroot/linuxsh/linux/include/asm-sh/current.h,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 current.h --- include/asm-sh/current.h 15 Oct 2001 20:45:06 -0000 1.1.1.1 +++ include/asm-sh/current.h 27 Feb 2002 00:14:16 -0000 @@ -6,16 +6,13 @@ * */ +#include <asm/thread_info.h> + struct task_struct; static __inline__ struct task_struct * get_current(void) { - struct task_struct *current; - - __asm__("stc r7_bank, %0" - :"=r" (current)); - - return current; + return current_thread_info()->task; } #define current get_current() Index: include/asm-sh/pci.h =================================================================== RCS file: /cvsroot/linuxsh/linux/include/asm-sh/pci.h,v retrieving revision 1.4 diff -u -3 -p -r1.4 pci.h --- include/asm-sh/pci.h 24 Jan 2002 11:04:15 -0000 1.4 +++ include/asm-sh/pci.h 27 Feb 2002 00:14:16 -0000 @@ -155,7 +155,7 @@ static inline int pci_map_sg(struct pci_ int i; for (i=0; i<nents; i++) - dma_cache_wback_inv(sg[i].address, sg[i].length); + dma_cache_wback_inv(page_address(sg[i].page) + sg[i].offset, sg[i].length); #endif if (direction == PCI_DMA_NONE) BUG(); @@ -212,7 +212,8 @@ static inline void pci_dma_sync_sg(struc int i; for (i=0; i<nelems; i++) - dma_cache_wback_inv(sg[i].address, sg[i].length); + dma_cache_wback_inv(page_address(sg[i].page) + sg[i].offset, sg[i].length); + #endif } Index: include/asm-sh/scatterlist.h =================================================================== RCS file: /cvsroot/linuxsh/linux/include/asm-sh/scatterlist.h,v retrieving revision 1.2 diff -u -3 -p -r1.2 scatterlist.h --- include/asm-sh/scatterlist.h 7 Jan 2002 03:57:48 -0000 1.2 +++ include/asm-sh/scatterlist.h 27 Feb 2002 00:14:16 -0000 @@ -2,8 +2,6 @@ #define __ASM_SH_SCATTERLIST_H struct scatterlist { - char * address; /* Location data is to be transferred to, NULL for - * highmem page */ struct page * page; /* Location for highmem page, if any */ unsigned int offset;/* for highmem, page offset */ dma_addr_t dma_address; Index: include/asm-sh/siginfo.h =================================================================== RCS file: /cvsroot/linuxsh/linux/include/asm-sh/siginfo.h,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 siginfo.h --- include/asm-sh/siginfo.h 15 Oct 2001 20:45:07 -0000 1.1.1.1 +++ include/asm-sh/siginfo.h 27 Feb 2002 00:14:16 -0000 @@ -107,6 +107,7 @@ typedef struct siginfo { #define SI_MESGQ -3 /* sent by real time mesq state change */ #define SI_ASYNCIO -4 /* sent by AIO completion */ #define SI_SIGIO -5 /* sent by queued SIGIO */ +#define SI_TKILL -6 /* sent by tkill system call */ #define SI_FROMUSER(siptr) ((siptr)->si_code <= 0) #define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0) Index: include/asm-sh/uaccess.h =================================================================== RCS file: /cvsroot/linuxsh/linux/include/asm-sh/uaccess.h,v retrieving revision 1.2 diff -u -3 -p -r1.2 uaccess.h --- include/asm-sh/uaccess.h 3 Nov 2001 00:54:51 -0000 1.2 +++ include/asm-sh/uaccess.h 27 Feb 2002 00:14:16 -0000 @@ -32,12 +32,12 @@ #define USER_DS MAKE_MM_SEG(0x80000000) #define get_ds() (KERNEL_DS) -#define get_fs() (current->addr_limit) -#define set_fs(x) (current->addr_limit=(x)) +#define get_fs() (current_thread_info()->addr_limit) +#define set_fs(x) (current_thread_info()->addr_limit=(x)) #define segment_eq(a,b) ((a).seg == (b).seg) -#define __addr_ok(addr) ((unsigned long)(addr) < (current->addr_limit.seg)) +#define __addr_ok(addr) ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg)) /* * Uhhuh, this needs 33-bit arithmetic. We have a carry.. @@ -49,7 +49,7 @@ unsigned long flag,sum; \ __asm__("clrt; addc %3, %1; movt %0; cmp/hi %4, %1; rotcl %0" \ :"=&r" (flag), "=r" (sum) \ - :"1" (addr), "r" ((int)(size)), "r" (current->addr_limit.seg) \ + :"1" (addr), "r" ((int)(size)), "r" (current_thread_info()->addr_limit.seg) \ :"t"); \ flag; }) Index: include/linux/input.h =================================================================== RCS file: /cvsroot/linuxsh/linux/include/linux/input.h,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 input.h --- include/linux/input.h 15 Oct 2001 20:45:12 -0000 1.1.1.1 +++ include/linux/input.h 27 Feb 2002 00:14:16 -0000 @@ -2,11 +2,9 @@ #define _INPUT_H /* - * $Id: input.h,v 1.2 2001/10/15 04:32:06 mrbrown Exp $ + * $Id: input.h,v 1.57 2002/01/02 11:59:56 vojtech Exp $ * - * Copyright (c) 1999-2000 Vojtech Pavlik - * - * Sponsored by SuSE + * Copyright (c) 1999-2001 Vojtech Pavlik */ /* @@ -17,7 +15,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -25,8 +23,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Should you need to contact me, the author, you can do so either by - * e-mail - mail your message to <vo...@su...>, or by paper mail: - * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic + * e-mail - mail your message to <vo...@uc...>, or by paper mail: + * Vojtech Pavlik, Ucitelska 1594, Prague 8, 182 00 Czech Republic */ #ifdef __KERNEL__ @@ -64,17 +62,21 @@ struct input_event { #define EVIOCSREP _IOW('E', 0x03, int[2]) /* get repeat settings */ #define EVIOCGKEYCODE _IOR('E', 0x04, int[2]) /* get keycode */ #define EVIOCSKEYCODE _IOW('E', 0x04, int[2]) /* set keycode */ -#define EVIOCGKEY _IOR('E', 0x05, int[2]) /* get key value */ + #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */ -#define EVIOCGBUS _IOR('E', 0x07, short[4]) /* get bus address */ +#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */ +#define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */ + +#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global keystate */ +#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */ +#define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */ + #define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */ #define EVIOCGABS(abs) _IOR('E', 0x40 + abs, int[5]) /* get abs value/limits */ #define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect)) /* send a force effect to a force feedback device */ #define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */ -#define EVIOCSGAIN _IOW('E', 0x82, unsigned short) /* Set overall gain */ -#define EVIOCSAUTOCENTER _IOW('E', 0x83, unsigned short) /* Enable or disable auto-centering */ #define EVIOCGEFFECTS _IOR('E', 0x84, int) /* Report number of effects playable at the same time */ /* @@ -90,6 +92,8 @@ struct input_event { #define EV_SND 0x12 #define EV_REP 0x14 #define EV_FF 0x15 +#define EV_PWR 0x16 +#define EV_FF_STATUS 0x17 #define EV_MAX 0x1f /* @@ -304,8 +308,23 @@ struct input_event { #define KEY_PROG4 203 #define KEY_SUSPEND 205 #define KEY_CLOSE 206 +#define KEY_PLAY 207 +#define KEY_FASTFORWARD 208 +#define KEY_BASSBOOST 209 +#define KEY_PRINT 210 +#define KEY_HP 211 +#define KEY_CAMERA 212 +#define KEY_SOUND 213 +#define KEY_QUESTION 214 +#define KEY_EMAIL 215 +#define KEY_CHAT 216 +#define KEY_SEARCH 217 +#define KEY_CONNECT 218 +#define KEY_FINANCE 219 +#define KEY_SPORT 220 +#define KEY_SHOP 221 -#define KEY_UNKNOWN 220 +#define KEY_UNKNOWN 240 #define BTN_MISC 0x100 #define BTN_0 0x100 @@ -415,14 +434,16 @@ struct input_event { #define ABS_DISTANCE 0x19 #define ABS_TILT_X 0x1a #define ABS_TILT_Y 0x1b -#define ABS_MISC 0x1c -#define ABS_MAX 0x1f +#define ABS_VOLUME 0x20 +#define ABS_MISC 0x28 +#define ABS_MAX 0x3f /* * Misc events */ #define MSC_SERIAL 0x00 +#define MSC_PULSELED 0x01 #define MSC_MAX 0x07 /* @@ -468,6 +489,7 @@ struct input_event { #define BUS_PCI 0x01 #define BUS_ISAPNP 0x02 #define BUS_USB 0x03 +#define BUS_HIL 0x04 #define BUS_ISA 0x10 #define BUS_I8042 0x11 @@ -481,46 +503,55 @@ struct input_event { #define BUS_MAPLE 0x19 /* + * Values describing the status of an effect + */ +#define FF_STATUS_STOPPED 0x00 +#define FF_STATUS_PLAYING 0x01 +#define FF_STATUS_MAX 0x01 + +/* * Structures used in ioctls to upload effects to a device * The first structures are not passed directly by using ioctls. * They are sub-structures of the actually sent structure (called ff_effect) + * + * Ranges: + * 0 <= __u16 <= 65535 + * -32767 <= __s16 <= +32767 ! Not -32768 for lower bound ! */ struct ff_replay { - __u16 length; /* Duration of an effect */ + __u16 length; /* Duration of an effect in ms. All other times are also expressed in ms */ __u16 delay; /* Time to wait before to start playing an effect */ }; struct ff_trigger { __u16 button; /* Number of button triggering an effect */ - __u16 interval; /* Time to wait before an effect can be re-triggered */ + __u16 interval; /* Time to wait before an effect can be re-triggered (ms) */ }; struct ff_shape { - __u16 attack_length; /* Duration of attack */ - __s16 attack_level; /* Level at beginning of attack */ - __u16 fade_length; /* Duration of fade */ - __s16 fade_level; /* Level at end of fade */ + __u16 attack_length; /* Duration of attack (ms) */ + __u16 attack_level; /* Level at beginning of attack */ + __u16 fade_length; /* Duration of fade (ms) */ + __u16 fade_level; /* Level at end of fade */ }; /* FF_CONSTANT */ struct ff_constant_effect { - __s16 level; /* Strength of effect */ - __u16 direction; /* Direction of effect (see periodic effects) */ - struct ff_shape shape; + __s16 level; /* Strength of effect. Negative values are OK */ struct ff_shape shape; }; /* FF_SPRING of FF_FRICTION */ struct ff_interactive_effect { /* Axis along which effect must be created. If null, the field named direction * is used - * It is a bit array (ie to enable axes X and Y, use BIT(ABS_X) | BIT(ABS_Y) + * It overrides the value of ff_effect::direction, which is used only if + * axis == 0 */ __u16 axis; - __u16 direction; - __s16 right_saturation; /* Max level when joystick is on the right */ - __s16 left_saturation; /* Max level when joystick in on the left */ + __u16 right_saturation; /* Max level when joystick is on the right */ + __u16 left_saturation; /* Max level when joystick in on the left */ __s16 right_coeff; /* Indicates how fast the force grows when the joystick moves to the right */ @@ -534,12 +565,10 @@ struct ff_interactive_effect { /* FF_PERIODIC */ struct ff_periodic_effect { __u16 waveform; /* Kind of wave (sine, square...) */ - __u16 period; + __u16 period; /* in ms */ __s16 magnitude; /* Peak value */ __s16 offset; /* Mean value of wave (roughly) */ __u16 phase; /* 'Horizontal' shift */ - __u16 direction; /* Direction. 0 deg -> 0x0000 - 90 deg -> 0x4000 */ struct ff_shape shape; }; @@ -550,10 +579,17 @@ struct ff_periodic_effect { struct ff_effect { __u16 type; /* Following field denotes the unique id assigned to an effect. - * It is set by the driver. + * If user sets if to -1, a new effect is created, and its id is returned in the same field + * Else, the user sets it to the effect id it wants to update. */ __s16 id; + __u16 direction; /* Direction. 0 deg -> 0x0000 (down) + 90 deg -> 0x4000 (left) + 180 deg -> 0x8000 (up) + 270 deg -> 0xC000 (right) + */ + struct ff_trigger trigger; struct ff_replay replay; @@ -565,7 +601,7 @@ struct ff_effect { }; /* - * Buttons that can trigger effects. Use for example FF_BTN(BTN_TRIGGER) to + * Buttons that can trigger effects. Use for example FF_BTN(BTN_TRIGGER) to * access the bitmap. */ @@ -626,8 +662,11 @@ struct input_dev { void *private; - int number; char *name; + char *phys; + char *uniq; + int number; + unsigned short idbus; unsigned short idvendor; unsigned short idproduct; @@ -650,6 +689,9 @@ struct input_dev { unsigned int repeat_key; struct timer_list timer; + struct pm_dev *pm_dev; + int state; + int abs[ABS_MAX + 1]; int rep[REP_MAX + 1]; @@ -662,8 +704,12 @@ struct input_dev { int absfuzz[ABS_MAX + 1]; int absflat[ABS_MAX + 1]; + int only_one_writer; + int (*open)(struct input_dev *dev); void (*close)(struct input_dev *dev); + int (*accept)(struct input_dev *dev, struct file *file); + int (*flush)(struct input_dev *dev, struct file *file); int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value); int (*upload_effect)(struct input_dev *dev, struct ff_effect *effect); int (*erase_effect)(struct input_dev *dev, int effect_id); @@ -672,16 +718,63 @@ struct input_dev { struct input_dev *next; }; +/* + * Structure for hotplug & device<->driver matching. + */ + +#define INPUT_DEVICE_ID_MATCH_BUS 1 +#define INPUT_DEVICE_ID_MATCH_VENDOR 2 +#define INPUT_DEVICE_ID_MATCH_PRODUCT 4 +#define INPUT_DEVICE_ID_MATCH_VERSION 8 + +#define INPUT_DEVICE_ID_MATCH_EVBIT 0x010 +#define INPUT_DEVICE_ID_MATCH_KEYBIT 0x020 +#define INPUT_DEVICE_ID_MATCH_RELBIT 0x040 +#define INPUT_DEVICE_ID_MATCH_ABSBIT 0x080 +#define INPUT_DEVICE_ID_MATCH_MSCIT 0x100 +#define INPUT_DEVICE_ID_MATCH_LEDBIT 0x200 +#define INPUT_DEVICE_ID_MATCH_SNDBIT 0x400 +#define INPUT_DEVICE_ID_MATCH_FFBIT 0x800 + +#define INPUT_DEVICE_ID_MATCH_DEVICE\ + (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT) +#define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\ + (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION) + +struct input_device_id { + + unsigned long flags; + + unsigned short idbus; + unsigned short idvendor; + unsigned short idproduct; + unsigned short idversion; + + unsigned long evbit[NBITS(EV_MAX)]; + unsigned long keybit[NBITS(KEY_MAX)]; + unsigned long relbit[NBITS(REL_MAX)]; + unsigned long absbit[NBITS(ABS_MAX)]; + unsigned long mscbit[NBITS(MSC_MAX)]; + unsigned long ledbit[NBITS(LED_MAX)]; + unsigned long sndbit[NBITS(SND_MAX)]; + unsigned long ffbit[NBITS(FF_MAX)]; + + unsigned long driver_info; +}; + struct input_handler { void *private; void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); - struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev); + struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id); void (*disconnect)(struct input_handle *handle); struct file_operations *fops; int minor; + char *name; + + struct input_device_id *id_table; struct input_handle *handle; struct input_handler *next; @@ -692,6 +785,7 @@ struct input_handle { void *private; int open; + char *name; struct input_dev *dev; struct input_handler *handler; @@ -709,6 +803,9 @@ void input_unregister_handler(struct inp int input_open_device(struct input_handle *); void input_close_device(struct input_handle *); +int input_accept_process(struct input_handle *handle, struct file *file); +int input_flush_device(struct input_handle* handle, struct file* file); + devfs_handle_t input_register_minor(char *name, int minor, int minor_base); void input_unregister_minor(devfs_handle_t handle); @@ -717,6 +814,8 @@ void input_event(struct input_dev *dev, #define input_report_key(a,b,c) input_event(a, EV_KEY, b, !!(c)) #define input_report_rel(a,b,c) input_event(a, EV_REL, b, c) #define input_report_abs(a,b,c) input_event(a, EV_ABS, b, c) +#define input_report_ff(a,b,c) input_event(a, EV_FF, b, c) +#define input_report_ff_status(a,b,c) input_event(a, EV_FF_STATUS, b, c) #endif #endif |